/** * Initializes all field editors. */ protected void initialize() { Iterator<FieldEditor> i = fieldEditors.iterator(); while (i.hasNext()) { FieldEditor pe = i.next(); pe.setPage(this); pe.setPropertyChangeListener(this); pe.setPreferenceStore(getPreferenceStore()); pe.load(); } }
protected void updateFieldEditors(boolean enabled) { // TODO handle do not use project settings sets project settings to // default Composite parent = getFieldEditorParent(); Iterator<FieldEditor> it = editors.iterator(); while (it.hasNext()) { FieldEditor editor = it.next(); if (enabled) editor.load(); else editor.loadDefault(); editor.setEnabled(enabled, parent); } }
@Override public final void propertyChange(PropertyChangeEvent event) { if (event.getSource() instanceof FieldEditor) { FieldEditor fe = (FieldEditor) event.getSource(); internalStore.setValue(fe.getPreferenceName(), fe.getPreferenceStore().getDefaultString(fe.getPreferenceName())); fe.setPreferenceStore(internalStore); fe.store(); } super.propertyChange(event); }
/** * The field editor preference page implementation of an <code>IDialogPage</code> * method disposes of this page's controls and images. * Subclasses may override to release their own allocated SWT * resources, but must call <code>super.dispose</code>. */ public void dispose() { super.dispose(); Iterator<FieldEditor> i = fieldEditors.iterator(); while (i.hasNext()) { FieldEditor pe = i.next(); pe.setPage(null); pe.setPropertyChangeListener(null); pe.setPreferenceStore(null); } }
/** * Create a composite that contains entry fields specifying the workspace name * preference. * * @param composite the Composite the group is created in. */ private void createWindowTitleGroup(Composite composite) { Composite groupComposite = new Composite(composite, SWT.LEFT); GridLayout layout = new GridLayout(); layout.numColumns = 2; groupComposite.setLayout(layout); GridData gd = new GridData(); gd.horizontalAlignment = GridData.FILL; gd.grabExcessHorizontalSpace = true; groupComposite.setLayoutData(gd); workspaceName = new StringFieldEditor( IDEInternalPreferences.WORKSPACE_NAME, IDEWorkbenchMessages.IDEWorkspacePreference_workspaceName, groupComposite); workspaceName.setPreferenceStore(getIDEPreferenceStore()); workspaceName.load(); workspaceName.setPage(this); }
field.setPreferenceStore(store); field.loadDefault(); field.setPropertyChangeListener(this); fFieldEditorMap.put(key, field);
@Override public void loadDefault() { if (masterList != null) { int selectionIndex = masterList.getSelectionIndex(); super.loadDefault(); masterList.select(selectionIndex); doLoad(); } else { super.loadDefault(); } }
public void setEnabled(boolean enabled, Composite parent) { if (!useGroup) { super.setEnabled(enabled, parent); } for (int i = 0; i < radioButtons.length; i++) { radioButtons[i].setEnabled(enabled); } } }
/** * 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. * * @see FieldEditor#store() */ public boolean performOk() { if (fields != null) { Iterator e = fields.iterator(); while (e.hasNext()) { FieldEditor pe = (FieldEditor) e.next(); pe.store(); pe.setPresentsDefaultValue(false); } } return true; }
/** * Initializes the field editors to their values * @since 3.2 */ private void initFieldEditors() { FieldEditor editor; for(int i = 0; i < fFieldEditors.size(); i++) { editor = fFieldEditors.get(i); editor.setPreferenceStore(getPreferenceStore()); editor.load(); } fDeleteConfigs.setSelection( Platform.getPreferencesService().getBoolean(DebugPlugin.getUniqueIdentifier(), DebugPlugin.PREF_DELETE_CONFIGS_ON_PROJECT_DELETE, true, null)); //restore the tables' checked state String[] types = getPreferenceStore().getString(IInternalDebugUIConstants.PREF_FILTER_TYPE_LIST).split("\\,"); //$NON-NLS-1$ TableItem[] items = fTable.getItems(); ILaunchConfigurationType type; for(int i = 0; i < types.length; i++) { for(int j = 0; j < items.length; j++) { type = (ILaunchConfigurationType)items[j].getData(); if(type.getIdentifier().equals(types[i])) { items[j].setChecked(true); } } } }
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); 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); }
/** * 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. * * @see FieldEditor#store() */ public boolean performOk() { Iterator<FieldEditor> i = fieldEditors.iterator(); while (i.hasNext()) { FieldEditor pe = i.next(); pe.store(); //this method is protected so have no access to it in this package //pe.setPresentsDefaultValue(false); } return true; }
String value = (String)attrMap.get(key); if (arg instanceof Connector.StringArgument || arg instanceof Connector.SelectedArgument) { editor.getPreferenceStore().setValue(key, value); editor.getPreferenceStore().setValue(key, Boolean.valueOf(value).booleanValue()); editor.getPreferenceStore().setValue(key, new Integer(value).intValue()); editor.load();
/** * Recomputes the page's error state by calling <code>isValid</code> for * every field editor. */ 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 Iterator<FieldEditor> i = fieldEditors.iterator(); while( i.hasNext() ){ FieldEditor editor = i.next(); valid = valid && editor.isValid(); if (!valid) { invalidFieldEditor = editor; break; } } setValid(valid); }
@Override public void setPreferenceStore(IPreferenceStore store) { super.setPreferenceStore(store); defaultEnc = store.getDefaultString(getPreferenceName()); updateDefaultEncoding(); }
private void setPreferencePrefix(String preferencePrefix) { this.preferencePrefix = preferencePrefix; for (FieldEditor fe : internalEditorsList) { String oldPreferenceName = fe.getPreferenceName(); if (oldPreferenceName.indexOf(PreferenceConstants.SEPARATOR) >= 0) { oldPreferenceName = oldPreferenceName.substring(oldPreferenceName .lastIndexOf(PreferenceConstants.SEPARATOR) + 1); } fe.setPreferenceName(getPreferencePrefix() + PreferenceConstants.SEPARATOR + oldPreferenceName); } } }
/** * Sets the preference page in which this field editor * appears. * * @param preferencePage the preference page, or <code>null</code> if none * @deprecated use #setPage(DialogPage) */ public void setPreferencePage(PreferencePage preferencePage) { setPage(preferencePage); }
/** * Set whether or not the controls in the field editor * are enabled. * @param enabled The enabled state. * @param parent The parent of the controls in the group. * Used to create the controls if required. */ public void setEnabled(boolean enabled, Composite parent) { getLabelControl(parent).setEnabled(enabled); }
private String findChangedPreference(PropertyChangeEvent event) { Object source = event.getSource(); if ((source instanceof FieldEditor) && event.getProperty().equals(VALUE)) { return ((FieldEditor) source).getPreferenceName(); } return null; }
protected final void loadDefaults(String preferencePrefix) { setPreferencePrefix(preferencePrefix); performDefaults(); for (FieldEditor fe : internalEditorsList) { if (fe.presentsDefaultValue()) { internalStore.setValue(fe.getPreferenceName(), masterPreferenceStore.getDefaultString(fe .getPreferenceName())); } } }