Merge "Bug 391523 - Revise getSelectionInfo...() in IToolBehaviorProvider"
diff --git a/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/internal/figures/GFAbstractShape.java b/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/internal/figures/GFAbstractShape.java
index 36e5807..f23173c 100644
--- a/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/internal/figures/GFAbstractShape.java
+++ b/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/internal/figures/GFAbstractShape.java
@@ -10,7 +10,8 @@
* Contributors:
* SAP AG - initial API, implementation and documentation
* mgorning - Bug 363186 - Allow modification of selection and hover state also for anchors
- * cbrand - Bug 370440 - Over scaling of connections and lines after canvas zoom
+ * cbrand - Bug 370440 - Over scaling of connections and lines after canvas zoom
+ * mgorning - Bug 391523 - Revise getSelectionInfo...() in IToolBehaviorProvider
*
* </copyright>
*
@@ -41,6 +42,7 @@
import org.eclipse.graphiti.platform.ga.VisualStateChangedEvent;
import org.eclipse.graphiti.services.Graphiti;
import org.eclipse.graphiti.tb.ISelectionInfo;
+import org.eclipse.graphiti.tb.IShapeSelectionInfo;
import org.eclipse.graphiti.tb.IToolBehaviorProvider;
import org.eclipse.graphiti.ui.internal.config.IConfigurationProviderInternal;
import org.eclipse.graphiti.ui.internal.parts.IPictogramElementDelegate;
@@ -151,8 +153,9 @@
}
/**
- * Returns the IConfigurationProviderInternal. This is just a convenience for
- * <code>getPictogramElementDelegate().getConfigurationProvider()</code>.
+ * Returns the IConfigurationProviderInternal. This is just a convenience
+ * for <code>getPictogramElementDelegate().getConfigurationProvider()</code>
+ * .
*
* @return The IConfigurationProviderInternal.
*/
@@ -371,7 +374,7 @@
IToolBehaviorProvider tbp = getConfigurationProvider().getDiagramTypeProvider()
.getCurrentToolBehaviorProvider();
PictogramElement pe = getPictogramElementDelegate().getPictogramElement();
- ISelectionInfo selectionInfo = null;
+ IShapeSelectionInfo selectionInfo = null;
if (pe instanceof org.eclipse.graphiti.mm.pictograms.Shape) {
selectionInfo = tbp.getSelectionInfoForShape((org.eclipse.graphiti.mm.pictograms.Shape) pe);
} else if (pe instanceof Anchor) {
@@ -381,13 +384,13 @@
return;
}
if (selectionFeedback == IVisualState.SELECTION_PRIMARY) {
- IColorConstant primarySelectionBackGroundColor = selectionInfo.getPrimarySelectionBackGroundColor();
+ IColorConstant primarySelectionBackGroundColor = selectionInfo.getPrimarySelectionBackgroundColor();
if (primarySelectionBackGroundColor != null) {
graphics.setBackgroundColor(DataTypeTransformation.toSwtColor(getConfigurationProvider()
.getResourceRegistry(), primarySelectionBackGroundColor));
}
} else if (selectionFeedback == IVisualState.SELECTION_SECONDARY) {
- IColorConstant secondarySelectionBackGroundColor = selectionInfo.getSecondarySelectionBackGroundColor();
+ IColorConstant secondarySelectionBackGroundColor = selectionInfo.getSecondarySelectionBackgroundColor();
if (secondarySelectionBackGroundColor != null) {
graphics.setBackgroundColor(DataTypeTransformation.toSwtColor(getConfigurationProvider()
.getResourceRegistry(), secondarySelectionBackGroundColor));
diff --git a/plugins/org.eclipse.graphiti/.settings/.api_filters b/plugins/org.eclipse.graphiti/.settings/.api_filters
index ecdaa80..24030ee 100644
--- a/plugins/org.eclipse.graphiti/.settings/.api_filters
+++ b/plugins/org.eclipse.graphiti/.settings/.api_filters
@@ -63,6 +63,24 @@
</filter>
</resource>
<resource path="src/org/eclipse/graphiti/tb/DefaultToolBehaviorProvider.java" type="org.eclipse.graphiti.tb.DefaultToolBehaviorProvider">
+ <filter id="338792546">
+ <message_arguments>
+ <message_argument value="org.eclipse.graphiti.tb.DefaultToolBehaviorProvider"/>
+ <message_argument value="getSelectionInfoForAnchor(Anchor)"/>
+ </message_arguments>
+ </filter>
+ <filter id="338792546">
+ <message_arguments>
+ <message_argument value="org.eclipse.graphiti.tb.DefaultToolBehaviorProvider"/>
+ <message_argument value="getSelectionInfoForConnection(Connection)"/>
+ </message_arguments>
+ </filter>
+ <filter id="338792546">
+ <message_arguments>
+ <message_argument value="org.eclipse.graphiti.tb.DefaultToolBehaviorProvider"/>
+ <message_argument value="getSelectionInfoForShape(Shape)"/>
+ </message_arguments>
+ </filter>
<filter comment="getToolTip changes its return type to Object" id="338792546">
<message_arguments>
<message_argument value="org.eclipse.graphiti.tb.DefaultToolBehaviorProvider"/>
@@ -70,7 +88,81 @@
</message_arguments>
</filter>
</resource>
+ <resource path="src/org/eclipse/graphiti/tb/ISelectionInfo.java" type="org.eclipse.graphiti.tb.ISelectionInfo">
+ <filter id="405901410">
+ <message_arguments>
+ <message_argument value="org.eclipse.graphiti.tb.ISelectionInfo"/>
+ <message_argument value="getHandleBackgroundColor()"/>
+ </message_arguments>
+ </filter>
+ <filter id="405901410">
+ <message_arguments>
+ <message_argument value="org.eclipse.graphiti.tb.ISelectionInfo"/>
+ <message_argument value="getHandleForegroundColor()"/>
+ </message_arguments>
+ </filter>
+ <filter id="405901410">
+ <message_arguments>
+ <message_argument value="org.eclipse.graphiti.tb.ISelectionInfo"/>
+ <message_argument value="getPrimarySelectionBackGroundColor()"/>
+ </message_arguments>
+ </filter>
+ <filter id="405901410">
+ <message_arguments>
+ <message_argument value="org.eclipse.graphiti.tb.ISelectionInfo"/>
+ <message_argument value="getSecondarySelectionBackGroundColor()"/>
+ </message_arguments>
+ </filter>
+ <filter id="405901410">
+ <message_arguments>
+ <message_argument value="org.eclipse.graphiti.tb.ISelectionInfo"/>
+ <message_argument value="setHandleBackgroundColor(IColorConstant)"/>
+ </message_arguments>
+ </filter>
+ <filter id="405901410">
+ <message_arguments>
+ <message_argument value="org.eclipse.graphiti.tb.ISelectionInfo"/>
+ <message_argument value="setHandleForegroundColor(IColorConstant)"/>
+ </message_arguments>
+ </filter>
+ <filter id="405901410">
+ <message_arguments>
+ <message_argument value="org.eclipse.graphiti.tb.ISelectionInfo"/>
+ <message_argument value="setLineStyle(IColorConstant)"/>
+ </message_arguments>
+ </filter>
+ <filter id="405901410">
+ <message_arguments>
+ <message_argument value="org.eclipse.graphiti.tb.ISelectionInfo"/>
+ <message_argument value="setPrimarySelectionBackgroundColor(IColorConstant)"/>
+ </message_arguments>
+ </filter>
+ <filter id="405901410">
+ <message_arguments>
+ <message_argument value="org.eclipse.graphiti.tb.ISelectionInfo"/>
+ <message_argument value="setSecondarySelectionBackgroundColor(IColorConstant)"/>
+ </message_arguments>
+ </filter>
+ </resource>
<resource path="src/org/eclipse/graphiti/tb/IToolBehaviorProvider.java" type="org.eclipse.graphiti.tb.IToolBehaviorProvider">
+ <filter id="405901410">
+ <message_arguments>
+ <message_argument value="org.eclipse.graphiti.tb.IToolBehaviorProvider"/>
+ <message_argument value="getSelectionInfoForAnchor(Anchor)"/>
+ </message_arguments>
+ </filter>
+ <filter id="405901410">
+ <message_arguments>
+ <message_argument value="org.eclipse.graphiti.tb.IToolBehaviorProvider"/>
+ <message_argument value="getSelectionInfoForConnection(Connection)"/>
+ </message_arguments>
+ </filter>
+ <filter id="405901410">
+ <message_arguments>
+ <message_argument value="org.eclipse.graphiti.tb.IToolBehaviorProvider"/>
+ <message_argument value="getSelectionInfoForShape(Shape)"/>
+ </message_arguments>
+ </filter>
<filter comment="getToolTip changes its return type to Object" id="405901410">
<message_arguments>
<message_argument value="org.eclipse.graphiti.tb.IToolBehaviorProvider"/>
@@ -78,6 +170,79 @@
</message_arguments>
</filter>
</resource>
+ <resource path="src/org/eclipse/graphiti/tb/SelectionInfoImpl.java" type="org.eclipse.graphiti.tb.SelectionInfoImpl">
+ <filter id="337764418">
+ <message_arguments>
+ <message_argument value="org.eclipse.graphiti.tb.SelectionInfoImpl"/>
+ </message_arguments>
+ </filter>
+ <filter id="338722907">
+ <message_arguments>
+ <message_argument value="org.eclipse.graphiti.tb.SelectionInfoImpl"/>
+ <message_argument value="SelectionInfoImpl(IColorConstant, IColorConstant, IColorConstant, IColorConstant, LineStyle)"/>
+ </message_arguments>
+ </filter>
+ <filter id="338722907">
+ <message_arguments>
+ <message_argument value="org.eclipse.graphiti.tb.SelectionInfoImpl"/>
+ <message_argument value="SelectionInfoImpl(IColorConstant, IColorConstant, IColorConstant, LineStyle)"/>
+ </message_arguments>
+ </filter>
+ <filter id="338792546">
+ <message_arguments>
+ <message_argument value="org.eclipse.graphiti.tb.SelectionInfoImpl"/>
+ <message_argument value="getHandleBackgroundColor()"/>
+ </message_arguments>
+ </filter>
+ <filter id="338792546">
+ <message_arguments>
+ <message_argument value="org.eclipse.graphiti.tb.SelectionInfoImpl"/>
+ <message_argument value="getHandleForegroundColor()"/>
+ </message_arguments>
+ </filter>
+ <filter id="338792546">
+ <message_arguments>
+ <message_argument value="org.eclipse.graphiti.tb.SelectionInfoImpl"/>
+ <message_argument value="getPrimarySelectionBackGroundColor()"/>
+ </message_arguments>
+ </filter>
+ <filter id="338792546">
+ <message_arguments>
+ <message_argument value="org.eclipse.graphiti.tb.SelectionInfoImpl"/>
+ <message_argument value="getSecondarySelectionBackGroundColor()"/>
+ </message_arguments>
+ </filter>
+ <filter id="338792546">
+ <message_arguments>
+ <message_argument value="org.eclipse.graphiti.tb.SelectionInfoImpl"/>
+ <message_argument value="setHandleBackgroundColor(IColorConstant)"/>
+ </message_arguments>
+ </filter>
+ <filter id="338792546">
+ <message_arguments>
+ <message_argument value="org.eclipse.graphiti.tb.SelectionInfoImpl"/>
+ <message_argument value="setHandleForegroundColor(IColorConstant)"/>
+ </message_arguments>
+ </filter>
+ <filter id="338792546">
+ <message_arguments>
+ <message_argument value="org.eclipse.graphiti.tb.SelectionInfoImpl"/>
+ <message_argument value="setLineStyle(IColorConstant)"/>
+ </message_arguments>
+ </filter>
+ <filter id="338792546">
+ <message_arguments>
+ <message_argument value="org.eclipse.graphiti.tb.SelectionInfoImpl"/>
+ <message_argument value="setPrimarySelectionBackgroundColor(IColorConstant)"/>
+ </message_arguments>
+ </filter>
+ <filter id="338792546">
+ <message_arguments>
+ <message_argument value="org.eclipse.graphiti.tb.SelectionInfoImpl"/>
+ <message_argument value="setSecondarySelectionBackgroundColor(IColorConstant)"/>
+ </message_arguments>
+ </filter>
+ </resource>
<resource path="src/org/eclipse/graphiti/util/PredefinedColoredAreas.java" type="org.eclipse.graphiti.util.PredefinedColoredAreas">
<filter id="1143996420">
<message_arguments>
diff --git a/plugins/org.eclipse.graphiti/src/org/eclipse/graphiti/tb/AnchorSelectionInfoImpl.java b/plugins/org.eclipse.graphiti/src/org/eclipse/graphiti/tb/AnchorSelectionInfoImpl.java
new file mode 100644
index 0000000..d3fa42b
--- /dev/null
+++ b/plugins/org.eclipse.graphiti/src/org/eclipse/graphiti/tb/AnchorSelectionInfoImpl.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2005, 2012 SAP AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API, implementation and documentation
+ * mgorning - Bug 391523 - Revise getSelectionInfo...() in IToolBehaviorProvider
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.graphiti.tb;
+
+/**
+ * @since 0.10
+ */
+public class AnchorSelectionInfoImpl extends ShapeSelectionInfoImpl implements IAnchorSelectionInfo {
+
+}
diff --git a/plugins/org.eclipse.graphiti/src/org/eclipse/graphiti/tb/ConnectionSelectionInfoImpl.java b/plugins/org.eclipse.graphiti/src/org/eclipse/graphiti/tb/ConnectionSelectionInfoImpl.java
new file mode 100644
index 0000000..6332d33
--- /dev/null
+++ b/plugins/org.eclipse.graphiti/src/org/eclipse/graphiti/tb/ConnectionSelectionInfoImpl.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2005, 2012 SAP AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API, implementation and documentation
+ * mgorning - Bug 391523 - Revise getSelectionInfo...() in IToolBehaviorProvider
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.graphiti.tb;
+
+/**
+ * @since 0.10
+ */
+public class ConnectionSelectionInfoImpl extends SelectionInfoImpl implements IConnectionSelectionInfo {
+
+}
diff --git a/plugins/org.eclipse.graphiti/src/org/eclipse/graphiti/tb/DefaultToolBehaviorProvider.java b/plugins/org.eclipse.graphiti/src/org/eclipse/graphiti/tb/DefaultToolBehaviorProvider.java
index e8aee37..51ef6ba 100644
--- a/plugins/org.eclipse.graphiti/src/org/eclipse/graphiti/tb/DefaultToolBehaviorProvider.java
+++ b/plugins/org.eclipse.graphiti/src/org/eclipse/graphiti/tb/DefaultToolBehaviorProvider.java
@@ -13,13 +13,11 @@
* mwenz - Bug 363796 - Make setting of selection width of connections public
* mgorning - Bug 363186 - Allow modification of selection and hover state also for anchors
* mgorning - Bug 386913 - Support also Single-Click-Features
+ * mgorning - Bug 391523 - Revise getSelectionInfo...() in IToolBehaviorProvider
*
* </copyright>
*
*******************************************************************************/
-/*
- * Created on 28.06.2005
- */
package org.eclipse.graphiti.tb;
import java.awt.Polygon;
@@ -132,9 +130,13 @@
return null;
}
- public ISelectionInfo getSelectionInfoForConnection(Connection connection) {
- ISelectionInfo si = new SelectionInfoImpl(IColorConstant.CONNECTION_SELECTION_FG, IColorConstant.HANDLE_FG,
- IColorConstant.HANDLE_BG, LineStyle.DASH);
+ /**
+ * @since 0.10
+ */
+ public IConnectionSelectionInfo getSelectionInfoForConnection(Connection connection) {
+ IConnectionSelectionInfo si = new ConnectionSelectionInfoImpl();
+ si.setColor(IColorConstant.CONNECTION_SELECTION_FG);
+ si.setLineStyle(LineStyle.DASH);
return si;
}
@@ -364,18 +366,23 @@
return NO_RENDERING_DECORATORS;
}
- public ISelectionInfo getSelectionInfoForShape(Shape shape) {
- ISelectionInfo si = new SelectionInfoImpl(IColorConstant.SHAPE_SELECTION_FG, IColorConstant.HANDLE_FG,
- IColorConstant.HANDLE_BG, LineStyle.DASH);
+ /**
+ * @since 0.10
+ */
+ public IShapeSelectionInfo getSelectionInfoForShape(Shape shape) {
+ IShapeSelectionInfo si = new ShapeSelectionInfoImpl();
+ si.setColor(IColorConstant.SHAPE_SELECTION_FG);
+ si.setLineStyle(LineStyle.DASH);
return si;
}
/**
- * @since 0.9
+ * @since 0.10
*/
- public ISelectionInfo getSelectionInfoForAnchor(Anchor anchor) {
- ISelectionInfo si = new SelectionInfoImpl(IColorConstant.SHAPE_SELECTION_FG, IColorConstant.HANDLE_FG,
- IColorConstant.HANDLE_BG, LineStyle.DASH);
+ public IAnchorSelectionInfo getSelectionInfoForAnchor(Anchor anchor) {
+ IAnchorSelectionInfo si = new AnchorSelectionInfoImpl();
+ si.setColor(IColorConstant.SHAPE_SELECTION_FG);
+ si.setLineStyle(LineStyle.DASH);
return si;
}
diff --git a/plugins/org.eclipse.graphiti/src/org/eclipse/graphiti/tb/IAnchorSelectionInfo.java b/plugins/org.eclipse.graphiti/src/org/eclipse/graphiti/tb/IAnchorSelectionInfo.java
new file mode 100644
index 0000000..3041d62
--- /dev/null
+++ b/plugins/org.eclipse.graphiti/src/org/eclipse/graphiti/tb/IAnchorSelectionInfo.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2005, 2012 SAP AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API, implementation and documentation
+ * mgorning - Bug 391523 - Revise getSelectionInfo...() in IToolBehaviorProvider
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.graphiti.tb;
+
+/**
+ * The Interface IAnchorSelectionInfo.
+ *
+ * @noimplement This interface is not intended to be implemented by clients, use
+ * {@link AnchorSelectionInfoImpl} instead
+ * @noextend This interface is not intended to be extended by clients.
+ * @since 0.10
+ */
+public interface IAnchorSelectionInfo extends IShapeSelectionInfo {
+
+}
diff --git a/plugins/org.eclipse.graphiti/src/org/eclipse/graphiti/tb/IConnectionSelectionInfo.java b/plugins/org.eclipse.graphiti/src/org/eclipse/graphiti/tb/IConnectionSelectionInfo.java
new file mode 100644
index 0000000..a9cd97e
--- /dev/null
+++ b/plugins/org.eclipse.graphiti/src/org/eclipse/graphiti/tb/IConnectionSelectionInfo.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2005, 2012 SAP AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API, implementation and documentation
+ * mgorning - Bug 391523 - Revise getSelectionInfo...() in IToolBehaviorProvider
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.graphiti.tb;
+
+/**
+ * The Interface IConnectionSelectionInfo.
+ *
+ * @noimplement This interface is not intended to be implemented by clients, use
+ * {@link ConnectionSelectionInfoImpl} instead
+ * @noextend This interface is not intended to be extended by clients.
+ * @since 0.10
+ */
+public interface IConnectionSelectionInfo extends ISelectionInfo {
+
+}
diff --git a/plugins/org.eclipse.graphiti/src/org/eclipse/graphiti/tb/ISelectionInfo.java b/plugins/org.eclipse.graphiti/src/org/eclipse/graphiti/tb/ISelectionInfo.java
index 32cec0a..39c8554 100644
--- a/plugins/org.eclipse.graphiti/src/org/eclipse/graphiti/tb/ISelectionInfo.java
+++ b/plugins/org.eclipse.graphiti/src/org/eclipse/graphiti/tb/ISelectionInfo.java
@@ -1,7 +1,7 @@
/*******************************************************************************
* <copyright>
*
- * Copyright (c) 2005, 2010 SAP AG.
+ * Copyright (c) 2005, 2012 SAP AG.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -9,6 +9,7 @@
*
* Contributors:
* SAP AG - initial API, implementation and documentation
+ * mgorning - Bug 391523 - Revise getSelectionInfo...() in IToolBehaviorProvider
*
* </copyright>
*
@@ -34,20 +35,6 @@
IColorConstant getColor();
/**
- * Gets the handle foreground color.
- *
- * @return the foreground color of the selection handle
- */
- IColorConstant getHandleForegroundColor();
-
- /**
- * Gets the handle background color.
- *
- * @return the background color of the selection handle
- */
- IColorConstant getHandleBackgroundColor();
-
- /**
* Gets the hover color.
*
* @return the on hover color
@@ -55,26 +42,6 @@
IColorConstant getHoverColor();
/**
- * Gets the primary selection background color. Only used for shapes and if
- * no Rendering style is set.
- *
- * @return the primary selection background color
- *
- * @since 0.8
- */
- IColorConstant getPrimarySelectionBackGroundColor();
-
- /**
- * Gets the secondary selection background color. Only used for shapes and
- * if no Rendering style is set.
- *
- * @return the secondary selection background color
- *
- * @since 0.8
- */
- IColorConstant getSecondarySelectionBackGroundColor();
-
- /**
* Gets the hover color for a shape whose parent is selected.
*
* @return the hover color
@@ -105,26 +72,6 @@
void setHoverColor(IColorConstant hoverColor);
/**
- * Sets color for primary selection background. Only used for shapes and if
- * no Rendering style is set.
- *
- * @param color
- * the color
- * @since 0.8
- */
- void setPrimarySelectionBackgroundColor(IColorConstant color);
-
- /**
- * Sets color for secondary selection background. Only used for shapes and
- * if no Rendering style is set.
- *
- * @param color
- * the color
- * @since 0.8
- */
- void setSecondarySelectionBackgroundColor(IColorConstant color);
-
- /**
* Sets the hover color for shapes whose parent is selected.
*
* @param hoverColor
@@ -133,22 +80,6 @@
void setHoverColorParentSelected(IColorConstant hoverColor);
/**
- * Set the foreground color of the selection handle.
- *
- * @param color
- * the color
- */
- void setHandleForegroundColor(IColorConstant color);
-
- /**
- * Set the background color of the selection handle.
- *
- * @param color
- * the color
- */
- void setHandleBackgroundColor(IColorConstant color);
-
- /**
* Set the line style of the selection.
*
* @param lineStyle
@@ -156,12 +87,4 @@
*/
void setLineStyle(LineStyle lineStyle);
- /**
- * Set hover color.
- *
- * @param color
- * the on hover color
- */
- void setLineStyle(IColorConstant color);
-
}
diff --git a/plugins/org.eclipse.graphiti/src/org/eclipse/graphiti/tb/IShapeSelectionInfo.java b/plugins/org.eclipse.graphiti/src/org/eclipse/graphiti/tb/IShapeSelectionInfo.java
new file mode 100644
index 0000000..e92ae6d
--- /dev/null
+++ b/plugins/org.eclipse.graphiti/src/org/eclipse/graphiti/tb/IShapeSelectionInfo.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2005, 2012 SAP AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API, implementation and documentation
+ * mgorning - Bug 391523 - Revise getSelectionInfo...() in IToolBehaviorProvider
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.graphiti.tb;
+
+import org.eclipse.graphiti.util.IColorConstant;
+
+/**
+ * The Interface IShapeSelectionInfo.
+ *
+ * @noimplement This interface is not intended to be implemented by clients, use
+ * {@link ShapeSelectionInfoImpl} instead
+ * @noextend This interface is not intended to be extended by clients.
+ * @since 0.10
+ */
+public interface IShapeSelectionInfo extends ISelectionInfo {
+ /**
+ * Gets the primary selection background color. Only used if no Rendering
+ * style is set.
+ *
+ * @return the primary selection background color
+ */
+ IColorConstant getPrimarySelectionBackgroundColor();
+
+ /**
+ * Gets the secondary selection background color. Only used if no Rendering
+ * style is set.
+ *
+ * @return the secondary selection background color
+ */
+ IColorConstant getSecondarySelectionBackgroundColor();
+
+ /**
+ * Sets color for primary selection background. Only used if no Rendering
+ * style is set.
+ *
+ * @param color
+ * the color
+ */
+ void setPrimarySelectionBackgroundColor(IColorConstant color);
+
+ /**
+ * Sets color for secondary selection background. Only used if no Rendering
+ * style is set.
+ *
+ * @param color
+ * the color
+ */
+ void setSecondarySelectionBackgroundColor(IColorConstant color);
+
+}
diff --git a/plugins/org.eclipse.graphiti/src/org/eclipse/graphiti/tb/IToolBehaviorProvider.java b/plugins/org.eclipse.graphiti/src/org/eclipse/graphiti/tb/IToolBehaviorProvider.java
index a3ff016..ac252f6 100644
--- a/plugins/org.eclipse.graphiti/src/org/eclipse/graphiti/tb/IToolBehaviorProvider.java
+++ b/plugins/org.eclipse.graphiti/src/org/eclipse/graphiti/tb/IToolBehaviorProvider.java
@@ -12,6 +12,7 @@
* mwenz - Bug 341224: Allow to hide the selection and marquee tools in the palette
* mwenz - Bug 363796 - Make setting of selection width of connections public
* mgorning - Bug 363186 - Allow modification of selection and hover state also for anchors
+ * mgorning - Bug 391523 - Revise getSelectionInfo...() in IToolBehaviorProvider
*
* </copyright>
*
@@ -182,8 +183,9 @@
* @param shape
* the shape
* @return the shape selection info
+ * @since 0.10
*/
- ISelectionInfo getSelectionInfoForShape(Shape shape);
+ IShapeSelectionInfo getSelectionInfoForShape(Shape shape);
/**
* Return the selection info for the given anchor.
@@ -191,9 +193,9 @@
* @param anchor
* the anchor
* @return the anchor selection info
- * @since 0.9
+ * @since 0.10
*/
- ISelectionInfo getSelectionInfoForAnchor(Anchor anchor);
+ IAnchorSelectionInfo getSelectionInfoForAnchor(Anchor anchor);
/**
* Return the selection info for the given connection.
@@ -201,8 +203,9 @@
* @param connection
* the connection
* @return the connection selection info
+ * @since 0.10
*/
- ISelectionInfo getSelectionInfoForConnection(Connection connection);
+ IConnectionSelectionInfo getSelectionInfoForConnection(Connection connection);
/**
* Returns the location info which will be used for direct editing if the
diff --git a/plugins/org.eclipse.graphiti/src/org/eclipse/graphiti/tb/SelectionInfoImpl.java b/plugins/org.eclipse.graphiti/src/org/eclipse/graphiti/tb/SelectionInfoImpl.java
index 25f4797..5691a32 100644
--- a/plugins/org.eclipse.graphiti/src/org/eclipse/graphiti/tb/SelectionInfoImpl.java
+++ b/plugins/org.eclipse.graphiti/src/org/eclipse/graphiti/tb/SelectionInfoImpl.java
@@ -1,7 +1,7 @@
/*******************************************************************************
* <copyright>
*
- * Copyright (c) 2005, 2010 SAP AG.
+ * Copyright (c) 2005, 2012 SAP AG.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -9,6 +9,7 @@
*
* Contributors:
* SAP AG - initial API, implementation and documentation
+ * mgorning - Bug 391523 - Revise getSelectionInfo...() in IToolBehaviorProvider
*
* </copyright>
*
@@ -21,67 +22,16 @@
/**
* The Class SelectionInfoImpl.
*/
-public class SelectionInfoImpl implements ISelectionInfo {
+public abstract class SelectionInfoImpl implements ISelectionInfo {
private IColorConstant color;
- private IColorConstant handleForegroundColor;
-
- private IColorConstant handleBackgroundColor;
-
private IColorConstant hoverColor;
private LineStyle lineStyle;
private IColorConstant hoverColorParentSelected;
- private IColorConstant primarySelectionBackgroundColor;
-
- private IColorConstant secondarySelectionBackgroundColor;
-
- /**
- * Creates a new {@link SelectionInfoImpl}.
- *
- * @param color
- * the color
- * @param handleForegroundColor
- * the handle foreground color
- * @param handleBackgroundColor
- * the handle background color
- * @param lineStyle
- * the line style
- */
- public SelectionInfoImpl(IColorConstant color, IColorConstant handleForegroundColor, IColorConstant handleBackgroundColor,
- LineStyle lineStyle) {
-
- setColor(color);
- setHandleForegroundColor(handleForegroundColor);
- setHandleBackgroundColor(handleBackgroundColor);
- setLineStyle(lineStyle);
- }
-
- /**
- * Creates a new {@link SelectionInfoImpl}.
- *
- * @param color
- * the color
- * @param handleForegroundColor
- * the handle foreground color
- * @param handleBackgroundColor
- * the handle background color
- * @param lineStyle
- * the line style
- */
- public SelectionInfoImpl(IColorConstant color, IColorConstant handleForegroundColor, IColorConstant handleBackgroundColor,
- IColorConstant hoverColor, LineStyle lineStyle) {
-
- setColor(color);
- setHandleForegroundColor(handleForegroundColor);
- setHandleBackgroundColor(handleBackgroundColor);
- setHoverColor(hoverColor);
- setLineStyle(lineStyle);
- }
-
/**
* Creates a new {@link SelectionInfoImpl}.
*/
@@ -92,22 +42,6 @@
return this.color;
}
- public IColorConstant getHandleForegroundColor() {
- return this.handleForegroundColor;
- }
-
- public void setHandleForegroundColor(IColorConstant handleForegroundColor) {
- this.handleForegroundColor = handleForegroundColor;
- }
-
- public IColorConstant getHandleBackgroundColor() {
- return this.handleBackgroundColor;
- }
-
- public void setHandleBackgroundColor(IColorConstant handleBackgroundColor) {
- this.handleBackgroundColor = handleBackgroundColor;
- }
-
public LineStyle getLineStyle() {
return this.lineStyle;
}
@@ -124,10 +58,6 @@
return this.hoverColor;
}
- public void setLineStyle(IColorConstant color) {
-
- }
-
public void setHoverColor(IColorConstant hoverColor) {
this.hoverColor = hoverColor;
@@ -142,20 +72,4 @@
}
- public IColorConstant getPrimarySelectionBackGroundColor() {
- return this.primarySelectionBackgroundColor;
- }
-
- public IColorConstant getSecondarySelectionBackGroundColor() {
- return this.secondarySelectionBackgroundColor;
-
- }
-
- public void setPrimarySelectionBackgroundColor(IColorConstant color) {
- this.primarySelectionBackgroundColor = color;
- }
-
- public void setSecondarySelectionBackgroundColor(IColorConstant color) {
- this.secondarySelectionBackgroundColor = color;
- }
}
diff --git a/plugins/org.eclipse.graphiti/src/org/eclipse/graphiti/tb/ShapeSelectionInfoImpl.java b/plugins/org.eclipse.graphiti/src/org/eclipse/graphiti/tb/ShapeSelectionInfoImpl.java
new file mode 100644
index 0000000..359d736
--- /dev/null
+++ b/plugins/org.eclipse.graphiti/src/org/eclipse/graphiti/tb/ShapeSelectionInfoImpl.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2005, 2012 SAP AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API, implementation and documentation
+ * mgorning - Bug 391523 - Revise getSelectionInfo...() in IToolBehaviorProvider
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.graphiti.tb;
+
+import org.eclipse.graphiti.util.IColorConstant;
+
+/**
+ * @since 0.10
+ */
+public class ShapeSelectionInfoImpl extends SelectionInfoImpl implements IShapeSelectionInfo {
+ private IColorConstant primarySelectionBackgroundColor;
+
+ private IColorConstant secondarySelectionBackgroundColor;
+
+ public IColorConstant getPrimarySelectionBackgroundColor() {
+ return this.primarySelectionBackgroundColor;
+ }
+
+ public IColorConstant getSecondarySelectionBackgroundColor() {
+ return this.secondarySelectionBackgroundColor;
+ }
+
+ public void setPrimarySelectionBackgroundColor(IColorConstant color) {
+ this.primarySelectionBackgroundColor = color;
+ }
+
+ public void setSecondarySelectionBackgroundColor(IColorConstant color) {
+ this.secondarySelectionBackgroundColor = color;
+ }
+}
diff --git a/tests/org.eclipse.graphiti.testtool.sketch/src/org/eclipse/graphiti/testtool/sketch/SketchToolBehavior.java b/tests/org.eclipse.graphiti.testtool.sketch/src/org/eclipse/graphiti/testtool/sketch/SketchToolBehavior.java
index d3ab20b..fdf4ae0 100644
--- a/tests/org.eclipse.graphiti.testtool.sketch/src/org/eclipse/graphiti/testtool/sketch/SketchToolBehavior.java
+++ b/tests/org.eclipse.graphiti.testtool.sketch/src/org/eclipse/graphiti/testtool/sketch/SketchToolBehavior.java
@@ -11,6 +11,7 @@
* SAP AG - initial API, implementation and documentation
* mwenz - Bug 342869 - Image doesn't scale the contained SWT Image on resize
* mwenz - Bug 358255 - Add Border/Background decorators
+ * mgorning - Bug 391523 - Revise getSelectionInfo...() in IToolBehaviorProvider
*
* </copyright>
*
@@ -57,17 +58,19 @@
import org.eclipse.graphiti.platform.IPlatformImageConstants;
import org.eclipse.graphiti.services.Graphiti;
import org.eclipse.graphiti.services.IGaService;
+import org.eclipse.graphiti.tb.ConnectionSelectionInfoImpl;
import org.eclipse.graphiti.tb.ContextButtonEntry;
import org.eclipse.graphiti.tb.ContextEntryHelper;
import org.eclipse.graphiti.tb.ContextMenuEntry;
import org.eclipse.graphiti.tb.DefaultToolBehaviorProvider;
+import org.eclipse.graphiti.tb.IConnectionSelectionInfo;
import org.eclipse.graphiti.tb.IContextButtonEntry;
import org.eclipse.graphiti.tb.IContextButtonPadData;
import org.eclipse.graphiti.tb.IContextMenuEntry;
import org.eclipse.graphiti.tb.IDecorator;
-import org.eclipse.graphiti.tb.ISelectionInfo;
+import org.eclipse.graphiti.tb.IShapeSelectionInfo;
import org.eclipse.graphiti.tb.ImageDecorator;
-import org.eclipse.graphiti.tb.SelectionInfoImpl;
+import org.eclipse.graphiti.tb.ShapeSelectionInfoImpl;
import org.eclipse.graphiti.testtool.sketch.features.ChangeAlignmentFeature;
import org.eclipse.graphiti.testtool.sketch.features.ClearDecoratorsFeature;
import org.eclipse.graphiti.testtool.sketch.features.CornerDimensionFeature;
@@ -95,7 +98,8 @@
private final String imageFilePath;
- public MyObjectCreationToolEntry(String label, String description, ICreateFeature createFeature, String imageFilePath) {
+ public MyObjectCreationToolEntry(String label, String description, ICreateFeature createFeature,
+ String imageFilePath) {
super(label, description, null, null, createFeature);
this.imageFilePath = imageFilePath;
}
@@ -127,13 +131,6 @@
private static boolean TEST_SHOW_WARNING_DECORATORS = false;
- private final ISelectionInfo selectionInfo = new SelectionInfoImpl(IColorConstant.BLUE, IColorConstant.LIGHT_BLUE, IColorConstant.RED,
- LineStyle.DOT);
- {
- selectionInfo.setPrimarySelectionBackgroundColor(IColorConstant.LIGHT_BLUE);
- selectionInfo.setSecondarySelectionBackgroundColor(IColorConstant.LIGHT_ORANGE);
- }
-
/**
* Instantiates a new sketch tool behaviour.
*
@@ -186,9 +183,12 @@
}
@Override
- public ISelectionInfo getSelectionInfoForConnection(Connection connection) {
+ public IConnectionSelectionInfo getSelectionInfoForConnection(Connection connection) {
if (connection instanceof FreeFormConnection) {
- return selectionInfo;
+ IConnectionSelectionInfo si = new ConnectionSelectionInfoImpl();
+ si.setColor(IColorConstant.BLUE);
+ si.setLineStyle(LineStyle.DOT);
+ return si;
}
return super.getSelectionInfoForConnection(connection);
}
@@ -212,7 +212,8 @@
ICustomFeature customFeature = customFeatures[i];
if (customFeature instanceof SketchFontFeature) {
// example for a collapse button
- IContextButtonEntry collapseButton = ContextEntryHelper.createCollapseContextButton(true, customFeature, customContext);
+ IContextButtonEntry collapseButton = ContextEntryHelper.createCollapseContextButton(true,
+ customFeature, customContext);
ret.setCollapseContextButton(collapseButton);
} else if (customFeature.isAvailable(customContext)) {
ContextButtonEntry contextButtonEntry = new ContextButtonEntry(customFeature, customContext);
@@ -413,9 +414,9 @@
}
for (ICreateConnectionFeature createConnectionFeature : createConnectionFeatures) {
- ConnectionCreationToolEntry ccTool = new ConnectionCreationToolEntry(createConnectionFeature.getCreateName(),
- createConnectionFeature.getCreateDescription(), createConnectionFeature.getCreateImageId(),
- createConnectionFeature.getCreateLargeImageId());
+ ConnectionCreationToolEntry ccTool = new ConnectionCreationToolEntry(
+ createConnectionFeature.getCreateName(), createConnectionFeature.getCreateDescription(),
+ createConnectionFeature.getCreateImageId(), createConnectionFeature.getCreateLargeImageId());
ccTool.addCreateConnectionFeature(createConnectionFeature);
if (multiTool != null) {
multiTool.addCreateConnectionFeature(createConnectionFeature);
@@ -443,8 +444,8 @@
createFeature.getCreateDescription(), createFeature, ICON_CAN_FIGURE);
} else {
objectCreationToolEntry = new ObjectCreationToolEntry(createFeature.getCreateName(),
- createFeature.getCreateDescription(), createFeature.getCreateImageId(), createFeature.getCreateLargeImageId(),
- createFeature);
+ createFeature.getCreateDescription(), createFeature.getCreateImageId(),
+ createFeature.getCreateLargeImageId(), createFeature);
}
objectsCompartmentEntry.addToolEntry(objectCreationToolEntry);
}
@@ -507,9 +508,14 @@
}
@Override
- public ISelectionInfo getSelectionInfoForShape(Shape shape) {
+ public IShapeSelectionInfo getSelectionInfoForShape(Shape shape) {
if (shape instanceof ContainerShape) {
- return selectionInfo;
+ IShapeSelectionInfo si = new ShapeSelectionInfoImpl();
+ si.setColor(IColorConstant.BLUE);
+ si.setLineStyle(LineStyle.DOT);
+ si.setPrimarySelectionBackgroundColor(IColorConstant.LIGHT_BLUE);
+ si.setSecondarySelectionBackgroundColor(IColorConstant.LIGHT_ORANGE);
+ return si;
}
return super.getSelectionInfoForShape(shape);
}
@@ -519,7 +525,7 @@
if (SketchUtil.isConnectionPoint(ga.getPictogramElement())) {
return null;
}
-
+
if (ga instanceof AbstractText && ga.getParentGraphicsAlgorithm() != null) {
return getToolTip(ga.getParentGraphicsAlgorithm());
}
@@ -560,7 +566,7 @@
public void postExecute(IExecutionInfo executionInfo) {
super.postExecute(executionInfo);
- //Graphiti.getPeService().moveBendpoints(executionInfo);
+ // Graphiti.getPeService().moveBendpoints(executionInfo);
}
@Override