本文整理汇总了Java中org.eclipse.core.runtime.preferences.IScopeContext.getNode方法的典型用法代码示例。如果您正苦于以下问题:Java IScopeContext.getNode方法的具体用法?Java IScopeContext.getNode怎么用?Java IScopeContext.getNode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.core.runtime.preferences.IScopeContext
的用法示例。
在下文中一共展示了IScopeContext.getNode方法的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;
}
示例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();
}
示例3: 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;
}
示例4: 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);
}
示例5: writeToPreferenceStore
import org.eclipse.core.runtime.preferences.IScopeContext; //导入方法依赖的package包/类
/**
* 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());
}
}
示例6: 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);
}
}
示例7: getEclipsePreferences
import org.eclipse.core.runtime.preferences.IScopeContext; //导入方法依赖的package包/类
/**
* Returns the eclipse preferences.
* @return the eclipse preferences
*/
public IEclipsePreferences getEclipsePreferences() {
if (eclipsePreferences==null) {
IScopeContext iScopeContext = ConfigurationScope.INSTANCE;
eclipsePreferences = iScopeContext.getNode(PlugInActivator.PLUGIN_ID);
eclipsePreferences.addPreferenceChangeListener(this.getChangeListener());
}
return eclipsePreferences;
}
示例8: testRemove
import org.eclipse.core.runtime.preferences.IScopeContext; //导入方法依赖的package包/类
@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);
}
示例9: addNodeListeners
import org.eclipse.core.runtime.preferences.IScopeContext; //导入方法依赖的package包/类
protected void addNodeListeners() {
for (IScopeContext scopeContext : SCOPE_CONTEXTS) {
try {
IEclipsePreferences node = scopeContext.getNode("");
node.accept((curNode) -> {
curNode.addPreferenceChangeListener(changeListener);
return true;
});
node.addNodeChangeListener(nodeListener);
} catch (BackingStoreException e) {
PrefEditorPlugin.log(e);
}
}
}
示例10: removeNodeListeners
import org.eclipse.core.runtime.preferences.IScopeContext; //导入方法依赖的package包/类
protected void removeNodeListeners() {
for (IScopeContext scopeContext : SCOPE_CONTEXTS) {
try {
IEclipsePreferences node = scopeContext.getNode("");
node.removeNodeChangeListener(nodeListener);
node.accept((curNode) -> {
curNode.removePreferenceChangeListener(changeListener);
return true;
});
} catch (BackingStoreException e) {
PrefEditorPlugin.log(e);
}
}
}
示例11: loadPrefs
import org.eclipse.core.runtime.preferences.IScopeContext; //导入方法依赖的package包/类
protected void loadPrefs() {
try {
for (IScopeContext scopeContext : SCOPE_CONTEXTS) {
IEclipsePreferences node = scopeContext.getNode("");
node.accept((curNode) -> {
loadPrefsFromNode(curNode);
return true;
});
}
} catch (BackingStoreException e) {
PrefEditorPlugin.log(e);
}
}
示例12: getNode
import org.eclipse.core.runtime.preferences.IScopeContext; //导入方法依赖的package包/类
protected IEclipsePreferences getNode(String categoryName) {
for (IScopeContext scopeContext : SCOPE_CONTEXTS) {
String preffix = "/" + scopeContext.getName() + "/";
if (categoryName.startsWith(preffix)) {
IEclipsePreferences node = scopeContext.getNode(categoryName.substring(preffix.length()));
return node;
}
}
return null;
}
示例13: readExportDataDefaultPathFromFile
import org.eclipse.core.runtime.preferences.IScopeContext; //导入方法依赖的package包/类
private String readExportDataDefaultPathFromFile() {
IScopeContext context = InstanceScope.INSTANCE;
IEclipsePreferences eclipsePreferences = context.getNode(Activator.PLUGIN_ID);
String exportDataDefaultpath = eclipsePreferences.get(EXPORT_DATA_DEFAULT_PATH, DEFAULT);
exportDataDefaultpath = exportDataDefaultpath.equalsIgnoreCase(DEFAULT) ? " " : exportDataDefaultpath;
return exportDataDefaultpath;
}
示例14: createPreferences
import org.eclipse.core.runtime.preferences.IScopeContext; //导入方法依赖的package包/类
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();
}
}
示例15: updateColorPreferences
import org.eclipse.core.runtime.preferences.IScopeContext; //导入方法依赖的package包/类
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();
}
}