Class AbstractIdeEclipseEditor<R extends Model,RE extends java.lang.Enum<RE>,O>
- java.lang.Object
-
- org.eclipse.core.commands.common.EventManager
-
- org.eclipse.ui.part.WorkbenchPart
-
- org.eclipse.ui.part.EditorPart
-
- org.eclipse.gef.mvc.fx.ui.parts.AbstractFXEditor
-
- net.officefloor.eclipse.ide.editor.AbstractIdeEclipseEditor<R,RE,O>
-
- All Implemented Interfaces:
org.eclipse.core.runtime.IAdaptable
,org.eclipse.core.runtime.IExecutableExtension
,org.eclipse.ui.IEditorPart
,org.eclipse.ui.ISaveablePart
,org.eclipse.ui.IWorkbenchPart
,org.eclipse.ui.IWorkbenchPart2
,org.eclipse.ui.IWorkbenchPart3
,org.eclipse.ui.part.IWorkbenchPartOrientation
- Direct Known Subclasses:
SectionEditor
,WoofEditor
public abstract class AbstractIdeEclipseEditor<R extends Model,RE extends java.lang.Enum<RE>,O> extends org.eclipse.gef.mvc.fx.ui.parts.AbstractFXEditor
OfficeFloorModel
editor.- Author:
- Daniel Sagenschneider
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
AbstractIdeEclipseEditor.OutsideWorkbenchLauncher
Logic to launch outside theIWorkbench
.
-
Constructor Summary
Constructors Modifier Constructor Description AbstractIdeEclipseEditor(java.lang.Class<R> rootModelType, java.util.function.Function<R,O> createOperations)
Instantiate with defaultAdaptedEditorModule
.protected
AbstractIdeEclipseEditor(AdaptedEditorModule module, java.lang.Class<R> rootModelType, java.util.function.Function<R,O> createOperations)
Instantiate to captureAdaptedEditorModule
.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
activate()
O
createOperations(R model)
Creates the operations for the rootModel
.void
dispose()
void
doSave(org.eclipse.core.runtime.IProgressMonitor monitor)
void
doSaveAs()
java.lang.String
editorStyle()
Allows overriding the editor styling.abstract java.lang.String
fileName()
Obtains the default file name for the editor.javafx.embed.swt.FXCanvas
getCanvas()
org.eclipse.gef.mvc.fx.viewer.IViewer
getContentViewer()
java.lang.String
getEditorStyleId()
Obtains theIPreferenceStore
identifier for the editor styling.protected OfficeFloorOsgiBridge
getOsgiBridge()
Obtains theOfficeFloorOsgiBridge
.java.lang.String
getPaletteIndicatorStyleId()
Obtains theIPreferenceStore
identifier for the palette indicator styling.java.lang.String
getPaletteStyleId()
Obtains theIPreferenceStore
identifier for the palette styling.AbstractConfigurableItem<R,RE,O,?,?,?>[]
getParents()
Obtains theAbstractConfigurableItem
instances.protected void
hookViewers()
protected void
init(AbstractItem.ConfigurableContext<R,O> context)
Allows overriding to initialise theAbstractIdeEclipseEditor
.boolean
isSaveAsAllowed()
static void
launch(java.io.File configurationFile)
Convenience method to launch theAbstractIdeEclipseEditor
implementation outside theIWorkbench
.static void
launch(java.lang.String configuration)
Convenience method to launch theAbstractIdeEclipseEditor
implementation outside theIWorkbench
.static void
launchOutsideWorkbench(AbstractIdeEclipseEditor.OutsideWorkbenchLauncher launcher)
Enables running theAbstractIdeEclipseEditor
outside of theIWorkbench
.protected abstract void
loadParents(java.util.List<AbstractConfigurableItem<R,RE,O,?,?,?>> parents)
Loads theAbstractConfigurableItem
instances.protected abstract R
loadRootModel(ConfigurationItem configurationItem)
Creates the rootModel
from theConfigurationItem
.java.lang.String
paletteIndicatorStyle()
Allows overriding the palette indicator styling.java.lang.String
paletteStyle()
Allows overriding the palette styling.abstract R
prototype()
Obtains root prototype.abstract void
saveRootModel(R model, WritableConfigurationItem configurationItem)
Writes the rootModel
to theWritableConfigurationItem
.protected void
setInput(org.eclipse.ui.IEditorInput input)
void
setSelectOnly(SelectOnly selectOnly)
Instantiate.protected void
setSite(org.eclipse.ui.IWorkbenchPartSite site)
static java.lang.String
translateStyle(java.lang.String rawStyle, AbstractItem<?,?,?,?,?,?> item)
Translates the style with the details of the item being rendered.-
Methods inherited from class org.eclipse.gef.mvc.fx.ui.parts.AbstractFXEditor
createActions, createPartControl, deactivate, disposeActions, getAdapter, getDomain, init, isDirty, markNonDirty, setFocus, unhookViewers
-
Methods inherited from class org.eclipse.ui.part.EditorPart
checkSite, getEditorInput, getEditorSite, getTitleToolTip, isSaveOnCloseNeeded, setContentDescription, setInitializationData, setInputWithNotify, setPartName
-
Methods inherited from class org.eclipse.ui.part.WorkbenchPart
addPartPropertyListener, addPropertyListener, firePartPropertyChanged, firePropertyChange, getConfigurationElement, getContentDescription, getDefaultImage, getOrientation, getPartName, getPartProperties, getPartProperty, getSite, getTitle, getTitleImage, removePartPropertyListener, removePropertyListener, setPartProperty, setTitle, setTitleImage, setTitleToolTip, showBusy
-
Methods inherited from class org.eclipse.core.commands.common.EventManager
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
-
-
-
-
Constructor Detail
-
AbstractIdeEclipseEditor
protected AbstractIdeEclipseEditor(AdaptedEditorModule module, java.lang.Class<R> rootModelType, java.util.function.Function<R,O> createOperations)
Instantiate to capture
AdaptedEditorModule
.Allows for alternate
AdaptedEditorModule
implementation.- Parameters:
module
-AdaptedEditorModule
.rootModelType
- RootModel
type.createOperations
-Function
to create the operations from the rootModel
.
-
AbstractIdeEclipseEditor
public AbstractIdeEclipseEditor(java.lang.Class<R> rootModelType, java.util.function.Function<R,O> createOperations)
Instantiate with defaultAdaptedEditorModule
.
-
-
Method Detail
-
translateStyle
public static java.lang.String translateStyle(java.lang.String rawStyle, AbstractItem<?,?,?,?,?,?> item)
Translates the style with the details of the item being rendered.- Parameters:
rawStyle
- Raw style to be translated.item
-AbstractItem
.- Returns:
- Ready to use translate.
-
launchOutsideWorkbench
public static void launchOutsideWorkbench(AbstractIdeEclipseEditor.OutsideWorkbenchLauncher launcher)
Enables running theAbstractIdeEclipseEditor
outside of theIWorkbench
.- Parameters:
launcher
-AbstractIdeEclipseEditor.OutsideWorkbenchLauncher
.
-
launch
public static void launch(java.io.File configurationFile)
Convenience method to launch theAbstractIdeEclipseEditor
implementation outside theIWorkbench
.- Parameters:
configurationFile
-File
containing the configuration.
-
launch
public static void launch(java.lang.String configuration)
Convenience method to launch theAbstractIdeEclipseEditor
implementation outside theIWorkbench
.- Parameters:
configuration
- Configuration ofConfigurationItem
to launch theAbstractIdeEclipseEditor
.
-
getPaletteIndicatorStyleId
public java.lang.String getPaletteIndicatorStyleId()
Obtains theIPreferenceStore
identifier for the palette indicator styling.- Returns:
IPreferenceStore
identifier for the palette indicator styling.
-
getPaletteStyleId
public java.lang.String getPaletteStyleId()
Obtains theIPreferenceStore
identifier for the palette styling.- Returns:
IPreferenceStore
identifier for the palette styling.
-
getEditorStyleId
public java.lang.String getEditorStyleId()
Obtains theIPreferenceStore
identifier for the editor styling.- Returns:
IPreferenceStore
identifier for the editor styling.
-
setSelectOnly
public void setSelectOnly(SelectOnly selectOnly)
Instantiate.- Parameters:
selectOnly
-SelectOnly
.
-
init
protected void init(AbstractItem.ConfigurableContext<R,O> context)
Allows overriding to initialise theAbstractIdeEclipseEditor
.- Parameters:
context
-AbstractItem.ConfigurableContext
.
-
getParents
public final AbstractConfigurableItem<R,RE,O,?,?,?>[] getParents()
Obtains theAbstractConfigurableItem
instances.- Returns:
AbstractConfigurableItem
instances.
-
fileName
public abstract java.lang.String fileName()
Obtains the default file name for the editor.- Returns:
- Default file name for the editor.
- See Also:
AbstractNewWizard
-
prototype
public abstract R prototype()
Obtains root prototype.- Returns:
- Root prototype.
-
loadParents
protected abstract void loadParents(java.util.List<AbstractConfigurableItem<R,RE,O,?,?,?>> parents)
Loads theAbstractConfigurableItem
instances.- Parameters:
parents
-List
to be populated with theAbstractConfigurableItem
instances.
-
loadRootModel
protected abstract R loadRootModel(ConfigurationItem configurationItem) throws java.lang.Exception
Creates the rootModel
from theConfigurationItem
.- Parameters:
configurationItem
-ConfigurationItem
containing the configuration of theModel
.- Returns:
- Root
Model
within theConfigurationItem
. - Throws:
java.lang.Exception
- If fails to load the rootModel
from theConfigurationItem
.
-
saveRootModel
public abstract void saveRootModel(R model, WritableConfigurationItem configurationItem) throws java.lang.Exception
Writes the rootModel
to theWritableConfigurationItem
.- Parameters:
model
- RootModel
to be saved.configurationItem
-WritableConfigurationItem
.- Throws:
java.lang.Exception
- If fails to save the rootModel
into theWritableConfigurationItem
.
-
paletteStyle
public java.lang.String paletteStyle()
Allows overriding the palette styling.- Returns:
- Palette styling. May be
null
for default styling.
-
paletteIndicatorStyle
public java.lang.String paletteIndicatorStyle()
Allows overriding the palette indicator styling.- Returns:
- Palette indicator styling. May be
null
for default styling.
-
editorStyle
public java.lang.String editorStyle()
Allows overriding the editor styling.- Returns:
- Editor styling. May be
null
for defaulting styling.
-
createOperations
public O createOperations(R model)
Creates the operations for the rootModel
.- Parameters:
model
- RootModel
.- Returns:
- Operations.
-
getOsgiBridge
protected final OfficeFloorOsgiBridge getOsgiBridge() throws java.lang.Exception
Obtains theOfficeFloorOsgiBridge
.- Returns:
OfficeFloorOsgiBridge
.- Throws:
java.lang.Exception
- If fails to obtain theOfficeFloorOsgiBridge
.
-
getCanvas
public javafx.embed.swt.FXCanvas getCanvas()
- Overrides:
getCanvas
in classorg.eclipse.gef.mvc.fx.ui.parts.AbstractFXEditor
-
getContentViewer
public final org.eclipse.gef.mvc.fx.viewer.IViewer getContentViewer()
- Overrides:
getContentViewer
in classorg.eclipse.gef.mvc.fx.ui.parts.AbstractFXEditor
-
hookViewers
protected final void hookViewers()
- Overrides:
hookViewers
in classorg.eclipse.gef.mvc.fx.ui.parts.AbstractFXEditor
-
activate
protected final void activate()
- Overrides:
activate
in classorg.eclipse.gef.mvc.fx.ui.parts.AbstractFXEditor
-
setInput
protected final void setInput(org.eclipse.ui.IEditorInput input)
- Overrides:
setInput
in classorg.eclipse.ui.part.EditorPart
-
setSite
protected final void setSite(org.eclipse.ui.IWorkbenchPartSite site)
- Overrides:
setSite
in classorg.eclipse.ui.part.WorkbenchPart
-
doSave
public final void doSave(org.eclipse.core.runtime.IProgressMonitor monitor)
- Specified by:
doSave
in interfaceorg.eclipse.ui.ISaveablePart
- Specified by:
doSave
in classorg.eclipse.ui.part.EditorPart
-
isSaveAsAllowed
public boolean isSaveAsAllowed()
- Specified by:
isSaveAsAllowed
in interfaceorg.eclipse.ui.ISaveablePart
- Specified by:
isSaveAsAllowed
in classorg.eclipse.ui.part.EditorPart
-
doSaveAs
public void doSaveAs()
- Specified by:
doSaveAs
in interfaceorg.eclipse.ui.ISaveablePart
- Specified by:
doSaveAs
in classorg.eclipse.ui.part.EditorPart
-
dispose
public void dispose()
- Specified by:
dispose
in interfaceorg.eclipse.ui.IWorkbenchPart
- Overrides:
dispose
in classorg.eclipse.gef.mvc.fx.ui.parts.AbstractFXEditor
-
-