List of usage examples for org.eclipse.jface.preference IPreferenceStore getString
String getString(String name);
From source file:com.aptana.ide.core.internal.ui.WebFilesPropertyTester.java
License:Open Source License
private void loadExtensions() { IPreferenceStore store = CoreUIPlugin.getDefault().getPreferenceStore(); String[] files = store.getString(IPreferenceConstants.PREF_FILE_EXPLORER_WEB_FILES).split(";"); //$NON-NLS-1$ extensions = new HashSet<String>(); for (int i = 0; i < files.length; ++i) { String ext = files[i];//w w w . j a va2 s.co m int index = ext.lastIndexOf('.'); if (index >= 0) { ext = ext.substring(index + 1); } extensions.add(ext); } }
From source file:com.aptana.ide.core.ui.ColorPair.java
License:Open Source License
/** * Returns the current value of the color-valued preference with the given name in the given * preference store. Returns the default-default value (<code>COLOR_DEFAULT_DEFAULT</code>) * if there is no preference with the given name, or if the current value cannot be treated as a * color./* w w w. j a v a2 s . c o m*/ * * @param store * the preference store * @param name * the name of the preference * @return the color-valued preference */ public static ColorPair getColorPair(IPreferenceStore store, String name) { return basicGetColorPair(store.getString(name)); }
From source file:com.aptana.ide.core.ui.CoreUIUtils.java
License:Open Source License
/** * Gets the user's name from preferences or the system, whichever is defined * /*from ww w . j a va2s .c o m*/ * @return String */ public static String getUserName() { try { String userName = System.getProperty("user.name"); //$NON-NLS-1$ IPreferenceStore store = CoreUIPlugin.getDefault().getPreferenceStore(); if (store != null) { String testName = store .getString(com.aptana.ide.core.ui.preferences.IPreferenceConstants.PREF_USER_NAME); if (StringUtils.EMPTY.equals(testName) == false) { userName = testName; } } return userName; } catch (Exception e) { IdeLog.logError(CoreUIPlugin.getDefault(), Messages.CoreUIUtils_UnableToGetCurrentUserName, e); return StringUtils.EMPTY; } }
From source file:com.aptana.ide.core.ui.DialogUtils.java
License:Open Source License
/** * openIgnoreMessageDialogInformation//from w ww. j a v a 2s. c o m * * @param shell * @param title * @param message * @param store * @param key * @return int */ public static int openIgnoreMessageDialogInformation(Shell shell, String title, String message, IPreferenceStore store, String key) { if (!store.getString(key).equals(MessageDialogWithToggle.ALWAYS)) { MessageDialogWithToggle d = MessageDialogWithToggle.openInformation(shell, title, message, Messages.DialogUtils_HideThisMessageInFuture, false, store, key); if (d.getReturnCode() == 3) { return MessageDialog.CANCEL; } else { return MessageDialog.OK; } } else { return MessageDialog.OK; } }
From source file:com.aptana.ide.core.ui.DialogUtils.java
License:Open Source License
/** * openIgnoreMessageDialogConfirm/*w ww. j a v a 2 s . c om*/ * * @param shell * @param title * @param message * @param store * @param key Key to store the show/hide this message. Message will be hidden if true * @return int */ public static int openIgnoreMessageDialogConfirm(Shell shell, String title, String message, IPreferenceStore store, String key) { if (!store.getString(key).equals(MessageDialogWithToggle.ALWAYS)) { MessageDialogWithToggle d = MessageDialogWithToggle.openYesNoQuestion(shell, title, message, Messages.DialogUtils_HideThisMessageInFuture, false, store, key); if (d.getReturnCode() == 3) { return MessageDialog.CANCEL; } else { return MessageDialog.OK; } } else { return MessageDialog.OK; } }
From source file:com.aptana.ide.core.ui.install.PlatformValidatorPatcher.java
License:Open Source License
/** * /*from w w w. j a v a2 s. c o m*/ */ private static void exportPreferences() { IPreferenceStore preferenceStore = CoreUIPlugin.getDefault().getPreferenceStore(); if (preferenceStore.getBoolean(IPreferenceConstants.PREF_AUTO_BACKUP_ENABLED)) { String string = preferenceStore.getString(IPreferenceConstants.PREF_AUTO_BACKUP_PATH); File folder = new File(string); folder.mkdirs(); doExport(folder); } }
From source file:com.aptana.ide.core.ui.preferences.FileExtensionPreferencePage.java
License:Open Source License
/** * Fills the resource type table with the current preference value *//*from w w w . j a v a 2s.com*/ protected void fillCurrentResourceTypeTable() { IPreferenceStore store = doGetPreferenceStore(); String editors = store.getString(doGetPreferenceID()); fillResourceTypeTable(editors); }
From source file:com.aptana.ide.debug.internal.ui.InstallDebuggerPromptStatusHandler.java
License:Open Source License
/** * @see org.eclipse.debug.core.IStatusHandler#handleStatus(org.eclipse.core.runtime.IStatus, java.lang.Object) *//* www. ja v a 2 s. c om*/ public Object handleStatus(IStatus status, Object source) throws CoreException { Shell shell = DebugUiPlugin.getActiveWorkbenchShell(); String title = Messages.InstallDebuggerPromptStatusHandler_InstallDebuggerExtension; if ("install".equals(source)) { //$NON-NLS-1$ MessageDialog.openInformation(shell, title, Messages.InstallDebuggerPromptStatusHandler_WaitbrowserLaunches_AcceptExtensionInstallation_Quit); return null; } else if ("postinstall".equals(source)) { //$NON-NLS-1$ MessageDialog.openInformation(shell, title, Messages.InstallDebuggerPromptStatusHandler_WaitbrowserLaunches_Quit); return null; } else if ("nopdm".equals(source)) { //$NON-NLS-1$ MessageDialog md = new MessageDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), title, null, Messages.InstallDebuggerPromptStatusHandler_PDMNotInstalled, MessageDialog.WARNING, new String[] { StringUtils.ellipsify(Messages.InstallDebuggerPromptStatusHandler_Download), CoreStrings.CONTINUE, CoreStrings.CANCEL, CoreStrings.HELP }, 0); switch (md.open()) { case 0: WorkbenchHelper.launchBrowser("http://www.aptana.com/pro/pdm.php", "org.eclipse.ui.browser.ie"); //$NON-NLS-1$ //$NON-NLS-2$ /* continue */ case 1: return new Boolean(true); case 3: WorkbenchHelper.launchBrowser("http://www.aptana.com/docs/index.php/Installing_the_IE_debugger"); //$NON-NLS-1$ return new Boolean(true); default: break; } return null; } else if (source instanceof String && ((String) source).startsWith("quit_")) { //$NON-NLS-1$ MessageDialog.openInformation(shell, title, StringUtils.format(Messages.InstallDebuggerPromptStatusHandler_BrowserIsRunning, new String[] { ((String) source).substring(5) })); return null; } else if (source instanceof String && ((String) source).startsWith("installed_")) { //$NON-NLS-1$ MessageDialog.openInformation(shell, title, StringUtils.format(Messages.InstallDebuggerPromptStatusHandler_ExtensionInstalled, new String[] { ((String) source).substring(10) })); return null; } else if (source instanceof String && ((String) source).startsWith("warning_")) { //$NON-NLS-1$ MessageDialog.openWarning(shell, title, ((String) source).substring(8)); return null; } else if (source instanceof String && ((String) source).startsWith("failed_")) { //$NON-NLS-1$ MessageDialog md = new MessageDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), title, null, MessageFormat.format(Messages.InstallDebuggerPromptStatusHandler_ExtensionInstallFailed, new Object[] { ((String) source).substring(7) }), MessageDialog.ERROR, new String[] { IDialogConstants.OK_LABEL, CoreStrings.HELP }, 0); while (true) { switch (md.open()) { case IDialogConstants.OK_ID: return null; default: break; } WorkbenchHelper.launchBrowser(((String) source).indexOf("Internet Explorer") != -1 //$NON-NLS-1$ ? "http://www.aptana.com/docs/index.php/Installing_the_IE_debugger" //$NON-NLS-1$ : "http://www.aptana.com/docs/index.php/Installing_the_JavaScript_debugger"); //$NON-NLS-1$ } } IPreferenceStore store = DebugUiPlugin.getDefault().getPreferenceStore(); String pref = store.getString(IDebugUIConstants.PREF_INSTALL_DEBUGGER); if (pref != null) { if (pref.equals(MessageDialogWithToggle.ALWAYS)) { return new Boolean(true); } } String message = StringUtils.format(Messages.InstallDebuggerPromptStatusHandler_ExtensionNotInstalled, new String[] { (String) source }); MessageDialogWithToggle dialog = new MessageDialogWithToggle(shell, title, null, message, MessageDialog.INFORMATION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, CoreStrings.HELP }, 2, null, false); dialog.setPrefKey(IDebugUIConstants.PREF_INSTALL_DEBUGGER); dialog.setPrefStore(store); while (true) { switch (dialog.open()) { case IDialogConstants.YES_ID: return new Boolean(true); case IDialogConstants.NO_ID: return new Boolean(false); default: break; } WorkbenchHelper.launchBrowser(((String) source).indexOf("Internet Explorer") != -1 //$NON-NLS-1$ ? "http://www.aptana.com/docs/index.php/Installing_the_IE_debugger" //$NON-NLS-1$ : "http://www.aptana.com/docs/index.php/Installing_the_JavaScript_debugger"); //$NON-NLS-1$ } }
From source file:com.aptana.ide.debug.internal.ui.Startup.java
License:Open Source License
private ILaunchConfiguration getOrCreateDefaultLaunchConfiguration(String nature) { ILaunchConfigurationType configType = getLaunchConfigType(); ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager(); try {/*ww w .j ava 2 s . c om*/ ILaunchConfiguration[] configs = manager.getLaunchConfigurations(configType); for (int i = 0; i < configs.length; ++i) { ILaunchConfiguration config = configs[i]; if (nature.equals(config.getAttribute(ILaunchConfigurationConstants.CONFIGURATION_BROWSER_NATURE, StringUtils.EMPTY))) { return config; } } ILaunchConfigurationWorkingCopy wc = configType.newInstance(null, DebugPlugin.getDefault() .getLaunchManager().generateUniqueLaunchConfigurationNameFrom(nature + " - Internal Server")); //$NON-NLS-1$ JSLaunchConfigurationHelper.setDefaults(wc, nature); boolean showDownload = true; while (!JSLaunchConfigurationHelper.isBrowserDebugCompatible(wc.getAttribute( ILaunchConfigurationConstants.CONFIGURATION_BROWSER_EXECUTABLE, StringUtils.EMPTY))) { String browserPath = null; if (nature.equals(JSLaunchConfigurationHelper.FIREFOX)) { IPreferenceStore store = DebugUiPlugin.getDefault().getPreferenceStore(); String pref = store .getString(com.aptana.ide.debug.internal.ui.IDebugUIConstants.PREF_SKIP_FIREFOX_CHECK); if (pref == null || !pref.equals(MessageDialogWithToggle.ALWAYS)) { browserPath = showBrowserNotFoundDialog(showDownload); } } if (browserPath == null) { wc.delete(); return null; } if (browserPath.length() == 0) { JSLaunchConfigurationHelper.setBrowserDefaults(wc, nature); } else { wc.setAttribute(ILaunchConfigurationConstants.CONFIGURATION_BROWSER_EXECUTABLE, browserPath); } showDownload = false; } return wc.doSave(); } catch (CoreException e) { DebugUiPlugin.log(e); } return null; }
From source file:com.aptana.ide.editor.css.formatting.CSSCodeFormatterOptions.java
License:Open Source License
private void initFromPreferences() { IPreferenceStore preferenceStore = CSSPlugin.getDefault().getPreferenceStore(); formatterTabChar = preferenceStore.getString(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR); tabSize = preferenceStore.getInt(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE); formatterBracePositionForBlock = parseOption(preferenceStore, DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK); newlinesBetweenSelectors = preferenceStore.getBoolean(NEWLINES_BETWEEN_SELECTORS); String string = preferenceStore.getString(DefaultCodeFormatterConstants.NO_FORMATTING); if (string.length() > 0) { doFormatting = false;//www. j av a 2s . com } }