Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2017-07-19 09:47:57 -0400
committerAlexander Kurtakov2017-07-19 09:47:57 -0400
commit709fad967e282a8c30156d18271beb08998b1c5f (patch)
treed308c214569cc4d8887c6591dfb084401156fb6a /bundles
parentfdb28cd0b9aef558e4f03db67cd5dbdd331d35de (diff)
downloadeclipse.platform.team-709fad967e282a8c30156d18271beb08998b1c5f.tar.gz
eclipse.platform.team-709fad967e282a8c30156d18271beb08998b1c5f.tar.xz
eclipse.platform.team-709fad967e282a8c30156d18271beb08998b1c5f.zip
Bug 519875 - Cleanup o.e.team.ui
Generifications. Change-Id: I5cb535fabbd30796ed18b3649d0d4d9b1bc29de0 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/mapping/CommonViewerAdvisor.java42
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/CompareInputChangeNotifier.java20
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/DiffTreeChangesSection.java11
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ModelEnablementPreferencePage.java15
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ModelSelectionDropDownAction.java40
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceCompareInputChangeNotifier.java29
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceDragAdapterAssistant.java17
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceMergeActionHandler.java20
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceModelLabelProvider.java34
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceModelParticipantAction.java4
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceModelPersistenceAdapter.java12
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceModelProviderOperation.java13
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceModelScopeParticipant.java13
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceModelTraversalCalculator.java18
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/SynchronizationResourceMappingContext.java25
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/SyncViewerPreferencePage.java23
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/TeamContentProviderManager.java30
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/AbstractSynchronizeModelProvider.java77
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ActiveChangeSetCollector.java57
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/CompressedFoldersModelProvider.java57
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SyncInfoSetChangeSetCollector.java22
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeManager.java88
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelProvider.java28
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelUpdateHandler.java147
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeView.java20
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ChangeSetActionGroup.java13
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/ApplyPatchSubscriber.java10
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ProjectSetExportWizard.java17
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/PsfStore.java10
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/TeamUI.java7
-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/SynchronizationContentProvider.java6
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SubscriberParticipant.java34
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoCompareInput.java39
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SynchronizeModelAction.java6
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SynchronizeModelOperation.java12
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamStateChangeEvent.java26
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamStateDescription.java24
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamStateProvider.java14
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/WorkingSetScope.java31
40 files changed, 313 insertions, 800 deletions
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/CommonViewerAdvisor.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/CommonViewerAdvisor.java
index 58abe7ad9..19580dd57 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/CommonViewerAdvisor.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/CommonViewerAdvisor.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
@@ -125,12 +125,12 @@ public class CommonViewerAdvisor extends AbstractTreeViewerAdvisor implements IN
* @since 2.0
*/
public TreePath[] getVisibleExpandedPaths() {
- ArrayList v = new ArrayList();
+ ArrayList<TreePath> v = new ArrayList<>();
internalCollectVisibleExpanded(v, getControl());
- return (TreePath[]) v.toArray(new TreePath[v.size()]);
+ return v.toArray(new TreePath[v.size()]);
}
- private void internalCollectVisibleExpanded(ArrayList result, Widget widget) {
+ private void internalCollectVisibleExpanded(ArrayList<TreePath> result, Widget widget) {
Item[] items = getChildren(widget);
for (int i = 0; i < items.length; i++) {
Item item = items[i];
@@ -212,7 +212,7 @@ public class CommonViewerAdvisor extends AbstractTreeViewerAdvisor implements IN
private static final String PROP_ACTION_SERVICE_ACTION_BARS = "org.eclipse.team.ui.actionServiceActionBars"; //$NON-NLS-1$
- private Set extensions = new HashSet();
+ private Set<INavigatorContentExtension> extensions = new HashSet<>();
private NavigatorActionService actionService;
@@ -263,7 +263,7 @@ public class CommonViewerAdvisor extends AbstractTreeViewerAdvisor implements IN
configuration.setProperty(ModelSynchronizeParticipant.P_VISIBLE_MODEL_PROVIDER, ModelSynchronizeParticipant.ALL_MODEL_PROVIDERS_VISIBLE);
ModelSynchronizeParticipant participant = (ModelSynchronizeParticipant)configuration.getParticipant();
ModelProvider[] providers = participant.getEnabledModelProviders();
- Set result = new HashSet();
+ Set<String> result = new HashSet<>();
Object property = configuration.getProperty(ITeamContentProviderManager.PROP_PAGE_LAYOUT);
boolean isFlatLayout = property != null && property.equals(ITeamContentProviderManager.FLAT_LAYOUT);
for (int i = 0; i < providers.length; i++) {
@@ -272,18 +272,18 @@ public class CommonViewerAdvisor extends AbstractTreeViewerAdvisor implements IN
if (desc != null && desc.isEnabled() && (!isFlatLayout || desc.isFlatLayoutSupported()))
result.add(desc.getContentExtensionId());
}
- return (String[]) result.toArray(new String[result.size()]);
+ return result.toArray(new String[result.size()]);
}
private static void bindTeamContentProviders(CommonViewer v) {
ITeamContentProviderManager teamContentProviderManager = TeamUI.getTeamContentProviderManager();
ITeamContentProviderDescriptor[] descriptors = teamContentProviderManager.getDescriptors();
- Set toBind = new HashSet();
+ Set<String> toBind = new HashSet<>();
for (int i = 0; i < descriptors.length; i++) {
ITeamContentProviderDescriptor descriptor = descriptors[i];
toBind.add(descriptor.getContentExtensionId());
}
- v.getNavigatorContentService().bindExtensions((String[]) toBind.toArray(new String[toBind.size()]), true);
+ v.getNavigatorContentService().bindExtensions(toBind.toArray(new String[toBind.size()]), true);
}
private static ISynchronizationScope getScope(ISynchronizePageConfiguration configuration) {
@@ -423,9 +423,6 @@ public class CommonViewerAdvisor extends AbstractTreeViewerAdvisor implements IN
return getConfiguration().getProperty(ITeamContentProviderManager.P_SYNCHRONIZATION_CONTEXT);
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.navigator.internal.extensions.INavigatorContentServiceListener#onLoad(org.eclipse.ui.navigator.internal.extensions.NavigatorContentExtension)
- */
@Override
public void onLoad(INavigatorContentExtension anExtension) {
extensions.add(anExtension);
@@ -439,26 +436,17 @@ public class CommonViewerAdvisor extends AbstractTreeViewerAdvisor implements IN
return (ModelSynchronizeParticipant)getConfiguration().getParticipant();
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.synchronize.StructuredViewerAdvisor#getContextMenuId(org.eclipse.jface.viewers.StructuredViewer)
- */
@Override
protected String getContextMenuId(StructuredViewer viewer) {
return ((CommonViewer)viewer).getNavigatorContentService().getViewerDescriptor().getPopupMenuId();
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.synchronize.StructuredViewerAdvisor#registerContextMenu(org.eclipse.jface.viewers.StructuredViewer, org.eclipse.jface.action.MenuManager)
- */
@Override
protected void registerContextMenu(StructuredViewer viewer, MenuManager menuMgr) {
actionService.prepareMenuForPlatformContributions(menuMgr,
viewer, false);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.synchronize.StructuredViewerAdvisor#fillContextMenu(org.eclipse.jface.viewers.StructuredViewer, org.eclipse.jface.action.IMenuManager)
- */
@Override
protected void fillContextMenu(StructuredViewer viewer, IMenuManager manager) {
// Clear any handlers from the menu
@@ -476,9 +464,6 @@ public class CommonViewerAdvisor extends AbstractTreeViewerAdvisor implements IN
super.fillContextMenu(viewer, manager);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.synchronize.StructuredViewerAdvisor#dispose()
- */
@Override
public void dispose() {
TeamUI.getTeamContentProviderManager().removePropertyChangeListener(this);
@@ -487,9 +472,6 @@ public class CommonViewerAdvisor extends AbstractTreeViewerAdvisor implements IN
super.dispose();
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.synchronize.StructuredViewerAdvisor#updateActionBars(org.eclipse.jface.viewers.IStructuredSelection)
- */
@Override
protected void updateActionBars(IStructuredSelection selection) {
super.updateActionBars(selection);
@@ -505,17 +487,11 @@ public class CommonViewerAdvisor extends AbstractTreeViewerAdvisor implements IN
}
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.synchronize.StructuredViewerAdvisor#createContextMenuManager(java.lang.String)
- */
@Override
protected MenuManager createContextMenuManager(String targetID) {
return new CommonMenuManager(targetID);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.synchronize.StructuredViewerAdvisor#addContextMenuGroups(org.eclipse.jface.action.IMenuManager)
- */
@Override
protected void addContextMenuGroups(IMenuManager manager) {
// Don't do anything. The groups will be added by the action service
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 878c53cfa..7d3fb2867 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
@@ -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
@@ -252,12 +252,7 @@ public abstract class CompareInputChangeNotifier implements
*/
protected void dispatchChanges(final ICompareInput[] inputs, IProgressMonitor monitor) {
prepareInputs(inputs, monitor);
- Display.getDefault().syncExec(new Runnable() {
- @Override
- public void run() {
- fireChanges(inputs);
- }
- });
+ Display.getDefault().syncExec(() -> fireChanges(inputs));
}
/**
@@ -309,12 +304,9 @@ public abstract class CompareInputChangeNotifier implements
eventHandler.queueEvent(new BackgroundEventHandler.RunnableEvent(runnable, false));
}
- /* (non-Javadoc)
- * @see org.eclipse.core.resources.IResourceChangeListener#resourceChanged(org.eclipse.core.resources.IResourceChangeEvent)
- */
@Override
public void resourceChanged(IResourceChangeEvent event) {
- List changedInputs = new ArrayList();
+ List<ICompareInput> changedInputs = new ArrayList<>();
ICompareInput[] inputs = getConnectedInputs();
for (int i = 0; i < inputs.length; i++) {
ICompareInput input = inputs[i];
@@ -335,7 +327,7 @@ public abstract class CompareInputChangeNotifier implements
}
}
if (!changedInputs.isEmpty())
- handleInputChanges((ICompareInput[]) changedInputs.toArray(new ICompareInput[changedInputs.size()]), true);
+ handleInputChanges(changedInputs.toArray(new ICompareInput[changedInputs.size()]), true);
}
/**
@@ -356,14 +348,14 @@ public abstract class CompareInputChangeNotifier implements
if (force) {
realChanges = inputs;
} else {
- List result = new ArrayList();
+ List<ICompareInput> result = new ArrayList<>();
for (int i = 0; i < inputs.length; i++) {
ICompareInput input = inputs[i];
if (isChanged(input)) {
result.add(input);
}
}
- realChanges = (ICompareInput[]) result.toArray(new ICompareInput[result.size()]);
+ realChanges = result.toArray(new ICompareInput[result.size()]);
}
if (realChanges.length > 0)
inputsChanged(realChanges);
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 53fc498e1..7241a82d2 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
@@ -337,7 +337,7 @@ public class DiffTreeChangesSection extends ForwardingChangesSection implements
public void linkActivated(HyperlinkEvent e) {
ModelSynchronizeParticipant participant = (ModelSynchronizeParticipant)getConfiguration().getParticipant();
ModelProvider[] providers = participant.getEnabledModelProviders();
- Set toEnable = new HashSet();
+ Set<ITeamContentProviderDescriptor> toEnable = new HashSet<>();
toEnable.addAll(Arrays.asList(descriptors));
for (int i = 0; i < providers.length; i++) {
ModelProvider provider = providers[i];
@@ -346,9 +346,8 @@ public class DiffTreeChangesSection extends ForwardingChangesSection implements
toEnable.add(desc);
}
}
- TeamUI.getTeamContentProviderManager().setEnabledDescriptors(
- (ITeamContentProviderDescriptor[]) toEnable
- .toArray(new ITeamContentProviderDescriptor[toEnable.size()]));
+ TeamUI.getTeamContentProviderManager()
+ .setEnabledDescriptors(toEnable.toArray(new ITeamContentProviderDescriptor[toEnable.size()]));
getConfiguration().setProperty(ModelSynchronizeParticipant.P_VISIBLE_MODEL_PROVIDER, ModelSynchronizeParticipant.ALL_MODEL_PROVIDERS_VISIBLE );
}
@@ -361,14 +360,14 @@ public class DiffTreeChangesSection extends ForwardingChangesSection implements
private ITeamContentProviderDescriptor[] getEnabledContentDescriptors() {
ModelSynchronizeParticipant participant = (ModelSynchronizeParticipant)getConfiguration().getParticipant();
ModelProvider[] providers = participant.getEnabledModelProviders();
- Set result = new HashSet();
+ Set<ITeamContentProviderDescriptor> result = new HashSet<>();
for (int i = 0; i < providers.length; i++) {
ModelProvider provider = providers[i];
ITeamContentProviderDescriptor desc = TeamUI.getTeamContentProviderManager().getDescriptor(provider.getId());
if (desc != null && desc.isEnabled())
result.add(desc);
}
- return (ITeamContentProviderDescriptor[]) result.toArray(new ITeamContentProviderDescriptor[result.size()]);
+ return result.toArray(new ITeamContentProviderDescriptor[result.size()]);
}
private Composite getInitializationPane(Composite parent) {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ModelEnablementPreferencePage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ModelEnablementPreferencePage.java
index bde22f3ab..ae9b6b71a 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ModelEnablementPreferencePage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ModelEnablementPreferencePage.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
@@ -31,7 +31,7 @@ import org.eclipse.ui.*;
public class ModelEnablementPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
- private Set previosulyEnabled = new HashSet();
+ private Set<ITeamContentProviderDescriptor> previosulyEnabled = new HashSet<>();
public ModelEnablementPreferencePage() {
setTitle(TeamUIMessages.ModelEnablementPreferencePage_0);
@@ -71,7 +71,7 @@ public class ModelEnablementPreferencePage extends PreferencePage implements IWo
}
});
tableViewer.setLabelProvider(new LabelProvider() {
- Map images = new HashMap();
+ Map<ITeamContentProviderDescriptor, Image> images = new HashMap<>();
@Override
public String getText(Object element) {
if (element instanceof ITeamContentProviderDescriptor) {
@@ -97,7 +97,7 @@ public class ModelEnablementPreferencePage extends PreferencePage implements IWo
public Image getImage(Object element) {
if (element instanceof ITeamContentProviderDescriptor) {
ITeamContentProviderDescriptor desc = (ITeamContentProviderDescriptor) element;
- Image image = (Image)images.get(desc);
+ Image image = images.get(desc);
if (image == null) {
ImageDescriptor idesc = desc.getImageDescriptor();
if (idesc != null) {
@@ -155,14 +155,15 @@ public class ModelEnablementPreferencePage extends PreferencePage implements IWo
tableViewer.setCheckedElements(previosulyEnabled.toArray());
}
+ @SuppressWarnings("unchecked")
@Override
public boolean performOk() {
Object[] checked = tableViewer.getCheckedElements();
- Set nowEnabled = new HashSet();
- nowEnabled.addAll(Arrays.asList(checked));
+ Set<ITeamContentProviderDescriptor> nowEnabled = new HashSet<>();
+ nowEnabled.addAll((Collection<? extends ITeamContentProviderDescriptor>) Arrays.asList(checked));
if (hasDescriptorEnablementChanged(checked)) {
TeamUI.getTeamContentProviderManager().setEnabledDescriptors(
- (ITeamContentProviderDescriptor[]) nowEnabled.toArray(new ITeamContentProviderDescriptor[nowEnabled.size()]));
+ nowEnabled.toArray(new ITeamContentProviderDescriptor[nowEnabled.size()]));
previosulyEnabled = nowEnabled;
}
return true;
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ModelSelectionDropDownAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ModelSelectionDropDownAction.java
index 3ecb78b1d..2582965db 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ModelSelectionDropDownAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ModelSelectionDropDownAction.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
@@ -74,15 +74,12 @@ public class ModelSelectionDropDownAction extends Action implements ISynchroniza
public ModelSelectionDropDownAction(ISynchronizePageConfiguration configuration) {
Utils.initAction(this, "action.pickModels."); //$NON-NLS-1$
this.configuration = configuration;
- listener = new org.eclipse.jface.util.IPropertyChangeListener() {
- @Override
- public void propertyChange(org.eclipse.jface.util.PropertyChangeEvent event) {
- if (event.getProperty() == ModelSynchronizeParticipant.P_VISIBLE_MODEL_PROVIDER) {
- update();
- }
- if (event.getProperty().equals(ITeamContentProviderManager.PROP_ENABLED_MODEL_PROVIDERS)) {
- rebuildMenu();
- }
+ listener = event -> {
+ if (event.getProperty() == ModelSynchronizeParticipant.P_VISIBLE_MODEL_PROVIDER) {
+ update();
+ }
+ if (event.getProperty().equals(ITeamContentProviderManager.PROP_ENABLED_MODEL_PROVIDERS)) {
+ rebuildMenu();
}
};
this.configuration.addPropertyChangeListener(listener);
@@ -127,7 +124,7 @@ public class ModelSelectionDropDownAction extends Action implements ISynchroniza
}
private ModelProvider[] getEnabledModelProviders() {
- Set result = new HashSet();
+ Set<ModelProvider> result = new HashSet<>();
ModelProvider[] providers = ((ModelSynchronizeParticipant)configuration.getParticipant()).getEnabledModelProviders();
providers = ModelMergeOperation.sortByExtension(providers);
for (int i = 0; i < providers.length; i++) {
@@ -137,7 +134,7 @@ public class ModelSelectionDropDownAction extends Action implements ISynchroniza
result.add(provider);
}
}
- return (ModelProvider[]) result.toArray(new ModelProvider[result.size()]);
+ return result.toArray(new ModelProvider[result.size()]);
}
private void addModelsToMenu(ModelProvider[] modelProviders) {
@@ -208,9 +205,6 @@ public class ModelSelectionDropDownAction extends Action implements ISynchroniza
return p != null && p.equals(ITeamContentProviderManager.FLAT_LAYOUT);
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IAction#run()
- */
@Override
public void run() {
ModelProvider next = getNextProvider();
@@ -219,9 +213,6 @@ public class ModelSelectionDropDownAction extends Action implements ISynchroniza
action.run();
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.mapping.ISynchronizationScopeChangeListener#scopeChanged(org.eclipse.team.core.mapping.ISynchronizationScope, org.eclipse.core.resources.mapping.ResourceMapping[], org.eclipse.core.resources.mapping.ResourceTraversal[])
- */
@Override
public void scopeChanged(ISynchronizationScope scope, ResourceMapping[] newMappings, ResourceTraversal[] newTraversals) {
if (newMappings.length > 0) {
@@ -231,15 +222,12 @@ public class ModelSelectionDropDownAction extends Action implements ISynchroniza
private void rebuildMenu() {
Display display = TeamUIPlugin.getStandardDisplay();
- display.asyncExec(new Runnable() {
- @Override
- public void run() {
- if(menuManager != null) {
- menuManager.dispose();
- menuManager = null;
- }
- update();
+ display.asyncExec(() -> {
+ if(menuManager != null) {
+ menuManager.dispose();
+ menuManager = null;
}
+ update();
});
}
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceCompareInputChangeNotifier.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceCompareInputChangeNotifier.java
index f253c21af..820fef2d4 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceCompareInputChangeNotifier.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceCompareInputChangeNotifier.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2010 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
@@ -156,13 +156,7 @@ public class ResourceCompareInputChangeNotifier extends CompareInputChangeNotifi
}
public void fireChangeEvent(final Object element) {
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- fireLabelProviderChanged(new LabelProviderChangedEvent(CompareInputLabelProvider.this, element));
- }
-
- });
+ Display.getDefault().asyncExec(() -> fireLabelProviderChanged(new LabelProviderChangedEvent(CompareInputLabelProvider.this, element)));
}
}
@@ -208,9 +202,6 @@ public class ResourceCompareInputChangeNotifier extends CompareInputChangeNotifi
super.initialize();
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.mapping.CompareInputChangeNotifier#dispose()
- */
@Override
public void dispose() {
super.dispose();
@@ -218,12 +209,9 @@ public class ResourceCompareInputChangeNotifier extends CompareInputChangeNotifi
labelProvider.dispose();
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.diff.IDiffChangeListener#diffsChanged(org.eclipse.team.core.diff.IDiffChangeEvent, org.eclipse.core.runtime.IProgressMonitor)
- */
@Override
public void diffsChanged(IDiffChangeEvent event, IProgressMonitor monitor) {
- Set changedInputs = new HashSet();
+ Set<ICompareInput> changedInputs = new HashSet<>();
IDiff[] added = event.getAdditions();
for (int i = 0; i < added.length; i++) {
IDiff diff = added[i];
@@ -247,20 +235,14 @@ public class ResourceCompareInputChangeNotifier extends CompareInputChangeNotifi
}
if (!changedInputs.isEmpty())
- handleInputChanges((ICompareInput[]) changedInputs.toArray(new ICompareInput[changedInputs.size()]), false);
+ handleInputChanges(changedInputs.toArray(new ICompareInput[changedInputs.size()]), false);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.diff.IDiffChangeListener#propertyChanged(org.eclipse.team.core.diff.IDiffTree, int, org.eclipse.core.runtime.IPath[])
- */
@Override
public void propertyChanged(IDiffTree tree, int property, IPath[] paths) {
// Property changes are not interesting w.r.t. state changes
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.mapping.CompareInputChangeNotifier#getResources(org.eclipse.compare.structuremergeviewer.ICompareInput)
- */
@Override
protected IResource[] getResources(ICompareInput input) {
IResource resource = getResource(input);
@@ -301,9 +283,6 @@ public class ResourceCompareInputChangeNotifier extends CompareInputChangeNotifi
return null;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.mapping.CompareInputChangeNotifier#prepareInput(org.eclipse.compare.structuremergeviewer.ICompareInput, org.eclipse.core.runtime.IProgressMonitor)
- */
@Override
protected void prepareInput(ICompareInput input, IProgressMonitor monitor) {
if (input instanceof ResourceDiffCompareInput) {
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 fc478812f..c584f2ba1 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
@@ -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
@@ -36,22 +36,11 @@ public class ResourceDragAdapterAssistant extends CommonDragAdapterAssistant {
private static final Class IRESOURCE_TYPE = IResource.class;
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.navigator.CommonDragAdapterAssistant#getSupportedTransferTypes()
- */
@Override
public Transfer[] getSupportedTransferTypes() {
return SUPPORTED_TRANSFERS;
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.navigator.CommonDragAdapterAssistant#setDragData(org.eclipse.swt.dnd.DragSourceEvent,
- * org.eclipse.jface.viewers.IStructuredSelection)
- */
@Override
public boolean setDragData(DragSourceEvent anEvent,
IStructuredSelection aSelection) {
@@ -101,7 +90,7 @@ public class ResourceDragAdapterAssistant extends CommonDragAdapterAssistant {
}
private IResource[] getSelectedResources(IStructuredSelection aSelection) {
- Set resources = new LinkedHashSet();
+ Set<IResource> resources = new LinkedHashSet<>();
IResource resource = null;
for (Iterator iter = aSelection.iterator(); iter.hasNext();) {
Object selected = iter.next();
@@ -110,7 +99,7 @@ public class ResourceDragAdapterAssistant extends CommonDragAdapterAssistant {
resources.add(resource);
}
}
- return (IResource[]) resources.toArray(new IResource[resources.size()]);
+ return resources.toArray(new IResource[resources.size()]);
}
private IResource adaptToResource(Object selected) {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceMergeActionHandler.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceMergeActionHandler.java
index 7f5e0f740..be4510936 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceMergeActionHandler.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceMergeActionHandler.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
@@ -55,7 +55,7 @@ public abstract class ResourceMergeActionHandler extends MergeActionHandler impl
private IResource[] getTargetResources() {
IStructuredSelection selection = getStructuredSelection();
Object[] objects = selection.toArray();
- Set roots = new HashSet();
+ Set<IResource> roots = new HashSet<>();
for (int i = 0; i < objects.length; i++) {
Object object = objects[i];
ResourceMapping mapping = Utils.getResourceMapping(object);
@@ -75,7 +75,7 @@ public abstract class ResourceMergeActionHandler extends MergeActionHandler impl
}
}
}
- return (IResource[]) roots.toArray(new IResource[roots.size()]);
+ return roots.toArray(new IResource[roots.size()]);
}
/**
@@ -122,24 +122,14 @@ public abstract class ResourceMergeActionHandler extends MergeActionHandler impl
@Override
public void diffsChanged(IDiffChangeEvent event, IProgressMonitor monitor) {
- Utils.syncExec(new Runnable() {
- @Override
- public void run() {
- updateEnablement(getStructuredSelection());
- }
- }, (StructuredViewer)getConfiguration().getPage().getViewer());
+ Utils.syncExec((Runnable) () -> updateEnablement(getStructuredSelection()), (StructuredViewer)getConfiguration().getPage().getViewer());
}
@Override
public void propertyChange(PropertyChangeEvent event) {
if (event.getProperty() == ISynchronizePageConfiguration.P_MODE) {
- Utils.syncExec(new Runnable() {
- @Override
- public void run() {
- updateEnablement(getStructuredSelection());
- }
- }, (StructuredViewer)getConfiguration().getPage().getViewer());
+ Utils.syncExec((Runnable) () -> updateEnablement(getStructuredSelection()), (StructuredViewer)getConfiguration().getPage().getViewer());
}
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceModelLabelProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceModelLabelProvider.java
index 62ab9f12b..658593929 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceModelLabelProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceModelLabelProvider.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
@@ -69,9 +69,6 @@ public class ResourceModelLabelProvider extends
super.dispose();
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.mapping.SynchronizationOperationLabelProvider#getBaseLabelProvider()
- */
@Override
protected ILabelProvider getDelegateLabelProvider() {
if (provider == null)
@@ -79,10 +76,6 @@ public class ResourceModelLabelProvider extends
return provider ;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.mapping.AbstractSynchronizationLabelProvider#getSyncDelta(java.lang.Object)
- */
- @Override
protected IDiff getDiff(Object elementOrPath) {
IResource resource = getResource(elementOrPath);
IResourceDiffTree tree = getDiffTree(elementOrPath);
@@ -101,17 +94,11 @@ public class ResourceModelLabelProvider extends
return null;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.AbstractSynchronizeLabelProvider#isIncludeOverlays()
- */
@Override
protected boolean isIncludeOverlays() {
return true;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.AbstractSynchronizeLabelProvider#isBusy(java.lang.Object)
- */
@Override
protected boolean isBusy(Object elementOrPath) {
IResource resource = getResource(elementOrPath);
@@ -129,9 +116,6 @@ public class ResourceModelLabelProvider extends
return null;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.AbstractSynchronizeLabelProvider#hasDecendantConflicts(java.lang.Object)
- */
@Override
protected boolean hasDecendantConflicts(Object elementOrPath) {
IResource resource = getResource(elementOrPath);
@@ -152,13 +136,10 @@ public class ResourceModelLabelProvider extends
return null;
}
- /* (non-Javadoc)
- * @see org.eclipse.core.resources.IResourceChangeListener#resourceChanged(org.eclipse.core.resources.IResourceChangeEvent)
- */
@Override
public void resourceChanged(IResourceChangeEvent event) {
String[] markerTypes = new String[] {IMarker.PROBLEM};
- final Set handledResources = new HashSet();
+ final Set<IResource> handledResources = new HashSet<>();
// Accumulate all distinct resources that have had problem marker
// changes
@@ -175,19 +156,14 @@ public class ResourceModelLabelProvider extends
}
if (!handledResources.isEmpty()) {
- final IResource[] resources = (IResource[]) handledResources.toArray(new IResource[handledResources.size()]);
+ final IResource[] resources = handledResources.toArray(new IResource[handledResources.size()]);
updateLabels(resources);
}
}
protected void updateLabels(final Object[] resources) {
- Utils.asyncExec(new Runnable() {
- @Override
- public void run() {
- contentProvider.getStructuredViewer().update(
- resources, null);
- }
- }, contentProvider.getStructuredViewer());
+ Utils.asyncExec((Runnable) () -> contentProvider.getStructuredViewer().update(
+ resources, null), contentProvider.getStructuredViewer());
}
@Override
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceModelParticipantAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceModelParticipantAction.java
index c59bc0106..7d11af24b 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceModelParticipantAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceModelParticipantAction.java
@@ -103,14 +103,14 @@ public abstract class ResourceModelParticipantAction extends ModelParticipantAct
IResource resource = (IResource) o;
int depth = getTraversalCalculator().getLayoutDepth(resource, path);
IDiff[] diffs = set.getDiffTree().getDiffs(resource, depth);
- Set resources = new HashSet();
+ Set<IResource> resources = new HashSet<>();
for (int i = 0; i < diffs.length; i++) {
IDiff diff = diffs[i];
IResource r = ResourceDiffTree.getResourceFor(diff);
if (r != null)
resources.add(r);
}
- return new ResourceTraversal[] { new ResourceTraversal((IResource[]) resources.toArray(new IResource[resources.size()]), IResource.DEPTH_ZERO, IResource.NONE) };
+ return new ResourceTraversal[] { new ResourceTraversal(resources.toArray(new IResource[resources.size()]), IResource.DEPTH_ZERO, IResource.NONE) };
}
}
if (getTraversalCalculator().isResourcePath(path)) {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceModelPersistenceAdapter.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceModelPersistenceAdapter.java
index 2b4c7f125..f05b6e5c0 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceModelPersistenceAdapter.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceModelPersistenceAdapter.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
@@ -35,9 +35,6 @@ public class ResourceModelPersistenceAdapter extends SynchronizationCompareAdapt
public ResourceModelPersistenceAdapter() {
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.mapping.SynchronizationCompareAdapter#save(org.eclipse.core.resources.mapping.ResourceMapping[], org.eclipse.ui.IMemento)
- */
@Override
public void save(ResourceMapping[] mappings, IMemento memento) {
for (int i = 0; i < mappings.length; i++) {
@@ -60,13 +57,10 @@ public class ResourceModelPersistenceAdapter extends SynchronizationCompareAdapt
}
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.mapping.SynchronizationCompareAdapter#restore(org.eclipse.ui.IMemento)
- */
@Override
public ResourceMapping[] restore(IMemento memento) {
IMemento[] children = memento.getChildren(RESOURCES);
- List result = new ArrayList();
+ List<ResourceMapping> result = new ArrayList<>();
for (int i = 0; i < children.length; i++) {
IMemento child = children[i];
Integer typeInt = child.getInteger(RESOURCE_TYPE);
@@ -135,7 +129,7 @@ public class ResourceModelPersistenceAdapter extends SynchronizationCompareAdapt
TeamUIPlugin.log(e);
}
}
- return (ResourceMapping[]) result.toArray(new ResourceMapping[result.size()]);
+ return result.toArray(new ResourceMapping[result.size()]);
}
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceModelProviderOperation.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceModelProviderOperation.java
index 369806cb2..d0ca71683 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceModelProviderOperation.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceModelProviderOperation.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
@@ -51,7 +51,7 @@ public abstract class ResourceModelProviderOperation extends SynchronizationOper
* @return the file deltas contained in or descended from the selection
*/
private IDiff[] getFileDeltas(Object[] pathOrElements) {
- Set result = new HashSet();
+ Set<IDiff> result = new HashSet<>();
for (int i = 0; i < pathOrElements.length; i++) {
Object pathOrElement = pathOrElements[i];
IDiff[] diffs = getFileDeltas(pathOrElement);
@@ -60,11 +60,11 @@ public abstract class ResourceModelProviderOperation extends SynchronizationOper
result.add(node);
}
}
- return (IDiff[]) result.toArray(new IDiff[result.size()]);
+ return result.toArray(new IDiff[result.size()]);
}
private IDiff[] getFileDeltas(Object pathOrElement) {
- List result = new ArrayList();
+ List<IDiff> result = new ArrayList<>();
ResourceTraversal[] traversals = getTraversals(pathOrElement);
if (traversals.length > 0) {
ISynchronizationContext context = getContext();
@@ -77,7 +77,7 @@ public abstract class ResourceModelProviderOperation extends SynchronizationOper
result.add(node);
}
}
- return (IDiff[]) result.toArray(new IDiff[result.size()]);
+ return result.toArray(new IDiff[result.size()]);
}
/**
@@ -145,9 +145,6 @@ public abstract class ResourceModelProviderOperation extends SynchronizationOper
*/
protected abstract FastDiffFilter getDiffFilter();
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.mapping.ModelProviderOperation#shouldRun()
- */
@Override
public boolean shouldRun() {
Object[] elements = getElements();
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceModelScopeParticipant.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceModelScopeParticipant.java
index b4510b829..730960656 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceModelScopeParticipant.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceModelScopeParticipant.java
@@ -74,15 +74,15 @@ public class ResourceModelScopeParticipant implements
public ResourceMapping[] handleContextChange(
ISynchronizationScope scope, IResource[] resources,
IProject[] projects) {
- Set result = new HashSet();
+ Set<ResourceMapping> result = new HashSet<>();
for (int i = 0; i < projects.length; i++) {
IProject project = projects[i];
collectMappings(project, result);
}
- return (ResourceMapping[]) result.toArray(new ResourceMapping[result.size()]);
+ return result.toArray(new ResourceMapping[result.size()]);
}
- private void collectMappings(IProject project, Set result) {
+ private void collectMappings(IProject project, Set<ResourceMapping> result) {
ResourceMapping[] mappings = scope.getMappings(provider.getDescriptor().getId());
for (int i = 0; i < mappings.length; i++) {
ResourceMapping mapping = mappings[i];
@@ -136,13 +136,10 @@ public class ResourceModelScopeParticipant implements
PlatformUI.getWorkbench().getWorkingSetManager().removePropertyChangeListener(this);
}
- /* (non-Javadoc)
- * @see org.eclipse.core.resources.IResourceChangeListener#resourceChanged(org.eclipse.core.resources.IResourceChangeEvent)
- */
@Override
public void resourceChanged(IResourceChangeEvent event) {
// Only interested in project additions and removals
- Set result = new HashSet();
+ Set<ResourceMapping> result = new HashSet<>();
IResourceDelta[] children = event.getDelta().getAffectedChildren();
for (int i = 0; i < children.length; i++) {
IResourceDelta delta = children[i];
@@ -155,7 +152,7 @@ public class ResourceModelScopeParticipant implements
}
}
if (!result.isEmpty())
- fireChange((ResourceMapping[]) result.toArray(new ResourceMapping[result.size()]));
+ fireChange(result.toArray(new ResourceMapping[result.size()]));
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceModelTraversalCalculator.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceModelTraversalCalculator.java
index 7d63ae911..db09aa519 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceModelTraversalCalculator.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceModelTraversalCalculator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2010 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
@@ -100,7 +100,7 @@ public class ResourceModelTraversalCalculator {
}
private Object[] getCompressedChildren(IResourceDiffTree diffTree, IProject project, Object[] children) {
- Set result = new HashSet();
+ Set<Object> result = new HashSet<>();
IDiff[] diffs = diffTree.getDiffs(project, IResource.DEPTH_INFINITE);
for (int i = 0; i < diffs.length; i++) {
IDiff diff = diffs[i];
@@ -121,7 +121,7 @@ public class ResourceModelTraversalCalculator {
* Only return the files that are direct children of the folder
*/
private Object[] getCompressedChildren(IResourceDiffTree diffTree, IFolder folder, Object[] children) {
- Set result = new HashSet();
+ Set<Object> result = new HashSet<>();
for (int i = 0; i < children.length; i++) {
Object object = children[i];
if (object instanceof IResource) {
@@ -143,7 +143,7 @@ public class ResourceModelTraversalCalculator {
private Object[] getFlatChildren(IResourceDiffTree diffTree, IResource resource) {
Object[] allChildren;
IDiff[] diffs = diffTree.getDiffs(resource, IResource.DEPTH_INFINITE);
- ArrayList result = new ArrayList();
+ ArrayList<Object> result = new ArrayList<>();
for (int i = 0; i < diffs.length; i++) {
IDiff diff = diffs[i];
result.add(diffTree.getResource(diff));
@@ -153,7 +153,7 @@ public class ResourceModelTraversalCalculator {
}
private Object[] getTreeChildren(IResourceDiffTree diffTree, IResource resource, Object[] children) {
- Set result = new HashSet();
+ Set<Object> result = new HashSet<>();
for (int i = 0; i < children.length; i++) {
Object object = children[i];
result.add(object);
@@ -168,7 +168,7 @@ public class ResourceModelTraversalCalculator {
}
public static IResource[] getChildren(IResourceDiffTree diffTree, IResource resource) {
- Set result = new HashSet();
+ Set<IResource> result = new HashSet<>();
IPath[] childPaths = diffTree.getChildren(resource.getFullPath());
for (int i = 0; i < childPaths.length; i++) {
IPath path = childPaths[i];
@@ -186,7 +186,7 @@ public class ResourceModelTraversalCalculator {
}
result.add(child);
}
- return (IResource[]) result.toArray(new IResource[result.size()]);
+ return result.toArray(new IResource[result.size()]);
}
public ResourceTraversal[] getTraversals(DiffChangeSet dcs, TreePath tp) {
@@ -198,7 +198,7 @@ public class ResourceModelTraversalCalculator {
if (tp.getSegmentCount() == 1 && tp.getFirstSegment() == dcs) {
return dcs.getResources();
}
- Set result = new HashSet();
+ Set<IResource> result = new HashSet<>();
Object o = tp.getLastSegment();
if (o instanceof IResource) {
IResource resource = (IResource) o;
@@ -211,7 +211,7 @@ public class ResourceModelTraversalCalculator {
result.add(r);
}
}
- return (IResource[]) result.toArray(new IResource[result.size()]);
+ return result.toArray(new IResource[result.size()]);
}
public ResourceTraversal[] getTraversals(IResource resource, TreePath tp) {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/SynchronizationResourceMappingContext.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/SynchronizationResourceMappingContext.java
index 683681a18..26d0a1c88 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/SynchronizationResourceMappingContext.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/SynchronizationResourceMappingContext.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
@@ -44,17 +44,11 @@ public final class SynchronizationResourceMappingContext extends
this.context = context;
}
- /* (non-Javadoc)
- * @see org.eclipse.core.resources.mapping.RemoteResourceMappingContext#isThreeWay()
- */
@Override
public boolean isThreeWay() {
return context.getType() == ISynchronizationContext.THREE_WAY;
}
- /* (non-Javadoc)
- * @see org.eclipse.core.resources.mapping.RemoteResourceMappingContext#hasRemoteChange(org.eclipse.core.resources.IResource, org.eclipse.core.runtime.IProgressMonitor)
- */
@Override
public boolean hasRemoteChange(IResource resource, IProgressMonitor monitor) throws CoreException {
IDiff diff = context.getDiffTree().getDiff(resource);
@@ -66,9 +60,6 @@ public final class SynchronizationResourceMappingContext extends
return diff != null && diff.getKind() != IDiff.NO_CHANGE;
}
- /* (non-Javadoc)
- * @see org.eclipse.core.resources.mapping.RemoteResourceMappingContext#hasLocalChange(org.eclipse.core.resources.IResource, org.eclipse.core.runtime.IProgressMonitor)
- */
@Override
public boolean hasLocalChange(IResource resource, IProgressMonitor monitor) throws CoreException {
IDiff diff = context.getDiffTree().getDiff(resource);
@@ -80,9 +71,6 @@ public final class SynchronizationResourceMappingContext extends
return false;
}
- /* (non-Javadoc)
- * @see org.eclipse.core.resources.mapping.RemoteResourceMappingContext#fetchRemoteContents(org.eclipse.core.resources.IFile, org.eclipse.core.runtime.IProgressMonitor)
- */
@Override
public IStorage fetchRemoteContents(IFile file, IProgressMonitor monitor) throws CoreException {
IDiff diff = context.getDiffTree().getDiff(file);
@@ -100,9 +88,6 @@ public final class SynchronizationResourceMappingContext extends
return file;
}
- /* (non-Javadoc)
- * @see org.eclipse.core.resources.mapping.RemoteResourceMappingContext#fetchBaseContents(org.eclipse.core.resources.IFile, org.eclipse.core.runtime.IProgressMonitor)
- */
@Override
public IStorage fetchBaseContents(IFile file, IProgressMonitor monitor) throws CoreException {
IDiff diff = context.getDiffTree().getDiff(file);
@@ -124,7 +109,7 @@ public final class SynchronizationResourceMappingContext extends
@Override
public IResource[] fetchMembers(IContainer container, IProgressMonitor monitor) throws CoreException {
- Set result = new HashSet();
+ Set<IResource> result = new HashSet<>();
IResource[] children = container.members();
for (int i = 0; i < children.length; i++) {
IResource resource = children[i];
@@ -147,7 +132,7 @@ public final class SynchronizationResourceMappingContext extends
}
result.add(child);
}
- return (IResource[]) result.toArray(new IResource[result.size()]);
+ return result.toArray(new IResource[result.size()]);
}
@Override
@@ -161,13 +146,13 @@ public final class SynchronizationResourceMappingContext extends
@Override
public IProject[] getProjects() {
- Set projects = new HashSet();
+ Set<IProject> projects = new HashSet<>();
IResource[] roots = context.getScope().getRoots();
for (int i = 0; i < roots.length; i++) {
IResource resource = roots[i];
projects.add(resource.getProject());
}
- return (IProject[]) projects.toArray(new IProject[projects.size()]);
+ return projects.toArray(new IProject[projects.size()]);
}
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/SyncViewerPreferencePage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/SyncViewerPreferencePage.java
index bca7e738e..af1ff7a7b 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/SyncViewerPreferencePage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/SyncViewerPreferencePage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 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
@@ -37,9 +37,6 @@ public class SyncViewerPreferencePage extends FieldEditorPreferencePage implemen
private boolean includeDefaultLayout = true;
private static class PerspectiveDescriptorComparator implements Comparator {
- /*
- * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
- */
@Override
public int compare(Object o1, Object o2) {
if (o1 instanceof IPerspectiveDescriptor && o2 instanceof IPerspectiveDescriptor) {
@@ -58,9 +55,6 @@ public class SyncViewerPreferencePage extends FieldEditorPreferencePage implemen
setPreferenceStore(TeamUIPlugin.getPlugin().getPreferenceStore());
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
- */
@Override
public void createControl(Composite parent) {
super.createControl(parent);
@@ -68,9 +62,6 @@ public class SyncViewerPreferencePage extends FieldEditorPreferencePage implemen
PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IHelpContextIds.SYNC_PREFERENCE_PAGE);
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
- */
@Override
public void createFieldEditors() {
showSyncInLabels = new BooleanFieldEditor(SYNCVIEW_VIEW_SYNCINFO_IN_LABEL, TeamUIMessages.SyncViewerPreferencePage_19, SWT.NONE, getFieldEditorParent());
@@ -183,16 +174,10 @@ public class SyncViewerPreferencePage extends FieldEditorPreferencePage implemen
composite.setLayout(layout);
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
- */
@Override
public void init(IWorkbench workbench) {
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
- */
@Override
public void propertyChange(PropertyChangeEvent event) {
//if(event.getSource() == bkgScheduledRefresh || event.getSource() == scheduledDelay) {
@@ -201,18 +186,12 @@ public class SyncViewerPreferencePage extends FieldEditorPreferencePage implemen
super.propertyChange(event);
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferencePage#performOk()
- */
@Override
public boolean performOk() {
TeamUIPlugin.getPlugin().savePluginPreferences();
return super.performOk();
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.FieldEditorPreferencePage#checkState()
- */
@Override
protected void initialize() {
super.initialize();
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/TeamContentProviderManager.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/TeamContentProviderManager.java
index c81bb3e7e..6b6e0e939 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/TeamContentProviderManager.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/TeamContentProviderManager.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
@@ -29,9 +29,9 @@ public class TeamContentProviderManager implements ITeamContentProviderManager {
private static ITeamContentProviderManager instance;
- Map descriptors;
+ Map<String, ITeamContentProviderDescriptor> descriptors;
- private ListenerList listeners = new ListenerList(ListenerList.IDENTITY);
+ private ListenerList<IPropertyChangeListener> listeners = new ListenerList<>(ListenerList.IDENTITY);
public static ITeamContentProviderManager getInstance() {
if (instance == null)
@@ -39,37 +39,28 @@ public class TeamContentProviderManager implements ITeamContentProviderManager {
return instance;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.registry.ITeamContentProviderManager#getDescriptors()
- */
@Override
public ITeamContentProviderDescriptor[] getDescriptors() {
lazyInitialize();
- return (ITeamContentProviderDescriptor[]) descriptors.values().toArray(new ITeamContentProviderDescriptor[descriptors.size()]);
+ return descriptors.values().toArray(new ITeamContentProviderDescriptor[descriptors.size()]);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.mapping.ITeamContentProviderManager#getContentProviderIds(org.eclipse.team.core.mapping.ISynchronizationScope)
- */
@Override
public String[] getContentProviderIds(ISynchronizationScope scope) {
- List result = new ArrayList();
+ List<String> result = new ArrayList<>();
ITeamContentProviderDescriptor[] descriptors = getDescriptors();
for (int i = 0; i < descriptors.length; i++) {
ITeamContentProviderDescriptor descriptor = descriptors[i];
if (descriptor.isEnabled() && scope.getMappings(descriptor.getModelProviderId()).length > 0)
result.add(descriptor.getContentExtensionId());
}
- return (String[]) result.toArray(new String[result.size()]);
+ return result.toArray(new String[result.size()]);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.registry.ITeamContentProviderManager#getDescriptor(java.lang.String)
- */
@Override
public ITeamContentProviderDescriptor getDescriptor(String modelProviderId) {
lazyInitialize();
- return (ITeamContentProviderDescriptor)descriptors.get(modelProviderId);
+ return descriptors.get(modelProviderId);
}
protected void lazyInitialize() {
@@ -77,7 +68,7 @@ public class TeamContentProviderManager implements ITeamContentProviderManager {
return;
IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(TeamUIPlugin.ID, PT_TEAM_CONTENT_PROVIDERS);
IExtension[] extensions = point.getExtensions();
- descriptors = new HashMap(extensions.length * 2);
+ descriptors = new HashMap<>(extensions.length * 2);
for (int i = 0, imax = extensions.length; i < imax; i++) {
ITeamContentProviderDescriptor desc = null;
try {
@@ -123,7 +114,7 @@ public class TeamContentProviderManager implements ITeamContentProviderManager {
@Override
public void setEnabledDescriptors(ITeamContentProviderDescriptor[] descriptors) {
- List previouslyEnabled = new ArrayList();
+ List<ITeamContentProviderDescriptor> previouslyEnabled = new ArrayList<>();
for (Iterator iter = this.descriptors.values().iterator(); iter.hasNext();) {
TeamContentProviderDescriptor descriptor = (TeamContentProviderDescriptor) iter.next();
if (descriptor.isEnabled()) {
@@ -135,8 +126,7 @@ public class TeamContentProviderManager implements ITeamContentProviderManager {
TeamContentProviderDescriptor descriptor = (TeamContentProviderDescriptor)descriptors[i];
descriptor.setEnabled(true);
}
- enablementChanged(
- (ITeamContentProviderDescriptor[]) previouslyEnabled.toArray(new ITeamContentProviderDescriptor[previouslyEnabled.size()]),
+ enablementChanged(previouslyEnabled.toArray(new ITeamContentProviderDescriptor[previouslyEnabled.size()]),
descriptors);
}
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/AbstractSynchronizeModelProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/AbstractSynchronizeModelProvider.java
index 9b54146cb..b106f3fd6 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/AbstractSynchronizeModelProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/AbstractSynchronizeModelProvider.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
@@ -66,7 +66,7 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
private SynchronizePageActionGroup actionGroup;
- private ListenerList listeners;
+ private ListenerList<IPropertyChangeListener> listeners;
private static final boolean DEBUG = false;
@@ -386,7 +386,7 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
* after validating that the viewer is still valid.
*/
protected IResource[] getExpandedResources() {
- Set expanded = new HashSet();
+ Set<IResource> expanded = new HashSet<>();
IResource[] savedExpansionState = getCachedResources(P_VIEWER_EXPANSION_STATE);
for (int i = 0; i < savedExpansionState.length; i++) {
IResource resource = savedExpansionState[i];
@@ -399,7 +399,7 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
IResource resource = currentExpansionState[i];
expanded.add(resource);
}
- return (IResource[]) expanded.toArray(new IResource[expanded.size()]);
+ return expanded.toArray(new IResource[expanded.size()]);
}
/*
@@ -432,7 +432,7 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
* after validating that the viewer is still valid.
*/
protected void expandResources(IResource[] resources) {
- Set expandedElements = new HashSet();
+ Set<ISynchronizeModelElement> expandedElements = new HashSet<>();
StructuredViewer viewer = getViewer();
for (int j = 0; j < resources.length; j++) {
IResource resource = resources[j];
@@ -454,7 +454,7 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
}
protected IResource[] getResources(Object[] objects) {
- Set result = new HashSet();
+ Set<IResource> result = new HashSet<>();
if (objects.length > 0) {
for (int i = 0; i < objects.length; i++) {
if (objects[i] instanceof ISynchronizeModelElement) {
@@ -464,7 +464,7 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
}
}
}
- return (IResource[]) result.toArray(new IResource[result.size()]);
+ return result.toArray(new IResource[result.size()]);
}
private void clearResourceCache(String configProperty) {
@@ -474,7 +474,7 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
private void cacheResources(IResource[] resources, String configProperty) {
if (resources.length > 0) {
ISynchronizePageConfiguration config = getConfiguration();
- ArrayList paths = new ArrayList();
+ ArrayList<String> paths = new ArrayList<>();
for (int i = 0; i < resources.length; i++) {
IResource resource = resources[i];
String path = resource.getFullPath().toString();
@@ -496,7 +496,7 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
if (paths == null)
return new IResource[0];
IContainer container = ResourcesPlugin.getWorkspace().getRoot();
- ArrayList resources = new ArrayList();
+ ArrayList<IResource> resources = new ArrayList<>();
for (Iterator it = paths.iterator(); it.hasNext();) {
String path = (String) it.next();
IResource resource = getResourceForPath(container, path);
@@ -504,7 +504,7 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
resources.add(resource);
}
}
- return (IResource[]) resources.toArray(new IResource[resources.size()]);
+ return resources.toArray(new IResource[resources.size()]);
}
/**
@@ -520,15 +520,12 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
final IResource[][] expandedResources = new IResource[1][0];
final IResource[][] selectedResources = new IResource[1][0];
final IResource[][] checkedResources = new IResource[1][0];
- viewer.getControl().getDisplay().syncExec(new Runnable() {
- @Override
- public void run() {
- if (viewer != null && !viewer.getControl().isDisposed()) {
- expandedResources[0] = getExpandedResources();
- selectedResources[0] = getSelectedResources();
- if (storeChecks)
- checkedResources [0] = getCheckedResources();
- }
+ viewer.getControl().getDisplay().syncExec(() -> {
+ if (viewer != null && !viewer.getControl().isDisposed()) {
+ expandedResources[0] = getExpandedResources();
+ selectedResources[0] = getSelectedResources();
+ if (storeChecks)
+ checkedResources [0] = getCheckedResources();
}
});
@@ -565,7 +562,7 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
*/
protected void selectResources(IResource[] resourcesToSelect) {
StructuredViewer viewer = getViewer();
- final ArrayList selectedElements = new ArrayList();
+ final ArrayList<ISynchronizeModelElement> selectedElements = new ArrayList<>();
for (int i = 0; i < resourcesToSelect.length; i++) {
IResource resource = resourcesToSelect[i];
ISynchronizeModelElement[] elements = getModelObjects(resource);
@@ -583,7 +580,7 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
* only be invoked from the UI thread.
*/
protected void checkResources(IResource[] resourcesToCheck) {
- Set checkedElements = new HashSet();
+ Set<ISynchronizeModelElement> checkedElements = new HashSet<>();
StructuredViewer viewer = getViewer();
if (!(viewer instanceof CheckboxTreeViewer))
return;
@@ -630,17 +627,11 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
return resource;
}
- /* (non-Javadoc)
- * @see org.eclipse.swt.events.TreeListener#treeCollapsed(org.eclipse.swt.events.TreeEvent)
- */
@Override
public void treeCollapsed(TreeEvent e) {
clearResourceCache(P_VIEWER_EXPANSION_STATE);
}
- /* (non-Javadoc)
- * @see org.eclipse.swt.events.TreeListener#treeExpanded(org.eclipse.swt.events.TreeEvent)
- */
@Override
public void treeExpanded(TreeEvent e) {
clearResourceCache(P_VIEWER_EXPANSION_STATE);
@@ -653,9 +644,6 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
*/
protected abstract ISynchronizeModelElement[] getModelObjects(IResource resource);
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.synchronize.ISynchronizeModelProvider#saveState()
- */
@Override
public void saveState() {
saveViewerState();
@@ -701,12 +689,7 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
set.removeSyncSetChangedListener(this);
}
if (actionGroup != null) {
- Utils.syncExec(new Runnable() {
- @Override
- public void run() {
- actionGroup.dispose();
- }
- }, getViewer());
+ Utils.syncExec((Runnable) () -> actionGroup.dispose(), getViewer());
}
this.disposed = true;
}
@@ -771,35 +754,21 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
*/
protected abstract void handleResourceRemovals(ISyncInfoTreeChangeEvent event);
- /* (non-Javadoc)
- * @see org.eclipse.team.core.synchronize.ISyncInfoSetChangeListener#syncInfoChanged(org.eclipse.team.core.synchronize.ISyncInfoSetChangeEvent, org.eclipse.core.runtime.IProgressMonitor)
- */
@Override
public void syncInfoChanged(final ISyncInfoSetChangeEvent event, final IProgressMonitor monitor) {
if (! (event instanceof ISyncInfoTreeChangeEvent)) {
reset();
} else {
- updateHandler.runViewUpdate(new Runnable() {
- @Override
- public void run() {
- handleChanges((ISyncInfoTreeChangeEvent)event, monitor);
- }
- }, true /* preserve expansion */);
+ updateHandler.runViewUpdate(() -> handleChanges((ISyncInfoTreeChangeEvent)event, monitor), true /* preserve expansion */);
}
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.synchronize.ISyncInfoSetChangeListener#syncInfoSetErrors(org.eclipse.team.core.synchronize.SyncInfoSet, org.eclipse.team.core.ITeamStatus[], org.eclipse.core.runtime.IProgressMonitor)
- */
@Override
public void syncInfoSetErrors(SyncInfoSet set, ITeamStatus[] errors, IProgressMonitor monitor) {
// Not handled
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.synchronize.ISyncInfoSetChangeListener#syncInfoSetReset(org.eclipse.team.core.synchronize.SyncInfoSet, org.eclipse.core.runtime.IProgressMonitor)
- */
@Override
public void syncInfoSetReset(SyncInfoSet set, IProgressMonitor monitor) {
reset();
@@ -847,7 +816,7 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
* @param nodes the model elements to remove
*/
protected void removeFromViewer(ISynchronizeModelElement[] nodes) {
- List rootsToClear = new ArrayList();
+ List<ISynchronizeModelElement> rootsToClear = new ArrayList<>();
for (int i = 0; i < nodes.length; i++) {
ISynchronizeModelElement node = nodes[i];
if (DEBUG) {
@@ -863,7 +832,7 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
clearModelObjects(rootToClear);
rootsToClear.add(rootToClear);
}
- ISynchronizeModelElement[] roots = (ISynchronizeModelElement[]) rootsToClear.toArray(new ISynchronizeModelElement[rootsToClear.size()]);
+ ISynchronizeModelElement[] roots = rootsToClear.toArray(new ISynchronizeModelElement[rootsToClear.size()]);
if (Utils.canUpdateViewer(getViewer())) {
doRemove(roots);
}
@@ -1027,7 +996,7 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
public void addPropertyChangeListener(IPropertyChangeListener listener) {
synchronized (this) {
if (listeners == null) {
- listeners = new ListenerList(ListenerList.IDENTITY);
+ listeners = new ListenerList<>(ListenerList.IDENTITY);
}
listeners.add(listener);
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ActiveChangeSetCollector.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ActiveChangeSetCollector.java
index 39d6c6131..d403b60ea 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ActiveChangeSetCollector.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ActiveChangeSetCollector.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
@@ -41,7 +41,7 @@ public class ActiveChangeSetCollector implements IDiffChangeListener {
/*
* Map active change sets to infos displayed by the participant
*/
- private final Map activeSets = new HashMap();
+ private final Map<ChangeSet, SyncInfoSet> activeSets = new HashMap<>();
/*
* Set which contains those changes that are not part of an active set
@@ -106,7 +106,7 @@ public class ActiveChangeSetCollector implements IDiffChangeListener {
public void resourcesChanged(final ChangeSet set, final IPath[] paths) {
// Look for any resources that were removed from the set but are still out-of sync.
// Re-add those resources
- final List outOfSync = new ArrayList();
+ final List<SyncInfo> outOfSync = new ArrayList<>();
for (int i = 0; i < paths.length; i++) {
IPath path = paths[i];
if (!((DiffChangeSet)set).contains(path)) {
@@ -120,7 +120,7 @@ public class ActiveChangeSetCollector implements IDiffChangeListener {
provider.performUpdate(new IWorkspaceRunnable() {
@Override
public void run(IProgressMonitor monitor) {
- add((SyncInfo[]) outOfSync.toArray(new SyncInfo[outOfSync.size()]));
+ add(outOfSync.toArray(new SyncInfo[outOfSync.size()]));
}
}, true, true);
}
@@ -170,7 +170,7 @@ public class ActiveChangeSetCollector implements IDiffChangeListener {
public void reset(SyncInfoSet seedSet) {
// First, clean up
rootSet.clear();
- ChangeSet[] sets = (ChangeSet[]) activeSets.keySet().toArray(new ChangeSet[activeSets.size()]);
+ ChangeSet[] sets = activeSets.keySet().toArray(new ChangeSet[activeSets.size()]);
for (int i = 0; i < sets.length; i++) {
ChangeSet set = sets[i];
remove(set);
@@ -219,8 +219,8 @@ public class ActiveChangeSetCollector implements IDiffChangeListener {
* updated properly.
*/
public void handleChange(ISyncInfoSetChangeEvent event) {
- List removals = new ArrayList();
- List additions = new ArrayList();
+ List<IResource> removals = new ArrayList<>();
+ List<SyncInfo> additions = new ArrayList<>();
removals.addAll(Arrays.asList(event.getRemovedResources()));
additions.addAll(Arrays.asList(event.getAddedResources()));
SyncInfo[] changed = event.getChangedResources();
@@ -230,10 +230,10 @@ public class ActiveChangeSetCollector implements IDiffChangeListener {
removals.add(info.getLocal());
}
if (!removals.isEmpty()) {
- remove((IResource[]) removals.toArray(new IResource[removals.size()]));
+ remove(removals.toArray(new IResource[removals.size()]));
}
if (!additions.isEmpty()) {
- add((SyncInfo[]) additions.toArray(new SyncInfo[additions.size()]));
+ add(additions.toArray(new SyncInfo[additions.size()]));
}
}
@@ -249,9 +249,6 @@ public class ActiveChangeSetCollector implements IDiffChangeListener {
rootSet.removeAll(resources);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.SyncInfoSetChangeSetCollector#add(org.eclipse.team.core.synchronize.SyncInfo[])
- */
protected void add(SyncInfo[] infos) {
for (int i = 0; i < infos.length; i++) {
SyncInfo info = infos[i];
@@ -278,14 +275,14 @@ public class ActiveChangeSetCollector implements IDiffChangeListener {
private ChangeSet[] findChangeSets(SyncInfo info) {
ActiveChangeSetManager manager = getActiveChangeSetManager();
ChangeSet[] sets = manager.getSets();
- List result = new ArrayList();
+ List<ChangeSet> result = new ArrayList<>();
for (int i = 0; i < sets.length; i++) {
ChangeSet set = sets[i];
if (set.contains(info.getLocal())) {
result.add(set);
}
}
- return (ChangeSet[]) result.toArray(new ChangeSet[result.size()]);
+ return result.toArray(new ChangeSet[result.size()]);
}
/*
@@ -386,7 +383,7 @@ public class ActiveChangeSetCollector implements IDiffChangeListener {
}
/* private */ IResource[] getResources(SyncInfoSet set, IPath[] paths) {
- List result = new ArrayList();
+ List<IResource> result = new ArrayList<>();
for (int i = 0; i < paths.length; i++) {
IPath path = paths[i];
SyncInfo info = getSyncInfo(set, path);
@@ -394,7 +391,7 @@ public class ActiveChangeSetCollector implements IDiffChangeListener {
result.add(info.getLocal());
}
}
- return (IResource[]) result.toArray(new IResource[result.size()]);
+ return result.toArray(new IResource[result.size()]);
}
private SyncInfo getSyncInfo(SyncInfoSet set, IPath path) {
@@ -464,22 +461,18 @@ public class ActiveChangeSetCollector implements IDiffChangeListener {
@Override
public void diffsChanged(final IDiffChangeEvent event, IProgressMonitor monitor) {
- provider.performUpdate(new IWorkspaceRunnable() {
- @Override
- public void run(IProgressMonitor monitor) {
- ChangeSet changeSet = getChangeSet(event.getTree());
- if (changeSet != null) {
- SyncInfoSet targetSet = getSyncInfoSet(changeSet);
- if (targetSet != null) {
- targetSet.removeAll(getResources(targetSet, event.getRemovals()));
- targetSet.addAll(asSyncInfoSet(event.getAdditions()));
- targetSet.addAll(asSyncInfoSet(event.getChanges()));
- rootSet.removeAll(((IResourceDiffTree)event.getTree()).getAffectedResources());
- }
- }
- }
-
- }, true /* preserver expansion */, true /* run in UI thread */);
+ provider.performUpdate(monitor1 -> {
+ ChangeSet changeSet = getChangeSet(event.getTree());
+ if (changeSet != null) {
+ SyncInfoSet targetSet = getSyncInfoSet(changeSet);
+ if (targetSet != null) {
+ targetSet.removeAll(getResources(targetSet, event.getRemovals()));
+ targetSet.addAll(asSyncInfoSet(event.getAdditions()));
+ targetSet.addAll(asSyncInfoSet(event.getChanges()));
+ rootSet.removeAll(((IResourceDiffTree)event.getTree()).getAffectedResources());
+ }
+ }
+ }, true /* preserver expansion */, true /* run in UI thread */);
}
@Override
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/CompressedFoldersModelProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/CompressedFoldersModelProvider.java
index 93f8347dd..2685eaf34 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/CompressedFoldersModelProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/CompressedFoldersModelProvider.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
@@ -35,18 +35,12 @@ public class CompressedFoldersModelProvider extends HierarchicalModelProvider {
super(parent, resource);
}
- /* (non-Javadoc)
- * @see org.eclipse.compare.structuremergeviewer.DiffNode#getName()
- */
@Override
public String getName() {
IResource resource = getResource();
return resource.getProjectRelativePath().toString();
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.SyncInfoModelElement#getImageDescriptor(java.lang.Object)
- */
@Override
public ImageDescriptor getImageDescriptor(Object object) {
return TeamUIPlugin.getImageDescriptor(ITeamUIImages.IMG_COMPRESSED_FOLDER);
@@ -62,18 +56,12 @@ public class CompressedFoldersModelProvider extends HierarchicalModelProvider {
super(parent, info);
}
- /* (non-Javadoc)
- * @see org.eclipse.compare.structuremergeviewer.DiffNode#getName()
- */
@Override
public String getName() {
IResource resource = getResource();
return resource.getProjectRelativePath().toString();
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.SyncInfoModelElement#getImageDescriptor(java.lang.Object)
- */
@Override
public ImageDescriptor getImageDescriptor(Object object) {
return TeamUIPlugin.getImageDescriptor(ITeamUIImages.IMG_COMPRESSED_FOLDER);
@@ -108,17 +96,11 @@ public class CompressedFoldersModelProvider extends HierarchicalModelProvider {
super(parentProvider, modelRoot, configuration, set);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.synchronize.HierarchicalModelProvider#getDescriptor()
- */
@Override
public ISynchronizeModelProviderDescriptor getDescriptor() {
return compressedDescriptor;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.SyncInfoDiffNodeRoot#getSorter()
- */
@Override
public ViewerSorter getViewerSorter() {
return new SynchronizeModelElementSorter() {
@@ -132,9 +114,6 @@ public class CompressedFoldersModelProvider extends HierarchicalModelProvider {
};
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.viewers.HierarchicalModelProvider#createModelObjects(org.eclipse.compare.structuremergeviewer.DiffNode)
- */
@Override
protected IDiffElement[] createModelObjects(ISynchronizeModelElement container) {
IResource resource = null;
@@ -157,22 +136,22 @@ public class CompressedFoldersModelProvider extends HierarchicalModelProvider {
private IDiffElement[] getFolderChildren(ISynchronizeModelElement parent, IResource resource) {
// Folders will only contain out-of-sync children
IResource[] children = getSyncInfoTree().members(resource);
- List result = new ArrayList();
+ List<IDiffElement> result = new ArrayList<>();
for (int i = 0; i < children.length; i++) {
IResource child = children[i];
if (child.getType() == IResource.FILE) {
result.add(createModelObject(parent, child));
}
}
- return (IDiffElement[])result.toArray(new IDiffElement[result.size()]);
+ return result.toArray(new IDiffElement[result.size()]);
}
private IDiffElement[] getProjectChildren(ISynchronizeModelElement parent, IProject project) {
// The out-of-sync elements could possibly include the project so the code
// below is written to ignore the project
SyncInfo[] outOfSync = getSyncInfoTree().getSyncInfos(project, IResource.DEPTH_INFINITE);
- Set result = new HashSet();
- Set resourcesToShow = new HashSet();
+ Set<IDiffElement> result = new HashSet<>();
+ Set<IResource> resourcesToShow = new HashSet<>();
for (int i = 0; i < outOfSync.length; i++) {
SyncInfo info = outOfSync[i];
IResource local = info.getLocal();
@@ -191,16 +170,9 @@ public class CompressedFoldersModelProvider extends HierarchicalModelProvider {
result.add(createModelObject(parent, resource));
}
- return (IDiffElement[])result.toArray(new IDiffElement[result.size()]);
+ return result.toArray(new IDiffElement[result.size()]);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.views.HierarchicalModelProvider#createChildNode(org.eclipse.compare.structuremergeviewer.DiffNode, org.eclipse.core.resources.IResource)
- */
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.viewers.HierarchicalModelProvider#createModelObject(org.eclipse.compare.structuremergeviewer.DiffNode, org.eclipse.core.resources.IResource)
- */
@Override
protected ISynchronizeModelElement createModelObject(ISynchronizeModelElement parent, IResource resource) {
if (resource.getType() == IResource.FOLDER) {
@@ -267,15 +239,12 @@ public class CompressedFoldersModelProvider extends HierarchicalModelProvider {
}
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.sync.views.SyncSetContentProvider#handleResourceRemovals(org.eclipse.team.internal.ui.sync.views.SyncSetChangedEvent)
- */
@Override
protected void handleResourceRemovals(ISyncInfoTreeChangeEvent event) {
IResource[] roots = event.getRemovedSubtreeRoots();
// First, deal with any projects that have been removed
- List removedProjects = new ArrayList();
+ List<IResource> removedProjects = new ArrayList<>();
for (int i = 0; i < roots.length; i++) {
IResource resource = roots[i];
if (resource.getType() == IResource.PROJECT) {
@@ -285,8 +254,8 @@ public class CompressedFoldersModelProvider extends HierarchicalModelProvider {
}
IResource[] resources = event.getRemovedResources();
- List resourcesToRemove = new ArrayList();
- List resourcesToAdd = new ArrayList();
+ List<IResource> resourcesToRemove = new ArrayList<IResource>();
+ List<SyncInfo> resourcesToAdd = new ArrayList<>();
for (int i = 0; i < resources.length; i++) {
IResource resource = resources[i];
if (!removedProjects.contains(resource.getProject())) {
@@ -306,10 +275,10 @@ public class CompressedFoldersModelProvider extends HierarchicalModelProvider {
}
}
if (!resourcesToRemove.isEmpty()) {
- removeFromViewer((IResource[]) resourcesToRemove.toArray(new IResource[resourcesToRemove.size()]));
+ removeFromViewer(resourcesToRemove.toArray(new IResource[resourcesToRemove.size()]));
}
if (!resourcesToAdd.isEmpty()) {
- addResources((SyncInfo[]) resourcesToAdd.toArray(new SyncInfo[resourcesToAdd.size()]));
+ addResources(resourcesToAdd.toArray(new SyncInfo[resourcesToAdd.size()]));
}
}
@@ -347,7 +316,7 @@ public class CompressedFoldersModelProvider extends HierarchicalModelProvider {
private SyncInfo[] getSyncInfosForFileMembers(IContainer parent) {
// Check if the sync set has any file children of the parent
- List result = new ArrayList();
+ List<SyncInfo> result = new ArrayList<>();
IResource[] members = getSyncInfoTree().members(parent);
for (int i = 0; i < members.length; i++) {
SyncInfo info = getSyncInfoTree().getSyncInfo(members[i]);
@@ -358,6 +327,6 @@ public class CompressedFoldersModelProvider extends HierarchicalModelProvider {
result.addAll(Arrays.asList(this.getSyncInfosForFileMembers((IContainer)members[i])));
}
}
- return (SyncInfo[]) result.toArray(new SyncInfo[result.size()]);
+ return result.toArray(new SyncInfo[result.size()]);
}
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SyncInfoSetChangeSetCollector.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SyncInfoSetChangeSetCollector.java
index 6acc27815..58dc439ee 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SyncInfoSetChangeSetCollector.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SyncInfoSetChangeSetCollector.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
@@ -46,25 +46,16 @@ public abstract class SyncInfoSetChangeSetCollector extends ChangeSetManager {
*/
ISyncInfoSetChangeListener changeSetListener = new ISyncInfoSetChangeListener() {
- /* (non-Javadoc)
- * @see org.eclipse.team.core.synchronize.ISyncInfoSetChangeListener#syncInfoSetReset(org.eclipse.team.core.synchronize.SyncInfoSet, org.eclipse.core.runtime.IProgressMonitor)
- */
@Override
public void syncInfoSetReset(SyncInfoSet set, IProgressMonitor monitor) {
handleChangeEvent(set);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.synchronize.ISyncInfoSetChangeListener#syncInfoChanged(org.eclipse.team.core.synchronize.ISyncInfoSetChangeEvent, org.eclipse.core.runtime.IProgressMonitor)
- */
@Override
public void syncInfoChanged(ISyncInfoSetChangeEvent event, IProgressMonitor monitor) {
handleChangeEvent(event.getSet());
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.synchronize.ISyncInfoSetChangeListener#syncInfoSetErrors(org.eclipse.team.core.synchronize.SyncInfoSet, org.eclipse.team.core.ITeamStatus[], org.eclipse.core.runtime.IProgressMonitor)
- */
@Override
public void syncInfoSetErrors(SyncInfoSet set, ITeamStatus[] errors, IProgressMonitor monitor) {
// TODO Auto-generated method stub
@@ -132,9 +123,6 @@ public abstract class SyncInfoSetChangeSetCollector extends ChangeSetManager {
}
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.subscribers.ChangeSetCollector#getChangeSetChangeListener()
- */
protected ISyncInfoSetChangeListener getChangeSetChangeListener() {
return changeSetListener;
}
@@ -184,8 +172,8 @@ public abstract class SyncInfoSetChangeSetCollector extends ChangeSetManager {
* @param event the set change event.
*/
public void handleChange(ISyncInfoSetChangeEvent event) {
- List removals = new ArrayList();
- List additions = new ArrayList();
+ List<IResource> removals = new ArrayList<>();
+ List<SyncInfo> additions = new ArrayList<>();
removals.addAll(Arrays.asList(event.getRemovedResources()));
additions.addAll(Arrays.asList(event.getAddedResources()));
SyncInfo[] changed = event.getChangedResources();
@@ -195,10 +183,10 @@ public abstract class SyncInfoSetChangeSetCollector extends ChangeSetManager {
removals.add(info.getLocal());
}
if (!removals.isEmpty()) {
- remove((IResource[]) removals.toArray(new IResource[removals.size()]));
+ remove(removals.toArray(new IResource[removals.size()]));
}
if (!additions.isEmpty()) {
- add((SyncInfo[]) additions.toArray(new SyncInfo[additions.size()]));
+ add(additions.toArray(new SyncInfo[additions.size()]));
}
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeManager.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeManager.java
index 82abace0c..04147bc30 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeManager.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeManager.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
@@ -58,7 +58,7 @@ public class SynchronizeManager implements ISynchronizeManager {
/**
* Synchronize participants listeners
*/
- private ListenerList fListeners = null;
+ private ListenerList<ISynchronizeParticipantListener> fListeners = null;
/**
* Contains the participant descriptions
@@ -74,7 +74,7 @@ public class SynchronizeManager implements ISynchronizeManager {
* Contains a table of the state saved between sessions for a participant. The set is keyed
* as such {String key -> ISynchronizeParticipantReference}.
*/
- private Map participantReferences = Collections.synchronizedMap(new HashMap(10));
+ private Map<String, ISynchronizeParticipantReference> participantReferences = Collections.synchronizedMap(new HashMap<>(10));
// change notification constants
private final static int ADDED = 1;
@@ -141,7 +141,7 @@ public class SynchronizeManager implements ISynchronizeManager {
* only when the participant is required.
*/
private class ParticipantInstance implements ISynchronizeParticipantReference {
- private Map participants;
+ private Map<String, ISynchronizeParticipant> participants;
private IMemento savedState;
private SynchronizeParticipantDescriptor descriptor;
private String secondaryId;
@@ -149,7 +149,7 @@ public class SynchronizeManager implements ISynchronizeManager {
private boolean dead;
public ParticipantInstance(SynchronizeParticipantDescriptor descriptor, String secondaryId, String displayName, IMemento savedState) {
- this.participants = new HashMap();
+ this.participants = new HashMap<>();
this.secondaryId = secondaryId;
this.savedState = savedState;
this.descriptor = descriptor;
@@ -159,7 +159,7 @@ public class SynchronizeManager implements ISynchronizeManager {
public void save(IMemento memento) {
if (dead) return;
String key = Utils.getKey(descriptor.getId(), getSecondaryId());
- ISynchronizeParticipant ref = (ISynchronizeParticipant) participants.get(key);
+ ISynchronizeParticipant ref = participants.get(key);
if(ref != null) {
ref.saveState(memento);
} else if(savedState != null) {
@@ -176,30 +176,21 @@ public class SynchronizeManager implements ISynchronizeManager {
return otherRef.getId().equals(getId()) && Utils.equalObject(getSecondaryId(), otherSecondaryId);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizeParticipantReference#getId()
- */
@Override
public String getId() {
return descriptor.getId();
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizeParticipantReference#getSecondaryId()
- */
@Override
public String getSecondaryId() {
return secondaryId;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizeParticipantReference#getDisplayName()
- */
@Override
public String getDisplayName() {
String key = Utils.getKey(descriptor.getId(), getSecondaryId());
- ISynchronizeParticipant participant = (ISynchronizeParticipant) participants.get(key);
+ ISynchronizeParticipant participant = participants.get(key);
if(participant != null) {
return participant.getName();
}
@@ -208,18 +199,15 @@ public class SynchronizeManager implements ISynchronizeManager {
public boolean isInstantiated() {
String key = Utils.getKey(descriptor.getId(), getSecondaryId());
- return (ISynchronizeParticipant) participants.get(key) != null;
+ return participants.get(key) != null;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizeParticipantReference#createParticipant()
- */
@Override
public ISynchronizeParticipant getParticipant() throws TeamException {
if (dead) return null;
String key = Utils.getKey(descriptor.getId(), getSecondaryId());
try {
- ISynchronizeParticipant participant = (ISynchronizeParticipant) participants.get(key);
+ ISynchronizeParticipant participant = participants.get(key);
if (participant == null) {
participant = instantiate();
if(participant != null)
@@ -238,9 +226,6 @@ public class SynchronizeManager implements ISynchronizeManager {
participants.put(key, participant);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizeParticipantReference#getDescriptor()
- */
@Override
public ISynchronizeParticipantDescriptor getDescriptor() {
return descriptor;
@@ -282,24 +267,14 @@ public class SynchronizeManager implements ISynchronizeManager {
init();
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.team.ui.sync.ISynchronizeManager#addSynchronizeParticipantListener(org.eclipse.team.ui.sync.ISynchronizeParticipantListener)
- */
@Override
public void addSynchronizeParticipantListener(ISynchronizeParticipantListener listener) {
if (fListeners == null) {
- fListeners = new ListenerList(ListenerList.IDENTITY);
+ fListeners = new ListenerList<>(ListenerList.IDENTITY);
}
fListeners.add(listener);
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.team.ui.sync.ISynchronizeManager#removeSynchronizeParticipantListener(org.eclipse.team.ui.sync.ISynchronizeParticipantListener)
- */
@Override
public void removeSynchronizeParticipantListener(ISynchronizeParticipantListener listener) {
if (fListeners != null) {
@@ -339,15 +314,10 @@ public class SynchronizeManager implements ISynchronizeManager {
return ref;
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.team.ui.sync.ISynchronizeManager#addSynchronizeParticipants(org.eclipse.team.ui.sync.ISynchronizeParticipant[])
- */
@Override
public synchronized void addSynchronizeParticipants(ISynchronizeParticipant[] participants) {
// renamed to createSynchronizeParticipant(id)
- List added = new ArrayList(participants.length);
+ List<ISynchronizeParticipant> added = new ArrayList<>(participants.length);
for (int i = 0; i < participants.length; i++) {
ISynchronizeParticipant participant = participants[i];
String key = Utils.getKey(participant.getId(), participant.getSecondaryId());
@@ -366,7 +336,7 @@ public class SynchronizeManager implements ISynchronizeManager {
}
if (!added.isEmpty()) {
saveState();
- fireUpdate((ISynchronizeParticipant[]) added.toArray(new ISynchronizeParticipant[added.size()]), ADDED);
+ fireUpdate(added.toArray(new ISynchronizeParticipant[added.size()]), ADDED);
}
}
@@ -401,14 +371,9 @@ public class SynchronizeManager implements ISynchronizeManager {
return false;
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.team.ui.sync.ISynchronizeManager#removeSynchronizeParticipants(org.eclipse.team.ui.sync.ISynchronizeParticipant[])
- */
@Override
public synchronized void removeSynchronizeParticipants(ISynchronizeParticipant[] participants) {
- List removed = new ArrayList(participants.length);
+ List<ISynchronizeParticipant> removed = new ArrayList<>(participants.length);
for (int i = 0; i < participants.length; i++) {
ISynchronizeParticipant participant = participants[i];
String key = Utils.getKey(participant.getId(), participant.getSecondaryId());
@@ -422,48 +387,34 @@ public class SynchronizeManager implements ISynchronizeManager {
}
if (!removed.isEmpty()) {
saveState();
- fireUpdate((ISynchronizeParticipant[]) removed.toArray(new ISynchronizeParticipant[removed.size()]), REMOVED);
+ fireUpdate(removed.toArray(new ISynchronizeParticipant[removed.size()]), REMOVED);
}
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizeManager#get(java.lang.String)
- */
@Override
public ISynchronizeParticipantReference get(String id, String secondaryId) {
String key = Utils.getKey(id, secondaryId);
- return (ISynchronizeParticipantReference) participantReferences.get(key);
+ return participantReferences.get(key);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizeManager#get(java.lang.String)
- */
@Override
public ISynchronizeParticipantReference[] get(String id) {
ISynchronizeParticipantReference[] refs = getSynchronizeParticipants();
- ArrayList refsForId = new ArrayList();
+ ArrayList<ISynchronizeParticipantReference> refsForId = new ArrayList<>();
for (int i = 0; i < refs.length; i++) {
ISynchronizeParticipantReference reference = refs[i];
if(reference.getId().equals(id)) {
refsForId.add(reference);
}
}
- return (ISynchronizeParticipantReference[]) refsForId.toArray(new ISynchronizeParticipantReference[refsForId.size()]);
+ return refsForId.toArray(new ISynchronizeParticipantReference[refsForId.size()]);
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.team.ui.sync.ISynchronizeManager#getSynchronizeParticipants()
- */
@Override
public synchronized ISynchronizeParticipantReference[] getSynchronizeParticipants() {
- return (ISynchronizeParticipantReference[]) participantReferences.values().toArray(new ISynchronizeParticipantReference[participantReferences.values().size()]);
+ return participantReferences.values().toArray(new ISynchronizeParticipantReference[participantReferences.values().size()]);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizeManager#showSynchronizeViewInActivePage()
- */
@Override
public ISynchronizeView showSynchronizeViewInActivePage() {
IWorkbench workbench = TeamUIPlugin.getPlugin().getWorkbench();
@@ -679,9 +630,6 @@ public class SynchronizeManager implements ISynchronizeManager {
new SynchronizeViewPageNotifier().notify(participants, type);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizeManager#getDescriptor()
- */
@Override
public ISynchronizeParticipantDescriptor getParticipantDescriptor(String id) {
return participantRegistry.find(id);
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelProvider.java
index 3932b8ee3..c667b6c47 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelProvider.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
@@ -40,7 +40,7 @@ import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
*/
public abstract class SynchronizeModelProvider extends AbstractSynchronizeModelProvider implements ISyncInfoSetChangeListener {
- protected final Map resourceMap = Collections.synchronizedMap(new HashMap());
+ protected final Map<IResource, ISynchronizeModelElement> resourceMap = Collections.synchronizedMap(new HashMap<>());
protected static final boolean DEBUG = false;
@@ -83,12 +83,9 @@ public abstract class SynchronizeModelProvider extends AbstractSynchronizeModelP
* @return the <code>SyncInfoModelElement</code> for the given resource
*/
protected ISynchronizeModelElement getModelObject(IResource resource) {
- return (ISynchronizeModelElement) resourceMap.get(resource);
+ return resourceMap.get(resource);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.synchronize.AbstractSynchronizeModelProvider#getModelObjects(org.eclipse.core.resources.IResource)
- */
@Override
protected ISynchronizeModelElement[] getModelObjects(IResource resource) {
ISynchronizeModelElement element = getModelObject(resource);
@@ -127,7 +124,7 @@ public abstract class SynchronizeModelProvider extends AbstractSynchronizeModelP
* @param resources the resources to remove
*/
protected void removeFromViewer(IResource[] resources) {
- List elements = new ArrayList();
+ List<ISynchronizeModelElement> elements = new ArrayList<>();
for (int i = 0; i < resources.length; i++) {
IResource resource = resources[i];
ISynchronizeModelElement element = getModelObject(resource);
@@ -136,13 +133,10 @@ public abstract class SynchronizeModelProvider extends AbstractSynchronizeModelP
}
}
if (!elements.isEmpty()) {
- removeFromViewer((ISynchronizeModelElement[]) elements.toArray(new ISynchronizeModelElement[elements.size()]));
+ removeFromViewer(elements.toArray(new ISynchronizeModelElement[elements.size()]));
}
}
- /* (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);
@@ -160,18 +154,12 @@ public abstract class SynchronizeModelProvider extends AbstractSynchronizeModelP
}
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.synchronize.AbstractSynchronizeModelProvider#addToViewer(org.eclipse.team.ui.synchronize.ISynchronizeModelElement)
- */
@Override
protected void addToViewer(ISynchronizeModelElement node) {
associateDiffNode(node);
super.addToViewer(node);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.synchronize.AbstractSynchronizeModelProvider#hasViewerState()
- */
@Override
protected boolean hasViewerState() {
return ! resourceMap.isEmpty();
@@ -192,17 +180,11 @@ public abstract class SynchronizeModelProvider extends AbstractSynchronizeModelP
return new ISynchronizeModelElement[] { element };
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.synchronize.AbstractSynchronizeModelProvider#handleChanges(org.eclipse.team.core.synchronize.ISyncInfoTreeChangeEvent)
- */
@Override
protected final void handleChanges(ISyncInfoTreeChangeEvent event, IProgressMonitor monitor) {
super.handleChanges(event, monitor);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.synchronize.AbstractSynchronizeModelProvider#handleResourceChanges(org.eclipse.team.core.synchronize.ISyncInfoTreeChangeEvent)
- */
@Override
protected void handleResourceChanges(ISyncInfoTreeChangeEvent event) {
// Refresh the viewer for each changed resource
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelUpdateHandler.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelUpdateHandler.java
index 783a91a59..30c0d2fdf 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelUpdateHandler.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelUpdateHandler.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2014 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
@@ -23,7 +23,6 @@ import java.util.Set;
import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.*;
import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.AbstractTreeViewer;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.swt.custom.BusyIndicator;
@@ -51,7 +50,7 @@ public class SynchronizeModelUpdateHandler extends BackgroundEventHandler implem
private AbstractSynchronizeModelProvider provider;
- private Set pendingLabelUpdates = Collections.synchronizedSet(new HashSet());
+ private Set<ISynchronizeModelElement> pendingLabelUpdates = Collections.synchronizedSet(new HashSet<>());
// Flag to indicate the need for an early dispath in order to show
// busy for elements involved in an operation
@@ -107,14 +106,11 @@ public class SynchronizeModelUpdateHandler extends BackgroundEventHandler implem
}
}
- private IPropertyChangeListener listener = new IPropertyChangeListener() {
- @Override
- public void propertyChange(final PropertyChangeEvent event) {
- if (event.getProperty() == ISynchronizeModelElement.BUSY_PROPERTY) {
- Object source = event.getSource();
- if (source instanceof ISynchronizeModelElement)
- updateBusyState((ISynchronizeModelElement)source, ((Boolean)event.getNewValue()).booleanValue());
- }
+ private IPropertyChangeListener listener = event -> {
+ if (event.getProperty() == ISynchronizeModelElement.BUSY_PROPERTY) {
+ Object source = event.getSource();
+ if (source instanceof ISynchronizeModelElement)
+ updateBusyState((ISynchronizeModelElement)source, ((Boolean)event.getNewValue()).booleanValue());
}
};
@@ -123,7 +119,7 @@ public class SynchronizeModelUpdateHandler extends BackgroundEventHandler implem
/*
* Map used to keep track of additions so they can be added in batch at the end of the update
*/
- private Map additionsMap;
+ private Map<ISynchronizeModelElement, Set<ISynchronizeModelElement>> additionsMap;
/**
* Create the marker update handler.
@@ -152,14 +148,11 @@ public class SynchronizeModelUpdateHandler extends BackgroundEventHandler implem
return provider.getViewer();
}
- /* (non-Javadoc)
- * @see org.eclipse.core.resources.IResourceChangeListener#resourceChanged(org.eclipse.core.resources.IResourceChangeEvent)
- */
@Override
public void resourceChanged(final IResourceChangeEvent event) {
String[] markerTypes = getMarkerTypes();
- Set handledResources = new HashSet();
- Set changes = new HashSet();
+ Set<IResource> handledResources = new HashSet<>();
+ Set<ISynchronizeModelElement> changes = new HashSet<>();
// Accumulate all distinct resources that have had problem marker
// changes
@@ -182,7 +175,7 @@ public class SynchronizeModelUpdateHandler extends BackgroundEventHandler implem
}
if (!changes.isEmpty()) {
- updateMarkersFor((ISynchronizeModelElement[]) changes.toArray(new ISynchronizeModelElement[changes.size()]));
+ updateMarkersFor(changes.toArray(new ISynchronizeModelElement[changes.size()]));
}
}
@@ -194,9 +187,6 @@ public class SynchronizeModelUpdateHandler extends BackgroundEventHandler implem
queueEvent(new BusyStateChangeEvent(element, isBusy), false /* not on front of queue */);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.BackgroundEventHandler#processEvent(org.eclipse.team.internal.core.BackgroundEventHandler.Event, org.eclipse.core.runtime.IProgressMonitor)
- */
@Override
protected void processEvent(Event event, IProgressMonitor monitor) throws CoreException {
switch (event.getType()) {
@@ -247,9 +237,6 @@ public class SynchronizeModelUpdateHandler extends BackgroundEventHandler implem
return new ISynchronizeModelElement[0];
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.BackgroundEventHandler#doDispatchEvents(org.eclipse.core.runtime.IProgressMonitor)
- */
@Override
protected boolean doDispatchEvents(IProgressMonitor monitor) throws TeamException {
// Fire label changed
@@ -257,12 +244,7 @@ public class SynchronizeModelUpdateHandler extends BackgroundEventHandler implem
if (pendingLabelUpdates.isEmpty()) {
return false;
} else {
- Utils.asyncExec(new Runnable() {
- @Override
- public void run() {
- firePendingLabelUpdates();
- }
- }, getViewer());
+ Utils.asyncExec((Runnable) () -> firePendingLabelUpdates(), getViewer());
return true;
}
}
@@ -399,9 +381,6 @@ public class SynchronizeModelUpdateHandler extends BackgroundEventHandler implem
provider.getSyncInfoSet().removeSyncSetChangedListener(this);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.BackgroundEventHandler#getShortDispatchDelay()
- */
@Override
protected long getShortDispatchDelay() {
if (dispatchEarly) {
@@ -472,9 +451,6 @@ public class SynchronizeModelUpdateHandler extends BackgroundEventHandler implem
return provider2.toString();
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.synchronize.ISyncInfoSetChangeListener#syncInfoSetReset(org.eclipse.team.core.synchronize.SyncInfoSet, org.eclipse.core.runtime.IProgressMonitor)
- */
@Override
public void syncInfoSetReset(SyncInfoSet set, IProgressMonitor monitor) {
if(provider.isDisposed()) {
@@ -484,9 +460,6 @@ public class SynchronizeModelUpdateHandler extends BackgroundEventHandler implem
}
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.synchronize.ISyncInfoSetChangeListener#syncInfoChanged(org.eclipse.team.core.synchronize.ISyncInfoSetChangeEvent, org.eclipse.core.runtime.IProgressMonitor)
- */
@Override
public void syncInfoChanged(final ISyncInfoSetChangeEvent event, IProgressMonitor monitor) {
if (! (event instanceof ISyncInfoTreeChangeEvent)) {
@@ -509,9 +482,6 @@ public class SynchronizeModelUpdateHandler extends BackgroundEventHandler implem
}, true /* preserve expansion */);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.synchronize.ISyncInfoSetChangeListener#syncInfoSetErrors(org.eclipse.team.core.synchronize.SyncInfoSet, org.eclipse.team.core.ITeamStatus[], org.eclipse.core.runtime.IProgressMonitor)
- */
@Override
public void syncInfoSetErrors(SyncInfoSet set, ITeamStatus[] errors, IProgressMonitor monitor) {
// When errors occur we currently don't process them. It may be possible to decorate
@@ -539,19 +509,16 @@ public class SynchronizeModelUpdateHandler extends BackgroundEventHandler implem
}
final Control ctrl = getViewer().getControl();
if (ctrl != null && !ctrl.isDisposed()) {
- ctrl.getDisplay().syncExec(new Runnable() {
- @Override
- public void run() {
- if (!ctrl.isDisposed()) {
- BusyIndicator.showWhile(ctrl.getDisplay(), new Runnable() {
- @Override
- public void run() {
- internalRunViewUpdate(runnable, preserveExpansion);
- }
- });
- }
- }
- });
+ ctrl.getDisplay().syncExec(() -> {
+ if (!ctrl.isDisposed()) {
+ BusyIndicator.showWhile(ctrl.getDisplay(), new Runnable() {
+ @Override
+ public void run() {
+ internalRunViewUpdate(runnable, preserveExpansion);
+ }
+ });
+ }
+ });
}
}
}
@@ -579,7 +546,7 @@ public class SynchronizeModelUpdateHandler extends BackgroundEventHandler implem
selected = provider.getSelectedResources();
}
if (viewer instanceof AbstractTreeViewer && additionsMap == null)
- additionsMap = new HashMap();
+ additionsMap = new HashMap<>();
}
runnable.run();
} finally {
@@ -591,7 +558,7 @@ public class SynchronizeModelUpdateHandler extends BackgroundEventHandler implem
if (Policy.DEBUG_SYNC_MODELS) {
System.out.println("Adding child view items of " + parent.getName()); //$NON-NLS-1$
}
- Set toAdd = (Set)additionsMap.get(parent);
+ Set<ISynchronizeModelElement> toAdd = additionsMap.get(parent);
((AbstractTreeViewer)viewer).add(parent, toAdd.toArray(new Object[toAdd.size()]));
}
additionsMap = null;
@@ -635,24 +602,18 @@ public class SynchronizeModelUpdateHandler extends BackgroundEventHandler implem
* Wrap the runnable in an outer runnable that preserves expansion.
*/
private IWorkspaceRunnable getUIUpdateRunnable(final IWorkspaceRunnable runnable, final boolean preserveExpansion) {
- return new IWorkspaceRunnable() {
- @Override
- public void run(final IProgressMonitor monitor) throws CoreException {
- final CoreException[] exception = new CoreException[] { null };
- runViewUpdate(new Runnable() {
- @Override
- public void run() {
- try {
- runnable.run(monitor);
- } catch (CoreException e) {
- exception[0] = e;
- }
- }
- }, true /* preserve expansion */);
- if (exception[0] != null)
- throw exception[0];
- }
- };
+ return monitor -> {
+ final CoreException[] exception = new CoreException[] { null };
+ runViewUpdate(() -> {
+ try {
+ runnable.run(monitor);
+ } catch (CoreException e) {
+ exception[0] = e;
+ }
+ }, true /* preserve expansion */);
+ if (exception[0] != null)
+ throw exception[0];
+ };
}
/*
@@ -679,29 +640,23 @@ public class SynchronizeModelUpdateHandler extends BackgroundEventHandler implem
private void recordExpandedResources() {
final StructuredViewer viewer = getViewer();
if (viewer != null && !viewer.getControl().isDisposed() && viewer instanceof AbstractTreeViewer) {
- viewer.getControl().getDisplay().syncExec(new Runnable() {
- @Override
- public void run() {
- if (viewer != null && !viewer.getControl().isDisposed()) {
- expanded = provider.getExpandedResources();
- selected = provider.getSelectedResources();
- }
- }
- });
+ viewer.getControl().getDisplay().syncExec(() -> {
+ if (viewer != null && !viewer.getControl().isDisposed()) {
+ expanded = provider.getExpandedResources();
+ selected = provider.getSelectedResources();
+ }
+ });
}
}
private void updateView() {
// Refresh the view and then set the expansion
- runViewUpdate(new Runnable() {
- @Override
- public void run() {
- provider.getViewer().refresh();
- if (expanded != null)
- provider.expandResources(expanded);
- if (selected != null)
- provider.selectResources(selected);
- }
- }, false /* do not preserve expansion (since it is done above) */);
+ runViewUpdate(() -> {
+ provider.getViewer().refresh();
+ if (expanded != null)
+ provider.expandResources(expanded);
+ if (selected != null)
+ provider.selectResources(selected);
+ }, false /* do not preserve expansion (since it is done above) */);
}
};
}
@@ -740,9 +695,9 @@ public class SynchronizeModelUpdateHandler extends BackgroundEventHandler implem
if (Policy.DEBUG_SYNC_MODELS) {
System.out.println("Queueing view item for addition " + element.getName()); //$NON-NLS-1$
}
- Set toAdd = (Set)additionsMap.get(parent);
+ Set<ISynchronizeModelElement> toAdd = additionsMap.get(parent);
if (toAdd == null) {
- toAdd = new HashSet();
+ toAdd = new HashSet<>();
additionsMap.put(parent, toAdd);
}
toAdd.add(element);
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeView.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeView.java
index 638a37958..8bd19e955 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeView.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeView.java
@@ -60,12 +60,12 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
/**
* Map of participants to dummy participant parts (used to close pages)
*/
- private Map fParticipantToPart;
+ private Map<ISynchronizeParticipant, IWorkbenchPart> fParticipantToPart;
/**
* Map of parts to participants
*/
- private Map fPartToParticipant;
+ private Map<IWorkbenchPart, ISynchronizeParticipant> fPartToParticipant;
/**
* Drop down action to switch between participants
@@ -165,7 +165,7 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
@Override
protected void showPageRec(PageRec pageRec) {
super.showPageRec(pageRec);
- activeParticipantRef = (ISynchronizeParticipant)fPartToParticipant.get(pageRec.part);
+ activeParticipantRef = fPartToParticipant.get(pageRec.part);
updateActionEnablements();
updateTitle();
}
@@ -342,8 +342,8 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
*/
public SynchronizeView() {
super();
- fParticipantToPart = new HashMap();
- fPartToParticipant = new HashMap();
+ fParticipantToPart = new HashMap<>();
+ fPartToParticipant = new HashMap<>();
updateTitle();
}
@@ -539,7 +539,7 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
private ISynchronizeParticipantReference[] getParticipants() {
ISynchronizeManager manager = TeamUI.getSynchronizeManager();
// create pages
- List participants = new ArrayList();
+ List<ISynchronizeParticipantReference> participants = new ArrayList<>();
ISynchronizeParticipantReference[] refs = manager.getSynchronizeParticipants();
for (int i = 0; i < refs.length; i++) {
ISynchronizeParticipantReference ref =refs[i];
@@ -547,7 +547,7 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
participants.add(ref);
}
}
- return (ISynchronizeParticipantReference[]) participants.toArray(new ISynchronizeParticipantReference[participants.size()]);
+ return participants.toArray(new ISynchronizeParticipantReference[participants.size()]);
}
private boolean isAvailable() {
@@ -558,7 +558,7 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
* Method used by test cases to access the page for a participant
*/
public IPage getPage(ISynchronizeParticipant participant) {
- IWorkbenchPart part = (IWorkbenchPart)fParticipantToPart.get(participant);
+ IWorkbenchPart part = fParticipantToPart.get(participant);
if (part == null) return null;
try {
return getPageRec(part).page;
@@ -613,7 +613,7 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
@Override
public Saveable[] getSaveables() {
- Set result = new HashSet();
+ Set<Saveable> result = new HashSet<>();
for (Iterator iter = fPartToParticipant.keySet().iterator(); iter.hasNext();) {
SynchronizeViewWorkbenchPart part = (SynchronizeViewWorkbenchPart) iter.next();
Saveable saveable = getSaveable(part.getParticipant());
@@ -621,7 +621,7 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
result.add(saveable);
}
}
- return (Saveable[]) result.toArray(new Saveable[result.size()]);
+ return result.toArray(new Saveable[result.size()]);
}
private Saveable getSaveable(ISynchronizeParticipant participant) {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ChangeSetActionGroup.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ChangeSetActionGroup.java
index f13cae7c1..3eff101eb 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ChangeSetActionGroup.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ChangeSetActionGroup.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
@@ -385,11 +385,11 @@ public class ChangeSetActionGroup extends SynchronizePageActionGroup {
protected void addChangeSets(IMenuManager manager) {
ChangeSet[] sets = getActiveChangeSetManager().getSets();
- Arrays.sort(sets, new Comparator() {
+ Arrays.sort(sets, new Comparator<ChangeSet>() {
private Collator collator = Collator.getInstance();
@Override
- public int compare(Object o1, Object o2) {
- return collator.compare(((ChangeSet) o1).getName(), ((ChangeSet) o2).getName());
+ public int compare(ChangeSet o1, ChangeSet o2) {
+ return collator.compare(o1.getName(), o2.getName());
}
});
ISelection selection = getContext().getSelection();
@@ -481,7 +481,7 @@ public class ChangeSetActionGroup extends SynchronizePageActionGroup {
}
private IDiff[] getDiffs(IResource[] resources) {
- List diffs = new ArrayList();
+ List<IDiff> diffs = new ArrayList<>();
Subscriber s = ((SubscriberParticipant)getConfiguration().getParticipant()).getSubscriber();
for (int i = 0; i < resources.length; i++) {
IResource resource = resources[i];
@@ -493,8 +493,7 @@ public class ChangeSetActionGroup extends SynchronizePageActionGroup {
TeamUIPlugin.log(e);
}
}
- IDiff[] diffArray = (IDiff[]) diffs
- .toArray(new IDiff[diffs.size()]);
+ IDiff[] diffArray = diffs.toArray(new IDiff[diffs.size()]);
return diffArray;
}
}
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 341ec0781..02b5c3200 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 IBM Corporation and others.
+ * Copyright (c) 2009, 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
@@ -128,7 +128,7 @@ public class ApplyPatchSubscriber extends Subscriber {
IContainer container = (IContainer) resource;
// workspace container members
- List existingChildren = new ArrayList();
+ List<IResource> existingChildren = new ArrayList<>();
if (container.isAccessible())
existingChildren.addAll(Arrays.asList(container.members()));
@@ -144,7 +144,7 @@ public class ApplyPatchSubscriber extends Subscriber {
}
}
}
- return (IResource[]) existingChildren.toArray(new IResource[existingChildren.size()]);
+ return existingChildren.toArray(new IResource[existingChildren.size()]);
} catch (CoreException e) {
throw TeamException.asTeamException(e);
}
@@ -167,7 +167,7 @@ public class ApplyPatchSubscriber extends Subscriber {
@Override
public IResource[] roots() {
- Set roots = new HashSet();
+ Set<IResource> roots = new HashSet<>();
if (getPatcher().isWorkspacePatch()) {
IDiffElement[] children = PatchModelProvider.getPatchWorkspace(this).getChildren();
for (int i = 0; i < children.length; i++) {
@@ -180,7 +180,7 @@ public class ApplyPatchSubscriber extends Subscriber {
} else {
roots.add(getPatcher().getTarget());
}
- return (IResource[]) roots.toArray(new IResource[0]);
+ return roots.toArray(new IResource[0]);
}
public WorkspacePatcher getPatcher() {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ProjectSetExportWizard.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ProjectSetExportWizard.java
index ed5f0cfe4..3a972d55c 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ProjectSetExportWizard.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ProjectSetExportWizard.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
@@ -92,20 +92,15 @@ public class ProjectSetExportWizard extends Wizard implements IExportWizard {
}
// Hash the projects by provider
IProject[] projects = mainPage.getSelectedProjects();
- Map map = new HashMap();
+ Map<String, Set<IProject>> map = new HashMap<>();
for (int i = 0; i < projects.length; i++) {
IProject project = projects[i];
RepositoryProvider provider = RepositoryProvider.getProvider(project);
if (provider != null) {
String id = provider.getID();
- Set list = (Set)map.get(id);
+ Set<IProject> list = map.get(id);
if (list == null) {
- list = new TreeSet(new Comparator() {
- @Override
- public int compare(Object o1, Object o2) {
- return ((IProject) o1).getName().toLowerCase().compareTo(((IProject) o2).getName().toLowerCase());
- }
- });
+ list = new TreeSet<>((o1, o2) -> o1.getName().toLowerCase().compareTo(o2.getName().toLowerCase()));
map.put(id, list);
}
list.add(project);
@@ -130,8 +125,8 @@ public class ProjectSetExportWizard extends Wizard implements IExportWizard {
String id = (String)it.next();
IMemento memento = xmlMemento.createChild("provider"); //$NON-NLS-1$
memento.putString("id", id); //$NON-NLS-1$
- Set list = (Set)map.get(id);
- IProject[] projectArray = (IProject[])list.toArray(new IProject[list.size()]);
+ Set<IProject> list = map.get(id);
+ IProject[] projectArray = list.toArray(new IProject[list.size()]);
RepositoryProviderType providerType = RepositoryProviderType.getProviderType(id);
ProjectSetCapability serializer = providerType.getProjectSetCapability();
ProjectSetCapability.ensureBackwardsCompatible(providerType, serializer);
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/PsfStore.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/PsfStore.java
index 023178cc1..552923f30 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/PsfStore.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/PsfStore.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
@@ -49,7 +49,7 @@ public abstract class PsfStore {
}
public void remember(String filename) {
- Vector filenames = createVector(getHistory());
+ Vector<String> filenames = createVector(getHistory());
if (filenames.contains(filename)) {
// The item is in the list. Remove it and add it back at the
// beginning. If it already was at the beginning this will be a
@@ -65,15 +65,15 @@ public abstract class PsfStore {
}
// Make it an array
- String[] arr = (String[]) filenames.toArray(new String[filenames.size()]);
+ String[] arr = filenames.toArray(new String[filenames.size()]);
IDialogSettings section = getSettingsSection();
section.put(getListTag(), arr);
section.put(getPreviousTag(), filename);
}
- private Vector createVector(Object[] arr) {
- Vector v = new Vector();
+ private Vector<String> createVector(String[] arr) {
+ Vector<String> v = new Vector<>();
for (int ix = 0; ix < arr.length; ++ix) {
v.add(ix, arr[ix]);
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/TeamUI.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/TeamUI.java
index fa1561e98..c4a6ad0a4 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/TeamUI.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/TeamUI.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
@@ -166,7 +166,7 @@ public class TeamUI {
.getConfigurationElementsFor(TeamUIPlugin.PLUGIN_ID,
IScmUrlImportWizardPage.ATT_EXTENSION);
if (elements.length > 0) {
- Set/* <IScmUrlImportWizardPage> */pages = new HashSet();
+ Set<IScmUrlImportWizardPage> pages = new HashSet<>();
for (int i = 0; i < elements.length; i++) {
String pageImporterId = elements[i]
.getAttribute(IScmUrlImportWizardPage.ATT_IMPORTER);
@@ -177,8 +177,7 @@ public class TeamUI {
pages.add(page);
}
}
- return (IScmUrlImportWizardPage[]) pages
- .toArray(new IScmUrlImportWizardPage[pages.size()]);
+ return pages.toArray(new IScmUrlImportWizardPage[pages.size()]);
}
return null;
}
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 8d13f95af..09c912cb5 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
@@ -225,7 +225,7 @@ public abstract class RevisionAnnotationController {
private static IEditorPart[] findOpenEditorsForFile(IWorkbenchPage page, FileEditorInput input) {
final IEditorReference[] references= page.findEditors(input, null, IWorkbenchPage.MATCH_INPUT);
- final List editors = new ArrayList();
+ final List<IEditorPart> editors = new ArrayList<>();
for (int i= 0; i < references.length; i++) {
IEditorReference reference= references[i];
IEditorPart editor= reference.getEditor(false);
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/SynchronizationContentProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/SynchronizationContentProvider.java
index 420e22f6b..7ff645c82 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/SynchronizationContentProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/SynchronizationContentProvider.java
@@ -449,7 +449,7 @@ public abstract class SynchronizationContentProvider implements ICommonContentPr
* scope of the content provider
*/
protected Object[] getChildrenInScope(ISynchronizationScope scope, Object parent, Object[] children) {
- List result = new ArrayList();
+ List<Object> result = new ArrayList<>();
for (int i = 0; i < children.length; i++) {
Object object = children[i];
if (object != null && isInScope(scope, parent, object)) {
@@ -489,7 +489,7 @@ public abstract class SynchronizationContentProvider implements ICommonContentPr
return children;
if (children.length == 0)
return setChildren;
- Set result = new HashSet(children.length);
+ Set<Object> result = new HashSet<>(children.length);
for (int i = 0; i < children.length; i++) {
result.add(children[i]);
}
@@ -500,7 +500,7 @@ public abstract class SynchronizationContentProvider implements ICommonContentPr
}
private Object[] internalGetChildren(ISynchronizationContext context, Object parent, Object[] children) {
- List result = new ArrayList(children.length);
+ List<Object> result = new ArrayList<>(children.length);
for (int i = 0; i < children.length; i++) {
Object object = children[i];
// If the parent is a TreePath then the subclass is
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SubscriberParticipant.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SubscriberParticipant.java
index c0e7137db..b8b9817a1 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SubscriberParticipant.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SubscriberParticipant.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
@@ -122,9 +122,6 @@ public abstract class SubscriberParticipant extends AbstractSynchronizeParticipa
scope.addPropertyChangeListener(this);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.sync.ISynchronizeViewPage#createPage(org.eclipse.team.ui.sync.ISynchronizeView)
- */
@Override
public final IPageBookViewPage createPage(ISynchronizePageConfiguration configuration) {
validateConfiguration(configuration);
@@ -202,9 +199,6 @@ public abstract class SubscriberParticipant extends AbstractSynchronizeParticipa
return job.run(monitor);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.sync.AbstractSynchronizeViewPage#dispose()
- */
@Override
public void dispose() {
Job.getJobManager().cancel(this);
@@ -214,9 +208,6 @@ public abstract class SubscriberParticipant extends AbstractSynchronizeParticipa
scope.dispose();
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.AbstractSynchronizeParticipant#getName()
- */
@Override
public String getName() {
String name = super.getName();
@@ -286,9 +277,6 @@ public abstract class SubscriberParticipant extends AbstractSynchronizeParticipa
return null;
}
- /* (non-Javadoc)
- * @see IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
- */
@Override
public void propertyChange(PropertyChangeEvent event) {
if (event.getProperty().equals(TeamUI.GLOBAL_IGNORES_CHANGED)) {
@@ -304,9 +292,6 @@ public abstract class SubscriberParticipant extends AbstractSynchronizeParticipa
}
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizeParticipant#init(org.eclipse.ui.IMemento)
- */
@Override
public void init(String secondaryId, IMemento memento) throws PartInitException {
super.init(secondaryId, memento);
@@ -321,9 +306,6 @@ public abstract class SubscriberParticipant extends AbstractSynchronizeParticipa
}
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizeParticipant#saveState(org.eclipse.ui.IMemento)
- */
@Override
public void saveState(IMemento memento) {
super.saveState(memento);
@@ -376,17 +358,11 @@ public abstract class SubscriberParticipant extends AbstractSynchronizeParticipa
return refreshSchedule;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.AbstractSynchronizeParticipant#initializeConfiguration(org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration)
- */
@Override
protected void initializeConfiguration(ISynchronizePageConfiguration configuration) {
configuration.setProperty(SynchronizePageConfiguration.P_PARTICIPANT_SYNC_INFO_SET, collector.getSyncInfoSet());
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizeParticipant#run(org.eclipse.ui.IWorkbenchPart)
- */
@Override
public void run(IWorkbenchPart part) {
refresh(getResources(), null, null, part != null ? part.getSite() : null);
@@ -531,13 +507,11 @@ public abstract class SubscriberParticipant extends AbstractSynchronizeParticipa
return scope;
}
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.PlatformObject#getAdapter(java.lang.Class)
- */
+ @SuppressWarnings("unchecked")
@Override
- public Object getAdapter(Class adapter) {
+ public <T> T getAdapter(Class<T> adapter) {
if (adapter == IRefreshable.class && refreshSchedule != null) {
- return refreshSchedule.getRefreshable();
+ return (T) refreshSchedule.getRefreshable();
}
return super.getAdapter(adapter);
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoCompareInput.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoCompareInput.java
index 04a9037c1..80bd9208f 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoCompareInput.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoCompareInput.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
@@ -105,9 +105,6 @@ public final class SyncInfoCompareInput extends SaveableCompareEditorInput imple
this.synchronizeConfiguration = configuration;
}
- /* (non-Javadoc)
- * @see org.eclipse.compare.CompareEditorInput#handleDispose()
- */
@Override
protected void handleDispose() {
super.handleDispose();
@@ -123,13 +120,12 @@ public final class SyncInfoCompareInput extends SaveableCompareEditorInput imple
}
}
}
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
- */
+
+ @SuppressWarnings("unchecked")
@Override
- public Object getAdapter(Class adapter) {
+ public <T> T getAdapter(Class<T> adapter) {
if (IFile.class.equals(adapter) && resource.getType() == IResource.FILE) {
- return resource;
+ return (T) resource;
}
return super.getAdapter(adapter);
}
@@ -165,9 +161,6 @@ public final class SyncInfoCompareInput extends SaveableCompareEditorInput imple
}
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.SaveableCompareEditorInput#internalPrepareInput(org.eclipse.core.runtime.IProgressMonitor)
- */
@Override
protected ICompareInput prepareCompareInput(IProgressMonitor monitor)
throws InvocationTargetException, InterruptedException {
@@ -191,19 +184,11 @@ public final class SyncInfoCompareInput extends SaveableCompareEditorInput imple
return node;
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.IEditorInput#getToolTipText()
- */
@Override
public String getToolTipText() {
return NLS.bind(TeamUIMessages.SyncInfoCompareInput_tooltip, new String[] { Utils.shortenText(30, description), node.getResource().getFullPath().toString() });
}
- /*
- * (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
@Override
public boolean equals(Object other) {
if (other == this)
@@ -219,11 +204,6 @@ public final class SyncInfoCompareInput extends SaveableCompareEditorInput imple
return false;
}
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#hashCode()
- */
@Override
public int hashCode() {
return getSyncInfo().hashCode();
@@ -233,17 +213,11 @@ public final class SyncInfoCompareInput extends SaveableCompareEditorInput imple
return node.getSyncInfo();
}
- /* (non-Javadoc)
- * @see org.eclipse.compare.CompareEditorInput#canRunInBackground()
- */
@Override
public boolean canRunAsJob() {
return true;
}
- /* (non-Javadoc)
- * @see org.eclipse.compare.CompareEditorInput#getNavigator()
- */
@Override
public synchronized ICompareNavigator getNavigator() {
if (synchronizeConfiguration != null && isSelectedInSynchronizeView()) {
@@ -269,9 +243,6 @@ public final class SyncInfoCompareInput extends SaveableCompareEditorInput imple
return false;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.SaveableCompareEditorInput#fireInputChange()
- */
@Override
protected void fireInputChange() {
node.fireChange();
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SynchronizeModelAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SynchronizeModelAction.java
index 226ef8164..5f8e593fd 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SynchronizeModelAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SynchronizeModelAction.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
@@ -202,7 +202,7 @@ public abstract class SynchronizeModelAction extends BaseSelectionListenerAction
*/
protected final IDiffElement[] getFilteredDiffElements() {
IDiffElement[] elements = getSelectedDiffElements();
- List filtered = new ArrayList();
+ List<IDiffElement> filtered = new ArrayList<>();
for (int i = 0; i < elements.length; i++) {
IDiffElement e = elements[i];
if (e instanceof SyncInfoModelElement) {
@@ -212,7 +212,7 @@ public abstract class SynchronizeModelAction extends BaseSelectionListenerAction
}
}
}
- return (IDiffElement[]) filtered.toArray(new IDiffElement[filtered.size()]);
+ return filtered.toArray(new IDiffElement[filtered.size()]);
}
/**
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SynchronizeModelOperation.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SynchronizeModelOperation.java
index 60530a3c7..7f4d35887 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SynchronizeModelOperation.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SynchronizeModelOperation.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
@@ -83,18 +83,12 @@ public abstract class SynchronizeModelOperation extends TeamOperation {
return makeSyncInfoSetFromSelection(getSyncInfos());
}
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.jobs.JobChangeAdapter#scheduled(org.eclipse.core.runtime.jobs.IJobChangeEvent)
- */
@Override
public void scheduled(IJobChangeEvent event) {
super.scheduled(event);
markBusy(elements, true);
}
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.jobs.JobChangeAdapter#done(org.eclipse.core.runtime.jobs.IJobChangeEvent)
- */
@Override
public void done(IJobChangeEvent event) {
markBusy(elements, false);
@@ -116,14 +110,14 @@ public abstract class SynchronizeModelOperation extends TeamOperation {
* @return the selected SyncInfo for which this action is enabled.
*/
private SyncInfo[] getSyncInfos() {
- List filtered = new ArrayList();
+ List<SyncInfo> filtered = new ArrayList<>();
for (int i = 0; i < elements.length; i++) {
IDiffElement e = elements[i];
if (e instanceof SyncInfoModelElement) {
filtered.add(((SyncInfoModelElement)e).getSyncInfo());
}
}
- return (SyncInfo[]) filtered.toArray(new SyncInfo[filtered.size()]);
+ return filtered.toArray(new SyncInfo[filtered.size()]);
}
/*
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamStateChangeEvent.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamStateChangeEvent.java
index 712acf963..2a6c23a28 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamStateChangeEvent.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamStateChangeEvent.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
@@ -26,9 +26,9 @@ import org.eclipse.team.ui.mapping.ITeamStateChangeEvent;
*/
public class TeamStateChangeEvent implements ITeamStateChangeEvent {
- private Set changes = new HashSet();
- private Set addedRoots = new HashSet();
- private Set removedRoots = new HashSet();
+ private Set<IResource> changes = new HashSet<>();
+ private Set<IResource> addedRoots = new HashSet<>();
+ private Set<IResource> removedRoots = new HashSet<>();
public TeamStateChangeEvent() {
super();
@@ -80,33 +80,21 @@ public class TeamStateChangeEvent implements ITeamStateChangeEvent {
addedRoots.add(resource);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.mapping.IDecoratedStateChangeEvent#getAddedRoots()
- */
@Override
public IResource[] getAddedRoots() {
- return (IResource[]) addedRoots.toArray(new IResource[addedRoots.size()]);
+ return addedRoots.toArray(new IResource[addedRoots.size()]);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.mapping.IDecoratedStateChangeEvent#getRemovedRoots()
- */
@Override
public IResource[] getRemovedRoots() {
- return (IResource[]) removedRoots.toArray(new IResource[removedRoots.size()]);
+ return removedRoots.toArray(new IResource[removedRoots.size()]);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.mapping.IDecoratedStateChangeEvent#getChangedResources()
- */
@Override
public IResource[] getChangedResources() {
- return (IResource[]) changes.toArray(new IResource[changes.size()]);
+ return changes.toArray(new IResource[changes.size()]);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.mapping.IDecoratedStateChangeEvent#hasChange(org.eclipse.core.resources.IResource)
- */
@Override
public boolean hasChange(IResource resource) {
if (changes.contains(resource))
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamStateDescription.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamStateDescription.java
index 6cfecf84c..6c30f92e5 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamStateDescription.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamStateDescription.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
@@ -26,7 +26,7 @@ import org.eclipse.team.ui.mapping.ITeamStateDescription;
public class TeamStateDescription implements ITeamStateDescription {
private int state;
- private Map properties = new HashMap();
+ private Map<String, Object> properties = new HashMap<>();
/**
* Create a description with the given state.
@@ -36,41 +36,26 @@ public class TeamStateDescription implements ITeamStateDescription {
this.state = state;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.mapping.IDecoratedStateDescription#getStateFlags()
- */
@Override
public int getStateFlags() {
return state;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.mapping.IDecoratedStateDescription#getKind()
- */
@Override
public int getKind() {
return getStateFlags() & Diff.KIND_MASK;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.mapping.IDecoratedStateDescription#getDirection()
- */
@Override
public int getDirection() {
return getStateFlags() & IThreeWayDiff.DIRECTION_MASK;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.mapping.ITeamStateDescription#getProperties()
- */
@Override
public String[] getPropertyNames() {
- return (String[]) properties.keySet().toArray(new String[properties.size()]);
+ return properties.keySet().toArray(new String[properties.size()]);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.mapping.ITeamStateDescription#getProperty(java.lang.String)
- */
@Override
public Object getProperty(String property) {
return properties.get(property);
@@ -85,9 +70,6 @@ public class TeamStateDescription implements ITeamStateDescription {
properties.put(property, value);
}
- /* (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
@Override
public boolean equals(Object obj) {
if (obj instanceof TeamStateDescription) {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamStateProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamStateProvider.java
index b920c25da..cfd75ea7d 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamStateProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamStateProvider.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
@@ -38,7 +38,7 @@ import org.eclipse.ui.PlatformUI;
*/
public abstract class TeamStateProvider implements ITeamStateProvider {
- private ListenerList listeners = new ListenerList(ListenerList.IDENTITY);
+ private ListenerList<ITeamStateChangeListener> listeners = new ListenerList<>(ListenerList.IDENTITY);
/**
* Determine if the decorator for the element is enabled by consulting the
@@ -76,17 +76,11 @@ public abstract class TeamStateProvider implements ITeamStateProvider {
return 0;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.mapping.ITeamStateProvider#addDecoratedStateChangeListener(org.eclipse.team.ui.mapping.ITeamStateChangeListener)
- */
@Override
public void addDecoratedStateChangeListener(ITeamStateChangeListener listener) {
listeners.add(listener);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.mapping.ITeamStateProvider#removeDecoratedStateChangeListener(org.eclipse.team.ui.mapping.ITeamStateChangeListener)
- */
@Override
public void removeDecoratedStateChangeListener(ITeamStateChangeListener listener) {
listeners.remove(listener);
@@ -132,14 +126,14 @@ public abstract class TeamStateProvider implements ITeamStateProvider {
}
private String[] getProviderIds(IProject[] projects) {
- Set providerIds = new HashSet();
+ Set<String> providerIds = new HashSet<>();
for (int i = 0; i < projects.length; i++) {
IProject project = projects[i];
String id = getProviderId(project);
if (id != null)
providerIds.add(id);
}
- return (String[]) providerIds.toArray(new String[providerIds.size()]);
+ return providerIds.toArray(new String[providerIds.size()]);
}
private String getProviderId(IProject project) {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/WorkingSetScope.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/WorkingSetScope.java
index c02384432..4892ced72 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/WorkingSetScope.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/WorkingSetScope.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,9 +67,6 @@ public class WorkingSetScope extends AbstractSynchronizeScope implements IProper
PlatformUI.getWorkbench().getWorkingSetManager().addPropertyChangeListener(this);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizeScope#getName()
- */
@Override
public String getName() {
if (sets.length == 0) {
@@ -86,24 +83,21 @@ public class WorkingSetScope extends AbstractSynchronizeScope implements IProper
return name.toString();
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizeScope#getRoots()
- */
@Override
public IResource[] getRoots() {
if (sets.length == 0) {
return null;
}
- HashSet roots = new HashSet();
+ HashSet<IResource> roots = new HashSet<>();
for (int i = 0; i < sets.length; i++) {
IWorkingSet set = sets[i];
IResource[] resources = Utils.getResources(set.getElements());
addNonOverlapping(roots, resources);
}
- return (IResource[]) roots.toArray(new IResource[roots.size()]);
+ return roots.toArray(new IResource[roots.size()]);
}
- private void addNonOverlapping(HashSet roots, IResource[] resources) {
+ private void addNonOverlapping(HashSet<IResource> roots, IResource[] resources) {
for (int i = 0; i < resources.length; i++) {
IResource newResource = resources[i];
boolean add = true;
@@ -130,9 +124,6 @@ public class WorkingSetScope extends AbstractSynchronizeScope implements IProper
}
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
- */
@Override
public void propertyChange(PropertyChangeEvent event) {
if (event.getProperty() == IWorkingSetManager.CHANGE_WORKING_SET_CONTENT_CHANGE) {
@@ -149,9 +140,6 @@ public class WorkingSetScope extends AbstractSynchronizeScope implements IProper
}
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizeScope#dispose()
- */
@Override
public void dispose() {
super.dispose();
@@ -159,9 +147,6 @@ public class WorkingSetScope extends AbstractSynchronizeScope implements IProper
PlatformUI.getWorkbench().getWorkingSetManager().removePropertyChangeListener(this);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.AbstractSynchronizeScope#saveState(org.eclipse.ui.IMemento)
- */
@Override
public void saveState(IMemento memento) {
super.saveState(memento);
@@ -172,16 +157,12 @@ public class WorkingSetScope extends AbstractSynchronizeScope implements IProper
}
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.AbstractSynchronizeScope#init(org.eclipse.ui.IMemento)
- */
@Override
protected void init(IMemento memento) {
super.init(memento);
IMemento[] rootNodes = memento.getChildren(CTX_SETS);
if (rootNodes != null) {
- List sets = new ArrayList();
+ List<IWorkingSet> sets = new ArrayList<>();
for (int i = 0; i < rootNodes.length; i++) {
IMemento rootNode = rootNodes[i];
String setName = rootNode.getString(CTX_SET_NAME);
@@ -190,7 +171,7 @@ public class WorkingSetScope extends AbstractSynchronizeScope implements IProper
sets.add(set);
}
}
- setWorkingSets((IWorkingSet[]) sets.toArray(new IWorkingSet[sets.size()]));
+ setWorkingSets(sets.toArray(new IWorkingSet[sets.size()]));
}
}
}

Back to the top