use of org.eclipse.core.resources.ProjectScope in project che by eclipse.
the class ImportOrganizeTest method setOrganizeImportSettings.
protected void setOrganizeImportSettings(String[] order, int threshold, int staticThreshold, IJavaProject project) {
IEclipsePreferences scope = new ProjectScope(project.getProject()).getNode("org.eclipse.jdt.ui");
if (order == null) {
scope.remove(PreferenceConstants.ORGIMPORTS_IMPORTORDER);
scope.remove(PreferenceConstants.ORGIMPORTS_ONDEMANDTHRESHOLD);
} else {
StringBuffer buf = new StringBuffer();
for (int i = 0; i < order.length; i++) {
buf.append(order[i]);
buf.append(';');
}
scope.put(PreferenceConstants.ORGIMPORTS_IMPORTORDER, buf.toString());
scope.put(PreferenceConstants.ORGIMPORTS_ONDEMANDTHRESHOLD, String.valueOf(threshold));
scope.put(PreferenceConstants.ORGIMPORTS_STATIC_ONDEMANDTHRESHOLD, String.valueOf(staticThreshold));
}
}
use of org.eclipse.core.resources.ProjectScope in project che by eclipse.
the class JavaProject method getEclipsePreferences.
/**
* Returns the project custom preference pool.
* Project preferences may include custom encoding.
* @return IEclipsePreferences or <code>null</code> if the project
* does not have a java nature.
*/
public IEclipsePreferences getEclipsePreferences() {
if (!org.eclipse.jdt.internal.core.JavaProject.hasJavaNature(this.project))
return null;
// Get cached preferences if exist
PerProjectInfo perProjectInfo = getJavaModelManager().getPerProjectInfo(this.project, true);
if (perProjectInfo.preferences != null)
return perProjectInfo.preferences;
// Init project preferences
IScopeContext context = new ProjectScope(getProject());
final IEclipsePreferences eclipsePreferences = context.getNode(JavaCore.PLUGIN_ID);
// updatePreferences(eclipsePreferences);
perProjectInfo.preferences = eclipsePreferences;
// eclipsePreferences.addPreferenceChangeListener(this.preferencesChangeListener);
return eclipsePreferences;
}
use of org.eclipse.core.resources.ProjectScope in project che by eclipse.
the class StubUtility method getLineDelimiterPreference.
public static String getLineDelimiterPreference(IProject project) {
IScopeContext[] scopeContext;
if (project != null) {
// project preference
scopeContext = new IScopeContext[] { new ProjectScope(project) };
String lineDelimiter = Platform.getPreferencesService().getString(Platform.PI_RUNTIME, Platform.PREF_LINE_SEPARATOR, null, scopeContext);
if (lineDelimiter != null)
return lineDelimiter;
}
// workspace preference
scopeContext = new IScopeContext[] { InstanceScope.INSTANCE };
//$NON-NLS-1$ //$NON-NLS-2$
String platformDefault = System.getProperty("line.separator", "\n");
return Platform.getPreferencesService().getString(Platform.PI_RUNTIME, Platform.PREF_LINE_SEPARATOR, platformDefault, scopeContext);
}
use of org.eclipse.core.resources.ProjectScope in project tdi-studio-se by Talend.
the class ChangeMappingFileMigrationTask method execute.
@Override
public ExecutionResult execute(Project project) {
try {
URL s = MetadataTalendType.getSystemForderURLOfMappingsFile();
changeSAPHanaMappingFile(s);
//$NON-NLS-1$
String dirPath = "/" + MetadataTalendType.INTERNAL_MAPPINGS_FOLDER;
IProject _project = ResourceUtils.getProject(project);
File projectMappingFolder = new ProjectScope(_project).getLocation().append(dirPath).toFile();
if (projectMappingFolder.exists()) {
URL p = MetadataTalendType.getProjectForderURLOfMappingsFile();
changeSAPHanaMappingFile(p);
if (GlobalServiceRegister.getDefault().isServiceRegistered(ICoreService.class)) {
ICoreService service = (ICoreService) GlobalServiceRegister.getDefault().getService(ICoreService.class);
service.synchronizeMapptingXML();
}
}
return ExecutionResult.SUCCESS_NO_ALERT;
} catch (Exception e) {
ExceptionHandler.process(e);
return ExecutionResult.FAILURE;
}
}
use of org.eclipse.core.resources.ProjectScope in project tdi-studio-se by Talend.
the class Log4jPrefsSettingManager method getLog4jPreferences.
public Preferences getLog4jPreferences(String log4jPrefsNode, boolean create) {
try {
IProject project = ResourceUtils.getProject(ProjectManager.getInstance().getCurrentProject());
if (create) {
return new ProjectScope(project).getNode(Log4jPrefsConstants.LOG4J_RESOURCES).node(log4jPrefsNode);
}
Preferences node = Platform.getPreferencesService().getRootNode().node(ProjectScope.SCOPE);
if (!node.nodeExists(project.getName())) {
return null;
}
node = node.node(project.getName());
if (!node.nodeExists(Log4jPrefsConstants.LOG4J_RESOURCES)) {
return null;
}
node = node.node(Log4jPrefsConstants.LOG4J_RESOURCES);
if (!node.nodeExists(log4jPrefsNode)) {
return null;
}
return node.node(log4jPrefsNode);
} catch (BackingStoreException e) {
ExceptionHandler.process(e);
} catch (PersistenceException e) {
ExceptionHandler.process(e);
}
return null;
}
Aggregations