Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2017-07-19 12:10:23 -0400
committerAlexander Kurtakov2017-07-19 12:10:23 -0400
commit8e8b622b4bf49f7e77107db4335e10731eb53254 (patch)
treeaff0eafed9ebc8ccbaa1db91c9b415c6468ea49b
parentd796c830dbef8ef8ba662ac974b21ce5a174d739 (diff)
downloadeclipse.platform.team-8e8b622b4bf49f7e77107db4335e10731eb53254.tar.gz
eclipse.platform.team-8e8b622b4bf49f7e77107db4335e10731eb53254.tar.xz
eclipse.platform.team-8e8b622b4bf49f7e77107db4335e10731eb53254.zip
Bug 519875 - Cleanup o.e.team.ui
Move Runnables to lambdas. Change-Id: I8ab7b9d9262c9d37ecf345ed4427e811fbb97387 Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/DefaultUIFileModificationValidator.java16
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetImporter.java7
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIPlugin.java15
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java101
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/ConfigureProjectAction.java23
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/OpenRevisionAction.java18
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/OpenWithMenu.java42
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/ProgressDialogRunnableContext.java66
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/TeamAction.java28
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/MultipleYesNoPrompter.java9
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/ResourceMappingResourceDisplayArea.java104
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/GenericHistoryView.java13
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/LocalHistoryPage.java115
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/ReplaceLocalHistory.java9
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/ShowLocalHistory.java31
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/CommonViewerAdvisor.java30
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/FuzzFactorDialog.java18
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/MergeAction.java18
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/MergeAllActionHandler.java29
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/MergeAllOperation.java62
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/MergeIncomingChangesAction.java25
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceCompareInputChangeNotifier.java17
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceMarkAsMergedHandler.java24
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceMergeHandler.java29
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceModelContentProvider.java30
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/AbstractSynchronizeModelProvider.java10
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ActiveChangeSetCollector.java56
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangesSection.java16
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ForwardingChangesSection.java21
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SaveablesCompareEditorInput.java55
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SyncInfoSetChangesSection.java14
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelUpdateHandler.java18
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/TreeViewerAdvisor.java60
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ChangeSetActionGroup.java55
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenInCompareAction.java18
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/PinParticipantAction.java17
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RemoveFromViewAction.java20
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/StatusLineContributionGroup.java43
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SynchronizePageDropDownAction.java46
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/ApplyPatchOperation.java5
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/PageCompareEditorInput.java21
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/SaveablePartDialog.java27
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/TeamOperation.java18
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ModelOperation.java21
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ModelParticipantAction.java58
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SaveableCompareEditorInput.java67
46 files changed, 456 insertions, 1089 deletions
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/DefaultUIFileModificationValidator.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/DefaultUIFileModificationValidator.java
index 8735f221b..bcafdf853 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/DefaultUIFileModificationValidator.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/DefaultUIFileModificationValidator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -112,19 +112,9 @@ public class DefaultUIFileModificationValidator extends DefaultFileModificationV
final Shell shell = getShell(context);
final boolean[] ok = new boolean[] { false };
if (readOnlyFiles.length == 1) {
- shell.getDisplay().syncExec(new Runnable() {
- @Override
- public void run() {
- ok[0] = MessageDialog.openQuestion(shell, TeamUIMessages.DefaultUIFileModificationValidator_3, NLS.bind(TeamUIMessages.DefaultUIFileModificationValidator_4, new String[] { readOnlyFiles[0].getFullPath().toString() })); //
- }
- });
+ shell.getDisplay().syncExec(() -> ok[0] = MessageDialog.openQuestion(shell, TeamUIMessages.DefaultUIFileModificationValidator_3, NLS.bind(TeamUIMessages.DefaultUIFileModificationValidator_4, new String[] { readOnlyFiles[0].getFullPath().toString() })));
} else {
- shell.getDisplay().syncExec(new Runnable() {
- @Override
- public void run() {
- ok[0] = FileListDialog.openQuestion(shell, readOnlyFiles);
- }
- });
+ shell.getDisplay().syncExec(() -> ok[0] = FileListDialog.openQuestion(shell, readOnlyFiles));
}
if (ok[0]) {
setWritable(readOnlyFiles);
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetImporter.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetImporter.java
index c8713aa8b..b1122d9b6 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetImporter.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetImporter.java
@@ -157,12 +157,7 @@ public class ProjectSetImporter {
shell, title, null, msg,
MessageDialog.QUESTION, buttons, 0);
- shell.getDisplay().syncExec(new Runnable() {
- @Override
- public void run() {
- dialog.open();
- }
- });
+ shell.getDisplay().syncExec(() -> dialog.open());
switch (dialog.getReturnCode()) {
case 0: // overwrite
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIPlugin.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIPlugin.java
index 22122abe4..d52ff35c9 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIPlugin.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIPlugin.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2014 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -107,14 +107,11 @@ public class TeamUIPlugin extends AbstractUIPlugin {
} else {
final Object [] ret = new Object[1];
final CoreException [] exc = new CoreException[1];
- BusyIndicator.showWhile(null, new Runnable() {
- @Override
- public void run() {
- try {
- ret[0] = element.createExecutableExtension(classAttribute);
- } catch (CoreException e) {
- exc[0] = e;
- }
+ BusyIndicator.showWhile(null, () -> {
+ try {
+ ret[0] = element.createExecutableExtension(classAttribute);
+ } catch (CoreException e) {
+ exc[0] = e;
}
});
if (exc[0] != null)
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java
index 7fbf7b48e..b9df04c27 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java
@@ -236,17 +236,13 @@ public class Utils {
}
// pop up progress dialog after a short delay
final Exception[] holder = new Exception[1];
- BusyIndicator.showWhile(parent.getDisplay(), new Runnable() {
-
- @Override
- public void run() {
- try {
- runnable.run(new NullProgressMonitor());
- } catch (InvocationTargetException e) {
- holder[0] = e;
- } catch (InterruptedException e) {
- holder[0] = e;
- }
+ BusyIndicator.showWhile(parent.getDisplay(), () -> {
+ try {
+ runnable.run(new NullProgressMonitor());
+ } catch (InvocationTargetException e1) {
+ holder[0] = e1;
+ } catch (InterruptedException e2) {
+ holder[0] = e2;
}
});
if (holder[0] != null) {
@@ -288,12 +284,7 @@ public class Utils {
if (display.isDisposed()) return null;
if (syncIfNecessary) {
final Shell[] result = new Shell[] { null };
- Runnable r = new Runnable() {
- @Override
- public void run() {
- result[0] = new Shell(Display.getDefault());
- }
- };
+ Runnable r = () -> result[0] = new Shell(Display.getDefault());
display.syncExec(r);
return result[0];
}
@@ -306,32 +297,29 @@ public class Utils {
* 16509). @param t
*/
public static void handle(final Throwable exception) {
- TeamUIPlugin.getStandardDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- IStatus error = null;
- Throwable t = exception;
- if (t instanceof InvocationTargetException) {
- t = ((InvocationTargetException) t).getTargetException();
- }
- if (t instanceof CoreException) {
- error = ((CoreException) t).getStatus();
- } else if (t instanceof TeamException) {
- error = ((TeamException) t).getStatus();
- } else {
- error = new Status(IStatus.ERROR, TeamUIPlugin.ID, 1, TeamUIMessages.simpleInternal, t);
- }
- Shell shell = new Shell(Display.getDefault());
- if (error.getSeverity() == IStatus.INFO) {
- MessageDialog.openInformation(shell, TeamUIMessages.information, error.getMessage());
- } else {
- ErrorDialog.openError(shell, TeamUIMessages.exception, null, error);
- }
- shell.dispose();
- // Let's log non-team exceptions
- if (!(t instanceof TeamException)) {
- TeamUIPlugin.log(error.getSeverity(), error.getMessage(), t);
- }
+ TeamUIPlugin.getStandardDisplay().asyncExec(() -> {
+ IStatus error = null;
+ Throwable t = exception;
+ if (t instanceof InvocationTargetException) {
+ t = ((InvocationTargetException) t).getTargetException();
+ }
+ if (t instanceof CoreException) {
+ error = ((CoreException) t).getStatus();
+ } else if (t instanceof TeamException) {
+ error = ((TeamException) t).getStatus();
+ } else {
+ error = new Status(IStatus.ERROR, TeamUIPlugin.ID, 1, TeamUIMessages.simpleInternal, t);
+ }
+ Shell shell = new Shell(Display.getDefault());
+ if (error.getSeverity() == IStatus.INFO) {
+ MessageDialog.openInformation(shell, TeamUIMessages.information, error.getMessage());
+ } else {
+ ErrorDialog.openError(shell, TeamUIMessages.exception, null, error);
+ }
+ shell.dispose();
+ // Let's log non-team exceptions
+ if (!(t instanceof TeamException)) {
+ TeamUIPlugin.log(error.getSeverity(), error.getMessage(), t);
}
});
}
@@ -852,12 +840,9 @@ public class Utils {
if(v == null) return;
final Control ctrl = v.getControl();
if (ctrl != null && !ctrl.isDisposed()) {
- ctrl.getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- if (!ctrl.isDisposed()) {
- BusyIndicator.showWhile(ctrl.getDisplay(), r);
- }
+ ctrl.getDisplay().asyncExec(() -> {
+ if (!ctrl.isDisposed()) {
+ BusyIndicator.showWhile(ctrl.getDisplay(), r);
}
});
}
@@ -871,12 +856,9 @@ public class Utils {
public static void syncExec(final Runnable r, final Control ctrl) {
if (ctrl != null && !ctrl.isDisposed()) {
- ctrl.getDisplay().syncExec(new Runnable() {
- @Override
- public void run() {
- if (!ctrl.isDisposed()) {
- BusyIndicator.showWhile(ctrl.getDisplay(), r);
- }
+ ctrl.getDisplay().syncExec(() -> {
+ if (!ctrl.isDisposed()) {
+ BusyIndicator.showWhile(ctrl.getDisplay(), r);
}
});
}
@@ -884,12 +866,9 @@ public class Utils {
public static void asyncExec(final Runnable r, final Control ctrl) {
if (ctrl != null && !ctrl.isDisposed()) {
- ctrl.getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- if (!ctrl.isDisposed()) {
- BusyIndicator.showWhile(ctrl.getDisplay(), r);
- }
+ ctrl.getDisplay().asyncExec(() -> {
+ if (!ctrl.isDisposed()) {
+ BusyIndicator.showWhile(ctrl.getDisplay(), r);
}
});
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/ConfigureProjectAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/ConfigureProjectAction.java
index b67450d5e..69fee2af5 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/ConfigureProjectAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/ConfigureProjectAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -14,9 +14,7 @@ package org.eclipse.team.internal.ui.actions;
import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.team.internal.ui.TeamUIMessages;
import org.eclipse.team.internal.ui.wizards.ConfigureProjectWizard;
@@ -31,17 +29,14 @@ public class ConfigureProjectAction extends TeamAction {
@Override
protected void execute(IAction action) throws InvocationTargetException,
InterruptedException {
- run(new IRunnableWithProgress() {
- @Override
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- if (!isEnabled())
- return;
- IProject[] projects = getSelectedProjects();
- ConfigureProjectWizard.shareProjects(getShell(), projects);
- } catch (Exception e) {
- throw new InvocationTargetException(e);
- }
+ run(monitor -> {
+ try {
+ if (!isEnabled())
+ return;
+ IProject[] projects = getSelectedProjects();
+ ConfigureProjectWizard.shareProjects(getShell(), projects);
+ } catch (Exception e) {
+ throw new InvocationTargetException(e);
}
}, TeamUIMessages.ConfigureProjectAction_configureProject, PROGRESS_BUSYCURSOR);
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/OpenRevisionAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/OpenRevisionAction.java
index 890509257..a764d66ca 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/OpenRevisionAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/OpenRevisionAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
+ * Copyright (c) 2006, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -14,7 +14,6 @@ package org.eclipse.team.internal.ui.actions;
import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.IStructuredSelection;
@@ -56,16 +55,13 @@ public class OpenRevisionAction extends BaseSelectionListenerAction {
if (revision == null || !revision.exists()) {
MessageDialog.openError(page.getSite().getShell(), TeamUIMessages.OpenRevisionAction_DeletedRevTitle, TeamUIMessages.OpenRevisionAction_DeletedRevMessage);
} else {
- IRunnableWithProgress runnable = new IRunnableWithProgress() {
- @Override
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- Utils.openEditor(page.getSite().getPage(), revision, monitor);
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- }
-
+ IRunnableWithProgress runnable = monitor -> {
+ try {
+ Utils.openEditor(page.getSite().getPage(), revision, monitor);
+ } catch (CoreException e) {
+ throw new InvocationTargetException(e);
}
+
};
IProgressService progressService = PlatformUI.getWorkbench().getProgressService();
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/OpenWithMenu.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/OpenWithMenu.java
index d39b3bc18..a0c11a09a 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/OpenWithMenu.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/OpenWithMenu.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2012 IBM Corporation and others.
+ * Copyright (c) 2008, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -246,46 +246,6 @@ public class OpenWithMenu extends ContributionItem {
createMenuItem(menu, defaultTextEditor, preferredEditor);
}
- // TODO : We might perhaps enable inplace and system external editors menu items
- /*// Add system editor
- IEditorDescriptor descriptor = registry
- .findEditor(IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID);
- final MenuItem systemEditorMenuItem = createMenuItem(menu, descriptor,
- preferredEditor);
- systemEditorMenuItem.setEnabled(false);
-
- // Add system in-place editor
- descriptor = registry
- .findEditor(IEditorRegistry.SYSTEM_INPLACE_EDITOR_ID);
-
- final MenuItem inPlaceEditorMenuItem = (descriptor != null) ? createMenuItem(
- menu, descriptor, preferredEditor)
- : null;
- if (inPlaceEditorMenuItem != null)
- inPlaceEditorMenuItem.setEnabled(false);
-
- Job job = new Job("updateOpenWithMenu") { //$NON-NLS-1$
- protected IStatus run(IProgressMonitor monitor) {
- try {
- final boolean isFile = fileRevision.getStorage(monitor) instanceof IFile;
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (inPlaceEditorMenuItem != null
- && !inPlaceEditorMenuItem.isDisposed())
- inPlaceEditorMenuItem.setEnabled(isFile);
- if (!systemEditorMenuItem.isDisposed())
- systemEditorMenuItem.setEnabled(isFile);
- }
- });
- return Status.OK_STATUS;
- } catch (CoreException e) {
- return new Status(IStatus.WARNING, TeamUIPlugin.ID, null, e);
- }
- };
- };
- job.setSystem(true);
- job.schedule();*/
-
createDefaultMenuItem(menu, fileRevision, preferredEditor == null);
// add Other... menu item
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/ProgressDialogRunnableContext.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/ProgressDialogRunnableContext.java
index 1458fe4f0..ec9d30420 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/ProgressDialogRunnableContext.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/ProgressDialogRunnableContext.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -15,7 +15,6 @@ import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.jface.operation.IRunnableContext;
import org.eclipse.jface.operation.IRunnableWithProgress;
@@ -62,9 +61,6 @@ public class ProgressDialogRunnableContext implements ITeamRunnableContext {
this.runnableContext = runnableContext;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.actions.ITeamRunnableContext#run(org.eclipse.jface.operation.IRunnableWithProgress)
- */
@Override
public void run(IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException {
getRunnableContext().run(true /* fork */, true /* cancelable */, wrapRunnable(runnable));
@@ -72,13 +68,9 @@ public class ProgressDialogRunnableContext implements ITeamRunnableContext {
private IRunnableContext getRunnableContext() {
if (runnableContext == null) {
- return new IRunnableContext() {
- @Override
- public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable)
- throws InvocationTargetException, InterruptedException {
- IProgressService manager = PlatformUI.getWorkbench().getProgressService();
- manager.busyCursorWhile(runnable);
- }
+ return (fork, cancelable, runnable) -> {
+ IProgressService manager = PlatformUI.getWorkbench().getProgressService();
+ manager.busyCursorWhile(runnable);
};
}
return runnableContext;
@@ -89,37 +81,31 @@ public class ProgressDialogRunnableContext implements ITeamRunnableContext {
* and runs in a workspace modify operation if requested.
*/
private IRunnableWithProgress wrapRunnable(final IRunnableWithProgress runnable) {
- return new IRunnableWithProgress() {
- @Override
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- if (schedulingRule == null && !postponeBuild) {
- runnable.run(monitor);
- } else {
- final Exception[] exception = new Exception[] { null };
- ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
- @Override
- public void run(IProgressMonitor pm) throws CoreException {
- try {
- runnable.run(pm);
- } catch (InvocationTargetException e) {
- exception[0] = e;
- } catch (InterruptedException e) {
- exception[0] = e;
- }
- }
- }, schedulingRule, 0 /* allow updates */, monitor);
- if (exception[0] != null) {
- if (exception[0] instanceof InvocationTargetException) {
- throw (InvocationTargetException)exception[0];
- } else if (exception[0] instanceof InterruptedException) {
- throw (InterruptedException)exception[0];
- }
+ return monitor -> {
+ try {
+ if (schedulingRule == null && !postponeBuild) {
+ runnable.run(monitor);
+ } else {
+ final Exception[] exception = new Exception[] { null };
+ ResourcesPlugin.getWorkspace().run((IWorkspaceRunnable) pm -> {
+ try {
+ runnable.run(pm);
+ } catch (InvocationTargetException e1) {
+ exception[0] = e1;
+ } catch (InterruptedException e2) {
+ exception[0] = e2;
+ }
+ }, schedulingRule, 0 /* allow updates */, monitor);
+ if (exception[0] != null) {
+ if (exception[0] instanceof InvocationTargetException) {
+ throw (InvocationTargetException)exception[0];
+ } else if (exception[0] instanceof InterruptedException) {
+ throw (InterruptedException)exception[0];
}
}
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
}
+ } catch (CoreException e) {
+ throw new InvocationTargetException(e);
}
};
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/TeamAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/TeamAction.java
index 73fc02c35..7d08f4ac8 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/TeamAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/TeamAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -95,12 +95,9 @@ public abstract class TeamAction extends AbstractHandler implements IObjectActio
}
};
- private ISelectionListener selectionListener = new ISelectionListener() {
- @Override
- public void selectionChanged(IWorkbenchPart part, ISelection selection) {
- if(selection instanceof IStructuredSelection)
- TeamAction.this.selection = (IStructuredSelection)selection;
- }
+ private ISelectionListener selectionListener = (part, selection) -> {
+ if(selection instanceof IStructuredSelection)
+ TeamAction.this.selection = (IStructuredSelection)selection;
};
/**
@@ -271,16 +268,13 @@ public abstract class TeamAction extends AbstractHandler implements IObjectActio
final Exception[] exceptions = new Exception[] {null};
switch (progressKind) {
case PROGRESS_BUSYCURSOR :
- BusyIndicator.showWhile(Display.getCurrent(), new Runnable() {
- @Override
- public void run() {
- try {
- runnable.run(new NullProgressMonitor());
- } catch (InvocationTargetException e) {
- exceptions[0] = e;
- } catch (InterruptedException e) {
- exceptions[0] = null;
- }
+ BusyIndicator.showWhile(Display.getCurrent(), () -> {
+ try {
+ runnable.run(new NullProgressMonitor());
+ } catch (InvocationTargetException e1) {
+ exceptions[0] = e1;
+ } catch (InterruptedException e2) {
+ exceptions[0] = null;
}
});
break;
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/MultipleYesNoPrompter.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/MultipleYesNoPrompter.java
index d36510406..f65c5c58d 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/MultipleYesNoPrompter.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/MultipleYesNoPrompter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -111,12 +111,7 @@ public class MultipleYesNoPrompter {
// run in syncExec because callback is from an operation,
// which is probably not running in the UI thread.
shell.getDisplay().syncExec(
- new Runnable() {
- @Override
- public void run() {
- dialog.open();
- }
- });
+ () -> dialog.open());
if (hasMultiple) {
switch (dialog.getReturnCode()) {
case 0:// Yes
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/ResourceMappingResourceDisplayArea.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/ResourceMappingResourceDisplayArea.java
index 180d22fba..f57d48d3d 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/ResourceMappingResourceDisplayArea.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/ResourceMappingResourceDisplayArea.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -78,9 +78,6 @@ public class ResourceMappingResourceDisplayArea extends DialogArea {
this.context = context;
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getChildren(java.lang.Object)
- */
@Override
public Object[] getChildren(Object o) {
ResourceTraversal[] traversals = getTraversals();
@@ -101,9 +98,6 @@ public class ResourceMappingResourceDisplayArea extends DialogArea {
return ResourceMappingResourceDisplayArea.getTraversals(mapping, context);
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getImageDescriptor(java.lang.Object)
- */
@Override
public ImageDescriptor getImageDescriptor(Object o) {
o = mapping;
@@ -121,17 +115,11 @@ public class ResourceMappingResourceDisplayArea extends DialogArea {
return workbenchAdapter.getImageDescriptor(o);
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getLabel(java.lang.Object)
- */
@Override
public String getLabel(Object o) {
return ResourceMappingResourceDisplayArea.getLabel(mapping);
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getParent(java.lang.Object)
- */
@Override
public Object getParent(Object o) {
return null;
@@ -162,9 +150,6 @@ public class ResourceMappingResourceDisplayArea extends DialogArea {
this.context = context;
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getChildren(java.lang.Object)
- */
@Override
public Object[] getChildren(Object o) {
if (traversal.getDepth() == IResource.DEPTH_INFINITE) {
@@ -202,9 +187,6 @@ public class ResourceMappingResourceDisplayArea extends DialogArea {
return container.members();
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getImageDescriptor(java.lang.Object)
- */
@Override
public ImageDescriptor getImageDescriptor(Object object) {
IWorkbenchAdapter workbenchAdapter = getWorkbenchAdapter(resource);
@@ -213,9 +195,6 @@ public class ResourceMappingResourceDisplayArea extends DialogArea {
return workbenchAdapter.getImageDescriptor(resource);
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getLabel(java.lang.Object)
- */
@Override
public String getLabel(Object o) {
if (resource.getType() != IResource.PROJECT && isTraversalRoot(resource))
@@ -230,9 +209,6 @@ public class ResourceMappingResourceDisplayArea extends DialogArea {
return ResourceMappingResourceDisplayArea.isTraversalRoot(traversal, resource);
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getParent(java.lang.Object)
- */
@Override
public Object getParent(Object o) {
return parent;
@@ -265,9 +241,6 @@ public class ResourceMappingResourceDisplayArea extends DialogArea {
this.message = string;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.dialogs.DialogArea#createArea(org.eclipse.swt.widgets.Composite)
- */
@Override
public void createArea(Composite parent) {
Composite composite = createComposite(parent, 1, true);
@@ -346,28 +319,25 @@ public class ResourceMappingResourceDisplayArea extends DialogArea {
private void buildFilteredResourceMap(final ResourceMapping mapping,
final ResourceTraversal traversal, IProgressMonitor monitor,
final Map<IResource, List<IResource>> result) throws CoreException {
- traversal.accept(new IResourceVisitor() {
- @Override
- public boolean visit(IResource resource) throws CoreException {
- if (filter.select(resource, mapping, traversal)) {
- // Add the resource to the result
- result.put(resource, new ArrayList<>());
- // Make sure that there are parent folders for the resource up to the traversal root
- IResource child = resource;
- while (!isTraversalRoot(traversal, child)) {
- IContainer parent = child.getParent();
- List<IResource> children = result.get(parent);
- if (children == null) {
- children = new ArrayList<>();
- result.put(parent, children);
- }
- children.add(child);
- child = parent;
- }
- }
- return true;
- }
- });
+ traversal.accept(resource -> {
+ if (filter.select(resource, mapping, traversal)) {
+ // Add the resource to the result
+ result.put(resource, new ArrayList<>());
+ // Make sure that there are parent folders for the resource up to the traversal root
+ IResource child = resource;
+ while (!isTraversalRoot(traversal, child)) {
+ IContainer parent = child.getParent();
+ List<IResource> children = result.get(parent);
+ if (children == null) {
+ children = new ArrayList<>();
+ result.put(parent, children);
+ }
+ children.add(child);
+ child = parent;
+ }
+ }
+ return true;
+ });
}
});
@@ -382,16 +352,13 @@ public class ResourceMappingResourceDisplayArea extends DialogArea {
/* private */ static ResourceTraversal[] getTraversals(final ResourceMapping mapping, final ResourceMappingContext context) {
final List<ResourceTraversal[]> traversals = new ArrayList<>();
try {
- PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress() {
- @Override
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- traversals.add(mapping.getTraversals(context, monitor));
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- }
- }
- });
+ PlatformUI.getWorkbench().getProgressService().busyCursorWhile(monitor -> {
+ try {
+ traversals.add(mapping.getTraversals(context, monitor));
+ } catch (CoreException e) {
+ throw new InvocationTargetException(e);
+ }
+ });
return traversals.get(0);
} catch (InvocationTargetException e) {
TeamUIPlugin.log(IStatus.ERROR, "An error occurred while traversing " + getLabel(mapping), e); //$NON-NLS-1$
@@ -404,16 +371,13 @@ public class ResourceMappingResourceDisplayArea extends DialogArea {
/* private */ static IResource[] members(final IContainer container, final RemoteResourceMappingContext context) {
final List<IResource[]> members = new ArrayList<>();
try {
- PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress() {
- @Override
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- members.add(context.fetchMembers(container, monitor));
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- }
- }
- });
+ PlatformUI.getWorkbench().getProgressService().busyCursorWhile(monitor -> {
+ try {
+ members.add(context.fetchMembers(container, monitor));
+ } catch (CoreException e) {
+ throw new InvocationTargetException(e);
+ }
+ });
return members.get(0);
} catch (InvocationTargetException e) {
TeamUIPlugin.log(IStatus.ERROR, "An error occurred while fetching the members of" + container.getFullPath(), e); //$NON-NLS-1$
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/GenericHistoryView.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/GenericHistoryView.java
index 1bdaf7b09..918f3c398 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/GenericHistoryView.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/GenericHistoryView.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2016 IBM Corporation and others.
+ * Copyright (c) 2006, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -835,13 +835,10 @@ public class GenericHistoryView extends PageBookView implements IHistoryView, IP
public void propertyChange(PropertyChangeEvent event) {
if (event.getSource() == getCurrentPage()) {
if (event.getProperty().equals(IHistoryPage.P_NAME)) {
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- IHistoryPage historyPage = getHistoryPage();
- setContentDescription(historyPage.getName());
- navigationHistory.updateName(historyPage, getPageSourceFor(historyPage.getInput(), null));
- }
+ Display.getDefault().asyncExec(() -> {
+ IHistoryPage historyPage = getHistoryPage();
+ setContentDescription(historyPage.getName());
+ navigationHistory.updateName(historyPage, getPageSourceFor(historyPage.getInput(), null));
});
} else if (event.getProperty().equals(IHistoryPage.P_DESCRIPTION)) {
// We don't show the description
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/LocalHistoryPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/LocalHistoryPage.java
index 3789e14fa..f639405ee 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/LocalHistoryPage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/LocalHistoryPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2011 IBM Corporation and others.
+ * Copyright (c) 2006, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -24,7 +24,6 @@ import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.action.*;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.util.OpenStrategy;
import org.eclipse.jface.viewers.*;
@@ -234,12 +233,7 @@ public class LocalHistoryPage extends HistoryPage implements IHistoryCompareAdap
IResourceDelta resourceDelta = root.findMember(file.getFullPath());
if (resourceDelta != null){
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- refresh();
- }
- });
+ Display.getDefault().asyncExec(() -> refresh());
}
}
}
@@ -370,21 +364,18 @@ public class LocalHistoryPage extends HistoryPage implements IHistoryCompareAdap
compareModeAction.setHoverImageDescriptor(TeamUIPlugin.getImageDescriptor(ITeamUIImages.IMG_COMPARE_VIEW));
compareModeAction.setChecked(compareMode == ON);
- getContentsAction = getContextMenuAction(TeamUIMessages.LocalHistoryPage_GetContents, true /* needs progress */, new IWorkspaceRunnable() {
- @Override
- public void run(IProgressMonitor monitor) throws CoreException {
- SubMonitor progress = SubMonitor.convert(monitor, 2);
- try {
- if (confirmOverwrite()) {
- IStorage currentStorage = currentSelection.getStorage(progress.split(1));
- InputStream in = currentStorage.getContents();
- file.setContents(in, false, true, progress.split(1));
- }
- } catch (TeamException e) {
- throw new CoreException(e.getStatus());
- } finally {
- monitor.done();
+ getContentsAction = getContextMenuAction(TeamUIMessages.LocalHistoryPage_GetContents, true /* needs progress */, monitor -> {
+ SubMonitor progress = SubMonitor.convert(monitor, 2);
+ try {
+ if (confirmOverwrite()) {
+ IStorage currentStorage = currentSelection.getStorage(progress.split(1));
+ InputStream in = currentStorage.getContents();
+ file.setContents(in, false, true, progress.split(1));
}
+ } catch (TeamException e) {
+ throw new CoreException(e.getStatus());
+ } finally {
+ monitor.done();
}
});
}
@@ -463,12 +454,7 @@ public class LocalHistoryPage extends HistoryPage implements IHistoryCompareAdap
//Contribute actions to popup menu
MenuManager menuMgr = new MenuManager();
Menu menu = menuMgr.createContextMenu(treeViewer.getTree());
- menuMgr.addMenuListener(new IMenuListener() {
- @Override
- public void menuAboutToShow(IMenuManager menuMgr) {
- fillTableMenu(menuMgr);
- }
- });
+ menuMgr.addMenuListener(menuMgr1 -> fillTableMenu(menuMgr1));
menuMgr.setRemoveAllWhenShown(true);
treeViewer.getTree().setMenu(menu);
@@ -647,14 +633,11 @@ public class LocalHistoryPage extends HistoryPage implements IHistoryCompareAdap
currentSelection = (IFileRevision)o;
if(needsProgressDialog) {
- PlatformUI.getWorkbench().getProgressService().run(true, true, new IRunnableWithProgress() {
- @Override
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- action.run(monitor);
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- }
+ PlatformUI.getWorkbench().getProgressService().run(true, true, monitor -> {
+ try {
+ action.run(monitor);
+ } catch (CoreException e) {
+ throw new InvocationTargetException(e);
}
});
} else {
@@ -690,12 +673,7 @@ public class LocalHistoryPage extends HistoryPage implements IHistoryCompareAdap
IHistoryPageSite parentSite = getHistoryPageSite();
final MessageDialog dialog = new MessageDialog(parentSite.getShell(), title, null, msg, MessageDialog.QUESTION, new String[] {IDialogConstants.YES_LABEL, IDialogConstants.CANCEL_LABEL}, 0);
final int[] result = new int[1];
- parentSite.getShell().getDisplay().syncExec(new Runnable() {
- @Override
- public void run() {
- result[0] = dialog.open();
- }
- });
+ parentSite.getShell().getDisplay().syncExec(() -> result[0] = dialog.open());
if (result[0] != 0) {
// cancel
return false;
@@ -784,36 +762,33 @@ public class LocalHistoryPage extends HistoryPage implements IHistoryCompareAdap
// Group the revisions (if appropriate) before running in the UI thread
final AbstractHistoryCategory[] categories = groupRevisions(revisions, monitor);
// Update the tree in the UI thread
- Utils.asyncExec(new Runnable() {
- @Override
- public void run() {
- if (Policy.DEBUG_HISTORY) {
- String time = new SimpleDateFormat("m:ss.SSS").format(new Date(System.currentTimeMillis())); //$NON-NLS-1$
- System.out.println(time + ": LocalHistoryPage#update, the tree is being updated in the UI thread"); //$NON-NLS-1$
- }
- if (categories != null) {
- Object[] elementsToExpand = mapExpandedElements(categories, treeViewer.getExpandedElements());
- treeViewer.getTree().setRedraw(false);
- treeViewer.setInput(categories);
- //if user is switching modes and already has expanded elements
- //selected try to expand those, else expand all
- if (elementsToExpand.length > 0)
- treeViewer.setExpandedElements(elementsToExpand);
- else {
- treeViewer.expandAll();
- Object[] el = treeViewer.getExpandedElements();
- if (el != null && el.length > 0) {
- treeViewer.setSelection(new StructuredSelection(el[0]));
- treeViewer.getTree().deselectAll();
- }
+ Utils.asyncExec((Runnable) () -> {
+ if (Policy.DEBUG_HISTORY) {
+ String time = new SimpleDateFormat("m:ss.SSS").format(new Date(System.currentTimeMillis())); //$NON-NLS-1$
+ System.out.println(time + ": LocalHistoryPage#update, the tree is being updated in the UI thread"); //$NON-NLS-1$
+ }
+ if (categories != null) {
+ Object[] elementsToExpand = mapExpandedElements(categories, treeViewer.getExpandedElements());
+ treeViewer.getTree().setRedraw(false);
+ treeViewer.setInput(categories);
+ //if user is switching modes and already has expanded elements
+ //selected try to expand those, else expand all
+ if (elementsToExpand.length > 0)
+ treeViewer.setExpandedElements(elementsToExpand);
+ else {
+ treeViewer.expandAll();
+ Object[] el = treeViewer.getExpandedElements();
+ if (el != null && el.length > 0) {
+ treeViewer.setSelection(new StructuredSelection(el[0]));
+ treeViewer.getTree().deselectAll();
}
- treeViewer.getTree().setRedraw(true);
+ }
+ treeViewer.getTree().setRedraw(true);
+ } else {
+ if (revisions.length > 0) {
+ treeViewer.setInput(revisions);
} else {
- if (revisions.length > 0) {
- treeViewer.setInput(revisions);
- } else {
- treeViewer.setInput(new AbstractHistoryCategory[] {getErrorMessage()});
- }
+ treeViewer.setInput(new AbstractHistoryCategory[] {getErrorMessage()});
}
}
}, treeViewer);
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/ReplaceLocalHistory.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/ReplaceLocalHistory.java
index 161a535b2..229900bbf 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/ReplaceLocalHistory.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/ReplaceLocalHistory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
+ * Copyright (c) 2006, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -30,12 +30,7 @@ public class ReplaceLocalHistory extends ShowLocalHistory {
IFileState states[]= getLocalHistory();
if (states == null || states.length == 0)
return;
- Runnable r = new Runnable() {
- @Override
- public void run() {
- showCompareInDialog(getShell(), file);
- }
- };
+ Runnable r = () -> showCompareInDialog(getShell(), file);
TeamUIPlugin.getStandardDisplay().asyncExec(r);
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/ShowLocalHistory.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/ShowLocalHistory.java
index 36d0fcaca..f78134352 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/ShowLocalHistory.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/ShowLocalHistory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
+ * Copyright (c) 2006, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -17,7 +17,6 @@ import org.eclipse.core.runtime.*;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.widgets.Shell;
@@ -40,23 +39,17 @@ public class ShowLocalHistory extends ActionDelegate implements IObjectActionDel
if (states == null || states.length == 0)
return;
try {
- PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress() {
- @Override
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- final IResource resource = (IResource) fSelection.getFirstElement();
- Runnable r = new Runnable() {
- @Override
- public void run() {
- IHistoryView view = TeamUI.showHistoryFor(TeamUIPlugin.getActivePage(), resource, LocalHistoryPageSource.getInstance());
- IHistoryPage page = view.getHistoryPage();
- if (page instanceof LocalHistoryPage){
- LocalHistoryPage historyPage = (LocalHistoryPage) page;
- historyPage.setClickAction(isCompare());
- }
- }
- };
- TeamUIPlugin.getStandardDisplay().asyncExec(r);
- }
+ PlatformUI.getWorkbench().getProgressService().busyCursorWhile(monitor -> {
+ final IResource resource = (IResource) fSelection.getFirstElement();
+ Runnable r = () -> {
+ IHistoryView view = TeamUI.showHistoryFor(TeamUIPlugin.getActivePage(), resource, LocalHistoryPageSource.getInstance());
+ IHistoryPage page = view.getHistoryPage();
+ if (page instanceof LocalHistoryPage){
+ LocalHistoryPage historyPage = (LocalHistoryPage) page;
+ historyPage.setClickAction(isCompare());
+ }
+ };
+ TeamUIPlugin.getStandardDisplay().asyncExec(r);
});
} catch (InvocationTargetException exception) {
ErrorDialog.openError(getShell(), null, null, new Status(IStatus.ERROR, TeamUIPlugin.PLUGIN_ID, IStatus.ERROR, TeamUIMessages.ShowLocalHistory_1, exception.getTargetException()));
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/CommonViewerAdvisor.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/CommonViewerAdvisor.java
index 19580dd57..ea217b43d 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/CommonViewerAdvisor.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/CommonViewerAdvisor.java
@@ -230,19 +230,9 @@ public class CommonViewerAdvisor extends AbstractTreeViewerAdvisor implements IN
v.setSorter(new TeamViewerSorter((CommonViewerSorter)v.getSorter()));
ISynchronizationScope scope = getScope(configuration);
bindTeamContentProviders(v);
- scope.addScopeChangeListener(new ISynchronizationScopeChangeListener() {
- @Override
- public void scopeChanged(final ISynchronizationScope scope,
- ResourceMapping[] newMappings, ResourceTraversal[] newTraversals) {
- enableContentProviders(v, configuration);
- Utils.asyncExec(new Runnable() {
- @Override
- public void run() {
- v.refresh();
- }
-
- }, v);
- }
+ scope.addScopeChangeListener((scope1, newMappings, newTraversals) -> {
+ enableContentProviders(v, configuration);
+ Utils.asyncExec((Runnable) () -> v.refresh(), v);
});
enableContentProviders(v, configuration);
configuration.getSite().setSelectionProvider(v);
@@ -378,9 +368,6 @@ public class CommonViewerAdvisor extends AbstractTreeViewerAdvisor implements IN
viewer.expandToLevel(2);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.synchronize.StructuredViewerAdvisor#initializeViewer(org.eclipse.jface.viewers.StructuredViewer)
- */
@Override
public void initializeViewer(StructuredViewer viewer) {
createActionService((CommonViewer)viewer, getConfiguration());
@@ -520,13 +507,10 @@ public class CommonViewerAdvisor extends AbstractTreeViewerAdvisor implements IN
} else if (event.getProperty().equals(ModelSynchronizeParticipant.P_VISIBLE_MODEL_PROVIDER)) {
enableContentProviders((CommonViewer)getViewer(), getConfiguration());
final Viewer viewer = getViewer();
- Utils.syncExec(new Runnable() {
- @Override
- public void run() {
- Object viewerInput = ModelSynchronizePage.getViewerInput(getConfiguration(), (String)event.getNewValue());
- if (viewer != null && viewerInput != null) {
- viewer.setInput(viewerInput);
- }
+ Utils.syncExec((Runnable) () -> {
+ Object viewerInput = ModelSynchronizePage.getViewerInput(getConfiguration(), (String)event.getNewValue());
+ if (viewer != null && viewerInput != null) {
+ viewer.setInput(viewerInput);
}
}, (StructuredViewer)viewer);
} else if (event.getProperty().equals(ITeamContentProviderManager.PROP_PAGE_LAYOUT)) {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/FuzzFactorDialog.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/FuzzFactorDialog.java
index 1ec614144..fe8c0e1b3 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/FuzzFactorDialog.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/FuzzFactorDialog.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 IBM Corporation and others.
+ * Copyright (c) 2010, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -13,10 +13,8 @@ package org.eclipse.team.internal.ui.mapping;
import java.lang.reflect.InvocationTargetException;
import org.eclipse.compare.internal.patch.WorkspacePatcher;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.resource.StringConverter;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.*;
@@ -68,12 +66,7 @@ public class FuzzFactorDialog extends Dialog {
| GridData.HORIZONTAL_ALIGN_FILL);
data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
valueText.setLayoutData(data);
- valueText.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- validateInput();
- }
- });
+ valueText.addModifyListener(e -> validateInput());
fuzzFactor = patcher.getFuzz();
if (fuzzFactor >= 0)
valueText.setText(new Integer(fuzzFactor).toString());
@@ -149,12 +142,7 @@ public class FuzzFactorDialog extends Dialog {
final int[] result = new int[] { -1 };
try {
PlatformUI.getWorkbench().getProgressService().run(true, true,
- new IRunnableWithProgress() {
- @Override
- public void run(IProgressMonitor monitor) {
- result[0] = patcher.guessFuzzFactor(monitor);
- }
- });
+ monitor -> result[0] = patcher.guessFuzzFactor(monitor));
} catch (InvocationTargetException ex) {
// NeedWork
} catch (InterruptedException ex) {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/MergeAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/MergeAction.java
index 8f5da0182..1afa39297 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/MergeAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/MergeAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
+ * Copyright (c) 2006, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -17,7 +17,6 @@ import org.eclipse.core.commands.*;
import org.eclipse.core.runtime.*;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.swt.widgets.Event;
import org.eclipse.team.internal.ui.*;
import org.eclipse.team.ui.mapping.*;
@@ -59,15 +58,12 @@ public class MergeAction extends Action {
}
final SaveableComparison target = targetBuffer;
try {
- PlatformUI.getWorkbench().getProgressService().run(true, true, new IRunnableWithProgress() {
- @Override
- public void run(IProgressMonitor monitor) throws InvocationTargetException,
- InterruptedException {
- try {
- ModelParticipantAction.handleTargetSaveableChange(configuration.getSite().getShell(), target, currentBuffer, true, monitor);
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- }
+ PlatformUI.getWorkbench().getProgressService().run(true, true, monitor -> {
+ try {
+ ModelParticipantAction.handleTargetSaveableChange(configuration.getSite().getShell(),
+ target, currentBuffer, true, monitor);
+ } catch (CoreException e) {
+ throw new InvocationTargetException(e);
}
});
} catch (InvocationTargetException e) {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/MergeAllActionHandler.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/MergeAllActionHandler.java
index ae7a0e634..af82f850d 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/MergeAllActionHandler.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/MergeAllActionHandler.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
+ * Copyright (c) 2006, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -35,9 +35,6 @@ public class MergeAllActionHandler extends MergeActionHandler implements IDiffCh
getContext().getDiffTree().addDiffChangeListener(this);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.mapping.MergeActionHandler#getOperation()
- */
@Override
protected synchronized SynchronizationOperation getOperation() {
if (operation == null) {
@@ -58,9 +55,6 @@ public class MergeAllActionHandler extends MergeActionHandler implements IDiffCh
return ((ISynchronizationScope)getConfiguration().getProperty(ITeamContentProviderManager.P_SYNCHRONIZATION_SCOPE)).getMappings();
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.diff.IDiffChangeListener#diffsChanged(org.eclipse.team.core.diff.IDiffChangeEvent, org.eclipse.core.runtime.IProgressMonitor)
- */
@Override
public void diffsChanged(IDiffChangeEvent event, IProgressMonitor monitor) {
synchronized (this) {
@@ -70,17 +64,11 @@ public class MergeAllActionHandler extends MergeActionHandler implements IDiffCh
|| event.getTree().countFor(IThreeWayDiff.CONFLICTING, IThreeWayDiff.DIRECTION_MASK) > 0);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.diff.IDiffChangeListener#propertyChanged(org.eclipse.team.core.diff.IDiffTree, int, org.eclipse.core.runtime.IPath[])
- */
@Override
public void propertyChanged(IDiffTree tree, int property, IPath[] paths) {
// Nothing to do
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.mapping.MergeActionHandler#dispose()
- */
@Override
public void dispose() {
getContext().getDiffTree().removeDiffChangeListener(this);
@@ -160,15 +148,12 @@ public class MergeAllActionHandler extends MergeActionHandler implements IDiffCh
if (count == 0)
return false;
final boolean[] result = new boolean[] {true};
- TeamUIPlugin.getStandardDisplay().syncExec(new Runnable() {
- @Override
- public void run() {
- String sizeString = Long.toString(count);
- String message = tree.size() > 1 ? NLS.bind(TeamUIMessages.MergeAllActionHandler_1, new String[] { sizeString }) :
- NLS.bind(TeamUIMessages.MergeAllActionHandler_2, new String[] { sizeString });
- result[0] = MessageDialog.openQuestion(getConfiguration().getSite().getShell(),
- NLS.bind(TeamUIMessages.MergeAllActionHandler_3, new String[] { sizeString }), message);
- }
+ TeamUIPlugin.getStandardDisplay().syncExec(() -> {
+ String sizeString = Long.toString(count);
+ String message = tree.size() > 1 ? NLS.bind(TeamUIMessages.MergeAllActionHandler_1, new String[] { sizeString }) :
+ NLS.bind(TeamUIMessages.MergeAllActionHandler_2, new String[] { sizeString });
+ result[0] = MessageDialog.openQuestion(getConfiguration().getSite().getShell(),
+ NLS.bind(TeamUIMessages.MergeAllActionHandler_3, new String[] { sizeString }), message);
});
return result[0];
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/MergeAllOperation.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/MergeAllOperation.java
index 8c61c4ed1..09d5edb62 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/MergeAllOperation.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/MergeAllOperation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
+ * Copyright (c) 2006, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -36,9 +36,6 @@ public final class MergeAllOperation extends SynchronizationOperation {
this.context = context;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.mapping.SynchronizationOperation#execute(org.eclipse.core.runtime.IProgressMonitor)
- */
@Override
public void execute(IProgressMonitor monitor) throws InvocationTargetException,
InterruptedException {
@@ -81,33 +78,30 @@ public final class MergeAllOperation extends SynchronizationOperation {
}
private boolean promptToContinue(final IStatus status) {
final boolean[] result = new boolean[] { false };
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- ErrorDialog dialog = new ErrorDialog(getShell(), TeamUIMessages.ModelMergeOperation_0, TeamUIMessages.ModelMergeOperation_1, status, IStatus.ERROR | IStatus.WARNING | IStatus.INFO) {
- @Override
- protected void createButtonsForButtonBar(Composite parent) {
- createButton(parent, IDialogConstants.YES_ID, IDialogConstants.YES_LABEL,
- false);
- createButton(parent, IDialogConstants.NO_ID, IDialogConstants.NO_LABEL,
- true);
- createDetailsButton(parent);
- }
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.ErrorDialog#buttonPressed(int)
- */
- @Override
- protected void buttonPressed(int id) {
- if (id == IDialogConstants.YES_ID)
- super.buttonPressed(IDialogConstants.OK_ID);
- else if (id == IDialogConstants.NO_ID)
- super.buttonPressed(IDialogConstants.CANCEL_ID);
- super.buttonPressed(id);
- }
- };
- int code = dialog.open();
- result[0] = code == 0;
- }
+ Runnable runnable = () -> {
+ ErrorDialog dialog = new ErrorDialog(getShell(), TeamUIMessages.ModelMergeOperation_0, TeamUIMessages.ModelMergeOperation_1, status, IStatus.ERROR | IStatus.WARNING | IStatus.INFO) {
+ @Override
+ protected void createButtonsForButtonBar(Composite parent) {
+ createButton(parent, IDialogConstants.YES_ID, IDialogConstants.YES_LABEL,
+ false);
+ createButton(parent, IDialogConstants.NO_ID, IDialogConstants.NO_LABEL,
+ true);
+ createDetailsButton(parent);
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.ErrorDialog#buttonPressed(int)
+ */
+ @Override
+ protected void buttonPressed(int id) {
+ if (id == IDialogConstants.YES_ID)
+ super.buttonPressed(IDialogConstants.OK_ID);
+ else if (id == IDialogConstants.NO_ID)
+ super.buttonPressed(IDialogConstants.CANCEL_ID);
+ super.buttonPressed(id);
+ }
+ };
+ int code = dialog.open();
+ result[0] = code == 0;
};
getShell().getDisplay().syncExec(runnable);
return (result[0]);
@@ -115,17 +109,11 @@ public final class MergeAllOperation extends SynchronizationOperation {
}.run(monitor);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.TeamOperation#canRunAsJob()
- */
@Override
protected boolean canRunAsJob() {
return true;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.TeamOperation#getJobName()
- */
@Override
protected String getJobName() {;
return jobName;
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/MergeIncomingChangesAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/MergeIncomingChangesAction.java
index 2de7cbe10..70cf0f4e0 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/MergeIncomingChangesAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/MergeIncomingChangesAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -15,8 +15,6 @@ import java.util.Collections;
import org.eclipse.core.commands.*;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.widgets.Event;
import org.eclipse.team.core.diff.*;
@@ -72,17 +70,11 @@ public class MergeIncomingChangesAction extends ModelParticipantAction implement
Utils.handle(throwable);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.mapping.ModelProviderAction#isEnabledForSelection(org.eclipse.jface.viewers.IStructuredSelection)
- */
@Override
protected boolean isEnabledForSelection(IStructuredSelection selection) {
return handler.isEnabled();
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.operations.ModelProviderAction#getDiffFilter()
- */
protected FastDiffFilter getDiffFilter() {
return new FastDiffFilter() {
@Override
@@ -102,15 +94,12 @@ public class MergeIncomingChangesAction extends ModelParticipantAction implement
protected void handleTargetSaveableChange() throws InvocationTargetException, InterruptedException {
final SaveableComparison currentBuffer = getActiveSaveable();
if (currentBuffer != null && currentBuffer.isDirty()) {
- PlatformUI.getWorkbench().getProgressService().run(true, true, new IRunnableWithProgress() {
- @Override
- public void run(IProgressMonitor monitor) throws InvocationTargetException,
- InterruptedException {
- try {
- handleTargetSaveableChange(getConfiguration().getSite().getShell(), null, currentBuffer, true, monitor);
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- }
+ PlatformUI.getWorkbench().getProgressService().run(true, true, monitor -> {
+ try {
+ handleTargetSaveableChange(getConfiguration().getSite().getShell(), null, currentBuffer, true,
+ monitor);
+ } catch (CoreException e) {
+ throw new InvocationTargetException(e);
}
});
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceCompareInputChangeNotifier.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceCompareInputChangeNotifier.java
index 820fef2d4..79a480680 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceCompareInputChangeNotifier.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceCompareInputChangeNotifier.java
@@ -16,15 +16,12 @@ import java.util.Set;
import org.eclipse.compare.*;
import org.eclipse.compare.structuremergeviewer.ICompareInput;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.runtime.*;
import org.eclipse.jface.viewers.BaseLabelProvider;
import org.eclipse.jface.viewers.LabelProviderChangedEvent;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Display;
-import org.eclipse.team.core.ICache;
-import org.eclipse.team.core.ICacheListener;
import org.eclipse.team.core.diff.*;
import org.eclipse.team.core.history.IFileRevision;
import org.eclipse.team.core.mapping.ISynchronizationContext;
@@ -193,12 +190,7 @@ public class ResourceCompareInputChangeNotifier extends CompareInputChangeNotifi
@Override
public void initialize() {
context.getDiffTree().addDiffChangeListener(this);
- context.getCache().addCacheListener(new ICacheListener() {
- @Override
- public void cacheDisposed(ICache cache) {
- dispose();
- }
- });
+ context.getCache().addCacheListener(cache -> dispose());
super.initialize();
}
@@ -311,12 +303,7 @@ public class ResourceCompareInputChangeNotifier extends CompareInputChangeNotifi
if (fetchingInput == input)
return;
fetchingInput= input;
- runInBackground(new IWorkspaceRunnable() {
- @Override
- public void run(IProgressMonitor monitor) throws CoreException {
- fetchAuthors(input, monitor);
- }
- });
+ runInBackground(monitor -> fetchAuthors(input, monitor));
}
protected void fetchAuthors(ResourceDiffCompareInput input, IProgressMonitor monitor) throws CoreException {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceMarkAsMergedHandler.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceMarkAsMergedHandler.java
index 2eb5ec0b2..577b92b90 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceMarkAsMergedHandler.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceMarkAsMergedHandler.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
+ * Copyright (c) 2006, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -15,7 +15,6 @@ import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
@@ -37,17 +36,11 @@ public class ResourceMarkAsMergedHandler extends ResourceMergeActionHandler {
super(configuration);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.mapping.MergeActionHandler#getOperation()
- */
@Override
protected synchronized SynchronizationOperation getOperation() {
if (operation == null) {
operation = new ResourceModelProviderOperation(getConfiguration(),
getStructuredSelection()) {
- /* (non-Javadoc)
- * @see org.eclipse.jface.operation.IRunnableWithProgress#run(org.eclipse.core.runtime.IProgressMonitor)
- */
@Override
public void execute(IProgressMonitor monitor)
throws InvocationTargetException, InterruptedException {
@@ -55,14 +48,7 @@ public class ResourceMarkAsMergedHandler extends ResourceMergeActionHandler {
final IMergeContext context = (IMergeContext) getContext();
final IDiff[] deltas = getTargetDiffs();
ISchedulingRule rule = getMergeRule(context, deltas);
- context.run(new IWorkspaceRunnable() {
- @Override
- public void run(IProgressMonitor monitor)
- throws CoreException {
- markAsMerged(deltas, context, monitor);
- }
-
- }, rule, IResource.NONE, monitor);
+ context.run(monitor1 -> markAsMerged(deltas, context, monitor1), rule, IResource.NONE, monitor);
} catch (CoreException e) {
throw new InvocationTargetException(e);
@@ -90,9 +76,6 @@ public class ResourceMarkAsMergedHandler extends ResourceMergeActionHandler {
context.markAsMerged(deltas, false, monitor);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.mapping.ResourceModelProviderOperation#getDiffFilter()
- */
@Override
protected FastDiffFilter getDiffFilter() {
return new FastDiffFilter() {
@@ -122,9 +105,6 @@ public class ResourceMarkAsMergedHandler extends ResourceMergeActionHandler {
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.mapping.MergeActionHandler#updateEnablement(org.eclipse.jface.viewers.IStructuredSelection)
- */
@Override
public void updateEnablement(IStructuredSelection selection) {
synchronized (this) {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceMergeHandler.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceMergeHandler.java
index d140ce363..aa02ce7f0 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceMergeHandler.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceMergeHandler.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
+ * Copyright (c) 2006, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -38,16 +38,10 @@ public class ResourceMergeHandler extends ResourceMergeActionHandler {
this.overwrite = overwrite;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.mapping.MergeActionHandler#getOperation()
- */
@Override
protected synchronized SynchronizationOperation getOperation() {
if (operation == null) {
operation = new ResourceModelProviderOperation(getConfiguration(), getStructuredSelection()) {
- /* (non-Javadoc)
- * @see org.eclipse.jface.operation.IRunnableWithProgress#run(org.eclipse.core.runtime.IProgressMonitor)
- */
@Override
public void execute(IProgressMonitor monitor) throws InvocationTargetException,
InterruptedException {
@@ -64,9 +58,6 @@ public class ResourceMergeHandler extends ResourceMergeActionHandler {
throw new InvocationTargetException(e);
}
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.mapping.ResourceModelProviderOperation#getDiffFilter()
- */
@Override
protected FastDiffFilter getDiffFilter() {
return new FastDiffFilter() {
@@ -102,9 +93,6 @@ public class ResourceMergeHandler extends ResourceMergeActionHandler {
return operation;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.mapping.MergeActionHandler#updateEnablement(org.eclipse.jface.viewers.IStructuredSelection)
- */
@Override
public void updateEnablement(IStructuredSelection selection) {
synchronized (this) {
@@ -131,13 +119,7 @@ public class ResourceMergeHandler extends ResourceMergeActionHandler {
final boolean[] confirmed = new boolean[] { false };
Shell shell = getConfiguration().getSite().getShell();
if (!shell.isDisposed()) {
- Utils.syncExec(new Runnable() {
- @Override
- public void run() {
- confirmed[0] = promptToConfirm();
- }
-
- }, shell);
+ Utils.syncExec((Runnable) () -> confirmed[0] = promptToConfirm(), shell);
}
return confirmed[0];
}
@@ -147,12 +129,7 @@ public class ResourceMergeHandler extends ResourceMergeActionHandler {
}
protected void promptForNoChanges() {
- Utils.syncExec(new Runnable() {
- @Override
- public void run() {
- MessageDialog.openInformation(getConfiguration().getSite().getShell(), TeamUIMessages.ResourceMergeHandler_6, TeamUIMessages.ResourceMergeHandler_7);
- }
- }, (StructuredViewer)getConfiguration().getPage().getViewer());
+ Utils.syncExec((Runnable) () -> MessageDialog.openInformation(getConfiguration().getSite().getShell(), TeamUIMessages.ResourceMergeHandler_6, TeamUIMessages.ResourceMergeHandler_7), (StructuredViewer)getConfiguration().getPage().getViewer());
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceModelContentProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceModelContentProvider.java
index 83e029d50..32ef4c979 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceModelContentProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceModelContentProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -239,13 +239,10 @@ public class ResourceModelContentProvider extends SynchronizationContentProvider
@Override
public void propertyChanged(IDiffTree tree, final int property, final IPath[] paths) {
- Utils.asyncExec(new Runnable() {
- @Override
- public void run() {
- ISynchronizationContext context = getContext();
- if (context != null) {
- updateLabels(context, paths);
- }
+ Utils.asyncExec((Runnable) () -> {
+ ISynchronizationContext context = getContext();
+ if (context != null) {
+ updateLabels(context, paths);
}
}, (StructuredViewer)getViewer());
}
@@ -331,13 +328,9 @@ public class ResourceModelContentProvider extends SynchronizationContentProvider
@Override
protected void refresh() {
- Utils.syncExec(new Runnable() {
- @Override
- public void run() {
- TreeViewer treeViewer = ((TreeViewer)getViewer());
- treeViewer.refresh();
- }
-
+ Utils.syncExec((Runnable) () -> {
+ TreeViewer treeViewer = ((TreeViewer)getViewer());
+ treeViewer.refresh();
}, getViewer().getControl());
}
@@ -392,12 +385,7 @@ public class ResourceModelContentProvider extends SynchronizationContentProvider
@Override
public void diffsChanged(final IDiffChangeEvent event, IProgressMonitor monitor) {
- Utils.syncExec(new Runnable() {
- @Override
- public void run() {
- handleChange(event);
- }
- }, (StructuredViewer)getViewer());
+ Utils.syncExec((Runnable) () -> handleChange(event), (StructuredViewer)getViewer());
}
private void handleChange(IDiffChangeEvent event) {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/AbstractSynchronizeModelProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/AbstractSynchronizeModelProvider.java
index b106f3fd6..de9a9ec3d 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/AbstractSynchronizeModelProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/AbstractSynchronizeModelProvider.java
@@ -334,12 +334,7 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
// Only refresh the view if there is now background update in
// progress. If there is, the background update will refresh
if (!updateHandler.isPerformingBackgroundUpdate()) {
- Utils.asyncExec(new Runnable() {
- @Override
- public void run() {
- refreshModelRoot();
- }
- }, getViewer());
+ Utils.asyncExec((Runnable) () -> refreshModelRoot(), getViewer());
}
}
}
@@ -1055,9 +1050,6 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
monitor.worked(1);
}
- /* (non-Javadoc)
- * @see java.lang.Object#toString()
- */
@Override
public String toString() {
ISynchronizeModelElement element = getModelRoot();
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ActiveChangeSetCollector.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ActiveChangeSetCollector.java
index d403b60ea..dbfe9a439 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ActiveChangeSetCollector.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ActiveChangeSetCollector.java
@@ -18,7 +18,6 @@ import java.util.List;
import java.util.Map;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.team.core.TeamException;
@@ -58,48 +57,36 @@ public class ActiveChangeSetCollector implements IDiffChangeListener {
@Override
public void setAdded(final ChangeSet set) {
// Remove any resources that are in the new set
- provider.performUpdate(new IWorkspaceRunnable() {
- @Override
- public void run(IProgressMonitor monitor) {
- remove(set.getResources());
- createSyncInfoSet(set);
- }
- }, true, true);
+ provider.performUpdate(monitor -> {
+ remove(set.getResources());
+ createSyncInfoSet(set);
+ }, true, true);
}
@Override
public void defaultSetChanged(final ChangeSet previousDefault, final ChangeSet set) {
- provider.performUpdate(new IWorkspaceRunnable() {
- @Override
- public void run(IProgressMonitor monitor) {
- if (listener != null)
- listener.defaultSetChanged(previousDefault, set);
- }
- }, true, true);
+ provider.performUpdate(monitor -> {
+ if (listener != null)
+ listener.defaultSetChanged(previousDefault, set);
+ }, true, true);
}
@Override
public void setRemoved(final ChangeSet set) {
- provider.performUpdate(new IWorkspaceRunnable() {
- @Override
- public void run(IProgressMonitor monitor) {
- remove(set);
- if (!set.isEmpty()) {
- add(getSyncInfos(set).getSyncInfos());
- }
- }
- }, true, true);
+ provider.performUpdate(monitor -> {
+ remove(set);
+ if (!set.isEmpty()) {
+ add(getSyncInfos(set).getSyncInfos());
+ }
+ }, true, true);
}
@Override
public void nameChanged(final ChangeSet set) {
- provider.performUpdate(new IWorkspaceRunnable() {
- @Override
- public void run(IProgressMonitor monitor) {
- if (listener != null)
- listener.nameChanged(set);
- }
- }, true, true);
+ provider.performUpdate(monitor -> {
+ if (listener != null)
+ listener.nameChanged(set);
+ }, true, true);
}
@Override
@@ -117,12 +104,7 @@ public class ActiveChangeSetCollector implements IDiffChangeListener {
}
}
if (!outOfSync.isEmpty()) {
- provider.performUpdate(new IWorkspaceRunnable() {
- @Override
- public void run(IProgressMonitor monitor) {
- add(outOfSync.toArray(new SyncInfo[outOfSync.size()]));
- }
- }, true, true);
+ provider.performUpdate(monitor -> add(outOfSync.toArray(new SyncInfo[outOfSync.size()])), true, true);
}
}
};
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangesSection.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangesSection.java
index 205d268e0..ce79888bc 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangesSection.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangesSection.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -100,9 +100,6 @@ public class ChangesSection extends Composite {
return page;
}
- /* (non-Javadoc)
- * @see org.eclipse.swt.widgets.Widget#dispose()
- */
@Override
public void dispose() {
super.dispose();
@@ -115,13 +112,10 @@ public class ChangesSection extends Composite {
}
protected void initializeChangesViewer() {
- TeamUIPlugin.getStandardDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- Control control = ChangesSection.this.getChangesViewer().getControl();
- if (!getContainer().isDisposed() && !control.isDisposed()) {
- getContainer().showPage(control);
- }
+ TeamUIPlugin.getStandardDisplay().asyncExec(() -> {
+ Control control = ChangesSection.this.getChangesViewer().getControl();
+ if (!getContainer().isDisposed() && !control.isDisposed()) {
+ getContainer().showPage(control);
}
});
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ForwardingChangesSection.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ForwardingChangesSection.java
index caa514e5e..c591c6a1b 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ForwardingChangesSection.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ForwardingChangesSection.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2010 IBM Corporation and others.
+ * Copyright (c) 2006, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -38,9 +38,6 @@ public abstract class ForwardingChangesSection extends ChangesSection {
super(parent, page, configuration);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.synchronize.ChangesSection#initializeChangesViewer()
- */
@Override
protected void initializeChangesViewer() {
calculateDescription();
@@ -50,20 +47,12 @@ public abstract class ForwardingChangesSection extends ChangesSection {
if (getContainer().isDisposed())
return;
if(getVisibleChangesCount() == 0) {
- TeamUIPlugin.getStandardDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- if (!getContainer().isDisposed())
- updatePage(getEmptyChangesComposite(getContainer()));
- }
+ TeamUIPlugin.getStandardDisplay().asyncExec(() -> {
+ if (!getContainer().isDisposed())
+ updatePage(getEmptyChangesComposite(getContainer()));
});
} else {
- TeamUIPlugin.getStandardDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- updatePage(null);
- }
- });
+ TeamUIPlugin.getStandardDisplay().asyncExec(() -> updatePage(null));
}
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SaveablesCompareEditorInput.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SaveablesCompareEditorInput.java
index 4ae10a678..e333e7e0f 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SaveablesCompareEditorInput.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SaveablesCompareEditorInput.java
@@ -24,8 +24,6 @@ import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.viewers.*;
import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.*;
@@ -284,11 +282,6 @@ public class SaveablesCompareEditorInput extends CompareEditorInput implements
(ICompareInput) compareResult, this, rightFileElement);
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.ISaveablesSource#getActiveSaveables()
- */
@Override
public Saveable[] getActiveSaveables() {
if (getCompareResult() == null)
@@ -296,25 +289,11 @@ public class SaveablesCompareEditorInput extends CompareEditorInput implements
return new Saveable[] { getLeftSaveable(), getRightSaveable() };
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.ISaveablesSource#getSaveables()
- */
@Override
public Saveable[] getSaveables() {
return getActiveSaveables();
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.compare.CompareEditorInput#findContentViewer(org.eclipse.
- * jface.viewers.Viewer,
- * org.eclipse.compare.structuremergeviewer.ICompareInput,
- * org.eclipse.swt.widgets.Composite)
- */
@Override
public Viewer findContentViewer(Viewer pOldViewer, ICompareInput pInput,
Composite pParent) {
@@ -330,12 +309,9 @@ public class SaveablesCompareEditorInput extends CompareEditorInput implements
dsp.addPropertyChangeListener(lpcl);
dsp.addPropertyChangeListener(rpcl);
Control c = newViewer.getControl();
- c.addDisposeListener(new DisposeListener() {
- @Override
- public void widgetDisposed(DisposeEvent e) {
- dsp.removePropertyChangeListener(lpcl);
- dsp.removePropertyChangeListener(rpcl);
- }
+ c.addDisposeListener(e -> {
+ dsp.removePropertyChangeListener(lpcl);
+ dsp.removePropertyChangeListener(rpcl);
});
}
return newViewer;
@@ -411,13 +387,10 @@ public class SaveablesCompareEditorInput extends CompareEditorInput implements
if (isSaveNeeded() && checkForUnsavedChanges) {
return false;
} else {
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- IEditorPart part = getPage().findEditor(
- SaveablesCompareEditorInput.this);
- getPage().closeEditor(part, false);
- }
+ Runnable runnable = () -> {
+ IEditorPart part = getPage().findEditor(
+ SaveablesCompareEditorInput.this);
+ getPage().closeEditor(part, false);
};
if (Display.getCurrent() != null) {
runnable.run();
@@ -569,23 +542,13 @@ public class SaveablesCompareEditorInput extends CompareEditorInput implements
final ITypedElement lLeftElement = getFileElement(getCompareInput()
.getLeft(), this);
if (lLeftSaveable instanceof LocalResourceSaveableComparison) {
- pMenuManager.addMenuListener(new IMenuListener() {
- @Override
- public void menuAboutToShow(IMenuManager manager) {
- handleMenuAboutToShow(manager, getContainer(), lLeftSaveable, lLeftElement, pSelectionProvider);
- }
- });
+ pMenuManager.addMenuListener(manager -> handleMenuAboutToShow(manager, getContainer(), lLeftSaveable, lLeftElement, pSelectionProvider));
}
final Saveable lRightSaveable = getRightSaveable();
final ITypedElement lRightElement = getFileElement(getCompareInput()
.getRight(), this);
if (lRightSaveable instanceof LocalResourceSaveableComparison) {
- pMenuManager.addMenuListener(new IMenuListener() {
- @Override
- public void menuAboutToShow(IMenuManager manager) {
- handleMenuAboutToShow(manager, getContainer(), lRightSaveable, lRightElement, pSelectionProvider);
- }
- });
+ pMenuManager.addMenuListener(manager -> handleMenuAboutToShow(manager, getContainer(), lRightSaveable, lRightElement, pSelectionProvider));
}
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SyncInfoSetChangesSection.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SyncInfoSetChangesSection.java
index b33f22554..c94d808f5 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SyncInfoSetChangesSection.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SyncInfoSetChangesSection.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -101,9 +101,6 @@ public class SyncInfoSetChangesSection extends ForwardingChangesSection {
super(parent, page, configuration);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.synchronize.ChangesSection#initializeChangesViewer()
- */
@Override
protected void initializeChangesViewer() {
super.initializeChangesViewer();
@@ -117,12 +114,9 @@ public class SyncInfoSetChangesSection extends ForwardingChangesSection {
SyncInfoTree syncInfoTree = getVisibleSyncInfoSet();
if (syncInfoTree.getErrors().length > 0) {
if (!showingError) {
- TeamUIPlugin.getStandardDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- updatePage(getErrorComposite(getContainer()));
- showingError = true;
- }
+ TeamUIPlugin.getStandardDisplay().asyncExec(() -> {
+ updatePage(getErrorComposite(getContainer()));
+ showingError = true;
});
}
return;
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelUpdateHandler.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelUpdateHandler.java
index 30c0d2fdf..2c4f47cfc 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelUpdateHandler.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelUpdateHandler.java
@@ -473,13 +473,10 @@ public class SynchronizeModelUpdateHandler extends BackgroundEventHandler implem
* Handle the sync info set change event in the UI thread.
*/
private void handleChanges(final ISyncInfoSetChangeEvent event, final IProgressMonitor monitor) {
- runViewUpdate(new Runnable() {
- @Override
- public void run() {
- provider.handleChanges((ISyncInfoTreeChangeEvent)event, monitor);
- firePendingLabelUpdates();
- }
- }, true /* preserve expansion */);
+ runViewUpdate(() -> {
+ provider.handleChanges((ISyncInfoTreeChangeEvent)event, monitor);
+ firePendingLabelUpdates();
+ }, true /* preserve expansion */);
}
@Override
@@ -511,12 +508,7 @@ public class SynchronizeModelUpdateHandler extends BackgroundEventHandler implem
if (ctrl != null && !ctrl.isDisposed()) {
ctrl.getDisplay().syncExec(() -> {
if (!ctrl.isDisposed()) {
- BusyIndicator.showWhile(ctrl.getDisplay(), new Runnable() {
- @Override
- public void run() {
- internalRunViewUpdate(runnable, preserveExpansion);
- }
- });
+ BusyIndicator.showWhile(ctrl.getDisplay(), () -> internalRunViewUpdate(runnable, preserveExpansion));
}
});
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/TreeViewerAdvisor.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/TreeViewerAdvisor.java
index 1b69bbe20..72ae10e2f 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/TreeViewerAdvisor.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/TreeViewerAdvisor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -10,13 +10,9 @@
*******************************************************************************/
package org.eclipse.team.internal.ui.synchronize;
-import org.eclipse.compare.structuremergeviewer.ICompareInput;
-import org.eclipse.compare.structuremergeviewer.ICompareInputChangeListener;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.action.IStatusLineManager;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.*;
import org.eclipse.swt.SWT;
import org.eclipse.swt.dnd.*;
@@ -187,12 +183,7 @@ public class TreeViewerAdvisor extends AbstractTreeViewerAdvisor {
@Override
protected void initializeListeners(final StructuredViewer viewer) {
super.initializeListeners(viewer);
- viewer.addSelectionChangedListener(new ISelectionChangedListener() {
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- updateStatusLine((IStructuredSelection) event.getSelection());
- }
- });
+ viewer.addSelectionChangedListener(event -> updateStatusLine((IStructuredSelection) event.getSelection()));
}
/* private */ void updateStatusLine(IStructuredSelection selection) {
@@ -231,39 +222,28 @@ public class TreeViewerAdvisor extends AbstractTreeViewerAdvisor {
public final void setInput(final ISynchronizeModelProvider modelProvider) {
final ISynchronizeModelElement modelRoot = modelProvider.getModelRoot();
getActionGroup().modelChanged(modelRoot);
- modelRoot.addCompareInputChangeListener(new ICompareInputChangeListener() {
- @Override
- public void compareInputChanged(ICompareInput source) {
- getActionGroup().modelChanged(modelRoot);
- }
- });
+ modelRoot.addCompareInputChangeListener(source -> getActionGroup().modelChanged(modelRoot));
final StructuredViewer viewer = getViewer();
if (viewer != null) {
viewer.setSorter(modelProvider.getViewerSorter());
viewer.setInput(modelRoot);
- modelProvider.addPropertyChangeListener(new IPropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent event) {
- if (event.getProperty() == ISynchronizeModelProvider.P_VIEWER_SORTER) {
- if (viewer != null && !viewer.getControl().isDisposed()) {
- viewer.getControl().getDisplay().syncExec(new Runnable() {
- @Override
- public void run() {
- if (viewer != null && !viewer.getControl().isDisposed()) {
- ViewerSorter newSorter = modelProvider.getViewerSorter();
- ViewerSorter oldSorter = viewer.getSorter();
- if (newSorter == oldSorter) {
- viewer.refresh();
- } else {
- viewer.setSorter(newSorter);
- }
- }
- }
- });
- }
- }
- }
- });
+ modelProvider.addPropertyChangeListener(event -> {
+ if (event.getProperty() == ISynchronizeModelProvider.P_VIEWER_SORTER) {
+ if (viewer != null && !viewer.getControl().isDisposed()) {
+ viewer.getControl().getDisplay().syncExec(() -> {
+ if (viewer != null && !viewer.getControl().isDisposed()) {
+ ViewerSorter newSorter = modelProvider.getViewerSorter();
+ ViewerSorter oldSorter = viewer.getSorter();
+ if (newSorter == oldSorter) {
+ viewer.refresh();
+ } else {
+ viewer.setSorter(newSorter);
+ }
+ }
+ });
+ }
+ }
+ });
}
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ChangeSetActionGroup.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ChangeSetActionGroup.java
index 3eff101eb..7b7c30124 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ChangeSetActionGroup.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ChangeSetActionGroup.java
@@ -59,39 +59,27 @@ public class ChangeSetActionGroup extends SynchronizePageActionGroup {
super(TeamUIMessages.ChangeLogModelProvider_0, configuration);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.SynchronizeModelAction#needsToSaveDirtyEditors()
- */
@Override
protected boolean needsToSaveDirtyEditors() {
return false;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.SynchronizeModelAction#getSyncInfoFilter()
- */
@Override
protected FastSyncInfoFilter getSyncInfoFilter() {
return OUTGOING_RESOURCE_FILTER;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.SynchronizeModelAction#getSubscriberOperation(org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration, org.eclipse.compare.structuremergeviewer.IDiffElement[])
- */
@Override
protected SynchronizeModelOperation getSubscriberOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements) {
return new SynchronizeModelOperation(configuration, elements) {
@Override
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- syncExec(new Runnable() {
- @Override
- public void run() {
- ActiveChangeSet set = createChangeSet(getDiffs(getSyncInfoSet().getResources()));
- if (set != null) {
- getActiveChangeSetManager().add(set);
- }
- }
- });
+ syncExec(() -> {
+ ActiveChangeSet set = createChangeSet(getDiffs(getSyncInfoSet().getResources()));
+ if (set != null) {
+ getActiveChangeSetManager().add(set);
+ }
+ });
}
};
}
@@ -103,9 +91,6 @@ public class ChangeSetActionGroup extends SynchronizePageActionGroup {
super(title);
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.actions.BaseSelectionListenerAction#updateSelection(org.eclipse.jface.viewers.IStructuredSelection)
- */
@Override
protected boolean updateSelection(IStructuredSelection selection) {
return getSelectedSet() != null;
@@ -197,9 +182,6 @@ public class ChangeSetActionGroup extends SynchronizePageActionGroup {
selectionChanged(selection);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.SynchronizeModelAction#getSyncInfoFilter()
- */
@Override
protected FastSyncInfoFilter getSyncInfoFilter() {
return OUTGOING_RESOURCE_FILTER;
@@ -210,9 +192,6 @@ public class ChangeSetActionGroup extends SynchronizePageActionGroup {
return false;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.SynchronizeModelAction#getSubscriberOperation(org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration, org.eclipse.compare.structuremergeviewer.IDiffElement[])
- */
@Override
protected SynchronizeModelOperation getSubscriberOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements) {
return new SynchronizeModelOperation(configuration, elements) {
@@ -332,12 +311,7 @@ public class ChangeSetActionGroup extends SynchronizePageActionGroup {
if (getChangeSetCapability().supportsActiveChangeSets()) {
addToChangeSet = new MenuManager(TeamUIMessages.ChangeLogModelProvider_12);
addToChangeSet.setRemoveAllWhenShown(true);
- addToChangeSet.addMenuListener(new IMenuListener() {
- @Override
- public void menuAboutToShow(IMenuManager manager) {
- addChangeSets(manager);
- }
- });
+ addToChangeSet.addMenuListener(manager -> addChangeSets(manager));
createChangeSet = new CreateChangeSetAction(configuration);
addToChangeSet.add(createChangeSet);
addToChangeSet.add(new Separator());
@@ -352,9 +326,6 @@ public class ChangeSetActionGroup extends SynchronizePageActionGroup {
}
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.SynchronizePageActionGroup#fillContextMenu(org.eclipse.jface.action.IMenuManager)
- */
@Override
public void fillContextMenu(IMenuManager menu) {
if (getChangeSetCapability().enableCheckedInChangeSetsFor(getConfiguration())) {
@@ -414,9 +385,6 @@ public class ChangeSetActionGroup extends SynchronizePageActionGroup {
return getChangeSetCapability().getActiveChangeSetManager();
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.SynchronizePageActionGroup#dispose()
- */
@Override
public void dispose() {
if (addToChangeSet != null) {
@@ -448,12 +416,9 @@ public class ChangeSetActionGroup extends SynchronizePageActionGroup {
private void syncExec(final Runnable runnable) {
final Control ctrl = getConfiguration().getPage().getViewer().getControl();
if (ctrl != null && !ctrl.isDisposed()) {
- ctrl.getDisplay().syncExec(new Runnable() {
- @Override
- public void run() {
- if (!ctrl.isDisposed()) {
- runnable.run();
- }
+ ctrl.getDisplay().syncExec(() -> {
+ if (!ctrl.isDisposed()) {
+ runnable.run();
}
});
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenInCompareAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenInCompareAction.java
index 963d42fc1..5fbc55e1a 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenInCompareAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenInCompareAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -19,7 +19,6 @@ import org.eclipse.compare.structuremergeviewer.ICompareInput;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.*;
import org.eclipse.jface.action.Action;
-import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.util.OpenStrategy;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
@@ -134,15 +133,12 @@ public class OpenInCompareAction extends Action {
final ModelSynchronizeParticipant msp = (ModelSynchronizeParticipant) participant;
final boolean[] result = new boolean[] { false };
try {
- PlatformUI.getWorkbench().getProgressService().run(true, true, new IRunnableWithProgress() {
- @Override
- public void run(IProgressMonitor monitor) throws InvocationTargetException,
- InterruptedException {
- try {
- result[0] = msp.checkForBufferChange(site.getShell(), (ISynchronizationCompareInput)input, true, monitor);
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- }
+ PlatformUI.getWorkbench().getProgressService().run(true, true, monitor -> {
+ try {
+ result[0] = msp.checkForBufferChange(site.getShell(), (ISynchronizationCompareInput) input,
+ true, monitor);
+ } catch (CoreException e) {
+ throw new InvocationTargetException(e);
}
});
} catch (InvocationTargetException e) {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/PinParticipantAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/PinParticipantAction.java
index 28aca8498..685bd9af2 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/PinParticipantAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/PinParticipantAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -12,9 +12,7 @@ package org.eclipse.team.internal.ui.synchronize.actions;
import java.lang.reflect.InvocationTargetException;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.action.Action;
-import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.team.internal.ui.Utils;
@@ -53,13 +51,9 @@ public class PinParticipantAction extends Action implements IPropertyChangeListe
public void run() {
if (participant != null) {
try {
- PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress() {
- @Override
- public void run(IProgressMonitor monitor)
- throws InvocationTargetException, InterruptedException {
- participant.setPinned(!participant.isPinned());
- updateState();
- }
+ PlatformUI.getWorkbench().getProgressService().busyCursorWhile(monitor -> {
+ participant.setPinned(!participant.isPinned());
+ updateState();
});
} catch (InvocationTargetException e) {
Utils.handle(e);
@@ -69,9 +63,6 @@ public class PinParticipantAction extends Action implements IPropertyChangeListe
}
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
- */
@Override
public void propertyChange(PropertyChangeEvent event) {
if (event.getSource() == participant) {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RemoveFromViewAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RemoveFromViewAction.java
index 882b292f0..a9aa81f8b 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RemoveFromViewAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RemoveFromViewAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -13,8 +13,6 @@ package org.eclipse.team.internal.ui.synchronize.actions;
import java.lang.reflect.InvocationTargetException;
import org.eclipse.compare.structuremergeviewer.IDiffElement;
-import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.dialogs.MessageDialogWithToggle;
import org.eclipse.jface.preference.IPreferenceStore;
@@ -36,9 +34,6 @@ public class RemoveFromViewAction extends SynchronizeModelAction {
setId(TeamUIPlugin.REMOVE_FROM_VIEW_ACTION_ID);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.SynchronizeModelAction#run()
- */
@Override
public void run() {
if (confirmRemove()) {
@@ -46,9 +41,6 @@ public class RemoveFromViewAction extends SynchronizeModelAction {
}
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.SynchronizeModelAction#getSubscriberOperation(org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration, org.eclipse.compare.structuremergeviewer.IDiffElement[])
- */
@Override
protected SynchronizeModelOperation getSubscriberOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements) {
return new SynchronizeModelOperation(configuration, elements) {
@@ -69,20 +61,12 @@ public class RemoveFromViewAction extends SynchronizeModelAction {
ISynchronizePage page = getConfiguration().getPage();
if (page instanceof SubscriberParticipantPage) {
final WorkingSetFilteredSyncInfoCollector collector = ((SubscriberParticipantPage)page).getCollector();
- collector.run(new IWorkspaceRunnable() {
- @Override
- public void run(IProgressMonitor monitor) throws CoreException {
- collector.getWorkingSetSyncInfoSet().removeAll(set.getResources());
- }
- });
+ collector.run(monitor -> collector.getWorkingSetSyncInfoSet().removeAll(set.getResources()));
}
}
};
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.SynchronizeModelAction#needsToSaveDirtyEditors()
- */
@Override
protected boolean needsToSaveDirtyEditors() {
return false;
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/StatusLineContributionGroup.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/StatusLineContributionGroup.java
index 8d8127d67..43dadfbec 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/StatusLineContributionGroup.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/StatusLineContributionGroup.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -58,12 +58,7 @@ public abstract class StatusLineContributionGroup extends ActionGroup {
private StatusLineCLabelContribution createStatusLineContribution(String id, final int mode, String label, Image image) {
StatusLineCLabelContribution item = new StatusLineCLabelContribution(id, 15);
- item.addListener(SWT.MouseDown, new Listener() {
- @Override
- public void handleEvent(Event event) {
- configuration.setMode(mode);
- }
- });
+ item.addListener(SWT.MouseDown, event -> configuration.setMode(mode));
item.setText(label);
item.setImage(image);
return item;
@@ -86,23 +81,20 @@ public abstract class StatusLineContributionGroup extends ActionGroup {
final int workspaceOutgoing = ((supportedModes & ISynchronizePageConfiguration.OUTGOING_MODE) != 0) ? countFor(SyncInfo.OUTGOING) : 0;
final int workspaceIncoming = ((supportedModes & ISynchronizePageConfiguration.INCOMING_MODE) != 0) ? countFor(SyncInfo.INCOMING) : 0;
- TeamUIPlugin.getStandardDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- if (isThreeWay()) {
- conflicting.setText(new Integer(workspaceConflicting).toString());
- incoming.setText(new Integer(workspaceIncoming).toString());
- outgoing.setText(new Integer(workspaceOutgoing).toString());
-
- conflicting.setTooltip(NLS.bind(TeamUIMessages.StatisticsPanel_numbersTooltip, new String[] { TeamUIMessages.StatisticsPanel_conflicting }));
- outgoing.setTooltip(NLS.bind(TeamUIMessages.StatisticsPanel_numbersTooltip, new String[] { TeamUIMessages.StatisticsPanel_outgoing }));
- incoming.setTooltip(NLS.bind(TeamUIMessages.StatisticsPanel_numbersTooltip, new String[] { TeamUIMessages.StatisticsPanel_incoming }));
+ TeamUIPlugin.getStandardDisplay().asyncExec(() -> {
+ if (isThreeWay()) {
+ conflicting.setText(new Integer(workspaceConflicting).toString());
+ incoming.setText(new Integer(workspaceIncoming).toString());
+ outgoing.setText(new Integer(workspaceOutgoing).toString());
+
+ conflicting.setTooltip(NLS.bind(TeamUIMessages.StatisticsPanel_numbersTooltip, new String[] { TeamUIMessages.StatisticsPanel_conflicting }));
+ outgoing.setTooltip(NLS.bind(TeamUIMessages.StatisticsPanel_numbersTooltip, new String[] { TeamUIMessages.StatisticsPanel_outgoing }));
+ incoming.setTooltip(NLS.bind(TeamUIMessages.StatisticsPanel_numbersTooltip, new String[] { TeamUIMessages.StatisticsPanel_incoming }));
+ } else {
+ if (total == 1) {
+ totalChanges.setText(NLS.bind(TeamUIMessages.StatisticsPanel_numberTotalSingular, new String[] { Integer.toString(total) }));
} else {
- if (total == 1) {
- totalChanges.setText(NLS.bind(TeamUIMessages.StatisticsPanel_numberTotalSingular, new String[] { Integer.toString(total) }));
- } else {
- totalChanges.setText(NLS.bind(TeamUIMessages.StatisticsPanel_numberTotalPlural, new String[] { Integer.toString(total) }));
- }
+ totalChanges.setText(NLS.bind(TeamUIMessages.StatisticsPanel_numberTotalPlural, new String[] { Integer.toString(total) }));
}
}
});
@@ -112,11 +104,6 @@ public abstract class StatusLineContributionGroup extends ActionGroup {
protected abstract int countFor(int state);
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.actions.ActionGroup#fillActionBars(org.eclipse.ui.IActionBars)
- */
@Override
public void fillActionBars(IActionBars actionBars) {
IStatusLineManager mgr = actionBars.getStatusLineManager();
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SynchronizePageDropDownAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SynchronizePageDropDownAction.java
index 5c37ecf34..b43702fde 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SynchronizePageDropDownAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SynchronizePageDropDownAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -51,9 +51,6 @@ public class SynchronizePageDropDownAction extends Action implements IMenuCreato
fView.getSite().getKeyBindingService().registerAction(this);
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IMenuCreator#dispose()
- */
@Override
public void dispose() {
if(menuManager != null) {
@@ -63,17 +60,11 @@ public class SynchronizePageDropDownAction extends Action implements IMenuCreato
TeamUI.getSynchronizeManager().removeSynchronizeParticipantListener(this);
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IMenuCreator#getMenu(org.eclipse.swt.widgets.Menu)
- */
@Override
public Menu getMenu(Menu parent) {
return null;
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IMenuCreator#getMenu(org.eclipse.swt.widgets.Control)
- */
@Override
public Menu getMenu(Control parent) {
Menu fMenu = null;
@@ -107,9 +98,6 @@ public class SynchronizePageDropDownAction extends Action implements IMenuCreato
}
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IAction#run()
- */
@Override
public void run() {
ISynchronizeParticipant current = fView.getParticipant();
@@ -121,39 +109,27 @@ public class SynchronizePageDropDownAction extends Action implements IMenuCreato
update();
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.sync.ISynchronizeParticipantListener#participantsAdded(org.eclipse.team.ui.sync.ISynchronizeParticipant[])
- */
@Override
public void participantsAdded(ISynchronizeParticipant[] consoles) {
Display display = TeamUIPlugin.getStandardDisplay();
- display.asyncExec(new Runnable() {
- @Override
- public void run() {
- if(menuManager != null) {
- menuManager.dispose();
- menuManager = null;
- }
- update();
+ display.asyncExec(() -> {
+ if(menuManager != null) {
+ menuManager.dispose();
+ menuManager = null;
}
+ update();
});
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.sync.ISynchronizeParticipantListener#participantsRemoved(org.eclipse.team.ui.sync.ISynchronizeParticipant[])
- */
@Override
public void participantsRemoved(ISynchronizeParticipant[] consoles) {
Display display = TeamUIPlugin.getStandardDisplay();
- display.asyncExec(new Runnable() {
- @Override
- public void run() {
- if(menuManager != null) {
- menuManager.dispose();
- menuManager = null;
- }
- update();
+ display.asyncExec(() -> {
+ if(menuManager != null) {
+ menuManager.dispose();
+ menuManager = null;
}
+ update();
});
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/ApplyPatchOperation.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/ApplyPatchOperation.java
index 7b6330d9f..213d69933 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/ApplyPatchOperation.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/ApplyPatchOperation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 IBM Corporation and others.
+ * Copyright (c) 2010, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -210,9 +210,6 @@ public class ApplyPatchOperation implements Runnable {
this.patchWizardImage = descriptor;
}
- /* (non-Javadoc)
- * @see java.lang.Runnable#run()
- */
@Override
public void run() {
openWizard();
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/PageCompareEditorInput.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/PageCompareEditorInput.java
index 0b9ed7274..0fb9d4831 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/PageCompareEditorInput.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/PageCompareEditorInput.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
+ * Copyright (c) 2006, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -17,7 +17,6 @@ import org.eclipse.compare.structuremergeviewer.ICompareInput;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.ToolBarManager;
-import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.*;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
@@ -138,9 +137,6 @@ public abstract class PageCompareEditorInput extends CompareEditorInput implemen
pagePane.setText(title);
}
- /* (non-Javadoc)
- * @see org.eclipse.compare.CompareEditorInput#handleDispose()
- */
@Override
protected void handleDispose() {
super.handleDispose();
@@ -237,12 +233,9 @@ public abstract class PageCompareEditorInput extends CompareEditorInput implemen
IProgressService manager = PlatformUI.getWorkbench().getProgressService();
try {
// TODO: we need a better progress story here (i.e. support for cancellation) bug 127075
- manager.busyCursorWhile(new IRunnableWithProgress() {
- @Override
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- prepareInput(input, getCompareConfiguration(), monitor);
- hookContentChangeListener(input);
- }
+ manager.busyCursorWhile(monitor -> {
+ prepareInput(input, getCompareConfiguration(), monitor);
+ hookContentChangeListener(input);
});
} catch (InvocationTargetException e) {
Utils.handle(e);
@@ -251,17 +244,11 @@ public abstract class PageCompareEditorInput extends CompareEditorInput implemen
}
}
- /* (non-Javadoc)
- * @see org.eclipse.compare.IContentChangeListener#contentChanged(org.eclipse.compare.IContentChangeNotifier)
- */
@Override
public void contentChanged(IContentChangeNotifier source) {
setDirty(true);
}
- /* (non-Javadoc)
- * @see org.eclipse.compare.CompareEditorInput#canRunInBackground()
- */
@Override
public boolean canRunAsJob() {
return true;
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/SaveablePartDialog.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/SaveablePartDialog.java
index 80c5990a1..58fa174fd 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/SaveablePartDialog.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/SaveablePartDialog.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -53,17 +53,11 @@ public class SaveablePartDialog extends TrayDialog {
this.input = input;
}
- /* (non-Javadoc)
- * Method declared on Dialog.
- */
@Override
protected void createButtonsForButtonBar(Composite parent) {
createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
}
- /* (non-Javadoc)
- * Method declared on Dialog.
- */
@Override
protected Control createDialogArea(Composite parent2) {
Composite parent = (Composite) super.createDialogArea(parent2);
@@ -75,9 +69,6 @@ public class SaveablePartDialog extends TrayDialog {
return parent;
}
- /* (non-Javadoc)
- * @see org.eclipse.compare.internal.ResizableDialog#close()
- */
@Override
public boolean close() {
saveChanges();
@@ -94,12 +85,7 @@ public class SaveablePartDialog extends TrayDialog {
IDialogConstants.NO_LABEL}, 0); // YES is the default
if (input.isDirty() && dialog.open() == IDialogConstants.OK_ID) {
- BusyIndicator.showWhile(null, new Runnable() {
- @Override
- public void run() {
- input.doSave(new NullProgressMonitor());
- }
- });
+ BusyIndicator.showWhile(null, () -> input.doSave(new NullProgressMonitor()));
}
}
@@ -112,9 +98,6 @@ public class SaveablePartDialog extends TrayDialog {
return input;
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.Dialog#getDialogBoundsSettings()
- */
@Override
protected IDialogSettings getDialogBoundsSettings() {
IDialogSettings compareSettings = TeamUIPlugin.getPlugin().getDialogSettings();
@@ -135,9 +118,6 @@ public class SaveablePartDialog extends TrayDialog {
fContextId= contextId;
}
- /*
- * @see org.eclipse.jface.window.Window#configureShell(Shell)
- */
@Override
protected void configureShell(Shell newShell) {
super.configureShell(newShell);
@@ -145,9 +125,6 @@ public class SaveablePartDialog extends TrayDialog {
PlatformUI.getWorkbench().getHelpSystem().setHelp(newShell, fContextId);
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.Dialog#getInitialSize()
- */
@Override
protected Point getInitialSize() {
Point initialSize = super.getInitialSize();
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/TeamOperation.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/TeamOperation.java
index 91d86b17b..bda3e50e3 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/TeamOperation.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/TeamOperation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -81,9 +81,6 @@ public abstract class TeamOperation extends JobChangeAdapter implements IRunnabl
job.setProperty(IProgressConstants.ICON_PROPERTY, icon);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.actions.JobRunnableContext#belongsTo(org.eclipse.team.internal.ui.actions.JobRunnableContext.IContextJob, java.lang.Object)
- */
@Override
protected boolean belongsTo(IContextJob job, Object family) {
if (family instanceof IContextJob) {
@@ -96,9 +93,6 @@ public abstract class TeamOperation extends JobChangeAdapter implements IRunnabl
return operation.belongsTo(family);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.actions.JobRunnableContext#getCompletionStatus()
- */
@Override
protected IStatus getCompletionStatus() {
if (gotoAction != null) {
@@ -107,9 +101,6 @@ public abstract class TeamOperation extends JobChangeAdapter implements IRunnabl
return super.getCompletionStatus();
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.actions.JobRunnableContext#isUser()
- */
@Override
protected boolean isUser() {
return operation.isUserInitiated();
@@ -330,12 +321,7 @@ public abstract class TeamOperation extends JobChangeAdapter implements IRunnabl
protected Shell getShell() {
final Shell[] shell = new Shell[] { null };
if (Display.getCurrent() == null) {
- Display.getDefault().syncExec(new Runnable() {
- @Override
- public void run() {
- shell[0] = Utils.getShell(getSite());
- }
- });
+ Display.getDefault().syncExec(() -> shell[0] = Utils.getShell(getSite()));
} else {
shell[0] = Utils.getShell(getSite());
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ModelOperation.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ModelOperation.java
index 872a91809..520fa594a 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ModelOperation.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ModelOperation.java
@@ -385,18 +385,15 @@ public abstract class ModelOperation extends TeamOperation {
private boolean showAllMappings(final String requestPreviewMessage) {
final boolean[] canceled = new boolean[] { false };
final boolean[] forcePreview = new boolean[] { false };
- Display.getDefault().syncExec(new Runnable() {
- @Override
- public void run() {
- AdditionalMappingsDialog dialog = new AdditionalMappingsDialog(getShell(), TeamUIMessages.ResourceMappingOperation_0, getScope(), getContext());
- dialog.setPreviewMessage(requestPreviewMessage);
- int result = dialog.open();
- canceled[0] = result != Window.OK;
- if (requestPreviewMessage != null) {
- forcePreview[0] = dialog.isForcePreview();
- }
- }
- });
+ Display.getDefault().syncExec(() -> {
+ AdditionalMappingsDialog dialog = new AdditionalMappingsDialog(getShell(), TeamUIMessages.ResourceMappingOperation_0, getScope(), getContext());
+ dialog.setPreviewMessage(requestPreviewMessage);
+ int result = dialog.open();
+ canceled[0] = result != Window.OK;
+ if (requestPreviewMessage != null) {
+ forcePreview[0] = dialog.isForcePreview();
+ }
+ });
if (canceled[0]) {
throw new OperationCanceledException();
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ModelParticipantAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ModelParticipantAction.java
index 0faf4fef6..f2d8182f2 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ModelParticipantAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ModelParticipantAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -16,11 +16,8 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.*;
import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.team.core.diff.*;
import org.eclipse.team.core.mapping.ISynchronizationContext;
@@ -51,12 +48,7 @@ public abstract class ModelParticipantAction extends BaseSelectionListenerAction
private void initialize(ISynchronizePageConfiguration configuration) {
configuration.getSite().getSelectionProvider().addSelectionChangedListener(this);
- configuration.getPage().getViewer().getControl().addDisposeListener(new DisposeListener() {
- @Override
- public void widgetDisposed(DisposeEvent e) {
- getConfiguration().getSite().getSelectionProvider().removeSelectionChangedListener(ModelParticipantAction.this);
- }
- });
+ configuration.getPage().getViewer().getControl().addDisposeListener(e -> getConfiguration().getSite().getSelectionProvider().removeSelectionChangedListener(ModelParticipantAction.this));
}
/**
@@ -154,15 +146,12 @@ public abstract class ModelParticipantAction extends BaseSelectionListenerAction
final SaveableComparison targetSaveable = getTargetSaveable();
final SaveableComparison activeSaveable = getActiveSaveable();
if (activeSaveable != null && activeSaveable.isDirty()) {
- PlatformUI.getWorkbench().getProgressService().run(true, true, new IRunnableWithProgress() {
- @Override
- public void run(IProgressMonitor monitor) throws InvocationTargetException,
- InterruptedException {
- try {
- handleTargetSaveableChange(configuration.getSite().getShell(), targetSaveable, activeSaveable, true, monitor);
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- }
+ PlatformUI.getWorkbench().getProgressService().run(true, true, monitor -> {
+ try {
+ handleTargetSaveableChange(configuration.getSite().getShell(), targetSaveable, activeSaveable, true,
+ monitor);
+ } catch (CoreException e) {
+ throw new InvocationTargetException(e);
}
});
}
@@ -202,24 +191,21 @@ public abstract class ModelParticipantAction extends BaseSelectionListenerAction
*/
public static boolean promptToSaveChanges(final Shell shell, final SaveableComparison saveable, final boolean allowCancel) throws InterruptedException {
final int[] result = new int[] { 0 };
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- String[] options;
- if (allowCancel) {
- options = new String[] {IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL};
- } else {
- options = new String[] {IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL};
- }
- MessageDialog dialog = new MessageDialog(
- shell,
- TeamUIMessages.ModelParticipantAction_0, null,
- NLS.bind(TeamUIMessages.ModelParticipantAction_1, saveable.getName()),
- MessageDialog.QUESTION,
- options,
- result[0]);
- result[0] = dialog.open();
+ Runnable runnable = () -> {
+ String[] options;
+ if (allowCancel) {
+ options = new String[] {IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL};
+ } else {
+ options = new String[] {IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL};
}
+ MessageDialog dialog = new MessageDialog(
+ shell,
+ TeamUIMessages.ModelParticipantAction_0, null,
+ NLS.bind(TeamUIMessages.ModelParticipantAction_1, saveable.getName()),
+ MessageDialog.QUESTION,
+ options,
+ result[0]);
+ result[0] = dialog.open();
};
shell.getDisplay().syncExec(runnable);
if (result[0] == 2)
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SaveableCompareEditorInput.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SaveableCompareEditorInput.java
index 852901c23..f5cf92bc7 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SaveableCompareEditorInput.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SaveableCompareEditorInput.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2015 IBM Corporation and others.
+ * Copyright (c) 2006, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -25,8 +25,6 @@ import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.*;
import org.eclipse.team.internal.ui.*;
@@ -181,20 +179,17 @@ public abstract class SaveableCompareEditorInput extends CompareEditorInput impl
logTrace("compareInputChangeListener assigned"); //$NON-NLS-1$
logStackTrace();
}
- compareInputChangeListener = new ICompareInputChangeListener() {
- @Override
- public void compareInputChanged(ICompareInput source) {
- if (source == getCompareResult()) {
- boolean closed = false;
- if (source.getKind() == Differencer.NO_CHANGE) {
- closed = closeEditor(true);
- }
- if (!closed) {
- // The editor was closed either because the compare input still has changes
- // or because the editor input is dirty. In either case, fire the changes
- // to the registered listeners.
- propogateInputChange();
- }
+ compareInputChangeListener = source -> {
+ if (source == getCompareResult()) {
+ boolean closed = false;
+ if (source.getKind() == Differencer.NO_CHANGE) {
+ closed = closeEditor(true);
+ }
+ if (!closed) {
+ // The editor was closed either because the compare input still has changes
+ // or because the editor input is dirty. In either case, fire the changes
+ // to the registered listeners.
+ propogateInputChange();
}
}
};
@@ -202,12 +197,9 @@ public abstract class SaveableCompareEditorInput extends CompareEditorInput impl
if (getSaveable() instanceof SaveableComparison) {
SaveableComparison scm = (SaveableComparison) saveable;
- propertyListener = new IPropertyListener() {
- @Override
- public void propertyChanged(Object source, int propId) {
- if (propId == SaveableComparison.PROP_DIRTY) {
- setDirty(saveable.isDirty());
- }
+ propertyListener = (source, propId) -> {
+ if (propId == SaveableComparison.PROP_DIRTY) {
+ setDirty(saveable.isDirty());
}
};
scm.addPropertyListener(propertyListener);
@@ -326,16 +318,13 @@ public abstract class SaveableCompareEditorInput extends CompareEditorInput impl
if (page == null)
return false;
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- Shell shell= page.getWorkbenchWindow().getShell();
- if (shell == null)
- return;
+ Runnable runnable = () -> {
+ Shell shell= page.getWorkbenchWindow().getShell();
+ if (shell == null)
+ return;
- IEditorPart part= page.findEditor(SaveableCompareEditorInput.this);
- getPage().closeEditor(part, false);
- }
+ IEditorPart part= page.findEditor(SaveableCompareEditorInput.this);
+ getPage().closeEditor(part, false);
};
if (Display.getCurrent() != null) {
runnable.run();
@@ -471,12 +460,7 @@ public abstract class SaveableCompareEditorInput extends CompareEditorInput impl
dsp.addPropertyChangeListener(pcl);
Control c= newViewer.getControl();
c.addDisposeListener(
- new DisposeListener() {
- @Override
- public void widgetDisposed(DisposeEvent e) {
- dsp.removePropertyChangeListener(pcl);
- }
- }
+ e -> dsp.removePropertyChangeListener(pcl)
);
}
return newViewer;
@@ -500,12 +484,7 @@ public abstract class SaveableCompareEditorInput extends CompareEditorInput impl
final Saveable saveable = getSaveable();
if (saveable instanceof LocalResourceSaveableComparison) {
final ITypedElement element= getFileElement(getCompareInput(), this);
- menu.addMenuListener(new IMenuListener() {
- @Override
- public void menuAboutToShow(IMenuManager manager) {
- SaveablesCompareEditorInput.handleMenuAboutToShow(manager, getContainer(), saveable, element, selectionProvider);
- }
- });
+ menu.addMenuListener(manager -> SaveablesCompareEditorInput.handleMenuAboutToShow(manager, getContainer(), saveable, element, selectionProvider));
}
}
}

Back to the top