X-Git-Url: http://secure.phpeclipse.com diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/TodoTaskInputDialog.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/TodoTaskInputDialog.java index b95f478..0d6effb 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/TodoTaskInputDialog.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/TodoTaskInputDialog.java @@ -43,6 +43,7 @@ public class TodoTaskInputDialog extends StatusDialog { } private StringDialogField fNameDialogField; + private ComboDialogField fPriorityDialogField; private List fExistingNames; @@ -50,41 +51,49 @@ public class TodoTaskInputDialog extends StatusDialog { public TodoTaskInputDialog(Shell parent, TodoTask task, List existingEntries) { super(parent); - fExistingNames= new ArrayList(existingEntries.size()); - for (int i= 0; i < existingEntries.size(); i++) { - TodoTask curr= (TodoTask) existingEntries.get(i); + fExistingNames = new ArrayList(existingEntries.size()); + for (int i = 0; i < existingEntries.size(); i++) { + TodoTask curr = (TodoTask) existingEntries.get(i); if (!curr.equals(task)) { fExistingNames.add(curr.name); } } if (task == null) { - setTitle(PreferencesMessages.getString("TodoTaskInputDialog.new.title")); //$NON-NLS-1$ + setTitle(PreferencesMessages + .getString("TodoTaskInputDialog.new.title")); //$NON-NLS-1$ } else { - setTitle(PreferencesMessages.getString("TodoTaskInputDialog.edit.title")); //$NON-NLS-1$ + setTitle(PreferencesMessages + .getString("TodoTaskInputDialog.edit.title")); //$NON-NLS-1$ } - CompilerTodoTaskInputAdapter adapter= new CompilerTodoTaskInputAdapter(); + CompilerTodoTaskInputAdapter adapter = new CompilerTodoTaskInputAdapter(); - fNameDialogField= new StringDialogField(); - fNameDialogField.setLabelText(PreferencesMessages.getString("TodoTaskInputDialog.name.label")); //$NON-NLS-1$ + fNameDialogField = new StringDialogField(); + fNameDialogField.setLabelText(PreferencesMessages + .getString("TodoTaskInputDialog.name.label")); //$NON-NLS-1$ fNameDialogField.setDialogFieldListener(adapter); fNameDialogField.setText((task != null) ? task.name : ""); //$NON-NLS-1$ - String[] items= new String[] { - PreferencesMessages.getString("TodoTaskInputDialog.priority.high"), //$NON-NLS-1$ - PreferencesMessages.getString("TodoTaskInputDialog.priority.normal"), //$NON-NLS-1$ - PreferencesMessages.getString("TodoTaskInputDialog.priority.low") //$NON-NLS-1$ + String[] items = new String[] { + PreferencesMessages + .getString("TodoTaskInputDialog.priority.high"), //$NON-NLS-1$ + PreferencesMessages + .getString("TodoTaskInputDialog.priority.normal"), //$NON-NLS-1$ + PreferencesMessages + .getString("TodoTaskInputDialog.priority.low") //$NON-NLS-1$ }; - fPriorityDialogField= new ComboDialogField(SWT.READ_ONLY); - fPriorityDialogField.setLabelText(PreferencesMessages.getString("TodoTaskInputDialog.priority.label")); //$NON-NLS-1$ + fPriorityDialogField = new ComboDialogField(SWT.READ_ONLY); + fPriorityDialogField.setLabelText(PreferencesMessages + .getString("TodoTaskInputDialog.priority.label")); //$NON-NLS-1$ fPriorityDialogField.setItems(items); if (task != null) { if (JavaCore.COMPILER_TASK_PRIORITY_HIGH.equals(task.priority)) { fPriorityDialogField.selectItem(0); - } else if (JavaCore.COMPILER_TASK_PRIORITY_NORMAL.equals(task.priority)) { + } else if (JavaCore.COMPILER_TASK_PRIORITY_NORMAL + .equals(task.priority)) { fPriorityDialogField.selectItem(1); } else { fPriorityDialogField.selectItem(2); @@ -95,37 +104,38 @@ public class TodoTaskInputDialog extends StatusDialog { } public TodoTask getResult() { - TodoTask task= new TodoTask(); - task.name= fNameDialogField.getText().trim(); + TodoTask task = new TodoTask(); + task.name = fNameDialogField.getText().trim(); switch (fPriorityDialogField.getSelectionIndex()) { - case 0 : - task.priority= JavaCore.COMPILER_TASK_PRIORITY_HIGH; - break; - case 1 : - task.priority= JavaCore.COMPILER_TASK_PRIORITY_NORMAL; - break; - default : - task.priority= JavaCore.COMPILER_TASK_PRIORITY_LOW; - break; + case 0: + task.priority = JavaCore.COMPILER_TASK_PRIORITY_HIGH; + break; + case 1: + task.priority = JavaCore.COMPILER_TASK_PRIORITY_NORMAL; + break; + default: + task.priority = JavaCore.COMPILER_TASK_PRIORITY_LOW; + break; } return task; } protected Control createDialogArea(Composite parent) { - Composite composite= (Composite) super.createDialogArea(parent); + Composite composite = (Composite) super.createDialogArea(parent); - Composite inner= new Composite(composite, SWT.NONE); - GridLayout layout= new GridLayout(); - layout.marginHeight= 0; - layout.marginWidth= 0; - layout.numColumns= 2; + Composite inner = new Composite(composite, SWT.NONE); + GridLayout layout = new GridLayout(); + layout.marginHeight = 0; + layout.marginWidth = 0; + layout.numColumns = 2; inner.setLayout(layout); fNameDialogField.doFillIntoGrid(inner, 2); fPriorityDialogField.doFillIntoGrid(inner, 2); LayoutUtil.setHorizontalGrabbing(fNameDialogField.getTextControl(null)); - LayoutUtil.setWidthHint(fNameDialogField.getTextControl(null), convertWidthInCharsToPixels(45)); + LayoutUtil.setWidthHint(fNameDialogField.getTextControl(null), + convertWidthInCharsToPixels(45)); fNameDialogField.postSetFocusOnDialogField(parent.getDisplay()); @@ -134,17 +144,23 @@ public class TodoTaskInputDialog extends StatusDialog { } private void doValidation() { - StatusInfo status= new StatusInfo(); - String newText= fNameDialogField.getText(); + StatusInfo status = new StatusInfo(); + String newText = fNameDialogField.getText(); if (newText.length() == 0) { - status.setError(PreferencesMessages.getString("TodoTaskInputDialog.error.enterName")); //$NON-NLS-1$ + status.setError(PreferencesMessages + .getString("TodoTaskInputDialog.error.enterName")); //$NON-NLS-1$ } else { if (newText.indexOf(',') != -1) { - status.setError(PreferencesMessages.getString("TodoTaskInputDialog.error.comma")); //$NON-NLS-1$ + status.setError(PreferencesMessages + .getString("TodoTaskInputDialog.error.comma")); //$NON-NLS-1$ } else if (fExistingNames.contains(newText)) { - status.setError(PreferencesMessages.getString("TodoTaskInputDialog.error.entryExists")); //$NON-NLS-1$ - } else if (Character.isWhitespace(newText.charAt(0)) || Character.isWhitespace(newText.charAt(newText.length() - 1))) { - status.setError(PreferencesMessages.getString("TodoTaskInputDialog.error.noSpace")); //$NON-NLS-1$ + status.setError(PreferencesMessages + .getString("TodoTaskInputDialog.error.entryExists")); //$NON-NLS-1$ + } else if (Character.isWhitespace(newText.charAt(0)) + || Character.isWhitespace(newText + .charAt(newText.length() - 1))) { + status.setError(PreferencesMessages + .getString("TodoTaskInputDialog.error.noSpace")); //$NON-NLS-1$ } } updateStatus(status); @@ -155,6 +171,7 @@ public class TodoTaskInputDialog extends StatusDialog { */ protected void configureShell(Shell newShell) { super.configureShell(newShell); - PlatformUI.getWorkbench().getHelpSystem().setHelp(newShell, IJavaHelpContextIds.TODO_TASK_INPUT_DIALOG); + PlatformUI.getWorkbench().getHelpSystem().setHelp(newShell, + IJavaHelpContextIds.TODO_TASK_INPUT_DIALOG); } }