List of usage examples for org.eclipse.jface.preference IPreferenceStore getDefaultString
String getDefaultString(String name);
From source file:org.eclipse.ptp.gig.util.GIGUtilities.java
License:Open Source License
public static IStatus processSource(IPath filePath) throws IOException, CoreException, InterruptedException { // enforce that the file is of the right type, and switch to something else if needed final String fileExtension = filePath.getFileExtension(); if (fileExtension.equals("gig")) { //$NON-NLS-1$ return processBinary(filePath); } else if (fileExtension.equals("log")) { //$NON-NLS-1$ return processLog(filePath); } else if (!fileExtension.equals("cu") && !fileExtension.equals("C") && !fileExtension.equals("c")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ showErrorDialog(Messages.INCORRECT_FILE_EXTENSION, Messages.CHANGE_FILE_EXTENSION); return Status.CANCEL_STATUS; }/* ww w. j av a 2s.c o m*/ final IWorkspace workspace = ResourcesPlugin.getWorkspace(); final IWorkspaceRoot workspaceRoot = workspace.getRoot(); // If we are doing a remote execution, now is the time to go over to it final IFile origFile = workspaceRoot.getFile(filePath); final IPreferenceStore preferenceStore = GIGPlugin.getDefault().getPreferenceStore(); final boolean local = preferenceStore.getBoolean(GIGPreferencePage.LOCAL); if (!local) { try { // First send the file over final List<IFile> fileList = new ArrayList<IFile>(); fileList.add(origFile); if (!preferenceStore.getString(Messages.USERNAME) .equals(preferenceStore.getDefaultString(Messages.USERNAME))) { sendFoldersAndFiles(new ArrayList<IFolder>(), fileList); } requestVerification(origFile.getProject(), origFile.getProjectRelativePath()); final UIJob job = new UIJob(Messages.RESET_SERVER_VIEW) { @Override public IStatus runInUIThread(IProgressMonitor monitor) { ServerView.getDefault().reset(); return Status.OK_STATUS; } }; startJob(job); return Status.OK_STATUS; } catch (final IncorrectPasswordException ipe) { showErrorDialog(Messages.INCORRECT_PASSWORD, Messages.INCORRECT_PASSWORD_MESSAGE); StatusManager.getManager() .handle(new Status(IStatus.ERROR, GIGPlugin.PLUGIN_ID, Messages.INCORRECT_PASSWORD, ipe)); } catch (final IllegalCommandException e) { showErrorDialog(Messages.ILLEGAL_COMMAND, Messages.ILLEGAL_COMMAND_MESSAGE); StatusManager.getManager() .handle(new Status(IStatus.ERROR, GIGPlugin.PLUGIN_ID, Messages.ILLEGAL_COMMAND, e)); } return Status.CANCEL_STATUS; } // klee-l++ can't handle the .cu extension, so make a link to it IFile currFile; final IContainer gigContainer = origFile.getParent(); if (fileExtension.equals("cu")) { //$NON-NLS-1$ final IPath newPath = origFile.getProjectRelativePath().removeFileExtension().addFileExtension("C"); //$NON-NLS-1$ currFile = origFile.getProject().getFile(newPath); origFile.getParent().refreshLocal(1, progressMonitor); if (currFile.exists()) { currFile.delete(true, progressMonitor); } origFile.copy(currFile.getFullPath(), 0, progressMonitor); gigContainer.refreshLocal(1, progressMonitor); } else { currFile = origFile; } final IPath binaryPath = filePath.removeFileExtension().addFileExtension("gig"); //$NON-NLS-1$ // begin building the command line with absolute paths, especially from the preferenceStore String sourceOSPath, binaryOSPath; final IPath sourceAbsoluteIPath = currFile.getLocation(); sourceOSPath = sourceAbsoluteIPath.toOSString(); binaryOSPath = sourceAbsoluteIPath.removeFileExtension().addFileExtension("gig").toOSString(); //$NON-NLS-1$ final String kleeOSPath = preferenceStore.getString(GIGPreferencePage.BIN) + "/klee-l++"; //$NON-NLS-1$ final ProcessBuilder processBuilder = new ProcessBuilder(kleeOSPath, sourceOSPath, "-o", binaryOSPath); //$NON-NLS-1$ // klee depends on a lot of path variables, so set these in the environment final Map<String, String> environment = processBuilder.environment(); buildEnvPath(environment); final Process process = processBuilder.start(); printToConsole(process.getInputStream()); process.waitFor(); if (process.exitValue() != 0) { showErrorDialog(Messages.COMPILATION_ERROR, Messages.SEE_CONSOLE); printToConsole(process.getErrorStream()); return Status.CANCEL_STATUS; } // refresh environment so that eclipse is aware of the new binary gigContainer.refreshLocal(1, progressMonitor); return processBinary(binaryPath); }
From source file:org.eclipse.ptp.internal.rdt.editor.preferences.HeaderFooterFieldEditor.java
License:Open Source License
@Override protected void doLoadDefault() { IPreferenceStore store = getPreferenceStore(); if (hRight != null) hRight.setText(store.getDefaultString(PrintPreferencePage.HEADER_KEY + PrintPreferencePage.RIGHT_KEY)); if (hCenter != null) hCenter.setText(//from ww w . j a v a 2 s.c o m store.getDefaultString(PrintPreferencePage.HEADER_KEY + PrintPreferencePage.CENTER_KEY)); if (hLeft != null) hLeft.setText(store.getDefaultString(PrintPreferencePage.HEADER_KEY + PrintPreferencePage.LEFT_KEY)); if (fRight != null) fRight.setText(store.getDefaultString(PrintPreferencePage.FOOTER_KEY + PrintPreferencePage.RIGHT_KEY)); if (fCenter != null) fCenter.setText( store.getDefaultString(PrintPreferencePage.FOOTER_KEY + PrintPreferencePage.CENTER_KEY)); if (fLeft != null) fLeft.setText(store.getDefaultString(PrintPreferencePage.FOOTER_KEY + PrintPreferencePage.LEFT_KEY)); }
From source file:org.eclipse.rap.incubator.texteditor.demo.commands.NewFileCommandHandler.java
License:Open Source License
@Override public Object execute(ExecutionEvent event) throws ExecutionException { Shell activeShell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); File file = CommandUtil.unwrap(event, File.class); if (file == null) { IPreferenceStore store = Activator.getDefault().getPreferenceStore(); String path = store.getDefaultString(ITextEditorDemoConfiguration.WORKSPACE_SETTING); file = new Path(path).toFile(); }/* www . j av a 2s.c o m*/ NewFileWizard wizard = new NewFileWizard(file); StructuredSelection selection = new StructuredSelection(file); wizard.init(PlatformUI.getWorkbench(), selection); WizardDialog wizardDialog = new WizardDialog(activeShell, wizard); wizardDialog.create(); wizardDialog.getShell().setSize(400, 400); Rectangle bounds = activeShell.getBounds(); Rectangle rect = wizardDialog.getShell().getBounds(); int x = bounds.x + (bounds.width - rect.width) / 2; int y = bounds.y + (bounds.height - rect.height) / 2; wizardDialog.getShell().setLocation(x, y); return wizardDialog.open(); }
From source file:org.eclipse.rap.incubator.texteditor.demo.wizards.AbstractNewResourceWizardPage.java
License:Open Source License
protected AbstractNewResourceWizardPage(String pageName) { super(pageName); IPreferenceStore store = Activator.getDefault().getPreferenceStore(); rootPath = store.getDefaultString(ITextEditorDemoConfiguration.WORKSPACE_SETTING); }
From source file:org.eclipse.releng.tools.preferences.CopyrightPreferencePage.java
License:Open Source License
protected void performDefaults() { IPreferenceStore store = getPreferenceStore(); fEditor.getDocument().set(store.getDefaultString(RelEngCopyrightConstants.COPYRIGHT_TEMPLATE_KEY)); fCreationYear.setText(store.getDefaultString(RelEngCopyrightConstants.CREATION_YEAR_KEY)); fRevisionYear.setText(store.getDefaultString(RelEngCopyrightConstants.REVISION_YEAR_KEY)); fUseDefaultRevisionYear.setSelection( getPreferenceStore().getDefaultBoolean(RelEngCopyrightConstants.USE_DEFAULT_REVISION_YEAR_KEY)); fReplaceAllExisting.setSelection(// w w w .j av a 2 s . com getPreferenceStore().getDefaultBoolean(RelEngCopyrightConstants.REPLACE_ALL_EXISTING_KEY)); // disable fix up existing copyright till it works better // handleReplaceAllEnabled(fReplaceAllExisting.getSelection(), getPreferenceStore().getDefaultBoolean(RelEngCopyrightConstants.FIX_UP_EXISTING_KEY)); fIgnoreProperties.setSelection( getPreferenceStore().getDefaultBoolean(RelEngCopyrightConstants.IGNORE_PROPERTIES_KEY)); if (XmlFile.BUGS_FIXED) fIgnoreXml .setSelection(getPreferenceStore().getDefaultBoolean(RelEngCopyrightConstants.IGNORE_XML_KEY)); super.performDefaults(); }
From source file:org.eclipse.scanning.event.ui.Activator.java
License:Open Source License
/** * Get the command value if it has been changed by the user. * @param key/*from w w w. j a va 2s . c o m*/ * @return */ private static final String getNovelCommandPreference(String key) { final IPreferenceStore store = getDefault().getPreferenceStore(); String val = store.getString(key); String def = store.getDefaultString(key); if (!val.equals(def)) return val; return null; }
From source file:org.eclipse.team.internal.ccvs.ui.ExtMethodPreferencePage.java
License:Open Source License
protected void performDefaults() { IPreferenceStore store = getPreferenceStore(); String rsh = store.getDefaultString(ICVSUIConstants.PREF_CVS_RSH); String parameter = store.getDefaultString(ICVSUIConstants.PREF_CVS_RSH_PARAMETERS); String server = store.getDefaultString(ICVSUIConstants.PREF_CVS_SERVER); String method = store.getDefaultString(ICVSUIConstants.PREF_EXT_CONNECTION_METHOD_PROXY); initializeDefaults(rsh, parameter, server, method); super.performDefaults(); }
From source file:org.eclipse.team.svn.revision.graph.preferences.SVNRevisionGraphPreferences.java
License:Open Source License
public static String getDefaultCacheString(IPreferenceStore store, String shortName) { return store.getDefaultString(SVNRevisionGraphPreferences.fullCacheName(shortName)); }
From source file:org.eclipse.test.internal.performance.results.ui.PerformanceResultsPreferencePage.java
License:Open Source License
/** * Initializes states of the controls using default values in the preference * store./*from w w w. j ava 2s.c o m*/ */ private void initializeDefaults() { IPreferenceStore store = getPreferenceStore(); // Init default database values this.dbConnectionCheckBox.setSelection(store.getDefaultBoolean(PRE_DATABASE_CONNECTION)); this.dbRelengRadioButton.setSelection(false); this.dbLocalRadioButton.setSelection(false); final boolean dbLocal = store.getDefaultBoolean(PRE_DATABASE_LOCAL); if (dbLocal) { this.dbLocalRadioButton.setSelection(true); } else { this.dbRelengRadioButton.setSelection(true); } this.databaseLocationCombo.removeAll(); this.databaseLocationCombo.setText(store.getString(PRE_DATABASE_LOCATION)); updateDatabaseGroup(); // Init eclipse version this.mVersionRadioButton.setSelection(false); this.dVersionRadionButton.setSelection(false); int version = store.getDefaultInt(PRE_ECLIPSE_VERSION); if (version == ECLIPSE_MAINTENANCE_VERSION) { this.mVersionRadioButton.setSelection(true); } else { this.dVersionRadionButton.setSelection(true); } updateBrowseButtonToolTip(version); // Milestones this.milestonesCombo.removeAll(); String prefix = PRE_MILESTONE_BUILDS + "." + version; String milestone = store.getDefaultString(prefix + "0"); int index = 0; while (milestone != null && milestone.length() > 0) { this.milestonesCombo.add(milestone); milestone = store.getDefaultString(prefix + index); } // Init default default dimension String defaultDimension = store.getDefaultString(PRE_DEFAULT_DIMENSION); this.defaultDimensionCombo.setText(defaultDimension); // Init default generated dimensions this.resultsDimensionsList.add(store.getDefaultString(PRE_RESULTS_DIMENSION + ".0")); this.resultsDimensionsList.add(store.getDefaultString(PRE_RESULTS_DIMENSION + ".1")); }
From source file:org.eclipse.ui.examples.readmetool.ReadmePreferencePage.java
License:Open Source License
/** * Initializes states of the controls using default values * in the preference store./* ww w. j av a 2s.co m*/ */ private void initializeDefaults() { IPreferenceStore store = getPreferenceStore(); checkBox1.setSelection(store.getDefaultBoolean(IReadmeConstants.PRE_CHECK1)); checkBox2.setSelection(store.getDefaultBoolean(IReadmeConstants.PRE_CHECK2)); checkBox3.setSelection(store.getDefaultBoolean(IReadmeConstants.PRE_CHECK3)); radioButton1.setSelection(false); radioButton2.setSelection(false); radioButton3.setSelection(false); int choice = store.getDefaultInt(IReadmeConstants.PRE_RADIO_CHOICE); switch (choice) { case 1: radioButton1.setSelection(true); break; case 2: radioButton2.setSelection(true); break; case 3: radioButton3.setSelection(true); break; } textField.setText(store.getDefaultString(IReadmeConstants.PRE_TEXT)); }