List of usage examples for org.eclipse.jface.preference FieldEditor isValid
public boolean isValid()
From source file:com.ge.research.sadl.ui.preferences.ReasonerConfigurationDialog.java
License:Open Source License
private String getErrorMessages() { String messages = new String(); for (FieldEditor editor : editors) { if (!editor.isValid()) { String message = ((StringFieldEditor) editor).getErrorMessage(); if (messages.length() > 0) { messages += "; "; }/*from ww w. jav a2 s . c o m*/ messages += message; } } return messages; }
From source file:com.swtdesigner.FieldLayoutPreferencePage.java
License:Open Source License
/** * Recomputes the page's error state by calling <code>isValid</code> for * every field editor./*from w ww . java 2s . c o m*/ */ protected void checkState() { boolean valid = true; invalidFieldEditor = null; // The state can only be set to true if all // field editors contain a valid value. So we must check them all if (fields != null) { int size = fields.size(); for (int i = 0; i < size; i++) { FieldEditor editor = (FieldEditor) fields.get(i); valid = valid && editor.isValid(); if (!valid) { invalidFieldEditor = editor; break; } } } setValid(valid); }
From source file:mpj_express_debugger.JavaConnectTab.java
License:Open Source License
public void performApply(ILaunchConfigurationWorkingCopy config) { config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, fProjText.getText().trim()); config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_ALLOW_TERMINATE, fAllowTerminateButton.getSelection()); config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_CONNECTOR, getSelectedConnector().getIdentifier()); mapResources(config);/* w w w . j a v a 2s . c o m*/ Map attrMap = new HashMap(fFieldEditorMap.size()); Iterator keys = fFieldEditorMap.keySet().iterator(); while (keys.hasNext()) { String key = (String) keys.next(); FieldEditor editor = (FieldEditor) fFieldEditorMap.get(key); if (!editor.isValid()) { return; } Connector.Argument arg = (Connector.Argument) fArgumentMap.get(key); editor.store(); if (arg instanceof Connector.StringArgument || arg instanceof Connector.SelectedArgument) { attrMap.put(key, editor.getPreferenceStore().getString(key)); } else if (arg instanceof Connector.BooleanArgument) { attrMap.put(key, Boolean.valueOf(editor.getPreferenceStore().getBoolean(key)).toString()); } else if (arg instanceof Connector.IntegerArgument) { attrMap.put(key, new Integer(editor.getPreferenceStore().getInt(key)).toString()); } } config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_CONNECT_MAP, attrMap); }
From source file:mpj_express_debugger.JavaMPJConnectTab.java
License:Open Source License
public void performApply(ILaunchConfigurationWorkingCopy config) { config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, fProjText.getText().trim()); config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_ALLOW_TERMINATE, fAllowTerminateButton.getSelection()); config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_CONNECTOR, getSelectedConnector().getIdentifier()); mapResources(config);//from ww w.j a v a 2s . c o m System.out.println("Conector : " + getSelectedConnector().getIdentifier()); Map attrMap = new HashMap(fFieldEditorMap.size()); Iterator keys = fFieldEditorMap.keySet().iterator(); while (keys.hasNext()) { String key = (String) keys.next(); FieldEditor editor = (FieldEditor) fFieldEditorMap.get(key); if (!editor.isValid()) { return; } Connector.Argument arg = (Connector.Argument) fArgumentMap.get(key); editor.store(); System.out.println("Key:" + key + " <" + arg + ">"); if (arg instanceof Connector.StringArgument || arg instanceof Connector.SelectedArgument) { attrMap.put(key, editor.getPreferenceStore().getString(key)); } else if (arg instanceof Connector.BooleanArgument) { attrMap.put(key, Boolean.valueOf(editor.getPreferenceStore().getBoolean(key)).toString()); } else if (arg instanceof Connector.IntegerArgument) { attrMap.put(key, new Integer(editor.getPreferenceStore().getInt(key)).toString()); } } config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_CONNECT_MAP, attrMap); }
From source file:org.bc.eclipse.hadoop.debug.JavaRetryConnectTab.java
License:Open Source License
public void performApply(ILaunchConfigurationWorkingCopy config) { config.setAttribute("relaunchTerminate", fRelaunchTerminateButton.getSelection()); //$NON-NLS-1$ config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, fProjText.getText().trim()); config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_ALLOW_TERMINATE, fAllowTerminateButton.getSelection()); config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_CONNECTOR, getSelectedConnector().getIdentifier()); mapResources(config);/*from w ww . java2 s.c o m*/ Map<String, String> attrMap = new HashMap<String, String>(fFieldEditorMap.size()); Iterator<String> keys = fFieldEditorMap.keySet().iterator(); while (keys.hasNext()) { String key = keys.next(); FieldEditor editor = fFieldEditorMap.get(key); if (!editor.isValid()) { return; } Connector.Argument arg = fArgumentMap.get(key); editor.store(); if (arg instanceof Connector.StringArgument || arg instanceof Connector.SelectedArgument) { attrMap.put(key, editor.getPreferenceStore().getString(key)); } else if (arg instanceof Connector.BooleanArgument) { attrMap.put(key, Boolean.valueOf(editor.getPreferenceStore().getBoolean(key)).toString()); } else if (arg instanceof Connector.IntegerArgument) { attrMap.put(key, new Integer(editor.getPreferenceStore().getInt(key)).toString()); } } config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_CONNECT_MAP, attrMap); }
From source file:org.chromium.debug.ui.launcher.TabBase.java
License:Open Source License
private static void storeEditor(FieldEditor editor, String errorValue) { if (editor.isValid()) { editor.store();/*from ww w.ja v a2 s . c om*/ } else { editor.getPreferenceStore().setValue(editor.getPreferenceName(), errorValue); } }
From source file:org.eclipse.jdt.debug.ui.launchConfigurations.JavaConnectTab.java
License:Open Source License
public void performApply(ILaunchConfigurationWorkingCopy config) { config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, fProjText.getText().trim()); config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_ALLOW_TERMINATE, fAllowTerminateButton.getSelection()); config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_CONNECTOR, getSelectedConnector().getIdentifier()); mapResources(config);/*from w ww.ja v a 2 s .com*/ Map<String, String> attrMap = new HashMap<String, String>(fFieldEditorMap.size()); Iterator<String> keys = fFieldEditorMap.keySet().iterator(); while (keys.hasNext()) { String key = keys.next(); FieldEditor editor = fFieldEditorMap.get(key); if (!editor.isValid()) { return; } Connector.Argument arg = fArgumentMap.get(key); editor.store(); if (arg instanceof Connector.StringArgument || arg instanceof Connector.SelectedArgument) { attrMap.put(key, editor.getPreferenceStore().getString(key)); } else if (arg instanceof Connector.BooleanArgument) { attrMap.put(key, Boolean.valueOf(editor.getPreferenceStore().getBoolean(key)).toString()); } else if (arg instanceof Connector.IntegerArgument) { attrMap.put(key, new Integer(editor.getPreferenceStore().getInt(key)).toString()); } } config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_CONNECT_MAP, attrMap); }
From source file:org.eclipse.titan.designer.properties.pages.FieldEditorPropertyPage.java
License:Open Source License
@Override protected void checkState() { super.checkState(); boolean valid = true; if (editors != null) { int size = editors.size(); for (int i = 0; i < size; i++) { FieldEditor editor = editors.get(i); valid = valid && editor.isValid(); if (!valid) { break; }/*from ww w.j a va2 s . co m*/ } } setValid(valid); }
From source file:org.eclipse.titan.executor.properties.FieldEditorPropertyPage.java
License:Open Source License
@Override protected void checkState() { super.checkState(); boolean valid = true; if (editors != null) { for (FieldEditor editor : editors) { valid = valid && editor.isValid(); if (!valid) { break; }// ww w . ja v a2s . c o m } } setValid(valid); }
From source file:org.eclipse.wb.core.controls.jface.preference.FieldLayoutPreferencePage.java
License:Open Source License
/** * Recomputes the page's error state by calling <code>isValid</code> for every field editor. */// w ww . j a va 2s. co m protected void checkState() { boolean valid = true; invalidFieldEditor = null; // The state can only be set to true if all field editors contain a valid value. // So we must check them all. for (FieldEditor fieldEditor : fields) { valid = valid && fieldEditor.isValid(); if (!valid) { invalidFieldEditor = fieldEditor; break; } } }