Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/MultipleInputDialog.java')
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/MultipleInputDialog.java46
1 files changed, 29 insertions, 17 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/MultipleInputDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/MultipleInputDialog.java
index 640ec2f2a..d02ea8404 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/MultipleInputDialog.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/MultipleInputDialog.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2012 IBM Corporation and others.
+ * Copyright (c) 2003, 2013 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -14,7 +14,6 @@ package org.eclipse.debug.internal.ui;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -48,10 +47,10 @@ public class MultipleInputDialog extends Dialog {
protected Composite panel;
- protected List fieldList = new ArrayList();
- protected List controlList = new ArrayList();
- protected List validators = new ArrayList();
- protected Map valueMap = new HashMap();
+ protected List<FieldSummary> fieldList = new ArrayList<FieldSummary>();
+ protected List<Text> controlList = new ArrayList<Text>();
+ protected List<Validator> validators = new ArrayList<Validator>();
+ protected Map<Object, String> valueMap = new HashMap<Object, String>();
private String title;
@@ -66,6 +65,7 @@ public class MultipleInputDialog extends Dialog {
/* (non-Javadoc)
* @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
*/
+ @Override
protected void configureShell(Shell shell) {
super.configureShell(shell);
if (title != null) {
@@ -77,6 +77,7 @@ public class MultipleInputDialog extends Dialog {
/* (non-Javadoc)
* @see org.eclipse.jface.dialogs.Dialog#createButtonBar(org.eclipse.swt.widgets.Composite)
*/
+ @Override
protected Control createButtonBar(Composite parent) {
Control bar = super.createButtonBar(parent);
validateFields();
@@ -86,6 +87,7 @@ public class MultipleInputDialog extends Dialog {
/* (non-Javadoc)
* @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
*/
+ @Override
protected Control createDialogArea(Composite parent) {
Composite container = (Composite)super.createDialogArea(parent);
container.setLayout(new GridLayout(2, false));
@@ -95,9 +97,7 @@ public class MultipleInputDialog extends Dialog {
GridLayout layout = new GridLayout(2, false);
panel.setLayout(layout);
panel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- for (Iterator i = fieldList.iterator(); i.hasNext();) {
- FieldSummary field = (FieldSummary)i.next();
+ for (FieldSummary field : fieldList) {
switch(field.type) {
case TEXT:
createTextField(field.name, field.initialValue, field.allowsEmpty);
@@ -111,6 +111,8 @@ public class MultipleInputDialog extends Dialog {
case MULTILINE_VARIABLE:
createMultilineVariablesField(field.name, field.initialValue, field.allowsEmpty);
break;
+ default:
+ break;
}
}
@@ -150,11 +152,13 @@ public class MultipleInputDialog extends Dialog {
if (!allowEmpty) {
validators.add(new Validator() {
+ @Override
public boolean validate() {
return !text.getText().equals(IInternalDebugCoreConstants.EMPTY_STRING);
}
});
text.addModifyListener(new ModifyListener() {
+ @Override
public void modifyText(ModifyEvent e) {
validateFields();
}
@@ -191,12 +195,14 @@ public class MultipleInputDialog extends Dialog {
if (!allowEmpty) {
validators.add(new Validator() {
+ @Override
public boolean validate() {
return !text.getText().equals(IInternalDebugCoreConstants.EMPTY_STRING);
}
});
text.addModifyListener(new ModifyListener() {
+ @Override
public void modifyText(ModifyEvent e) {
validateFields();
}
@@ -205,6 +211,7 @@ public class MultipleInputDialog extends Dialog {
Button button = createButton(comp, IDialogConstants.IGNORE_ID, DebugUIMessages.MultipleInputDialog_6, false);
button.addSelectionListener(new SelectionAdapter() {
+ @Override
public void widgetSelected(SelectionEvent e) {
DirectoryDialog dialog = new DirectoryDialog(getShell());
dialog.setMessage(DebugUIMessages.MultipleInputDialog_7);
@@ -255,12 +262,14 @@ public class MultipleInputDialog extends Dialog {
if (!allowEmpty) {
validators.add(new Validator() {
+ @Override
public boolean validate() {
return !text.getText().equals(IInternalDebugCoreConstants.EMPTY_STRING);
}
});
text.addModifyListener(new ModifyListener() {
+ @Override
public void modifyText(ModifyEvent e) {
validateFields();
}
@@ -269,6 +278,7 @@ public class MultipleInputDialog extends Dialog {
Button button = createButton(comp, IDialogConstants.IGNORE_ID, DebugUIMessages.MultipleInputDialog_8, false);
button.addSelectionListener(new SelectionAdapter() {
+ @Override
public void widgetSelected(SelectionEvent e) {
StringVariableSelectionDialog dialog = new StringVariableSelectionDialog(getShell());
int code = dialog.open();
@@ -301,7 +311,8 @@ public class MultipleInputDialog extends Dialog {
text.setData(FIELD_NAME, labelText);
text.addTraverseListener(new TraverseListener () {
- public void keyTraversed(TraverseEvent e) {
+ @Override
+ public void keyTraversed(TraverseEvent e) {
if(e.detail == SWT.TRAVERSE_RETURN && e.stateMask == SWT.SHIFT) {
e.doit = true;
}
@@ -317,12 +328,14 @@ public class MultipleInputDialog extends Dialog {
if (!allowEmpty) {
validators.add(new Validator() {
+ @Override
public boolean validate() {
return !text.getText().equals(IInternalDebugCoreConstants.EMPTY_STRING);
}
});
text.addModifyListener(new ModifyListener() {
+ @Override
public void modifyText(ModifyEvent e) {
validateFields();
}
@@ -336,6 +349,7 @@ public class MultipleInputDialog extends Dialog {
Button button = createButton(comp, IDialogConstants.IGNORE_ID, DebugUIMessages.MultipleInputDialog_8, false);
button.addSelectionListener(new SelectionAdapter() {
+ @Override
public void widgetSelected(SelectionEvent e) {
StringVariableSelectionDialog dialog = new StringVariableSelectionDialog(getShell());
int code = dialog.open();
@@ -354,12 +368,10 @@ public class MultipleInputDialog extends Dialog {
/* (non-Javadoc)
* @see org.eclipse.jface.dialogs.Dialog#okPressed()
*/
+ @Override
protected void okPressed() {
- for (Iterator i = controlList.iterator(); i.hasNext(); ) {
- Control control = (Control)i.next();
- if (control instanceof Text) {
- valueMap.put(control.getData(FIELD_NAME), ((Text)control).getText());
- }
+ for (Text control : controlList) {
+ valueMap.put(control.getData(FIELD_NAME), control.getText());
}
controlList = null;
super.okPressed();
@@ -369,6 +381,7 @@ public class MultipleInputDialog extends Dialog {
/* (non-Javadoc)
* @see org.eclipse.jface.window.Window#open()
*/
+ @Override
public int open() {
applyDialogFont(panel);
return super.open();
@@ -383,8 +396,7 @@ public class MultipleInputDialog extends Dialog {
}
public void validateFields() {
- for(Iterator i = validators.iterator(); i.hasNext(); ) {
- Validator validator = (Validator) i.next();
+ for (Validator validator : validators) {
if (!validator.validate()) {
getButton(IDialogConstants.OK_ID).setEnabled(false);
return;

Back to the top