/* (non-Javadoc) * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object) */ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { if (this.viewer == null) { MakeCorePlugin.getDefault().getTargetManager().addListener(this); } this.viewer = (StructuredViewer) viewer; IWorkspace oldWorkspace = null; IWorkspace newWorkspace = null; if (oldInput instanceof IWorkspace) { oldWorkspace = (IWorkspace) oldInput; } else if (oldInput instanceof IContainer) { oldWorkspace = ((IContainer) oldInput).getWorkspace(); } else if (oldInput instanceof TargetSourceContainer) { oldWorkspace = ((TargetSourceContainer) oldInput).getContainer().getWorkspace(); } if (newInput instanceof IWorkspace) { newWorkspace = (IWorkspace) newInput; } else if (newInput instanceof IContainer) { newWorkspace = ((IContainer) newInput).getWorkspace(); } else if (newInput instanceof TargetSourceContainer) { newWorkspace = ((TargetSourceContainer) newInput).getContainer().getWorkspace(); } if (oldWorkspace != newWorkspace) { ICProjectDescriptionManager mngr = CoreModel.getDefault().getProjectDescriptionManager(); if (oldWorkspace != null) { InstanceScope.INSTANCE.getNode(CCorePlugin.PLUGIN_ID).removePreferenceChangeListener(this); mngr.removeCProjectDescriptionListener(this); oldWorkspace.removeResourceChangeListener(this); } if (newWorkspace != null) { newWorkspace.addResourceChangeListener(this, IResourceChangeEvent.POST_CHANGE); mngr.addCProjectDescriptionListener(this, CProjectDescriptionEvent.APPLIED); InstanceScope.INSTANCE.getNode(CCorePlugin.PLUGIN_ID).addPreferenceChangeListener(this); } } }
private void PreProcessing(String projectName) { IEclipsePreferences prefs = InstanceScope.INSTANCE.getNode(Constants.BUNDLE_NAME); String fileName = prefs.get("LTiEFileName", null); java.io.File f = new java.io.File(fileName + projectName + ".MTD"); if (!f.exists()) { String id = "default"; String UNCTime; Calendar calendar = Calendar.getInstance(); if (fileName != null) { int index = fileName.indexOf('_'); int index2 = fileName.indexOf('_', index + 1); UNCTime = fileName.substring(index2 + 1, fileName.length() - 1); id = fileName.substring(index + 1, index2); calendar.setTimeInMillis(Long.parseLong(UNCTime)); } try { PrintStream p = new PrintStream(f); p.print(CreateStartOfSessionString(calendar, id, projectName)); p.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } } }
public static void savePluginSettings( boolean disableCloning, boolean genAsStrings, boolean genConc, boolean genJml, String userSpecifiedClassesToSkip, String javaPackage) { Preferences prefs = InstanceScope.INSTANCE.getNode(ICodeGenConstants.PLUGIN_ID); prefs.put(ICodeGenConstants.DISABLE_CLONING, new Boolean(disableCloning).toString()); prefs.put( ICodeGenConstants.GENERATE_CHAR_SEQUENCES_AS_STRINGS, new Boolean(genAsStrings).toString()); prefs.put(ICodeGenConstants.GENERATE_CONCURRENCY_MECHANISMS, new Boolean(genConc).toString()); if (userSpecifiedClassesToSkip != null) { prefs.put(ICodeGenConstants.CLASSES_TO_SKIP, userSpecifiedClassesToSkip); } if (javaPackage != null) { prefs.put(ICodeGenConstants.JAVA_PACKAGE, javaPackage); } prefs.put(ICodeGenConstants.GENERATE_JML, new Boolean(genJml).toString()); try { prefs.flush(); } catch (BackingStoreException e) { e.printStackTrace(); } }
/** Update the settings for the global window cache of the workspace. */ public static void reconfigureWindowCache() { final WindowCacheConfig c = new WindowCacheConfig(); IEclipsePreferences d = DefaultScope.INSTANCE.getNode(Activator.getPluginId()); IEclipsePreferences p = InstanceScope.INSTANCE.getNode(Activator.getPluginId()); c.setPackedGitLimit( p.getInt( GitCorePreferences.core_packedGitLimit, d.getInt(GitCorePreferences.core_packedGitLimit, 0))); c.setPackedGitWindowSize( p.getInt( GitCorePreferences.core_packedGitWindowSize, d.getInt(GitCorePreferences.core_packedGitWindowSize, 0))); c.setPackedGitMMAP( p.getBoolean( GitCorePreferences.core_packedGitMMAP, d.getBoolean(GitCorePreferences.core_packedGitMMAP, false))); c.setDeltaBaseCacheLimit( p.getInt( GitCorePreferences.core_deltaBaseCacheLimit, d.getInt(GitCorePreferences.core_deltaBaseCacheLimit, 0))); c.setStreamFileThreshold( p.getInt( GitCorePreferences.core_streamFileThreshold, d.getInt(GitCorePreferences.core_streamFileThreshold, 0))); c.install(); }
/** * Check if model version is changed and rebuild PHP projects if necessary. * * @see PHPCoreConstants.STRUCTURE_VERSION */ private void rebuildProjects() { IEclipsePreferences preferences = InstanceScope.INSTANCE.getNode(ID); String modelVersion = preferences.get(PHPCoreConstants.STRUCTURE_VERSION_PREFERENCE, null); if (PHPCoreConstants.STRUCTURE_VERSION.equals(modelVersion)) { return; } preferences.put( PHPCoreConstants.STRUCTURE_VERSION_PREFERENCE, PHPCoreConstants.STRUCTURE_VERSION); try { preferences.flush(); } catch (BackingStoreException e1) { Logger.logException(e1); } IWorkspace workspace = ResourcesPlugin.getWorkspace(); IProject[] projects = workspace.getRoot().getProjects(); if (workspace.isAutoBuilding()) { try { for (IProject project : projects) { if (PHPToolkitUtil.isPhpProject(project)) { project.build(IncrementalProjectBuilder.CLEAN_BUILD, null); } } } catch (CoreException e) { Logger.logException(e); } } }
public static void flushInstanceScope() { try { InstanceScope.INSTANCE.getNode(PLUGIN_ID).flush(); } catch (BackingStoreException e) { logError("Error saving instance preferences: ", e); } }
private void launchDialog( final IServer server, AS7DeploymentScannerUtility.Scanner[] scanners) { ModifyDeploymentScannerIntervalDialog d = new ModifyDeploymentScannerIntervalDialog( server, scanners, Display.getDefault().getActiveShell()); int ret = d.open(); final AS7DeploymentScannerUtility.Scanner[] changedArray = d.getChangedScanners(); boolean neverAskAgainSetting = d.getAskAgainSelection(); if (neverAskAgainSetting) { IEclipsePreferences prefs = InstanceScope.INSTANCE.getNode(JBossServerUIPlugin.PLUGIN_ID); prefs.putBoolean(AS7_IGNORE_ZERO_INTERVAL_SCANNER_SETTING, true); try { prefs.flush(); } catch (BackingStoreException e) { } } if (ret == Window.OK && changedArray.length > 0) { new Job(Messages.DeploymentScannerUpdateJobTitle) { protected IStatus run(IProgressMonitor monitor) { return updateServersScanners(server, changedArray); } }.schedule(); } }
public void storeMappings(WorkspaceLanguageConfiguration config) throws CoreException { try { // Encode mappings as XML and serialize as a String. Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); Element rootElement = doc.createElement(WORKSPACE_MAPPINGS); doc.appendChild(rootElement); addContentTypeMappings(config.getWorkspaceMappings(), rootElement); Transformer serializer = createSerializer(); DOMSource source = new DOMSource(doc); StringWriter buffer = new StringWriter(); StreamResult result = new StreamResult(buffer); serializer.transform(source, result); String encodedMappings = buffer.getBuffer().toString(); IEclipsePreferences node = InstanceScope.INSTANCE.getNode(CCorePlugin.PLUGIN_ID); node.put(CCorePreferenceConstants.WORKSPACE_LANGUAGE_MAPPINGS, encodedMappings); node.flush(); } catch (ParserConfigurationException e) { throw new CoreException(Util.createStatus(e)); } catch (TransformerException e) { throw new CoreException(Util.createStatus(e)); } catch (BackingStoreException e) { throw new CoreException(Util.createStatus(e)); } }
@Override protected void setUp() throws Exception { super.setUp(); domain = TransactionalEditingDomain.Factory.INSTANCE.createEditingDomain(); refreshEditorsPrecommitListener = new RefreshEditorsPrecommitListener(domain); resourceSet = domain.getResourceSet(); sessionResourceURI = URI.createPlatformPluginURI(SiriusTestsPlugin.PLUGIN_ID + PATH + "vp1753.aird", true); semanticResourceURI = URI.createPlatformPluginURI(SiriusTestsPlugin.PLUGIN_ID + PATH + "vp1753.ecore", true); sessionResource = resourceSet.getResource(sessionResourceURI, true); final DRepresentation firstDRepresentation = getFirstElement(sessionResource, DRepresentation.class); refreshFilterStub = new RefreshFilterStub(firstDRepresentation); RefreshFilterManager.INSTANCE.addRefreshFilter(refreshFilterStub); oldRefreshAutoMode = Platform.getPreferencesService() .getBoolean( SiriusPlugin.ID, SiriusPreferencesKeys.PREF_AUTO_REFRESH.name(), false, null); InstanceScope.INSTANCE .getNode(SiriusPlugin.ID) .putBoolean(SiriusPreferencesKeys.PREF_AUTO_REFRESH.name(), true); }
private void storeViewPaneVisibility() { fVisibleViewPanes.clear(); StringBuffer visibleViewPanes = new StringBuffer(); Enumeration<String> enumeration = fViewPaneControls.keys(); while (enumeration.hasMoreElements()) { String paneId = enumeration.nextElement(); Control control = fViewPaneControls.get(paneId); if (control.isVisible()) { visibleViewPanes.append(paneId); visibleViewPanes.append(","); // $NON-NLS-1$ fVisibleViewPanes.add(paneId); } } IEclipsePreferences node = InstanceScope.INSTANCE.getNode(DebugUIPlugin.getUniqueIdentifier()); if (node != null) { try { node.put(getVisibilityPrefId(), visibleViewPanes.toString()); node.flush(); } catch (BackingStoreException e) { DebugUIPlugin.log(e); } } }
public WorkspaceLanguageConfiguration decodeWorkspaceMappings() throws CoreException { IEclipsePreferences node = InstanceScope.INSTANCE.getNode(CCorePlugin.PLUGIN_ID); IEclipsePreferences defaultNode = DefaultScope.INSTANCE.getNode(CCorePlugin.PLUGIN_ID); String encodedMappings = node.get(CCorePreferenceConstants.WORKSPACE_LANGUAGE_MAPPINGS, null); if (encodedMappings == null) { encodedMappings = defaultNode.get(CCorePreferenceConstants.WORKSPACE_LANGUAGE_MAPPINGS, null); } WorkspaceLanguageConfiguration config = new WorkspaceLanguageConfiguration(); if (encodedMappings == null || encodedMappings.length() == 0) { return config; } // The mappings are encoded as XML in a String so we need to parse it. InputSource input = new InputSource(new StringReader(encodedMappings)); try { Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(input); config.setWorkspaceMappings(decodeContentTypeMappings(document.getDocumentElement())); return config; } catch (SAXException e) { throw new CoreException(Util.createStatus(e)); } catch (IOException e) { throw new CoreException(Util.createStatus(e)); } catch (ParserConfigurationException e) { throw new CoreException(Util.createStatus(e)); } }
@Override public boolean performOk() { // Preferences preferences = Activator.getDefault().getPluginPreferences(); // InstanceScope is = new InstanceScope(); final IEclipsePreferences preferences = InstanceScope.INSTANCE.getNode(Activator.PLUGIN_ID); if (toolGroups != null) { for (final BinDirPanel toolGroup : toolGroups) { preferences.put( IToolLaunchConfigurationConstants.TOOL_BIN_ID + "." + toolGroup.group, toolGroup.binDir.getText()); // $NON-NLS-1$ } } try { preferences.flush(); } catch (final BackingStoreException e) { // TODO Auto-generated catch block e.printStackTrace(); } // Activator.getDefault().savePluginPreferences(); return true; }
/** * Flush unsaved preferences and perform any other config-related shutdown. This is called once, * from AptPlugin.shutdown(). */ public static void dispose() { try { InstanceScope.INSTANCE.getNode(AptPlugin.PLUGIN_ID).flush(); } catch (BackingStoreException e) { // log failure and continue AptPlugin.log(e, "Couldn't flush preferences to disk"); // $NON-NLS-1$ } }
/** * Writes the value of the CONFIGURED attribute. * * @param value the value to set */ private static void writeConfiguredAttribute(String value) { IEclipsePreferences rootNode = InstanceScope.INSTANCE.getNode( FrameworkUtil.getBundle(WorkspaceConfigurationStatusUtil.class).getSymbolicName()); if (rootNode != null) { rootNode.put(WorkspaceConfigurationConstants.CONFIG_CONFIGURED, value); } }
public static List<String> getClassesToSkip() { Preferences preferences = InstanceScope.INSTANCE.getNode(ICodeGenConstants.PLUGIN_ID); String userInput = preferences.get( ICodeGenConstants.CLASSES_TO_SKIP, ICodeGenConstants.CLASSES_TO_SKIP_DEFAULT); return GeneralCodeGenUtils.getClassesToSkip(userInput); }
public void saveToPreferences() { final IEclipsePreferences lStore = InstanceScope.INSTANCE.getNode(RelationsConstants.PREFERENCE_NODE); lStore.put(RelationsConstants.KEY_DB_PLUGIN_ID, dbConfig.getName()); lStore.put(RelationsConstants.KEY_DB_HOST, host); lStore.put(RelationsConstants.KEY_DB_CATALOG, catalog); lStore.put(RelationsConstants.KEY_DB_USER_NAME, username); lStore.put(RelationsConstants.KEY_DB_PASSWORD, password); }
@Override protected void setUp() throws Exception { super.setUp(); // The following disables some nasty popups that can cause test to hang rather than fail. // when project has errors upon launching it. InstanceScope.INSTANCE .getNode(DebugPlugin.getUniqueIdentifier()) .putBoolean(IInternalDebugCoreConstants.PREF_ENABLE_STATUS_HANDLERS, false); }
@Override public void dispose() { try { InstanceScope.INSTANCE .getNode(HTMLPlugin.PLUGIN_ID) .removePreferenceChangeListener(preferenceListener); } finally { super.dispose(); } }
public HTMLOutlineContentProvider(AbstractThemeableEditor editor) { addSubLanguage(ICSSConstants.CONTENT_TYPE_CSS, new CSSOutlineContentProvider()); addSubLanguage(IJSConstants.CONTENT_TYPE_JS, new JSOutlineContentProvider()); showTextNode = HTMLPreferenceUtil.getShowTextNodesInOutline(); InstanceScope.INSTANCE .getNode(HTMLPlugin.PLUGIN_ID) .addPreferenceChangeListener(preferenceListener); fEditor = editor; }
@Override public boolean performOk() { boolean dirty = false; if (object != null && object.getVisibility() != null && !object.getVisibility().equals(default_visibility)) { ConfigurationScope.INSTANCE .getNode("org.bbaw.bts.ui.corpus") .put(BTSCorpusConstants.PREF_LEMMA_DEFAULT_VISIBILITY, object.getVisibility()); // update instance scope so that new value is injected InstanceScope.INSTANCE .getNode("org.bbaw.bts.ui.corpus") .put(BTSCorpusConstants.PREF_LEMMA_DEFAULT_VISIBILITY, object.getVisibility()); dirty = true; } if (object != null && object.getRevisionState() != null && !object.getRevisionState().equals(default_reviewState)) { ConfigurationScope.INSTANCE .getNode("org.bbaw.bts.ui.corpus") .put(BTSCorpusConstants.PREF_LEMMA_DEFAULT_REVIEWSTATE, object.getRevisionState()); // update instance scope so that new value is injected InstanceScope.INSTANCE .getNode("org.bbaw.bts.ui.corpus") .put(BTSCorpusConstants.PREF_LEMMA_DEFAULT_REVIEWSTATE, object.getRevisionState()); dirty = true; } if (dirty) { try { ConfigurationScope.INSTANCE.getNode("org.bbaw.bts.ui.corpus").flush(); } catch (BackingStoreException e) { } try { InstanceScope.INSTANCE.getNode("org.bbaw.bts.ui.corpus").flush(); } catch (BackingStoreException e) { } } return super.performOk(); }
private void saveOrientation() { IEclipsePreferences node = InstanceScope.INSTANCE.getNode(DebugUIPlugin.getUniqueIdentifier()); if (node != null) { try { node.putInt(getOrientationPrefId(), fViewOrientation); node.flush(); } catch (BackingStoreException e) { DebugUIPlugin.log(e); } } }
private static String getRepoURL() { IEclipsePreferences prefs = InstanceScope.INSTANCE.getNode(ProjectCore.PLUGIN_ID); String repoURL = prefs.get(BLADE_CLI_REPO_URL, defaultRepoUrl); if (!repoURL.endsWith("/")) { repoURL = repoURL + "/"; } return repoURL; }
public IEclipsePreferences getProjectOrWorkspacePreferences(IProject project) { IEclipsePreferences projectPreferences = getProjectScope(project); if (projectPreferences != null && projectPreferences.getBoolean(USING_PROJECT_PROPERTIES, false)) { return projectPreferences; } else { if (instanceScope == null) { instanceScope = InstanceScope.INSTANCE.getNode(Activator.PLUGIN_ID); } return instanceScope; } }
public void buildFinished(IJavaProject project) { try { StringBuilder sb = new StringBuilder(); PreProcessing(project.getElementName()); IEclipsePreferences prefs = InstanceScope.INSTANCE.getNode(Constants.BUNDLE_NAME); String fileName = prefs.get("LTiEFileName", "Empty String") + project.getElementName() + ".MTD"; sb.append("<COMPILE_INSTANCE>"); Calendar c = Calendar.getInstance(); SimpleDateFormat format = new SimpleDateFormat("EEE, MMM d, yyyy 'at' HH:mm:ss z"); sb.append( "<TIME UTC=\"" + c.getTimeInMillis() + "\">" + format.format(c.getTime()) + "</TIME>"); IPackageFragment[] packages = project.getPackageFragments(); sb.append("<PACKAGES>"); for (IPackageFragment aPackage : packages) { if (aPackage.getKind() == IPackageFragmentRoot.K_SOURCE) { String packageName = aPackage.getElementName().isEmpty() ? "default" : aPackage.getElementName(); Constants.writer.println("Package Fragment Name: " + packageName); sb.append("<PACKAGE>"); sb.append("<NAME>" + packageName + "</NAME>"); sb.append("<FILES>"); for (ICompilationUnit unit : aPackage.getCompilationUnits()) { sb.append("<FILE>"); sb.append("<NAME>" + unit.getElementName() + "</NAME>"); printFileInternals(unit, sb); printFilesProblems(unit, sb); sb.append("<SOURCE>" + StringEscapeUtils.escapeHtml4(unit.getSource()) + "</SOURCE>"); sb.append("</FILE>"); } ProcessUMLFiles(aPackage.getNonJavaResources(), sb); sb.append("</FILES>"); sb.append("</PACKAGE>"); } } sb.append("</PACKAGES>"); Object[] nonJavaResources = project.getNonJavaResources(); if (nonJavaResources != null && nonJavaResources.length > 0) { sb.append("<FILES>"); ProcessUMLFiles(nonJavaResources, sb); sb.append("</FILES>"); } sb.append("</COMPILE_INSTANCE>"); PrintWriter out = new PrintWriter(new FileWriter(fileName, true)); out.write(XMLFormatter.format(sb.toString())); out.close(); } catch (Exception e) { e.printStackTrace(Constants.writer); } }
protected void createProjectSettings(IProject project, String containerPath, String consolePath) throws BackingStoreException { IEclipsePreferences preferences = InstanceScope.INSTANCE.getNode(SymfonyCorePlugin.ID); String executable = preferences.get(Keys.PHP_EXECUTABLE, null); IEclipsePreferences node = new ProjectScope(project).getNode(SymfonyCorePlugin.ID); if (executable != null) { node.put(Keys.PHP_EXECUTABLE, executable); Logger.log(Logger.WARNING, "Executable not found!"); } node.put(Keys.CONSOLE, consolePath); node.put(Keys.USE_PROJECT_PHAR, Boolean.FALSE.toString()); node.put(Keys.DUMPED_CONTAINER, containerPath); node.flush(); }
@Test public void testLinkToFolderWithDefaultSCM() throws Exception { // enable git autoinit for new projects IEclipsePreferences prefs = InstanceScope.INSTANCE.getNode(ServerConstants.PREFERENCE_SCOPE); String oldValue = prefs.get(ServerConstants.CONFIG_FILE_DEFAULT_SCM, null); prefs.put(ServerConstants.CONFIG_FILE_DEFAULT_SCM, "git"); prefs.flush(); try { // the same check as in // org.eclipse.orion.server.git.GitFileDecorator.initGitRepository(HttpServletRequest, IPath, // JSONObject) String scm = PreferenceHelper.getString(ServerConstants.CONFIG_FILE_DEFAULT_SCM, ""); Assume.assumeTrue("git".equals(scm)); // $NON-NLS-1$ URI workspaceLocation = createWorkspace(getMethodName()); String contentLocation = new File(gitDir, "folder").getAbsolutePath(); JSONObject newProject = createProjectOrLink(workspaceLocation, getMethodName() + "-link", contentLocation); String projectContentLocation = newProject.getString(ProtocolConstants.KEY_CONTENT_LOCATION); // http://<host>/file/<projectId>/ WebRequest request = getGetFilesRequest(projectContentLocation); WebResponse response = webConversation.getResponse(request); assertEquals(HttpURLConnection.HTTP_OK, response.getResponseCode()); JSONObject project = new JSONObject(response.getText()); String childrenLocation = project.getString(ProtocolConstants.KEY_CHILDREN_LOCATION); assertNotNull(childrenLocation); // http://<host>/file/<projectId>/?depth=1 request = getGetFilesRequest(childrenLocation); response = webConversation.getResponse(request); assertEquals(HttpURLConnection.HTTP_OK, response.getResponseCode()); List<JSONObject> children = getDirectoryChildren(new JSONObject(response.getText())); String[] expectedChildren = new String[] {"folder.txt"}; // no .git even though auto-git is on assertEquals("Wrong number of directory children", expectedChildren.length, children.size()); assertEquals(expectedChildren[0], children.get(0).getString(ProtocolConstants.KEY_NAME)); } finally { // reset the preference we messed with for the test if (oldValue == null) prefs.remove(ServerConstants.CONFIG_FILE_DEFAULT_SCM); else prefs.put(ServerConstants.CONFIG_FILE_DEFAULT_SCM, oldValue); prefs.flush(); } }
/** Tests that we are not allowed to get metadata files */ @Test public void testGetForbiddenFiles() throws IOException, SAXException, BackingStoreException { // enable global anonymous read IEclipsePreferences prefs = InstanceScope.INSTANCE.getNode(ServerConstants.PREFERENCE_SCOPE); String oldValue = prefs.get(ServerConstants.CONFIG_FILE_ANONYMOUS_READ, null); prefs.put(ServerConstants.CONFIG_FILE_ANONYMOUS_READ, "true"); prefs.flush(); try { // should not be allowed to get at file root WebRequest request = new GetMethodWebRequest(SERVER_LOCATION + FILE_SERVLET_LOCATION); setAuthentication(request); WebResponse response = webConversation.getResponse(request); assertEquals( "Should not be able to get the root", HttpURLConnection.HTTP_FORBIDDEN, response.getResponseCode()); // should not be allowed to access the metadata directory request = new GetMethodWebRequest(SERVER_LOCATION + FILE_SERVLET_LOCATION + ".metadata"); setAuthentication(request); response = webConversation.getResponse(request); assertEquals( "Should not be able to get metadata", HttpURLConnection.HTTP_FORBIDDEN, response.getResponseCode()); // should not be allowed to read specific metadata files request = new GetMethodWebRequest( SERVER_LOCATION + FILE_SERVLET_LOCATION + ".metadata/.plugins/org.eclipse.orion.server.user.securestorage/user_store"); setAuthentication(request); response = webConversation.getResponse(request); assertEquals( "Should not be able to get metadata", HttpURLConnection.HTTP_FORBIDDEN, response.getResponseCode()); } finally { // reset the preference we messed with for the test if (oldValue == null) prefs.remove(ServerConstants.CONFIG_FILE_ANONYMOUS_READ); else prefs.put(ServerConstants.CONFIG_FILE_ANONYMOUS_READ, oldValue); prefs.flush(); } }
/* * (non-Javadoc) Method declared on PreferencePage */ public boolean performOk() { storeValues(); try { IEclipsePreferences preferences = InstanceScope.INSTANCE.getNode(PLUGIN_ID); preferences.flush(); BuildsView buildsView = (BuildsView) PerformancesView.getWorkbenchView( "org.eclipse.test.internal.performance.results.ui.BuildsView"); if (buildsView != null) { buildsView.resetView(); } } catch (BackingStoreException e) { e.printStackTrace(); return false; } return true; }
@Override protected void tearDown() throws Exception { InstanceScope.INSTANCE .getNode(SiriusPlugin.ID) .putBoolean(SiriusPreferencesKeys.PREF_AUTO_REFRESH.name(), oldRefreshAutoMode); sessionResourceURI = null; semanticResourceURI = null; domain.dispose(); domain = null; resourceSet = null; sessionResource = null; refreshEditorsPrecommitListener = null; RefreshFilterManager.INSTANCE.removeRefreshFilter(refreshFilterStub); refreshFilterStub = null; super.tearDown(); }
private static void updateProjectPrefs(final NewLiferayPluginProjectOp op) { try { final IEclipsePreferences prefs = InstanceScope.INSTANCE.getNode(ProjectCore.PLUGIN_ID); prefs.put( ProjectCore.PREF_DEFAULT_PLUGIN_PROJECT_BUILD_TYPE_OPTION, op.getProjectProvider().text()); prefs.putBoolean(ProjectCore.PREF_INCLUDE_SAMPLE_CODE, op.getIncludeSampleCode().content()); prefs.putBoolean(ProjectCore.PREF_CREATE_NEW_PORLET, op.getCreateNewPortlet().content()); if ("maven".equalsIgnoreCase(op.getProjectProvider().text())) { prefs.put(ProjectCore.PREF_DEFAULT_PLUGIN_PROJECT_MAVEN_GROUPID, op.getGroupId().content()); } prefs.flush(); } catch (Exception e) { final String msg = "Error updating default project build type."; // $NON-NLS-1$ ProjectCore.logError(msg, e); } }