Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Tiede2014-11-21 13:11:57 +0000
committerMarkus Tiede2014-11-21 13:12:44 +0000
commit714b92a57b89a4d96e887d4f37930ef69d1c4cf0 (patch)
tree229cabda23967c6f2955d6b46190a0d1ffa9453f /org.eclipse.jubula.rc.rcp.e3/src
parent6d6ded29c60bc1e6170e971000729260da891cba (diff)
downloadorg.eclipse.jubula.core-714b92a57b89a4d96e887d4f37930ef69d1c4cf0.tar.gz
org.eclipse.jubula.core-714b92a57b89a4d96e887d4f37930ef69d1c4cf0.tar.xz
org.eclipse.jubula.core-714b92a57b89a4d96e887d4f37930ef69d1c4cf0.zip
Non-sprint task - generics added and now unnecessary casts removed.
Diffstat (limited to 'org.eclipse.jubula.rc.rcp.e3/src')
-rw-r--r--org.eclipse.jubula.rc.rcp.e3/src/org/eclipse/jubula/rc/rcp/e3/accessor/E3Startup.java8
-rw-r--r--org.eclipse.jubula.rc.rcp.e3/src/org/eclipse/jubula/rc/rcp/e3/gef/identifier/ClassCountEditPartIdentifier.java8
-rw-r--r--org.eclipse.jubula.rc.rcp.e3/src/org/eclipse/jubula/rc/rcp/e3/gef/identifier/IEditPartIdentifier.java7
-rw-r--r--org.eclipse.jubula.rc.rcp.e3/src/org/eclipse/jubula/rc/rcp/e3/gef/identifier/StaticEditPartIdentifier.java5
-rw-r--r--org.eclipse.jubula.rc.rcp.e3/src/org/eclipse/jubula/rc/rcp/e3/gef/inspector/FigureHighlighter.java28
-rw-r--r--org.eclipse.jubula.rc.rcp.e3/src/org/eclipse/jubula/rc/rcp/e3/gef/inspector/GefInspectorListenerAppender.java29
-rw-r--r--org.eclipse.jubula.rc.rcp.e3/src/org/eclipse/jubula/rc/rcp/e3/gef/tester/FigureCanvasTester.java30
7 files changed, 58 insertions, 57 deletions
diff --git a/org.eclipse.jubula.rc.rcp.e3/src/org/eclipse/jubula/rc/rcp/e3/accessor/E3Startup.java b/org.eclipse.jubula.rc.rcp.e3/src/org/eclipse/jubula/rc/rcp/e3/accessor/E3Startup.java
index cd717bd31..77f7b0d49 100644
--- a/org.eclipse.jubula.rc.rcp.e3/src/org/eclipse/jubula/rc/rcp/e3/accessor/E3Startup.java
+++ b/org.eclipse.jubula.rc.rcp.e3/src/org/eclipse/jubula/rc/rcp/e3/accessor/E3Startup.java
@@ -326,11 +326,11 @@ public abstract class E3Startup implements IStartup {
* @param mainShell The shell to search for Coolbars and Toolbars.
*/
public static void repaintToolbars(Shell mainShell) {
- List toolbarList = new ArrayList();
+ List<Control> toolbarList = new ArrayList<Control>();
getToolbars(mainShell, toolbarList);
- Iterator iter = toolbarList.iterator();
+ Iterator<Control> iter = toolbarList.iterator();
while (iter.hasNext()) {
- Control toolbar = (Control)iter.next();
+ Control toolbar = iter.next();
toolbar.update();
toolbar.redraw();
toolbar.update();
@@ -347,7 +347,7 @@ public abstract class E3Startup implements IStartup {
* be added.
*/
public static void getToolbars(Composite composite,
- List toolbarList) {
+ List<Control> toolbarList) {
if (composite != null && !composite.isDisposed()) {
Control [] children = composite.getChildren();
diff --git a/org.eclipse.jubula.rc.rcp.e3/src/org/eclipse/jubula/rc/rcp/e3/gef/identifier/ClassCountEditPartIdentifier.java b/org.eclipse.jubula.rc.rcp.e3/src/org/eclipse/jubula/rc/rcp/e3/gef/identifier/ClassCountEditPartIdentifier.java
index 1376beb74..1c21731a4 100644
--- a/org.eclipse.jubula.rc.rcp.e3/src/org/eclipse/jubula/rc/rcp/e3/gef/identifier/ClassCountEditPartIdentifier.java
+++ b/org.eclipse.jubula.rc.rcp.e3/src/org/eclipse/jubula/rc/rcp/e3/gef/identifier/ClassCountEditPartIdentifier.java
@@ -14,6 +14,7 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
+import org.eclipse.draw2d.ConnectionAnchor;
import org.eclipse.gef.EditPart;
/**
@@ -66,8 +67,7 @@ public class ClassCountEditPartIdentifier implements IEditPartIdentifier {
/**
* {@inheritDoc}
*/
- public Map getConnectionAnchors() {
- return new HashMap();
+ public Map<String, ConnectionAnchor> getConnectionAnchors() {
+ return new HashMap<String, ConnectionAnchor>();
}
-
-}
+} \ No newline at end of file
diff --git a/org.eclipse.jubula.rc.rcp.e3/src/org/eclipse/jubula/rc/rcp/e3/gef/identifier/IEditPartIdentifier.java b/org.eclipse.jubula.rc.rcp.e3/src/org/eclipse/jubula/rc/rcp/e3/gef/identifier/IEditPartIdentifier.java
index f386f260f..ced7819a0 100644
--- a/org.eclipse.jubula.rc.rcp.e3/src/org/eclipse/jubula/rc/rcp/e3/gef/identifier/IEditPartIdentifier.java
+++ b/org.eclipse.jubula.rc.rcp.e3/src/org/eclipse/jubula/rc/rcp/e3/gef/identifier/IEditPartIdentifier.java
@@ -12,7 +12,7 @@ package org.eclipse.jubula.rc.rcp.e3.gef.identifier;
import java.util.Map;
-
+import org.eclipse.draw2d.ConnectionAnchor;
/**
* Encapsulates the ability to generate unique IDs for a given
@@ -34,6 +34,5 @@ public interface IEditPartIdentifier {
* @return a map that correlates identifiers (<code>String</code>s) with
* <code>ConnectionAnchor</code>s.
*/
- public Map getConnectionAnchors();
-
-}
+ public Map<String, ConnectionAnchor> getConnectionAnchors();
+} \ No newline at end of file
diff --git a/org.eclipse.jubula.rc.rcp.e3/src/org/eclipse/jubula/rc/rcp/e3/gef/identifier/StaticEditPartIdentifier.java b/org.eclipse.jubula.rc.rcp.e3/src/org/eclipse/jubula/rc/rcp/e3/gef/identifier/StaticEditPartIdentifier.java
index 8a4ab9a12..d21b621e6 100644
--- a/org.eclipse.jubula.rc.rcp.e3/src/org/eclipse/jubula/rc/rcp/e3/gef/identifier/StaticEditPartIdentifier.java
+++ b/org.eclipse.jubula.rc.rcp.e3/src/org/eclipse/jubula/rc/rcp/e3/gef/identifier/StaticEditPartIdentifier.java
@@ -13,6 +13,8 @@ package org.eclipse.jubula.rc.rcp.e3.gef.identifier;
import java.util.Collections;
import java.util.Map;
+import org.eclipse.draw2d.ConnectionAnchor;
+
/**
* Provides a static String as an identifier. This class does not take the
@@ -46,8 +48,7 @@ public class StaticEditPartIdentifier implements IEditPartIdentifier {
/**
* {@inheritDoc}
*/
- public Map getConnectionAnchors() {
+ public Map<String, ConnectionAnchor> getConnectionAnchors() {
return Collections.EMPTY_MAP;
}
-
}
diff --git a/org.eclipse.jubula.rc.rcp.e3/src/org/eclipse/jubula/rc/rcp/e3/gef/inspector/FigureHighlighter.java b/org.eclipse.jubula.rc.rcp.e3/src/org/eclipse/jubula/rc/rcp/e3/gef/inspector/FigureHighlighter.java
index 9d269f799..2c59fb8f0 100644
--- a/org.eclipse.jubula.rc.rcp.e3/src/org/eclipse/jubula/rc/rcp/e3/gef/inspector/FigureHighlighter.java
+++ b/org.eclipse.jubula.rc.rcp.e3/src/org/eclipse/jubula/rc/rcp/e3/gef/inspector/FigureHighlighter.java
@@ -155,25 +155,21 @@ public class FigureHighlighter implements MouseMoveListener {
IEditPartIdentifier editPartIdentifier, Point cursorLocation) {
if (editPartIdentifier != null) {
- Map anchorMap =
+ Map<String, ConnectionAnchor> anchorMap =
editPartIdentifier.getConnectionAnchors();
if (anchorMap != null) {
- Iterator iter = anchorMap.keySet().iterator();
+ Iterator<String> iter = anchorMap.keySet().iterator();
while (iter.hasNext()) {
- Object key = iter.next();
- Object value = anchorMap.get(key);
- if (key instanceof String
- && value instanceof ConnectionAnchor) {
- Point refPoint =
- ((ConnectionAnchor)value).getReferencePoint();
-
- // The "bounds" of an anchor is considered to be
- // 3 pixels in all directions.
- Rectangle refBounds = new Rectangle(
- refPoint.x - 3, refPoint.y - 3, 7, 7);
- if (refBounds.contains(cursorLocation.getSWTPoint())) {
- return refBounds;
- }
+ String key = iter.next();
+ ConnectionAnchor value = anchorMap.get(key);
+ Point refPoint = value.getReferencePoint();
+
+ // The "bounds" of an anchor is considered to be
+ // 3 pixels in all directions.
+ Rectangle refBounds = new Rectangle(
+ refPoint.x - 3, refPoint.y - 3, 7, 7);
+ if (refBounds.contains(cursorLocation.getSWTPoint())) {
+ return refBounds;
}
}
}
diff --git a/org.eclipse.jubula.rc.rcp.e3/src/org/eclipse/jubula/rc/rcp/e3/gef/inspector/GefInspectorListenerAppender.java b/org.eclipse.jubula.rc.rcp.e3/src/org/eclipse/jubula/rc/rcp/e3/gef/inspector/GefInspectorListenerAppender.java
index beb411931..d4986b8c6 100644
--- a/org.eclipse.jubula.rc.rcp.e3/src/org/eclipse/jubula/rc/rcp/e3/gef/inspector/GefInspectorListenerAppender.java
+++ b/org.eclipse.jubula.rc.rcp.e3/src/org/eclipse/jubula/rc/rcp/e3/gef/inspector/GefInspectorListenerAppender.java
@@ -74,7 +74,8 @@ public class GefInspectorListenerAppender implements IAutListenerAppender {
private static class FigureHighlightAppender implements Listener {
/** mapping from control to figure highlighter */
- private Map m_canvasToListener = new HashMap();
+ private Map<FigureCanvas, FigureHighlighter> m_canvasToListener =
+ new HashMap<FigureCanvas, FigureHighlighter>();
/**
* {@inheritDoc}
@@ -92,12 +93,13 @@ public class GefInspectorListenerAppender implements IAutListenerAppender {
* Removes all listeners added by this appender.
*/
public void removeAddedListeners() {
- Iterator iter = m_canvasToListener.keySet().iterator();
+ Iterator<FigureCanvas> iter = m_canvasToListener
+ .keySet().iterator();
while (iter.hasNext()) {
- Control control = (Control)iter.next();
+ Control control = iter.next();
if (!control.isDisposed()) {
FigureHighlighter highlighter =
- (FigureHighlighter)m_canvasToListener.get(control);
+ m_canvasToListener.get(control);
highlighter.removeAddedListeners();
control.removeMouseMoveListener(highlighter);
}
@@ -169,10 +171,10 @@ public class GefInspectorListenerAppender implements IAutListenerAppender {
IEditPartIdentifier editPartIdentifier, Point cursorLocation) {
if (editPartIdentifier != null) {
- Map anchorMap =
+ Map<?, ?> anchorMap =
editPartIdentifier.getConnectionAnchors();
if (anchorMap != null) {
- Iterator iter = anchorMap.keySet().iterator();
+ Iterator<?> iter = anchorMap.keySet().iterator();
while (iter.hasNext()) {
Object key = iter.next();
Object value = anchorMap.get(key);
@@ -242,7 +244,7 @@ public class GefInspectorListenerAppender implements IAutListenerAppender {
EditPart editPart = viewer.findObjectAt(cursorLocation);
EditPart primaryEditPart = FigureCanvasUtil.getPrimaryEditPart(
editPart, viewer.getRootEditPart());
- List idStringList = Collections.EMPTY_LIST;
+ List<String> idStringList = Collections.EMPTY_LIST;
if (primaryEditPart != null) {
idStringList = getPathToRoot(viewer.getRootEditPart(),
@@ -287,10 +289,10 @@ public class GefInspectorListenerAppender implements IAutListenerAppender {
* list will be the identifier for a connection anchor if
* <code>cursorLocation</code> is near such an anchor.
*/
- private List getPathToRoot(RootEditPart root, Point cursorLocation,
- EditPart editPart) {
+ private List<String> getPathToRoot(RootEditPart root,
+ Point cursorLocation, EditPart editPart) {
- List idStringList = new ArrayList();
+ List<String> idStringList = new ArrayList<String>();
EditPart currentEditPart = editPart;
// Check for connection anchor
@@ -351,9 +353,10 @@ public class GefInspectorListenerAppender implements IAutListenerAppender {
* @return a list containing the identifier of each edit part between
* <code>editPart</code> and its root.
*/
- private List getToolPathToRoot(RootEditPart root, EditPart editPart) {
+ private List<String> getToolPathToRoot(RootEditPart root,
+ EditPart editPart) {
- List idStringList = new ArrayList();
+ List<String> idStringList = new ArrayList<String>();
EditPart currentEditPart = editPart;
if (currentEditPart != null) {
@@ -395,7 +398,7 @@ public class GefInspectorListenerAppender implements IAutListenerAppender {
* <code>null</code> if no valid component identifier can be
* generated.
*/
- private IComponentIdentifier createCompId(List idStringList) {
+ private IComponentIdentifier createCompId(List<String> idStringList) {
IComponentIdentifier compId = null;
if (!idStringList.isEmpty()) {
Collections.reverse(idStringList);
diff --git a/org.eclipse.jubula.rc.rcp.e3/src/org/eclipse/jubula/rc/rcp/e3/gef/tester/FigureCanvasTester.java b/org.eclipse.jubula.rc.rcp.e3/src/org/eclipse/jubula/rc/rcp/e3/gef/tester/FigureCanvasTester.java
index 015f3cf37..bcaf7539c 100644
--- a/org.eclipse.jubula.rc.rcp.e3/src/org/eclipse/jubula/rc/rcp/e3/gef/tester/FigureCanvasTester.java
+++ b/org.eclipse.jubula.rc.rcp.e3/src/org/eclipse/jubula/rc/rcp/e3/gef/tester/FigureCanvasTester.java
@@ -114,11 +114,11 @@ public class FigureCanvasTester extends WidgetTester {
EditPart currentEditPart = getPaletteRoot().getContents();
for (int i = 0; i < pathItems.length && currentEditPart != null; i++) {
- List effectiveChildren = currentEditPart.getChildren();
+ List<?> effectiveChildren = currentEditPart.getChildren();
EditPart [] children =
- (EditPart [])effectiveChildren.toArray(
- new EditPart[effectiveChildren.size()]);
+ effectiveChildren.toArray(
+ new EditPart[effectiveChildren.size()]);
boolean itemFound = false;
for (int j = 0; j < children.length && !itemFound; j++) {
Object model = children[j].getModel();
@@ -310,10 +310,11 @@ public class FigureCanvasTester extends WidgetTester {
ConnectionEditPart connectionEditPart = null;
if (sourceEditPart != null) {
- List sourceConnectionList = sourceEditPart.getSourceConnections();
+ List<?> sourceConnectionList = sourceEditPart
+ .getSourceConnections();
ConnectionEditPart [] sourceConnections =
- (ConnectionEditPart [])sourceConnectionList.toArray(
- new ConnectionEditPart[sourceConnectionList.size()]);
+ sourceConnectionList.toArray(
+ new ConnectionEditPart[sourceConnectionList.size()]);
for (int i = 0; i < sourceConnections.length
&& connectionEditPart == null; i++) {
if (sourceConnections[i].getTarget() == targetEditPart) {
@@ -321,10 +322,11 @@ public class FigureCanvasTester extends WidgetTester {
}
}
} else if (targetEditPart != null) {
- List targetConnectionList = targetEditPart.getTargetConnections();
+ List<?> targetConnectionList = targetEditPart
+ .getTargetConnections();
ConnectionEditPart [] targetConnections =
- (ConnectionEditPart [])targetConnectionList.toArray(
- new ConnectionEditPart[targetConnectionList.size()]);
+ targetConnectionList.toArray(
+ new ConnectionEditPart[targetConnectionList.size()]);
for (int i = 0; i < targetConnections.length
&& connectionEditPart == null; i++) {
if (targetConnections[i].getSource() == targetEditPart) {
@@ -606,10 +608,10 @@ public class FigureCanvasTester extends WidgetTester {
EditPart currentEditPart = getRootEditPart().getContents();
for (int i = 0; i < pathItems.length && currentEditPart != null; i++) {
- List effectiveChildren = currentEditPart.getChildren();
+ List<?> effectiveChildren = currentEditPart.getChildren();
EditPart [] children =
- (EditPart [])effectiveChildren.toArray(
- new EditPart[effectiveChildren.size()]);
+ effectiveChildren.toArray(
+ new EditPart[effectiveChildren.size()]);
boolean itemFound = false;
for (int j = 0; j < children.length && !itemFound; j++) {
IEditPartIdentifier childFigureIdentifier =
@@ -713,10 +715,10 @@ public class FigureCanvasTester extends WidgetTester {
IEditPartIdentifier editPartIdentifier =
DefaultEditPartAdapterFactory.loadFigureIdentifier(editPart);
if (editPartIdentifier != null) {
- Map anchorMap =
+ Map<String, ConnectionAnchor> anchorMap =
editPartIdentifier.getConnectionAnchors();
if (anchorMap != null) {
- Iterator anchorMapIter =
+ Iterator<String> anchorMapIter =
anchorMap.keySet().iterator();
while (anchorMapIter.hasNext()) {
Object anchorMapKey = anchorMapIter.next();

Back to the top