diff options
author | Markus Keller | 2015-11-30 19:23:22 +0000 |
---|---|---|
committer | Markus Keller | 2015-12-01 12:59:16 +0000 |
commit | 96da92a20589d62dad534245c5d9c4d45618ee95 (patch) | |
tree | db7f27dc0839db136db463ad28a7e763a6a07a91 /org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor | |
parent | 0bbe21e0e553957dd09eda0b29e8c77a98f38048 (diff) | |
download | eclipse.platform.text-96da92a20589d62dad534245c5d9c4d45618ee95.tar.gz eclipse.platform.text-96da92a20589d62dad534245c5d9c4d45618ee95.tar.xz eclipse.platform.text-96da92a20589d62dad534245c5d9c4d45618ee95.zip |
Bug 478673: generify codeI20151201-1100I20151201-0800
Diffstat (limited to 'org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor')
2 files changed, 9 insertions, 9 deletions
diff --git a/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/editors/ColorManager.java b/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/editors/ColorManager.java index 0757efeec..2ccf6461e 100644 --- a/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/editors/ColorManager.java +++ b/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/editors/ColorManager.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. + * Copyright (c) 2000, 2015 IBM Corporation and others. * 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 @@ -20,15 +20,15 @@ import org.eclipse.swt.widgets.Display; public class ColorManager { - protected Map fColorTable = new HashMap(10); + protected Map<RGB, Color> fColorTable = new HashMap<>(10); public void dispose() { - Iterator e = fColorTable.values().iterator(); + Iterator<Color> e = fColorTable.values().iterator(); while (e.hasNext()) - ((Color) e.next()).dispose(); + e.next().dispose(); } public Color getColor(RGB rgb) { - Color color = (Color) fColorTable.get(rgb); + Color color = fColorTable.get(rgb); if (color == null) { color = new Color(Display.getCurrent(), rgb); fColorTable.put(rgb, color); diff --git a/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/template/AntVariableResolver.java b/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/template/AntVariableResolver.java index f94551325..9e1623a16 100644 --- a/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/template/AntVariableResolver.java +++ b/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/template/AntVariableResolver.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2015 IBM Corporation and others. * 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 @@ -25,11 +25,11 @@ public class AntVariableResolver extends TemplateVariableResolver { protected String[] resolveAll(TemplateContext context) { String[] proposals= new String[] { "${srcDir}", "${dstDir}" }; //$NON-NLS-1$ //$NON-NLS-2$ - Arrays.sort(proposals, new Comparator() { + Arrays.sort(proposals, new Comparator<String>() { @Override - public int compare(Object o1, Object o2) { - return getCommonPrefixLength(getType(), (String) o2) - getCommonPrefixLength(getType(), (String) o1); + public int compare(String o1, String o2) { + return getCommonPrefixLength(getType(), o2) - getCommonPrefixLength(getType(), o1); } private int getCommonPrefixLength(String type, String var) { |