Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2018-02-07 14:21:32 -0500
committerAlexander Kurtakov2018-02-07 14:21:32 -0500
commit2df4e713c2e9b6cf0a6f554c2f44797cb33e566c (patch)
tree1010db1e4ac5b606eccfc1e76a53f10b4ae1c489 /examples
parentf9959fe40ae5943210c66dc0d0fd0aad14f2766f (diff)
downloadeclipse.platform.team-2df4e713c2e9b6cf0a6f554c2f44797cb33e566c.tar.gz
eclipse.platform.team-2df4e713c2e9b6cf0a6f554c2f44797cb33e566c.tar.xz
eclipse.platform.team-2df4e713c2e9b6cf0a6f554c2f44797cb33e566c.zip
Change-Id: I2ce29644a969e3df4d47bfcbe2557ebf439c7d0b Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
Diffstat (limited to 'examples')
-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
8 files changed, 29 insertions, 32 deletions
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);
}

Back to the top