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;
}
use of org.eclipse.core.resources.ProjectScope in project sling by apache.
the class ProjectUtil method setPathPersistentProperty.
private static void setPathPersistentProperty(IProject project, IPath path, String propertyName) {
IScopeContext projectScope = new ProjectScope(project);
IEclipsePreferences projectNode = projectScope.getNode(Activator.PLUGIN_ID);
if (projectNode != null) {
projectNode.put(propertyName, path.toPortableString());
try {
projectNode.flush();
} catch (BackingStoreException e) {
Activator.getDefault().getPluginLogger().error(e.getMessage(), e);
}
}
}
use of org.eclipse.core.resources.ProjectScope in project eclipse.platform.text by eclipse.
the class FileDocumentProvider method getLineDelimiterPreference.
/**
* Returns the default line delimiter preference for the given file.
*
* @param file the file
* @return the default line delimiter
* @since 3.1
*/
private String getLineDelimiterPreference(IFile file) {
IScopeContext[] scopeContext;
if (file != null && file.getProject() != null) {
// project preference
scopeContext = new IScopeContext[] { new ProjectScope(file.getProject()) };
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 };
return Platform.getPreferencesService().getString(Platform.PI_RUNTIME, Platform.PREF_LINE_SEPARATOR, null, scopeContext);
}
use of org.eclipse.core.resources.ProjectScope in project linuxtools by eclipse.
the class GprofLaunchTest method setUp.
@Before
public void setUp() throws Exception {
// $NON-NLS-1$
proj = createProjectAndBuild(FrameworkUtil.getBundle(this.getClass()), "fibTest");
ProjectScope ps = new ProjectScope(proj.getProject());
ScopedPreferenceStore scoped = new ScopedPreferenceStore(ps, ProviderProfileConstants.PLUGIN_ID);
scoped.setSearchContexts(new IScopeContext[] { ps, InstanceScope.INSTANCE });
scoped.setValue(ProviderProfileConstants.PREFS_KEY + GPROF_CATEGORY, GPROF_PROVIDER_ID);
scoped.setValue(ProviderProfileConstants.USE_PROJECT_SETTINGS + GPROF_CATEGORY, true);
scoped.save();
IExtensionPoint extPoint = Platform.getExtensionRegistry().getExtensionPoint(LAUNCH_SHORT_EXTPT);
IConfigurationElement[] configs = extPoint.getConfigurationElements();
for (IConfigurationElement cfg : configs) {
if (cfg.getAttribute("id").equals(ID)) {
// $NON-NLS-1$
try {
// $NON-NLS-1$
shortcut = (ProviderLaunchShortcut) cfg.createExecutableExtension("class");
// $NON-NLS-1$
launchConfigTypeId = cfg.getChildren("class")[0].getChildren("parameter")[1].getAttribute("value");
} catch (Exception e) {
fail(e.getMessage());
}
}
}
config = createConfiguration(proj.getProject());
// (otherwise test hangs on 'enable GGprof support' dialogue. )
enableGprofSupport();
// ---- Continue with launch.
launch = new Launch(config, ILaunchManager.PROFILE_MODE, null);
wc = config.getWorkingCopy();
}
Aggregations