de.upb.swt.epctools.plugin.editor
Class EpctoolsEditor

java.lang.Object
  extended by org.eclipse.core.commands.common.EventManager
      extended by org.eclipse.ui.part.WorkbenchPart
          extended by org.eclipse.ui.part.EditorPart
              extended by de.upb.swt.epctools.plugin.editor.EpctoolsEditor
All Implemented Interfaces:
ModelListener, java.util.EventListener, org.eclipse.core.runtime.IAdaptable, org.eclipse.core.runtime.IExecutableExtension, org.eclipse.gef.commands.CommandStackListener, org.eclipse.ui.IEditorPart, org.eclipse.ui.ISaveablePart, org.eclipse.ui.ISelectionListener, org.eclipse.ui.IWorkbenchPart, org.eclipse.ui.IWorkbenchPart2, org.eclipse.ui.IWorkbenchPart3, org.eclipse.ui.part.IWorkbenchPartOrientation

public class EpctoolsEditor
extends org.eclipse.ui.part.EditorPart
implements org.eclipse.ui.IWorkbenchPart, org.eclipse.gef.commands.CommandStackListener, org.eclipse.ui.ISelectionListener, ModelListener

This class represents an EPC editor based on GEF/Eclipse. This is the main class of the epctools project. Note: GraphicalEditorWithPalette is deprecated.


Nested Class Summary
(package private)  class EpctoolsEditor.Button10Listener
           
(package private)  class EpctoolsEditor.Button1Listener
           
(package private)  class EpctoolsEditor.Button2Listener
           
(package private)  class EpctoolsEditor.Button3Listener
           
(package private)  class EpctoolsEditor.Button4Listener
           
(package private)  class EpctoolsEditor.Button5Listener
           
(package private)  class EpctoolsEditor.Button6Listener
           
(package private)  class EpctoolsEditor.Button7Listener
           
(package private)  class EpctoolsEditor.Button8Listener
           
(package private)  class EpctoolsEditor.Button9Listener
           
(package private)  class EpctoolsEditor.ButtonR1Listener
           
(package private)  class EpctoolsEditor.NextStateAction
           
(package private)  class EpctoolsEditor.ProcessFolderAction
           
 
Field Summary
private  org.eclipse.gef.ui.actions.ActionRegistry m_action_registry
           
(package private)  org.eclipse.swt.widgets.Button m_button_1
           
(package private)  org.eclipse.swt.widgets.Button m_button_10
           
(package private)  org.eclipse.swt.widgets.Button m_button_11
           
(package private)  org.eclipse.swt.widgets.Button m_button_12
           
(package private)  org.eclipse.swt.widgets.Button m_button_2
           
(package private)  org.eclipse.swt.widgets.Button m_button_3
           
(package private)  org.eclipse.swt.widgets.Button m_button_4
           
(package private)  org.eclipse.swt.widgets.Button m_button_5
           
(package private)  org.eclipse.swt.widgets.Button m_button_6
           
(package private)  org.eclipse.swt.widgets.Button m_button_7
           
(package private)  org.eclipse.swt.widgets.Button m_button_8
           
(package private)  org.eclipse.swt.widgets.Button m_button_9
           
private  org.eclipse.gef.DefaultEditDomain m_edit_domain
           
private  EPC m_epc
           
private  org.eclipse.core.resources.IFile m_file
           
private  org.eclipse.gef.GraphicalViewer m_graphical_viewer
           
(package private)  org.eclipse.swt.widgets.Label m_label_1
           
(package private)  org.eclipse.swt.widgets.Label m_label_10
           
(package private)  org.eclipse.swt.widgets.Label m_label_11
           
(package private)  org.eclipse.swt.widgets.Label m_label_2
           
(package private)  org.eclipse.swt.widgets.Label m_label_3
           
(package private)  org.eclipse.swt.widgets.Label m_label_4
           
(package private)  org.eclipse.swt.widgets.Label m_label_5
           
(package private)  org.eclipse.swt.widgets.Label m_label_6
           
(package private)  org.eclipse.swt.widgets.Label m_label_7
           
(package private)  org.eclipse.swt.widgets.Label m_label_8
           
(package private)  org.eclipse.swt.widgets.Label m_label_9
           
private  EpctoolsPaletteRoot m_palette_root
           
private  org.eclipse.gef.ui.palette.PaletteViewer m_palette_viewer
           
private  java.util.List m_property_actions
           
private  boolean m_save_needed
           
private  java.util.List m_selection_actions
           
private  org.eclipse.gef.KeyHandler m_shared_key_handler
           
private  EPCSimulator m_simulator
           
private  java.util.List m_stack_actions
           
private  org.eclipse.gef.ui.parts.SelectionSynchronizer m_synchronizer
           
private  EpctoolsXmlFile m_xml_data
           
private static int PALETTE_HEIGHT
           
private static int PALETTE_WIDTH
           
 
Fields inherited from interface org.eclipse.ui.IWorkbenchPart
PROP_TITLE
 
Fields inherited from interface de.upb.swt.epctools.model.tools.ModelListener
MSG_ARC_ADDED, MSG_ARC_RECONNECTED, MSG_ARC_REMOVED, MSG_BEND_POINT_CHANGE, MSG_CHANGED_ALGORITHM, MSG_CONSTRAINT_CHANGED, MSG_DESCRIPTION_CHANGED, MSG_FOLDERS_CHANGED, MSG_HIGHLIGHTING_CHANGED, MSG_IN_ARC_ADDED, MSG_IN_ARC_REMOVED, MSG_INFO_CHANGED, MSG_LOCATION_CHANGED, MSG_NAME_CHANGED, MSG_NODE_ADDED, MSG_NODE_REMOVED, MSG_OUT_ARC_ADDED, MSG_OUT_ARC_REMOVED, MSG_SIZE_CHANGED, MSG_SOURCE_CHANGED, MSG_STRUCTURE_CHANGED, MSG_TARGET_CHANGED
 
Fields inherited from interface org.eclipse.ui.IEditorPart
PROP_DIRTY, PROP_INPUT
 
Constructor Summary
EpctoolsEditor()
          Main editor initialization
 
Method Summary
 void commandStackChanged(java.util.EventObject event)
           
protected  void configureGraphicalViewer()
           
protected  void createActions()
           
protected  void createGraphicalViewer(org.eclipse.swt.widgets.Composite parent)
          This function creates the GraphicalViewer on the specified Composite.
protected  void createPaletteViewer(org.eclipse.swt.widgets.Composite parent)
           
 void createPartControl(org.eclipse.swt.widgets.Composite parent)
           
 void dispose()
           
 void doSave(org.eclipse.core.runtime.IProgressMonitor monitor)
           
 void doSaveAs()
           
protected  void firePropertyChange(int property)
           
protected  org.eclipse.gef.ui.actions.ActionRegistry getActionRegistry()
          This function lazily creates and returns the action registry.
 java.lang.Object getAdapter(java.lang.Class type)
          Returns the adapter for the specified key.
protected  org.eclipse.gef.commands.CommandStack getCommandStack()
          Returns the command stack.
protected  org.eclipse.gef.KeyHandler getCommonKeyHandler()
           
protected  org.eclipse.gef.DefaultEditDomain getEditDomain()
          Returns the edit domain.
protected  org.eclipse.gef.GraphicalViewer getGraphicalViewer()
          Returns the graphical viewer.
 void getMessage(int msg_id)
          This method is called upon changes on the model object.
protected  java.util.List getPropertyActions()
          Returns the list of IActions dependant on property changes in the Editor.
protected  java.util.List getSelectionActions()
          Returns the list of IActions dependant on changes in the workbench's ISelectionService.
protected  org.eclipse.gef.ui.parts.SelectionSynchronizer getSelectionSynchronizer()
          Returns the selection syncronizer object.
protected  java.util.List getStackActions()
          Returns the list of IActions dependant on the CommmandStack's state.
 void gotoMarker(org.eclipse.core.resources.IMarker marker)
           
protected  void hookGraphicalViewer()
          This function hooks the GraphicalViewer to the rest of the Editor.
 void init(org.eclipse.ui.IEditorSite site, org.eclipse.ui.IEditorInput input)
           
protected  void initializeActionRegistry()
          This function initializes the ActionRegistry.
protected  void initializeGraphicalViewer()
           
 boolean isDirty()
           
 boolean isSaveAsAllowed()
           
 void repaintInformation()
           
 void selectionChanged(org.eclipse.ui.IWorkbenchPart part, org.eclipse.jface.viewers.ISelection selection)
           
protected  void setActionRegistry(org.eclipse.gef.ui.actions.ActionRegistry registry)
          This function sets the ActionRegistry for this EditorPart.
protected  void setEditDomain(org.eclipse.gef.DefaultEditDomain ed)
          Sets the EditDomain for this EditorPart.
 void setFocus()
           
protected  void setGraphicalViewer(org.eclipse.gef.GraphicalViewer viewer)
          This function sets the graphicalViewer for this EditorPart.
protected  void updateActions(java.util.List actionIds)
          This function is a convenience method for updating a set of actions defined by the given List of action IDs.
 
Methods inherited from class org.eclipse.ui.part.EditorPart
checkSite, getEditorInput, getEditorSite, getTitleToolTip, isSaveOnCloseNeeded, setContentDescription, setInitializationData, setInput, setInputWithNotify, setPartName
 
Methods inherited from class org.eclipse.ui.part.WorkbenchPart
addPartPropertyListener, addPropertyListener, firePartPropertyChanged, getConfigurationElement, getContentDescription, getDefaultImage, getOrientation, getPartName, getPartProperties, getPartProperty, getSite, getTitle, getTitleImage, removePartPropertyListener, removePropertyListener, setPartProperty, setSite, setTitle, setTitleImage, setTitleToolTip, showBusy
 
Methods inherited from class org.eclipse.core.commands.common.EventManager
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.ui.IWorkbenchPart
addPropertyListener, getSite, getTitle, getTitleImage, getTitleToolTip, removePropertyListener
 

Field Detail

m_epc

private EPC m_epc

m_simulator

private EPCSimulator m_simulator

m_xml_data

private EpctoolsXmlFile m_xml_data

m_file

private org.eclipse.core.resources.IFile m_file

m_palette_viewer

private org.eclipse.gef.ui.palette.PaletteViewer m_palette_viewer

m_palette_root

private EpctoolsPaletteRoot m_palette_root

m_shared_key_handler

private org.eclipse.gef.KeyHandler m_shared_key_handler

m_edit_domain

private org.eclipse.gef.DefaultEditDomain m_edit_domain

m_graphical_viewer

private org.eclipse.gef.GraphicalViewer m_graphical_viewer

m_action_registry

private org.eclipse.gef.ui.actions.ActionRegistry m_action_registry

m_synchronizer

private org.eclipse.gef.ui.parts.SelectionSynchronizer m_synchronizer

m_selection_actions

private java.util.List m_selection_actions

m_stack_actions

private java.util.List m_stack_actions

m_property_actions

private java.util.List m_property_actions

m_button_1

org.eclipse.swt.widgets.Button m_button_1

m_button_2

org.eclipse.swt.widgets.Button m_button_2

m_button_3

org.eclipse.swt.widgets.Button m_button_3

m_button_4

org.eclipse.swt.widgets.Button m_button_4

m_button_5

org.eclipse.swt.widgets.Button m_button_5

m_button_6

org.eclipse.swt.widgets.Button m_button_6

m_button_7

org.eclipse.swt.widgets.Button m_button_7

m_button_8

org.eclipse.swt.widgets.Button m_button_8

m_button_9

org.eclipse.swt.widgets.Button m_button_9

m_button_10

org.eclipse.swt.widgets.Button m_button_10

m_button_11

org.eclipse.swt.widgets.Button m_button_11

m_button_12

org.eclipse.swt.widgets.Button m_button_12

m_label_1

org.eclipse.swt.widgets.Label m_label_1

m_label_2

org.eclipse.swt.widgets.Label m_label_2

m_label_3

org.eclipse.swt.widgets.Label m_label_3

m_label_4

org.eclipse.swt.widgets.Label m_label_4

m_label_5

org.eclipse.swt.widgets.Label m_label_5

m_label_6

org.eclipse.swt.widgets.Label m_label_6

m_label_7

org.eclipse.swt.widgets.Label m_label_7

m_label_8

org.eclipse.swt.widgets.Label m_label_8

m_label_9

org.eclipse.swt.widgets.Label m_label_9

m_label_10

org.eclipse.swt.widgets.Label m_label_10

m_label_11

org.eclipse.swt.widgets.Label m_label_11

m_save_needed

private boolean m_save_needed

PALETTE_WIDTH

private static final int PALETTE_WIDTH
See Also:
Constant Field Values

PALETTE_HEIGHT

private static final int PALETTE_HEIGHT
See Also:
Constant Field Values
Constructor Detail

EpctoolsEditor

public EpctoolsEditor()
Main editor initialization

Method Detail

getMessage

public void getMessage(int msg_id)
This method is called upon changes on the model object. Depending on the given message, certain actions are performed, e.g. refreshing the visuals.

Specified by:
getMessage in interface ModelListener
Parameters:
msg_id - Message id

repaintInformation

public void repaintInformation()

init

public void init(org.eclipse.ui.IEditorSite site,
                 org.eclipse.ui.IEditorInput input)
          throws org.eclipse.ui.PartInitException
Specified by:
init in interface org.eclipse.ui.IEditorPart
Specified by:
init in class org.eclipse.ui.part.EditorPart
Throws:
org.eclipse.ui.PartInitException

initializeGraphicalViewer

protected void initializeGraphicalViewer()

doSave

public void doSave(org.eclipse.core.runtime.IProgressMonitor monitor)
Specified by:
doSave in interface org.eclipse.ui.ISaveablePart
Specified by:
doSave in class org.eclipse.ui.part.EditorPart

doSaveAs

public void doSaveAs()
Specified by:
doSaveAs in interface org.eclipse.ui.ISaveablePart
Specified by:
doSaveAs in class org.eclipse.ui.part.EditorPart

gotoMarker

public void gotoMarker(org.eclipse.core.resources.IMarker marker)

isDirty

public boolean isDirty()
Specified by:
isDirty in interface org.eclipse.ui.ISaveablePart
Specified by:
isDirty in class org.eclipse.ui.part.EditorPart

commandStackChanged

public void commandStackChanged(java.util.EventObject event)
Specified by:
commandStackChanged in interface org.eclipse.gef.commands.CommandStackListener

isSaveAsAllowed

public boolean isSaveAsAllowed()
Specified by:
isSaveAsAllowed in interface org.eclipse.ui.ISaveablePart
Specified by:
isSaveAsAllowed in class org.eclipse.ui.part.EditorPart

configureGraphicalViewer

protected void configureGraphicalViewer()

getCommonKeyHandler

protected org.eclipse.gef.KeyHandler getCommonKeyHandler()

createActions

protected void createActions()

createPaletteViewer

protected void createPaletteViewer(org.eclipse.swt.widgets.Composite parent)

createGraphicalViewer

protected void createGraphicalViewer(org.eclipse.swt.widgets.Composite parent)
This function creates the GraphicalViewer on the specified Composite.

Parameters:
parent - the parent composite

createPartControl

public void createPartControl(org.eclipse.swt.widgets.Composite parent)
Specified by:
createPartControl in interface org.eclipse.ui.IWorkbenchPart
Specified by:
createPartControl in class org.eclipse.ui.part.WorkbenchPart

dispose

public void dispose()
Specified by:
dispose in interface org.eclipse.ui.IWorkbenchPart
Overrides:
dispose in class org.eclipse.ui.part.WorkbenchPart
See Also:
IWorkbenchPart.dispose()

firePropertyChange

protected void firePropertyChange(int property)
Overrides:
firePropertyChange in class org.eclipse.ui.part.WorkbenchPart

getActionRegistry

protected org.eclipse.gef.ui.actions.ActionRegistry getActionRegistry()
This function lazily creates and returns the action registry.

Returns:
the action registry

getAdapter

public java.lang.Object getAdapter(java.lang.Class type)
Returns the adapter for the specified key.

IMPORTANT certain requests, such as the property sheet, may be made before or after createPartControl(Composite) is called. The order is unspecified by the Workbench.

Specified by:
getAdapter in interface org.eclipse.core.runtime.IAdaptable
Overrides:
getAdapter in class org.eclipse.ui.part.WorkbenchPart
See Also:
IAdaptable.getAdapter(java.lang.Class)

getCommandStack

protected org.eclipse.gef.commands.CommandStack getCommandStack()
Returns the command stack.

Returns:
the command stack

getEditDomain

protected org.eclipse.gef.DefaultEditDomain getEditDomain()
Returns the edit domain.

Returns:
the edit domain

getGraphicalViewer

protected org.eclipse.gef.GraphicalViewer getGraphicalViewer()
Returns the graphical viewer.

Returns:
the graphical viewer

getPropertyActions

protected java.util.List getPropertyActions()
Returns the list of IActions dependant on property changes in the Editor. These actions should implement the UpdateAction interface so that they can be updated in response to property changes. An example is the "Save" action.

Returns:
the list of property-dependant actions

getSelectionActions

protected java.util.List getSelectionActions()
Returns the list of IActions dependant on changes in the workbench's ISelectionService. These actions should implement the UpdateAction interface so that they can be updated in response to selection changes. An example is the Delete action.

Returns:
the list of selection-dependant actions

getSelectionSynchronizer

protected org.eclipse.gef.ui.parts.SelectionSynchronizer getSelectionSynchronizer()
Returns the selection syncronizer object. The synchronizer can be used to sync the selection of 2 or more EditPartViewers.

Returns:
the syncrhonizer

getStackActions

protected java.util.List getStackActions()
Returns the list of IActions dependant on the CommmandStack's state. These actions should implement the UpdateAction interface so that they can be updated in response to command stack changes. An example is the "undo" action.

Returns:
the list of stack-dependant actions

hookGraphicalViewer

protected void hookGraphicalViewer()
This function hooks the GraphicalViewer to the rest of the Editor. By default, the viewer is added to the SelectionSynchronizer, which can be used to keep 2 or more EditPartViewers in sync. The viewer is also registered as the ISelectionProvider for the Editor's PartSite.


initializeActionRegistry

protected void initializeActionRegistry()
This function initializes the ActionRegistry. This registry may be used by ActionBarContributors and/or ContextMenuProviders.

This method may be called on Editor creation, or lazily the first time getActionRegistry() is called.


selectionChanged

public void selectionChanged(org.eclipse.ui.IWorkbenchPart part,
                             org.eclipse.jface.viewers.ISelection selection)
Specified by:
selectionChanged in interface org.eclipse.ui.ISelectionListener
See Also:
ISelectionListener.selectionChanged(IWorkbenchPart, ISelection)

setActionRegistry

protected void setActionRegistry(org.eclipse.gef.ui.actions.ActionRegistry registry)
This function sets the ActionRegistry for this EditorPart.

Parameters:
registry - the registry

setEditDomain

protected void setEditDomain(org.eclipse.gef.DefaultEditDomain ed)
Sets the EditDomain for this EditorPart.

Parameters:
ed - the domain

setFocus

public void setFocus()
Specified by:
setFocus in interface org.eclipse.ui.IWorkbenchPart
Specified by:
setFocus in class org.eclipse.ui.part.WorkbenchPart
See Also:
IWorkbenchPart.setFocus()

setGraphicalViewer

protected void setGraphicalViewer(org.eclipse.gef.GraphicalViewer viewer)
This function sets the graphicalViewer for this EditorPart.

Parameters:
viewer - the graphical viewer

updateActions

protected void updateActions(java.util.List actionIds)
This function is a convenience method for updating a set of actions defined by the given List of action IDs. The actions are found by looking up the ID in the action registry. If the corresponding action is an UpdateAction, it will have its update() method called.

Parameters:
actionIds - the list of IDs to update