use of org.eclipse.core.resources.ProjectScope in project tdi-studio-se by Talend.
the class AutoConvertTypesUtils method getTypeFile.
public static File getTypeFile() {
try {
IProject project = ResourceUtils.getProject(ProjectManager.getInstance().getCurrentProject());
IPath settingPath = new ProjectScope(project).getLocation();
//$NON-NLS-1$//$NON-NLS-2$;
return new File(settingPath + "\\" + AUTO_CONVERSION_TYPES_RESOURCES + ".xml");
} catch (PersistenceException e) {
e.printStackTrace();
}
return null;
}
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 JavaProjectSetupUtil method setUnixLineEndings.
public static void setUnixLineEndings(IProject project) {
IEclipsePreferences prefs = new ProjectScope(project).getNode(Platform.PI_RUNTIME);
prefs.put(Platform.PREF_LINE_SEPARATOR, "\n");
try {
prefs.flush();
} catch (BackingStoreException e) {
throw new RuntimeException(e);
}
}
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 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;
}
Aggregations