org.eclipse.jface.preference.ComboFieldEditor Java Examples

The following examples show how to use org.eclipse.jface.preference.ComboFieldEditor. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TimeZonePreferencePage.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected void createFieldEditors ()
{
    final List<String> tzs = Arrays.asList ( TimeZone.getAvailableIDs () );
    Collections.sort ( tzs );
    final String[][] entries = new String[tzs.size ()][2];
    int i = 0;
    for ( final String id : tzs )
    {
        entries[i][0] = id;
        entries[i][1] = id;
        i += 1;
    }
    final FieldEditor field = new ComboFieldEditor ( "timeZone", Messages.TimeZonePreferencePage_TimeZone_Label, entries, getFieldEditorParent () ); //$NON-NLS-1$
    addField ( field );
}
 
Example #2
Source File: BonitaLanguagePreferencePage.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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.
 */
@Override
public void createFieldEditors() {

    createTitleBar(Messages.BonitaPreferenceDialog_language, Pics.getImage(PicsConstants.preferenceLanguage), false);

    studioLocale = new ComboFieldEditor(BonitaPreferenceConstants.CURRENT_STUDIO_LOCALE,
            Messages.bind(Messages.studioLocalLabel,
                    new Object[] { bonitaStudioModuleName }),
            toLocales(LocaleUtil.getStudioLocales()), getFieldEditorParent());
    webLocale = new ComboFieldEditor(BonitaPreferenceConstants.CURRENT_UXP_LOCALE, Messages.consoleLocaleLabel,
            toLocales(LocaleUtil.getProtalLocales()),
            getFieldEditorParent());

    addField(studioLocale);
    addField(webLocale);

}
 
Example #3
Source File: ContentAssistPreferencePage.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
/**
 * createFilterSelector
 * 
 * @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);
}
 
Example #4
Source File: ColorPredicatePreferencePage.java    From tlaplus with MIT License 5 votes vote down vote up
/**
 * 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.
 */
protected void createFieldEditors()
{

    for (int i = 1; i <= NUM_STATUS_COLORS; i++)
    {
        addField(new ColorFieldEditor(getMainColorPrefName(i), "Color " + i, getFieldEditorParent()));
        addField(new ComboFieldEditor(getColorPredPrefName(i), "Predicate", ColorPredicate.PREDEFINED_MACROS,
                getFieldEditorParent()));
        addField(new BooleanFieldEditor(getLeafSideBarPrefName(i), "Show Leaf Steps in Side Bar",
                getFieldEditorParent()));
        addField(new BooleanFieldEditor(getAppliesToLeafPrefName(i), "Applies to Leaf Steps Only",
                getFieldEditorParent()));
    }
}
 
Example #5
Source File: IoPreferencePage.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
private void createIlcdOtherContents(Composite parent) {
	Group section = new Group(parent, SWT.SHADOW_OUT);
	section.setText(M.ILCDOtherSettings);
	ComboFieldEditor langEditor = new ComboFieldEditor(
			IoPreference.ILCD_LANG, M.Language, getLanguages(),
			section);
	addField(langEditor);
	UI.gridLayout(section, 2);
	UI.gridData(section, true, false);
}
 
Example #6
Source File: SamplePageWithProvider.java    From e4Preferences with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected void createFieldEditors()
{
	
	addField(new ComboFieldEditor("prefCombo", "A combo field", new String[][]{{"display1", "value1"},{"display2", "value2"}}, getFieldEditorParent()));

	addField(new ColorFieldEditor("prefColor", "Color for table items : ", getFieldEditorParent()));
	addField(new BooleanFieldEditor("prefBoolean", "A boolean : ", getFieldEditorParent()));
	addField(new StringFieldEditor("prefString", "A string : ", getFieldEditorParent()));
}
 
Example #7
Source File: SamplePage.java    From e4Preferences with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected void createFieldEditors()
{
	
	addField(new ComboFieldEditor("prefCombo", "A combo field", new String[][]{{"display1", "value1"},{"display2", "value2"}}, getFieldEditorParent()));

	addField(new ColorFieldEditor("prefColor", "Color for table items : ", getFieldEditorParent()));
	addField(new BooleanFieldEditor("prefBoolean", "A boolean : ", getFieldEditorParent()));
	addField(new StringFieldEditor("prefString", "A string : ", getFieldEditorParent()));
}
 
Example #8
Source File: NamedElementListPluginPreference.java    From SparkBuilderGenerator with MIT License 5 votes vote down vote up
@Override
public FieldEditor createFieldEditor(Composite parent) {
    String[][] entryNamesAndValues = new String[values.size()][2];
    for (int i = 0; i < values.size(); ++i) {
        entryNamesAndValues[i][0] = values.get(i).getDisplayName();
        entryNamesAndValues[i][1] = values.get(i).getId();
    }
    return new ComboFieldEditor(this.getKey(), this.getDescription(), entryNamesAndValues, parent);
}
 
Example #9
Source File: StrategyIdentifierPluginPreferenceTest.java    From jenerate with Eclipse Public License 1.0 5 votes vote down vote up
@Test
public void testCreateFieldEditor() {
    Display.getDefault().asyncExec(new Runnable() {
        @Override
        public void run() {
            assertEquals(new ComboFieldEditor(KEY, DESCRIPTION, comboValues, parent),
                    pluginPreference.createFieldEditor(parent));
        }
    });
}
 
Example #10
Source File: StrategyIdentifierPluginPreference.java    From jenerate with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public FieldEditor createFieldEditor(Composite parent) {
    MethodContentStrategyIdentifier[] values = MethodContentStrategyIdentifier.values();
    String[][] comboValues = new String[values.length][2];
    for (int i = 0; i < values.length; i++) {
        comboValues[i] = new String[] { values[i].name(), values[i].name() };
    }
    return new ComboFieldEditor(this.getKey(), this.getDescription(), comboValues, parent);
}
 
Example #11
Source File: TypeScriptMainPreferencePage.java    From typescript.java with MIT License 5 votes vote down vote up
@Override
protected Control createContents(Composite parent) {
	Composite comp = new Composite(parent, SWT.NONE);
	comp.setFont(parent.getFont());
	comp.setLayout(new GridLayout());
	comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

	String[][] uses = new String[3][2];
	uses[0][0] = TypeScriptUIMessages.TypeScriptMainPreferencePage_useSalsa_Never;
	uses[0][1] = UseSalsa.Never.name();
	uses[1][0] = TypeScriptUIMessages.TypeScriptMainPreferencePage_useSalsa_EveryTime;
	uses[1][1] = UseSalsa.EveryTime.name();
	uses[2][0] = TypeScriptUIMessages.TypeScriptMainPreferencePage_useSalsa_WhenNoJSDTNature;
	uses[2][1] = UseSalsa.WhenNoJSDTNature.name();

	ComboFieldEditor ternServerEditor = new ComboFieldEditor(
			TypeScriptCorePreferenceConstants.USE_SALSA_AS_JS_INFERENCE,
			TypeScriptUIMessages.TypeScriptMainPreferencePage_useSalsa, uses, comp);
	initEditor(ternServerEditor, getPreferenceStore());

	Group refactoringGroup = new Group(comp, SWT.NONE);
	refactoringGroup.setLayout(new GridLayout());
	GridData data = new GridData(GridData.FILL_HORIZONTAL);
	data.horizontalSpan = 2;
	refactoringGroup.setLayoutData(data);
	refactoringGroup.setText(TypeScriptUIMessages.TypeScriptMainPreferencePage_refactoring_title);

	BooleanFieldEditor refactoringAutoSave = new BooleanFieldEditor(
			TypeScriptCorePreferenceConstants.REFACTOR_SAVE_ALL_EDITORS,
			TypeScriptUIMessages.TypeScriptMainPreferencePage_refactoring_auto_save, refactoringGroup);
	initEditor(refactoringAutoSave, getPreferenceStore());

	BooleanFieldEditor refactoringLightweight = new BooleanFieldEditor(
			TypeScriptCorePreferenceConstants.REFACTOR_LIGHTWEIGHT,
			TypeScriptUIMessages.TypeScriptMainPreferencePage_refactoring_lightweight, refactoringGroup);
	initEditor(refactoringLightweight, getPreferenceStore());
	initGroup(refactoringGroup);

	return comp;
}
 
Example #12
Source File: ModelEditorPreferencePage.java    From tlaplus with MIT License 5 votes vote down vote up
protected void createFieldEditors() {
    addField(new BooleanFieldEditor(IModelEditorPreferenceConstants.I_MODEL_EDITOR_SHOW_ECE_AS_TAB,
            "Show Evaluate Constant Expression in its own tab", getFieldEditorParent()));
    
    final String[][] overrideDisplays = {
    		{ "Definition [Module Name]",
    			IModelEditorPreferenceConstants.I_OVERRIDDEN_DEFINITION_STYLE_MODULE_NAME },
    		{ "InstanceName!Definition",
    			IModelEditorPreferenceConstants.I_OVERRIDDEN_DEFINITION_STYLE_INSTANCE_NAME }
    };
    addField(new ComboFieldEditor(IModelEditorPreferenceConstants.I_OVERRIDDEN_DEFINITION_STYLE,
    		"Definition Override display style", overrideDisplays, getFieldEditorParent()));
}
 
Example #13
Source File: SettingsPreferencePage.java    From cppcheclipse with Apache License 2.0 4 votes vote down vote up
@Override
protected void createFieldEditors() {
	numberOfThreads = new IntegerFieldEditor(
			IPreferenceConstants.P_NUMBER_OF_THREADS,
			Messages.SettingsPreferencePage_NumberOfThreads,
			getFieldEditorParent(), 2) {

		@Override
		public void setEnabled(boolean enabled, Composite parent) {
			if (enabled) {
				enabled = !unusedFunctionsCheck.getBooleanValue();
			}
			super.setEnabled(enabled, parent);
		}

	};
	numberOfThreads.setValidRange(1, 16);
	addField(numberOfThreads);

	createCheckGroup();
	
	final BooleanFieldEditor inconclusiveChecks = new BooleanFieldEditor(
			IPreferenceConstants.P_CHECK_INCONCLUSIVE,
			Messages.SettingsPreferencePage_Inconclusive,
			getFieldEditorParent());
	addField(inconclusiveChecks);
	
	BooleanFieldEditor checkEditor = new BooleanFieldEditor(
			IPreferenceConstants.P_LANGUAGE_STANDARD_POSIX,
			Messages.SettingsPreferencePage_LanguageStandard_Posix, getFieldEditorParent());
	addField(checkEditor);
	
	final ComboFieldEditor languageStandardCEditor = new ComboFieldEditor(
			IPreferenceConstants.P_LANGUAGE_STANDARD_C,
			"C Language Standard", new String[][] {
					{ "Unspecified", "" }, { "C89", "c89" },
					{ "C99", "c99" }, { "C11", "c11" }}, getFieldEditorParent());
	addField(languageStandardCEditor);
	
	final ComboFieldEditor languageStandardCppEditor = new ComboFieldEditor(
			IPreferenceConstants.P_LANGUAGE_STANDARD_CPP,
			"C++ Language Standard", new String[][] {
					{ "Unspecified", "" }, { "C++03", "c++03" },
					{ "C++11", "c++11" }}, getFieldEditorParent());
	addField(languageStandardCppEditor);

	final ComboFieldEditor platformsEditor = new ComboFieldEditor(
			IPreferenceConstants.P_TARGET_PLATFORM,
			Messages.SettingsPreferencePage_TargetPlatform, new String[][] {
					{ "Unspecified", "" }, { "Win32 (ANSI)", "win32A" },
					{ "Win32 (Unicode)", "win32W" }, { "Win64", "win64" },
					{ "Unix (32bit)", "unix32" },
					{ "Unix (64bit)", "unix64" } }, getFieldEditorParent());
	addField(platformsEditor);

	// special flags
	final BooleanFieldEditor forceCheck = new BooleanFieldEditor(
			IPreferenceConstants.P_CHECK_FORCE,
			Messages.SettingsPreferencePage_Force, getFieldEditorParent());
	addField(forceCheck);

	final BooleanFieldEditor verboseCheck = new BooleanFieldEditor(
			IPreferenceConstants.P_CHECK_VERBOSE,
			Messages.SettingsPreferencePage_Verbose, getFieldEditorParent());
	addField(verboseCheck);

	final BooleanFieldEditor useInlineSuppressions = new BooleanFieldEditor(
			IPreferenceConstants.P_USE_INLINE_SUPPRESSIONS,
			Messages.SettingsPreferencePage_InlineSuppressions,
			getFieldEditorParent());
	addField(useInlineSuppressions);

	final BooleanFieldEditor debugCheck = new BooleanFieldEditor(
			IPreferenceConstants.P_CHECK_DEBUG,
			Messages.SettingsPreferencePage_Debug, getFieldEditorParent());
	addField(debugCheck);

	final BooleanFieldEditor followSystemIncludes = new BooleanFieldEditor(
			IPreferenceConstants.P_FOLLOW_SYSTEM_INCLUDES,
			Messages.SettingsPreferencePage_FollowSystemIncludes,
			getFieldEditorParent());
	addField(followSystemIncludes);

	final BooleanFieldEditor followUserIncludes = new BooleanFieldEditor(
			IPreferenceConstants.P_FOLLOW_USER_INCLUDES,
			Messages.SettingsPreferencePage_FollowUserIncludes,
			getFieldEditorParent());
	addField(followUserIncludes);

}
 
Example #14
Source File: ContentAssistPreferencePage.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
/**
 * createProposalGroupContent
 * 
 * @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
}
 
Example #15
Source File: UpdateCheckerPreferencePage.java    From developer-studio with Apache License 2.0 4 votes vote down vote up
@Override
protected void createFieldEditors() {
	
	
	fieldEditorParent = getFieldEditorParent();
	boolean isSchedulingEnabled = false;
	addBlankSeparator(fieldEditorParent);
	setSeparator(fieldEditorParent);
	addField(new BooleanFieldEditor(PreferenceConstants.ENABLE_AUTOMATIC_UPDATES, "Check for updates Automatically",
			fieldEditorParent));
	setSeparator(fieldEditorParent);

	boolean isUpdatesEnabled = preferenceStore.getBoolean(PreferenceConstants.ENABLE_AUTOMATIC_UPDATES);

	enableDisableSet = new Composite(fieldEditorParent, SWT.LEFT);

	addBlankSeparator(enableDisableSet);
	updateSchedulingRadioBttn = new RadioGroupFieldEditor(PreferenceConstants.UPDATE_RUNNING_CONFIGURATION,
			"Automatic Updates Scheduling", 1,
			new String[][] { { PreferenceConstants.RUN_ON_STARTUP, PreferenceConstants.STARTUP },
					{ PreferenceConstants.SCHEDULE_UPDATER, PreferenceConstants.SCHEDULE } },
			enableDisableSet);
	addField(updateSchedulingRadioBttn);
	updateSchedulingRadioBttn.setEnabled(isUpdatesEnabled, enableDisableSet);

	if (preferenceStore.getString(PreferenceConstants.UPDATE_RUNNING_CONFIGURATION)
			.equals(PreferenceConstants.SCHEDULE)) {
		isSchedulingEnabled = true;
	}

	String[][] dayIntervals = { { PreferenceConstants.DAILY, PreferenceConstants.DAILY },
			{ PreferenceConstants.DEFAULT_SUNDAY, PreferenceConstants.DEFAULT_SUNDAY },
			{ PreferenceConstants.EVERY_MONDAY, PreferenceConstants.EVERY_MONDAY },
			{ PreferenceConstants.EVERY_TUESDAY, PreferenceConstants.EVERY_TUESDAY },
			{ PreferenceConstants.EVERY_WEDNESDAY, PreferenceConstants.EVERY_WEDNESDAY },
			{ PreferenceConstants.EVERY_THURSDAY, PreferenceConstants.EVERY_THURSDAY },
			{ PreferenceConstants.EVERY_FRIDAY, PreferenceConstants.EVERY_FRIDAY },
			{ PreferenceConstants.EVERY_SATURDAY, PreferenceConstants.EVERY_SATURDAY } };
	intervalDayEditor = new ComboFieldEditor(PreferenceConstants.UPDATE_DATE_INTERVAL, "Check for updates ",
			dayIntervals, enableDisableSet);
	addField(intervalDayEditor);
	intervalDayEditor.setEnabled(isUpdatesEnabled && isSchedulingEnabled, enableDisableSet);

	String[][] timeIntervals = { { PreferenceConstants.MIDNIGHT, PreferenceConstants.MIDNIGHT },
			{ PreferenceConstants.ONEAM, PreferenceConstants.ONEAM },
			{ PreferenceConstants.TWOAM, PreferenceConstants.TWOAM },
			{ PreferenceConstants.THREEAM, PreferenceConstants.THREEAM },
			{ PreferenceConstants.FOURAM, PreferenceConstants.FOURAM },
			{ PreferenceConstants.FIVEAM, PreferenceConstants.FIVEAM },
			{ PreferenceConstants.SIXAM, PreferenceConstants.SIXAM },
			{ PreferenceConstants.SEVENAM, PreferenceConstants.SEVENAM },
			{ PreferenceConstants.DEFAULT_EIGHT_AM, PreferenceConstants.NINEAM },
			{ PreferenceConstants.TENAM, PreferenceConstants.TENAM },
			{ PreferenceConstants.ELEVENAM, PreferenceConstants.ELEVENAM },
			{ PreferenceConstants.TWELEVENOON, PreferenceConstants.TWELEVENOON },
			{ PreferenceConstants.ONEPM, PreferenceConstants.ONEPM },
			{ PreferenceConstants.TWOPM, PreferenceConstants.TWOPM },
			{ PreferenceConstants.THREEPM, PreferenceConstants.THREEPM },
			{ PreferenceConstants.FOURPM, PreferenceConstants.FOURPM },
			{ PreferenceConstants.FIVEPM, PreferenceConstants.FIVEPM },
			{ PreferenceConstants.SIXPM, PreferenceConstants.SIXPM },
			{ PreferenceConstants.SIXPM, PreferenceConstants.SIXPM },
			{ PreferenceConstants.SEVENPM, PreferenceConstants.SEVENPM },
			{ PreferenceConstants.EIGHTPM, PreferenceConstants.EIGHTPM },
			{ PreferenceConstants.NINEPM, PreferenceConstants.NINEPM },
			{ PreferenceConstants.TENPM, PreferenceConstants.TENPM },
			{ PreferenceConstants.ELEVENPM, PreferenceConstants.ELEVENPM } };
	intervalTimeEditor = new ComboFieldEditor(PreferenceConstants.UPDATE_TIME_INTERVAL, "at", timeIntervals,
			enableDisableSet);
	addField(intervalTimeEditor);
	intervalTimeEditor.setEnabled(isUpdatesEnabled && isSchedulingEnabled, enableDisableSet);

	setSeparator(enableDisableSet);
	addBlankSeparator(enableDisableSet);
	updateInstallationRadioBttn = new RadioGroupFieldEditor(PreferenceConstants.UPDATE_NOTIFICATION_CONFIGURATION,
			"Specify Installation Preference", 1,
			new String[][] { { PreferenceConstants.NOTIFY_ME_IF_UPDATES_AVAILABLE, PreferenceConstants.NOTIFY_ME },
					{ PreferenceConstants.DOWNLOAD_UPDATES, PreferenceConstants.INSTALL_AUTOMATICALLY } },
			enableDisableSet);
	addField(updateInstallationRadioBttn);
	updateInstallationRadioBttn.setEnabled(isUpdatesEnabled, enableDisableSet);

	setSeparator(enableDisableSet);
	addBlankSeparator(enableDisableSet);
	updateSiteURL = new StringFieldEditor(PreferenceConstants.UPDATE_SITE_URL, "Update site:", enableDisableSet);
	releaseSiteURL = new StringFieldEditor(PreferenceConstants.RELESE_SITE_URL, "Release site:", enableDisableSet);
	updateSiteURL.setEnabled(isUpdatesEnabled, enableDisableSet);
	releaseSiteURL.setEnabled(isUpdatesEnabled, enableDisableSet);
	addField(updateSiteURL);
	addField(releaseSiteURL);

	setSeparator(fieldEditorParent);

}
 
Example #16
Source File: ClientTrustStorePreferencePage.java    From developer-studio with Apache License 2.0 4 votes vote down vote up
@Override
protected void createFieldEditors() {
	addField(new FileFieldEditor(TRUST_STORE_LOCATION, "&Trust Store Location:", getFieldEditorParent()));
	
	String[][] types = { { "JKS", "JKS" }, { "JCEKS", "JCEKS" }, { "PKCS12", "PKCS12" } };
	ComboFieldEditor editor = new ComboFieldEditor(TRUST_STORE_TYPE, "Trust &Store Type", types,
			getFieldEditorParent());

	addField(editor);
	stringField1 = new StringFieldEditor(TRUST_STORE_PASSWORD, "Trust Store &Password", getFieldEditorParent());
	addField(stringField1);
	BooleanFieldEditor booleanFieldEditor = new BooleanFieldEditor(SHOW_PLAIN_PASSWORD,
			"S&how Password in Plain Text", getFieldEditorParent());
	addField(booleanFieldEditor);
	if (!preferenceStore.getBoolean(SHOW_PLAIN_PASSWORD)) {
		stringField1.getTextControl(getFieldEditorParent()).setEchoChar('*');
	}
	preferenceStore.addPropertyChangeListener(new IPropertyChangeListener() {

		@Override
		public void propertyChange(org.eclipse.jface.util.PropertyChangeEvent arg0) {

			if (SHOW_PLAIN_PASSWORD.equals(arg0.getProperty())) {
				boolean boolean1 = preferenceStore.getBoolean(SHOW_PLAIN_PASSWORD);
				if (boolean1) {
					stringField1.getTextControl(getFieldEditorParent()).setEchoChar('\0');
				} else {
					stringField1.getTextControl(getFieldEditorParent()).setEchoChar('*');
				}
			}

			if (TRUST_STORE_LOCATION.equals(arg0.getProperty())) {
				String string = preferenceStore.getString(TRUST_STORE_LOCATION);
				if (!string.equals("") && !string.endsWith(".jks")) {
					MessageDialog.openError(Display.getCurrent().getActiveShell(), "Developer Studio Error Dialog",
					                        "You cannot set non JKS trust stores from Developer Studio");
				}
			}

		}
	});

}
 
Example #17
Source File: TmfTimestampFormatPage.java    From tracecompass with Eclipse Public License 2.0 4 votes vote down vote up
@Override
protected Control createContents(Composite parent) {

    // Overall preference page layout
    GridLayout gl = new GridLayout();
    gl.marginHeight = 0;
    gl.marginWidth = 0;
    parent.setLayout(gl);
    fPage = new Composite(parent, SWT.NONE);
    fPage.setLayout(new GridLayout());
    fPage.setLayoutData(new GridData(
            GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_VERTICAL | GridData.VERTICAL_ALIGN_FILL));

    // Example section
    fExampleSection = new Composite(fPage, SWT.NONE);
    fExampleSection.setLayout(new GridLayout(2, false));
    fExampleSection.setLayoutData(new GridData(GridData.FILL_BOTH));

    Label patternLabel = new Label(fExampleSection, SWT.HORIZONTAL);
    patternLabel.setText("Current Format: "); //$NON-NLS-1$
    fPatternDisplay = new Text(fExampleSection, SWT.BORDER | SWT.READ_ONLY);
    fPatternDisplay.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    Label exampleLabel = new Label(fExampleSection, SWT.NONE);
    exampleLabel.setText("Sample Display: "); //$NON-NLS-1$
    fExampleDisplay = new Text(fExampleSection, SWT.BORDER | SWT.READ_ONLY);
    fExampleDisplay.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    Label separator = new Label(fPage, SWT.SEPARATOR | SWT.HORIZONTAL | SWT.SHADOW_NONE);
    separator.setLayoutData(
            new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));

    // Time Zones
    String[][] timeZoneIntervals = new String[timeZones.length][2];
    timeZoneIntervals[0][0] = timeZones[0];
    timeZoneIntervals[0][1] = fPreferenceStore.getDefaultString(ITmfTimePreferencesConstants.TIME_ZONE);
    for (int i = 1; i < timeZones.length; i++) {
        TimeZone tz = null;
        try {
            tz = TimeZone.getTimeZone(timeZones[i]);
            timeZoneIntervals[i][0] = tz.getDisplayName();
            timeZoneIntervals[i][1] = tz.getID();
        } catch (NullPointerException e) {
            Activator.getDefault().logError("TimeZone " + timeZones[i] + " does not exist.", e); //$NON-NLS-1$ //$NON-NLS-2$
        }
    }

    fCombo = new ComboFieldEditor(ITmfTimePreferencesConstants.TIME_ZONE, "Time Zone", timeZoneIntervals, fPage); //$NON-NLS-1$
    fCombo.setPreferenceStore(fPreferenceStore);
    fCombo.load();
    fCombo.setPropertyChangeListener(this);

    // Date and Time section
    fDateTimeFields = new RadioGroupFieldEditor(
            ITmfTimePreferencesConstants.DATIME, "Date and Time format", 3, fDateTimeFormats, fPage, true); //$NON-NLS-1$
    fDateTimeFields.setPreferenceStore(fPreferenceStore);
    fDateTimeFields.load();
    fDateTimeFields.setPropertyChangeListener(this);

    // Sub-second section
    fSSecFields = new RadioGroupFieldEditor(
            ITmfTimePreferencesConstants.SUBSEC, "Sub-second format", 3, fSubSecondFormats, fPage, true); //$NON-NLS-1$
    fSSecFields.setPreferenceStore(fPreferenceStore);
    fSSecFields.load();
    fSSecFields.setPropertyChangeListener(this);

    // Separators section
    fDateFieldDelim = new RadioGroupFieldEditor(
            ITmfTimePreferencesConstants.DATE_DELIMITER, "Date delimiter", 5, fDateTimeDelimiters, fPage, true); //$NON-NLS-1$
    fDateFieldDelim.setPreferenceStore(fPreferenceStore);
    fDateFieldDelim.load();
    fDateFieldDelim.setPropertyChangeListener(this);

    fTimeFieldDelim = new RadioGroupFieldEditor(
            ITmfTimePreferencesConstants.TIME_DELIMITER, "Time delimiter", 5, fDateTimeDelimiters, fPage, true); //$NON-NLS-1$
    fTimeFieldDelim.setPreferenceStore(fPreferenceStore);
    fTimeFieldDelim.load();
    fTimeFieldDelim.setPropertyChangeListener(this);

    fSSecFieldDelim = new RadioGroupFieldEditor(
            ITmfTimePreferencesConstants.SSEC_DELIMITER, "Sub-Second Delimiter", 5, fSubSecondDelimiters, fPage, true); //$NON-NLS-1$
    fSSecFieldDelim.setPreferenceStore(fPreferenceStore);
    fSSecFieldDelim.load();
    fSSecFieldDelim.setPropertyChangeListener(this);

    refresh();
    return fPage;
}
 
Example #18
Source File: InteractiveConsolePrefs.java    From Pydev with Eclipse Public License 1.0 4 votes vote down vote up
@Override
protected void createFieldEditors() {
    Composite p = getFieldEditorParent();

    addField(new ColorFieldEditor(PydevConsoleConstants.CONSOLE_OUTPUT_COLOR, "Stdout color", p));

    addField(new ColorFieldEditor(PydevConsoleConstants.CONSOLE_ERROR_COLOR, "Stderr color", p));

    addField(new ColorFieldEditor(PydevConsoleConstants.CONSOLE_INPUT_COLOR, "Stdin color", p));

    addField(new ColorFieldEditor(PydevConsoleConstants.CONSOLE_PROMPT_COLOR, "Prompt color", p));

    addField(new ColorFieldEditor(PydevConsoleConstants.CONSOLE_BACKGROUND_COLOR,
            "Background color", p));

    addField(new ColorFieldEditor(PydevConsoleConstants.DEBUG_CONSOLE_BACKGROUND_COLOR,
            "Debug console background color", p));

    addField(new StringFieldEditor(PydevConsoleConstants.INTERACTIVE_CONSOLE_VM_ARGS,
            "Vm Args for jython\n(used only on external\nprocess option):", p));

    addField(new StringFieldEditor(PydevConsoleConstants.INTERACTIVE_CONSOLE_ENCODING,
            "Encoding for interactive console:", p));

    addField(new IntegerFieldEditor(PydevConsoleConstants.INTERACTIVE_CONSOLE_MAXIMUM_CONNECTION_ATTEMPTS,
            "Maximum connection attempts\nfor initial communication:", p));

    addField(new BooleanFieldEditor(PydevConsoleConstants.INTERACTIVE_CONSOLE_FOCUS_ON_CONSOLE_START,
            "Focus console when it's started?", BooleanFieldEditor.SEPARATE_LABEL, p));

    addField(new BooleanFieldEditor(PydevConsoleConstants.INTERACTIVE_CONSOLE_TAB_COMPLETION,
            "Enable tab completion in interactive console?", BooleanFieldEditor.SEPARATE_LABEL, p));

    addField(new IntegerFieldEditor(
            ScriptConsoleUIConstants.INTERACTIVE_CONSOLE_PERSISTENT_HISTORY_MAXIMUM_ENTRIES,
            "Maximum number of lines to\nstore in global history\n(0 for unlimited):", p) {
        // We are trying to set a preference that is in a different store, but logically lives within this UI
        @Override
        public IPreferenceStore getPreferenceStore() {
            return InteractiveConsolePlugin.getDefault().getPreferenceStore();
        }
    });

    addField(new BooleanFieldEditor(
            PydevConsoleConstants.INTERACTIVE_CONSOLE_SEND_INITIAL_COMMAND_WHEN_CREATED_FROM_EDITOR,
            "When creating console send\ncurrent selection/editor\ncontents for execution?",
            BooleanFieldEditor.SEPARATE_LABEL, p));

    addField(new BooleanFieldEditor(PydevConsoleConstants.INTERACTIVE_CONSOLE_FOCUS_ON_SEND_COMMAND,
            "Focus console when an evaluate\ncommand is sent from the editor?", BooleanFieldEditor.SEPARATE_LABEL,
            p));

    addField(new BooleanFieldEditor(PydevConsoleConstants.INTERACTIVE_CONSOLE_CONNECT_DEBUG_SESSION,
            "Connect console to a Debug Session?", BooleanFieldEditor.SEPARATE_LABEL, p));

    addField(new ComboFieldEditor(PydevConsoleConstants.INTERACTIVE_CONSOLE_ENABLE_GUI_ON_STARTUP,
            "Enable GUI event loop integration?",
            PydevConsoleConstants.ENTRIES_VALUES_INTERACTIVE_CONSOLE_ENABLE_GUI_ON_STARTUP, p));

}
 
Example #19
Source File: WorkbenchPreferencePage.java    From MergeProcessor with Apache License 2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected void createFieldEditors() {
	addField(createWorkingFolderFieldEditor());
	addField(createUserFieldEditor());
	addField(createRefreshIntervalFieldEditor());

	String[][] entryNamesAndValues = getLogLevels().stream()
			.map(level -> new String[] { level.getName(), level.getName() }).toArray(String[][]::new);
	ComboFieldEditor comboFieldEditorLogLevel = new ComboFieldEditor(LOG_LEVEL,
			Messages.WorkbenchPreferencePage_LogLevel, entryNamesAndValues, getFieldEditorParent());
	addField(comboFieldEditorLogLevel);

	addField(createWindowLocationFieldEditor());
	addField(createWindowSizeFieldEditor());

	String[][] entrySortColumnNamesAndValues = Arrays.stream(Column.sortedValues())
			.map(column -> new String[] { column.toString(), Integer.toString(column.ordinal()) })
			.toArray(size -> new String[size][]);
	ComboFieldEditor cfeSortColumn = new ComboFieldEditor(SORT_COLUMN,
			Messages.WorkbenchPreferencePage_SortedColumn, entrySortColumnNamesAndValues, getFieldEditorParent());
	addField(cfeSortColumn);

	String[][] entrySortDirectionNamesAndValues = new String[][] {
			{ Messages.WorkbenchPreferencePage_SortDirection_Up, String.valueOf(SWT.UP) },
			{ Messages.WorkbenchPreferencePage_SortDirection_Down, String.valueOf(SWT.DOWN) } };
	ComboFieldEditor cfeSortDirection = new ComboFieldEditor(SORT_DIRECTION,
			Messages.WorkbenchPreferencePage_SortDirection, entrySortDirectionNamesAndValues,
			getFieldEditorParent());
	addField(cfeSortDirection);

	final Label separator = new Label(getFieldEditorParent(), SWT.SEPARATOR | SWT.HORIZONTAL);
	GridDataFactory.fillDefaults().span(3, 1).applyTo(separator);

	addField(new CheckedStringFieldEditor(SFTP_USERNAME, //
			Messages.WorkbenchPreferencePage_SftpUsername, //
			getFieldEditorParent(), //
			Messages.WorkbenchPreferencePage_Validate_SftpUsernameMustntBeEmpty));
	final CheckedStringFieldEditor sftpPassword = new CheckedStringFieldEditor(SFTP_PASSWORD,
			Messages.WorkbenchPreferencePage_SftpPassword, //
			getFieldEditorParent(), //
			Messages.WorkbenchPreferencePage_Validate_SftpPasswordMustntBeEmpty);
	sftpPassword.getTextControl(getFieldEditorParent()).setEchoChar('*');
	addField(sftpPassword);
	addField(new CheckedStringFieldEditor(SFTP_HOST, //
			Messages.WorkbenchPreferencePage_SftpHost, //
			getFieldEditorParent(), //
			Messages.WorkbenchPreferencePage_Validate_SftpHostMustntBeEmpty));
	addField(new CheckedStringFieldEditor(SFTP_MERGEFOLDER, //
			Messages.WorkbenchPreferencePage_SftpMergeFolder, //
			getFieldEditorParent(), //
			Messages.WorkbenchPreferencePage_Validate_SftpMergeFolderMustntBeEmpty));

}
 
Example #20
Source File: MavenInfoPreferencePage.java    From developer-studio with Apache License 2.0 2 votes vote down vote up
@Override
protected void createFieldEditors() {
	addEmptyField();

	addField(new LabelFieldEditor("Custom Maven Parent Information", getFieldEditorParent()));

	addField(new StringFieldEditor(GLOBAL_PARENT_MAVEN_GROUP_ID, "Custom Parent GroupId", getFieldEditorParent()));

	addField(new StringFieldEditor(GLOBAL_PARENT_MAVEN_ARTIFACTID, "Custom Parent ArtifactId",
	                               getFieldEditorParent()));

	addField(new StringFieldEditor(GLOBAL_PARENT_MAVEN_VERSION, "Custom Parent Version", getFieldEditorParent()));

	addEmptyField();

	addField(new LabelFieldEditor("Custom Global Maven Information", getFieldEditorParent()));

	addField(new StringFieldEditor(GLOBAL_MAVEN_GROUP_ID, "Custom GroupId", getFieldEditorParent()));

	addField(new StringFieldEditor(GLOBAL_MAVEN_VERSION, "Custom Version", getFieldEditorParent()));

	addEmptyField();

	addField(new LabelFieldEditor("Enable/Disable WSO2 Maven Repository", getFieldEditorParent()));
	
	addField(new BooleanFieldEditor(DISABLE_WSO2_REPOSITORY, EXCLUDE_WSO2_REPOSITORY_LABEL, getFieldEditorParent()));
	
	addEmptyField();

	addField(new LabelFieldEditor("Custom Maven Repository Information", getFieldEditorParent()));

	addField(new StringFieldEditor(GLOBAL_REPOSITORY_URL, "Custom Repository URL", getFieldEditorParent()));

	addField(new StringFieldEditor(GLOBAL_REPOSITORY_ID, "Custom Repository ID", getFieldEditorParent()));

	addEmptyField();
	
	addField(new LabelFieldEditor("Releases", getFieldEditorParent()));

	addField(new BooleanFieldEditor(RELEASES_ENABLED, "Enabled", getFieldEditorParent()));

	String[][] a = { { "Ignore", "Ignore" }, { "fail", "fail" }, { "warn", "warn" } };

	addField(new ComboFieldEditor(RELEASES_CHECKSUM_POLICY, CHECKSUM_POLICY_LABEL, a, getFieldEditorParent()));

	String[][] b = { { "always", "always" }, { "daily", "daily" }, { "never", "never" } };

	addField(new ComboFieldEditor(RELEASES_UPDATE_POLICY, UPDATE_POLICY_LABEL, b, getFieldEditorParent()));

	addEmptyField();
	
	addField(new LabelFieldEditor("Snapshots", getFieldEditorParent()));

	addField(new BooleanFieldEditor(SNAPSHOTS_ENABLED, "Enabled", getFieldEditorParent()));

	addField(new ComboFieldEditor(SNAPSHOTS_CHECKSUM_POLICY, CHECKSUM_POLICY_LABEL, a, getFieldEditorParent()));

	addField(new ComboFieldEditor(SNAPSHOTS_UPDATE_POLICY, UPDATE_POLICY_LABEL, b, getFieldEditorParent()));

}