Java 类org.eclipse.core.runtime.preferences.InstanceScope 实例源码

项目:n4js    文件:OsgiBinariesPreferenceStore.java   
@Override
public IStatus save() {
    try {
        final IEclipsePreferences node = InstanceScope.INSTANCE.getNode(QUALIFIER);
        for (final Entry<Binary, URI> entry : getOrCreateState().entrySet()) {
            final URI path = entry.getValue();
            if (null != path) {
                final File file = new File(path);
                if (file.isDirectory()) {
                    node.put(entry.getKey().getId(), file.getAbsolutePath());
                }
            } else {
                // Set to default.
                node.put(entry.getKey().getId(), "");
            }
        }
        node.flush();
        return OK_STATUS;
    } catch (final BackingStoreException e) {
        final String message = "Unexpected error when trying to persist binary preferences.";
        LOGGER.error(message, e);
        return statusHelper.createError(message, e);
    }
}
项目:Hydrograph    文件:DebugDataViewer.java   
/**
 * 
 * Get data viewer preferences from preference file
 * 
 * @return {@link ViewDataPreferencesVO}
 */
public ViewDataPreferencesVO getViewDataPreferencesFromPreferenceFile() {
    boolean includeHeaderValue = false;
    IEclipsePreferences eclipsePreferences = InstanceScope.INSTANCE.getNode(Activator.PLUGIN_ID);
    String delimiter = eclipsePreferences.get(DELIMITER, DEFAULT);
    String quoteCharactor = eclipsePreferences.get(QUOTE_CHARACTOR, DEFAULT);
    String includeHeader = eclipsePreferences.get(INCLUDE_HEADERS, DEFAULT);
    String fileSize = eclipsePreferences.get(FILE_SIZE, DEFAULT);
    String pageSize = eclipsePreferences.get(PAGE_SIZE, DEFAULT);
    delimiter = delimiter.equalsIgnoreCase(DEFAULT) ? DEFAULT_DELIMITER : delimiter;
    quoteCharactor = quoteCharactor.equalsIgnoreCase(DEFAULT) ? DEFAULT_QUOTE_CHARACTOR : quoteCharactor;
    includeHeaderValue = includeHeader.equalsIgnoreCase(DEFAULT) ? true : false;
    fileSize = fileSize.equalsIgnoreCase(DEFAULT) ? DEFAULT_FILE_SIZE : fileSize;
    pageSize = pageSize.equalsIgnoreCase(DEFAULT) ? DEFAULT_PAGE_SIZE : pageSize;
    ViewDataPreferencesVO viewDataPreferencesVO = new ViewDataPreferencesVO(delimiter, quoteCharactor,
            includeHeaderValue, Integer.parseInt(fileSize), Integer.parseInt(pageSize));
    return viewDataPreferencesVO;
}
项目:termsuite-ui    文件:LifeCycleManager.java   
private void logContextualInfo() {
    Preferences preferences = InstanceScope.INSTANCE.getNode(TermSuiteUI.PLUGIN_ID);

    logger.info("Current directory: " + Paths.get(".").toAbsolutePath().normalize().toString());
    logger.info("Workspace location: " + Platform.getInstanceLocation().getURL().toString());
    logger.info("Output directory is " + preferences.get(TermSuiteUIPreferences.OUTPUT_DIRECTORY, ""));
    logger.info("Install location: " + Platform.getInstallLocation().getURL().toString());
    for(String p:LOGGED_PROPS)
        logger.info(p + ": " + System.getProperty(p));
    logger.info("eclipse.commands: " + System.getProperty("eclipse.commands").replaceAll("[\n\r]+", " "));
    logger.info("Command line args: " + Joiner.on(" ").join(Platform.getCommandLineArgs()));
    logger.info("Application args: " + Joiner.on(" ").join(Platform.getApplicationArgs()));

    BundleContext bundleContext = Platform.getBundle(TermSuiteUI.PLUGIN_ID).getBundleContext();

    for(Bundle bundle:bundleContext.getBundles()) {
        if(bundle.getSymbolicName().startsWith("fr.univnantes.termsuite"))
            logger.info("Found bundle " +bundle.getSymbolicName() + ":" + bundle.getVersion());
    }
}
项目:termsuite-ui    文件:AlignmentServiceImpl.java   
@PostConstruct
private void loadDictionaries() {
    targetDictionaries = HashMultimap.create();
    sourceDictionaries = HashMultimap.create();

    Preferences preferences = InstanceScope.INSTANCE
              .getNode(TermSuiteUI.PLUGIN_ID);

    String dictionaryDirectory = preferences.get(TermSuiteUIPreferences.BILINGUAL_DICTIONARY_DIRECTORY, null);

    dictionaries = dictionaryDirectory == null ? 
            Lists.newArrayList() : 
                findDictionaries(Paths.get(dictionaryDirectory));

    for(EBilingualDictionary dico:dictionaries) {
        sourceDictionaries.put(dico.getSourceLang(), dico);
        targetDictionaries.put(dico.getTargetLang(), dico);
    }
}
项目:tm4e    文件:ThemeManager.java   
/**
 * Load TextMate Themes from preferences.
 */
private void loadThemesFromPreferences() {
    // Load Theme definitions from the
    // "${workspace_loc}/metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.tm4e.ui.prefs"
    IEclipsePreferences prefs = InstanceScope.INSTANCE.getNode(TMUIPlugin.PLUGIN_ID);
    String json = prefs.get(PreferenceConstants.THEMES, null);
    if (json != null) {
        ITheme[] themes = PreferenceHelper.loadThemes(json);
        for (ITheme theme : themes) {
            super.registerTheme(theme);
        }
    }

    json = prefs.get(PreferenceConstants.THEME_ASSOCIATIONS, null);
    if (json != null) {
        IThemeAssociation[] themeAssociations = PreferenceHelper.loadThemeAssociations(json);
        for (IThemeAssociation association : themeAssociations) {
            super.registerThemeAssociation(association);
        }
    }
}
项目:tm4e    文件:ThemeManager.java   
@Override
public void save() throws BackingStoreException {
    // Save Themes in the
    // "${workspace_loc}/metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.tm4e.ui.prefs"
    String json = PreferenceHelper.toJsonThemes(
            Arrays.stream(getThemes()).filter(t -> t.getPluginId() == null).collect(Collectors.toList()));
    IEclipsePreferences prefs = InstanceScope.INSTANCE.getNode(TMUIPlugin.PLUGIN_ID);
    prefs.put(PreferenceConstants.THEMES, json);

    // Save Theme associations in the
    // "${workspace_loc}/metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.tm4e.ui.prefs"
    json = PreferenceHelper.toJsonThemeAssociations(Arrays.stream(getAllThemeAssociations())
            .filter(t -> t.getPluginId() == null).collect(Collectors.toList()));
    prefs.put(PreferenceConstants.THEME_ASSOCIATIONS, json);

    // Save preferences
    prefs.flush();
}
项目:team-explorer-everywhere    文件:SynchronizeLabelDecorator.java   
public SynchronizeLabelDecorator(final Subscriber subscriber) {
    this.subscriber = subscriber;

    preferenceStore = new ScopedPreferenceStore(new InstanceScope(), TEAM_UI_PLUGIN_ID);

    decorate = Boolean.TRUE.equals(preferenceStore.getBoolean(DECORATION_PREFERENCE_CONSTANT));

    preferenceStore.addPropertyChangeListener(new IPropertyChangeListener() {
        @Override
        public void propertyChange(final PropertyChangeEvent event) {
            if (event.getProperty().equals(DECORATION_PREFERENCE_CONSTANT)) {
                /*
                 * Note that we compare against the string value of the
                 * preference here. Preferences are not strongly typed
                 * (they're strings under the hood), so in the property
                 * change event, we're given the string value.
                 */
                decorate = "true".equals(event.getNewValue()); //$NON-NLS-1$

                ((ILabelProviderListener) listeners.getListener()).labelProviderChanged(
                    new LabelProviderChangedEvent(SynchronizeLabelDecorator.this));
            }
        }
    });
}
项目:Notepad4e    文件:Note.java   
/**
 * Constructor. Sets properties of the editor window.
 * 
 * @param parent
 * @param text
 * @param editable
 * @param shortcutHandler
 */
public Note(Composite parent, String text, boolean editable) {
    // Enable multiple lines and scroll bars.
    super(parent, SWT.V_SCROLL | SWT.H_SCROLL);

    preferences = InstanceScope.INSTANCE.getNode(Notepad4e.PLUGIN_ID);

    undoRedoManager = new UndoRedoManager(this);
    bulletStyle = new StyleRange();
    bulletStyle.metrics = new GlyphMetrics(0, 0, 0);

    // Scroll bars only appear when the text extends beyond the note window.
    setAlwaysShowScrollBars(false);
    setParametersFromPreferences();
    setText(text);
    initialiseMenu();

    if (!editable) {
        toggleEditable();
    }
}
项目:hybris-commerce-eclipse-plugin    文件:Activator.java   
public void start(BundleContext context) throws Exception {
    super.start(context);
    plugin = this;
    String platformHomeStr = null;
    if (platformHome == null) {

        Preferences preferences = InstanceScope.INSTANCE.getNode("com.hybris.hyeclipse.preferences");
        platformHomeStr = preferences.get("platform_home", null);
        if (platformHomeStr == null) {
            IProject platformProject = ResourcesPlugin.getWorkspace().getRoot().getProject("platform");
            IPath platformProjectPath = platformProject.getLocation();
            if (platformProjectPath != null) {
                platformHome = platformProjectPath.toFile();
                platformHomeStr = platformHome.getAbsolutePath();
            }
        } else {
            platformHome = new File(platformHomeStr);
        }
    }
}
项目:hybris-commerce-eclipse-plugin    文件:Activator.java   
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;
}
项目:hybris-commerce-eclipse-plugin    文件:PlatformHomePropertyTester.java   
@Override
public boolean test(Object arg0, String arg1, Object[] arg2, Object arg3) {

    boolean enableOption = false;
    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) {
            enableOption = true;
        }
    }
    else {
        enableOption = true;
    }

    return enableOption;
}
项目:hybris-commerce-eclipse-plugin    文件:CommandState.java   
@Override
public Map<String, String> getCurrentState() {
    Map<String, String> map = new HashMap<String, String>(1);
    boolean enableOption = false;
    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) {
            enableOption = true;
        }
    }
    else {
        enableOption = true;
    }

    if (enableOption) {
        map.put(ID, ENABLED);
    }
    else {
        map.put(ID, DISABLED);
    }
    return map;
}
项目:hybris-commerce-eclipse-plugin    文件:Activator.java   
public void start(BundleContext context) throws Exception {
    super.start(context);
    plugin = this;
    String platformHomeStr = null;
    if (platformHome == null) {

        Preferences preferences = InstanceScope.INSTANCE.getNode("com.hybris.hyeclipse.preferences");
        platformHomeStr = preferences.get("platform_home", null);
        if (platformHomeStr == null) {
            IProject platformProject = ResourcesPlugin.getWorkspace().getRoot().getProject("platform");
            IPath platformProjectPath = platformProject.getLocation();
            if (platformProjectPath != null) {
                platformHome = platformProjectPath.toFile();
            }
        }
        else {
            platformHome = new File(platformHomeStr);
        }
    }

    disableProjectNatureSolutionLookup();
    log("Disabled automatic project nature solution lookup");
}
项目:hybris-commerce-eclipse-plugin    文件:Activator.java   
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();
}
项目:hybris-commerce-eclipse-plugin    文件:Activator.java   
@Override
public void start(BundleContext context) throws Exception {
    super.start(context);
    plugin = this;
    String platformHomeStr = null;
    if (platformHome == null) {

        Preferences preferences = InstanceScope.INSTANCE.getNode("com.hybris.hyeclipse.preferences");
        platformHomeStr = preferences.get("platform_home", null);
        if (platformHomeStr == null) {
            IProject platformProject = ResourcesPlugin.getWorkspace().getRoot().getProject("platform");
            IPath platformProjectPath = platformProject.getLocation();
            if (platformProjectPath != null) {
                platformHome = platformProjectPath.toFile();
                platformHomeStr = platformHome.getAbsolutePath();
            }
        }
        else {
            platformHome = new File(platformHomeStr);
        }
    }
}
项目:cft    文件:StsTestUtil.java   
/**
 * Set a bunch of preferences so that m2eclipse hopefully isn't doing a lot
 * of time consuming stuff in the background.
 */
public static void mavenOffline() throws Error {
    System.out.println("Pacifying m2eclipse...");
    IEclipsePreferences m2EclipsePrefs = new InstanceScope().getNode("org.eclipse.m2e.core");
    m2EclipsePrefs.putBoolean("eclipse.m2.offline", true);
    m2EclipsePrefs.putBoolean("eclipse.m2.globalUpdatePolicy", false);
    m2EclipsePrefs.putBoolean("eclipse.m2.updateIndexes", false);
    try {
        m2EclipsePrefs.flush();
    }
    catch (BackingStoreException e) {
        throw new Error(e);
    }

    // LegacyProjectChecker.NON_BLOCKING = true;
    System.out.println("Pacifying m2eclipse...DONE");
}
项目:cft    文件:ModuleCache.java   
private void setLocalModuleToCloudModuleMapping(Map<String, String> list) {
    String string = convertMapToString(list);
    IEclipsePreferences node = new InstanceScope().getNode(CloudFoundryPlugin.PLUGIN_ID);
    CloudFoundryPlugin.trace("Updated mapping: " + string); //$NON-NLS-1$
    node.put(KEY_MODULE_MAPPING_LIST + ":" + getServerId(), string); //$NON-NLS-1$
    try {
        node.flush();
    }
    catch (BackingStoreException e) {
        CloudFoundryPlugin
                .getDefault()
                .getLog()
                .log(new Status(IStatus.ERROR, CloudFoundryPlugin.PLUGIN_ID,
                        "Failed to update application mappings", e)); //$NON-NLS-1$
    }
}
项目:cft    文件:ModuleCache.java   
protected synchronized void remove(IServer server) {
    dataByServer.remove(server);

    CloudFoundryServer cfs =  (CloudFoundryServer)server.loadAdapter(CloudFoundryServer.class, null);

    String serverId =  cfs.getServerId(); 

    if (serverId != null) {
        IEclipsePreferences node = new InstanceScope().getNode(CloudFoundryPlugin.PLUGIN_ID);
        node.remove(KEY_MODULE_MAPPING_LIST + ":" + serverId); //$NON-NLS-1$
        try {
            node.flush();
        }
        catch (BackingStoreException e) {
            CloudFoundryPlugin
                    .getDefault()
                    .getLog()
                    .log(new Status(IStatus.ERROR, CloudFoundryPlugin.PLUGIN_ID,
                            "Failed to remove application mappings", e)); //$NON-NLS-1$
        }
    }
}
项目:bts    文件:BTSEObjectHover.java   
public IInformationControlCreatorProvider getHoverInfo(final EObject object, final ITextViewer viewer, final IRegion region)
{
    boolean showHover = true;
    try {
        IEclipsePreferences defaultNode = DefaultScope.INSTANCE.getNode("org.bbaw.bts.ui.corpus.egy");
        IEclipsePreferences instanceNode = InstanceScope.INSTANCE.getNode("org.bbaw.bts.ui.corpus.egy");
        showHover = instanceNode.getBoolean(BTSEGYUIConstants.PREF_TRANSLITERATION_EDITOR_ACTIVATE_HOVER_INFO, 
            defaultNode.getBoolean(BTSEGYUIConstants.PREF_TRANSLITERATION_EDITOR_ACTIVATE_HOVER_INFO, true));
    } catch (Exception e) {
    }
    if (showHover)
    {
        return super.getHoverInfo(object, viewer, region);
    }
    return null;

}
项目:bts    文件:PreferenceStoreAccessImpl.java   
@SuppressWarnings("deprecation")
public IPreferenceStore getWritablePreferenceStore(Object context) {
    lazyInitialize();
    if (context instanceof IFileEditorInput) {
        context = ((IFileEditorInput) context).getFile().getProject();
    }
    if (context instanceof IProject) {
        ProjectScope projectScope = new ProjectScope((IProject) context);
        FixedScopedPreferenceStore result = new FixedScopedPreferenceStore(projectScope, getQualifier());
        result.setSearchContexts(new IScopeContext[] {
            projectScope,
            new InstanceScope(),
            new ConfigurationScope()
        });
        return result;
    }
    return getWritablePreferenceStore();
}
项目:bts    文件:ConfigurationPage.java   
/**
 * Create contents of the preference page.
 */
@Override
protected void createFieldEditors() {
    // Create the field editors
    IPreferenceStore store = new ScopedPreferenceStore(InstanceScope.INSTANCE, "org.bbaw.bts.app");
    Composite container = (Composite) this.getControl();
    container.setLayout(new GridLayout(1, false));

    Label activeConfigLB = new Label(container, SWT.NONE);
    activeConfigLB.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false,
            false, 1, 1));
    activeConfigLB.setText("Currently active Configuration");

    activeConfigcomboViewer = new ComboViewer(container, SWT.READ_ONLY);
    activeConfigcomboViewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true,
            false, 1, 1));
    ComposedAdapterFactory factory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
    AdapterFactoryLabelProvider labelProvider = new AdapterFactoryLabelProvider(factory);
    activeConfigcomboViewer.setContentProvider(new AdapterFactoryContentProvider(factory));
    activeConfigcomboViewer.setLabelProvider(labelProvider);        


    init(null);
    loaded = true;
}
项目:bts    文件:LoginRememberMePage.java   
/**
     * Create contents of the preference page.
     */
    @Override
    protected void createFieldEditors() {
        // Create the field editors
        IPreferenceStore store = new ScopedPreferenceStore(InstanceScope.INSTANCE, "org.bbaw.bts.app");


//      addField(new BooleanFieldEditor("remember_me", "Remember my login credentials on startup", BooleanFieldEditor.DEFAULT, getFieldEditorParent()));
        Composite container = (Composite) this.getControl();
        container.setLayout(new GridLayout(1, false));
        Label lblNewLabel = new Label(container, SWT.NONE);
        lblNewLabel.setText("Login Preferences");

        btnCheckButton = new Button(container, SWT.CHECK);
        btnCheckButton.setText("Remember my login credentials on startup");

        init(null);
        loaded = true;
    }
项目:jsweet-eclipse-plugin    文件:JSweetBuilder.java   
private void forceStaticImports() {
    try {
        IPreferenceStore s = new ScopedPreferenceStore(InstanceScope.INSTANCE, "org.eclipse.jdt.ui");
        String favorites = s.getString(PreferenceConstants.CODEASSIST_FAVORITE_STATIC_MEMBERS);
        for (String f : defaultFavorites) {
            if (!favorites.contains(f)) {
                if (!favorites.isEmpty()) {
                    favorites += ";";
                }
                favorites += f;
            }
        }
        Log.info("forcing favorite static members: " + favorites);
        s.setValue(PreferenceConstants.CODEASSIST_FAVORITE_STATIC_MEMBERS, favorites);
    } catch (Exception e) {
        Log.error(e);
    }
}
项目:dockerfoundry    文件:ModuleCache.java   
private void setLocalModuleToCloudModuleMapping(Map<String, String> list) {
    String string = convertMapToString(list);
    IEclipsePreferences node = new InstanceScope().getNode(DockerFoundryPlugin.PLUGIN_ID);
    DockerFoundryPlugin.trace("Updated mapping: " + string); //$NON-NLS-1$
    node.put(KEY_MODULE_MAPPING_LIST + ":" + getServerId(), string); //$NON-NLS-1$
    try {
        node.flush();
    }
    catch (BackingStoreException e) {
        DockerFoundryPlugin
                .getDefault()
                .getLog()
                .log(new Status(IStatus.ERROR, DockerFoundryPlugin.PLUGIN_ID,
                        "Failed to update application mappings", e)); //$NON-NLS-1$
    }
}
项目:dockerfoundry    文件:ModuleCache.java   
protected synchronized void remove(IServer server) {
    dataByServer.remove(server);

    String serverId = server.getAttribute(DockerFoundryServer.PROP_SERVER_ID, (String) null);
    if (serverId != null) {
        IEclipsePreferences node = new InstanceScope().getNode(DockerFoundryPlugin.PLUGIN_ID);
        node.remove(KEY_MODULE_MAPPING_LIST + ":" + serverId); //$NON-NLS-1$
        try {
            node.flush();
        }
        catch (BackingStoreException e) {
            DockerFoundryPlugin
                    .getDefault()
                    .getLog()
                    .log(new Status(IStatus.ERROR, DockerFoundryPlugin.PLUGIN_ID,
                            "Failed to remove application mappings", e)); //$NON-NLS-1$
        }
    }
}
项目:ModularityCheck    文件:ModularityCheck.java   
/**
 * Load the parameters to run ModularityCheck.
 */
public void loadPreferences() {
    @SuppressWarnings("deprecation")
    Preferences preferences = new InstanceScope().getNode(PLUGIN_ID);
    try {
        repoType = preferences.getInt(REPO_TYPE, 0);
        repoManager = preferences.getInt(REPO_MANAGER, 0);
        repoUrl = preferences.get(REPO_URL, " ");
        repoXml = preferences.get(REPO_XML, " ");
        repoBegin = new SimpleDateFormat("yyyy-MM-dd").parse(preferences
                .get(REPO_BEGIN, (new Date()).toString()));
        repoEnd = new SimpleDateFormat("yyyy-MM-dd").parse(preferences.get(
                REPO_END, (new Date()).toString()));
        lastExec = preferences.get(LAST_EXEC_PARAMS, " ");
    } catch (ParseException e) {
        ConfigurationsDialog cd = new ConfigurationsDialog();
        cd.showDialog(Display.getDefault().getActiveShell());
    }
}
项目:ModularityCheck    文件:ModularityCheck.java   
/**
 * Load the parameters to run ModularityCheck.
 */
private void loadPreferences() {
    @SuppressWarnings("deprecation")
    Preferences preferences = new InstanceScope().getNode(PLUGIN_ID);
    try {
        contents.setRepoType(preferences.getInt(REPO_TYPE, 0));
        contents.setRepoManager(preferences.getInt(REPO_MANAGER, 0));
        contents.setRepoUrl(preferences.get(REPO_URL, " "));
        contents.setRepoXml(preferences.get(REPO_XML, " ")); 
        contents.setRepoBegin(new SimpleDateFormat("yyyy-MM-dd").parse(preferences
                .get(REPO_BEGIN, (new Date()).toString())));
        contents.setRepoEnd(new SimpleDateFormat("yyyy-MM-dd").parse(preferences.get(
                REPO_END, (new Date()).toString())));
        contents.setLastExec(preferences.get(LAST_EXEC_PARAMS, " "));

        } catch (ParseException e) {
            ConfigurationsDialog cd = new ConfigurationsDialog();
            cd.showDialog(Display.getDefault().getActiveShell());
        }
}
项目:ModularityCheck    文件:GITManager.java   
private void cloneRepository() throws IOException, InvalidRemoteException, TransportException, GitAPIException {
    File localPath = File.createTempFile("TestGitRepository", "");
       localPath.delete();

       System.out.println("Cloning from " + repository_url + " to " + localPath);
       Git result = Git.cloneRepository()
               .setURI(repository_url)
               .setDirectory(localPath)
               .call();


        // Note: the call() returns an opened repository already which needs to be closed to avoid file handle leaks!
        System.out.println("Having repository: " + result.getRepository().getDirectory());

        repositoryPath = result.getRepository().getDirectory().getAbsolutePath();

        @SuppressWarnings("deprecation")
        Preferences preferences = new InstanceScope().getNode(ModularityCheck.PLUGIN_ID);
        preferences.put(REPOSITORY_PATH, repositoryPath);
}
项目:e4-cookbook-migration-guide    文件:ContributedPreferenceNode.java   
@Override
public void createPage() {
    try {
        setPage(this.pageClass.newInstance());
    } catch (InstantiationException|IllegalAccessException e) {
        e.printStackTrace();
    }

    if (getLabelImage() != null) {
        getPage().setImageDescriptor(getImageDescriptor());
    }
       getPage().setTitle(getLabelText());

       ((PreferencePage)getPage()).setPreferenceStore(
            new ScopedPreferenceStore(InstanceScope.INSTANCE, this.nodeQualifier));
}
项目:che    文件:StubUtility.java   
public static String getLineDelimiterPreference(IProject project) {
  IScopeContext[] scopeContext;
  if (project != null) {
    // project preference
    scopeContext = new IScopeContext[] {new ProjectScope(project)};
    String lineDelimiter =
        Platform.getPreferencesService()
            .getString(Platform.PI_RUNTIME, Platform.PREF_LINE_SEPARATOR, null, scopeContext);
    if (lineDelimiter != null) return lineDelimiter;
  }
  // workspace preference
  scopeContext = new IScopeContext[] {InstanceScope.INSTANCE};
  String platformDefault =
      System.getProperty("line.separator", "\n"); // $NON-NLS-1$ //$NON-NLS-2$
  return Platform.getPreferencesService()
      .getString(
          Platform.PI_RUNTIME, Platform.PREF_LINE_SEPARATOR, platformDefault, scopeContext);
}
项目:eclox    文件:Doxygen.java   
/**
 * Retrieves the default doxygen instance to use.
 */
public static Doxygen getDefault() {
    Doxygen doxygen = null;
    // get the actual default preference store
    //final String identifier  = Plugin.getDefault().getPluginPreferences().getString( IPreferences.DEFAULT_DOXYGEN );
    IPreferencesService service = Platform.getPreferencesService();
    final String PLUGIN_ID = Plugin.getDefault().getBundle().getSymbolicName();
    IEclipsePreferences defaultNode = DefaultScope.INSTANCE.getNode(PLUGIN_ID);
    IEclipsePreferences instanceNode = InstanceScope.INSTANCE.getNode(PLUGIN_ID);
    IEclipsePreferences[] nodes = new IEclipsePreferences[] { instanceNode, defaultNode };
    final String identifier = service.get(IPreferences.DEFAULT_DOXYGEN, "", nodes);

    List<Class<? extends Doxygen>> doxygenClassList = new ArrayList<Class<? extends Doxygen>>();
    doxygenClassList.add(DefaultDoxygen.class);
    doxygenClassList.add(CustomDoxygen.class);
    doxygenClassList.add(BundledDoxygen.class);
    for (Class<? extends Doxygen> doxygenClass : doxygenClassList) {
        doxygen = getFromClassAndIdentifier(doxygenClass, identifier);
        if (doxygen != null)
            break;
    }
    return doxygen;
}
项目:org.csstudio.display.builder    文件:Activator.java   
/** {@inheritDoc} */
@Override
public void start(BundleContext context) throws Exception
{
    super.start(context);
    if (SingleSourcePlugin.getUIHelper().getUI() == UI.RAP)
    {
        // Is this necessary?
        // RAPCorePlugin adds the "server" scope for all plugins,
        // but starts too late...
        Platform.getPreferencesService().setDefaultLookupOrder(
                PLUGIN_ID, null,
                new String[]
                        {
                                InstanceScope.SCOPE,
                                ConfigurationScope.SCOPE,
                                "server",
                                DefaultScope.SCOPE
                        });
    }
    plugin = this;
}
项目:gwt-eclipse-plugin    文件:InlinedCssFormattingStrategy.java   
private String computeOneXmlIndentString() {
  char indentChar = ' ';
  IEclipsePreferences prefs = InstanceScope.INSTANCE.getNode(XMLCorePlugin.DEFAULT_CATALOG_ID);
  String indentCharPref = prefs.get(XMLCorePreferenceNames.INDENTATION_CHAR, null);

  if (XMLCorePreferenceNames.TAB.equals(indentCharPref)) {
    indentChar = '\t';
  }
  int indentationWidth = prefs.getInt(XMLCorePreferenceNames.INDENTATION_SIZE, 0);

  StringBuilder indent = new StringBuilder();
  for (int i = 0; i < indentationWidth; i++) {
    indent.append(indentChar);
  }
  return indent.toString();
}
项目:gama    文件:WorkspacePreferences.java   
public static IPreferenceFilter[] getPreferenceFilters() {
    final IPreferenceFilter[] transfers = new IPreferenceFilter[1];

    // For export all create a preference filter that can export
    // all nodes of the Instance and Configuration scopes
    transfers[0] = new IPreferenceFilter() {

        @Override
        public String[] getScopes() {
            return new String[] { InstanceScope.SCOPE };
        }

        @Override
        public Map getMapping(final String scope) {
            return null;
        }
    };

    return transfers;
}
项目:eclipse-wtp-json    文件:Validator.java   
protected IScopeContext[] createPreferenceScopes(
        NestedValidatorContext context) {
    if (context != null) {
        final IProject project = context.getProject();
        if (project != null && project.isAccessible()) {
            final ProjectScope projectScope = new ProjectScope(project);
            if (projectScope.getNode(
                    JSONCorePlugin.getDefault().getBundle()
                            .getSymbolicName()).getBoolean(
                    JSONCorePreferenceNames.USE_PROJECT_SETTINGS, false))
                return new IScopeContext[] { projectScope,
                        new InstanceScope(), new DefaultScope() };
        }
    }
    return new IScopeContext[] { new InstanceScope(), new DefaultScope() };
}
项目:Eclipse-Postfix-Code-Completion    文件:CleanUpPreferenceUtil.java   
public static Map<String, String> loadSaveParticipantOptions(IScopeContext context) {
    IEclipsePreferences node;
    if (hasSettingsInScope(context)) {
        node= context.getNode(JavaUI.ID_PLUGIN);
    } else {
        IScopeContext instanceScope= InstanceScope.INSTANCE;
        if (hasSettingsInScope(instanceScope)) {
            node= instanceScope.getNode(JavaUI.ID_PLUGIN);
        } else {
            return JavaPlugin.getDefault().getCleanUpRegistry().getDefaultOptions(CleanUpConstants.DEFAULT_SAVE_ACTION_OPTIONS).getMap();
        }
    }

    Map<String, String> result= new HashMap<String, String>();
    Set<String> keys= JavaPlugin.getDefault().getCleanUpRegistry().getDefaultOptions(CleanUpConstants.DEFAULT_SAVE_ACTION_OPTIONS).getKeys();
    for (Iterator<String> iterator= keys.iterator(); iterator.hasNext();) {
        String key= iterator.next();
        result.put(key, node.get(SAVE_PARTICIPANT_KEY_PREFIX + key, CleanUpOptions.FALSE));
       }

    return result;
}
项目:Eclipse-Postfix-Code-Completion    文件:ProfileManager.java   
/**
 * Update all formatter settings with the settings of the specified profile.
 * @param profile The profile to write to the preference store
 */
private void writeToPreferenceStore(Profile profile, IScopeContext context) {
    final Map<String, String> profileOptions= profile.getSettings();

    for (int i= 0; i < fKeySets.length; i++) {
        updatePreferences(context.getNode(fKeySets[i].getNodeName()), fKeySets[i].getKeys(), profileOptions);
       }

    final IEclipsePreferences uiPrefs= context.getNode(JavaUI.ID_PLUGIN);
    if (uiPrefs.getInt(fProfileVersionKey, 0) != fProfileVersioner.getCurrentVersion()) {
        uiPrefs.putInt(fProfileVersionKey, fProfileVersioner.getCurrentVersion());
    }

    if (context.getName() == InstanceScope.SCOPE) {
        uiPrefs.put(fProfileKey, profile.getID());
    } else if (context.getName() == ProjectScope.SCOPE && !profile.isSharedProfile()) {
        uiPrefs.put(fProfileKey, profile.getID());
    }
}
项目:Eclipse-Postfix-Code-Completion    文件:CleanUpSaveParticipantPreferenceConfiguration.java   
/**
 * {@inheritDoc}
 */
@Override
public void performDefaults() {
    if (ProjectScope.SCOPE.equals(fContext.getName()) && !hasSettingsInScope(fContext))
        return;

    enabled(true);

    if (ProjectScope.SCOPE.equals(fContext.getName())) {
        fSettings= CleanUpPreferenceUtil.loadSaveParticipantOptions(InstanceScope.INSTANCE);
    } else {
        fSettings= JavaPlugin.getDefault().getCleanUpRegistry().getDefaultOptions(CleanUpConstants.DEFAULT_SAVE_ACTION_OPTIONS).getMap();
    }
    settingsChanged();

    super.performDefaults();
}
项目:Eclipse-Postfix-Code-Completion    文件:CleanUpRefactoringWizard.java   
/**
 * {@inheritDoc}
 */
public String getColumnText(Object element, int columnIndex) {
    if (columnIndex == 0) {
        return ((IJavaProject)element).getProject().getName();
    } else if (columnIndex == 1) {

        if (fProfileIdsTable == null)
            fProfileIdsTable= loadProfiles();

        IEclipsePreferences instancePreferences= InstanceScope.INSTANCE.getNode(JavaUI.ID_PLUGIN);

        final String workbenchProfileId;
        if (instancePreferences.get(CleanUpConstants.CLEANUP_PROFILE, null) != null) {
            workbenchProfileId= instancePreferences.get(CleanUpConstants.CLEANUP_PROFILE, null);
        } else {
            workbenchProfileId= CleanUpConstants.DEFAULT_PROFILE;
        }

        return getProjectProfileName((IJavaProject)element, fProfileIdsTable, workbenchProfileId);
    }
    return null;
}
项目:Eclipse-Postfix-Code-Completion    文件:JavaCorePreferenceModifyListener.java   
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);
}