1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-02 06:35:28 +02:00

[cleanup] Organize Imports to fix build error

This commit is contained in:
Martin Oberhuber 2008-04-07 10:53:56 +00:00
parent 8cc3b1ed8e
commit 3352ce19f1

View file

@ -1,15 +1,15 @@
/********************************************************************************
* Copyright (c) 2005, 2007 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
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
*
* Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
*
* Contributors:
* Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin
* David McKnight (IBM) - [216252] [api][nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible
@ -28,6 +28,7 @@ import org.eclipse.rse.internal.processes.ui.ProcessesPlugin;
import org.eclipse.rse.internal.processes.ui.SystemProcessesResources;
import org.eclipse.rse.internal.processes.ui.view.SystemProcessStatesContentProvider;
import org.eclipse.rse.internal.ui.SystemResources;
import org.eclipse.rse.internal.ui.actions.SystemTestFilterStringAction;
import org.eclipse.rse.services.clientserver.messages.SimpleSystemMessage;
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
import org.eclipse.rse.services.clientserver.processes.HostProcessFilterImpl;
@ -35,7 +36,6 @@ import org.eclipse.rse.services.clientserver.processes.ISystemProcessRemoteConst
import org.eclipse.rse.subsystems.processes.core.subsystem.IRemoteProcessSubSystemConfiguration;
import org.eclipse.rse.ui.SystemBasePlugin;
import org.eclipse.rse.ui.SystemWidgetHelpers;
import org.eclipse.rse.ui.actions.SystemTestFilterStringAction;
import org.eclipse.rse.ui.filters.SystemFilterStringEditPane;
import org.eclipse.rse.ui.messages.SystemMessageDialog;
import org.eclipse.rse.ui.validators.ValidatorIntegerInput;
@ -61,24 +61,24 @@ public class SystemProcessFilterStringEditPane extends
SystemFilterStringEditPane
{
// GUI widgets
protected Label lblStatus;
protected CheckboxTableViewer chkStatus;
protected CheckboxTableViewer chkStatus;
protected Label lblExeName, lblUserName, lblGid;
protected Text txtExeName, txtUserName, txtGid;
protected Label lblMinVM, lblMaxVM;
protected Text txtMinVM, txtMaxVM;
protected Button chkBoxUnlimitedVM;
// limits
protected int gidLimit = Integer.MAX_VALUE;
protected long vmMaxValue = Long.MAX_VALUE;
protected int exeNameLength = 256;
protected int userNameLength = 256;
// validators
protected ValidatorLongRangeInput vmRangeValidator = new ValidatorLongRangeInput(0, vmMaxValue);
protected ValidatorLongRangeInput vmRangeValidator = new ValidatorLongRangeInput(0, vmMaxValue);
protected ValidatorIntegerRangeInput gidValidator = new ValidatorIntegerRangeInput(0, gidLimit);
protected ValidatorSpecialChar nameValidator = new ValidatorSpecialChar(" \t|", true); //$NON-NLS-1$
@ -87,12 +87,12 @@ public class SystemProcessFilterStringEditPane extends
// state
protected boolean noValidation = false;
protected boolean callerInstanceOfWizardPage, callerInstanceOfSystemPromptDialog;
protected boolean callerInstanceOfWizardPage, callerInstanceOfSystemPromptDialog;
protected boolean skipUniquenessChecking;
protected boolean calledFromVerify;
protected boolean calledFromVerify;
protected boolean dontStealFocus;
protected IRemoteProcessSubSystemConfiguration inputSubsystemConfiguration = null;
// actions
protected SystemTestFilterStringAction testAction = null;
@ -104,16 +104,16 @@ public class SystemProcessFilterStringEditPane extends
* Constructor for SystemProcessFilterStringEditPane.
* @param shell
*/
public SystemProcessFilterStringEditPane(Shell shell)
public SystemProcessFilterStringEditPane(Shell shell)
{
super(shell);
((ValidatorIntegerInput)gidValidator).setBlankAllowed(true);
}
// ------------------------------
// INPUT/CONFIGURATION METHODS...
// ------------------------------
/* (non-Javadoc)
* @see org.eclipse.rse.ui.filters.SystemFilterStringEditPane#setEditable(boolean)
*/
@ -132,7 +132,7 @@ public class SystemProcessFilterStringEditPane extends
enable(txtMaxVM, editable);
enable(chkBoxUnlimitedVM, editable);
}
/**
* Call this to override the text limit for the filter name, from the default of 256.
*/
@ -153,13 +153,13 @@ public class SystemProcessFilterStringEditPane extends
}
/**
* Existing strings are used to aid in uniqueness validation.
*/
*/
public void setExistingStrings(String[] existingStrings)
{
this.inputFilterStrings = existingStrings;
}
}
// ------------------------------
// ------------------------------
// LIFECYCLE METHODS...
// ------------------------------
@ -168,13 +168,13 @@ public class SystemProcessFilterStringEditPane extends
* @param parent
* @return Control
*/
public Control createContents(Composite parent)
{
Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, 1);
public Control createContents(Composite parent)
{
Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, 1);
int gridColumns = 2;
Composite sub_prompts1 = SystemWidgetHelpers.createComposite(composite_prompts, gridColumns);
// Exe name prompt
Composite sub_prompts1 = SystemWidgetHelpers.createComposite(composite_prompts, gridColumns);
// Exe name prompt
lblExeName = SystemWidgetHelpers.createLabel(sub_prompts1, SystemProcessesResources.RESID_PROCESSFILTERSTRING_EXENAME_LABEL);
lblExeName.setToolTipText(SystemProcessesResources.RESID_PROCESSFILTERSTRING_EXENAME_TOOLTIP);
txtExeName = SystemWidgetHelpers.createTextField(sub_prompts1, null);
@ -184,7 +184,7 @@ public class SystemProcessFilterStringEditPane extends
updateGridData(txtExeName, gridColumns-1);
txtExeName.setText("*"); //$NON-NLS-1$
// User name prompt
// User name prompt
lblUserName = SystemWidgetHelpers.createLabel(sub_prompts1, SystemProcessesResources.RESID_PROCESSFILTERSTRING_USERNAME_LABEL);
lblUserName.setToolTipText(SystemProcessesResources.RESID_PROCESSFILTERSTRING_USERNAME_TOOLTIP);
txtUserName = SystemWidgetHelpers.createTextField(sub_prompts1, null);
@ -193,8 +193,8 @@ public class SystemProcessFilterStringEditPane extends
SystemWidgetHelpers.setHelp(txtUserName, ProcessesPlugin.HELPPREFIX+"pfsd0002"); //$NON-NLS-1$
updateGridData(txtUserName, gridColumns-1);
txtUserName.setText("*"); //$NON-NLS-1$
// Group ID prompt
// Group ID prompt
lblGid = SystemWidgetHelpers.createLabel(sub_prompts1, SystemProcessesResources.RESID_PROCESSFILTERSTRING_GID_LABEL);
lblGid.setToolTipText(SystemProcessesResources.RESID_PROCESSFILTERSTRING_GID_TOOLTIP);
txtGid = SystemWidgetHelpers.createTextField(sub_prompts1, null);
@ -203,7 +203,7 @@ public class SystemProcessFilterStringEditPane extends
SystemWidgetHelpers.setHelp(txtGid, ProcessesPlugin.HELPPREFIX+"pfsd0003"); //$NON-NLS-1$
updateGridData(txtGid, gridColumns-1);
txtGid.setText("*"); //$NON-NLS-1$
// status checkbox table
lblStatus = SystemWidgetHelpers.createLabel(sub_prompts1, SystemProcessesResources.RESID_PROCESSFILTERSTRING_STATUS_LABEL);
lblStatus.setToolTipText(SystemProcessesResources.RESID_PROCESSFILTERSTRING_STATUS_TOOLTIP);
@ -217,7 +217,7 @@ public class SystemProcessFilterStringEditPane extends
SystemWidgetHelpers.setHelp(chkStatus.getControl(), ProcessesPlugin.HELPPREFIX+"pfsd0004"); //$NON-NLS-1$
SystemWidgetHelpers.createLabel(sub_prompts1, " "); //$NON-NLS-1$
addSelectionButtons(sub_prompts1);
// Range prompt
Composite subsub = SystemWidgetHelpers.createComposite(sub_prompts1, gridColumns, 3, false, null, -1, -1);
lblMinVM = SystemWidgetHelpers.createLabel(subsub, SystemProcessesResources.RESID_PROCESSFILTERSTRING_MINVM_LABEL);
@ -228,7 +228,7 @@ public class SystemProcessFilterStringEditPane extends
SystemWidgetHelpers.setHelp(txtMinVM, ProcessesPlugin.HELPPREFIX+"pfsd0005"); //$NON-NLS-1$
txtMinVM.setText("0"); //$NON-NLS-1$
SystemWidgetHelpers.createLabel(subsub, " "); //$NON-NLS-1$
lblMaxVM = SystemWidgetHelpers.createLabel(subsub, SystemProcessesResources.RESID_PROCESSFILTERSTRING_MAXVM_LABEL);
lblMaxVM.setToolTipText(SystemProcessesResources.RESID_PROCESSFILTERSTRING_MAXVM_TOOLTIP);
txtMaxVM = SystemWidgetHelpers.createTextField(subsub, null);
@ -237,7 +237,7 @@ public class SystemProcessFilterStringEditPane extends
SystemWidgetHelpers.setHelp(txtMaxVM, ProcessesPlugin.HELPPREFIX+"pfsd0006"); //$NON-NLS-1$
txtMaxVM.setEnabled(false);
// Unlimited check box
// Unlimited check box
chkBoxUnlimitedVM = SystemWidgetHelpers.createCheckBox(subsub, 1, null,
SystemProcessesResources.RESID_PROCESSFILTERSTRING_UNLIMITED_LABEL, SystemProcessesResources.RESID_PROCESSFILTERSTRING_UNLIMITED_TOOLTIP);
SystemWidgetHelpers.setHelp(chkBoxUnlimitedVM, ProcessesPlugin.HELPPREFIX+"pfsd0007"); //$NON-NLS-1$
@ -249,16 +249,16 @@ public class SystemProcessFilterStringEditPane extends
else if (provider != null)
inputSubsystemConfiguration = (IRemoteProcessSubSystemConfiguration)provider;
IStructuredContentProvider p = new SystemProcessStatesContentProvider();
chkStatus.setContentProvider(p);
chkStatus.setInput(p.getElements(null));
txtExeName.setTextLimit(exeNameLength);
txtUserName.setTextLimit(userNameLength);
resetFields();
doInitializeFields();
txtUserName.setTextLimit(userNameLength);
resetFields();
doInitializeFields();
txtExeName.addModifyListener(
new ModifyListener() {
public void modifyText(ModifyEvent e) {
@ -308,18 +308,18 @@ public class SystemProcessFilterStringEditPane extends
}
}
);
chkBoxUnlimitedVM.addSelectionListener(this);
setEditable(editable);
return composite_prompts;
}
/**
* Add the selection and deselection buttons to the dialog.
* @param composite org.eclipse.swt.widgets.Composite
*/
private void addSelectionButtons(Composite composite)
private void addSelectionButtons(Composite composite)
{
Composite buttonComposite = new Composite(composite, SWT.RIGHT);
GridLayout layout = new GridLayout();
@ -331,8 +331,8 @@ public class SystemProcessFilterStringEditPane extends
composite.setData(data);
//Button selectButton = createButton(buttonComposite, IDialogConstants.SELECT_ALL_ID, WorkbenchMessages.getString("WizardTransferPage.selectAll"), false); //$NON-NLS-1$
Button selectButton = SystemWidgetHelpers.createPushButton(buttonComposite, null,
SystemResources.RESID_SELECTFILES_SELECTALL_BUTTON_ROOT_LABEL, SystemResources.RESID_SELECTFILES_SELECTALL_BUTTON_ROOT_TOOLTIP);
Button selectButton = SystemWidgetHelpers.createPushButton(buttonComposite, null,
SystemResources.RESID_SELECTFILES_SELECTALL_BUTTON_ROOT_LABEL, SystemResources.RESID_SELECTFILES_SELECTALL_BUTTON_ROOT_TOOLTIP);
SelectionListener listener = new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
@ -343,9 +343,9 @@ public class SystemProcessFilterStringEditPane extends
//Button deselectButton = createButton(buttonComposite, IDialogConstants.DESELECT_ALL_ID, WorkbenchMessages.getString("WizardTransferPage.deselectAll"), false); //$NON-NLS-1$
Button deselectButton = SystemWidgetHelpers.createPushButton(buttonComposite, null,
SystemResources.RESID_SELECTFILES_DESELECTALL_BUTTON_ROOT_LABEL, SystemResources.RESID_SELECTFILES_DESELECTALL_BUTTON_ROOT_TOOLTIP);
Button deselectButton = SystemWidgetHelpers.createPushButton(buttonComposite, null,
SystemResources.RESID_SELECTFILES_DESELECTALL_BUTTON_ROOT_LABEL, SystemResources.RESID_SELECTFILES_DESELECTALL_BUTTON_ROOT_TOOLTIP);
listener = new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
chkStatus.setAllChecked(false);
@ -353,23 +353,23 @@ public class SystemProcessFilterStringEditPane extends
};
deselectButton.addSelectionListener(listener);
}
private void updateGridData(Control widget, int gridColumns)
{
GridData data = (GridData)widget.getLayoutData();
data.horizontalSpan = gridColumns;
data.horizontalSpan = gridColumns;
data.grabExcessHorizontalSpace = false;
data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_BEGINNING;
data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_BEGINNING;
}
/**
* Return the control to recieve initial focus. Should be overridden if you override createContents
*/
public Control getInitialFocusControl()
{
return txtExeName;
}
}
/**
* Override of parent.
* Called after reset fields, at first create time or when input is reset to a non-null value.
@ -377,20 +377,20 @@ public class SystemProcessFilterStringEditPane extends
protected void doInitializeFields()
{
if (txtExeName == null) return;
if (inputFilterString != null)
{
HostProcessFilterImpl rffs = new HostProcessFilterImpl(inputFilterString);
String defaultExeName = rffs.getName();
txtExeName.setText((defaultExeName==null) ? "" : defaultExeName); //$NON-NLS-1$
String defaultUserName = rffs.getUsername();
String defaultUserName = rffs.getUsername();
txtUserName.setText((defaultUserName==null) ? "" : defaultUserName); //$NON-NLS-1$
String defaultGid = rffs.getGid();
txtGid.setText((defaultGid==null) ? "" : defaultGid); //$NON-NLS-1$
String defaultMinVM = rffs.getMinVM();
String defaultMinVM = rffs.getMinVM();
txtMinVM.setText((defaultMinVM==null) ? "" : defaultMinVM); //$NON-NLS-1$
String defaultMaxVM = rffs.getMaxVM();
String defaultMaxVM = rffs.getMaxVM();
if (defaultMaxVM.equals("-1")) //$NON-NLS-1$
{
txtMaxVM.setText(""); //$NON-NLS-1$
@ -404,9 +404,9 @@ public class SystemProcessFilterStringEditPane extends
chkBoxUnlimitedVM.setEnabled(false);
txtMaxVM.setText(defaultMaxVM);
}
chkStatus.setAllChecked(rffs.getAnyStatus());
String[] stateTypes = SystemProcessStatesContentProvider.getStates();
for (int i = 0; i < ISystemProcessRemoteConstants.ALL_STATES_STR.length; i++)
{
@ -444,26 +444,26 @@ public class SystemProcessFilterStringEditPane extends
{
if (txtExeName == null) return false;
else return true;
}
}
/**
* Completes processing of the wizard page or dialog. If this
* method returns true, the wizard/dialog will close;
* Completes processing of the wizard page or dialog. If this
* method returns true, the wizard/dialog will close;
* otherwise, it will stay active.
*
* @return error, if there is one
*/
public SystemMessage verify()
public SystemMessage verify()
{
errorMessage = null;
Control controlInError = null;
calledFromVerify = true;
skipEventFiring = true;
errorMessage = validateNameInput(txtExeName);
if (errorMessage != null)
controlInError = txtExeName;
errorMessage = validateNameInput(txtUserName);
if (errorMessage != null)
controlInError = txtUserName;
@ -471,15 +471,15 @@ public class SystemProcessFilterStringEditPane extends
errorMessage = validateGidInput();
if (errorMessage != null)
controlInError = txtGid;
errorMessage = validateMinVMInput();
if (errorMessage != null)
controlInError = txtMinVM;
if (errorMessage == null)
{
if (!chkBoxUnlimitedVM.getSelection())
{
{
errorMessage = validateMaxVMInput();
if (errorMessage == null)
{
@ -488,7 +488,7 @@ public class SystemProcessFilterStringEditPane extends
}
if (errorMessage != null)
controlInError = txtMaxVM;
}
if ((errorMessage == null) && (inputFilterStrings!=null) && !skipUniquenessChecking)
{
@ -498,10 +498,10 @@ public class SystemProcessFilterStringEditPane extends
notUnique = true;
if (notUnique)
{
errorMessage = new SimpleSystemMessage(ProcessesPlugin.PLUGIN_ID,
errorMessage = new SimpleSystemMessage(ProcessesPlugin.PLUGIN_ID,
"RSEF1007", //$NON-NLS-1$
IStatus.ERROR,
IStatus.ERROR,
NLS.bind(SystemProcessesResources.MSG_VALIDATE_FILEFILTERSTRING_NOTUNIQUE, currFilterString));
}
controlInError = txtExeName;
@ -512,15 +512,15 @@ public class SystemProcessFilterStringEditPane extends
if (!dontStealFocus && controlInError != null)
controlInError.setFocus();
}
calledFromVerify = false;
skipEventFiring = false;
fireChangeEvent(errorMessage);
return errorMessage;
}
/*
*
*
*/
private boolean containsFilterString(String newString)
{
@ -532,7 +532,7 @@ public class SystemProcessFilterStringEditPane extends
{
if (inputFilterStrings[idx].equals(newString))
return true;
}
}
}
return false;
}
@ -546,21 +546,21 @@ public class SystemProcessFilterStringEditPane extends
* If the <code>ISystemValidator</code> reports an error the error message is displayed
* in the Dialog's message line.
*/
protected SystemMessage validateNameInput(Text txt)
{
protected SystemMessage validateNameInput(Text txt)
{
if (noValidation || ignoreChanges)
return null;
errorMessage = null;
errorMessage = null;
if (nameValidator != null)
{
errorMessage = nameValidator.validate(txt.getText().trim());
{
errorMessage = nameValidator.validate(txt.getText().trim());
}
fireChangeEvent(errorMessage);
return errorMessage;
}
}
/**
* This hook method is called whenever the text changes in the input field.
@ -568,73 +568,73 @@ public class SystemProcessFilterStringEditPane extends
* If the <code>ISystemValidator</code> reports an error the error message is displayed
* in the Dialog's message line.
*/
protected SystemMessage validateGidInput()
protected SystemMessage validateGidInput()
{
if (noValidation || ignoreChanges)
return null;
errorMessage = null;
errorMessage = null;
if (gidValidator != null)
{
errorMessage = gidValidator.validate(txtGid.getText().trim());
{
errorMessage = gidValidator.validate(txtGid.getText().trim());
}
fireChangeEvent(errorMessage);
return errorMessage;
}
/**
* This hook method is called whenever the text changes in the input field.
* The default implementation delegates the request to an <code>ISystemValidator</code> object.
* If the <code>ISystemValidator</code> reports an error the error message is displayed
* in the Dialog's message line.
*/
protected SystemMessage validateMinVMInput()
{
protected SystemMessage validateMinVMInput()
{
if (noValidation || ignoreChanges)
return null;
errorMessage = null;
errorMessage = null;
if (vmRangeValidator != null)
{
errorMessage = vmRangeValidator.validate(txtMinVM.getText().trim());
errorMessage = vmRangeValidator.validate(txtMinVM.getText().trim());
}
fireChangeEvent(errorMessage);
return errorMessage;
}
/**
* This hook method is called whenever the text changes in the input field.
* The default implementation delegates the request to an <code>ISystemValidator</code> object.
* If the <code>ISystemValidator</code> reports an error the error message is displayed
* in the Dialog's message line.
*/
protected SystemMessage validateMaxVMInput()
{
protected SystemMessage validateMaxVMInput()
{
if (noValidation || ignoreChanges || chkBoxUnlimitedVM.getSelection())
return null;
errorMessage = null;
errorMessage = null;
if (vmRangeValidator != null)
{
errorMessage = vmRangeValidator.validate(txtMaxVM.getText().trim());
{
errorMessage = vmRangeValidator.validate(txtMaxVM.getText().trim());
}
fireChangeEvent(errorMessage);
return errorMessage;
}
/**
* This hook method is called whenever the text changes in the input field.
* The default implementation delegates the request to an <code>ISystemValidator</code> object.
* If the <code>ISystemValidator</code> reports an error the error message is displayed
* in the Dialog's message line.
*/
protected SystemMessage validateMinLessThanMax()
protected SystemMessage validateMinLessThanMax()
{
long minVM = 0;
long maxVM = 0;
@ -653,21 +653,21 @@ public class SystemProcessFilterStringEditPane extends
}
return null;
}
// ------------------------------
// ------------------------------
// DATA EXTRACTION METHODS
// ------------------------------
/**
* Get the filter string in its current form.
* Get the filter string in its current form.
* This should be overridden if createContents is overridden.
*/
public String getFilterString()
{
if (txtExeName == null)
return inputFilterString;
HostProcessFilterImpl rpfs = new HostProcessFilterImpl();
String exeName = txtExeName.getText().trim();
if (!exeName.equals("")) rpfs.setName(exeName); //$NON-NLS-1$
@ -689,7 +689,7 @@ public class SystemProcessFilterStringEditPane extends
String maxVM = txtMaxVM.getText().trim();
if (!maxVM.equals("")) rpfs.setMaxVM(maxVM); //$NON-NLS-1$
}
String[] stateStrings = SystemProcessStatesContentProvider.getStates();
for (int i = 0; i < ISystemProcessRemoteConstants.ALL_STATES_STR.length; i++)
{
@ -698,16 +698,16 @@ public class SystemProcessFilterStringEditPane extends
return rpfs.toString();
}
// ------------------
// ------------------
// EVENT LISTENERS...
// ------------------
/**
* User has selected something
*/
public void widgetSelected(SelectionEvent event)
{
Object src = event.getSource();
{
Object src = event.getSource();
dontStealFocus = true;
if (src == chkBoxUnlimitedVM)
{
@ -739,23 +739,23 @@ public class SystemProcessFilterStringEditPane extends
SystemBasePlugin.logWarning("Programming Error: input subsystem is not set"); //$NON-NLS-1$
return;
}
skipUniquenessChecking = true;
skipUniquenessChecking = true;
if (verify() == null)
{
SystemTestFilterStringAction testAction = new SystemTestFilterStringAction(getShell());
testAction.setSubSystem((ISubSystem)refProvider);
testAction.setFilterString(getFilterString());
try
try
{
testAction.run();
}
catch (Exception exc)
{
SystemMessage msg = SystemMessageDialog.getExceptionMessage(getShell(), exc);
fireChangeEvent(msg);
fireChangeEvent(msg);
}
}
skipUniquenessChecking = false;
}
skipUniquenessChecking = false;
}
}