Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2017-07-19 06:19:49 -0400
committerAlexander Kurtakov2017-07-19 06:19:49 -0400
commit19a5138a13cf4f17cceb807bd902363b846a76ef (patch)
tree69d40dcae0c7a99c5413f8436147751212948387 /bundles
parent39d6760d33c8eecafd04de3c321729daee7acddf (diff)
downloadeclipse.platform.team-19a5138a13cf4f17cceb807bd902363b846a76ef.tar.gz
eclipse.platform.team-19a5138a13cf4f17cceb807bd902363b846a76ef.tar.xz
eclipse.platform.team-19a5138a13cf4f17cceb807bd902363b846a76ef.zip
Bug 519875 - Cleanup o.e.team.ui
* Remove unneeded casts. * Remove useless non-javadoc see tags. * Convert to lambda where noticed. * Generify some getAdapter implementations. Change-Id: Ia661d056034f1716fb4bcb119600ff8a895b172b 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/DiffTreeChangesSection.java24
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ModelCompareEditorInput.java50
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ModelSynchronizePage.java18
-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/ResourceModelScopeParticipant.java4
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/LocalResourceSaveableComparison.java40
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SaveablesCompareEditorInput.java86
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SubscriberRefreshSchedule.java4
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelElement.java15
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeView.java154
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/GlobalRefreshAction.java64
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenWithActionGroup.java5
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/PasteAction.java14
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RefactorActionGroup.java7
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ShowSynchronizeParticipantAction.java4
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/FilePatchResourceMapping.java4
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/HunkResourceMapping.java5
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigurationWizardElement.java17
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigureProjectWizard.java13
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigureProjectWizardMainPage.java65
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ExportProjectSetMainPage.java229
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/PageSaveablePart.java14
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/history/HistoryPageCompareEditorInput.java45
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/history/HistoryPageSaveablePart.java31
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/history/HistoryPageSource.java8
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/history/RevisionAnnotationController.java59
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/SynchronizationCompareAdapter.java20
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/SynchronizationContentProvider.java58
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/AbstractSynchronizeParticipant.java47
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ModelMergeOperation.java63
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ModelSynchronizeParticipant.java51
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ParticipantPageCompareEditorInput.java56
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ParticipantPageSaveablePart.java59
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SubscriberTeamStateProvider.java19
34 files changed, 369 insertions, 987 deletions
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 be4f1c733..53fc498e1 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 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
@@ -139,7 +139,7 @@ public class DiffTreeChangesSection extends ForwardingChangesSection implements
}
private boolean hasChangesFor(String id, ISynchronizationCompareAdapter adapter, ISynchronizationContext context, int[] states, int mask) {
- ITraversalFactory factory = (ITraversalFactory)Adapters.adapt(adapter, ITraversalFactory.class);
+ ITraversalFactory factory = Adapters.adapt(adapter, ITraversalFactory.class);
ResourceTraversal[] traversals;
if (factory == null) {
traversals = context.getScope().getTraversals(id);
@@ -456,7 +456,7 @@ public class DiffTreeChangesSection extends ForwardingChangesSection implements
}
private SubscriberDiffTreeEventHandler getHandler() {
- return (SubscriberDiffTreeEventHandler)Adapters.adapt(context, SubscriberDiffTreeEventHandler.class);
+ return Adapters.adapt(context, SubscriberDiffTreeEventHandler.class);
}
private Composite getPointerToModel(Composite parent, final ModelProvider provider, String oldId) {
@@ -511,12 +511,9 @@ public class DiffTreeChangesSection extends ForwardingChangesSection implements
private void handleEmptyViewer() {
// Override stand behavior to do our best to show something
- TeamUIPlugin.getStandardDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- if (!getContainer().isDisposed())
- updatePage(getEmptyChangesComposite(getContainer()));
- }
+ TeamUIPlugin.getStandardDisplay().asyncExec(() -> {
+ if (!getContainer().isDisposed())
+ updatePage(getEmptyChangesComposite(getContainer()));
});
}
@@ -524,12 +521,9 @@ public class DiffTreeChangesSection extends ForwardingChangesSection implements
protected void calculateDescription() {
if (errors != null && errors.length > 0) {
if (!showingError) {
- TeamUIPlugin.getStandardDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- updatePage(getErrorComposite(getContainer()));
- showingError = true;
- }
+ TeamUIPlugin.getStandardDisplay().asyncExec(() -> {
+ updatePage(getErrorComposite(getContainer()));
+ showingError = true;
});
}
return;
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ModelCompareEditorInput.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ModelCompareEditorInput.java
index 39f19b934..8e6266773 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ModelCompareEditorInput.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ModelCompareEditorInput.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
@@ -22,7 +22,6 @@ import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.*;
import org.eclipse.osgi.util.NLS;
-import org.eclipse.team.core.ICache;
import org.eclipse.team.core.ICacheListener;
import org.eclipse.team.internal.ui.*;
import org.eclipse.team.internal.ui.synchronize.*;
@@ -50,12 +49,7 @@ public class ModelCompareEditorInput extends SaveableCompareEditorInput implemen
Assert.isNotNull(input);
this.participant = participant;
this.input = input;
- contextListener = new ICacheListener() {
- @Override
- public void cacheDisposed(ICache cache) {
- closeEditor(true);
- }
- };
+ contextListener = cache -> closeEditor(true);
getCompareConfiguration().addPropertyChangeListener(this);
setTitle(NLS.bind(TeamUIMessages.SyncInfoCompareInput_title, new String[] { input.getName() }));
}
@@ -69,18 +63,12 @@ public class ModelCompareEditorInput extends SaveableCompareEditorInput implemen
return compareConfiguration;
}
- /* (non-Javadoc)
- * @see org.eclipse.compare.CompareEditorInput#contentsCreated()
- */
@Override
protected void contentsCreated() {
super.contentsCreated();
participant.getContext().getCache().addCacheListener(contextListener);
}
- /* (non-Javadoc)
- * @see org.eclipse.compare.CompareEditorInput#handleDispose()
- */
@Override
protected void handleDispose() {
super.handleDispose();
@@ -97,9 +85,6 @@ public class ModelCompareEditorInput extends SaveableCompareEditorInput implemen
}
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.LocalResourceCompareEditorInput#createSaveable()
- */
@Override
protected Saveable createSaveable() {
if (input instanceof ISynchronizationCompareInput) {
@@ -111,9 +96,6 @@ public class ModelCompareEditorInput extends SaveableCompareEditorInput implemen
return super.createSaveable();
}
- /* (non-Javadoc)
- * @see org.eclipse.compare.CompareEditorInput#prepareInput(org.eclipse.core.runtime.IProgressMonitor)
- */
@Override
protected ICompareInput prepareCompareInput(IProgressMonitor monitor)
throws InvocationTargetException, InterruptedException {
@@ -135,7 +117,7 @@ public class ModelCompareEditorInput extends SaveableCompareEditorInput implemen
}
private ISynchronizationCompareInput asModelCompareInput(ICompareInput input) {
- return (ISynchronizationCompareInput)Adapters.adapt(input, ISynchronizationCompareInput.class);
+ return Adapters.adapt(input, ISynchronizationCompareInput.class);
}
/**
@@ -154,10 +136,6 @@ public class ModelCompareEditorInput extends SaveableCompareEditorInput implemen
return false;
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.IEditorInput#getToolTipText()
- */
@Override
public String getToolTipText() {
String fullPath;
@@ -170,9 +148,6 @@ public class ModelCompareEditorInput extends SaveableCompareEditorInput implemen
return NLS.bind(TeamUIMessages.SyncInfoCompareInput_tooltip, new String[] { Utils.shortenText(SynchronizeView.MAX_NAME_LENGTH, participant.getName()), fullPath });
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.LocalResourceCompareEditorInput#fireInputChange()
- */
@Override
protected void fireInputChange() {
if (input instanceof ResourceDiffCompareInput) {
@@ -181,20 +156,12 @@ public class ModelCompareEditorInput extends SaveableCompareEditorInput implemen
}
}
- /* (non-Javadoc)
- * @see org.eclipse.compare.CompareEditorInput#registerContextMenu(org.eclipse.jface.action.MenuManager)
- */
@Override
public void registerContextMenu(MenuManager menu, ISelectionProvider provider) {
super.registerContextMenu(menu, provider);
Saveable saveable = getSaveable();
if (saveable instanceof LocalResourceSaveableComparison) {
- menu.addMenuListener(new IMenuListener() {
- @Override
- public void menuAboutToShow(IMenuManager manager) {
- handleMenuAboutToShow(manager);
- }
- });
+ menu.addMenuListener(manager -> handleMenuAboutToShow(manager));
}
}
@@ -266,9 +233,6 @@ public class ModelCompareEditorInput extends SaveableCompareEditorInput implemen
}
}
- /* (non-Javadoc)
- * @see org.eclipse.compare.CompareEditorInput#belongsTo(java.lang.Object)
- */
@Override
public boolean belongsTo(Object family) {
return super.belongsTo(family) || family == participant;
@@ -295,9 +259,6 @@ public class ModelCompareEditorInput extends SaveableCompareEditorInput implemen
return false;
}
- /* (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
@Override
public boolean equals(Object obj) {
if (obj == this)
@@ -309,9 +270,6 @@ public class ModelCompareEditorInput extends SaveableCompareEditorInput implemen
return false;
}
- /* (non-Javadoc)
- * @see java.lang.Object#hashCode()
- */
@Override
public int hashCode() {
return input.hashCode();
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ModelSynchronizePage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ModelSynchronizePage.java
index 8be0393bb..e68d4a79b 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ModelSynchronizePage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ModelSynchronizePage.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
@@ -49,18 +49,12 @@ public class ModelSynchronizePage extends AbstractSynchronizePage {
return getParticipant().getContext().getType() == ISynchronizationContext.THREE_WAY;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.synchronize.AbstractSynchronizePage#reset()
- */
@Override
public void reset() {
// TODO Auto-generated method stub
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.synchronize.AbstractSynchronizePage#updateMode(int)
- */
@Override
protected void updateMode(int mode) {
// Nothing to do
@@ -74,9 +68,6 @@ public class ModelSynchronizePage extends AbstractSynchronizePage {
return participant;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.synchronize.AbstractSynchronizePage#createViewerAdvisor(org.eclipse.swt.widgets.Composite)
- */
@Override
protected AbstractViewerAdvisor createViewerAdvisor(Composite parent) {
CommonViewerAdvisor commonViewerAdvisor = new CommonViewerAdvisor(parent, getConfiguration());
@@ -85,9 +76,6 @@ public class ModelSynchronizePage extends AbstractSynchronizePage {
return commonViewerAdvisor;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.synchronize.AbstractSynchronizePage#createChangesSection()
- */
@Override
protected ChangesSection createChangesSection(Composite parent) {
return new DiffTreeChangesSection(parent, this, getConfiguration());
@@ -170,14 +158,14 @@ public class ModelSynchronizePage extends AbstractSynchronizePage {
input = provider;
}
} else {
- input = (ISynchronizationContext)configuration.getProperty(ITeamContentProviderManager.P_SYNCHRONIZATION_CONTEXT);
+ input = configuration.getProperty(ITeamContentProviderManager.P_SYNCHRONIZATION_CONTEXT);
}
return input;
}
private static ModelProvider getModelProvider(String id) {
try {
- IModelProviderDescriptor desc = ModelProvider.getModelProviderDescriptor((String)id);
+ IModelProviderDescriptor desc = ModelProvider.getModelProviderDescriptor(id);
if (desc != null) {
return desc.getModelProvider();
}
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 af3883c90..c59bc0106 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
@@ -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
@@ -53,7 +53,7 @@ public abstract class ResourceModelParticipantAction extends ModelParticipantAct
}
} else {
for (Iterator iter = selection.iterator(); iter.hasNext();) {
- Object element = (Object) iter.next();
+ Object element = iter.next();
ResourceTraversal[] traversals = getTraversals(element, Policy.subMonitorFor(monitor, 100));
traversal.addTraversals(traversals);
}
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 b4ee2e2cf..b4510b829 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
@@ -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
@@ -93,7 +93,7 @@ public class ResourceModelScopeParticipant implements
IAdaptable[] elements = set.getElements();
for (int j = 0; j < elements.length; j++) {
IAdaptable adaptable = elements[j];
- ResourceMapping m = (ResourceMapping)Adapters.adapt(adaptable, ResourceMapping.class);
+ ResourceMapping m = Adapters.adapt(adaptable, ResourceMapping.class);
if (m != null) {
IProject[] p = m.getProjects();
for (int k = 0; k < p.length; k++) {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/LocalResourceSaveableComparison.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/LocalResourceSaveableComparison.java
index a522a3a6d..2ff733f1d 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/LocalResourceSaveableComparison.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/LocalResourceSaveableComparison.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2013 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
@@ -119,9 +119,6 @@ public abstract class LocalResourceSaveableComparison extends SaveableComparison
return fileElement;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.mapping.SaveableCompareModel#performSave(org.eclipse.core.runtime.IProgressMonitor)
- */
@Override
protected void performSave(IProgressMonitor monitor) throws CoreException {
if (checkForUpdateConflicts()) {
@@ -209,9 +206,6 @@ public abstract class LocalResourceSaveableComparison extends SaveableComparison
return false;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.mapping.SaveableCompareModel#isDirty()
- */
@Override
public boolean isDirty() {
// We need to get the dirty state from the compare editor input
@@ -222,9 +216,6 @@ public abstract class LocalResourceSaveableComparison extends SaveableComparison
return editorInput.isSaveNeeded();
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.mapping.SaveableCompareModel#setDirty(boolean)
- */
@Override
protected void setDirty(boolean dirty) {
if (editorInput instanceof SaveablesCompareEditorInput) {
@@ -237,9 +228,6 @@ public abstract class LocalResourceSaveableComparison extends SaveableComparison
editorInput.setDirty(dirty);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.mapping.SaveableCompareModel#performRevert(org.eclipse.core.runtime.IProgressMonitor)
- */
@Override
protected void performRevert(IProgressMonitor monitor) {
// Only the left is ever editable
@@ -248,9 +236,6 @@ public abstract class LocalResourceSaveableComparison extends SaveableComparison
((LocalResourceTypedElement) left).discardBuffer();
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.Saveable#getName()
- */
@Override
public String getName() {
// Return the name of the file element as held in the compare input
@@ -265,17 +250,11 @@ public abstract class LocalResourceSaveableComparison extends SaveableComparison
return input.getName();
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.Saveable#getToolTipText()
- */
@Override
public String getToolTipText() {
return editorInput.getToolTipText();
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.Saveable#getImageDescriptor()
- */
@Override
public ImageDescriptor getImageDescriptor() {
Image image = input.getImage();
@@ -284,9 +263,6 @@ public abstract class LocalResourceSaveableComparison extends SaveableComparison
return TeamUIPlugin.getImageDescriptor(ITeamUIImages.IMG_SYNC_VIEW);
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
- */
@Override
public void propertyChange(PropertyChangeEvent e) {
String propertyName= e.getProperty();
@@ -321,9 +297,6 @@ public abstract class LocalResourceSaveableComparison extends SaveableComparison
}
}
- /*
- * @see org.eclipse.ui.Saveable#hashCode()
- */
@Override
public int hashCode() {
if (document != null) {
@@ -359,21 +332,22 @@ public abstract class LocalResourceSaveableComparison extends SaveableComparison
return false;
}
+ @SuppressWarnings("unchecked")
@Override
- public Object getAdapter(Class adapter) {
+ public <T> T getAdapter(Class<T> adapter) {
if (adapter == IDocument.class) {
if (document != null)
- return document;
+ return (T) document;
if (fileElement instanceof LocalResourceTypedElement) {
LocalResourceTypedElement lrte = (LocalResourceTypedElement) fileElement;
if (lrte.isConnected()) {
- ISharedDocumentAdapter sda = (ISharedDocumentAdapter)Adapters.adapt(lrte, ISharedDocumentAdapter.class);
+ ISharedDocumentAdapter sda = Adapters.adapt(lrte, ISharedDocumentAdapter.class);
if (sda != null) {
IEditorInput input = sda.getDocumentKey(lrte);
if (input != null) {
IDocumentProvider provider = SharedDocumentAdapter.getDocumentProvider(input);
if (provider != null)
- return provider.getDocument(input);
+ return (T) provider.getDocument(input);
}
}
}
@@ -382,7 +356,7 @@ public abstract class LocalResourceSaveableComparison extends SaveableComparison
if (adapter == IEditorInput.class) {
if (fileElement instanceof LocalResourceTypedElement) {
LocalResourceTypedElement lrte = (LocalResourceTypedElement) fileElement;
- return new FileEditorInput((IFile)lrte.getResource());
+ return (T) new FileEditorInput((IFile)lrte.getResource());
}
}
return super.getAdapter(adapter);
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SaveablesCompareEditorInput.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SaveablesCompareEditorInput.java
index 3af8561b6..4ae10a678 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SaveablesCompareEditorInput.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SaveablesCompareEditorInput.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2011 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
@@ -103,36 +103,27 @@ public class SaveablesCompareEditorInput extends CompareEditorInput implements
private ISaveablesLifecycleListener getSaveablesLifecycleListener(
IWorkbenchPart part) {
- ISaveablesLifecycleListener listener = (ISaveablesLifecycleListener) Adapters.adapt(part, ISaveablesLifecycleListener.class);
+ ISaveablesLifecycleListener listener = Adapters.adapt(part, ISaveablesLifecycleListener.class);
if (listener == null)
- listener = (ISaveablesLifecycleListener) part.getSite().getService(
- ISaveablesLifecycleListener.class);
+ listener = part.getSite().getService(ISaveablesLifecycleListener.class);
return listener;
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.compare.CompareEditorInput#contentsCreated()
- */
@Override
protected void contentsCreated() {
super.contentsCreated();
- compareInputChangeListener = new ICompareInputChangeListener() {
- @Override
- public void compareInputChanged(ICompareInput source) {
- if (source == getCompareResult()) {
- boolean closed = false;
- if (source.getKind() == Differencer.NO_CHANGE) {
- closed = closeEditor(true);
- }
- if (!closed) {
- // The editor was not closed either because the compare
- // input still has changes or because the editor input
- // is dirty. In either case, fire the changes
- // to the registered listeners
- propogateInputChange();
- }
+ compareInputChangeListener = source -> {
+ if (source == getCompareResult()) {
+ boolean closed = false;
+ if (source.getKind() == Differencer.NO_CHANGE) {
+ closed = closeEditor(true);
+ }
+ if (!closed) {
+ // The editor was not closed either because the compare
+ // input still has changes or because the editor input
+ // is dirty. In either case, fire the changes
+ // to the registered listeners
+ propogateInputChange();
}
}
};
@@ -141,12 +132,9 @@ public class SaveablesCompareEditorInput extends CompareEditorInput implements
if (getLeftSaveable() instanceof SaveableComparison) {
SaveableComparison lscm = (SaveableComparison) fLeftSaveable;
- fLeftPropertyListener = new IPropertyListener() {
- @Override
- public void propertyChanged(Object source, int propId) {
- if (propId == SaveableComparison.PROP_DIRTY) {
- setLeftDirty(fLeftSaveable.isDirty());
- }
+ fLeftPropertyListener = (source, propId) -> {
+ if (propId == SaveableComparison.PROP_DIRTY) {
+ setLeftDirty(fLeftSaveable.isDirty());
}
};
lscm.addPropertyListener(fLeftPropertyListener);
@@ -154,12 +142,9 @@ public class SaveablesCompareEditorInput extends CompareEditorInput implements
if (getRightSaveable() instanceof SaveableComparison) {
SaveableComparison rscm = (SaveableComparison) fRightSaveable;
- fRightPropertyListener = new IPropertyListener() {
- @Override
- public void propertyChanged(Object source, int propId) {
- if (propId == SaveableComparison.PROP_DIRTY) {
- setRightDirty(fRightSaveable.isDirty());
- }
+ fRightPropertyListener = (source, propId) -> {
+ if (propId == SaveableComparison.PROP_DIRTY) {
+ setRightDirty(fRightSaveable.isDirty());
}
};
rscm.addPropertyListener(fRightPropertyListener);
@@ -169,11 +154,6 @@ public class SaveablesCompareEditorInput extends CompareEditorInput implements
setRightDirty(fRightSaveable.isDirty());
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.compare.CompareEditorInput#handleDispose()
- */
@Override
protected void handleDispose() {
super.handleDispose();
@@ -692,11 +672,6 @@ public class SaveablesCompareEditorInput extends CompareEditorInput implements
return TeamUIPlugin.getImageDescriptor(ITeamUIImages.IMG_SYNC_VIEW);
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.compare.CompareEditorInput#canRunAsJob()
- */
@Override
public boolean canRunAsJob() {
return true;
@@ -705,8 +680,7 @@ public class SaveablesCompareEditorInput extends CompareEditorInput implements
private static String getShowInMenuLabel() {
String keyBinding = null;
- IBindingService bindingService = (IBindingService) PlatformUI
- .getWorkbench().getAdapter(IBindingService.class);
+ IBindingService bindingService = PlatformUI.getWorkbench().getAdapter(IBindingService.class);
if (bindingService != null)
keyBinding = bindingService
.getBestActiveBindingFormattedFor(IWorkbenchCommandConstants.NAVIGATE_SHOW_IN_QUICK_MENU);
@@ -802,9 +776,6 @@ public class SaveablesCompareEditorInput extends CompareEditorInput implements
// Ignore
}
- /*
- * @see org.eclipse.ui.Saveable#equals(java.lang.Object)
- */
@Override
public boolean equals(Object obj) {
if (this == obj)
@@ -833,7 +804,7 @@ public class SaveablesCompareEditorInput extends CompareEditorInput implements
if (provider instanceof ITextViewer) {
final ITextViewer v= (ITextViewer)provider;
IDocument d= v.getDocument();
- IDocument other= (IDocument)Adapters.adapt(saveable, IDocument.class);
+ IDocument other= Adapters.adapt(saveable, IDocument.class);
if (d == other) {
if (element instanceof IResourceProvider) {
IResourceProvider rp= (IResourceProvider)element;
@@ -851,12 +822,6 @@ public class SaveablesCompareEditorInput extends CompareEditorInput implements
// XXX: Internal reference will get fixed during 3.7, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=307026
submenu2.add(new OpenWithMenu(ws.getPage(), resource) {
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.actions.OpenWithMenu#openEditor(org.eclipse.ui.
- * IEditorDescriptor, boolean)
- */
@Override
protected void openEditor(IEditorDescriptor editorDescriptor, boolean openUsingDescriptor) {
super.openEditor(editorDescriptor, openUsingDescriptor);
@@ -869,11 +834,6 @@ public class SaveablesCompareEditorInput extends CompareEditorInput implements
// XXX: Internal reference will get fixed during 3.7, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=307026
OpenFileAction openFileAction= new OpenFileAction(ws.getPage()) {
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.actions.OpenSystemEditorAction#run()
- */
@Override
public void run() {
super.run();
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SubscriberRefreshSchedule.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SubscriberRefreshSchedule.java
index 1a42060f1..ebe759b1e 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SubscriberRefreshSchedule.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SubscriberRefreshSchedule.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2009 IBM Corporation and others.
+ * Copyright (c) 2003, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -79,7 +79,7 @@ public class SubscriberRefreshSchedule {
return null;
}
private IRefreshable getRefreshable(ISynchronizeParticipant participant) {
- return (IRefreshable)Adapters.adapt(participant, IRefreshable.class);
+ return Adapters.adapt(participant, IRefreshable.class);
}
};
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelElement.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelElement.java
index 5019dbb5c..00e66a831 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelElement.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelElement.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
@@ -48,11 +48,8 @@ public abstract class SynchronizeModelElement extends DiffNode implements IAdapt
internalSetParent(parent);
}
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
- */
@Override
- public Object getAdapter(Class adapter) {
+ public <T> T getAdapter(Class<T> adapter) {
return Platform.getAdapterManager().getAdapter(this, adapter);
}
@@ -74,9 +71,6 @@ public abstract class SynchronizeModelElement extends DiffNode implements IAdapt
}
}
- /* (non-Javadoc)
- * @see org.eclipse.compare.structuremergeviewer.IDiffElement#setParent(org.eclipse.compare.structuremergeviewer.IDiffContainer)
- */
@Override
public void setParent(IDiffContainer parent) {
super.setParent(parent);
@@ -131,7 +125,7 @@ public abstract class SynchronizeModelElement extends DiffNode implements IAdapt
public ImageDescriptor getImageDescriptor(Object object) {
IResource resource = getResource();
if(resource != null) {
- IWorkbenchAdapter adapter = (IWorkbenchAdapter)((IAdaptable) resource).getAdapter(IWorkbenchAdapter.class);
+ IWorkbenchAdapter adapter = ((IAdaptable) resource).getAdapter(IWorkbenchAdapter.class);
return adapter.getImageDescriptor(resource);
}
return null;
@@ -234,9 +228,6 @@ public abstract class SynchronizeModelElement extends DiffNode implements IAdapt
return this==object;
}
- /* (non-Javadoc)
- * @see org.eclipse.compare.structuremergeviewer.DiffNode#hashCode()
- */
@Override
public int hashCode() {
// Use the name to get the hashCode to ensure that we can find equal elements.
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 cf3137fc7..638a37958 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
@@ -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
@@ -113,9 +113,6 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
private static final String KEY_SETTINGS_SECTION= "SynchronizeViewSettings"; //$NON-NLS-1$
- /* (non-Javadoc)
- * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
- */
@Override
public void propertyChange(PropertyChangeEvent event) {
Object source = event.getSource();
@@ -125,30 +122,20 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
updateTitle();
}
} else if (event.getProperty().equals(ModelSynchronizeParticipant.PROP_DIRTY)) {
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- firePropertyChange(PROP_DIRTY);
- }
- });
+ Display.getDefault().asyncExec(() -> firePropertyChange(PROP_DIRTY));
} else if (event.getProperty().equals(ModelSynchronizeParticipant.PROP_ACTIVE_SAVEABLE)) {
Saveable oldSaveable = (Saveable)event.getOldValue();
Saveable newSaveable = (Saveable)event.getNewValue();
- ISaveablesLifecycleListener listener = (ISaveablesLifecycleListener)getSite().getPage().getWorkbenchWindow()
+ ISaveablesLifecycleListener listener = getSite().getPage().getWorkbenchWindow()
.getService(ISaveablesLifecycleListener.class);
if (listener != null && oldSaveable != null)
listener.handleLifecycleEvent(new SaveablesLifecycleEvent(this, SaveablesLifecycleEvent.POST_CLOSE, new Saveable[] { oldSaveable }, false));
if (listener != null && newSaveable != null)
listener.handleLifecycleEvent(new SaveablesLifecycleEvent(this, SaveablesLifecycleEvent.POST_OPEN, new Saveable[] { newSaveable }, false));
} else if (event.getProperty().equals(ISynchronizeParticipant.P_CONTENT)) {
- final IWorkbenchSiteProgressService ps = (IWorkbenchSiteProgressService)getSite().getAdapter(IWorkbenchSiteProgressService.class);
+ final IWorkbenchSiteProgressService ps = getSite().getAdapter(IWorkbenchSiteProgressService.class);
if (ps != null)
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- ps.warnOfContentChange();
- }
- });
+ Display.getDefault().asyncExec(() -> ps.warnOfContentChange());
}
}
if (source instanceof ISynchronizePageConfiguration) {
@@ -165,25 +152,16 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
}
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPartListener#partClosed(org.eclipse.ui.IWorkbenchPart)
- */
@Override
public void partClosed(IWorkbenchPart part) {
super.partClosed(part);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.sync.ISynchronizeView#getParticipant()
- */
@Override
public ISynchronizeParticipant getParticipant() {
return activeParticipantRef;
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.PageBookView#showPageRec(org.eclipse.ui.part.PageBookView.PageRec)
- */
@Override
protected void showPageRec(PageRec pageRec) {
super.showPageRec(pageRec);
@@ -212,9 +190,6 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
}
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.PageBookView#doDestroyPage(org.eclipse.ui.IWorkbenchPart, org.eclipse.ui.part.PageBookView.PageRec)
- */
@Override
protected void doDestroyPage(IWorkbenchPart part, PageRec pageRecord) {
IPage page = pageRecord.page;
@@ -236,9 +211,6 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
fParticipantToPart.remove(participant);
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.PageBookView#doCreatePage(org.eclipse.ui.IWorkbenchPart)
- */
@Override
protected PageRec doCreatePage(IWorkbenchPart dummyPart) {
SynchronizeViewWorkbenchPart part = (SynchronizeViewWorkbenchPart)dummyPart;
@@ -258,9 +230,6 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
return null;
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.PageBookView#initPage(org.eclipse.ui.part.IPageBookViewPage)
- */
protected void initPage(ISynchronizePageConfiguration configuration, IPageBookViewPage page) {
// A page site does not provide everything the page may need
// Also provide the synchronize page site if the page is a synchronize view page
@@ -276,17 +245,11 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
page.getSite().getActionBars().updateActionBars();
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.PageBookView#isImportant(org.eclipse.ui.IWorkbenchPart)
- */
@Override
protected boolean isImportant(IWorkbenchPart part) {
return part instanceof SynchronizeViewWorkbenchPart;
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPart#dispose()
- */
@Override
public void dispose() {
super.dispose();
@@ -313,9 +276,6 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
section.put(KEY_LAST_ACTIVE_PARTICIPANT_SECONDARY_ID, activeParticipantRef.getSecondaryId());
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.PageBookView#createDefaultPage(org.eclipse.ui.part.PageBook)
- */
@Override
protected IPage createDefaultPage(PageBook book) {
Page page = new MessagePage();
@@ -324,9 +284,6 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
return page;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.sync.ISynchronizeParticipantListener#participantsAdded(org.eclipse.team.ui.sync.ISynchronizeParticipant[])
- */
@Override
public void participantsAdded(final ISynchronizeParticipant[] participants) {
for (int i = 0; i < participants.length; i++) {
@@ -337,55 +294,44 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
fPartToParticipant.put(part, participant);
}
}
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- firePropertyChange(PROP_DIRTY);
- }
- });
+ Display.getDefault().asyncExec(() -> firePropertyChange(PROP_DIRTY));
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.sync.ISynchronizeParticipantListener#participantsRemoved(org.eclipse.team.ui.sync.ISynchronizeParticipant[])
- */
@Override
public void participantsRemoved(final ISynchronizeParticipant[] participants) {
if (isAvailable()) {
- Runnable r = new Runnable() {
- @Override
- public void run() {
- for (int i = 0; i < participants.length; i++) {
- ISynchronizeParticipant participant = participants[i];
- if (isAvailable()) {
- SynchronizeViewWorkbenchPart part = (SynchronizeViewWorkbenchPart)fParticipantToPart.get(participant);
- if (part != null) {
- partClosed(part);
- clearCrossReferenceCache(part, participant);
- }
- // Remove any settings created for the participant
- removeDialogSettings(participant);
- if (getParticipant() == null) {
- ISynchronizeParticipantReference[] available = TeamUI.getSynchronizeManager().getSynchronizeParticipants();
- if (available.length > 0) {
- ISynchronizeParticipant p;
- try {
- p = available[available.length - 1].getParticipant();
- } catch (TeamException e) {
- return;
- }
- display(p);
- } else {
- /*
- * Remove 'Link with Editor' listener if
- * there are no more participants available.
- */
- getSite().getPage().removePartListener(fLinkWithEditorListener);
+ Runnable r = () -> {
+ for (int i = 0; i < participants.length; i++) {
+ ISynchronizeParticipant participant = participants[i];
+ if (isAvailable()) {
+ SynchronizeViewWorkbenchPart part = (SynchronizeViewWorkbenchPart)fParticipantToPart.get(participant);
+ if (part != null) {
+ partClosed(part);
+ clearCrossReferenceCache(part, participant);
+ }
+ // Remove any settings created for the participant
+ removeDialogSettings(participant);
+ if (getParticipant() == null) {
+ ISynchronizeParticipantReference[] available = TeamUI.getSynchronizeManager().getSynchronizeParticipants();
+ if (available.length > 0) {
+ ISynchronizeParticipant p;
+ try {
+ p = available[available.length - 1].getParticipant();
+ } catch (TeamException e) {
+ return;
}
+ display(p);
+ } else {
+ /*
+ * Remove 'Link with Editor' listener if
+ * there are no more participants available.
+ */
+ getSite().getPage().removePartListener(fLinkWithEditorListener);
}
}
}
- firePropertyChange(PROP_DIRTY);
}
+ firePropertyChange(PROP_DIRTY);
};
asyncExec(r);
}
@@ -450,14 +396,11 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
menu.add(fRemoveCurrentAction);
menu.add(fRemoveAllAction);
- IHandlerService handlerService= (IHandlerService) this.getViewSite().getService(IHandlerService.class);
+ IHandlerService handlerService= this.getViewSite().getService(IHandlerService.class);
handlerService.activateHandler(IWorkbenchCommandConstants.NAVIGATE_TOGGLE_LINK_WITH_EDITOR, new ActionHandler(fToggleLinkingAction));
handlerService.activateHandler(ActionFactory.PASTE.getCommandId(), new ActionHandler(fPastePatchAction));
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizeView#display(org.eclipse.team.ui.synchronize.ISynchronizeParticipant)
- */
@Override
public void display(ISynchronizeParticipant participant) {
SynchronizeViewWorkbenchPart part = (SynchronizeViewWorkbenchPart)fParticipantToPart.get(participant);
@@ -500,9 +443,6 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
setLinkingEnabled(isLinkingEnabled());
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.PageBookView#getBootstrapPart()
- */
@Override
protected IWorkbenchPart getBootstrapPart() {
return null;
@@ -545,7 +485,7 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
getViewSite().getActionBars().updateActionBars();
updateTitle();
- IWorkbenchSiteProgressService progress = (IWorkbenchSiteProgressService)getSite().getAdapter(IWorkbenchSiteProgressService.class);
+ IWorkbenchSiteProgressService progress = getSite().getAdapter(IWorkbenchSiteProgressService.class);
if(progress != null) {
progress.showBusyForFamily(ISynchronizeManager.FAMILY_SYNCHRONIZE_OPERATION);
}
@@ -671,9 +611,6 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
}
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.ISaveablesSource#getSaveables()
- */
@Override
public Saveable[] getSaveables() {
Set result = new HashSet();
@@ -695,9 +632,6 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
return null;
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.ISaveablesSource#getActiveSaveables()
- */
@Override
public Saveable[] getActiveSaveables() {
ISynchronizeParticipant participant = getParticipant();
@@ -707,9 +641,6 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
return new Saveable[0];
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.ISaveablePart#doSave(org.eclipse.core.runtime.IProgressMonitor)
- */
@Override
public void doSave(IProgressMonitor monitor) {
Saveable[] saveables = getSaveables();
@@ -729,17 +660,11 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
firePropertyChange(PROP_DIRTY);
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.ISaveablePart#doSaveAs()
- */
@Override
public void doSaveAs() {
// Not allowed
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.ISaveablePart#isDirty()
- */
@Override
public boolean isDirty() {
Saveable[] saveables = getSaveables();
@@ -751,17 +676,11 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
return false;
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.ISaveablePart#isSaveAsAllowed()
- */
@Override
public boolean isSaveAsAllowed() {
return false;
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.ISaveablePart#isSaveOnCloseNeeded()
- */
@Override
public boolean isSaveOnCloseNeeded() {
return true;
@@ -1045,8 +964,7 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
Object compareResult = cei.getCompareResult();
if (compareResult instanceof IAdaptable) {
- IResource r = (IResource) ((IAdaptable) compareResult)
- .getAdapter(IResource.class);
+ IResource r = ((IAdaptable) compareResult).getAdapter(IResource.class);
if (r != null)
return file.equals(r);
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/GlobalRefreshAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/GlobalRefreshAction.java
index c622865d3..b3bde81a1 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/GlobalRefreshAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/GlobalRefreshAction.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
@@ -71,10 +71,6 @@ public class GlobalRefreshAction extends Action implements IMenuCreator, IWorkbe
// Nothing to do
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.action.IMenuCreator#dispose()
- */
@Override
public void dispose() {
if(menuManager != null) {
@@ -86,7 +82,7 @@ public class GlobalRefreshAction extends Action implements IMenuCreator, IWorkbe
// handlers
if (window != null) {
- IHandlerService hs = (IHandlerService)window.getService(IHandlerService.class);
+ IHandlerService hs = window.getService(IHandlerService.class);
if (hs != null) {
if (syncAll != null)
hs.deactivateHandler(syncAll);
@@ -96,19 +92,11 @@ public class GlobalRefreshAction extends Action implements IMenuCreator, IWorkbe
}
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.action.IMenuCreator#getMenu(org.eclipse.swt.widgets.Menu)
- */
@Override
public Menu getMenu(Menu parent) {
return null;
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.action.IMenuCreator#getMenu(org.eclipse.swt.widgets.Control)
- */
@Override
public Menu getMenu(Control parent) {
Menu fMenu = null;
@@ -131,10 +119,6 @@ public class GlobalRefreshAction extends Action implements IMenuCreator, IWorkbe
return fMenu;
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow)
- */
@Override
public void init(IWorkbenchWindow window) {
this.window = window;
@@ -150,7 +134,7 @@ public class GlobalRefreshAction extends Action implements IMenuCreator, IWorkbe
synchronizeAction.setImageDescriptor(TeamImages.getImageDescriptor(ITeamUIImages.IMG_SYNC_VIEW));
synchronizeAction.setActionDefinitionId("org.eclipse.team.ui.synchronizeAll"); //$NON-NLS-1$
- IHandlerService hs = (IHandlerService)window.getService(IHandlerService.class);
+ IHandlerService hs = window.getService(IHandlerService.class);
if (hs != null) {
// hook up actions to the commands
IHandler handler = new AbstractHandler() {
@@ -189,10 +173,6 @@ public class GlobalRefreshAction extends Action implements IMenuCreator, IWorkbe
}
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
- */
@Override
public void run(IAction action) {
run();
@@ -211,48 +191,30 @@ public class GlobalRefreshAction extends Action implements IMenuCreator, IWorkbe
}
}
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.sync.ISynchronizeParticipantListener#participantsAdded(org.eclipse.team.ui.sync.ISynchronizeParticipant[])
- */
@Override
public void participantsAdded(ISynchronizeParticipant[] consoles) {
Display display = TeamUIPlugin.getStandardDisplay();
- display.asyncExec(new Runnable() {
- @Override
- public void run() {
- if(menuManager != null) {
- menuManager.dispose();
- menuManager = null;
- }
- updateTooltipText();
+ display.asyncExec(() -> {
+ if(menuManager != null) {
+ menuManager.dispose();
+ menuManager = null;
}
+ updateTooltipText();
});
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.sync.ISynchronizeParticipantListener#participantsRemoved(org.eclipse.team.ui.sync.ISynchronizeParticipant[])
- */
@Override
public void participantsRemoved(ISynchronizeParticipant[] consoles) {
Display display = TeamUIPlugin.getStandardDisplay();
- display.asyncExec(new Runnable() {
- @Override
- public void run() {
- if(menuManager != null) {
- menuManager.dispose();
- menuManager = null;
- }
- updateTooltipText();
+ display.asyncExec(() -> {
+ if(menuManager != null) {
+ menuManager.dispose();
+ menuManager = null;
}
+ updateTooltipText();
});
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction,
- * org.eclipse.jface.viewers.ISelection)
- */
@Override
public void selectionChanged(IAction action, ISelection selection) {
actionProxy = action;
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenWithActionGroup.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenWithActionGroup.java
index 874139108..487ad429e 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenWithActionGroup.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenWithActionGroup.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
@@ -171,8 +171,7 @@ public class OpenWithActionGroup extends ActionGroup {
private static String getShowInMenuLabel() {
String keyBinding = null;
- IBindingService bindingService = (IBindingService) PlatformUI
- .getWorkbench().getAdapter(IBindingService.class);
+ IBindingService bindingService = PlatformUI.getWorkbench().getAdapter(IBindingService.class);
if (bindingService != null)
keyBinding = bindingService
.getBestActiveBindingFormattedFor(IWorkbenchCommandConstants.NAVIGATE_SHOW_IN_QUICK_MENU);
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/PasteAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/PasteAction.java
index e844fc356..cb9d2b934 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/PasteAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/PasteAction.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
@@ -51,8 +51,7 @@ public class PasteAction extends SelectionListenerAction {
IStorage patchStorage = getPatchStorage();
if (patchStorage != null) {
IResource resource = null;
- IResource[] resources = (IResource[]) getSelectedResources()
- .toArray(new IResource[0]);
+ IResource[] resources = getSelectedResources().toArray(new IResource[0]);
if (resources.length > 0) {
resource = resources[0];
}
@@ -80,7 +79,7 @@ public class PasteAction extends SelectionListenerAction {
IStorage storage = new IEncodedStorage() {
@Override
- public Object getAdapter(Class adapter) {
+ public <T> T getAdapter(Class<T> adapter) {
return null;
}
@@ -146,12 +145,7 @@ public class PasteAction extends SelectionListenerAction {
final Transfer transfer, Shell shell) {
// see bug 33028 for explanation why we need this
final Object[] result = new Object[1];
- shell.getDisplay().syncExec(new Runnable() {
- @Override
- public void run() {
- result[0] = clipboard.getContents(transfer);
- }
- });
+ shell.getDisplay().syncExec(() -> result[0] = clipboard.getContents(transfer));
return result[0];
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RefactorActionGroup.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RefactorActionGroup.java
index 6f90c071f..6ace0413b 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RefactorActionGroup.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RefactorActionGroup.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
@@ -164,7 +164,7 @@ public class RefactorActionGroup extends ActionGroup {
resource = (IResource)next;
} else if (next instanceof IAdaptable) {
IAdaptable adaptable = (IAdaptable)next;
- resource = (IResource)adaptable.getAdapter(IResource.class);
+ resource = adaptable.getAdapter(IResource.class);
}
if(resource == null) {
IResource[] r = Utils.getResources(new Object[] {next});
@@ -179,9 +179,6 @@ public class RefactorActionGroup extends ActionGroup {
return true;
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.actions.ActionGroup#dispose()
- */
@Override
public void dispose() {
super.dispose();
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ShowSynchronizeParticipantAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ShowSynchronizeParticipantAction.java
index 3463f86b3..43d03fb45 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ShowSynchronizeParticipantAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ShowSynchronizeParticipantAction.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
@@ -100,7 +100,7 @@ public class ShowSynchronizeParticipantAction extends Action implements IPropert
drawImage(scheduledData, 0, 0);
}
} else {
- SubscriberRefreshSchedule schedule = (SubscriberRefreshSchedule)Adapters.adapt(participant, SubscriberRefreshSchedule.class);
+ SubscriberRefreshSchedule schedule = Adapters.adapt(participant, SubscriberRefreshSchedule.class);
if(schedule!=null && schedule.isEnabled()) {
drawImage(scheduledData, 0, 0);
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/FilePatchResourceMapping.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/FilePatchResourceMapping.java
index eb2d9a95d..5e7b9ee2e 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/FilePatchResourceMapping.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/FilePatchResourceMapping.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
@@ -38,7 +38,7 @@ public class FilePatchResourceMapping extends ResourceMapping {
@Override
public IProject[] getProjects() {
- DiffProject dp = (DiffProject) object.getDiff().getProject();
+ DiffProject dp = object.getDiff().getProject();
IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject(
dp.getName());
return new IProject[] { p };
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/HunkResourceMapping.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/HunkResourceMapping.java
index d0a433cb6..c14b50127 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/HunkResourceMapping.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/HunkResourceMapping.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
@@ -36,8 +36,7 @@ public class HunkResourceMapping extends ResourceMapping {
@Override
public IProject[] getProjects() {
- DiffProject dp = (DiffProject) object.getHunk().getParent()
- .getProject();
+ DiffProject dp = object.getHunk().getParent().getProject();
IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject(
dp.getName());
return new IProject[] { p };
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigurationWizardElement.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigurationWizardElement.java
index 0bc443a77..45c7552d6 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigurationWizardElement.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigurationWizardElement.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
@@ -61,7 +61,7 @@ public class ConfigurationWizardElement extends WorkbenchAdapter implements IAda
public IWizard createExecutableExtension(IProject[] projects) throws CoreException {
IWorkbench workbench = PlatformUI.getWorkbench();
IConfigurationWizard wizard = (IConfigurationWizard)createExecutableExtension();
- IConfigurationWizardExtension extension = (IConfigurationWizardExtension)Adapters.adapt(wizard, IConfigurationWizardExtension.class);
+ IConfigurationWizardExtension extension = Adapters.adapt(wizard, IConfigurationWizardExtension.class);
if (extension == null) {
if (projects.length == 1) {
wizard.init(workbench, projects[0]);
@@ -85,10 +85,11 @@ public class ConfigurationWizardElement extends WorkbenchAdapter implements IAda
/*
* Method declared on IAdaptable.
*/
+ @SuppressWarnings("unchecked")
@Override
- public Object getAdapter(Class adapter) {
+ public <T> T getAdapter(Class<T> adapter) {
if (adapter == IWorkbenchAdapter.class) {
- return this;
+ return (T) this;
}
return Platform.getAdapterManager().getAdapter(this, adapter);
}
@@ -169,17 +170,11 @@ public class ConfigurationWizardElement extends WorkbenchAdapter implements IAda
imageDescriptor = value;
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPluginContribution#getLocalId()
- */
@Override
public String getLocalId() {
return configurationElement.getAttribute(ConfigureProjectWizard.ATT_ID);
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPluginContribution#getPluginId()
- */
@Override
public String getPluginId() {
return configurationElement.getNamespaceIdentifier();
@@ -193,7 +188,7 @@ public class ConfigurationWizardElement extends WorkbenchAdapter implements IAda
*/
public boolean wizardHasPages(IProject[] projects) {
try {
- IWizard wizard = (IWizard)createExecutableExtension(projects);
+ IWizard wizard = createExecutableExtension(projects);
try {
wizard.addPages();
return (wizard.getPageCount() > 0);
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigureProjectWizard.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigureProjectWizard.java
index c525cab08..a7cd7a176 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigureProjectWizard.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigureProjectWizard.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
@@ -42,9 +42,6 @@ public class ConfigureProjectWizard extends Wizard {
setWindowTitle(TeamUIMessages.ConfigureProjectWizard_title);
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.Wizard#addPages()
- */
@Override
public void addPages() {
AdaptableList disabledWizards = new AdaptableList();
@@ -55,9 +52,6 @@ public class ConfigureProjectWizard extends Wizard {
addPage(mainPage);
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.Wizard#canFinish()
- */
@Override
public boolean canFinish() {
// If we are on the first page, never allow finish unless the selected wizard has no pages.
@@ -70,9 +64,6 @@ public class ConfigureProjectWizard extends Wizard {
return super.canFinish();
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.Wizard#performFinish()
- */
@Override
public boolean performFinish() {
// If we are on the first page and the selected wizard has no pages then
@@ -113,7 +104,7 @@ public class ConfigureProjectWizard extends Wizard {
ConfigurationWizardElement element = (ConfigurationWizardElement)wizards.getChildren()[0];
if (element.wizardHasPages(projects)) {
try {
- wizard = (IWizard)element.createExecutableExtension(projects);
+ wizard = element.createExecutableExtension(projects);
} catch (CoreException e) {
// Log the exception and fall through to show the wizard
TeamUIPlugin.log(e);
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigureProjectWizardMainPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigureProjectWizardMainPage.java
index 64cf733b8..83da2d258 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigureProjectWizardMainPage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigureProjectWizardMainPage.java
@@ -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
@@ -89,16 +89,12 @@ public class ConfigureProjectWizardMainPage extends WizardPage {
public IWizard getSelectedWizard() {
return selectedWizard;
}
- /*
- * @see WizardPage#canFlipToNextPage
- */
+
@Override
public boolean canFlipToNextPage() {
return selectedWizard != null && selectedWizard.getPageCount() > 0;
}
- /*
- * @see WizardPage#createControl
- */
+
@Override
public void createControl(Composite parent) {
Composite composite = new Composite(parent, SWT.NULL);
@@ -123,36 +119,33 @@ public class ConfigureProjectWizardMainPage extends WizardPage {
viewer = new TableViewer(table);
viewer.setContentProvider(new WorkbenchContentProvider());
viewer.setLabelProvider(new WorkbenchLabelProvider());
- viewer.addSelectionChangedListener(new ISelectionChangedListener() {
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- // Initialize the wizard so we can tell whether to enable the Next button
- ISelection selection = event.getSelection();
- if (selection == null || !(selection instanceof IStructuredSelection)) {
- selectedWizard = null;
- selectedWizardId = null;
- setPageComplete(false);
- return;
- }
- IStructuredSelection ss = (IStructuredSelection)selection;
- if (ss.size() != 1) {
- selectedWizard = null;
- selectedWizardId = null;
- setPageComplete(false);
- return;
- }
- ConfigurationWizardElement selectedElement = (ConfigurationWizardElement)ss.getFirstElement();
- try {
- selectedWizard = (IWizard)selectedElement.createExecutableExtension(getUnsharedProjects());
- selectedWizardId = selectedElement.getID();
- } catch (CoreException e) {
- return;
- }
- selectedWizard.addPages();
-
- // Ask the container to update button enablement
- setPageComplete(true);
+ viewer.addSelectionChangedListener(event -> {
+ // Initialize the wizard so we can tell whether to enable the Next button
+ ISelection selection = event.getSelection();
+ if (selection == null || !(selection instanceof IStructuredSelection)) {
+ selectedWizard = null;
+ selectedWizardId = null;
+ setPageComplete(false);
+ return;
}
+ IStructuredSelection ss = (IStructuredSelection)selection;
+ if (ss.size() != 1) {
+ selectedWizard = null;
+ selectedWizardId = null;
+ setPageComplete(false);
+ return;
+ }
+ ConfigurationWizardElement selectedElement = (ConfigurationWizardElement)ss.getFirstElement();
+ try {
+ selectedWizard = selectedElement.createExecutableExtension(getUnsharedProjects());
+ selectedWizardId = selectedElement.getID();
+ } catch (CoreException e) {
+ return;
+ }
+ selectedWizard.addPages();
+
+ // Ask the container to update button enablement
+ setPageComplete(true);
});
viewer.addDoubleClickListener(new IDoubleClickListener() {
@Override
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ExportProjectSetMainPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ExportProjectSetMainPage.java
index 897a18968..29ad6d58d 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ExportProjectSetMainPage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ExportProjectSetMainPage.java
@@ -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
@@ -21,7 +21,6 @@ import org.eclipse.jface.dialogs.*;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.*;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.SashForm;
@@ -129,7 +128,7 @@ public class ExportProjectSetMainPage extends TeamWizardPage {
tempList.addAll(Arrays.asList(projects));
}
- return (IProject[]) tempList.toArray(new IProject[tempList.size()]);
+ return tempList.toArray(new IProject[tempList.size()]);
}
return null;
@@ -207,9 +206,6 @@ public class ExportProjectSetMainPage extends TeamWizardPage {
setDescription(TeamUIMessages.ExportProjectSetMainPage_Initial_description);
}
- /*
- * @see IDialogPage#createControl(Composite)
- */
@Override
public void createControl(Composite parent) {
Composite c = SWTUtils.createHVFillComposite(parent, 0);
@@ -340,35 +336,32 @@ public class ExportProjectSetMainPage extends TeamWizardPage {
tableViewer.setContentProvider(new ProjectContentProvider());
tableViewer.setLabelProvider(new WorkbenchLabelProvider());
tableViewer.setComparator(new ResourceComparator(ResourceComparator.NAME));
- tableViewer.addCheckStateListener(new ICheckStateListener() {
- @Override
- public void checkStateChanged(CheckStateChangedEvent event) {
- Object temp = event.getElement();
- if (temp instanceof IProject){
- IProject project = (IProject) event.getElement();
- if (event.getChecked()) {
- selectedProjects.add(project);
- referenceCountProjects.add(project);
- } else {
- selectedProjects.remove(project);
- referenceCountProjects.remove(project);
+ tableViewer.addCheckStateListener(event -> {
+ Object temp = event.getElement();
+ if (temp instanceof IProject){
+ IProject project = (IProject) event.getElement();
+ if (event.getChecked()) {
+ selectedProjects.add(project);
+ referenceCountProjects.add(project);
+ } else {
+ selectedProjects.remove(project);
+ referenceCountProjects.remove(project);
+ }
+ } else if (temp instanceof IWorkingSet){
+ IWorkingSet workingSet = (IWorkingSet) temp;
+ if (event.getChecked()){
+ IAdaptable[] elements1 = workingSet.getElements();
+ for (int i1 = 0; i1 < elements1.length; i1++) {
+ selectedProjects.add(elements1[i1]);
}
- } else if (temp instanceof IWorkingSet){
- IWorkingSet workingSet = (IWorkingSet) temp;
- if (event.getChecked()){
- IAdaptable[] elements = workingSet.getElements();
- for (int i = 0; i < elements.length; i++) {
- selectedProjects.add(elements[i]);
- }
- } else {
- IAdaptable[] elements = workingSet.getElements();
- for (int i = 0; i < elements.length; i++) {
- selectedProjects.remove(elements[i]);
- }
+ } else {
+ IAdaptable[] elements2 = workingSet.getElements();
+ for (int i2 = 0; i2 < elements2.length; i2++) {
+ selectedProjects.remove(elements2[i2]);
}
}
- updateEnablement();
}
+ updateEnablement();
});
Composite buttonComposite = new Composite(composite, SWT.NONE);
@@ -387,17 +380,14 @@ public class ExportProjectSetMainPage extends TeamWizardPage {
data.widthHint = Math.max(widthHint, selectAll.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
selectAll.setLayoutData(data);
selectAll.setText(TeamUIMessages.ExportProjectSetMainPage_SelectAll);
- selectAll.addListener(SWT.Selection, new Listener() {
- @Override
- public void handleEvent(Event event) {
- tableViewer.setAllChecked(true);
- selectedProjects.removeAll(selectedProjects);
- Object[] checked = tableViewer.getCheckedElements();
- for (int i = 0; i < checked.length; i++) {
- selectedProjects.add(checked[i]);
- }
- updateEnablement();
+ selectAll.addListener(SWT.Selection, event -> {
+ tableViewer.setAllChecked(true);
+ selectedProjects.removeAll(selectedProjects);
+ Object[] checked = tableViewer.getCheckedElements();
+ for (int i = 0; i < checked.length; i++) {
+ selectedProjects.add(checked[i]);
}
+ updateEnablement();
});
Button deselectAll = new Button(buttonComposite, SWT.PUSH);
@@ -408,13 +398,10 @@ public class ExportProjectSetMainPage extends TeamWizardPage {
data.widthHint = Math.max(widthHint, deselectAll.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
deselectAll.setLayoutData(data);
deselectAll.setText(TeamUIMessages.ExportProjectSetMainPage_DeselectAll);
- deselectAll.addListener(SWT.Selection, new Listener() {
- @Override
- public void handleEvent(Event event) {
- tableViewer.setAllChecked(false);
- selectedProjects.removeAll(selectedProjects);
- updateEnablement();
- }
+ deselectAll.addListener(SWT.Selection, event -> {
+ tableViewer.setAllChecked(false);
+ selectedProjects.removeAll(selectedProjects);
+ updateEnablement();
});
}
@@ -524,24 +511,21 @@ public class ExportProjectSetMainPage extends TeamWizardPage {
wsTable.setLayoutData(data);
wsTableViewer.setContentProvider(new ProjectContentProvider());
wsTableViewer.setLabelProvider(new WorkbenchLabelProvider());
- wsTableViewer.addCheckStateListener(new ICheckStateListener() {
- @Override
- public void checkStateChanged(CheckStateChangedEvent event) {
- Object temp = event.getElement();
- if (temp instanceof IWorkingSet){
- IWorkingSet workingSet = (IWorkingSet) temp;
- if (event.getChecked()){
- workingSetAdded(workingSet);
- //Add the selected project to the table viewer
- tableViewer.setInput(selectedProjects);
- } else {
- workingSetRemoved(workingSet);
- //Add the selected project to the table viewer
- tableViewer.setInput(selectedProjects);
- }
+ wsTableViewer.addCheckStateListener(event -> {
+ Object temp = event.getElement();
+ if (temp instanceof IWorkingSet){
+ IWorkingSet workingSet = (IWorkingSet) temp;
+ if (event.getChecked()){
+ workingSetAdded(workingSet);
+ //Add the selected project to the table viewer
+ tableViewer.setInput(selectedProjects);
+ } else {
+ workingSetRemoved(workingSet);
+ //Add the selected project to the table viewer
+ tableViewer.setInput(selectedProjects);
}
- updateEnablement();
}
+ updateEnablement();
});
wsTableViewer.setInput(TeamUIPlugin.getPlugin().getWorkbench().getWorkingSetManager());
@@ -565,25 +549,22 @@ public class ExportProjectSetMainPage extends TeamWizardPage {
data.widthHint = Math.max(widthHint, selectAll.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
selectAll.setLayoutData(data);
selectAll.setText(TeamUIMessages.ExportProjectSetMainPage_SelectAll);
- selectAll.addListener(SWT.Selection, new Listener() {
- @Override
- public void handleEvent(Event event) {
- wsTableViewer.setAllChecked(true);
-
- selectedProjects.removeAll(selectedProjects);
- selectedWorkingSet.removeAll(selectedWorkingSet);
- Object[] checked = wsTableViewer.getCheckedElements();
- for (int i = 0; i < checked.length; i++) {
- selectedWorkingSet.add(checked[i]);
- if (checked[i] instanceof IWorkingSet){
- IWorkingSet ws = (IWorkingSet) checked[i];
- IAdaptable[] elements = ws.getElements();
- addProjects(elements);
- }
- tableViewer.setInput(selectedProjects);
+ selectAll.addListener(SWT.Selection, event -> {
+ wsTableViewer.setAllChecked(true);
+
+ selectedProjects.removeAll(selectedProjects);
+ selectedWorkingSet.removeAll(selectedWorkingSet);
+ Object[] checked = wsTableViewer.getCheckedElements();
+ for (int i = 0; i < checked.length; i++) {
+ selectedWorkingSet.add(checked[i]);
+ if (checked[i] instanceof IWorkingSet){
+ IWorkingSet ws = (IWorkingSet) checked[i];
+ IAdaptable[] elements = ws.getElements();
+ addProjects(elements);
}
- updateEnablement();
+ tableViewer.setInput(selectedProjects);
}
+ updateEnablement();
});
Button deselectAll = new Button(buttonComposite, SWT.PUSH);
@@ -594,16 +575,13 @@ public class ExportProjectSetMainPage extends TeamWizardPage {
data.widthHint = Math.max(widthHint, deselectAll.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
deselectAll.setLayoutData(data);
deselectAll.setText(TeamUIMessages.ExportProjectSetMainPage_DeselectAll);
- deselectAll.addListener(SWT.Selection, new Listener() {
- @Override
- public void handleEvent(Event event) {
- wsTableViewer.setAllChecked(false);
- selectedWorkingSet.removeAll(selectedWorkingSet);
- selectedProjects.removeAll(selectedProjects);
- referenceCountProjects.removeAll(referenceCountProjects);
- tableViewer.setInput(selectedProjects);
- updateEnablement();
- }
+ deselectAll.addListener(SWT.Selection, event -> {
+ wsTableViewer.setAllChecked(false);
+ selectedWorkingSet.removeAll(selectedWorkingSet);
+ selectedProjects.removeAll(selectedProjects);
+ referenceCountProjects.removeAll(referenceCountProjects);
+ tableViewer.setInput(selectedProjects);
+ updateEnablement();
});
Button newWorkingSet = new Button(buttonComposite, SWT.PUSH);
@@ -614,44 +592,39 @@ public class ExportProjectSetMainPage extends TeamWizardPage {
data.widthHint = Math.max(widthHint, deselectAll.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
newWorkingSet.setLayoutData(data);
newWorkingSet.setText(TeamUIMessages.ExportProjectSetMainPage_EditButton);
- newWorkingSet.addListener(SWT.Selection, new Listener() {
- @Override
- public void handleEvent(Event event) {
- final IWorkingSetManager workingSetManager = TeamUIPlugin.getPlugin().getWorkbench().getWorkingSetManager();
- IWorkingSetSelectionDialog wsWizard = workingSetManager.createWorkingSetSelectionDialog(getShell(), false);
- if (wsWizard != null) {
- IPropertyChangeListener propListener = null;
- try {
- //add event listener
- propListener = new IPropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent event) {
-
- }};
-
- workingSetManager.addPropertyChangeListener(propListener);
- wsWizard.open();
- //recalculate working sets
- selectedWorkingSet.removeAll(selectedWorkingSet);
- referenceCountProjects.removeAll(selectedProjects);
- selectedProjects.removeAll(selectedProjects);
- wsTableViewer.setInput(workingSetManager);
- Object[] checked = wsTableViewer.getCheckedElements();
- for (int i = 0; i < checked.length; i++) {
- selectedWorkingSet.add(checked[i]);
- if (checked[i] instanceof IWorkingSet) {
- IWorkingSet ws = (IWorkingSet) checked[i];
- IAdaptable[] elements = ws.getElements();
- addProjects(elements);
- }
+ newWorkingSet.addListener(SWT.Selection, event -> {
+ final IWorkingSetManager workingSetManager = TeamUIPlugin.getPlugin().getWorkbench().getWorkingSetManager();
+ IWorkingSetSelectionDialog wsWizard = workingSetManager.createWorkingSetSelectionDialog(getShell(), false);
+ if (wsWizard != null) {
+ IPropertyChangeListener propListener = null;
+ try {
+ //add event listener
+ propListener = event1 -> {
+
+ };
+
+ workingSetManager.addPropertyChangeListener(propListener);
+ wsWizard.open();
+ //recalculate working sets
+ selectedWorkingSet.removeAll(selectedWorkingSet);
+ referenceCountProjects.removeAll(selectedProjects);
+ selectedProjects.removeAll(selectedProjects);
+ wsTableViewer.setInput(workingSetManager);
+ Object[] checked = wsTableViewer.getCheckedElements();
+ for (int i = 0; i < checked.length; i++) {
+ selectedWorkingSet.add(checked[i]);
+ if (checked[i] instanceof IWorkingSet) {
+ IWorkingSet ws = (IWorkingSet) checked[i];
+ IAdaptable[] elements = ws.getElements();
+ addProjects(elements);
}
-
- wsTableViewer.setInput(workingSetManager);
- tableViewer.setInput(selectedProjects);
- } finally {
- if (propListener != null)
- workingSetManager.removePropertyChangeListener(propListener);
}
+
+ wsTableViewer.setInput(workingSetManager);
+ tableViewer.setInput(selectedProjects);
+ } finally {
+ if (propListener != null)
+ workingSetManager.removePropertyChangeListener(propListener);
}
}
});
@@ -746,7 +719,7 @@ public class ExportProjectSetMainPage extends TeamWizardPage {
if (!tempSet.isEmpty()) {
selectedProjects.removeAll(tempSet);
for (Iterator iterator = tempSet.iterator(); iterator.hasNext();) {
- Object element = (Object) iterator.next();
+ Object element = iterator.next();
referenceCountProjects.remove(element);
}
selectedProjects.addAll(referenceCountProjects);
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/PageSaveablePart.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/PageSaveablePart.java
index ca283f433..8facab478 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/PageSaveablePart.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/PageSaveablePart.java
@@ -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
@@ -21,7 +21,6 @@ import org.eclipse.compare.internal.CompareEditorInputNavigator;
import org.eclipse.compare.structuremergeviewer.ICompareInput;
import org.eclipse.core.runtime.*;
import org.eclipse.jface.action.ToolBarManager;
-import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.*;
@@ -275,12 +274,9 @@ public abstract class PageSaveablePart extends SaveablePartAdapter implements IC
IProgressService manager = PlatformUI.getWorkbench().getProgressService();
try {
// TODO: we need a better progress story here (i.e. support for cancellation) bug 127075
- manager.busyCursorWhile(new IRunnableWithProgress() {
- @Override
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- prepareInput(input, getCompareConfiguration(), monitor);
- hookContentChangeListener(input);
- }
+ manager.busyCursorWhile(monitor -> {
+ prepareInput(input, getCompareConfiguration(), monitor);
+ hookContentChangeListener(input);
});
} catch (InvocationTargetException e) {
Utils.handle(e);
@@ -427,7 +423,7 @@ public abstract class PageSaveablePart extends SaveablePartAdapter implements IC
for (int i=0; i<fDirtyViewers.size(); i++){
Object element = iter.next();
- IFlushable flushable = (IFlushable)Adapters.adapt(element, IFlushable.class);
+ IFlushable flushable = Adapters.adapt(element, IFlushable.class);
if (flushable != null)
flushable.flush(monitor);
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/history/HistoryPageCompareEditorInput.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/history/HistoryPageCompareEditorInput.java
index 600eac128..2d29db066 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/history/HistoryPageCompareEditorInput.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/history/HistoryPageCompareEditorInput.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
@@ -40,12 +40,7 @@ public class HistoryPageCompareEditorInput extends PageCompareEditorInput {
private DialogHistoryPageSite site;
private final Object object;
private final IHistoryPageSource pageSource;
- private final IPropertyChangeListener changeListener = new IPropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent event) {
- handlePropertyChange(event);
- }
- };
+ private final IPropertyChangeListener changeListener = event -> handlePropertyChange(event);
private boolean isReplace;
/**
@@ -102,15 +97,12 @@ public class HistoryPageCompareEditorInput extends PageCompareEditorInput {
return (IPage)historyPage;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.PageCompareEditorInput#asCompareInput(org.eclipse.jface.viewers.ISelection)
- */
@Override
protected ICompareInput asCompareInput(ISelection selection) {
ICompareInput compareInput = super.asCompareInput(selection);
if (compareInput != null)
return compareInput;
- IHistoryCompareAdapter compareAdapter = (IHistoryCompareAdapter) Adapters.adapt(historyPage, IHistoryCompareAdapter.class);
+ IHistoryCompareAdapter compareAdapter = Adapters.adapt(historyPage, IHistoryCompareAdapter.class);
if (compareAdapter != null){
if (selection instanceof IStructuredSelection) {
IStructuredSelection ss= (IStructuredSelection) selection;
@@ -123,22 +115,16 @@ public class HistoryPageCompareEditorInput extends PageCompareEditorInput {
return null;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.PageCompareEditorInput#getSelectionProvider()
- */
@Override
protected ISelectionProvider getSelectionProvider() {
return site.getSelectionProvider();
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.PageCompareEditorInput#prepareInput(org.eclipse.compare.structuremergeviewer.ICompareInput, org.eclipse.compare.CompareConfiguration, org.eclipse.core.runtime.IProgressMonitor)
- */
@Override
protected void prepareInput(ICompareInput input,
CompareConfiguration configuration, IProgressMonitor monitor)
throws InvocationTargetException {
- IHistoryCompareAdapter compareAdapter = (IHistoryCompareAdapter) Adapters.adapt(historyPage, IHistoryCompareAdapter.class);
+ IHistoryCompareAdapter compareAdapter = Adapters.adapt(historyPage, IHistoryCompareAdapter.class);
if (compareAdapter != null){
compareAdapter.prepareInput(input, configuration, monitor);
}
@@ -160,26 +146,13 @@ public class HistoryPageCompareEditorInput extends PageCompareEditorInput {
protected void handlePropertyChange(PropertyChangeEvent event) {
if (event.getSource() == historyPage) {
if (event.getProperty().equals(IHistoryPage.P_NAME)) {
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- setTitle(historyPage.getName());
- }
- });
+ Display.getDefault().asyncExec(() -> setTitle(historyPage.getName()));
} else if (event.getProperty().equals(IHistoryPage.P_DESCRIPTION)) {
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- setPageDescription(historyPage.getDescription());
- }
- });
+ Display.getDefault().asyncExec(() -> setPageDescription(historyPage.getDescription()));
}
}
}
- /* (non-Javadoc)
- * @see org.eclipse.compare.CompareEditorInput#isEditionSelectionDialog()
- */
@Override
public boolean isEditionSelectionDialog() {
return isReplaceDialog();
@@ -205,9 +178,6 @@ public class HistoryPageCompareEditorInput extends PageCompareEditorInput {
this.isReplace = isReplace;
}
- /* (non-Javadoc)
- * @see org.eclipse.compare.CompareEditorInput#getOKButtonLabel()
- */
@Override
public String getOKButtonLabel() {
if (isReplaceDialog())
@@ -215,9 +185,6 @@ public class HistoryPageCompareEditorInput extends PageCompareEditorInput {
return super.getOKButtonLabel();
}
- /* (non-Javadoc)
- * @see org.eclipse.compare.CompareEditorInput#okPressed()
- */
@Override
public boolean okPressed() {
if (!isReplaceDialog())
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/history/HistoryPageSaveablePart.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/history/HistoryPageSaveablePart.java
index 55109ba38..f98748b8e 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/history/HistoryPageSaveablePart.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/history/HistoryPageSaveablePart.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
@@ -86,32 +86,21 @@ public class HistoryPageSaveablePart extends PageSaveablePart {
this.pageSource = pageSource;
this.object = object;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.PageSaveablePart#getTitle()
- */
+
@Override
public String getTitle() {
return historyPage.getName();
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.PageSaveablePart#getTitleImage()
- */
@Override
public Image getTitleImage() {
return null;
}
- /* (non-Javadoc)
- * @see org.eclipse.compare.IContentChangeListener#contentChanged(org.eclipse.compare.IContentChangeNotifier)
- */
@Override
public void contentChanged(IContentChangeNotifier source) {
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.PageSaveablePart#createPage(org.eclipse.swt.widgets.Composite, org.eclipse.jface.action.ToolBarManager)
- */
@Override
protected Control createPage(Composite parent, ToolBarManager toolBarManager) {
site = new DialogHistoryPageSite(getShell());
@@ -127,23 +116,17 @@ public class HistoryPageSaveablePart extends PageSaveablePart {
return ((Page) historyPage).getControl();
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.PageSaveablePart#getPageSelectionProvider()
- */
@Override
protected final ISelectionProvider getSelectionProvider() {
return site.getSelectionProvider();
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.PageSaveablePart#getCompareInput(org.eclipse.jface.viewers.ISelection)
- */
@Override
protected ICompareInput getCompareInput(ISelection selection) {
ICompareInput compareInput = super.getCompareInput(selection);
if (compareInput != null)
return compareInput;
- IHistoryCompareAdapter compareAdapter = (IHistoryCompareAdapter) Adapters.adapt(historyPage, IHistoryCompareAdapter.class);
+ IHistoryCompareAdapter compareAdapter = Adapters.adapt(historyPage, IHistoryCompareAdapter.class);
if (compareAdapter != null){
if (selection instanceof IStructuredSelection) {
IStructuredSelection ss= (IStructuredSelection) selection;
@@ -156,20 +139,14 @@ public class HistoryPageSaveablePart extends PageSaveablePart {
return null;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.PageSaveablePart#prepareInput(org.eclipse.compare.structuremergeviewer.ICompareInput, org.eclipse.compare.CompareConfiguration, org.eclipse.core.runtime.IProgressMonitor)
- */
@Override
protected void prepareInput(ICompareInput input, CompareConfiguration configuration, IProgressMonitor monitor) throws InvocationTargetException {
- IHistoryCompareAdapter compareAdapter = (IHistoryCompareAdapter) Adapters.adapt(historyPage, IHistoryCompareAdapter.class);
+ IHistoryCompareAdapter compareAdapter = Adapters.adapt(historyPage, IHistoryCompareAdapter.class);
if (compareAdapter != null){
compareAdapter.prepareInput(input, configuration, monitor);
}
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.SaveablePartAdapter#dispose()
- */
@Override
public void dispose() {
super.dispose();
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/history/HistoryPageSource.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/history/HistoryPageSource.java
index 77a0a8c8b..a8a5b786a 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/history/HistoryPageSource.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/history/HistoryPageSource.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,16 +38,16 @@ public abstract class HistoryPageSource implements IHistoryPageSource {
if (provider != null) {
IFileHistoryProvider fileHistoryProvider = provider.getFileHistoryProvider();
if (fileHistoryProvider != null) {
- IHistoryPageSource pageSource = (IHistoryPageSource)Adapters.adapt(fileHistoryProvider, IHistoryPageSource.class);
+ IHistoryPageSource pageSource = Adapters.adapt(fileHistoryProvider, IHistoryPageSource.class);
if (pageSource != null)
return pageSource;
}
- IHistoryPageSource pageSource = (IHistoryPageSource)Adapters.adapt(provider, IHistoryPageSource.class);
+ IHistoryPageSource pageSource = Adapters.adapt(provider, IHistoryPageSource.class);
if (pageSource != null)
return pageSource;
}
}
- IHistoryPageSource pageSource = (IHistoryPageSource)Adapters.adapt(object, IHistoryPageSource.class);
+ IHistoryPageSource pageSource = Adapters.adapt(object, IHistoryPageSource.class);
return pageSource;
}
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 d7cdf17a3..8d13f95af 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
@@ -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
@@ -19,8 +19,6 @@ import org.eclipse.core.runtime.Adapters;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.text.revisions.*;
import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
import org.eclipse.team.core.history.IFileRevision;
import org.eclipse.team.core.variants.IResourceVariant;
import org.eclipse.team.internal.ui.TeamUIMessages;
@@ -48,31 +46,25 @@ public abstract class RevisionAnnotationController {
private ISelectionProvider fRulerSelectionProvider;
private ISelectionProvider fHistoryListSelectionProvider;
- private ISelectionChangedListener rulerListener = new ISelectionChangedListener() {
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- ISelection selection= event.getSelection();
- Revision selected= null;
- if (selection instanceof IStructuredSelection)
- selected= (Revision) ((IStructuredSelection) selection).getFirstElement();
-
- if (selected == null)
- return;
-
- revisionSelected(selected);
- }
+ private ISelectionChangedListener rulerListener = event -> {
+ ISelection selection= event.getSelection();
+ Revision selected= null;
+ if (selection instanceof IStructuredSelection)
+ selected= (Revision) ((IStructuredSelection) selection).getFirstElement();
+
+ if (selected == null)
+ return;
+
+ revisionSelected(selected);
};
- private ISelectionChangedListener historyListListener = new ISelectionChangedListener() {
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- ISelection selection= event.getSelection();
- if (selection instanceof IStructuredSelection) {
- IStructuredSelection ss = (IStructuredSelection) selection;
- if (ss.size() == 1) {
- Object first= ss.getFirstElement();
- if (first != null)
- historyEntrySelected(first);
- }
+ private ISelectionChangedListener historyListListener = event -> {
+ ISelection selection= event.getSelection();
+ if (selection instanceof IStructuredSelection) {
+ IStructuredSelection ss = (IStructuredSelection) selection;
+ if (ss.size() == 1) {
+ Object first= ss.getFirstElement();
+ if (first != null)
+ historyEntrySelected(first);
}
}
};
@@ -274,7 +266,7 @@ public abstract class RevisionAnnotationController {
if (editor == null)
return null;
- IRevisionRulerColumn column= (IRevisionRulerColumn) editor.getAdapter(IRevisionRulerColumn.class);
+ IRevisionRulerColumn column= editor.getAdapter(IRevisionRulerColumn.class);
if (column instanceof IRevisionRulerColumnExtension) {
if (column.getControl() != null && column.getControl().isDisposed())
return null;
@@ -295,12 +287,7 @@ public abstract class RevisionAnnotationController {
fRulerSelectionProvider.addSelectionChangedListener(rulerListener);
fHistoryListSelectionProvider.addSelectionChangedListener(historyListListener);
- ((IRevisionRulerColumn)revisionRuler).getControl().addDisposeListener(new DisposeListener() {
- @Override
- public void widgetDisposed(DisposeEvent e) {
- dispose();
- }
- });
+ ((IRevisionRulerColumn)revisionRuler).getControl().addDisposeListener(e -> dispose());
}
/**
@@ -391,11 +378,11 @@ public abstract class RevisionAnnotationController {
* @return the id of the entry
*/
protected String getRevisionId(Object historyEntry) {
- IFileRevision revision= (IFileRevision)Adapters.adapt(historyEntry, IFileRevision.class);
+ IFileRevision revision= Adapters.adapt(historyEntry, IFileRevision.class);
if (revision != null) {
return revision.getContentIdentifier();
}
- IResourceVariant variant = (IResourceVariant)Adapters.adapt(historyEntry, IResourceVariant.class);
+ IResourceVariant variant = Adapters.adapt(historyEntry, IResourceVariant.class);
if (variant != null)
return variant.getContentIdentifier();
return null;
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/SynchronizationCompareAdapter.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/SynchronizationCompareAdapter.java
index 54fe9a87a..c50e72c38 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/SynchronizationCompareAdapter.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/SynchronizationCompareAdapter.java
@@ -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
@@ -55,21 +55,15 @@ public abstract class SynchronizationCompareAdapter implements ISynchronizationC
return null;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.mapping.ICompareAdapter#hasCompareInput(org.eclipse.team.core.mapping.ISynchronizationContext, java.lang.Object)
- */
@Override
public boolean hasCompareInput(ISynchronizationContext context, Object object) {
return asCompareInput(context, object) != null;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.mapping.IResourceMappingPersistenceAdapter#getName(org.eclipse.core.resources.mapping.ResourceMapping)
- */
@Override
public String getName(ResourceMapping mapping) {
Object object = mapping.getModelObject();
- IWorkbenchAdapter adapter = (IWorkbenchAdapter) Adapters.adapt(object, IWorkbenchAdapter.class);
+ IWorkbenchAdapter adapter = Adapters.adapt(object, IWorkbenchAdapter.class);
if (adapter != null) {
String label = adapter.getLabel(object);
if (label != null)
@@ -88,13 +82,10 @@ public abstract class SynchronizationCompareAdapter implements ISynchronizationC
return ""; //$NON-NLS-1$
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.mapping.IResourceMappingPersistenceAdapter#getFullPath(org.eclipse.core.resources.mapping.ResourceMapping)
- */
@Override
public String getPathString(ResourceMapping mapping) {
Object object = mapping.getModelObject();
- IWorkbenchAdapter adapter = (IWorkbenchAdapter) Adapters.adapt(object, IWorkbenchAdapter.class);
+ IWorkbenchAdapter adapter = Adapters.adapt(object, IWorkbenchAdapter.class);
if (adapter != null) {
List segments = new ArrayList();
Object parent = object;
@@ -116,9 +107,6 @@ public abstract class SynchronizationCompareAdapter implements ISynchronizationC
return getName(mapping);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.mapping.ISynchronizationCompareAdapter#getImageDescriptor(org.eclipse.core.resources.mapping.ResourceMapping)
- */
@Override
public ImageDescriptor getImageDescriptor(ResourceMapping mapping) {
Object object = mapping.getModelObject();
@@ -141,7 +129,7 @@ public abstract class SynchronizationCompareAdapter implements ISynchronizationC
}
private ImageDescriptor getImageDescriptorFromWorkbenchAdapter(Object object) {
- IWorkbenchAdapter adapter = (IWorkbenchAdapter) Adapters.adapt(object, IWorkbenchAdapter.class);
+ IWorkbenchAdapter adapter = Adapters.adapt(object, IWorkbenchAdapter.class);
if (adapter != null) {
return adapter.getImageDescriptor(object);
}
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 521c9bd01..420e22f6b 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
@@ -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
@@ -42,25 +42,16 @@ public abstract class SynchronizationContentProvider implements ICommonContentPr
private boolean empty;
private ICommonContentExtensionSite site;
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
- */
@Override
public Object[] getChildren(Object parent) {
return internalGetChildren(parent, false);
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
- */
@Override
public Object[] getElements(Object parent) {
return internalGetChildren(parent, true);
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
- */
@Override
public Object getParent(Object element) {
element = internalGetElement(element);
@@ -74,9 +65,6 @@ public abstract class SynchronizationContentProvider implements ICommonContentPr
return parent;
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
- */
@Override
public boolean hasChildren(Object element) {
return internalHasChildren(element);
@@ -253,9 +241,6 @@ public abstract class SynchronizationContentProvider implements ICommonContentPr
return context.getDiffTree().getDiffs(traversals).length > 0;
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IContentProvider#dispose()
- */
@Override
public void dispose() {
ICommonContentExtensionSite extensionSite = getExtensionSite();
@@ -270,18 +255,12 @@ public abstract class SynchronizationContentProvider implements ICommonContentPr
configuration.removePropertyChangeListener(this);
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
- */
@Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
this.viewer = viewer;
getDelegateContentProvider().inputChanged(viewer, oldInput, newInput);
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.navigator.ICommonContentProvider#init(org.eclipse.ui.navigator.ICommonContentExtensionSite)
- */
@Override
public void init(ICommonContentExtensionSite site) {
// Set the site
@@ -300,9 +279,6 @@ public abstract class SynchronizationContentProvider implements ICommonContentPr
context.getDiffTree().addDiffChangeListener(this);
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
- */
@Override
public void propertyChange(PropertyChangeEvent event) {
// TODO: this could happen at the root as well
@@ -382,9 +358,6 @@ public abstract class SynchronizationContentProvider implements ICommonContentPr
return null;
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.navigator.IMementoAware#restoreState(org.eclipse.ui.IMemento)
- */
@Override
public void restoreState(IMemento aMemento) {
ITreeContentProvider provider = getDelegateContentProvider();
@@ -393,9 +366,6 @@ public abstract class SynchronizationContentProvider implements ICommonContentPr
}
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.navigator.IMementoAware#saveState(org.eclipse.ui.IMemento)
- */
@Override
public void saveState(IMemento aMemento) {
ITreeContentProvider provider = getDelegateContentProvider();
@@ -404,17 +374,11 @@ public abstract class SynchronizationContentProvider implements ICommonContentPr
}
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.delta.ISyncDeltaChangeListener#syncDeltaTreeChanged(org.eclipse.team.core.delta.ISyncDeltaChangeEvent, org.eclipse.core.runtime.IProgressMonitor)
- */
@Override
public void diffsChanged(IDiffChangeEvent event, IProgressMonitor monitor) {
refresh();
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.diff.IDiffChangeListener#propertyChanged(int, org.eclipse.core.runtime.IPath[])
- */
@Override
public void propertyChanged(IDiffTree tree, int property, IPath[] paths) {
// Property changes only affect labels
@@ -424,17 +388,13 @@ public abstract class SynchronizationContentProvider implements ICommonContentPr
* Refresh the subtree associated with this model.
*/
protected void refresh() {
- Utils.syncExec(new Runnable() {
- @Override
- public void run() {
- TreeViewer treeViewer = ((TreeViewer)getViewer());
- // TODO: Need to know if the model root is present in order to refresh properly
- if (empty)
- treeViewer.refresh();
- else
- treeViewer.refresh(getModelProvider());
- }
-
+ Utils.syncExec((Runnable) () -> {
+ TreeViewer treeViewer = ((TreeViewer)getViewer());
+ // TODO: Need to know if the model root is present in order to refresh properly
+ if (empty)
+ treeViewer.refresh();
+ else
+ treeViewer.refresh(getModelProvider());
}, getViewer().getControl());
}
@@ -651,7 +611,7 @@ public abstract class SynchronizationContentProvider implements ICommonContentPr
protected boolean isInScope(ISynchronizationScope scope, Object parent, Object element) {
ResourceMapping mapping = Utils.getResourceMapping(internalGetElement(element));
if (mapping != null) {
- ResourceMapping[] mappings = ((ISynchronizationScope)scope).getMappings(mapping.getModelProviderId());
+ ResourceMapping[] mappings = scope.getMappings(mapping.getModelProviderId());
for (int i = 0; i < mappings.length; i++) {
ResourceMapping sm = mappings[i];
if (mapping.contains(sm)) {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/AbstractSynchronizeParticipant.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/AbstractSynchronizeParticipant.java
index 630fbb8ca..d196ed7c8 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/AbstractSynchronizeParticipant.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/AbstractSynchronizeParticipant.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
@@ -72,34 +72,21 @@ public abstract class AbstractSynchronizeParticipant extends PlatformObject impl
public AbstractSynchronizeParticipant() {
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizeParticipant#getName()
- */
@Override
public String getName() {
return fName;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizeParticipant#getImageDescriptor()
- */
@Override
public ImageDescriptor getImageDescriptor() {
return fImageDescriptor;
}
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizeParticipant#getId()
- */
@Override
public String getId() {
return fId;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizeParticipant#getSecondaryId()
- */
@Override
public String getSecondaryId() {
return fSecondaryId;
@@ -122,9 +109,6 @@ public abstract class AbstractSynchronizeParticipant extends PlatformObject impl
: fHelpContextId;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizeParticipant#setPinned(boolean)
- */
@Override
public final void setPinned(boolean pinned) {
this.pinned = pinned;
@@ -132,9 +116,6 @@ public abstract class AbstractSynchronizeParticipant extends PlatformObject impl
firePropertyChange(this, P_PINNED, Boolean.valueOf(!pinned), Boolean.valueOf(pinned));
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizeParticipant#isPinned()
- */
@Override
public final boolean isPinned() {
return pinned;
@@ -149,9 +130,6 @@ public abstract class AbstractSynchronizeParticipant extends PlatformObject impl
// Subclasses can re-act to changes in the pinned state
}
- /* (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
@Override
public boolean equals(Object obj) {
if(obj == this) return true;
@@ -160,9 +138,6 @@ public abstract class AbstractSynchronizeParticipant extends PlatformObject impl
return getId().equals(other.getId()) && Utils.equalObject(getSecondaryId(), other.getSecondaryId());
}
- /* (non-Javadoc)
- * @see java.lang.Object#hashCode()
- */
@Override
public int hashCode() {
return Utils.getKey(getId(), getSecondaryId()).hashCode();
@@ -180,9 +155,6 @@ public abstract class AbstractSynchronizeParticipant extends PlatformObject impl
return true;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizeParticipant#addPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener)
- */
@Override
public synchronized void addPropertyChangeListener(IPropertyChangeListener listener) {
if (fChangeHandler == null) {
@@ -191,9 +163,6 @@ public abstract class AbstractSynchronizeParticipant extends PlatformObject impl
fChangeHandler.addPropertyChangeListener(listener);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizeParticipant#removePropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener)
- */
@Override
public void removePropertyChangeListener(IPropertyChangeListener listener) {
if (fChangeHandler != null) {
@@ -216,9 +185,6 @@ public abstract class AbstractSynchronizeParticipant extends PlatformObject impl
fChangeHandler.firePropertyChange(source, property, oldValue, newValue);
}
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IExecutableExtension#setInitializationData(org.eclipse.core.runtime.IConfigurationElement, java.lang.String, java.lang.Object)
- */
@Override
public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException {
// Save config element.
@@ -307,17 +273,11 @@ public abstract class AbstractSynchronizeParticipant extends PlatformObject impl
pinned = Boolean.valueOf(memento.getString(CTX_PINNED)).booleanValue();
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizeParticipant#saveState(org.eclipse.ui.IMemento)
- */
@Override
public void saveState(IMemento memento) {
memento.putString(CTX_PINNED, Boolean.toString(pinned));
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizeParticipant#createPageConfiguration()
- */
@Override
public final ISynchronizePageConfiguration createPageConfiguration() {
SynchronizePageConfiguration configuration = new SynchronizePageConfiguration(this);
@@ -371,14 +331,11 @@ public abstract class AbstractSynchronizeParticipant extends PlatformObject impl
*/
private SyncInfo getSyncInfo(ISynchronizeModelElement element) {
if (element instanceof IAdaptable) {
- return (SyncInfo)((IAdaptable)element).getAdapter(SyncInfo.class);
+ return ((IAdaptable)element).getAdapter(SyncInfo.class);
}
return null;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizeParticipant#getPreferencePages()
- */
@Override
public PreferencePage[] getPreferencePages() {
return new PreferencePage[] { new SyncViewerPreferencePage() };
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ModelMergeOperation.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ModelMergeOperation.java
index 2ace5227a..48ad9bbfd 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ModelMergeOperation.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ModelMergeOperation.java
@@ -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
@@ -99,7 +99,7 @@ public abstract class ModelMergeOperation extends ModelOperation {
*/
private static IResourceMappingMerger getMerger(ModelProvider provider) {
Assert.isNotNull(provider);
- return (IResourceMappingMerger)Adapters.adapt(provider, IResourceMappingMerger.class);
+ return Adapters.adapt(provider, IResourceMappingMerger.class);
}
/**
@@ -205,9 +205,7 @@ public abstract class ModelMergeOperation extends ModelOperation {
true);
createDetailsButton(parent);
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.ErrorDialog#buttonPressed(int)
- */
+
@Override
protected void buttonPressed(int id) {
if (id == IDialogConstants.YES_ID)
@@ -233,12 +231,7 @@ public abstract class ModelMergeOperation extends ModelOperation {
* @param status the status returned from the merger that reported the conflict
*/
protected void handleMergeFailure(final IStatus status) {
- Display.getDefault().syncExec(new Runnable() {
- @Override
- public void run() {
- MessageDialog.openInformation(getShell(), TeamUIMessages.MergeIncomingChangesAction_0, status.getMessage());
- };
- });
+ Display.getDefault().syncExec(() -> MessageDialog.openInformation(getShell(), TeamUIMessages.MergeIncomingChangesAction_0, status.getMessage()));
handlePreviewRequest();
}
@@ -248,12 +241,7 @@ public abstract class ModelMergeOperation extends ModelOperation {
* Subclasses may override.
*/
protected void handleNoChanges() {
- Display.getDefault().syncExec(new Runnable() {
- @Override
- public void run() {
- NoChangesDialog.open(getShell(), TeamUIMessages.ResourceMappingMergeOperation_0, TeamUIMessages.ResourceMappingMergeOperation_1, TeamUIMessages.ModelMergeOperation_3, getScope().asInputScope());
- };
- });
+ Display.getDefault().syncExec(() -> NoChangesDialog.open(getShell(), TeamUIMessages.ResourceMappingMergeOperation_0, TeamUIMessages.ResourceMappingMergeOperation_1, TeamUIMessages.ModelMergeOperation_3, getScope().asInputScope()));
}
/**
@@ -278,30 +266,27 @@ public abstract class ModelMergeOperation extends ModelOperation {
IMergeContext context = (IMergeContext) sc;
final ModelProvider[] providers = sortByExtension(context.getScope().getModelProviders());
final IStatus[] result = new IStatus[] { Status.OK_STATUS };
- context.run(new IWorkspaceRunnable() {
- @Override
- public void run(IProgressMonitor monitor) throws CoreException {
- try {
- int ticks = 100;
- monitor.beginTask(null, ticks + ((providers.length - 1) * 10));
- for (int i = 0; i < providers.length; i++) {
- ModelProvider provider = providers[i];
- IStatus status = performMerge(provider, Policy.subMonitorFor(monitor, ticks));
- ticks = 10;
- if (!status.isOK()) {
- // Stop at the first failure
- result[0] = status;
- return;
- }
- try {
- Job.getJobManager().join(getContext(), monitor);
- } catch (InterruptedException e) {
- // Ignore
- }
+ context.run(monitor1 -> {
+ try {
+ int ticks = 100;
+ monitor1.beginTask(null, ticks + ((providers.length - 1) * 10));
+ for (int i = 0; i < providers.length; i++) {
+ ModelProvider provider = providers[i];
+ IStatus status = performMerge(provider, Policy.subMonitorFor(monitor1, ticks));
+ ticks = 10;
+ if (!status.isOK()) {
+ // Stop at the first failure
+ result[0] = status;
+ return;
+ }
+ try {
+ Job.getJobManager().join(getContext(), monitor1);
+ } catch (InterruptedException e) {
+ // Ignore
}
- } finally {
- monitor.done();
}
+ } finally {
+ monitor1.done();
}
}, null /* scheduling rule */, IResource.NONE, monitor);
return result[0];
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ModelSynchronizeParticipant.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ModelSynchronizeParticipant.java
index 73e16119a..3181eb383 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ModelSynchronizeParticipant.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ModelSynchronizeParticipant.java
@@ -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
@@ -115,14 +115,11 @@ public class ModelSynchronizeParticipant extends
}
};
- private IPropertyListener dirtyListener = new IPropertyListener() {
- @Override
- public void propertyChanged(Object source, int propId) {
- if (source instanceof SaveableComparison && propId == SaveableComparison.PROP_DIRTY) {
- SaveableComparison scm = (SaveableComparison) source;
- boolean isDirty = scm.isDirty();
- firePropertyChange(ModelSynchronizeParticipant.this, PROP_DIRTY, Boolean.valueOf(!isDirty), Boolean.valueOf(isDirty));
- }
+ private IPropertyListener dirtyListener = (source, propId) -> {
+ if (source instanceof SaveableComparison && propId == SaveableComparison.PROP_DIRTY) {
+ SaveableComparison scm = (SaveableComparison) source;
+ boolean isDirty = scm.isDirty();
+ firePropertyChange(ModelSynchronizeParticipant.this, PROP_DIRTY, Boolean.valueOf(!isDirty), Boolean.valueOf(isDirty));
}
};
@@ -168,9 +165,6 @@ public class ModelSynchronizeParticipant extends
public ModelSynchronizeParticipant() {
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.AbstractSynchronizeParticipant#getName()
- */
@Override
public String getName() {
String name = super.getName();
@@ -190,9 +184,6 @@ public class ModelSynchronizeParticipant extends
return super.getName();
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.AbstractSynchronizeParticipant#initializeConfiguration(org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration)
- */
@Override
protected void initializeConfiguration(
ISynchronizePageConfiguration configuration) {
@@ -220,18 +211,12 @@ public class ModelSynchronizeParticipant extends
return new ModelSynchronizeParticipantActionGroup();
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizeParticipant#createPage(org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration)
- */
@Override
public final IPageBookViewPage createPage(
ISynchronizePageConfiguration configuration) {
return new ModelSynchronizePage(configuration);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizeParticipant#run(org.eclipse.ui.IWorkbenchPart)
- */
@Override
public void run(IWorkbenchPart part) {
refresh(part != null ? part.getSite() : null, context.getScope().getMappings());
@@ -252,9 +237,6 @@ public class ModelSynchronizeParticipant extends
internalRefresh(mappings, null, null, site, listener);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizeParticipant#dispose()
- */
@Override
public void dispose() {
context.dispose();
@@ -432,24 +414,19 @@ public class ModelSynchronizeParticipant extends
};
}
- /* (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();
}
if (adapter == SubscriberRefreshSchedule.class) {
- return refreshSchedule;
+ return (T) refreshSchedule;
}
return super.getAdapter(adapter);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizeParticipant#saveState(org.eclipse.ui.IMemento)
- */
@Override
public void saveState(IMemento memento) {
super.saveState(memento);
@@ -476,9 +453,6 @@ public class ModelSynchronizeParticipant extends
}
}
- /* (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);
@@ -643,9 +617,6 @@ public class ModelSynchronizeParticipant extends
return getContext().getScope().getModelProviders();
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.AbstractSynchronizeParticipant#getPreferencePages()
- */
@Override
public PreferencePage[] getPreferencePages() {
List pages = new ArrayList();
@@ -685,7 +656,7 @@ public class ModelSynchronizeParticipant extends
}
private SubscriberDiffTreeEventHandler getHandler() {
- return (SubscriberDiffTreeEventHandler)Adapters.adapt(context, SubscriberDiffTreeEventHandler.class);
+ return Adapters.adapt(context, SubscriberDiffTreeEventHandler.class);
}
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ParticipantPageCompareEditorInput.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ParticipantPageCompareEditorInput.java
index 867bb0927..ecc2e495c 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ParticipantPageCompareEditorInput.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ParticipantPageCompareEditorInput.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
+ * Copyright (c) 2007, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -18,7 +18,6 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.*;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.*;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
@@ -74,9 +73,6 @@ public class ParticipantPageCompareEditorInput extends PageCompareEditorInput {
pageConfiguration.setRunnableContext(this);
}
- /* (non-Javadoc)
- * @see org.eclipse.compare.CompareEditorInput#prepareInput(org.eclipse.core.runtime.IProgressMonitor)
- */
@Override
protected Object prepareInput(IProgressMonitor monitor)
throws InvocationTargetException, InterruptedException {
@@ -84,9 +80,6 @@ public class ParticipantPageCompareEditorInput extends PageCompareEditorInput {
return participant;
}
- /* (non-Javadoc)
- * @see org.eclipse.compare.CompareEditorInput#getTitleImage()
- */
@Override
public Image getTitleImage() {
if(titleImage == null) {
@@ -95,9 +88,6 @@ public class ParticipantPageCompareEditorInput extends PageCompareEditorInput {
return titleImage;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.PageCompareEditorInput#handleDispose()
- */
@Override
protected void handleDispose() {
if(titleImage != null) {
@@ -111,18 +101,12 @@ public class ParticipantPageCompareEditorInput extends PageCompareEditorInput {
super.handleDispose();
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.PageCompareEditorInput#createPage(org.eclipse.compare.CompareViewerPane, org.eclipse.jface.action.IToolBarManager)
- */
@Override
protected IPage createPage(CompareViewerPane parent,
IToolBarManager toolBarManager) {
- listener = new IPropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent event) {
- if (event.getProperty().equals(ISynchronizePageConfiguration.P_PAGE_DESCRIPTION)) {
- updateDescription();
- }
+ listener = event -> {
+ if (event.getProperty().equals(ISynchronizePageConfiguration.P_PAGE_DESCRIPTION)) {
+ updateDescription();
}
};
pageConfiguration.addPropertyChangeListener(listener);
@@ -151,9 +135,6 @@ public class ParticipantPageCompareEditorInput extends PageCompareEditorInput {
}
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.PageCompareEditorInput#getSelectionProvider()
- */
@Override
protected ISelectionProvider getSelectionProvider() {
return ((ISynchronizePage)page).getViewer();
@@ -178,9 +159,6 @@ public class ParticipantPageCompareEditorInput extends PageCompareEditorInput {
return null;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.PageCompareEditorInput#prepareInput(org.eclipse.compare.structuremergeviewer.ICompareInput, org.eclipse.compare.CompareConfiguration, org.eclipse.core.runtime.IProgressMonitor)
- */
@Override
protected void prepareInput(ICompareInput input,
CompareConfiguration configuration, IProgressMonitor monitor)
@@ -221,12 +199,9 @@ public class ParticipantPageCompareEditorInput extends PageCompareEditorInput {
}
private ISynchronizationCompareInput asModelCompareInput(ICompareInput input) {
- return (ISynchronizationCompareInput)Adapters.adapt(input, ISynchronizationCompareInput.class);
+ return Adapters.adapt(input, ISynchronizationCompareInput.class);
}
- /* (non-Javadoc)
- * @see org.eclipse.compare.CompareEditorInput#isSaveNeeded()
- */
@Override
public boolean isSaveNeeded() {
if (participant instanceof ModelSynchronizeParticipant) {
@@ -239,9 +214,6 @@ public class ParticipantPageCompareEditorInput extends PageCompareEditorInput {
return super.isSaveNeeded();
}
- /* (non-Javadoc)
- * @see org.eclipse.compare.CompareEditorInput#saveChanges(org.eclipse.core.runtime.IProgressMonitor)
- */
@Override
public void saveChanges(IProgressMonitor monitor) throws CoreException {
super.saveChanges(monitor);
@@ -275,9 +247,6 @@ public class ParticipantPageCompareEditorInput extends PageCompareEditorInput {
}
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.PageCompareEditorInput#contentChanged(org.eclipse.compare.IContentChangeNotifier)
- */
@Override
public void contentChanged(IContentChangeNotifier source) {
super.contentChanged(source);
@@ -310,9 +279,6 @@ public class ParticipantPageCompareEditorInput extends PageCompareEditorInput {
return participant;
}
- /* (non-Javadoc)
- * @see org.eclipse.compare.CompareEditorInput#createContents(org.eclipse.swt.widgets.Composite)
- */
@Override
public Control createContents(Composite parent) {
if (shouldCreateRememberButton()) {
@@ -360,9 +326,6 @@ public class ParticipantPageCompareEditorInput extends PageCompareEditorInput {
}
}
- /* (non-Javadoc)
- * @see org.eclipse.compare.CompareEditorInput#okPressed()
- */
@Override
public boolean okPressed() {
if (isEditable()) {
@@ -376,9 +339,6 @@ public class ParticipantPageCompareEditorInput extends PageCompareEditorInput {
return super.okPressed();
}
- /* (non-Javadoc)
- * @see org.eclipse.compare.CompareEditorInput#cancelPressed()
- */
@Override
public void cancelPressed() {
// If the CompareConfiguration is editable, then the CANCEL button is the done button
@@ -387,9 +347,6 @@ public class ParticipantPageCompareEditorInput extends PageCompareEditorInput {
super.cancelPressed();
}
- /* (non-Javadoc)
- * @see org.eclipse.compare.CompareEditorInput#getOKButtonLabel()
- */
@Override
public String getOKButtonLabel() {
if (isEditable())
@@ -402,9 +359,6 @@ public class ParticipantPageCompareEditorInput extends PageCompareEditorInput {
|| getCompareConfiguration().isRightEditable();
}
- /* (non-Javadoc)
- * @see org.eclipse.compare.CompareEditorInput#getCancelButtonLabel()
- */
@Override
public String getCancelButtonLabel() {
return TeamUIMessages.ResourceMappingMergeOperation_2;
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ParticipantPageSaveablePart.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ParticipantPageSaveablePart.java
index 80136c86a..9bbfcb35d 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ParticipantPageSaveablePart.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ParticipantPageSaveablePart.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
@@ -18,7 +18,6 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.*;
import org.eclipse.jface.action.ToolBarManager;
import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.*;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.*;
@@ -70,9 +69,6 @@ public class ParticipantPageSaveablePart extends PageSaveablePart implements ICo
this.pageConfiguration = pageConfiguration;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.SaveablePartAdapter#dispose()
- */
@Override
public void dispose() {
if(titleImage != null) {
@@ -86,9 +82,6 @@ public class ParticipantPageSaveablePart extends PageSaveablePart implements ICo
super.dispose();
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPart#getTitleImage()
- */
@Override
public Image getTitleImage() {
if(titleImage == null) {
@@ -97,17 +90,11 @@ public class ParticipantPageSaveablePart extends PageSaveablePart implements ICo
return titleImage;
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPart#getTitle()
- */
@Override
public String getTitle() {
return Utils.shortenText(SynchronizeView.MAX_NAME_LENGTH, participant.getName());
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.ISaveablePart#isDirty()
- */
@Override
public boolean isDirty() {
if (participant instanceof ModelSynchronizeParticipant) {
@@ -120,9 +107,6 @@ public class ParticipantPageSaveablePart extends PageSaveablePart implements ICo
return super.isDirty();
}
- /* (non-Javadoc)
- * @see org.eclipse.compare.IContentChangeListener#contentChanged(org.eclipse.compare.IContentChangeNotifier)
- */
@Override
public void contentChanged(IContentChangeNotifier source) {
try {
@@ -136,9 +120,6 @@ public class ParticipantPageSaveablePart extends PageSaveablePart implements ICo
}
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.ISaveablePart#doSave(org.eclipse.core.runtime.IProgressMonitor)
- */
@Override
public void doSave(IProgressMonitor pm) {
// TODO needs to work for models
@@ -158,17 +139,11 @@ public class ParticipantPageSaveablePart extends PageSaveablePart implements ICo
}
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.PageSaveablePart#createPage(org.eclipse.swt.widgets.Composite, org.eclipse.jface.action.ToolBarManager)
- */
@Override
protected Control createPage(Composite parent, ToolBarManager toolBarManager) {
- listener = new IPropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent event) {
- if (event.getProperty().equals(ISynchronizePageConfiguration.P_PAGE_DESCRIPTION)) {
- updateDescription();
- }
+ listener = event -> {
+ if (event.getProperty().equals(ISynchronizePageConfiguration.P_PAGE_DESCRIPTION)) {
+ updateDescription();
}
};
pageConfiguration.addPropertyChangeListener(listener);
@@ -195,9 +170,6 @@ public class ParticipantPageSaveablePart extends PageSaveablePart implements ICo
return page.getControl();
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.PageSaveablePart#getPageSelectionProvider()
- */
@Override
protected final ISelectionProvider getSelectionProvider() {
return ((ISynchronizePage)page).getViewer();
@@ -219,19 +191,16 @@ public class ParticipantPageSaveablePart extends PageSaveablePart implements ICo
*/
private void initializeDiffViewer(Viewer viewer) {
if (viewer instanceof StructuredViewer) {
- ((StructuredViewer) viewer).addOpenListener(new IOpenListener() {
- @Override
- public void open(OpenEvent event) {
- ISelection s = event.getSelection();
- final SyncInfoModelElement node = getElement(s);
- if (node == null) {
- ICompareInput input = getCompareInput(s);
- if (input != null) {
- prepareCompareInput(input);
- }
- } else {
- prepareCompareInput(node);
+ ((StructuredViewer) viewer).addOpenListener(event -> {
+ ISelection s = event.getSelection();
+ final SyncInfoModelElement node = getElement(s);
+ if (node == null) {
+ ICompareInput input = getCompareInput(s);
+ if (input != null) {
+ prepareCompareInput(input);
}
+ } else {
+ prepareCompareInput(node);
}
});
}
@@ -279,7 +248,7 @@ public class ParticipantPageSaveablePart extends PageSaveablePart implements ICo
}
private ISynchronizationCompareInput asModelCompareInput(ICompareInput input) {
- return (ISynchronizationCompareInput)Adapters.adapt(input, ISynchronizationCompareInput.class);
+ return Adapters.adapt(input, ISynchronizationCompareInput.class);
}
private SyncInfoModelElement getElement(ISelection selection) {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SubscriberTeamStateProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SubscriberTeamStateProvider.java
index 5615cb9bd..9be08b0a4 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SubscriberTeamStateProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SubscriberTeamStateProvider.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
@@ -46,9 +46,6 @@ public class SubscriberTeamStateProvider extends TeamStateProvider implements IS
subscriber.addListener(this);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.mapping.DecoratedStateProvider#isDecorated(java.lang.Object)
- */
@Override
public boolean hasDecoratedState(Object element) throws CoreException {
ResourceMapping mapping = Utils.getResourceMapping(element);
@@ -91,7 +88,7 @@ public class SubscriberTeamStateProvider extends TeamStateProvider implements IS
}
private int getSynchronizationState(ResourceMapping mapping, int stateMask, IProgressMonitor monitor) throws CoreException {
- ISynchronizationCompareAdapter compareAdapter = (ISynchronizationCompareAdapter)Adapters.adapt(mapping.getModelProvider(), ISynchronizationCompareAdapter.class);
+ ISynchronizationCompareAdapter compareAdapter = Adapters.adapt(mapping.getModelProvider(), ISynchronizationCompareAdapter.class);
try {
if (compareAdapter != null) {
int state = compareAdapter.getSynchronizationState(this, mapping, stateMask, monitor);
@@ -113,9 +110,6 @@ public class SubscriberTeamStateProvider extends TeamStateProvider implements IS
return IDiff.NO_CHANGE;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.mapping.ITeamStateProvider#getStateDescription(java.lang.Object, int, java.lang.String[], org.eclipse.core.runtime.IProgressMonitor)
- */
@Override
public ITeamStateDescription getStateDescription(Object element, int stateMask,
String[] properties, IProgressMonitor monitor) throws CoreException {
@@ -125,9 +119,6 @@ public class SubscriberTeamStateProvider extends TeamStateProvider implements IS
return new TeamStateDescription(getSynchronizationState(element, stateMask, monitor));
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.mapping.ITeamStateProvider#getResourceMappingContext(java.lang.Object)
- */
@Override
public ResourceMappingContext getResourceMappingContext(Object element) {
return new SubscriberResourceMappingContext(subscriber, false);
@@ -151,17 +142,11 @@ public class SubscriberTeamStateProvider extends TeamStateProvider implements IS
subscriber.removeListener(this);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.subscribers.ISubscriberChangeListener#subscriberResourceChanged(org.eclipse.team.core.subscribers.ISubscriberChangeEvent[])
- */
@Override
public void subscriberResourceChanged(ISubscriberChangeEvent[] deltas) {
fireStateChangeEvent(new TeamStateChangeEvent(deltas));
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.mapping.ITeamStateProvider#getDecoratedProperties(java.lang.Object)
- */
@Override
public String[] getDecoratedProperties(Object element) {
return new String[0];

Back to the top