Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2018-10-30 09:14:34 -0400
committerAlexander Kurtakov2018-10-30 09:14:34 -0400
commitae43ae1a68fd23451f8d3a05b361c67d48faf43a (patch)
tree9c65a6edc5f54584de5a78ccfb80f2d09817d1f0
parentf584836a72f37bb80c25ea61b7b7a1470d704ebc (diff)
downloadeclipse.platform.team-ae43ae1a68fd23451f8d3a05b361c67d48faf43a.tar.gz
eclipse.platform.team-ae43ae1a68fd23451f8d3a05b361c67d48faf43a.tar.xz
eclipse.platform.team-ae43ae1a68fd23451f8d3a05b361c67d48faf43a.zip
More lambdas (take 3).Y20181030-1100
Change-Id: I7b9c94f440e87fec72499baeb7055a26cd77533f Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewer.java38
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CommentTemplateEditDialog.java30
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RemoteViewPart.java42
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CommitSetDialog.java54
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagAsVersionDialog.java50
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsLocationSelectionPage.java12
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/MergeWizardPage.java31
-rw-r--r--examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLCompareAddIdMapDialog.java16
-rw-r--r--examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLCompareEditCopyIdMapDialog.java9
-rw-r--r--examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLCompareEditMappingDialog.java34
-rw-r--r--examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLCompareEditOrderedDialog.java16
11 files changed, 129 insertions, 203 deletions
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewer.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewer.java
index 34eaa243a..167350c52 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewer.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewer.java
@@ -16,38 +16,17 @@ package org.eclipse.compare.structuremergeviewer;
import java.util.Iterator;
import java.util.ResourceBundle;
-import org.eclipse.compare.CompareConfiguration;
-import org.eclipse.compare.CompareUI;
-import org.eclipse.compare.CompareViewerPane;
-import org.eclipse.compare.INavigatable;
+import org.eclipse.compare.*;
import org.eclipse.compare.internal.Utilities;
import org.eclipse.compare.internal.patch.DiffViewerComparator;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.action.ToolBarManager;
+import org.eclipse.jface.action.*;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.LabelProviderChangedEvent;
-import org.eclipse.jface.viewers.OpenEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.jface.viewers.*;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeItem;
-import org.eclipse.swt.widgets.Widget;
+import org.eclipse.swt.widgets.*;
/**
* A tree viewer that works on objects implementing
@@ -266,19 +245,16 @@ public class DiffTreeViewer extends TreeViewer {
MenuManager mm= new MenuManager();
mm.setRemoveAllWhenShown(true);
mm.addMenuListener(
- new IMenuListener() {
- @Override
- public void menuAboutToShow(IMenuManager mm2) {
+ mm2 -> {
fillContextMenu(mm2);
if (mm2.isEmpty()) {
if (fEmptyMenuAction == null) {
- fEmptyMenuAction= new Action(Utilities.getString(fBundle, "emptyMenuItem")) { //$NON-NLS-1$
+ fEmptyMenuAction = new Action(Utilities.getString(fBundle, "emptyMenuItem")) { //$NON-NLS-1$
// left empty
};
fEmptyMenuAction.setEnabled(false);
- }
- mm2.add(fEmptyMenuAction);
}
+ mm2.add(fEmptyMenuAction);
}
}
);
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CommentTemplateEditDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CommentTemplateEditDialog.java
index 6fc685bae..a665eb4ef 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CommentTemplateEditDialog.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CommentTemplateEditDialog.java
@@ -17,15 +17,8 @@ import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.IInputValidator;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.*;
/**
* A simple input dialog for soliciting an input string from the user.
@@ -105,7 +98,8 @@ public class CommentTemplateEditDialog extends Dialog {
/*
* (non-Javadoc) Method declared on Dialog.
*/
- protected void buttonPressed(int buttonId) {
+ @Override
+ protected void buttonPressed(int buttonId) {
if (buttonId == IDialogConstants.OK_ID) {
value = text.getText();
} else {
@@ -119,7 +113,8 @@ public class CommentTemplateEditDialog extends Dialog {
*
* @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
*/
- protected void configureShell(Shell shell) {
+ @Override
+ protected void configureShell(Shell shell) {
super.configureShell(shell);
if (title != null)
shell.setText(title);
@@ -130,7 +125,8 @@ public class CommentTemplateEditDialog extends Dialog {
*
* @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
*/
- protected void createButtonsForButtonBar(Composite parent) {
+ @Override
+ protected void createButtonsForButtonBar(Composite parent) {
// create OK and Cancel buttons by default
okButton = createButton(parent, IDialogConstants.OK_ID,
IDialogConstants.OK_LABEL, true);
@@ -148,7 +144,8 @@ public class CommentTemplateEditDialog extends Dialog {
/*
* (non-Javadoc) Method declared on Dialog.
*/
- protected Control createDialogArea(Composite parent) {
+ @Override
+ protected Control createDialogArea(Composite parent) {
// create composite
Composite composite = (Composite) super.createDialogArea(parent);
// create message
@@ -167,11 +164,7 @@ public class CommentTemplateEditDialog extends Dialog {
| GridData.HORIZONTAL_ALIGN_FILL);
gd.heightHint = convertHeightInCharsToPixels(5);
text.setLayoutData(gd);
- text.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- validateInput();
- }
- });
+ text.addModifyListener(e -> validateInput());
errorMessageText = new Text(composite, SWT.READ_ONLY);
errorMessageText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL
| GridData.HORIZONTAL_ALIGN_FILL));
@@ -188,7 +181,8 @@ public class CommentTemplateEditDialog extends Dialog {
* @return the error message label
* @deprecated use setErrorMessage(String) instead
*/
- protected Label getErrorMessageLabel() {
+ @Deprecated
+ protected Label getErrorMessageLabel() {
return null;
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RemoteViewPart.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RemoteViewPart.java
index f64eb6082..ee3f657ca 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RemoteViewPart.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RemoteViewPart.java
@@ -16,7 +16,6 @@ package org.eclipse.team.internal.ccvs.ui.repo;
import org.eclipse.jface.action.*;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.*;
import org.eclipse.osgi.util.NLS;
import org.eclipse.osgi.util.TextProcessor;
@@ -29,7 +28,8 @@ import org.eclipse.team.internal.ccvs.ui.*;
import org.eclipse.team.internal.ccvs.ui.actions.OpenRemoteFileAction;
import org.eclipse.team.internal.ccvs.ui.model.RemoteContentProvider;
import org.eclipse.ui.*;
-import org.eclipse.ui.actions.*;
+import org.eclipse.ui.actions.ActionFactory;
+import org.eclipse.ui.actions.WorkingSetFilterActionGroup;
import org.eclipse.ui.model.WorkbenchLabelProvider;
import org.eclipse.ui.part.*;
@@ -56,6 +56,7 @@ public abstract class RemoteViewPart extends ViewPart implements ISelectionListe
private static final String SELECTED_WORKING_SET = "SelectedWorkingSet"; //$NON-NLS-1$
/* package */ class DecoratingRepoLabelProvider extends WorkbenchLabelProvider {
+ @Override
protected String decorateText(String input, Object element) {
//Used to process RTL locales only
return TextProcessor.process(input, ":@/"); //$NON-NLS-1$
@@ -78,6 +79,7 @@ public abstract class RemoteViewPart extends ViewPart implements ISelectionListe
/**
* @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
*/
+ @Override
public void createPartControl(Composite parent) {
viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
viewer.setContentProvider(getContentProvider());
@@ -102,6 +104,7 @@ public abstract class RemoteViewPart extends ViewPart implements ISelectionListe
/**
* @see WorkbenchPart#setFocus
*/
+ @Override
public void setFocus() {
viewer.getControl().setFocus();
}
@@ -134,6 +137,7 @@ public abstract class RemoteViewPart extends ViewPart implements ISelectionListe
protected KeyAdapter getKeyListener() {
return new KeyAdapter() {
+ @Override
public void keyPressed(KeyEvent event) {
if (event.keyCode == SWT.F5) {
refreshAll();
@@ -179,6 +183,7 @@ public abstract class RemoteViewPart extends ViewPart implements ISelectionListe
// Refresh (toolbar)
CVSUIPlugin plugin = CVSUIPlugin.getPlugin();
refreshAction = new Action(CVSUIMessages.RepositoriesView_refresh, CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_REFRESH_ENABLED)) {
+ @Override
public void run() {
refreshAll();
}
@@ -189,6 +194,7 @@ public abstract class RemoteViewPart extends ViewPart implements ISelectionListe
getViewSite().getActionBars().setGlobalActionHandler(ActionFactory.REFRESH.getId(), refreshAction);
collapseAllAction = new Action(CVSUIMessages.RepositoriesView_collapseAll, CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_COLLAPSE_ALL_ENABLED)) {
+ @Override
public void run() {
collapseAll();
}
@@ -197,16 +203,13 @@ public abstract class RemoteViewPart extends ViewPart implements ISelectionListe
collapseAllAction.setHoverImageDescriptor(plugin.getImageDescriptor(ICVSUIConstants.IMG_COLLAPSE_ALL));
// Working Set action group
- IPropertyChangeListener workingSetUpdater = new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- String property = event.getProperty();
- if (WorkingSetFilterActionGroup.CHANGE_WORKING_SET
- .equals(property)) {
- Object newValue = event.getNewValue();
- setWorkingSet((IWorkingSet) newValue, true);
- }
- }
- };
+ IPropertyChangeListener workingSetUpdater = event -> {
+ String property = event.getProperty();
+ if (WorkingSetFilterActionGroup.CHANGE_WORKING_SET.equals(property)) {
+ Object newValue = event.getNewValue();
+ setWorkingSet((IWorkingSet) newValue, true);
+ }
+ };
setActionGroup(new WorkingSetFilterActionGroup(shell, workingSetUpdater));
getWorkingSetActionGroup().setWorkingSet(getContentProvider().getWorkingSet());
@@ -214,12 +217,7 @@ public abstract class RemoteViewPart extends ViewPart implements ISelectionListe
MenuManager menuMgr = new MenuManager();
Tree tree = viewer.getTree();
Menu menu = menuMgr.createContextMenu(tree);
- menuMgr.addMenuListener(new IMenuListener() {
- public void menuAboutToShow(IMenuManager manager) {
- addWorkbenchActions(manager);
- }
-
- });
+ menuMgr.addMenuListener(manager -> addWorkbenchActions(manager));
menuMgr.setRemoveAllWhenShown(true);
tree.setMenu(menu);
getSite().registerContextMenu(menuMgr, viewer);
@@ -235,11 +233,7 @@ public abstract class RemoteViewPart extends ViewPart implements ISelectionListe
// Register the open handler
openAction = new OpenRemoteFileAction();
- viewer.addOpenListener(new IOpenListener() {
- public void open(OpenEvent event) {
- handleOpen(event);
- }
- });
+ viewer.addOpenListener(event -> handleOpen(event));
bars.updateActionBars();
}
@@ -341,12 +335,14 @@ public abstract class RemoteViewPart extends ViewPart implements ISelectionListe
/**
* @see org.eclipse.ui.ISelectionListener#selectionChanged(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
*/
+ @Override
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
}
/**
* @see org.eclipse.ui.IWorkbenchPart#dispose()
*/
+ @Override
public void dispose() {
getSite().getWorkbenchWindow().getSelectionService().removePostSelectionListener(this);
if (getWorkingSetActionGroup() != null) {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CommitSetDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CommitSetDialog.java
index 6e262282e..01fadeb5d 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CommitSetDialog.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CommitSetDialog.java
@@ -15,12 +15,12 @@
package org.eclipse.team.internal.ccvs.ui.subscriber;
import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.dialogs.*;
import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.TitleAreaDialog;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;
@@ -73,7 +73,8 @@ public class CommitSetDialog extends TitleAreaDialog {
/* (non-Javadoc)
* @see org.eclipse.jface.dialogs.TitleAreaDialog#createContents(org.eclipse.swt.widgets.Composite)
*/
- protected Control createContents(Composite parent) {
+ @Override
+ protected Control createContents(Composite parent) {
Control contents = super.createContents(parent);
setTitle(title);
setMessage(description);
@@ -83,7 +84,8 @@ public class CommitSetDialog extends TitleAreaDialog {
/* (non-Javadoc)
* @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
*/
- protected Control createDialogArea(Composite parent) {
+ @Override
+ protected Control createDialogArea(Composite parent) {
Composite parentComposite = (Composite) super.createDialogArea(parent);
// create a composite with standard margins and spacing
@@ -110,18 +112,15 @@ public class CommitSetDialog extends TitleAreaDialog {
}
commitCommentArea.createArea(composite);
- commitCommentArea.addPropertyChangeListener(new IPropertyChangeListener() {
-
- public void propertyChange(PropertyChangeEvent event) {
- if (event.getProperty() == CommitCommentArea.OK_REQUESTED) {
- okPressed();
- } else if (event.getProperty() == CommitCommentArea.COMMENT_MODIFIED) {
- comment = (String)event.getNewValue();
- if (!customTitleButton.getSelection()) {
- nameText.setText(commitCommentArea.getFirstLineOfComment());
- }
- updateEnablements();
+ commitCommentArea.addPropertyChangeListener(event -> {
+ if (event.getProperty() == CommitCommentArea.OK_REQUESTED) {
+ okPressed();
+ } else if (event.getProperty() == CommitCommentArea.COMMENT_MODIFIED) {
+ comment = (String) event.getNewValue();
+ if (!customTitleButton.getSelection()) {
+ nameText.setText(commitCommentArea.getFirstLineOfComment());
}
+ updateEnablements();
}
});
@@ -138,6 +137,7 @@ public class CommitSetDialog extends TitleAreaDialog {
/* (non-Javadoc)
* @see org.eclipse.jface.window.Window#getInitialSize()
*/
+ @Override
protected Point getInitialSize() {
final Point size= super.getInitialSize();
size.x= convertWidthInCharsToPixels(DEFAULT_WIDTH_IN_CHARS);
@@ -163,12 +163,10 @@ public class CommitSetDialog extends TitleAreaDialog {
nameText = new Text(composite, SWT.BORDER);
nameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- nameText.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- customTitle = nameText.getText();
- updateEnablements();
- }
- });
+ nameText.addModifyListener(e -> {
+ customTitle = nameText.getText();
+ updateEnablements();
+ });
}
private void initializeValues() {
@@ -193,7 +191,8 @@ public class CommitSetDialog extends TitleAreaDialog {
customTitleButton = createCheckButton(radioArea, CVSUIMessages.CommitSetDialog_2);
SelectionAdapter listener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
if (customTitleButton.getSelection()) {
nameText.setText(customTitle);
} else {
@@ -264,7 +263,8 @@ public class CommitSetDialog extends TitleAreaDialog {
/* (non-Javadoc)
* @see org.eclipse.jface.dialogs.Dialog#okPressed()
*/
- protected void okPressed() {
+ @Override
+ protected void okPressed() {
String title = null;
if (customTitleButton.getSelection()) {
title= customTitle;
@@ -296,7 +296,8 @@ public class CommitSetDialog extends TitleAreaDialog {
/* (non-Javadoc)
* @see org.eclipse.jface.dialogs.Dialog#createButtonBar(org.eclipse.swt.widgets.Composite)
*/
- protected Control createButtonBar(Composite parent) {
+ @Override
+ protected Control createButtonBar(Composite parent) {
Control control = super.createButtonBar(parent);
updateEnablements();
return control;
@@ -305,6 +306,7 @@ public class CommitSetDialog extends TitleAreaDialog {
/* (non-Javadoc)
* @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
*/
+ @Override
protected void configureShell(Shell shell) {
super.configureShell(shell);
shell.setText(title);
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagAsVersionDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagAsVersionDialog.java
index 460a35983..4f17fdec0 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagAsVersionDialog.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagAsVersionDialog.java
@@ -19,10 +19,9 @@ import java.util.Vector;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.*;
import org.eclipse.team.internal.ccvs.core.CVSTag;
@@ -65,6 +64,7 @@ public class TagAsVersionDialog extends DetailsDialog {
/**
* @see DetailsDialog#createMainDialogArea(Composite)
*/
+ @Override
protected void createMainDialogArea(Composite parent) {
final int width= convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH + 50);
@@ -77,16 +77,15 @@ public class TagAsVersionDialog extends DetailsDialog {
tagCombo.setItems(getTagNameHistory());
tagCombo.setText(tagName);
tagCombo.addModifyListener(
- new ModifyListener() {
- public void modifyText(ModifyEvent e) {
+ e -> {
tagName = tagCombo.getText();
updateEnablements();
- }
}
);
moveTagButton= SWTUtils.createCheckBox(parent, CVSUIMessages.TagAction_moveTag);
moveTagButton.addSelectionListener(new SelectionAdapter() {
+ @Override
public void widgetSelected(SelectionEvent e) {
moveTag = moveTagButton.getSelection();
}
@@ -97,7 +96,8 @@ public class TagAsVersionDialog extends DetailsDialog {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ui.dialogs.DetailsDialog#getHelpContextId()
*/
- protected String getHelpContextId() {
+ @Override
+ protected String getHelpContextId() {
return IHelpContextIds.TAG_AS_VERSION_DIALOG;
}
@@ -108,6 +108,7 @@ public class TagAsVersionDialog extends DetailsDialog {
/**
* @see DetailsDialog#createDropDownDialogArea(Composite)
*/
+ @Override
protected Composite createDropDownDialogArea(Composite parent) {
final PixelConverter converter= SWTUtils.createDialogPixelConverter(parent);
@@ -123,28 +124,27 @@ public class TagAsVersionDialog extends DetailsDialog {
tagArea.setTagAreaLabel(CVSUIMessages.TagAction_existingVersions);
tagArea.setIncludeFilterInputArea(false);
tagArea.createArea(composite);
- tagArea.addPropertyChangeListener(new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- if (event.getProperty().equals(TagSelectionArea.SELECTED_TAG)) {
- CVSTag tag = tagArea.getSelection();
- if (tag != null) {
- tagCombo.setText(tag.getName());
- }
- } else if (event.getProperty().equals(TagSelectionArea.OPEN_SELECTED_TAG)) {
- CVSTag tag = tagArea.getSelection();
- if (tag != null) {
- tagCombo.setText(tag.getName());
- okPressed();
- }
- }
- }
- });
+ tagArea.addPropertyChangeListener(event -> {
+ if (event.getProperty().equals(TagSelectionArea.SELECTED_TAG)) {
+ CVSTag tag1 = tagArea.getSelection();
+ if (tag1 != null) {
+ tagCombo.setText(tag1.getName());
+ }
+ } else if (event.getProperty().equals(TagSelectionArea.OPEN_SELECTED_TAG)) {
+ CVSTag tag2 = tagArea.getSelection();
+ if (tag2 != null) {
+ tagCombo.setText(tag2.getName());
+ okPressed();
+ }
+ }
+ });
return composite;
}
/**
* Validates tag name
*/
+ @Override
protected void updateEnablements() {
String message = null;
if(tagName.length() == 0) {
@@ -183,7 +183,8 @@ public class TagAsVersionDialog extends DetailsDialog {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ui.dialogs.DetailsDialog#isMainGrabVertical()
*/
- protected boolean isMainGrabVertical() {
+ @Override
+ protected boolean isMainGrabVertical() {
return false;
}
@@ -197,6 +198,7 @@ public class TagAsVersionDialog extends DetailsDialog {
return combo;
}
+ @Override
protected void okPressed() {
rememberTagName(tagName);
super.okPressed();
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsLocationSelectionPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsLocationSelectionPage.java
index 02dc98e83..304823685 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsLocationSelectionPage.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsLocationSelectionPage.java
@@ -15,7 +15,8 @@
package org.eclipse.team.internal.ccvs.ui.wizards;
import java.io.File;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
import org.eclipse.core.resources.IProject;
@@ -105,6 +106,7 @@ public class CheckoutAsLocationSelectionPage extends CVSWizardPage {
/* (non-Javadoc)
* @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
*/
+ @Override
public void createControl(Composite parent) {
Composite composite= createComposite(parent, 1, false);
setControl(composite);
@@ -122,6 +124,7 @@ public class CheckoutAsLocationSelectionPage extends CVSWizardPage {
initializeValues();
SelectionListener listener = new SelectionAdapter() {
+ @Override
public void widgetSelected(SelectionEvent e) {
useDefaults = useDefaultsButton.getSelection();
browseButton.setEnabled(!useDefaults);
@@ -167,6 +170,7 @@ public class CheckoutAsLocationSelectionPage extends CVSWizardPage {
this.browseButton = new Button(projectGroup, SWT.PUSH);
this.browseButton.setText(CVSUIMessages.CheckoutAsLocationSelectionPage_browseLabel);
this.browseButton.addSelectionListener(new SelectionAdapter() {
+ @Override
public void widgetSelected(SelectionEvent event) {
handleLocationBrowseButtonPressed();
}
@@ -177,11 +181,7 @@ public class CheckoutAsLocationSelectionPage extends CVSWizardPage {
// Set the initial value first before listener
// to avoid handling an event during the creation.
setLocationForSelection(true);
- locationPathField.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- setErrorMessage(checkValidLocation());
- }
- });
+ locationPathField.addModifyListener(e -> setErrorMessage(checkValidLocation()));
return projectGroup;
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/MergeWizardPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/MergeWizardPage.java
index 17170fe0b..841bdbc6c 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/MergeWizardPage.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/MergeWizardPage.java
@@ -17,7 +17,8 @@ import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.window.Window;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.*;
import org.eclipse.team.internal.ccvs.core.CVSTag;
@@ -52,7 +53,8 @@ public class MergeWizardPage extends CVSWizardPage {
/* (non-Javadoc)
* @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
*/
- public void createControl(Composite parent) {
+ @Override
+ public void createControl(Composite parent) {
final PixelConverter converter= SWTUtils.createDialogPixelConverter(parent);
@@ -91,7 +93,8 @@ public class MergeWizardPage extends CVSWizardPage {
}
noPreviewButton = SWTUtils.createRadioButton(composite, CVSUIMessages.MergeWizardPage_1);
SelectionAdapter selectionAdapter = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
preview = previewButton.getSelection();
updateEnablements();
}
@@ -104,6 +107,7 @@ public class MergeWizardPage extends CVSWizardPage {
onlyPreviewConflicts.setEnabled(preview);
onlyPreviewConflicts.setSelection(isOnlyPreviewConflicts);
onlyPreviewConflicts.addSelectionListener(new SelectionAdapter() {
+ @Override
public void widgetSelected(SelectionEvent e) {
isOnlyPreviewConflicts = onlyPreviewConflicts.getSelection();
}
@@ -112,7 +116,8 @@ public class MergeWizardPage extends CVSWizardPage {
}
private void createTagRefreshArea(Composite composite) {
tagRefreshArea = new TagRefreshButtonArea(getShell(), getTagSource(), null) {
- public void refresh(boolean background) {
+ @Override
+ public void refresh(boolean background) {
super.refresh(background);
updateStartTag(startTagField.getText());
updateEndTag(endTagField.getText());
@@ -126,17 +131,14 @@ public class MergeWizardPage extends CVSWizardPage {
SWTUtils.createLabel(parent, CVSUIMessages.MergeWizardPage_2, 2);
endTagField = SWTUtils.createText(parent);
- endTagField.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- updateEndTag(endTagField.getText());
- }
- });
+ endTagField.addModifyListener(e -> updateEndTag(endTagField.getText()));
final int endTagIncludeFlags = TagSelectionArea.INCLUDE_VERSIONS | TagSelectionArea.INCLUDE_BRANCHES | TagSelectionArea.INCLUDE_HEAD_TAG;
TagContentAssistProcessor.createContentAssistant(endTagField, tagSource, endTagIncludeFlags);
endTagBrowseButton = createPushButton(parent, CVSUIMessages.MergeWizardPage_3);
endTagBrowseButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
TagSelectionDialog dialog = new TagSelectionDialog(getShell(), getTagSource(),
CVSUIMessages.MergeWizardPage_4,
CVSUIMessages.MergeWizardPage_5,
@@ -155,16 +157,13 @@ public class MergeWizardPage extends CVSWizardPage {
SWTUtils.createLabel(parent, CVSUIMessages.MergeWizardPage_6, 2);
startTagField = SWTUtils.createText(parent);
- startTagField.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- updateStartTag(startTagField.getText());
- }
- });
+ startTagField.addModifyListener(e -> updateStartTag(startTagField.getText()));
TagContentAssistProcessor.createContentAssistant(startTagField, tagSource, TagSelectionArea.INCLUDE_VERSIONS);
startTagBrowseButton = createPushButton(parent, CVSUIMessages.MergeWizardPage_7);
startTagBrowseButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
TagSelectionDialog dialog = new TagSelectionDialog(getShell(), getTagSource(),
CVSUIMessages.MergeWizardPage_8,
CVSUIMessages.MergeWizardPage_9,
diff --git a/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLCompareAddIdMapDialog.java b/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLCompareAddIdMapDialog.java
index 19530210b..13957c590 100644
--- a/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLCompareAddIdMapDialog.java
+++ b/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLCompareAddIdMapDialog.java
@@ -17,8 +17,6 @@ import java.text.MessageFormat;
import java.util.*;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.*;
@@ -83,12 +81,7 @@ public class XMLCompareAddIdMapDialog extends StatusDialog {
data.widthHint = convertWidthInCharsToPixels(30);
fIdMapText.setLayoutData(data);
fIdMapText.setText(fIdMap.getName());
- fIdMapText.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e){
- doValidation();
- }
- });
+ fIdMapText.addModifyListener(e -> doValidation());
label= new Label(inner, SWT.NULL);
label.setText(XMLCompareMessages.XMLCompareAddIdMapDialog_extlabel);
@@ -99,12 +92,7 @@ public class XMLCompareAddIdMapDialog extends StatusDialog {
data.widthHint = convertWidthInCharsToPixels(30);
fIdMapExtText.setLayoutData(data);
fIdMapExtText.setText(fIdMap.getExtension());
- fIdMapExtText.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e){
- doValidation();
- }
- });
+ fIdMapExtText.addModifyListener(e -> doValidation());
fIdMapText.setFocus();
diff --git a/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLCompareEditCopyIdMapDialog.java b/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLCompareEditCopyIdMapDialog.java
index 36965b0d4..cbd0f3090 100644
--- a/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLCompareEditCopyIdMapDialog.java
+++ b/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLCompareEditCopyIdMapDialog.java
@@ -16,8 +16,6 @@ package org.eclipse.compare.examples.xml;
import java.util.HashMap;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.*;
@@ -84,12 +82,7 @@ public class XMLCompareEditCopyIdMapDialog extends StatusDialog {
fIdMapText= new Text(inner, SWT.BORDER);
fIdMapText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- fIdMapText.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e){
- doValidation();
- }
- });
+ fIdMapText.addModifyListener(e -> doValidation());
fIdMapText.setFocus();
diff --git a/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLCompareEditMappingDialog.java b/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLCompareEditMappingDialog.java
index a88cf0d49..ae92c98a1 100644
--- a/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLCompareEditMappingDialog.java
+++ b/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLCompareEditMappingDialog.java
@@ -15,14 +15,17 @@ package org.eclipse.compare.examples.xml;
import java.util.HashMap;
+import org.eclipse.compare.examples.xml.ui.StatusDialog;
+import org.eclipse.compare.examples.xml.ui.StatusInfo;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-
-import org.eclipse.compare.examples.xml.ui.StatusDialog;
-import org.eclipse.compare.examples.xml.ui.StatusInfo;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
/**
* This class is used to add or edit a particular ID Mapping
@@ -87,12 +90,7 @@ public class XMLCompareEditMappingDialog extends StatusDialog {
fElementText= new Text(inner, SWT.BORDER);
fElementText.setText(fMapping.getElement());
fElementText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- fElementText.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e){
- doValidation();
- }
- });
+ fElementText.addModifyListener(e -> doValidation());
//Signature
label= new Label(inner, SWT.NULL);
@@ -104,12 +102,7 @@ public class XMLCompareEditMappingDialog extends StatusDialog {
GridData data= new GridData(GridData.FILL_HORIZONTAL);
data.widthHint= convertWidthInCharsToPixels(50);
fSignatureText.setLayoutData(data);
- fSignatureText.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e){
- doValidation();
- }
- });
+ fSignatureText.addModifyListener(e -> doValidation());
//Id Attribute
label= new Label(inner, SWT.NULL);
@@ -119,12 +112,7 @@ public class XMLCompareEditMappingDialog extends StatusDialog {
fIdAttributeText= new Text(inner, SWT.BORDER);
fIdAttributeText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- fIdAttributeText.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e){
- doValidation();
- }
- });
+ fIdAttributeText.addModifyListener(e -> doValidation());
//Id Source
createIdSourceGroup(inner);
diff --git a/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLCompareEditOrderedDialog.java b/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLCompareEditOrderedDialog.java
index 585b19280..0dee61b2f 100644
--- a/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLCompareEditOrderedDialog.java
+++ b/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLCompareEditOrderedDialog.java
@@ -18,8 +18,6 @@ import java.util.ArrayList;
import org.eclipse.compare.examples.xml.ui.StatusDialog;
import org.eclipse.compare.examples.xml.ui.StatusInfo;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
@@ -87,12 +85,7 @@ public class XMLCompareEditOrderedDialog extends StatusDialog {
fElementText= new Text(inner, SWT.BORDER);
fElementText.setText(fMapping.getElement());
fElementText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- fElementText.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e){
- doValidation();
- }
- });
+ fElementText.addModifyListener(e -> doValidation());
//Signature
label= new Label(inner, SWT.NULL);
@@ -104,12 +97,7 @@ public class XMLCompareEditOrderedDialog extends StatusDialog {
GridData data= new GridData(GridData.FILL_HORIZONTAL);
data.widthHint= convertWidthInCharsToPixels(50);
fSignatureText.setLayoutData(data);
- fSignatureText.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e){
- doValidation();
- }
- });
+ fSignatureText.addModifyListener(e -> doValidation());
fElementText.setFocus();

Back to the top