Package de.uni_hildesheim.sse.ui.embed
Class EditorUtils
- java.lang.Object
-
- de.uni_hildesheim.sse.ui.embed.EditorUtils
-
- All Implemented Interfaces:
EditorEmbedderFactory.IEditorCreator,ModelEditorConfigurer.IModelEditorConfigurer
public class EditorUtils extends java.lang.Object implements EditorEmbedderFactory.IEditorCreator, ModelEditorConfigurer.IModelEditorConfigurer
Provides editor utility methods.- Author:
- Holger Eichelberger
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringEXTENSION
-
Constructor Summary
Constructors Constructor Description EditorUtils()Creates an instance (public constructor required by OSGI-DS).
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidactivate(org.osgi.service.component.ComponentContext context)Private method to activate plugin.ModelEditorConfigurer.IHeadercreateHeader(org.eclipse.swt.widgets.Composite parent, Configuration config, java.io.File base, ModelInfo<?> info)Creates the actual header.protected voiddeactivate(org.osgi.service.component.ComponentContext context)Private method to to de-activate plugin.IEmbeddedEditorembedEditor(java.net.URI resourceURI, org.eclipse.swt.widgets.Composite composite)Embeds an editor handling the givenresourceURI.static IEmbeddedEditorembedVilEditor(java.net.URI file, org.eclipse.swt.widgets.Composite parent)Embeds an VIL editor for the given resource into the givenparent.java.lang.StringgetEditorTitle(boolean editable)Returns the editor title.java.lang.StringgetExtension()Returns the file extension to configure fore.AbstractModelChangeListenergetModelChangeListener()Returns the model change listener, e.g., to rebuild the related model on save.intgetOrdinal()Returns an ordinal for sorting model configurers for displying them.java.lang.StringgetPageTitle(boolean editable)Returns the page title.booleanhasHeader()Returns whether the described editor shall have a header.
-
-
-
Method Detail
-
embedVilEditor
public static IEmbeddedEditor embedVilEditor(java.net.URI file, org.eclipse.swt.widgets.Composite parent)
Embeds an VIL editor for the given resource into the givenparent.- Parameters:
file- the file representing the resourceparent- the parent UI component- Returns:
- the embedded editor (or null if embedding failed)
-
activate
protected void activate(org.osgi.service.component.ComponentContext context)
Private method to activate plugin.- Parameters:
context- Context.
-
deactivate
protected void deactivate(org.osgi.service.component.ComponentContext context)
Private method to to de-activate plugin.- Parameters:
context- Context.
-
embedEditor
public IEmbeddedEditor embedEditor(java.net.URI resourceURI, org.eclipse.swt.widgets.Composite composite)
Description copied from interface:EditorEmbedderFactory.IEditorCreatorEmbeds an editor handling the givenresourceURI.- Specified by:
embedEditorin interfaceEditorEmbedderFactory.IEditorCreator- Parameters:
resourceURI- the URI to be handledcomposite- the parent composite to embed the editor into- Returns:
- the embedded editor (or null if embedding failed for some reason)
-
getEditorTitle
public java.lang.String getEditorTitle(boolean editable)
Description copied from interface:ModelEditorConfigurer.IModelEditorConfigurerReturns the editor title.- Specified by:
getEditorTitlein interfaceModelEditorConfigurer.IModelEditorConfigurer- Parameters:
editable- whether the editor is editable- Returns:
- the editor title
-
getPageTitle
public java.lang.String getPageTitle(boolean editable)
Description copied from interface:ModelEditorConfigurer.IModelEditorConfigurerReturns the page title.- Specified by:
getPageTitlein interfaceModelEditorConfigurer.IModelEditorConfigurer- Parameters:
editable- whether the editor is editable- Returns:
- the page title
-
getExtension
public java.lang.String getExtension()
Description copied from interface:ModelEditorConfigurer.IModelEditorConfigurerReturns the file extension to configure fore.- Specified by:
getExtensionin interfaceModelEditorConfigurer.IModelEditorConfigurer- Returns:
- the file extension
-
getOrdinal
public int getOrdinal()
Description copied from interface:ModelEditorConfigurer.IModelEditorConfigurerReturns an ordinal for sorting model configurers for displying them.- Specified by:
getOrdinalin interfaceModelEditorConfigurer.IModelEditorConfigurer- Returns:
- the ordinal
-
hasHeader
public boolean hasHeader()
Description copied from interface:ModelEditorConfigurer.IModelEditorConfigurerReturns whether the described editor shall have a header.- Specified by:
hasHeaderin interfaceModelEditorConfigurer.IModelEditorConfigurer- Returns:
trueif it shall have a header,falseelse
-
createHeader
public ModelEditorConfigurer.IHeader createHeader(org.eclipse.swt.widgets.Composite parent, Configuration config, java.io.File base, ModelInfo<?> info)
Description copied from interface:ModelEditorConfigurer.IModelEditorConfigurerCreates the actual header.- Specified by:
createHeaderin interfaceModelEditorConfigurer.IModelEditorConfigurer- Parameters:
parent- the parent compositeconfig- the recent product line configurationbase- the basic directory of the project we are working ininfo- the actual model being displayed- Returns:
- the header instance
-
getModelChangeListener
public AbstractModelChangeListener getModelChangeListener()
Description copied from interface:ModelEditorConfigurer.IModelEditorConfigurerReturns the model change listener, e.g., to rebuild the related model on save.- Specified by:
getModelChangeListenerin interfaceModelEditorConfigurer.IModelEditorConfigurer- Returns:
- the model change listener or null for none
-
-