Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bundles/org.eclipse.jsch.core/src/org/eclipse/jsch/internal/core/ResponsiveSocketFactory.java12
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSSyncTreeSubscriber.java6
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProviderType.java6
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSWorkspaceSubscriber.java6
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/filehistory/CVSFileRevision.java8
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/filehistory/CVSLocalFileRevision.java6
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/mapping/ChangeSetAdapterFactory.java12
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AdaptableResourceList.java23
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryPage.java10
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ResourceEditionNode.java6
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/CVSConsolePageParticipant.java4
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CVSSubscriberMergeContext.java6
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/AllRootsElement.java6
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSAdapterFactory.java24
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSModelElement.java8
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSResourceElement.java6
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/DateTagCategory.java6
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteModule.java8
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/TagCategory.java6
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/VersionCategory.java8
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RefreshRemoteProjectSelectionPage.java6
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryRoot.java10
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/FilteredTagList.java6
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagElement.java6
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagRootElement.java6
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSourceResourceAdapter.java21
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSourceWorkbenchAdapter.java6
-rw-r--r--examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/history/FileSystemFileRevision.java4
-rw-r--r--examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/ConfigurationWizard.java8
-rw-r--r--examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/FileSystemHistoryPage.java4
-rw-r--r--examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/FileSystemRevisionEditorInput.java10
-rw-r--r--examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/OpenFileSystemRevisionAction.java4
-rw-r--r--examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/model/ui/AdapterFactory.java19
-rw-r--r--examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/model/ui/ModelNavigatorContentProvider.java6
-rw-r--r--examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/model/ui/ModelSaveable.java6
-rw-r--r--tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/PatchLinesTest.java4
-rw-r--r--tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/PatchUtils.java8
-rw-r--r--tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/ReflectionUtils.java8
-rw-r--r--tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/WorkspaceTest.java6
39 files changed, 143 insertions, 182 deletions
diff --git a/bundles/org.eclipse.jsch.core/src/org/eclipse/jsch/internal/core/ResponsiveSocketFactory.java b/bundles/org.eclipse.jsch.core/src/org/eclipse/jsch/internal/core/ResponsiveSocketFactory.java
index ff822dbcf..2beef7f5a 100644
--- a/bundles/org.eclipse.jsch.core/src/org/eclipse/jsch/internal/core/ResponsiveSocketFactory.java
+++ b/bundles/org.eclipse.jsch.core/src/org/eclipse/jsch/internal/core/ResponsiveSocketFactory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
+ * Copyright (c) 2007, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -26,7 +26,7 @@ public class ResponsiveSocketFactory implements SocketFactory {
OutputStream out = null;
private IProgressMonitor monitor;
private final int timeout;
- private static Class proxyClass;
+ private static Class<?> proxyClass;
private static boolean hasProxyClass = true;
public ResponsiveSocketFactory(IProgressMonitor monitor, int timeout) {
if (monitor == null)
@@ -131,7 +131,7 @@ public class ResponsiveSocketFactory implements SocketFactory {
/* private */ Socket internalCreateSocket(final String host, final int port)
throws UnknownHostException, IOException{
- Class proxyClass = getProxyClass();
+ Class<?> proxyClass = getProxyClass();
if (proxyClass != null) {
// We need to disable proxy support for the socket
try{
@@ -139,8 +139,8 @@ public class ResponsiveSocketFactory implements SocketFactory {
// Obtain the value of the NO_PROXY static field of the proxy class
Field field = proxyClass.getField("NO_PROXY"); //$NON-NLS-1$
Object noProxyObject = field.get(null);
- Constructor constructor = Socket.class.getConstructor(new Class[] { proxyClass });
- Object o = constructor.newInstance(new Object[] { noProxyObject });
+ Constructor<Socket> constructor = Socket.class.getConstructor(proxyClass);
+ Object o = constructor.newInstance(noProxyObject);
if(o instanceof Socket){
Socket socket=(Socket)o;
socket.connect(new InetSocketAddress(host, port), timeout * 1000);
@@ -173,7 +173,7 @@ public class ResponsiveSocketFactory implements SocketFactory {
return new Socket(host, port);
}
- private synchronized Class getProxyClass() {
+ private synchronized Class<?> getProxyClass() {
if (hasProxyClass && proxyClass == null) {
try{
proxyClass = Class.forName(JAVA_NET_PROXY);
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSSyncTreeSubscriber.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSSyncTreeSubscriber.java
index 151a4ebdf..e543b03a5 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSSyncTreeSubscriber.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSSyncTreeSubscriber.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 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
@@ -151,9 +151,9 @@ public abstract class CVSSyncTreeSubscriber extends ResourceVariantTreeSubscribe
return null;
return converter.getDeltaFor(info);
}
- public Object getAdapter(Class adapter) {
+ public <T> T getAdapter(Class<T> adapter) {
if (adapter == SyncInfoToDiffConverter.class) {
- return converter;
+ return adapter.cast(converter);
}
return Platform.getAdapterManager().getAdapter(this, adapter);
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProviderType.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProviderType.java
index 93688fcda..210b193ef 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProviderType.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProviderType.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 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
@@ -192,9 +192,9 @@ public class CVSTeamProviderType extends RepositoryProviderType implements IAdap
/* (non-Javadoc)
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
*/
- public Object getAdapter(Class adapter) {
+ public <T> T getAdapter(Class<T> adapter) {
if (adapter == ActiveChangeSetManager.class || adapter == IChangeGroupingRequestor.class)
- return CVSProviderPlugin.getPlugin().getChangeSetManager();
+ return adapter.cast(CVSProviderPlugin.getPlugin().getChangeSetManager());
return Platform.getAdapterManager().getAdapter(this, adapter);
}
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSWorkspaceSubscriber.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSWorkspaceSubscriber.java
index 32e617f4b..05a6833dc 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSWorkspaceSubscriber.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSWorkspaceSubscriber.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 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
@@ -421,9 +421,9 @@ public class CVSWorkspaceSubscriber extends CVSSyncTreeSubscriber implements IRe
}
- public Object getAdapter(Class adapter) {
+ public <T> T getAdapter(Class<T> adapter) {
if (adapter == ActiveChangeSetManager.class) {
- return CVSProviderPlugin.getPlugin().getChangeSetManager();
+ return adapter.cast(CVSProviderPlugin.getPlugin().getChangeSetManager());
}
return super.getAdapter(adapter);
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/filehistory/CVSFileRevision.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/filehistory/CVSFileRevision.java
index 9b6ff9ccb..2ad4ef106 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/filehistory/CVSFileRevision.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/filehistory/CVSFileRevision.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 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
@@ -111,11 +111,11 @@ public class CVSFileRevision extends FileRevision implements IAdaptable {
return new CVSFileRevision(getCVSRemoteFile().getLogEntry(monitor));
}
- public Object getAdapter(Class adapter) {
+ public <T> T getAdapter(Class<T> adapter) {
if (adapter == ICVSFile.class)
- return getCVSRemoteFile();
+ return adapter.cast(getCVSRemoteFile());
if (adapter == IResourceVariant.class)
- return getCVSRemoteFile();
+ return adapter.cast(getCVSRemoteFile());
return Platform.getAdapterManager().getAdapter(this, adapter);
}
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/filehistory/CVSLocalFileRevision.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/filehistory/CVSLocalFileRevision.java
index 2e174d4ea..e83710880 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/filehistory/CVSLocalFileRevision.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/filehistory/CVSLocalFileRevision.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
+ * Copyright (c) 2006, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -34,9 +34,9 @@ public class CVSLocalFileRevision extends LocalFileRevision implements IAdaptabl
super(fileState);
}
- public Object getAdapter(Class adapter) {
+ public <T> T getAdapter(Class<T> adapter) {
if (adapter == ICVSFile.class)
- return CVSWorkspaceRoot.getCVSFileFor(ResourcesPlugin.getWorkspace().getRoot().getFile(URIUtil.toPath(getURI())));
+ return adapter.cast(CVSWorkspaceRoot.getCVSFileFor(ResourcesPlugin.getWorkspace().getRoot().getFile(URIUtil.toPath(getURI()))));
return null;
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/mapping/ChangeSetAdapterFactory.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/mapping/ChangeSetAdapterFactory.java
index 6371c28d3..e3760b787 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/mapping/ChangeSetAdapterFactory.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/mapping/ChangeSetAdapterFactory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
+ * Copyright (c) 2006, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -15,23 +15,23 @@ import org.eclipse.core.runtime.IAdapterFactory;
public class ChangeSetAdapterFactory implements IAdapterFactory {
- public Object getAdapter(Object adaptableObject, Class adapterType) {
+ public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) {
if (adaptableObject instanceof CVSActiveChangeSet && adapterType == ResourceMapping.class) {
CVSActiveChangeSet cs = (CVSActiveChangeSet) adaptableObject;
- return new ChangeSetResourceMapping(cs);
+ return adapterType.cast(new ChangeSetResourceMapping(cs));
}
if (adaptableObject instanceof CVSCheckedInChangeSet && adapterType == ResourceMapping.class) {
CVSCheckedInChangeSet cs = (CVSCheckedInChangeSet) adaptableObject;
- return new ChangeSetResourceMapping(cs);
+ return adapterType.cast(new ChangeSetResourceMapping(cs));
}
if (adaptableObject instanceof UnassignedDiffChangeSet && adapterType == ResourceMapping.class) {
UnassignedDiffChangeSet cs = (UnassignedDiffChangeSet) adaptableObject;
- return new ChangeSetResourceMapping(cs);
+ return adapterType.cast(new ChangeSetResourceMapping(cs));
}
return null;
}
- public Class[] getAdapterList() {
+ public Class<?>[] getAdapterList() {
return new Class[] { ResourceMapping.class };
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AdaptableResourceList.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AdaptableResourceList.java
index e4a6997ef..4d530e30c 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AdaptableResourceList.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AdaptableResourceList.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -26,35 +26,22 @@ public class AdaptableResourceList implements IAdaptable, IWorkbenchAdapter {
this.resources = resources;
}
- /**
- * @see org.eclipse.core.runtime.IAdaptable#getAdapter(Class)
- */
- public Object getAdapter(Class adapter) {
- if (adapter == IWorkbenchAdapter.class) return this;
+ public <T> T getAdapter(Class<T> adapter) {
+ if (adapter == IWorkbenchAdapter.class) return adapter.cast(this);
return null;
}
- /**
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getChildren(Object)
- */
public Object[] getChildren(Object o) {
return resources;
}
- /**
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getImageDescriptor(java.lang.Object)
- */
public ImageDescriptor getImageDescriptor(Object object) {
return null;
}
- /**
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getLabel(java.lang.Object)
- */
+
public String getLabel(Object o) {
return o == null ? "" : o.toString();//$NON-NLS-1$
}
- /**
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getParent(java.lang.Object)
- */
+
public Object getParent(Object o) {
return null;
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryPage.java
index 7808d2645..55d7b0535 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryPage.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryPage.java
@@ -318,11 +318,11 @@ public class CVSHistoryPage extends HistoryPage implements IAdaptable, IHistoryC
protected Map getHyperlinkDetectorTargets(ISourceViewer sourceViewer) {
return Collections.singletonMap("org.eclipse.ui.DefaultTextEditor", //$NON-NLS-1$
new IAdaptable() {
- public Object getAdapter(Class adapter) {
+ public <T> T getAdapter(Class<T> adapter) {
if(adapter==IFile.class && getInput() instanceof IFile) {
- return getInput();
+ return adapter.cast(getInput());
} else if(adapter==IFileHistory.class && getInput() instanceof IFileHistory) {
- return getInput();
+ return adapter.cast(getInput());
}
return Platform.getAdapterManager().getAdapter(CVSHistoryPage.this, adapter);
}
@@ -1825,9 +1825,9 @@ public class CVSHistoryPage extends HistoryPage implements IAdaptable, IHistoryC
return null;
}
- public Object getAdapter(Class adapter) {
+ public <T> T getAdapter(Class<T> adapter) {
if(adapter == IHistoryCompareAdapter.class) {
- return this;
+ return adapter.cast(this);
}
return null;
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ResourceEditionNode.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ResourceEditionNode.java
index 2bcb228bb..670fa651b 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ResourceEditionNode.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ResourceEditionNode.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -184,7 +184,7 @@ public class ResourceEditionNode implements IStructureComparator, ITypedElement,
return holder[0];
}
- public Object getAdapter(Class adapter) {
+ public <T> T getAdapter(Class<T> adapter) {
if (adapter == ISharedDocumentAdapter.class) {
synchronized (this) {
if (sharedDocumentAdapter == null)
@@ -200,7 +200,7 @@ public class ResourceEditionNode implements IStructureComparator, ITypedElement,
// The document is read-only
}
};
- return sharedDocumentAdapter;
+ return adapter.cast(sharedDocumentAdapter);
}
}
return Platform.getAdapterManager().getAdapter(this, adapter);
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/CVSConsolePageParticipant.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/CVSConsolePageParticipant.java
index 181ed6127..dcce46006 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/CVSConsolePageParticipant.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/CVSConsolePageParticipant.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 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
@@ -43,7 +43,7 @@ public class CVSConsolePageParticipant implements IConsolePageParticipant {
public void deactivated() {
}
- public Object getAdapter(Class adapter) {
+ public <T> T getAdapter(Class<T> adapter) {
return null;
}
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CVSSubscriberMergeContext.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CVSSubscriberMergeContext.java
index 39ba0b64d..a5f9e8e31 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CVSSubscriberMergeContext.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CVSSubscriberMergeContext.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2011 IBM Corporation and others.
+ * Copyright (c) 2006, 2018 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
@@ -240,9 +240,9 @@ public abstract class CVSSubscriberMergeContext extends SubscriberMergeContext {
return (IFile[]) failures.toArray(new IFile[failures.size()]);
}
- public Object getAdapter(Class adapter) {
+ public <T> T getAdapter(Class<T> adapter) {
if (adapter == IStorageMerger.class)
- return MERGER;
+ return adapter.cast(MERGER);
return super.getAdapter(adapter);
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/AllRootsElement.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/AllRootsElement.java
index abecf5199..0353105e3 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/AllRootsElement.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/AllRootsElement.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -31,8 +31,8 @@ public class AllRootsElement extends CVSModelElement implements IAdaptable {
public String getLabel(Object o) {
return null;
}
- public Object getAdapter(Class adapter) {
- if (adapter == IWorkbenchAdapter.class) return this;
+ public <T> T getAdapter(Class<T> adapter) {
+ if (adapter == IWorkbenchAdapter.class) return adapter.cast(this);
return null;
}
public Object getParent(Object o) {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSAdapterFactory.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSAdapterFactory.java
index d5ef132ff..5718ac86e 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSAdapterFactory.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSAdapterFactory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 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,28 +38,25 @@ public class CVSAdapterFactory implements IAdapterFactory {
private Object cachedPropertyValue = null;
private ChangeSetCompareAdapter compareAdapter;
- /** (Non-javadoc)
- * Method declared on IAdapterFactory.
- */
- public Object getAdapter(Object adaptableObject, Class adapterType) {
+ public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) {
if (IWorkbenchAdapter.class == adapterType) {
- return getWorkbenchAdapter(adaptableObject);
+ return adapterType.cast(getWorkbenchAdapter(adaptableObject));
}
if(IDeferredWorkbenchAdapter.class == adapterType) {
Object o = getWorkbenchAdapter(adaptableObject);
if(o != null && o instanceof IDeferredWorkbenchAdapter) {
- return o;
+ return adapterType.cast(o);
}
return null;
}
if (IPropertySource.class == adapterType) {
- return getPropertySource(adaptableObject);
+ return adapterType.cast(getPropertySource(adaptableObject));
}
if (IHistoryPageSource.class == adapterType){
- return historyParticipant;
+ return adapterType.cast(historyParticipant);
}
if (ITeamStateProvider.class == adapterType) {
@@ -67,13 +64,13 @@ public class CVSAdapterFactory implements IAdapterFactory {
if (teamStateProvider == null)
teamStateProvider = new CVSTeamStateProvider(CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber());
}
- return teamStateProvider;
+ return adapterType.cast(teamStateProvider);
}
if (ISynchronizationCompareAdapter.class == adapterType) {
if (compareAdapter == null)
compareAdapter = new ChangeSetCompareAdapter();
- return compareAdapter;
+ return adapterType.cast(compareAdapter);
}
return null;
@@ -92,10 +89,7 @@ public class CVSAdapterFactory implements IAdapterFactory {
return null;
}
- /** (Non-javadoc)
- * Method declared on IAdapterFactory.
- */
- public Class[] getAdapterList() {
+ public Class<?>[] getAdapterList() {
return new Class[] { IWorkbenchAdapter.class, IPropertySource.class,
IDeferredWorkbenchAdapter.class, IHistoryPageSource.class,
ISynchronizationCompareAdapter.class, ITeamStateProvider.class,
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSModelElement.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSModelElement.java
index 89712593a..6b23a9145 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSModelElement.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSModelElement.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -35,11 +35,11 @@ public abstract class CVSModelElement implements IWorkbenchAdapter, IAdaptable {
this.workingSet = workingSet;
}
- public Object getAdapter(Class adapter) {
+ public <T> T getAdapter(Class<T> adapter) {
if (adapter == IWorkbenchAdapter.class)
- return this;
+ return adapter.cast(this);
if ((adapter == IDeferredWorkbenchAdapter.class) && this instanceof IDeferredWorkbenchAdapter)
- return this;
+ return adapter.cast(this);
return null;
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSResourceElement.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSResourceElement.java
index ec49cc3cb..c122675a8 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSResourceElement.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSResourceElement.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -16,8 +16,8 @@ import org.eclipse.team.internal.ccvs.core.ICVSResource;
import org.eclipse.ui.model.IWorkbenchAdapter;
public abstract class CVSResourceElement extends CVSModelElement implements IAdaptable {
- public Object getAdapter(Class adapter) {
- if (adapter == IWorkbenchAdapter.class) return this;
+ public <T> T getAdapter(Class<T> adapter) {
+ if (adapter == IWorkbenchAdapter.class) return adapter.cast(this);
return null;
}
/**
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/DateTagCategory.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/DateTagCategory.java
index 36a492b44..360e6701d 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/DateTagCategory.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/DateTagCategory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 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
@@ -50,9 +50,9 @@ public class DateTagCategory extends TagCategory {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.model.TagCategory#getAdapter(java.lang.Class)
*/
- public Object getAdapter(Class adapter) {
+ public <T> T getAdapter(Class<T> adapter) {
if (adapter.equals(ICVSRepositoryLocation.class)) {
- return getRepository(null);
+ return adapter.cast(getRepository(null));
}
return super.getAdapter(adapter);
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteModule.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteModule.java
index 02164aacc..9c4091497 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteModule.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteModule.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 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,11 +46,11 @@ public class RemoteModule extends CVSModelElement implements IAdaptable,
* Returns an object which is an instance of the given class associated with
* this object. Returns <code>null</code> if no such object can be found.
*/
- public Object getAdapter(Class adapter) {
+ public <T> T getAdapter(Class<T> adapter) {
if (adapter == IWorkbenchAdapter.class)
- return this;
+ return adapter.cast(this);
if (adapter == IDeferredWorkbenchAdapter.class)
- return this;
+ return adapter.cast(this);
return null;
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/TagCategory.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/TagCategory.java
index f502ff396..3a1aee407 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/TagCategory.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/TagCategory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -64,8 +64,8 @@ public abstract class TagCategory extends CVSModelElement {
* associated with this object. Returns <code>null</code> if
* no such object can be found.
*/
- public Object getAdapter(Class adapter) {
- if (adapter == IWorkbenchAdapter.class) return this;
+ public <T> T getAdapter(Class<T> adapter) {
+ if (adapter == IWorkbenchAdapter.class) return adapter.cast(this);
return null;
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/VersionCategory.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/VersionCategory.java
index fce52463f..562c268d9 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/VersionCategory.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/VersionCategory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -37,11 +37,11 @@ public class VersionCategory extends CVSModelElement implements IAdaptable,
* Returns an object which is an instance of the given class associated with
* this object. Returns <code>null</code> if no such object can be found.
*/
- public Object getAdapter(Class adapter) {
+ public <T> T getAdapter(Class<T> adapter) {
if (adapter == IWorkbenchAdapter.class)
- return this;
+ return adapter.cast(this);
if (adapter == IDeferredWorkbenchAdapter.class)
- return this;
+ return adapter.cast(this);
return null;
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RefreshRemoteProjectSelectionPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RefreshRemoteProjectSelectionPage.java
index 4e019db91..b04fe1b66 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RefreshRemoteProjectSelectionPage.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RefreshRemoteProjectSelectionPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 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
@@ -59,8 +59,8 @@ public class RefreshRemoteProjectSelectionPage extends CVSWizardPage {
public Object getParent(Object o) {
return null;
}
- public Object getAdapter(Class adapter) {
- if (adapter == IWorkbenchAdapter.class) return this;
+ public <T> T getAdapter(Class<T> adapter) {
+ if (adapter == IWorkbenchAdapter.class) return adapter.cast(this);
return null;
}
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryRoot.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryRoot.java
index c977ff8b7..8de9e6b9e 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryRoot.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryRoot.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 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
@@ -739,11 +739,9 @@ public class RepositoryRoot extends PlatformObject {
paths.addAll(autoRefreshFiles.keySet());
return (String[]) paths.toArray(new String[paths.size()]);
}
- /**
- * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
- */
- public Object getAdapter(Class adapter) {
- if (ICVSRepositoryLocation.class.equals(adapter)) return getRoot();
+
+ public <T> T getAdapter(Class<T> adapter) {
+ if (ICVSRepositoryLocation.class.equals(adapter)) return adapter.cast(getRoot());
return super.getAdapter(adapter);
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/FilteredTagList.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/FilteredTagList.java
index 5767240a5..36a1e990e 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/FilteredTagList.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/FilteredTagList.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 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
@@ -81,8 +81,8 @@ public class FilteredTagList implements IWorkbenchAdapter, IAdaptable {
/* (non-Javadoc)
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
*/
- public Object getAdapter(Class adapter) {
- if (adapter == IWorkbenchAdapter.class) return this;
+ public <T> T getAdapter(Class<T> adapter) {
+ if (adapter == IWorkbenchAdapter.class) return adapter.cast(this);
return null;
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagElement.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagElement.java
index 47ca30f3f..8b2fb0141 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagElement.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagElement.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 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
@@ -47,8 +47,8 @@ public class TagElement implements IWorkbenchAdapter, IAdaptable {
public Object[] getChildren(Object o) {
return new Object[0];
}
- public Object getAdapter(Class adapter) {
- if (adapter == IWorkbenchAdapter.class) return this;
+ public <T> T getAdapter(Class<T> adapter) {
+ if (adapter == IWorkbenchAdapter.class) return adapter.cast(this);
return null;
}
public ImageDescriptor getImageDescriptor(Object object) {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagRootElement.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagRootElement.java
index 94bbe082b..49b403b08 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagRootElement.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagRootElement.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 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
@@ -39,8 +39,8 @@ public class TagRootElement implements IWorkbenchAdapter, IAdaptable {
}
return result;
}
- public Object getAdapter(Class adapter) {
- if (adapter == IWorkbenchAdapter.class) return this;
+ public <T> T getAdapter(Class<T> adapter) {
+ if (adapter == IWorkbenchAdapter.class) return adapter.cast(this);
return null;
}
public ImageDescriptor getImageDescriptor(Object object) {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSourceResourceAdapter.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSourceResourceAdapter.java
index 78904b7b6..09ba16418 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSourceResourceAdapter.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSourceResourceAdapter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -34,9 +34,6 @@ public class TagSourceResourceAdapter implements IAdaptable, IWorkbenchAdapter {
this.tagSource = tagSource;
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getChildren(java.lang.Object)
- */
public Object[] getChildren(Object o) {
ICVSResource[] children = tagSource.getCVSResources();
if (children.length == 0) return new Object[0];
@@ -52,35 +49,23 @@ public class TagSourceResourceAdapter implements IAdaptable, IWorkbenchAdapter {
return result.toArray(new Object[result.size()]);
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getImageDescriptor(java.lang.Object)
- */
public ImageDescriptor getImageDescriptor(Object object) {
// No image descriptor
return null;
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getLabel(java.lang.Object)
- */
public String getLabel(Object o) {
return tagSource.getShortDescription();
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getParent(java.lang.Object)
- */
public Object getParent(Object o) {
// No parent
return null;
}
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
- */
- public Object getAdapter(Class adapter) {
+ public <T> T getAdapter(Class<T> adapter) {
if (adapter == IWorkbenchAdapter.class) {
- return this;
+ return adapter.cast(this);
}
return null;
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSourceWorkbenchAdapter.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSourceWorkbenchAdapter.java
index ceb89a51b..bc305557e 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSourceWorkbenchAdapter.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSourceWorkbenchAdapter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -128,8 +128,8 @@ public class TagSourceWorkbenchAdapter implements IAdaptable, IWorkbenchAdapter
}
return children.toArray(new Object[children.size()]);
}
- public Object getAdapter(Class adapter) {
- if (adapter == IWorkbenchAdapter.class) return this;
+ public <T> T getAdapter(Class<T> adapter) {
+ if (adapter == IWorkbenchAdapter.class) return adapter.cast(this);
return null;
}
public ImageDescriptor getImageDescriptor(Object object) {
diff --git a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/history/FileSystemFileRevision.java b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/history/FileSystemFileRevision.java
index 0b248c205..9939ebb47 100644
--- a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/history/FileSystemFileRevision.java
+++ b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/history/FileSystemFileRevision.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2009 IBM Corporation and others.
+ * Copyright (c) 2006, 2018 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
@@ -62,7 +62,7 @@ public class FileSystemFileRevision extends FileRevision {
return true;
}
- public Object getAdapter(Class adapter) {
+ public <T> T getAdapter(Class<T> adapter) {
return null;
}
diff --git a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/ConfigurationWizard.java b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/ConfigurationWizard.java
index 742f862b5..12a2c582c 100644
--- a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/ConfigurationWizard.java
+++ b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/ConfigurationWizard.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 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,13 +96,13 @@ public class ConfigurationWizard extends Wizard implements IConfigurationWizard,
return true;
}
- public Object getAdapter(Class adapter) {
+ public <T> T getAdapter(Class<T> adapter) {
if (adapter == IConfigurationWizardExtension.class) {
- return new IConfigurationWizardExtension(){
+ return adapter.cast(new IConfigurationWizardExtension(){
public void init(IWorkbench workbench, IProject[] projects) {
setProjects(projects);
}
- };
+ });
}
return null;
}
diff --git a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/FileSystemHistoryPage.java b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/FileSystemHistoryPage.java
index 9d0a744ae..e2f55e7d4 100644
--- a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/FileSystemHistoryPage.java
+++ b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/FileSystemHistoryPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
+ * Copyright (c) 2006, 2018 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
@@ -239,7 +239,7 @@ public class FileSystemHistoryPage extends HistoryPage {
Utils.schedule(refreshFileHistoryJob, getWorkbenchSite(parentSite));
}
- public Object getAdapter(Class adapter) {
+ public <T> T getAdapter(Class<T> adapter) {
return null;
}
diff --git a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/FileSystemRevisionEditorInput.java b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/FileSystemRevisionEditorInput.java
index 41757a4d6..bb915bd80 100644
--- a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/FileSystemRevisionEditorInput.java
+++ b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/FileSystemRevisionEditorInput.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2009 IBM Corporation and others.
+ * Copyright (c) 2006, 2018 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,15 +93,15 @@ public class FileSystemRevisionEditorInput extends PlatformObject implements IWo
return ""; //$NON-NLS-1$
}
- public Object getAdapter(Class adapter) {
+ public <T> T getAdapter(Class<T> adapter) {
if (adapter == IWorkbenchAdapter.class) {
- return this;
+ return adapter.cast(this);
}
if (adapter == IFileRevision.class)
- return fileRevision;
+ return adapter.cast(fileRevision);
else if (adapter == IFileState.class){
if (storage != null && storage instanceof IFileState)
- return storage;
+ return adapter.cast(storage);
}
return super.getAdapter(adapter);
}
diff --git a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/OpenFileSystemRevisionAction.java b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/OpenFileSystemRevisionAction.java
index 270812c29..11d5b1920 100644
--- a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/OpenFileSystemRevisionAction.java
+++ b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/OpenFileSystemRevisionAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2017 IBM Corporation and others.
+ * Copyright (c) 2006, 2018 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
@@ -148,7 +148,7 @@ public class OpenFileSystemRevisionAction extends BaseSelectionListenerAction {
for (int i = 0; i < editorRefs.length; i++) {
IEditorPart part = editorRefs[i].getEditor(false);
if (part != null && part.getEditorInput() instanceof FileSystemRevisionEditorInput) {
- IFileRevision inputRevision = (IFileRevision) input.getAdapter(IFileRevision.class);
+ IFileRevision inputRevision = input.getAdapter(IFileRevision.class);
IFileRevision editorRevision = part.getEditorInput().getAdapter(IFileRevision.class);
if (inputRevision.equals(editorRevision)) {
diff --git a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/model/ui/AdapterFactory.java b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/model/ui/AdapterFactory.java
index ce0ce565c..d06230700 100644
--- a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/model/ui/AdapterFactory.java
+++ b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/model/ui/AdapterFactory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
+ * Copyright (c) 2006, 2018 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
@@ -30,35 +30,32 @@ public class AdapterFactory implements IAdapterFactory {
private CompareAdapter compareAdapter;
private static Object historyPageSource = new FileSystemHistoryPageSource();
- public Object getAdapter(Object adaptableObject, Class adapterType) {
+ public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) {
if (adapterType == IWorkbenchAdapter.class && adaptableObject instanceof ModelObject)
- return modelAdapter;
+ return adapterType.cast(modelAdapter);
if (adapterType == ResourceMapping.class && adaptableObject instanceof ModelObject)
- return ModelResourceMapping.create((ModelObject)adaptableObject);
+ return adapterType.cast(ModelResourceMapping.create((ModelObject)adaptableObject));
if (adapterType == IResourceMappingMerger.class && adaptableObject instanceof ExampleModelProvider) {
if (modelMerger == null) {
modelMerger = new ModelMerger((ExampleModelProvider)adaptableObject);
}
- return modelMerger;
+ return adapterType.cast(modelMerger);
}
if (adapterType == ISynchronizationCompareAdapter.class && adaptableObject instanceof ExampleModelProvider) {
if (compareAdapter == null) {
compareAdapter = new CompareAdapter((ExampleModelProvider)adaptableObject);
}
- return compareAdapter;
+ return adapterType.cast(compareAdapter);
}
if (adapterType == IHistoryPageSource.class){
- return historyPageSource;
+ return adapterType.cast(historyPageSource);
}
return null;
}
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
- */
- public Class[] getAdapterList() {
+ public Class<?>[] getAdapterList() {
return new Class[] { IWorkbenchAdapter.class, ResourceMapping.class, IResourceMappingMerger.class, ISynchronizationCompareAdapter.class };
}
diff --git a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/model/ui/ModelNavigatorContentProvider.java b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/model/ui/ModelNavigatorContentProvider.java
index 2e1d35c46..3db44963a 100644
--- a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/model/ui/ModelNavigatorContentProvider.java
+++ b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/model/ui/ModelNavigatorContentProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
+ * Copyright (c) 2006, 2018 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
@@ -320,9 +320,9 @@ public class ModelNavigatorContentProvider extends BaseWorkbenchContentProvider
return false;
}
- public Object getAdapter(Class adapter) {
+ public <T> T getAdapter(Class<T> adapter) {
if (adapter == SaveablesProvider.class) {
- return saveablesProvider;
+ return adapter.cast(saveablesProvider);
}
return Platform.getAdapterManager().getAdapter(this, adapter);
}
diff --git a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/model/ui/ModelSaveable.java b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/model/ui/ModelSaveable.java
index 622e42cc8..15498a8f7 100644
--- a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/model/ui/ModelSaveable.java
+++ b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/model/ui/ModelSaveable.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2009 IBM Corporation and others.
+ * Copyright (c) 2007, 2018 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
@@ -73,9 +73,9 @@ public class ModelSaveable extends Saveable {
dirty = true;
}
- public Object getAdapter(Class adapter) {
+ public <T> T getAdapter(Class<T> adapter) {
if (adapter == ResourceMapping.class) {
- return Adapters.adapt(getModelObject(), ResourceMapping.class);
+ return Adapters.adapt(getModelObject(), adapter);
}
return super.getAdapter(adapter);
}
diff --git a/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/PatchLinesTest.java b/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/PatchLinesTest.java
index bd41c5864..fa30c83bf 100644
--- a/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/PatchLinesTest.java
+++ b/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/PatchLinesTest.java
@@ -133,7 +133,7 @@ public class PatchLinesTest extends TestCase {
}
private int getNewLength(IHunk hunk) {
- Class cls = hunk.getClass();
+ Class<?> cls = hunk.getClass();
try {
Field fld = cls.getDeclaredField("fNewLength");
fld.setAccessible(true);
@@ -152,7 +152,7 @@ public class PatchLinesTest extends TestCase {
}
private int getOldLength(IHunk hunk) {
- Class cls = hunk.getClass();
+ Class<?> cls = hunk.getClass();
try {
Field fld = cls.getDeclaredField("fOldLength");
fld.setAccessible(true);
diff --git a/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/PatchUtils.java b/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/PatchUtils.java
index c1d0c7564..d0c033f55 100644
--- a/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/PatchUtils.java
+++ b/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/PatchUtils.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2017 IBM Corporation and others.
+ * Copyright (c) 2009, 2018 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
@@ -43,7 +43,7 @@ public class PatchUtils {
fileName = old;
}
- public Object getAdapter(Class adapter) {
+ public <T> T getAdapter(Class<T> adapter) {
return null;
}
@@ -92,7 +92,7 @@ public class PatchUtils {
return true;
}
- public Object getAdapter(Class adapter) {
+ public <T> T getAdapter(Class<T> adapter) {
return null;
}
}
@@ -127,7 +127,7 @@ public class PatchUtils {
return true;
}
- public Object getAdapter(Class adapter) {
+ public <T> T getAdapter(Class<T> adapter) {
return null;
}
}
diff --git a/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/ReflectionUtils.java b/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/ReflectionUtils.java
index 8d19b3415..87d5980b1 100644
--- a/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/ReflectionUtils.java
+++ b/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/ReflectionUtils.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2011 IBM Corporation and others.
+ * Copyright (c) 2009, 2018 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,12 +19,12 @@ public class ReflectionUtils {
public static Object callMethod(Object object, String name, Object args[])
throws IllegalArgumentException, IllegalAccessException,
InvocationTargetException, NoSuchMethodException {
- Class types[] = new Class[args.length];
+ Class<?> types[] = new Class[args.length];
for (int i = 0; i < args.length; i++) {
types[i] = args[i].getClass();
}
Method method = null;
- Class clazz = object.getClass();
+ Class<?> clazz = object.getClass();
NoSuchMethodException ex = null;
while (method == null && clazz != null) {
try {
@@ -56,7 +56,7 @@ public class ReflectionUtils {
public static Object getField(Object object, String name, boolean deep)
throws IllegalArgumentException, IllegalAccessException,
SecurityException, NoSuchFieldException {
- Class clazz = object.getClass();
+ Class<?> clazz = object.getClass();
NoSuchFieldException ex = null;
while (clazz != null) {
try {
diff --git a/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/WorkspaceTest.java b/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/WorkspaceTest.java
index 5e8217b66..2531f5416 100644
--- a/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/WorkspaceTest.java
+++ b/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/WorkspaceTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 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,14 +36,14 @@ public class WorkspaceTest extends ResourceTest {
protected static IProgressMonitor DEFAULT_MONITOR = new NullProgressMonitor();
protected static final IProgressMonitor DEFAULT_PROGRESS_MONITOR = new NullProgressMonitor();
- public static Test suite(Class c) {
+ public static Test suite(Class<?> c) {
String testName = System.getProperty("eclipse.team.testName");
if (testName == null) {
TestSuite suite = new TestSuite(c);
return suite;
}
try {
- return (Test)c.getConstructor(new Class[] { String.class }).newInstance(new Object[] {testName});
+ return (Test)c.getConstructor(String.class).newInstance(testName);
} catch (Exception e) {
fail(e.getMessage());
// Above will throw so below is never actually reached

Back to the top