Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2017-07-19 06:38:11 -0400
committerAlexander Kurtakov2017-07-19 06:38:11 -0400
commitfdb28cd0b9aef558e4f03db67cd5dbdd331d35de (patch)
treee90d5a87a5b70bc6c5d9164a735df404285ad148
parent19a5138a13cf4f17cceb807bd902363b846a76ef (diff)
downloadeclipse.platform.team-fdb28cd0b9aef558e4f03db67cd5dbdd331d35de.tar.gz
eclipse.platform.team-fdb28cd0b9aef558e4f03db67cd5dbdd331d35de.tar.xz
eclipse.platform.team-fdb28cd0b9aef558e4f03db67cd5dbdd331d35de.zip
Bug 519875 - Cleanup o.e.team.ui
Generify getAdapter overrides. Change-Id: Iaee00a5769f46d5becab8d9cda79d541071f25cb Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/CompareFileRevisionEditorInput.java28
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/EditionHistoryPage.java38
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceDiffCompareInput.java31
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/AbstractSynchronizePage.java58
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/AbstractTreeViewerAdvisor.java18
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetDiffNode.java30
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/LocalResourceTypedElement.java28
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SyncInfoModelElement.java22
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeViewWorkbenchPart.java40
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/AdapterFactory.java19
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/ApplyPatchModelSynchronizeParticipant.java4
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/PatchWorkspace.java4
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/PatchedFileVariant.java4
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/SaveablePartAdapter.java34
14 files changed, 62 insertions, 296 deletions
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/CompareFileRevisionEditorInput.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/CompareFileRevisionEditorInput.java
index aaaa4642d..99f594c15 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/CompareFileRevisionEditorInput.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/CompareFileRevisionEditorInput.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
@@ -96,9 +96,6 @@ public class CompareFileRevisionEditorInput extends SaveableCompareEditorInput {
setTitle(NLS.bind(TeamUIMessages.SyncInfoCompareInput_title, new String[] { left.getName() }));
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.LocalResourceCompareEditorInput#internalPrepareInput(org.eclipse.core.runtime.IProgressMonitor)
- */
@Override
protected ICompareInput prepareCompareInput(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
ICompareInput input = createCompareInput();
@@ -214,9 +211,6 @@ public class CompareFileRevisionEditorInput extends SaveableCompareEditorInput {
return ""; //$NON-NLS-1$
}
- /* (non-Javadoc)
- * @see org.eclipse.compare.CompareEditorInput#getToolTipText()
- */
@Override
public String getToolTipText() {
Object[] titleObject = new Object[3];
@@ -226,9 +220,6 @@ public class CompareFileRevisionEditorInput extends SaveableCompareEditorInput {
return NLS.bind(TeamUIMessages.CompareFileRevisionEditorInput_compareResourceAndVersions, titleObject);
}
- /* (non-Javadoc)
- * @see org.eclipse.compare.CompareEditorInput#getTitle()
- */
@Override
public String getTitle() {
Object[] titleObject = new Object[3];
@@ -238,14 +229,12 @@ public class CompareFileRevisionEditorInput extends SaveableCompareEditorInput {
return NLS.bind(TeamUIMessages.CompareFileRevisionEditorInput_compareResourceAndVersions, titleObject);
}
- /* (non-Javadoc)
- * @see org.eclipse.compare.CompareEditorInput#getAdapter(java.lang.Class)
- */
+ @SuppressWarnings("unchecked")
@Override
- public Object getAdapter(Class adapter) {
+ public <T> T getAdapter(Class<T> adapter) {
if (adapter == IFile.class || adapter == IResource.class) {
if (getLocalElement() != null) {
- return getLocalElement().getResource();
+ return (T) getLocalElement().getResource();
}
return null;
}
@@ -299,26 +288,17 @@ public class CompareFileRevisionEditorInput extends SaveableCompareEditorInput {
return TeamUIMessages.CompareFileRevisionEditorInput_2;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.LocalResourceCompareEditorInput#fireInputChange()
- */
@Override
protected void fireInputChange() {
((MyDiffNode)getCompareResult()).fireChange();
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.SaveableCompareEditorInput#contentsCreated()
- */
@Override
protected void contentsCreated() {
super.contentsCreated();
notifier.initialize();
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.SaveableCompareEditorInput#handleDispose()
- */
@Override
protected void handleDispose() {
super.handleDispose();
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/EditionHistoryPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/EditionHistoryPage.java
index b0da330a3..c72ddce3e 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/EditionHistoryPage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/EditionHistoryPage.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
@@ -123,7 +123,7 @@ public class EditionHistoryPage extends LocalHistoryPage {
return null;
}
@Override
- public Object getAdapter(Class adapter) {
+ public <T> T getAdapter(Class<T> adapter) {
if (adapter == IFile.class)
return null;
return super.getAdapter(adapter);
@@ -189,17 +189,11 @@ public class EditionHistoryPage extends LocalHistoryPage {
}
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.history.LocalHistoryPage#getFile()
- */
@Override
protected IFile getFile() {
return file;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.history.LocalHistoryPage#update(org.eclipse.team.core.history.IFileRevision[], org.eclipse.core.runtime.IProgressMonitor)
- */
@Override
protected void update(IFileRevision[] revisions, IProgressMonitor monitor) {
monitor.beginTask(null, 100);
@@ -245,12 +239,7 @@ public class EditionHistoryPage extends LocalHistoryPage {
}
private static void sortDescending(IFileRevision[] revisions) {
- Arrays.sort(revisions, new Comparator<IFileRevision>() {
- @Override
- public int compare(IFileRevision d1, IFileRevision d2) {
- return -Long.compare(d1.getTimestamp(), d2.getTimestamp());
- }
- });
+ Arrays.sort(revisions, (d1, d2) -> -Long.compare(d1.getTimestamp(), d2.getTimestamp()));
}
private static boolean contentsEqual(IStructureCreator creator, ITypedElement previousEdition,
@@ -262,9 +251,6 @@ public class EditionHistoryPage extends LocalHistoryPage {
return (contents1 != null && contents2 != null && contents1.equals(contents2));
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.history.LocalHistoryPage#getCompareInput(java.lang.Object)
- */
@Override
public ICompareInput getCompareInput(Object object) {
ITypedElement edition = getEditionFor(object);
@@ -308,18 +294,12 @@ public class EditionHistoryPage extends LocalHistoryPage {
return null;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.history.LocalHistoryPage#isValidInput(java.lang.Object)
- */
@Override
public boolean isValidInput(Object object) {
// This page doesn't support input changes
return object.equals(element);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.history.LocalHistoryPage#dispose()
- */
@Override
public void dispose() {
try {
@@ -354,9 +334,6 @@ public class EditionHistoryPage extends LocalHistoryPage {
}
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.history.LocalHistoryPage#getNoChangesMessage()
- */
@Override
protected String getNoChangesMessage() {
if (name != null)
@@ -394,9 +371,6 @@ public class EditionHistoryPage extends LocalHistoryPage {
return null;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.history.LocalHistoryPage#getName()
- */
@Override
public String getName() {
if (name != null)
@@ -404,9 +378,6 @@ public class EditionHistoryPage extends LocalHistoryPage {
return super.getName();
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.history.LocalHistoryPage#getDescription()
- */
@Override
public String getDescription() {
if (name != null)
@@ -414,9 +385,6 @@ public class EditionHistoryPage extends LocalHistoryPage {
return super.getDescription();
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.history.LocalHistoryPage#createCompareAction()
- */
@Override
protected CompareRevisionAction createCompareAction() {
return new CompareEditionAction(this);
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceDiffCompareInput.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceDiffCompareInput.java
index eafb8b31f..61fac50a0 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceDiffCompareInput.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceDiffCompareInput.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
@@ -169,30 +169,22 @@ public class ResourceDiffCompareInput extends AbstractCompareInput implements IS
super.fireChange();
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.mapping.ISynchronizationCompareInput#prepareInput(org.eclipse.compare.CompareConfiguration, org.eclipse.core.runtime.IProgressMonitor)
- */
@Override
public void prepareInput(CompareConfiguration configuration, IProgressMonitor monitor) throws CoreException {
configuration.setLabelProvider(this, ((ResourceCompareInputChangeNotifier)getChangeNotifier()).getLabelProvider());
ensureContentsCached(getAncestor(), getRight(), monitor);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.mapping.ISynchronizationCompareInput#getSaveable()
- */
@Override
public SaveableComparison getSaveable() {
return null;
}
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
- */
+ @SuppressWarnings("unchecked")
@Override
- public Object getAdapter(Class adapter) {
+ public <T> T getAdapter(Class<T> adapter) {
if (adapter == IFile.class || adapter == IResource.class) {
- return ResourceDiffTree.getResourceFor(node);
+ return (T) ResourceDiffTree.getResourceFor(node);
}
if (adapter == ResourceMapping.class) {
IResource resource = ResourceDiffTree.getResourceFor(node);
@@ -201,9 +193,6 @@ public class ResourceDiffCompareInput extends AbstractCompareInput implements IS
return null;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.mapping.ISynchronizationCompareInput#getFullPath()
- */
@Override
public String getFullPath() {
final IResource resource = ResourceDiffTree.getResourceFor(node);
@@ -212,9 +201,6 @@ public class ResourceDiffCompareInput extends AbstractCompareInput implements IS
return getName();
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.mapping.ISynchronizationCompareInput#isCompareInputFor(java.lang.Object)
- */
@Override
public boolean isCompareInputFor(Object object) {
final IResource resource = ResourceDiffTree.getResourceFor(node);
@@ -224,9 +210,6 @@ public class ResourceDiffCompareInput extends AbstractCompareInput implements IS
return false;
}
- /* (non-Javadoc)
- * @see org.eclipse.compare.IResourceProvider#getResource()
- */
@Override
public IResource getResource() {
return ResourceDiffTree.getResourceFor(node);
@@ -242,9 +225,6 @@ public class ResourceDiffCompareInput extends AbstractCompareInput implements IS
return ResourceCompareInputChangeNotifier.getChangeNotifier(context);
}
- /* (non-Javadoc)
- * @see org.eclipse.compare.structuremergeviewer.DiffNode#equals(java.lang.Object)
- */
@Override
public boolean equals(Object other) {
if (other == this)
@@ -267,9 +247,6 @@ public class ResourceDiffCompareInput extends AbstractCompareInput implements IS
return e1.equals(e2);
}
- /* (non-Javadoc)
- * @see org.eclipse.compare.structuremergeviewer.DiffNode#hashCode()
- */
@Override
public int hashCode() {
return getResource().hashCode();
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/AbstractSynchronizePage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/AbstractSynchronizePage.java
index c940dd2e0..50fe7d684 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/AbstractSynchronizePage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/AbstractSynchronizePage.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
@@ -94,9 +94,6 @@ public abstract class AbstractSynchronizePage extends Page implements ISynchroni
configuration.addActionContribution(new ModeFilterActions());
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.IPage#createControl(org.eclipse.swt.widgets.Composite)
- */
@Override
public void createControl(Composite parent) {
composite = new Composite(parent, SWT.NONE);
@@ -141,34 +138,22 @@ public abstract class AbstractSynchronizePage extends Page implements ISynchroni
return viewerAdvisor;
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.IPage#setActionBars(org.eclipse.ui.IActionBars)
- */
@Override
public void setActionBars(IActionBars actionBars) {
// Delegate menu creation to the advisor
viewerAdvisor.setActionBars(actionBars);
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.IPage#getControl()
- */
@Override
public Control getControl() {
return composite;
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.IPage#setFocus()
- */
@Override
public void setFocus() {
changesSection.setFocus();
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizePage#init(org.eclipse.team.ui.synchronize.ISynchronizePageSite)
- */
@Override
public void init(ISynchronizePageSite site) {
this.site = site;
@@ -188,9 +173,6 @@ public abstract class AbstractSynchronizePage extends Page implements ISynchroni
}
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.Page#dispose()
- */
@Override
public void dispose() {
changesSection.dispose();
@@ -198,17 +180,11 @@ public abstract class AbstractSynchronizePage extends Page implements ISynchroni
super.dispose();
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizePage#getViewer()
- */
@Override
public Viewer getViewer() {
return changesViewer;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizePage#aboutToChangeProperty(org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration, java.lang.String, java.lang.Object)
- */
@Override
public boolean aboutToChangeProperty(
ISynchronizePageConfiguration configuration, String key,
@@ -234,33 +210,25 @@ public abstract class AbstractSynchronizePage extends Page implements ISynchroni
*
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
*/
+ @SuppressWarnings("unchecked")
@Override
- public Object getAdapter(Class key) {
+ public <T> T getAdapter(Class<T> key) {
if (key.equals(ISelectionProvider.class))
- return changesViewer;
+ return (T) changesViewer;
if (key == IShowInSource.class) {
- return new IShowInSource() {
- @Override
- public ShowInContext getShowInContext() {
- StructuredViewer v = (StructuredViewer)changesViewer;
- if (v == null) return null;
- ISelection s = v.getSelection();
- if (s instanceof IStructuredSelection) {
- Object[] resources = Utils.getResources(((IStructuredSelection)s).toArray());
- return new ShowInContext(null, new StructuredSelection(resources));
- }
- return null;
+ return (T) (IShowInSource) () -> {
+ StructuredViewer v = (StructuredViewer)changesViewer;
+ if (v == null) return null;
+ ISelection s = v.getSelection();
+ if (s instanceof IStructuredSelection) {
+ Object[] resources = Utils.getResources(((IStructuredSelection)s).toArray());
+ return new ShowInContext(null, new StructuredSelection(resources));
}
+ return null;
};
}
if (key == IShowInTargetList.class) {
- return new IShowInTargetList() {
- @Override
- public String[] getShowInTargetIds() {
- return new String[] { IPageLayout.ID_RES_NAV };
- }
-
- };
+ return (T) (IShowInTargetList) () -> new String[] { IPageLayout.ID_RES_NAV };
}
return null;
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/AbstractTreeViewerAdvisor.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/AbstractTreeViewerAdvisor.java
index c1b6220f9..64e7edc28 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/AbstractTreeViewerAdvisor.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/AbstractTreeViewerAdvisor.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
@@ -41,18 +41,12 @@ public abstract class AbstractTreeViewerAdvisor extends StructuredViewerAdvisor
private class TreeCompareNavigator extends CompareNavigator {
- /* (non-Javadoc)
- * @see org.eclipse.compare.CompareNavigator#getNavigatables()
- */
@Override
protected INavigatable[] getNavigatables() {
INavigatable navigatable = getNavigatable();
return new INavigatable[] { navigatable };
}
- /* (non-Javadoc)
- * @see org.eclipse.compare.CompareNavigator#selectChange(boolean)
- */
@Override
public boolean selectChange(boolean next) {
if (getSubNavigator() != null) {
@@ -94,9 +88,6 @@ public abstract class AbstractTreeViewerAdvisor extends StructuredViewerAdvisor
}
}
- /* (non-Javadoc)
- * @see org.eclipse.compare.CompareNavigator#hasChange(boolean)
- */
@Override
public boolean hasChange(boolean next) {
if (getSubNavigator() != null) {
@@ -353,16 +344,17 @@ public abstract class AbstractTreeViewerAdvisor extends StructuredViewerAdvisor
* navigation between several objects.
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
*/
+ @SuppressWarnings("unchecked")
@Override
- public Object getAdapter(Class adapter) {
+ public <T> T getAdapter(Class<T> adapter) {
if(adapter == ICompareNavigator.class) {
if(nav == null) {
nav = new TreeCompareNavigator();
}
- return nav;
+ return (T) nav;
}
if(adapter == INavigatable.class) {
- return getNavigatable();
+ return (T) getNavigatable();
}
return null;
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetDiffNode.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetDiffNode.java
index 0ff3a9446..d739679e2 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetDiffNode.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetDiffNode.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -29,9 +29,6 @@ public class ChangeSetDiffNode extends SynchronizeModelElement {
this.set = set;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizeModelElement#getResource()
- */
@Override
public IResource getResource() {
return null;
@@ -41,41 +38,26 @@ public class ChangeSetDiffNode extends SynchronizeModelElement {
return set;
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getImageDescriptor(java.lang.Object)
- */
@Override
public ImageDescriptor getImageDescriptor(Object object) {
return TeamUIPlugin.getImageDescriptor(ITeamUIImages.IMG_CHANGE_SET);
}
- /* (non-Javadoc)
- * @see org.eclipse.compare.structuremergeviewer.DiffNode#getName()
- */
@Override
public String getName() {
return set.getName();
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.SyncInfoModelElement#toString()
- */
@Override
public String toString() {
return getName();
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.synchronize.SynchronizeModelElement#hashCode()
- */
@Override
public int hashCode() {
return set.hashCode();
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.synchronize.SynchronizeModelElement#equals(java.lang.Object)
- */
@Override
public boolean equals(Object object) {
if (object instanceof ChangeSetDiffNode) {
@@ -84,13 +66,11 @@ public class ChangeSetDiffNode extends SynchronizeModelElement {
return super.equals(object);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.synchronize.SynchronizeModelElement#getAdapter(java.lang.Class)
- */
- @Override
- public Object getAdapter(Class adapter) {
+ @SuppressWarnings("unchecked")
+ @Override
+ public <T> T getAdapter(Class<T> adapter) {
if (adapter.equals(ChangeSet.class)) {
- return set;
+ return (T) set;
}
return super.getAdapter(adapter);
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/LocalResourceTypedElement.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/LocalResourceTypedElement.java
index f16ca37ac..7197ce867 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/LocalResourceTypedElement.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/LocalResourceTypedElement.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -63,9 +63,6 @@ public class LocalResourceTypedElement extends ResourceNode implements IAdaptabl
exists = resource.exists();
}
- /* (non-Javadoc)
- * @see org.eclipse.compare.BufferedContent#setContent(byte[])
- */
@Override
public void setContent(byte[] contents) {
fDirty = true;
@@ -112,9 +109,6 @@ public class LocalResourceTypedElement extends ResourceNode implements IAdaptabl
}
}
- /* (non-Javadoc)
- * @see org.eclipse.compare.ResourceNode#getContents()
- */
@Override
public InputStream getContents() throws CoreException {
if (exists)
@@ -122,14 +116,12 @@ public class LocalResourceTypedElement extends ResourceNode implements IAdaptabl
return null;
}
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
- */
+ @SuppressWarnings("unchecked")
@Override
- public Object getAdapter(Class adapter) {
+ public <T> T getAdapter(Class<T> adapter) {
if (adapter == ISharedDocumentAdapter.class) {
if (isSharedDocumentsEnable())
- return getSharedDocumentAdapter();
+ return (T) getSharedDocumentAdapter();
else
return null;
}
@@ -176,9 +168,6 @@ public class LocalResourceTypedElement extends ResourceNode implements IAdaptabl
return sharedDocumentAdapter;
}
- /* (non-Javadoc)
- * @see org.eclipse.compare.ResourceNode#isEditable()
- */
@Override
public boolean isEditable() {
// Do not allow non-existent files to be edited
@@ -217,9 +206,6 @@ public class LocalResourceTypedElement extends ResourceNode implements IAdaptabl
return false;
}
- /* (non-Javadoc)
- * @see org.eclipse.compare.ResourceNode#createStream()
- */
@Override
protected InputStream createStream() throws CoreException {
InputStream inputStream = super.createStream();
@@ -245,9 +231,6 @@ public class LocalResourceTypedElement extends ResourceNode implements IAdaptabl
return timestamp;
}
- /* (non-Javadoc)
- * @see org.eclipse.compare.ResourceNode#hashCode()
- */
@Override
public int hashCode() {
return getResource().hashCode();
@@ -303,9 +286,6 @@ public class LocalResourceTypedElement extends ResourceNode implements IAdaptabl
return exists;
}
- /* (non-Javadoc)
- * @see org.eclipse.compare.BufferedContent#fireContentChanged()
- */
@Override
protected void fireContentChanged() {
super.fireContentChanged();
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SyncInfoModelElement.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SyncInfoModelElement.java
index 2bb763807..7b2543aca 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SyncInfoModelElement.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SyncInfoModelElement.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
@@ -101,9 +101,6 @@ public class SyncInfoModelElement extends SynchronizeModelElement {
fireChange();
}
- /* (non-Javadoc)
- * @see org.eclipse.compare.structuremergeviewer.DiffElement#getKind()
- */
@Override
public int getKind() {
SyncInfo info = getSyncInfo();
@@ -124,17 +121,11 @@ public class SyncInfoModelElement extends SynchronizeModelElement {
this.ancestor = ancestor;
}
- /* (non-Javadoc)
- * @see org.eclipse.compare.structuremergeviewer.DiffNode#getAncestor()
- */
@Override
public ITypedElement getAncestor() {
return this.ancestor;
}
- /* (non-Javadoc)
- * @see org.eclipse.compare.structuremergeviewer.DiffNode#getName()
- */
@Override
public String getName() {
IResource resource = getResource();
@@ -145,13 +136,11 @@ public class SyncInfoModelElement extends SynchronizeModelElement {
}
}
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
- */
+ @SuppressWarnings("unchecked")
@Override
- public Object getAdapter(Class adapter) {
+ public <T> T getAdapter(Class<T> adapter) {
if(adapter == SyncInfo.class) {
- return getSyncInfo();
+ return (T) getSyncInfo();
}
return super.getAdapter(adapter);
}
@@ -167,9 +156,6 @@ public class SyncInfoModelElement extends SynchronizeModelElement {
return info.getLocal();
}
- /* (non-Javadoc)
- * @see java.lang.Object#toString()
- */
@Override
public String toString() {
return getResource().getFullPath().toString();
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeViewWorkbenchPart.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeViewWorkbenchPart.java
index 710d4e8a4..67eb966c9 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeViewWorkbenchPart.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeViewWorkbenchPart.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
@@ -27,18 +27,12 @@ public class SynchronizeViewWorkbenchPart implements IWorkbenchPart {
private IWorkbenchPartSite site;
private ISynchronizePageConfiguration configuration;
- /* (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
@Override
public boolean equals(Object obj) {
return (obj instanceof SynchronizeViewWorkbenchPart) &&
participant.equals(((SynchronizeViewWorkbenchPart)obj).getParticipant());
}
- /* (non-Javadoc)
- * @see java.lang.Object#hashCode()
- */
@Override
public int hashCode() {
return participant.hashCode();
@@ -53,78 +47,48 @@ public class SynchronizeViewWorkbenchPart implements IWorkbenchPart {
this.site = site;
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPart#addPropertyListener(org.eclipse.ui.IPropertyListener)
- */
@Override
public void addPropertyListener(IPropertyListener listener) {
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
- */
@Override
public void createPartControl(Composite parent) {
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPart#dispose()
- */
@Override
public void dispose() {
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPart#getSite()
- */
@Override
public IWorkbenchPartSite getSite() {
return site;
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPart#getTitle()
- */
@Override
public String getTitle() {
return ""; //$NON-NLS-1$
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPart#getTitleImage()
- */
@Override
public Image getTitleImage() {
return null;
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPart#getTitleToolTip()
- */
@Override
public String getTitleToolTip() {
return ""; //$NON-NLS-1$
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPart#removePropertyListener(org.eclipse.ui.IPropertyListener)
- */
@Override
public void removePropertyListener(IPropertyListener listener) {
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPart#setFocus()
- */
@Override
public void setFocus() {
}
- /* (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 null;
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/AdapterFactory.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/AdapterFactory.java
index 4cf0265ec..61aaf0d9e 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/AdapterFactory.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/AdapterFactory.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
@@ -22,42 +22,43 @@ public class AdapterFactory implements IAdapterFactory {
private IWorkbenchAdapter modelAdapter = new PatchWorkbenchAdapter();
private ISynchronizationCompareAdapter compareAdapter;
+ @SuppressWarnings("unchecked")
@Override
- public Object getAdapter(Object adaptableObject, Class adapterType) {
+ public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) {
if (adapterType == ResourceMapping.class) {
if (adaptableObject instanceof PatchProjectDiffNode) {
- return new DiffProjectResourceMapping(
+ return (T) new DiffProjectResourceMapping(
((PatchProjectDiffNode) adaptableObject)
.getDiffProject());
}
if (adaptableObject instanceof PatchFileDiffNode) {
- return new FilePatchResourceMapping(
+ return (T) new FilePatchResourceMapping(
((PatchFileDiffNode) adaptableObject).getDiffResult());
}
if (adaptableObject instanceof HunkDiffNode) {
- return new HunkResourceMapping(((HunkDiffNode) adaptableObject)
+ return (T) new HunkResourceMapping(((HunkDiffNode) adaptableObject)
.getHunkResult());
}
}
if (adapterType == IWorkbenchAdapter.class)
- return modelAdapter;
+ return (T) modelAdapter;
if (adapterType == ISynchronizationCompareAdapter.class
&& adaptableObject instanceof PatchModelProvider) {
if (compareAdapter == null) {
compareAdapter = new PatchCompareAdapter();
}
- return compareAdapter;
+ return (T) compareAdapter;
}
if (adapterType == IResource.class) {
if (adaptableObject instanceof PatchFileDiffNode) {
- return ((PatchFileDiffNode) adaptableObject).getResource();
+ return (T) ((PatchFileDiffNode) adaptableObject).getResource();
}
}
return null;
}
@Override
- public Class[] getAdapterList() {
+ public Class<?>[] getAdapterList() {
return new Class[] { ResourceMapping.class, IWorkbenchAdapter.class,
IResource.class };
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/ApplyPatchModelSynchronizeParticipant.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/ApplyPatchModelSynchronizeParticipant.java
index 814995bb4..8559cd1b9 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/ApplyPatchModelSynchronizeParticipant.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/ApplyPatchModelSynchronizeParticipant.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
@@ -143,7 +143,7 @@ public class ApplyPatchModelSynchronizeParticipant extends
}
@Override
- public Object getAdapter(Class adapter) {
+ public <T> T getAdapter(Class<T> adapter) {
if (adapter == IRefreshable.class) {
return null;
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/PatchWorkspace.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/PatchWorkspace.java
index 82675cfae..a172d7f89 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/PatchWorkspace.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/PatchWorkspace.java
@@ -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
@@ -131,7 +131,7 @@ public class PatchWorkspace extends DiffNode implements IAdaptable {
// cannot extend PlatformObject (already extends DiffNode) so implement
// IAdaptable
@Override
- public Object getAdapter(Class adapter) {
+ public <T> T getAdapter(Class<T> adapter) {
return Platform.getAdapterManager().getAdapter(this, adapter);
}
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/PatchedFileVariant.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/PatchedFileVariant.java
index c079bb6dd..f0a47c92b 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/PatchedFileVariant.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/PatchedFileVariant.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
@@ -51,7 +51,7 @@ public class PatchedFileVariant implements IResourceVariant {
return new IStorage() {
@Override
- public Object getAdapter(Class adapter) {
+ public <T> T getAdapter(Class<T> adapter) {
return null;
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/SaveablePartAdapter.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/SaveablePartAdapter.java
index 70c57437e..29e1f3740 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/SaveablePartAdapter.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/SaveablePartAdapter.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
@@ -29,78 +29,48 @@ import org.eclipse.ui.*;
@Deprecated
public abstract class SaveablePartAdapter implements ISaveableWorkbenchPart {
- /* (non-Javadoc)
- * @see org.eclipse.ui.ISaveablePart#doSaveAs()
- */
@Override
public void doSaveAs() {
}
- /* (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 false;
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPart#addPropertyListener(org.eclipse.ui.IPropertyListener)
- */
@Override
public void addPropertyListener(IPropertyListener listener) {
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPart#dispose()
- */
@Override
public void dispose() {
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPart#getSite()
- */
@Override
public IWorkbenchPartSite getSite() {
return null;
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPart#getTitleToolTip()
- */
@Override
public String getTitleToolTip() {
return null;
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPart#removePropertyListener(org.eclipse.ui.IPropertyListener)
- */
@Override
public void removePropertyListener(IPropertyListener listener) {
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPart#setFocus()
- */
@Override
public void setFocus() {
}
- /* (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 null;
}
}

Back to the top