Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2017-02-28 14:04:48 +0000
committerAlexander Kurtakov2017-02-28 14:04:48 +0000
commit82aac06efdfc056a18ab8944f96f2a290a05381c (patch)
tree3d775286be9478a35b095c239587cb4555c74bf3
parentc0d653794c46020c435891436f21d488ecfb69ef (diff)
downloadeclipse.platform.ua-82aac06efdfc056a18ab8944f96f2a290a05381c.tar.gz
eclipse.platform.ua-82aac06efdfc056a18ab8944f96f2a290a05381c.tar.xz
eclipse.platform.ua-82aac06efdfc056a18ab8944f96f2a290a05381c.zip
Lamba usages and generification. Change-Id: I224645c54dd2cdd3793fc6f417b13584888f7dfb Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
-rw-r--r--org.eclipse.ui.cheatsheets/.settings/org.eclipse.jdt.core.prefs11
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/cheatsheets/OpenCheatSheetFromHelpAction.java9
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/ActionRunner.java16
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/CheatSheetHistory.java8
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/TreeExplorerMenu.java10
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/BlockedTaskFinder.java4
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/CompositeCheatSheetModel.java9
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/TaskDependencies.java6
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/CheatsheetTaskEditor.java10
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/CompositeCheatSheetPage.java6
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/TaskEditorManager.java4
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/TaskExplorerManager.java4
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/CheatSheetSaveHelper.java8
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/Item.java10
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/dialogs/CheatSheetCategoryBasedSelectionDialog.java24
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetCollectionElement.java6
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetElement.java4
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetItemExtensionElement.java6
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetRegistryReader.java6
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CheatSheetPage.java6
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CheatSheetViewer.java42
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CoreItem.java18
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/ErrorPage.java4
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/ViewItem.java15
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/provisional/cheatsheets/ICompositeCheatSheetTask.java2
-rw-r--r--org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/CustomizationContentsArea.java71
26 files changed, 131 insertions, 188 deletions
diff --git a/org.eclipse.ui.cheatsheets/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.ui.cheatsheets/.settings/org.eclipse.jdt.core.prefs
index 35d82ea0b..f860a49b4 100644
--- a/org.eclipse.ui.cheatsheets/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.ui.cheatsheets/.settings/org.eclipse.jdt.core.prefs
@@ -2,8 +2,11 @@ eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
+org.eclipse.jdt.core.compiler.annotation.nonnull.secondary=
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary=
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
+org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
@@ -50,19 +53,21 @@ org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=error
org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
+org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning
org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
org.eclipse.jdt.core.compiler.problem.nullReference=ignore
org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
-org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
-org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
@@ -73,7 +78,7 @@ org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
-org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
+org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/cheatsheets/OpenCheatSheetFromHelpAction.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/cheatsheets/OpenCheatSheetFromHelpAction.java
index 7527c525c..843f96d06 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/cheatsheets/OpenCheatSheetFromHelpAction.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/cheatsheets/OpenCheatSheetFromHelpAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2015 IBM Corporation and others.
+ * Copyright (c) 2004, 2017 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
@@ -49,11 +49,6 @@ public final class OpenCheatSheetFromHelpAction implements ILiveHelpAction {
@Override
public void run() {
// Active help does not run on the UI thread, so we must use syncExec
- Display.getDefault().syncExec(new Runnable() {
- @Override
- public void run() {
- new OpenCheatSheetAction(cheatsheetID).run();
- }
- });
+ Display.getDefault().syncExec(() -> new OpenCheatSheetAction(cheatsheetID).run());
}
}
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/ActionRunner.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/ActionRunner.java
index f0c0f114b..46c4099d2 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/ActionRunner.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/ActionRunner.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2015 IBM Corporation and others.
+ * Copyright (c) 2005, 2017 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
@@ -16,7 +16,6 @@ import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.osgi.util.NLS;
import org.eclipse.ui.cheatsheets.ICheatSheetAction;
import org.eclipse.ui.internal.cheatsheets.data.Action;
@@ -38,7 +37,7 @@ public class ActionRunner {
String message = NLS.bind(Messages.ERROR_FINDING_PLUGIN_FOR_ACTION, (new Object[] {pluginId}));
return new Status(IStatus.ERROR, ICheatSheetResource.CHEAT_SHEET_PLUGIN_ID, IStatus.OK, message, null);
}
- Class actionClass;
+ Class<?> actionClass;
IAction action;
try {
actionClass = bundle.loadClass(className);
@@ -55,13 +54,10 @@ public class ActionRunner {
final boolean[] listenerFired = { false };
final boolean[] listenerResult = { false };
- IPropertyChangeListener propertyChangeListener = new IPropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent event) {
- if(event.getProperty().equals(IAction.RESULT) && event.getNewValue() instanceof Boolean) {
- listenerFired[0] = true;
- listenerResult[0] = ((Boolean)event.getNewValue()).booleanValue();
- }
+ IPropertyChangeListener propertyChangeListener = event -> {
+ if (event.getProperty().equals(IAction.RESULT) && event.getNewValue() instanceof Boolean) {
+ listenerFired[0] = true;
+ listenerResult[0] = ((Boolean) event.getNewValue()).booleanValue();
}
};
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/CheatSheetHistory.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/CheatSheetHistory.java
index b313a8036..1051f853f 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/CheatSheetHistory.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/CheatSheetHistory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2002, 2015 IBM Corporation and others.
+ * Copyright (c) 2002, 2017 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
@@ -32,7 +32,7 @@ public class CheatSheetHistory {
private ArrayList<CheatSheetElement> history;
private CheatSheetRegistryReader reg;
- private ListenerList listeners = new ListenerList();
+ private ListenerList<IPropertyListener> listeners = new ListenerList<>();
public CheatSheetHistory(CheatSheetRegistryReader reg) {
this.history = new ArrayList<>(DEFAULT_DEPTH);
@@ -48,9 +48,7 @@ public class CheatSheetHistory {
}
private void fireChange() {
- Object[] array = listeners.getListeners();
- for (int i = 0; i < array.length; i++) {
- IPropertyListener element = (IPropertyListener)array[i];
+ for (IPropertyListener element : listeners) {
element.propertyChanged(this, 0);
}
}
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/TreeExplorerMenu.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/TreeExplorerMenu.java
index 4a05ec943..5c9b75040 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/TreeExplorerMenu.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/TreeExplorerMenu.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2015 IBM Corporation and others.
+ * Copyright (c) 2005, 2017 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
@@ -16,7 +16,6 @@ package org.eclipse.ui.internal.cheatsheets.composite.explorer;
*/
import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.viewers.ISelection;
@@ -34,12 +33,7 @@ public class TreeExplorerMenu {
this.explorer = explorer;
MenuManager menuMgr = new MenuManager(null);
menuMgr.setRemoveAllWhenShown(true);
- menuMgr.addMenuListener(new IMenuListener() {
- @Override
- public void menuAboutToShow(IMenuManager manager) {
- fillContextMenu(manager);
- }
- });
+ menuMgr.addMenuListener(manager -> fillContextMenu(manager));
Menu menu = menuMgr.createContextMenu(explorer.getControl());
explorer.getControl().setMenu(menu);
}
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/BlockedTaskFinder.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/BlockedTaskFinder.java
index 72449ff75..9b0cfaca2 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/BlockedTaskFinder.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/BlockedTaskFinder.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2015 IBM Corporation and others.
+ * Copyright (c) 2006, 2017 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
@@ -37,7 +37,7 @@ public class BlockedTaskFinder {
* <li> Add the successor and its children to the list if not started
*/
- public Set findBlockedTaskChanges(Set<ICompositeCheatSheetTask> stateChangedTasks) {
+ public Set<ICompositeCheatSheetTask> findBlockedTaskChanges(Set<ICompositeCheatSheetTask> stateChangedTasks) {
this.stateChangedTasks = stateChangedTasks;
impactedTasks = new HashSet<>();
visitChangedTasks();
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/CompositeCheatSheetModel.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/CompositeCheatSheetModel.java
index 36e499c5e..5f6eb3fa9 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/CompositeCheatSheetModel.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/CompositeCheatSheetModel.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2015 IBM Corporation and others.
+ * Copyright (c) 2005, 2017 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
@@ -113,12 +113,13 @@ public class CompositeCheatSheetModel extends Observable implements ICompositeCh
* send events for those also.
*/
public void sendTaskChangeEvents() {
- Set blockedStateChanged = new BlockedTaskFinder().findBlockedTaskChanges(stateChangedSet);
- for (Iterator iter = stateChangedSet.iterator(); iter.hasNext();) {
+ Set<ICompositeCheatSheetTask> blockedStateChanged = new BlockedTaskFinder()
+ .findBlockedTaskChanges(stateChangedSet);
+ for (Iterator<ICompositeCheatSheetTask> iter = stateChangedSet.iterator(); iter.hasNext();) {
setChanged();
notifyObservers(iter.next());
}
- for (Iterator iter = blockedStateChanged.iterator(); iter.hasNext();) {
+ for (Iterator<ICompositeCheatSheetTask> iter = blockedStateChanged.iterator(); iter.hasNext();) {
setChanged();
notifyObservers(iter.next());
}
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/TaskDependencies.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/TaskDependencies.java
index bb583ac06..c59a4fa43 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/TaskDependencies.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/TaskDependencies.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2015 IBM Corporation and others.
+ * Copyright (c) 2005, 2017 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
@@ -112,8 +112,8 @@ public class TaskDependencies {
private void checkForCircularities (IStatusContainer status) {
Set<ICompositeCheatSheetTask> tasks = new HashSet<>();
// Combine steps 1 + 2
- for (Iterator idIterator = taskIdMap.values().iterator(); idIterator.hasNext(); ) {
- AbstractTask nextTask = (AbstractTask)idIterator.next();
+ for (Iterator<AbstractTask> idIterator = taskIdMap.values().iterator(); idIterator.hasNext();) {
+ AbstractTask nextTask = idIterator.next();
if (nextTask.getRequiredTasks().length > 0) {
tasks.add(nextTask);
}
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/CheatsheetTaskEditor.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/CheatsheetTaskEditor.java
index 37967c840..62a367e63 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/CheatsheetTaskEditor.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/CheatsheetTaskEditor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2015 IBM Corporation and others.
+ * Copyright (c) 2005, 2017 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
@@ -49,11 +49,11 @@ public class CheatsheetTaskEditor extends TaskEditor {
@Override
public void setInput(IEditableTask task, IMemento memento) {
this.task = task;
- Dictionary params = task.getParameters();
- String id = (String)params.get(ICompositeCheatsheetTags.CHEATSHEET_TASK_ID);
- String path = (String)params.get(ICompositeCheatsheetTags.CHEATSHEET_TASK_PATH);
+ Dictionary<String, String> params = task.getParameters();
+ String id = params.get(ICompositeCheatsheetTags.CHEATSHEET_TASK_ID);
+ String path = params.get(ICompositeCheatsheetTags.CHEATSHEET_TASK_PATH);
boolean showIntro = true;
- String showIntroParam = (String)params.get(ICompositeCheatsheetTags.CHEATSHEET_TASK_SHOW_INTRO);
+ String showIntroParam = params.get(ICompositeCheatsheetTags.CHEATSHEET_TASK_SHOW_INTRO);
if (showIntroParam != null) {
showIntro = showIntroParam.equalsIgnoreCase("true"); //$NON-NLS-1$
}
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/CompositeCheatSheetPage.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/CompositeCheatSheetPage.java
index 76cddda5a..8d724751c 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/CompositeCheatSheetPage.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/CompositeCheatSheetPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2015 IBM Corporation and others.
+ * Copyright (c) 2005, 2017 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
@@ -184,12 +184,12 @@ public class CompositeCheatSheetPage extends Page implements ISelectionChangedLi
super.dispose();
}
- private void setInputModel(CompositeCheatSheetModel model, Map layout) {
+ private void setInputModel(CompositeCheatSheetModel model, Map<String, String> layout) {
this.model = model;
mform.getForm().setText(ViewUtilities.escapeForLabel(model.getName()));
String explorerId = model.getTaskExplorerId();
setCurrentExplorerFromId(explorerId);
- String selectedTaskId = (String) layout.get(ICompositeCheatsheetTags.SELECTED_TASK);
+ String selectedTaskId = layout.get(ICompositeCheatsheetTags.SELECTED_TASK);
ICompositeCheatSheetTask selectedTask= null;
if (selectedTaskId != null) {
selectedTask = model.getDependencies().getTask(selectedTaskId);
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/TaskEditorManager.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/TaskEditorManager.java
index a1812687a..a759e50be 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/TaskEditorManager.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/TaskEditorManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2015 IBM Corporation and others.
+ * Copyright (c) 2005, 2017 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
@@ -60,7 +60,7 @@ public class TaskEditorManager {
}
try {
if (extClass != null) {
- Constructor c = extClass.getConstructor(new Class[0]);
+ Constructor<?> c = extClass.getConstructor(new Class[0]);
editorInstance = (TaskEditor) c.newInstance();
}
} catch (Exception e) {
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/TaskExplorerManager.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/TaskExplorerManager.java
index aea2d05c7..af055f270 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/TaskExplorerManager.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/TaskExplorerManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2015 IBM Corporation and others.
+ * Copyright (c) 2005, 2017 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
@@ -65,7 +65,7 @@ private static TaskExplorerManager instance;
}
try {
if (extClass != null) {
- Constructor c = extClass.getConstructor();
+ Constructor<?> c = extClass.getConstructor();
explorerInstance = (TaskExplorer) c.newInstance();
}
} catch (Exception e) {
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/CheatSheetSaveHelper.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/CheatSheetSaveHelper.java
index bb33dee6e..b5668f425 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/CheatSheetSaveHelper.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/CheatSheetSaveHelper.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2002, 2015 IBM Corporation and others.
+ * Copyright (c) 2002, 2017 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
@@ -279,13 +279,13 @@ public class CheatSheetSaveHelper {
}
private void addListOfStringsToMemento(IMemento memento, Properties properties, String key) {
- List list = (List)properties.get(key);
+ List<String> list = (List<String>) properties.get(key);
if (list == null) {
return;
}
- for (Iterator iter = list.iterator(); iter.hasNext();) {
+ for (Iterator<String> iter = list.iterator(); iter.hasNext();) {
IMemento childMemento = memento.createChild(key);
- childMemento.putString(IParserTags.ITEM,(String)iter.next());
+ childMemento.putString(IParserTags.ITEM, iter.next());
}
}
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/Item.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/Item.java
index c26b4fa36..9ebe9270b 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/Item.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/Item.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2002, 2015 IBM Corporation and others.
+ * Copyright (c) 2002, 2017 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
@@ -13,11 +13,13 @@ package org.eclipse.ui.internal.cheatsheets.data;
import java.util.ArrayList;
import java.util.Iterator;
+import org.eclipse.ui.cheatsheets.AbstractItemExtensionElement;
+
public class Item extends Intro implements IExecutableItem, IPerformWhenItem, ISubItemItem {
private String title;
private boolean skip;
private boolean dialog;
- private ArrayList itemExtensions;
+ private ArrayList<AbstractItemExtensionElement[]> itemExtensions;
private AbstractExecutable executable;
private PerformWhen performWhen;
@@ -105,7 +107,7 @@ public class Item extends Intro implements IExecutableItem, IPerformWhenItem, IS
* Sets the item extensions for this item.
* @param exts the extensions to set
*/
- public void setItemExtensions(ArrayList exts) {
+ public void setItemExtensions(ArrayList<AbstractItemExtensionElement[]> exts) {
this.itemExtensions = exts;
}
@@ -113,7 +115,7 @@ public class Item extends Intro implements IExecutableItem, IPerformWhenItem, IS
* Returns the item extensions, if any, for this item,.
* @return list of the extensions or <code>null</code>
*/
- public ArrayList getItemExtensions() {
+ public ArrayList<AbstractItemExtensionElement[]> getItemExtensions() {
return itemExtensions;
}
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/dialogs/CheatSheetCategoryBasedSelectionDialog.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/dialogs/CheatSheetCategoryBasedSelectionDialog.java
index a33c55423..99efb55ac 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/dialogs/CheatSheetCategoryBasedSelectionDialog.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/dialogs/CheatSheetCategoryBasedSelectionDialog.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2002, 2015 IBM Corporation and others.
+ * Copyright (c) 2002, 2017 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
@@ -24,9 +24,7 @@ import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.dialogs.TrayDialog;
-import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IContentProvider;
-import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
@@ -284,18 +282,14 @@ public class CheatSheetCategoryBasedSelectionDialog extends TrayDialog //extends
createShowAllButton(outerContainer);
// Add double-click listener
- treeViewer.addDoubleClickListener(new IDoubleClickListener() {
- @Override
- public void doubleClick(DoubleClickEvent event) {
- IStructuredSelection selection = (IStructuredSelection)event.getSelection();
- Object obj = selection.getFirstElement();
- if (obj instanceof CheatSheetCollectionElement) {
- boolean state = treeViewer.getExpandedState(obj);
- treeViewer.setExpandedState(obj, !state);
- }
- else {
- okPressed();
- }
+ treeViewer.addDoubleClickListener(event -> {
+ IStructuredSelection selection = (IStructuredSelection) event.getSelection();
+ Object obj = selection.getFirstElement();
+ if (obj instanceof CheatSheetCollectionElement) {
+ boolean state = treeViewer.getExpandedState(obj);
+ treeViewer.setExpandedState(obj, !state);
+ } else {
+ okPressed();
}
});
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetCollectionElement.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetCollectionElement.java
index 265bcd0ae..e640e068e 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetCollectionElement.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetCollectionElement.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2002, 2015 IBM Corporation and others.
+ * Copyright (c) 2002, 2017 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
@@ -96,8 +96,8 @@ public class CheatSheetCollectionElement extends WorkbenchAdapter implements IPl
}
if (!recursive)
return null;
- for (Iterator iterator = childCollections.iterator(); iterator.hasNext();) {
- CheatSheetCollectionElement child = (CheatSheetCollectionElement) iterator.next();
+ for (Iterator<CheatSheetCollectionElement> iterator = childCollections.iterator(); iterator.hasNext();) {
+ CheatSheetCollectionElement child = iterator.next();
CheatSheetElement result = child.findCheatSheet(searchId, true);
if (result != null)
return result;
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetElement.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetElement.java
index 17ade33f2..7d621f896 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetElement.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetElement.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2002, 2015 IBM Corporation and others.
+ * Copyright (c) 2002, 2017 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
@@ -160,7 +160,7 @@ public class CheatSheetElement extends WorkbenchAdapter implements IAdaptable, I
return null;
}
- Class extClass = null;
+ Class<?> extClass = null;
CheatSheetListener listener = null;
String pluginId = configurationElement.getContributor().getName();
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetItemExtensionElement.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetItemExtensionElement.java
index 76cf865ba..626dcb740 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetItemExtensionElement.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetItemExtensionElement.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2002, 2015 IBM Corporation and others.
+ * Copyright (c) 2002, 2017 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
@@ -33,7 +33,7 @@ public class CheatSheetItemExtensionElement extends WorkbenchAdapter implements
private String className;
private String itemAttribute;
private IConfigurationElement configurationElement;
- private final Class[] stringArray = { String.class };
+ private final Class<?>[] stringArray = { String.class };
/**
* Create a new instance of this class
@@ -123,7 +123,7 @@ public class CheatSheetItemExtensionElement extends WorkbenchAdapter implements
}
try {
if (extClass != null) {
- Constructor c = extClass.getConstructor(stringArray);
+ Constructor<?> c = extClass.getConstructor(stringArray);
extElement = (AbstractItemExtensionElement) c.newInstance(itemAttribute);
}
} catch (Exception e) {
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetRegistryReader.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetRegistryReader.java
index fb2becffe..8bece3ea8 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetRegistryReader.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetRegistryReader.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2002, 2015 IBM Corporation and others.
+ * Copyright (c) 2002, 2017 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
@@ -439,9 +439,9 @@ public class CheatSheetRegistryReader extends RegistryReader implements IRegistr
*/
private void finishCheatSheets() {
if (deferCheatSheets != null) {
- Iterator iter = deferCheatSheets.iterator();
+ Iterator<CheatSheetElement> iter = deferCheatSheets.iterator();
while (iter.hasNext()) {
- CheatSheetElement cheatsheet = (CheatSheetElement) iter.next();
+ CheatSheetElement cheatsheet = iter.next();
IConfigurationElement config = cheatsheet.getConfigurationElement();
finishCheatSheet(cheatsheet, config, cheatsheets);
}
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CheatSheetPage.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CheatSheetPage.java
index 25865c815..cbff66190 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CheatSheetPage.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CheatSheetPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2002, 2015 IBM Corporation and others.
+ * Copyright (c) 2002, 2017 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
@@ -221,8 +221,8 @@ public class CheatSheetPage extends Page implements IMenuContributor {
@Override
public void initialized() {
- for (Iterator iter = viewItemList.iterator(); iter.hasNext();) {
- ViewItem item = (ViewItem) iter.next();
+ for (Iterator<ViewItem> iter = viewItemList.iterator(); iter.hasNext();) {
+ ViewItem item = iter.next();
item.initialized();
}
}
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CheatSheetViewer.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CheatSheetViewer.java
index 651981dc0..1cf50efb0 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CheatSheetViewer.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CheatSheetViewer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2002, 2015 IBM Corporation and others.
+ * Copyright (c) 2002, 2017 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
@@ -36,15 +36,12 @@ import org.eclipse.jface.dialogs.TrayDialog;
import org.eclipse.jface.window.Window;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.graphics.Cursor;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Menu;
@@ -102,7 +99,7 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor {
private ViewItem currentItem;
//Lists
- private ArrayList<String> expandRestoreList = new ArrayList<String>();
+ private ArrayList<String> expandRestoreList = new ArrayList<>();
private ArrayList<ViewItem> viewItemList = new ArrayList<>();
//Composites
@@ -636,12 +633,7 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor {
layout.numColumns = 1;
control.setLayout(layout);
- control.addDisposeListener(new DisposeListener(){
- @Override
- public void widgetDisposed(DisposeEvent e) {
- dispose();
- }
- });
+ control.addDisposeListener(e -> dispose());
showStartPage();
@@ -687,18 +679,15 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor {
control.setVisible(false);
Display.getCurrent().removeFilter(SWT.Show, listener);
- helpPart.getControl().addListener(SWT.Dispose, new Listener() {
- @Override
- public void handleEvent(Event event) {
- control.setVisible(true);
- Display.getCurrent().addFilter(SWT.Show, listener);
- if (preTrayManager != null) {
- loadState(); // Load from the tray manager
- stateManager = preTrayManager;
- preTrayManager = null;
- }
- dialogReturnCode = dialog.getReturnCode();
+ helpPart.getControl().addListener(SWT.Dispose, event -> {
+ control.setVisible(true);
+ Display.getCurrent().addFilter(SWT.Show, listener);
+ if (preTrayManager != null) {
+ loadState(); // Load from the tray manager
+ stateManager = preTrayManager;
+ preTrayManager = null;
}
+ dialogReturnCode = dialog.getReturnCode();
});
}
}
@@ -798,12 +787,9 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor {
* step is this plugin is present.
*/
if (!inDialog && isInDialogItem() && (Platform.getBundle("org.eclipse.help.ui") != null)) { //$NON-NLS-1$
- listener = new Listener() {
- @Override
- public void handleEvent(Event event) {
- if (isTrayDialog(event.widget)) {
- dialogOpened((TrayDialog)((Shell)event.widget).getData());
- }
+ listener = event -> {
+ if (isTrayDialog(event.widget)) {
+ dialogOpened((TrayDialog) ((Shell) event.widget).getData());
}
};
Display.getCurrent().addFilter(SWT.Show, listener);
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CoreItem.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CoreItem.java
index 43a06a75d..037d49f05 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CoreItem.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CoreItem.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2002, 2015 IBM Corporation and others.
+ * Copyright (c) 2002, 2017 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
@@ -360,8 +360,8 @@ public class CoreItem extends ViewItem {
//loop throught the number of sub items, make a new composite for each sub item.
//Add the spacer, the label, then the buttons that are applicable for each sub item.
int i=0;
- for (Iterator iter = item.getSubItems().iterator(); iter.hasNext(); i++) {
- AbstractSubItem subItem = (AbstractSubItem)iter.next();
+ for (Iterator<AbstractSubItem> iter = item.getSubItems().iterator(); iter.hasNext(); i++) {
+ AbstractSubItem subItem = iter.next();
if( subItem instanceof RepeatedSubItem ) {
//Get the sub item to add.
@@ -451,7 +451,7 @@ public class CoreItem extends ViewItem {
//Instantiate the list to store the sub item composites.
listOfSubItemCompositeHolders = new ArrayList<>(20);
- ArrayList sublist = item.getSubItems();
+ ArrayList<AbstractSubItem> sublist = item.getSubItems();
createSubItemButtonComposite();
@@ -556,10 +556,10 @@ public class CoreItem extends ViewItem {
super.setIncomplete();
//check for sub items and reset their icons.
- ArrayList l = getListOfSubItemCompositeHolders();
+ ArrayList<SubItemCompositeHolder> l = getListOfSubItemCompositeHolders();
if(l != null){
for(int j=0; j<l.size(); j++){
- SubItemCompositeHolder s = (SubItemCompositeHolder)l.get(j);
+ SubItemCompositeHolder s = l.get(j);
if(s.isCompleted() || s.isSkipped())
s.getCheckDoneLabel().setVisible(false); //setImage(null);
if(s.getStartButton() != null) {
@@ -672,12 +672,12 @@ public class CoreItem extends ViewItem {
@Override
protected void setFocus() {
- ArrayList list = getListOfSubItemCompositeHolders();
+ ArrayList<SubItemCompositeHolder> list = getListOfSubItemCompositeHolders();
Control subitemLabel = null;
SubItemCompositeHolder holder = null;
if (list != null) {
- for (Iterator iter = list.iterator(); iter.hasNext() && subitemLabel == null ;) {
- holder = (SubItemCompositeHolder)iter.next();
+ for (Iterator<SubItemCompositeHolder> iter = list.iterator(); iter.hasNext() && subitemLabel == null;) {
+ holder = iter.next();
if (!holder.isCompleted() && !holder.isSkipped()) {
subitemLabel = holder.getSubitemLabel();
}
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/ErrorPage.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/ErrorPage.java
index 0bfae1161..be4469300 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/ErrorPage.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/ErrorPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2002, 2015 IBM Corporation and others.
+ * Copyright (c) 2002, 2017 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
@@ -60,7 +60,7 @@ public class ErrorPage extends Page {
}
public List<IStatus> getSortedStatus() {
- List<IStatus> result = new ArrayList<IStatus>();
+ List<IStatus> result = new ArrayList<>();
result.addAll(errors);
result.addAll(warnings);
result.addAll(info);
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/ViewItem.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/ViewItem.java
index 80aa925c2..fd9b44e40 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/ViewItem.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/ViewItem.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2002, 2015 IBM Corporation and others.
+ * Copyright (c) 2002, 2017 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
@@ -130,7 +130,7 @@ public abstract class ViewItem {
// handle item extensions here
// check number of extensions for this item and adjust layout accordingly
int number = 0;
- ArrayList itemExts = item.getItemExtensions();
+ ArrayList<AbstractItemExtensionElement[]> itemExts = item.getItemExtensions();
if((itemExts != null && itemExts.size() > 0) || item.getContextId() != null || item.getHref() != null) {
// Set up the title composite for the item.
@@ -140,7 +140,7 @@ public abstract class ViewItem {
if(itemExts != null) {
for (int g = 0; g < itemExts.size(); g++) {
- AbstractItemExtensionElement[] eea = (AbstractItemExtensionElement[]) itemExts.get(g);
+ AbstractItemExtensionElement[] eea = itemExts.get(g);
number += eea.length;
for (int x = 0; x < eea.length; x++) {
eea[x].createControl(titleComposite);
@@ -290,10 +290,10 @@ public abstract class ViewItem {
if (regularFont != null)
regularFont.dispose();
- ArrayList itemExts = item.getItemExtensions();
+ ArrayList<AbstractItemExtensionElement[]> itemExts = item.getItemExtensions();
if (itemExts != null) {
for (int g = 0; g < itemExts.size(); g++) {
- AbstractItemExtensionElement[] eea = (AbstractItemExtensionElement[]) itemExts.get(g);
+ AbstractItemExtensionElement[] eea = itemExts.get(g);
for (int x = 0; x < eea.length; x++) {
eea[x].dispose();
}
@@ -470,8 +470,9 @@ public abstract class ViewItem {
void setButtonsVisible(boolean isVisible) {
if (buttonExpanded != isVisible) {
if (listOfSubItemCompositeHolders != null) {
- for (Iterator iter = listOfSubItemCompositeHolders.iterator(); iter.hasNext(); ){
- ((SubItemCompositeHolder)iter.next()).setButtonsVisible(isVisible);
+ for (Iterator<SubItemCompositeHolder> iter = listOfSubItemCompositeHolders.iterator(); iter
+ .hasNext();) {
+ iter.next().setButtonsVisible(isVisible);
}
} else if (buttonComposite != null) {
buttonComposite.setVisible(isVisible);
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/provisional/cheatsheets/ICompositeCheatSheetTask.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/provisional/cheatsheets/ICompositeCheatSheetTask.java
index 16a83841d..9b7260953 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/provisional/cheatsheets/ICompositeCheatSheetTask.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/provisional/cheatsheets/ICompositeCheatSheetTask.java
@@ -58,7 +58,7 @@ public interface ICompositeCheatSheetTask {
* @return the parameter names and values as specified in the
* composite cheatsheet content file.
*/
- public Dictionary getParameters();
+ public Dictionary<String, String> getParameters();
/**
* Returns the description of the task.
* @return a plain String, or XML markup that can
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 2f4d9ab02..c0d450b8f 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2014 IBM Corporation and others.
+ * Copyright (c) 2006, 2017 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
@@ -27,23 +27,18 @@ import org.eclipse.core.runtime.preferences.DefaultScope;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.jface.viewers.CheckStateChangedEvent;
import org.eclipse.jface.viewers.CheckboxTableViewer;
import org.eclipse.jface.viewers.ComboBoxCellEditor;
import org.eclipse.jface.viewers.ICellModifier;
-import org.eclipse.jface.viewers.ICheckStateListener;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
@@ -57,8 +52,6 @@ import org.eclipse.swt.dnd.DragSourceEvent;
import org.eclipse.swt.dnd.DragSourceListener;
import org.eclipse.swt.dnd.Transfer;
import org.eclipse.swt.dnd.TransferData;
-import org.eclipse.swt.events.PaintEvent;
-import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Image;
@@ -728,12 +721,7 @@ public class CustomizationContentsArea {
public boolean performOk() {
saveData();
- BusyIndicator.showWhile(shell.getDisplay(), new Runnable() {
- @Override
- public void run() {
- restartIntro();
- }
- });
+ BusyIndicator.showWhile(shell.getDisplay(), () -> restartIntro());
return true;
}
@@ -874,14 +862,11 @@ public class CustomizationContentsArea {
themes.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
themes.setContentProvider(contentProvider);
themes.setLabelProvider(labelProvider);
- themes.addSelectionChangedListener(new ISelectionChangedListener() {
- @Override
- public void selectionChanged(SelectionChangedEvent e) {
- Object sel = ((StructuredSelection) e.getSelection()).getFirstElement();
- introTheme = (IntroTheme) sel;
- themePreview.redraw();
- enableFontsButton();
- }
+ themes.addSelectionChangedListener(e -> {
+ Object sel = ((StructuredSelection) e.getSelection()).getFirstElement();
+ introTheme = (IntroTheme) sel;
+ themePreview.redraw();
+ enableFontsButton();
});
loadThemes();
Label previewLabel = new Label(rightColumn, SWT.NULL);
@@ -891,19 +876,15 @@ public class CustomizationContentsArea {
gd.widthHint = 160+20;
gd.heightHint = 120+20;
themePreview.setLayoutData(gd);
- themePreview.addPaintListener(new PaintListener() {
-
- @Override
- public void paintControl(PaintEvent e) {
- if (introTheme == null)
- return;
- Image bgImage = introTheme.getPreviewImage();
- if (bgImage == null)
- return;
- //Rectangle carea = themePreview.getClientArea();
- Rectangle ibounds = bgImage.getBounds();
- e.gc.drawImage(bgImage, 0, 0, ibounds.width, ibounds.height, 10, 10, 160, 120);
- }
+ themePreview.addPaintListener(e -> {
+ if (introTheme == null)
+ return;
+ Image bgImage = introTheme.getPreviewImage();
+ if (bgImage == null)
+ return;
+ //Rectangle carea = themePreview.getClientArea();
+ Rectangle ibounds = bgImage.getBounds();
+ e.gc.drawImage(bgImage, 0, 0, ibounds.width, ibounds.height, 10, 10, 160, 120);
});
Label label = new Label(container, SWT.NULL);
label.setText(Messages.WelcomeCustomizationPreferencePage_rootpages);
@@ -932,14 +913,10 @@ public class CustomizationContentsArea {
gd = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
gd.horizontalSpan = 2;
rootPages.getControl().setLayoutData(gd);
- rootPages.addCheckStateListener(new ICheckStateListener() {
-
- @Override
- public void checkStateChanged(CheckStateChangedEvent event) {
- RootPage page = (RootPage) event.getElement();
- boolean checked = event.getChecked();
- onPageChecked(page.id, checked);
- }
+ rootPages.addCheckStateListener(event -> {
+ RootPage page = (RootPage) event.getElement();
+ boolean checked = event.getChecked();
+ onPageChecked(page.id, checked);
});
item.setControl(container);
}
@@ -1013,13 +990,7 @@ public class CustomizationContentsArea {
manager.createContextMenu(viewer.getControl());
viewer.getControl().setMenu(manager.getMenu());
manager.setRemoveAllWhenShown(true);
- manager.addMenuListener(new IMenuListener() {
-
- @Override
- public void menuAboutToShow(IMenuManager manager) {
- fillPopupMenu(manager, viewer);
- }
- });
+ manager.addMenuListener(manager1 -> fillPopupMenu(manager1, viewer));
}
private void addDNDSupport(TableViewer viewer) {

Back to the top