Generify o.e.dltk.ruby.ui bundle.
Change-Id: I60838112f881962d443c0b42775407f2f93ba7a4
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
diff --git a/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/docs/RiHelper.java b/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/docs/RiHelper.java
index 594ad24..57d249e 100644
--- a/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/docs/RiHelper.java
+++ b/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/docs/RiHelper.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2016 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.ruby.internal.ui.docs;
@@ -49,7 +48,7 @@
return instance;
}
- private WeakHashMap cache = new WeakHashMap();
+ private WeakHashMap<String, String> cache = new WeakHashMap<String, String>();
private Process riProcess;
private OutputStreamWriter writer;
@@ -243,7 +242,7 @@
}
public synchronized String getDocFor(String keyword) {
- String doc = (String) cache.get(keyword);
+ String doc = cache.get(keyword);
if (doc == null) {
if (checkRiProcess()) {
diff --git a/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/editor/RubyOutlinePage.java b/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/editor/RubyOutlinePage.java
index 1570fd5..43f917f 100644
--- a/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/editor/RubyOutlinePage.java
+++ b/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/editor/RubyOutlinePage.java
@@ -38,7 +38,7 @@
fOutlineViewer, fStore);
String title, helpContext;
- ArrayList actions = new ArrayList(3);
+ ArrayList<MemberFilterAction> actions = new ArrayList<MemberFilterAction>(3);
// Hide variables
title = ActionMessages.MemberFilterActionGroup_hide_variables_label;
@@ -85,8 +85,7 @@
actions.add(hideNamespaces);
// Adding actions to toobar
- MemberFilterAction[] fFilterActions = (MemberFilterAction[]) actions
- .toArray(new MemberFilterAction[actions.size()]);
+ MemberFilterAction[] fFilterActions = actions.toArray(new MemberFilterAction[actions.size()]);
fMemberFilterActionGroup.setActions(fFilterActions);
fMemberFilterActionGroup.contributeToToolBar(toolBarManager);
diff --git a/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/RubyCodeScanner.java b/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/RubyCodeScanner.java
index 045addf..647c45b 100644
--- a/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/RubyCodeScanner.java
+++ b/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/RubyCodeScanner.java
@@ -18,6 +18,7 @@
import org.eclipse.dltk.ui.text.AbstractScriptScanner;
import org.eclipse.dltk.ui.text.IColorManager;
import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.text.rules.IRule;
import org.eclipse.jface.text.rules.IToken;
import org.eclipse.jface.text.rules.WhitespaceRule;
import org.eclipse.jface.text.rules.WordRule;
@@ -83,8 +84,8 @@
}
@Override
- protected List createRules() {
- List/* <IRule> */rules = new ArrayList/* <IRule> */();
+ protected List<IRule> createRules() {
+ List<IRule> rules = new ArrayList<IRule>();
IToken keyword = getToken(IRubyColorConstants.RUBY_KEYWORD);
IToken keywordReturn = getToken(IRubyColorConstants.RUBY_KEYWORD_RETURN);
IToken other = getToken(IRubyColorConstants.RUBY_DEFAULT);
diff --git a/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/RubyPartitionScanner.java b/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/RubyPartitionScanner.java
index 46785b6..0755db3 100644
--- a/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/RubyPartitionScanner.java
+++ b/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/RubyPartitionScanner.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2016 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.ruby.internal.ui.text;
@@ -50,7 +49,7 @@
rubyDoc = new Token(IRubyPartitions.RUBY_DOC);
- List rules = new ArrayList();
+ List<IPredicateRule> rules = new ArrayList<IPredicateRule>();
rules.add(new RDocRule(rubyDoc));
diff --git a/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/RubySemanticUpdateWorker.java b/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/RubySemanticUpdateWorker.java
index ee3e3cf..b04fae4 100644
--- a/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/RubySemanticUpdateWorker.java
+++ b/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/RubySemanticUpdateWorker.java
@@ -181,7 +181,7 @@
stack.pop();
}
- private final Stack stack = new Stack();
+ private final Stack<ASTNode> stack = new Stack<ASTNode>();
private void handleVariableReference(VariableReference ref) {
final String varName = ref.getName();
diff --git a/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/RubySingleQuoteStringScanner.java b/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/RubySingleQuoteStringScanner.java
index 11430c8..c2a8c9e 100644
--- a/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/RubySingleQuoteStringScanner.java
+++ b/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/RubySingleQuoteStringScanner.java
@@ -15,6 +15,7 @@
import org.eclipse.dltk.ui.text.AbstractScriptScanner;
import org.eclipse.dltk.ui.text.IColorManager;
import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.text.rules.IRule;
import org.eclipse.jface.text.rules.WhitespaceRule;
public class RubySingleQuoteStringScanner extends AbstractScriptScanner {
@@ -34,8 +35,8 @@
}
@Override
- protected List createRules() {
- List rules = new ArrayList();
+ protected List<IRule> createRules() {
+ List<IRule> rules = new ArrayList<IRule>();
// Add generic whitespace rule.
rules.add(new WhitespaceRule(new RubyWhitespaceDetector()));
diff --git a/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/hyperlink/RubyRequireHyperlink.java b/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/hyperlink/RubyRequireHyperlink.java
index 3838414..63567c0 100644
--- a/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/hyperlink/RubyRequireHyperlink.java
+++ b/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/hyperlink/RubyRequireHyperlink.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 xored software, Inc.
+ * Copyright (c) 2008, 2016 xored software, Inc.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -109,16 +109,15 @@
if (dialog.open() == Window.OK) {
final Object[] selection = dialog.getResult();
if (selection != null && selection.length > 0) {
- final List result = new ArrayList();
+ final List<ISourceModule> result = new ArrayList<ISourceModule>();
for (int i = 0, size = selection.length; i < size; i++) {
final Object current = selection[i];
if (current instanceof ISourceModule) {
- result.add(current);
+ result.add((ISourceModule) current);
}
}
if (!result.isEmpty()) {
- return (ISourceModule[]) result
- .toArray(new ISourceModule[result.size()]);
+ return result.toArray(new ISourceModule[result.size()]);
}
}
}
diff --git a/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/hyperlink/SourceModuleLookup.java b/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/hyperlink/SourceModuleLookup.java
index e3b94f7..4e65745 100644
--- a/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/hyperlink/SourceModuleLookup.java
+++ b/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/hyperlink/SourceModuleLookup.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 xored software, Inc.
+ * Copyright (c) 2008, 2016 xored software, Inc.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -38,7 +38,7 @@
*/
public static ISourceModule[] lookup(IScriptProject project,
String modulePath, String suffix) throws ModelException {
- final List result = new ArrayList();
+ final List<ISourceModule> result = new ArrayList<ISourceModule>();
final IPath path = new Path(modulePath);
final String fileName = path.lastSegment();
final String folderPath = path.removeLastSegments(1).toString();
@@ -63,8 +63,7 @@
}
}
}
- return (ISourceModule[]) result
- .toArray(new ISourceModule[result.size()]);
+ return result.toArray(new ISourceModule[result.size()]);
}
}
diff --git a/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/rules/RubyPercentStringRule.java b/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/rules/RubyPercentStringRule.java
index 0ac1958..73dcafa 100644
--- a/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/rules/RubyPercentStringRule.java
+++ b/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/rules/RubyPercentStringRule.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2016 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.ruby.internal.ui.text.rules;
@@ -28,9 +27,9 @@
*
* @since 3.1
*/
- private static class DecreasingCharArrayLengthComparator implements Comparator {
- public int compare(Object o1, Object o2) {
- return ((char[]) o2).length - ((char[]) o1).length;
+ private static class DecreasingCharArrayLengthComparator implements Comparator<char[]> {
+ public int compare(char[] o1, char[] o2) {
+ return o2.length - o1.length;
}
}
@@ -55,7 +54,7 @@
* Line delimiter comparator which orders according to decreasing delimiter length.
* @since 3.1
*/
- private Comparator fLineDelimiterComparator= new DecreasingCharArrayLengthComparator();
+ private Comparator<char[]> fLineDelimiterComparator= new DecreasingCharArrayLengthComparator();
/**
* Cached line delimiters.
* @since 3.1
diff --git a/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/rules/RubySlashRegexpRule.java b/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/rules/RubySlashRegexpRule.java
index f74ebbc..2099e84 100644
--- a/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/rules/RubySlashRegexpRule.java
+++ b/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/rules/RubySlashRegexpRule.java
@@ -37,9 +37,9 @@
* @since 3.1
*/
private static class DecreasingCharArrayLengthComparator implements
- Comparator {
- public int compare(Object o1, Object o2) {
- return ((char[]) o2).length - ((char[]) o1).length;
+ Comparator<char[]> {
+ public int compare(char[] o1, char[] o2) {
+ return o2.length - o1.length;
}
}
@@ -49,7 +49,7 @@
*
* @since 3.1
*/
- private Comparator fLineDelimiterComparator = new DecreasingCharArrayLengthComparator();
+ private Comparator<char[]> fLineDelimiterComparator = new DecreasingCharArrayLengthComparator();
/**
* Cached line delimiters.