use of org.eclipse.core.runtime.preferences.IScopeContext in project jbosstools-openshift by jbosstools.
the class ServerUtils method getProjectNode.
public static IEclipsePreferences getProjectNode(String nodeQualifier, IProject project) {
IScopeContext context = new ProjectScope(project);
IEclipsePreferences node = context.getNode(nodeQualifier);
return node;
}
use of org.eclipse.core.runtime.preferences.IScopeContext in project jbosstools-openshift by jbosstools.
the class OpenShiftCorePreferenceInitializer method initializeDefaultPreferences.
@Override
public void initializeDefaultPreferences() {
IEclipsePreferences defaultPreferences = ((IScopeContext) DefaultScope.INSTANCE).getNode(OpenShiftCoreActivator.PLUGIN_ID);
String location = OCBinary.getInstance().getSystemPathLocation();
if (!StringUtils.isEmpty(location)) {
defaultPreferences.put(IOpenShiftCoreConstants.OPENSHIFT_CLI_LOC, location);
}
}
use of org.eclipse.core.runtime.preferences.IScopeContext in project mdw-designer by CenturyLinkCloud.
the class WorkspaceConfigurator method setFormatter.
protected void setFormatter() {
IScopeContext instanceScope = InstanceScope.INSTANCE;
IEclipsePreferences uiPrefs = instanceScope.getNode(JavaUI.ID_PLUGIN);
if (getWorkspaceConfig().getCodeFormatter().equals(WorkspaceConfig.CODE_FORMATTERS[0]))
uiPrefs.put("formatter_profile", "_CenturyLinkIT");
else
uiPrefs.put("formatter_profile", "_MDWCodeFormatter");
try {
uiPrefs.flush();
uiPrefs.sync();
IProfileVersioner profileVersioner = new ProfileVersioner();
ProfileStore profileStore = new FormatterProfileStore(profileVersioner);
List<ProfileManager.Profile> profiles = profileStore.readProfiles(instanceScope);
if (profiles == null)
profiles = profileStore.readProfiles(DefaultScope.INSTANCE);
if (profiles == null)
profiles = new ArrayList<>();
WorkingCopyManager workingCopyManager = new WorkingCopyManager();
PreferencesAccess access = PreferencesAccess.getWorkingCopyPreferences(workingCopyManager);
ProfileManager profileManager = new FormatterProfileManager(profiles, instanceScope, access, profileVersioner);
profileManager.commitChanges(instanceScope);
} catch (Exception ex) {
PluginMessages.uiError(getShell(), ex, "Set Code Formatter");
}
}
use of org.eclipse.core.runtime.preferences.IScopeContext in project webtools.sourceediting by eclipse.
the class HTMLAttributeValidator method getExcludedAttributeNames.
private Set getExcludedAttributeNames(IProject project) {
IScopeContext[] fLookupOrder = new IScopeContext[] { new InstanceScope(), new DefaultScope() };
if (project != null) {
ProjectScope projectScope = new ProjectScope(project);
if (projectScope.getNode(HTMLCorePlugin.getDefault().getBundle().getSymbolicName()).getBoolean(HTMLCorePreferenceNames.USE_PROJECT_SETTINGS, false))
fLookupOrder = new IScopeContext[] { projectScope, new InstanceScope(), new DefaultScope() };
}
Set result = new HashSet();
if (fPreferenceService.getBoolean(HTMLCorePlugin.getDefault().getBundle().getSymbolicName(), HTMLCorePreferenceNames.IGNORE_ATTRIBUTE_NAMES, HTMLCorePreferenceNames.IGNORE_ATTRIBUTE_NAMES_DEFAULT, fLookupOrder)) {
String ignoreList = fPreferenceService.getString(HTMLCorePlugin.getDefault().getBundle().getSymbolicName(), HTMLCorePreferenceNames.ATTRIBUTE_NAMES_TO_IGNORE, HTMLCorePreferenceNames.ATTRIBUTE_NAMES_TO_IGNORE_DEFAULT, fLookupOrder);
if (ignoreList.trim().length() == 0)
return result;
// $NON-NLS-1$
String[] names = ignoreList.split(",");
for (int i = 0; names != null && i < names.length; i++) {
String name = names[i] == null ? null : names[i].trim();
if (name != null && name.length() > 0)
result.add(name.toLowerCase());
}
}
return result;
}
use of org.eclipse.core.runtime.preferences.IScopeContext in project eclipse-integration-commons by spring-projects.
the class SpringCoreUtils method getLineSeparator.
/**
* Returns the line separator found in the given text. If it is null, or not
* found return the line delimiter for the given project. If the project is
* null, returns the line separator for the workspace. If still null, return
* the system line separator.
* @since 2.2.2
*/
public static String getLineSeparator(String text, IProject project) {
String lineSeparator = null;
// line delimiter in given text
if (text != null && text.length() != 0) {
lineSeparator = findLineSeparator(text.toCharArray());
if (lineSeparator != null) {
return lineSeparator;
}
}
// line delimiter in project preference
IScopeContext[] scopeContext;
if (project != null) {
scopeContext = new IScopeContext[] { new ProjectScope(project) };
lineSeparator = Platform.getPreferencesService().getString(Platform.PI_RUNTIME, Platform.PREF_LINE_SEPARATOR, null, scopeContext);
if (lineSeparator != null) {
return lineSeparator;
}
}
// line delimiter in workspace preference
scopeContext = new IScopeContext[] { new InstanceScope() };
lineSeparator = Platform.getPreferencesService().getString(Platform.PI_RUNTIME, Platform.PREF_LINE_SEPARATOR, null, scopeContext);
if (lineSeparator != null) {
return lineSeparator;
}
// system line delimiter
return LINE_SEPARATOR;
}
Aggregations