List of usage examples for org.eclipse.jface.preference FieldEditor getPreferenceStore
public IPreferenceStore getPreferenceStore()
From source file:org.eclipse.titan.designer.properties.pages.FieldEditorPropertyPage.java
License:Open Source License
/** * The field editor preference page implementation of this * <code>PreferencePage</code> method saves all field editors by calling * <code>FieldEditor.store</code>. Note that this method does not save * the preference store itself; it just stores the values back into the * preference store./* w w w .j av a 2 s . c o m*/ * * @see FieldEditor#store() */ @Override public boolean performOk() { if (editors != null) { Iterator<FieldEditor> e = editors.iterator(); while (e.hasNext()) { FieldEditor pe = e.next(); pe.store(); pe.getPreferenceStore().setToDefault(pe.getPreferenceName()); } } super.performOk(); return true; }
From source file:org.eclipse.wst.jsdt.debug.internal.ui.launching.JavaScriptConnectTab.java
License:Open Source License
public void initializeFrom(ILaunchConfiguration configuration) { try {//ww w . java2s . co m String connectorid = configuration.getAttribute(ILaunchConstants.CONNECTOR_ID, (String) null); if (connectorid != null) { Connector connector = JavaScriptDebugPlugin.getConnectionsManager().getConnector(connectorid); if (connector != null) { int idx = this.connectorcombo.indexOf(connector.name()); if (idx > -1) { this.connectorcombo.select(idx); handleConnectorSelected(); Map argmap = configuration.getAttribute(ILaunchConstants.ARGUMENT_MAP, (Map) null); if (argmap != null) { Entry entry = null; Argument argument = null; String key = null; FieldEditor editor = null; for (Iterator iter = argmap.entrySet().iterator(); iter.hasNext();) { entry = (Entry) iter.next(); key = (String) entry.getKey(); argument = (Argument) connector.defaultArguments().get(key); editor = (FieldEditor) this.editormap.get(key); if (argument != null && editor != null) { String value = (String) argmap.get(key); if (argument instanceof StringArgument || argument instanceof SelectedArgument) { editor.getPreferenceStore().setValue(key, value); } else if (argument instanceof BooleanArgument) { editor.getPreferenceStore().setValue(key, Boolean.valueOf(value).booleanValue()); } else if (argument instanceof IntegerArgument) { editor.getPreferenceStore().setValue(key, new Integer(value).intValue()); } editor.load(); } } } } else { this.connectorcombo.select(0); handleConnectorSelected(); } } } } catch (CoreException ce) { //ignore } }
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 ww w .ja v a2 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
/** * Updates the connection argument field editors from the specified * configuration//from ww w .j a v a 2 s. c o m * * @param config * the config to load from */ private void updateConnectionFromConfig(ILaunchConfiguration config) { String id = null; try { id = config.getAttribute(IRubyLaunchConfigurationConstants.ATTR_VM_CONNECTOR, RubyRuntime.getDefaultVMConnector().getIdentifier()); fConnectorCombo.setText(RubyRuntime.getVMConnector(id).getName()); handleConnectorComboModified(); Map<String, Object> attrMap = config.getAttribute(IRubyLaunchConfigurationConstants.ATTR_CONNECT_MAP, (Map) null); if (attrMap == null) { return; } Iterator<String> keys = attrMap.keySet().iterator(); while (keys.hasNext()) { String key = keys.next(); Object arg = fArgumentMap.get(key); FieldEditor editor = (FieldEditor) fFieldEditorMap.get(key); if (arg != null && editor != null) { String value = (String) attrMap.get(key); if (arg instanceof String) { // || arg instanceof Connector.SelectedArgument) { editor.getPreferenceStore().setValue(key, value); // } else if (arg instanceof Connector.BooleanArgument) { // editor.getPreferenceStore().setValue(key, // Boolean.valueOf(value).booleanValue()); } else if (arg instanceof Integer) { editor.getPreferenceStore().setValue(key, new Integer(value).intValue()); } editor.load(); } } } catch (CoreException ce) { RdtDebugUiPlugin.log(ce); } }
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);/* w w w . j av 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); }