use of org.eclipse.core.resources.ProjectScope in project webtools.sourceediting by eclipse.
the class ELGeneratorVisitor method getScopeContexts.
private IScopeContext[] getScopeContexts() {
IScopeContext[] scopes = new IScopeContext[] { new InstanceScope(), new DefaultScope() };
final IFile file = getFile();
if (file != null && file.exists()) {
final IProject project = file.getProject();
if (project.exists()) {
final ProjectScope projectScope = new ProjectScope(project);
if (projectScope.getNode(PREFERENCE_NODE_QUALIFIER).getBoolean(JSPCorePreferenceNames.VALIDATION_USE_PROJECT_SETTINGS, false)) {
scopes = new IScopeContext[] { projectScope, new InstanceScope(), new DefaultScope() };
}
}
}
return scopes;
}
use of org.eclipse.core.resources.ProjectScope in project webtools.sourceediting by eclipse.
the class NewJSPWizard method applyLineDelimiter.
private String applyLineDelimiter(IFile file, String text) {
// $NON-NLS-1$
String lineDelimiter = Platform.getPreferencesService().getString(Platform.PI_RUNTIME, Platform.PREF_LINE_SEPARATOR, System.getProperty("line.separator"), new IScopeContext[] { new ProjectScope(file.getProject()), new InstanceScope() });
String convertedText = StringUtils.replace(text, "\r\n", "\n");
convertedText = StringUtils.replace(convertedText, "\r", "\n");
convertedText = StringUtils.replace(convertedText, "\n", lineDelimiter);
return convertedText;
}
use of org.eclipse.core.resources.ProjectScope in project webtools.sourceediting by eclipse.
the class CSSContentProperties method getPreferences.
/**
* Get the preferences node associated with the given project scope and
* preference key (subNode) If create is true, the preference node will be
* created if one does not already exist
*
* @param project
* the project the preference node is under
* @param preferenceKey
* the subnode/category the preference node is located in
* @param create
* if true, a preference node will be created if one does not
* already exist
* @return Preferences associated with the given project scope and
* preference key. null if one could not be found and create is
* false
*/
static Preferences getPreferences(IProject project, String preferenceKey, boolean create) {
if (create)
// create all nodes down to the one we are interested in
return new ProjectScope(project).getNode(CSSCORE_ID).node(preferenceKey);
// be careful looking up for our node so not to create any nodes as
// side effect
Preferences node = Platform.getPreferencesService().getRootNode().node(ProjectScope.SCOPE);
try {
// for now, take the long way
if (!node.nodeExists(project.getName()))
return null;
node = node.node(project.getName());
if (!node.nodeExists(CSSCORE_ID))
return null;
node = node.node(CSSCORE_ID);
if (!node.nodeExists(preferenceKey))
return null;
return node.node(preferenceKey);
} catch (BackingStoreException e) {
// nodeExists failed
// $NON-NLS-1$
Logger.log(Logger.WARNING_DEBUG, "Could not retrieve preference node", e);
}
return null;
}
use of org.eclipse.core.resources.ProjectScope in project webtools.sourceediting by eclipse.
the class TaskScanningJob method isEnabledOnProject.
private boolean isEnabledOnProject(IProject p) {
IPreferencesService preferencesService = Platform.getPreferencesService();
IScopeContext[] lookupOrder = new IScopeContext[] { new ProjectScope(p), new InstanceScope(), new DefaultScope() };
return preferencesService.getBoolean(TaskTagPreferenceKeys.TASK_TAG_NODE, TaskTagPreferenceKeys.TASK_TAG_ENABLE, false, lookupOrder);
}
use of org.eclipse.core.resources.ProjectScope in project webtools.sourceediting by eclipse.
the class JSPFContentProperties method getPreferences.
/**
* Get the preferences node associated with the given project scope and
* preference key (subNode) If create is true, the preference node will be
* created if one does not already exist
*
* @param project
* the project the preference node is under
* @param preferenceKey
* the subnode/category the preference node is located in
* @param create
* if true, a preference node will be created if one does not
* already exist
* @return Preferences associated with the given project scope and
* preference key. null if one could not be found and create is
* false
*/
static Preferences getPreferences(IProject project, String preferenceKey, boolean create) {
if (create)
// create all nodes down to the one we are interested in
return new ProjectScope(project).getNode(JSPCORE_ID).node(preferenceKey);
// be careful looking up for our node so not to create any nodes as
// side effect
Preferences node = Platform.getPreferencesService().getRootNode().node(ProjectScope.SCOPE);
try {
// for now, take the long way
if (!node.nodeExists(project.getName()))
return null;
node = node.node(project.getName());
if (!node.nodeExists(JSPCORE_ID))
return null;
node = node.node(JSPCORE_ID);
if (!node.nodeExists(preferenceKey))
return null;
return node.node(preferenceKey);
} catch (BackingStoreException e) {
// nodeExists failed
// $NON-NLS-1$
Logger.log(Logger.WARNING_DEBUG, "Could not retrieve preference node", e);
}
return null;
}
Aggregations