Java Code Examples for org.eclipse.core.runtime.preferences.ConfigurationScope#getNode()

The following examples show how to use org.eclipse.core.runtime.preferences.ConfigurationScope#getNode() . 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: SendPingJob.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
private boolean enroll()
{
	ConfigurationScope scope = EclipseUtil.configurationScope();
	boolean hasEnrolled = Platform.getPreferencesService().getBoolean(UsagePlugin.PLUGIN_ID,
			IPreferenceConstants.HAS_ENROLLED, false, new IScopeContext[] { scope });
	if (!hasEnrolled)
	{
		AnalyticsInfo info = UsagePlugin.getDefault().getAnalyticsInfoManager()
				.getInfo("com.aptana.usage.analytics"); //$NON-NLS-1$
		String guid = info.getAppGuid();
		// only sends the enroll ping if it's Aptana Studio
		if ((new DefaultAnalyticsInfo()).getAppGuid().equals(guid))
		{
			// @formatter:off
			Map<String, String> payload = CollectionsUtil.newInOrderMap(
				"guid", guid, //$NON-NLS-1$
				"mid", CorePlugin.getMID()); //$NON-NLS-1$
			// @formatter:on

			StudioAnalytics.getInstance().sendEvent(new AnalyticsEvent(STUDIO_ENROLL, STUDIO_ENROLL, payload));
		}

		IEclipsePreferences store = scope.getNode(UsagePlugin.PLUGIN_ID);
		store.putBoolean(IPreferenceConstants.HAS_ENROLLED, true);
		try
		{
			store.flush();
			return true;
		}
		catch (BackingStoreException e)
		{
			UsagePlugin.logError(e);
		}
	}
	return false;
}
 
Example 2
Source File: SendPingJob.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
private boolean sendFirstRunEvent()
{
	ConfigurationScope scope = EclipseUtil.configurationScope();
	boolean hasRun = Platform.getPreferencesService().getBoolean(UsagePlugin.PLUGIN_ID,
			IPreferenceConstants.P_IDE_HAS_RUN, false, new IScopeContext[] { scope });
	if (!hasRun)
	{
		// checks with the previous plugin id
		hasRun = Platform.getPreferencesService().getBoolean(UsagePlugin.OLD_PLUGIN_ID,
				IPreferenceConstants.P_IDE_HAS_RUN, false, new IScopeContext[] { scope });
		if (!hasRun)
		{
			StudioAnalytics.getInstance().sendEvent(new AnalyticsEvent(STUDIO_FIRST_RUN, STUDIO_FIRST_RUN, null));

			IEclipsePreferences store = scope.getNode(UsagePlugin.PLUGIN_ID);
			store.putBoolean(IPreferenceConstants.P_IDE_HAS_RUN, true);
			try
			{
				store.flush();
				return true;
			}
			catch (BackingStoreException e)
			{
				UsagePlugin.logError(e);
			}
		}
	}
	return false;
}
 
Example 3
Source File: GdtPreferences.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 4 votes vote down vote up
private static IEclipsePreferences getConfigurationPreferences() {
  ConfigurationScope scope = new ConfigurationScope();
  IEclipsePreferences configurationPrefs = scope.getNode(GdtPlugin.PLUGIN_ID);
  return configurationPrefs;
}