org.osgi.service.prefs.Preferences Java Examples

The following examples show how to use org.osgi.service.prefs.Preferences. 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: Activator.java    From hybris-commerce-eclipse-plugin with Apache License 2.0 6 votes vote down vote up
public void resetPlatform(String platformHome) {
	
	try {
		Preferences preferences = InstanceScope.INSTANCE.getNode("com.hybris.hyeclipse.preferences");
		preferences.put("platform_home", platformHome);
		preferences.flush();
	}
	catch (BackingStoreException e) {
		logError("Failed to persist platform_home", e);
	}
	
	getTypeSystemExporter().setPlatformHome(null);
	getTypeSystemExporter().nullifySystemConfig();
	getTypeSystemExporter().nullifyPlatformConfig();
	getTypeSystemExporter().nullifyTypeSystem();
	getTypeSystemExporter().nullifyAllTypes();
	getTypeSystemExporter().nullifyAllTypeNames();
}
 
Example #2
Source File: WorkingSetManagerImpl.java    From n4js with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public IStatus restoreState(final IProgressMonitor monitor) {

	final Preferences node = getPreferences();

	// Restore ordered labels.
	final String orderedLabels = node.get(ORDERED_IDS_KEY, EMPTY_STRING);
	if (!Strings.isNullOrEmpty(orderedLabels)) {
		orderedWorkingSetIds.clear();
		orderedWorkingSetIds.addAll(Arrays.asList(orderedLabels.split(SEPARATOR)));
	}

	// Restore visible labels.
	final String visibleLabels = node.get(VISIBLE_IDS_KEY, EMPTY_STRING);
	if (!Strings.isNullOrEmpty(visibleLabels)) {
		visibleWorkingSetIds.clear();
		visibleWorkingSetIds.addAll(Arrays.asList(visibleLabels.split(SEPARATOR)));
	}

	discardWorkingSetCaches();

	return statusHelper.OK();
}
 
Example #3
Source File: WorkingSetManagerImpl.java    From n4js with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public IStatus saveState(final IProgressMonitor monitor) {

	final Preferences node = getPreferences();

	// Save ordered labels.
	node.put(ORDERED_IDS_KEY, Joiner.on(SEPARATOR).join(orderedWorkingSetIds));

	// Save visible labels.
	node.put(VISIBLE_IDS_KEY, Joiner.on(SEPARATOR).join(visibleWorkingSetIds));

	try {
		node.flush();
	} catch (final BackingStoreException e) {
		final String message = "Error occurred while saving state to preference store.";
		LOGGER.error(message, e);
		return statusHelper.createError(message, e);
	}

	return statusHelper.OK();
}
 
Example #4
Source File: ProjectNameFilterAwareWorkingSetManager.java    From n4js with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public IStatus restoreState(final IProgressMonitor monitor) {
	final IStatus superRestoreResult = super.restoreState(monitor);

	if (superRestoreResult.isOK()) {

		final Preferences node = getPreferences();
		final String orderedFilters = node.get(ORDERED_FILTERS_KEY, EMPTY_STRING);
		if (!Strings.isNullOrEmpty(orderedFilters)) {
			orderedWorkingSetFilters.clear();
			orderedWorkingSetFilters.addAll(Arrays.asList(orderedFilters.split(SEPARATOR)));
		}

		discardWorkingSetCaches();
		return statusHelper.OK();

	}

	return superRestoreResult;
}
 
Example #5
Source File: ProjectNameFilterAwareWorkingSetManager.java    From n4js with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public IStatus saveState(final IProgressMonitor monitor) {
	final IStatus superSaveResult = super.saveState(monitor);

	if (superSaveResult.isOK()) {

		final Preferences node = getPreferences();
		node.put(ORDERED_FILTERS_KEY, Joiner.on(SEPARATOR).join(orderedWorkingSetFilters));

		try {
			node.flush();
		} catch (final BackingStoreException e) {
			final String message = "Error occurred while saving state to preference store.";
			LOGGER.error(message, e);
			return statusHelper.createError(message, e);
		}

		return statusHelper.OK();
	}

	return superSaveResult;
}
 
Example #6
Source File: FontSubstitutionModel.java    From ganttproject with GNU General Public License v3.0 6 votes vote down vote up
public FontSubstitutionModel(TTFontCache fontCache, ITextStylesheet stylesheet, Preferences prefs) {
  myFontCache = fontCache;
  List<FontSubstitution> unresolvedFonts = new ArrayList<FontSubstitution>();
  List<FontSubstitution> resolvedFonts = new ArrayList<FontSubstitution>();
  for (Iterator<String> families = stylesheet.getFontFamilies().iterator(); families.hasNext();) {
    String nextFamily = families.next();
    FontSubstitution fs = new FontSubstitution(nextFamily, prefs, myFontCache);
    Font awtFont = fs.getSubstitutionFont();
    if (awtFont == null) {
      unresolvedFonts.add(fs);
    } else {
      resolvedFonts.add(fs);
    }
  }
  addSubstitutions(unresolvedFonts);
  addSubstitutions(resolvedFonts);
  myIndexedSubstitutions = new ArrayList<FontSubstitution>(mySubstitutions.values());
}
 
Example #7
Source File: Theme.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
protected void storeDefaults()
{
	// Don't store builtin themes default copy in prefs!
	if (getThemeManager().isBuiltinTheme(getName()))
	{
		return;
	}
	// Only save to defaults if it has never been saved there. Basically take a snapshot of first version and
	// use that as the "default"
	IEclipsePreferences prefs = EclipseUtil.defaultScope().getNode(ThemePlugin.PLUGIN_ID);
	if (prefs == null)
	{
		return; // TODO Log something?
	}
	Preferences preferences = prefs.node(ThemeManager.THEMES_NODE);
	if (preferences == null)
	{
		return;
	}
	String value = preferences.get(getName(), null);
	if (value == null)
	{
		save(EclipseUtil.defaultScope());
	}
}
 
Example #8
Source File: WorkingSetManagerBrokerImpl.java    From n4js with Eclipse Public License 1.0 6 votes vote down vote up
private IStatus restoreState() {

		final Preferences node = getPreferences();
		// Top level element.
		workingSetTopLevel.set(node.getBoolean(IS_WORKINGSET_TOP_LEVEL_KEY, false));

		// Active working set manager.
		final String value = node.get(ACTIVE_MANAGER_KEY, "");
		WorkingSetManager workingSetManager = contributions.get().get(value);
		if (workingSetManager == null) {
			if (!contributions.get().isEmpty()) {
				workingSetManager = contributions.get().values().iterator().next();
			}
		}
		if (workingSetManager != null) {
			setActiveManager(workingSetManager);
		}

		return Status.OK_STATUS;
	}
 
Example #9
Source File: PluginPreferencesImpl.java    From ganttproject with GNU General Public License v3.0 6 votes vote down vote up
@Override
public Preferences node(String path) {
  if (path.endsWith("/")) {
    if (!"/".equals(path)) {
      throw new IllegalArgumentException("Path can't end with /");
    }
  }
  if (path.startsWith("/")) {
    if (myParent != null) {
      return myParent.node(path);
    }
    path = path.substring(1);
  }
  if ("".equals(path)) {
    return this;
  }
  int firstSlash = path.indexOf('/');
  String prefix = firstSlash == -1 ? path : path.substring(0, firstSlash);
  String suffix = firstSlash == -1 ? "" : path.substring(firstSlash + 1);
  Preferences child = myChildren.get(prefix);
  if (child == null) {
    child = createChild(prefix);
  }
  return child.node(suffix);
}
 
Example #10
Source File: PreferenceInitializer.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void initializeDefaultPreferences(){
	Preferences node = DefaultScope.INSTANCE.getNode(Activator.PLUGIN_ID); //$NON-NLS-1$
	// default values
	node.putBoolean(PreferenceConstants.REPOSITORIES_VISIBLE, true);
	node.putBoolean(PreferenceConstants.SHOW_LATEST_VERSION_ONLY, true);
	node.putBoolean(PreferenceConstants.AVAILABLE_SHOW_ALL_BUNDLES, false);
	node.putBoolean(PreferenceConstants.INSTALLED_SHOW_ALL_BUNDLES, false);
	node.putBoolean(PreferenceConstants.AVAILABLE_GROUP_BY_CATEGORY, true);
	node.putBoolean(PreferenceConstants.SHOW_DRILLDOWN_REQUIREMENTS, false);
	node.putInt(PreferenceConstants.RESTART_POLICY,
		Policy.RESTART_POLICY_PROMPT_RESTART_OR_APPLY);
	node.putInt(PreferenceConstants.UPDATE_WIZARD_STYLE, Policy.UPDATE_STYLE_MULTIPLE_IUS);
	node.putBoolean(PreferenceConstants.FILTER_ON_ENV, true);
	node.putInt(PreferenceConstants.UPDATE_DETAILS_HEIGHT, SWT.DEFAULT);
	node.putInt(PreferenceConstants.UPDATE_DETAILS_WIDTH, SWT.DEFAULT);
}
 
Example #11
Source File: Ruleset.java    From CogniCrypt with Eclipse Public License 2.0 6 votes vote down vote up
public Ruleset(Preferences subPrefs) throws BackingStoreException {
	String[] keys = subPrefs.keys();
	for (String key : keys) {
		switch (key) {
			case "SelectedVersion":
				this.selectedVersion = subPrefs.get(key, "");
				break;
			case "CheckboxState":
				this.isChecked = subPrefs.getBoolean(key, false);
				break;
			case "FolderName":
				this.folderName = subPrefs.get(key, "");
				break;
			case "Url":
				this.url = subPrefs.get(key, "");
				break;
			default:
				break;
		}
	}
}
 
Example #12
Source File: AnalysisPreferenceInitializer.java    From Pydev with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void initializeDefaultPreferences() {
    Preferences node = DefaultScope.INSTANCE.getNode(DEFAULT_SCOPE);

    for (int i = 0; i < AnalysisPreferences.completeSeverityMap.length; i++) {
        Object[] s = AnalysisPreferences.completeSeverityMap[i];
        node.putInt((String) s[1], (Integer) s[2]);

    }
    node.put(NAMES_TO_IGNORE_UNUSED_VARIABLE, DEFAULT_NAMES_TO_IGNORE_UNUSED_VARIABLE);
    node.put(NAMES_TO_IGNORE_UNUSED_IMPORT, DEFAULT_NAMES_TO_IGNORE_UNUSED_IMPORT);
    node.put(NAMES_TO_CONSIDER_GLOBALS, DEFAULT_NAMES_TO_CONSIDER_GLOBALS);
    node.putBoolean(DO_CODE_ANALYSIS, DEFAULT_DO_CODE_ANALYSIS);
    node.putBoolean(DO_AUTO_IMPORT, DEFAULT_DO_AUT_IMPORT);
    node.putBoolean(DO_AUTO_IMPORT_ON_ORGANIZE_IMPORTS, DEFAULT_DO_AUTO_IMPORT_ON_ORGANIZE_IMPORTS);
    node.putBoolean(DO_IGNORE_IMPORTS_STARTING_WITH_UNDER, DEFAULT_DO_IGNORE_FIELDS_WITH_UNDER);

    //pep8 related.
    node.putBoolean(USE_PEP8_CONSOLE, DEFAULT_USE_PEP8_CONSOLE);
    node.putBoolean(PEP8_USE_SYSTEM, DEFAULT_PEP8_USE_SYSTEM);
}
 
Example #13
Source File: AddInPreferencePage.java    From M2Doc with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Gets the manifest URL.
 * 
 * @return the manifest URL
 */
private String getManifestURL() {
    final String res;

    final Preferences preferences = InstanceScope.INSTANCE.getNode(AddInPreferenceInitializer.SCOPE);
    final String host = preferences.get(AddInPreferenceInitializer.HOST_PREFERENCE,
            AddInPreferenceInitializer.DEFAULT_HOST);
    final String port = preferences.get(AddInPreferenceInitializer.PORT_PREFERENCE,
            String.valueOf(AddInPreferenceInitializer.DEFAULT_PORT));
    if (AddInPreferenceInitializer.DEFAULT_HOST.equals(host)) {
        res = "http://localhost:" + port + "/assets/manifest.xml";
    } else {
        res = "http://" + host + ":" + port + "/assets/manifest.xml";
    }

    return res;
}
 
Example #14
Source File: BazelProjectSupport.java    From eclipse with Apache License 2.0 6 votes vote down vote up
private static void addSettings(IProject project, String workspaceRoot, List<String> targets,
    List<String> buildFlags) throws BackingStoreException {
  IScopeContext projectScope = new ProjectScope(project);
  Preferences projectNode = projectScope.getNode(Activator.PLUGIN_ID);
  int i = 0;
  for (String target : targets) {
    projectNode.put("target" + i, target);
    i++;
  }
  projectNode.put("workspaceRoot", workspaceRoot);
  i = 0;
  for (String flag : buildFlags) {
    projectNode.put("buildFlag" + i, flag);
    i++;
  }
  projectNode.flush();
}
 
Example #15
Source File: PyLintPrefInitializer.java    From Pydev with Eclipse Public License 1.0 6 votes vote down vote up
public static void initializeDefaultPreferences() {
    Preferences node = DefaultScope.INSTANCE.getNode(SharedCorePlugin.DEFAULT_PYDEV_PREFERENCES_SCOPE);

    node.put(PyLintPreferences.PYLINT_FILE_LOCATION, "");
    node.putBoolean(PyLintPreferences.USE_PYLINT, PyLintPreferences.DEFAULT_USE_PYLINT);

    node.putInt(PyLintPreferences.SEVERITY_ERRORS, PyLintPreferences.DEFAULT_SEVERITY_ERRORS);
    node.putInt(PyLintPreferences.SEVERITY_WARNINGS, PyLintPreferences.DEFAULT_SEVERITY_WARNINGS);
    node.putInt(PyLintPreferences.SEVERITY_FATAL, PyLintPreferences.DEFAULT_SEVERITY_FATAL);
    node.putInt(PyLintPreferences.SEVERITY_CODING_STANDARD, PyLintPreferences.DEFAULT_SEVERITY_CODING_STANDARD);
    node.putInt(PyLintPreferences.SEVERITY_REFACTOR, PyLintPreferences.DEFAULT_SEVERITY_REFACTOR);

    node.putBoolean(PyLintPreferences.USE_CONSOLE, PyLintPreferences.DEFAULT_USE_CONSOLE);
    node.put(PyLintPreferences.PYLINT_ARGS, PyLintPreferences.DEFAULT_PYLINT_ARGS);

}
 
Example #16
Source File: Activator.java    From hybris-commerce-eclipse-plugin with Apache License 2.0 6 votes vote down vote up
public File getPlatformHome() {
	if (platformHome == null) {

		// Get platform home from workspace preferences
		Preferences preferences = InstanceScope.INSTANCE.getNode("com.hybris.hyeclipse.preferences");
		String platformHomeStr = preferences.get("platform_home", null);
		if (platformHomeStr == null) {
			IProject platformProject = ResourcesPlugin.getWorkspace().getRoot().getProject("platform");
			IPath platformProjectPath = platformProject.getLocation();
			if (platformProjectPath != null) {
				setPlatformHome(platformProjectPath.toFile());
			}
		} else {
			setPlatformHome(new File(platformHomeStr));
		}
	}
	return platformHome;
}
 
Example #17
Source File: EclipseMocker.java    From saros with GNU General Public License v2.0 6 votes vote down vote up
/** Mock a somewhat clever Saros, with a version number and a preference store. */
public static Saros mockSaros() {
  // saros.getBundle() is final --> need PowerMock
  Saros saros = PowerMock.createNiceMock(Saros.class);

  Bundle bundle = createNiceMock(Bundle.class);
  expect(bundle.getVersion()).andStubReturn(new Version("1.0.0.dummy"));
  expect(saros.getBundle()).andStubReturn(bundle);

  expect(saros.getPreferenceStore()).andStubReturn(new EclipseMemoryPreferenceStore());

  Preferences globalPref = createNiceMock(Preferences.class);
  expect(saros.getGlobalPreferences()).andStubReturn(globalPref);

  replay(bundle, globalPref, saros);

  return saros;
}
 
Example #18
Source File: JavaCorePreferenceModifyListener.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
public IEclipsePreferences preApply(IEclipsePreferences node) {
	// the node does not need to be the root of the hierarchy
	Preferences root = node.node("/"); //$NON-NLS-1$
	try {
		// we must not create empty preference nodes, so first check if the node exists
		if (root.nodeExists(InstanceScope.SCOPE)) {
			Preferences instance = root.node(InstanceScope.SCOPE);
			// we must not create empty preference nodes, so first check if the node exists
			if (instance.nodeExists(JavaCore.PLUGIN_ID)) {
				cleanJavaCore(instance.node(JavaCore.PLUGIN_ID));
			}
		}
	} catch (BackingStoreException e) {
		// do nothing
	}
	return super.preApply(node);
}
 
Example #19
Source File: PreferenceStoreHelper.java    From tlaplus with MIT License 5 votes vote down vote up
/**
 * Stores the preferences to disk
 * @param preferences
 */
private static void storePreferences(Preferences preferences)
{
    try
    {
        preferences.flush();
    } catch (BackingStoreException e)
    {
        Activator.getDefault().logError("Error storing the preference node", e);
    }
}
 
Example #20
Source File: UpdateCheckerJobListener.java    From developer-studio with Apache License 2.0 5 votes vote down vote up
@Override
public void done(IJobChangeEvent event) {
	if (event.getResult().isOK()) {
		Display.getDefault().syncExec(new Runnable() {
			@Override
			public void run() {
				try {
					// Wait half a second to let progress reporting complete
					// FIXME: Find a proper fix
					Thread.sleep(500);
					// Set last check for Updates Time-stamp in OSGI bundle
					// prefs
					Preferences preferences = ConfigurationScope.INSTANCE.getNode(Constants.NODE_UPDATE_HANDER);
					preferences.putLong(Constants.PREF_LAST_PROMPT_FOR_UPDATES, new Date().getTime());
					preferences.flush();
					UpdateCheckerJob.setIsJobRunning(false);
					if (isAutomaticUpdater && !updateManager.hasPossibleUpdates()) {
						// no updates - no need to open the window
						return;
					}

					UpdaterDialog dialog = new UpdaterDialog(updateManager, activeTab);
					dialog.open();
				} catch (Exception e) {
					log.error(Messages.UpdateCheckerJobListener_0, e);
				}
			}
		});
	}
}
 
Example #21
Source File: AbstractFileChooserPage.java    From ganttproject with GNU General Public License v3.0 5 votes vote down vote up
protected AbstractFileChooserPage(UIFacade uiFacade, Preferences prefs, String title, FileFilter fileFilter, GPOptionGroup[] options, boolean enableUrlChooser) {
  myUiFacade = uiFacade;
  myPreferences = prefs;
  myTitle = title;
  myFileFilter = MoreObjects.firstNonNull(fileFilter, ACCEPT_ALL);
  myOptions = MoreObjects.firstNonNull(options, new GPOptionGroup[0]);
  isUrlChooserEnabled = enableUrlChooser;
  myOptionsBuilder = new OptionsPageBuilder();
  mySecondaryOptionsComponent = new JPanel(new BorderLayout());
  mySecondaryOptionsComponent.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
}
 
Example #22
Source File: PreferencesImpl.java    From knopflerfish.org with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public Preferences parent() {
  assertValid();

  if(parentPath == null) {
    return null;
  }

  return storage.getNode(parentPath, false);
}
 
Example #23
Source File: PrefsStorageFile.java    From knopflerfish.org with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public Preferences getNode(final String path, boolean bCreate) {
  try {
    PreferencesImpl pi = prefs.get(path);
    if(pi != null) {
      return pi;
    }

    getNodeDir(path, bCreate);
    final File keyFile = getKeyFile(path);

    AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
      @Override
      public Object run() throws Exception {
        if(!keyFile.exists()) {
          final Dictionary<String, String> props = new Hashtable<String, String>();
          propsMap.put(path, props);
          saveProps(path, props);
        }
        return null;
      }
    });

    pi = new PreferencesImpl(this, path);
    prefs.put(path, pi);
    return pi;
  } catch (Exception e) {
    if (e instanceof PrivilegedActionException) {
      e = (Exception) e.getCause();
    }
    throw new IllegalStateException("getNode " + path + " failed: " + e);
  }
}
 
Example #24
Source File: SynchronizePlatformWizard.java    From hybris-commerce-eclipse-plugin with Apache License 2.0 5 votes vote down vote up
/**
 * Workhorse to do the actual import of the projects into this workspace.
 */
private void synchronizePlatform()
{
	boolean autobuildEnabled = isAutoBuildEnabled();
	enableAutoBuild( false );
	final boolean fixClasspath = page1.isFixClasspath();
	final boolean removeHybrisBuilder = page1.isRemoveHybrisGenerator();
	final boolean createWorkingSets = page1.isCreateWorkingSets();
	final boolean useMultiThread = page1.isUseMultiThread();
	final boolean skipJarScanning = page1.isSkipJarScanning();
		
	Preferences preferences = InstanceScope.INSTANCE.getNode("com.hybris.hyeclipse.preferences");
	final String platformDir = preferences.get("platform_home", null);
	
	if (platformDir == null)
	{
		throw new IllegalStateException("not platform has been set, try importing again");
	}
	
	IRunnableWithProgress importer = new IRunnableWithProgress()
	{
		public void run( IProgressMonitor monitor ) throws InvocationTargetException
		{
			List<IProject> projects = Arrays.asList( ResourcesPlugin.getWorkspace().getRoot().getProjects() );
			synchronizePlatform( monitor, projects, new File(platformDir), fixClasspath, removeHybrisBuilder, createWorkingSets, useMultiThread, skipJarScanning);
		}
	};
	try
	{
		new ProgressMonitorDialog( getContainer().getShell() ).run( true, false, importer );
	}
	catch( InvocationTargetException | InterruptedException e )
	{
		Activator.logError("Failed to synchronize platform", e);
		Throwable t = (e instanceof InvocationTargetException) ? e.getCause() : e;
		MessageDialog.openError( this.page1.getControl().getShell(), "Error", t.toString() );
		enableAutoBuild( autobuildEnabled );
	}
	enableAutoBuild( autobuildEnabled );
}
 
Example #25
Source File: SynchronizePlatformPage.java    From hybris-commerce-eclipse-plugin with Apache License 2.0 5 votes vote down vote up
private void persistSelections() {
	// persist checkbox selections for next time
	Preferences preferences = InstanceScope.INSTANCE.getNode("com.hybris.hyeclipse.preferences");
	preferences.putBoolean(ImportPlatformPage.FIX_CLASS_PATH_ISSUES_PREFERENCE, fixClasspathIssuesButton.getSelection());
	preferences.putBoolean(ImportPlatformPage.REMOVE_HYBRIS_BUILDER_PREFERENCE, removeHybrisItemsXmlGeneratorButton.getSelection());
	preferences.putBoolean(ImportPlatformPage.CREATE_WORKING_SETS_PREFERENCE, createWorkingSetsButton.getSelection());
	preferences.putBoolean(ImportPlatformPage.USE_MULTI_THREAD_PREFERENCE, useMultiThreadButton.getSelection());
	preferences.putBoolean(ImportPlatformPage.SKIP_JAR_SCANNING_PREFERENCE, skipJarScanningButton.getSelection());

	try {
		preferences.flush();
	} catch (BackingStoreException e) {
		throw new IllegalStateException("Could not save preferences", e);
	}
}
 
Example #26
Source File: FileChooserPage.java    From ganttproject with GNU General Public License v3.0 5 votes vote down vote up
FileChooserPage(State state, IGanttProject project, WizardImpl wizardImpl, Preferences prefs) {
  super(wizardImpl, prefs, false);
  myState = state;
  myProject = project;
  myWebPublishingGroup = new GPOptionGroup("exporter.webPublishing", new GPOption[] { state.getPublishInWebOption() });
  myWebPublishingGroup.setTitled(false);
}
 
Example #27
Source File: ImporterFromGanttFile.java    From ganttproject with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void setContext(IGanttProject project, UIFacade uiFacade, Preferences preferences) {
  super.setContext(project, uiFacade, preferences);
  final Preferences node = preferences.node("/instance/net.sourceforge.ganttproject/import");
  myMergeResourcesOption.lock();
  myMergeResourcesOption.loadPersistentValue(node.get(myMergeResourcesOption.getID(),
      HumanResourceMerger.MergeResourcesOption.BY_ID));
  myMergeResourcesOption.commit();
  myMergeResourcesOption.addChangeValueListener(new ChangeValueListener() {
    @Override
    public void changeValue(ChangeValueEvent event) {
      node.put(myMergeResourcesOption.getID(), String.valueOf(event.getNewValue()));
    }
  });
}
 
Example #28
Source File: RefactoringPreferencesInitializer.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void initializeDefaultPreferences() {
    Preferences node = DefaultScope.INSTANCE.getNode(DEFAULT_SCOPE);
    node.putBoolean(MarkOccurrencesPreferencesPage.USE_MARK_OCCURRENCES,
            MarkOccurrencesPreferencesPage.DEFAULT_USE_MARK_OCCURRENCES);
    node.putBoolean(MarkOccurrencesPreferencesPage.USE_MARK_OCCURRENCES_IN_STRINGS,
            MarkOccurrencesPreferencesPage.DEFAULT_USE_MARK_OCCURRENCES_IN_STRINGS);
}
 
Example #29
Source File: FileChooserPageBase.java    From ganttproject with GNU General Public License v3.0 5 votes vote down vote up
protected FileChooserPageBase(WizardImpl wizard, Preferences prefs, boolean enableUrlChooser) {
  myPreferences = prefs;
  isUrlChooserEnabled = enableUrlChooser;
  myWizard = wizard;
  myOptionsBuilder = new OptionsPageBuilder();
  mySecondaryOptionsComponent = new JPanel(new BorderLayout());
  mySecondaryOptionsComponent.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
}
 
Example #30
Source File: MergeFileAssociation.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
public boolean remove() {
	Preferences node = MergeFileAssociation.getParentPreferences().node(getFileType());
	if (node != null) {
		try {
			node.removeNode();
		} catch (BackingStoreException e) {
		}
	}
	return false;
}