Java Code Examples for org.eclipse.jface.preference.ComboFieldEditor#setEnabled()

The following examples show how to use org.eclipse.jface.preference.ComboFieldEditor#setEnabled() . 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: 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 2
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);

}