diff options
author | Henrik Rentz-Reichert | 2011-04-08 12:00:42 +0000 |
---|---|---|
committer | Henrik Rentz-Reichert | 2011-04-08 12:00:42 +0000 |
commit | 0922f6b21f84a06f01077a18dfdd51c7364efa6c (patch) | |
tree | 137ade9e1a56ffd84f5d741503ff5a8c7202fbb8 /plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice | |
parent | dab12e4b2c91a10bbdf3ae98814e4eea51a7f0ad (diff) | |
download | org.eclipse.etrice-0922f6b21f84a06f01077a18dfdd51c7364efa6c.tar.gz org.eclipse.etrice-0922f6b21f84a06f01077a18dfdd51c7364efa6c.tar.xz org.eclipse.etrice-0922f6b21f84a06f01077a18dfdd51c7364efa6c.zip |
ui.structure/behavior: custom features only where applicable
Diffstat (limited to 'plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice')
-rw-r--r-- | plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/ProviderDispatcher.java | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/ProviderDispatcher.java b/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/ProviderDispatcher.java index b4b6fc258..f7ca47dba 100644 --- a/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/ProviderDispatcher.java +++ b/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/ProviderDispatcher.java @@ -139,15 +139,6 @@ public class ProviderDispatcher { layerConnectionSupport.getFeatureProvider().getCreateConnectionFeatures()
);
}
-
- public ICustomFeature[] getCustomFeatures(ICustomContext context) {
- return concatAll(
- portSupport.getFeatureProvider().getCustomFeatures(context),
- sppSupport.getFeatureProvider().getCustomFeatures(context),
- structureClassSupport.getFeatureProvider().getCustomFeatures(context),
- actorContainerRefSupport.getFeatureProvider().getCustomFeatures(context)
- );
- }
}
private class ToolBehaviorProviderSwitch extends RoomSwitch<IToolBehaviorProvider> {
@@ -293,7 +284,11 @@ public class ProviderDispatcher { @Override
public ICustomFeature[] getCustomFeatures(ICustomContext context) {
- return getAllCustomFeatures(context);
+ IFeatureProvider fp = featureSwitch.doSwitch(getBusinessObject(context));
+ if (fp!=null)
+ return fp.getCustomFeatures(context);
+ else
+ return super.getCustomFeatures(context);
}
private EObject getBusinessObject(IPictogramElementContext context) {
@@ -301,6 +296,15 @@ public class ProviderDispatcher { EObject bo = (EObject) getBusinessObjectForPictogramElement(pictogramElement);
return bo;
}
+
+ private EObject getBusinessObject(ICustomContext context) {
+ PictogramElement[] pes = context.getPictogramElements();
+ if (pes.length>0) {
+ EObject bo = (EObject) getBusinessObjectForPictogramElement(pes[0]);
+ return bo;
+ }
+ return null;
+ }
}
private class DispatchingToolBehaviorProvider extends DefaultToolBehaviorProvider {
@@ -419,10 +423,6 @@ public class ProviderDispatcher { return featureSwitch.getCreateConnectionFeatures();
}
- private ICustomFeature[] getAllCustomFeatures(ICustomContext context) {
- return featureSwitch.getCustomFeatures(context);
- }
-
private static <T> T[] concatAll(T[] first, T[]... rest) {
int totalLength = first.length;
for (T[] array : rest) {
|