List of usage examples for org.eclipse.jface.preference IPreferenceStore getString
String getString(String name);
From source file:com.aptana.ide.editor.css.formatting.CSSCodeFormatterOptions.java
License:Open Source License
/** * @param store/*w ww . j a v a 2 s. c om*/ * @param id * @return option */ public final int parseOption(IPreferenceStore store, String id) { String string = store.getString(id); return parseOption(string); }
From source file:com.aptana.ide.editor.css.MultiPageCSSEditor.java
License:Open Source License
private void updatePreview() { String url = null;//from w w w .jav a 2 s .c om IEditorInput input = this.editor.getEditorInput(); try { if (input instanceof FileEditorInput) { url = getExternalPreviewUrl(input); } if (url != null && !"".equals(url)) //$NON-NLS-1$ { this.setBrowserURL(url); } else { boolean useTemplate = CSSPlugin.getDefault().getPreferenceStore() .getBoolean(IPreferenceConstants.CSSEDITOR_BROWSER_USE_TEMPLATE_PREFERENCE); if (!useTemplate) { url = CSSPlugin.getDefault().getPreferenceStore() .getString(IPreferenceConstants.CSSEDITOR_BROWSER_URL_PREFERENCE); this.setBrowserURL(url); } else { IDocumentProvider docProvider = editor.getDocumentProvider(); String css = docProvider.getDocument(input).get(); IPreferenceStore store = CSSPlugin.getDefault().getPreferenceStore(); String template = store.getString(IPreferenceConstants.CSSEDITOR_BROWSER_TEMPLATE_PREFERENCE); css = "<html>" + template + "<style>" + css + "</style></html>"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ String charset = null; if (input instanceof IFileEditorInput) { charset = ((IFileEditorInput) input).getFile().getCharset(); } else if (docProvider instanceof TextFileDocumentProvider) { charset = ((TextFileDocumentProvider) docProvider).getEncoding(input); if (charset == null) { charset = ((TextFileDocumentProvider) docProvider).getDefaultEncoding(); } } File tmpFile; tmpFile = writeTemporaryPreviewFile(editor, input, css, charset); String tmpUrl = CoreUIUtils.getURI(tmpFile, false); if (prevTempFile != null && prevTempFile.equals(tmpFile)) { setBrowserURL(tmpUrl); } else { if (prevTempFile != null) { prevTempFile.delete(); } prevTempFile = tmpFile; setBrowserURL(tmpUrl); } } } } catch (Exception e) { IdeLog.logError(CSSPlugin.getDefault(), Messages.MultiPageCSSEditor_ERR_UnableToUpdatePreview, e); } }
From source file:com.aptana.ide.editor.css.wizards.CssNewWizard.java
License:Open Source License
/** * @see com.aptana.ide.editors.wizards.SimpleNewFileWizard#createNewFilePage(org.eclipse.jface.viewers.ISelection) */// w w w.jav a 2 s . co m protected SimpleNewWizardPage createNewFilePage(ISelection selection) { SimpleNewWizardPage page = new SimpleNewWizardPage(selection); page.setRequiredFileExtensions(new String[] { "css" }); //$NON-NLS-1$ page.setTitle(Messages.CssNewWizard_WizardTitle); page.setDescription(Messages.CssNewWizard_WizardDescription); IPreferenceStore store = CSSPlugin.getDefault().getPreferenceStore(); String fileName = store.getString(IPreferenceConstants.CSSEDITOR_INITIAL_FILE_NAME); page.setDefaultFileName(fileName); return page; }
From source file:com.aptana.ide.editor.css.wizards.CssNewWizard.java
License:Open Source License
/** * @see com.aptana.ide.editors.wizards.SimpleNewFileWizard#getInitialFileContents() *//*w ww .j av a2 s . c om*/ protected String getInitialFileContents() { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); IPreferenceStore store = CSSPlugin.getDefault().getPreferenceStore(); String contents = store.getString(IPreferenceConstants.CSSEDITOR_INITIAL_CONTENTS); pw.print(contents); pw.close(); return sw.toString(); }
From source file:com.aptana.ide.editor.erb.wizards.ERBNewFileWizard.java
License:Open Source License
/** * @see com.aptana.ide.editors.wizards.SimpleNewFileWizard#createNewFilePage(org.eclipse.jface.viewers.ISelection) *///from ww w . j a v a 2s . c o m protected SimpleNewWizardPage createNewFilePage(ISelection selection) { SimpleNewWizardPage page = new SimpleNewWizardPage(selection); page.setRequiredFileExtensions(new String[] { "erb", "rhtml" }); //$NON-NLS-1$ page.setTitle(Messages.ERBNewFileWizard_Filename); page.setDescription(Messages.ERBNewFileWizard_Description); IPreferenceStore store = ERBPlugin.getDefault().getPreferenceStore(); String filename = store.getString(IPreferenceConstants.ERBEDITOR_INITIAL_FILE_NAME); String extension = getProperExtension(selection); if (extension != null) { IPath path = new Path(filename); String oldExtension = path.getFileExtension(); int toRemove = 0; if (oldExtension != null) toRemove = oldExtension.length() + 1; filename = filename.substring(0, filename.length() - toRemove) + extension; } page.setDefaultFileName(filename); return page; }
From source file:com.aptana.ide.editor.erb.wizards.ERBNewFileWizard.java
License:Open Source License
/** * @see com.aptana.ide.editors.wizards.SimpleNewFileWizard#getInitialFileContents() *//* w ww . j a va 2s .c o m*/ protected String getInitialFileContents() { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); IPreferenceStore store = ERBPlugin.getDefault().getPreferenceStore(); String contents = store.getString(IPreferenceConstants.ERBEDITOR_INITIAL_CONTENTS); pw.println(contents); pw.close(); return sw.toString(); }
From source file:com.aptana.ide.editor.js.formatting.HTMLCodeFormatterOptions.java
License:Open Source License
private void initFromPreferences() { AbstractUIPlugin abstractUIPlugin = ((AbstractUIPlugin) Platform.getPlugin("com.aptana.ide.editor.html")); //$NON-NLS-1$ if ((abstractUIPlugin != null)) { IPreferenceStore preferenceStore = abstractUIPlugin.getPreferenceStore(); formatterTabChar = preferenceStore.getString(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR); tabSize = preferenceStore.getInt(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE); } else {/*from w ww . jav a 2 s .c o m*/ initDefaults(); } }
From source file:com.aptana.ide.editor.js.formatting.JSCodeFormatterOptions.java
License:Open Source License
private void initFromPreferences() { IPreferenceStore preferenceStore = JSPlugin.getDefault().getPreferenceStore(); insertNewLineBeforeReturn = parseInsert(preferenceStore .getString(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_RETURN_STATEMENT)); insertNewLineBeforeIf = parseInsert(preferenceStore .getString(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_IF_STATEMENT)); insertNewLineBeforeElse = parseInsert(preferenceStore .getString(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT)); insertNewLineBeforeCatch = parseInsert(preferenceStore .getString(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT)); insertNewLineBeforeFinally = parseInsert(preferenceStore.getString( DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT)); insertNewLineBeforeWhile = parseInsert(preferenceStore .getString(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT)); keepThenSameLine = preferenceStore/* ww w . j ava 2 s . co m*/ .getBoolean(DefaultCodeFormatterConstants.FORMATTER_KEEP_THEN_STATEMENT_ON_SAME_LINE); keepSimpleIfOnOneLine = preferenceStore .getBoolean(DefaultCodeFormatterConstants.FORMATTER_KEEP_SIMPLE_IF_ON_ONE_LINE); keepElseStatementOnSameLine = preferenceStore .getBoolean(DefaultCodeFormatterConstants.FORMATTER_KEEP_ELSE_STATEMENT_ON_SAME_LINE); compactElseIf = preferenceStore.getBoolean(DefaultCodeFormatterConstants.FORMATTER_COMPACT_ELSE_IF); keepGuardianClauseOnOneLine = preferenceStore .getBoolean(DefaultCodeFormatterConstants.FORMATTER_KEEP_GUARDIAN_CLAUSE_ON_ONE_LINE); formatterTabChar = preferenceStore.getString(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR); tabSize = preferenceStore.getInt(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE); indentStatementsCompareToBody = preferenceStore .getBoolean(DefaultCodeFormatterConstants.FORMATTER_INDENT_STATEMENTS_COMPARE_TO_BODY); indentStatementsCompareToBlock = preferenceStore .getBoolean(DefaultCodeFormatterConstants.FORMATTER_INDENT_STATEMENTS_COMPARE_TO_BLOCK); indentStatementsCompareToSwitch = preferenceStore .getBoolean(DefaultCodeFormatterConstants.FORMATTER_INDENT_SWITCHSTATEMENTS_COMPARE_TO_SWITCH); indentStatementsCompareToCases = preferenceStore .getBoolean(DefaultCodeFormatterConstants.FORMATTER_INDENT_SWITCHSTATEMENTS_COMPARE_TO_CASES); indentBreaksCompareToCases = preferenceStore .getBoolean(DefaultCodeFormatterConstants.FORMATTER_INDENT_BREAKS_COMPARE_TO_CASES); indentEmptyLines = preferenceStore.getBoolean(DefaultCodeFormatterConstants.FORMATTER_INDENT_EMPTY_LINES); blankLinesBeforeMethod = preferenceStore .getInt(DefaultCodeFormatterConstants.FORMATTER_BLANK_LINES_BEFORE_METHOD); blankLinesInStartOfMethodBody = preferenceStore .getInt(DefaultCodeFormatterConstants.FORMATTER_BLANK_LINES_AT_BEGINNING_OF_METHOD_BODY); preserveLineBreaks = preferenceStore .getBoolean(DefaultCodeFormatterConstants.FORMATTER_PRESERVE_EXTRA_CARRIAGE_RETURNS); formatterBracePositionForMethodDecl = parseOption(preferenceStore, DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION); formatterBracePositionForBlock = parseOption(preferenceStore, DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK); formatterBracePositionForBlockInCase = parseOption(preferenceStore, DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK_IN_CASE); formatterBracePositionForBlockInSwitch = parseOption(preferenceStore, DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH); formatterBracePositionForArrayInitializer = parseOption(preferenceStore, DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ARRAY_INITIALIZER); keepEmptyArrayInitializerOnOneLine = preferenceStore .getBoolean(DefaultCodeFormatterConstants.FORMATTER_KEEP_EMPTY_ARRAY_INITIALIZER_ON_ONE_LINE); addSpaceAfterFunctionDeclaration = preferenceStore .getBoolean(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_CLOSING_BRACE_IN_BLOCK); String string = preferenceStore.getString(DefaultCodeFormatterConstants.NO_FORMATTING); if (string.length() > 0) { doFormatting = false; } }
From source file:com.aptana.ide.editor.js.outline.JSLabelProvider.java
License:Open Source License
/** * updatePrivateMemberPrefix//w w w . java 2 s . com * */ private void updatePrivateMemberPrefix() { // get JS preference store IPreferenceStore prefStore = JSPlugin.getDefault().getPreferenceStore(); // get value String prefix = prefStore.getString(IPreferenceConstants.PREFERENCE_PRIVATE_FIELD_INDICATOR); // store value UnifiedOutlineProvider.getInstance().setPrivateMemberPrefix(JSMimeType.MimeType, prefix); }
From source file:com.aptana.ide.editor.js.wizards.JsNewWizard.java
License:Open Source License
/** * @see com.aptana.ide.editors.wizards.SimpleNewFileWizard#createNewFilePage(org.eclipse.jface.viewers.ISelection) *///from w w w .j a v a 2s . c o m protected SimpleNewWizardPage createNewFilePage(ISelection selection) { SimpleNewWizardPage page = new SimpleNewWizardPage(selection); page.setRequiredFileExtensions(new String[] { "js" }); //$NON-NLS-1$ page.setTitle(Messages.JsNewWizard_JSFile); page.setDescription(Messages.JsNewWizard_CreateJSFile); IPreferenceStore store = JSPlugin.getDefault().getPreferenceStore(); String fileName = store.getString(IPreferenceConstants.JSEDITOR_INITIAL_FILE_NAME); page.setDefaultFileName(fileName); return page; }