Java 类org.eclipse.core.resources.ProjectScope 实例源码

项目:EclipseMinifyBuilder    文件:MinifyBuilder.java   
@Override
protected IProject[] build(int kind, @SuppressWarnings("rawtypes") Map args,
        IProgressMonitor monitor) throws CoreException {
    ProjectScope projectScope = new ProjectScope(getProject());
    IEclipsePreferences prefs = projectScope.getNode(BUILDER_ID);
    if (kind == FULL_BUILD) {
        fullBuild(prefs, monitor);
    } else {
        IResourceDelta delta = getDelta(getProject());
        if (delta == null) {
            fullBuild(prefs, monitor);
        } else {
            incrementalBuild(delta, prefs, monitor);
        }
    }
    return null;
}
项目:eclipse-asciidoctools    文件:AsciidocConfiguration.java   
private static boolean updateConfigurationFromSettings(AsciidocConfiguration configuration, IProject project) {
    final IScopeContext projectScope = new ProjectScope(project);
    IEclipsePreferences preferences = projectScope.getNode(Activator.PLUGIN_ID);
    try {
        createSettings(project, BACKEND_DEFAULT, RESOURCESPATH_DEFAULT, SOURCESPATH_DEFAULT, STYLESHEETPATH_DEFAULT, TARGETPATH_DEFAULT);
        configuration.setBackend(preferences.get(BACKEND_PROPERTY, BACKEND_DEFAULT));
        configuration.setResourcesPath(preferences.get(RESOURCESPATH_PROPERTY, RESOURCESPATH_DEFAULT));
        configuration.setSourcesPath(preferences.get(SOURCESPATH_PROPERTY, SOURCESPATH_DEFAULT));
        configuration.setStylesheetPath(preferences.get(STYLESHEETPATH_PROPERTY, STYLESHEETPATH_DEFAULT));
        configuration.setTargetPath(preferences.get(TARGETPATH_PROPERTY, TARGETPATH_DEFAULT));
    } catch (BackingStoreException e) {
        Activator.getDefault().getLog().log(new Status(IStatus.WARNING, Activator.PLUGIN_ID, e.getMessage(), e));
        return false;
    }
    configuration.source = AsciidocConfigurationSource.SETTINGS;
    return true;
}
项目:eclipse    文件:BazelProjectSupport.java   
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();
}
项目:google-cloud-eclipse    文件:AppEngineDeployPreferencesPanelTest.java   
@Test
public void testProjectSavedInPreferencesSelected()
    throws ProjectRepositoryException, InterruptedException, BackingStoreException {
  IEclipsePreferences node =
      new ProjectScope(project).getNode(DeployPreferences.PREFERENCE_STORE_QUALIFIER);
  try {
    node.put("project.id", "projectId1");
    node.put("account.email", EMAIL_1);
    model = new DeployPreferences(project);

    initializeProjectRepository();
    when(loginService.getAccounts()).thenReturn(twoAccountSet);
    deployPanel = createPanel(true /* requireValues */);
    deployPanel.latestGcpProjectQueryJob.join();

    ProjectSelector projectSelector = getProjectSelector();
    IStructuredSelection selection = projectSelector.getViewer().getStructuredSelection();
    assertThat(selection.size(), is(1));
    assertThat(((GcpProject) selection.getFirstElement()).getId(), is("projectId1"));
  } finally {
    node.clear();
  }
}
项目: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();
}
项目:che    文件:ImportOrganizeTest.java   
protected void setOrganizeImportSettings(
    String[] order, int threshold, int staticThreshold, IJavaProject project) {
  IEclipsePreferences scope =
      new ProjectScope(project.getProject()).getNode("org.eclipse.jdt.ui");
  if (order == null) {
    scope.remove(PreferenceConstants.ORGIMPORTS_IMPORTORDER);
    scope.remove(PreferenceConstants.ORGIMPORTS_ONDEMANDTHRESHOLD);
  } else {
    StringBuffer buf = new StringBuffer();
    for (int i = 0; i < order.length; i++) {
      buf.append(order[i]);
      buf.append(';');
    }
    scope.put(PreferenceConstants.ORGIMPORTS_IMPORTORDER, buf.toString());
    scope.put(PreferenceConstants.ORGIMPORTS_ONDEMANDTHRESHOLD, String.valueOf(threshold));
    scope.put(
        PreferenceConstants.ORGIMPORTS_STATIC_ONDEMANDTHRESHOLD, String.valueOf(staticThreshold));
  }
}
项目: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);
}
项目:gwt-eclipse-plugin    文件:GWTJavaEditor.java   
private boolean formatOnSaveEnabled(IJavaProject javaProject) {
  SaveParticipantRegistry spr = JavaPlugin.getDefault().getSaveParticipantRegistry();
  IPostSaveListener[] listeners = spr.getEnabledPostSaveListeners(javaProject.getProject());

  for (IPostSaveListener listener : listeners) {
    if (listener instanceof CleanUpPostSaveListener) {
      Map<String, String> settings =
          CleanUpPreferenceUtil.loadSaveParticipantOptions(new ProjectScope(
          javaProject.getProject()));

      if (settings == null) {
        return false;
      }

      return (CLEAN_UP_OPTION_TRUE.equals(settings.get(CleanUpConstants.FORMAT_SOURCE_CODE)));
    }
  }

  return false;
}
项目:PerformanceHat    文件:AbstractFeedbackPropertyPage.java   
private final IEclipsePreferences getProjectPreferences() {
  final IAdaptable element = getElement();
  IProject project = null;
  if (element instanceof IJavaProject) {
    project = ((IJavaProject) element).getProject();
  }
  else if (element instanceof IProject) {
    project = (IProject) element;
  }

  if (project != null) {
    final IScopeContext context = new ProjectScope(project);
    return context.getNode(BaseIds.ID);
  }
  return null;
}
项目:filesync4eclipse    文件:ProjectProperties.java   
private void initPreferencesStore() {
    IScopeContext projectScope = new ProjectScope(project);
    preferences = projectScope.getNode(FileSyncPlugin.PLUGIN_ID);
    buildPathMap(preferences);
    preferences.addPreferenceChangeListener(this);
    preferences.addNodeChangeListener(this);
    IStringVariableManager manager = VariablesPlugin.getDefault().getStringVariableManager();
    manager.addValueVariableListener(this);
    jobChangeAdapter = new JobChangeAdapter(){
        @Override
        public void done(IJobChangeEvent event) {
            // XXX dirty trick to re-evaluate dynamic egit variables on branch change
            if(!event.getJob().getClass().getName().contains("org.eclipse.egit.ui.internal.branch.BranchOperationUI")){
                return;
            }
            rebuildPathMap();
        }
    };
    Job.getJobManager().addJobChangeListener(jobChangeAdapter);
    ResourcesPlugin.getWorkspace().addResourceChangeListener(this);
}
项目: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() };
}
项目:APICloud-Studio    文件:ProfileManager.java   
public IProfile getSelected(IProject project)
{
    IProfile selected = fSelected.get(project);
    if (selected == null && project != null)
    {
        // try to resolve the selected profile
        PreferenceKey activeProfileKey = getActiveProfileKey();
        ProjectScope scope = new ProjectScope(project);
        IProfile profile = findProfile(activeProfileKey.getStoredValue(scope));
        if (profile != null)
        {
            fSelected.put(project, profile);
            selected = profile;
        }
        else
        {
            // Return the default workspace setting
            selected = fSelected.get(null);
        }
    }
    return selected;
}
项目:APICloud-Studio    文件:OptionsConfigurationBlock.java   
public boolean hasProjectSpecificOptions(IProject project)
{
    if (project != null)
    {
        IScopeContext projectContext = new ProjectScope(project);
        PreferenceKey[] allKeys = fAllKeys;
        for (int i = 0; i < allKeys.length; i++)
        {
            if (allKeys[i].getStoredValue(projectContext, fManager) != null)
            {
                return true;
            }
        }
    }
    return false;
}
项目:APICloud-Studio    文件:UserAgentManager.java   
/**
 * Given a project, return the list of active user agent IDs. The current implementation processes only the first
 * (primary) nature ID of the given project. Secondary natures may be taken into consideration at a later point in
 * time
 * 
 * @param project
 *            An {@link IProject}.
 * @return Returns an array of user agent IDs for the main mature of the given project. In case the given project is
 *         null, an empty string array is returned.
 */
public String[] getActiveUserAgentIDs(IProject project)
{
    if (project == null)
    {
        return ArrayUtil.NO_STRINGS;
    }
    // Extract the natures from the given project
    String[] natureIDs = getProjectNatures(project);

    // Look at the project-scope preferences for the active agents.
    ProjectScope scope = new ProjectScope(project);
    IEclipsePreferences node = scope.getNode(CommonEditorPlugin.PLUGIN_ID);
    if (node != null)
    {
        String agents = node.get(IPreferenceConstants.USER_AGENT_PREFERENCE, null);
        if (agents != null)
        {
            Map<String, String[]> userAgents = extractUserAgents(agents);
            return getActiveUserAgentIDs(userAgents, natureIDs);
        }
    }
    // In case we did not find any project-specific settings, use the project's nature IDs to grab the agents that
    // were set in the workspace settings.
    return getActiveUserAgentIDs(natureIDs);
}
项目:APICloud-Studio    文件:UserAgentManager.java   
public void clearPreferences(IProject project)
{
    if (project != null)
    {
        // Save to the project scope
        IEclipsePreferences preferences = new ProjectScope(project).getNode(CommonEditorPlugin.PLUGIN_ID);
        preferences.remove(IPreferenceConstants.USER_AGENT_PREFERENCE);
        try
        {
            preferences.flush();
        }
        catch (BackingStoreException e)
        {
            // ignore
        }
    }
}
项目:Extensions    文件:KnuddelsWizard.java   
private void createProject(IProject project) throws CoreException {
    project.create(null);
    project.open(null);
    project.setDefaultCharset("UTF-8", null);
    updateProjectNature(project);
    IScopeContext context           = new ProjectScope(project);
    System.err.println(context.getName() + ", " + context.getLocation());
    /* projectPreferences.put(key, value); projectPreferences.flush();*/

    Properties config = new Properties();
    config.setProperty("appName", app_name);
    config.setProperty("appVersion", app_version);
    config.setProperty("appDeveloper.knuddelsDEV", app_nickname);
    config.setProperty("appDeveloper.knuddelsDE", app_nickname);
    config.setProperty("mayBeInstalledBy.1", "*.knuddelsDE");
    saveProperties(config, project.getFile("app.config"));

    loadTemplate(project);
}
项目:Eclipse-Postfix-Code-Completion    文件:JavaEditor.java   
/**
 * Creates and returns the preference store for this Java editor with the given input.
 *
 * @param input The editor input for which to create the preference store
 * @return the preference store for this editor
 *
 * @since 3.0
 */
private IPreferenceStore createCombinedPreferenceStore(IEditorInput input) {
    List<IPreferenceStore> stores= new ArrayList<IPreferenceStore>(3);

    IJavaProject project= EditorUtility.getJavaProject(input);
    if (project != null) {
        stores.add(new EclipsePreferencesAdapter(new ProjectScope(project.getProject()), JavaCore.PLUGIN_ID));
    }

    stores.add(JavaPlugin.getDefault().getPreferenceStore());
    stores.add(new PreferencesAdapter(JavaPlugin.getJavaCorePluginPreferences()));
    stores.add(EditorsUI.getPreferenceStore());
    stores.add(PlatformUI.getPreferenceStore());

    return new ChainedPreferenceStore(stores.toArray(new IPreferenceStore[stores.size()]));
}
项目: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();
}
项目:cmake4cdt    文件:CompileCmdsHandler.java   
/**
 * @return
 * @throws BackingStoreException 
 */
public boolean hasChanged(boolean resetModifiedTimestamp) throws BackingStoreException  {

    ProjectScope ps = new ProjectScope(project);
    IEclipsePreferences prefs = ps.getNode( Activator.getId() );

    String key = this.filename;
    Long value = prefs.getLong(key, 0);

    Long current_ts = getFileModTime();

    if(resetModifiedTimestamp) {
        prefs.putLong(key, current_ts);
        prefs.flush();
    }

    if(value.longValue() == current_ts.longValue()) {
        return false;
    }
    else {
        return true;
    }
}
项目:parichayana    文件:ParichayanaActivator.java   
public static String getPreference(String name, String defaultValue, IProject project) {
    IEclipsePreferences[] preferencesLookup;
    if (project != null) {
        preferencesLookup = new IEclipsePreferences[] {
                new ProjectScope(project).getNode(PLUGIN_ID),
                InstanceScope.INSTANCE.getNode(PLUGIN_ID),
                DefaultScope.INSTANCE.getNode(PLUGIN_ID)
        };
    } else {
        preferencesLookup = new IEclipsePreferences[] {
                InstanceScope.INSTANCE.getNode(PLUGIN_ID),
                DefaultScope.INSTANCE.getNode(PLUGIN_ID)
        };
    }
    IPreferencesService service = Platform.getPreferencesService();
    String value = service.get(name, defaultValue, preferencesLookup);
    return value;
}
项目:eclipse-wtp-webresources    文件:PreferencesWebResourcesProvider.java   
private boolean isSearchInAllCSSFiles(IProject project) {
    if (fPreferenceService == null) {
        fPreferenceService = Platform.getPreferencesService();
    }

    IScopeContext[] fLookupOrder;
    ProjectScope projectScope = new ProjectScope(project);
    if (projectScope
            .getNode(getQualifier())
            .getBoolean(
                    WebResourcesCorePreferenceNames.CSS_USE_PROJECT_SETTINGS,
                    false)) {
        fLookupOrder = new IScopeContext[] { projectScope,
                new InstanceScope(), new DefaultScope() };
    } else {
        fLookupOrder = new IScopeContext[] { new InstanceScope(),
                new DefaultScope() };
    }
    return fPreferenceService
            .getBoolean(
                    getQualifier(),
                    WebResourcesCorePreferenceNames.SEARCH_IN_ALL_CSS_FILES_IF_NO_LINKS,
                    false, fLookupOrder);
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:JavaEditor.java   
/**
 * Creates and returns the preference store for this Java editor with the given input.
 *
 * @param input The editor input for which to create the preference store
 * @return the preference store for this editor
 *
 * @since 3.0
 */
private IPreferenceStore createCombinedPreferenceStore(IEditorInput input) {
    List<IPreferenceStore> stores= new ArrayList<IPreferenceStore>(3);

    IJavaProject project= EditorUtility.getJavaProject(input);
    if (project != null) {
        stores.add(new EclipsePreferencesAdapter(new ProjectScope(project.getProject()), JavaCore.PLUGIN_ID));
    }

    stores.add(JavaPlugin.getDefault().getPreferenceStore());
    stores.add(new PreferencesAdapter(JavaPlugin.getJavaCorePluginPreferences()));
    stores.add(EditorsUI.getPreferenceStore());
    stores.add(PlatformUI.getPreferenceStore());

    return new ChainedPreferenceStore(stores.toArray(new IPreferenceStore[stores.size()]));
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件: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-Juno38    文件: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();
}
项目:ant-ivyde    文件:RetrieveSetupManager.java   
public void save(final IProject project, List<StandaloneRetrieveSetup> retrieveSetups)
        throws IOException {
    StandaloneRetrieveSerializer serializer = new StandaloneRetrieveSerializer();
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    try {
        serializer.write(out, retrieveSetups);
    } finally {
        try {
            out.close();
        } catch (IOException e) {
            // we don't care
        }
    }

    final String retrieveSetup = new String(out.toByteArray());

    synchronized (projectPrefs) {
        IEclipsePreferences pref = projectPrefs.get(project);
        if (pref == null) {
            IScopeContext projectScope = new ProjectScope(project);
            pref = projectScope.getNode(IvyPlugin.ID);
            projectPrefs.put(project, pref);
        }
        pref.put(PREF_ID, retrieveSetup);
    }
}
项目:wt-studio    文件:LineEndingUtil.java   
public static String determineProjectLineEnding(IFile file) {
    String lineEnding = null;
    if (file != null && file.getProject() != null) {
        lineEnding = Platform.getPreferencesService().getString(Platform.PI_RUNTIME, Platform.PREF_LINE_SEPARATOR, null, new IScopeContext[] { new ProjectScope(file.getProject()) });
    }

    if (lineEnding == null) {
        lineEnding = Platform.getPreferencesService().getString(Platform.PI_RUNTIME, Platform.PREF_LINE_SEPARATOR, null, new IScopeContext[] {
                InstanceScope.INSTANCE});
    }

    if (lineEnding == null) {
        lineEnding = System.getProperty(Platform.PREF_LINE_SEPARATOR);
    }

    return lineEnding;
}
项目:seasar2-assistant    文件:ProjectPreferences.java   
private ProjectPreferences(IProject project) {
    IScopeContext projectScope = new ProjectScope(project);
    projectNode = projectScope.getNode(Seasar2AssistantPlugin.PLUGIN_ID);
    for (Field field : this.getClass().getDeclaredFields()) {
        if (!field.isAnnotationPresent(ProjectProperty.class)) {
            continue;
        }
        try {
            if (field.getType() == int.class || field.getType() == Integer.class) {
                field.setInt(this, projectNode.getInt(field.getName(), 0));
            }
            if (field.getType() == boolean.class || field.getType() == Boolean.class) {
                field.setBoolean(this, projectNode.getBoolean(field.getName(), false));
            }
            if (field.getType() == long.class || field.getType() == Long.class) {
                field.setLong(this, projectNode.getLong(field.getName(), 0L));
            }
            if (field.getType() == String.class) {
                field.set(this, projectNode.get(field.getName(), ""));
            }
        } catch (IllegalAccessException e) {
            LoggerUtil.error(e);
            throw new IllegalStateException(e);
        }
    }
}
项目:teavm    文件:TeaVMEclipsePlugin.java   
public void addNature(IProgressMonitor progressMonitor, IProject project) throws CoreException {
    ProjectScope scope = new ProjectScope(project);
    try {
        IEclipsePreferences prefs = scope.getNode(TeaVMEclipsePlugin.ID);
        prefs.flush();
        settingsMap.put(project, new PreferencesBasedTeaVMProjectSettings(project, prefs));
    } catch (BackingStoreException e) {
        throw new RuntimeException("Error creating preferences", e);
    }
    IProjectDescription projectDescription = project.getDescription();
    String[] natureIds = projectDescription.getNatureIds();
    natureIds = Arrays.copyOf(natureIds, natureIds.length + 1);
    natureIds[natureIds.length - 1] = TeaVMEclipsePlugin.NATURE_ID;
    projectDescription.setNatureIds(natureIds);
    project.setDescription(projectDescription, progressMonitor);
}
项目:eclipse-tslint    文件:Builder.java   
private void lint(IResource resource) throws IOException {
    IProject project = this.getProject();
    IScopeContext projectScope = new ProjectScope(project);
    IEclipsePreferences prefs = projectScope.getNode(TSLintPlugin.ID);
    String configurationPath = prefs.get("configPath", null);
    if (configurationPath != null && !configurationPath.equals("")) {
        File configFile = new File(configurationPath);
        // if we're given a relative path get the absolute path for it
        if (!configFile.isAbsolute()) {
            IPath projectLocation = project.getRawLocation();
            String projectLocationPath = projectLocation.toOSString();
            File projectFile = new File(projectLocationPath, configurationPath);
            configurationPath = projectFile.getAbsolutePath();
        }
    } else {
        configurationPath = project.getFile("tslint.json").getRawLocation().toOSString();
    }
    this.linter.lint(resource, configurationPath);
}
项目:goclipse    文件:AbstractLangEditor.java   
protected IPreferenceStore createCombinedPreferenceStore(IEditorInput input) {
    List<IPreferenceStore> stores = new ArrayList<IPreferenceStore>(4);

    IProject project = EditorUtils.getAssociatedProject(input);
    if (project != null) {
        stores.add(new EclipsePreferencesAdapter(new ProjectScope(project), LangUIPlugin.PLUGIN_ID));
    }

    stores.add(LangUIPlugin.getInstance().getPreferenceStore());
    stores.add(LangUIPlugin.getInstance().getCorePreferenceStore());

    alterCombinedPreferenceStores_beforeEditorsUI(stores);
    stores.add(EditorsUI.getPreferenceStore());

    return new ChainedPreferenceStore(ArrayUtil.createFrom(stores, IPreferenceStore.class));
}
项目:cuina    文件:CuinaProject.java   
/**
 * Erstellt eine neue Projekt-Ressource und öffnet sie.
 * @param monitor
 * @throws CoreException
 */
public void create(IProgressMonitor monitor) throws CoreException
{
    project.create(monitor);
    project.open(monitor);

    IProjectDescription description = project.getDescription();
    description.setNatureIds(new String[] { CuinaCore.NATURE_ID });
    project.setDescription(description, null);

    IEclipsePreferences prefs = new ProjectScope(project).getNode(CuinaCore.PLUGIN_ID);
    prefs.put("cuina.engine.path", "${env_var:CUINA_HOME}");
    prefs.put("cuina.plugin.path", "${env_var:CUINA_HOME}/plugins");
    try
    {
        prefs.flush();
    }
    catch (BackingStoreException e)
    {
        throw new CoreException(new Status(IStatus.ERROR, CuinaCore.PLUGIN_ID, e.getMessage(), e));
    }
}
项目:eclipse-less    文件:Builder.java   
private void compileLessFiles(IProgressMonitor monitor) {
    IProject project = this.getProject();
    IScopeContext projectScope = new ProjectScope(project);
    IEclipsePreferences prefs = projectScope.getNode(UIPlugin.ID);
    String srcFiles = prefs.get("srcFiles", null);
    String outDir = prefs.get("outDir", null);

    if (srcFiles != null) {
        for (String srcFile : Splitter.on(';').split(srcFiles)) {
            IFile lessFile = project.getFile(srcFile);
            String cssFileName = srcFile.replace(".less", ".css");

            if (outDir != null) {
                List<String> splitList = Splitter.on('/').splitToList(cssFileName);

                cssFileName = outDir + '/' + splitList.get(splitList.size() - 1);
            }

            IFile cssFile = project.getFile(cssFileName);

            compileLessFile(lessFile, cssFile, monitor);
        }
    }
}
项目:gw4e.project    文件:SettingsManagerTest.java   
@Test
public void testRemove() throws Exception {
    IJavaProject pj = ProjectHelper.getOrCreateSimpleGW4EProject(PROJECT_NAME, false, false);
    String[] values = new String[] { PreferenceManager.SUFFIX_PREFERENCE_FOR_TEST_IMPLEMENTATION };
    SettingsManager.remove(pj.getProject(), values);

    IScopeContext context = new ProjectScope(pj.getProject());
    IEclipsePreferences projectPreferences = context.getNode(Activator.PLUGIN_ID);
    String val = projectPreferences.get(PreferenceManager.SUFFIX_PREFERENCE_FOR_TEST_IMPLEMENTATION, "");

    assertEquals("", val);
}
项目:pgcodekeeper    文件:PgDbProject.java   
/**
 * @return pgCodeKeeper project preferences or null if wrong project
 */
public static IEclipsePreferences getPrefs(IProject proj) {
    try {
        if (proj.hasNature(NATURE.ID)) {
            return new ProjectScope(proj).getNode(PLUGIN_ID.THIS);
        }
    } catch (CoreException ex) {
        Log.log(ex);
    }
    return null;
}
项目:ec4e    文件:NewEditorConfigWizard.java   
private static String getLineDelimiterPreference(IContainer file) {
    IScopeContext[] scopeContext;
    if (file != null && file.getProject() != null) {
        // project preference
        scopeContext = new IScopeContext[] { new ProjectScope(file.getProject()) };
        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 };
    return Platform.getPreferencesService().getString(Platform.PI_RUNTIME, Platform.PREF_LINE_SEPARATOR, null,
            scopeContext);
}
项目:visuflow-plugin    文件:ProjectPreferences.java   
public void createPreferences() {
        IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(GlobalSettings.get("AnalysisProject"));
        IScopeContext projectScope = new ProjectScope(project);
        IEclipsePreferences pref = projectScope.getNode(Activator.PLUGIN_ID);
        for (String stmt : getStatementTypes()) {
//          pref.putInt(stmt, -16743169);
            pref.putInt(stmt, -6037505);
        }
        try {
            pref.flush();
        } catch (BackingStoreException e) {
            e.printStackTrace();
        }
    }
项目:visuflow-plugin    文件:ProjectPreferences.java   
public void updateColorPreferences(String stmtType, int color) {
    IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(GlobalSettings.get("AnalysisProject"));
    IScopeContext projectScope = new ProjectScope(project);
    IEclipsePreferences pref = projectScope.getNode(Activator.PLUGIN_ID);
    pref.putInt(stmtType, color);
    try {
        pref.flush();
    } catch (BackingStoreException e) {
        e.printStackTrace();
    }
}
项目:visuflow-plugin    文件:ProjectPreferences.java   
public Map<String, Integer> getAllNodeColors() {
    HashMap<String, Integer> res = new HashMap<>();
    IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(GlobalSettings.get("AnalysisProject"));
    IScopeContext projectScope = new ProjectScope(project);
    IEclipsePreferences pref = projectScope.getNode(Activator.PLUGIN_ID);
    for (String stmt : getStatementTypes()) {
        res.put(stmt, pref.getInt(stmt, 0));
    }
    return res;
}
项目:eclipse-asciidoctools    文件:AsciidocConfiguration.java   
private static void createSettings(IProject project, String backend, String resourcesPath, String sourcesPath, String stylesheetPath,
        String targetPath) throws BackingStoreException {
    final IScopeContext projectScope = new ProjectScope(project);
    IEclipsePreferences preferences = projectScope.getNode(Activator.PLUGIN_ID);
    if (preferences.keys().length == 0) {
        preferences.put(BACKEND_PROPERTY, backend);
        preferences.put(RESOURCESPATH_PROPERTY, resourcesPath);
        preferences.put(SOURCESPATH_PROPERTY, sourcesPath);
        preferences.put(STYLESHEETPATH_PROPERTY, stylesheetPath);
        preferences.put(TARGETPATH_PROPERTY, targetPath);
        preferences.flush();
    }
}