use of org.eclipse.core.resources.ProjectScope in project xtext-eclipse by eclipse.
the class XtextProjectConfigurator method configureLanguages.
private void configureLanguages(ProjectConfigurationRequest request, IProgressMonitor monitor) throws CoreException {
List<MojoExecution> executions = getMojoExecutions(request, monitor);
SubMonitor progress = SubMonitor.convert(monitor, executions.size());
for (MojoExecution execution : executions) {
Languages languages = maven.getMojoParameterValue(request.getMavenProject(), execution, "languages", Languages.class, progress.split(1));
if (languages != null) {
ProjectScope projectPreferences = new ProjectScope(request.getProject());
for (Language language : languages) {
configureLanguage(projectPreferences, language, request);
}
}
}
}
use of org.eclipse.core.resources.ProjectScope in project xtext-eclipse by eclipse.
the class PreferenceStoreWhitespaceInformationProvider method getLineSeparatorPreference.
protected String getLineSeparatorPreference(URI uri) {
if (uri.isPlatformResource()) {
IFile file = workspace.getRoot().getFile(new Path(uri.toPlatformString(true)));
String delimiter = senseLineDelimiter(file);
if (delimiter != null)
return delimiter;
}
IProject project = null;
if (uri.isPlatformResource()) {
project = workspace.getRoot().getProject(uri.segment(1));
} else {
for (Pair<IStorage, IProject> storage : storage2UriMapper.getStorages(uri)) {
project = storage.getSecond();
break;
}
}
if (project != null) {
String result = getLineSeparatorPreference(new ProjectScope(project));
if (result != null)
return result;
}
@SuppressWarnings("all") String result = getLineSeparatorPreference(new InstanceScope());
if (result != null)
return result;
return System.getProperty("line.separator");
}
use of org.eclipse.core.resources.ProjectScope in project xtext-eclipse by eclipse.
the class PreferenceStoreAccessImpl method getWritablePreferenceStore.
@Override
@SuppressWarnings("deprecation")
public IPreferenceStore getWritablePreferenceStore(Object context) {
lazyInitialize();
IProject project = getProject(context);
if (project == null) {
return getWritablePreferenceStore();
}
ProjectScope projectScope = new ProjectScope(project);
FixedScopedPreferenceStore result = new FixedScopedPreferenceStore(projectScope, getQualifier());
result.setSearchContexts(new IScopeContext[] { projectScope, new InstanceScope(), new ConfigurationScope() });
return result;
}
use of org.eclipse.core.resources.ProjectScope in project xtext-eclipse by eclipse.
the class AbstractPreferencePage method handleUseProjectSettings.
/**
* Switches the search scope of the preference store to use [Project, Instance, Configuration] if values are project
* specific, and [Instance, Configuration] otherwise. This implementation requires that the given preference store
* is based on the Project preference store when the page is used as a Properties page. (This is done in
* {@link #doGetPreferenceStore()}).
*/
@SuppressWarnings("deprecation")
private void handleUseProjectSettings() {
// Note: uses the pre Eclipse 3.6 way of specifying search scopes (deprecated since 3.6)
boolean isUseProjectSettings = useProjectSettingsButton.getSelection();
link.setEnabled(!isUseProjectSettings);
if (!isUseProjectSettings) {
((FixedScopedPreferenceStore) getPreferenceStore()).setSearchContexts(new IScopeContext[] { new InstanceScope(), new ConfigurationScope() });
} else {
((FixedScopedPreferenceStore) getPreferenceStore()).setSearchContexts(new IScopeContext[] { new ProjectScope(currentProject()), new InstanceScope(), new ConfigurationScope() });
setProjectSpecificValues();
}
updateFieldEditors(isUseProjectSettings);
}
use of org.eclipse.core.resources.ProjectScope in project statecharts by Yakindu.
the class DefaultResourceBlacklist method save.
public boolean save(IProject project, List<IResource> items) {
ProjectScope projectScope = getPreferenceScope(project);
IEclipsePreferences node = projectScope.getNode(SCT_RESOURCE_NODE);
String blacklist = getBlacklistValue(items);
node.put(SCT_BLACKLIST_KEY, blacklist);
try {
node.flush();
} catch (BackingStoreException e) {
e.printStackTrace();
return false;
}
return true;
}
Aggregations