Skip to content
Snippets Groups Projects
Commit 61736b6a authored by Florian Hölzl's avatar Florian Hölzl
Browse files

ExtendableMultiPageEditor is returned as IModelEditor if it is the active...

ExtendableMultiPageEditor is returned as IModelEditor if it is the active editor (and no sub-editor is instance of IModelEditor).
refs 331
parent 454ec493
No related branches found
No related tags found
No related merge requests found
......@@ -26,11 +26,9 @@ import org.eclipse.ui.IEditorPart;
* @author hoelzl
* @author $Author$
* @version $Rev$
* @ConQAT.Rating RED Hash:
* @ConQAT.Rating YELLOW Hash: F0A94041C50D164FB6A321C68DB038D5
*/
public interface IModelEditor<T extends EObject> extends IEditorPart {
// FIXME (FH): define
/** Returns the edited object. */
T getEditedObject();
......@@ -39,5 +37,4 @@ public interface IModelEditor<T extends EObject> extends IEditorPart {
/** Clears all highlightings from the editor. */
void clearAllHighlights();
}
......@@ -52,7 +52,7 @@ import org.fortiss.tooling.kernel.utils.ModelElementUtils;
* @author hoelzl
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash: D719F4D54DBF1707B1BE0B6FEA65624A
* @ConQAT.Rating YELLOW Hash: 3B1883C7F53B739120A1E2B507BCB8AB
*/
public class ModelEditorBindingService extends
EObjectAwareServiceBase<IModelEditorBinding<EObject>> implements
......@@ -259,9 +259,14 @@ public class ModelEditorBindingService extends
IEditorPart activeEditor = PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getActivePage().getActiveEditor();
if (activeEditor instanceof ExtendableMultiPageEditor) {
return ((ExtendableMultiPageEditor) activeEditor)
.getActiveModelEditor();
} else if (activeEditor instanceof IModelEditor) {
ExtendableMultiPageEditor extEditor = (ExtendableMultiPageEditor) activeEditor;
IModelEditor<EObject> inner = extEditor.getActiveModelEditor();
if (inner != null) {
return inner;
}
return extEditor;
}
if (activeEditor instanceof IModelEditor) {
return (IModelEditor<EObject>) activeEditor;
}
return null;
......
......@@ -61,8 +61,7 @@ import org.fortiss.tooling.kernel.ui.util.PropertiesConstantUtils;
*/
public class ExtendableMultiPageEditor extends MultiPageEditorPart implements
ITabbedPropertySheetPageContributor, CommandStackListener,
ISaveablePart {
ISaveablePart, IModelEditor<EObject> {
/** The editor's ID. */
public static String ID = ExtendableMultiPageEditor.class.getName();
......@@ -278,4 +277,32 @@ public class ExtendableMultiPageEditor extends MultiPageEditorPart implements
}
return null;
}
/** {@inheritDoc} */
@Override
public EObject getEditedObject() {
return editedObject;
}
/** {@inheritDoc} */
@SuppressWarnings("rawtypes")
@Override
public void setHighlight(EObject element, boolean highlighted) {
// delegate to active editor
IEditorPart part = getActiveEditor();
if (part instanceof IModelEditor) {
((IModelEditor) part).setHighlight(element, highlighted);
}
}
/** {@inheritDoc} */
@SuppressWarnings("rawtypes")
@Override
public void clearAllHighlights() {
// delegate to active editor
IEditorPart part = getActiveEditor();
if (part instanceof IModelEditor) {
((IModelEditor) part).clearAllHighlights();
}
}
}
......@@ -33,7 +33,7 @@ import org.fortiss.tooling.kernel.ui.internal.ModelEditorBindingService;
* @author hoelzl
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash: 8EFBD4397AB482FDAAD1F96749BBEAE0
* @ConQAT.Rating YELLOW Hash: 575EDF6DF5A306410AC134948FAF6D8D
*/
public interface IModelEditorBindingService {
......@@ -46,7 +46,7 @@ public interface IModelEditorBindingService {
/** Closes editors which depend on the given element or a sub-element. */
void closeEditors(EObject parentElement);
/** Returns the currently editor. */
/** Returns the currently active editor. */
IModelEditor<EObject> getActiveEditor();
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment