当前位置: 首页>>代码示例>>Java>>正文


Java IScopeContext类代码示例

本文整理汇总了Java中org.eclipse.core.runtime.preferences.IScopeContext的典型用法代码示例。如果您正苦于以下问题:Java IScopeContext类的具体用法?Java IScopeContext怎么用?Java IScopeContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IScopeContext类属于org.eclipse.core.runtime.preferences包,在下文中一共展示了IScopeContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: updateConfigurationFromSettings

import org.eclipse.core.runtime.preferences.IScopeContext; //导入依赖的package包/类
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;
}
 
开发者ID:awltech,项目名称:eclipse-asciidoctools,代码行数:18,代码来源:AsciidocConfiguration.java

示例2: addSettings

import org.eclipse.core.runtime.preferences.IScopeContext; //导入依赖的package包/类
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();
}
 
开发者ID:bazelbuild,项目名称:eclipse,代码行数:18,代码来源:BazelProjectSupport.java

示例3: getChanges

import org.eclipse.core.runtime.preferences.IScopeContext; //导入依赖的package包/类
private boolean getChanges(IScopeContext currContext, List<Key> changedSettings) {
	boolean needsBuild = false;
	for (int i = 0; i < fAllKeys.length; i++) {
		Key key = fAllKeys[i];
		String oldVal = key.getStoredValue(currContext, null);
		String val = key.getStoredValue(currContext, fManager);
		if (val == null) {
			if (oldVal != null) {
				changedSettings.add(key);
				needsBuild |= !oldVal.equals(key.getStoredValue(fLookupOrder, true, fManager));
			}
		} else if (!val.equals(oldVal)) {
			changedSettings.add(key);
			needsBuild |= oldVal != null || !val.equals(key.getStoredValue(fLookupOrder, true, fManager));
		}
	}
	return needsBuild;
}
 
开发者ID:angelozerr,项目名称:typescript.java,代码行数:19,代码来源:OptionsConfigurationBlock.java

示例4: getWritablePreferenceStore

import org.eclipse.core.runtime.preferences.IScopeContext; //导入依赖的package包/类
@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();
}
 
开发者ID:cplutte,项目名称:bts,代码行数:19,代码来源:PreferenceStoreAccessImpl.java

示例5: getLineDelimiterPreference

import org.eclipse.core.runtime.preferences.IScopeContext; //导入依赖的package包/类
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);
}
 
开发者ID:eclipse,项目名称:che,代码行数:19,代码来源:StubUtility.java

示例6: getProjectPreferences

import org.eclipse.core.runtime.preferences.IScopeContext; //导入依赖的package包/类
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;
}
 
开发者ID:sealuzh,项目名称:PerformanceHat,代码行数:17,代码来源:AbstractFeedbackPropertyPage.java

示例7: initPreferencesStore

import org.eclipse.core.runtime.preferences.IScopeContext; //导入依赖的package包/类
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);
}
 
开发者ID:iloveeclipse,项目名称:filesync4eclipse,代码行数:22,代码来源:ProjectProperties.java

示例8: createPreferenceScopes

import org.eclipse.core.runtime.preferences.IScopeContext; //导入依赖的package包/类
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() };
}
 
开发者ID:angelozerr,项目名称:eclipse-wtp-json,代码行数:17,代码来源:Validator.java

示例9: getCurrentTaskTags

import org.eclipse.core.runtime.preferences.IScopeContext; //导入依赖的package包/类
/**
 * Looks up the task tag strings an priorities from preferences.
 * 
 * @return
 */
protected static List<TaskTag> getCurrentTaskTags()
{
	try
	{
		final IScopeContext[] contexts = new IScopeContext[] { EclipseUtil.instanceScope(),
				EclipseUtil.defaultScope() };
		String rawTagNames = Platform.getPreferencesService().getString(PREF_PLUGIN_ID,
				ICorePreferenceConstants.TASK_TAG_NAMES, null, contexts);
		String rawTagPriorities = Platform.getPreferencesService().getString(PREF_PLUGIN_ID,
				ICorePreferenceConstants.TASK_TAG_PRIORITIES, null, contexts);
		return createTaskTags(rawTagNames, rawTagPriorities);
	}
	catch (Exception e)
	{
		IdeLog.logError(CorePlugin.getDefault(), "Failed to lookup task tag strings and priorities", e); //$NON-NLS-1$
		return Collections.emptyList();
	}
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:24,代码来源:TaskTag.java

示例10: getServerAddress

import org.eclipse.core.runtime.preferences.IScopeContext; //导入依赖的package包/类
/**
 * Returns preferences-specified local webserver address
 * 
 * @return
 */
public static InetAddress getServerAddress()
{
	String address = Platform.getPreferencesService().getString(WebServerCorePlugin.PLUGIN_ID,
			IWebServerPreferenceConstants.PREF_HTTP_SERVER_ADDRESS, null,
			new IScopeContext[] { EclipseUtil.instanceScope(), EclipseUtil.defaultScope() });
	for (InetAddress i : SocketUtil.getLocalAddresses())
	{
		if (i.getHostAddress().equals(address))
		{
			return i;
		}
	}
	try
	{
		return InetAddress.getByName(IWebServerPreferenceConstants.DEFAULT_HTTP_SERVER_ADDRESS);
	}
	catch (UnknownHostException e)
	{
		return null;
	}
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:27,代码来源:WebServerPreferences.java

示例11: hasProjectSpecificOptions

import org.eclipse.core.runtime.preferences.IScopeContext; //导入依赖的package包/类
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;
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:17,代码来源:OptionsConfigurationBlock.java

示例12: AbstractFormatterSelectionBlock

import org.eclipse.core.runtime.preferences.IScopeContext; //导入依赖的package包/类
public AbstractFormatterSelectionBlock(IStatusChangeListener context, IProject project,
		IWorkbenchPreferenceContainer container)
{
	super(context, project, ProfileManager.collectPreferenceKeys(TEMP_LIST, true), container);
	Collections.sort(TEMP_LIST, new Comparator<IScriptFormatterFactory>()
	{
		public int compare(IScriptFormatterFactory s1, IScriptFormatterFactory s2)
		{
			return s1.getName().compareToIgnoreCase(s2.getName());
		}
	});
	factories = TEMP_LIST.toArray(new IScriptFormatterFactory[TEMP_LIST.size()]);
	TEMP_LIST = new ArrayList<IScriptFormatterFactory>();
	sourcePreviewViewers = new ArrayList<SourceViewer>();

	// Override the super preferences lookup order.
	// All the changes to the formatter settings should go to the instance scope (no project scope here). Only the
	// selected profile will be picked from the project scope and then the instance scope when requested.
	fLookupOrder = new IScopeContext[] { EclipseUtil.instanceScope(), EclipseUtil.defaultScope() };
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:21,代码来源:AbstractFormatterSelectionBlock.java

示例13: createProject

import org.eclipse.core.runtime.preferences.IScopeContext; //导入依赖的package包/类
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);
}
 
开发者ID:MyChannel-Apps,项目名称:Extensions,代码行数:20,代码来源:KnuddelsWizard.java

示例14: updateProfilesWithName

import org.eclipse.core.runtime.preferences.IScopeContext; //导入依赖的package包/类
protected void updateProfilesWithName(String oldName, Profile newProfile, boolean applySettings) {
	IProject[] projects= ResourcesPlugin.getWorkspace().getRoot().getProjects();
	for (int i= 0; i < projects.length; i++) {
		IScopeContext projectScope= fPreferencesAccess.getProjectScope(projects[i]);
		IEclipsePreferences node= projectScope.getNode(JavaUI.ID_PLUGIN);
		String profileId= node.get(fProfileKey, null);
		if (oldName.equals(profileId)) {
			if (newProfile == null) {
				node.remove(fProfileKey);
			} else {
				if (applySettings) {
					writeToPreferenceStore(newProfile, projectScope);
				} else {
					node.put(fProfileKey, newProfile.getID());
				}
			}
		}
	}

	IScopeContext instanceScope= fPreferencesAccess.getInstanceScope();
	final IEclipsePreferences uiPrefs= instanceScope.getNode(JavaUI.ID_PLUGIN);
	if (newProfile != null && oldName.equals(uiPrefs.get(fProfileKey, null))) {
		writeToPreferenceStore(newProfile, instanceScope);
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:26,代码来源:ProfileManager.java

示例15: loadProfiles

import org.eclipse.core.runtime.preferences.IScopeContext; //导入依赖的package包/类
/**
 * Returns a list of {@link org.eclipse.jdt.internal.ui.preferences.formatter.ProfileManager.Profile} stored in the <code>scope</code>,
 * including the built-in profiles.
 * @param scope the context from which to retrieve the profiles
 * @return list of profiles, not null
 * @since 3.3
 */
public static List<Profile> loadProfiles(IScopeContext scope) {

       CleanUpProfileVersioner versioner= new CleanUpProfileVersioner();
   	ProfileStore profileStore= new ProfileStore(CleanUpConstants.CLEANUP_PROFILES, versioner);

   	List<Profile> list= null;
       try {
           list= profileStore.readProfiles(scope);
       } catch (CoreException e1) {
           JavaPlugin.log(e1);
       }
       if (list == null) {
       	list= getBuiltInProfiles();
       } else {
       	list.addAll(getBuiltInProfiles());
       }

       return list;
   }
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:27,代码来源:CleanUpPreferenceUtil.java


注:本文中的org.eclipse.core.runtime.preferences.IScopeContext类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。