List of usage examples for org.eclipse.jface.preference FieldEditor getPreferenceStore
public IPreferenceStore getPreferenceStore()
From source file:eu.numberfour.n4js.ui.preferences.ComponentPreferencesDetailsPart.java
License:Open Source License
/** * @return the preference stores associated with the field editors (they store their values in separate preference * stores)/* ww w .j a v a 2 s . c o m*/ */ public List<IPreferenceStore> getPreferenceStores() { List<IPreferenceStore> stores = new ArrayList<>(); for (FieldEditor field : fields) { stores.add(field.getPreferenceStore()); } return stores; }
From source file:mpj_express_debugger.JavaConnectTab.java
License:Open Source License
/** * Updates the connection argument field editors from the specified * configuration/*w w w. j ava2 s . c om*/ * * @param config * the config to load from */ private void updateConnectionFromConfig(ILaunchConfiguration config) { String id = null; try { id = config.getAttribute(IMPJLaunchConfigurationConstants.ATTR_MPJ_DEV, MPJExpressRunTime.getDefaultVMConnector().getIdentifier()); fConnectorCombo.setText(MPJExpressRunTime.getVMConnector(id).getName()); handleConnectorComboModified(); Map attrMap = config.getAttribute(IJavaLaunchConfigurationConstants.ATTR_CONNECT_MAP, (Map) null); if (attrMap == null) { return; } Iterator keys = attrMap.keySet().iterator(); while (keys.hasNext()) { String key = (String) keys.next(); Connector.Argument arg = (Connector.Argument) fArgumentMap.get(key); FieldEditor editor = (FieldEditor) fFieldEditorMap.get(key); if (arg != null && editor != null) { String value = (String) attrMap.get(key); if (arg instanceof Connector.StringArgument || 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 Connector.IntegerArgument) { editor.getPreferenceStore().setValue(key, new Integer(value).intValue()); } editor.load(); } } } catch (CoreException ce) { JDIDebugUIPlugin.log(ce); } }
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 om*/ 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
/** * Updates the connection argument field editors from the specified * configuration/* ww w . j a v a 2 s. co m*/ * * @param config * the config to load from */ private void updateConnectionFromConfig(ILaunchConfiguration config) { String id = null; try { id = config.getAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_CONNECTOR, JavaRuntime.getDefaultVMConnector().getIdentifier()); fConnectorCombo.setText(JavaRuntime.getVMConnector(id).getName()); handleConnectorComboModified(); Map attrMap = config.getAttribute(IJavaLaunchConfigurationConstants.ATTR_CONNECT_MAP, (Map) null); if (attrMap == null) { return; } Iterator keys = attrMap.keySet().iterator(); while (keys.hasNext()) { String key = (String) keys.next(); Connector.Argument arg = (Connector.Argument) fArgumentMap.get(key); FieldEditor editor = (FieldEditor) fFieldEditorMap.get(key); if (arg != null && editor != null) { String value = (String) attrMap.get(key); if (arg instanceof Connector.StringArgument || 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 Connector.IntegerArgument) { editor.getPreferenceStore().setValue(key, new Integer(value).intValue()); } editor.load(); } } } catch (CoreException ce) { JDIDebugUIPlugin.log(ce); } }
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);//w ww. j a va 2 s .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
/** * Updates the connection argument field editors from the specified configuration * @param config the config to load from *///from w w w. j a va 2 s .co m private void updateConnectionFromConfig(ILaunchConfiguration config) { String id = null; try { id = config.getAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_CONNECTOR, JavaRuntime.getDefaultVMConnector().getIdentifier()); fConnectorCombo.setText(JavaRuntime.getVMConnector(id).getName()); handleConnectorComboModified(); Map<String, String> attrMap = config.getAttribute(IJavaLaunchConfigurationConstants.ATTR_CONNECT_MAP, (Map<String, String>) null); if (attrMap == null) { return; } Iterator<String> keys = attrMap.keySet().iterator(); while (keys.hasNext()) { String key = keys.next(); Connector.Argument arg = fArgumentMap.get(key); FieldEditor editor = fFieldEditorMap.get(key); if (arg != null && editor != null) { String value = attrMap.get(key); if (arg instanceof Connector.StringArgument || 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 Connector.IntegerArgument) { editor.getPreferenceStore().setValue(key, new Integer(value).intValue()); } editor.load(); } } } catch (CoreException ce) { JDIDebugUIPlugin.log(ce); } }
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.jav a 2 s . c om*/ 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.bonitasoft.studio.preferences.pages.BonitaAppearancePreferencePage.java
License:Open Source License
@Override protected void initialize() { if (fieldEditors != null) { Iterator<FieldEditor> e = fieldEditors.iterator(); while (e.hasNext()) { FieldEditor pe = e.next(); pe.setPage(this); pe.setPropertyChangeListener(this); if (pe.getPreferenceStore() == null) { pe.setPreferenceStore(getPreferenceStore()); }/* w w w .j a v a 2 s .c om*/ pe.load(); } } }
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 w ww . j av a 2 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 a2s . 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); }