Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2017-07-19 11:14:16 -0400
committerAlexander Kurtakov2017-07-19 11:14:16 -0400
commitd796c830dbef8ef8ba662ac974b21ce5a174d739 (patch)
treec361a44833969efeb4c9cd137a621d4539252307 /bundles
parent709fad967e282a8c30156d18271beb08998b1c5f (diff)
downloadeclipse.platform.team-d796c830dbef8ef8ba662ac974b21ce5a174d739.tar.gz
eclipse.platform.team-d796c830dbef8ef8ba662ac974b21ce5a174d739.tar.xz
eclipse.platform.team-d796c830dbef8ef8ba662ac974b21ce5a174d739.zip
Bug 519875 - Cleanup o.e.team.ui
Generification(part2). Change-Id: Ibfa168d0f78a6968a6fabac6bc8037c350c55144 Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
Diffstat (limited to 'bundles')
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java10
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/CommonMenuManager.java6
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/CompareInputChangeNotifier.java12
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/DiffTreeChangesSection.java4
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ModelElementSelectionPage.java77
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/RemoveFromViewAction.java27
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceDragAdapterAssistant.java8
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/WorkspaceTeamStateProvider.java35
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/TextPreferencePage.java24
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/RegistryReader.java25
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/SynchronizeParticipantRegistry.java9
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/SynchronizeWizardRegistry.java9
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/TeamDecoratorManager.java10
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetModelProvider.java39
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/CompositeModelProvider.java63
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/DialogSynchronizePageSite.java44
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/GlobalRefreshElementSelectionPage.java12
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/GlobalRefreshResourceSelectionPage.java10
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/HierarchicalModelProvider.java25
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshModelParticipantJob.java4
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshParticipantJob.java19
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshUserNotificationPolicy.java42
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelElementLabelProvider.java31
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizePageConfiguration.java83
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/CopyToClipboardAction.java14
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenFileInSystemEditorAction.java12
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RemoveSynchronizeParticipantAction.java80
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/ApplyPatchSubscriber.java4
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/PatchWorkspace.java12
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigureProjectWizardMainPage.java11
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ExportProjectSetMainPage.java14
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/PatchInaccessibleProjectsPage.java10
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/WorkingSetsDialog.java12
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/PageSaveablePart.java57
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/history/RevisionAnnotationController.java2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/SynchronizationActionProvider.java15
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/SynchronizationCompareAdapter.java2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ModelMergeOperation.java51
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ModelOperation.java14
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ModelSynchronizeParticipant.java8
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ResourceScope.java21
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SynchronizePageActionGroup.java47
42 files changed, 308 insertions, 706 deletions
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java
index 25a95b44c..7fbf7b48e 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 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
@@ -143,16 +143,14 @@ public class Utils {
}
}
- public static final Comparator resourceComparator = new Comparator() {
+ public static final Comparator<IResource> resourceComparator = new Comparator<IResource>() {
@Override
public boolean equals(Object obj) {
return false;
}
@Override
- public int compare(Object o1, Object o2) {
- IResource resource0 = (IResource) o1;
- IResource resource1 = (IResource) o2;
- return resource0.getFullPath().toString().compareTo(resource1.getFullPath().toString());
+ public int compare(IResource o1, IResource o2) {
+ return o1.getFullPath().toString().compareTo(o2.getFullPath().toString());
}
};
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/CommonMenuManager.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/CommonMenuManager.java
index 2e158ee68..8a7f52f49 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/CommonMenuManager.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/CommonMenuManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006 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
@@ -21,7 +21,7 @@ import org.eclipse.jface.action.MenuManager;
*/
public class CommonMenuManager extends MenuManager {
- private Map handlers = new HashMap();
+ private Map<String, IHandler> handlers = new HashMap<>();
public CommonMenuManager(String id) {
super(id);
@@ -48,7 +48,7 @@ public class CommonMenuManager extends MenuManager {
}
public IHandler getHandler(String actionId) {
- return (IHandler)handlers.get(actionId);
+ return handlers.get(actionId);
}
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/CompareInputChangeNotifier.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/CompareInputChangeNotifier.java
index 7d3fb2867..45f53e73d 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/CompareInputChangeNotifier.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/CompareInputChangeNotifier.java
@@ -40,7 +40,7 @@ import org.eclipse.team.internal.ui.TeamUIMessages;
public abstract class CompareInputChangeNotifier implements
IResourceChangeListener {
- private Map inputs = new HashMap();
+ private Map<ICompareInput, CompareInputConnecton> inputs = new HashMap<>();
private InputChangeEventHandler eventHandler;
private class CompareInputConnecton {
@@ -74,7 +74,7 @@ public abstract class CompareInputChangeNotifier implements
private class InputChangeEventHandler extends BackgroundEventHandler {
- private final Set changedInputs = new HashSet();
+ private final Set<ICompareInput> changedInputs = new HashSet<>();
private final List pendingRunnables = new ArrayList();
protected InputChangeEventHandler() {
@@ -90,7 +90,7 @@ public abstract class CompareInputChangeNotifier implements
synchronized (changedInputs) {
if (changedInputs.isEmpty() && pendingRunnables.isEmpty())
return false;
- toDispatch = (ICompareInput[]) changedInputs.toArray(new ICompareInput[changedInputs.size()]);
+ toDispatch = changedInputs.toArray(new ICompareInput[changedInputs.size()]);
events = (RunnableEvent[]) pendingRunnables.toArray(new RunnableEvent[pendingRunnables.size()]);
changedInputs.clear();
pendingRunnables.clear();
@@ -205,7 +205,7 @@ public abstract class CompareInputChangeNotifier implements
* @param input the compare input
*/
public void connect(ICompareInput input) {
- CompareInputConnecton con = (CompareInputConnecton)inputs.get(input);
+ CompareInputConnecton con = inputs.get(input);
if (con == null) {
con = new CompareInputConnecton();
inputs.put(input, con);
@@ -219,7 +219,7 @@ public abstract class CompareInputChangeNotifier implements
* @see #connect(ICompareInput)
*/
public void disconnect(ICompareInput input) {
- CompareInputConnecton con = (CompareInputConnecton)inputs.get(input);
+ CompareInputConnecton con = inputs.get(input);
if (con != null) {
con.decrement();
if (con.isDisconnected()) {
@@ -233,7 +233,7 @@ public abstract class CompareInputChangeNotifier implements
* @return the array of inputs that have connections
*/
protected ICompareInput[] getConnectedInputs() {
- return (ICompareInput[])inputs.keySet().toArray(new ICompareInput[inputs.size()]);
+ return inputs.keySet().toArray(new ICompareInput[inputs.size()]);
}
/**
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/DiffTreeChangesSection.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/DiffTreeChangesSection.java
index 7241a82d2..69bb4498a 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/DiffTreeChangesSection.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/DiffTreeChangesSection.java
@@ -284,7 +284,7 @@ public class DiffTreeChangesSection extends ForwardingChangesSection implements
private ModelProvider[] findModelsWithChangesInMode(int mode) {
ModelProvider[] providers =context.getScope().getModelProviders();
providers = ModelOperation.sortByExtension(providers);
- List result = new ArrayList();
+ List<ModelProvider> result = new ArrayList<>();
for (int i = 0; i < providers.length; i++) {
ModelProvider provider = providers[i];
ISynchronizationCompareAdapter adapter = Utils.getCompareAdapter(provider);
@@ -295,7 +295,7 @@ public class DiffTreeChangesSection extends ForwardingChangesSection implements
}
}
}
- return (ModelProvider[]) result.toArray(new ModelProvider[result.size()]);
+ return result.toArray(new ModelProvider[result.size()]);
}
private boolean isEnabled(ModelProvider provider) {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ModelElementSelectionPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ModelElementSelectionPage.java
index ec1e09e53..205d6b3b2 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ModelElementSelectionPage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ModelElementSelectionPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2009 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
@@ -16,9 +16,7 @@ import java.util.*;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.mapping.*;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.*;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.TreeEvent;
@@ -50,12 +48,12 @@ public class ModelElementSelectionPage extends GlobalRefreshElementSelectionPage
super("elementSelection"); //$NON-NLS-1$
setDescription(TeamUIMessages.GlobalRefreshResourceSelectionPage_2);
setTitle(TeamUIMessages.GlobalRefreshResourceSelectionPage_3);
- List result = new ArrayList();
+ List<ResourceMapping> result = new ArrayList<>();
for (int i = 0; i < roots.length; i++) {
IResource resource = roots[i];
result.add(Utils.getResourceMapping(resource));
}
- manager = new SynchronizationScopeManager(TeamUIMessages.ModelElementSelectionPage_0, (ResourceMapping[]) result.toArray(new ResourceMapping[result.size()]),
+ manager = new SynchronizationScopeManager(TeamUIMessages.ModelElementSelectionPage_0, result.toArray(new ResourceMapping[result.size()]),
ResourceMappingContext.LOCAL_CONTEXT, true);
}
@@ -73,25 +71,22 @@ public class ModelElementSelectionPage extends GlobalRefreshElementSelectionPage
fViewer.getControl().setLayoutData(data);
fViewer.setContentProvider(service.createCommonContentProvider());
fViewer.setLabelProvider(new DecoratingLabelProvider(service.createCommonLabelProvider(), PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator()));
- fViewer.addCheckStateListener(new ICheckStateListener() {
- @Override
- public void checkStateChanged(CheckStateChangedEvent event) {
- Object element = event.getElement();
- //If the workspace model has been checked, switch the scope to workspace
- if (event.getChecked() && element instanceof ModelProvider && ((ModelProvider) element).getId().equals(ModelProvider.RESOURCE_MODEL_PROVIDER_ID)) {
- setWorkspaceSelected(true);
- } else {
- //Get the resource mapping from the element
- ResourceMapping mapping = Utils.getResourceMapping(element);
- if (mapping != null) {
- if (!(element instanceof ModelProvider)) {
- uncheckOtherModels(mapping.getModelProviderId());
- event.getCheckable().setChecked(event.getElement(), event.getChecked());
- }
- updateOKStatus();
- } else
- updateOKStatus();
- }
+ fViewer.addCheckStateListener(event -> {
+ Object element = event.getElement();
+ //If the workspace model has been checked, switch the scope to workspace
+ if (event.getChecked() && element instanceof ModelProvider && ((ModelProvider) element).getId().equals(ModelProvider.RESOURCE_MODEL_PROVIDER_ID)) {
+ setWorkspaceSelected(true);
+ } else {
+ //Get the resource mapping from the element
+ ResourceMapping mapping = Utils.getResourceMapping(element);
+ if (mapping != null) {
+ if (!(element instanceof ModelProvider)) {
+ uncheckOtherModels(mapping.getModelProviderId());
+ event.getCheckable().setChecked(event.getElement(), event.getChecked());
+ }
+ updateOKStatus();
+ } else
+ updateOKStatus();
}
});
fViewer.getTree().addTreeListener(new TreeListener(){
@@ -113,13 +108,13 @@ public class ModelElementSelectionPage extends GlobalRefreshElementSelectionPage
public ResourceMapping[] getSelectedMappings() {
if (isWorkingSetSelected()) {
- List result = new ArrayList();
+ List<ResourceMapping> result = new ArrayList<>();
IWorkingSet[] sets = getWorkingSets();
for (int i = 0; i < sets.length; i++) {
IWorkingSet set = sets[i];
result.add(Utils.getResourceMapping(set));
}
- return (ResourceMapping[]) result.toArray(new ResourceMapping[result.size()]);
+ return result.toArray(new ResourceMapping[result.size()]);
}
if (isWorkspaceSelected()) {
try {
@@ -135,7 +130,7 @@ public class ModelElementSelectionPage extends GlobalRefreshElementSelectionPage
ResourceMapping[] mappings = manager.getScope().getMappings(ModelProvider.RESOURCE_MODEL_PROVIDER_ID);
return mappings;
}
- List result = new ArrayList();
+ List<ResourceMapping> result = new ArrayList<>();
Object[] objects = getRootElement();
for (int i = 0; i < objects.length; i++) {
Object object = objects[i];
@@ -144,7 +139,7 @@ public class ModelElementSelectionPage extends GlobalRefreshElementSelectionPage
result.add(mapping);
}
}
- return (ResourceMapping[]) result.toArray(new ResourceMapping[result.size()]);
+ return result.toArray(new ResourceMapping[result.size()]);
}
@Override
@@ -217,11 +212,11 @@ public class ModelElementSelectionPage extends GlobalRefreshElementSelectionPage
if (!foundEnabledModelProvider){
if (MessageDialog.openConfirm(getShell(), TeamUIMessages.ModelElementSelectionPage_AllModelsDisabledTitle, TeamUIMessages.ModelElementSelectionPage_AllModelsDisabledMessage)) {
- ArrayList teamProviderDescriptors = new ArrayList();
+ ArrayList<ITeamContentProviderDescriptor> teamProviderDescriptors = new ArrayList<>();
for (int i = 0; i < providers.length; i++)
teamProviderDescriptors.add(TeamUI.getTeamContentProviderManager().getDescriptor(providers[i].getId()));
- ITeamContentProviderDescriptor[] desc = (ITeamContentProviderDescriptor[]) teamProviderDescriptors.toArray(new ITeamContentProviderDescriptor[teamProviderDescriptors.size()]);
+ ITeamContentProviderDescriptor[] desc = teamProviderDescriptors.toArray(new ITeamContentProviderDescriptor[teamProviderDescriptors.size()]);
TeamUI.getTeamContentProviderManager().setEnabledDescriptors(desc);
}
}
@@ -235,18 +230,13 @@ public class ModelElementSelectionPage extends GlobalRefreshElementSelectionPage
private void initialize() {
try {
- getContainer().run(true, true, new IRunnableWithProgress() {
- @Override
- public void run(IProgressMonitor monitor) throws InvocationTargetException,
- InterruptedException {
- try {
- manager.initialize(monitor);
- initialized = true;
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- }
+ getContainer().run(true, true, monitor -> {
+ try {
+ manager.initialize(monitor);
+ initialized = true;
+ } catch (CoreException e) {
+ throw new InvocationTargetException(e);
}
-
});
} catch (InvocationTargetException e) {
Utils.handleError(getShell(), e, null, null);
@@ -264,15 +254,14 @@ public class ModelElementSelectionPage extends GlobalRefreshElementSelectionPage
if (!isSelectedResourcesSelected()) {
ModelProvider[] providers = manager.getScope().getModelProviders();
- ArrayList disabledProviders = new ArrayList();
+ ArrayList<ModelProvider> disabledProviders = new ArrayList<>();
for (int i = 0; i < providers.length; i++) {
if (!providers[i].getId().equals(modelProviderId)) {
disabledProviders.add(providers[i]);
}
}
- for (Iterator iterator = disabledProviders.iterator(); iterator.hasNext();) {
- ModelProvider disable = (ModelProvider) iterator.next();
+ for (ModelProvider disable : disabledProviders) {
fViewer.setChecked(disable, false);
}
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/RemoveFromViewAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/RemoveFromViewAction.java
index 00d415c08..2433c5f11 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/RemoveFromViewAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/RemoveFromViewAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 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
@@ -18,7 +18,6 @@ import org.eclipse.core.resources.mapping.ResourceTraversal;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.dialogs.MessageDialogWithToggle;
-import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.window.Window;
@@ -39,22 +38,15 @@ public class RemoveFromViewAction extends ResourceModelParticipantAction {
setId(TeamUIPlugin.REMOVE_FROM_VIEW_ACTION_ID);
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.Action#run()
- */
@Override
public void run() {
if (confirmRemove()) {
try {
- PlatformUI.getWorkbench().getProgressService().run(true, true, new IRunnableWithProgress() {
- @Override
- public void run(IProgressMonitor monitor) throws InvocationTargetException,
- InterruptedException {
- try {
- performRemove(monitor);
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- }
+ PlatformUI.getWorkbench().getProgressService().run(true, true, monitor -> {
+ try {
+ performRemove(monitor);
+ } catch (CoreException e) {
+ throw new InvocationTargetException(e);
}
});
} catch (InvocationTargetException e) {
@@ -84,14 +76,14 @@ public class RemoveFromViewAction extends ResourceModelParticipantAction {
private IResource[] getVisibleResources(IProgressMonitor monitor) throws CoreException {
ResourceTraversal[] traversals = getResourceTraversals(getStructuredSelection(), monitor);
IDiff[] diffs = getSynchronizationContext().getDiffTree().getDiffs(traversals);
- List result = new ArrayList();
+ List<IResource> result = new ArrayList<>();
for (int i = 0; i < diffs.length; i++) {
IDiff diff = diffs[i];
if (isVisible(diff)) {
result.add(ResourceDiffTree.getResourceFor(diff));
}
}
- return (IResource[]) result.toArray(new IResource[result.size()]);
+ return result.toArray(new IResource[result.size()]);
}
private boolean confirmRemove() {
@@ -112,9 +104,6 @@ public class RemoveFromViewAction extends ResourceModelParticipantAction {
}
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ModelParticipantAction#isEnabledForSelection(org.eclipse.jface.viewers.IStructuredSelection)
- */
@Override
protected boolean isEnabledForSelection(IStructuredSelection selection) {
// Only enable if the selected elements adapt to IResource
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceDragAdapterAssistant.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceDragAdapterAssistant.java
index c584f2ba1..ffd6ae6b5 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceDragAdapterAssistant.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceDragAdapterAssistant.java
@@ -34,7 +34,7 @@ public class ResourceDragAdapterAssistant extends CommonDragAdapterAssistant {
ResourceTransfer.getInstance(),
FileTransfer.getInstance() };
- private static final Class IRESOURCE_TYPE = IResource.class;
+ private static final Class<IResource> IRESOURCE_TYPE = IResource.class;
@Override
public Transfer[] getSupportedTransferTypes() {
@@ -107,11 +107,9 @@ public class ResourceDragAdapterAssistant extends CommonDragAdapterAssistant {
if (selected instanceof IResource) {
resource = (IResource) selected;
} else if (selected instanceof IAdaptable) {
- resource = (IResource) ((IAdaptable) selected)
- .getAdapter(IRESOURCE_TYPE);
+ resource = ((IAdaptable) selected).getAdapter(IRESOURCE_TYPE);
} else {
- resource = (IResource) Platform.getAdapterManager().getAdapter(
- selected, IRESOURCE_TYPE);
+ resource = Platform.getAdapterManager().getAdapter(selected, IRESOURCE_TYPE);
}
return resource;
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/WorkspaceTeamStateProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/WorkspaceTeamStateProvider.java
index d167ee887..7ed8234aa 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/WorkspaceTeamStateProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/WorkspaceTeamStateProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006 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
@@ -34,7 +34,7 @@ public class WorkspaceTeamStateProvider extends TeamStateProvider
implements ITeamStateChangeListener, IRepositoryProviderListener,
IResourceChangeListener {
- private Map providers = new HashMap();
+ private Map<String, ITeamStateProvider> providers = new HashMap<>();
public WorkspaceTeamStateProvider() {
RepositoryProviderManager.getInstance().addListener(this);
@@ -53,9 +53,6 @@ public class WorkspaceTeamStateProvider extends TeamStateProvider
ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.mapping.DecoratedStateProvider#isDecorationEnabled(java.lang.Object)
- */
@Override
public final boolean isDecorationEnabled(Object element) {
ITeamStateProvider provider = getDecoratedStateProvider(element);
@@ -64,9 +61,6 @@ public class WorkspaceTeamStateProvider extends TeamStateProvider
return false;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.mapping.DecoratedStateProvider#isDecorated(java.lang.Object)
- */
@Override
public boolean hasDecoratedState(Object element) throws CoreException {
ITeamStateProvider provider = getDecoratedStateProvider(element);
@@ -75,9 +69,6 @@ public class WorkspaceTeamStateProvider extends TeamStateProvider
return false;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.mapping.DecoratedStateProvider#getDecoratedStateMask(java.lang.Object)
- */
@Override
public final int getDecoratedStateMask(Object element) {
ITeamStateProvider provider = getDecoratedStateProvider(element);
@@ -86,9 +77,6 @@ public class WorkspaceTeamStateProvider extends TeamStateProvider
return 0;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.mapping.ITeamStateProvider#getDecoratedProperties(java.lang.Object)
- */
@Override
public String[] getDecoratedProperties(Object element) {
ITeamStateProvider provider = getDecoratedStateProvider(element);
@@ -97,10 +85,6 @@ public class WorkspaceTeamStateProvider extends TeamStateProvider
return new String[0];
}
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.mapping.DecoratedStateProvider#getState(java.lang.Object, int, org.eclipse.core.runtime.IProgressMonitor)
- */
@Override
public ITeamStateDescription getStateDescription(Object element, int stateMask,
String[] properties, IProgressMonitor monitor) throws CoreException {
@@ -110,9 +94,6 @@ public class WorkspaceTeamStateProvider extends TeamStateProvider
return null;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.mapping.ITeamStateProvider#getResourceMappingContext(java.lang.Object)
- */
@Override
public ResourceMappingContext getResourceMappingContext(Object element) {
ITeamStateProvider provider = getDecoratedStateProvider(element);
@@ -193,34 +174,22 @@ public class WorkspaceTeamStateProvider extends TeamStateProvider
}
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.mapping.IDecoratedStateChangeListener#decoratedStateChanged(org.eclipse.team.ui.mapping.IDecoratedStateChangeEvent)
- */
@Override
public void teamStateChanged(ITeamStateChangeEvent event) {
fireStateChangeEvent(event);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.IRepositoryProviderListener#providerUnmapped(org.eclipse.core.resources.IProject)
- */
@Override
public void providerUnmapped(IProject project) {
// We don't need to worry about this
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.IRepositoryProviderListener#providerMapped(org.eclipse.team.core.RepositoryProvider)
- */
@Override
public void providerMapped(RepositoryProvider provider) {
String id = provider.getID();
listenerForStateChangesForId(id);
}
- /* (non-Javadoc)
- * @see org.eclipse.core.resources.IResourceChangeListener#resourceChanged(org.eclipse.core.resources.IResourceChangeEvent)
- */
@Override
public void resourceChanged(IResourceChangeEvent event) {
IResourceDelta delta = event.getDelta();
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/TextPreferencePage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/TextPreferencePage.java
index 9f05d0227..273c3b805 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/TextPreferencePage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/TextPreferencePage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 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
@@ -131,24 +131,18 @@ public class TextPreferencePage extends PreferencePage implements IWorkbenchPref
}
- private static Set makeSetOfStrings(IStringMapping [] mappings) {
- final Set set= new HashSet(mappings.length);
+ private static Set<String> makeSetOfStrings(IStringMapping [] mappings) {
+ final Set<String> set= new HashSet<>(mappings.length);
for (int i = 0; i < mappings.length; i++) {
set.add(mappings[i].getString());
}
return set;
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
- */
@Override
public void init(IWorkbench workbench) {
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
- */
@Override
protected Control createContents(Composite parent) {
@@ -255,11 +249,11 @@ public class TextPreferencePage extends PreferencePage implements IWorkbenchPref
*/
@Override
public boolean performOk() {
- final ArrayList extensionsList= new ArrayList();
- final ArrayList extensionsModesList= new ArrayList();
+ final ArrayList<String> extensionsList= new ArrayList<>();
+ final ArrayList<Integer> extensionsModesList= new ArrayList<>();
- final ArrayList namesList= new ArrayList();
- final ArrayList namesModesList= new ArrayList();
+ final ArrayList<String> namesList= new ArrayList<>();
+ final ArrayList<Integer> namesModesList= new ArrayList<>();
for (final Iterator iter = fItems.iterator(); iter.hasNext();) {
final FileTypeTable.Item item= (FileTypeTable.Item) iter.next();
@@ -273,8 +267,8 @@ public class TextPreferencePage extends PreferencePage implements IWorkbenchPref
}
}
- final String [] extensions= (String [])extensionsList.toArray(new String [extensionsList.size()]);
- final String [] names= (String [])namesList.toArray(new String [namesList.size()]);
+ final String [] extensions= extensionsList.toArray(new String [extensionsList.size()]);
+ final String [] names= namesList.toArray(new String [namesList.size()]);
final int [] extensionsModes= integerListToIntArray(extensionsModesList);
final int [] namesModes= integerListToIntArray(namesModesList);
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/RegistryReader.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/RegistryReader.java
index 2a8541fa6..7b9ceb4be 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/RegistryReader.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/RegistryReader.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 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
@@ -22,7 +22,7 @@ import org.osgi.framework.Bundle;
public abstract class RegistryReader {
protected static final String TAG_DESCRIPTION = "description"; //$NON-NLS-1$
- protected static Hashtable extensionPoints = new Hashtable();
+ protected static Hashtable<String, IExtension[]> extensionPoints = new Hashtable<>();
/**
* Creates an extension. If the extension plugin has not
@@ -45,17 +45,14 @@ public abstract class RegistryReader {
}
final Object[] ret = new Object[1];
final CoreException[] exc = new CoreException[1];
- BusyIndicator.showWhile(null, new Runnable() {
- @Override
- public void run() {
- try {
- ret[0] = element
- .createExecutableExtension(classAttribute);
- } catch (CoreException e) {
- exc[0] = e;
- }
- }
- });
+ BusyIndicator.showWhile(null, () -> {
+ try {
+ ret[0] = element
+ .createExecutableExtension(classAttribute);
+ } catch (CoreException e) {
+ exc[0] = e;
+ }
+ });
if (exc[0] != null) {
throw exc[0];
}
@@ -191,7 +188,7 @@ public abstract class RegistryReader {
*/
public void readRegistry(IExtensionRegistry registry, String pluginId, String extensionPoint) {
String pointId = pluginId + "-" + extensionPoint; //$NON-NLS-1$
- IExtension[] extensions = (IExtension[]) extensionPoints.get(pointId);
+ IExtension[] extensions = extensionPoints.get(pointId);
if (extensions == null) {
IExtensionPoint point = registry.getExtensionPoint(pluginId, extensionPoint);
if (point == null)
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/SynchronizeParticipantRegistry.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/SynchronizeParticipantRegistry.java
index 8b7602abe..27a2b1724 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/SynchronizeParticipantRegistry.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/SynchronizeParticipantRegistry.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 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
@@ -21,15 +21,12 @@ public class SynchronizeParticipantRegistry extends RegistryReader {
public static final String PT_SYNCPARTICIPANTS = "synchronizeParticipants"; //$NON-NLS-1$
private static final String TAG_SYNCPARTICIPANT = "participant"; //$NON-NLS-1$
- private Map participants = new HashMap();
+ private Map<String, SynchronizeParticipantDescriptor> participants = new HashMap<>();
public SynchronizeParticipantRegistry() {
super();
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.registry.RegistryReader#readElement(org.eclipse.core.runtime.IConfigurationElement)
- */
@Override
protected boolean readElement(IConfigurationElement element) {
if (element.getName().equals(TAG_SYNCPARTICIPANT)) {
@@ -47,6 +44,6 @@ public class SynchronizeParticipantRegistry extends RegistryReader {
}
public SynchronizeParticipantDescriptor find(String id) {
- return (SynchronizeParticipantDescriptor)participants.get(id);
+ return participants.get(id);
}
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/SynchronizeWizardRegistry.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/SynchronizeWizardRegistry.java
index e50defcbf..046ef9972 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/SynchronizeWizardRegistry.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/SynchronizeWizardRegistry.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 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
@@ -21,11 +21,8 @@ public class SynchronizeWizardRegistry extends RegistryReader {
public static final String PT_SYNCHRONIZE_WIZARDS = "synchronizeWizards"; //$NON-NLS-1$
private static final String TAG_SYNCHRONIZE_WIZARD = "wizard"; //$NON-NLS-1$
- private Map wizards = new HashMap();
+ private Map<String, SynchronizeWizardDescription> wizards = new HashMap<>();
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.registry.RegistryReader#readElement(org.eclipse.core.runtime.IConfigurationElement)
- */
@Override
protected boolean readElement(IConfigurationElement element) {
if (element.getName().equals(TAG_SYNCHRONIZE_WIZARD)) {
@@ -43,7 +40,7 @@ public class SynchronizeWizardRegistry extends RegistryReader {
}
public SynchronizeWizardDescription[] getSynchronizeWizards() {
- return (SynchronizeWizardDescription[])wizards.values().toArray(new SynchronizeWizardDescription[wizards.size()]);
+ return wizards.values().toArray(new SynchronizeWizardDescription[wizards.size()]);
}
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/TeamDecoratorManager.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/TeamDecoratorManager.java
index fe2bb863f..b071b6f6c 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/TeamDecoratorManager.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/TeamDecoratorManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006 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
@@ -23,7 +23,7 @@ public class TeamDecoratorManager {
private static TeamDecoratorManager instance;
- Map descriptors;
+ Map<String, TeamDecoratorDescription> descriptors;
public static TeamDecoratorManager getInstance() {
if (instance == null)
@@ -33,12 +33,12 @@ public class TeamDecoratorManager {
public ITeamContentProviderDescriptor[] getDescriptors() {
lazyInitialize();
- return (ITeamContentProviderDescriptor[]) descriptors.values().toArray(new ITeamContentProviderDescriptor[descriptors.size()]);
+ return descriptors.values().toArray(new ITeamContentProviderDescriptor[descriptors.size()]);
}
public TeamDecoratorDescription getDecoratorDescription(String providerId) {
lazyInitialize();
- return (TeamDecoratorDescription)descriptors.get(providerId);
+ return descriptors.get(providerId);
}
protected void lazyInitialize() {
@@ -46,7 +46,7 @@ public class TeamDecoratorManager {
return;
IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(TeamUIPlugin.ID, PT_TEAM_DECORATORS);
IExtension[] extensions = point.getExtensions();
- descriptors = new HashMap(extensions.length * 2 + 1);
+ descriptors = new HashMap<>(extensions.length * 2 + 1);
for (int i = 0, imax = extensions.length; i < imax; i++) {
TeamDecoratorDescription desc = null;
try {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetModelProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetModelProvider.java
index 98e1181a5..ef8240ce9 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetModelProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetModelProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 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,7 +36,7 @@ public class ChangeSetModelProvider extends CompositeModelProvider {
// The id of the sub-provider
private final String subProvierId;
- private Map rootToProvider = new HashMap(); // Maps ISynchronizeModelElement -> AbstractSynchronizeModelProvider
+ private Map<ISynchronizeModelElement, ISynchronizeModelProvider> rootToProvider = new HashMap<>();
private ViewerSorter embeddedSorter;
@@ -44,9 +44,6 @@ public class ChangeSetModelProvider extends CompositeModelProvider {
private IChangeSetChangeListener changeSetListener = new IChangeSetChangeListener() {
- /* (non-Javadoc)
- * @see org.eclipse.team.core.subscribers.IChangeSetChangeListener#setAdded(org.eclipse.team.core.subscribers.ChangeSet)
- */
@Override
public void setAdded(final ChangeSet set) {
final SyncInfoTree syncInfoSet;
@@ -60,34 +57,22 @@ public class ChangeSetModelProvider extends CompositeModelProvider {
createChangeSetModelElement(set, syncInfoSet);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.subscribers.IChangeSetChangeListener#defaultSetChanged(org.eclipse.team.core.subscribers.ChangeSet, org.eclipse.team.core.subscribers.ChangeSet)
- */
@Override
public void defaultSetChanged(final ChangeSet previousDefault, final ChangeSet set) {
refreshLabel(previousDefault);
refreshLabel(set);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.subscribers.IChangeSetChangeListener#setRemoved(org.eclipse.team.core.subscribers.ChangeSet)
- */
@Override
public void setRemoved(final ChangeSet set) {
removeModelElementForSet(set);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.subscribers.IChangeSetChangeListener#nameChanged(org.eclipse.team.core.subscribers.ChangeSet)
- */
@Override
public void nameChanged(final ChangeSet set) {
refreshLabel(set);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.subscribers.IChangeSetChangeListener#resourcesChanged(org.eclipse.team.core.subscribers.ChangeSet, org.eclipse.core.resources.IResource[])
- */
@Override
public void resourcesChanged(ChangeSet set, IPath[] paths) {
// The sub-providers listen directly to the sets for changes
@@ -133,9 +118,6 @@ public class ChangeSetModelProvider extends CompositeModelProvider {
}
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.synchronize.AbstractSynchronizeModelProvider#handleChanges(org.eclipse.team.core.synchronize.ISyncInfoTreeChangeEvent, org.eclipse.core.runtime.IProgressMonitor)
- */
@Override
protected void handleChanges(ISyncInfoTreeChangeEvent event, IProgressMonitor monitor) {
boolean handled = false;
@@ -223,17 +205,11 @@ public class ChangeSetModelProvider extends CompositeModelProvider {
return new IDiffElement[0];
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.synchronize.ISynchronizeModelProvider#getDescriptor()
- */
@Override
public ISynchronizeModelProviderDescriptor getDescriptor() {
return descriptor;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.synchronize.ISynchronizeModelProvider#getViewerSorter()
- */
@Override
public ViewerSorter getViewerSorter() {
if (viewerSorter == null) {
@@ -250,9 +226,6 @@ public class ChangeSetModelProvider extends CompositeModelProvider {
firePropertyChange(ISynchronizeModelProvider.P_VIEWER_SORTER, null, null);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.synchronize.AbstractSynchronizeModelProvider#createActionGroup()
- */
@Override
protected SynchronizePageActionGroup createActionGroup() {
return new ChangeSetActionGroup(this);
@@ -266,12 +239,9 @@ public class ChangeSetModelProvider extends CompositeModelProvider {
}
private ISynchronizeModelProvider getProviderRootedAt(ISynchronizeModelElement parent) {
- return (ISynchronizeModelProvider)rootToProvider.get(parent);
+ return rootToProvider.get(parent);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.synchronize.CompositeModelProvider#removeProvider(org.eclipse.team.internal.ui.synchronize.AbstractSynchronizeModelProvider)
- */
@Override
protected void removeProvider(ISynchronizeModelProvider provider) {
rootToProvider.remove(provider.getModelRoot());
@@ -294,9 +264,6 @@ public class ChangeSetModelProvider extends CompositeModelProvider {
return embeddedSorter;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.synchronize.CompositeModelProvider#clearModelObjects(org.eclipse.team.ui.synchronize.ISynchronizeModelElement)
- */
@Override
protected void recursiveClearModelObjects(ISynchronizeModelElement node) {
super.recursiveClearModelObjects(node);
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/CompositeModelProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/CompositeModelProvider.java
index 0d8adfc09..a7a0904d8 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/CompositeModelProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/CompositeModelProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 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
@@ -26,9 +26,9 @@ import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
*/
public abstract class CompositeModelProvider extends AbstractSynchronizeModelProvider {
- private final List providers = new ArrayList();
- private final Map resourceToElements = new HashMap(); // Map IResource to List of ISynchronizeModelElement
- private final Map elementToProvider = new HashMap(); // Map ISynchronizeModelElement -> AbstractSynchronizeModelProvider
+ private final List<ISynchronizeModelProvider> providers = new ArrayList<>();
+ private final Map<IResource, List <ISynchronizeModelElement>> resourceToElements = new HashMap<>();
+ private final Map<ISynchronizeModelElement, AbstractSynchronizeModelProvider> elementToProvider = new HashMap<>();
protected CompositeModelProvider(ISynchronizePageConfiguration configuration, SyncInfoSet set) {
super(configuration, set);
@@ -51,17 +51,11 @@ public abstract class CompositeModelProvider extends AbstractSynchronizeModelPro
provider.dispose();
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.synchronize.AbstractSynchronizeModelProvider#getProvider(org.eclipse.team.ui.synchronize.ISynchronizeModelElement)
- */
@Override
protected ISynchronizeModelProvider getProvider(ISynchronizeModelElement element) {
- return (ISynchronizeModelProvider)elementToProvider.get(element);
+ return elementToProvider.get(element);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.synchronize.AbstractSynchronizeModelProvider#getClosestExistingParents(org.eclipse.core.resources.IResource)
- */
@Override
public ISynchronizeModelElement[] getClosestExistingParents(IResource resource) {
ISynchronizeModelProvider[] providers = getProviders();
@@ -71,7 +65,7 @@ public abstract class CompositeModelProvider extends AbstractSynchronizeModelPro
if (providers.length == 1 && providers[0] instanceof AbstractSynchronizeModelProvider) {
return ((AbstractSynchronizeModelProvider)providers[0]).getClosestExistingParents(resource);
}
- List result = new ArrayList();
+ List<ISynchronizeModelElement> result = new ArrayList<>();
for (int i = 0; i < providers.length; i++) {
ISynchronizeModelProvider provider = providers[i];
if (provider instanceof AbstractSynchronizeModelProvider) {
@@ -82,7 +76,7 @@ public abstract class CompositeModelProvider extends AbstractSynchronizeModelPro
}
}
}
- return (ISynchronizeModelElement[]) result.toArray(new ISynchronizeModelElement[result.size()]);
+ return result.toArray(new ISynchronizeModelElement[result.size()]);
}
/**
@@ -90,7 +84,7 @@ public abstract class CompositeModelProvider extends AbstractSynchronizeModelPro
* @return the sub-providers of this composite
*/
protected ISynchronizeModelProvider[] getProviders() {
- return (ISynchronizeModelProvider[]) providers.toArray(new ISynchronizeModelProvider[providers.size()]);
+ return providers.toArray(new ISynchronizeModelProvider[providers.size()]);
}
/**
@@ -99,21 +93,18 @@ public abstract class CompositeModelProvider extends AbstractSynchronizeModelPro
* @return the providers displaying the resource
*/
protected ISynchronizeModelProvider[] getProvidersContaining(IResource resource) {
- List elements = (List)resourceToElements.get(resource);
+ List<ISynchronizeModelElement> elements = resourceToElements.get(resource);
if (elements == null || elements.isEmpty()) {
return new ISynchronizeModelProvider[0];
}
- List result = new ArrayList();
- for (Iterator iter = elements.iterator(); iter.hasNext();) {
- ISynchronizeModelElement element = (ISynchronizeModelElement)iter.next();
+ List<ISynchronizeModelProvider> result = new ArrayList<>();
+ for (Iterator<ISynchronizeModelElement> iter = elements.iterator(); iter.hasNext();) {
+ ISynchronizeModelElement element = iter.next();
result.add(getProvider(element));
}
- return (ISynchronizeModelProvider[]) result.toArray(new ISynchronizeModelProvider[result.size()]);
+ return result.toArray(new ISynchronizeModelProvider[result.size()]);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.synchronize.AbstractSynchronizeModelProvider#handleResourceAdditions(org.eclipse.team.core.synchronize.ISyncInfoTreeChangeEvent)
- */
@Override
protected final void handleResourceAdditions(ISyncInfoTreeChangeEvent event) {
handleAdditions(event.getAddedResources());
@@ -196,17 +187,14 @@ public abstract class CompositeModelProvider extends AbstractSynchronizeModelPro
}
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.synchronize.AbstractSynchronizeModelProvider#nodeAdded(org.eclipse.team.ui.synchronize.ISynchronizeModelElement)
- */
@Override
protected void nodeAdded(ISynchronizeModelElement node, AbstractSynchronizeModelProvider provider) {
// Update the resource-to-element map and the element-to-provider map
IResource r = node.getResource();
if(r != null) {
- List elements = (List)resourceToElements.get(r);
+ List<ISynchronizeModelElement> elements = resourceToElements.get(r);
if(elements == null) {
- elements = new ArrayList(2);
+ elements = new ArrayList<>(2);
resourceToElements.put(r, elements);
}
elements.add(node);
@@ -215,15 +203,12 @@ public abstract class CompositeModelProvider extends AbstractSynchronizeModelPro
super.nodeAdded(node, provider);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.synchronize.AbstractSynchronizeModelProvider#modelObjectCleared(org.eclipse.team.ui.synchronize.ISynchronizeModelElement)
- */
@Override
public void modelObjectCleared(ISynchronizeModelElement node) {
super.modelObjectCleared(node);
IResource r = node.getResource();
if(r != null) {
- List elements = (List)resourceToElements.get(r);
+ List elements = resourceToElements.get(r);
if(elements != null) {
elements.remove(node);
if (elements.isEmpty()) {
@@ -234,9 +219,6 @@ public abstract class CompositeModelProvider extends AbstractSynchronizeModelPro
elementToProvider.remove(node);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.synchronize.AbstractSynchronizeModelProvider#clearModelObjects(org.eclipse.team.ui.synchronize.ISynchronizeModelElement)
- */
@Override
protected void recursiveClearModelObjects(ISynchronizeModelElement node) {
super.recursiveClearModelObjects(node);
@@ -271,32 +253,23 @@ public abstract class CompositeModelProvider extends AbstractSynchronizeModelPro
}
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.synchronize.AbstractSynchronizeModelProvider#dispose()
- */
@Override
public void dispose() {
clearProviders();
super.dispose();
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.synchronize.AbstractSynchronizeModelProvider#hasViewerState()
- */
@Override
protected boolean hasViewerState() {
return resourceToElements != null && !resourceToElements.isEmpty();
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.synchronize.AbstractSynchronizeModelProvider#getModelObjects(org.eclipse.core.resources.IResource)
- */
@Override
protected ISynchronizeModelElement[] getModelObjects(IResource resource) {
- List elements = (List)resourceToElements.get(resource);
+ List<ISynchronizeModelElement> elements = resourceToElements.get(resource);
if (elements == null) {
return new ISynchronizeModelElement[0];
}
- return (ISynchronizeModelElement[]) elements.toArray(new ISynchronizeModelElement[elements.size()]);
+ return elements.toArray(new ISynchronizeModelElement[elements.size()]);
}
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/DialogSynchronizePageSite.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/DialogSynchronizePageSite.java
index 7d1eacec4..865626d3a 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/DialogSynchronizePageSite.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/DialogSynchronizePageSite.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006 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
@@ -34,7 +34,7 @@ public class DialogSynchronizePageSite implements ISynchronizePageSite {
private final boolean isModal;
// Keybindings enabled in the dialog, these should be removed
// when the dialog is closed.
- private List actionHandlers = new ArrayList(2);
+ private List<HandlerSubmission> actionHandlers = new ArrayList<>(2);
/**
* Create a site for use in a dialog
@@ -45,71 +45,51 @@ public class DialogSynchronizePageSite implements ISynchronizePageSite {
this.shell = shell;
this.isModal = isModal;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizePageSite#getSelectionProvider()
- */
+
@Override
public ISelectionProvider getSelectionProvider() {
return selectionProvider;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizePageSite#getShell()
- */
+
@Override
public Shell getShell() {
return shell;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizePageSite#setSelectionProvider(org.eclipse.jface.viewers.ISelectionProvider)
- */
+
@Override
public void setSelectionProvider(ISelectionProvider provider) {
selectionProvider = provider;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizePageSite#getWorkbenchSite()
- */
+
@Override
public IWorkbenchSite getWorkbenchSite() {
return null;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizePageSite#getPart()
- */
+
@Override
public IWorkbenchPart getPart() {
return null;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizePageSite#getKeyBindingService()
- */
+
@Override
public IKeyBindingService getKeyBindingService() {
return null;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizePageSite#setFocus()
- */
+
@Override
public void setFocus() {
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizePageSite#getPageSettings()
- */
+
@Override
public IDialogSettings getPageSettings() {
return null;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizePageSite#getActionBars()
- */
+
@Override
public IActionBars getActionBars() {
return actionBars;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizePageSite#isModal()
- */
+
@Override
public boolean isModal() {
return isModal;
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/GlobalRefreshElementSelectionPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/GlobalRefreshElementSelectionPage.java
index a6171f5c2..62735946f 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/GlobalRefreshElementSelectionPage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/GlobalRefreshElementSelectionPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 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
@@ -64,9 +64,6 @@ public abstract class GlobalRefreshElementSelectionPage extends WizardPage {
}
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
- */
@Override
public void createControl(Composite parent2) {
Composite top = new Composite(parent2, SWT.NULL);
@@ -252,7 +249,7 @@ public abstract class GlobalRefreshElementSelectionPage extends WizardPage {
updateParticipantScope();
} else {
StringTokenizer st = new StringTokenizer(working_sets, " ,"); //$NON-NLS-1$
- ArrayList ws = new ArrayList();
+ ArrayList<IWorkingSet> ws = new ArrayList<>();
while (st.hasMoreTokens()) {
String workingSetName = st.nextToken();
if (workingSetName != null && workingSetName.equals("") == false) { //$NON-NLS-1$
@@ -264,7 +261,7 @@ public abstract class GlobalRefreshElementSelectionPage extends WizardPage {
}
}
if(! ws.isEmpty()) {
- this.workingSets = (IWorkingSet[]) ws.toArray(new IWorkingSet[ws.size()]);
+ this.workingSets = ws.toArray(new IWorkingSet[ws.size()]);
updateWorkingSetScope();
updateWorkingSetLabel();
participantScope.setSelection(false);
@@ -274,9 +271,6 @@ public abstract class GlobalRefreshElementSelectionPage extends WizardPage {
}
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.IDialogPage#dispose()
- */
@Override
public void dispose() {
if(workingSets != null && isWorkingSetSelected()) {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/GlobalRefreshResourceSelectionPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/GlobalRefreshResourceSelectionPage.java
index 7e4dac06a..aa00e6637 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/GlobalRefreshResourceSelectionPage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/GlobalRefreshResourceSelectionPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 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
@@ -100,13 +100,7 @@ public class GlobalRefreshResourceSelectionPage extends GlobalRefreshElementSele
fViewer.getControl().setLayoutData(data);
fViewer.setContentProvider(new MyContentProvider());
fViewer.setLabelProvider(new DecoratingLabelProvider(new MyLabelProvider(), PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator()));
- fViewer.addCheckStateListener(new ICheckStateListener() {
-
- @Override
- public void checkStateChanged(CheckStateChangedEvent event) {
- updateOKStatus();
- }
- });
+ fViewer.addCheckStateListener(event -> updateOKStatus());
fViewer.setComparator(new ResourceComparator(ResourceComparator.NAME));
fViewer.setInput(resources);
return fViewer;
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/HierarchicalModelProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/HierarchicalModelProvider.java
index 920df5f6a..31397d604 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/HierarchicalModelProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/HierarchicalModelProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 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
@@ -15,8 +15,7 @@ import java.util.HashSet;
import java.util.Iterator;
import org.eclipse.compare.structuremergeviewer.IDiffElement;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.resources.*;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.ViewerSorter;
import org.eclipse.team.core.synchronize.*;
@@ -81,9 +80,6 @@ public class HierarchicalModelProvider extends SynchronizeModelProvider {
super(parentProvider, modelRoot, configuration, set);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.synchronize.ISynchronizeModelProvider#getDescriptor()
- */
@Override
public ISynchronizeModelProviderDescriptor getDescriptor() {
return hierarchicalDescriptor;
@@ -172,9 +168,6 @@ public class HierarchicalModelProvider extends SynchronizeModelProvider {
}
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.viewers.SynchronizeModelProvider#buildModelObjects(org.eclipse.team.ui.synchronize.viewers.SynchronizeModelElement)
- */
@Override
protected IDiffElement[] buildModelObjects(ISynchronizeModelElement node) {
IDiffElement[] children = createModelObjects(node);
@@ -187,13 +180,10 @@ public class HierarchicalModelProvider extends SynchronizeModelProvider {
return children;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.viewers.SynchronizeModelProvider#handleResourceAdditions(org.eclipse.team.core.synchronize.ISyncInfoTreeChangeEvent)
- */
@Override
protected void handleResourceAdditions(ISyncInfoTreeChangeEvent event) {
SyncInfo[] infos = event.getAddedResources();
- HashSet set = new HashSet();
+ HashSet<IProject> set = new HashSet<>();
for (int i = 0; i < infos.length; i++) {
SyncInfo info = infos[i];
set.add(info.getLocal().getProject());
@@ -203,9 +193,6 @@ public class HierarchicalModelProvider extends SynchronizeModelProvider {
}
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.viewers.SynchronizeModelProvider#handleResourceRemovals(org.eclipse.team.core.synchronize.ISyncInfoTreeChangeEvent)
- */
@Override
protected void handleResourceRemovals(ISyncInfoTreeChangeEvent event) {
// Remove the removed subtrees
@@ -225,17 +212,11 @@ public class HierarchicalModelProvider extends SynchronizeModelProvider {
}
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.synchronize.SynchronizeModelProvider#createModelObject(org.eclipse.team.ui.synchronize.ISynchronizeModelElement, org.eclipse.team.core.synchronize.SyncInfo)
- */
@Override
protected ISynchronizeModelElement createModelObject(ISynchronizeModelElement parent, SyncInfo info) {
return createModelObject(parent, info.getLocal());
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.synchronize.SynchronizeModelProvider#addResource(org.eclipse.team.core.synchronize.SyncInfo)
- */
@Override
protected void addResource(SyncInfo info) {
addResource(info.getLocal());
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshModelParticipantJob.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshModelParticipantJob.java
index 68405e46a..710351932 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshModelParticipantJob.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshModelParticipantJob.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2009 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
@@ -31,7 +31,7 @@ public class RefreshModelParticipantJob extends RefreshParticipantJob {
private int groupTicks;
public class ChangeDescription implements IChangeDescription, IDiffChangeListener {
- Map changes = new HashMap();
+ Map<IPath, IDiff> changes = new HashMap<>();
@Override
public int getChangeCount() {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshParticipantJob.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshParticipantJob.java
index f877089cf..5ecd8147d 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshParticipantJob.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshParticipantJob.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 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
@@ -19,8 +19,6 @@ import org.eclipse.core.runtime.*;
import org.eclipse.core.runtime.jobs.*;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.osgi.util.NLS;
import org.eclipse.team.core.subscribers.Subscriber;
import org.eclipse.team.internal.ui.*;
@@ -78,7 +76,7 @@ public abstract class RefreshParticipantJob extends Job {
/**
* Refresh started/completed listener for every refresh
*/
- private static List listeners = new ArrayList(1);
+ private static List<IRefreshSubscriberListener> listeners = new ArrayList<>(1);
private static final int STARTED = 1;
private static final int DONE = 2;
@@ -143,13 +141,10 @@ public abstract class RefreshParticipantJob extends Job {
this.gotoAction = gotoAction;
setEnabled(isEnabled());
setToolTipText(getToolTipText());
- gotoAction.addPropertyChangeListener(new IPropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent event) {
- if(event.getProperty().equals(IAction.ENABLED)) {
- Boolean bool = (Boolean) event.getNewValue();
- GotoActionWrapper.this.setEnabled(bool.booleanValue());
- }
+ gotoAction.addPropertyChangeListener(event -> {
+ if(event.getProperty().equals(IAction.ENABLED)) {
+ Boolean bool = (Boolean) event.getNewValue();
+ GotoActionWrapper.this.setEnabled(bool.booleanValue());
}
});
}
@@ -565,7 +560,7 @@ public abstract class RefreshParticipantJob extends Job {
// Get a snapshot of the listeners so the list doesn't change while we're firing
IRefreshSubscriberListener[] listenerArray;
synchronized (listeners) {
- listenerArray = (IRefreshSubscriberListener[]) listeners.toArray(new IRefreshSubscriberListener[listeners.size()]);
+ listenerArray = listeners.toArray(new IRefreshSubscriberListener[listeners.size()]);
}
// Notify each listener in a safe manner (i.e. so their exceptions don't kill us)
for (int i = 0; i < listenerArray.length; i++) {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshUserNotificationPolicy.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshUserNotificationPolicy.java
index 8cb7366a7..5ba005fa7 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshUserNotificationPolicy.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshUserNotificationPolicy.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * Copyright (c) 2003, 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,29 +36,18 @@ public class RefreshUserNotificationPolicy implements IRefreshSubscriberListener
this.participant = participant;
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.team.internal.ui.jobs.IRefreshSubscriberListener#refreshStarted(org.eclipse.team.internal.ui.jobs.IRefreshEvent)
- */
@Override
public void refreshStarted(final IRefreshEvent event) {
- TeamUIPlugin.getStandardDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- if (event.getRefreshType() == IRefreshEvent.USER_REFRESH && event.getParticipant() == participant) {
- ISynchronizeView view = TeamUI.getSynchronizeManager().showSynchronizeViewInActivePage();
- if (view != null) {
- view.display(participant);
- }
+ TeamUIPlugin.getStandardDisplay().asyncExec(() -> {
+ if (event.getRefreshType() == IRefreshEvent.USER_REFRESH && event.getParticipant() == participant) {
+ ISynchronizeView view = TeamUI.getSynchronizeManager().showSynchronizeViewInActivePage();
+ if (view != null) {
+ view.display(participant);
}
}
});
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.team.internal.ui.jobs.IRefreshSubscriberListener#refreshDone(org.eclipse.team.internal.ui.jobs.IRefreshEvent)
- */
@Override
public ActionFactory.IWorkbenchAction refreshDone(final IRefreshEvent event) {
// Ensure that this event was generated for this participant
@@ -101,15 +90,12 @@ public class RefreshUserNotificationPolicy implements IRefreshSubscriberListener
}
private void notifyIfNeededModal(final IRefreshEvent event) {
- TeamUIPlugin.getStandardDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- String title = (event.getRefreshType() == IRefreshEvent.SCHEDULED_REFRESH ?
- NLS.bind(TeamUIMessages.RefreshCompleteDialog_4a, new String[] { Utils.getTypeName(participant) }) :
- NLS.bind(TeamUIMessages.RefreshCompleteDialog_4, new String[] { Utils.getTypeName(participant) })
- );
- MessageDialog.openInformation(Utils.getShell(null), title, event.getStatus().getMessage());
- }
+ TeamUIPlugin.getStandardDisplay().asyncExec(() -> {
+ String title = (event.getRefreshType() == IRefreshEvent.SCHEDULED_REFRESH
+ ? NLS.bind(TeamUIMessages.RefreshCompleteDialog_4a, new String[] { Utils.getTypeName(participant) })
+ : NLS.bind(TeamUIMessages.RefreshCompleteDialog_4,
+ new String[] { Utils.getTypeName(participant) }));
+ MessageDialog.openInformation(Utils.getShell(null), title, event.getStatus().getMessage());
});
}
@@ -117,12 +103,12 @@ public class RefreshUserNotificationPolicy implements IRefreshSubscriberListener
if (participant instanceof SubscriberParticipant) {
SubscriberParticipant sp = (SubscriberParticipant) participant;
SyncInfo[] infos = ((RefreshChangeListener)event.getChangeDescription()).getChanges();
- List selectedResources = new ArrayList();
+ List<IResource> selectedResources = new ArrayList<>();
selectedResources.addAll(Arrays.asList(((RefreshChangeListener)event.getChangeDescription()).getResources()));
for (int i = 0; i < infos.length; i++) {
selectedResources.add(infos[i].getLocal());
}
- IResource[] resources = (IResource[]) selectedResources.toArray(new IResource[selectedResources.size()]);
+ IResource[] resources = selectedResources.toArray(new IResource[selectedResources.size()]);
// If it's a file, simply show the compare editor
if (resources.length == 1 && resources[0].getType() == IResource.FILE) {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelElementLabelProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelElementLabelProvider.java
index e595105bd..7b30e118d 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelElementLabelProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelElementLabelProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 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
@@ -35,7 +35,7 @@ import org.eclipse.ui.model.WorkbenchLabelProvider;
public class SynchronizeModelElementLabelProvider extends LabelProvider implements IColorProvider, IFontProvider {
// Cache for folder images that have been overlayed with conflict icon
- private Map fgImageCache;
+ private Map<ImageDescriptor, Image> fgImageCache;
// Contains direction images
CompareConfiguration compareConfig = new CompareConfiguration();
@@ -50,27 +50,16 @@ public class SynchronizeModelElementLabelProvider extends LabelProvider implemen
public SynchronizeModelElementLabelProvider() {
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.viewers.IColorProvider#getForeground(java.lang.Object)
- */
@Override
public Color getForeground(Object element) {
return null;
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.viewers.IColorProvider#getBackground(java.lang.Object)
- */
@Override
public Color getBackground(Object element) {
return null;
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IFontProvider#getFont(java.lang.Object)
- */
@Override
public Font getFont(Object element) {
if (element instanceof ISynchronizeModelElement) {
@@ -90,10 +79,6 @@ public class SynchronizeModelElementLabelProvider extends LabelProvider implemen
return null;
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.viewers.LabelProvider#getImage(java.lang.Object)
- */
@Override
public Image getImage(Object element) {
Image base = workbenchLabelProvider.getImage(element);
@@ -112,10 +97,6 @@ public class SynchronizeModelElementLabelProvider extends LabelProvider implemen
return base;
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
- */
@Override
public String getText(Object element) {
String base = workbenchLabelProvider.getText(element);
@@ -175,9 +156,9 @@ public class SynchronizeModelElementLabelProvider extends LabelProvider implemen
if (hasOverlay) {
ImageDescriptor overlay = new DecorationOverlayIcon(base, overlayImages, new Point(base.getBounds().width, base.getBounds().height));
if (fgImageCache == null) {
- fgImageCache = new HashMap(10);
+ fgImageCache = new HashMap<>(10);
}
- Image conflictDecoratedImage = (Image) fgImageCache.get(overlay);
+ Image conflictDecoratedImage = fgImageCache.get(overlay);
if (conflictDecoratedImage == null) {
conflictDecoratedImage = overlay.createImage();
fgImageCache.put(overlay, conflictDecoratedImage);
@@ -212,10 +193,6 @@ public class SynchronizeModelElementLabelProvider extends LabelProvider implemen
return node.getProperty(ISynchronizeModelElement.PROPAGATED_WARNING_MARKER_PROPERTY);
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
- */
@Override
public void dispose() {
workbenchLabelProvider.dispose();
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizePageConfiguration.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizePageConfiguration.java
index 0cc1ce5a9..bc2d8b810 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizePageConfiguration.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizePageConfiguration.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 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,9 +113,9 @@ public class SynchronizePageConfiguration extends SynchronizePageActionGroup imp
private ISynchronizeParticipant participant;
private ISynchronizePageSite site;
- private ListenerList propertyChangeListeners = new ListenerList(ListenerList.IDENTITY);
- private ListenerList actionContributions = new ListenerList(ListenerList.IDENTITY);
- private Map properties = new HashMap();
+ private ListenerList<IPropertyChangeListener> propertyChangeListeners = new ListenerList<>(ListenerList.IDENTITY);
+ private ListenerList<SynchronizePageActionGroup> actionContributions = new ListenerList<>(ListenerList.IDENTITY);
+ private Map<String, Object> properties = new HashMap<>();
private int actionState = UNINITIALIZED;
private ISynchronizePage page;
private IRunnableContext context;
@@ -132,17 +132,11 @@ public class SynchronizePageConfiguration extends SynchronizePageActionGroup imp
setProperty(P_COMPARISON_TYPE, THREE_WAY);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration#getParticipant()
- */
@Override
public ISynchronizeParticipant getParticipant() {
return participant;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration#getSite()
- */
@Override
public ISynchronizePageSite getSite() {
return site;
@@ -157,9 +151,6 @@ public class SynchronizePageConfiguration extends SynchronizePageActionGroup imp
this.site = site;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration#addPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener)
- */
@Override
public void addPropertyChangeListener(IPropertyChangeListener listener) {
synchronized(propertyChangeListeners) {
@@ -167,9 +158,6 @@ public class SynchronizePageConfiguration extends SynchronizePageActionGroup imp
}
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration#removePropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener)
- */
@Override
public void removePropertyChangeListener(IPropertyChangeListener listener) {
synchronized(propertyChangeListeners) {
@@ -177,9 +165,6 @@ public class SynchronizePageConfiguration extends SynchronizePageActionGroup imp
}
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration#setProperty(java.lang.String, java.lang.Object)
- */
@Override
public void setProperty(String key, Object newValue) {
Object oldValue = properties.get(key);
@@ -190,17 +175,11 @@ public class SynchronizePageConfiguration extends SynchronizePageActionGroup imp
}
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration#getProperty(java.lang.String)
- */
@Override
public Object getProperty(String key) {
return properties.get(key);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration#addActionContribution(org.eclipse.team.ui.synchronize.IActionContribution)
- */
@Override
public void addActionContribution(SynchronizePageActionGroup contribution) {
int currentActionState;
@@ -224,9 +203,6 @@ public class SynchronizePageConfiguration extends SynchronizePageActionGroup imp
}
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration#removeActionContribution(org.eclipse.team.ui.synchronize.IActionContribution)
- */
@Override
public void removeActionContribution(SynchronizePageActionGroup contribution) {
synchronized(actionContributions) {
@@ -255,9 +231,6 @@ public class SynchronizePageConfiguration extends SynchronizePageActionGroup imp
}
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.IActionContribution#initialize(org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration)
- */
@Override
public void initialize(final ISynchronizePageConfiguration configuration) {
super.initialize(configuration);
@@ -286,9 +259,6 @@ public class SynchronizePageConfiguration extends SynchronizePageActionGroup imp
}
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.actions.ActionGroup#setContext(org.eclipse.ui.actions.ActionContext)
- */
@Override
public void setContext(final ActionContext context) {
super.setContext(context);
@@ -365,9 +335,6 @@ public class SynchronizePageConfiguration extends SynchronizePageActionGroup imp
}
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.actions.ActionGroup#updateActionBars()
- */
@Override
public void updateActionBars() {
final Object[] listeners;
@@ -389,9 +356,6 @@ public class SynchronizePageConfiguration extends SynchronizePageActionGroup imp
}
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.SynchronizePageActionGroup#modelChanged(org.eclipse.team.ui.synchronize.ISynchronizeModelElement)
- */
@Override
public void modelChanged(final ISynchronizeModelElement root) {
final Object[] listeners;
@@ -413,9 +377,6 @@ public class SynchronizePageConfiguration extends SynchronizePageActionGroup imp
}
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.IActionContribution#dispose()
- */
@Override
public void dispose() {
super.dispose();
@@ -439,17 +400,11 @@ public class SynchronizePageConfiguration extends SynchronizePageActionGroup imp
}
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration#setMenu(java.lang.String, java.lang.String[])
- */
@Override
public void setMenuGroups(String menuPropertyId, String[] groups) {
setProperty(menuPropertyId, groups);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration#appendMenu(java.lang.String, java.lang.String)
- */
@Override
public void addMenuGroup(String menuPropertyId, String groupId) {
String[] menuGroups = (String[])getProperty(menuPropertyId);
@@ -462,9 +417,6 @@ public class SynchronizePageConfiguration extends SynchronizePageActionGroup imp
setProperty(menuPropertyId, newGroups);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration#hasMenuGroup(java.lang.String, java.lang.String)
- */
@Override
public boolean hasMenuGroup(String menuPropertyId, String groupId) {
String[] groups = (String[])getProperty(menuPropertyId);
@@ -490,9 +442,6 @@ public class SynchronizePageConfiguration extends SynchronizePageActionGroup imp
}
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration#addLabelDecorator(org.eclipse.jface.viewers.ILabelDecorator)
- */
@Override
public void addLabelDecorator(ILabelDecorator decorator) {
ILabelDecorator[] decorators = (ILabelDecorator[])getProperty(P_LABEL_DECORATORS);
@@ -525,9 +474,6 @@ public class SynchronizePageConfiguration extends SynchronizePageActionGroup imp
return id + "." + group; //$NON-NLS-1$
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.subscribers.ISubscriberPageConfiguration#getMode()
- */
@Override
public int getMode() {
Object o = getProperty(P_MODE);
@@ -537,9 +483,6 @@ public class SynchronizePageConfiguration extends SynchronizePageActionGroup imp
return 0;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.subscribers.ISubscriberPageConfiguration#setMode(int)
- */
@Override
public void setMode(int mode) {
if (isModeSupported(mode))
@@ -559,9 +502,6 @@ public class SynchronizePageConfiguration extends SynchronizePageActionGroup imp
return 0;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.subscribers.ISubscriberPageConfiguration#setSupportedModes(int)
- */
@Override
public void setSupportedModes(int modes) {
setProperty(P_SUPPORTED_MODES, new Integer(modes));
@@ -600,9 +540,6 @@ public class SynchronizePageConfiguration extends SynchronizePageActionGroup imp
setProperty(P_VIEWER_STYLE, new Integer(style));
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration#getSyncInfoSet()
- */
@Override
public SyncInfoSet getSyncInfoSet() {
Object o = getProperty(P_SYNC_INFO_SET);
@@ -612,33 +549,21 @@ public class SynchronizePageConfiguration extends SynchronizePageActionGroup imp
return null;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration#getComparisonType()
- */
@Override
public String getComparisonType() {
return (String)getProperty(P_COMPARISON_TYPE);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration#setComparisonType(java.lang.String)
- */
@Override
public void setComparisonType(String type) {
setProperty(P_COMPARISON_TYPE,type);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration#setRunnableContext(org.eclipse.jface.operation.IRunnableContext)
- */
@Override
public void setRunnableContext(IRunnableContext context) {
this.context = context;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration#getRunnableContext()
- */
@Override
public IRunnableContext getRunnableContext() {
return context;
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/CopyToClipboardAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/CopyToClipboardAction.java
index 2b7b71ac3..50f0d83a1 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/CopyToClipboardAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/CopyToClipboardAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 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
@@ -134,8 +134,8 @@ class CopyToClipboardAction extends SelectionListenerAction {
return navigatorContentService;
}
- private void copyResources(List selectedResources, String text) {
- IResource[] resources = (IResource[]) selectedResources.toArray(new IResource[selectedResources.size()]);
+ private void copyResources(List<? extends IResource> selectedResources, String text) {
+ IResource[] resources = selectedResources.toArray(new IResource[selectedResources.size()]);
// Get the file names and a string representation
final int length = resources.length;
int actualLength = 0;
@@ -167,7 +167,7 @@ class CopyToClipboardAction extends SelectionListenerAction {
try {
// set the clipboard contents
List data = new ArrayList();
- List dataTypes = new ArrayList();
+ List<Transfer> dataTypes = new ArrayList<>();
if (resources.length > 0) {
data.add(resources);
dataTypes.add(ResourceTransfer.getInstance());
@@ -183,7 +183,7 @@ class CopyToClipboardAction extends SelectionListenerAction {
if (!data.isEmpty())
fClipboard.setContents(
data.toArray(),
- (Transfer[]) dataTypes.toArray(new Transfer[dataTypes.size()]));
+ dataTypes.toArray(new Transfer[dataTypes.size()]));
} catch (SWTError e) {
if (e.code != DND.ERROR_CANNOT_SET_CLIPBOARD)
throw e;
@@ -230,12 +230,12 @@ class CopyToClipboardAction extends SelectionListenerAction {
}
@Override
- protected List getSelectedNonResources() {
+ protected List<?> getSelectedNonResources() {
return Arrays.asList(Utils.getNonResources(getStructuredSelection().toArray()));
}
@Override
- protected List getSelectedResources() {
+ protected List<? extends IResource> getSelectedResources() {
// Calling our own selection utility because the elements in the
// synchronize view can't adapt to IResource because we don't want the usual object
// contribution/ on them.
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenFileInSystemEditorAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenFileInSystemEditorAction.java
index db1272bd6..d190dccb9 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenFileInSystemEditorAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenFileInSystemEditorAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 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
@@ -26,21 +26,15 @@ public class OpenFileInSystemEditorAction extends OpenFileAction {
super(page);
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.actions.SelectionListenerAction#getSelectedResources()
- */
@Override
- protected List getSelectedResources() {
+ protected List<? extends IResource> getSelectedResources() {
IStructuredSelection selection = getStructuredSelection();
IResource[] resources = Utils.getResources(selection.toArray());
return Arrays.asList(resources);
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.actions.SelectionListenerAction#getSelectedNonResources()
- */
@Override
- protected List getSelectedNonResources() {
+ protected List<?> getSelectedNonResources() {
return Collections.EMPTY_LIST;
}
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RemoveSynchronizeParticipantAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RemoveSynchronizeParticipantAction.java
index 921411bae..1bfc684c4 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RemoveSynchronizeParticipantAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RemoveSynchronizeParticipantAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 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
@@ -54,14 +54,11 @@ public class RemoveSynchronizeParticipantAction extends Action {
@Override
public void run() {
try {
- PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress() {
- @Override
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- if (removeAll) {
- removeAll();
- } else {
- removeCurrent();
- }
+ PlatformUI.getWorkbench().getProgressService().busyCursorWhile(monitor -> {
+ if (removeAll) {
+ removeAll();
+ } else {
+ removeCurrent();
}
});
} catch (InvocationTargetException e) {
@@ -77,19 +74,16 @@ public class RemoveSynchronizeParticipantAction extends Action {
final List dirtyModels = getDirtyModels(new ISynchronizeParticipant[] { participant });
if (participant.isPinned() || !dirtyModels.isEmpty()) {
final boolean[] keepGoing = new boolean[] { false };
- Display.getDefault().syncExec(new Runnable() {
- @Override
- public void run() {
- if (!dirtyModels.isEmpty()) {
- keepGoing[0] = promptToSave(dirtyModels);
- } else {
- keepGoing[0] = MessageDialog.openQuestion(
- view.getSite().getShell(),
- TeamUIMessages.RemoveSynchronizeParticipantAction_0,
- TeamUIMessages.RemoveSynchronizeParticipantAction_1);
- }
-
+ Display.getDefault().syncExec(() -> {
+ if (!dirtyModels.isEmpty()) {
+ keepGoing[0] = promptToSave(dirtyModels);
+ } else {
+ keepGoing[0] = MessageDialog.openQuestion(
+ view.getSite().getShell(),
+ TeamUIMessages.RemoveSynchronizeParticipantAction_0,
+ TeamUIMessages.RemoveSynchronizeParticipantAction_1);
}
+
});
if (!keepGoing[0]) {
return;
@@ -102,7 +96,7 @@ public class RemoveSynchronizeParticipantAction extends Action {
private void removeAll() {
ISynchronizeManager manager = TeamUI.getSynchronizeManager();
ISynchronizeParticipantReference[] refs = manager.getSynchronizeParticipants();
- ArrayList removals = new ArrayList();
+ ArrayList<ISynchronizeParticipant> removals = new ArrayList<>();
for (int i = 0; i < refs.length; i++) {
ISynchronizeParticipantReference reference = refs[i];
ISynchronizeParticipant p;
@@ -114,16 +108,13 @@ public class RemoveSynchronizeParticipantAction extends Action {
// keep going
}
}
- ISynchronizeParticipant[] toRemove = (ISynchronizeParticipant[]) removals.toArray(new ISynchronizeParticipant[removals.size()]);
+ ISynchronizeParticipant[] toRemove = removals.toArray(new ISynchronizeParticipant[removals.size()]);
final List dirtyModels = getDirtyModels(toRemove);
if (!dirtyModels.isEmpty()) {
final boolean[] keepGoing = new boolean[] { false };
- Display.getDefault().syncExec(new Runnable() {
- @Override
- public void run() {
- if (!dirtyModels.isEmpty()) {
- keepGoing[0] = promptToSave(dirtyModels);
- }
+ Display.getDefault().syncExec(() -> {
+ if (!dirtyModels.isEmpty()) {
+ keepGoing[0] = promptToSave(dirtyModels);
}
});
if (!keepGoing[0]) {
@@ -179,24 +170,21 @@ public class RemoveSynchronizeParticipantAction extends Action {
// Create save block.
final List finalModels = dirtyModels;
- IRunnableWithProgress progressOp = new IRunnableWithProgress() {
- @Override
- public void run(IProgressMonitor monitor) {
- monitor.beginTask(null, finalModels.size());
- for (Iterator i = finalModels.iterator(); i.hasNext();) {
- Saveable model = (Saveable) i.next();
- if (model.isDirty()) {
- try {
- model.doSave(new SubProgressMonitor(monitor, 1));
- } catch (CoreException e) {
- ErrorDialog.openError(view.getSite().getShell(), null, e.getMessage(), e.getStatus());
- }
+ IRunnableWithProgress progressOp = monitor -> {
+ monitor.beginTask(null, finalModels.size());
+ for (Iterator i = finalModels.iterator(); i.hasNext();) {
+ Saveable model = (Saveable) i.next();
+ if (model.isDirty()) {
+ try {
+ model.doSave(new SubProgressMonitor(monitor, 1));
+ } catch (CoreException e) {
+ ErrorDialog.openError(view.getSite().getShell(), null, e.getMessage(), e.getStatus());
}
- if (monitor.isCanceled())
- break;
}
- monitor.done();
+ if (monitor.isCanceled())
+ break;
}
+ monitor.done();
};
try {
PlatformUI.getWorkbench().getProgressService().run(true, true, progressOp);
@@ -210,8 +198,8 @@ public class RemoveSynchronizeParticipantAction extends Action {
return true;
}
- private List getDirtyModels(ISynchronizeParticipant[] participants) {
- List result = new ArrayList();
+ private List<Saveable> getDirtyModels(ISynchronizeParticipant[] participants) {
+ List<Saveable> result = new ArrayList<>();
for (int i = 0; i < participants.length; i++) {
ISynchronizeParticipant participant = participants[i];
if (participant instanceof ModelSynchronizeParticipant) {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/ApplyPatchSubscriber.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/ApplyPatchSubscriber.java
index 02b5c3200..cb9d35389 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/ApplyPatchSubscriber.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/ApplyPatchSubscriber.java
@@ -153,7 +153,7 @@ public class ApplyPatchSubscriber extends Subscriber {
@Override
public void refresh(IResource[] resources, int depth,
IProgressMonitor monitor) throws TeamException {
- Set /* <FilePatch> */diffs = new HashSet();
+ Set<FilePatch2> diffs = new HashSet<>();
for (int i = 0; i < resources.length; i++) {
Object object = PatchModelProvider.getPatchObject(resources[i],
getPatcher());
@@ -162,7 +162,7 @@ public class ApplyPatchSubscriber extends Subscriber {
diffs.add(filePatch);
}
}
- getPatcher().refresh((FilePatch2[]) diffs.toArray(new FilePatch2[0]));
+ getPatcher().refresh(diffs.toArray(new FilePatch2[0]));
}
@Override
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/PatchWorkspace.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/PatchWorkspace.java
index a172d7f89..8d52430c8 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/PatchWorkspace.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/PatchWorkspace.java
@@ -71,16 +71,16 @@ public class PatchWorkspace extends DiffNode implements IAdaptable {
// see org.eclipse.compare.internal.patch.PatchCompareEditorInput.processDiffs(FilePatch2[])
private IDiffElement[] processDiffs(FilePatch2[] diffs) {
- List result = new ArrayList();
+ List<IDiffElement> result = new ArrayList<>();
for (int i = 0; i < diffs.length; i++) {
result.addAll(processDiff(diffs[i], this));
}
- return (IDiffElement[]) result.toArray(new IDiffElement[result.size()]);
+ return result.toArray(new IDiffElement[result.size()]);
}
// see org.eclipse.compare.internal.patch.PatchCompareEditorInput.processProjects(DiffProject[])
private IDiffElement[] processProjects(DiffProject[] diffProjects) {
- List result = new ArrayList();
+ List<IDiffElement> result = new ArrayList<>();
for (int i = 0; i < diffProjects.length; i++) {
PatchProjectDiffNode projectNode = new PatchProjectDiffNode(this, diffProjects[i], getPatcher().getConfiguration());
result.add(projectNode);
@@ -90,12 +90,12 @@ public class PatchWorkspace extends DiffNode implements IAdaptable {
processDiff(fileDiff, projectNode);
}
}
- return (IDiffElement[]) result.toArray(new IDiffElement[result.size()]);
+ return result.toArray(new IDiffElement[result.size()]);
}
// see org.eclipse.compare.internal.patch.PatchCompareEditorInput.processDiff(FilePatch2, DiffNode)
- private List/*<IDiffElement>*/ processDiff(FilePatch2 diff, DiffNode parent) {
- List result = new ArrayList();
+ private List<IDiffElement> processDiff(FilePatch2 diff, DiffNode parent) {
+ List<IDiffElement> result = new ArrayList<>();
FileDiffResult diffResult = getPatcher().getDiffResult(diff);
PatchFileDiffNode node = new PatchFileDiffNode(diffResult, parent, PatchFileDiffNode.getKind(diffResult), PatchFileDiffNode.getAncestorElement(diffResult), getLeftElement(diffResult), PatchFileDiffNode.getRightElement(diffResult));
result.add(node);
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigureProjectWizardMainPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigureProjectWizardMainPage.java
index 83da2d258..74c820758 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigureProjectWizardMainPage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigureProjectWizardMainPage.java
@@ -147,12 +147,7 @@ public class ConfigureProjectWizardMainPage extends WizardPage {
// Ask the container to update button enablement
setPageComplete(true);
});
- viewer.addDoubleClickListener(new IDoubleClickListener() {
- @Override
- public void doubleClick(DoubleClickEvent event) {
- getWizard().getContainer().showPage(getNextPage());
- }
- });
+ viewer.addDoubleClickListener(event -> getWizard().getContainer().showPage(getNextPage()));
viewer.setComparator(new ViewerComparator() {
@Override
public int compare(Viewer viewer, Object e1, Object e2) {
@@ -193,13 +188,13 @@ public class ConfigureProjectWizardMainPage extends WizardPage {
}
/* package */ IProject[] getUnsharedProjects() {
- java.util.List unshared = new ArrayList();
+ java.util.List<IProject> unshared = new ArrayList<>();
for (int i = 0; i < projects.length; i++) {
IProject project = projects[i];
if (!RepositoryProvider.isShared(project))
unshared.add(project);
}
- return (IProject[]) unshared.toArray(new IProject[unshared.size()]);
+ return unshared.toArray(new IProject[unshared.size()]);
}
/**
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ExportProjectSetMainPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ExportProjectSetMainPage.java
index 29ad6d58d..dee19f3d0 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ExportProjectSetMainPage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ExportProjectSetMainPage.java
@@ -94,7 +94,7 @@ public class ExportProjectSetMainPage extends TeamWizardPage {
public Object[] getElements(Object inputElement) {
if (inputElement instanceof IWorkspaceRoot) {
IWorkspaceRoot root = (IWorkspaceRoot) inputElement;
- List projectList = new ArrayList();
+ List<IProject> projectList = new ArrayList<>();
IProject[] workspaceProjects = root.getProjects();
for (int i = 0; i < workspaceProjects.length; i++) {
if (isProjectExportable(workspaceProjects[i])) {
@@ -105,7 +105,7 @@ public class ExportProjectSetMainPage extends TeamWizardPage {
} else if (inputElement instanceof IWorkingSetManager){
IWorkingSetManager manager = (IWorkingSetManager) inputElement;
IWorkingSet[] allSets = manager.getAllWorkingSets();
- ArrayList resourceSets = new ArrayList();
+ ArrayList<IWorkingSet> resourceSets = new ArrayList<>();
for (int i = 0; i < allSets.length; i++)
if (isWorkingSetSupported(allSets[i]))
resourceSets.add(allSets[i]);
@@ -120,7 +120,7 @@ public class ExportProjectSetMainPage extends TeamWizardPage {
IAdaptable[] tempAdaptable = (IAdaptable[]) inputElement;
return getProjectsForAdaptables(tempAdaptable);
} else if (inputElement instanceof HashSet){
- Set tempList = new HashSet();
+ Set<IProject> tempList = new HashSet<>();
HashSet inputElementSet = (HashSet) inputElement;
for (Iterator iterator = inputElementSet.iterator(); iterator.hasNext();) {
IProject[] projects = getProjectsForObject(iterator.next());
@@ -453,8 +453,8 @@ public class ExportProjectSetMainPage extends TeamWizardPage {
private TableViewer tableViewer;
- HashSet selectedProjects = new HashSet();
- ArrayList referenceCountProjects = new ArrayList();
+ HashSet<IProject> selectedProjects = new HashSet<>();
+ ArrayList<IProject> referenceCountProjects = new ArrayList<>();
ArrayList selectedWorkingSet = new ArrayList();
/**
@@ -709,7 +709,7 @@ public class ExportProjectSetMainPage extends TeamWizardPage {
IAdaptable[] elements = workingSet.getElements();
selectedWorkingSet.remove(workingSet);
- Set tempSet = new HashSet();
+ Set<IProject> tempSet = new HashSet<>();
for (int i = 0; i < elements.length; i++) {
IProject[] projects = getProjectsForObject(elements[i]);
if (projects != null)
@@ -727,7 +727,7 @@ public class ExportProjectSetMainPage extends TeamWizardPage {
}
private void addProjects(IAdaptable[] elements) {
- Set tempSet = new HashSet();
+ Set<IProject> tempSet = new HashSet<>();
for (int j = 0; j < elements.length; j++) {
IProject[] projects = getProjectsForObject(elements[j]);
if (projects != null)
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/PatchInaccessibleProjectsPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/PatchInaccessibleProjectsPage.java
index 62c05fb7c..32d67ab6f 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/PatchInaccessibleProjectsPage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/PatchInaccessibleProjectsPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 IBM Corporation and others.
+ * Copyright (c) 2010, 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
@@ -133,7 +133,7 @@ public class PatchInaccessibleProjectsPage extends WizardPage {
private void updateControls() {
DiffProject[] diffProjects = fPatcher.getDiffProjects();
- List projects = new ArrayList();
+ List<IProject> projects = new ArrayList<>();
if (diffProjects != null) {
for (int i = 0; i < diffProjects.length; i++) {
IProject project = ResourcesPlugin.getWorkspace().getRoot()
@@ -163,10 +163,10 @@ public class PatchInaccessibleProjectsPage extends WizardPage {
public IProject[] getSelectedProjects() {
Object elements[] = checkList.getCheckedElements();
- List projects = new ArrayList();
+ List<IProject> projects = new ArrayList<>();
for (int i = 0; i < elements.length; i++)
- projects.add(elements[i]);
- return (IProject[]) projects.toArray(new IProject[] {});
+ projects.add((IProject) elements[i]);
+ return projects.toArray(new IProject[] {});
}
private void setAllChecked(boolean checked) {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/WorkingSetsDialog.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/WorkingSetsDialog.java
index c220b5ed8..a34608541 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/WorkingSetsDialog.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/WorkingSetsDialog.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2008 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
@@ -131,18 +131,18 @@ public class WorkingSetsDialog extends TitleAreaDialog {
}
class WorkingSetLabelProvider extends LabelProvider {
- private Map icons;
+ private Map<ImageDescriptor, Image> icons;
public WorkingSetLabelProvider() {
- icons = new Hashtable();
+ icons = new Hashtable<>();
}
@Override
public void dispose() {
- Iterator iterator = icons.values().iterator();
+ Iterator<Image> iterator = icons.values().iterator();
while (iterator.hasNext()) {
- Image icon = (Image) iterator.next();
+ Image icon = iterator.next();
icon.dispose();
}
super.dispose();
@@ -158,7 +158,7 @@ public class WorkingSetsDialog extends TitleAreaDialog {
return null;
}
- Image icon = (Image) icons.get(imageDescriptor);
+ Image icon = icons.get(imageDescriptor);
if (icon == null) {
icon = imageDescriptor.createImage();
icons.put(imageDescriptor, icon);
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/PageSaveablePart.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/PageSaveablePart.java
index 8facab478..1202b6af4 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/PageSaveablePart.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/PageSaveablePart.java
@@ -22,11 +22,8 @@ import org.eclipse.compare.structuremergeviewer.ICompareInput;
import org.eclipse.core.runtime.*;
import org.eclipse.jface.action.ToolBarManager;
import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.*;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.*;
@@ -56,7 +53,7 @@ public abstract class PageSaveablePart extends SaveablePartAdapter implements IC
// Tracking of dirty state
private boolean fDirty= false;
- private ArrayList fDirtyViewers= new ArrayList();
+ private ArrayList<Object> fDirtyViewers= new ArrayList<>();
private IPropertyChangeListener fDirtyStateListener;
// SWT controls
@@ -77,32 +74,23 @@ public abstract class PageSaveablePart extends SaveablePartAdapter implements IC
this.shell = shell;
this.cc = compareConfiguration;
- fDirtyStateListener= new IPropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent e) {
- String propertyName= e.getProperty();
- if (CompareEditorInput.DIRTY_STATE.equals(propertyName)) {
- boolean changed= false;
- Object newValue= e.getNewValue();
- if (newValue instanceof Boolean)
- changed= ((Boolean)newValue).booleanValue();
- setDirty(e.getSource(), changed);
- }
+ fDirtyStateListener= e -> {
+ String propertyName= e.getProperty();
+ if (CompareEditorInput.DIRTY_STATE.equals(propertyName)) {
+ boolean changed= false;
+ Object newValue= e.getNewValue();
+ if (newValue instanceof Boolean)
+ changed= ((Boolean)newValue).booleanValue();
+ setDirty(e.getSource(), changed);
}
};
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.ISaveablePart#isDirty()
- */
@Override
public boolean isDirty() {
return fDirty || fDirtyViewers.size() > 0;
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
- */
@Override
public void createPartControl(Composite parent) {
Composite composite = new Composite(parent, SWT.NULL);
@@ -130,12 +118,7 @@ public abstract class PageSaveablePart extends SaveablePartAdapter implements IC
return null;
}
};
- fStructuredComparePane.addSelectionChangedListener(new ISelectionChangedListener() {
- @Override
- public void selectionChanged(SelectionChangedEvent e) {
- feedInput2(e.getSelection());
- }
- });
+ fStructuredComparePane.addSelectionChangedListener(e -> feedInput2(e.getSelection()));
fEditionPane.setText(TeamUIMessages.ParticipantPageSaveablePart_0);
fContentPane = new CompareViewerSwitchingPane(vsplitter, SWT.BORDER | SWT.FLAT) {
@Override
@@ -149,12 +132,7 @@ public abstract class PageSaveablePart extends SaveablePartAdapter implements IC
dsp.addPropertyChangeListener(fDirtyStateListener);
Control c= newViewer.getControl();
c.addDisposeListener(
- new DisposeListener() {
- @Override
- public void widgetDisposed(DisposeEvent e) {
- dsp.removePropertyChangeListener(fDirtyStateListener);
- }
- }
+ e -> dsp.removePropertyChangeListener(fDirtyStateListener)
);
hookContentChangeListener((ICompareInput)input);
}
@@ -173,14 +151,11 @@ public abstract class PageSaveablePart extends SaveablePartAdapter implements IC
hsplitter.setMaximizedControl(fEditionPane);
}
- getSelectionProvider().addSelectionChangedListener(new ISelectionChangedListener() {
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- ICompareInput input = getCompareInput(event.getSelection());
- if (input != null)
- prepareCompareInput(input);
- setInput(input);
- }
+ getSelectionProvider().addSelectionChangedListener(event -> {
+ ICompareInput input = getCompareInput(event.getSelection());
+ if (input != null)
+ prepareCompareInput(input);
+ setInput(input);
});
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/history/RevisionAnnotationController.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/history/RevisionAnnotationController.java
index 09c912cb5..487b48d10 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/history/RevisionAnnotationController.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/history/RevisionAnnotationController.java
@@ -232,7 +232,7 @@ public abstract class RevisionAnnotationController {
editors.add(editor);
}
- return (IEditorPart[]) editors.toArray(new IEditorPart[editors.size()]);
+ return editors.toArray(new IEditorPart[editors.size()]);
}
private static AbstractDecoratedTextEditor findOpenTextEditorFor(IWorkbenchPage page, Object object) {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/SynchronizationActionProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/SynchronizationActionProvider.java
index 2c6555d46..e24a8bc41 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/SynchronizationActionProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/SynchronizationActionProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006 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
@@ -63,7 +63,7 @@ public class SynchronizationActionProvider extends CommonActionProvider {
*/
public static final String MARK_AS_MERGE_ACTION_ID = "org.eclipse.team.ui.markAsMergeAction"; //$NON-NLS-1$
- private Map handlers = new HashMap();
+ private Map<String, IHandler> handlers = new HashMap<>();
private OpenWithActionGroup openWithActions;
@Override
@@ -147,9 +147,6 @@ public class SynchronizationActionProvider extends CommonActionProvider {
handlers.put(actionId, handler);
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.actions.ActionGroup#fillContextMenu(org.eclipse.jface.action.IMenuManager)
- */
@Override
public void fillContextMenu(IMenuManager menu) {
super.fillContextMenu(menu);
@@ -157,7 +154,7 @@ public class SynchronizationActionProvider extends CommonActionProvider {
CommonMenuManager manager = (CommonMenuManager) menu;
for (Iterator iter = handlers.keySet().iterator(); iter.hasNext();) {
String actionId = (String) iter.next();
- manager.registerHandler(actionId, (IHandler)handlers.get(actionId));
+ manager.registerHandler(actionId, handlers.get(actionId));
}
}
final IContributionItem fileGroup = menu.find(ISynchronizePageConfiguration.FILE_GROUP);
@@ -166,9 +163,6 @@ public class SynchronizationActionProvider extends CommonActionProvider {
}
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.actions.ActionGroup#fillActionBars(org.eclipse.ui.IActionBars)
- */
@Override
public void fillActionBars(IActionBars actionBars) {
super.fillActionBars(actionBars);
@@ -187,9 +181,6 @@ public class SynchronizationActionProvider extends CommonActionProvider {
if (openWithActions != null) openWithActions.setContext(context);
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.actions.ActionGroup#dispose()
- */
@Override
public void dispose() {
super.dispose();
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/SynchronizationCompareAdapter.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/SynchronizationCompareAdapter.java
index c50e72c38..5c1cc05ee 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/SynchronizationCompareAdapter.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/SynchronizationCompareAdapter.java
@@ -87,7 +87,7 @@ public abstract class SynchronizationCompareAdapter implements ISynchronizationC
Object object = mapping.getModelObject();
IWorkbenchAdapter adapter = Adapters.adapt(object, IWorkbenchAdapter.class);
if (adapter != null) {
- List segments = new ArrayList();
+ List<String> segments = new ArrayList<>();
Object parent = object;
do {
String segment = adapter.getLabel(parent);
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ModelMergeOperation.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ModelMergeOperation.java
index 48ad9bbfd..44d8821ce 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ModelMergeOperation.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ModelMergeOperation.java
@@ -54,7 +54,7 @@ public abstract class ModelMergeOperation extends ModelOperation {
try {
ModelProvider[] providers = context.getScope().getModelProviders();
monitor.beginTask(null, 100 * providers.length);
- List notOK = new ArrayList();
+ List<IStatus> notOK = new ArrayList<>();
for (int i = 0; i < providers.length; i++) {
ModelProvider provider = providers[i];
IStatus status = validateMerge(provider, context, Policy.subMonitorFor(monitor, 100));
@@ -64,8 +64,8 @@ public abstract class ModelMergeOperation extends ModelOperation {
if (notOK.isEmpty())
return Status.OK_STATUS;
if (notOK.size() == 1)
- return (IStatus)notOK.get(0);
- return new MultiStatus(TeamUIPlugin.ID, 0, (IStatus[]) notOK.toArray(new IStatus[notOK.size()]), TeamUIMessages.ResourceMappingMergeOperation_3, null);
+ return notOK.get(0);
+ return new MultiStatus(TeamUIPlugin.ID, 0, notOK.toArray(new IStatus[notOK.size()]), TeamUIMessages.ResourceMappingMergeOperation_3, null);
} finally {
monitor.done();
}
@@ -193,31 +193,28 @@ public abstract class ModelMergeOperation extends ModelOperation {
*/
protected void handleValidationFailure(final IStatus status) {
final boolean[] result = new boolean[] { false };
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- ErrorDialog dialog = new ErrorDialog(getShell(), TeamUIMessages.ModelMergeOperation_0, TeamUIMessages.ModelMergeOperation_1, status, IStatus.ERROR | IStatus.WARNING | IStatus.INFO) {
- @Override
- protected void createButtonsForButtonBar(Composite parent) {
- createButton(parent, IDialogConstants.YES_ID, IDialogConstants.YES_LABEL,
- false);
- createButton(parent, IDialogConstants.NO_ID, IDialogConstants.NO_LABEL,
- true);
- createDetailsButton(parent);
- }
+ Runnable runnable = () -> {
+ ErrorDialog dialog = new ErrorDialog(getShell(), TeamUIMessages.ModelMergeOperation_0, TeamUIMessages.ModelMergeOperation_1, status, IStatus.ERROR | IStatus.WARNING | IStatus.INFO) {
+ @Override
+ protected void createButtonsForButtonBar(Composite parent) {
+ createButton(parent, IDialogConstants.YES_ID, IDialogConstants.YES_LABEL,
+ false);
+ createButton(parent, IDialogConstants.NO_ID, IDialogConstants.NO_LABEL,
+ true);
+ createDetailsButton(parent);
+ }
- @Override
- protected void buttonPressed(int id) {
- if (id == IDialogConstants.YES_ID)
- super.buttonPressed(IDialogConstants.OK_ID);
- else if (id == IDialogConstants.NO_ID)
- super.buttonPressed(IDialogConstants.CANCEL_ID);
- super.buttonPressed(id);
- }
- };
- int code = dialog.open();
- result[0] = code == 0;
- }
+ @Override
+ protected void buttonPressed(int id) {
+ if (id == IDialogConstants.YES_ID)
+ super.buttonPressed(IDialogConstants.OK_ID);
+ else if (id == IDialogConstants.NO_ID)
+ super.buttonPressed(IDialogConstants.CANCEL_ID);
+ super.buttonPressed(id);
+ }
+ };
+ int code = dialog.open();
+ result[0] = code == 0;
};
getShell().getDisplay().syncExec(runnable);
if (result[0])
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ModelOperation.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ModelOperation.java
index 7e782047f..872a91809 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ModelOperation.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ModelOperation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 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
@@ -53,12 +53,12 @@ public abstract class ModelOperation extends TeamOperation {
* @return the list of provides sorted by their extends relationship
*/
public static ModelProvider[] sortByExtension(ModelProvider[] providers) {
- List result = new ArrayList();
+ List<ModelProvider> result = new ArrayList<>();
for (int i = 0; i < providers.length; i++) {
ModelProvider providerToInsert = providers[i];
int index = result.size();
for (int j = 0; j < result.size(); j++) {
- ModelProvider provider = (ModelProvider) result.get(j);
+ ModelProvider provider = result.get(j);
if (extendsProvider(providerToInsert, provider)) {
index = j;
break;
@@ -66,7 +66,7 @@ public abstract class ModelOperation extends TeamOperation {
}
result.add(index, providerToInsert);
}
- return (ModelProvider[]) result.toArray(new ModelProvider[result.size()]);
+ return result.toArray(new ModelProvider[result.size()]);
}
private static boolean extendsProvider(ModelProvider providerToInsert, ModelProvider provider) {
@@ -273,15 +273,15 @@ public abstract class ModelOperation extends TeamOperation {
}
private ModelProvider[] getAdditionalProviders(ModelProvider[] inputModelProviders, ModelProvider[] modelProviders) {
- Set input = new HashSet();
- List result = new ArrayList();
+ Set<ModelProvider> input = new HashSet<>();
+ List<ModelProvider> result = new ArrayList<>();
input.addAll(Arrays.asList(inputModelProviders));
for (int i = 0; i < modelProviders.length; i++) {
ModelProvider provider = modelProviders[i];
if (!input.contains(provider))
result.add(provider);
}
- return (ModelProvider[]) result.toArray(new ModelProvider[result.size()]);
+ return result.toArray(new ModelProvider[result.size()]);
}
private boolean overlaps(ResourceTraversal[] scopeTraversals, ResourceTraversal[] inputModelTraversals) {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ModelSynchronizeParticipant.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ModelSynchronizeParticipant.java
index 3181eb383..fefc7bab7 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ModelSynchronizeParticipant.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ModelSynchronizeParticipant.java
@@ -477,7 +477,7 @@ public class ModelSynchronizeParticipant extends
}
private ResourceMapping[] loadMappings(IMemento settings) throws PartInitException {
- List result = new ArrayList();
+ List<ResourceMapping> result = new ArrayList<>();
IMemento[] children = settings.getChildren(CTX_PARTICIPANT_MAPPINGS);
for (int i = 0; i < children.length; i++) {
IMemento memento = children[i];
@@ -499,7 +499,7 @@ public class ModelSynchronizeParticipant extends
}
}
}
- return (ResourceMapping[]) result.toArray(new ResourceMapping[result.size()]);
+ return result.toArray(new ResourceMapping[result.size()]);
}
private void initializeContext(ResourceMapping[] mappings) throws PartInitException {
@@ -619,7 +619,7 @@ public class ModelSynchronizeParticipant extends
@Override
public PreferencePage[] getPreferencePages() {
- List pages = new ArrayList();
+ List<PreferencePage> pages = new ArrayList<>();
SyncViewerPreferencePage syncViewerPreferencePage = new SyncViewerPreferencePage();
syncViewerPreferencePage.setIncludeDefaultLayout(false);
pages.add(syncViewerPreferencePage);
@@ -641,7 +641,7 @@ public class ModelSynchronizeParticipant extends
if (getHandler() != null) {
pages.add(new StartupPreferencePage(preferences));
}
- return (PreferencePage[]) pages.toArray(new PreferencePage[pages.size()]);
+ return pages.toArray(new PreferencePage[pages.size()]);
}
private boolean isIncluded(ITeamContentProviderDescriptor descriptor) {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ResourceScope.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ResourceScope.java
index b08355176..b43d7062f 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ResourceScope.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ResourceScope.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 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
@@ -67,33 +67,21 @@ public class ResourceScope extends AbstractSynchronizeScope {
fireRootsChanges();
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.synchronize.ScopableSubscriberParticipant.ISynchronizeScope#getName()
- */
@Override
public String getName() {
return Utils.convertSelection(resources);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.synchronize.ScopableSubscriberParticipant.ISynchronizeScope#getRoots()
- */
@Override
public IResource[] getRoots() {
return resources;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.synchronize.ScopableSubscriberParticipant.ISynchronizeScope#dispose()
- */
@Override
public void dispose() {
// Nothing to dispose
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.synchronize.ScopableSubscriberParticipant.ISynchronizeScope#saveState(org.eclipse.ui.IMemento)
- */
@Override
public void saveState(IMemento memento) {
if (resources != null) {
@@ -105,14 +93,11 @@ public class ResourceScope extends AbstractSynchronizeScope {
}
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.AbstractSynchronizeScope#init(org.eclipse.ui.IMemento)
- */
@Override
protected void init(IMemento memento) {
IMemento[] rootNodes = memento.getChildren(CTX_ROOT);
if(rootNodes != null) {
- List resources = new ArrayList();
+ List<IResource> resources = new ArrayList<>();
for (int i = 0; i < rootNodes.length; i++) {
IMemento rootNode = rootNodes[i];
IPath path = new Path(rootNode.getString(CTX_ROOT_PATH));
@@ -121,7 +106,7 @@ public class ResourceScope extends AbstractSynchronizeScope {
resources.add(resource);
}
}
- this.resources = (IResource[]) resources.toArray(new IResource[resources.size()]);
+ this.resources = resources.toArray(new IResource[resources.size()]);
}
}
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SynchronizePageActionGroup.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SynchronizePageActionGroup.java
index 7f645d640..40e18b5a4 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SynchronizePageActionGroup.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SynchronizePageActionGroup.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 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 abstract class SynchronizePageActionGroup extends ActionGroup {
private ISynchronizePageConfiguration configuration;
- private Map menuContributions = new HashMap();
+ private Map<String, Map<String, List<Object>>> menuContributions = new HashMap<>();
private VisibleRootsSelectionProvider visibleRootSelectionProvider;
@@ -71,16 +71,13 @@ public abstract class SynchronizePageActionGroup extends ActionGroup {
*/
private class VisibleRootsSelectionProvider extends SynchronizePageActionGroup implements ISelectionProvider {
- private ListenerList selectionChangedListeners = new ListenerList(ListenerList.IDENTITY);
+ private ListenerList<ISelectionChangedListener> selectionChangedListeners = new ListenerList<>(ListenerList.IDENTITY);
private ISelection selection;
protected VisibleRootsSelectionProvider(ISynchronizeModelElement element) {
modelChanged(element);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.SynchronizePageActionGroup#modelChanged(org.eclipse.team.ui.synchronize.ISynchronizeModelElement)
- */
@Override
public void modelChanged(ISynchronizeModelElement root) {
if (root == null) {
@@ -90,33 +87,21 @@ public abstract class SynchronizePageActionGroup extends ActionGroup {
}
}
- /* (non-Javadoc)
- * Method declared on ISelectionProvider.
- */
@Override
public void addSelectionChangedListener(ISelectionChangedListener listener) {
selectionChangedListeners.add(listener);
}
- /* (non-Javadoc)
- * Method declared on ISelectionProvider.
- */
@Override
public void removeSelectionChangedListener(ISelectionChangedListener listener) {
selectionChangedListeners.remove(listener);
}
- /* (non-Javadoc)
- * Method declared on ISelectionProvider.
- */
@Override
public ISelection getSelection() {
return selection;
}
- /* (non-Javadoc)
- * Method declared on ISelectionProvider.
- */
@Override
public void setSelection(ISelection selection) {
this.selection = selection;
@@ -125,9 +110,7 @@ public abstract class SynchronizePageActionGroup extends ActionGroup {
private void selectionChanged(final SelectionChangedEvent event) {
// pass on the notification to listeners
- Object[] listeners = selectionChangedListeners.getListeners();
- for (int i = 0; i < listeners.length; ++i) {
- final ISelectionChangedListener l = (ISelectionChangedListener)listeners[i];
+ for (final ISelectionChangedListener l: selectionChangedListeners) {
SafeRunner.run(new SafeRunnable() {
@Override
public void run() {
@@ -322,18 +305,12 @@ public abstract class SynchronizePageActionGroup extends ActionGroup {
return visibleRootSelectionProvider;
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.actions.ActionGroup#fillContextMenu(org.eclipse.jface.action.IMenuManager)
- */
@Override
public void fillContextMenu(IMenuManager menu) {
super.fillContextMenu(menu);
fillMenu(menu, ISynchronizePageConfiguration.P_CONTEXT_MENU);
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.actions.ActionGroup#fillActionBars(org.eclipse.ui.IActionBars)
- */
@Override
public void fillActionBars(IActionBars actionBars) {
super.fillActionBars(actionBars);
@@ -344,11 +321,11 @@ public abstract class SynchronizePageActionGroup extends ActionGroup {
}
private void fillMenu(IContributionManager menu, String menuId) {
- Map groups = (Map)menuContributions.get(menuId);
+ Map<String, List<Object>> groups = menuContributions.get(menuId);
if (menu != null && groups != null) {
- for (Iterator iter = groups.keySet().iterator(); iter.hasNext(); ) {
- String groupId = (String) iter.next();
- List actions = (List)groups.get(groupId);
+ for (Iterator<String> iter = groups.keySet().iterator(); iter.hasNext(); ) {
+ String groupId = iter.next();
+ List actions = groups.get(groupId);
if (actions != null) {
for (Iterator iter2 = actions.iterator(); iter2.hasNext();) {
Object element = iter2.next();
@@ -367,14 +344,14 @@ public abstract class SynchronizePageActionGroup extends ActionGroup {
}
private void internalAppendToGroup(String menuId, String groupId, Object action) {
- Map groups = (Map)menuContributions.get(menuId);
+ Map<String, List<Object>> groups = menuContributions.get(menuId);
if (groups == null) {
- groups = new HashMap();
+ groups = new HashMap<>();
menuContributions.put(menuId, groups);
}
- List actions = (List)groups.get(groupId);
+ List<Object> actions = groups.get(groupId);
if (actions == null) {
- actions = new ArrayList();
+ actions = new ArrayList<>();
groups.put(groupId, actions);
}
actions.add(action);

Back to the top