List of usage examples for org.eclipse.jface.preference FieldEditor isValid
public boolean isValid()
From source file:org.eclipse.wb.swt.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 v a2 s.c o m */ protected void checkState() { boolean valid = true; m_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 (m_fields != null) { int size = m_fields.size(); for (int i = 0; i < size; i++) { FieldEditor editor = (FieldEditor) m_fields.get(i); valid = valid && editor.isValid(); if (!valid) { m_invalidFieldEditor = editor; break; } } } setValid(valid); }
From source file:org.eclipse.wst.jsdt.debug.internal.ui.launching.JavaScriptConnectTab.java
License:Open Source License
public void performApply(ILaunchConfigurationWorkingCopy configuration) { Connector connector = getSelectedConnector(); if (connector != null) { configuration.setAttribute(ILaunchConstants.CONNECTOR_ID, connector.id()); Entry entry = null;//from w w w.ja v a 2 s .c o m FieldEditor editor = null; String key = null; HashMap argmap = new HashMap(); Argument argument = null; for (Iterator iter = this.editormap.entrySet().iterator(); iter.hasNext();) { entry = (Entry) iter.next(); editor = (FieldEditor) entry.getValue(); if (!editor.isValid()) { return; } key = (String) entry.getKey(); argument = (Argument) connector.defaultArguments().get(key); if (argument == null) { continue; } editor.store(); if (argument instanceof StringArgument || argument instanceof SelectedArgument) { argmap.put(key, editor.getPreferenceStore().getString(key)); } else if (argument instanceof BooleanArgument) { argmap.put(key, Boolean.valueOf(editor.getPreferenceStore().getBoolean(key)).toString()); } else if (argument instanceof IntegerArgument) { argmap.put(key, new Integer(editor.getPreferenceStore().getInt(key)).toString()); } } configuration.setAttribute(ILaunchConstants.ARGUMENT_MAP, argmap); } else { configuration.removeAttribute(ILaunchConstants.ARGUMENT_MAP); configuration.removeAttribute(ILaunchConstants.CONNECTOR_ID); } }
From source file:org.rubypeople.rdt.debug.ui.launchConfigurations.RubyConnectTab.java
License:Open Source License
public void performApply(ILaunchConfigurationWorkingCopy config) { config.setAttribute(IRubyLaunchConfigurationConstants.ATTR_PROJECT_NAME, fProjText.getText().trim()); config.setAttribute(IRubyLaunchConfigurationConstants.ATTR_VM_CONNECTOR, getSelectedConnector().getIdentifier()); mapResources(config);// ww w . j a v a2 s. c om Map<String, Object> attrMap = new HashMap<String, Object>(fFieldEditorMap.size()); Iterator<String> keys = fFieldEditorMap.keySet().iterator(); while (keys.hasNext()) { String key = keys.next(); FieldEditor editor = (FieldEditor) fFieldEditorMap.get(key); if (!editor.isValid()) { return; } Object arg = (Object) fArgumentMap.get(key); editor.store(); if (arg instanceof String) { // || 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 Integer) { attrMap.put(key, new Integer(editor.getPreferenceStore().getInt(key)).toString()); } } config.setAttribute(IRubyLaunchConfigurationConstants.ATTR_CONNECT_MAP, attrMap); }
From source file:org.talend.core.prefs.ui.CorePreferencePage.java
License:Open Source License
@Override protected void checkState() { super.checkState(); int size = fields.size(); if (size > 0) { for (int i = 0; i < size; i++) { FieldEditor editor = fields.get(i); if (!editor.isValid()) { editor.setFocus();/*from w ww . ja va2s . com*/ } } } }
From source file:org.talend.designer.esb.runcontainer.preferences.FieldLayoutPreferencePage.java
License:Open Source License
/** * Recomputes the page's error state by calling <code>isValid</code> for every field editor. *//*from www. j a v a 2 s . c om*/ protected void checkState() { boolean valid = true; m_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 (m_fields != null) { int size = m_fields.size(); for (int i = 0; i < size; i++) { FieldEditor editor = m_fields.get(i); valid = valid && editor.isValid(); if (!valid) { m_invalidFieldEditor = editor; break; } } } setValid(true); }