Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2018-10-30 08:59:06 -0400
committerAlexander Kurtakov2018-10-30 08:59:06 -0400
commitf584836a72f37bb80c25ea61b7b7a1470d704ebc (patch)
treeee2d5d4afa0e54910856be7473e1e0baa43e9ecf
parent293a2626f262d8048c6667b56ca6348a83aefc91 (diff)
downloadeclipse.platform.team-f584836a72f37bb80c25ea61b7b7a1470d704ebc.tar.gz
eclipse.platform.team-f584836a72f37bb80c25ea61b7b7a1470d704ebc.tar.xz
eclipse.platform.team-f584836a72f37bb80c25ea61b7b7a1470d704ebc.zip
Even more lambda conversions.Y20181030-0940
Change-Id: I621c582be5c5afba330cacb1f3d635465c41158a Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
-rw-r--r--bundles/org.eclipse.jsch.ui/src/org/eclipse/jsch/internal/ui/preference/PreferencePage.java39
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSRepositoryLocationMatcher.java48
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/AbstractStructureVisitor.java36
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSRepositoryLocation.java6
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AddToVersionControlDialog.java20
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AlternateUserValidationDialog.java86
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryTableProvider.java9
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CommitCommentArea.java108
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ExtMethodPreferencePage.java24
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryTableProvider.java18
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IgnoreResourcesDialog.java20
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSActionSelectionProperties.java24
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/OutgoingChangesDialog.java25
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CVSSubscriberMergeContext.java9
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/DiffOperation.java34
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/CVSRepositoryPropertiesPage.java25
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SyncInfoSetDetailsDialog.java15
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/BranchPromptDialog.java33
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagContentAssistProcessor.java47
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsMainPage.java18
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsProjectSelectionPage.java16
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ConfigurationWizardAutoconnectPage.java7
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ConfigurationWizardMainPage.java69
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ActionDelegateWrapper.java10
-rw-r--r--examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/ui/MessageLine.java9
-rw-r--r--examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/FileSystemMainPage.java24
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/BenchmarkUtils.java11
27 files changed, 350 insertions, 440 deletions
diff --git a/bundles/org.eclipse.jsch.ui/src/org/eclipse/jsch/internal/ui/preference/PreferencePage.java b/bundles/org.eclipse.jsch.ui/src/org/eclipse/jsch/internal/ui/preference/PreferencePage.java
index cd208f6ac..52e5e4fe6 100644
--- a/bundles/org.eclipse.jsch.ui/src/org/eclipse/jsch/internal/ui/preference/PreferencePage.java
+++ b/bundles/org.eclipse.jsch.ui/src/org/eclipse/jsch/internal/ui/preference/PreferencePage.java
@@ -53,8 +53,6 @@ import org.eclipse.swt.custom.CTabItem;
import org.eclipse.swt.custom.TableEditor;
import org.eclipse.swt.events.FocusEvent;
import org.eclipse.swt.events.FocusListener;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Image;
@@ -65,10 +63,8 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
@@ -342,9 +338,7 @@ protected Control createContents(Composite parent){
gd.horizontalSpan=2;
keyCommentText.setLayoutData(gd);
- keyCommentText.addModifyListener(new ModifyListener(){
- @Override
- public void modifyText(ModifyEvent e){
+ keyCommentText.addModifyListener(e -> {
if(kpair==null)
return;
try{
@@ -357,8 +351,7 @@ protected Control createContents(Composite parent){
catch(IOException ee){
// Ignore
}
- }
- });
+ });
keyPassphrase1Label=new Label(group, SWT.NONE);
keyPassphrase1Label.setText(Messages.CVSSSH2PreferencePage_43);
@@ -378,9 +371,7 @@ protected Control createContents(Composite parent){
gd.horizontalSpan=2;
keyPassphrase2Text.setLayoutData(gd);
- keyPassphrase1Text.addModifyListener(new ModifyListener(){
- @Override
- public void modifyText(ModifyEvent e){
+ keyPassphrase1Text.addModifyListener(e -> {
String pass1=keyPassphrase1Text.getText();
String pass2=keyPassphrase2Text.getText();
if(kpair!=null&&pass1.equals(pass2)){
@@ -399,12 +390,9 @@ protected Control createContents(Composite parent){
else{
setErrorMessage(Messages.CVSSSH2PreferencePage_48);
}
- }
- });
+ });
- keyPassphrase2Text.addModifyListener(new ModifyListener(){
- @Override
- public void modifyText(ModifyEvent e){
+ keyPassphrase2Text.addModifyListener(e -> {
String pass1=keyPassphrase1Text.getText();
String pass2=keyPassphrase2Text.getText();
if(kpair!=null&&pass1.equals(pass2)){
@@ -428,8 +416,7 @@ protected Control createContents(Composite parent){
else{
setErrorMessage(Messages.CVSSSH2PreferencePage_48);
}
- }
- });
+ });
keyPassphrase2Text.addFocusListener(new FocusListener(){
@Override
@@ -897,12 +884,7 @@ protected Control createContents(Composite parent){
*/
gd.heightHint=100;
table.setLayoutData(gd);
- table.addListener(SWT.Selection, new Listener(){
- @Override
- public void handleEvent(Event e){
- handleSelection();
- }
- });
+ table.addListener(SWT.Selection, e -> handleSelection());
// Create the table columns
new TableColumn(table, SWT.NULL);
new TableColumn(table, SWT.NULL);
@@ -955,12 +937,7 @@ protected Control createContents(Composite parent){
removeHostKeyButton.setLayoutData(SWTUtils.createGridData(buttonWidth,
SWT.DEFAULT, SWT.END, SWT.CENTER, false, false));
removeHostKeyButton.setEnabled(false);
- removeHostKeyButton.addListener(SWT.Selection, new Listener(){
- @Override
- public void handleEvent(Event e){
- removeHostKey();
- }
- });
+ removeHostKeyButton.addListener(SWT.Selection, e -> removeHostKey());
Dialog.applyDialogFont(parent);
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSRepositoryLocationMatcher.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSRepositoryLocationMatcher.java
index cd9daa369..fd7079f49 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSRepositoryLocationMatcher.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSRepositoryLocationMatcher.java
@@ -25,33 +25,31 @@ public class CVSRepositoryLocationMatcher {
private static final String PSERVER = "pserver"; //$NON-NLS-1$
private static final String EXT = "ext"; //$NON-NLS-1$
- private static Comparator COMPATIBLE_LOCATIONS_COMPARATOR = new Comparator() {
- public int compare(Object o1, Object o2) {
- if (o1 instanceof ICVSRepositoryLocation
- && o2 instanceof ICVSRepositoryLocation) {
- ICVSRepositoryLocation rl1 = (ICVSRepositoryLocation) o1;
- ICVSRepositoryLocation rl2 = (ICVSRepositoryLocation) o2;
- String name1 = rl1.getMethod().getName();
- String name2 = rl2.getMethod().getName();
-
- if (!name1.equals(name2) && isCompatible(rl1, rl2, false)) {
- if (name1.equals(EXTSSH))
- return -1;
- if (name2.equals(EXTSSH))
- return 1;
- if (name1.equals(PSERVER))
- return -1;
- if (name2.equals(PSERVER))
- return 1;
- if (name1.equals(EXT))
- return -1;
- if (name2.equals(EXT))
- return 1;
- }
- return name1.compareTo(name2);
+ private static Comparator COMPATIBLE_LOCATIONS_COMPARATOR = (o1, o2) -> {
+ if (o1 instanceof ICVSRepositoryLocation
+ && o2 instanceof ICVSRepositoryLocation) {
+ ICVSRepositoryLocation rl1 = (ICVSRepositoryLocation) o1;
+ ICVSRepositoryLocation rl2 = (ICVSRepositoryLocation) o2;
+ String name1 = rl1.getMethod().getName();
+ String name2 = rl2.getMethod().getName();
+
+ if (!name1.equals(name2) && isCompatible(rl1, rl2, false)) {
+ if (name1.equals(EXTSSH))
+ return -1;
+ if (name2.equals(EXTSSH))
+ return 1;
+ if (name1.equals(PSERVER))
+ return -1;
+ if (name2.equals(PSERVER))
+ return 1;
+ if (name1.equals(EXT))
+ return -1;
+ if (name2.equals(EXT))
+ return 1;
}
- return 0;
+ return name1.compareTo(name2);
}
+ return 0;
};
public static Map/* <IProject, List<ICVSRepositoryLocation>> */prepareSuggestedRepositoryLocations(
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/AbstractStructureVisitor.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/AbstractStructureVisitor.java
index 1611d6cec..715916bd5 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/AbstractStructureVisitor.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/AbstractStructureVisitor.java
@@ -244,31 +244,27 @@ abstract class AbstractStructureVisitor implements ICVSResourceVisitor {
public void visit(Session session, ICVSResource[] resources, IProgressMonitor monitor) throws CVSException {
// Sort the resources to avoid sending the same directory multiple times
- List resourceList = new ArrayList(resources.length);
+ List<ICVSResource> resourceList = new ArrayList<>(resources.length);
resourceList.addAll(Arrays.asList(resources));
final ICVSFolder localRoot = session.getLocalRoot();
- Collections.sort(resourceList, new Comparator() {
- public int compare(Object object1, Object object2) {
- ICVSResource resource1 = (ICVSResource)object1;
- ICVSResource resource2 = (ICVSResource)object2;
- try {
- String path1 = resource1.getParent().getRelativePath(localRoot);
- String path2 = resource2.getParent().getRelativePath(localRoot);
- int pathCompare = path1.compareTo(path2);
- if (pathCompare == 0) {
- if (resource1.isFolder() == resource2.isFolder()) {
- return resource1.getName().compareTo(resource2.getName());
- } else if (resource1.isFolder()) {
- return 1;
- } else {
- return -1;
- }
+ Collections.sort(resourceList, (resource1, resource2) -> {
+ try {
+ String path1 = resource1.getParent().getRelativePath(localRoot);
+ String path2 = resource2.getParent().getRelativePath(localRoot);
+ int pathCompare = path1.compareTo(path2);
+ if (pathCompare == 0) {
+ if (resource1.isFolder() == resource2.isFolder()) {
+ return resource1.getName().compareTo(resource2.getName());
+ } else if (resource1.isFolder()) {
+ return 1;
} else {
- return pathCompare;
+ return -1;
}
- } catch (CVSException e) {
- return resource1.getName().compareTo(resource2.getName());
+ } else {
+ return pathCompare;
}
+ } catch (CVSException e) {
+ return resource1.getName().compareTo(resource2.getName());
}
});
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSRepositoryLocation.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSRepositoryLocation.java
index b38f6f51b..3fbf7267b 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSRepositoryLocation.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSRepositoryLocation.java
@@ -443,11 +443,7 @@ public class CVSRepositoryLocation extends PlatformObject implements ICVSReposit
}
}
IConnectionMethod[] methods = connectionMethods.toArray(new IConnectionMethod[0]);
- Arrays.sort(methods, new Comparator<IConnectionMethod> () {
- @Override
- public int compare(IConnectionMethod cm1, IConnectionMethod cm2) {
- return cm1.getName().compareTo(cm2.getName());
- }});
+ Arrays.sort(methods, (cm1, cm2) -> cm1.getName().compareTo(cm2.getName()));
pluggedInConnectionMethods = methods;
}
return pluggedInConnectionMethods;
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AddToVersionControlDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AddToVersionControlDialog.java
index 25d190df3..546041fa8 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AddToVersionControlDialog.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AddToVersionControlDialog.java
@@ -18,7 +18,7 @@ import java.util.List;
import org.eclipse.core.resources.IResource;
import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.viewers.*;
+import org.eclipse.jface.viewers.CheckboxTableViewer;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.*;
@@ -55,6 +55,7 @@ public class AddToVersionControlDialog extends DetailsDialog {
/**
* @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
*/
+ @Override
protected void createMainDialogArea(Composite parent) {
Composite composite = new Composite(parent, SWT.NULL);
composite.setLayout(new GridLayout());
@@ -71,13 +72,15 @@ public class AddToVersionControlDialog extends DetailsDialog {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ui.dialogs.DetailsDialog#getHelpContextId()
*/
- protected String getHelpContextId() {
+ @Override
+ protected String getHelpContextId() {
return IHelpContextIds.ADD_TO_VERSION_CONTROL_DIALOG;
}
/**
* @see org.eclipse.team.internal.ui.DetailsDialog#createDropDownDialogArea(org.eclipse.swt.widgets.Composite)
*/
+ @Override
protected Composite createDropDownDialogArea(Composite parent) {
// create a composite with standard margins and spacing
Composite composite = new Composite(parent, SWT.NONE);
@@ -108,6 +111,7 @@ public class AddToVersionControlDialog extends DetailsDialog {
// set the contents of the list
listViewer.setLabelProvider(new WorkbenchLabelProvider() {
+ @Override
protected String decorateText(String input, Object element) {
if (element instanceof IResource)
return ((IResource)element).getFullPath().toString();
@@ -122,11 +126,7 @@ public class AddToVersionControlDialog extends DetailsDialog {
} else {
listViewer.setCheckedElements(resourcesToAdd);
}
- listViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- resourcesToAdd = listViewer.getCheckedElements();
- }
- });
+ listViewer.addSelectionChangedListener(event -> resourcesToAdd = listViewer.getCheckedElements());
addSelectionButtons(composite);
}
@@ -148,6 +148,7 @@ public class AddToVersionControlDialog extends DetailsDialog {
Button selectButton = createButton(buttonComposite, IDialogConstants.SELECT_ALL_ID, CVSUIMessages.ReleaseCommentDialog_selectAll, false);
SelectionListener listener = new SelectionAdapter() {
+ @Override
public void widgetSelected(SelectionEvent e) {
listViewer.setAllChecked(true);
resourcesToAdd = null;
@@ -157,6 +158,7 @@ public class AddToVersionControlDialog extends DetailsDialog {
Button deselectButton = createButton(buttonComposite, IDialogConstants.DESELECT_ALL_ID, CVSUIMessages.ReleaseCommentDialog_deselectAll, false);
listener = new SelectionAdapter() {
+ @Override
public void widgetSelected(SelectionEvent e) {
listViewer.setAllChecked(false);
resourcesToAdd = new Object[0];
@@ -169,6 +171,7 @@ public class AddToVersionControlDialog extends DetailsDialog {
/**
* @see org.eclipse.team.internal.ui.DetailsDialog#updateEnablements()
*/
+ @Override
protected void updateEnablements() {
}
@@ -188,6 +191,7 @@ public class AddToVersionControlDialog extends DetailsDialog {
/* (non-Javadoc)
* @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
*/
+ @Override
protected void createButtonsForButtonBar(Composite parent) {
createButton(parent, IDialogConstants.YES_ID, IDialogConstants.YES_LABEL, true);
createButton(parent, IDialogConstants.NO_ID, IDialogConstants.NO_LABEL, true);
@@ -197,12 +201,14 @@ public class AddToVersionControlDialog extends DetailsDialog {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ui.DetailsDialog#includeOkButton()
*/
+ @Override
protected boolean includeOkButton() {
return false;
}
/* (non-Javadoc)
* @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int)
*/
+ @Override
protected void buttonPressed(int id) {
// hijack yes and no buttons to set the correct return
// codes.
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AlternateUserValidationDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AlternateUserValidationDialog.java
index 99a41995b..27f85d95d 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AlternateUserValidationDialog.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AlternateUserValidationDialog.java
@@ -19,20 +19,11 @@ import java.util.List;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.VerifyEvent;
-import org.eclipse.swt.events.VerifyListener;
import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.*;
public class AlternateUserValidationDialog extends Dialog {
String user;
@@ -53,11 +44,13 @@ public class AlternateUserValidationDialog extends Dialog {
initializeImages();
}
+ @Override
protected void configureShell(Shell newShell) {
super.configureShell(newShell);
newShell.setText(CVSUIMessages.AlternateUserValidationDialog_Enter_Password_2);
}
+ @Override
protected Control createContents(Composite parent) {
Composite main = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
@@ -91,39 +84,38 @@ public class AlternateUserValidationDialog extends Dialog {
data.widthHint = 250;
passwordText.setLayoutData(data);
- passwordText.addVerifyListener(new VerifyListener() {
- public void verifyText(VerifyEvent e) {
- if (inUpdate) return;
- e.doit = false;
- inUpdate = true;
- switch (e.character) {
- case 8: {
- // backspace pressed
- if (password.length() > 0) {
- password = password.substring(0, password.length() - 1);
- }
- // get rid of bogus Xs
- int numX = ((Integer)numXs.get(numXs.size() - 1)).intValue();
- numXs.remove(numXs.size() - 1);
- String oldText = passwordText.getText();
- String newText = oldText.substring(0, oldText.length() - numX);
- passwordText.setText(newText);
- passwordText.setSelection(newText.length());
- break;
- }
- default: {
- String oldText = passwordText.getText();
- String x = getXs();
- numXs.add(numXs.size(), Integer.valueOf(x.length()));
- String newText = oldText + x;
- passwordText.setText(newText);
- passwordText.setSelection(newText.length());
- password += e.character;
+ passwordText.addVerifyListener(e -> {
+ if (inUpdate)
+ return;
+ e.doit = false;
+ inUpdate = true;
+ switch (e.character) {
+ case 8: {
+ // backspace pressed
+ if (password.length() > 0) {
+ password = password.substring(0, password.length() - 1);
}
+ // get rid of bogus Xs
+ int numX = ((Integer) numXs.get(numXs.size() - 1)).intValue();
+ numXs.remove(numXs.size() - 1);
+ String oldText1 = passwordText.getText();
+ String newText1 = oldText1.substring(0, oldText1.length() - numX);
+ passwordText.setText(newText1);
+ passwordText.setSelection(newText1.length());
+ break;
+ }
+ default: {
+ String oldText2 = passwordText.getText();
+ String x = getXs();
+ numXs.add(numXs.size(), Integer.valueOf(x.length()));
+ String newText2 = oldText2 + x;
+ passwordText.setText(newText2);
+ passwordText.setSelection(newText2.length());
+ password += e.character;
}
- inUpdate = false;
- updateImages();
}
+ inUpdate = false;
+ updateImages();
});
/*passwordText.addTraverseListener(new TraverseListener() {
public void keyTraversed(TraverseEvent e) {
@@ -144,26 +136,19 @@ public class AlternateUserValidationDialog extends Dialog {
data = new GridData();
data.widthHint = 70;
b.setLayoutData(data);
- b.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- okPressed();
- }
- });
+ b.addListener(SWT.Selection, event -> okPressed());
buttonComposite.getShell().setDefaultButton(b);
b = new Button(buttonComposite, SWT.PUSH);
b.setText(CVSUIMessages.AlternateUserValidationDialog_Cancel_7);
data = new GridData();
data.widthHint = 70;
b.setLayoutData(data);
- b.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- cancelPressed();
- }
- });
+ b.addListener(SWT.Selection, event -> cancelPressed());
Dialog.applyDialogFont(parent);
return main;
}
+ @Override
public boolean close() {
boolean result = super.close();
if (images != null) {
@@ -232,6 +217,7 @@ public class AlternateUserValidationDialog extends Dialog {
}
return "X"; //$NON-NLS-1$
}
+ @Override
protected void cancelPressed() {
password = null;
super.cancelPressed();
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryTableProvider.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryTableProvider.java
index 5650cd6bf..93b390edf 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryTableProvider.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryTableProvider.java
@@ -532,12 +532,9 @@ public class CVSHistoryTableProvider {
ColumnViewerToolTipSupport.enableFor(viewer);
viewer.refresh();
- tree.addDisposeListener(new DisposeListener() {
- @Override
- public void widgetDisposed(DisposeEvent e) {
- if (currentRevisionFont != null) {
- currentRevisionFont.dispose();
- }
+ tree.addDisposeListener(e -> {
+ if (currentRevisionFont != null) {
+ currentRevisionFont.dispose();
}
});
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CommitCommentArea.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CommitCommentArea.java
index 4e7e975d4..c819b32ba 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CommitCommentArea.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CommitCommentArea.java
@@ -32,8 +32,6 @@ import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.text.*;
import org.eclipse.jface.text.contentassist.ICompletionProposal;
import org.eclipse.jface.text.source.*;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.events.*;
@@ -118,46 +116,50 @@ public class CommitCommentArea extends DialogArea {
final SubMenuManager quickFixMenu = new SubMenuManager(contextMenu);
quickFixMenu.setVisible(true);
- quickFixMenu.addMenuListener(new IMenuListener() {
-
- @Override
- public void menuAboutToShow(IMenuManager manager) {
- quickFixMenu.removeAll();
-
- IAnnotationModel annotationModel = sourceViewer.getAnnotationModel();
- Iterator annotationIterator = annotationModel.getAnnotationIterator();
- while (annotationIterator.hasNext()) {
- Annotation annotation = (Annotation) annotationIterator.next();
- if (!annotation.isMarkedDeleted() && includes(annotationModel.getPosition(annotation), sourceViewer.getTextWidget().getCaretOffset()) && sourceViewer.getQuickAssistAssistant().canFix(annotation)) {
- ICompletionProposal[] computeQuickAssistProposals = sourceViewer.getQuickAssistAssistant().getQuickAssistProcessor().computeQuickAssistProposals(sourceViewer.getQuickAssistInvocationContext());
- for (int i = 0; i < computeQuickAssistProposals.length; i++) {
- final ICompletionProposal proposal = computeQuickAssistProposals[i];
- quickFixMenu.add(new Action(proposal.getDisplayString()) {
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.Action#run()
- */
- @Override
- public void run() {
- proposal.apply(sourceViewer.getDocument());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.Action#getImageDescriptor()
- */
- @Override
- public ImageDescriptor getImageDescriptor() {
- if (proposal.getImage() != null) {
- return ImageDescriptor.createFromImage(proposal.getImage());
- }
- return null;
- }
- });
- }
- }
- }
+ quickFixMenu.addMenuListener(manager -> {
+ quickFixMenu.removeAll();
+
+ IAnnotationModel annotationModel1 = sourceViewer.getAnnotationModel();
+ Iterator annotationIterator = annotationModel1.getAnnotationIterator();
+ while (annotationIterator.hasNext()) {
+ Annotation annotation = (Annotation) annotationIterator.next();
+ if (!annotation.isMarkedDeleted()
+ && includes(annotationModel1.getPosition(annotation),
+ sourceViewer.getTextWidget().getCaretOffset())
+ && sourceViewer.getQuickAssistAssistant().canFix(annotation)) {
+ ICompletionProposal[] computeQuickAssistProposals = sourceViewer.getQuickAssistAssistant()
+ .getQuickAssistProcessor()
+ .computeQuickAssistProposals(sourceViewer.getQuickAssistInvocationContext());
+ for (int i = 0; i < computeQuickAssistProposals.length; i++) {
+ final ICompletionProposal proposal = computeQuickAssistProposals[i];
+ quickFixMenu.add(new Action(proposal.getDisplayString()) {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ @Override
+ public void run() {
+ proposal.apply(sourceViewer.getDocument());
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.action.Action#getImageDescriptor()
+ */
+ @Override
+ public ImageDescriptor getImageDescriptor() {
+ if (proposal.getImage() != null) {
+ return ImageDescriptor.createFromImage(proposal.getImage());
+ }
+ return null;
+ }
+ });
+ }
+ }
}
-
});
fTextField.addFocusListener(new FocusListener() {
@@ -206,24 +208,14 @@ public class CommitCommentArea extends DialogArea {
});
- sourceViewer.addSelectionChangedListener(new ISelectionChangedListener() {
-
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- cutAction.update();
- copyAction.update();
- }
-
- });
+ sourceViewer.addSelectionChangedListener(event -> {
+ cutAction.update();
+ copyAction.update();
+ });
- sourceViewer.getTextWidget().addDisposeListener(new DisposeListener() {
-
- @Override
- public void widgetDisposed(DisposeEvent e) {
- support.uninstall();
- handlerService.deactivateHandler(handlerActivation);
- }
-
+ sourceViewer.getTextWidget().addDisposeListener(e1 -> {
+ support.uninstall();
+ handlerService.deactivateHandler(handlerActivation);
});
fDocument = new Document(initialText);
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ExtMethodPreferencePage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ExtMethodPreferencePage.java
index e4f133f50..3ceba83d6 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ExtMethodPreferencePage.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ExtMethodPreferencePage.java
@@ -43,10 +43,12 @@ public class ExtMethodPreferencePage extends PreferencePage implements IWorkbenc
/*
* @see PreferencePage#createContents(Composite)
*/
+ @Override
protected Control createContents(Composite parent) {
Composite composite = new Composite(parent, SWT.NULL);
SelectionAdapter selectionListener = new SelectionAdapter() {
+ @Override
public void widgetSelected(SelectionEvent e) {
updateEnablements();
}
@@ -170,15 +172,13 @@ public class ExtMethodPreferencePage extends PreferencePage implements IWorkbenc
int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
data.widthHint = Math.max(widthHint, b.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
b.setLayoutData(data);
- b.addListener(SWT.MouseDown, new Listener() {
- public void handleEvent (Event event) {
- FileDialog d = new FileDialog(getShell());
- d.setText(CVSUIMessages.ExtMethodPreferencePage_Details);
- String file = d.open();
- if(file!=null) {
- setCvsRshText(file);
- }
- }
+ b.addListener(SWT.MouseDown, event -> {
+ FileDialog d = new FileDialog(getShell());
+ d.setText(CVSUIMessages.ExtMethodPreferencePage_Details);
+ String file = d.open();
+ if (file != null) {
+ setCvsRshText(file);
+ }
});
new Label(composite, SWT.LEFT).setText(CVSUIMessages.ExtMethodPreferencePage_CVS_RSH_Parameters);
@@ -220,12 +220,14 @@ public class ExtMethodPreferencePage extends PreferencePage implements IWorkbenc
/*
* @see IWorkbenchPreferencePage#init(IWorkbench)
*/
+ @Override
public void init(IWorkbench workbench) {
}
/*
* @see IPreferencePage#performOk()
*/
+ @Override
public boolean performOk() {
IPreferenceStore store = getPreferenceStore();
String method;
@@ -249,7 +251,8 @@ public class ExtMethodPreferencePage extends PreferencePage implements IWorkbenc
/*
* @see PreferencePage#performDefaults()
*/
- protected void performDefaults() {
+ @Override
+ protected void performDefaults() {
IPreferenceStore store = getPreferenceStore();
String rsh = store.getDefaultString(ICVSUIConstants.PREF_CVS_RSH);
String parameter = store.getDefaultString(ICVSUIConstants.PREF_CVS_RSH_PARAMETERS);
@@ -283,6 +286,7 @@ public class ExtMethodPreferencePage extends PreferencePage implements IWorkbenc
/*
* @see PreferencePage#doGetPreferenceStore()
*/
+ @Override
protected IPreferenceStore doGetPreferenceStore() {
return CVSUIPlugin.getPlugin().getPreferenceStore();
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryTableProvider.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryTableProvider.java
index 69346b6b0..58edacb40 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryTableProvider.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryTableProvider.java
@@ -316,12 +316,9 @@ public class HistoryTableProvider {
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();
}
});
@@ -357,12 +354,9 @@ public class HistoryTableProvider {
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.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IgnoreResourcesDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IgnoreResourcesDialog.java
index 9d97e3815..fb3c708d2 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IgnoreResourcesDialog.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IgnoreResourcesDialog.java
@@ -109,6 +109,7 @@ public class IgnoreResourcesDialog extends TitleAreaDialog {
/* (non-Javadoc)
* Method declared on Dialog.
*/
+ @Override
protected void createButtonsForButtonBar(Composite parent) {
createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
@@ -117,6 +118,7 @@ public class IgnoreResourcesDialog extends TitleAreaDialog {
/* (non-Javadoc)
* Method declared on Dialog.
*/
+ @Override
protected void configureShell(Shell newShell) {
super.configureShell(newShell);
newShell.setText(CVSUIMessages.IgnoreResourcesDialog_dialogTitle);
@@ -125,6 +127,7 @@ public class IgnoreResourcesDialog extends TitleAreaDialog {
/* (non-Javadoc)
* Method declared on Dialog.
*/
+ @Override
protected Control createContents(Composite parent) {
Control control = super.createContents(parent);
dlgTitleImage = CVSUIPlugin.getPlugin().getImageDescriptor(
@@ -140,6 +143,7 @@ public class IgnoreResourcesDialog extends TitleAreaDialog {
/* (non-Javadoc)
* Method declared on Dialog.
*/
+ @Override
protected Control createDialogArea(Composite parent) {
Composite top = new Composite((Composite) super
.createDialogArea(parent), SWT.NONE);
@@ -153,16 +157,8 @@ public class IgnoreResourcesDialog extends TitleAreaDialog {
PlatformUI.getWorkbench().getHelpSystem().setHelp(top, IHelpContextIds.ADD_TO_CVSIGNORE);
- Listener selectionListener = new Listener() {
- public void handleEvent(Event event) {
- updateEnablements();
- }
- };
- Listener modifyListener = new Listener() {
- public void handleEvent(Event event) {
- validate();
- }
- };
+ Listener selectionListener = event -> updateEnablements();
+ Listener modifyListener = event -> validate();
addNameEntryButton = createRadioButton(top, CVSUIMessages.IgnoreResourcesDialog_addNameEntryButton);
addNameEntryButton.addListener(SWT.Selection, selectionListener);
@@ -234,6 +230,7 @@ public class IgnoreResourcesDialog extends TitleAreaDialog {
/* (non-Javadoc)
* Method declared on Dialog.
*/
+ @Override
protected void okPressed() {
settings.put(ACTION_KEY, selectedAction);
super.okPressed();
@@ -371,7 +368,8 @@ public class IgnoreResourcesDialog extends TitleAreaDialog {
return false;
}
- public boolean close() {
+ @Override
+ public boolean close() {
if (dlgTitleImage != null) {
dlgTitleImage.dispose();
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSActionSelectionProperties.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSActionSelectionProperties.java
index 99e705893..368f24a48 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSActionSelectionProperties.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSActionSelectionProperties.java
@@ -13,15 +13,7 @@
*******************************************************************************/
package org.eclipse.team.internal.ccvs.ui.actions;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.WeakHashMap;
+import java.util.*;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IPath;
@@ -120,15 +112,15 @@ public class CVSActionSelectionProperties {
return resources;
}
// Sort the resources so the shortest paths are first
- List sorted = new ArrayList();
+ List<IResource> sorted = new ArrayList<>();
sorted.addAll(Arrays.asList(resources));
- Collections.sort(sorted, new Comparator() {
- public int compare(Object arg0, Object arg1) {
- IResource resource0 = (IResource) arg0;
- IResource resource1 = (IResource) arg1;
+ Collections.sort(sorted, new Comparator<IResource>() {
+ @Override
+ public int compare(IResource resource0, IResource resource1) {
return resource0.getFullPath().segmentCount() - resource1.getFullPath().segmentCount();
}
- public boolean equals(Object arg0) {
+ @Override
+ public boolean equals(Object arg0) {
return false;
}
});
@@ -154,7 +146,7 @@ public class CVSActionSelectionProperties {
}
}
}
- return (IResource[]) sorted.toArray(new IResource[sorted.size()]);
+ return sorted.toArray(new IResource[sorted.size()]);
}
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/OutgoingChangesDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/OutgoingChangesDialog.java
index 55df933ce..e50188739 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/OutgoingChangesDialog.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/OutgoingChangesDialog.java
@@ -18,8 +18,6 @@ import java.lang.reflect.InvocationTargetException;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.*;
@@ -51,6 +49,7 @@ public class OutgoingChangesDialog extends DetailsDialog {
this.detailsMessage = detailsMessage;
}
+ @Override
protected void createMainDialogArea(Composite parent) {
Composite composite = SWTUtils.createHVFillComposite(parent, SWTUtils.MARGINS_NONE);
composite.setLayout(new GridLayout());
@@ -59,6 +58,7 @@ public class OutgoingChangesDialog extends DetailsDialog {
Dialog.applyDialogFont(parent);
}
+ @Override
protected Label createWrappingLabel(Composite parent, String text) {
Label label = new Label(parent, SWT.LEFT | SWT.WRAP);
label.setText(text);
@@ -73,19 +73,18 @@ public class OutgoingChangesDialog extends DetailsDialog {
return label;
}
+ @Override
protected Composite createDropDownDialogArea(Composite parent) {
Composite composite = SWTUtils.createHVFillComposite(parent, SWTUtils.MARGINS_DIALOG);
GridData data = new GridData(GridData.FILL_BOTH);
data.heightHint = 200;
data.widthHint = 200;
composite.setLayoutData(data);
- composite.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- if (pane != null)
- pane.dispose();
- if (participant != null)
- participant.dispose();
- }
+ composite.addDisposeListener(e -> {
+ if (pane != null)
+ pane.dispose();
+ if (participant != null)
+ participant.dispose();
});
createWrappingLabel(composite, detailsMessage);
@@ -125,6 +124,7 @@ public class OutgoingChangesDialog extends DetailsDialog {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ui.dialogs.DetailsDialog#isMainGrabVertical()
*/
+ @Override
protected boolean isMainGrabVertical() {
return false;
}
@@ -132,7 +132,8 @@ public class OutgoingChangesDialog extends DetailsDialog {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ui.dialogs.DetailsDialog#updateEnablements()
*/
- protected void updateEnablements() {
+ @Override
+ protected void updateEnablements() {
// Can always finish
setPageComplete(true);
}
@@ -140,7 +141,8 @@ public class OutgoingChangesDialog extends DetailsDialog {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ui.dialogs.DetailsDialog#includeErrorMessage()
*/
- protected boolean includeErrorMessage() {
+ @Override
+ protected boolean includeErrorMessage() {
return false;
}
@@ -148,6 +150,7 @@ public class OutgoingChangesDialog extends DetailsDialog {
this.helpContextId = helpContextId;
}
+ @Override
protected String getHelpContextId() {
return helpContextId;
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CVSSubscriberMergeContext.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CVSSubscriberMergeContext.java
index bbc815a95..9548be63c 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CVSSubscriberMergeContext.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CVSSubscriberMergeContext.java
@@ -132,7 +132,7 @@ public abstract class CVSSubscriberMergeContext extends SubscriberMergeContext {
// The list of diffs that add or change the local file
List fileChanges = new ArrayList();
// The list of folders diffs
- List folderDiffs = new ArrayList();
+ List<IDiff> folderDiffs = new ArrayList<>();
// The list of diffs that will result in the deletion of
// the local file
List fileDeletions = new ArrayList();
@@ -187,12 +187,7 @@ public abstract class CVSSubscriberMergeContext extends SubscriberMergeContext {
}
if (!folderDiffs.isEmpty()) {
// Order the diffs so empty added children will get deleted before their parents are visited
- Collections.sort(folderDiffs, new Comparator() {
- @Override
- public int compare(Object o1, Object o2) {
- return ((IDiff)o2).getPath().toString().compareTo(((IDiff)o1).getPath().toString());
- }
- });
+ Collections.sort(folderDiffs, (o1, o2) -> o2.getPath().toString().compareTo(o1.getPath().toString()));
for (Iterator iter = folderDiffs.iterator(); iter.hasNext();) {
IDiff diff = (IDiff) iter.next();
IResource resource = ResourceDiffTree.getResourceFor(diff);
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/DiffOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/DiffOperation.java
index e435adede..f46766657 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/DiffOperation.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/DiffOperation.java
@@ -66,10 +66,12 @@ public abstract class DiffOperation extends SingleCommandOperation {
}
}
+ @Override
public boolean checkError() {
return error || super.checkError();
}
+ @Override
public void println() {
try{
write(defaultLineEnding.getBytes());
@@ -78,46 +80,55 @@ public abstract class DiffOperation extends SingleCommandOperation {
}
}
+ @Override
public void println(boolean x) {
print(x);
println();
}
+ @Override
public void println(char x) {
print(x);
println();
}
+ @Override
public void println(char[] x) {
print(x);
println();
}
+ @Override
public void println(double x) {
print(x);
println();
}
+ @Override
public void println(float x) {
print(x);
println();
}
+ @Override
public void println(int x) {
print(x);
println();
}
+ @Override
public void println(long x) {
print(x);
println();
}
+ @Override
public void println(Object x) {
print(x);
println();
}
+ @Override
public void println(String x) {
print(x);
println();
@@ -134,6 +145,7 @@ public abstract class DiffOperation extends SingleCommandOperation {
this.destination = destination;
}
+ @Override
protected boolean shouldRun(){
if (super.shouldRun() == false){
return false;
@@ -155,6 +167,7 @@ public abstract class DiffOperation extends SingleCommandOperation {
return true;
}
+ @Override
public void execute(IProgressMonitor monitor) throws CVSException, InterruptedException {
try {
stream = new CustomizableEOLPrintStream(openStream());
@@ -179,6 +192,7 @@ public abstract class DiffOperation extends SingleCommandOperation {
private int compare(IResource r1, IResource r2) {
return r1.getFullPath().toString().compareTo(r2.getFullPath().toString());
}
+ @Override
public int compare(Object o1, Object o2) {
IResource r1 = null;
IResource r2 = null;
@@ -195,6 +209,7 @@ public abstract class DiffOperation extends SingleCommandOperation {
return compare(r1, r2);
}
};
+ @Override
protected void execute(CVSTeamProvider provider, IResource[] resources, boolean recurse, IProgressMonitor monitor) throws CVSException, InterruptedException {
//add this project to the total projects encountered
@@ -207,6 +222,7 @@ public abstract class DiffOperation extends SingleCommandOperation {
IResource resource = resources[i];
ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
cvsResource.accept(new ICVSResourceVisitor() {
+ @Override
public void visitFile(ICVSFile file) throws CVSException {
if (!(file.isIgnored())) {
if (!file.isManaged() || file.getSyncInfo().isAdded() ){
@@ -219,6 +235,7 @@ public abstract class DiffOperation extends SingleCommandOperation {
}
}
+ @Override
public void visitFolder(ICVSFolder folder) throws CVSException {
// Even if we are not supposed to recurse we still need to go into
// the root directory.
@@ -355,6 +372,7 @@ public abstract class DiffOperation extends SingleCommandOperation {
return CVSWorkspaceRoot.getCVSFolderFor(cvsFile.getIResource().getProject());
}
+ @Override
protected IStatus executeCommand(Session session, CVSTeamProvider provider, ICVSResource[] resources, boolean recurse, IProgressMonitor monitor) throws CVSException, InterruptedException {
DiffListener diffListener = new DiffListener(stream);
@@ -374,22 +392,23 @@ public abstract class DiffOperation extends SingleCommandOperation {
return status;
}
+ @Override
protected String getTaskName(CVSTeamProvider provider) {
return NLS.bind(CVSUIMessages.DiffOperation_0, new String[]{provider.getProject().getName()});
}
+ @Override
protected String getTaskName() {
return CVSUIMessages.DiffOperation_1;
}
+ @Override
Map getProviderTraversalMapping(IProgressMonitor monitor) throws CoreException {
Map providerTraversal = super.getProviderTraversalMapping(monitor);
- SortedMap result = new TreeMap(new Comparator() {
- public int compare(Object o1, Object o2) {
- CVSTeamProvider p1 = (CVSTeamProvider) o1;
- CVSTeamProvider p2 = (CVSTeamProvider) o2;
- return COMPARATOR.compare(p1.getProject(), p2.getProject());
- }
+ SortedMap result = new TreeMap((o1, o2) -> {
+ CVSTeamProvider p1 = (CVSTeamProvider) o1;
+ CVSTeamProvider p2 = (CVSTeamProvider) o2;
+ return COMPARATOR.compare(p1.getProject(), p2.getProject());
});
result.putAll(providerTraversal);
return result;
@@ -545,6 +564,7 @@ public abstract class DiffOperation extends SingleCommandOperation {
StatusManager.SHOW);
}
+ @Override
protected ICVSFolder getLocalRoot(CVSTeamProvider provider) throws CVSException {
ICVSFolder root = getPatchRootFolder();
if (root != null)
@@ -578,10 +598,12 @@ public abstract class DiffOperation extends SingleCommandOperation {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#consultModelsForMappings()
*/
+ @Override
public boolean consultModelsForMappings() {
return false;
}
+ @Override
public boolean belongsTo(Object family){
if(family != null && family.equals(destination))
return true;
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/CVSRepositoryPropertiesPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/CVSRepositoryPropertiesPage.java
index fed3e6c6e..5016ded25 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/CVSRepositoryPropertiesPage.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/CVSRepositoryPropertiesPage.java
@@ -77,6 +77,7 @@ public class CVSRepositoryPropertiesPage extends PropertyPage {
/*
* @see PreferencesPage#createContents
*/
+ @Override
protected Control createContents(Composite parent) {
initialize();
@@ -97,11 +98,7 @@ public class CVSRepositoryPropertiesPage extends PropertyPage {
layout.marginHeight = 0;
layout.marginWidth = 0;
labelGroup.setLayout(layout);
- Listener labelListener = new Listener() {
- public void handleEvent(Event event) {
- updateWidgetEnablements();
- }
- };
+ Listener labelListener = event -> updateWidgetEnablements();
useLocationAsLabel = createRadioButton(labelGroup, CVSUIMessages.CVSRepositoryPropertiesPage_useLocationAsLabel, 3);
useCustomLabel = createRadioButton(labelGroup, CVSUIMessages.CVSRepositoryPropertiesPage_useCustomLabel, 1);
useCustomLabel.addListener(SWT.Selection, labelListener);
@@ -150,6 +147,7 @@ public class CVSRepositoryPropertiesPage extends PropertyPage {
data.horizontalSpan = 3;
allowCachingButton.setLayoutData(data);
allowCachingButton.addSelectionListener(new SelectionAdapter() {
+ @Override
public void widgetSelected(SelectionEvent e) {
allowCaching = allowCachingButton.getSelection();
}
@@ -163,17 +161,11 @@ public class CVSRepositoryPropertiesPage extends PropertyPage {
initializeValues();
updateWidgetEnablements();
- Listener connectionInfoChangedListener = new Listener() {
- public void handleEvent(Event event) {
- connectionInfoChanged = true;
- updateWidgetEnablements();
- }
+ Listener connectionInfoChangedListener = event -> {
+ connectionInfoChanged = true;
+ updateWidgetEnablements();
};
- passwordText.addListener(SWT.Modify, new Listener() {
- public void handleEvent(Event event) {
- passwordChanged = !passwordText.getText().equals(FAKE_PASSWORD);
- }
- });
+ passwordText.addListener(SWT.Modify, event -> passwordChanged = !passwordText.getText().equals(FAKE_PASSWORD));
userText.addListener(SWT.Modify, connectionInfoChangedListener);
methodType.addListener(SWT.Modify, connectionInfoChangedListener);
hostText.addListener(SWT.Modify, connectionInfoChangedListener);
@@ -364,6 +356,7 @@ public class CVSRepositoryPropertiesPage extends PropertyPage {
final boolean[] result = new boolean[] { false };
final ProgressMonitorDialog progressMonitorDialog = new ProgressMonitorDialog(getShell());
progressMonitorDialog.run(false, false, new WorkspaceModifyOperation(null) {
+ @Override
public void execute(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
try {
// Create a new repository location with the new information
@@ -444,6 +437,7 @@ public class CVSRepositoryPropertiesPage extends PropertyPage {
/*
* @see PreferencesPage#performOk
*/
+ @Override
public boolean performOk() {
if (performConnectionInfoChanges()) {
performNonConnectionInfoChanges();
@@ -455,6 +449,7 @@ public class CVSRepositoryPropertiesPage extends PropertyPage {
/* (non-Javadoc)
* @see org.eclipse.jface.preference.PreferencePage#performDefaults()
*/
+ @Override
protected void performDefaults() {
super.performDefaults();
initializeValues();
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SyncInfoSetDetailsDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SyncInfoSetDetailsDialog.java
index 4f0c42066..5dd2c8b41 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SyncInfoSetDetailsDialog.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SyncInfoSetDetailsDialog.java
@@ -15,7 +15,7 @@ package org.eclipse.team.internal.ccvs.ui.subscriber;
import org.eclipse.core.resources.IResource;
import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.viewers.*;
+import org.eclipse.jface.viewers.CheckboxTableViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.*;
import org.eclipse.swt.layout.GridData;
@@ -50,6 +50,7 @@ public abstract class SyncInfoSetDetailsDialog extends DetailsDialog {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ui.DetailsDialog#createDropDownDialogArea(org.eclipse.swt.widgets.Composite)
*/
+ @Override
protected Composite createDropDownDialogArea(Composite parent) {
Composite composite = createComposite(parent);
@@ -76,6 +77,7 @@ public abstract class SyncInfoSetDetailsDialog extends DetailsDialog {
// set the contents of the list
listViewer.setLabelProvider(new WorkbenchLabelProvider() {
+ @Override
protected String decorateText(String input, Object element) {
if (element instanceof IResource)
return ((IResource)element).getFullPath().toString();
@@ -85,11 +87,7 @@ public abstract class SyncInfoSetDetailsDialog extends DetailsDialog {
});
listViewer.setContentProvider(new WorkbenchContentProvider());
setViewerInput();
- listViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- selectedResources = listViewer.getCheckedElements();
- }
- });
+ listViewer.addSelectionChangedListener(event -> selectedResources = listViewer.getCheckedElements());
addSelectionButtons(composite);
@@ -112,6 +110,7 @@ public abstract class SyncInfoSetDetailsDialog extends DetailsDialog {
Button selectButton = createButton(buttonComposite, IDialogConstants.SELECT_ALL_ID, CVSUIMessages.ReleaseCommentDialog_selectAll, false);
SelectionListener listener = new SelectionAdapter() {
+ @Override
public void widgetSelected(SelectionEvent e) {
listViewer.setAllChecked(true);
selectedResources = null;
@@ -121,6 +120,7 @@ public abstract class SyncInfoSetDetailsDialog extends DetailsDialog {
Button deselectButton = createButton(buttonComposite, IDialogConstants.DESELECT_ALL_ID, CVSUIMessages.ReleaseCommentDialog_deselectAll, false);
listener = new SelectionAdapter() {
+ @Override
public void widgetSelected(SelectionEvent e) {
listViewer.setAllChecked(false);
selectedResources = new Object[0];
@@ -151,6 +151,7 @@ public abstract class SyncInfoSetDetailsDialog extends DetailsDialog {
* (non-Javadoc)
* @see org.eclipse.team.internal.ui.DetailsDialog#updateEnablements()
*/
+ @Override
protected void updateEnablements() {
}
@@ -164,6 +165,7 @@ public abstract class SyncInfoSetDetailsDialog extends DetailsDialog {
/* (non-Javadoc)
* @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int)
*/
+ @Override
protected void buttonPressed(int id) {
if (id == IDialogConstants.OK_ID) {
filterSyncSet();
@@ -175,6 +177,7 @@ public abstract class SyncInfoSetDetailsDialog extends DetailsDialog {
// Keep only the checked resources
if (selectedResources != null) {
getSyncSet().selectNodes(new FastSyncInfoFilter() {
+ @Override
public boolean select(SyncInfo info) {
IResource local = info.getLocal();
for (int i = 0; i < selectedResources.length; i++) {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/BranchPromptDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/BranchPromptDialog.java
index 9cb0dcd82..64a4889e2 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/BranchPromptDialog.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/BranchPromptDialog.java
@@ -59,6 +59,7 @@ public class BranchPromptDialog extends DetailsDialog {
/**
* @see DetailsDialog#createMainDialogArea(Composite)
*/
+ @Override
protected void createMainDialogArea(Composite composite) {
applyDialogFont(composite);
@@ -73,21 +74,15 @@ public class BranchPromptDialog extends DetailsDialog {
name.setLayoutData(SWTUtils.createGridData(areaWidth, SWT.DEFAULT, true, false));
branchText = CVSWizardPage.createTextField(composite);
- branchText.addListener(SWT.Modify, new Listener() {
- public void handleEvent(Event event) {
- branchTag = branchText.getText();
- updateEnablements();
- updateVersionName(branchTag);
- }
+ branchText.addListener(SWT.Modify, event -> {
+ branchTag = branchText.getText();
+ updateEnablements();
+ updateVersionName(branchTag);
});
addBranchContentAssist();
final Button check = SWTUtils.createCheckBox(composite, CVSUIMessages.BranchWizardPage_startWorking);
- check.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- update = check.getSelection();
- }
- });
+ check.addListener(SWT.Selection, event -> update = check.getSelection());
check.setSelection(true);
update = true;
@@ -98,11 +93,9 @@ public class BranchPromptDialog extends DetailsDialog {
versionLabel2.setLayoutData(SWTUtils.createGridData(areaWidth, SWT.DEFAULT, true, false));
versionText = CVSWizardPage.createTextField(composite);
- versionText.addListener(SWT.Modify, new Listener() {
- public void handleEvent(Event event) {
- versionTag = versionText.getText();
- updateEnablements();
- }
+ versionText.addListener(SWT.Modify, event -> {
+ versionTag = versionText.getText();
+ updateEnablements();
});
if(allStickyResources) {
@@ -117,7 +110,8 @@ public class BranchPromptDialog extends DetailsDialog {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ui.dialogs.DetailsDialog#getHelpContextId()
*/
- protected String getHelpContextId() {
+ @Override
+ protected String getHelpContextId() {
return IHelpContextIds.BRANCH_DIALOG;
}
private void addBranchContentAssist() {
@@ -142,6 +136,7 @@ public class BranchPromptDialog extends DetailsDialog {
/**
* @see DetailsDialog#createDropDownDialogArea(Composite)
*/
+ @Override
protected Composite createDropDownDialogArea(Composite parent) {
applyDialogFont(parent);
@@ -164,6 +159,7 @@ public class BranchPromptDialog extends DetailsDialog {
/**
* Validates branch and version names
*/
+ @Override
protected void updateEnablements() {
String message = null;
@@ -214,7 +210,8 @@ public class BranchPromptDialog extends DetailsDialog {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ui.dialogs.DetailsDialog#isMainGrabVertical()
*/
- protected boolean isMainGrabVertical() {
+ @Override
+ protected boolean isMainGrabVertical() {
return false;
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagContentAssistProcessor.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagContentAssistProcessor.java
index c937f2732..12ba5165f 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagContentAssistProcessor.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagContentAssistProcessor.java
@@ -13,21 +13,16 @@
*******************************************************************************/
package org.eclipse.team.internal.ccvs.ui.tags;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.contentassist.*;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.text.*;
import org.eclipse.jface.text.contentassist.*;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.*;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Text;
import org.eclipse.team.internal.ccvs.core.CVSTag;
import org.eclipse.ui.contentassist.ContentAssistHandler;
@@ -41,11 +36,7 @@ public class TagContentAssistProcessor implements ISubjectControlContentAssistPr
public static void createContentAssistant(Text text, TagSource tagSource, int includeFlags) {
final TagContentAssistProcessor tagContentAssistProcessor = new TagContentAssistProcessor(tagSource, includeFlags);
- text.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- tagContentAssistProcessor.dispose();
- }
- });
+ text.addDisposeListener(e -> tagContentAssistProcessor.dispose());
ContentAssistHandler.createHandlerForText(text, createSubjectContentAssistant(tagContentAssistProcessor));
}
@@ -57,11 +48,7 @@ public class TagContentAssistProcessor implements ISubjectControlContentAssistPr
//ContentAssistPreference.configure(contentAssistant, JavaPlugin.getDefault().getPreferenceStore());
contentAssistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE);
- contentAssistant.setInformationControlCreator(new IInformationControlCreator() {
- public IInformationControl createInformationControl(Shell parent) {
- return new DefaultInformationControl(parent);
- }
- });
+ contentAssistant.setInformationControlCreator(parent -> new DefaultInformationControl(parent));
return contentAssistant;
}
@@ -73,7 +60,8 @@ public class TagContentAssistProcessor implements ISubjectControlContentAssistPr
/* (non-Javadoc)
* @see org.eclipse.jface.contentassist.ISubjectControlContentAssistProcessor#computeCompletionProposals(org.eclipse.jface.contentassist.IContentAssistSubjectControl, int)
*/
- public ICompletionProposal[] computeCompletionProposals(IContentAssistSubjectControl contentAssistSubjectControl, int documentOffset) {
+ @Override
+ public ICompletionProposal[] computeCompletionProposals(IContentAssistSubjectControl contentAssistSubjectControl, int documentOffset) {
Control c = contentAssistSubjectControl.getControl();
int docLength = contentAssistSubjectControl.getDocument().getLength();
if (c instanceof Text) {
@@ -107,14 +95,16 @@ public class TagContentAssistProcessor implements ISubjectControlContentAssistPr
/* (non-Javadoc)
* @see org.eclipse.jface.contentassist.ISubjectControlContentAssistProcessor#computeContextInformation(org.eclipse.jface.contentassist.IContentAssistSubjectControl, int)
*/
- public IContextInformation[] computeContextInformation(IContentAssistSubjectControl contentAssistSubjectControl, int documentOffset) {
+ @Override
+ public IContextInformation[] computeContextInformation(IContentAssistSubjectControl contentAssistSubjectControl, int documentOffset) {
return null;
}
/* (non-Javadoc)
* @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#computeCompletionProposals(org.eclipse.jface.text.ITextViewer, int)
*/
- public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int offset) {
+ @Override
+ public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int offset) {
Assert.isTrue(false, "ITextViewer not supported"); //$NON-NLS-1$
return null;
}
@@ -122,35 +112,40 @@ public class TagContentAssistProcessor implements ISubjectControlContentAssistPr
/* (non-Javadoc)
* @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#computeContextInformation(org.eclipse.jface.text.ITextViewer, int)
*/
- public IContextInformation[] computeContextInformation(ITextViewer viewer, int offset) {
+ @Override
+ public IContextInformation[] computeContextInformation(ITextViewer viewer, int offset) {
return null;
}
/* (non-Javadoc)
* @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getCompletionProposalAutoActivationCharacters()
*/
- public char[] getCompletionProposalAutoActivationCharacters() {
+ @Override
+ public char[] getCompletionProposalAutoActivationCharacters() {
return null;
}
/* (non-Javadoc)
* @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getContextInformationAutoActivationCharacters()
*/
- public char[] getContextInformationAutoActivationCharacters() {
+ @Override
+ public char[] getContextInformationAutoActivationCharacters() {
return null;
}
/* (non-Javadoc)
* @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getErrorMessage()
*/
- public String getErrorMessage() {
+ @Override
+ public String getErrorMessage() {
return null;
}
/* (non-Javadoc)
* @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getContextInformationValidator()
*/
- public IContextInformationValidator getContextInformationValidator() {
+ @Override
+ public IContextInformationValidator getContextInformationValidator() {
return null;
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsMainPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsMainPage.java
index 97e9173ea..66c1f6733 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsMainPage.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsMainPage.java
@@ -21,7 +21,8 @@ import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.osgi.util.NLS;
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.layout.GridLayout;
import org.eclipse.swt.widgets.*;
@@ -70,6 +71,7 @@ public class CheckoutAsMainPage 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);
@@ -128,11 +130,7 @@ public class CheckoutAsMainPage extends CVSWizardPage {
// Should sub-folders of the folder be checked out?
recurseCheck = createCheckBox(composite, CVSUIMessages.CheckoutAsProjectSelectionPage_recurse);
- recurseCheck.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- recurse = recurseCheck.getSelection();
- }
- });
+ recurseCheck.addListener(SWT.Selection, event -> recurse = recurseCheck.getSelection());
recurseCheck.setSelection(recurse);
addWorkingSetSection(composite, CVSUIMessages.CheckoutAsMainPage_WorkingSetSingle);
@@ -197,11 +195,7 @@ public class CheckoutAsMainPage extends CVSWizardPage {
projectNameField.selectAll();
// Set the listener to capture modify events
- projectNameField.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- updateEnablements();
- }
- });
+ projectNameField.addModifyListener(e -> updateEnablements());
}
/**
@@ -245,9 +239,11 @@ public class CheckoutAsMainPage extends CVSWizardPage {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.wizards.CVSWizardPage#createRadioButton(org.eclipse.swt.widgets.Composite, java.lang.String, int)
*/
+ @Override
protected Button createRadioButton(Composite parent, String label, int span) {
Button radio = super.createRadioButton(parent, label, span);
radio.addSelectionListener(new SelectionAdapter() {
+ @Override
public void widgetSelected(SelectionEvent e) {
updateEnablements();
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsProjectSelectionPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsProjectSelectionPage.java
index 1310c5f5e..b75224bbe 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsProjectSelectionPage.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsProjectSelectionPage.java
@@ -85,6 +85,7 @@ public class CheckoutAsProjectSelectionPage extends CVSWizardPage {
/**
* @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
*/
+ @Override
public void createControl(Composite parent) {
Composite composite= createComposite(parent, 2, false);
setControl(composite);
@@ -94,22 +95,16 @@ public class CheckoutAsProjectSelectionPage extends CVSWizardPage {
if (isSingleFolder()) {
createLabel(composite, CVSUIMessages.CheckoutAsProjectSelectionPage_name);
nameField = createTextField(composite);
- nameField.addListener(SWT.Modify, new Listener() {
- public void handleEvent(Event event) {
- folderName = nameField.getText();
- updateWidgetEnablements();
- }
+ nameField.addListener(SWT.Modify, event -> {
+ folderName = nameField.getText();
+ updateWidgetEnablements();
});
}
createWrappingLabel(composite, CVSUIMessages.CheckoutAsProjectSelectionPage_treeLabel, 0, 2);
tree = createResourceSelectionTree(composite, IResource.PROJECT | IResource.FOLDER, 2 /* horizontal span */);
- tree.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- handleResourceSelection(event);
- }
- });
+ tree.addSelectionChangedListener(event -> handleResourceSelection(event));
Composite filterComposite = createComposite(composite, 2, false);
GridData data = new GridData();
@@ -120,6 +115,7 @@ public class CheckoutAsProjectSelectionPage extends CVSWizardPage {
createLabel(filterComposite, CVSUIMessages.CheckoutAsProjectSelectionPage_showLabel);
filterList = createCombo(filterComposite);
filterList.addSelectionListener(new SelectionAdapter() {
+ @Override
public void widgetSelected(SelectionEvent e) {
handleFilterSelection();
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ConfigurationWizardAutoconnectPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ConfigurationWizardAutoconnectPage.java
index 7f885a329..129b76ea6 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ConfigurationWizardAutoconnectPage.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ConfigurationWizardAutoconnectPage.java
@@ -47,6 +47,7 @@ public class ConfigurationWizardAutoconnectPage extends CVSWizardPage {
/*
* @see IDialogPage#createControl(Composite)
*/
+ @Override
public void createControl(Composite parent) {
Composite composite = createComposite(parent, 2, false);
setControl(composite);
@@ -93,11 +94,7 @@ public class ConfigurationWizardAutoconnectPage extends CVSWizardPage {
data = new GridData();
data.horizontalSpan = 2;
check.setText(CVSUIMessages.ConfigurationWizardAutoconnectPage_validate);
- check.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- validate = check.getSelection();
- }
- });
+ check.addListener(SWT.Selection, event -> validate = check.getSelection());
check.setSelection(true);
Dialog.applyDialogFont(parent);
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ConfigurationWizardMainPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ConfigurationWizardMainPage.java
index 98e833443..b1385cc0c 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ConfigurationWizardMainPage.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ConfigurationWizardMainPage.java
@@ -20,8 +20,9 @@ import java.util.*;
import java.util.List;
import org.eclipse.core.runtime.*;
-import org.eclipse.jface.dialogs.*;
import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.fieldassist.*;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.SWT;
@@ -119,6 +120,7 @@ public class ConfigurationWizardMainPage extends CVSWizardPage {
l.toArray(r);
return r;
}
+ @Override
protected IDialogSettings getDialogSettings() {
return settings;
}
@@ -147,44 +149,43 @@ public class ConfigurationWizardMainPage extends CVSWizardPage {
*
* @param parent the parent of the created widgets
*/
+ @Override
public void createControl(Composite parent) {
Composite composite = createComposite(parent, 2, false);
// set F1 help
PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IHelpContextIds.SHARING_NEW_REPOSITORY_PAGE);
- Listener listener = new Listener() {
- public void handleEvent(Event event) {
- if (location != null) {
- oldLocation = location;
- location = null;
- }
- if (event.widget == hostCombo) {
- String hostText = hostCombo.getText();
- if (hostText.length() > 0 && hostText.charAt(0) == ':') {
- try {
- CVSRepositoryLocation newLocation = CVSRepositoryLocation.fromString(hostText);
- connectionMethodCombo.setText(newLocation.getMethod().getName());
- repositoryPathCombo.setText(newLocation.getRootDirectory());
- int port = newLocation.getPort();
- if (port == ICVSRepositoryLocation.USE_DEFAULT_PORT) {
- useDefaultPort.setSelection(true);
- useCustomPort.setSelection(false);
- } else {
- useCustomPort.setSelection(true);
- useDefaultPort.setSelection(false);
- portText.setText(String.valueOf(port));
- }
-
- userCombo.setText(newLocation.getUsername());
- //passwordText.setText(newLocation.xxx);
- hostCombo.setText(newLocation.getHost());
- } catch (CVSException e) {
- CVSUIPlugin.log(e);
+ Listener listener = event -> {
+ if (location != null) {
+ oldLocation = location;
+ location = null;
+ }
+ if (event.widget == hostCombo) {
+ String hostText = hostCombo.getText();
+ if (hostText.length() > 0 && hostText.charAt(0) == ':') {
+ try {
+ CVSRepositoryLocation newLocation = CVSRepositoryLocation.fromString(hostText);
+ connectionMethodCombo.setText(newLocation.getMethod().getName());
+ repositoryPathCombo.setText(newLocation.getRootDirectory());
+ int port = newLocation.getPort();
+ if (port == ICVSRepositoryLocation.USE_DEFAULT_PORT) {
+ useDefaultPort.setSelection(true);
+ useCustomPort.setSelection(false);
+ } else {
+ useCustomPort.setSelection(true);
+ useDefaultPort.setSelection(false);
+ portText.setText(String.valueOf(port));
}
+
+ userCombo.setText(newLocation.getUsername());
+ // passwordText.setText(newLocation.xxx);
+ hostCombo.setText(newLocation.getHost());
+ } catch (CVSException e) {
+ CVSUIPlugin.log(e);
}
}
- updateWidgetEnablements();
}
+ updateWidgetEnablements();
};
Group g = createGroup(composite, CVSUIMessages.ConfigurationWizardMainPage_Location_1);
@@ -256,11 +257,7 @@ public class ConfigurationWizardMainPage extends CVSWizardPage {
validateButton = new Button(validateButtonTabGroup, SWT.CHECK);
validateButton.setText(CVSUIMessages.ConfigurationWizardAutoconnectPage_validate);
- validateButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event e) {
- validate = validateButton.getSelection();
- }
- });
+ validateButton.addListener(SWT.Selection, e -> validate = validateButton.getSelection());
}
allowCachingButton = new Button(composite, SWT.CHECK);
@@ -269,6 +266,7 @@ public class ConfigurationWizardMainPage extends CVSWizardPage {
data.horizontalSpan = 2;
allowCachingButton.setLayoutData(data);
allowCachingButton.addSelectionListener(new SelectionAdapter() {
+ @Override
public void widgetSelected(SelectionEvent e) {
allowCaching = allowCachingButton.getSelection();
}
@@ -560,6 +558,7 @@ public class ConfigurationWizardMainPage extends CVSWizardPage {
public boolean getValidate() {
return validate;
}
+ @Override
public void setVisible(boolean visible) {
super.setVisible(visible);
if (visible) {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ActionDelegateWrapper.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ActionDelegateWrapper.java
index a9b6ea791..44dcd3696 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ActionDelegateWrapper.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ActionDelegateWrapper.java
@@ -16,8 +16,6 @@ package org.eclipse.team.internal.ui.synchronize;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
import org.eclipse.ui.*;
@@ -62,12 +60,8 @@ public class ActionDelegateWrapper extends Action implements ISelectionChangedLi
*/
protected void initialize(final ISynchronizePageConfiguration configuration) {
configuration.getSite().getSelectionProvider().addSelectionChangedListener(this);
- configuration.getPage().getViewer().getControl().addDisposeListener(new DisposeListener() {
- @Override
- public void widgetDisposed(DisposeEvent e) {
- configuration.getSite().getSelectionProvider().removeSelectionChangedListener(ActionDelegateWrapper.this);
- }
- });
+ configuration.getPage().getViewer().getControl().addDisposeListener(e -> configuration.getSite()
+ .getSelectionProvider().removeSelectionChangedListener(ActionDelegateWrapper.this));
}
/* (non-Javadoc)
diff --git a/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/ui/MessageLine.java b/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/ui/MessageLine.java
index c38672d04..a22427702 100644
--- a/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/ui/MessageLine.java
+++ b/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/ui/MessageLine.java
@@ -15,8 +15,6 @@ package org.eclipse.compare.examples.xml.ui;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CLabel;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.widgets.Composite;
@@ -117,12 +115,7 @@ public class MessageLine extends CLabel {
} else {
if (fErrorColor == null) {
fErrorColor= new Color(getDisplay(), fErrorRGB);
- addDisposeListener(new DisposeListener() {
- @Override
- public void widgetDisposed(DisposeEvent e) {
- fErrorColor.dispose();
- }
- });
+ addDisposeListener(e -> fErrorColor.dispose());
}
setForeground(fErrorColor);
setText(message);
diff --git a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/FileSystemMainPage.java b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/FileSystemMainPage.java
index eb4160316..fb980c41b 100644
--- a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/FileSystemMainPage.java
+++ b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/FileSystemMainPage.java
@@ -30,9 +30,7 @@ import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.DirectoryDialog;
-import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Text;
import org.eclipse.team.examples.filesystem.Policy;
@@ -216,11 +214,9 @@ public class FileSystemMainPage extends WizardPage {
locationCombo = createEditableCombo(composite);
locationCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- locationCombo.addListener(SWT.Modify, new Listener() {
- public void handleEvent(Event e) {
- location = ((Combo)e.widget).getText();
- FileSystemMainPage.this.validateFields();
- }
+ locationCombo.addListener(SWT.Modify, e -> {
+ location = ((Combo)e.widget).getText();
+ FileSystemMainPage.this.validateFields();
});
locationCombo.setFocus();
@@ -229,14 +225,12 @@ public class FileSystemMainPage extends WizardPage {
Button browse = new Button(composite, SWT.NULL);
browse.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
browse.setText(Policy.bind("FileSystemMainPage.browseDir")); //$NON-NLS-1$
- browse.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- DirectoryDialog d = new DirectoryDialog(getShell());
- String directory = d.open();
- if(directory!=null) {
- locationCombo.setText(directory);
- }
- }
+ browse.addListener(SWT.Selection, event -> {
+ DirectoryDialog d = new DirectoryDialog(getShell());
+ String directory = d.open();
+ if(directory!=null) {
+ locationCombo.setText(directory);
+ }
});
initializeValues();
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/BenchmarkUtils.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/BenchmarkUtils.java
index d4ea8aa94..db51b7d09 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/BenchmarkUtils.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/BenchmarkUtils.java
@@ -23,7 +23,6 @@ import java.io.OutputStream;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Comparator;
import java.util.List;
import java.util.zip.ZipException;
import java.util.zip.ZipFile;
@@ -537,18 +536,14 @@ public class BenchmarkUtils {
* folders each time we repeat the test.
*/
public static IResource[] filterResources(IResource[] resources) throws CoreException {
- List list = new ArrayList(resources.length);
+ List<IResource> list = new ArrayList<>(resources.length);
for (int i = 0; i < resources.length; ++i) {
if (isValidResource(resources[i])) list.add(resources[i]);
}
if (list.size() != resources.length) {
- resources = (IResource[]) list.toArray(new IResource[list.size()]);
+ resources = list.toArray(new IResource[list.size()]);
}
- Arrays.sort(resources, new Comparator() {
- public int compare(Object a, Object b) {
- return ((IResource) a).getName().compareTo(((IResource) b).getName());
- }
- });
+ Arrays.sort(resources, (a, b) -> a.getName().compareTo(b.getName()));
return resources;
}

Back to the top