X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.workbench%2Fsrc%2Forg%2Fsimantics%2Fworkbench%2Finternal%2Fpreferences%2FSimanticsPreferenceInitializer.java;fp=bundles%2Forg.simantics.workbench%2Fsrc%2Forg%2Fsimantics%2Fworkbench%2Finternal%2Fpreferences%2FSimanticsPreferenceInitializer.java;h=644df301aa0924ad3f435102a18fe3ca142459a5;hp=a2bacee626635da9993890dc28bc525d459af9a1;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hpb=24e2b34260f219f0d1644ca7a138894980e25b14 diff --git a/bundles/org.simantics.workbench/src/org/simantics/workbench/internal/preferences/SimanticsPreferenceInitializer.java b/bundles/org.simantics.workbench/src/org/simantics/workbench/internal/preferences/SimanticsPreferenceInitializer.java index a2bacee62..644df301a 100644 --- a/bundles/org.simantics.workbench/src/org/simantics/workbench/internal/preferences/SimanticsPreferenceInitializer.java +++ b/bundles/org.simantics.workbench/src/org/simantics/workbench/internal/preferences/SimanticsPreferenceInitializer.java @@ -1,47 +1,47 @@ -/******************************************************************************* - * Copyright (c) 2007, 2011 Association for Decentralized Information Management in - * Industry THTH ry. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * VTT Technical Research Centre of Finland - initial API and implementation - *******************************************************************************/ -package org.simantics.workbench.internal.preferences; - -import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; -import org.eclipse.core.runtime.preferences.DefaultScope; -import org.eclipse.core.runtime.preferences.IScopeContext; -import org.eclipse.core.runtime.preferences.InstanceScope; -import org.osgi.service.prefs.Preferences; -import org.simantics.workbench.internal.Activator; - -/** - * @author Tuukka Lehtonen - */ -public class SimanticsPreferenceInitializer extends AbstractPreferenceInitializer { - - @Override - public void initializeDefaultPreferences() { - IScopeContext defaults = DefaultScope.INSTANCE; - Preferences node = defaults.getNode(Activator.PLUGIN_ID); - node.putBoolean(SimanticsPreferences.SHOW_DATABASE_CONTROLS, false); - - IScopeContext instance = InstanceScope.INSTANCE; - node = instance.getNode(Activator.PLUGIN_ID); - boolean show = node.getBoolean(SimanticsPreferences.SHOW_DATABASE_CONTROLS, false); - if (show) - System.setProperty(bind(Activator.PLUGIN_ID, SimanticsPreferences.SHOW_DATABASE_CONTROLS), "true"); - - // NOTE: the above system property are used in plugin.xml with - // systemTest in menu contribution visibility checking. - // This implementation requires a restart every time the preference is changed. - } - - private static String bind(String namespace, String pref) { - return namespace + "." + pref; - } - -} +/******************************************************************************* + * Copyright (c) 2007, 2011 Association for Decentralized Information Management in + * Industry THTH ry. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.workbench.internal.preferences; + +import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; +import org.eclipse.core.runtime.preferences.DefaultScope; +import org.eclipse.core.runtime.preferences.IScopeContext; +import org.eclipse.core.runtime.preferences.InstanceScope; +import org.osgi.service.prefs.Preferences; +import org.simantics.workbench.internal.Activator; + +/** + * @author Tuukka Lehtonen + */ +public class SimanticsPreferenceInitializer extends AbstractPreferenceInitializer { + + @Override + public void initializeDefaultPreferences() { + IScopeContext defaults = DefaultScope.INSTANCE; + Preferences node = defaults.getNode(Activator.PLUGIN_ID); + node.putBoolean(SimanticsPreferences.SHOW_DATABASE_CONTROLS, false); + + IScopeContext instance = InstanceScope.INSTANCE; + node = instance.getNode(Activator.PLUGIN_ID); + boolean show = node.getBoolean(SimanticsPreferences.SHOW_DATABASE_CONTROLS, false); + if (show) + System.setProperty(bind(Activator.PLUGIN_ID, SimanticsPreferences.SHOW_DATABASE_CONTROLS), "true"); + + // NOTE: the above system property are used in plugin.xml with + // systemTest in menu contribution visibility checking. + // This implementation requires a restart every time the preference is changed. + } + + private static String bind(String namespace, String pref) { + return namespace + "." + pref; + } + +}