Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2017-07-19 12:30:04 -0400
committerAlexander Kurtakov2017-07-19 12:30:04 -0400
commit00e3d380e5ad65ccac45fe9d237763a46e363153 (patch)
treebc70ecf1858432aa012bdc8b8cea544186669555 /bundles
parent8e8b622b4bf49f7e77107db4335e10731eb53254 (diff)
downloadeclipse.platform.team-00e3d380e5ad65ccac45fe9d237763a46e363153.tar.gz
eclipse.platform.team-00e3d380e5ad65ccac45fe9d237763a46e363153.tar.xz
eclipse.platform.team-00e3d380e5ad65ccac45fe9d237763a46e363153.zip
Bug 519875 - Cleanup o.e.team.ui
Convert listeners to lambdas. Change-Id: Ie43fb060f41bfdc4de0fa6d5c6097705709246ed Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
Diffstat (limited to 'bundles')
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Policy.java18
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/OpenWithMenu.java41
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/PreferencePageContainerDialog.java28
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/ResourceMappingSelectionArea.java35
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/GenericHistoryTableProvider.java17
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/LocalHistoryTableProvider.java10
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/IgnorePreferencePage.java23
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/TextPreferencePage.java48
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetModelManager.java16
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetModelProvider.java17
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ConfigureSynchronizeScheduleComposite.java28
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ImageManager.java20
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/LocalResourceSaveableComparison.java15
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/StructuredViewerAdvisor.java46
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/ApplyPatchModelCompareEditorInput.java9
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ExportProjectSetLocationPage.java169
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ImportProjectSetMainPage.java57
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/PatchInaccessibleProjectsPage.java11
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ProjectSelectionPage.java9
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/WorkingSetsDialog.java22
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/MergeActionHandler.java9
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SynchronizeModelAction.java12
22 files changed, 217 insertions, 443 deletions
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Policy.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Policy.java
index 32532b2a5..28c30b8f4 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Policy.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Policy.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2015 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,7 +14,6 @@ package org.eclipse.team.internal.ui;
import java.util.ResourceBundle;
import org.eclipse.core.runtime.*;
-import org.eclipse.osgi.service.debug.DebugOptions;
import org.eclipse.osgi.service.debug.DebugOptionsListener;
/**
@@ -42,15 +41,12 @@ public class Policy {
return actionBundle = ResourceBundle.getBundle(ACTION_BUNDLE);
}
- static final DebugOptionsListener DEBUG_OPTIONS_LISTENER = new DebugOptionsListener() {
- @Override
- public void optionsChanged(DebugOptions options) {
- boolean DEBUG = options.getBooleanOption(TeamUIPlugin.ID + "/debug", false); //$NON-NLS-1$
- DEBUG_SYNC_MODELS = DEBUG && options.getBooleanOption(TeamUIPlugin.ID + "/syncmodels", false); //$NON-NLS-1$
- DEBUG_HISTORY = DEBUG && options.getBooleanOption(TeamUIPlugin.ID + "/history", false); //$NON-NLS-1$
- DEBUG_DND = DEBUG && options.getBooleanOption(TeamUIPlugin.ID + "/dnd", false); //$NON-NLS-1$
- DEBUG_COMPARE_EDITOR_INPUT = DEBUG && options.getBooleanOption(TeamUIPlugin.ID + "/compare_editor_input", false); //$NON-NLS-1$
- }
+ static final DebugOptionsListener DEBUG_OPTIONS_LISTENER = options -> {
+ boolean DEBUG = options.getBooleanOption(TeamUIPlugin.ID + "/debug", false); //$NON-NLS-1$
+ DEBUG_SYNC_MODELS = DEBUG && options.getBooleanOption(TeamUIPlugin.ID + "/syncmodels", false); //$NON-NLS-1$
+ DEBUG_HISTORY = DEBUG && options.getBooleanOption(TeamUIPlugin.ID + "/history", false); //$NON-NLS-1$
+ DEBUG_DND = DEBUG && options.getBooleanOption(TeamUIPlugin.ID + "/dnd", false); //$NON-NLS-1$
+ DEBUG_COMPARE_EDITOR_INPUT = DEBUG && options.getBooleanOption(TeamUIPlugin.ID + "/compare_editor_input", false); //$NON-NLS-1$
};
/**
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 a0c11a09a..b9523ab6e 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
@@ -158,12 +158,9 @@ public class OpenWithMenu extends ContributionItem {
if (image != null) {
menuItem.setImage(image);
}
- Listener listener = new Listener() {
- @Override
- public void handleEvent(Event event) {
- if (event.type == SWT.Selection && menuItem.getSelection()) {
- openEditor(descriptor, false);
- }
+ Listener listener = event -> {
+ if (event.type == SWT.Selection && menuItem.getSelection()) {
+ openEditor(descriptor, false);
}
};
menuItem.addListener(SWT.Selection, listener);
@@ -184,19 +181,16 @@ public class OpenWithMenu extends ContributionItem {
new MenuItem(menu, SWT.SEPARATOR);
final MenuItem menuItem = new MenuItem(menu, SWT.PUSH);
menuItem.setText(TeamUIMessages.LocalHistoryPage_OpenWithMenu_Other);
- Listener listener = new Listener() {
- @Override
- public void handleEvent(Event event) {
- if (event.type == SWT.Selection) {
- EditorSelectionDialog dialog = new EditorSelectionDialog(menu.getShell());
- dialog.setMessage(NLS.bind(
- TeamUIMessages.LocalHistoryPage_OpenWithMenu_OtherDialogDescription,
- fileResource.getName()));
- if (dialog.open() == Window.OK) {
- IEditorDescriptor editor = dialog.getSelectedEditor();
- if (editor != null) {
- openEditor(editor, editor.isOpenExternal());
- }
+ Listener listener = event -> {
+ if (event.type == SWT.Selection) {
+ EditorSelectionDialog dialog = new EditorSelectionDialog(menu.getShell());
+ dialog.setMessage(NLS.bind(
+ TeamUIMessages.LocalHistoryPage_OpenWithMenu_OtherDialogDescription,
+ fileResource.getName()));
+ if (dialog.open() == Window.OK) {
+ IEditorDescriptor editor = dialog.getSelectedEditor();
+ if (editor != null) {
+ openEditor(editor, editor.isOpenExternal());
}
}
}
@@ -257,12 +251,9 @@ public class OpenWithMenu extends ContributionItem {
menuItem.setSelection(markAsSelected);
menuItem.setText(TeamUIMessages.LocalHistoryPage_OpenWithMenu_DefaultEditorDescription);
- Listener listener = new Listener() {
- @Override
- public void handleEvent(Event event) {
- if (event.type == SWT.Selection && menuItem.getSelection()) {
- openEditor(Utils.getDefaultEditor(revision), false);
- }
+ Listener listener = event -> {
+ if (event.type == SWT.Selection && menuItem.getSelection()) {
+ openEditor(Utils.getDefaultEditor(revision), false);
}
};
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/PreferencePageContainerDialog.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/PreferencePageContainerDialog.java
index 9d20c173c..8ff1d786e 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/PreferencePageContainerDialog.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/PreferencePageContainerDialog.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
@@ -130,13 +130,7 @@ public class PreferencePageContainerDialog extends TrayDialog
setTitle(TeamUIMessages.PreferencePageContainerDialog_6);
applyDialogFont(parent);
- composite.addHelpListener(new HelpListener(){
- @Override
- public void helpRequested(HelpEvent e) {
- currentPage.performHelp();
- }
-
- });
+ composite.addHelpListener(e -> currentPage.performHelp());
return composite;
}
@@ -249,22 +243,14 @@ public class PreferencePageContainerDialog extends TrayDialog
fMessageLabel.setText(" ");//$NON-NLS-1$
fMessageLabel.setFont(JFaceResources.getBannerFont());
- final IPropertyChangeListener fontListener = new IPropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent event) {
- if(JFaceResources.BANNER_FONT.equals(event.getProperty()) ||
- JFaceResources.DIALOG_FONT.equals(event.getProperty())) {
- updateMessage();
- }
+ final IPropertyChangeListener fontListener = event -> {
+ if(JFaceResources.BANNER_FONT.equals(event.getProperty()) ||
+ JFaceResources.DIALOG_FONT.equals(event.getProperty())) {
+ updateMessage();
}
};
- fMessageLabel.addDisposeListener(new DisposeListener() {
- @Override
- public void widgetDisposed(DisposeEvent event) {
- JFaceResources.getFontRegistry().removeListener(fontListener);
- }
- });
+ fMessageLabel.addDisposeListener(event -> JFaceResources.getFontRegistry().removeListener(fontListener));
JFaceResources.getFontRegistry().addListener(fontListener);
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/ResourceMappingSelectionArea.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/ResourceMappingSelectionArea.java
index daa659a87..cd32a1018 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/ResourceMappingSelectionArea.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/ResourceMappingSelectionArea.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2005 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
@@ -57,9 +57,6 @@ public class ResourceMappingSelectionArea extends DialogArea {
this.supportsSelection = supportSelection;
}
- /* (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);
@@ -82,15 +79,12 @@ public class ResourceMappingSelectionArea extends DialogArea {
viewer.setLabelProvider(new ResourceMappingLabelProvider());
viewer.setInput(new AdaptableList(mappings));
if (isSupportsSelection()) {
- viewer.addSelectionChangedListener(new ISelectionChangedListener() {
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- ResourceMapping oldSelection = selectedMapping;
- selectedMapping = internalGetSelectedMapping();
- if (oldSelection != selectedMapping)
- firePropertyChangeChange(SELECTED_MAPPING, oldSelection, selectedMapping);
- }
- });
+ viewer.addSelectionChangedListener(event -> {
+ ResourceMapping oldSelection = selectedMapping;
+ selectedMapping = internalGetSelectedMapping();
+ if (oldSelection != selectedMapping)
+ firePropertyChangeChange(SELECTED_MAPPING, oldSelection, selectedMapping);
+ });
}
if (isSupportsChecking())
initializeCheckboxViewer(composite);
@@ -98,15 +92,12 @@ public class ResourceMappingSelectionArea extends DialogArea {
private void initializeCheckboxViewer(Composite composite) {
final CheckboxTableViewer checkboxViewer = getCheckboxTableViewer();
- checkboxViewer.addCheckStateListener(new ICheckStateListener() {
- @Override
- public void checkStateChanged(CheckStateChangedEvent event) {
- ResourceMapping[] oldMappings = checkedMappings;
- checkedMappings = internalGetCheckedMappings();
- if (oldMappings != checkedMappings)
- firePropertyChangeChange(CHECKED_MAPPINGS, oldMappings, checkedMappings);
- }
- });
+ checkboxViewer.addCheckStateListener(event -> {
+ ResourceMapping[] oldMappings = checkedMappings;
+ checkedMappings = internalGetCheckedMappings();
+ if (oldMappings != checkedMappings)
+ firePropertyChangeChange(CHECKED_MAPPINGS, oldMappings, checkedMappings);
+ });
checkboxViewer.setCheckedElements(mappings);
checkedMappings = mappings;
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/GenericHistoryTableProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/GenericHistoryTableProvider.java
index ee4844d35..cc338caec 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/GenericHistoryTableProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/GenericHistoryTableProvider.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
@@ -19,11 +19,7 @@ import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.viewers.*;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.events.*;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.FontData;
@@ -260,12 +256,9 @@ public class GenericHistoryTableProvider {
sorter.setReversed(true);
viewer.setComparator(sorter);
- table.addDisposeListener(new DisposeListener() {
- @Override
- public void widgetDisposed(DisposeEvent e) {
- if(currentRevisionFont != null) {
- currentRevisionFont.dispose();
- }
+ table.addDisposeListener(e -> {
+ if(currentRevisionFont != null) {
+ currentRevisionFont.dispose();
}
});
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/LocalHistoryTableProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/LocalHistoryTableProvider.java
index d9c6b216b..13eec6586 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/LocalHistoryTableProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/LocalHistoryTableProvider.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
@@ -19,7 +19,6 @@ import org.eclipse.core.runtime.Adapters;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.JFaceResources;
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.events.*;
@@ -47,12 +46,7 @@ public class LocalHistoryTableProvider {
private Image dateImage;
private Font currentRevisionFont;
- private IPropertyChangeListener themeListener = new IPropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent event) {
- LocalHistoryTableProvider.this.viewer.refresh();
- }
- };
+ private IPropertyChangeListener themeListener = event -> LocalHistoryTableProvider.this.viewer.refresh();
public LocalHistoryLabelProvider() {
PlatformUI.getWorkbench().getThemeManager().addPropertyChangeListener(themeListener);
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/IgnorePreferencePage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/IgnorePreferencePage.java
index 7a327bf03..b54864e09 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/IgnorePreferencePage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/IgnorePreferencePage.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
@@ -65,12 +65,7 @@ public class IgnorePreferencePage extends PreferencePage implements IWorkbenchPr
//gd.widthHint = convertWidthInCharsToPixels(30);
gd.heightHint = 300;
ignoreTable.setLayoutData(gd);
- ignoreTable.addListener(SWT.Selection, new Listener() {
- @Override
- public void handleEvent(Event e) {
- handleSelection();
- }
- });
+ ignoreTable.addListener(SWT.Selection, e -> handleSelection());
Composite buttons = new Composite(parent, SWT.NULL);
buttons.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
@@ -81,22 +76,12 @@ public class IgnorePreferencePage extends PreferencePage implements IWorkbenchPr
addButton = new Button(buttons, SWT.PUSH);
addButton.setText(TeamUIMessages.IgnorePreferencePage_add);
- addButton.addListener(SWT.Selection, new Listener() {
- @Override
- public void handleEvent(Event e) {
- addIgnore();
- }
- });
+ addButton.addListener(SWT.Selection, e -> addIgnore());
removeButton = new Button(buttons, SWT.PUSH);
removeButton.setText(TeamUIMessages.IgnorePreferencePage_remove);
removeButton.setEnabled(false);
- removeButton.addListener(SWT.Selection, new Listener() {
- @Override
- public void handleEvent(Event e) {
- removeIgnore();
- }
- });
+ removeButton.addListener(SWT.Selection, e -> removeIgnore());
fillTable(Team.getAllIgnores());
Dialog.applyDialogFont(ancestor);
setButtonLayoutData(addButton);
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/TextPreferencePage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/TextPreferencePage.java
index 273c3b805..9f5146707 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/TextPreferencePage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/TextPreferencePage.java
@@ -154,22 +154,14 @@ public class TextPreferencePage extends PreferencePage implements IWorkbenchPref
fTable= new FileTypeTable(composite, fItems, false);
- fTable.getViewer().getControl().addListener(SWT.Selection, new Listener() {
- @Override
- public void handleEvent(Event e) {
- handleSelection();
- }
- });
+ fTable.getViewer().getControl().addListener(SWT.Selection, e -> handleSelection());
- fTable.getViewer().addDoubleClickListener(new IDoubleClickListener() {
- @Override
- public void doubleClick(DoubleClickEvent event) {
- final ISelection selection = event.getSelection();
- if (selection == null || !(selection instanceof IStructuredSelection)) {
- return;
- }
- fTable.getViewer().editElement(((IStructuredSelection)selection).getFirstElement(), 1);
+ fTable.getViewer().addDoubleClickListener(event -> {
+ final ISelection selection = event.getSelection();
+ if (selection == null || !(selection instanceof IStructuredSelection)) {
+ return;
}
+ fTable.getViewer().editElement(((IStructuredSelection)selection).getFirstElement(), 1);
});
final Composite buttonsComposite = new Composite(composite, SWT.NONE);
@@ -197,34 +189,14 @@ public class TextPreferencePage extends PreferencePage implements IWorkbenchPref
fChangeButton.setLayoutData(SWTUtils.createGridData(buttonWidth, SWT.DEFAULT, SWT.FILL, SWT.FILL, false, false));
fRemoveButton.setLayoutData(SWTUtils.createGridData(buttonWidth, SWT.DEFAULT, SWT.FILL, SWT.FILL, false, false));
- addExtensionButton.addListener(SWT.Selection, new Listener() {
- @Override
- public void handleEvent(Event e) {
- addExtension();
- }
- });
- addNameButton.addListener(SWT.Selection, new Listener() {
- @Override
- public void handleEvent(Event e) {
- addName();
- }
- });
+ addExtensionButton.addListener(SWT.Selection, e -> addExtension());
+ addNameButton.addListener(SWT.Selection, e -> addName());
fChangeButton.setEnabled(false);
- fChangeButton.addListener(SWT.Selection, new Listener() {
- @Override
- public void handleEvent(Event e) {
- changePattern();
- }
- });
+ fChangeButton.addListener(SWT.Selection, e -> changePattern());
fRemoveButton.setEnabled(false);
- fRemoveButton.addListener(SWT.Selection, new Listener() {
- @Override
- public void handleEvent(Event e) {
- removePattern();
- }
- });
+ fRemoveButton.addListener(SWT.Selection, e -> removePattern());
Dialog.applyDialogFont(parent);
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetModelManager.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetModelManager.java
index a6f0c9f3f..c4358fbc1 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetModelManager.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetModelManager.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
@@ -73,15 +73,11 @@ public class ChangeSetModelManager extends HierarchicalModelManager implements I
if (changeSetCapability != null && changeSetCapability.supportsActiveChangeSets()) {
configuration.addLabelDecorator(new ChangeSetLabelDecorator(configuration));
}
- configuration.addPropertyChangeListener(new IPropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent event) {
- if (event.getProperty().equals(ISynchronizePageConfiguration.P_MODE)) {
- updateEnablement();
- }
- }
-
- });
+ configuration.addPropertyChangeListener(event -> {
+ if (event.getProperty().equals(ISynchronizePageConfiguration.P_MODE)) {
+ updateEnablement();
+ }
+ });
}
private ChangeSetCapability getChangeSetCapability(ISynchronizePageConfiguration configuration) {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetModelProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetModelProvider.java
index ef8240ce9..a68482184 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetModelProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetModelProvider.java
@@ -17,8 +17,6 @@ import org.eclipse.compare.structuremergeviewer.IDiffElement;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.ViewerSorter;
import org.eclipse.team.core.synchronize.*;
import org.eclipse.team.internal.core.subscribers.*;
@@ -297,15 +295,12 @@ public class ChangeSetModelProvider extends CompositeModelProvider {
if (actionGroup != null) {
// This action group will be disposed when the provider is disposed
getConfiguration().addActionContribution(actionGroup);
- provider.addPropertyChangeListener(new IPropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent event) {
- if (event.getProperty().equals(P_VIEWER_SORTER)) {
- embeddedSorter = provider.getViewerSorter();
- ChangeSetModelProvider.this.firePropertyChange(P_VIEWER_SORTER, null, null);
- }
- }
- });
+ provider.addPropertyChangeListener(event -> {
+ if (event.getProperty().equals(P_VIEWER_SORTER)) {
+ embeddedSorter = provider.getViewerSorter();
+ ChangeSetModelProvider.this.firePropertyChange(P_VIEWER_SORTER, null, null);
+ }
+ });
}
}
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ConfigureSynchronizeScheduleComposite.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ConfigureSynchronizeScheduleComposite.java
index 9b9f383ac..0c17dcf0e 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ConfigureSynchronizeScheduleComposite.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ConfigureSynchronizeScheduleComposite.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
@@ -144,23 +144,15 @@ public class ConfigureSynchronizeScheduleComposite extends Composite {
gridData = new GridData();
gridData.widthHint = 35;
timeInterval.setLayoutData(gridData);
- timeInterval.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- updateEnablements();
- }
- });
- timeInterval.addVerifyListener(new VerifyListener() {
- @Override
- public void verifyText(VerifyEvent e) {
- String string = e.text;
- char[] chars = new char[string.length()];
- string.getChars(0, chars.length, chars, 0);
- for (int i = 0; i < chars.length; i++) {
- if (!('0' <= chars[i] && chars[i] <= '9')) {
- e.doit = false;
- return;
- }
+ timeInterval.addModifyListener(e -> updateEnablements());
+ timeInterval.addVerifyListener(e -> {
+ String string = e.text;
+ char[] chars = new char[string.length()];
+ string.getChars(0, chars.length, chars, 0);
+ for (int i = 0; i < chars.length; i++) {
+ if (!('0' <= chars[i] && chars[i] <= '9')) {
+ e.doit = false;
+ return;
}
}
});
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ImageManager.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ImageManager.java
index f90c63bb3..44737da68 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ImageManager.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ImageManager.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
@@ -13,11 +13,7 @@ package org.eclipse.team.internal.ui.synchronize;
import org.eclipse.compare.CompareConfiguration;
import org.eclipse.jface.resource.*;
import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.team.core.ICache;
-import org.eclipse.team.core.ICacheListener;
import org.eclipse.team.core.mapping.ISynchronizationContext;
import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
@@ -39,20 +35,10 @@ public class ImageManager {
Viewer v = getViewer(configuration);
if (v != null) {
// It is best to dispose the images when the view is disposed (see bug 198383)
- v.getControl().addDisposeListener(new DisposeListener() {
- @Override
- public void widgetDisposed(DisposeEvent e) {
- newRegistry.dispose();
- }
- });
+ v.getControl().addDisposeListener(e -> newRegistry.dispose());
} else {
// The viewer wasn't available so we'll dispose when the context is disposed
- context.getCache().addCacheListener(new ICacheListener() {
- @Override
- public void cacheDisposed(ICache cache) {
- newRegistry.dispose();
- }
- });
+ context.getCache().addCacheListener(cache -> newRegistry.dispose());
}
manager = newRegistry;
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/LocalResourceSaveableComparison.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/LocalResourceSaveableComparison.java
index 2ff733f1d..24e4f2581 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/LocalResourceSaveableComparison.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/LocalResourceSaveableComparison.java
@@ -81,16 +81,13 @@ public abstract class LocalResourceSaveableComparison extends SaveableComparison
ITypedElement te = getFileElement();
if (te instanceof IContentChangeNotifier) {
if (contentChangeListener == null) {
- contentChangeListener = new IContentChangeListener() {
- @Override
- public void contentChanged(IContentChangeNotifier source) {
- try {
- if(! isSaving) {
- performSave(new NullProgressMonitor());
- }
- } catch (CoreException e) {
- TeamUIPlugin.log(e);
+ contentChangeListener = source -> {
+ try {
+ if(! isSaving) {
+ performSave(new NullProgressMonitor());
}
+ } catch (CoreException e) {
+ TeamUIPlugin.log(e);
}
};
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/StructuredViewerAdvisor.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/StructuredViewerAdvisor.java
index c3cc15e00..2b7b3194e 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/StructuredViewerAdvisor.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/StructuredViewerAdvisor.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
@@ -65,15 +65,12 @@ public abstract class StructuredViewerAdvisor extends AbstractViewerAdvisor {
// Property change listener which responds to:
// - working set selection by the user
// - decorator format change selected by the user
- private IPropertyChangeListener propertyListener = new IPropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent event) {
- // Change to showing of sync state in text labels preference
- if(event.getProperty().equals(IPreferenceIds.SYNCVIEW_VIEW_SYNCINFO_IN_LABEL)) {
- StructuredViewer viewer = getViewer();
- if(viewer != null && !viewer.getControl().isDisposed()) {
- viewer.refresh(true /* update labels */);
- }
+ private IPropertyChangeListener propertyListener = event -> {
+ // Change to showing of sync state in text labels preference
+ if(event.getProperty().equals(IPreferenceIds.SYNCVIEW_VIEW_SYNCINFO_IN_LABEL)) {
+ StructuredViewer viewer = getViewer();
+ if(viewer != null && !viewer.getControl().isDisposed()) {
+ viewer.refresh(true /* update labels */);
}
}
};
@@ -122,12 +119,7 @@ public abstract class StructuredViewerAdvisor extends AbstractViewerAdvisor {
* @param viewer the viewer being initialize
*/
protected void initializeListeners(final StructuredViewer viewer) {
- viewer.getControl().addDisposeListener(new DisposeListener() {
- @Override
- public void widgetDisposed(DisposeEvent e) {
- StructuredViewerAdvisor.this.dispose();
- }
- });
+ viewer.getControl().addDisposeListener(e -> StructuredViewerAdvisor.this.dispose());
new OpenAndLinkWithEditorHelper(viewer) {
@@ -154,20 +146,9 @@ public abstract class StructuredViewerAdvisor extends AbstractViewerAdvisor {
};
- viewer.addDoubleClickListener(new IDoubleClickListener() {
- @Override
- public void doubleClick(DoubleClickEvent event) {
- handleDoubleClick(viewer, event);
- }
- });
+ viewer.addDoubleClickListener(event -> handleDoubleClick(viewer, event));
- viewer.addSelectionChangedListener(new ISelectionChangedListener() {
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- // Update the action bars enablement for any contributed action groups
- updateActionBars((IStructuredSelection)viewer.getSelection());
- }
- });
+ viewer.addSelectionChangedListener(event -> updateActionBars((IStructuredSelection)viewer.getSelection()));
TeamUIPlugin.getPlugin().getPreferenceStore().addPropertyChangeListener(propertyListener);
}
@@ -271,12 +252,7 @@ public abstract class StructuredViewerAdvisor extends AbstractViewerAdvisor {
final MenuManager menuMgr = createContextMenuManager(targetID);
menuMgr.setRemoveAllWhenShown(true);
- menuMgr.addMenuListener(new IMenuListener() {
- @Override
- public void menuAboutToShow(IMenuManager manager) {
- fillContextMenu(viewer, manager);
- }
- });
+ menuMgr.addMenuListener(manager -> fillContextMenu(viewer, manager));
Menu menu = menuMgr.createContextMenu(viewer.getControl());
menu.addMenuListener(new MenuListener() {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/ApplyPatchModelCompareEditorInput.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/ApplyPatchModelCompareEditorInput.java
index 0914fc0b9..ad639aacd 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/ApplyPatchModelCompareEditorInput.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/ApplyPatchModelCompareEditorInput.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
@@ -84,12 +84,7 @@ public class ApplyPatchModelCompareEditorInput extends ModelCompareEditorInput {
if (pane instanceof CompareViewerPane) {
CompareViewerPane cvp = (CompareViewerPane) pane;
cvp.setSelection(StructuredSelection.EMPTY);
- cvp.addSelectionChangedListener(new ISelectionChangedListener() {
- @Override
- public void selectionChanged(SelectionChangedEvent e) {
- feed1(cein);
- }
- });
+ cvp.addSelectionChangedListener(e -> feed1(cein));
feed1(cein);
}
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ExportProjectSetLocationPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ExportProjectSetLocationPage.java
index ee093b97f..b1d151eae 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ExportProjectSetLocationPage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ExportProjectSetLocationPage.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
@@ -20,8 +20,6 @@ import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.*;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
@@ -75,13 +73,10 @@ public class ExportProjectSetLocationPage extends TeamWizardPage {
private void createExportToFile(Composite composite) {
fileRadio = new Button(composite, SWT.RADIO);
fileRadio.setText(TeamUIMessages.ExportProjectSetMainPage_FileButton);
- fileRadio.addListener(SWT.Selection, new Listener() {
- @Override
- public void handleEvent(Event event) {
- saveToFileSystem = true;
- file = fileCombo.getText();
- updateEnablement();
- }
+ fileRadio.addListener(SWT.Selection, event -> {
+ saveToFileSystem = true;
+ file = fileCombo.getText();
+ updateEnablement();
});
Composite inner = new Composite(composite, SWT.NONE);
@@ -96,12 +91,9 @@ public class ExportProjectSetLocationPage extends TeamWizardPage {
file = PsfFilenameStore.getInstance().getSuggestedDefault();
fileCombo.setItems(PsfFilenameStore.getInstance().getHistory());
fileCombo.setText(file);
- fileCombo.addListener(SWT.Modify, new Listener() {
- @Override
- public void handleEvent(Event event) {
- file = fileCombo.getText();
- updateEnablement();
- }
+ fileCombo.addListener(SWT.Modify, event -> {
+ file = fileCombo.getText();
+ updateEnablement();
});
browseButton = new Button(inner, SWT.PUSH);
@@ -111,42 +103,36 @@ public class ExportProjectSetLocationPage extends TeamWizardPage {
int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
data.widthHint = Math.max(widthHint, browseButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
browseButton.setLayoutData(data);
- browseButton.addListener(SWT.Selection, new Listener() {
- @Override
- public void handleEvent(Event event) {
- if (!isSaveToFileSystem())
- saveToFileSystem = true;
-
- FileDialog d = new FileDialog(getShell(), SWT.SAVE);
- d.setFilterExtensions(new String[] {"*.psf"}); //$NON-NLS-1$
- d.setFilterNames(new String[] {TeamUIMessages.ExportProjectSetMainPage_Project_Set_Files_3});
- d.setFileName(TeamUIMessages.ExportProjectSetMainPage_default);
- String fileName = getFileName();
- if (fileName != null) {
- int separator = fileName.lastIndexOf(System.getProperty("file.separator").charAt(0)); //$NON-NLS-1$
- if (separator != -1) {
- fileName = fileName.substring(0, separator);
- }
- }
- d.setFilterPath(fileName);
- String f = d.open();
- if (f != null) {
- fileCombo.setText(f);
- file = f;
+ browseButton.addListener(SWT.Selection, event -> {
+ if (!isSaveToFileSystem())
+ saveToFileSystem = true;
+
+ FileDialog d = new FileDialog(getShell(), SWT.SAVE);
+ d.setFilterExtensions(new String[] {"*.psf"}); //$NON-NLS-1$
+ d.setFilterNames(new String[] {TeamUIMessages.ExportProjectSetMainPage_Project_Set_Files_3});
+ d.setFileName(TeamUIMessages.ExportProjectSetMainPage_default);
+ String fileName = getFileName();
+ if (fileName != null) {
+ int separator = fileName.lastIndexOf(System.getProperty("file.separator").charAt(0)); //$NON-NLS-1$
+ if (separator != -1) {
+ fileName = fileName.substring(0, separator);
}
}
+ d.setFilterPath(fileName);
+ String f = d.open();
+ if (f != null) {
+ fileCombo.setText(f);
+ file = f;
+ }
});
}
private void createExportToWorkspace(Composite composite) {
workspaceRadio = new Button(composite, SWT.RADIO);
workspaceRadio.setText(TeamUIMessages.ExportProjectSetMainPage_WorkspaceButton);
- workspaceRadio.addListener(SWT.Selection, new Listener() {
- @Override
- public void handleEvent(Event event) {
- saveToFileSystem = false;
- updateEnablement();
- }
+ workspaceRadio.addListener(SWT.Selection, event -> {
+ saveToFileSystem = false;
+ updateEnablement();
});
final Composite nameGroup = new Composite(composite, SWT.NONE);
@@ -159,12 +145,9 @@ public class ExportProjectSetLocationPage extends TeamWizardPage {
workspaceText = createTextField(nameGroup);
workspaceText.setEditable(false);
- workspaceText.addListener(SWT.Modify, new Listener() {
- @Override
- public void handleEvent(Event event) {
- file = workspaceFile.getLocation().toString();
- updateEnablement();
- }
+ workspaceText.addListener(SWT.Modify, event -> {
+ file = workspaceFile.getLocation().toString();
+ updateEnablement();
});
Button wsBrowseButton = new Button(nameGroup, SWT.PUSH);
GridData gd = new GridData();
@@ -173,15 +156,12 @@ public class ExportProjectSetLocationPage extends TeamWizardPage {
gd.widthHint = Math.max(widthHint, wsBrowseButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
wsBrowseButton.setLayoutData(gd);
wsBrowseButton.setText(TeamUIMessages.ExportProjectSetMainPage_Browse);
- wsBrowseButton.addListener(SWT.Selection, new Listener() {
- @Override
- public void handleEvent(Event event) {
- if (isSaveToFileSystem())
- saveToFileSystem = false;
-
- WorkspaceDialog d = new WorkspaceDialog(getShell());
- d.open();
- }
+ wsBrowseButton.addListener(SWT.Selection, event -> {
+ if (isSaveToFileSystem())
+ saveToFileSystem = false;
+
+ WorkspaceDialog d = new WorkspaceDialog(getShell());
+ d.open();
});
}
@@ -358,53 +338,44 @@ public class ExportProjectSetLocationPage extends TeamWizardPage {
}
void setupListeners() {
- wsTreeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- IStructuredSelection s = (IStructuredSelection) event.getSelection();
- Object obj = s.getFirstElement();
- if (obj != null) {
+ wsTreeViewer.addSelectionChangedListener(event -> {
+ IStructuredSelection s = (IStructuredSelection) event.getSelection();
+ Object obj = s.getFirstElement();
+ if (obj != null) {
- }
- if (obj instanceof IContainer)
- wsContainer = (IContainer) obj;
- else if (obj instanceof IFile) {
- IFile tempFile = (IFile) obj;
- wsContainer = tempFile.getParent();
- wsFilenameText.setText(tempFile.getName());
- }
+ }
+ if (obj instanceof IContainer)
+ wsContainer = (IContainer) obj;
+ else if (obj instanceof IFile) {
+ IFile tempFile = (IFile) obj;
+ wsContainer = tempFile.getParent();
+ wsFilenameText.setText(tempFile.getName());
}
});
- wsTreeViewer.addDoubleClickListener(new IDoubleClickListener() {
- @Override
- public void doubleClick(DoubleClickEvent event) {
- ISelection s = event.getSelection();
- if (s instanceof IStructuredSelection) {
- Object item = ((IStructuredSelection) s).getFirstElement();
- if (wsTreeViewer.getExpandedState(item))
- wsTreeViewer.collapseToLevel(item, 1);
- else
- wsTreeViewer.expandToLevel(item, 1);
- }
+ wsTreeViewer.addDoubleClickListener(event -> {
+ ISelection s = event.getSelection();
+ if (s instanceof IStructuredSelection) {
+ Object item = ((IStructuredSelection) s).getFirstElement();
+ if (wsTreeViewer.getExpandedState(item))
+ wsTreeViewer.collapseToLevel(item, 1);
+ else
+ wsTreeViewer.expandToLevel(item, 1);
}
});
- wsFilenameText.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- String patchName = wsFilenameText.getText();
- if (patchName.trim().equals("")) { //$NON-NLS-1$
- okButton.setEnabled(false);
- setErrorMessage(TeamUIMessages.ExportProjectSetMainPage_WorkspaceDialogErrorNoFilename);
- } else if (!(ResourcesPlugin.getWorkspace().validateName(patchName, IResource.FILE)).isOK()) {
- //make sure that the filename does not contain more than one segment
- okButton.setEnabled(false);
- setErrorMessage(TeamUIMessages.ExportProjectSetMainPage_WorkspaceDialogErrorFilenameSegments);
- } else {
- okButton.setEnabled(true);
- setErrorMessage(null);
- }
+ wsFilenameText.addModifyListener(e -> {
+ String patchName = wsFilenameText.getText();
+ if (patchName.trim().equals("")) { //$NON-NLS-1$
+ okButton.setEnabled(false);
+ setErrorMessage(TeamUIMessages.ExportProjectSetMainPage_WorkspaceDialogErrorNoFilename);
+ } else if (!(ResourcesPlugin.getWorkspace().validateName(patchName, IResource.FILE)).isOK()) {
+ //make sure that the filename does not contain more than one segment
+ okButton.setEnabled(false);
+ setErrorMessage(TeamUIMessages.ExportProjectSetMainPage_WorkspaceDialogErrorFilenameSegments);
+ } else {
+ okButton.setEnabled(true);
+ setErrorMessage(null);
}
});
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ImportProjectSetMainPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ImportProjectSetMainPage.java
index 464163ac1..25557fcdb 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ImportProjectSetMainPage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ImportProjectSetMainPage.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
@@ -118,12 +118,9 @@ public class ImportProjectSetMainPage extends TeamWizardPage {
file = psfFilenameStore.getSuggestedDefault();
fileCombo.setItems(psfFilenameStore.getHistory());
fileCombo.setText(file);
- fileCombo.addListener(SWT.Modify, new Listener() {
- @Override
- public void handleEvent(Event event) {
- file = fileCombo.getText();
- updateFileEnablement();
- }
+ fileCombo.addListener(SWT.Modify, event -> {
+ file = fileCombo.getText();
+ updateFileEnablement();
});
browseButton = new Button(inner, SWT.PUSH);
@@ -145,12 +142,9 @@ public class ImportProjectSetMainPage extends TeamWizardPage {
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 2;
urlCombo.setLayoutData(gd);
- urlCombo.addListener(SWT.Modify, new Listener() {
- @Override
- public void handleEvent(Event event) {
- urlString = urlCombo.getText();
- updateUrlEnablement();
- }
+ urlCombo.addListener(SWT.Modify, event -> {
+ urlString = urlCombo.getText();
+ updateUrlEnablement();
});
GridData data = new GridData();
@@ -158,27 +152,24 @@ public class ImportProjectSetMainPage extends TeamWizardPage {
int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
data.widthHint = Math.max(widthHint, browseButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
browseButton.setLayoutData(data);
- browseButton.addListener(SWT.Selection, new Listener() {
- @Override
- public void handleEvent(Event event) {
- FileDialog d = new FileDialog(getShell());
- d.setFilterExtensions(new String[] {"*.psf", "*"}); //$NON-NLS-1$ //$NON-NLS-2$
- d.setFilterNames(new String[] {TeamUIMessages.ImportProjectSetMainPage_Project_Set_Files_2, TeamUIMessages.ImportProjectSetMainPage_allFiles}); //
- String fileName= getFileName();
- if (fileName != null && fileName.length() > 0) {
- int separator= fileName.lastIndexOf(System.getProperty ("file.separator").charAt (0)); //$NON-NLS-1$
- if (separator != -1) {
- fileName= fileName.substring(0, separator);
- }
- } else {
- fileName= ResourcesPlugin.getWorkspace().getRoot().getLocation().toString();
- }
- d.setFilterPath(fileName);
- String f = d.open();
- if (f != null) {
- fileCombo.setText(f);
- file = f;
+ browseButton.addListener(SWT.Selection, event -> {
+ FileDialog d = new FileDialog(getShell());
+ d.setFilterExtensions(new String[] {"*.psf", "*"}); //$NON-NLS-1$ //$NON-NLS-2$
+ d.setFilterNames(new String[] {TeamUIMessages.ImportProjectSetMainPage_Project_Set_Files_2, TeamUIMessages.ImportProjectSetMainPage_allFiles}); //
+ String fileName= getFileName();
+ if (fileName != null && fileName.length() > 0) {
+ int separator= fileName.lastIndexOf(System.getProperty ("file.separator").charAt (0)); //$NON-NLS-1$
+ if (separator != -1) {
+ fileName= fileName.substring(0, separator);
}
+ } else {
+ fileName= ResourcesPlugin.getWorkspace().getRoot().getLocation().toString();
+ }
+ d.setFilterPath(fileName);
+ String f = d.open();
+ if (f != null) {
+ fileCombo.setText(f);
+ file = f;
}
});
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/PatchInaccessibleProjectsPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/PatchInaccessibleProjectsPage.java
index 32d67ab6f..1fe82e04d 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/PatchInaccessibleProjectsPage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/PatchInaccessibleProjectsPage.java
@@ -85,13 +85,10 @@ public class PatchInaccessibleProjectsPage extends WizardPage {
return input;
}
});
- checkList.addCheckStateListener(new ICheckStateListener() {
- @Override
- public void checkStateChanged(CheckStateChangedEvent event) {
- IProject project = (IProject) event.getElement();
- if (event.getChecked() && !project.exists())
- checkList.setChecked(project, false);
- }
+ checkList.addCheckStateListener(event -> {
+ IProject project = (IProject) event.getElement();
+ if (event.getChecked() && !project.exists())
+ checkList.setChecked(project, false);
});
checkList
.setComparator(new ResourceComparator(ResourceComparator.NAME));
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ProjectSelectionPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ProjectSelectionPage.java
index 15634212d..2f8e66ac7 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ProjectSelectionPage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ProjectSelectionPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
+ * Copyright (c) 2007, 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
@@ -69,12 +69,7 @@ public class ProjectSelectionPage extends WizardPage {
projectViewer.setComparator(new ResourceComparator(ResourceComparator.NAME));
projectViewer.setInput(projectList);
projectViewer.getTable().select(0);
- projectViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- updateEnablements();
- }
- });
+ projectViewer.addSelectionChangedListener(event -> updateEnablements());
}
private void createShareButton(Composite composite) {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/WorkingSetsDialog.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/WorkingSetsDialog.java
index a34608541..276e97b74 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/WorkingSetsDialog.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/WorkingSetsDialog.java
@@ -18,8 +18,6 @@ import org.eclipse.jface.dialogs.TitleAreaDialog;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.*;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
@@ -112,22 +110,14 @@ public class WorkingSetsDialog extends TitleAreaDialog {
}
void setupListeners() {
- wsTableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- IStructuredSelection s = (IStructuredSelection) event.getSelection();
- Object obj = s.getFirstElement();
- if (obj instanceof IWorkingSet)
- wsNameText.setText(((IWorkingSet) obj).getName());
- }
+ wsTableViewer.addSelectionChangedListener(event -> {
+ IStructuredSelection s = (IStructuredSelection) event.getSelection();
+ Object obj = s.getFirstElement();
+ if (obj instanceof IWorkingSet)
+ wsNameText.setText(((IWorkingSet) obj).getName());
});
- wsNameText.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- setErrorMessage(null);
- }
- });
+ wsNameText.addModifyListener(e -> setErrorMessage(null));
}
class WorkingSetLabelProvider extends LabelProvider {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/MergeActionHandler.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/MergeActionHandler.java
index 39cc095ba..a56c8ca73 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/MergeActionHandler.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/MergeActionHandler.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,12 +36,7 @@ public abstract class MergeActionHandler extends AbstractHandler {
private final ISynchronizePageConfiguration configuration;
private boolean enabled = false;
private IStructuredSelection selection;
- private ISelectionChangedListener listener = new ISelectionChangedListener() {
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- updatedEnablement(event);
- }
- };
+ private ISelectionChangedListener listener = event -> updatedEnablement(event);
/**
* Return an instance of the default handler for the given merge action id.
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SynchronizeModelAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SynchronizeModelAction.java
index 5f8e593fd..f6aeba044 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SynchronizeModelAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SynchronizeModelAction.java
@@ -16,8 +16,6 @@ import java.util.List;
import org.eclipse.compare.structuremergeviewer.IDiffElement;
import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
import org.eclipse.team.core.synchronize.*;
import org.eclipse.team.internal.ui.Utils;
import org.eclipse.team.internal.ui.synchronize.SyncInfoModelElement;
@@ -76,17 +74,9 @@ public abstract class SynchronizeModelAction extends BaseSelectionListenerAction
*/
protected void initialize(final ISynchronizePageConfiguration configuration, final ISelectionProvider selectionProvider) {
selectionProvider.addSelectionChangedListener(this);
- configuration.getPage().getViewer().getControl().addDisposeListener(new DisposeListener() {
- @Override
- public void widgetDisposed(DisposeEvent e) {
- selectionProvider.removeSelectionChangedListener(SynchronizeModelAction.this);
- }
- });
+ configuration.getPage().getViewer().getControl().addDisposeListener(e -> selectionProvider.removeSelectionChangedListener(SynchronizeModelAction.this));
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.Action#run()
- */
@Override
public void run() {
if(needsToSaveDirtyEditors()) {

Back to the top