Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Keppler2019-05-15 08:43:30 -0400
committerMatthias Sohn2019-06-10 19:13:00 -0400
commitacbd245305eab71839b2b8dbf2cd33737112a179 (patch)
tree3730e4ac4b24aba626d6c4baa9421821e8e34578 /org.eclipse.egit.ui/src/org/eclipse
parentbfe19a05dd5832e65e97d6dffab8ba96ddebe025 (diff)
downloadegit-acbd245305eab71839b2b8dbf2cd33737112a179.tar.gz
egit-acbd245305eab71839b2b8dbf2cd33737112a179.tar.xz
egit-acbd245305eab71839b2b8dbf2cd33737112a179.zip
Remove pre-Mars adapter workaround
Since our minimum target is Mars, we no longer need the previous workaround for avoiding compiler warnings around adapters. This is not a git revert, but an inline refactoring of the previously introduced method. Also inline AdapterUtils.adapt() in such a way that Adapters.adapt() is called instead. Bug:460685 Change-Id: Idbbe4853f68a9b6d1ffff1f434bdbfb9bc705a80 Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.egit.ui/src/org/eclipse')
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIUtils.java6
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/GitLabelProvider.java4
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/RepositorySaveableFilter.java4
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/CompareIndexWithHeadActionHandler.java6
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/ShowBlameActionHandler.java6
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/TagActionHandler.java4
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/blame/BlameOperation.java6
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commit/CommitEditor.java10
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commit/CommitEditorPage.java4
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commit/DiffEditorPage.java6
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commit/MultiPageEditorContentOutlinePage.java4
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commit/NotesEditorPage.java4
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/decorators/GitLightweightDecorator.java7
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/decorators/ProblemLabelDecorator.java7
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/expressions/GitPropertyTester.java19
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/factories/GitAdapterFactory.java4
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/handler/SelectionHandler.java6
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/CommitMessageViewer.java5
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GitHistoryPage.java11
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/command/AbstractHistoryCommandHandler.java13
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/command/AbstractRebaseHistoryCommandHandler.java4
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/operations/GitScopeUtil.java6
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/preferences/GitProjectPropertyPage.java4
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/rebase/RebaseInteractiveView.java3
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/reflog/ReflogView.java5
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoriesView.java7
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoryPropertyPage.java4
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoryPropertySourceProvider.java4
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoryStatisticsPage.java4
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/revision/FileRevisionEditorInput.java18
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/revision/FileRevisionTypedElement.java4
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/revision/GitCompareFileRevisionEditorInput.java6
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/selection/SelectionPropertyTester.java10
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/selection/SelectionUtils.java18
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/staging/StagingView.java13
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/GitChangeSetModelProvider.java5
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/GitModelSynchronize.java4
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/GitModelSynchronizeParticipant.java4
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/action/OpenWorkingFileAction.java4
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/mapping/GitChangeSetContentProvider.java4
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/variables/GitTemplateVariableResolver.java4
41 files changed, 138 insertions, 133 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIUtils.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIUtils.java
index 922c82da9..89922c017 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIUtils.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIUtils.java
@@ -28,8 +28,8 @@ import org.eclipse.core.commands.NotEnabledException;
import org.eclipse.core.commands.NotHandledException;
import org.eclipse.core.commands.common.NotDefinedException;
import org.eclipse.core.expressions.IEvaluationContext;
+import org.eclipse.core.runtime.Adapters;
import org.eclipse.core.runtime.Path;
-import org.eclipse.egit.core.AdapterUtils;
import org.eclipse.egit.ui.internal.CommonUtils;
import org.eclipse.egit.ui.internal.RepositorySaveableFilter;
import org.eclipse.egit.ui.internal.UIIcons;
@@ -917,7 +917,7 @@ public class UIUtils {
}
private static String getShowInMenuLabel() {
- IBindingService bindingService = AdapterUtils.adapt(PlatformUI
+ IBindingService bindingService = Adapters.adapt(PlatformUI
.getWorkbench(), IBindingService.class);
if (bindingService != null) {
String keyBinding = bindingService
@@ -942,7 +942,7 @@ public class UIUtils {
*/
@Nullable
public static KeyStroke getKeystrokeOfBestActiveBindingFor(String commandId) {
- IBindingService bindingService = AdapterUtils
+ IBindingService bindingService = Adapters
.adapt(PlatformUI.getWorkbench(), IBindingService.class);
if (bindingService == null) {
return null;
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/GitLabelProvider.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/GitLabelProvider.java
index 7d042eaf7..c38d75288 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/GitLabelProvider.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/GitLabelProvider.java
@@ -13,7 +13,7 @@
package org.eclipse.egit.ui.internal;
import org.eclipse.core.resources.IResource;
-import org.eclipse.egit.core.AdapterUtils;
+import org.eclipse.core.runtime.Adapters;
import org.eclipse.egit.ui.internal.clone.ProjectRecord;
import org.eclipse.egit.ui.internal.commit.RepositoryCommit;
import org.eclipse.egit.ui.internal.repository.tree.RefNode;
@@ -70,7 +70,7 @@ public class GitLabelProvider extends LabelProvider implements
}
if (element instanceof GitModelBlob || element instanceof GitModelTree) {
- Object adapter = AdapterUtils.adapt(element, IResource.class);
+ Object adapter = Adapters.adapt(element, IResource.class);
return getWorkbenchLabelProvider().getImage(adapter);
}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/RepositorySaveableFilter.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/RepositorySaveableFilter.java
index 1635fd529..a1a7045ad 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/RepositorySaveableFilter.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/RepositorySaveableFilter.java
@@ -15,9 +15,9 @@ import java.util.List;
import org.eclipse.core.filebuffers.FileBuffers;
import org.eclipse.core.filebuffers.ITextFileBuffer;
+import org.eclipse.core.runtime.Adapters;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
-import org.eclipse.egit.core.AdapterUtils;
import org.eclipse.egit.core.internal.util.ProjectUtil;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jgit.lib.Repository;
@@ -54,7 +54,7 @@ public class RepositorySaveableFilter extends SaveFilter {
}
private boolean isTextFileBufferInWorkDir(Saveable saveable) {
- IDocument document = AdapterUtils.adapt(saveable, IDocument.class);
+ IDocument document = Adapters.adapt(saveable, IDocument.class);
if (document == null)
return true; // be conservative and assume this needs to be saved
ITextFileBuffer textFileBuffer = FileBuffers.getTextFileBufferManager()
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/CompareIndexWithHeadActionHandler.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/CompareIndexWithHeadActionHandler.java
index 1af16244e..57ba92dcd 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/CompareIndexWithHeadActionHandler.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/CompareIndexWithHeadActionHandler.java
@@ -18,8 +18,8 @@ import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.Adapters;
import org.eclipse.core.runtime.IPath;
-import org.eclipse.egit.core.AdapterUtils;
import org.eclipse.egit.core.internal.storage.GitFileRevision;
import org.eclipse.egit.ui.Activator;
import org.eclipse.egit.ui.internal.CompareUtils;
@@ -111,13 +111,13 @@ public class CompareIndexWithHeadActionHandler extends RepositoryActionHandler {
}
Object selected = selection.getFirstElement();
- IResource resource = AdapterUtils.adapt(selected, IResource.class);
+ IResource resource = Adapters.adapt(selected, IResource.class);
if (resource instanceof IFile) {
// action is only working on files. Avoid calculation
// of unnecessary expensive IndexDiff on a folder
return ResourceStateFactory.getInstance().get(resource).isStaged();
} else if (resource == null) {
- IPath location = AdapterUtils.adapt(selected, IPath.class);
+ IPath location = Adapters.adapt(selected, IPath.class);
if (location != null) {
return ResourceStateFactory.getInstance().get(location.toFile())
.isStaged();
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/ShowBlameActionHandler.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/ShowBlameActionHandler.java
index 28f84db8c..2e2edc690 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/ShowBlameActionHandler.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/ShowBlameActionHandler.java
@@ -19,7 +19,7 @@ import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IStorage;
-import org.eclipse.egit.core.AdapterUtils;
+import org.eclipse.core.runtime.Adapters;
import org.eclipse.egit.core.internal.job.JobUtil;
import org.eclipse.egit.core.internal.storage.CommitFileRevision;
import org.eclipse.egit.core.project.RepositoryMapping;
@@ -44,7 +44,7 @@ public class ShowBlameActionHandler extends RepositoryActionHandler {
return null;
}
Object element = selection.getFirstElement();
- IResource resource = AdapterUtils.adapt(element, IResource.class);
+ IResource resource = Adapters.adapt(element, IResource.class);
if (resource instanceof IFile) {
RepositoryMapping mapping = RepositoryMapping.getMapping(resource);
if (mapping != null) {
@@ -76,7 +76,7 @@ public class ShowBlameActionHandler extends RepositoryActionHandler {
return false;
}
Object element = selection.getFirstElement();
- IResource resource = AdapterUtils.adapt(element, IResource.class);
+ IResource resource = Adapters.adapt(element, IResource.class);
if (resource instanceof IStorage) {
return RepositoryMapping.getMapping(resource) != null;
}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/TagActionHandler.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/TagActionHandler.java
index 3710acf37..e218685ee 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/TagActionHandler.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/TagActionHandler.java
@@ -15,6 +15,7 @@ import java.text.MessageFormat;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.Adapters;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
@@ -22,7 +23,6 @@ import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
-import org.eclipse.egit.core.AdapterUtils;
import org.eclipse.egit.core.internal.IRepositoryCommit;
import org.eclipse.egit.core.op.TagOperation;
import org.eclipse.egit.ui.Activator;
@@ -163,7 +163,7 @@ public class TagActionHandler extends RepositoryActionHandler {
private IRepositoryCommit getCommit(IStructuredSelection selection) {
if (selection != null && selection.size() == 1) {
Object obj = selection.getFirstElement();
- return AdapterUtils.adapt(obj, IRepositoryCommit.class);
+ return Adapters.adapt(obj, IRepositoryCommit.class);
}
return null;
}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/blame/BlameOperation.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/blame/BlameOperation.java
index 84ad8d15b..22a1f5260 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/blame/BlameOperation.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/blame/BlameOperation.java
@@ -21,13 +21,13 @@ import java.util.Map;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IStorage;
+import org.eclipse.core.runtime.Adapters;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.egit.core.AdapterUtils;
import org.eclipse.egit.core.internal.storage.CommitFileRevision;
import org.eclipse.egit.core.op.IEGitOperation;
import org.eclipse.egit.ui.Activator;
@@ -356,7 +356,7 @@ public class BlameOperation implements IEGitOperation {
AbstractDecoratedTextEditor editor = (AbstractDecoratedTextEditor) editorPart;
// IRevisionRulerColumn would also be possible but using
// IVerticalRulerInfo seems to work in more situations.
- IVerticalRulerInfo rulerInfo = AdapterUtils.adapt(editor,
+ IVerticalRulerInfo rulerInfo = Adapters.adapt(editor,
IVerticalRulerInfo.class);
BlameInformationControlCreator creator = new BlameInformationControlCreator(
@@ -380,7 +380,7 @@ public class BlameOperation implements IEGitOperation {
}
}
- IRevisionRulerColumn revisionRuler = AdapterUtils.adapt(editor,
+ IRevisionRulerColumn revisionRuler = Adapters.adapt(editor,
IRevisionRulerColumn.class);
if (revisionRuler instanceof IRevisionRulerColumnExtension)
((IRevisionRulerColumnExtension) revisionRuler)
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commit/CommitEditor.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commit/CommitEditor.java
index b502bcb9d..08269fbe1 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commit/CommitEditor.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commit/CommitEditor.java
@@ -16,10 +16,10 @@ package org.eclipse.egit.ui.internal.commit;
import java.text.MessageFormat;
+import org.eclipse.core.runtime.Adapters;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
-import org.eclipse.egit.core.AdapterUtils;
import org.eclipse.egit.ui.Activator;
import org.eclipse.egit.ui.internal.CommonUtils;
import org.eclipse.egit.ui.internal.UIIcons;
@@ -461,7 +461,7 @@ public class CommitEditor extends SharedHeaderFormEditor implements
@Override
public <T> T getAdapter(Class<T> adapter) {
if (RepositoryCommit.class == adapter) {
- return AdapterUtils.adapt(getEditorInput(), adapter);
+ return Adapters.adapt(getEditorInput(), adapter);
} else if (IContentOutlinePage.class == adapter) {
return adapter.cast(getOutlinePage());
}
@@ -475,7 +475,7 @@ public class CommitEditor extends SharedHeaderFormEditor implements
@Override
public void init(IEditorSite site, IEditorInput input)
throws PartInitException {
- if (AdapterUtils.adapt(input, RepositoryCommit.class) == null)
+ if (Adapters.adapt(input, RepositoryCommit.class) == null)
throw new PartInitException(
"Input could not be adapted to commit object"); //$NON-NLS-1$
super.init(site, input);
@@ -543,7 +543,7 @@ public class CommitEditor extends SharedHeaderFormEditor implements
@Override
public ShowInContext getShowInContext() {
IFormPage currentPage = getActivePageInstance();
- IShowInSource showInSource = AdapterUtils.adapt(currentPage,
+ IShowInSource showInSource = Adapters.adapt(currentPage,
IShowInSource.class);
if (showInSource != null) {
return showInSource.getShowInContext();
@@ -554,7 +554,7 @@ public class CommitEditor extends SharedHeaderFormEditor implements
@Override
public String[] getShowInTargetIds() {
IFormPage currentPage = getActivePageInstance();
- IShowInTargetList targetList = AdapterUtils.adapt(currentPage,
+ IShowInTargetList targetList = Adapters.adapt(currentPage,
IShowInTargetList.class);
if (targetList != null) {
return targetList.getShowInTargetIds();
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commit/CommitEditorPage.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commit/CommitEditorPage.java
index 532106ef1..13c2b4115 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commit/CommitEditorPage.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commit/CommitEditorPage.java
@@ -20,6 +20,7 @@ import java.util.Collections;
import java.util.Comparator;
import java.util.List;
+import org.eclipse.core.runtime.Adapters;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
@@ -30,7 +31,6 @@ import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.egit.core.AdapterUtils;
import org.eclipse.egit.core.EclipseGitProgressTransformer;
import org.eclipse.egit.core.internal.Utils;
import org.eclipse.egit.ui.Activator;
@@ -552,7 +552,7 @@ public class CommitEditorPage extends FormPage
}
RepositoryCommit getCommit() {
- return AdapterUtils.adapt(getEditor(), RepositoryCommit.class);
+ return Adapters.adapt(getEditor(), RepositoryCommit.class);
}
@Override
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commit/DiffEditorPage.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commit/DiffEditorPage.java
index 88269be58..739014716 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commit/DiffEditorPage.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commit/DiffEditorPage.java
@@ -26,13 +26,13 @@ import java.util.Map;
import java.util.Objects;
import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.runtime.Adapters;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.egit.core.AdapterUtils;
import org.eclipse.egit.ui.Activator;
import org.eclipse.egit.ui.UIUtils;
import org.eclipse.egit.ui.internal.UIText;
@@ -429,7 +429,7 @@ public class DiffEditorPage extends TextEditor
@Override
public ShowInContext getShowInContext() {
- RepositoryCommit commit = AdapterUtils.adapt(getEditorInput(),
+ RepositoryCommit commit = Adapters.adapt(getEditorInput(),
RepositoryCommit.class);
if (commit != null) {
return new ShowInContext(getEditorInput(),
@@ -563,7 +563,7 @@ public class DiffEditorPage extends TextEditor
* cause this document to be shown.
*/
private void formatDiff() {
- RepositoryCommit commit = AdapterUtils.adapt(getEditor(),
+ RepositoryCommit commit = Adapters.adapt(getEditor(),
RepositoryCommit.class);
if (commit == null) {
return;
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commit/MultiPageEditorContentOutlinePage.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commit/MultiPageEditorContentOutlinePage.java
index f78875e71..26c1ec4f3 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commit/MultiPageEditorContentOutlinePage.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commit/MultiPageEditorContentOutlinePage.java
@@ -14,7 +14,7 @@ import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.CopyOnWriteArrayList;
-import org.eclipse.egit.core.AdapterUtils;
+import org.eclipse.core.runtime.Adapters;
import org.eclipse.egit.ui.internal.UIText;
import org.eclipse.jface.dialogs.IPageChangedListener;
import org.eclipse.jface.util.SafeRunnable;
@@ -223,7 +223,7 @@ public class MultiPageEditorContentOutlinePage extends ContentOutlinePage {
}
private IPage createOutlinePage(IEditorPart editor) {
- IContentOutlinePage outlinePage = AdapterUtils.adapt(editor,
+ IContentOutlinePage outlinePage = Adapters.adapt(editor,
IContentOutlinePage.class);
if (outlinePage == null) {
pages.put(editor, emptyPage);
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commit/NotesEditorPage.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commit/NotesEditorPage.java
index 3bee1fa0f..57679879c 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commit/NotesEditorPage.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commit/NotesEditorPage.java
@@ -12,7 +12,7 @@
*****************************************************************************/
package org.eclipse.egit.ui.internal.commit;
-import org.eclipse.egit.core.AdapterUtils;
+import org.eclipse.core.runtime.Adapters;
import org.eclipse.egit.ui.internal.UIText;
import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.swt.widgets.Composite;
@@ -47,7 +47,7 @@ public class NotesEditorPage extends FormPage {
* @return commit
*/
protected RepositoryCommit getCommit() {
- return AdapterUtils.adapt(getEditor(), RepositoryCommit.class);
+ return Adapters.adapt(getEditor(), RepositoryCommit.class);
}
@Override
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/decorators/GitLightweightDecorator.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/decorators/GitLightweightDecorator.java
index a4dcd2ff8..9cf415bf4 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/decorators/GitLightweightDecorator.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/decorators/GitLightweightDecorator.java
@@ -33,10 +33,10 @@ import java.util.Map;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.resources.mapping.ResourceMapping;
+import org.eclipse.core.runtime.Adapters;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.egit.core.AdapterUtils;
import org.eclipse.egit.core.internal.indexdiff.IndexDiffData;
import org.eclipse.egit.core.internal.util.ExceptionCollector;
import org.eclipse.egit.core.project.GitProjectData;
@@ -710,9 +710,10 @@ public class GitLightweightDecorator extends GitDecorator
resource = (IResource) element;
} else if (element instanceof IAdaptable) {
final IAdaptable adaptable = (IAdaptable) element;
- resource = AdapterUtils.adapt(adaptable, IResource.class);
+ resource = Adapters.adapt(adaptable, IResource.class);
if (resource == null) {
- final IContributorResourceAdapter adapter = AdapterUtils.adapt(adaptable, IContributorResourceAdapter.class);
+ final IContributorResourceAdapter adapter = Adapters
+ .adapt(adaptable, IContributorResourceAdapter.class);
if (adapter != null)
resource = adapter.getAdaptedResource(adaptable);
}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/decorators/ProblemLabelDecorator.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/decorators/ProblemLabelDecorator.java
index a5a3ec302..f1b803905 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/decorators/ProblemLabelDecorator.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/decorators/ProblemLabelDecorator.java
@@ -23,9 +23,9 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceChangeEvent;
import org.eclipse.core.resources.IResourceChangeListener;
import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.Adapters;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
-import org.eclipse.egit.core.AdapterUtils;
import org.eclipse.egit.core.project.RepositoryMapping;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.JFaceResources;
@@ -174,10 +174,9 @@ public class ProblemLabelDecorator extends BaseLabelProvider implements
private void getAffectedElements(Set<IPath> paths, Object[] elements,
IStructuredContentProvider contentProvider, List<Object> result) {
for (Object element : elements) {
- IPath path = AdapterUtils.adapt(element, IPath.class);
+ IPath path = Adapters.adapt(element, IPath.class);
if (path == null) {
- IResource resource = AdapterUtils.adapt(element,
- IResource.class);
+ IResource resource = Adapters.adapt(element, IResource.class);
if (resource != null) {
path = resource.getLocation();
}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/expressions/GitPropertyTester.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/expressions/GitPropertyTester.java
index 1bd4f2282..d27b12143 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/expressions/GitPropertyTester.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/expressions/GitPropertyTester.java
@@ -16,7 +16,7 @@ import java.util.Collection;
import java.util.List;
import org.eclipse.core.expressions.PropertyTester;
-import org.eclipse.egit.core.AdapterUtils;
+import org.eclipse.core.runtime.Adapters;
import org.eclipse.egit.core.internal.IRepositoryCommit;
import org.eclipse.egit.ui.internal.commit.RepositoryCommit;
import org.eclipse.jgit.lib.Constants;
@@ -71,7 +71,7 @@ public class GitPropertyTester extends AbstractPropertyTester {
public boolean test(Object receiver, String property, Object[] args,
Object expectedValue) {
if ("parentCount".equals(property)) { //$NON-NLS-1$
- RevCommit commit = AdapterUtils.adapt(receiver, RevCommit.class);
+ RevCommit commit = Adapters.adapt(receiver, RevCommit.class);
if (commit == null) {
return false;
}
@@ -83,41 +83,38 @@ public class GitPropertyTester extends AbstractPropertyTester {
commit.getParentCount() > 0);
}
} else if ("isBare".equals(property)) { //$NON-NLS-1$
- Repository repository = AdapterUtils.adapt(receiver,
- Repository.class);
+ Repository repository = Adapters.adapt(receiver, Repository.class);
if (repository != null) {
return computeResult(expectedValue, repository.isBare());
}
} else if ("isSafe".equals(property)) { //$NON-NLS-1$
- Repository repository = AdapterUtils.adapt(receiver,
- Repository.class);
+ Repository repository = Adapters.adapt(receiver, Repository.class);
if (repository != null) {
return computeResult(expectedValue, repository
.getRepositoryState().equals(RepositoryState.SAFE));
}
} else if ("canCommit".equals(property)) { //$NON-NLS-1$
- Repository repository = AdapterUtils.adapt(receiver,
- Repository.class);
+ Repository repository = Adapters.adapt(receiver, Repository.class);
if (repository != null) {
return computeResult(expectedValue,
repository.getRepositoryState().canCommit());
}
} else if ("hasMultipleRefs".equals(property)) { //$NON-NLS-1$
- IRepositoryCommit commit = AdapterUtils.adapt(receiver,
+ IRepositoryCommit commit = Adapters.adapt(receiver,
IRepositoryCommit.class);
if (commit != null) {
return computeResult(expectedValue,
hasMultipleRefs(commit, toRefNames(args)));
}
} else if ("hasRef".equals(property)) { //$NON-NLS-1$
- IRepositoryCommit commit = AdapterUtils.adapt(receiver,
+ IRepositoryCommit commit = Adapters.adapt(receiver,
IRepositoryCommit.class);
if (commit != null) {
return computeResult(expectedValue,
hasRef(commit, toRefNames(args)));
}
} else if ("isStash".equals(property)) { //$NON-NLS-1$
- RepositoryCommit commit = AdapterUtils.adapt(receiver,
+ RepositoryCommit commit = Adapters.adapt(receiver,
RepositoryCommit.class);
return computeResult(expectedValue,
commit != null && commit.isStash());
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/factories/GitAdapterFactory.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/factories/GitAdapterFactory.java
index 58094c341..2181690b8 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/factories/GitAdapterFactory.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/factories/GitAdapterFactory.java
@@ -27,13 +27,13 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.resources.mapping.ResourceMapping;
+import org.eclipse.core.runtime.Adapters;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdapterFactory;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.egit.core.Activator;
-import org.eclipse.egit.core.AdapterUtils;
import org.eclipse.egit.core.internal.util.ProjectUtil;
import org.eclipse.egit.core.internal.util.ResourceUtil;
import org.eclipse.egit.core.project.RepositoryMapping;
@@ -144,7 +144,7 @@ public class GitAdapterFactory implements IAdapterFactory {
}
if (adapterType == Repository.class) {
- ResourceMapping m = AdapterUtils.adapt(adaptableObject,
+ ResourceMapping m = Adapters.adapt(adaptableObject,
ResourceMapping.class);
if (m != null) {
return adapterType.cast(SelectionUtils
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/handler/SelectionHandler.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/handler/SelectionHandler.java
index de2bfc0c7..81211b618 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/handler/SelectionHandler.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/handler/SelectionHandler.java
@@ -18,7 +18,7 @@ import java.util.List;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.egit.core.AdapterUtils;
+import org.eclipse.core.runtime.Adapters;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
@@ -56,7 +56,7 @@ public abstract class SelectionHandler extends AbstractHandler {
protected <V> V getSelectedItem(final Class<V> itemClass,
final ExecutionEvent event) {
final Object selected = getSelection(event).getFirstElement();
- return AdapterUtils.adapt(selected, itemClass);
+ return Adapters.adapt(selected, itemClass);
}
/**
@@ -71,7 +71,7 @@ public abstract class SelectionHandler extends AbstractHandler {
ExecutionEvent event) {
final List<V> items = new LinkedList<>();
for (Object selected : getSelection(event).toArray()) {
- V adapted = AdapterUtils.adapt(selected, itemClass);
+ V adapted = Adapters.adapt(selected, itemClass);
if (adapted != null)
items.add(adapted);
}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/CommitMessageViewer.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/CommitMessageViewer.java
index bf1ab666a..7851ea17f 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/CommitMessageViewer.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/CommitMessageViewer.java
@@ -21,11 +21,11 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.core.runtime.Adapters;
import org.eclipse.core.runtime.ListenerList;
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
-import org.eclipse.egit.core.AdapterUtils;
import org.eclipse.egit.ui.Activator;
import org.eclipse.egit.ui.UIPreferences;
import org.eclipse.egit.ui.UIUtils;
@@ -339,7 +339,8 @@ class CommitMessageViewer extends HyperlinkSourceViewer {
}
private void scheduleFormatJob() {
- IWorkbenchSiteProgressService siteService = AdapterUtils.adapt(partSite, IWorkbenchSiteProgressService.class);
+ IWorkbenchSiteProgressService siteService = Adapters.adapt(partSite,
+ IWorkbenchSiteProgressService.class);
if (siteService == null) {
return;
}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GitHistoryPage.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GitHistoryPage.java
index 8b99e743b..589d849b8 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GitHistoryPage.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GitHistoryPage.java
@@ -31,6 +31,7 @@ import java.util.regex.Pattern;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.runtime.Adapters;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
@@ -891,7 +892,7 @@ public class GitHistoryPage extends HistoryPage implements RefsChangedListener,
if (resource != null && typeOk(resource))
return true;
- return AdapterUtils.adapt(object, Repository.class) != null;
+ return Adapters.adapt(object, Repository.class) != null;
}
private static boolean typeOk(final IResource object) {
@@ -1923,9 +1924,9 @@ public class GitHistoryPage extends HistoryPage implements RefsChangedListener,
}
}
if (repo == null) {
- repo = AdapterUtils.adapt(o, Repository.class);
+ repo = Adapters.adapt(o, Repository.class);
if (repo != null) {
- File file = AdapterUtils.adapt(o, File.class);
+ File file = Adapters.adapt(o, File.class);
if (file == null) {
input = new HistoryPageInput(repo);
} else {
@@ -1933,7 +1934,7 @@ public class GitHistoryPage extends HistoryPage implements RefsChangedListener,
}
}
}
- selection = AdapterUtils.adapt(o, RevCommit.class);
+ selection = Adapters.adapt(o, RevCommit.class);
if (input == null || repo == null) {
this.name = ""; //$NON-NLS-1$
@@ -2788,7 +2789,7 @@ public class GitHistoryPage extends HistoryPage implements RefsChangedListener,
IWorkbenchPartSite site = getPartSite();
if (site != null) {
final IWorkbenchSiteProgressService p;
- p = AdapterUtils.adapt(site, IWorkbenchSiteProgressService.class);
+ p = Adapters.adapt(site, IWorkbenchSiteProgressService.class);
if (p != null) {
p.schedule(j, 0, true /* use half-busy cursor */);
return;
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/command/AbstractHistoryCommandHandler.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/command/AbstractHistoryCommandHandler.java
index 5fe593a48..dc4a3abf2 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/command/AbstractHistoryCommandHandler.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/command/AbstractHistoryCommandHandler.java
@@ -24,6 +24,7 @@ import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.Adapters;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.egit.core.AdapterUtils;
@@ -74,8 +75,8 @@ abstract class AbstractHistoryCommandHandler extends AbstractHandler {
throws ExecutionException {
IStructuredSelection selection = getSelection(event);
if (!selection.isEmpty()) {
- IRepositoryCommit commit = AdapterUtils
- .adapt(selection.getFirstElement(), IRepositoryCommit.class);
+ IRepositoryCommit commit = Adapters.adapt(
+ selection.getFirstElement(), IRepositoryCommit.class);
if (commit != null) {
return commit.getRepository();
}
@@ -90,7 +91,7 @@ abstract class AbstractHistoryCommandHandler extends AbstractHandler {
if (input instanceof RepositoryTreeNode) {
return ((RepositoryTreeNode) input).getRepository();
}
- Repository repo = AdapterUtils.adapt(input, Repository.class);
+ Repository repo = Adapters.adapt(input, Repository.class);
if (repo != null) {
return repo;
}
@@ -194,7 +195,7 @@ abstract class AbstractHistoryCommandHandler extends AbstractHandler {
throw new ExecutionException(
UIText.AbstractHistoryCommandHandler_ActionRequiresOneSelectedCommitMessage);
}
- RevCommit commit = AdapterUtils.adapt(selection.getFirstElement(),
+ RevCommit commit = Adapters.adapt(selection.getFirstElement(),
RevCommit.class);
if (commit == null) {
throw new ExecutionException(
@@ -240,7 +241,7 @@ abstract class AbstractHistoryCommandHandler extends AbstractHandler {
List<RevCommit> commits = new ArrayList<>();
try (RevWalk walk = new RevWalk(repository)) {
for (Object element : selection.toList()) {
- RevCommit commit = AdapterUtils.adapt(element, RevCommit.class);
+ RevCommit commit = Adapters.adapt(element, RevCommit.class);
if (commit != null) {
// Re-parse commit to clear effects of TreeFilter
RevCommit reparsed = walk.parseCommit(commit.getId());
@@ -307,7 +308,7 @@ abstract class AbstractHistoryCommandHandler extends AbstractHandler {
if (selection.isEmpty()) {
return branchesOfCommit;
}
- RevCommit revCommit = AdapterUtils.adapt(selection.getFirstElement(),
+ RevCommit revCommit = Adapters.adapt(selection.getFirstElement(),
RevCommit.class);
if (!(revCommit instanceof PlotCommit)) {
return branchesOfCommit;
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/command/AbstractRebaseHistoryCommandHandler.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/command/AbstractRebaseHistoryCommandHandler.java
index b927bb246..3e317ad9e 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/command/AbstractRebaseHistoryCommandHandler.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/command/AbstractRebaseHistoryCommandHandler.java
@@ -20,7 +20,7 @@ import java.io.IOException;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.egit.core.AdapterUtils;
+import org.eclipse.core.runtime.Adapters;
import org.eclipse.egit.core.op.RebaseOperation;
import org.eclipse.egit.ui.internal.UIText;
import org.eclipse.egit.ui.internal.commands.shared.AbstractRebaseCommandHandler;
@@ -51,7 +51,7 @@ public abstract class AbstractRebaseHistoryCommandHandler extends
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
- RevCommit revCommit = AdapterUtils
+ RevCommit revCommit = Adapters
.adapt(getSelection(event).getFirstElement(), RevCommit.class);
if (!(revCommit instanceof PlotCommit)) {
return null;
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/operations/GitScopeUtil.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/operations/GitScopeUtil.java
index 5bce2c081..02034d581 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/operations/GitScopeUtil.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/operations/GitScopeUtil.java
@@ -21,10 +21,10 @@ import java.util.List;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.mapping.ResourceMapping;
+import org.eclipse.core.runtime.Adapters;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.SubMonitor;
-import org.eclipse.egit.core.AdapterUtils;
import org.eclipse.egit.core.synchronize.GitResourceVariantTreeSubscriber;
import org.eclipse.egit.core.synchronize.dto.GitSynchronizeDataSet;
import org.eclipse.egit.ui.Activator;
@@ -110,12 +110,12 @@ public class GitScopeUtil {
@Nullable
private static ResourceMapping getResourceMapping(Object o) {
- ResourceMapping mapping = AdapterUtils.adapt(o, ResourceMapping.class);
+ ResourceMapping mapping = Adapters.adapt(o, ResourceMapping.class);
if (mapping != null) {
return mapping;
}
if (o instanceof IAdaptable) {
- IContributorResourceAdapter adapted = AdapterUtils.adapt(o,
+ IContributorResourceAdapter adapted = Adapters.adapt(o,
IContributorResourceAdapter.class);
if (adapted instanceof IContributorResourceAdapter2) {
IContributorResourceAdapter2 cra = (IContributorResourceAdapter2) adapted;
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/preferences/GitProjectPropertyPage.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/preferences/GitProjectPropertyPage.java
index 4b32dcdea..0a08cc512 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/preferences/GitProjectPropertyPage.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/preferences/GitProjectPropertyPage.java
@@ -17,8 +17,8 @@ import java.io.IOException;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.Adapters;
import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.egit.core.AdapterUtils;
import org.eclipse.egit.core.project.RepositoryMapping;
import org.eclipse.egit.ui.Activator;
import org.eclipse.egit.ui.UIUtils;
@@ -87,7 +87,7 @@ public class GitProjectPropertyPage extends PropertyPage {
if (element instanceof IResource) {
project = ((IResource) element).getProject();
} else {
- IResource adapter = AdapterUtils.adapt(element, IResource.class);
+ IResource adapter = Adapters.adapt(element, IResource.class);
if (adapter != null) {
project = adapter.getProject();
}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/rebase/RebaseInteractiveView.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/rebase/RebaseInteractiveView.java
index 5963ee989..2c7ae5da6 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/rebase/RebaseInteractiveView.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/rebase/RebaseInteractiveView.java
@@ -21,6 +21,7 @@ import java.util.List;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.Adapters;
import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener;
import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent;
import org.eclipse.core.runtime.preferences.InstanceScope;
@@ -227,7 +228,7 @@ public class RebaseInteractiveView extends ViewPart implements
}
}
if (repo == null) {
- repo = AdapterUtils.adapt(o, Repository.class);
+ repo = Adapters.adapt(o, Repository.class);
}
if (repo == null && !force) {
return;
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/reflog/ReflogView.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/reflog/ReflogView.java
index 219cdf72f..2abf2fb62 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/reflog/ReflogView.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/reflog/ReflogView.java
@@ -19,6 +19,7 @@ package org.eclipse.egit.ui.internal.reflog;
import java.io.IOException;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.Adapters;
import org.eclipse.egit.core.AdapterUtils;
import org.eclipse.egit.core.internal.Utils;
import org.eclipse.egit.core.project.RepositoryMapping;
@@ -369,7 +370,7 @@ public class ReflogView extends ViewPart implements RefsChangedListener, IShowIn
}
if (part instanceof IEditorPart) {
IEditorInput input = ((IEditorPart) part).getEditorInput();
- Repository repository = AdapterUtils.adapt(input,
+ Repository repository = Adapters.adapt(input,
Repository.class);
if (repository != null) {
reactOnSelection(new StructuredSelection(repository));
@@ -461,7 +462,7 @@ public class ReflogView extends ViewPart implements RefsChangedListener, IShowIn
}
}
if (selectedRepo == null) {
- selectedRepo = AdapterUtils.adapt(first, Repository.class);
+ selectedRepo = Adapters.adapt(first, Repository.class);
}
if (selectedRepo == null) {
return;
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoriesView.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoriesView.java
index eeecf20b8..908ea7564 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoriesView.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoriesView.java
@@ -33,6 +33,7 @@ import java.util.Set;
import org.eclipse.core.commands.Command;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.Adapters;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
@@ -873,7 +874,7 @@ public class RepositoriesView extends CommonNavigator implements IShowInSource,
showResource(input.getFile());
return true;
}
- Repository repository = AdapterUtils.adapt(context.getInput(),
+ Repository repository = Adapters.adapt(context.getInput(),
Repository.class);
if (repository != null) {
showRepository(repository);
@@ -985,13 +986,13 @@ public class RepositoriesView extends CommonNavigator implements IShowInSource,
showResource(adapted);
return;
}
- File file = AdapterUtils.adapt(ssel.getFirstElement(), File.class);
+ File file = Adapters.adapt(ssel.getFirstElement(), File.class);
if (file != null) {
IPath path = new Path(file.getAbsolutePath());
showPaths(Arrays.asList(path));
return;
}
- Repository repository = AdapterUtils.adapt(ssel.getFirstElement(),
+ Repository repository = Adapters.adapt(ssel.getFirstElement(),
Repository.class);
if (repository != null) {
showRepository(repository);
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoryPropertyPage.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoryPropertyPage.java
index 63960db89..f248a0c39 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoryPropertyPage.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoryPropertyPage.java
@@ -15,7 +15,7 @@ package org.eclipse.egit.ui.internal.repository;
import java.io.File;
import java.io.IOException;
-import org.eclipse.egit.core.AdapterUtils;
+import org.eclipse.core.runtime.Adapters;
import org.eclipse.egit.ui.Activator;
import org.eclipse.egit.ui.internal.preferences.ConfigurationEditorComponent;
import org.eclipse.jface.layout.GridDataFactory;
@@ -43,7 +43,7 @@ public class RepositoryPropertyPage extends PropertyPage {
GridLayoutFactory.fillDefaults().applyTo(displayArea);
GridDataFactory.fillDefaults().applyTo(displayArea);
- final Repository repo = AdapterUtils.adapt(getElement(), Repository.class);
+ final Repository repo = Adapters.adapt(getElement(), Repository.class);
if (repo == null)
return displayArea;
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoryPropertySourceProvider.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoryPropertySourceProvider.java
index fdc47f94e..89852a2af 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoryPropertySourceProvider.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoryPropertySourceProvider.java
@@ -12,7 +12,7 @@
*******************************************************************************/
package org.eclipse.egit.ui.internal.repository;
-import org.eclipse.egit.core.AdapterUtils;
+import org.eclipse.core.runtime.Adapters;
import org.eclipse.egit.ui.internal.repository.tree.RepositoryTreeNode;
import org.eclipse.egit.ui.internal.repository.tree.RepositoryTreeNodeType;
import org.eclipse.jface.action.IToolBarManager;
@@ -134,7 +134,7 @@ public class RepositoryPropertySourceProvider implements
Ref ref = (Ref) node.getObject();
if (ref.getName().startsWith(Constants.R_HEADS) || ref.getName().startsWith(Constants.R_REMOTES)){
checkChangeType(SourceType.BRANCH);
- Repository repository = AdapterUtils.adapt(node, Repository.class);
+ Repository repository = Adapters.adapt(node, Repository.class);
lastRepositorySource = new BranchPropertySource(repository, ref.getName(), myPage);
return lastRepositorySource;
}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoryStatisticsPage.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoryStatisticsPage.java
index d0ae76b3a..ab2e038ef 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoryStatisticsPage.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoryStatisticsPage.java
@@ -15,7 +15,7 @@ package org.eclipse.egit.ui.internal.repository;
import java.text.NumberFormat;
import java.util.Properties;
-import org.eclipse.egit.core.AdapterUtils;
+import org.eclipse.core.runtime.Adapters;
import org.eclipse.egit.ui.Activator;
import org.eclipse.egit.ui.internal.UIText;
import org.eclipse.jgit.api.GarbageCollectCommand;
@@ -65,7 +65,7 @@ public class RepositoryStatisticsPage extends PropertyPage {
column.setText(title);
}
- Repository repo = AdapterUtils.adapt(getElement(), Repository.class);
+ Repository repo = Adapters.adapt(getElement(), Repository.class);
if (repo == null) {
return table;
}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/revision/FileRevisionEditorInput.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/revision/FileRevisionEditorInput.java
index 8fe617d27..6c92b7f45 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/revision/FileRevisionEditorInput.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/revision/FileRevisionEditorInput.java
@@ -25,13 +25,13 @@ import java.util.Date;
import org.eclipse.core.resources.IEncodedStorage;
import org.eclipse.core.resources.IFileState;
import org.eclipse.core.resources.IStorage;
+import org.eclipse.core.runtime.Adapters;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.PlatformObject;
-import org.eclipse.egit.core.AdapterUtils;
import org.eclipse.egit.core.internal.storage.CommitFileRevision;
import org.eclipse.egit.ui.Activator;
import org.eclipse.egit.ui.internal.PreferenceBasedDateFormatter;
@@ -80,7 +80,7 @@ public class FileRevisionEditorInput extends PlatformObject implements
return new IFileState() {
@Override
public <T> T getAdapter(Class<T> adapter) {
- return AdapterUtils.adapt(storage, adapter);
+ return Adapters.adapt(storage, adapter);
}
@Override
@@ -123,7 +123,7 @@ public class FileRevisionEditorInput extends PlatformObject implements
return new IEncodedStorage() {
@Override
public <T> T getAdapter(Class<T> adapter) {
- return AdapterUtils.adapt(storage, adapter);
+ return Adapters.adapt(storage, adapter);
}
@Override
@@ -201,7 +201,7 @@ public class FileRevisionEditorInput extends PlatformObject implements
@Override
public String getName() {
- IFileRevision rev = AdapterUtils.adapt(this, IFileRevision.class);
+ IFileRevision rev = Adapters.adapt(this, IFileRevision.class);
if (rev != null) {
String identifier;
if (rev instanceof CommitFileRevision) {
@@ -214,7 +214,7 @@ public class FileRevisionEditorInput extends PlatformObject implements
UIText.FileRevisionEditorInput_NameAndRevisionTitle,
rev.getName(), identifier);
}
- IFileState state = AdapterUtils.adapt(this, IFileState.class);
+ IFileState state = Adapters.adapt(this, IFileState.class);
if (state != null) {
return state.getName() + ' ' + PreferenceBasedDateFormatter.create()
.formatDate(new Date(state.getModificationTime()));
@@ -245,7 +245,7 @@ public class FileRevisionEditorInput extends PlatformObject implements
if (object != null) {
return adapter.cast(object);
}
- return AdapterUtils.adapt(fileRevision, adapter);
+ return Adapters.adapt(fileRevision, adapter);
}
@Override
@@ -260,7 +260,7 @@ public class FileRevisionEditorInput extends PlatformObject implements
@Override
public String getLabel(Object o) {
- IFileRevision rev = AdapterUtils.adapt(this, IFileRevision.class);
+ IFileRevision rev = Adapters.adapt(this, IFileRevision.class);
if (rev != null)
return rev.getName();
return storage.getName();
@@ -348,11 +348,11 @@ public class FileRevisionEditorInput extends PlatformObject implements
}
private String getRevisionPrefix() {
- IFileRevision rev = AdapterUtils.adapt(this, IFileRevision.class);
+ IFileRevision rev = Adapters.adapt(this, IFileRevision.class);
if (rev != null) {
return abbreviate(rev.getContentIdentifier()) + '_';
}
- IFileState state = AdapterUtils.adapt(this, IFileState.class);
+ IFileState state = Adapters.adapt(this, IFileState.class);
if (state != null) {
return DATE_FORMAT.format(new Date(state.getModificationTime()))
+ '_';
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/revision/FileRevisionTypedElement.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/revision/FileRevisionTypedElement.java
index ee7f29740..685fd1635 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/revision/FileRevisionTypedElement.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/revision/FileRevisionTypedElement.java
@@ -18,10 +18,10 @@ import java.util.Date;
import org.eclipse.compare.ITypedElement;
import org.eclipse.core.resources.IStorage;
+import org.eclipse.core.runtime.Adapters;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.egit.core.AdapterUtils;
import org.eclipse.egit.ui.internal.PreferenceBasedDateFormatter;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.team.core.history.IFileRevision;
@@ -63,7 +63,7 @@ public class FileRevisionTypedElement extends StorageTypedElement {
return adapter.cast(result);
}
if (adapter == Repository.class) {
- return AdapterUtils.adapt(fileRevision, adapter);
+ return Adapters.adapt(fileRevision, adapter);
}
return null;
}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/revision/GitCompareFileRevisionEditorInput.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/revision/GitCompareFileRevisionEditorInput.java
index 1929f9a26..8de917451 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/revision/GitCompareFileRevisionEditorInput.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/revision/GitCompareFileRevisionEditorInput.java
@@ -30,11 +30,11 @@ import org.eclipse.compare.structuremergeviewer.IDiffElement;
import org.eclipse.compare.structuremergeviewer.IStructureComparator;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.Adapters;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.egit.core.Activator;
-import org.eclipse.egit.core.AdapterUtils;
import org.eclipse.egit.core.internal.storage.IndexFileRevision;
import org.eclipse.egit.core.internal.storage.OpenWorkspaceVersionEnabled;
import org.eclipse.egit.ui.internal.CommonUtils;
@@ -369,7 +369,7 @@ public class GitCompareFileRevisionEditorInput extends SaveableCompareEditorInpu
}
return getResource();
} else if (adapter == Repository.class && left != null) {
- return AdapterUtils.adapt(left, Repository.class);
+ return Adapters.adapt(left, Repository.class);
}
return super.getAdapter(adapter);
}
@@ -623,7 +623,7 @@ public class GitCompareFileRevisionEditorInput extends SaveableCompareEditorInpu
private ISaveablesLifecycleListener getSaveablesLifecycleListener(
IWorkbenchPart part) {
- ISaveablesLifecycleListener listener = AdapterUtils.adapt(part,
+ ISaveablesLifecycleListener listener = Adapters.adapt(part,
ISaveablesLifecycleListener.class);
if (listener == null)
listener = CommonUtils.getService(part.getSite(), ISaveablesLifecycleListener.class);
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/selection/SelectionPropertyTester.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/selection/SelectionPropertyTester.java
index 7d3a293bb..9f2071376 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/selection/SelectionPropertyTester.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/selection/SelectionPropertyTester.java
@@ -27,6 +27,7 @@ import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.Adapters;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.egit.core.AdapterUtils;
import org.eclipse.egit.core.project.RepositoryMapping;
@@ -194,13 +195,12 @@ public class SelectionPropertyTester extends AbstractPropertyTester {
boolean single) {
Repository repo = null;
for (Object element : collection) {
- IContainer container = AdapterUtils.adapt(element,
- IProject.class);
+ IContainer container = Adapters.adapt(element, IProject.class);
RepositoryMapping mapping = null;
if (container != null) {
mapping = RepositoryMapping.getMapping(container);
} else {
- container = AdapterUtils.adapt(element, IContainer.class);
+ container = Adapters.adapt(element, IContainer.class);
if (container != null) {
mapping = RepositoryMapping.getMapping(container);
}
@@ -214,7 +214,7 @@ public class SelectionPropertyTester extends AbstractPropertyTester {
repo = r;
}
} else {
- IWorkingSet workingSet = AdapterUtils.adapt(element,
+ IWorkingSet workingSet = Adapters.adapt(element,
IWorkingSet.class);
if (workingSet != null) {
for (IAdaptable adaptable : workingSet.getElements()) {
@@ -270,7 +270,7 @@ public class SelectionPropertyTester extends AbstractPropertyTester {
}
private static Repository getRepositoryOfProject(Object object) {
- IProject project = AdapterUtils.adapt(object, IProject.class);
+ IProject project = Adapters.adapt(object, IProject.class);
if (project != null)
return getRepositoryOfMapping(project);
return null;
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/selection/SelectionUtils.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/selection/SelectionUtils.java
index 9729f0b73..338ccc273 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/selection/SelectionUtils.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/selection/SelectionUtils.java
@@ -26,6 +26,7 @@ import org.eclipse.core.expressions.IEvaluationContext;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.mapping.ResourceMapping;
+import org.eclipse.core.runtime.Adapters;
import org.eclipse.core.runtime.IPath;
import org.eclipse.egit.core.AdapterUtils;
import org.eclipse.egit.core.internal.util.ResourceUtil;
@@ -102,7 +103,7 @@ public class SelectionUtils {
Set<Repository> repos = new LinkedHashSet<>();
for (Object o : selection.toArray()) {
- Repository repo = AdapterUtils.adapt(o, Repository.class);
+ Repository repo = Adapters.adapt(o, Repository.class);
if (repo != null) {
repos.add(repo);
} else {
@@ -200,7 +201,7 @@ public class SelectionUtils {
if (location != null)
result.add(location);
} else {
- IPath location = AdapterUtils.adapt(o, IPath.class);
+ IPath location = Adapters.adapt(o, IPath.class);
if (location != null)
result.add(location);
else
@@ -248,7 +249,7 @@ public class SelectionUtils {
}
private static List<IResource> extractResourcesFromMapping(Object o) {
- ResourceMapping mapping = AdapterUtils.adapt(o, ResourceMapping.class);
+ ResourceMapping mapping = Adapters.adapt(o, ResourceMapping.class);
return ResourceUtil.extractResourcesFromMapping(mapping);
}
@@ -316,7 +317,7 @@ public class SelectionUtils {
@NonNull IStructuredSelection selection) {
Set<Object> result = new HashSet<>();
for (Object o : selection.toList()) {
- Repository r = AdapterUtils.adapt(o, Repository.class);
+ Repository r = Adapters.adapt(o, Repository.class);
if (r != null) {
result.add(r);
continue;
@@ -326,12 +327,11 @@ public class SelectionUtils {
result.add(resource);
continue;
}
- ResourceMapping mapping = AdapterUtils.adapt(o,
- ResourceMapping.class);
+ ResourceMapping mapping = Adapters.adapt(o, ResourceMapping.class);
if (mapping != null) {
result.addAll(extractResourcesFromMapping(mapping));
} else {
- IPath location = AdapterUtils.adapt(o, IPath.class);
+ IPath location = Adapters.adapt(o, IPath.class);
if (location != null) {
result.add(location);
}
@@ -394,7 +394,7 @@ public class SelectionUtils {
if (result == null) {
for (Object o : selection.toArray()) {
- Repository nextRepo = AdapterUtils.adapt(o, Repository.class);
+ Repository nextRepo = Adapters.adapt(o, Repository.class);
if (nextRepo != null && result != null && result != nextRepo) {
if (warn)
MessageDialog
@@ -533,7 +533,7 @@ public class SelectionUtils {
result = new ArrayList<>();
Iterator elements = ((IStructuredSelection) selection).iterator();
while (elements.hasNext()) {
- T adapter = AdapterUtils.adapt(elements.next(), c);
+ T adapter = Adapters.adapt(elements.next(), c);
if (adapter != null) {
result.add(adapter);
}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/staging/StagingView.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/staging/StagingView.java
index 0b991000d..b9cc24904 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/staging/StagingView.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/staging/StagingView.java
@@ -45,6 +45,7 @@ import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.Adapters;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -1204,7 +1205,7 @@ public class StagingView extends ViewPart
}
if (part instanceof IEditorPart) {
IEditorInput input = ((IEditorPart) part).getEditorInput();
- Repository repository = AdapterUtils.adapt(input,
+ Repository repository = Adapters.adapt(input,
Repository.class);
if (repository != null) {
reactOnSelection(new StructuredSelection(repository));
@@ -1476,7 +1477,7 @@ public class StagingView extends ViewPart
if (resource != null) {
sel = new StructuredSelection(resource);
} else {
- Repository repository = AdapterUtils.adapt(
+ Repository repository = Adapters.adapt(
((IEditorPart) part).getEditorInput(),
Repository.class);
if (repository != null) {
@@ -2004,7 +2005,8 @@ public class StagingView extends ViewPart
// For the normal resource undo/redo actions to be active, so that files
// deleted via the "Delete" action in the staging view can be restored.
- IUndoContext workspaceContext = AdapterUtils.adapt(ResourcesPlugin.getWorkspace(), IUndoContext.class);
+ IUndoContext workspaceContext = Adapters
+ .adapt(ResourcesPlugin.getWorkspace(), IUndoContext.class);
undoRedoActionGroup = new UndoRedoActionGroup(getViewSite(), workspaceContext, true);
undoRedoActionGroup.fillActionBars(actionBars);
@@ -3320,8 +3322,7 @@ public class StagingView extends ViewPart
reload(repo);
}
} else {
- Repository repo = AdapterUtils.adapt(firstElement,
- Repository.class);
+ Repository repo = Adapters.adapt(firstElement, Repository.class);
if (repo != null) {
if (currentRepository != repo) {
reload(repo);
@@ -3609,7 +3610,7 @@ public class StagingView extends ViewPart
.getStagingEntriesFiltered((StagingFolderEntry) o);
collectPaths(entries, result);
} else if (o instanceof StagingEntry) {
- result.add(AdapterUtils.adapt(o, IPath.class));
+ result.add(Adapters.adapt(o, IPath.class));
}
}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/GitChangeSetModelProvider.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/GitChangeSetModelProvider.java
index b314b35cc..fcdbb4082 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/GitChangeSetModelProvider.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/GitChangeSetModelProvider.java
@@ -16,10 +16,10 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.mapping.ModelProvider;
import org.eclipse.core.resources.mapping.ResourceMapping;
import org.eclipse.core.resources.mapping.ResourceMappingContext;
+import org.eclipse.core.runtime.Adapters;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.egit.core.Activator;
-import org.eclipse.egit.core.AdapterUtils;
import org.eclipse.egit.core.synchronize.GitSubscriberResourceMappingContext;
import org.eclipse.egit.core.synchronize.IgnoreInGitSynchronizations;
import org.eclipse.egit.core.synchronize.dto.GitSynchronizeData;
@@ -76,7 +76,8 @@ public class GitChangeSetModelProvider extends ModelProvider
}
if (object != null) {
- ResourceMapping rm = AdapterUtils.adapt(object, ResourceMapping.class);
+ ResourceMapping rm = Adapters.adapt(object,
+ ResourceMapping.class);
return new ResourceMapping[] { rm };
}
}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/GitModelSynchronize.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/GitModelSynchronize.java
index c5ad55861..fbed0bc95 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/GitModelSynchronize.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/GitModelSynchronize.java
@@ -20,13 +20,13 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.WorkspaceJob;
import org.eclipse.core.resources.mapping.RemoteResourceMappingContext;
import org.eclipse.core.resources.mapping.ResourceMapping;
+import org.eclipse.core.runtime.Adapters;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
-import org.eclipse.egit.core.AdapterUtils;
import org.eclipse.egit.core.internal.util.ResourceUtil;
import org.eclipse.egit.core.synchronize.GitResourceVariantTreeSubscriber;
import org.eclipse.egit.core.synchronize.GitSubscriberMergeContext;
@@ -98,7 +98,7 @@ public class GitModelSynchronize {
List<ResourceMapping> gitMappings = new ArrayList<>();
for (IResource element : elements) {
- ResourceMapping mapping = AdapterUtils.adapt(element,
+ ResourceMapping mapping = Adapters.adapt(element,
ResourceMapping.class);
if (mapping != null && isMappedToGitProvider(mapping))
gitMappings.add(mapping);
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/GitModelSynchronizeParticipant.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/GitModelSynchronizeParticipant.java
index c1e82daab..7439a3c86 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/GitModelSynchronizeParticipant.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/GitModelSynchronizeParticipant.java
@@ -31,6 +31,7 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.resources.mapping.ModelProvider;
import org.eclipse.core.resources.mapping.ResourceMapping;
+import org.eclipse.core.runtime.Adapters;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.NullProgressMonitor;
@@ -38,7 +39,6 @@ import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
-import org.eclipse.egit.core.AdapterUtils;
import org.eclipse.egit.core.internal.storage.WorkspaceFileRevision;
import org.eclipse.egit.core.internal.util.ResourceUtil;
import org.eclipse.egit.core.project.GitProjectData;
@@ -221,7 +221,7 @@ public class GitModelSynchronizeParticipant extends ModelSynchronizeParticipant
// in Java Workspace model Java source files are passed as type
// CompilationUnit which can be adapted to IResource
- IResource res = AdapterUtils.adapt(object, IResource.class);
+ IResource res = Adapters.adapt(object, IResource.class);
if (res != null && res.getType() == IResource.FILE)
return true;
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/action/OpenWorkingFileAction.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/action/OpenWorkingFileAction.java
index 884305ab2..42bbd36e8 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/action/OpenWorkingFileAction.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/action/OpenWorkingFileAction.java
@@ -14,8 +14,8 @@ import java.io.File;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.Adapters;
import org.eclipse.core.runtime.IPath;
-import org.eclipse.egit.core.AdapterUtils;
import org.eclipse.egit.ui.internal.UIText;
import org.eclipse.egit.ui.internal.synchronize.model.GitModelObject;
import org.eclipse.jface.dialogs.ErrorDialog;
@@ -133,7 +133,7 @@ public class OpenWorkingFileAction extends SelectionListenerAction {
@Nullable
private IResource getExistingResource(IStructuredSelection selection) {
Object element = selection.getFirstElement();
- IResource resource = AdapterUtils.adapt(element, IResource.class);
+ IResource resource = Adapters.adapt(element, IResource.class);
if (resource != null && resource.exists()) {
return resource;
}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/mapping/GitChangeSetContentProvider.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/mapping/GitChangeSetContentProvider.java
index 50b8e3219..6fc737780 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/mapping/GitChangeSetContentProvider.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/mapping/GitChangeSetContentProvider.java
@@ -17,11 +17,11 @@ import org.eclipse.compare.structuremergeviewer.Differencer;
import org.eclipse.core.resources.mapping.ResourceMapping;
import org.eclipse.core.resources.mapping.ResourceMappingContext;
import org.eclipse.core.resources.mapping.ResourceTraversal;
+import org.eclipse.core.runtime.Adapters;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.egit.core.Activator;
-import org.eclipse.egit.core.AdapterUtils;
import org.eclipse.egit.core.synchronize.GitResourceVariantTreeSubscriber;
import org.eclipse.egit.core.synchronize.GitSubscriberMergeContext;
import org.eclipse.egit.core.synchronize.GitSubscriberResourceMappingContext;
@@ -114,7 +114,7 @@ public class GitChangeSetContentProvider extends SynchronizationContentProvider
@Nullable
private ResourceMapping getResourceMapping(Object object) {
- return AdapterUtils.adapt(object, ResourceMapping.class);
+ return Adapters.adapt(object, ResourceMapping.class);
}
@Override
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/variables/GitTemplateVariableResolver.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/variables/GitTemplateVariableResolver.java
index 5b8dbe97b..41cdfe335 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/variables/GitTemplateVariableResolver.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/variables/GitTemplateVariableResolver.java
@@ -15,8 +15,8 @@ import java.lang.reflect.Method;
import java.util.List;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.Adapters;
import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.egit.core.AdapterUtils;
import org.eclipse.egit.core.project.RepositoryMapping;
import org.eclipse.egit.ui.Activator;
import org.eclipse.jdt.core.IJavaProject;
@@ -147,7 +147,7 @@ public class GitTemplateVariableResolver extends TemplateVariableResolver {
// We can't use instanceof here because of the compiler error on 4.10
// platform saying that TemplateContext is always IAdaptable
if (IAdaptable.class.isInstance(context)) {
- return AdapterUtils.adapt(context, IProject.class);
+ return Adapters.adapt(context, IProject.class);
}
// Note: block below can be removed after EGit minimum target platform
// will be 4.10, see bug 539095 for details

Back to the top