Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian de Alwis2016-04-07 16:20:29 +0000
committerBrian de Alwis2016-04-08 14:37:13 +0000
commit87502bc98ec1c89e8adba4df7aa86d3e12dd4a06 (patch)
tree9885c30210bdb6aaede8ed576bf769d97681fea8
parent3690d52e9e3c1f9452c3061a4e3fe91f006395d6 (diff)
downloadeclipse.platform.ua-87502bc98ec1c89e8adba4df7aa86d3e12dd4a06.tar.gz
eclipse.platform.ua-87502bc98ec1c89e8adba4df7aa86d3e12dd4a06.tar.xz
eclipse.platform.ua-87502bc98ec1c89e8adba4df7aa86d3e12dd4a06.zip
Bug 491265 - Generify org.eclipse.ui.intro*
Move org.eclipse.ui.intro.universal to JavaSE-1.8 Fix leaked resources Change-Id: I831a65808709853459129c20244c42a84dd6bf02
-rw-r--r--org.eclipse.ua.tests/base/org/eclipse/ua/tests/util/FileUtil.java4
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/dynamic/DynamicXHTMLProcessorTest.java12
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/preferences/ProductPreferencesTest.java2
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/HelpServerInterrupt.java9
-rw-r--r--org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/contentdetect/ContentDetectorTest.java2
-rw-r--r--org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/util/IntroModelSerializer.java4
-rw-r--r--org.eclipse.ui.intro.universal/.classpath2
-rw-r--r--org.eclipse.ui.intro.universal/.settings/org.eclipse.jdt.core.prefs17
-rw-r--r--org.eclipse.ui.intro.universal/META-INF/MANIFEST.MF2
-rw-r--r--org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/CustomizationContentsArea.java6
-rw-r--r--org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/GroupData.java20
-rw-r--r--org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/IntroData.java10
-rw-r--r--org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/PageData.java26
-rw-r--r--org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/UniversalIntroConfigurer.java46
-rw-r--r--org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/contentdetect/ContentDetectHelper.java8
-rw-r--r--org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/contentdetect/ContentDetector.java4
-rw-r--r--org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/util/PreferenceArbiter.java8
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/html/FormattedHTMLElement.java3
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/html/HTMLElement.java24
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/AbstractIntroContainer.java18
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/AbstractIntroPage.java23
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/ExtensionMap.java4
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/History.java6
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroExtensionContent.java11
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroHomePage.java4
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroLaunchBarElement.java6
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroModelRoot.java19
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroPartPresentation.java6
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroSearchParticipant.java10
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroTheme.java6
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/loader/BaseExtensionPointManager.java11
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/loader/ContentProviderManager.java11
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/loader/SharedConfigExtensionsManager.java12
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/url/IntroURL.java8
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/util/FindSupport.java77
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/util/ModelUtil.java4
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/parts/StandbyPart.java11
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/swt/PageStyleManager.java21
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/util/IntroModelSerializer.java14
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/util/StringUtil.java2
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/intro/config/CustomizableIntroPart.java8
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/intro/config/IntroConfigurer.java4
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/intro/config/IntroElement.java9
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/intro/contentproviders/EclipseRSSViewer.java18
44 files changed, 257 insertions, 275 deletions
diff --git a/org.eclipse.ua.tests/base/org/eclipse/ua/tests/util/FileUtil.java b/org.eclipse.ua.tests/base/org/eclipse/ua/tests/util/FileUtil.java
index e0eb15af3..4e35b0fee 100644
--- a/org.eclipse.ua.tests/base/org/eclipse/ua/tests/util/FileUtil.java
+++ b/org.eclipse.ua.tests/base/org/eclipse/ua/tests/util/FileUtil.java
@@ -40,7 +40,9 @@ public class FileUtil {
* be encoded as UTF-8).
*/
public static String getContents(String absolutePath) throws IOException {
- return readString(new FileInputStream(absolutePath));
+ try (FileInputStream fis = new FileInputStream(absolutePath)) {
+ return readString(fis);
+ }
}
/**
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/dynamic/DynamicXHTMLProcessorTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/dynamic/DynamicXHTMLProcessorTest.java
index 96ad6cbe8..7038662aa 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/dynamic/DynamicXHTMLProcessorTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/dynamic/DynamicXHTMLProcessorTest.java
@@ -39,16 +39,18 @@ public class DynamicXHTMLProcessorTest {
private String process(String path) throws Exception {
Bundle bundle = UserAssistanceTestPlugin.getDefault().getBundle();
- InputStream is = getProcessedInput(path, bundle);
- return readStream(is);
+ try (InputStream is = getProcessedInput(path, bundle)) {
+ return readStream(is);
+ }
}
protected InputStream getProcessedInput(String path, Bundle bundle)
throws IOException, SAXException, ParserConfigurationException,
TransformerException, TransformerConfigurationException {
- InputStream in = bundle.getEntry(path).openStream();
- String href = '/' + bundle.getBundleId() +path;
- return DynamicXHTMLProcessor.process(href, in, "en", true);
+ try (InputStream in = bundle.getEntry(path).openStream()) {
+ String href = '/' + bundle.getBundleId() + path;
+ return DynamicXHTMLProcessor.process(href, in, "en", true);
+ }
}
private String readStream(InputStream is) throws Exception {
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/preferences/ProductPreferencesTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/preferences/ProductPreferencesTest.java
index 09e2c67be..6ac5ab978 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/preferences/ProductPreferencesTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/preferences/ProductPreferencesTest.java
@@ -173,7 +173,7 @@ public class ProductPreferencesTest {
public void testGetValue() {
for (String[] data : GET_VALUE_DATA) {
String key = data[0];
- Set<String> allowableValues = new HashSet<String>(ProductPreferences.tokenize(data[1]));
+ Set<String> allowableValues = new HashSet<>(ProductPreferences.tokenize(data[1]));
Properties primary = ProductPreferences.loadPropertiesFile(UserAssistanceTestPlugin.getDefault().getBundle().getSymbolicName(), "data/help/preferences/" + data[2]);
Properties[] secondary = new Properties[data.length - 3];
for (int j=0;j<secondary.length;++j) {
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/HelpServerInterrupt.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/HelpServerInterrupt.java
index eb6095fd2..181156d7e 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/HelpServerInterrupt.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/HelpServerInterrupt.java
@@ -102,17 +102,16 @@ public class HelpServerInterrupt {
}
private void checkServer() throws Exception {
- InputStream input;
long start = System.currentTimeMillis();
try {
int port = WebappManager.getPort();
URL url = new URL("http", "localhost", port, "/help/index.jsp");
URLConnection connection = url.openConnection();
setTimeout(connection, 5000);
- input = connection.getInputStream();
- int firstbyte = input.read();
- Assert.assertTrue(firstbyte > 0);
- input.close();
+ try (InputStream input = connection.getInputStream()) {
+ int firstbyte = input.read();
+ Assert.assertTrue(firstbyte > 0);
+ }
} catch (Exception e) {
long elapsed = System.currentTimeMillis() - start;
System.out.println("Fail, milliseconds = " + elapsed);
diff --git a/org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/contentdetect/ContentDetectorTest.java b/org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/contentdetect/ContentDetectorTest.java
index cd00f2667..a558fff4c 100644
--- a/org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/contentdetect/ContentDetectorTest.java
+++ b/org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/contentdetect/ContentDetectorTest.java
@@ -90,7 +90,7 @@ public class ContentDetectorTest {
assertFalse(detector.isNewContentAvailable());
Set<?> newContent = ContentDetector.getNewContributors();
assertTrue(newContent == null || newContent.size() == 0);
- String firstContribution = (String) helper.getContributors().iterator().next();
+ String firstContribution = helper.getContributors().iterator().next();
assertFalse(ContentDetector.isNew(firstContribution));
}
diff --git a/org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/util/IntroModelSerializer.java b/org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/util/IntroModelSerializer.java
index d8361e353..fae8301ad 100644
--- a/org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/util/IntroModelSerializer.java
+++ b/org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/util/IntroModelSerializer.java
@@ -11,7 +11,7 @@
package org.eclipse.ua.tests.intro.util;
import java.util.Arrays;
-import java.util.Hashtable;
+import java.util.Map;
import java.util.Set;
import org.eclipse.ui.internal.intro.impl.model.AbstractIntroContainer;
@@ -111,7 +111,7 @@ public class IntroModelSerializer {
text.append(filterURL(style + "\n\t\t\t")); //$NON-NLS-1$
text.append("\n\tpage alt-styles are = "); //$NON-NLS-1$
- final Hashtable<String, Bundle> altStylesHashtable = page.getAltStyles();
+ final Map<String, Bundle> altStylesHashtable = page.getAltStyles();
if (altStylesHashtable == null)
return;
diff --git a/org.eclipse.ui.intro.universal/.classpath b/org.eclipse.ui.intro.universal/.classpath
index ce7393340..22f30643c 100644
--- a/org.eclipse.ui.intro.universal/.classpath
+++ b/org.eclipse.ui.intro.universal/.classpath
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/org.eclipse.ui.intro.universal/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.ui.intro.universal/.settings/org.eclipse.jdt.core.prefs
index 2175b8e6b..940d8eeb5 100644
--- a/org.eclipse.ui.intro.universal/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.ui.intro.universal/.settings/org.eclipse.jdt.core.prefs
@@ -1,16 +1,21 @@
-#Mon May 01 16:05:28 EDT 2006
eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
-org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
org.eclipse.jdt.core.compiler.problem.deprecation=warning
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
@@ -54,4 +59,4 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=di
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.3
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/org.eclipse.ui.intro.universal/META-INF/MANIFEST.MF b/org.eclipse.ui.intro.universal/META-INF/MANIFEST.MF
index 2253f02b4..44216f8dd 100644
--- a/org.eclipse.ui.intro.universal/META-INF/MANIFEST.MF
+++ b/org.eclipse.ui.intro.universal/META-INF/MANIFEST.MF
@@ -17,7 +17,7 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.6.0,4.0.0)",
Eclipse-LazyStart: true; exceptions="org.eclipse.ui.internal.intro.universal.contentdetect"
Bundle-Activator: org.eclipse.ui.internal.intro.universal.UniversalIntroPlugin
Bundle-ClassPath: .
-Bundle-RequiredExecutionEnvironment: J2SE-1.4
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Import-Package: javax.xml.parsers,
org.w3c.dom,
org.xml.sax
diff --git a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/CustomizationContentsArea.java b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/CustomizationContentsArea.java
index 5ef8a0722..277f89487 100644
--- a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/CustomizationContentsArea.java
+++ b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/CustomizationContentsArea.java
@@ -111,8 +111,8 @@ public class CustomizationContentsArea {
private TableViewer bottomLeft;
private TableViewer bottomRight;
private CheckboxTableViewer rootPages;
- private ArrayList introRootPages = new ArrayList();
- private ArrayList themeList = new ArrayList();
+ private ArrayList<String> introRootPages = new ArrayList<>();
+ private ArrayList<IntroTheme> themeList = new ArrayList<>();
private IntroTheme introTheme;
private String introThemeId;
private IntroData introData;
@@ -688,7 +688,7 @@ public class CustomizationContentsArea {
enableFontsButton();
// sync up the root page checklist
rootPages.setInput(ROOT_PAGE_TABLE);
- ArrayList selected = new ArrayList();
+ ArrayList<RootPage> selected = new ArrayList<>();
for (int i = 0; i < ROOT_PAGE_TABLE.length; i++) {
String id = ROOT_PAGE_TABLE[i].id;
if (introRootPages.contains(id))
diff --git a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/GroupData.java b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/GroupData.java
index df1571694..276bd84f3 100644
--- a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/GroupData.java
+++ b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/GroupData.java
@@ -23,7 +23,7 @@ import org.w3c.dom.NodeList;
public class GroupData {
boolean fDefault=false;
private String path;
- private ArrayList children = new ArrayList();
+ private ArrayList<BaseData> children = new ArrayList<>();
public GroupData(String path, boolean defaultGroup) {
fDefault = defaultGroup;
@@ -60,9 +60,9 @@ public class GroupData {
return fDefault;
}
- public void addAnchors(List result) {
+ public void addAnchors(List<IntroElement> result) {
for (int i = 0; i < children.size(); i++) {
- BaseData edata = (BaseData) children.get(i);
+ BaseData edata = children.get(i);
String id = edata.getId();
IntroElement element = null;
String tagName="anchor"; //$NON-NLS-1$
@@ -107,13 +107,13 @@ public class GroupData {
}
public BaseData[] getChildren() {
- return (BaseData[])children.toArray(new BaseData[children.size()]);
+ return children.toArray(new BaseData[children.size()]);
}
public int getExtensionCount() {
int count=0;
for (int i=0; i<children.size(); i++) {
- BaseData data = (BaseData)children.get(i);
+ BaseData data = children.get(i);
if (data instanceof ExtensionData)
count++;
}
@@ -141,7 +141,7 @@ public class GroupData {
BaseData find(String extensionId) {
for (int i = 0; i < children.size(); i++) {
- BaseData data = (BaseData) children.get(i);
+ BaseData data = children.get(i);
if (data.getId().equals(extensionId))
return data;
}
@@ -154,7 +154,7 @@ public class GroupData {
public int getIndexOf(String baseId) {
for (int i = 0; i < children.size(); i++) {
- BaseData bd = (BaseData) children.get(i);
+ BaseData bd = children.get(i);
if (bd.getId().equals(baseId))
return i;
}
@@ -173,14 +173,14 @@ public class GroupData {
public void moveUp(BaseData ed) {
int index = children.indexOf(ed);
- BaseData swapped = (BaseData)children.get(index-1);
+ BaseData swapped = children.get(index-1);
children.set(index, swapped);
children.set(index-1, ed);
}
public void moveDown(BaseData ed) {
int index = children.indexOf(ed);
- BaseData swapped = (BaseData)children.get(index+1);
+ BaseData swapped = children.get(index+1);
children.set(index, swapped);
children.set(index+1, ed);
}
@@ -210,7 +210,7 @@ public class GroupData {
writer.println(">"); //$NON-NLS-1$
}
for (int i=0; i<children.size(); i++) {
- BaseData ed = (BaseData)children.get(i);
+ BaseData ed = children.get(i);
ed.write(writer, indent+" "); //$NON-NLS-1$
}
writer.print(indent);
diff --git a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/IntroData.java b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/IntroData.java
index c655c3682..1a90e3589 100644
--- a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/IntroData.java
+++ b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/IntroData.java
@@ -13,8 +13,8 @@ package org.eclipse.ui.internal.intro.universal;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringReader;
-import java.util.Enumeration;
-import java.util.Hashtable;
+import java.util.HashMap;
+import java.util.Map;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
@@ -37,7 +37,7 @@ import org.xml.sax.SAXParseException;
public class IntroData {
private String productId;
- private Hashtable pages=new Hashtable();
+ private Map<String, PageData> pages = new HashMap<>();
private boolean active;
public IntroData(String productId, String fileNameOrData, boolean active) {
@@ -192,9 +192,7 @@ public class IntroData {
public void write(PrintWriter writer) {
writer.println("<?xml version=\"1.0\" encoding=\"utf-8\" ?>"); //$NON-NLS-1$
writer.println("<extensions>"); //$NON-NLS-1$
- for (Enumeration keys = pages.keys(); keys.hasMoreElements();) {
- String id = (String)keys.nextElement();
- PageData pd = (PageData)pages.get(id);
+ for (PageData pd : pages.values()) {
pd.write(writer, " "); //$NON-NLS-1$
}
writer.println("</extensions>"); //$NON-NLS-1$
diff --git a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/PageData.java b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/PageData.java
index ccc8e76b0..a27b628a2 100644
--- a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/PageData.java
+++ b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/PageData.java
@@ -14,13 +14,13 @@ import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.ui.intro.config.IntroElement;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-
public class PageData {
public static final String P_TOP_LEFT = "page-content/top-left"; //$NON-NLS-1$
public static final String P_TOP_RIGHT = "page-content/top-right"; //$NON-NLS-1$
@@ -28,7 +28,7 @@ public class PageData {
public static final String P_BOTTOM_RIGHT = "page-content/bottom-right"; //$NON-NLS-1$
private String id;
- private ArrayList groups = new ArrayList();
+ private ArrayList<GroupData> groups = new ArrayList<>();
private GroupData hidden=null;
public PageData(String id) {
@@ -59,7 +59,7 @@ public class PageData {
groups.add(gd);
}
- public void addAnchors(List result, String groupId) {
+ public void addAnchors(List<IntroElement> result, String groupId) {
GroupData group = findGroup(groupId);
if (group==null) return;
group.addAnchors(result);
@@ -69,7 +69,7 @@ public class PageData {
if (isHidden(extensionId))
return null;
for (int i=0; i<groups.size(); i++) {
- GroupData gdata = (GroupData)groups.get(i);
+ GroupData gdata = groups.get(i);
if (gdata.contains(extensionId)) {
IPath resolvedPath = new Path(id);
resolvedPath = resolvedPath.append(gdata.getPath());
@@ -82,7 +82,7 @@ public class PageData {
public String resolveDefaultPath() {
for (int i=0; i<groups.size(); i++) {
- GroupData gdata = (GroupData)groups.get(i);
+ GroupData gdata = groups.get(i);
if (gdata.isDefault()) {
IPath resolvedPath = new Path(id).append(gdata.getPath());
resolvedPath = resolvedPath.append(IUniversalIntroConstants.DEFAULT_ANCHOR);
@@ -100,7 +100,7 @@ public class PageData {
if (groupId.equals(IUniversalIntroConstants.HIDDEN))
return hidden;
for (int i=0; i<groups.size(); i++) {
- GroupData gdata = (GroupData)groups.get(i);
+ GroupData gdata = groups.get(i);
IPath path = new Path(gdata.getPath());
if (path.lastSegment().equals(groupId))
return gdata;
@@ -137,7 +137,7 @@ public class PageData {
private GroupData findDefaultGroup() {
GroupData defaultGroup = null;
for (int i=0; i<groups.size(); i++) {
- GroupData gd = (GroupData)groups.get(i);
+ GroupData gd = groups.get(i);
if (gd.isDefault()) {
if (defaultGroup==null)
defaultGroup = gd;
@@ -155,7 +155,7 @@ public class PageData {
public ExtensionData findExtension(String extensionId, boolean checkHidden) {
for (int i=0; i<groups.size(); i++) {
- GroupData gdata = (GroupData)groups.get(i);
+ GroupData gdata = groups.get(i);
ExtensionData ed = find(gdata, extensionId);
if (ed!=null)
return ed;
@@ -176,7 +176,7 @@ public class PageData {
public String resolveExtension(String extensionId) {
// check the explicit groups
for (int i=0; i<groups.size(); i++) {
- GroupData gdata = (GroupData)groups.get(i);
+ GroupData gdata = groups.get(i);
if (gdata.contains(extensionId)) {
return id+"/"+gdata.getPath()+"/"+extensionId; //$NON-NLS-1$//$NON-NLS-2$
}
@@ -186,7 +186,7 @@ public class PageData {
return null;
// create the default: pick the last group
if (groups.size()==0) return null;
- GroupData last = (GroupData)groups.get(groups.size()-1);
+ GroupData last = groups.get(groups.size()-1);
return id + "/" + last.getPath() + "/" + IUniversalIntroConstants.DEFAULT_ANCHOR; //$NON-NLS-1$//$NON-NLS-2$
}
@@ -195,7 +195,7 @@ public class PageData {
String indent2 = indent+" "; //$NON-NLS-1$
writer.println("<page id=\""+id+"\">"); //$NON-NLS-1$//$NON-NLS-2$
for (int i=0; i<groups.size(); i++) {
- GroupData gd = (GroupData)groups.get(i);
+ GroupData gd = groups.get(i);
gd.write(writer, indent2);
}
if (hidden!=null)
diff --git a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/UniversalIntroConfigurer.java b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/UniversalIntroConfigurer.java
index 2e6f2a7a1..4e9b13506 100644
--- a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/UniversalIntroConfigurer.java
+++ b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/UniversalIntroConfigurer.java
@@ -48,7 +48,7 @@ public class UniversalIntroConfigurer extends IntroConfigurer implements
private IntroData primaryIntroData;
private IntroData[] secondaryIntroData;
- private SequenceResolver sequenceResolver;
+ private SequenceResolver<IntroElement> sequenceResolver;
public UniversalIntroConfigurer() {
loadData();
@@ -225,7 +225,7 @@ public class UniversalIntroConfigurer extends IntroConfigurer implements
}
public IntroElement[] getLaunchBarShortcuts() {
- ArrayList links = new ArrayList();
+ ArrayList<IntroElement> links = new ArrayList<>();
String ids = getVariable(VAR_INTRO_ROOT_PAGES);
if (ids != null) {
StringTokenizer stok = new StringTokenizer(ids, ","); //$NON-NLS-1$
@@ -236,11 +236,11 @@ public class UniversalIntroConfigurer extends IntroConfigurer implements
links.add(page);
}
}
- return (IntroElement[]) links.toArray(new IntroElement[links.size()]);
+ return links.toArray(new IntroElement[links.size()]);
}
private IntroElement[] getRootPageLinks(boolean standby) {
- ArrayList links = new ArrayList();
+ ArrayList<IntroElement> links = new ArrayList<IntroElement>();
String ids = getVariable(VAR_INTRO_ROOT_PAGES);
if (ids != null) {
StringTokenizer stok = new StringTokenizer(ids, ","); //$NON-NLS-1$
@@ -258,7 +258,7 @@ public class UniversalIntroConfigurer extends IntroConfigurer implements
if (page !=null)
links.add(page);
}
- return (IntroElement[]) links.toArray(new IntroElement[links.size()]);
+ return links.toArray(new IntroElement[links.size()]);
}
private IntroElement[] getRootPageActionLinks(boolean standby) {
@@ -274,7 +274,7 @@ public class UniversalIntroConfigurer extends IntroConfigurer implements
}
private IntroElement[] getNavLinks(String pageId) {
- ArrayList links = new ArrayList();
+ ArrayList<IntroElement> links = new ArrayList<IntroElement>();
String ids = getVariable(VAR_INTRO_ROOT_PAGES);
/*
* In high contrast mode the workbench link must be generated in the nav links
@@ -294,7 +294,7 @@ public class UniversalIntroConfigurer extends IntroConfigurer implements
}
}
- return (IntroElement[]) links.toArray(new IntroElement[links.size()]);
+ return links.toArray(new IntroElement[links.size()]);
}
private IntroElement createRootPageLink(String id, boolean standby) {
@@ -500,7 +500,7 @@ public class UniversalIntroConfigurer extends IntroConfigurer implements
}
}
// load all other installed (but not running) products' intro data
- List result = new ArrayList();
+ List<IntroData> result = new ArrayList<IntroData>();
Properties[] prefs = ProductPreferences.getProductPreferences(false);
for (int i=0;i<prefs.length;++i) {
String key = UniversalIntroPlugin.PLUGIN_ID + '/' + VAR_INTRO_DATA;
@@ -515,18 +515,18 @@ public class UniversalIntroConfigurer extends IntroConfigurer implements
}
}
}
- secondaryIntroData = (IntroData[])result.toArray(new IntroData[result.size()]);
+ secondaryIntroData = result.toArray(new IntroData[result.size()]);
}
private IntroElement[] getContent(String pageId, String groupId) {
- List result = new ArrayList();
+ List<IntroElement> result = new ArrayList<IntroElement>();
if (!ContentDetector.getNewContributors().isEmpty()) {
// Add a new content fallback anchor
IntroElement fallback = new IntroElement("anchor"); //$NON-NLS-1$
fallback.setAttribute("id", NEW_CONTENT_ANCHOR); //$NON-NLS-1$
result.add(fallback);
}
- List anchors = getAnchors(pageId, groupId);
+ List<IntroElement> anchors = getAnchors(pageId, groupId);
if (anchors != null) {
result.addAll(anchors);
}
@@ -534,36 +534,38 @@ public class UniversalIntroConfigurer extends IntroConfigurer implements
IntroElement fallback = new IntroElement("anchor"); //$NON-NLS-1$
fallback.setAttribute("id", DEFAULT_ANCHOR); //$NON-NLS-1$
result.add(fallback);
- return (IntroElement[]) result.toArray(new IntroElement[result.size()]);
+ return result.toArray(new IntroElement[result.size()]);
}
- private List getAnchors(String pageId, String groupId) {
- List primaryAnchors = null;
+ private List<IntroElement> getAnchors(String pageId, String groupId) {
+ List<IntroElement> primaryAnchors = null;
if (primaryIntroData != null) {
primaryAnchors = getAnchors(primaryIntroData, pageId, groupId);
}
if (primaryAnchors == null) {
- primaryAnchors = Collections.EMPTY_LIST;
+ primaryAnchors = Collections.emptyList();
}
- List secondaryAnchorsList = new ArrayList();
+ List<List<IntroElement>> secondaryAnchorsList = new ArrayList<>();
for (int i=0;i<secondaryIntroData.length;++i) {
IntroData idata = secondaryIntroData[i];
- List anchors = getAnchors(idata, pageId, groupId);
+ List<IntroElement> anchors = getAnchors(idata, pageId, groupId);
if (anchors != null) {
secondaryAnchorsList.add(anchors);
}
}
- List[] secondaryAnchors = (List[])secondaryAnchorsList.toArray(new List[secondaryAnchorsList.size()]);
+
+ @SuppressWarnings("unchecked")
+ List<IntroElement>[] secondaryAnchors = secondaryAnchorsList.toArray(new List[secondaryAnchorsList.size()]);
if (sequenceResolver == null) {
- sequenceResolver = new SequenceResolver();
+ sequenceResolver = new SequenceResolver<IntroElement>();
}
return sequenceResolver.getSequence(primaryAnchors, secondaryAnchors);
}
- private List getAnchors(IntroData data, String pageId, String groupId) {
+ private List<IntroElement> getAnchors(IntroData data, String pageId, String groupId) {
PageData pdata = data.getPage(pageId);
if (pdata != null) {
- List anchors = new ArrayList();
+ List<IntroElement> anchors = new ArrayList<IntroElement>();
pdata.addAnchors(anchors, groupId);
return anchors;
}
@@ -664,7 +666,7 @@ public class UniversalIntroConfigurer extends IntroConfigurer implements
return false;
}
- public void init(IIntroSite site, Map themeProperties) {
+ public void init(IIntroSite site, Map<String, String> themeProperties) {
super.init(site, themeProperties);
Action customizeAction = new CustomizeAction(site);
customizeAction.setText(Messages.SharedIntroConfigurer_customize_label);
diff --git a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/contentdetect/ContentDetectHelper.java b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/contentdetect/ContentDetectHelper.java
index 6749c32b2..d5fe11496 100644
--- a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/contentdetect/ContentDetectHelper.java
+++ b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/contentdetect/ContentDetectHelper.java
@@ -86,8 +86,8 @@ public class ContentDetectHelper {
saveMemento(writeMemento, EXTENSION_NAMES_XML);
}
- public Set getContributors() {
- Set contributors = new HashSet();
+ public Set<String> getContributors() {
+ Set<String> contributors = new HashSet<>();
XMLMemento readMemento = getReadMemento(EXTENSION_NAMES_XML);
if (readMemento == null) {
return contributors;
@@ -155,8 +155,8 @@ public class ContentDetectHelper {
return stateFile;
}
- public Set findNewContributors(Set contributors, Set previousContributors) {
- Set result = new HashSet(contributors);
+ public Set<String> findNewContributors(Set<String> contributors, Set<String> previousContributors) {
+ Set<String> result = new HashSet<>(contributors);
for (Iterator iter = previousContributors.iterator(); iter.hasNext();) {
result.remove(iter.next());
}
diff --git a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/contentdetect/ContentDetector.java b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/contentdetect/ContentDetector.java
index 78f4b226f..2cf157259 100644
--- a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/contentdetect/ContentDetector.java
+++ b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/contentdetect/ContentDetector.java
@@ -42,12 +42,12 @@ public class ContentDetector extends IntroContentDetector {
int previous = helper.getExtensionCount();
if (numIntroExtensions != previous) {
helper.saveExtensionCount(numIntroExtensions);
- Set contributors = new HashSet();
+ Set<String> contributors = new HashSet<>();
for (int i = 0; i < extensions.length; i++) {
contributors.add(extensions[i].getContributor().getName());
}
if (numIntroExtensions > previous && previous != ContentDetectHelper.NO_STATE) {
- Set previousContributors = helper.getContributors();
+ Set<String> previousContributors = helper.getContributors();
newContributors = helper.findNewContributors(contributors, previousContributors);
helper.saveContributors(contributors);
return true;
diff --git a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/util/PreferenceArbiter.java b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/util/PreferenceArbiter.java
index c70b083f3..4173d89a3 100644
--- a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/util/PreferenceArbiter.java
+++ b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/util/PreferenceArbiter.java
@@ -20,15 +20,15 @@ import java.util.Map;
*/
public class PreferenceArbiter {
- private Map references;
+ private Map<Object, int[]> references;
private Object leader;
public void consider(Object obj) {
if (obj != null) {
if (references == null) {
- references = new HashMap();
+ references = new HashMap<>();
}
- int[] count = (int[])references.get(obj);
+ int[] count = references.get(obj);
if (count == null) {
count = new int[] { 0 };
references.put(obj, count);
@@ -38,7 +38,7 @@ public class PreferenceArbiter {
if (leader == null) {
leader = obj;
}
- else if (count[0] > ((int[])references.get(leader))[0]) {
+ else if (count[0] > (references.get(leader))[0]) {
leader = obj;
}
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/html/FormattedHTMLElement.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/html/FormattedHTMLElement.java
index 6ca24a4ae..584d65b1e 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/html/FormattedHTMLElement.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/html/FormattedHTMLElement.java
@@ -41,7 +41,8 @@ public class FormattedHTMLElement extends HTMLElement {
this.spanMultipleLines = spanMultipleLines;
this.endTagRequired = endTagRequired;
}
- public FormattedHTMLElement(String name, Map attributes, Vector content,
+
+ public FormattedHTMLElement(String name, Map<String, String> attributes, Vector<Object> content,
int indentLevel, boolean spanMultipleLines) {
super(name, attributes, content);
this.indentLevel = indentLevel;
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/html/HTMLElement.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/html/HTMLElement.java
index 474ac99ff..ac3dc84c9 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/html/HTMLElement.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/html/HTMLElement.java
@@ -10,7 +10,7 @@
*******************************************************************************/
package org.eclipse.ui.internal.intro.impl.html;
-import java.util.Hashtable;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Vector;
@@ -25,19 +25,19 @@ public class HTMLElement {
private String elementName;
// a collection of attributes that belong to this element (possibly empty)
- private Map elementAttributes;
+ private Map<String, String> elementAttributes;
// a collection of other HTMLElements or Strings contained inside this
// element
- private Vector elementContent;
+ private Vector<Object> elementContent;
public HTMLElement(String name) {
this.elementName = name;
- this.elementAttributes = new Hashtable();
- this.elementContent = new Vector();
+ this.elementAttributes = new HashMap<>();
+ this.elementContent = new Vector<>();
}
- public HTMLElement(String name, Map attributes, Vector content) {
+ public HTMLElement(String name, Map<String, String> attributes, Vector<Object> content) {
this.elementName = name;
this.elementAttributes = attributes;
this.elementContent = content;
@@ -67,9 +67,9 @@ public class HTMLElement {
*
* @return Returns the elementAttributes.
*/
- public Map getElementAttributes() {
+ public Map<String, String> getElementAttributes() {
if (elementAttributes == null)
- elementAttributes = new Hashtable();
+ elementAttributes = new HashMap<>();
return elementAttributes;
}
@@ -80,7 +80,7 @@ public class HTMLElement {
* @param elementAttributes
* The elementAttributes to set.
*/
- public void setElementAttributes(Map elementAttributes) {
+ public void setElementAttributes(Map<String, String> elementAttributes) {
this.elementAttributes = elementAttributes;
}
@@ -89,9 +89,9 @@ public class HTMLElement {
*
* @return Returns the elementContent.
*/
- public Vector getElementContent() {
+ public Vector<Object> getElementContent() {
if (elementContent == null)
- elementContent = new Vector();
+ elementContent = new Vector<>();
return elementContent;
}
@@ -102,7 +102,7 @@ public class HTMLElement {
* @param elementContent
* The elementContent to set.
*/
- public void setElementContent(Vector elementContent) {
+ public void setElementContent(Vector<Object> elementContent) {
this.elementContent = elementContent;
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/AbstractIntroContainer.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/AbstractIntroContainer.java
index f4b8eb10f..93b160ba2 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/AbstractIntroContainer.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/AbstractIntroContainer.java
@@ -34,7 +34,7 @@ public abstract class AbstractIntroContainer extends AbstractBaseIntroElement {
protected static final String ATT_BG_IMAGE = "bgImage"; //$NON-NLS-1$
// vector is lazily created when children are loaded in a call to
// loadChildren().
- protected Vector children;
+ protected Vector<AbstractIntroElement> children;
protected boolean loaded = false;
protected boolean resolved = false;
protected Element element;
@@ -133,7 +133,7 @@ public abstract class AbstractIntroContainer extends AbstractBaseIntroElement {
AbstractIntroElement[] childrenElements = getChildren();
// if we have no children, we still need to return an empty array of
// the correct type.
- Vector typedChildren = new Vector();
+ Vector<AbstractIntroElement> typedChildren = new Vector<>();
for (int i = 0; i < childrenElements.length; i++) {
AbstractIntroElement element = childrenElements[i];
if (element.isOfType(elementMask))
@@ -218,11 +218,11 @@ public abstract class AbstractIntroContainer extends AbstractBaseIntroElement {
*/
protected void loadChildren() {
// init the children vector. old children are disposed automatically.
- children = new Vector();
+ children = new Vector<>();
NodeList nodeList = element.getChildNodes();
- Vector vector = new Vector();
+ Vector<Node> vector = new Vector<>();
for (int i = 0; i < nodeList.getLength(); i++) {
Node node = nodeList.item(i);
if (node.getNodeType() == Node.ELEMENT_NODE)
@@ -365,11 +365,11 @@ public abstract class AbstractIntroContainer extends AbstractBaseIntroElement {
* @param unfiltered the unfiltered elements
* @return a new Vector with elements filtered
*/
- private Vector filterChildren(Vector unfiltered) {
- Vector filtered = new Vector();
- Iterator iter = unfiltered.iterator();
+ private <T> Vector<T> filterChildren(Vector<T> unfiltered) {
+ Vector<T> filtered = new Vector<>();
+ Iterator<T> iter = unfiltered.iterator();
while (iter.hasNext()) {
- Object element = iter.next();
+ T element = iter.next();
if (!UAContentFilter.isFiltered(element, IntroEvaluationContext.getContext())) {
filtered.add(element);
}
@@ -609,7 +609,7 @@ public abstract class AbstractIntroContainer extends AbstractBaseIntroElement {
*/
public Object clone() throws CloneNotSupportedException {
AbstractIntroContainer clone = (AbstractIntroContainer) super.clone();
- clone.children = new Vector();
+ clone.children = new Vector<>();
if (children != null) {
for (int i = 0; i < children.size(); i++) {
AbstractIntroElement cloneChild = (AbstractIntroElement) ((AbstractIntroElement) children
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/AbstractIntroPage.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/AbstractIntroPage.java
index 8fc3c5e0c..134f8cdfa 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/AbstractIntroPage.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/AbstractIntroPage.java
@@ -11,6 +11,7 @@
package org.eclipse.ui.internal.intro.impl.model;
import java.util.Hashtable;
+import java.util.Map;
import java.util.Vector;
import org.eclipse.core.runtime.IPath;
@@ -113,8 +114,8 @@ public abstract class AbstractIntroPage extends AbstractIntroContainer {
* <li>Shared hashtable has alt-styles as keys and bundles as values.</li>
* </ul>
*/
- private Vector styles;
- private Hashtable altStyles;
+ private Vector<String> styles;
+ private Map<String, Bundle> altStyles;
private boolean isDynamic = false;
protected boolean isStandbyPage;
@@ -294,7 +295,7 @@ public abstract class AbstractIntroPage extends AbstractIntroContainer {
* hashtable if page is not expandable, does not have any includes,
* or has includes that do not merge styles.
*/
- public Hashtable getAltStyles() {
+ public Map<String, Bundle> getAltStyles() {
// call get children first to resolve includes and populate hashtable.
// Resolving children will initialize the style vectors.
getChildren();
@@ -354,12 +355,12 @@ public abstract class AbstractIntroPage extends AbstractIntroContainer {
/**
* Util method to add map of altstyles to list.
*/
- protected void addAltStyles(Hashtable altStyles) {
+ protected void addAltStyles(Map<String, Bundle> altStyles) {
if (altStyles == null)
return;
if (this.altStyles == null)
// delay creation until needed.
- this.altStyles = new Hashtable();
+ this.altStyles = new Hashtable<>();
this.altStyles.putAll(altStyles);
}
@@ -369,7 +370,7 @@ public abstract class AbstractIntroPage extends AbstractIntroContainer {
return false;
if (this.styles == null)
// delay creation until needed.
- this.styles = new Vector();
+ this.styles = new Vector<>();
return true;
}
@@ -378,7 +379,7 @@ public abstract class AbstractIntroPage extends AbstractIntroContainer {
return false;
if (this.altStyles == null)
// delay creation until needed.
- this.altStyles = new Hashtable();
+ this.altStyles = new Hashtable<>();
return true;
}
@@ -540,7 +541,7 @@ public abstract class AbstractIntroPage extends AbstractIntroContainer {
else {
// page was not found in content file. Perform load actions, and log
// fact. init the children vector.
- children = new Vector();
+ children = new Vector<>();
loaded = true;
// free DOM model for memory performance.
element = null;
@@ -554,7 +555,7 @@ public abstract class AbstractIntroPage extends AbstractIntroContainer {
this.dom = dom;
this.isXHTMLPage = true;
// init empty children vector.
- children = new Vector();
+ children = new Vector<>();
loaded = true;
}
@@ -803,9 +804,9 @@ public abstract class AbstractIntroPage extends AbstractIntroContainer {
}
// styles are safe for a shallow copy.
if (styles != null)
- clone.styles = (Vector) styles.clone();
+ clone.styles = new Vector<String>(styles);
if (altStyles != null)
- clone.altStyles = (Hashtable) altStyles.clone();
+ clone.altStyles = new Hashtable<>(altStyles);
return clone;
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/ExtensionMap.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/ExtensionMap.java
index 16b6ac918..45666fa80 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/ExtensionMap.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/ExtensionMap.java
@@ -24,7 +24,7 @@ public class ExtensionMap {
private static ExtensionMap instance;
private static String startPage;
- private Map extensions = new HashMap();
+ private Map<String, String> extensions = new HashMap<>();
private ExtensionMap() {
@@ -65,7 +65,7 @@ public class ExtensionMap {
* Clear the map and content page
*/
public void clear() {
- extensions = new HashMap();
+ extensions = new HashMap<>();
startPage = null;
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/History.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/History.java
index 7d17b3057..4d7f6a4c8 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/History.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/History.java
@@ -21,7 +21,7 @@ import org.eclipse.ui.internal.intro.impl.model.url.IntroURLParser;
public class History {
// History of Intro Pages and real URL visited by Intro Browser. All
// elements are all of type HistoryObject.
- private Vector history = new Vector();
+ private Vector<HistoryObject> history = new Vector<>();
private int navigationLocation = 0;
@@ -170,8 +170,8 @@ public class History {
}
private void trimHistory(Object location) {
- List newHistory = history.subList(0, navigationLocation + 1);
- history = new Vector(newHistory);
+ List<HistoryObject> newHistory = history.subList(0, navigationLocation + 1);
+ history = new Vector<>(newHistory);
history.add(new HistoryObject(location));
// point the nav location to the end of the vector.
navigationLocation = getHistoryEndPosition();
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroExtensionContent.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroExtensionContent.java
index ce6341017..2f3d7ff6d 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroExtensionContent.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroExtensionContent.java
@@ -11,7 +11,8 @@
package org.eclipse.ui.internal.intro.impl.model;
-import java.util.Hashtable;
+import java.util.HashMap;
+import java.util.Map;
import java.util.Vector;
import org.eclipse.core.runtime.FileLocator;
@@ -60,8 +61,8 @@ public class IntroExtensionContent extends AbstractIntroElement {
private Element element;
private String base;
- private Vector styles = new Vector();
- private Hashtable altStyles = new Hashtable();
+ private Vector<String> styles = new Vector<>();
+ private Map<String, Bundle> altStyles = new HashMap<>();
IntroExtensionContent(Element element, Bundle bundle, String base, IConfigurationElement configExtElement) {
super(element, bundle);
@@ -178,7 +179,7 @@ public class IntroExtensionContent extends AbstractIntroElement {
protected Element[] getChildren() {
NodeList nodeList = element.getChildNodes();
- Vector vector = new Vector();
+ Vector<Node> vector = new Vector<>();
for (int i = 0; i < nodeList.getLength(); i++) {
Node node = nodeList.item(i);
if (node.getNodeType() == Node.ELEMENT_NODE)
@@ -230,7 +231,7 @@ public class IntroExtensionContent extends AbstractIntroElement {
/**
* @return Returns the altStyle.
*/
- protected Hashtable getAltStyles() {
+ protected Map<String, Bundle> getAltStyles() {
return altStyles;
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroHomePage.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroHomePage.java
index 82c42f51b..c6018d602 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroHomePage.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroHomePage.java
@@ -42,7 +42,7 @@ public class IntroHomePage extends AbstractIntroPage {
* links. Try to get the real links in the page, and all links in all divs.
*/
public IntroLink[] getLinks() {
- Vector linkVector = new Vector();
+ Vector<AbstractIntroElement> linkVector = new Vector<>();
AbstractIntroElement[] children = getChildren();
for (int i = 0; i < children.length; i++) {
@@ -59,7 +59,7 @@ public class IntroHomePage extends AbstractIntroPage {
return links;
}
- private void addLinks(IntroGroup group, Vector linkVector) {
+ private void addLinks(IntroGroup group, Vector<AbstractIntroElement> linkVector) {
AbstractIntroElement[] children = group.getChildren();
for (int i = 0; i < children.length; i++) {
AbstractIntroElement child = children[i];
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroLaunchBarElement.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroLaunchBarElement.java
index b5cf29d0b..380362556 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroLaunchBarElement.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroLaunchBarElement.java
@@ -11,6 +11,7 @@
package org.eclipse.ui.internal.intro.impl.model;
import java.util.ArrayList;
+import java.util.List;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.jface.resource.ImageDescriptor;
@@ -29,7 +30,8 @@ import org.eclipse.ui.intro.config.IntroElement;
* @since 3.1
*/
public class IntroLaunchBarElement extends AbstractIntroElement {
- private ArrayList shortcuts;
+
+ private List<IntroLaunchBarShortcut> shortcuts;
IntroLaunchBarElement(IConfigurationElement element) {
super(element);
@@ -159,7 +161,7 @@ public class IntroLaunchBarElement extends AbstractIntroElement {
*
*/
private void createShortcuts() {
- shortcuts = new ArrayList();
+ shortcuts = new ArrayList<>();
IntroModelRoot model = getModelRoot();
IntroConfigurer configurer = model!=null?model.getConfigurer():null;
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroModelRoot.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroModelRoot.java
index 04123c61b..c49d89591 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroModelRoot.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroModelRoot.java
@@ -11,9 +11,9 @@
package org.eclipse.ui.internal.intro.impl.model;
import java.util.ArrayList;
-import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import java.util.Vector;
import org.eclipse.core.runtime.CoreException;
@@ -130,11 +130,11 @@ public class IntroModelRoot extends AbstractIntroContainer {
private IConfigurationElement[] configExtensionElements;
// maintain listener list for model changes.
- public ListenerList propChangeListeners = new ListenerList();
+ public ListenerList<IPropertyListener> propChangeListeners = new ListenerList<>();
// a list to hold all loaded DOMs until resolving all configExtensions
// is done.
- private List unresolvedConfigExt = new ArrayList();
+ private List<ExtensionContent> unresolvedConfigExt = new ArrayList<>();
private class ExtensionContent {
@@ -175,7 +175,7 @@ public class IntroModelRoot extends AbstractIntroContainer {
*
*/
protected void loadChildren() {
- children = new Vector();
+ children = new Vector<>();
if (Log.logInfo)
Log.info("Creating Intro plugin model...."); //$NON-NLS-1$
@@ -462,9 +462,8 @@ public class IntroModelRoot extends AbstractIntroContainer {
int previousSize;
do {
previousSize = unresolvedConfigExt.size();
- List stillUnresolved = new ArrayList();
- for (Iterator iter = unresolvedConfigExt.iterator(); iter.hasNext();) {
- ExtensionContent content = (ExtensionContent) iter.next();
+ List<ExtensionContent> stillUnresolved = new ArrayList<>();
+ for (ExtensionContent content : unresolvedConfigExt) {
Element extensionContentElement = content.element;
IConfigurationElement configExtElement = content.configExtElement;
Bundle bundle = BundleUtil.getBundleFromConfigurationElement(configExtElement);
@@ -497,7 +496,7 @@ public class IntroModelRoot extends AbstractIntroContainer {
// get the bundle from the extensions since they are defined in
// other plugins.
- List elements = new ArrayList();
+ List<Element> elements = new ArrayList<>();
Element[] extensionContents = ModelUtil.getElementsByTagName(dom,
IntroExtensionContent.TAG_CONTAINER_EXTENSION);
Element[] replacementContents = ModelUtil.getElementsByTagName(dom,
@@ -509,7 +508,7 @@ public class IntroModelRoot extends AbstractIntroContainer {
return (Element[])elements.toArray(new Element[elements.size()]);
}
- private void addUnfilteredExtensions(List elements, Element[] extensionContents) {
+ private void addUnfilteredExtensions(List<Element> elements, Element[] extensionContents) {
for (int i = 0; i < extensionContents.length; i++) {
Element extensionContentElement = extensionContents[i];
if (!UAContentFilter.isFiltered(UAElementFactory.newElement(extensionContentElement), IntroEvaluationContext.getContext())) {
@@ -679,7 +678,7 @@ public class IntroModelRoot extends AbstractIntroContainer {
targetContainer.getParentPage().addStyles(styles);
// for alt-style cache bundle for loading resources.
- Hashtable altStyles = extension.getAltStyles();
+ Map<String, Bundle> altStyles = extension.getAltStyles();
if (altStyles != null)
targetContainer.getParentPage().addAltStyles(altStyles);
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroPartPresentation.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroPartPresentation.java
index ee810cdf2..fa95a6eca 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroPartPresentation.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroPartPresentation.java
@@ -105,7 +105,7 @@ public class IntroPartPresentation extends AbstractIntroElement {
String value = element.getAttribute(ATT_STYLE);
if (value!=null) {
IntroModelRoot root = getModelRoot();
- ArrayList list = new ArrayList();
+ ArrayList<String> list = new ArrayList<>();
StringTokenizer stok = new StringTokenizer(value, ","); //$NON-NLS-1$
for (;stok.hasMoreTokens();) {
String oneStyle = stok.nextToken().trim();
@@ -232,7 +232,7 @@ public class IntroPartPresentation extends AbstractIntroElement {
IntroModelRoot model = getModelRoot();
if (model != null && model.getConfigurer() != null) {
IntroTheme theme = model.getTheme();
- Map properties = theme!=null?theme.getProperties():null;
+ Map<String, String> properties = theme != null ? theme.getProperties() : null;
model.getConfigurer().init(introPart.getIntroSite(), properties);
}
if (Log.logInfo)
@@ -278,7 +278,7 @@ public class IntroPartPresentation extends AbstractIntroElement {
*/
private Vector getValidImplementationElements(IConfigurationElement configElement) {
- Vector validList = new Vector();
+ Vector<IConfigurationElement> validList = new Vector<>();
// There can be more than one implementation contribution. Add each
// valid one. First start with OS, then WS then no OS.
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroSearchParticipant.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroSearchParticipant.java
index 52e68d2c1..95b84dbe1 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroSearchParticipant.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroSearchParticipant.java
@@ -51,10 +51,10 @@ public class IntroSearchParticipant extends SearchParticipant {
*
* @see org.eclipse.help.search.LuceneSearchParticipant#getContributingPlugins()
*/
- public Set getContributingPlugins() {
+ public Set<String> getContributingPlugins() {
IConfigurationElement[] elements = Platform.getExtensionRegistry().getConfigurationElementsFor(
"org.eclipse.ui.intro.config"); //$NON-NLS-1$
- HashSet set = new HashSet();
+ Set<String> set = new HashSet<>();
for (int i = 0; i < elements.length; i++) {
IConfigurationElement element = elements[i];
if (!element.getName().equals("config")) //$NON-NLS-1$
@@ -77,8 +77,8 @@ public class IntroSearchParticipant extends SearchParticipant {
*
* @see org.eclipse.help.search.LuceneSearchParticipant#getAllDocuments(java.lang.String)
*/
- public Set getAllDocuments(String locale) {
- HashSet set = new HashSet();
+ public Set<String> getAllDocuments(String locale) {
+ HashSet<String> set = new HashSet<>();
IProduct product = Platform.getProduct();
if (product == null) {
return set;
@@ -122,7 +122,7 @@ public class IntroSearchParticipant extends SearchParticipant {
return set;
}
- private void loadFromModel(IntroModelRoot model, HashSet set, String locale) {
+ private void loadFromModel(IntroModelRoot model, Set<String> set, String locale) {
IntroPage[] pages = model.getPages();
for (int i = 0; i < pages.length; i++) {
IntroPage page = pages[i];
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroTheme.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroTheme.java
index 04e93a9fd..a71080e33 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroTheme.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroTheme.java
@@ -24,7 +24,7 @@ public class IntroTheme extends AbstractIntroIdElement {
private static final String ATT_PATH = "path"; //$NON-NLS-1$
private String name;
private String path;
- private Hashtable properties;
+ private Hashtable<String, String> properties;
private boolean scalable;
public IntroTheme(IConfigurationElement element) {
@@ -56,7 +56,7 @@ public class IntroTheme extends AbstractIntroIdElement {
return THEME;
}
- public Map getProperties() {
+ public Map<String, String> getProperties() {
return properties;
}
@@ -68,7 +68,7 @@ public class IntroTheme extends AbstractIntroIdElement {
IConfigurationElement [] children = element.getChildren("property"); //$NON-NLS-1$
if (children.length==0)
return;
- properties = new Hashtable();
+ properties = new Hashtable<>();
for (int i=0; i<children.length; i++) {
IConfigurationElement property = children[i];
String name = property.getAttribute("name"); //$NON-NLS-1$
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/loader/BaseExtensionPointManager.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/loader/BaseExtensionPointManager.java
index 8ac5a13b3..4d8f4c398 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/loader/BaseExtensionPointManager.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/loader/BaseExtensionPointManager.java
@@ -12,8 +12,9 @@
package org.eclipse.ui.internal.intro.impl.model.loader;
import java.util.ArrayList;
-import java.util.Hashtable;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import java.util.Vector;
import org.eclipse.core.runtime.IConfigurationElement;
@@ -45,7 +46,7 @@ public class BaseExtensionPointManager {
protected static final String ATT_ID = AbstractIntroIdElement.ATT_ID;
- protected Hashtable introModels = new Hashtable();
+ protected Map<String, IntroModelRoot> introModels = new HashMap<>();
protected IExtensionRegistry registry;
protected SharedConfigExtensionsManager sharedConfigExtensionsManager;
private String extensionFilter;
@@ -155,7 +156,7 @@ public class BaseExtensionPointManager {
* from a specific plug-in (fixed data set).
*/
if (extensionFilter != null) {
- List filtered = new ArrayList();
+ List<IConfigurationElement> filtered = new ArrayList<>();
for (int i=0;i<configExtensionElements.length;++i) {
if (extensionFilter.equals(configExtensionElements[i].getContributor().getName())) {
filtered.add(configExtensionElements[i]);
@@ -222,7 +223,7 @@ public class BaseExtensionPointManager {
String attributeValue) {
// find all configs with given attribute and attibute value.
- Vector elements = new Vector();
+ Vector<IConfigurationElement> elements = new Vector<>();
for (int i = 0; i < configElements.length; i++) {
String currentAttributeValue = configElements[i]
.getAttribute(attributeName);
@@ -259,7 +260,7 @@ public class BaseExtensionPointManager {
/**
* @return Returns the cached introModels.
*/
- public Hashtable getIntroModels() {
+ public Map<String, IntroModelRoot> getIntroModels() {
return introModels;
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/loader/ContentProviderManager.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/loader/ContentProviderManager.java
index 72e76a3f8..550400325 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/loader/ContentProviderManager.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/loader/ContentProviderManager.java
@@ -11,9 +11,9 @@
package org.eclipse.ui.internal.intro.impl.model.loader;
-import java.util.Enumeration;
-import java.util.Hashtable;
+import java.util.HashMap;
import java.util.Iterator;
+import java.util.Map;
import org.eclipse.ui.internal.intro.impl.model.AbstractIntroPage;
import org.eclipse.ui.internal.intro.impl.model.IntroContentProvider;
@@ -49,7 +49,7 @@ public class ContentProviderManager {
// class on each navigation. Key is the contentProvider id, value
// is a wrapper class to hold the actual Intro content provider instance and
// the intro page that holds it.
- private Hashtable contentProviders = new Hashtable();
+ private Map<String, ContentProviderWrapper> contentProviders = new HashMap<>();
class ContentProviderWrapper {
@@ -138,10 +138,7 @@ public class ContentProviderManager {
public AbstractIntroPage getContentProviderParentPage(IIntroContentProvider provider) {
- Enumeration keys = contentProviders.keys();
- while (keys.hasMoreElements()) {
- String key = (String) keys.nextElement();
- ContentProviderWrapper wrapper = (ContentProviderWrapper) contentProviders.get(key);
+ for (ContentProviderWrapper wrapper : contentProviders.values()) {
boolean foundKey = wrapper.getIIntroContentProvider().equals(provider) ? true : false;
if (foundKey) {
return wrapper.getParentPage();
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/loader/SharedConfigExtensionsManager.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/loader/SharedConfigExtensionsManager.java
index 67ffe6485..fe37646d0 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/loader/SharedConfigExtensionsManager.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/loader/SharedConfigExtensionsManager.java
@@ -11,7 +11,8 @@
package org.eclipse.ui.internal.intro.impl.model.loader;
-import java.util.Hashtable;
+import java.util.HashMap;
+import java.util.Map;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionRegistry;
@@ -30,12 +31,11 @@ public class SharedConfigExtensionsManager {
private IExtensionRegistry registry;
- // Holds all standbyPart extensions. Key is id, value is
- // IntroStandbyContentPart.
- private Hashtable standbyParts = new Hashtable();
+ // Holds all standbyPart extensions
+ private Map<String, IntroStandbyContentPart> standbyParts = new HashMap<>();
- // Holds all command extensions. Key is name, value is IntroURLAction.
- private Hashtable commands = new Hashtable();
+ // Holds all command extensions
+ private Map<String, IntroURLAction> commands = new HashMap<>();
/*
* Prevent creation.
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/url/IntroURL.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/url/IntroURL.java
index 389133a9e..66d6b5d2d 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/url/IntroURL.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/url/IntroURL.java
@@ -12,7 +12,6 @@
package org.eclipse.ui.internal.intro.impl.model.url;
import java.util.Enumeration;
-import java.util.Hashtable;
import java.util.Properties;
import org.eclipse.core.commands.ParameterizedCommand;
@@ -532,11 +531,8 @@ public class IntroURL implements IIntroURL {
* @return
*/
private AbstractIntroPage findPageToShow(String pageId) {
- // get all cached models.
- Hashtable models = ExtensionPointManager.getInst().getIntroModels();
- Enumeration values = models.elements();
- while (values.hasMoreElements()) {
- IntroModelRoot model = (IntroModelRoot) values.nextElement();
+ // check all cached models.
+ for (IntroModelRoot model : ExtensionPointManager.getInst().getIntroModels().values()) {
AbstractIntroPage page = (AbstractIntroPage) model.findChild(
pageId, AbstractIntroElement.ABSTRACT_PAGE);
if (page != null)
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/util/FindSupport.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/util/FindSupport.java
index b82ac5566..8a8622e22 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/util/FindSupport.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/util/FindSupport.java
@@ -14,7 +14,9 @@ import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.ArrayList;
+import java.util.List;
import java.util.Map;
+
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
@@ -26,7 +28,7 @@ public class FindSupport {
private static String[] NL_JAR_VARIANTS = buildNLVariants(Platform.getNL());
private static String[] buildNLVariants(String nl) {
- ArrayList result = new ArrayList();
+ ArrayList<String> result = new ArrayList<>();
IPath base = new Path("nl"); //$NON-NLS-1$
IPath path = new Path(nl.replace('_', '/'));
@@ -64,19 +66,18 @@ public class FindSupport {
}
/**
- * Proposed API for Platform in Eclispe 3.2.
- * Same as @link #find(Bundle, IPath) except multiple entries can be
- * returned if more than one entry matches the path in the host and
- * any of its fragments.
- *
- * @param bundle
- * @param path
- * @param override
- * @returnan array of entries which match the given path. An empty
- * array is returned if no matches are found.
- */
- public static URL[] findEntries(Bundle bundle, IPath path, Map override) {
- ArrayList results = new ArrayList(1);
+ * Proposed API for Platform in Eclipse 3.2. Same as @link #find(Bundle, IPath) except multiple
+ * entries can be returned if more than one entry matches the path in the host and any of its
+ * fragments.
+ *
+ * @param bundle
+ * @param path
+ * @param override
+ * @return an array of entries which match the given path. An empty array is returned if no
+ * matches are found.
+ */
+ public static URL[] findEntries(Bundle bundle, IPath path, Map<String, String> override) {
+ List<URL> results = new ArrayList<>(1);
find(bundle, path, override, results);
return (URL[]) results.toArray(new URL[results.size()]);
}
@@ -84,11 +85,11 @@ public class FindSupport {
/**
* See doc on @link Platform#find(Bundle, IPath, Map) Platform#find(Bundle, IPath, Map)
*/
- public static URL find(Bundle b, IPath path, Map override) {
+ public static URL find(Bundle b, IPath path, Map<String, String> override) {
return find(b, path, override, null);
}
- private static URL find(Bundle b, IPath path, Map override, ArrayList multiple) {
+ private static URL find(Bundle b, IPath path, Map<String, String> override, List<URL> multiple) {
if (path == null)
return null;
@@ -128,15 +129,11 @@ public class FindSupport {
return null;
}
- private static URL findOS(Bundle b, IPath path, Map override, ArrayList multiple) {
+ private static URL findOS(Bundle b, IPath path, Map<String, String> override, List<URL> multiple) {
String os = null;
if (override != null)
- try {
- // check for override
- os = (String) override.get("$os$"); //$NON-NLS-1$
- } catch (ClassCastException e) {
- // just in case
- }
+ // check for override
+ os = override.get("$os$"); //$NON-NLS-1$
if (os == null)
// use default
os = Platform.getOS();
@@ -146,12 +143,8 @@ public class FindSupport {
// Now do the same for osarch
String osArch = null;
if (override != null)
- try {
- // check for override
- osArch = (String) override.get("$arch$"); //$NON-NLS-1$
- } catch (ClassCastException e) {
- // just in case
- }
+ // check for override
+ osArch = (String) override.get("$arch$"); //$NON-NLS-1$
if (osArch == null)
// use default
osArch = Platform.getOSArch();
@@ -179,15 +172,11 @@ public class FindSupport {
return findInFragments(b, path, multiple);
}
- private static URL findWS(Bundle b, IPath path, Map override, ArrayList multiple) {
+ private static URL findWS(Bundle b, IPath path, Map<String, String> override, List<URL> multiple) {
String ws = null;
if (override != null)
- try {
- // check for override
- ws = (String) override.get("$ws$"); //$NON-NLS-1$
- } catch (ClassCastException e) {
- // just in case
- }
+ // check for override
+ ws = override.get("$ws$"); //$NON-NLS-1$
if (ws == null)
// use default
ws = Platform.getWS();
@@ -208,16 +197,12 @@ public class FindSupport {
return findInFragments(b, path, multiple);
}
- private static URL findNL(Bundle b, IPath path, Map override, ArrayList multiple) {
+ private static URL findNL(Bundle b, IPath path, Map<String, String> override, List<URL> multiple) {
String nl = null;
String[] nlVariants = null;
if (override != null)
- try {
- // check for override
- nl = (String) override.get("$nl$"); //$NON-NLS-1$
- } catch (ClassCastException e) {
- // just in case
- }
+ // check for override
+ nl = override.get("$nl$"); //$NON-NLS-1$
nlVariants = nl == null ? NL_JAR_VARIANTS : buildNLVariants(nl);
if (nl != null && nl.length() == 0)
return null;
@@ -240,19 +225,19 @@ public class FindSupport {
return findInFragments(b, path, multiple);
}
- private static URL findInPlugin(Bundle b, IPath filePath, ArrayList multiple) {
+ private static URL findInPlugin(Bundle b, IPath filePath, List<URL> multiple) {
URL result = b.getEntry(filePath.toString());
if (result != null && multiple != null)
multiple.add(result);
return result;
}
- private static URL findInFragments(Bundle b, IPath filePath, ArrayList multiple) {
+ private static URL findInFragments(Bundle b, IPath filePath, List<URL> multiple) {
Bundle[] fragments = Platform.getFragments(b);
if (fragments == null)
return null;
- multiple.ensureCapacity(fragments.length + 1);
+ // multiple.ensureCapacity(fragments.length + 1);
URL fileURL = null;
int i = 0;
while (i < fragments.length && fileURL == null) {
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/util/ModelUtil.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/util/ModelUtil.java
index 22079e67b..d5198aa29 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/util/ModelUtil.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/util/ModelUtil.java
@@ -275,7 +275,7 @@ public class ModelUtil {
*/
public static Element[] getElementsByTagName(Element parent, String tagName) {
NodeList allChildElements = parent.getElementsByTagName(tagName);
- Vector vector = new Vector();
+ Vector<Element> vector = new Vector<>();
for (int i = 0; i < allChildElements.getLength(); i++) {
// we know that the nodelist is of elements.
Element aElement = (Element) allChildElements.item(i);
@@ -296,7 +296,7 @@ public class ModelUtil {
*/
public static Element[] getElementsByTagName(Document dom, String tagName) {
NodeList allChildElements = dom.getElementsByTagName(tagName);
- Vector vector = new Vector();
+ Vector<Element> vector = new Vector<>();
for (int i = 0; i < allChildElements.getLength(); i++) {
// we know that the nodelist is of elements.
Element aElement = (Element) allChildElements.item(i);
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/parts/StandbyPart.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/parts/StandbyPart.java
index cb1f3546d..d56d1e4e7 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/parts/StandbyPart.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/parts/StandbyPart.java
@@ -10,8 +10,8 @@
*******************************************************************************/
package org.eclipse.ui.internal.intro.impl.parts;
-import java.util.Enumeration;
-import java.util.Hashtable;
+import java.util.HashMap;
+import java.util.Map;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
@@ -68,8 +68,7 @@ public class StandbyPart implements IIntroConstants {
private EmptyStandbyContentPart emptyPart;
private IMemento memento;
- // hastable has partIds as keys, and ControlKeys are values.
- private Hashtable cachedContentParts = new Hashtable();
+ private Map<String, ControlKey> cachedContentParts = new HashMap<>();
private ControlKey cachedControlKey;
@@ -363,9 +362,7 @@ public class StandbyPart implements IIntroConstants {
*
*/
public void dispose() {
- Enumeration values = cachedContentParts.elements();
- while (values.hasMoreElements()) {
- ControlKey controlKey = (ControlKey) values.nextElement();
+ for (ControlKey controlKey : cachedContentParts.values()) {
controlKey.getContentPart().dispose();
}
toolkit.dispose();
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/swt/PageStyleManager.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/swt/PageStyleManager.java
index ca7c2671d..ca6fcabb7 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/swt/PageStyleManager.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/swt/PageStyleManager.java
@@ -10,8 +10,9 @@
*******************************************************************************/
package org.eclipse.ui.internal.intro.impl.swt;
-import java.util.Enumeration;
-import java.util.Hashtable;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
import java.util.Properties;
import org.eclipse.core.runtime.FileLocator;
@@ -39,7 +40,7 @@ import org.osgi.framework.Bundle;
public class PageStyleManager extends SharedStyleManager {
private AbstractIntroPage page;
- private Hashtable altStyleContexts = new Hashtable();
+ private Map<Properties, StyleContext> altStyleContexts = new HashMap<>();
private IntroModelRoot root;
@@ -68,13 +69,12 @@ public class PageStyleManager extends SharedStyleManager {
// AltStyles Hashtable has alt-styles as keys, the bundles as
// values.
- Hashtable altStyles = page.getAltStyles();
+ Map<String, Bundle> altStyles = page.getAltStyles();
if (altStyles != null) {
- Enumeration styles = altStyles.keys();
- while (styles.hasMoreElements()) {
- String style = (String) styles.nextElement();
+ for (Entry<String, Bundle> entry : altStyles.entrySet()) {
+ String style = entry.getKey();
Properties inheritedProperties = new Properties();
- Bundle bundle = (Bundle) altStyles.get(style);
+ Bundle bundle = entry.getValue();
StyleContext sc = new StyleContext();
sc.bundle = bundle;
load(inheritedProperties, style, sc);
@@ -124,10 +124,7 @@ public class PageStyleManager extends SharedStyleManager {
return properties;
// search inherited properties second.
- Enumeration inheritedPageProperties = altStyleContexts.keys();
- while (inheritedPageProperties.hasMoreElements()) {
- Properties aProperties = (Properties) inheritedPageProperties
- .nextElement();
+ for (Properties aProperties : altStyleContexts.keySet()) {
if (aProperties.containsKey(key))
return aProperties;
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/util/IntroModelSerializer.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/util/IntroModelSerializer.java
index 0b2566c54..70993ecdd 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/util/IntroModelSerializer.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/util/IntroModelSerializer.java
@@ -10,8 +10,8 @@
*******************************************************************************/
package org.eclipse.ui.internal.intro.impl.util;
-import java.util.Enumeration;
-import java.util.Hashtable;
+import java.util.Map;
+import java.util.Map.Entry;
import org.eclipse.ui.internal.intro.impl.model.AbstractIntroContainer;
import org.eclipse.ui.internal.intro.impl.model.AbstractIntroElement;
@@ -125,16 +125,12 @@ public class IntroModelSerializer {
text.append(filterURL(styles[i] + "\n\t\t\t")); //$NON-NLS-1$
text.append("\n\tpage alt-styles are = "); //$NON-NLS-1$
- Hashtable altStylesHashtable = page.getAltStyles();
+ Map<String, Bundle> altStylesHashtable = page.getAltStyles();
if (altStylesHashtable == null)
return;
- Enumeration altStyles = altStylesHashtable.keys();
- while (altStyles.hasMoreElements()) {
- String altStyle = (String) altStyles.nextElement();
-
- Bundle bundle = (Bundle) altStylesHashtable.get(altStyle);
- text.append(filterURL(altStyle) + " from " + bundle.getSymbolicName()); //$NON-NLS-1$
+ for (Entry<String, Bundle> entry : altStylesHashtable.entrySet()) {
+ text.append(filterURL(entry.getKey()) + " from " + entry.getValue().getSymbolicName()); //$NON-NLS-1$
text.append("\n\t\t"); //$NON-NLS-1$
}
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/util/StringUtil.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/util/StringUtil.java
index f963bdf53..b1add5d19 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/util/StringUtil.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/util/StringUtil.java
@@ -59,7 +59,7 @@ public class StringUtil {
return string.split(delimiters);
} catch (NoSuchMethodError e) {
// not running 1.4 so try a string tokenizer
- List result = new ArrayList();
+ List<String> result = new ArrayList<>();
for (StringTokenizer tokenizer = new StringTokenizer(string, delimiters); tokenizer.hasMoreTokens(); )
result.add(tokenizer.nextToken());
return (String[]) result.toArray(new String[result.size()]);
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/intro/config/CustomizableIntroPart.java b/org.eclipse.ui.intro/src/org/eclipse/ui/intro/config/CustomizableIntroPart.java
index 5dd4208ed..affb2420f 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/intro/config/CustomizableIntroPart.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/intro/config/CustomizableIntroPart.java
@@ -95,18 +95,18 @@ public final class CustomizableIntroPart extends IntroPart implements
// Adapter factory to abstract out the StandbyPart implementation from APIs.
IAdapterFactory factory = new IAdapterFactory() {
- public Class[] getAdapterList() {
+ public Class<?>[] getAdapterList() {
return new Class[] { StandbyPart.class, IntroPartPresentation.class };
}
- public Object getAdapter(Object adaptableObject, Class adapterType) {
+ public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) {
if (!(adaptableObject instanceof CustomizableIntroPart))
return null;
if (adapterType.equals(StandbyPart.class)) {
- return getStandbyPart();
+ return adapterType.cast(getStandbyPart());
} else if (adapterType.equals(IntroPartPresentation.class)) {
- return getPresentation();
+ return adapterType.cast(getPresentation());
} else
return null;
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/intro/config/IntroConfigurer.java b/org.eclipse.ui.intro/src/org/eclipse/ui/intro/config/IntroConfigurer.java
index 854a06319..3e80f94ce 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/intro/config/IntroConfigurer.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/intro/config/IntroConfigurer.java
@@ -33,7 +33,7 @@ public abstract class IntroConfigurer {
*/
public static final String TB_ADDITIONS = "additions"; //$NON-NLS-1$
- protected Map themeProperties;
+ protected Map<String, String> themeProperties;
protected IIntroSite site;
private IntroModelRoot model;
@@ -49,7 +49,7 @@ public abstract class IntroConfigurer {
* <code>null</code> if no theme is currently active or the active theme has no
* properties.
*/
- public void init(IIntroSite site, Map themeProperties) {
+ public void init(IIntroSite site, Map<String, String> themeProperties) {
this.themeProperties = themeProperties;
this.site = site;
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/intro/config/IntroElement.java b/org.eclipse.ui.intro/src/org/eclipse/ui/intro/config/IntroElement.java
index 92f412d65..31ed8babc 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/intro/config/IntroElement.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/intro/config/IntroElement.java
@@ -12,6 +12,7 @@ package org.eclipse.ui.intro.config;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Hashtable;
+import java.util.List;
/**
* Used to provide children of the computed gruops while constructing intro content. Clients provide
@@ -25,8 +26,8 @@ public class IntroElement {
private String name;
private String value;
- private Hashtable atts = new Hashtable();
- private ArrayList children;
+ private Hashtable<String, String> atts = new Hashtable<>();
+ private List<IntroElement> children;
/**
* Creates a new intro element with the provided name.
@@ -67,7 +68,7 @@ public class IntroElement {
* @return an enumeration of all the element names
*/
- public Enumeration getAttributes() {
+ public Enumeration<String> getAttributes() {
return atts.keys();
}
@@ -107,7 +108,7 @@ public class IntroElement {
*/
public void addChild(IntroElement child) {
if (children == null)
- children = new ArrayList();
+ children = new ArrayList<>();
children.add(child);
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/intro/contentproviders/EclipseRSSViewer.java b/org.eclipse.ui.intro/src/org/eclipse/ui/intro/contentproviders/EclipseRSSViewer.java
index e7da293e4..14a618aa7 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/intro/contentproviders/EclipseRSSViewer.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/intro/contentproviders/EclipseRSSViewer.java
@@ -24,6 +24,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import java.util.Stack;
import javax.xml.parsers.SAXParser;
@@ -98,7 +99,7 @@ public class EclipseRSSViewer implements IIntroContentProvider {
private static final String HREF_BULLET = "bullet"; //$NON-NLS-1$
- private HashMap params;
+ private Map<String, String> params;
private IIntroContentProviderSite site;
@@ -106,7 +107,7 @@ public class EclipseRSSViewer implements IIntroContentProvider {
private String id;
- private List items;
+ private List<NewsItem> items;
private Composite parent;
@@ -149,8 +150,7 @@ public class EclipseRSSViewer implements IIntroContentProvider {
} else {
if (items.size() > 0) {
out.println("<ul id=\"news-feed\" class=\"news-list\">"); //$NON-NLS-1$
- for (int i = 0; i < items.size(); i++) {
- NewsItem item = (NewsItem) items.get(i);
+ for (NewsItem item : items) {
out.print("<li>"); //$NON-NLS-1$
out.print("<a class=\"topicList\" href=\""); //$NON-NLS-1$
out.print(createExternalURL(item.url));
@@ -396,7 +396,7 @@ public class EclipseRSSViewer implements IIntroContentProvider {
private static final String ELEMENT_TITLE = "title"; //$NON-NLS-1$
private static final String ELEMENT_LINK = "link"; //$NON-NLS-1$
- private Stack stack = new Stack();
+ private Stack<String> stack = new Stack<>();
private StringBuffer buf;
private NewsItem item;
@@ -456,8 +456,8 @@ public class EclipseRSSViewer implements IIntroContentProvider {
}
}
- private HashMap setParams(String query) {
- HashMap _params = new HashMap();
+ private Map<String, String> setParams(String query) {
+ Map<String, String> _params = new HashMap<>();
//String[] t = _query.split("?");
//String query = t[1];
if (query != null && query.length() > 1) {
@@ -484,7 +484,7 @@ public class EclipseRSSViewer implements IIntroContentProvider {
public void run()
{
threadRunning = true;
- items = Collections.synchronizedList(new ArrayList());
+ items = Collections.synchronizedList(new ArrayList<>());
InputStream in = null;
@@ -520,7 +520,7 @@ public class EclipseRSSViewer implements IIntroContentProvider {
}
private void setTimeout(URLConnection conn, int milliseconds) {
- Class conClass = conn.getClass();
+ Class<? extends URLConnection> conClass = conn.getClass();
try {
Method timeoutMethod = conClass.getMethod(
"setConnectTimeout", new Class[]{ int.class } ); //$NON-NLS-1$

Back to the top