private ProjectScopeEclipsePreferencesPreferenceStore(IProject project, String node) { this.project = project; this.node = node; this.preferences = new ProjectScope(project).getNode(node); }
/** * Returns the preference settings scoped to the given project if available * @param project project to get preferences for * @return preferences for the project or <code>null</code> */ private Preferences getPreferences(IProject project) { return new ProjectScope(project).getNode(PDECore.PLUGIN_ID); }
private Preferences getPreferences(IProject project) { return new ProjectScope(project).getNode(PDECore.PLUGIN_ID); }
private static List getFoldersToExclude(IProject project, boolean checkExcluded) { ArrayList list = new ArrayList(); if (checkExcluded) { IEclipsePreferences pref = new ProjectScope(project).getNode(PDECore.PLUGIN_ID); if (pref != null) { String binExcludes = pref.get(ICoreConstants.SELFHOSTING_BIN_EXCLUDES, ""); //$NON-NLS-1$ StringTokenizer tokenizer = new StringTokenizer(binExcludes, ","); //$NON-NLS-1$ while (tokenizer.hasMoreTokens()) { list.add(new Path(tokenizer.nextToken().trim())); } } } return list; }
private static List<Path> getFoldersToExclude(IProject project, boolean checkExcluded) { ArrayList<Path> list = new ArrayList<>(); if (checkExcluded) { IEclipsePreferences pref = new ProjectScope(project).getNode(PDECore.PLUGIN_ID); if (pref != null) { String binExcludes = pref.get(ICoreConstants.SELFHOSTING_BIN_EXCLUDES, ""); //$NON-NLS-1$ StringTokenizer tokenizer = new StringTokenizer(binExcludes, ","); //$NON-NLS-1$ while (tokenizer.hasMoreTokens()) { list.add(new Path(tokenizer.nextToken().trim())); } } } return list; }
ProjectScope ps = new ProjectScope(projectResource); IEclipsePreferences prefs = ps.getNode("my.plugin.id"); prefs.put("key", "value"); prefs.flush();
/** * Returns the export wizard configured for this project or <code>null</code> * if default. * * @param project project * @return export wizard identifier or <code>null</code> */ public static String getExportWizard(IProject project) { ProjectScope scope = new ProjectScope(project); IEclipsePreferences node = scope.getNode(PDECore.PLUGIN_ID); if (node != null) { return node.get(ICoreConstants.MANIFEST_EXPORT_WIZARD, (String) null); } return null; }
/** * Returns the launch shortcuts configured for this project * or <code>null</code> if default launchers should be used. * * @param project project * @return configured launch shortcuts or <code>null</code> */ public static String[] getLaunchShortcuts(IProject project) { ProjectScope scope = new ProjectScope(project); IEclipsePreferences node = scope.getNode(PDECore.PLUGIN_ID); if (node != null) { String list = node.get(ICoreConstants.MANIFEST_LAUNCH_SHORTCUTS, (String) null); if (list != null) { return list.split(","); //$NON-NLS-1$ } } return null; }
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); } }
@Override public boolean hasSpecificProjectSettings(IProject project) { if(project != null) { Preferences[] prefs = new Preferences[] {new ProjectScope(project).getNode(MavenJdtAptPlugin.PLUGIN_ID)}; IPreferencesService service = Platform.getPreferencesService(); for(String optionName : PreferencesConstants.DEFAULT_OPTIONS.keySet()) { if(service.get(optionName, null, prefs) != null) { return true; } } } return false; }
public static boolean hasProjectSpecificTempates(IProject project) { String pref= new ProjectScope(project).getNode(JavaUI.ID_PLUGIN).get(KEY, null); if (pref != null && pref.trim().length() > 0) { Reader input= new StringReader(pref); TemplateReaderWriter reader= new TemplateReaderWriter(); TemplatePersistenceData[] datas; try { datas= reader.read(input); return datas.length > 0; } catch (IOException e) { // ignore } } return false; }
public static boolean hasProjectSpecificTempates(IProject project) { String pref= new ProjectScope(project).getNode(JavaUI.ID_PLUGIN).get(KEY, null); if (pref != null && pref.trim().length() > 0) { Reader input= new StringReader(pref); TemplateReaderWriter reader= new TemplateReaderWriter(); TemplatePersistenceData[] datas; try { datas= reader.read(input); return datas.length > 0; } catch (IOException e) { // ignore } } return false; }
public static boolean hasProjectSpecificTempates(IProject project) { String pref= new ProjectScope(project).getNode(JavaManipulation.getPreferenceNodeId()).get(KEY, null); if (pref != null && pref.trim().length() > 0) { Reader input= new StringReader(pref); TemplateReaderWriter reader= new TemplateReaderWriter(); TemplatePersistenceData[] datas; try { datas= reader.read(input); return datas.length > 0; } catch (IOException e) { // ignore } } return false; }
@Override public void clearSpecificSettings(IProject project) { if(project != null) { try { IEclipsePreferences prefs = new ProjectScope(project).getNode(MavenJdtAptPlugin.PLUGIN_ID); prefs.clear(); prefs.flush(); } catch(BackingStoreException ex) { log.error("Error saving " + project.getName() + "preferences", ex); } } }
/** * Clears preference from Project scope * * @param project * @param flagId */ public static void clear(IProject project, String flagId) { if (project == null) return; Preferences preferences = new ProjectScope(project) .getNode(PDE.PLUGIN_ID); preferences.remove(flagId); try { preferences.flush(); } catch (BackingStoreException bse) { } }
/** * Returns if the given project has project-specific settings. * * @param project * @return true if the project has specific settings, false otherwise * @since 1.1 */ boolean hasProjectSettings(IProject project) { if (project != null) { ProjectScope scope = new ProjectScope(project); IEclipsePreferences node = scope.getNode(PLUGIN_ID); try { return node != null && node.keys().length > 0; } catch (BackingStoreException bse) { log(bse); } } return false; }
/** * Sets preference on PROJECT scope * * @param project * @param flagId * @param value */ public static void setString(IProject project, String flagId, String value) { if (project == null) return; Preferences preferences = new ProjectScope(project) .getNode(PDE.PLUGIN_ID); preferences.put(flagId, value); try { preferences.flush(); } catch (BackingStoreException bse) { } }
public static Map<String, String> getProjectSettings(IJavaProject javaProject) { Map<String, String> options= new HashMap<>(javaProject.getOptions(true)); ProfileVersioner versioner= new ProfileVersioner(); IEclipsePreferences prefs= new ProjectScope(javaProject.getProject()).getNode(JavaUI.ID_PLUGIN); if (prefs == null) return options; int profileVersion= prefs.getInt(FORMATTER_SETTINGS_VERSION, versioner.getCurrentVersion()); if (profileVersion == versioner.getCurrentVersion()) return options; CustomProfile profile= new CustomProfile(null, options, profileVersion, null); versioner.update(profile); return profile.getSettings(); }
private String getString(IProject project, String optionName) { if(project == null) { return getString(getWorkspaceContexts(), optionName); } //Read Eclipse project pref String value = new ProjectScope(project).getNode(MavenJdtAptPlugin.PLUGIN_ID).get(optionName, null); if(value == null) { //Read Maven property value = getStringFromMavenProps(project, optionName); } if(value == null) { //Read Eclipse Workspace pref value = getString(getWorkspaceContexts(), optionName); } return value; }
protected void enableApt(String lineDelimiter, IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException { getJaxWsProject().setOption("org.eclipse.jdt.core.compiler.processAnnotations", "enabled"); IEclipsePreferences aptUiPluginPreferenceNode = new ProjectScope(getJaxWsProject().getProject()).getNode("org.eclipse.jdt.apt.core"); aptUiPluginPreferenceNode.putBoolean("org.eclipse.jdt.apt.aptEnabled", true); aptUiPluginPreferenceNode.put("org.eclipse.jdt.apt.genSrcDir", "target/generated-sources/annotations"); aptUiPluginPreferenceNode.putBoolean("org.eclipse.jdt.apt.reconcileEnabled", true); try { aptUiPluginPreferenceNode.flush(); } catch (BackingStoreException e) { SdkLog.info("Unable to save the APT preferences of project '{}'.", getJaxWsProject().getElementName(), e); } createFactoryPath(lineDelimiter, monitor, workingCopyManager); }