List of usage examples for org.eclipse.jface.preference IPreferenceStore putValue
void putValue(String name, String value);
From source file:org.jboss.tools.seam.core.test.SeamValidatorsTest.java
License:Open Source License
private void modifyPreference(String name, String value) { IPreferenceStore store = SeamCorePlugin.getDefault().getPreferenceStore(); if (store instanceof IPersistentPreferenceStore) { try {/*from w w w . ja v a 2 s . c o m*/ ((IPersistentPreferenceStore) store).save(); } catch (IOException e) { SeamCorePlugin.getPluginLog().logError(e); } } store = WebKbPlugin.getDefault().getPreferenceStore(); store.putValue(name, value); if (store instanceof IPersistentPreferenceStore) { try { ((IPersistentPreferenceStore) store).save(); } catch (IOException e) { SeamCorePlugin.getPluginLog().logError(e); } } }
From source file:org.jboss.tools.seam.ui.test.marker.SeamMarkerResolutionTest.java
License:Open Source License
@Override protected void setUp() throws Exception { JobUtils.waitForIdle();/* w w w. jav a 2 s . c om*/ IResource project = ResourcesPlugin.getWorkspace().getRoot().findMember("SeamWebWarTestProject"); this.project = project.getProject(); IPreferenceStore store = SeamCorePlugin.getDefault().getPreferenceStore(); store.putValue(SeamPreferences.DUPLICATE_REMOVE, SeamPreferences.WARNING); store.putValue(SeamPreferences.DUPLICATE_DESTROY, SeamPreferences.WARNING); store.putValue(SeamPreferences.DUPLICATE_CREATE, SeamPreferences.WARNING); store.putValue(SeamPreferences.DUPLICATE_UNWRAP, SeamPreferences.WARNING); store.putValue(SeamPreferences.CREATE_DOESNT_BELONG_TO_COMPONENT, SeamPreferences.WARNING); store.putValue(SeamPreferences.UNWRAP_DOESNT_BELONG_TO_COMPONENT, SeamPreferences.WARNING); store.putValue(SeamPreferences.OBSERVER_DOESNT_BELONG_TO_COMPONENT, SeamPreferences.WARNING); store.putValue(SeamPreferences.NONUNIQUE_COMPONENT_NAME, SeamPreferences.WARNING); store.putValue(SeamPreferences.STATEFUL_COMPONENT_DOES_NOT_CONTENT_REMOVE, SeamPreferences.WARNING); store.putValue(SeamPreferences.STATEFUL_COMPONENT_DOES_NOT_CONTENT_DESTROY, SeamPreferences.WARNING); store.putValue(SeamPreferences.STATEFUL_COMPONENT_WRONG_SCOPE, SeamPreferences.WARNING); store.putValue(SeamPreferences.ENTITY_COMPONENT_WRONG_SCOPE, SeamPreferences.WARNING); store.putValue(SeamPreferences.UNKNOWN_COMPONENT_PROPERTY, SeamPreferences.WARNING); if (store instanceof IPersistentPreferenceStore) { try { ((IPersistentPreferenceStore) store).save(); } catch (IOException e) { SeamCorePlugin.getPluginLog().logError(e); } } }
From source file:org.joe_e.eclipse.Main.java
License:BSD License
/** * Main method of the command-line Joe-E verifier *///from w ww .ja v a 2 s . com public Object start(IApplicationContext context) throws Exception { // Get command line args from the ApplicationContext String[] args = (String[]) context.getArguments().get("application.args"); // parse arguments for (int i = 0; i < args.length; i++) { if (args[i].equals("-taming")) { if (i + 1 < args.length && !(args[i + 1].startsWith("-/-"))) { File taming = new File(args[i + 1]); if (taming.exists() && taming.isDirectory()) { tamingPath = taming.getAbsolutePath(); i++; } else { System.out.println("ERROR: did you specify your taming database correctly?"); } } } else if (args[i].equals("-markasjoee")) { markAsJoeE = true; } else if (args[i].equals("-fail")) { failIfNotJoeE = true; } else if (args[i].equals("-verbose")) { debug = true; } else if (args[i].equals("-classpath")) { if (i + 1 < args.length && !(args[i + 1].startsWith("-"))) { classPathEntries = args[i + 1].split(pathSeparator); i++; } /* File library = new File(args[i+1]); String ext = library.toString().substring(library.toString().lastIndexOf('.')+1); if (library.exists() && ext.trim().equals("jar")){ libraryJar = new File(args[i+1]).getAbsolutePath(); i++; } else { System.out.println("ERROR: is your library file the correct jar file?"); } } */ } else if (args[i].equals("-source")) { if (i + 1 < args.length && !(args[i + 1].startsWith("-"))) { projectRoot = args[i + 1] + (args[i + 1].endsWith(separator) ? "" : separator); i++; } } else { // command line args are incorrect so we should print usage string help = true; } } // Verify args and don't run if required args are not passed in. if (tamingPath == null) { System.out.println("ERROR: taming database location not specified"); help = true; } if (classPathEntries == null) { System.out.println("ERROR: the classpath must include at least the Joe-E library"); help = true; } if (help) { // then the user needs some help System.out.println(usageString); return 1; } // Now we can run. System.out.println("Running Verifier on: " + projectRoot); // starting if (markAsJoeE && failIfNotJoeE) { markAsJoeE = false; // these two options are contradictory, so if both are on turn markAsJoeE off. } File projectRootDir = new File(projectRoot); try { IWorkspace workspace = ResourcesPlugin.getWorkspace(); IWorkspaceRoot root = workspace.getRoot(); // we're going to make a random project in the workspace and copy everything into that. IProject proj = root.getProject("verification" + new java.util.Date().getTime()); if (proj.exists()) { throw new AssertionError("project already exists"); } else { proj.create(null); // create the project } if (proj.exists() && !proj.isOpen()) { proj.open(null); // open the project } for (File child : projectRootDir.listFiles()) { putFolderIntoProject(proj, child); // recursively copy everything from projectRoot to the project } modifyDotProjectFile(proj); //HACK, assign the appropriate builders to the project modifyDotClasspathFile(proj); //HACK, add necessary library files to the project // Refresh project proj.close(null); proj.open(null); IPreferenceStore store = Plugin.getDefault().getPreferenceStore(); store.putValue(Preferences.P_TAMING_PATH, tamingPath); // update the tamingPath in the PreferenceStore store.setValue(Preferences.P_ENABLE_DEBUG, debug); if (build) { // if we haven't had any problems so far, build the project proj.build(IncrementalProjectBuilder.FULL_BUILD, null); int errors = Printer.printErrors(proj); // refresh the project -- why? proj.close(null); proj.open(null); // delete the project, save the workspace and then return. proj.delete(true, true, null); workspace.save(true, null); if (errors > 0) { System.out.println("Build terminated with " + errors + " errors"); return 1; } else { System.out.println("Build terminated with no errors"); return 0; } } else { // we've had some problems so don't build, delete the project, and return failure. System.out.println("Project not built because some packages weren't marked as Joe-E."); proj.delete(true, true, null); workspace.save(true, null); return 2; } } catch (Throwable t) { System.out.println(t); t.printStackTrace(); return 3; } }
From source file:org.kie.eclipse.navigator.view.server.KieServerHandler.java
License:Open Source License
public void setRuntimeId(String version) { IPreferenceStore store = Activator.getDefault().getPreferenceStore(); store.putValue(getKieVersionPreferenceKey(), version); }
From source file:org.kie.eclipse.server.KieServerHandler.java
License:Open Source License
public void setRuntimeId(String version) { IPreferenceStore store = org.kie.eclipse.Activator.getDefault().getPreferenceStore(); store.putValue(getKieVersionPreferenceKey(), version); }
From source file:org.locationtech.udig.omsbox.OmsBoxPlugin.java
License:Open Source License
/** * Save a list of jar paths to the preferences. * //from ww w .java 2s. com * @param jarsList the list of jars to save. */ public void saveJars(List<String> jarsList) { IPreferenceStore preferenceStore = OmsBoxPlugin.getDefault().getPreferenceStore(); StringBuilder sb = new StringBuilder(); for (String jarPath : jarsList) { sb.append(JARPATH_SPLITTER); sb.append(jarPath); } String jarsPathPref = sb.toString().replaceFirst(JARPATH_SPLITTER, ""); //$NON-NLS-1$ preferenceStore.putValue(OMSBOX_LOADED_JARS_KEY, jarsPathPref); }
From source file:org.locationtech.udig.omsbox.OmsBoxPlugin.java
License:Open Source License
/** * Utility method for file dialogs to set the last folder. * /*from w ww . j a v a2 s . c om*/ * @param folderPath */ public void setLastFolderChosen(String folderPath) { IPreferenceStore store = getPreferenceStore(); store.putValue(LAST_CHOSEN_FOLDER, folderPath); }
From source file:org.neuro4j.studio.debug.ui.views.FlowLaunchView.java
License:Apache License
public void partDeactivated(IWorkbenchPart part) { String id = part.getSite().getId(); if (id.equals(getSite().getId())) { ByteArrayOutputStream bout = new ByteArrayOutputStream(); OutputStreamWriter writer = new OutputStreamWriter(bout); try {// w w w . j ava2 s . c o m XMLMemento memento = XMLMemento.createWriteRoot("DebugViewMemento"); //$NON-NLS-1$ saveViewerState(memento); memento.save(writer); IPreferenceStore store = DebugUIPlugin.getDefault().getPreferenceStore(); String xmlString = bout.toString(); store.putValue(PREF_STATE_MEMENTO, xmlString); } catch (IOException e) { } finally { try { writer.close(); bout.close(); } catch (IOException e) { } } } super.partDeactivated(part); }
From source file:org.oobium.eclipse.OobiumPlugin.java
License:Open Source License
private void loadPreferences() { IPreferenceStore preferences = getPreferenceStore(); String props = System.getProperty(PREFERENCES); if (props != null && props.length() > 0) { Map<String, String> map = JsonUtils.toStringMap(props); for (Entry<String, String> entry : map.entrySet()) { preferences.putValue(entry.getKey(), entry.getValue()); }/* ww w .j a v a 2 s. co m*/ } }
From source file:org.parallelj.designer.extension.edit.parts.BusinessProcedureExtendedEditPart.java
License:Open Source License
/** * This will update the preference value for icon on name change event * /*from w ww .ja v a 2 s. c o m*/ * @param newKey * @param oldKey */ public void updatePreference(String newKey, String oldKey) { IPreferenceStore preferenceStore = Activator.getDefault().getPreferenceStore(); String path = preferenceStore.getString(oldKey); preferenceStore.putValue(newKey, path); }