List of usage examples for org.eclipse.jface.preference StringFieldEditor StringFieldEditor
public StringFieldEditor(String name, String labelText, Composite parent)
From source file:org.eclipse.ant.internal.ui.preferences.AntPreferencePage.java
License:Open Source License
@Override protected void createFieldEditors() { storeAppliedValues();//from w w w . ja va 2 s. c o m Font font = getFieldEditorParent().getFont(); Label label = new Label(getFieldEditorParent(), SWT.WRAP); label.setText(AntPreferencesMessages.AntPreferencePage_Enter); GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL); gd.horizontalSpan = 3; gd.widthHint = convertWidthInCharsToPixels(60); label.setLayoutData(gd); label.setLayoutData(gd); label.setFont(font); StringFieldEditor editor = new StringFieldEditor(IAntUIPreferenceConstants.ANT_FIND_BUILD_FILE_NAMES, AntPreferencesMessages.AntPreferencePage__Names__3, getFieldEditorParent()); addField(editor); timeout = new AntIntegerFieldEditor(AntLaunching.getUniqueIdentifier(), IAntLaunchingPreferenceConstants.ANT_COMMUNICATION_TIMEOUT, AntPreferencesMessages.AntPreferencePage_13, getFieldEditorParent(), 20000); int minValue = DefaultScope.INSTANCE.getNode(AntLaunching.getUniqueIdentifier()) .getInt(IAntLaunchingPreferenceConstants.ANT_COMMUNICATION_TIMEOUT, 20000); int maxValue = 1200000; timeout.setValidRange(minValue, maxValue); timeout.setValidateStrategy(StringFieldEditor.VALIDATE_ON_KEY_STROKE); timeout.setErrorMessage(MessageFormat.format(AntPreferencesMessages.AntPreferencePage_14, new Object[] { new Integer(minValue), new Integer(maxValue) })); addField(timeout); editor = new URLFieldEditor(IAntUIPreferenceConstants.DOCUMENTATION_URL, AntPreferencesMessages.AntPreferencePage_2, getFieldEditorParent()); addField(editor); workspacejre = new BooleanFieldEditor(IAntUIPreferenceConstants.USE_WORKSPACE_JRE, AntPreferencesMessages.always_run_in_workspace_jre, getFieldEditorParent()); workspacejre.fillIntoGrid(getFieldEditorParent(), 3); addField(workspacejre); createSpace(); if (!AntUIPlugin.isMacOS()) { // the mac does not have a tools.jar Bug 40778 label = new Label(getFieldEditorParent(), SWT.WRAP); label.setText(AntPreferencesMessages.AntPreferencePage_0); gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL); gd.horizontalSpan = 3; gd.widthHint = convertWidthInCharsToPixels(60); label.setLayoutData(gd); label.setFont(font); fToolsWarningEditor = new BooleanFieldEditor(IAntUIPreferenceConstants.ANT_TOOLS_JAR_WARNING, AntPreferencesMessages.AntPreferencePage_1, getFieldEditorParent()); addField(fToolsWarningEditor); createSpace(); } addField(new BooleanFieldEditor(IAntUIPreferenceConstants.ANT_ERROR_DIALOG, AntPreferencesMessages.AntPreferencePage_12, getFieldEditorParent())); createSpace(); addField(new BooleanFieldEditor(IAntUIPreferenceConstants.ANT_CREATE_MARKERS, AntPreferencesMessages.AntPreferencePage_15, getFieldEditorParent())); label = new Label(getFieldEditorParent(), SWT.WRAP); label.setText(AntPreferencesMessages.AntPreferencePage_16); gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL); gd.horizontalSpan = 3; gd.widthHint = convertWidthInCharsToPixels(60); label.setLayoutData(gd); label.setFont(font); createSpace(); createColorComposite(); getPreferenceStore().addPropertyChangeListener(this); }
From source file:org.eclipse.buckminster.ui.prefs.DynamicPreferencePage.java
License:Open Source License
@Override protected void createFieldEditors() { addField(new StringFieldEditor(SITE_NAME, Messages.site_name, getFieldEditorParent())); addField(new DirectoryFieldEditor(BUCKMINSTER_PROJECT_CONTENTS, Messages.buckminster_project_folder, getFieldEditorParent()));/* ww w. j a v a2 s . c o m*/ addField(new EnumFieldEditor(LOG_LEVEL_CONSOLE, Messages.console_logger_level_with_colon, LogLevel.values(), getFieldEditorParent())); addField(new EnumFieldEditor(LOG_LEVEL_ECLIPSE_LOGGER, Messages.eclipse_logger_level_with_colon, LogLevel.values(), getFieldEditorParent())); addField(new EnumFieldEditor(LOG_LEVEL_ANT_LOGGER, Messages.ant_logger_level_with_colon, LogLevel.values(), getFieldEditorParent())); addField(new BooleanFieldEditor(LOG_ECLIPSE_TO_CONSOLE, Messages.copy_eclipse_log_events_to_console, getFieldEditorParent())); IntegerFieldEditor intEditor = new IntegerFieldEditor(MaterializationJob.MAX_PARALLEL_JOBS, Messages.max_number_of_parallel_materializations, getFieldEditorParent()); intEditor.setValidRange(1, 12); addField(intEditor); intEditor = new IntegerFieldEditor(CONNECTION_RETRY_COUNT, Messages.connection_retry_count, getFieldEditorParent()); intEditor.setValidRange(0, 5); addField(intEditor); intEditor = new IntegerFieldEditor(CONNECTION_RETRY_DELAY, Messages.connection_retry_delay_in_seconds, getFieldEditorParent()); intEditor.setValidRange(0, 60); addField(intEditor); addField(new ResolutionResolverListEditor(QUERY_RESOLVER_SORT_ORDER, Messages.resolver_order, getFieldEditorParent())); IResolverFactory[] factories = ResolverFactoryMaintainer.getInstance().getResolverFactories(); int top = factories.length; if (top == 1) { IResolverFactory factory = factories[0]; factory.initDefaultPreferences(); NestedFieldEditor nfe = new NestedFieldEditor(factory.getId(), getFieldEditorParent()); addDynamicFieldEditors(nfe.getControl(), factory.getId(), factory.getPreferenceDescriptors()); addField(nfe); } else if (top > 1) { // We need a parent that will allow us to switch pane // dependent on what resolver factory that is selected // NestedFieldEditor resolvers = new NestedFieldEditor("", getFieldEditorParent()); //$NON-NLS-1$ addField(resolvers); resolversParent = resolvers.getControl(); for (int idx = 0; idx < top; ++idx) { IResolverFactory factory = factories[idx]; factory.initDefaultPreferences(); String factoryId = factory.getId(); NestedFieldEditor nfe = new NestedFieldEditor(factoryId, resolversParent); Composite nfeComp = nfe.getControl(); nfeComp.setData(factoryId); addDynamicFieldEditors(nfeComp, factoryId, factory.getPreferenceDescriptors()); addField(nfe); } resolversStack = new StackLayout(); resolversParent.setLayout(resolversStack); resolversParent.setVisible(false); } Group tsGroup = new Group(getFieldEditorParent(), SWT.NONE); tsGroup.setLayout(new GridLayout(2, false)); tsGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); tsGroup.setText(Messages.troubleshooting); UiUtils.createPushButton(tsGroup, Messages.clear_url_cache, new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { CorePlugin plugin = CorePlugin.getDefault(); plugin.clearRemoteFileCache(); plugin.clearURLCache(); } }); UiUtils.createPushButton(tsGroup, Messages.refresh_meta_data, new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent ev) { IWorkbench workbench = PlatformUI.getWorkbench(); IWorkbenchWindow wbWin = workbench.getActiveWorkbenchWindow(); if (wbWin == null) { // Not very likely. Just run it in the UI thread without // monitor // WorkspaceInfo.forceRefreshOnAll(new NullProgressMonitor()); return; } try { wbWin.run(true, true, new IRunnableWithProgress() { @Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { try { WorkspaceInfo.forceRefreshOnAll(monitor); } catch (OperationCanceledException e) { throw new InterruptedException(); } } }); } catch (InterruptedException e) { } catch (Exception e) { CorePlugin.getLogger().error(e, e.toString()); // We don't care to display exceptions here } } }); }
From source file:org.eclipse.cdt.codan.internal.ui.widgets.ParametersComposite.java
License:Open Source License
/** * @param parent/*from w w w. j a va 2 s . c om*/ * @param problem * @param style */ public ParametersComposite(Composite parent, final IProblem problem) { super(parent, SWT.NONE); if (problem == null) throw new NullPointerException(); this.setLayout(new GridLayout(2, false)); this.problem = problem; this.prefStore = new PreferenceStore(); page = new FieldEditorPreferencePage(FieldEditorPreferencePage.GRID) { @Override protected void createFieldEditors() { noDefaultAndApplyButton(); ((GridLayout) getFieldEditorParent().getLayout()).numColumns = 2; addField(new BooleanFieldEditor(PREF_ENABLED, CodanUIMessages.ParametersComposite_IsEnabled, getFieldEditorParent())); String[][] entries = { { CodanSeverity.Error.toTranslatableString(), CodanSeverity.Error.toString() }, // { CodanSeverity.Warning.toTranslatableString(), CodanSeverity.Warning.toString() }, // { CodanSeverity.Info.toTranslatableString(), CodanSeverity.Info.toString() }, // { NO_CHANGE, NO_CHANGE }, // }; addField(new ComboFieldEditor(PREF_SEVERITY, CodanUIMessages.ParametersComposite_Severity, entries, getFieldEditorParent())); StringFieldEditor messagePatternEditor = new StringFieldEditor(PREF_MESSAGE, CodanUIMessages.ParametersComposite_MessagePattern, getFieldEditorParent()); // We are using read-only text field for message pattern to allow copy to clipboard. makeUneditable(messagePatternEditor); addField(messagePatternEditor); IProblemPreference pref = problem.getPreference(); createFieldEditorsForParameters(pref); } private void makeUneditable(StringFieldEditor editor) { /* * Here we are doing 2 things to make a text control "uneditable": * 1. 'setUneditable(false)' the problem with with just doing this is that * the background of the text control doesn't change, and it looks like * an editable one. This is confusing to the user. * 2. Getting the background of a label control and applying it * to the "uneditable" text control. This way it is easier to figure out that * the contents of the text control cannot be changed. * Why not just setEnable(false)? Because it changes the text of the text control * to light gray, making it difficult to read. Also, users cannot select and copy * text from a disabled text field. */ Color background = editor.getLabelControl(getFieldEditorParent()).getBackground(); Text text = editor.getTextControl(getFieldEditorParent()); text.setBackground(background); text.setEditable(false); } @Override protected Control createContents(Composite parent) { return super.createContents(parent); } /** * @param info */ private void createFieldEditorsForParameters(final IProblemPreference info) { if (info == null) return; if (info.getKey() == FileScopeProblemPreference.KEY) return; // skip the scope if (info.getKey() == LaunchModeProblemPreference.KEY) return; // skip the launch switch (info.getType()) { case TYPE_STRING: { StringFieldEditor fe = new StringFieldEditor(info.getQualifiedKey(), info.getLabel(), getFieldEditorParent()); addField(fe); break; } case TYPE_BOOLEAN: { BooleanFieldEditor fe = new BooleanFieldEditor(info.getQualifiedKey(), info.getLabel(), getFieldEditorParent()); addField(fe); break; } case TYPE_LIST: ListEditor le = new ListEditor(info.getQualifiedKey(), info.getLabel(), getFieldEditorParent()) { @Override protected String[] parseString(String stringList) { ListProblemPreference list = (ListProblemPreference) info; IProblemPreference[] childDescriptors = list.getChildDescriptors(); if (childDescriptors.length == 0) return new String[0]; String res[] = new String[childDescriptors.length]; for (int i = 0; i < childDescriptors.length; i++) { IProblemPreference item = childDescriptors[i]; res[i] = String.valueOf(item.getValue()); } return res; } @Override protected String getNewInputObject() { ListProblemPreference list = (ListProblemPreference) info; String label = list.getChildDescriptor().getLabel(); InputDialog dialog = new InputDialog(getShell(), CodanUIMessages.ParametersComposite_NewValue, label, "", null); //$NON-NLS-1$ if (dialog.open() == Window.OK) { return dialog.getValue(); } return null; } @Override protected String createList(String[] items) { ListProblemPreference list = (ListProblemPreference) info.clone(); list.clear(); for (int i = 0; i < items.length; i++) { String val = items[i]; list.addChildValue(val); } return list.exportValue(); } }; addField(le); break; case TYPE_MAP: IProblemPreference[] childrenDescriptor = ((IProblemPreferenceCompositeDescriptor) info) .getChildDescriptors(); for (int i = 0; i < childrenDescriptor.length; i++) { IProblemPreference desc = childrenDescriptor[i]; createFieldEditorsForParameters(desc); } break; case TYPE_CUSTOM: { StringFieldEditor fe = new StringFieldEditor(info.getQualifiedKey(), info.getLabel(), getFieldEditorParent()); addField(fe); break; } case TYPE_FILE: { FileFieldEditor fe = new FileFieldEditor(info.getQualifiedKey(), info.getLabel(), getFieldEditorParent()); addField(fe); break; } default: throw new UnsupportedOperationException(info.getType().toString()); } } }; load(problem); page.setPreferenceStore(prefStore); page.createControl(parent); page.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); }
From source file:org.eclipse.cdt.dsf.gdb.internal.ui.preferences.GdbDebugPreferencePage.java
License:Open Source License
@Override protected void createFieldEditors() { final Composite parent = getFieldEditorParent(); final GridLayout layout = new GridLayout(); layout.marginWidth = 0;/*from w w w. ja v a 2s .c o m*/ parent.setLayout(layout); final Group group1 = new Group(parent, SWT.NONE); group1.setText(MessagesForPreferences.GdbDebugPreferencePage_defaults_label); GridLayout groupLayout = new GridLayout(3, false); group1.setLayout(groupLayout); group1.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); final StringFieldEditor stringFieldEditorCommand = new StringFieldEditor( IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_COMMAND, MessagesForPreferences.GdbDebugPreferencePage_GDB_debugger, group1); stringFieldEditorCommand.fillIntoGrid(group1, 2); addField(stringFieldEditorCommand); Button browsebutton = new Button(group1, SWT.PUSH); browsebutton.setText(MessagesForPreferences.GdbDebugPreferencePage_Browse_button); browsebutton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { handleBrowseButtonSelected(MessagesForPreferences.GdbDebugPreferencePage_GDB_debugger_dialog_title, stringFieldEditorCommand); } }); setButtonLayoutData(browsebutton); final StringFieldEditor stringFieldEditorGdbInit = new StringFieldEditor( IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_INIT, MessagesForPreferences.GdbDebugPreferencePage_GDB_command_file, group1); stringFieldEditorGdbInit.fillIntoGrid(group1, 2); addField(stringFieldEditorGdbInit); browsebutton = new Button(group1, SWT.PUSH); browsebutton.setText(MessagesForPreferences.GdbDebugPreferencePage_Browse_button); browsebutton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { handleBrowseButtonSelected( MessagesForPreferences.GdbDebugPreferencePage_GDB_command_file_dialog_title, stringFieldEditorGdbInit); } }); setButtonLayoutData(browsebutton); final StringWithBooleanFieldEditor enableStopAtMain = new StringWithBooleanFieldEditor( IGdbDebugPreferenceConstants.PREF_DEFAULT_STOP_AT_MAIN, IGdbDebugPreferenceConstants.PREF_DEFAULT_STOP_AT_MAIN_SYMBOL, MessagesForPreferences.GdbDebugPreferencePage_Stop_on_startup_at, group1); enableStopAtMain.fillIntoGrid(group1, 3); addField(enableStopAtMain); fCommandTimeoutField = new IntegerWithBooleanFieldEditor(IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT, IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT_VALUE, MessagesForPreferences.GdbDebugPreferencePage_Command_timeout, group1); fCommandTimeoutField.setValidRange(0, Integer.MAX_VALUE); fCommandTimeoutField.fillIntoGrid(group1, 2); addField(fCommandTimeoutField); fTimeoutAdvancedButton = new Button(group1, SWT.PUSH); fTimeoutAdvancedButton.setText(MessagesForPreferences.GdbDebugPreferencePage_Advanced_button); fTimeoutAdvancedButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { handleAdvancedButtonSelected( MessagesForPreferences.GdbDebugPreferencePage_GDB_debugger_dialog_title); } }); setButtonLayoutData(fTimeoutAdvancedButton); final ListenableBooleanFieldEditor enableNonStop = new ListenableBooleanFieldEditor( IGdbDebugPreferenceConstants.PREF_DEFAULT_NON_STOP, MessagesForPreferences.GdbDebugPreferencePage_Non_stop_mode, SWT.NONE, group1); enableNonStop.fillIntoGrid(group1, 3); addField(enableNonStop); group1.setLayout(groupLayout); final Group group2 = new Group(parent, SWT.NONE); group2.setText(MessagesForPreferences.GdbDebugPreferencePage_general_behavior_label); groupLayout = new GridLayout(3, false); group2.setLayout(groupLayout); group2.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); BooleanFieldEditor boolField = new BooleanFieldEditor(IGdbDebugPreferenceConstants.PREF_AUTO_TERMINATE_GDB, MessagesForPreferences.GdbDebugPreferencePage_autoTerminateGdb_label, group2); boolField.fillIntoGrid(group2, 3); addField(boolField); // Need to set layout again. group2.setLayout(groupLayout); boolField = new BooleanFieldEditor(IGdbDebugPreferenceConstants.PREF_USE_INSPECTOR_HOVER, MessagesForPreferences.GdbDebugPreferencePage_useInspectorHover_label, group2); boolField.fillIntoGrid(group2, 3); addField(boolField); // need to set layout again group2.setLayout(groupLayout); boolField = new BooleanFieldEditor(IGdbDebugPreferenceConstants.PREF_HIDE_RUNNING_THREADS, MessagesForPreferences.GdbDebugPreferencePage_hideRunningThreads, group2); boolField.fillIntoGrid(group2, 3); addField(boolField); // Need to set layout again. group2.setLayout(groupLayout); boolField = new BooleanFieldEditor(IGdbDebugPreferenceConstants.PREF_AGGRESSIVE_BP_FILTER, MessagesForPreferences.GdbDebugPreferencePage_useAggressiveBpFilter, group2); boolField.fillIntoGrid(group2, 3); addField(boolField); // Need to set layout again. group2.setLayout(groupLayout); final IntegerWithBooleanFieldEditor enableGdbTracesField = new IntegerWithBooleanFieldEditor( IGdbDebugPreferenceConstants.PREF_TRACES_ENABLE, IGdbDebugPreferenceConstants.PREF_MAX_GDB_TRACES, MessagesForPreferences.GdbDebugPreferencePage_enableTraces_label, group2); // Instead of using Integer.MAX_VALUE which is some obscure number, // using 2 billion is nice and readable. enableGdbTracesField.setValidRange(10000, 2000000000); enableGdbTracesField.fillIntoGrid(group2, 2); addField(enableGdbTracesField); // Need to set layout again. group2.setLayout(groupLayout); boolField = new BooleanFieldEditor(IGdbDebugPreferenceConstants.PREF_USE_RTTI, MessagesForPreferences.GdbDebugPreferencePage_use_rtti_label1 + "\n" //$NON-NLS-1$ + MessagesForPreferences.GdbDebugPreferencePage_use_rtti_label2, group2); boolField.fillIntoGrid(group2, 3); addField(boolField); // need to set layout again group2.setLayout(groupLayout); Group group = new Group(parent, SWT.NONE); group.setText(MessagesForPreferences.GdbDebugPreferencePage_prettyPrinting_label); groupLayout = new GridLayout(3, false); group.setLayout(groupLayout); group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); final ListenableBooleanFieldEditor enablePrettyPrintingField = new ListenableBooleanFieldEditor( IGdbDebugPreferenceConstants.PREF_ENABLE_PRETTY_PRINTING, MessagesForPreferences.GdbDebugPreferencePage_enablePrettyPrinting_label1 + "\n" //$NON-NLS-1$ + MessagesForPreferences.GdbDebugPreferencePage_enablePrettyPrinting_label2, SWT.NONE, group); enablePrettyPrintingField.fillIntoGrid(group, 3); addField(enablePrettyPrintingField); final Composite indentHelper = new Composite(group, SWT.NONE); GridLayout helperLayout = new GridLayout(3, false); indentHelper.setLayout(helperLayout); GridData helperData = new GridData(SWT.FILL, SWT.FILL, true, false, 3, 1); helperData.horizontalIndent = 20; indentHelper.setLayoutData(helperData); final IntegerFieldEditor childCountLimitField = new IntegerFieldEditor( IGdbDebugPreferenceConstants.PREF_INITIAL_CHILD_COUNT_LIMIT_FOR_COLLECTIONS, MessagesForPreferences.GdbDebugPreferencePage_initialChildCountLimitForCollections_label, indentHelper); childCountLimitField.setValidRange(1, 10000); childCountLimitField.fillIntoGrid(indentHelper, 3); boolean prettyPrintingEnabled = getPreferenceStore() .getBoolean(IGdbDebugPreferenceConstants.PREF_ENABLE_PRETTY_PRINTING); childCountLimitField.setEnabled(prettyPrintingEnabled, indentHelper); addField(childCountLimitField); enablePrettyPrintingField.getChangeControl(group).addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { boolean enabled = enablePrettyPrintingField.getBooleanValue(); childCountLimitField.setEnabled(enabled, indentHelper); } }); // need to set layouts again indentHelper.setLayout(helperLayout); group.setLayout(groupLayout); }
From source file:org.eclipse.cdt.examples.dsf.pda.ui.breakpoints.PDAWatchpointFunctionFieldEditorFactory.java
License:Open Source License
public FieldEditor createFieldEditor(String name, String labelText, Composite parent) { return new StringFieldEditor(name, labelText, parent); }
From source file:org.eclipse.cdt.internal.autotools.ui.properties.AutotoolsToolPropertyOptionPage.java
License:Open Source License
protected void createFieldEditors() { super.createFieldEditors(); // Add a string editor to edit the tool command Composite parent = getFieldEditorParent(); FontMetrics fm = AbstractCPropertyTab.getFontMetrics(parent); commandStringField = new StringFieldEditor(toolName, ConfigureMessages.getString(COMMAND), parent); commandStringField.setEmptyStringAllowed(false); GridData gd = ((GridData) commandStringField.getTextControl(parent).getLayoutData()); gd.grabExcessHorizontalSpace = true; gd.minimumWidth = Dialog.convertWidthInCharsToPixels(fm, 3); addField(commandStringField);/* w ww .j a va 2s .c om*/ // Add a field editor that displays overall build options Composite par = getFieldEditorParent(); allOptionFieldEditor = new MultiLineTextFieldEditor(AutotoolsConfigurePrefStore.ALL_OPTIONS_ID, ConfigureMessages.getString(ALL_OPTIONS), par); allOptionFieldEditor.getTextControl(par).setEditable(false); // gd = ((GridData)allOptionFieldEditor.getTextControl().getLayoutData()); gd.grabExcessHorizontalSpace = true; gd.minimumWidth = Dialog.convertWidthInCharsToPixels(fm, 20); addField(allOptionFieldEditor); }
From source file:org.eclipse.cdt.internal.docker.launcher.ui.preferences.DockerLaunchPreferencePage.java
License:Open Source License
/** * Creates the field editors. Field editors are abstractions of the common * GUI blocks needed to manipulate various types of preferences. Each field * editor knows how to save and restore itself. *///from www . j a v a 2s . co m public void createFieldEditors() { defaultImage = new StringFieldEditor(PreferenceConstants.DEFAULT_IMAGE, Messages.Default_Image, getFieldEditorParent()); addField(defaultImage); keepContainerAfterLaunch = new BooleanFieldEditor(PreferenceConstants.KEEP_CONTAINER_AFTER_LAUNCH, Messages.Keep_Container_After_Launch, getFieldEditorParent()); addField(keepContainerAfterLaunch); }
From source file:org.eclipse.cdt.llvm.dsf.lldb.ui.internal.LLDBDebugPreferencePage.java
License:Open Source License
@Override protected void createFieldEditors() { final Composite parent = getFieldEditorParent(); final GridLayout layout = new GridLayout(); layout.marginWidth = 0;//from w ww.j a va 2s . c o m parent.setLayout(layout); final Group group1 = new Group(parent, SWT.NONE); group1.setText(Messages.LLDBDebugPreferencePage_defaults_label); GridLayout groupLayout = new GridLayout(3, false); group1.setLayout(groupLayout); group1.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); fStringFieldEditorCommand = new StringFieldEditor(ILLDBDebugPreferenceConstants.PREF_DEFAULT_LLDB_COMMAND, Messages.LLDBCDebuggerPage_debugger_command, group1); fStringFieldEditorCommand.fillIntoGrid(group1, 2); GridData stringFieldLayoutData = (GridData) fStringFieldEditorCommand.getTextControl(group1) .getLayoutData(); stringFieldLayoutData.widthHint = 300; addField(fStringFieldEditorCommand); Button browsebutton = new Button(group1, SWT.PUSH); browsebutton.setText(Messages.LLDBCDebuggerPage_browse); browsebutton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { handleBrowseButtonSelected(Messages.LLDBCDebuggerPage_browse_dialog_title, fStringFieldEditorCommand); } }); setButtonLayoutData(browsebutton); fEnableStopAtMain = createStopAtMainEditor(group1); fEnableStopAtMain.fillIntoGrid(group1, 3); addField(fEnableStopAtMain); group1.setLayout(groupLayout); createLinkToGdb(parent); }
From source file:org.eclipse.cdt.managedbuilder.ui.properties.BuildToolSettingUI.java
License:Open Source License
@Override protected void createFieldEditors() { // Load up the preference store super.createFieldEditors(); // Add a string editor to edit the tool command Composite parent = getFieldEditorParent(); FontMetrics fm = AbstractCPropertyTab.getFontMetrics(parent); commandStringField = new StringFieldEditor(fTool.getId(), Messages.BuildToolSettingsPage_tool_command, parent);// w w w . ja v a 2 s.c o m commandStringField.setEmptyStringAllowed(false); GridData gd = ((GridData) commandStringField.getTextControl(parent).getLayoutData()); gd.grabExcessHorizontalSpace = true; gd.minimumWidth = Dialog.convertWidthInCharsToPixels(fm, 3); addField(commandStringField); // Add a field editor that displays overall build options Composite par = getFieldEditorParent(); allOptionFieldEditor = new MultiLineTextFieldEditor(ToolSettingsPrefStore.ALL_OPTIONS_ID, ALL_OPTIONS, par); allOptionFieldEditor.getTextControl(par).setEditable(false); // gd = ((GridData)allOptionFieldEditor.getTextControl().getLayoutData()); gd.grabExcessHorizontalSpace = true; gd.minimumWidth = Dialog.convertWidthInCharsToPixels(fm, 20); addField(allOptionFieldEditor); addField(createLabelEditor(getFieldEditorParent(), WHITESPACE)); addField(createLabelEditor(getFieldEditorParent(), Messages.BuildToolSettingsPage_tool_advancedSettings)); // Add a string editor to edit the tool command line pattern parent = getFieldEditorParent(); commandLinePatternField = new StringFieldEditor(fTool.getId() + ToolSettingsPrefStore.COMMAND_LINE_SUFFIX, Messages.BuildToolSettingsPage_tool_commandLinePattern, parent); gd = ((GridData) commandLinePatternField.getTextControl(parent).getLayoutData()); gd.grabExcessHorizontalSpace = true; gd.widthHint = Dialog.convertWidthInCharsToPixels(fm, 30); gd.minimumWidth = Dialog.convertWidthInCharsToPixels(fm, 20); addField(commandLinePatternField); }
From source file:org.eclipse.debug.internal.ui.views.memory.CodePagesPreferencePage.java
License:Open Source License
protected void createFieldEditors() { fAsciiCodePage = new StringFieldEditor(IDebugUIConstants.PREF_DEFAULT_ASCII_CODE_PAGE, DebugUIMessages.CodePagesPrefDialog_2, getFieldEditorParent()); fAsciiCodePage.setEmptyStringAllowed(false); addField(fAsciiCodePage);/*from ww w.j a v a 2 s .c o m*/ fEbcdicCodePage = new StringFieldEditor(IDebugUIConstants.PREF_DEFAULT_EBCDIC_CODE_PAGE, DebugUIMessages.CodePagesPrefDialog_4, getFieldEditorParent()); fEbcdicCodePage.setEmptyStringAllowed(false); addField(fEbcdicCodePage); }