be.ac.vub.cocompose.eclipse
Class CoComposeEditor

java.lang.Object
  extended byorg.eclipse.ui.part.WorkbenchPart
      extended byorg.eclipse.ui.part.EditorPart
          extended byorg.eclipse.gef.ui.parts.GraphicalEditor
              extended byorg.eclipse.gef.ui.parts.GraphicalEditorWithPalette
                  extended bybe.ac.vub.cocompose.eclipse.CoComposeEditor
All Implemented Interfaces:
CommandStackListener, IAdaptable, IEditorPart, IExecutableExtension, ISaveablePart, ISelectionListener, IWorkbenchPart

public class CoComposeEditor
extends GraphicalEditorWithPalette

Eclipse editor for CoCompose models.

Since:
0.2.0
Version:
0.2.10, 11/05/2004
Author:
Dennis Wagelaar

Field Summary
protected static int DEFAULT_PALETTE_SIZE
           
protected static String PALETTE_SIZE
           
 
Fields inherited from interface org.eclipse.ui.IEditorPart
PROP_DIRTY, PROP_INPUT
 
Fields inherited from interface org.eclipse.ui.IWorkbenchPart
PROP_TITLE
 
Constructor Summary
CoComposeEditor()
          Creates a CoComposeEditor.
 
Method Summary
protected  void closeEditor(boolean save)
          Closes this editor.
 void commandStackChanged(EventObject event)
           
protected  void configureGraphicalViewer()
           
protected  void configurePaletteViewer()
           
protected  void createActions()
           
 void dispose()
          Frees shared model.
 void doSave(IProgressMonitor monitor)
           
 void doSaveAs()
           
 ActionRegistry getActionRegistry()
           
 Object getAdapter(Class type)
          Extended to return ZoomManager on request.
 KeyHandler getCommonKeyHandler()
          Returns the KeyHandler with common bindings for both the Outline and Graphical Views.
 DefaultEditDomain getEditDomain()
           
 GraphicalViewer getGraphicalViewer()
           
protected  int getInitialPaletteSize()
           
 Model getModel()
          Gets the CoCompose model that is edited.
protected  PaletteRoot getPaletteRoot()
           
 SelectionSynchronizer getSelectionSynchronizer()
           
 String getUri()
          Returns the URI of the file being edited.
 void gotoMarker(IMarker marker)
           
protected  void handlePaletteResized(int newSize)
           
protected  void initializeGraphicalViewer()
           
protected  void initializePaletteViewer()
           
 boolean isDirty()
           
 boolean isSaveAsAllowed()
           
 boolean isSaveOnCloseNeeded()
           
 boolean isSavePreviouslyNeeded()
          Returns whether a save was needed before - isDirty().
protected  void performSave(IProgressMonitor monitor)
          Executes a Save of the model.
protected  boolean performSaveAs()
          Executes a Save As.
 void setInput(IEditorInput input)
           
 void setModel(Model model)
          Sets the CoCompose model that is edited.
 void setSavePreviouslyNeeded(boolean savePrevouslyNeeded)
          Sets whether a save was needed before - isDirty().
protected  void setSite(IWorkbenchPartSite site)
           
protected  void superSetInput(IEditorInput input)
          Invokes super.setInput() and handles adding and removing the ResourceListener.
 
Methods inherited from class org.eclipse.gef.ui.parts.GraphicalEditorWithPalette
createPaletteViewer, createPartControl, getPaletteViewer, hookPaletteViewer, setPaletteViewer
 
Methods inherited from class org.eclipse.gef.ui.parts.GraphicalEditor
createGraphicalViewer, firePropertyChange, getCommandStack, getPropertyActions, getSelectionActions, getStackActions, hookGraphicalViewer, init, initializeActionRegistry, selectionChanged, setActionRegistry, setEditDomain, setFocus, setGraphicalViewer, updateActions
 
Methods inherited from class org.eclipse.ui.part.EditorPart
getEditorInput, getEditorSite, getTitleToolTip
 
Methods inherited from class org.eclipse.ui.part.WorkbenchPart
addPropertyListener, getConfigurationElement, getDefaultImage, getSite, getTitle, getTitleImage, removePropertyListener, setInitializationData, setTitle, setTitleImage, setTitleToolTip
 
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, removePropertyListener
 

Field Detail

PALETTE_SIZE

protected static final String PALETTE_SIZE
See Also:
Constant Field Values

DEFAULT_PALETTE_SIZE

protected static final int DEFAULT_PALETTE_SIZE
See Also:
Constant Field Values
Constructor Detail

CoComposeEditor

public CoComposeEditor()
Creates a CoComposeEditor.

Method Detail

getModel

public Model getModel()
Gets the CoCompose model that is edited.

Returns:
the model.

setModel

public void setModel(Model model)
Sets the CoCompose model that is edited.

Parameters:
model - - the model.

getPaletteRoot

protected PaletteRoot getPaletteRoot()
See Also:
GraphicalEditorWithPalette.getPaletteRoot()

setInput

public void setInput(IEditorInput input)
See Also:
EditorPart.setInput(org.eclipse.ui.IEditorInput)

doSave

public void doSave(IProgressMonitor monitor)
See Also:
ISaveablePart.doSave(org.eclipse.core.runtime.IProgressMonitor)

doSaveAs

public void doSaveAs()
See Also:
ISaveablePart.doSaveAs()

gotoMarker

public void gotoMarker(IMarker marker)
See Also:
IEditorPart.gotoMarker(org.eclipse.core.resources.IMarker)

isDirty

public boolean isDirty()
See Also:
ISaveablePart.isDirty()

isSaveOnCloseNeeded

public boolean isSaveOnCloseNeeded()
See Also:
ISaveablePart.isSaveOnCloseNeeded()

isSaveAsAllowed

public boolean isSaveAsAllowed()
See Also:
ISaveablePart.isSaveAsAllowed()

commandStackChanged

public void commandStackChanged(EventObject event)
See Also:
CommandStackListener.commandStackChanged(java.util.EventObject)

configurePaletteViewer

protected void configurePaletteViewer()
See Also:
GraphicalEditorWithPalette.configurePaletteViewer()

configureGraphicalViewer

protected void configureGraphicalViewer()
See Also:
GraphicalEditor.configureGraphicalViewer()

initializeGraphicalViewer

protected void initializeGraphicalViewer()
See Also:
GraphicalEditor.initializeGraphicalViewer()

initializePaletteViewer

protected void initializePaletteViewer()
See Also:
GraphicalEditorWithPalette.initializePaletteViewer()

createActions

protected void createActions()
See Also:
GraphicalEditor.createActions()

getInitialPaletteSize

protected int getInitialPaletteSize()
See Also:
GraphicalEditorWithPalette.getInitialPaletteSize()

handlePaletteResized

protected void handlePaletteResized(int newSize)
See Also:
GraphicalEditorWithPalette.handlePaletteResized(int)

getAdapter

public Object getAdapter(Class type)
Extended to return ZoomManager on request.

See Also:
IAdaptable.getAdapter(java.lang.Class)

getActionRegistry

public ActionRegistry getActionRegistry()
See Also:
GraphicalEditor.getActionRegistry()

getEditDomain

public DefaultEditDomain getEditDomain()
See Also:
GraphicalEditor.getEditDomain()

getGraphicalViewer

public GraphicalViewer getGraphicalViewer()
See Also:
GraphicalEditor.getGraphicalViewer()

getSelectionSynchronizer

public SelectionSynchronizer getSelectionSynchronizer()
See Also:
GraphicalEditor.getSelectionSynchronizer()

getCommonKeyHandler

public KeyHandler getCommonKeyHandler()
Returns the KeyHandler with common bindings for both the Outline and Graphical Views. For example, delete is a common action.

See Also:
examples.logicdesigner.LogicEditor

performSaveAs

protected boolean performSaveAs()
Executes a Save As.

Returns:
True if the file got written.
See Also:
examples.logicdesigner.LogicEditor

performSave

protected void performSave(IProgressMonitor monitor)
                    throws ClassNotFoundException,
                           IllegalAccessException,
                           InstantiationException,
                           IOException,
                           CoreException,
                           ModelElementException
Executes a Save of the model.

Parameters:
monitor - the progress monitor.
Throws:
ClassNotFoundException - if the ModelWriter could not be retrieved from the settings.
IllegalAccessException - if the ModelWriter class could not be accessed.
InstantiationException - if the ModelWriter class could not be instantiated.
IOException - if there was a file I/O error.
CoreException - if there was a file I/O error.
ModelElementException - if there was an error building the file content.

closeEditor

protected void closeEditor(boolean save)
Closes this editor.

Parameters:
save - saves model if true.
See Also:
examples.logicdesigner.LogicEditor

superSetInput

protected void superSetInput(IEditorInput input)
Invokes super.setInput() and handles adding and removing the ResourceListener.

Parameters:
input - the editor input.
See Also:
examples.logicdesigner.LogicEditor

setSite

protected void setSite(IWorkbenchPartSite site)
See Also:
WorkbenchPart.setSite(org.eclipse.ui.IWorkbenchPartSite)

isSavePreviouslyNeeded

public boolean isSavePreviouslyNeeded()
Returns whether a save was needed before - isDirty().

Returns:
true if a save was needed before.

setSavePreviouslyNeeded

public void setSavePreviouslyNeeded(boolean savePrevouslyNeeded)
Sets whether a save was needed before - isDirty().

Parameters:
savePrevouslyNeeded -

getUri

public String getUri()
Returns the URI of the file being edited. Note that the URI is based on the virtual Eclipse workspace and may not point to a real filesystem path.

Returns:
the URI of the file being edited.

dispose

public void dispose()
Frees shared model.

See Also:
IWorkbenchPart.dispose()