diff options
author | Markus Tiede | 2014-06-25 12:34:57 +0000 |
---|---|---|
committer | Markus Tiede | 2014-06-25 12:34:57 +0000 |
commit | cdc5342e2b9eb8a5d7bda54e6ba5626e97727b1f (patch) | |
tree | 3d32b7c0cc3cbe6a5eee47f942f846c764bf84b8 /org.eclipse.jubula.rc.swing/src | |
parent | 6f4ca45eca0fd344ab605109ccd06bac5f1f72a9 (diff) | |
download | org.eclipse.jubula.core-cdc5342e2b9eb8a5d7bda54e6ba5626e97727b1f.tar.gz org.eclipse.jubula.core-cdc5342e2b9eb8a5d7bda54e6ba5626e97727b1f.tar.xz org.eclipse.jubula.core-cdc5342e2b9eb8a5d7bda54e6ba5626e97727b1f.zip |
Non-sprint task - minor refactoring: reduce type safety warnings.
Diffstat (limited to 'org.eclipse.jubula.rc.swing/src')
5 files changed, 71 insertions, 66 deletions
diff --git a/org.eclipse.jubula.rc.swing/src/org/eclipse/jubula/rc/swing/driver/KeyCodeConverter.java b/org.eclipse.jubula.rc.swing/src/org/eclipse/jubula/rc/swing/driver/KeyCodeConverter.java index 0eda6a0e9..748e06e5b 100644 --- a/org.eclipse.jubula.rc.swing/src/org/eclipse/jubula/rc/swing/driver/KeyCodeConverter.java +++ b/org.eclipse.jubula.rc.swing/src/org/eclipse/jubula/rc/swing/driver/KeyCodeConverter.java @@ -31,10 +31,10 @@ public class KeyCodeConverter { /** * The Converter Map. */ - private static Map converterTable = null; + private static Map<String, Integer> converterTable = null; static { - converterTable = new HashMap(); + converterTable = new HashMap<String, Integer>(); converterTable.put(CompSystemConstants.MODIFIER_NONE, new Integer(-1)); converterTable.put(CompSystemConstants.MODIFIER_SHIFT, new Integer(KeyEvent.VK_SHIFT)); @@ -68,7 +68,7 @@ public class KeyCodeConverter { throw new RobotException("Key is null!", //$NON-NLS-1$ EventFactory.createConfigErrorEvent()); } - final Integer keyCode = (Integer)converterTable.get(key.toLowerCase()); + final Integer keyCode = converterTable.get(key.toLowerCase()); if (keyCode == null) { throw new RobotException("No KeyCode found for key '" + key + "'", //$NON-NLS-1$//$NON-NLS-2$ EventFactory.createConfigErrorEvent()); diff --git a/org.eclipse.jubula.rc.swing/src/org/eclipse/jubula/rc/swing/listener/CheckListener.java b/org.eclipse.jubula.rc.swing/src/org/eclipse/jubula/rc/swing/listener/CheckListener.java index 3e433874b..94e6c2cdf 100644 --- a/org.eclipse.jubula.rc.swing/src/org/eclipse/jubula/rc/swing/listener/CheckListener.java +++ b/org.eclipse.jubula.rc.swing/src/org/eclipse/jubula/rc/swing/listener/CheckListener.java @@ -156,7 +156,8 @@ public class CheckListener extends AbstractAutSwingEventListener { .getIdentifier(getCurrentComponent()); } - Map checkValues = getCheckValues(getCurrentComponent()); + Map<String, String> checkValues = getCheckValues( + getCurrentComponent()); String logName = m_recordHelper.generateLogicalName( getCurrentComponent(), id); openCheckDialog(id, checkValues, logName); @@ -176,7 +177,7 @@ public class CheckListener extends AbstractAutSwingEventListener { * @param logName logical Name */ protected void openCheckDialog(IComponentIdentifier id, - Map checkValues, String logName) { + Map<String, String> checkValues, String logName) { try { // send a message with the identifier of the selected component AUTServer.getInstance().setMode( @@ -214,8 +215,8 @@ public class CheckListener extends AbstractAutSwingEventListener { * @param enabled String * @return the map with added focus-, existence- and enablement-information */ - protected Map addFocExistEnbl(Map valueMap, String hasFocus, - String exists, String enabled) { + protected Map<String, String> addFocExistEnbl(Map<String, String> valueMap, + String hasFocus, String exists, String enabled) { valueMap.put("CompSystem.HasFocus", hasFocus); //$NON-NLS-1$ valueMap.put("CompSystem.IsExisting", exists); //$NON-NLS-1$ valueMap.put("CompSystem.IsEnabled", enabled); //$NON-NLS-1$ @@ -226,8 +227,8 @@ public class CheckListener extends AbstractAutSwingEventListener { * @param component Component * @return the map of values to check */ - protected Map getCheckValues(Component component) { - Map valueMap = new HashMap(); + protected Map<String, String> getCheckValues(Component component) { + Map<String, String> valueMap = new HashMap<String, String>(); if (component instanceof JTextComponent) { valueMap = getTextCompValues(component); } @@ -262,8 +263,8 @@ public class CheckListener extends AbstractAutSwingEventListener { * @param c Component * @return text values to check */ - private Map getTextCompValues(Component c) { - Map map = new HashMap(); + private Map<String, String> getTextCompValues(Component c) { + Map<String, String> map = new HashMap<String, String>(); JTextComponent t = (JTextComponent)c; String text = StringParsing.singleQuoteText(t.getText()); @@ -282,8 +283,8 @@ public class CheckListener extends AbstractAutSwingEventListener { * @param c Component * @return button values to check */ - private Map getButtonValues(Component c) { - Map map = new HashMap(); + private Map<String, String> getButtonValues(Component c) { + Map<String, String> map = new HashMap<String, String>(); AbstractButton ab = (AbstractButton)c; String text = StringParsing.singleQuoteText(ab.getText()); String hasFocus = StringParsing.boolToString(ab.hasFocus()); @@ -300,8 +301,8 @@ public class CheckListener extends AbstractAutSwingEventListener { * @param c Component * @return label values to check */ - private Map getLabelValues(Component c) { - Map map = new HashMap(); + private Map<String, String> getLabelValues(Component c) { + Map<String, String> map = new HashMap<String, String>(); JLabel lbl = (JLabel)c; String text = StringParsing.singleQuoteText(lbl.getText()); String hasFocus = StringParsing.boolToString(lbl.hasFocus()); @@ -316,8 +317,8 @@ public class CheckListener extends AbstractAutSwingEventListener { * @param c Component * @return tree values to check */ - private Map getTreeValues(Component c) { - Map map = new HashMap(); + private Map<String, String> getTreeValues(Component c) { + Map<String, String> map = new HashMap<String, String>(); JTree tre = (JTree)c; if (tre.getSelectionCount() != 0) { TreePath[] selNodes = tre.getSelectionPaths(); @@ -353,8 +354,8 @@ public class CheckListener extends AbstractAutSwingEventListener { * @param c Component * @return list values to check */ - private Map getListValues(Component c) { - Map map = new HashMap(); + private Map<String, String> getListValues(Component c) { + Map<String, String> map = new HashMap<String, String>(); JList lst = (JList)c; if (lst.getSelectedIndices().length != 0) { String[] entries = m_recordHelper.getRenderedListValues(lst); @@ -384,8 +385,8 @@ public class CheckListener extends AbstractAutSwingEventListener { * @param c Component * @return combo values to check */ - private Map getComboValues(Component c) { - Map map = new HashMap(); + private Map<String, String> getComboValues(Component c) { + Map<String, String> map = new HashMap<String, String>(); JComboBox cbx = (JComboBox)c; String cbxText = StringConstants.EMPTY; boolean isCbxItem = true; @@ -422,8 +423,8 @@ public class CheckListener extends AbstractAutSwingEventListener { * @param c Component * @return tabbedpane values to check */ - private Map getTpnValues(Component c) { - Map map = new HashMap(); + private Map<String, String> getTpnValues(Component c) { + Map<String, String> map = new HashMap<String, String>(); JTabbedPane tp = (JTabbedPane)c; String hasFocus = StringParsing.boolToString(tp.hasFocus()); String exists = StringParsing.boolToString(tp.isShowing()); @@ -445,8 +446,8 @@ public class CheckListener extends AbstractAutSwingEventListener { * @param c Component * @return table values to check */ - private Map getTableValues(Component c) { - Map map = new HashMap(); + private Map<String, String> getTableValues(Component c) { + Map<String, String> map = new HashMap<String, String>(); JTable tbl = (JTable)c; int row = tbl.getSelectedRow(); int column = tbl.getSelectedColumn(); @@ -479,8 +480,8 @@ public class CheckListener extends AbstractAutSwingEventListener { * @param c Component * @return text values to check */ - private Map getMenuItemValues(Component c) { - Map map = new HashMap(); + private Map<String, String> getMenuItemValues(Component c) { + Map<String, String> map = new HashMap<String, String>(); JMenuItem m = (JMenuItem)c; String menupath = m_recordHelper.getPath(m); @@ -506,7 +507,7 @@ public class CheckListener extends AbstractAutSwingEventListener { */ private void sendMessage(IComponentIdentifier id, org.eclipse.jubula.tools.xml.businessmodell.Component comp, - Map checkValues, String logName) + Map<String, String> checkValues, String logName) throws CommunicationException { ServerShowDialogMessage message = new ServerShowDialogMessage(comp, id, checkValues); diff --git a/org.eclipse.jubula.rc.swing/src/org/eclipse/jubula/rc/swing/listener/RecordActions.java b/org.eclipse.jubula.rc.swing/src/org/eclipse/jubula/rc/swing/listener/RecordActions.java index 4766b417e..594415a9e 100644 --- a/org.eclipse.jubula.rc.swing/src/org/eclipse/jubula/rc/swing/listener/RecordActions.java +++ b/org.eclipse.jubula.rc.swing/src/org/eclipse/jubula/rc/swing/listener/RecordActions.java @@ -83,13 +83,15 @@ public class RecordActions { private int[] m_tableRowColumn = {0, 0}; /** map to store contents of TextComponents */ - private Map m_map = new HashMap(); + private Map<Component, String> m_map = new HashMap<Component, String>(); /** map to store logical Names */ - private Map m_logNameMap = new HashMap(); + private Map<String, IComponentIdentifier> m_logNameMap = + new HashMap<String, IComponentIdentifier>(); /** map to store technical Names */ - private Map m_techNameMap = new HashMap(); + private Map<Component, String> m_techNameMap = new + HashMap<Component, String>(); /** mouse button for popups */ private int m_popupMouseBtn = MouseEvent.BUTTON3; @@ -108,14 +110,14 @@ public class RecordActions { * contents of TextComponents * @return map */ - public Map getTextCompContent() { + public Map<Component, String> getTextCompContent() { return m_map; } /** * contents of TextComponents * @param map The message data */ - public void setTextCompContent(Map map) { + public void setTextCompContent(Map<Component, String> map) { m_map = map; } /** @@ -204,7 +206,7 @@ public class RecordActions { entr = entr.concat(","); //$NON-NLS-1$ } } - List lstValues = new LinkedList(); + List<String> lstValues = new LinkedList<String>(); lstValues.add(entr); lstValues.add(Constants.REC_OPERATOR); lstValues.add(Constants.REC_SEARCH_MODE); @@ -231,7 +233,7 @@ public class RecordActions { count = 1; } String clCount = String.valueOf(count); - List treValues = new LinkedList(); + List<String> treValues = new LinkedList<String>(); treValues.add(Constants.REC_SEARCH_MODE); treValues.add("0"); //$NON-NLS-1$ treValues.add(nodepath); @@ -257,7 +259,7 @@ public class RecordActions { String nodepath = null; nodepath = m_recordHelper.treepathToTextpath(jtre, path); Action a = m_recordHelper.compSysToAction(id, collOrExp); - java.util.List treValues = new LinkedList(); + java.util.List<String> treValues = new LinkedList<String>(); treValues.add(Constants.REC_SEARCH_MODE); treValues.add("0"); //$NON-NLS-1$ treValues.add(nodepath); @@ -276,7 +278,7 @@ public class RecordActions { */ protected void selectTab(JTabbedPane jtpn, IComponentIdentifier id, Action a) { - List tpnValues = new LinkedList(); + List<String> tpnValues = new LinkedList<String>(); String tpnTitle = StringParsing.singleQuoteText(jtpn .getTitleAt(jtpn.getSelectedIndex())); tpnValues.add(tpnTitle); @@ -300,7 +302,7 @@ public class RecordActions { if (cbxText.equals(StringConstants.EMPTY) || cbxText == null) { cbxText = Constants.EMPTY_ITEM; } - List cbxValues = new LinkedList(); + List<String> cbxValues = new LinkedList<String>(); cbxValues.add(cbxText); cbxValues.add(Constants.REC_OPERATOR); cbxValues.add(Constants.REC_SEARCH_MODE); @@ -329,7 +331,7 @@ public class RecordActions { .toString()); String rowStr = (new Integer(row + 1)).toString(); String columnStr = (new Integer(column + 1)).toString(); - List tblValues = new LinkedList(); + List<String> tblValues = new LinkedList<String>(); tblValues.add(rowStr); tblValues.add(MatchUtil.EQUALS); tblValues.add(columnStr); @@ -377,7 +379,7 @@ public class RecordActions { Action a = new Action(); if (comp instanceof JComponent) { String pth = m_recordHelper.getPath(mi); - List parValues = new LinkedList(); + List<String> parValues = new LinkedList<String>(); parValues.add(pth); parValues.add(Constants.REC_OPERATOR); @@ -417,7 +419,7 @@ public class RecordActions { Action a = new Action(); a = m_recordHelper.compSysToAction(id, "CompSystem.KeyStroke"); //$NON-NLS-1$ - List parameterValues = new LinkedList(); + List<String> parameterValues = new LinkedList<String>(); String modifierKey = null; if (ke.getModifiers() == 0) { modifierKey = "none"; //$NON-NLS-1$ @@ -465,7 +467,7 @@ public class RecordActions { String mbutton = (new Integer(me.getButton()) .toString()); Action a = m_recordHelper.compSysToAction(id, "CompSystem.Click"); //$NON-NLS-1$ - List parValues = new LinkedList(); + List<String> parValues = new LinkedList<String>(); parValues.add(clCount); parValues.add(mbutton); @@ -498,7 +500,7 @@ public class RecordActions { int percentY = (int)(me.getY() / bounds.getHeight() * 100); String percentYString = new Integer(percentY).toString(); String units = Constants.REC_UNITS; - List parValues = new LinkedList(); + List<String> parValues = new LinkedList<String>(); parValues.add(clCount); parValues.add(mbutton); parValues.add(percentXString); @@ -580,7 +582,7 @@ public class RecordActions { id = ComponentHandler.getIdentifier(src); Action a = new Action(); a = m_recordHelper.compSysToAction(id, "CompSystem.InputText"); //$NON-NLS-1$ - List parameterValues = new LinkedList(); + List<String> parameterValues = new LinkedList<String>(); text = StringParsing.singleQuoteText(text); parameterValues.add(text); String logName = createLogicalName(src, id); @@ -613,7 +615,7 @@ public class RecordActions { int column = getTableRowColumn()[1]; String rowStr = (new Integer(row + 1)).toString(); String columnStr = (new Integer(column + 1)).toString(); - List parameterValues = new LinkedList(); + List<String> parameterValues = new LinkedList<String>(); if (txt.equals(StringConstants.EMPTY) || txt == null) { txt = "''"; //$NON-NLS-1$ } @@ -667,7 +669,7 @@ public class RecordActions { timeout = new Integer(timeoutInt).toString(); } - java.util.List winValues = new LinkedList(); + java.util.List<String> winValues = new LinkedList<String>(); winValues.add(title); winValues.add(operator); winValues.add(timeout); @@ -683,7 +685,7 @@ public class RecordActions { * @param parValues List of values */ private void createCAP(Action a, - IComponentIdentifier id, List parValues) { + IComponentIdentifier id, List<String> parValues) { String defaultName = "default"; //$NON-NLS-1$ createCAP(a, id, parValues, defaultName); } @@ -696,7 +698,7 @@ public class RecordActions { * @param logName Logical Name */ private void createCAP(Action a, - IComponentIdentifier id, List parValues, String logName) { + IComponentIdentifier id, List<String> parValues, String logName) { MessageCap messageCap = new MessageCap(); // setup Action in MessageCap @@ -708,7 +710,7 @@ public class RecordActions { messageCap.setCi(id); // setup parameters in MessageCap - List parameterValues = parValues; + List<String> parameterValues = parValues; List params = a.getParams(); for (int i = 0; i < params.size(); i++) { @@ -718,7 +720,7 @@ public class RecordActions { String emptyString = StringConstants.EMPTY; String value = emptyString.equals(parameterValues.get(i)) ? null - : (String)parameterValues.get(i); + : parameterValues.get(i); messageParam.setValue(value); messageCap.addMessageParam(messageParam); @@ -748,21 +750,21 @@ public class RecordActions { */ private String createLogicalName(Component c, IComponentIdentifier id) { - String logName = (String)m_techNameMap.get(c); + String logName = m_techNameMap.get(c); if (logName == null) { logName = m_recordHelper.generateLogicalName(c, id); if (logName != null) { IComponentIdentifier id2 = - (IComponentIdentifier)m_logNameMap.get(logName); + m_logNameMap.get(logName); if (m_logNameMap.containsKey(logName)) { if (!(m_recordHelper.isCiEqual(id, id2))) { - Collection col = m_techNameMap.values(); - Iterator it = col.iterator(); + Collection<String> col = m_techNameMap.values(); + Iterator<String> it = col.iterator(); int counter = 0; while (it.hasNext()) { - String name = (String)it.next(); + String name = it.next(); if (name.equals(logName) || name.equals( logName + "_" + (counter + 1))) { //$NON-NLS-1$ diff --git a/org.eclipse.jubula.rc.swing/src/org/eclipse/jubula/rc/swing/listener/RecordHelper.java b/org.eclipse.jubula.rc.swing/src/org/eclipse/jubula/rc/swing/listener/RecordHelper.java index 599fee8f5..7d634d25a 100644 --- a/org.eclipse.jubula.rc.swing/src/org/eclipse/jubula/rc/swing/listener/RecordHelper.java +++ b/org.eclipse.jubula.rc.swing/src/org/eclipse/jubula/rc/swing/listener/RecordHelper.java @@ -73,7 +73,8 @@ public class RecordHelper { * Map for translating keycodes from keyevents to the ITE * Integer <=> String */ - private static final Map KEYCODE_MAP = new HashMap(); + private static final Map<Integer, String> KEYCODE_MAP = + new HashMap<Integer, String>(); static { // Swing Key Code <=> Value to Enter @@ -138,7 +139,8 @@ public class RecordHelper { /** Map for translating modifiers from keyevents to the ITE * Integer <=> String */ - private static final Map MODIFIER_MAP = new HashMap(); + private static final Map<Integer, String> MODIFIER_MAP = + new HashMap<Integer, String>(); static { // Swing Modifier <=> Value to Enter @@ -194,7 +196,7 @@ public class RecordHelper { throws StepExecutionException { String keyname = KEYCODE_MAP.containsKey(new Integer(keycode)) - ? (String)KEYCODE_MAP.get(new Integer(keycode)) : null; + ? KEYCODE_MAP.get(new Integer(keycode)) : null; if (keyname == null && log.isInfoEnabled()) { log.info("The keycode '" + keycode //$NON-NLS-1$ @@ -213,7 +215,7 @@ public class RecordHelper { throws StepExecutionException { String modname = MODIFIER_MAP.containsKey(new Integer(modifier)) - ? (String)MODIFIER_MAP.get(new Integer(modifier)) : null; + ? MODIFIER_MAP.get(new Integer(modifier)) : null; if (modname == null && log.isInfoEnabled()) { log.info("The modifier '" + modifier //$NON-NLS-1$ diff --git a/org.eclipse.jubula.rc.swing/src/org/eclipse/jubula/rc/swing/tester/util/TreeOperationContext.java b/org.eclipse.jubula.rc.swing/src/org/eclipse/jubula/rc/swing/tester/util/TreeOperationContext.java index 4473a4183..8c4236651 100644 --- a/org.eclipse.jubula.rc.swing/src/org/eclipse/jubula/rc/swing/tester/util/TreeOperationContext.java +++ b/org.eclipse.jubula.rc.swing/src/org/eclipse/jubula/rc/swing/tester/util/TreeOperationContext.java @@ -73,7 +73,7 @@ public class TreeOperationContext extends AbstractTreeOperationContext { return getRootNodes(); } int childCount = m_model.getChildCount(parent); - List childList = new ArrayList(); + List<Object> childList = new ArrayList<Object>(); for (int i = 0; i < childCount; i++) { childList.add(m_model.getChild(parent, i)); } @@ -84,8 +84,8 @@ public class TreeOperationContext extends AbstractTreeOperationContext { /** * {@inheritDoc} */ - public Collection getNodeTextList(Object node) { - Collection res = new ArrayList(); + public Collection<String> getNodeTextList(Object node) { + Collection<String> res = new ArrayList<String>(); int row = getRowForTreeNode(node); String valText = convertValueToText(node, row); if (valText != null) { @@ -218,7 +218,7 @@ public class TreeOperationContext extends AbstractTreeOperationContext { */ private Object[] getPathToRoot(Object node) { Object rootNode = m_model.getRoot(); - List path = getPathToRootImpl(node, rootNode); + List<Object> path = getPathToRootImpl(node, rootNode); return path.toArray(); } @@ -457,16 +457,16 @@ public class TreeOperationContext extends AbstractTreeOperationContext { * @param currentNode The node currently being checked. * @return a List containing the elements of the path in the proper order. */ - private List getPathToRootImpl(Object node, Object currentNode) { + private List<Object> getPathToRootImpl(Object node, Object currentNode) { if (ObjectUtils.equals(currentNode, node)) { - List retList = new ArrayList(); + List<Object> retList = new ArrayList<Object>(); retList.add(currentNode); return retList; } int childCount = m_model.getChildCount(currentNode); for (int i = 0; i < childCount; i++) { - List path = getPathToRootImpl( + List<Object> path = getPathToRootImpl( node, m_model.getChild(currentNode, i)); if (path != null) { // prepend the current node to the path and return |