Commit 6097510d authored by Florian Hölzl's avatar Florian Hölzl
Browse files

added layout related base implementations

parent d0d7d98a
......@@ -8,8 +8,8 @@ Bundle-Vendor: %providerName
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Export-Package: org.fortiss.tooling.base.editor,
org.fortiss.tooling.base.model,
org.fortiss.tooling.base.model.impl,
org.fortiss.tooling.base.model.util
org.fortiss.tooling.base.model.element,
org.fortiss.tooling.base.model.element.impl,
org.fortiss.tooling.base.model.element.util
Require-Bundle: org.fortiss.tooling.kernel;bundle-version="0.0.1";visibility:=reexport
Bundle-ActivationPolicy: lazy
......@@ -2,47 +2,236 @@
<ecore:EPackage xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="model"
nsURI="http://www.fortiss.org/tooling/base" nsPrefix="org-fortiss-tooling-base">
<eClassifiers xsi:type="ecore:EClass" name="IModelElement">
<eStructuralFeatures xsi:type="ecore:EReference" name="specifications" upperBound="-1"
eType="#//IModelElementSpecification" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="referencedBy" upperBound="-1"
eType="#//IModelElementReference" eOpposite="#//IModelElementReference/reference"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="IModelElementSpecification" abstract="true"
interface="true"/>
<eClassifiers xsi:type="ecore:EClass" name="IModelElementReference" abstract="true"
interface="true">
<eStructuralFeatures xsi:type="ecore:EReference" name="reference" eType="#//IModelElement"
eOpposite="#//IModelElement/referencedBy"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="IHierarchicElement" abstract="true"
interface="true" eSuperTypes="#//IHierarchicElementContainer #//IModelElement">
<eStructuralFeatures xsi:type="ecore:EReference" name="connections" upperBound="-1"
eType="#//IConnection" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="connectors" upperBound="-1"
eType="#//IConnector" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="IHierarchicElementContainer" abstract="true"
interface="true">
<eStructuralFeatures xsi:type="ecore:EReference" name="containedElements" upperBound="-1"
eType="#//IHierarchicElement" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="IConnector" abstract="true" interface="true"
eSuperTypes="#//IModelElement">
<eStructuralFeatures xsi:type="ecore:EReference" name="incoming" upperBound="-1"
eType="#//IConnection" eOpposite="#//IConnection/target"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="outgoing" upperBound="-1"
eType="#//IConnection" eOpposite="#//IConnection/source"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="IConnection" abstract="true" interface="true"
eSuperTypes="#//IModelElement">
<eStructuralFeatures xsi:type="ecore:EReference" name="source" eType="#//IConnector"
eOpposite="#//IConnector/outgoing"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="target" eType="#//IConnector"
eOpposite="#//IConnector/incoming"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="IHiddenSpecification" abstract="true"
interface="true" eSuperTypes="#//IModelElementSpecification"/>
<eClassifiers xsi:type="ecore:EClass" name="IAnnotatedSpecification" eSuperTypes="#//IHiddenSpecification"/>
nsURI="http://www.fortiss.org/tooling/base/model" nsPrefix="org-fortiss-tooling-base-model">
<eSubpackages name="element" nsURI="http://www.fortiss.org/tooling/base/model/element"
nsPrefix="org-fortiss-tooling-base-model-element">
<eClassifiers xsi:type="ecore:EClass" name="IModelElement">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="Super class of first class model elements."/>
</eAnnotations>
<eStructuralFeatures xsi:type="ecore:EReference" name="specifications" upperBound="-1"
eType="#//element/IModelElementSpecification" containment="true">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="List of model element specifications providing additional model element properties."/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EReference" name="referencedBy" upperBound="-1"
eType="#//element/IModelElementReference" eOpposite="#//element/IModelElementReference/reference">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="List of model element references."/>
</eAnnotations>
</eStructuralFeatures>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="IModelElementSpecification" abstract="true"
interface="true">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="Super class of model element specifications. Such specifications provide additional plugable properties."/>
</eAnnotations>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="IModelElementReference" abstract="true"
interface="true">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="Super class of EObjects referencing model elements."/>
</eAnnotations>
<eStructuralFeatures xsi:type="ecore:EReference" name="reference" eType="#//element/IModelElement"
eOpposite="#//element/IModelElement/referencedBy">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="The referenced model element."/>
</eAnnotations>
</eStructuralFeatures>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="IHierarchicElement" abstract="true"
interface="true" eSuperTypes="#//element/IHierarchicElementContainer #//element/IModelElement">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="Super class of hierarchic model elements."/>
</eAnnotations>
<eStructuralFeatures xsi:type="ecore:EReference" name="connections" upperBound="-1"
eType="#//element/IConnection" containment="true">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="List of aggregated connection model elements. Usually a hierarchic element aggregates all connections of its direct sub-structure."/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EReference" name="connectors" upperBound="-1"
eType="#//element/IConnector" containment="true">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="List of aggregated connectors."/>
</eAnnotations>
</eStructuralFeatures>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="IHierarchicElementContainer" abstract="true"
interface="true">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="Super class of containers of hierarchic model elements."/>
</eAnnotations>
<eStructuralFeatures xsi:type="ecore:EReference" name="containedElements" upperBound="-1"
eType="#//element/IHierarchicElement" containment="true">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="The contained hierarchic model elements."/>
</eAnnotations>
</eStructuralFeatures>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="IConnector" abstract="true" interface="true"
eSuperTypes="#//element/IModelElement">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="Super class of connectors. Connectors reference incoming and outgoing connection model elements."/>
</eAnnotations>
<eStructuralFeatures xsi:type="ecore:EReference" name="incoming" upperBound="-1"
eType="#//element/IConnection" eOpposite="#//element/IConnection/target">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="The incoming connections."/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EReference" name="outgoing" upperBound="-1"
eType="#//element/IConnection" eOpposite="#//element/IConnection/source">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="The outgoing connections."/>
</eAnnotations>
</eStructuralFeatures>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="IConnection" abstract="true" interface="true"
eSuperTypes="#//element/IModelElement">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="Super class of connections. Connections are aggregated in a hierarchic model element and reference two connectors from that element or any direct sub-elenent."/>
</eAnnotations>
<eStructuralFeatures xsi:type="ecore:EReference" name="source" eType="#//element/IConnector"
eOpposite="#//element/IConnector/outgoing">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="The connection's source connector."/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EReference" name="target" eType="#//element/IConnector"
eOpposite="#//element/IConnector/incoming">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="The connection's target connector."/>
</eAnnotations>
</eStructuralFeatures>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="IHiddenSpecification" abstract="true"
interface="true" eSuperTypes="#//element/IModelElementSpecification">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="Super class of model element specifications, which should be excluded from the navigator view."/>
</eAnnotations>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="IAnnotatedSpecification" eSuperTypes="#//element/IHiddenSpecification">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="Super class of hidden model element specifications that represent annotations."/>
</eAnnotations>
</eClassifiers>
</eSubpackages>
<eSubpackages name="layout" nsURI="http://www.fortiss.org/tooling/base/model/layout"
nsPrefix="org-fortiss-tooling-base-model-layout">
<eClassifiers xsi:type="ecore:EClass" name="ILayoutedModelElement" abstract="true"
interface="true">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="Super class of model elements with layout data."/>
</eAnnotations>
<eStructuralFeatures xsi:type="ecore:EReference" name="layoutData" upperBound="-1"
eType="#//layout/ILayoutData" containment="true">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="Stores the aggregated layout data."/>
</eAnnotations>
</eStructuralFeatures>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="ILayoutData" abstract="true" interface="true">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="Super class of all layout data objects."/>
</eAnnotations>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="key" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="The layout key indicating how the layout data is to be interpreted."/>
</eAnnotations>
</eStructuralFeatures>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Point" eSuperTypes="#//layout/ILayoutData">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="Layout data for 2D locations."/>
</eAnnotations>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="x" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="The horizontal X coordinate."/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="y" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="The vertical Y coordinate."/>
</eAnnotations>
</eStructuralFeatures>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Dimension" eSuperTypes="#//layout/ILayoutData">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="Layout data for 2D dimensions."/>
</eAnnotations>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="width" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"
defaultValueLiteral="10">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="The width."/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="height" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"
defaultValueLiteral="10">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="The height."/>
</eAnnotations>
</eStructuralFeatures>
</eClassifiers>
<eClassifiers xsi:type="ecore:EEnum" name="EOrientation">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="Enumeration of 2D directions and orientations."/>
</eAnnotations>
<eLiterals name="NORTH"/>
<eLiterals name="EAST" value="1"/>
<eLiterals name="SOUTH" value="2"/>
<eLiterals name="WEST" value="3"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Orientation" eSuperTypes="#//layout/ILayoutData">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="Layout data for 2D orientations."/>
</eAnnotations>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="orientation" lowerBound="1"
eType="#//layout/EOrientation" defaultValueLiteral="NORTH">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="The orientation."/>
</eAnnotations>
</eStructuralFeatures>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Points" eSuperTypes="#//layout/ILayoutData">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="Layout data for a sequence of 2D locations."/>
</eAnnotations>
<eStructuralFeatures xsi:type="ecore:EReference" name="points" upperBound="-1"
eType="#//layout/Point" containment="true">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="The aggregated locations."/>
</eAnnotations>
</eStructuralFeatures>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Angle" eSuperTypes="#//layout/ILayoutData">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="Layout data for an angle (the interpretation of the double value is application dependent)."/>
</eAnnotations>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="angle" lowerBound="1"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EDouble"
defaultValueLiteral="0">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="The double value of the angle."/>
</eAnnotations>
</eStructuralFeatures>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Offset" eSuperTypes="#//layout/ILayoutData">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="Layout data of a single dimensional offset."/>
</eAnnotations>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="offset" lowerBound="1"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt" defaultValueLiteral="0">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="The offset value."/>
</eAnnotations>
</eStructuralFeatures>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="OffsetOrientation" eSuperTypes="#//layout/Offset #//layout/Orientation">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="Combines an offset with an orientation."/>
</eAnnotations>
</eClassifiers>
</eSubpackages>
</ecore:EPackage>
......@@ -12,8 +12,14 @@
<extension point="org.eclipse.emf.ecore.generated_package">
<package
uri="http://www.fortiss.org/tooling/base"
class="org.fortiss.tooling.base.model.BasePackage"
uri="http://www.fortiss.org/tooling/base/model/element"
class="org.fortiss.tooling.base.model.element.ElementPackage"
genModel="model/base.genmodel"/>
</extension>
<extension point="org.eclipse.emf.ecore.generated_package">
<package
uri="http://www.fortiss.org/tooling/base/model/layout"
class="org.fortiss.tooling.base.model.layout.LayoutPackage"
genModel="model/base.genmodel"/>
</extension>
</plugin>
/*--------------------------------------------------------------------------+
$Id$
| |
| Copyright 2011 ForTISS GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.tooling.base.compose;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.gef.EditPart;
import org.fortiss.tooling.base.editpart.RootEditPartBase;
import org.fortiss.tooling.kernel.interfaces.ICompositionContext;
/**
* Composition context for GEF edit parts initiated by a drop gesture. The
* context content is defined by the editpart that was the drop target and the
* mouse position.
* <P>
* The editpart can also be a root edit part, e.g. the background of some
* editor.
*
* @author hoelzl
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash: F41CA022ECFE85D93C254EFB2BE6D7BE
*/
public class DropContext implements ICompositionContext {
/** Drop target edit part */
private final EditPart dropTarget;
/** Position. */
private final Point position;
/** Constructor. */
public DropContext(EditPart dropTarget, Point position) {
this.dropTarget = dropTarget;
this.position = position;
}
/** Returns the position. */
public Point getPosition() {
return position;
}
/** Returns the drop target edit part. */
public EditPart getDropTarget() {
return dropTarget;
}
/** Returns whether drop target is root edit part (base). */
public boolean isRoot() {
return dropTarget instanceof RootEditPartBase;
}
}
......@@ -50,7 +50,7 @@ import org.fortiss.tooling.kernel.util.EObjectSelectionUtils;
* @author hoelzl
* @author $Author$
* @version $Rev$
* @ConQAT.Rating RED Hash: 307872B23BCAC5771FDAD66F17973611
* @ConQAT.Rating YELLOW Hash: 570713B6F67C37F5BD0948CEBAC276D4
*/
public abstract class TreeViewerEditorBase<T extends EObject> extends
EditorBase<T> {
......@@ -177,7 +177,6 @@ public abstract class TreeViewerEditorBase<T extends EObject> extends
return ICompositorService.INSTANCE.canCompose(
(EObject) lastTarget, dropped, null);
}
return false;
}
......
/*--------------------------------------------------------------------------+
$Id$
| |
| Copyright 2011 ForTISS GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.tooling.base.editpart;
import org.fortiss.tooling.base.model.element.IConnector;
import org.fortiss.tooling.base.model.layout.ILayoutedModelElement;
/**
* Base class for connector edit parts.
*
* @author hummel
* @author hoelzl
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash: 33691B003B390F6576C82DFB32395F1C
*/
public abstract class ConnectorEditPartBase<T extends ILayoutedModelElement & IConnector>
extends PositionedEditPartBase<T> {
/** Constructor. */
protected ConnectorEditPartBase(T modelElement) {
super(modelElement);
}
}
/*--------------------------------------------------------------------------+
$Id$
| |
| Copyright 2011 ForTISS GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.tooling.base.editpart;
import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.impl.AdapterImpl;
import org.eclipse.gef.editparts.AbstractConnectionEditPart;
import org.fortiss.tooling.base.model.element.IConnection;
import org.fortiss.tooling.base.model.layout.ILayoutedModelElement;
import org.fortiss.tooling.kernel.interfaces.IModelElementHandler;
import org.fortiss.tooling.kernel.services.IModelElementService;
/**
* Base class for graphical connection edit parts.
*
* @author hoelzl
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash: CEB37EC45D3FB317BEF8282765C22C0A
*/
public abstract class GraphicalConnectionEditPartBase<T extends ILayoutedModelElement & IConnection>
extends AbstractConnectionEditPart {
/** The underlying model object. */
protected final T modelElement;
/** The model element handler to be used for the {@link #modelElement}. */
protected final IModelElementHandler<T> modelElementHandler;
/**
* The adapter used to receive change notifications for the
* {@link #modelElement}.
*/
protected final Adapter fullRefreshAdapter = new AdapterImpl() {
/** {@inheritDoc} */
@Override
public void notifyChanged(Notification notification) {
// do not care what happens, just refresh everything
refresh();
}
};
/** Constructor. */
@SuppressWarnings("unchecked")
protected GraphicalConnectionEditPartBase(T modelElement) {
this.modelElement = modelElement;
setModel(modelElement);
this.modelElementHandler = (IModelElementHandler<T>) IModelElementService.INSTANCE
.getModelElementHandler(modelElement);
}
/** {@inheritDoc} */
@Override
protected void createEditPolicies() {
// no edit policies installed by default
}
/** {@inheritDoc} */
@Override
public void activate() {
super.activate();
modelElement.eAdapters().add(fullRefreshAdapter);
}
/** {@inheritDoc} */
@Override
public void deactivate() {
modelElement.eAdapters().remove(fullRefreshAdapter);
super.deactivate();
}
}
/*--------------------------------------------------------------------------+
$Id$
| |
| Copyright 2011 ForTISS GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.tooling.base.editpart;
import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.impl.AdapterImpl;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
import org.fortiss.tooling.kernel.interfaces.IModelElementHandler;
import org.fortiss.tooling.kernel.services.IModelElementService;
/**
* The base class for all graphical edit parts.
*
* @param <T>
* the type of the model element wrapped.
*
* @author hoelzl
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash: 8835616CDDA5F811EE493732151D585F
*/
public abstract class GraphicalEditPartBase<T extends EObject> extends
AbstractGraphicalEditPart {
/**
* The adapter used to receive change notifications for the
* {@link #modelElement}.
*/
protected final Adapter fullRefreshAdapter = new AdapterImpl() {
/** {@inheritDoc} */
@Override
public void notifyChanged(Notification notification) {
// do not care what happens, just refresh everything
refresh();
}