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

added enable mechanism for library view from editors.

refs 426
parent e675bd46
No related branches found
No related tags found
No related merge requests found
......@@ -33,12 +33,14 @@ import org.eclipse.ui.forms.widgets.Section;
import org.fortiss.tooling.kernel.ui.extension.base.EditorBase;
/**
* Basic GEF editor based on forms.
* Basic editor based on forms.
* <p>
* This editor disables the library view.
*
* @author ratiu
* @author $Author: hoelzl $
* @version $Rev: 18709 $
* @ConQAT.Rating YELLOW Hash: 59FD8F82856ABF18DD742AEB9A1D313C
* @ConQAT.Rating YELLOW Hash: 77237937DC7CBA4AA9BD8B671E8A9926
*/
public abstract class FormsEditorBase<T extends EObject> extends EditorBase<T> {
......@@ -117,4 +119,9 @@ public abstract class FormsEditorBase<T extends EObject> extends EditorBase<T> {
return client;
}
/** {@inheritDoc} */
@Override
public boolean enableLibraryView() {
return false;
}
}
......@@ -26,12 +26,19 @@ import org.eclipse.ui.IEditorPart;
* @author hoelzl
* @author $Author$
* @version $Rev$
* @ConQAT.Rating GREEN Hash: A0FEDA6616CBC0DCC4632D2E73E4FDA5
* @ConQAT.Rating YELLOW Hash: CD4AF6D1FAD865473DCF9928CF7C245D
*/
public interface IModelEditor<T extends EObject> extends IEditorPart {
/** Returns the edited object. */
T getEditedObject();
/**
* Returns whether the library view should be active for this editor. If an
* editor does not need elements to be dragged from the library it may
* return <code>false</code> here.
*/
boolean enableLibraryView();
/** Sets the highlighting of the given model element to the given value. */
void setHighlight(EObject element, boolean highlighted);
......
......@@ -35,11 +35,13 @@ import org.fortiss.tooling.kernel.ui.internal.editor.ModelElementEditorInput;
/**
* Base implementation of model element editors returned by
* {@link IModelEditorBinding}s.
* <p>
* By default this implementation enables the library view.
*
* @author hoelzlf
* @author $Author$
* @version $Rev$
* @ConQAT.Rating GREEN Hash: D735C9795A2EB99EDB8D0DF67CDF0A23
* @ConQAT.Rating YELLOW Hash: 8E78A5604AD81E0BA5E5124F58512E6A
*/
public abstract class EditorBase<T extends EObject> extends EditorPart
implements IActionContributingEditor, IModelEditor<T> {
......@@ -159,4 +161,10 @@ public abstract class EditorBase<T extends EObject> extends EditorPart
public void clearAllHighlights() {
// nothing to do
}
/** {@inheritDoc} */
@Override
public boolean enableLibraryView() {
return true;
}
}
......@@ -56,8 +56,9 @@ import org.fortiss.tooling.kernel.ui.util.PropertiesConstantUtils;
* @author hoelzl
* @author $Author$
* @version $Rev$
* @ConQAT.Rating GREEN Hash: 0EF0D64A6035A48B0886CCC162C90293
* @ConQAT.Rating YELLOW Hash: 9EAFF8E3E63D2E476AE2EB23C595D329
*/
@SuppressWarnings("rawtypes")
public class ExtendableMultiPageEditor extends MultiPageEditorPart implements
ITabbedPropertySheetPageContributor, CommandStackListener,
ISaveablePart, IModelEditor<EObject> {
......@@ -238,7 +239,6 @@ public class ExtendableMultiPageEditor extends MultiPageEditorPart implements
/**
* {@inheritDoc}
*/
@SuppressWarnings("rawtypes")
@Override
public Object getAdapter(Class adapter) {
if (adapter == IPropertySheetPage.class) {
......@@ -277,7 +277,6 @@ public class ExtendableMultiPageEditor extends MultiPageEditorPart implements
}
/** {@inheritDoc} */
@SuppressWarnings("rawtypes")
@Override
public void setHighlight(EObject element, boolean highlighted) {
// delegate to active editor
......@@ -288,7 +287,6 @@ public class ExtendableMultiPageEditor extends MultiPageEditorPart implements
}
/** {@inheritDoc} */
@SuppressWarnings("rawtypes")
@Override
public void clearAllHighlights() {
// delegate to active editor
......@@ -297,4 +295,15 @@ public class ExtendableMultiPageEditor extends MultiPageEditorPart implements
((IModelEditor) part).clearAllHighlights();
}
}
/** {@inheritDoc} */
@Override
public boolean enableLibraryView() {
// delegate to active editor
IEditorPart part = getActiveEditor();
if (part instanceof IModelEditor) {
return ((IModelEditor) part).enableLibraryView();
}
return false;
}
}
......@@ -51,7 +51,7 @@ import org.fortiss.tooling.kernel.ui.service.IModelElementHandlerService;
* @author eder
* @author $Author: hoelzl $
* @version $Rev: 18709 $
* @ConQAT.Rating GREEN Hash: 65BA252C5E41249091A127DAC0282DC1
* @ConQAT.Rating YELLOW Hash: CCABADEE562619A5D1238EA8BD8BAF81
*/
public class LibraryView extends ViewPart {
......@@ -131,7 +131,8 @@ public class LibraryView extends ViewPart {
@SuppressWarnings("unchecked")
private void updateEditorFilters(IEditorPart editor) {
supportedBaseClasses.clear();
if (editor instanceof EditorBase) {
if (editor instanceof EditorBase
&& ((EditorBase<? extends EObject>) editor).enableLibraryView()) {
EditorBase<? extends EObject> editorBase = (EditorBase<? extends EObject>) editor;
containerObject = editorBase.getEditedObject();
for (Class<? extends EObject> clazz : editorBase
......
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