From 3a0efdabdc98efcf81a6917cf53a460fe4809e25 Mon Sep 17 00:00:00 2001 From: David Dykstal Date: Tue, 6 Feb 2007 04:12:17 +0000 Subject: [PATCH] [api][171530] Add a setEditable to the SystemFilterStringEditPane hierarchy. --- .../DeveloperFilterStringEditPane.java | 13 +++++- .../ui/SystemFileFilterStringEditPane.java | 29 ++++++++++-- .../ui/widgets/SystemRemoteFolderCombo.java | 1 + .../ui/SystemProcessFilterStringEditPane.java | 20 +++++++++ .../ui/filters/SystemChangeFilterPane.java | 4 +- .../filters/SystemFilterStringEditPane.java | 44 +++++++++++++++---- 6 files changed, 95 insertions(+), 16 deletions(-) diff --git a/rse/examples/org.eclipse.rse.examples.tutorial/src/samples/subsystems/DeveloperFilterStringEditPane.java b/rse/examples/org.eclipse.rse.examples.tutorial/src/samples/subsystems/DeveloperFilterStringEditPane.java index 1a31ec23fc4..9bf1c4a25c6 100644 --- a/rse/examples/org.eclipse.rse.examples.tutorial/src/samples/subsystems/DeveloperFilterStringEditPane.java +++ b/rse/examples/org.eclipse.rse.examples.tutorial/src/samples/subsystems/DeveloperFilterStringEditPane.java @@ -99,6 +99,7 @@ public class DeveloperFilterStringEditPane extends SystemFilterStringEditPane { } } ); + setEditable(editable); return composite_prompts; } @@ -134,7 +135,17 @@ public class DeveloperFilterStringEditPane extends SystemFilterStringEditPane { textDevr.setText(inputFilterString.substring(idx+1)); } } - } + } + + /* (non-Javadoc) + * @see org.eclipse.rse.ui.filters.SystemFilterStringEditPane#setEditable(boolean) + */ + public void setEditable(boolean editable) { + super.setEditable(editable); + enable(textDevr, editable); + enable(textTeam, editable); + } + /** * Override of parent method. * This is called in the change filter dialog when the user selects "new", or selects another string. diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/SystemFileFilterStringEditPane.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/SystemFileFilterStringEditPane.java index c46b9851fb7..71a453396a8 100644 --- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/SystemFileFilterStringEditPane.java +++ b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/SystemFileFilterStringEditPane.java @@ -18,6 +18,7 @@ package org.eclipse.rse.files.ui; import java.util.Vector; +import org.eclipse.jface.viewers.CheckboxTableViewer; import org.eclipse.rse.core.SystemBasePlugin; import org.eclipse.rse.core.filters.ISystemFilter; import org.eclipse.rse.core.filters.ISystemFilterPoolManagerProvider; @@ -64,11 +65,13 @@ public class SystemFileFilterStringEditPane { // GUI widgets protected Button filesOnlyCheckBox; - //protected Button testButton; - protected Button subsetByFileNameRadioButton, subsetByFileTypesRadioButton; + protected Button subsetByFileNameRadioButton; + protected Button subsetByFileTypesRadioButton; protected Button selectTypesButton; - protected Label labelFile, labelTypes; - protected Text textFile, textTypes; + protected Label labelFile; + protected Label labelTypes; + protected Text textFile; + protected Text textTypes; protected SystemRemoteFolderCombo folderCombo; // limits protected int filterFileLength = 256; @@ -150,6 +153,23 @@ public class SystemFileFilterStringEditPane if (folderCombo != null) folderCombo.setTextLimit(max); } + + /* (non-Javadoc) + * @see org.eclipse.rse.ui.filters.SystemFilterStringEditPane#setEditable(boolean) + */ + public void setEditable(boolean editable) { + super.setEditable(editable); + enable(filesOnlyCheckBox, editable); + enable(subsetByFileNameRadioButton, editable); + enable(selectTypesButton, editable); + enable(labelFile, editable); + enable(textFile, editable); + enable(folderCombo, editable); + enable(subsetByFileTypesRadioButton, editable); + enable(labelTypes, editable); + enable(textTypes, editable); + } + /** * Existing strings are used to aid in uniqueness validation. */ @@ -304,6 +324,7 @@ public class SystemFileFilterStringEditPane selectTypesButton.addSelectionListener(this); filesOnlyCheckBox.addSelectionListener(this); + setEditable(editable); return composite_prompts; } private void updateGridData(Control widget, int gridColumns) diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/widgets/SystemRemoteFolderCombo.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/widgets/SystemRemoteFolderCombo.java index 3f872623d7a..18915341769 100644 --- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/widgets/SystemRemoteFolderCombo.java +++ b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/widgets/SystemRemoteFolderCombo.java @@ -271,6 +271,7 @@ public class SystemRemoteFolderCombo extends Composite implements ISystemCombo */ public void setEnabled(boolean enabled) { + folderLabel.setEnabled(enabled); folderCombo.setEnabled(enabled); browseButton.setEnabled(enabled); } diff --git a/rse/plugins/org.eclipse.rse.processes.ui/src/org/eclipse/rse/processes/ui/SystemProcessFilterStringEditPane.java b/rse/plugins/org.eclipse.rse.processes.ui/src/org/eclipse/rse/processes/ui/SystemProcessFilterStringEditPane.java index 4cefeadecdb..36c176301e0 100644 --- a/rse/plugins/org.eclipse.rse.processes.ui/src/org/eclipse/rse/processes/ui/SystemProcessFilterStringEditPane.java +++ b/rse/plugins/org.eclipse.rse.processes.ui/src/org/eclipse/rse/processes/ui/SystemProcessFilterStringEditPane.java @@ -111,6 +111,25 @@ public class SystemProcessFilterStringEditPane extends // INPUT/CONFIGURATION METHODS... // ------------------------------ + /* (non-Javadoc) + * @see org.eclipse.rse.ui.filters.SystemFilterStringEditPane#setEditable(boolean) + */ + public void setEditable(boolean editable) { + super.setEditable(editable); + enable(lblStatus, editable); + enable(lblExeName, editable); + enable(lblUserName, editable); + enable(lblGid, editable); + enable(txtExeName, editable); + enable(txtUserName, editable); + enable(txtGid, editable); + enable(lblMinVM, editable); + enable(lblMaxVM, editable); + enable(txtMinVM, editable); + enable(txtMaxVM, editable); + enable(chkBoxUnlimitedVM, editable); + } + /** * Call this to override the text limit for the filter name, from the default of 256. */ @@ -289,6 +308,7 @@ public class SystemProcessFilterStringEditPane extends chkBoxUnlimitedVM.addSelectionListener(this); + setEditable(editable); return composite_prompts; } diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/SystemChangeFilterPane.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/SystemChangeFilterPane.java index a6a8425de2b..fbf97432cf0 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/SystemChangeFilterPane.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/SystemChangeFilterPane.java @@ -565,8 +565,8 @@ public class SystemChangeFilterPane extends SystemBaseForm listView.setEnabled(false); if (strings.length > 0) editpane.setFilterString(strings[0], 0); - editPaneComposite.setEnabled(false); - //editpane.setEditable(false); +// editPaneComposite.setEnabled(false); + editpane.setEditable(false); setPageComplete(true); } else if (!getSupportsMultipleStrings()) diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/SystemFilterStringEditPane.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/SystemFilterStringEditPane.java index ad0e486ccd2..19d5cc6d324 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/SystemFilterStringEditPane.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/SystemFilterStringEditPane.java @@ -83,16 +83,18 @@ public class SystemFilterStringEditPane implements SelectionListener protected boolean newMode = true; protected boolean changeFilterMode = false; protected boolean ignoreChanges; - //protected boolean editable = true; + protected boolean editable = true; // default GUI protected Label labelString; protected Text textString; protected Button dlgTestButton; + // state protected SystemMessage errorMessage; protected boolean skipEventFiring; protected int currentSelectionIndex; + /** * Constructor for SystemFilterStringEditPane. @@ -328,20 +330,43 @@ public class SystemFilterStringEditPane implements SelectionListener System.out.println("Someone forgot to override processTest in SystemFilterStringEditPane!"); //$NON-NLS-1$ } - /* - * Set if the edit pane is not to be editable - * - public void setEditable(boolean editable) - { + /** + * Sets whether or not the edit pane is not to be editable. May be invoked + * atany time prior or after the creation of the controls. + * Subclasses should override and enable their own controls appropriately. + *

+ * Subclasses should call super to ensure that the "editable" flag is + * set properly. Controls which are not instantiated in this call will be ignored. + * @param editable true if the controls in this pane are to be editable. + * Usually set to true, but if the filter is not modifiable it will be + * set to false. + */ + public void setEditable(boolean editable) { this.editable = editable; - }*/ + enable(labelString, editable); + enable(textString, editable); + enable(dlgTestButton, editable); + } + + /** + * Set the enabled state of a particular control. + * @param control the control of which to set the state + * @param enabled the enabled state + */ + protected void enable(Control control, boolean enabled) { + if (!(control == null || control.isDisposed())) { + control.setEnabled(enabled); + } + } + /* * Return whether the edit pane is editable, as set by {@link #setEditable(boolean)} * + */ public boolean getEditable() { return editable; - }*/ + } // ------------------------------ // DATA EXTRACTION METHODS @@ -447,7 +472,8 @@ public class SystemFilterStringEditPane implements SelectionListener validateStringInput(); } } - ); + ); + setEditable(editable); return composite_prompts; } /**