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


Java InstanceScope类代码示例

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


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

示例1: save

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

示例2: getViewDataPreferencesFromPreferenceFile

import org.eclipse.core.runtime.preferences.InstanceScope; //导入依赖的package包/类
/**
 * 
 * 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;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:24,代码来源:DebugDataViewer.java

示例3: logContextualInfo

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

示例4: loadDictionaries

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

示例5: loadThemesFromPreferences

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

示例6: save

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

示例7: SynchronizeLabelDecorator

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

示例8: Note

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

示例9: start

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

示例10: getPlatformHome

import org.eclipse.core.runtime.preferences.InstanceScope; //导入依赖的package包/类
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;
}
 
开发者ID:SAP,项目名称:hybris-commerce-eclipse-plugin,代码行数:20,代码来源:Activator.java

示例11: test

import org.eclipse.core.runtime.preferences.InstanceScope; //导入依赖的package包/类
@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;
}
 
开发者ID:SAP,项目名称:hybris-commerce-eclipse-plugin,代码行数:20,代码来源:PlatformHomePropertyTester.java

示例12: getCurrentState

import org.eclipse.core.runtime.preferences.InstanceScope; //导入依赖的package包/类
@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;
}
 
开发者ID:SAP,项目名称:hybris-commerce-eclipse-plugin,代码行数:26,代码来源:CommandState.java

示例13: start

import org.eclipse.core.runtime.preferences.InstanceScope; //导入依赖的package包/类
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");
}
 
开发者ID:SAP,项目名称:hybris-commerce-eclipse-plugin,代码行数:24,代码来源:Activator.java

示例14: resetPlatform

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

示例15: start

import org.eclipse.core.runtime.preferences.InstanceScope; //导入依赖的package包/类
@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);
		}
	}
}
 
开发者ID:SAP,项目名称:hybris-commerce-eclipse-plugin,代码行数:23,代码来源:Activator.java


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