Xj3D 2.0 VRML/X3D Code API

org.xj3d.ui.swt.widgets
Class OpenAction

java.lang.Object
  extended by org.xj3d.ui.swt.widgets.OpenAction
All Implemented Interfaces:
java.lang.Runnable, java.util.EventListener, org.eclipse.swt.events.SelectionListener, org.eclipse.swt.internal.SWTEventListener

public class OpenAction
extends java.lang.Object
implements org.eclipse.swt.events.SelectionListener, java.lang.Runnable

A Selection handler used to select a file from the local system, then pass the file's url along to a file handler for loading.

Version:
$Revision: 1.3 $
Author:
Rex Melton

Constructor Summary
OpenAction(org.eclipse.swt.widgets.Shell shell, FileHandler handler, java.lang.String contentDirectory)
          Create an instance of the open selection handler.
 
Method Summary
 void run()
          Get the URL String and call the file handler to load
 void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent se)
          Process the default selection generated from the user interface.
 void widgetSelected(org.eclipse.swt.events.SelectionEvent se)
          A selection has been performed that requires opening a file dialog to allow the user the opportunity to select the file to load.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OpenAction

public OpenAction(org.eclipse.swt.widgets.Shell shell,
                  FileHandler handler,
                  java.lang.String contentDirectory)
Create an instance of the open selection handler.

Parameters:
shell - - The parent shell
handler - - A handler for opening files
contentDirectory - - The initial directory to load content from. Must be a full path.
Method Detail

widgetSelected

public void widgetSelected(org.eclipse.swt.events.SelectionEvent se)
A selection has been performed that requires opening a file dialog to allow the user the opportunity to select the file to load. If a valid file selection has been made, check that it exists in the local file system, then forward it's URL to the file handler for loading.

Specified by:
widgetSelected in interface org.eclipse.swt.events.SelectionListener
Parameters:
se - - The event that caused this method to be called

widgetDefaultSelected

public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent se)
Process the default selection generated from the user interface. Ignored.

Specified by:
widgetDefaultSelected in interface org.eclipse.swt.events.SelectionListener
Parameters:
se - - The event that caused this method to be called

run

public void run()
Get the URL String and call the file handler to load

Specified by:
run in interface java.lang.Runnable

Xj3D 2.0 VRML/X3D Code API

Copyright © 2001 - 2006 Web3D Consortium