List of usage examples for org.eclipse.jface.preference ComboFieldEditor ComboFieldEditor
public ComboFieldEditor(String name, String labelText, String[][] entryNamesAndValues, Composite parent)
From source file:at.medevit.elexis.gdt.ui.GDTPreferencePage.java
License:Open Source License
/** * Create contents of the preference page. *///from ww w .ja va2 s . c o m @Override protected void createFieldEditors() { { Composite composite = getFieldEditorParent(); StringFieldEditor stringFieldEditorGDTID = new StringFieldEditor(CFG_GDT_ID, "GDT Identitt", composite); stringFieldEditorGDTID.getLabelControl(composite).setText("GDT Identitt (max 8 Zeichen)"); stringFieldEditorGDTID.getLabelControl(composite).setToolTipText( "Die GDT-ID dient zur eindeutigen Identifikation der an der Kommunikation beteiligten Komonenten."); stringFieldEditorGDTID.getTextControl(composite).setTextLimit(8); addField(stringFieldEditorGDTID); } { Composite composite = getFieldEditorParent(); StringFieldEditor exchangeKuerzel = new StringFieldEditor(CFG_GDT_FILETRANSFER_SHORTNAME, "Kommunikations-Krzel (4 Zeichen)", composite); exchangeKuerzel.getTextControl(composite).setTextLimit(4); addField(exchangeKuerzel); } { Composite composite = getFieldEditorParent(); ComboFieldEditor comboFieldEditor = new ComboFieldEditor(CFG_GDT_CHARSET, "Standard Zeichensatz", comboCharsetSelektor, composite); comboFieldEditor.getLabelControl(composite) .setToolTipText("Zeichensatz welcher zum Datenaustausch verwendet werden soll"); addField(comboFieldEditor); } { BooleanFieldEditor deleteNonGDTFiles = new BooleanFieldEditor(CFG_GDT_FILETRANSFER_DELETE_NON_GDT_FILES, "Nicht GDT Dateien aus Daten-Austausch-Verzeichnissen entfernen", getFieldEditorParent()); addField(deleteNonGDTFiles); } }
From source file:au.gov.ansto.bragg.echidna.ui.preference.DRAPreferencePage.java
License:Open Source License
@Override protected void createFieldEditors() { Label newProfileLabel = new Label(getFieldEditorParent(), SWT.NONE); newProfileLabel.setText("Configurations for data reduction"); GridDataFactory.fillDefaults().span(3, 1).grab(true, false).applyTo(newProfileLabel); final StringFieldEditor efficiencyFileText = new StringFieldEditor(PreferenceConstants.P_EFFICIENCY_FILE, "Detector efficiency file:", 40, getFieldEditorParent()); Button browseButton = new Button(getFieldEditorParent(), SWT.PUSH); browseButton.setText("Browse..."); browseButton.setToolTipText("Click to browse the file system"); addField(efficiencyFileText);/*from w w w. j a v a 2 s .co m*/ GridDataFactory.fillDefaults().grab(true, false).applyTo(browseButton); browseButton.addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { String filename = Util.getFilenameFromShell(getShell(), "", ""); if (filename != null && filename.trim().length() > 0) { efficiencyFileText.setStringValue(filename); } } @Override public void widgetDefaultSelected(SelectionEvent e) { } }); final StringFieldEditor angularOffsetFileText = new StringFieldEditor( PreferenceConstants.P_ANGULAR_OFFSET_FILE, "Angular offset file:", 40, getFieldEditorParent()); Button browseButton2 = new Button(getFieldEditorParent(), SWT.PUSH); browseButton2.setCursor(Display.getDefault().getSystemCursor(SWT.CURSOR_HAND)); browseButton2.setToolTipText("Click to browse the file system"); browseButton2.setText("Browse..."); addField(angularOffsetFileText); GridDataFactory.fillDefaults().grab(true, false).applyTo(browseButton2); browseButton2.addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { String filename = Util.getFilenameFromShell(getShell(), "", ""); if (filename != null && filename.trim().length() > 0) { angularOffsetFileText.setStringValue(filename); } } @Override public void widgetDefaultSelected(SelectionEvent e) { } }); final ComboFieldEditor normRefCombo = new ComboFieldEditor(PreferenceConstants.P_NORM_REF, "Normalisation reference: ", new String[][] { { "bm1_counts", "bm1_counts" }, { "bm2_counts", "bm2_counts" }, { "bm3_counts", "bm3_counts" } }, getFieldEditorParent()); addField(normRefCombo); new Label(getFieldEditorParent(), SWT.NONE); final StringFieldEditor userOutputFileText = new StringFieldEditor( PreferenceConstants.P_USER_OUTPUT_DIRECTORY, "User Output Directory:", 40, getFieldEditorParent()); Button browseButton3 = new Button(getFieldEditorParent(), SWT.PUSH); browseButton3.setCursor(Display.getDefault().getSystemCursor(SWT.CURSOR_HAND)); browseButton3.setToolTipText("Click to browse the file system"); browseButton3.setText("Browse..."); addField(userOutputFileText); GridDataFactory.fillDefaults().grab(true, false).applyTo(browseButton3); browseButton3.addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { String filename = Util.selectDirectoryFromShell(getShell()); if (filename != null && filename.trim().length() > 0) { userOutputFileText.setStringValue(filename); } } @Override public void widgetDefaultSelected(SelectionEvent e) { } }); final StringFieldEditor calibrationOutputFileText = new StringFieldEditor( PreferenceConstants.P_CALIBRATION_OUTPUT_DIRECTORY, "Calibration Output Directory:", 40, getFieldEditorParent()); Button browseButton4 = new Button(getFieldEditorParent(), SWT.PUSH); browseButton4.setCursor(Display.getDefault().getSystemCursor(SWT.CURSOR_HAND)); browseButton4.setToolTipText("Click to browse the file system"); browseButton4.setText("Browse..."); addField(calibrationOutputFileText); GridDataFactory.fillDefaults().grab(true, false).applyTo(browseButton4); browseButton4.addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { String filename = Util.selectDirectoryFromShell(getShell()); if (filename != null && filename.trim().length() > 0) { calibrationOutputFileText.setStringValue(filename); } } @Override public void widgetDefaultSelected(SelectionEvent e) { } }); // GridDataFactory.fillDefaults().grab(false, false).span(2, 1).applyTo(normRefCombo.get); }
From source file:br.com.tecsinapse.glimpse.preferences.GlimpsePreferencePage.java
License:Apache License
@Override protected void createFieldEditors() { StringFieldEditor urlEditor = new StringFieldEditor(GlimpsePreferenceConstants.URL, "Url", getFieldEditorParent());/* w w w .ja v a 2 s . c om*/ urlEditor.setEmptyStringAllowed(false); urlText = urlEditor.getTextControl(getFieldEditorParent()); urlText.setToolTipText("Use the arrow keys (UP and DOWN) to get previous urls"); urlText.addListener(SWT.KeyDown, new Listener() { @Override public void handleEvent(Event e) { switch (e.keyCode) { case SWT.ARROW_DOWN: urlText.setText(selectNextUrl(urlText.getText())); break; case SWT.ARROW_UP: urlText.setText(selectPreviousUrl(urlText.getText())); break; } } }); addField(urlEditor); addField(new StringFieldEditor(GlimpsePreferenceConstants.USERNAME, "User name", getFieldEditorParent())); addField(new StringFieldEditor(GlimpsePreferenceConstants.PASSWORD, "Password", getFieldEditorParent())); addField(new ComboFieldEditor(GlimpsePreferenceConstants.CONSOLE_TYPE, "Console type", new String[][] { { "Glimpse", "GLIMPSE" }, { "Eclipse", "ECLIPSE" } }, getFieldEditorParent())); }
From source file:cn.edu.xmu.tidems.control.ui.preferences.PreferencePageADCard.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. */// w w w. j a v a 2s . c o m @Override public void createFieldEditors() { addField(new SpacerFieldEditor(getFieldEditorParent())); adCardFieldEditor = new ComboFieldEditor(PreferenceSupplier.P_SELECTED_ADCARD, "Selected ADCard:", getRegisteredADC9982Services(), getFieldEditorParent()); addField(adCardFieldEditor); addField(new ComboFieldEditor(PreferenceSupplier.P_SELECTED_ADCARD_ADDRESS, "Selected Address:", getAvailableAddress(), getFieldEditorParent())); addField(new ComboFieldEditor(PreferenceSupplier.P_CLOCK, "Clock:", PreferenceSupplier.CLOCK_LIST, getFieldEditorParent())); addField(new ComboFieldEditor(PreferenceSupplier.P_CLOCK_DIVISION, "Clock Division:", PreferenceSupplier.CLOCK_DIVISION_LIST, getFieldEditorParent())); addField(new BooleanFieldEditor(PreferenceSupplier.P_ADCARD_2G_ACQUISTION, "Enable 2G Acquisiton", getFieldEditorParent())); addField(new ComboFieldEditor(PreferenceSupplier.P_TRIGGER_MODE, "Trigger Mode:", PreferenceSupplier.TRIGGER_MODE_LIST, getFieldEditorParent())); addField(new ComboFieldEditor(PreferenceSupplier.P_TRIGGER_SOURCE, "Trigger Source:", PreferenceSupplier.TRIGGER_SOURCE_LIST, getFieldEditorParent())); final DirectoryFieldEditor dirFieldEditor = new DirectoryFieldEditor( PreferenceSupplier.P_DEFAULT_DATA_FOLDER, "Data folder:", getFieldEditorParent()); final String userHomeDir = System.getProperty("user.home"); dirFieldEditor.getTextControl(getFieldEditorParent()).setText(userHomeDir); dirFieldEditor.setFilterPath(new File(userHomeDir)); addField(dirFieldEditor); }
From source file:com.agynamix.platform.frontend.preferences.GlobalPreferencePageDefaults.java
License:Open Source License
protected void createFieldEditors() { startMinimized = new BooleanFieldEditor(IPreferenceConstants.START_MINIMIZED, "Start minimized", getFieldEditorParent());/*from w w w. j av a2 s . c om*/ restoreLatestEntry = new BooleanFieldEditor(IPreferenceConstants.RESTORE_LATEST_ENTRY, "Restore the latest Clipboard entry after a system restart", getFieldEditorParent()); showBalloonTooltip = new BooleanFieldEditor(IPreferenceConstants.SHOW_BALLOON_TOOLTIP, "Show tooltips when new items arrive", getFieldEditorParent()); updateSchedule = new ComboFieldEditor(IPreferenceConstants.UPDATE_SCHEDULE, "Update Schedule", new String[][] { { "On Every Start", IPreferenceConstants.UPD_ON_EVERY_START }, { "Weekly", IPreferenceConstants.UPD_WEEKLY }, { "Never", IPreferenceConstants.UPD_NEVER } }, getFieldEditorParent()); modifierKeyNames = new String[][] { { SimidudeUtils.getKeyCodeName(SWT.SHIFT), "" + SWT.SHIFT }, { SimidudeUtils.getKeyCodeName(SWT.MOD1), "" + SWT.MOD1 }, { SimidudeUtils.getKeyCodeName(SWT.ALT), "" + SWT.ALT } }; modifierKey = new ComboFieldEditor(IPreferenceConstants.MODIFIER_KEY, "The Modifier Key", modifierKeyNames, getFieldEditorParent()); defaultTextEditor = new ApplicationChooserFieldEditor(IPreferenceConstants.DEFAULT_TEXT_EDITOR, "Text Editor for text entries", getFieldEditorParent()); defaultImageViewer = new ApplicationChooserFieldEditor(IPreferenceConstants.DEFAULT_IMAGE_EDITOR, "Image Editor for image entries", getFieldEditorParent()); defaultFileBrowser = new ApplicationChooserFieldEditor(IPreferenceConstants.DEFAULT_FILE_BROWSER, "File Browser for files/directories", getFieldEditorParent()); defaultTextEditor.setEmptyStringAllowed(true); defaultImageViewer.setEmptyStringAllowed(true); defaultFileBrowser.setEmptyStringAllowed(true); OS os = PlatformUtils.getOsName(); switch (os) { case win32: case win64: defaultTextEditor.setFileExtensions(new String[] { "*.exe; *.com; *.bat; *.cmd", "*.*" }); defaultImageViewer.setFileExtensions(new String[] { "*.exe; *.com; *.bat; *.cmd", "*.*" }); defaultFileBrowser.setFileExtensions(new String[] { "*.exe; *.com; *.bat; *.cmd", "*.*" }); break; case macosx: case macosx64: defaultTextEditor.setFileExtensions(new String[] { "*.app; *.sh", "*.*" }); defaultImageViewer.setFileExtensions(new String[] { "*.app; *.sh", "*.*" }); defaultFileBrowser.setFileExtensions(new String[] { "*.app; *.sh", "*.*" }); break; } IHotkeyRegistrar hotkeyRegistrar = HotkeyRegistrarFactory.getHotkeyRegistrarInstance(); if (hotkeyRegistrar.isEnabled()) { bringSimidudeToFront = new HotkeyFieldEditor(IPreferenceConstants.HOTKEY_BRING_SIMIDUDE_TO_FRONT, "HotKey to make Simidude visible (clear to disable)", getFieldEditorParent()); String msg = "HotKey to paste the latest Simidude entry (clear to disable)"; // if (os != OS.win32) // { // msg = "HotKey to activate the lastest Simidude entry (clear to disable)"; // } activateLastEntry = new HotkeyFieldEditor(IPreferenceConstants.HOTKEY_ACTIVATE_LAST_ENTRY, msg, getFieldEditorParent()); } autoActivateNewEntry = new BooleanFieldEditor(IPreferenceConstants.AUTO_ACTIVATE_NEW_ENTRY, "Automatically copy items to clipboard when they arrive", getFieldEditorParent()); autoDownloadContents = new BooleanFieldEditor(IPreferenceConstants.AUTO_DOWNLOAD_CONTENTS, "Automatically download contents from remote computers", getFieldEditorParent()); showDownloadErrorDialog = new BooleanFieldEditor(IPreferenceConstants.DIALOG_DOWNLOAD_ERR_SHOW, "Do not show a message when a file cannot be downloaded", getFieldEditorParent()); showHostNotFoundDialog = new BooleanFieldEditor(IPreferenceConstants.DIALOG_HOST_NOT_FOUND_ERR_SHOW, "Do not show a message when a host cannot be contacted", getFieldEditorParent()); addField(startMinimized); addField(new SpacerFieldEditor(getFieldEditorParent())); addField(restoreLatestEntry); addField(new SpacerFieldEditor(getFieldEditorParent())); addField(showBalloonTooltip); addField(new SpacerFieldEditor(getFieldEditorParent())); addField(updateSchedule); addField(new SpacerFieldEditor(getFieldEditorParent())); addField(defaultTextEditor); addField(new SpacerFieldEditor(getFieldEditorParent())); addField(defaultImageViewer); addField(new SpacerFieldEditor(getFieldEditorParent())); addField(defaultFileBrowser); addField(new SpacerFieldEditor(getFieldEditorParent())); addField(modifierKey); if (hotkeyRegistrar.isEnabled()) { addField(new SpacerFieldEditor(getFieldEditorParent())); addField(bringSimidudeToFront); addField(new SpacerFieldEditor(getFieldEditorParent())); addField(activateLastEntry); } addField(new SpacerFieldEditor(getFieldEditorParent())); addField(autoActivateNewEntry); addField(new SpacerFieldEditor(getFieldEditorParent())); addField(autoDownloadContents); addField(new SpacerFieldEditor(getFieldEditorParent())); addField(showDownloadErrorDialog); addField(new SpacerFieldEditor(getFieldEditorParent())); addField(showHostNotFoundDialog); addPropertyChangeListener(updateSchedule, new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { UpdateSchedule schedule = null; String v = (String) event.getNewValue(); if (v.equals(IPreferenceConstants.UPD_ON_EVERY_START)) { schedule = UpdateSchedule.ON_EVERY_START; } else if (v.equals(IPreferenceConstants.UPD_WEEKLY)) { schedule = UpdateSchedule.WEEKLY; } else if (v.equals(IPreferenceConstants.UPD_NEVER)) { schedule = UpdateSchedule.NEVER; } UpdateScheduleRegistry.setUpdateSchedule(schedule); } }); if (hotkeyRegistrar.isEnabled()) { //Listen to events from the PreferenceStore which are emitted when save or apply is pushed configAdapter.addPropertyChangeListener(new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { //System.out.println("propertyChanged Called"); String newBringSimidudeToFront = bringSimidudeToFront.getStringValue(); String newActivateLastEntry = activateLastEntry.getStringValue(); if ((!oldBringSimidudeToFront.equals(newBringSimidudeToFront)) || (!oldActivateLastEntry.equals(newActivateLastEntry))) { // System.out.println("Unregister and register new hotkeys"); SimidudeHotkeyActions.unregisterHotkeys(); SimidudeHotkeyActions.registerHotkeys(); oldBringSimidudeToFront = newBringSimidudeToFront; oldActivateLastEntry = newActivateLastEntry; } } }); } }
From source file:com.android.ide.eclipse.ddms.preferences.LogCatPreferencePage.java
License:Apache License
private void createAdtSpecificFieldEditors() { mSwitchPerspective = new BooleanFieldEditor(PreferenceInitializer.ATTR_SWITCH_PERSPECTIVE, Messages.LogCatPreferencePage_Switch_Perspective, getFieldEditorParent()); addField(mSwitchPerspective);/*from ww w.j a v a 2 s. co m*/ IPerspectiveDescriptor[] perspectiveDescriptors = PlatformUI.getWorkbench().getPerspectiveRegistry() .getPerspectives(); String[][] perspectives = new String[0][0]; if (perspectiveDescriptors.length > 0) { perspectives = new String[perspectiveDescriptors.length][2]; for (int i = 0; i < perspectiveDescriptors.length; i++) { IPerspectiveDescriptor perspective = perspectiveDescriptors[i]; perspectives[i][0] = perspective.getLabel(); perspectives[i][1] = perspective.getId(); } } mWhichPerspective = new ComboFieldEditor(PreferenceInitializer.ATTR_PERSPECTIVE_ID, Messages.LogCatPreferencePage_Switch_To, perspectives, getFieldEditorParent()); mWhichPerspective.setEnabled(getPreferenceStore().getBoolean(PreferenceInitializer.ATTR_SWITCH_PERSPECTIVE), getFieldEditorParent()); addField(mWhichPerspective); createHorizontalSeparator(); mAutoMonitorLogcat = new BooleanFieldEditor(LogCatMonitor.AUTO_MONITOR_PREFKEY, Messages.LogCatPreferencePage_AutoMonitorLogcat, getFieldEditorParent()); addField(mAutoMonitorLogcat); mAutoMonitorLogcatLevel = new ComboFieldEditor(LogCatMonitor.AUTO_MONITOR_LOGLEVEL, Messages.LogCatPreferencePage_SessionFilterLogLevel, new String[][] { { LogLevel.VERBOSE.toString(), LogLevel.VERBOSE.getStringValue() }, { LogLevel.DEBUG.toString(), LogLevel.DEBUG.getStringValue() }, { LogLevel.INFO.toString(), LogLevel.INFO.getStringValue() }, { LogLevel.WARN.toString(), LogLevel.WARN.getStringValue() }, { LogLevel.ERROR.toString(), LogLevel.ERROR.getStringValue() }, { LogLevel.ASSERT.toString(), LogLevel.ASSERT.getStringValue() }, }, getFieldEditorParent()); mAutoMonitorLogcatLevel.setEnabled(getPreferenceStore().getBoolean(LogCatMonitor.AUTO_MONITOR_PREFKEY), getFieldEditorParent()); addField(mAutoMonitorLogcatLevel); }
From source file:com.android.ide.eclipse.ddms.preferences.PreferencePage.java
License:Apache 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. *///w w w . j a v a2s . c o m @Override public void createFieldEditors() { IntegerFieldEditor ife; ife = new IntegerFieldEditor(PreferenceInitializer.ATTR_DEBUG_PORT_BASE, Messages.PreferencePage_Base_Local_Debugger_Port, getFieldEditorParent()); ife.setValidRange(1024, 32767); addField(ife); BooleanFieldEditor bfe; bfe = new BooleanFieldEditor(PreferenceInitializer.ATTR_DEFAULT_THREAD_UPDATE, Messages.PreferencePage_Thread_Updates_Enabled_By_Default, getFieldEditorParent()); addField(bfe); bfe = new BooleanFieldEditor(PreferenceInitializer.ATTR_DEFAULT_HEAP_UPDATE, Messages.PreferencePage_Heap_Updates_Enabled_Default, getFieldEditorParent()); addField(bfe); ife = new IntegerFieldEditor(PreferenceInitializer.ATTR_THREAD_INTERVAL, Messages.PreferencePage_Thread_Status_Refresh_Interval, getFieldEditorParent()); ife.setValidRange(1, 60); addField(ife); if (InstallDetails.isAdtInstalled()) { ComboFieldEditor cfe = new ComboFieldEditor(PreferenceInitializer.ATTR_HPROF_ACTION, Messages.PreferencePage_HPROF_Action, new String[][] { { Messages.PreferencePage_Save_Disk, HProfHandler.ACTION_SAVE }, { Messages.PreferencePage_Open_Eclipse, HProfHandler.ACTION_OPEN }, }, getFieldEditorParent()); addField(cfe); } mProfilerBufsize = new IntegerFieldEditor(PreferenceInitializer.ATTR_PROFILER_BUFSIZE_MB, "Method Profiler buffer size (MB):", getFieldEditorParent()); addField(mProfilerBufsize); ife = new IntegerFieldEditor(PreferenceInitializer.ATTR_TIME_OUT, Messages.PreferencePage_ADB_Connection_Time_Out, getFieldEditorParent()); addField(ife); RadioGroupFieldEditor rgfe = new RadioGroupFieldEditor(PreferenceInitializer.ATTR_LOG_LEVEL, Messages.PreferencePage_Logging_Level, 1, new String[][] { { Messages.PreferencePage_Verbose, LogLevel.VERBOSE.getStringValue() }, { Messages.PreferencePage_Debug, LogLevel.DEBUG.getStringValue() }, { Messages.PreferencePage_Info, LogLevel.INFO.getStringValue() }, { Messages.PreferencePage_Warning, LogLevel.WARN.getStringValue() }, { Messages.PreferencePage_Error, LogLevel.ERROR.getStringValue() }, { Messages.PreferencePage_Assert, LogLevel.ASSERT.getStringValue() } }, getFieldEditorParent(), true); addField(rgfe); mUseAdbHost = new BooleanFieldEditor(PreferenceInitializer.ATTR_USE_ADBHOST, Messages.PreferencePage_Use_Adbhost, getFieldEditorParent()); addField(mUseAdbHost); mAdbHostValue = new StringFieldEditor(PreferenceInitializer.ATTR_ADBHOST_VALUE, Messages.PreferencePage_Adbhost_value, getFieldEditorParent()); mAdbHostValue.setEnabled(getPreferenceStore().getBoolean(PreferenceInitializer.ATTR_USE_ADBHOST), getFieldEditorParent()); addField(mAdbHostValue); }
From source file:com.aptana.editor.common.preferences.ContentAssistPreferencePage.java
License:Open Source License
/** * createFilterSelector/*from w w w.j a v a2 s . com*/ * * @param parent */ protected void createFilterSelector(Composite parent) { // @formatter:off ComboFieldEditor fieldEditor = new ComboFieldEditor( com.aptana.editor.common.contentassist.IPreferenceConstants.CONTENT_ASSIST_USER_AGENT_FILTER_TYPE, Messages.ContentAssistPreferencePage_ProposalFilterTypeLabel, new String[][] { { Messages.ContentAssistPreferencePage_NoFilterLabel, UserAgentFilterType.NO_FILTER.getText() }, { Messages.ContentAssistPreferencePage_OneOrMoreFilterLabel, UserAgentFilterType.ONE_OR_MORE.getText() }, { Messages.ContentAssistPreferencePage_AllFilterLabel, UserAgentFilterType.ALL.getText() } }, parent); addField(fieldEditor); // @formatter:on // We only want to enable this field editor for workspace-specific settings. // Since the UI will not draw anything unless we have at least one field-editor in this page, we have to add it // and disable it for project-specific. fieldEditor.setEnabled(!isProjectPreferencePage(), parent); }
From source file:com.aptana.editor.common.preferences.ContentAssistPreferencePage.java
License:Open Source License
/** * createProposalGroupContent// ww w .j ava 2 s . com * * @param parent */ protected void createProposalGroupContent(Composite parent) { // @formatter:off addField(new BooleanFieldEditor(IPreferenceConstants.CONTENT_ASSIST_AUTO_INSERT, Messages.EditorsPreferencePage_Content_Assist_Auto_Insert, parent)); addField(new ComboFieldEditor(IPreferenceConstants.CONTENT_ASSIST_DELAY, Messages.EditorsPreferencePage_Content_Assist_Auto_Display, new String[][] { { Messages.EditorsPreferencePage_Instant, Integer.toString(CommonSourceViewerConfiguration.NO_CONTENT_ASSIST_DELAY) }, { Messages.EditorsPreferencePage_DefaultDelay, Integer.toString(CommonSourceViewerConfiguration.DEFAULT_CONTENT_ASSIST_DELAY) }, { Messages.EditorsPreferencePage_Content_Assist_Short_Delay, Integer.toString(CommonSourceViewerConfiguration.LONG_CONTENT_ASSIST_DELAY) }, { CoreStrings.OFF, String.valueOf(CommonSourceViewerConfiguration.CONTENT_ASSIST_OFF_DELAY) } }, parent)); addField(new ComboFieldEditor(IPreferenceConstants.CONTENT_ASSIST_HOVER, Messages.EditorsPreferencePage_Content_Assist_Hover, new String[][] { { CoreStrings.ON, Boolean.toString(true) }, { CoreStrings.OFF, Boolean.toString(false) } }, parent)); // @formatter:on }
From source file:com.aptana.webserver.ui.preferences.LocalWebServerPreferencePage.java
License:Open Source License
@Override protected void createFieldEditors() { List<String[]> addresses = new ArrayList<String[]>(); for (InetAddress i : SocketUtil.getLocalAddresses()) { addresses.add(new String[] { i.getHostAddress(), i.getHostAddress() }); }/*from w ww . j a v a 2 s . co m*/ addField(new ComboFieldEditor(IWebServerPreferenceConstants.PREF_HTTP_SERVER_ADDRESS, StringUtil.makeFormLabel(Messages.LocalWebServerPreferencePage_Address_Label), addresses.toArray(new String[addresses.size()][]), getFieldEditorParent())); addField(new StringFieldEditor(IWebServerPreferenceConstants.PREF_HTTP_SERVER_PORTS, StringUtil.makeFormLabel(Messages.LocalWebServerPreferencePage_Port_Label), 11, getFieldEditorParent()) { { setErrorMessage(Messages.LocalWebServerPreferencePage_PortError_Message); setEmptyStringAllowed(true); } @Override protected boolean doCheckState() { Matcher matcher = PORTS_PATTERN.matcher(getStringValue()); if (matcher.matches()) { try { int start = Integer.parseInt(matcher.group(1)); if (matcher.group(2) != null) { int end = Integer.parseInt(matcher.group(3)); if (start < end) { return true; } } else { return true; } } catch (NumberFormatException e) { IdeLog.logError(WebServerUIPlugin.getDefault(), e); } } return false; } }); }