コード例 #1
0
 private void clearCache() {
   if (UnifiedEditorsPlugin.getDefault()
       .getPreferenceStore()
       .getBoolean(IPreferenceConstants.CACHE_BUST_BROWSERS)) {
     try {
       nsICacheService cache =
           (nsICacheService)
               Mozilla.getInstance()
                   .getServiceManager()
                   .getServiceByContractID(
                       "@mozilla.org/network/cache-service;1", //$NON-NLS-1$
                       nsICacheService.NS_ICACHESERVICE_IID);
       cache.evictEntries(nsICache.STORE_ANYWHERE);
     } catch (Exception e) {
       if (e instanceof XPCOMException
           && ((XPCOMException) e).errorcode == Mozilla.NS_ERROR_FILE_NOT_FOUND) {
         /*Not an error since disk cache wasn't created yet  */
         return;
       }
       IdeLog.logError(
           Activator.getDefault(),
           Messages.getString("FirefoxBrowser.Error_Clearing_Cache"),
           e); //$NON-NLS-1$
     }
   }
 }
コード例 #2
0
  /**
   * @see
   *     org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
   */
  public void initializeDefaultPreferences() {
    IPreferenceStore store = UnifiedEditorsPlugin.getDefault().getPreferenceStore();

    store.setDefault(com.aptana.ide.core.preferences.IPreferenceConstants.SHOW_LIVE_HELP, true);

    store.setDefault(IPreferenceConstants.CACHE_BUST_BROWSERS, true);
    store.setDefault(IPreferenceConstants.PIANO_KEY_DIFFERENCE, 7);
    store.setDefault(IPreferenceConstants.MATCH_BRACKETS, "true"); // $NON-NLS-1$
    store.setDefault(
        IPreferenceConstants.MATCH_BRACKETS_COLOR,
        StringConverter.asString(new RGB(150, 150, 150)));
    store.setDefault(IPreferenceConstants.SHOW_WHITESPACE, false);
    store.setDefault(IPreferenceConstants.ENABLE_WORD_WRAP, false);
    store.setDefault(IPreferenceConstants.USER_AGENT_PREFERENCE, "IE,Mozilla"); // $NON-NLS-1$
    store.setDefault(IPreferenceConstants.INSERT_ON_TAB, false);

    store.setDefault(AbstractTextEditor.PREFERENCE_NAVIGATION_SMART_HOME_END, false);
    store.setDefault(IPreferenceConstants.CONTENT_ASSIST_DELAY, 200);
    store.setDefault(IPreferenceConstants.COLORIZER_TEXT_HIGHLIGHT_ENABLED, false);
    store.setDefault(
        IPreferenceConstants.COLORIZER_TEXT_HIGHLIGHT_BACKGROUND_COLOR,
        StringConverter.asString(new RGB(212, 212, 212)));
    store.setDefault(IPreferenceConstants.COLORIZER_MAXCOLUMNS, 500);
    store.setDefault(IPreferenceConstants.EXPAND_EDITOR_OPTIONS, true);
    store.setDefault(IPreferenceConstants.EXPAND_TOKENS, true);
    store.setDefault(IPreferenceConstants.EXPAND_REGIONS, false);
    store.setDefault(IPreferenceConstants.SHOW_ERRORS, true);
    store.setDefault(IPreferenceConstants.SHOW_WARNINGS, false);
    store.setDefault(IPreferenceConstants.SHOW_INFOS, false);
    store.setDefault(IPreferenceConstants.DRAG_AND_DROP_ENABLED, true);
    store.setDefault(IPreferenceConstants.SORT_OUTLINE_ALPHABETICALLY, false);
    store.setDefault(IPreferenceConstants.PARSER_OFF_UI, true);

    // Tasks
    store.setDefault(IPreferenceConstants.COMPILER_TASK_CASE_SENSITIVE, true);
    store.setDefault(IPreferenceConstants.COMPILER_TASK_TAGS, "TODO,FIXME,XXX,OPTIMIZE");
    store.setDefault(IPreferenceConstants.COMPILER_TASK_PRIORITIES, "NORMAL,HIGH,NORMAL,LOW");

    // These two _must_ be set as a preference, or UnifiedEditor will crash
    // hard without
    // warning on initialization.
    // store.setDefault(ColorizerPreferencePage.HRD_SET, "default");
    // store.setDefault(ColorizerPreferencePage.USE_BACK, true);
    //
    // store.setDefault(ColorizerPreferencePage.FULL_BACK, true);
    // store.setDefault(ColorizerPreferencePage.PAIRS_MATCH,
    // "PAIRS_OUTLINE");
    //
    // store.setDefault(ColorizerPreferencePage.HORZ_CROSS, true);
    // store.setDefault(ColorizerPreferencePage.VERT_CROSS, true);

    // To set preferences for AbstractTextEditor
    store = org.eclipse.ui.internal.editors.text.EditorsPlugin.getDefault().getPreferenceStore();
    store.setToDefault(AbstractTextEditor.PREFERENCE_NAVIGATION_SMART_HOME_END);
    store.setDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_UNDO_HISTORY_SIZE, 500);
  }
コード例 #3
0
  /**
   * @see
   *     org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
   */
  public void initializeDefaultPreferences() {

    IPreferenceStore store = JSPlugin.getDefault().getPreferenceStore();
    store.setDefault(IPreferenceConstants.ENABLE_NO_VALIDATE_COMMENT, false);
    store.setDefault(IPreferenceConstants.SHOW_JS_TOOLBAR, true);
    store.setDefault(IPreferenceConstants.PREFERENCE_COMMENT_INDENT_USE_STAR, true);
    store.setDefault(
        com.aptana.ide.editors.preferences.IPreferenceConstants.AUTO_BRACKET_INSERTION,
        "INSERT"); //$NON-NLS-1$
    store.setDefault(
        com.aptana.ide.editors.preferences.IPreferenceConstants.CODE_ASSIST_AUTO_ACTIVATION, true);
    store.setDefault(IPreferenceConstants.AUTO_FORMAT_ON_CLOSE_CURLY, true);
    store.setDefault(IPreferenceConstants.AUTO_INDENT_ON_CARRIAGE_RETURN, true);
    store.setDefault(IPreferenceConstants.PREFERENCE_PRIVATE_FIELD_INDICATOR, "_"); // $NON-NLS-1$
    store.setDefault(
        com.aptana.ide.editors.preferences.IPreferenceConstants.VALIDATORS_LIST,
        Messages.PreferenceInitializer_Mozilla_javascript_validator);

    store.setDefault(
        IPreferenceConstants.LOADED_ENVIRONMENTS,
        JSLanguageEnvironment.DOM_5
            + ","
            + JSLanguageEnvironment.DOM_3
            + ","
            + JSLanguageEnvironment.DOM_1_2
            + "," //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
            + JSLanguageEnvironment.DOM_0);

    PreferenceConverter.setDefault(
        store,
        IPreferenceConstants.JSEDITOR_PROPOSALS_FOREGROUND_COLOR,
        IJSColorConstants.PROPOSALS_FOREGROUND);
    PreferenceConverter.setDefault(
        store,
        IPreferenceConstants.JSEDITOR_PROPOSALS_BACKGROUND_COLOR,
        IJSColorConstants.PROPOSALS_BACKGROUND);
    PreferenceConverter.setDefault(
        store, IPreferenceConstants.JSEDITOR_DEFAULT_COLOR, IJSColorConstants.DEFAULT);
    PreferenceConverter.setDefault(
        store, IPreferenceConstants.JSEDITOR_KEYWORD_COLOR, IJSColorConstants.KEYWORD);
    PreferenceConverter.setDefault(
        store, IPreferenceConstants.JSEDITOR_NATIVETYPE_COLOR, IJSColorConstants.NATIVETYPE);
    PreferenceConverter.setDefault(
        store, IPreferenceConstants.JSEDITOR_PUNCTUATOR_COLOR, IJSColorConstants.PUNCTUATOR);
    PreferenceConverter.setDefault(
        store, IPreferenceConstants.JSEDITOR_RESERVED_COLOR, IJSColorConstants.RESERVED);
    PreferenceConverter.setDefault(
        store, IPreferenceConstants.JSEDITOR_FUTURE_COLOR, IJSColorConstants.FUTURE);
    PreferenceConverter.setDefault(
        store, IPreferenceConstants.JSEDITOR_STRING_COLOR, IJSColorConstants.STRING);
    PreferenceConverter.setDefault(
        store, IPreferenceConstants.JSEDITOR_NUMBER_COLOR, IJSColorConstants.NUMBER);
    PreferenceConverter.setDefault(
        store, IPreferenceConstants.JSEDITOR_LITERAL_COLOR, IJSColorConstants.LITERAL);
    PreferenceConverter.setDefault(
        store, IPreferenceConstants.JSEDITOR_COMMENT_COLOR, IJSColorConstants.COMMENT);
    PreferenceConverter.setDefault(
        store, IPreferenceConstants.JSEDITOR_DOCUMENTATION_COLOR, IJSColorConstants.DOCUMENTATION);
    PreferenceConverter.setDefault(
        store, IPreferenceConstants.JSEDITOR_ERROR_COLOR, IJSColorConstants.ERROR);
    PreferenceConverter.setDefault(
        store, IPreferenceConstants.JSEDITOR_HTMLDOM_COLOR, IJSColorConstants.HTMLDOM);
    PreferenceConverter.setDefault(
        store, IPreferenceConstants.JSEDITOR_JSCORE_COLOR, IJSColorConstants.JSCORE);

    PreferenceConverter.setDefault(
        store, IPreferenceConstants.JSCOMMENTEDITOR_TEXT_COLOR, IJSCommentColorConstants.TEXT);
    PreferenceConverter.setDefault(
        store,
        IPreferenceConstants.JSCOMMENTEDITOR_DELIMITER_COLOR,
        IJSCommentColorConstants.DELIMITER);

    PreferenceConverter.setDefault(
        store, IPreferenceConstants.SCRIPTDOCEDITOR_TEXT_COLOR, IScriptDocColorConstants.TEXT);
    PreferenceConverter.setDefault(
        store, IPreferenceConstants.SCRIPTDOCEDITOR_KEYWORDCOLOR, IScriptDocColorConstants.KEYWORD);
    PreferenceConverter.setDefault(
        store,
        IPreferenceConstants.SCRIPTDOCEDITOR_USER_KEYWORD_COLOR,
        IScriptDocColorConstants.KEYWORD);
    PreferenceConverter.setDefault(
        store,
        IPreferenceConstants.SCRIPTDOCEDITOR_IDENTIFIER_COLOR,
        IScriptDocColorConstants.IDENTIFIER);
    PreferenceConverter.setDefault(
        store,
        IPreferenceConstants.SCRIPTDOCEDITOR_PUNCTUATOR_COLOR,
        IScriptDocColorConstants.PUNCTUATOR);
    PreferenceConverter.setDefault(
        store,
        IPreferenceConstants.SCRIPTDOCEDITOR_DELIMITER_COLOR,
        IScriptDocColorConstants.DELIMITER);

    store.setDefault(
        com.aptana.ide.editors.preferences.IPreferenceConstants.IGNORE_PROBLEMS,
        "~~~~~~~~-1~~~~Undefined variable.*####~~~~~~~~-1~~~~Expected an identifier and instead saw 'const'.####~~~~~~~~-1~~~~.*identifier is a reserved word.*####~~~~~~~~-1~~~~All debugger statements should be removed."); //$NON-NLS-1$
    store.setDefault(
        IPreferenceConstants.JSEDITOR_INITIAL_CONTENTS,
        Messages.PreferenceInitializer_InitialFileContents);
    store.setDefault(
        IPreferenceConstants.JSEDITOR_INITIAL_FILE_NAME,
        Messages.PreferenceInitializer_NewFileName);
    store.setDefault(
        IPreferenceConstants.SCRIPTDOCEDITOR_INITIAL_FILE_NAME,
        Messages.PreferenceInitializer_Default_sdoc_filename);
    store.setDefault(
        com.aptana.ide.editors.preferences.IPreferenceConstants.SHOW_PAIR_MATCHES,
        com.aptana.ide.editors.preferences.IPreferenceConstants.BOTH);
    PreferenceConverter.setDefault(
        store,
        com.aptana.ide.editors.preferences.IPreferenceConstants.PAIR_MATCHING_COLOR,
        new RGB(192, 192, 192));

    IPreferenceStore unifiedStore = UnifiedEditorsPlugin.getDefault().getPreferenceStore();
    unifiedStore.setDefault(
        FoldingExtensionPointLoader.createEnablePreferenceId(JSMimeType.MimeType), true);
    unifiedStore.setDefault(
        FoldingExtensionPointLoader.createEnablePreferenceId(ScriptDocMimeType.MimeType), true);

    store.setDefault(
        DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_IF_STATEMENT,
        CommentsTabPage.INSERT);
    store.setDefault(
        DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_RETURN_STATEMENT,
        CommentsTabPage.INSERT);
    store.setDefault(
        DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT,
        CommentsTabPage.INSERT);
    store.setDefault(
        DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT,
        CommentsTabPage.INSERT);
    store.setDefault(
        DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT,
        CommentsTabPage.INSERT);
    store.setDefault(
        DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT,
        CommentsTabPage.INSERT);
    store.setDefault(
        DefaultCodeFormatterConstants.FORMATTER_KEEP_THEN_STATEMENT_ON_SAME_LINE,
        Boolean.FALSE.toString());
    store.setDefault(
        DefaultCodeFormatterConstants.FORMATTER_KEEP_SIMPLE_IF_ON_ONE_LINE,
        Boolean.FALSE.toString());
    store.setDefault(
        DefaultCodeFormatterConstants.FORMATTER_KEEP_ELSE_STATEMENT_ON_SAME_LINE,
        Boolean.FALSE.toString());
    store.setDefault(
        DefaultCodeFormatterConstants.FORMATTER_COMPACT_ELSE_IF, Boolean.FALSE.toString());
    store.setDefault(
        DefaultCodeFormatterConstants.FORMATTER_KEEP_GUARDIAN_CLAUSE_ON_ONE_LINE,
        Boolean.FALSE.toString());
    store.setDefault(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, " "); // $NON-NLS-1$
    store.setDefault(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE, "4"); // $NON-NLS-1$
    store.setDefault(
        DefaultCodeFormatterConstants.FORMATTER_INDENT_STATEMENTS_COMPARE_TO_BODY,
        Boolean.TRUE.toString());
    store.setDefault(
        DefaultCodeFormatterConstants.FORMATTER_INDENT_STATEMENTS_COMPARE_TO_BLOCK,
        Boolean.TRUE.toString());
    store.setDefault(
        DefaultCodeFormatterConstants.FORMATTER_INDENT_SWITCHSTATEMENTS_COMPARE_TO_SWITCH,
        Boolean.TRUE.toString());
    store.setDefault(
        DefaultCodeFormatterConstants.FORMATTER_INDENT_SWITCHSTATEMENTS_COMPARE_TO_CASES,
        Boolean.TRUE.toString());
    store.setDefault(
        DefaultCodeFormatterConstants.FORMATTER_INDENT_BREAKS_COMPARE_TO_CASES,
        Boolean.TRUE.toString());
    store.setDefault(
        DefaultCodeFormatterConstants.FORMATTER_BLANK_LINES_BEFORE_METHOD, "1"); // $NON-NLS-1$
    store.setDefault(
        DefaultCodeFormatterConstants.FORMATTER_BLANK_LINES_AT_BEGINNING_OF_METHOD_BODY,
        "0"); //$NON-NLS-1$
    store.setDefault(
        DefaultCodeFormatterConstants.FORMATTER_PRESERVE_EXTRA_CARRIAGE_RETURNS,
        Boolean.TRUE.toString()); // $NON-NLS-1$

    store.setDefault(
        DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION,
        DefaultCodeFormatterConstants.END_OF_LINE);
    store.setDefault(
        DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK,
        DefaultCodeFormatterConstants.END_OF_LINE);
    store.setDefault(
        DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK_IN_CASE,
        DefaultCodeFormatterConstants.END_OF_LINE);
    store.setDefault(
        DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH,
        DefaultCodeFormatterConstants.END_OF_LINE);
    store.setDefault(
        DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ARRAY_INITIALIZER,
        DefaultCodeFormatterConstants.END_OF_LINE);
    store.setDefault(
        DefaultCodeFormatterConstants.FORMATTER_KEEP_EMPTY_ARRAY_INITIALIZER_ON_ONE_LINE,
        Boolean.TRUE.toString());
  }