Java Code Examples for org.eclipse.ui.PlatformUI#getPreferenceStore()

The following examples show how to use org.eclipse.ui.PlatformUI#getPreferenceStore() . 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: BackgroundUpdateTaskJob.java    From developer-studio with Apache License 2.0 6 votes vote down vote up
protected IStatus run(IProgressMonitor monitor) {
	/**
	 * If the updater is scheduled daily schedule the next run in a day if
	 * not schedule the next run in a week.
	 */
	IPreferenceStore prefPage = PlatformUI.getPreferenceStore();
	String updateIntervalDay = prefPage.getString(PreferenceConstants.UPDATE_DATE_INTERVAL);
	if (updateIntervalDay == null || updateIntervalDay.isEmpty()) {
		updateIntervalDay = PreferenceConstants.DEFAULT_SUNDAY;
	}
	if (!updateIntervalDay.equals(PreferenceConstants.DAILY)) {
		repeatTime = repeatWeekDelay;
	}
	schedule(repeatTime);
	return Status.OK_STATUS;
}
 
Example 2
Source File: UpdaterRootJob.java    From developer-studio with Apache License 2.0 6 votes vote down vote up
private long evaluateTimeToUserScheduledTime() {
	final IPreferenceStore prefPage = PlatformUI.getPreferenceStore();
	String updateIntervalDay = prefPage.getString(PreferenceConstants.UPDATE_DATE_INTERVAL);
	if (updateIntervalDay == null || updateIntervalDay.isEmpty()) {
		updateIntervalDay = PreferenceConstants.DEFAULT_SUNDAY;
	}
	int intValOfDay = getIntValOfDay(updateIntervalDay);
	String updateIntervalTime = prefPage.getString(PreferenceConstants.UPDATE_TIME_INTERVAL);
	if (updateIntervalTime == null || updateIntervalTime.isEmpty()) {
		updateIntervalTime = PreferenceConstants.DEFAULT_EIGHT_AM;
	}

	String[] hourValFromIntervalTime = updateIntervalTime.split(":");
	Integer intHourVal = Integer.parseInt(hourValFromIntervalTime[0]);

	Calendar c = Calendar.getInstance();
	c.add(Calendar.DAY_OF_WEEK, intValOfDay);
	c.set(Calendar.HOUR_OF_DAY, intHourVal);
	c.set(Calendar.MINUTE, 0);
	c.set(Calendar.SECOND, 0);
	c.set(Calendar.MILLISECOND, 0);
	return (c.getTimeInMillis() - System.currentTimeMillis());

}
 
Example 3
Source File: UpdaterRootJob.java    From developer-studio with Apache License 2.0 5 votes vote down vote up
@Override
protected IStatus run(IProgressMonitor arg0) {
	// TODO Auto-generated method stub
	try {
		Thread.sleep(DELAY_ONE_MINUTE);
	} catch (InterruptedException e) {
		log.error("error while running automatic updates", e);
		Thread.currentThread().interrupt();
	}
	IPreferenceStore prefPage = PlatformUI.getPreferenceStore();
	UpdateCheckerPreferencePage.setPreferenceDefaults(prefPage);
	boolean isAutomaticUpdate = prefPage.getBoolean(PreferenceConstants.ENABLE_AUTOMATIC_UPDATES);
	String updateRunConfig = prefPage.getString(PreferenceConstants.UPDATE_RUNNING_CONFIGURATION);
	if (updateRunConfig == null || updateRunConfig.isEmpty()) {
		updateRunConfig = PreferenceConstants.STARTUP;
	}
	if (updateRunConfig.equals(PreferenceConstants.SCHEDULE)) {
		isAutomaticUpdate = false; // do not run at startup if user has
									// scheduled the updater job
		BackgroundUpdateTaskJob job = new BackgroundUpdateTaskJob("BackgroundScheduler", minute);
		// start at user specified time.
		job.schedule(evaluateTimeToUserScheduledTime());
		job.addJobChangeListener(new BackgroundUpdaterTaskListener(updateManager));
	}
	if (!isAutomaticUpdate) {
		return Status.CANCEL_STATUS;
	}
	/**
	 * before running the update checker job, read the updates meta file and
	 * see if it has updates before iterating through the updater
	 * repository. UpdateMetaFileReaderJob
	 */
	runUpdateMetaFileReaderJob();
	return Status.OK_STATUS;
}
 
Example 4
Source File: UnOpenAgainEditorPresentationFactory.java    From translationstudio8 with GNU General Public License v2.0 4 votes vote down vote up
public StackPresentation createEditorPresentation(Composite parent,
		IStackPresentationSite site) {
	DefaultTabFolder folder = new DefaultTabFolder(parent,
			editorTabPosition | SWT.BORDER, site
					.supportsState(IStackPresentationSite.STATE_MINIMIZED),
			site.supportsState(IStackPresentationSite.STATE_MAXIMIZED));

	/*
	 * Set the minimum characters to display, if the preference is something
	 * other than the default. This is mainly intended for RCP applications
	 * or for expert users (i.e., via the plug-in customization file).
	 * 
	 * Bug 32789.
	 */
	final IPreferenceStore store = PlatformUI.getPreferenceStore();
	if (store
			.contains(IWorkbenchPreferenceConstants.EDITOR_MINIMUM_CHARACTERS)) {
		final int minimumCharacters = store
				.getInt(IWorkbenchPreferenceConstants.EDITOR_MINIMUM_CHARACTERS);
		if (minimumCharacters >= 0) {
			folder.setMinimumCharacters(minimumCharacters);
		}
	}

	PresentablePartFolder partFolder = new PresentablePartFolder(folder);

	TabbedStackPresentation result = new TabbedStackPresentation(site,
			partFolder, new StandardEditorSystemMenu(site));

	DefaultThemeListener themeListener = new DefaultThemeListener(folder,
			result.getTheme());
	result.getTheme().addListener(themeListener);

	new DefaultMultiTabListener(result.getApiPreferences(),
			IWorkbenchPreferenceConstants.SHOW_MULTIPLE_EDITOR_TABS, folder);

	new DefaultSimpleTabListener(result.getApiPreferences(),
			IWorkbenchPreferenceConstants.SHOW_TRADITIONAL_STYLE_TABS,
			folder);

	return result;
}
 
Example 5
Source File: WorkbenchToolkit.java    From developer-studio with Apache License 2.0 4 votes vote down vote up
public static IPreferenceStore getPreferenceStore(){
	IPreferenceStore preferenceStore = PlatformUI.getPreferenceStore();
	return preferenceStore;
}
 
Example 6
Source File: MavenInfoPreferencePage.java    From developer-studio with Apache License 2.0 4 votes vote down vote up
@Override
public void init(IWorkbench arg0) {
	preferenceStore = PlatformUI.getPreferenceStore();
	setPreferenceStore(preferenceStore);
	setDescription("WSO2 Developer Studio Maven Information Preferences.");
}
 
Example 7
Source File: PreferenceInitializer.java    From developer-studio with Apache License 2.0 4 votes vote down vote up
public void initializeDefaultPreferences() {

		IPreferenceStore store = PlatformUI.getPreferenceStore();
		UpdateCheckerPreferencePage.setPreferenceDefaults(store);
	}
 
Example 8
Source File: CappPreferencesPage.java    From developer-studio with Apache License 2.0 4 votes vote down vote up
@Override
public void init(IWorkbench arg0) {
        preferenceStore = PlatformUI.getPreferenceStore();
        setPreferenceStore(preferenceStore);
        setDescription("WSO2 Developer Studio Custom Capp Preference.");
}
 
Example 9
Source File: UpdaterDialog.java    From developer-studio with Apache License 2.0 4 votes vote down vote up
private void listFeatures(Group group, ActiveTab tab) {
	IPreferenceStore prefPage = PlatformUI.getPreferenceStore();
	boolean showHiddenFeatures = prefPage.getBoolean(DeveloperPreferencePage.SHOW_HIDDEN_FEATURES);

	Iterator<Entry<String, EnhancedFeature>> featureList;
	if (tab == ActiveTab.ALL_FEATURES) {
		featureList = updateManager.getAvailableFeaturesMap().entrySet().iterator();
	} else {
		featureList = updateManager.getPossibleUpdatesMap().entrySet().iterator();
	}
	while (featureList.hasNext()) {
		EnhancedFeature feature = featureList.next().getValue();
		// set isKernelFeature=true or isHidden=true in update.properties
		// file in features to
		// ignore them in available Features tab
		if (tab == ActiveTab.ALL_FEATURES && !showHiddenFeatures) {
			if (feature.isKernelFeature() || feature.isHidden()) {
				continue;
			}
		}
		GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, false);
		final Group featureGroup = createFeatureRepresentationGroup(group, gridData);
		createCheckBoxInFeatureGroup(feature, featureGroup, tab);

		Label featureImageLabel = new Label(featureGroup, SWT.NONE);
		try {
			Image image = new Image(Display.getDefault(), feature.getIconURL().replace(FILE_PROTOCOL, "")); //$NON-NLS-1$
			featureImageLabel.setImage(image);
		} catch (Exception ex) {
			log.warn(Messages.UpdaterDialog_8 + feature.getId(), ex);
		}
		final Group featureInfoGroup = createFeatureInfoRepresentationGroup(featureGroup);
		StyledText featureName = createFeatureNameText(feature, featureInfoGroup);
		FontData fontData = featureName.getFont().getFontData()[0];
		Font font = new Font(featureInfoGroup.getDisplay(),
				new FontData(fontData.getName(), fontData.getHeight() + 1, SWT.BOLD));
		featureName.setFont(font);
		createFeatureNewVersionText(feature, featureInfoGroup);
		if (feature.isUpdateFeature() && feature.getWhatIsNew() != null && !feature.getWhatIsNew().isEmpty()) {
			createFeatureDescr(feature.getWhatIsNew(), feature.getBugFixes(), featureInfoGroup);
		}
	}
}
 
Example 10
Source File: UnOpenAgainEditorPresentationFactory.java    From tmxeditor8 with GNU General Public License v2.0 4 votes vote down vote up
public StackPresentation createEditorPresentation(Composite parent,
		IStackPresentationSite site) {
	DefaultTabFolder folder = new DefaultTabFolder(parent,
			editorTabPosition | SWT.BORDER, site
					.supportsState(IStackPresentationSite.STATE_MINIMIZED),
			site.supportsState(IStackPresentationSite.STATE_MAXIMIZED));

	/*
	 * Set the minimum characters to display, if the preference is something
	 * other than the default. This is mainly intended for RCP applications
	 * or for expert users (i.e., via the plug-in customization file).
	 * 
	 * Bug 32789.
	 */
	final IPreferenceStore store = PlatformUI.getPreferenceStore();
	if (store
			.contains(IWorkbenchPreferenceConstants.EDITOR_MINIMUM_CHARACTERS)) {
		final int minimumCharacters = store
				.getInt(IWorkbenchPreferenceConstants.EDITOR_MINIMUM_CHARACTERS);
		if (minimumCharacters >= 0) {
			folder.setMinimumCharacters(minimumCharacters);
		}
	}

	PresentablePartFolder partFolder = new PresentablePartFolder(folder);

	TabbedStackPresentation result = new TabbedStackPresentation(site,
			partFolder, new StandardEditorSystemMenu(site));

	DefaultThemeListener themeListener = new DefaultThemeListener(folder,
			result.getTheme());
	result.getTheme().addListener(themeListener);

	new DefaultMultiTabListener(result.getApiPreferences(),
			IWorkbenchPreferenceConstants.SHOW_MULTIPLE_EDITOR_TABS, folder);

	new DefaultSimpleTabListener(result.getApiPreferences(),
			IWorkbenchPreferenceConstants.SHOW_TRADITIONAL_STYLE_TABS,
			folder);

	return result;
}