Rational Developer for Power Systems Software
V7.6

com.ibm.etools.systems.application.visual.editor
Class SystemGraphicalEditor

java.lang.Object
  extended by DiagramDocumentEditor
      extended by com.ibm.etools.systems.application.visual.editor.SystemGraphicalEditor
All Implemented Interfaces:
ISystemGraphicalEditorConstants

public class SystemGraphicalEditor
extends DiagramDocumentEditor
implements ISystemGraphicalEditorConstants

Extensible graphical editor that visualizes the model represented by ApplicationModel. The editor supports three types of input: 1. ApplicationModel instance 2. Application diagram XML file ( .appmdl_diagram ) 3. Application model XML file ( .appmdl )


Field Summary
protected  ApplicationModel applicationModel
           
static String copyright
           
static String EDITOR_ID
           
 
Fields inherited from interface com.ibm.etools.systems.application.visual.editor.ISystemGraphicalEditorConstants
APPLICATION_MODEL_DEFAULT_BASENAME, APPLICATION_MODEL_DEFAULT_DIAGRAMNAME, APPLICATION_MODEL_DEFAULT_MODELNAME, APPLICATION_MODEL_FOLDER, APPLICATION_MODEL_TOPOLOGY_DEFAULTNAME, APPLICATION_SAVE_TEXT_DEFAULT_EXTENSION, APPLICATIONMODEL_MODEL_ID, AUTOEXPAND_THRESHOLD, DEFAULT_GDI_DLL, DEFAULT_MODELELEMENT_FILTER_EXTENSION_ID, DEFAULT_SYSTEM_EDITPART_PROVIDER_ID, EDITPART_PROVIDER_EXTENSION, EDITPART_PROVIDER_EXTENSION_CLASSNAME, EDITPART_PROVIDER_EXTENSION_ID, EDITPART_PROVIDER_EXTENSION_PRIORITY, EXPANSIONSIZE_WARNING_LIMIT, EXTENSION_APPLICATION_DIAGRAM_EXT, EXTENSION_APPLICATION_MODEL_EXT, HIDE_EXPANSION_WARNING, HORIZONTAL, IGNORED_EXCEPTION_WARNING, INTERNAL_ERROR, LINESTYLE_UNKNOWN, MODELELEMENT_FILTER_EXTENSION, MODELELEMENT_FILTER_EXTENSION_FILTERCLASS, MODELELEMENT_FILTER_EXTENSION_ID, MODELELEMENT_FILTER_EXTENSION_MODELSUBTYPES, MODELELEMENT_FILTER_EXTENSION_MODELTYPES, MODELELEMENT_FILTER_EXTENSION_NAME, NONSET, OK, PALETTE_ID_SELECTION, PREFERENCE_AUTOLAYOUT, PREFERENCE_DEFAULTVIEW, PREFERENCE_DLLNAME, PREFERENCE_LINESTYLE, PREFERENCE_ORIENTATION, PREFERENCE_PREREQCHECK, PROPERTIES_PROVIDER_ID, RESOURCE_FAILURE, STATE_ASSOCIATED_CLEAR, STATE_ASSOCIATED_SOURCE, STATE_ASSOCIATED_TARGET, STATE_HOVER, STATE_NONE, STATE_SELECTED, STATE_TARGET, STATE_TARGET_HOVER, SYSTEM_GRAPHICAL_EDITOR_CONTEXT_ID, SYSTEM_GRAPHICAL_EDITOR_CONTEXT_MENU_ID, SYSTEM_GRAPHICAL_EDITOR_ID, SYSTEM_GRAPHICAL_EDITOR_PLUGIN_ID, SYSTEM_GRAPHICAL_EDITOR_VIEW_TYPE, SYSTEM_GRAPHICAL_EDITOR_VIEW_VERSION, VERTICAL, VISUALADAPTER_PROVIDER_EXTENSION, VISUALADAPTER_PROVIDER_EXTENSION_CLASSNAME, VISUALADAPTER_PROVIDER_EXTENSION_ID, VISUALADAPTER_PROVIDER_EXTENSION_PRIORITY
 
Constructor Summary
SystemGraphicalEditor()
          Constructor.
SystemGraphicalEditor(boolean hasFlyOut)
          Constructor.
 
Method Summary
protected  boolean checkModelFileAvailable(IEditorInput fileInput)
          Return true if model file is available, false otherwise.
protected  void configureGraphicalViewer()
           
protected  void deleteTemporaryDiagramFile(SystemGraphicalEditor part)
          Delete temporary diagram file.
 void dispose()
           
protected  void doAutoLayout()
          Do auto layout.
 void doSave(IProgressMonitor progressMonitor)
          Override of doSave method to force a save as if the the model is still being loaded from the temporary file location, instead of being loaded from a proper IFile
 void doSetInput(IEditorInput input, boolean releaseEditorContents)
          Override of doSetInput in order to catch incompatible model format exception and provide migration.
 Object getAdapter(Class type)
           
 ApplicationModel getApplicationModel()
          Return ApplicationModel.
 String getContributorId()
           
protected  IDocumentProvider getDocumentProvider(IEditorInput input)
          Hook method for setting the document provider for the given input.
protected  EditPartFactory getOutlineViewEditPartFactory()
          Get outline view editpart factory.
protected  PreferencesHint getPreferencesHint()
          Gets the preferences hint that will be used to determine which preference store to use when retrieving diagram preferences for this diagram editor.
 SystemGraphicalEditorSessionManager getSessionManager()
          Return SystemGraphicalEditorSessionManager instance.
 boolean getUseAppModelInput()
          Return true if ApplicationModel instance is used as input.
 void init(IEditorSite site, IEditorInput input)
           
protected  void initializeGraphicalViewer()
           
protected  boolean isDiagramFileAvailableForSave(IPath filePath)
          Check if the given file path is available for saving the diagram.
protected  boolean isEditorInputIncludedInContextMenu()
          Sets whether the editor input should be included when adding object contributions to this editor's context menu.
 boolean isSaveAsAllowed()
          Allow SaveAs.
 boolean isUsingInMemoryModel()
          Helper method to determine if the model is loaded from the temporary diagram file or from a proper IFile.
protected  void performSaveAs(IProgressMonitor progressMonitor)
          Performs a save as and reports the result state back to the given progress monitor.
protected  void setDocumentProvider(IEditorInput input)
          Set DocumentProvider.
protected  void setUseAppModelInput(boolean isAppModelInput)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

copyright

public static final String copyright
See Also:
Constant Field Values

EDITOR_ID

public static final String EDITOR_ID
See Also:
Constant Field Values

applicationModel

protected ApplicationModel applicationModel
Constructor Detail

SystemGraphicalEditor

public SystemGraphicalEditor()
Constructor.


SystemGraphicalEditor

public SystemGraphicalEditor(boolean hasFlyOut)
Constructor.

Method Detail

configureGraphicalViewer

protected void configureGraphicalViewer()
See Also:
configureGraphicalViewer is called before initzlizeGraphicalViewer.

isEditorInputIncludedInContextMenu

protected boolean isEditorInputIncludedInContextMenu()
Sets whether the editor input should be included when adding object contributions to this editor's context menu. The default implementation of this method returns FALSE so that no external editor context menu contributions which are related to the editorInput (Run As, Debug As etc) are added by default. Override to return TRUE if you want to allow those external editor context menu contributions.

Returns:
false if the editor input should not be considered.

checkModelFileAvailable

protected boolean checkModelFileAvailable(IEditorInput fileInput)
Return true if model file is available, false otherwise. The model file name is extracted from the associated diagram file nmae.


initializeGraphicalViewer

protected void initializeGraphicalViewer()

doAutoLayout

protected void doAutoLayout()
Do auto layout.


setDocumentProvider

protected void setDocumentProvider(IEditorInput input)
Set DocumentProvider.


setUseAppModelInput

protected void setUseAppModelInput(boolean isAppModelInput)
Parameters:
isAppModelInput -

getUseAppModelInput

public boolean getUseAppModelInput()
Return true if ApplicationModel instance is used as input. False otherwise.


isSaveAsAllowed

public boolean isSaveAsAllowed()
Allow SaveAs.


init

public void init(IEditorSite site,
                 IEditorInput input)
          throws PartInitException
Throws:
PartInitException

getAdapter

public Object getAdapter(Class type)

getApplicationModel

public ApplicationModel getApplicationModel()
Return ApplicationModel.


getSessionManager

public SystemGraphicalEditorSessionManager getSessionManager()
Return SystemGraphicalEditorSessionManager instance.


deleteTemporaryDiagramFile

protected void deleteTemporaryDiagramFile(SystemGraphicalEditor part)
Delete temporary diagram file.


performSaveAs

protected void performSaveAs(IProgressMonitor progressMonitor)
Performs a save as and reports the result state back to the given progress monitor. This default implementation does nothing. Subclasses may reimplement.

Parameters:
progressMonitor - the progress monitor for communicating result state or null

isDiagramFileAvailableForSave

protected boolean isDiagramFileAvailableForSave(IPath filePath)
Check if the given file path is available for saving the diagram. Because diagram and model files are saved in pair, both will be checked.


getDocumentProvider

protected IDocumentProvider getDocumentProvider(IEditorInput input)
Hook method for setting the document provider for the given input. This default implementation does nothing. Clients may reimplement.

Parameters:
input - the input of this editor.

getPreferencesHint

protected PreferencesHint getPreferencesHint()
Gets the preferences hint that will be used to determine which preference store to use when retrieving diagram preferences for this diagram editor. Override to return the preference hint of the system graphical editor.

See Also:
org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor.getPreferencesHint()

getContributorId

public String getContributorId()

getOutlineViewEditPartFactory

protected EditPartFactory getOutlineViewEditPartFactory()
Get outline view editpart factory.


doSave

public void doSave(IProgressMonitor progressMonitor)
Override of doSave method to force a save as if the the model is still being loaded from the temporary file location, instead of being loaded from a proper IFile


isUsingInMemoryModel

public boolean isUsingInMemoryModel()
Helper method to determine if the model is loaded from the temporary diagram file or from a proper IFile.

Returns:
true if the model is loaded from the temporary diagram file, false if it is loaded from an IFile.

dispose

public void dispose()

doSetInput

public void doSetInput(IEditorInput input,
                       boolean releaseEditorContents)
                throws CoreException
Override of doSetInput in order to catch incompatible model format exception and provide migration.

Throws:
CoreException

Rational Developer for Power Systems Software
V7.6

Copyright © 2011 IBM Corp. All Rights Reserved.

Note: This documentation is for part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.