Commit 50864e4f authored by Li's avatar Li
Browse files

No commit message

No commit message
parent 9b81491f
......@@ -6,8 +6,14 @@ Bundle-Version: 1.0.0.qualifier
Bundle-Activator: org.fortiss.af3.mode.ui.AF3ModeUIActivator
Require-Bundle: org.eclipse.ui.ide;bundle-version="3.7.0";visibility:=reexport,
org.fortiss.af3.project.ui;bundle-version="1.0.0";visibility:=reexport,
org.fortiss.tooling.base.ui;bundle-version="1.0.0";visibility:=reexport
org.fortiss.tooling.base.ui;bundle-version="1.0.0";visibility:=reexport,
org.fortiss.af3.mode;bundle-version="1.0.0",
org.fortiss.af3.component.ui;bundle-version="1.0.0",
org.fortiss.af3.state.ui
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-Vendor: fortiss GmbH
Export-Package: org.fortiss.af3.mode.ui
Import-Package: org.fortiss.af3.component.model,
org.fortiss.af3.component.model.behavior.common,
org.fortiss.af3.state.ui.editpart.figure
......@@ -8,5 +8,196 @@
$Id$
-->
<plugin>
<!-- Prototype provider extension -->
<extension
point="org.fortiss.tooling.kernel.modelPrototypeProvider">
<modelPrototypeProvider
provider="org.fortiss.af3.mode.ui.prototypes.PrototypeProvider">
</modelPrototypeProvider>
</extension>
<!-- Handler extension. -->
<extension
point="org.fortiss.tooling.kernel.ui.modelElementHandler">
<modelElementHandler
handler="org.fortiss.af3.mode.ui.handler.ModeAutomatonHandler">
<modelElementClass
modelElementClass="org.fortiss.af3.mode.model.ModeAutomaton">
</modelElementClass>
</modelElementHandler>
<modelElementHandler
handler="org.fortiss.af3.mode.ui.handler.ModeHandler">
<modelElementClass
modelElementClass="org.fortiss.af3.mode.model.Mode">
</modelElementClass>
</modelElementHandler>
<modelElementHandler
handler="org.fortiss.af3.mode.ui.handler.SwitchSegmentEntryConnectorHandler">
<modelElementClass
modelElementClass="org.fortiss.af3.mode.model.SwitchSegmentEntryConnector">
</modelElementClass>
</modelElementHandler>
<modelElementHandler
handler="org.fortiss.af3.mode.ui.handler.SwitchSegmentExitConnectorHandler">
<modelElementClass
modelElementClass="org.fortiss.af3.mode.model.SwitchSegmentExitConnector">
</modelElementClass>
</modelElementHandler>
<modelElementHandler
handler="org.fortiss.af3.mode.ui.handler.SwitchSegmentHandler">
<modelElementClass
modelElementClass="org.fortiss.af3.mode.model.SwitchSegment">
</modelElementClass>
</modelElementHandler>
<modelElementHandler
handler="org.fortiss.af3.mode.ui.handler.SwitchSegmentLocalConnectorHandler">
<modelElementClass
modelElementClass="org.fortiss.af3.mode.model.SwitchSegmentLocalConnector">
</modelElementClass>
</modelElementHandler>
<modelElementHandler
handler="org.fortiss.af3.mode.ui.handler.ModeComponentStructureHandler">
<modelElementClass
modelElementClass="org.fortiss.af3.mode.model.ModeComponentStructureSpecification">
</modelElementClass>
</modelElementHandler>
</extension>
<!-- Editors binding extension. -->
<extension
point="org.fortiss.tooling.kernel.ui.modelEditorBinding">
<modelEditorBinding
binding="org.fortiss.af3.mode.ui.editor.ModeAutomatonEditorBinding">
<modelElementClass
modelElementClass="org.fortiss.af3.mode.model.ModeAutomaton">
</modelElementClass>
</modelEditorBinding>
<modelEditorBinding
binding="org.fortiss.af3.mode.ui.editor.ModeEditorBinding">
<modelElementClass
modelElementClass="org.fortiss.af3.mode.model.Mode">
</modelElementClass>
</modelEditorBinding>
<modelEditorBinding
binding="org.fortiss.af3.mode.ui.editor.DataModeEditorBinding">
<modelElementClass
modelElementClass="org.fortiss.af3.mode.model.ModeAutomaton">
</modelElementClass>
</modelEditorBinding>
</extension>
<!-- Property section binding extension. -->
<extension
point="org.eclipse.ui.views.properties.tabbed.propertySections">
<propertySections
contributorId="org.fortiss.tooling.kernel.ui.properties.Contributor">
<propertySection
afterSection="org.fortiss.tooling.kernel.ui.internal.properties.NamedCommentedPropertySection"
class="org.fortiss.af3.mode.ui.properties.ModeSpecificationPropertySection"
enablesFor="1"
id="org.fortiss.af3.mode.ui.properties.ModeSpecificationPropertySection"
tab="org.fortiss.tooling.kernel.ui.property.tab.general">
<input
type="org.fortiss.af3.mode.model.Mode">
</input>
</propertySection>
<propertySection
afterSection="org.fortiss.tooling.kernel.ui.internal.properties.NamedCommentedPropertySection"
class="org.fortiss.af3.mode.ui.properties.SwitchSegmentSpecificationPropertySection"
enablesFor="1"
id="org.fortiss.af3.mode.ui.properties.SwitchSegmentSpecificationPropertySection"
tab="org.fortiss.tooling.kernel.ui.property.tab.general">
<input
type="org.fortiss.af3.mode.model.SwitchSegment">
</input>
</propertySection>
</propertySections>
</extension>
<!-- Editparts extension. -->
<extension
point="org.fortiss.tooling.kernel.ui.editPartFactory">
<editPartFactory
factory="org.fortiss.af3.mode.ui.editpart.ModesEditPartFactory">
<modelElementClass
modelElementClass="org.fortiss.af3.mode.model.Mode">
</modelElementClass>
<modelElementClass
modelElementClass="org.fortiss.af3.mode.model.SwitchSegmentEntryConnector">
</modelElementClass>
<modelElementClass
modelElementClass="org.fortiss.af3.mode.model.SwitchSegment">
</modelElementClass>
<modelElementClass
modelElementClass="org.fortiss.af3.mode.model.SwitchSegmentExitConnector">
</modelElementClass>
</editPartFactory>
</extension>
<!-- Model element compositor. -->
<extension
point="org.fortiss.tooling.kernel.modelElementCompositor">
<modelElementCompositor
compositor="org.fortiss.af3.mode.ui.compose.BehaviorComponentCompositor">
<modelElementClass
modelElementClass="org.fortiss.af3.component.model.Component">
</modelElementClass>
</modelElementCompositor>
<modelElementCompositor
compositor="org.fortiss.af3.mode.ui.compose.ModeAutomatonCompositor">
<modelElementClass
modelElementClass="org.fortiss.af3.mode.model.ModeAutomaton">
</modelElementClass>
</modelElementCompositor>
<modelElementCompositor
compositor="org.fortiss.af3.mode.ui.compose.ModeCompositor">
<modelElementClass
modelElementClass="org.fortiss.af3.mode.model.Mode">
</modelElementClass>
</modelElementCompositor>
<modelElementCompositor
compositor="org.fortiss.af3.mode.ui.compose.ModeComponentStructureCompositor">
<modelElementClass
modelElementClass="org.fortiss.af3.mode.model.ModeComponentStructureSpecification">
</modelElementClass>
</modelElementCompositor>
</extension>
<!-- Connections compositor. -->
<extension
point="org.fortiss.tooling.kernel.modelConnectionCompositor">
<modelConnectionCompositor
modelConnectionCompositor="org.fortiss.af3.mode.ui.compose.ModeConnectionCompositor">
<source>
<modelElementClass
modelElementClass="org.fortiss.af3.mode.model.Mode">
</modelElementClass>
</source>
<target>
<modelElementClass
modelElementClass="org.fortiss.af3.mode.model.Mode">
</modelElementClass>
</target>
</modelConnectionCompositor>
<modelConnectionCompositor
modelConnectionCompositor="org.fortiss.af3.mode.ui.compose.ModeConnectorConnectionCompositor">
<source>
<modelElementClass
modelElementClass="org.fortiss.af3.mode.model.SwitchSegmentEntryConnector">
</modelElementClass>
<modelElementClass
modelElementClass="org.fortiss.af3.mode.model.SwitchSegmentExitConnector">
</modelElementClass>
</source>
<target>
<modelElementClass
modelElementClass="org.fortiss.af3.mode.model.SwitchSegmentExitConnector">
</modelElementClass>
<modelElementClass
modelElementClass="org.fortiss.af3.mode.model.SwitchSegmentEntryConnector">
</modelElementClass>
</target>
</modelConnectionCompositor>
</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.af3.mode.ui.compose;
import org.conqat.lib.commons.reflect.ReflectionUtils;
import org.eclipse.emf.ecore.EObject;
import org.fortiss.af3.component.model.Component;
import org.fortiss.af3.mode.model.ModeAutomaton;
import org.fortiss.tooling.base.decompose.HierarchicElementCompositorBase;
import org.fortiss.tooling.base.model.element.IModelElementSpecification;
import org.fortiss.tooling.kernel.extension.data.IElementCompositionContext;
import org.fortiss.tooling.kernel.extension.data.Prototype;
/**
* Element compositor for {@link Component} and behavior (ModeAutomaton).
*
* @author li
* @author $Author$
* @version $Rev$
* @ConQAT.Rating RED Hash:
*/
public class BehaviorComponentCompositor extends
HierarchicElementCompositorBase<Component> {
/** {@inheritDoc} */
@Override
public boolean canCompose(Component container, EObject contained,
IElementCompositionContext context) {
// does not allow composition with component architecture root component
// does not allow to add the same specification twice; however different
// specifications are allowed
return isCorrectElementClass(contained)
&& container.eContainer() instanceof Component
&& ReflectionUtils.pickInstanceOf(contained.getClass(),
container.getSpecificationsList()) == null;
}
/** Tests the class of the given element. */
private boolean isCorrectElementClass(EObject element) {
return element instanceof ModeAutomaton;
}
/** {@inheritDoc} */
@Override
public boolean canComposePrototype(Prototype prototype) {
return isCorrectElementClass(prototype.getPrototype());
}
/** {@inheritDoc} */
@Override
public boolean compose(Component container, EObject contained,
IElementCompositionContext context) {
container.getSpecificationsList().add(
(IModelElementSpecification) contained);
return true;
}
/** {@inheritDoc} */
@Override
public boolean canDecompose(EObject contained) {
return false;
// return isCorrectElementClass(contained);
}
}
/*--------------------------------------------------------------------------+
$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.af3.mode.ui.compose;
import org.conqat.lib.commons.reflect.ReflectionUtils;
import org.eclipse.emf.ecore.EObject;
import org.fortiss.af3.mode.model.Mode;
import org.fortiss.af3.mode.model.ModeAutomaton;
import org.fortiss.tooling.base.decompose.HierarchicElementCompositorBase;
import org.fortiss.tooling.base.layout.DefaultLayoutConstants;
import org.fortiss.tooling.base.ui.dnd.ElementDropContext;
import org.fortiss.tooling.base.ui.utils.RectangleLayoutUtils;
import org.fortiss.tooling.kernel.extension.IElementCompositor;
import org.fortiss.tooling.kernel.extension.data.IElementCompositionContext;
import org.fortiss.tooling.kernel.extension.data.Prototype;
/**
* {@link IElementCompositor} for {@link ModeAutomaton}.
*
* @author li
* @author $Author$
* @version $Rev$
* @ConQAT.Rating RED Hash:
*/
public class ModeAutomatonCompositor extends
HierarchicElementCompositorBase<ModeAutomaton> {
/** {@inheritDoc} */
@Override
public boolean canCompose(ModeAutomaton container, EObject contained,
IElementCompositionContext context) {
return isCorrectElementClass(contained);
}
/** {@inheritDoc} */
@Override
public boolean compose(ModeAutomaton container, EObject contained,
IElementCompositionContext context) {
if (contained instanceof Mode) {
Mode mode = (Mode) contained;
if (context instanceof ElementDropContext) {
RectangleLayoutUtils.layoutNodeInRoot(mode,
(ElementDropContext) context,
DefaultLayoutConstants.DEFAULT_GRID_SIZE, true);
}
Mode root = (Mode) container.getContainedElements(0);
root.getContainedElementsList().add(mode);
return true;
}
return false;
}
/** {@inheritDoc} */
@Override
public boolean canComposePrototype(Prototype prototype) {
return isCorrectElementClass(prototype.getPrototype());
}
/** {@inheritDoc} */
@Override
public boolean canDecompose(EObject contained) {
// hidden root state cannot be removed
return false;
}
/** Returns whether the given element is of an acceptable class. */
private boolean isCorrectElementClass(EObject element) {
return ReflectionUtils.isInstanceOfAny(element, Mode.class);
}
}
/*--------------------------------------------------------------------------+
$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.af3.mode.ui.compose;
import org.conqat.lib.commons.reflect.ReflectionUtils;
import org.eclipse.emf.ecore.EObject;
import org.fortiss.af3.component.model.Component;
import org.fortiss.af3.mode.model.ModeComponentStructureSpecification;
import org.fortiss.tooling.base.decompose.HierarchicElementCompositorBase;
import org.fortiss.tooling.base.layout.DefaultLayoutConstants;
import org.fortiss.tooling.base.ui.dnd.ElementDropContext;
import org.fortiss.tooling.base.ui.utils.RectangleLayoutUtils;
import org.fortiss.tooling.kernel.extension.IElementCompositor;
import org.fortiss.tooling.kernel.extension.data.IElementCompositionContext;
import org.fortiss.tooling.kernel.extension.data.Prototype;
/**
* {@link IElementCompositor} for {@link ModeComponentStructureSpecification}.
*
* @author li
* @author $Author$
* @version $Rev$
* @ConQAT.Rating RED Hash:
*/
public class ModeComponentStructureCompositor extends
HierarchicElementCompositorBase<ModeComponentStructureSpecification> {
/** {@inheritDoc} */
@Override
public boolean canCompose(ModeComponentStructureSpecification container,
EObject contained, IElementCompositionContext context) {
return isCorrectElementClass(contained);
}
/** {@inheritDoc} */
@Override
public boolean compose(ModeComponentStructureSpecification container,
EObject contained, IElementCompositionContext context) {
if (contained instanceof Component) {
Component comp = (Component) contained;
if (context instanceof ElementDropContext) {
RectangleLayoutUtils.layoutNodeInRoot(comp,
(ElementDropContext) context,
DefaultLayoutConstants.DEFAULT_GRID_SIZE, true);
}
Component rootComp = (Component) container.getContainedElements(0);
rootComp.getContainedElementsList().add(comp);
return true;
}
return false;
}
/** {@inheritDoc} */
@Override
public boolean canComposePrototype(Prototype prototype) {
return isCorrectElementClass(prototype.getPrototype());
}
/** {@inheritDoc} */
@Override
public boolean canDecompose(EObject contained) {
// hidden root state cannot be removed
return isCorrectElementClass(contained);
}
/** Returns whether the given element is of an acceptable class. */
private boolean isCorrectElementClass(EObject element) {
return ReflectionUtils.isInstanceOfAny(element, Component.class);
}
}
/*--------------------------------------------------------------------------+
$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.af3.mode.ui.compose;
import org.conqat.lib.commons.reflect.ReflectionUtils;
import org.eclipse.emf.ecore.EObject;
import org.fortiss.af3.mode.model.Mode;
import org.fortiss.af3.mode.model.ModeComponentStructureSpecification;
import org.fortiss.af3.mode.model.SwitchSegmentEntryConnector;
import org.fortiss.af3.mode.model.SwitchSegmentExitConnector;
import org.fortiss.tooling.base.decompose.HierarchicElementCompositorBase;
import org.fortiss.tooling.base.layout.DefaultLayoutConstants;
import org.fortiss.tooling.base.model.base.ConnectorBase;
import org.fortiss.tooling.base.ui.dnd.ElementDropContext;
import org.fortiss.tooling.base.ui.utils.RectangleLayoutUtils;
import org.fortiss.tooling.kernel.extension.IElementCompositor;
import org.fortiss.tooling.kernel.extension.data.IElementCompositionContext;
import org.fortiss.tooling.kernel.extension.data.Prototype;
/**
* {@link IElementCompositor} for {@link Mode}s.
*
* @author li
* @author $Author$
* @version $Rev$
* @ConQAT.Rating RED Hash:
*/
public class ModeCompositor extends HierarchicElementCompositorBase<Mode> {
/** {@inheritDoc} */
@Override
public boolean canCompose(Mode container, EObject contained,
IElementCompositionContext context) {
return isCorrectElementClass(contained)
&& ReflectionUtils.pickInstanceOf(contained.getClass(),
container.getSpecificationsList()) == null;
}
/** {@inheritDoc} */
@Override
public boolean compose(Mode container, EObject contained,
IElementCompositionContext context) {
if (contained instanceof Mode) {
Mode mode = (Mode) contained;
if (context instanceof ElementDropContext) {
RectangleLayoutUtils.layoutNodeInRoot(mode,
(ElementDropContext) context,
DefaultLayoutConstants.DEFAULT_GRID_SIZE, true);
}
container.getContainedElementsList().add(mode);
return true;
}
if (contained instanceof ConnectorBase) {
ConnectorBase connector = (ConnectorBase) contained;
if (context instanceof ElementDropContext) {
final ElementDropContext ctx = (ElementDropContext) context;
if (ctx.isRoot()) {
int size = DefaultLayoutConstants.DEFAULT_CONNECTOR_SIZE / 2;
RectangleLayoutUtils.layoutNodeInRoot(connector, ctx, size,
true);
} else {
RectangleLayoutUtils.layoutConnectorInRectangle(connector,
container, ctx.getPosition());
}
}
container.getConnectorsList().add(connector);
return true;
}
if (contained instanceof ModeComponentStructureSpecification) {
ModeComponentStructureSpecification mcss = (ModeComponentStructureSpecification) contained;
container.getSpecificationsList().add(mcss);
return true;
}
return false;
}
/** {@inheritDoc} */
@Override
public boolean canComposePrototype(Prototype prototype) {
return isCorrectElementClass(prototype.getPrototype());
}