Search in sources :

Example 91 with IEclipsePreferences

use of org.eclipse.core.runtime.preferences.IEclipsePreferences in project eclipse-integration-commons by spring-projects.

the class GlobalPreferenceEnhancer method enhanceM2EPreferences.

public void enhanceM2EPreferences() {
    IEclipsePreferences m2eCorePrefs = InstanceScope.INSTANCE.getNode(M2E_CORE_BUNDLE_ID);
    if (m2eCorePrefs != null) {
        m2eCorePrefs.putBoolean(P_HIDE_FOLDERS_OF_NESTED_PROJECTS, true);
        m2eCorePrefs.putBoolean(P_DEFAULT_POM_EDITOR_PAGE, true);
        m2eCorePrefs.putBoolean(P_UPDATE_INDEXES, false);
        try {
            m2eCorePrefs.flush();
        } catch (BackingStoreException e) {
            handleException(e);
        }
    }
}
Also used : IEclipsePreferences(org.eclipse.core.runtime.preferences.IEclipsePreferences) BackingStoreException(org.osgi.service.prefs.BackingStoreException)

Example 92 with IEclipsePreferences

use of org.eclipse.core.runtime.preferences.IEclipsePreferences in project eclipse-integration-commons by spring-projects.

the class GlobalPreferenceEnhancer method enhanceJDTPreferences.

public void enhanceJDTPreferences() {
    IEclipsePreferences jdtCorePrefs = InstanceScope.INSTANCE.getNode(JDT_CORE_BUNDLE_ID);
    if (jdtCorePrefs != null) {
        jdtCorePrefs.put(COMPILER_PB_NON_NLS_STRING_LITERAL, "ignore");
        try {
            jdtCorePrefs.flush();
        } catch (BackingStoreException e) {
            handleException(e);
        }
    }
    IEclipsePreferences jdtUiPrefs = InstanceScope.INSTANCE.getNode(JDT_UI_BUNDLE_ID);
    if (jdtUiPrefs != null) {
        jdtUiPrefs.putBoolean(EDITOR_SMART_PASTE, true);
        jdtUiPrefs.putBoolean(EDITOR_ESCAPE_STRINGS, true);
        jdtUiPrefs.putInt(CODEASSIST_AUTOACTIVATION_DELAY, 40);
        // jdtUiPrefs.put(CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVA, "_.abcdefghijklmnopqrstuvwxyz");
        jdtUiPrefs.putBoolean(EDITOR_SMART_SEMICOLON, true);
        jdtUiPrefs.putBoolean(EDITOR_SMART_OPENING_BRACE, true);
        jdtUiPrefs.putBoolean(EDITOR_SMART_BACKSPACE, true);
        jdtUiPrefs.putBoolean(EDITOR_SMART_TAB, true);
        try {
            jdtUiPrefs.flush();
        } catch (BackingStoreException e) {
            handleException(e);
        }
    }
}
Also used : IEclipsePreferences(org.eclipse.core.runtime.preferences.IEclipsePreferences) BackingStoreException(org.osgi.service.prefs.BackingStoreException)

Example 93 with IEclipsePreferences

use of org.eclipse.core.runtime.preferences.IEclipsePreferences in project eclipse-integration-commons by spring-projects.

the class GlobalPreferenceEnhancer method undoJDTEnhance.

public void undoJDTEnhance() {
    IEclipsePreferences jdtCorePrefs = InstanceScope.INSTANCE.getNode(JDT_CORE_BUNDLE_ID);
    if (jdtCorePrefs != null) {
        jdtCorePrefs.remove(COMPILER_PB_NON_NLS_STRING_LITERAL);
        try {
            jdtCorePrefs.flush();
        } catch (BackingStoreException e) {
            handleException(e);
        }
    }
    IEclipsePreferences jdtUiPrefs = InstanceScope.INSTANCE.getNode(JDT_UI_BUNDLE_ID);
    if (jdtUiPrefs != null) {
        jdtUiPrefs.remove(EDITOR_SMART_PASTE);
        jdtUiPrefs.remove(EDITOR_ESCAPE_STRINGS);
        jdtUiPrefs.remove(CODEASSIST_AUTOACTIVATION_DELAY);
        jdtUiPrefs.remove(CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVA);
        jdtUiPrefs.remove(EDITOR_SMART_SEMICOLON);
        jdtUiPrefs.remove(EDITOR_SMART_OPENING_BRACE);
        jdtUiPrefs.remove(EDITOR_SMART_BACKSPACE);
        jdtUiPrefs.remove(EDITOR_SMART_TAB);
        try {
            jdtUiPrefs.flush();
        } catch (BackingStoreException e) {
            handleException(e);
        }
    }
}
Also used : IEclipsePreferences(org.eclipse.core.runtime.preferences.IEclipsePreferences) BackingStoreException(org.osgi.service.prefs.BackingStoreException)

Example 94 with IEclipsePreferences

use of org.eclipse.core.runtime.preferences.IEclipsePreferences in project webtools.sourceediting by eclipse.

the class JSONCatalogPreferencePage method storePreferences.

private void storePreferences() {
    IEclipsePreferences prefs = getPreferences();
    try {
        String value = new EntryParser().serialize(entries.getEntries());
        prefs.put(EntryParser.JSON_CATALOG_ENTRIES, value);
        JSONCorePlugin.getDefault().clearCatalogCache();
        JSONSchemaProcessor.clearCache();
    } catch (Exception e) {
        logException(e);
    }
}
Also used : IEclipsePreferences(org.eclipse.core.runtime.preferences.IEclipsePreferences) EntryParser(org.eclipse.wst.json.core.internal.schema.catalog.EntryParser)

Example 95 with IEclipsePreferences

use of org.eclipse.core.runtime.preferences.IEclipsePreferences in project webtools.sourceediting by eclipse.

the class CSSCorePreferenceInitializer method initializeDefaultPreferences.

public void initializeDefaultPreferences() {
    IEclipsePreferences node = DefaultScope.INSTANCE.getNode(CSSCorePlugin.getDefault().getBundle().getSymbolicName());
    // formatting preferences
    node.putInt(CSSCorePreferenceNames.LINE_WIDTH, 72);
    node.putBoolean(CSSCorePreferenceNames.CLEAR_ALL_BLANK_LINES, false);
    node.put(CSSCorePreferenceNames.INDENTATION_CHAR, CSSCorePreferenceNames.TAB);
    node.putInt(CSSCorePreferenceNames.INDENTATION_SIZE, 1);
    // cleanup preferences
    node.putBoolean(CSSCorePreferenceNames.QUOTE_ATTR_VALUES, true);
    node.putBoolean(CSSCorePreferenceNames.FORMAT_SOURCE, true);
    // code generation preferences
    // $NON-NLS-1$
    node.put(CommonEncodingPreferenceNames.INPUT_CODESET, "");
    // $NON-NLS-1$
    String defaultEnc = "UTF-8";
    // $NON-NLS-1$
    String systemEnc = System.getProperty("file.encoding");
    if (systemEnc != null) {
        // $NON-NLS-1$
        defaultEnc = CommonCharsetNames.getPreferredDefaultIanaName(systemEnc, "UTF-8");
    }
    node.put(CommonEncodingPreferenceNames.OUTPUT_CODESET, defaultEnc);
    // $NON-NLS-1$
    node.put(CommonEncodingPreferenceNames.END_OF_LINE_CODE, "");
    // this could be made smarter by actually looking up the content
    // type's valid extensions
    // $NON-NLS-1$
    node.put(CSSCorePreferenceNames.DEFAULT_EXTENSION, "css");
    // additional css core preferences
    node.putInt(CSSCorePreferenceNames.FORMAT_PROP_PRE_DELIM, 0);
    node.putInt(CSSCorePreferenceNames.FORMAT_PROP_POST_DELIM, 1);
    // $NON-NLS-1$
    node.put(CSSCorePreferenceNames.FORMAT_QUOTE, "\"");
    // $NON-NLS-1$
    node.put(CSSCorePreferenceNames.FORMAT_BETWEEN_VALUE, " ");
    node.putBoolean(CSSCorePreferenceNames.FORMAT_SPACE_BETWEEN_SELECTORS, true);
    node.putBoolean(CSSCorePreferenceNames.FORMAT_QUOTE_IN_URI, true);
    node.putBoolean(CSSCorePreferenceNames.WRAPPING_ONE_PER_LINE, true);
    node.putBoolean(CSSCorePreferenceNames.WRAPPING_PROHIBIT_WRAP_ON_ATTR, true);
    node.putBoolean(CSSCorePreferenceNames.WRAPPING_NEWLINE_ON_OPEN_BRACE, false);
    node.putInt(CSSCorePreferenceNames.CASE_IDENTIFIER, CSSCorePreferenceNames.LOWER);
    node.putInt(CSSCorePreferenceNames.CASE_SELECTOR, CSSCorePreferenceNames.LOWER);
    node.putInt(CSSCorePreferenceNames.CASE_PROPERTY_NAME, CSSCorePreferenceNames.LOWER);
    node.putInt(CSSCorePreferenceNames.CASE_PROPERTY_VALUE, CSSCorePreferenceNames.LOWER);
    // CSS cleanup preferences
    node.putInt(CSSCorePreferenceNames.CLEANUP_CASE_IDENTIFIER, CSSCorePreferenceNames.ASIS);
    node.putInt(CSSCorePreferenceNames.CLEANUP_CASE_PROPERTY_NAME, CSSCorePreferenceNames.ASIS);
    node.putInt(CSSCorePreferenceNames.CLEANUP_CASE_PROPERTY_VALUE, CSSCorePreferenceNames.ASIS);
    node.putInt(CSSCorePreferenceNames.CLEANUP_CASE_SELECTOR, CSSCorePreferenceNames.ASIS);
}
Also used : IEclipsePreferences(org.eclipse.core.runtime.preferences.IEclipsePreferences)

Aggregations

IEclipsePreferences (org.eclipse.core.runtime.preferences.IEclipsePreferences)339 BackingStoreException (org.osgi.service.prefs.BackingStoreException)81 Test (org.junit.Test)37 ProjectScope (org.eclipse.core.resources.ProjectScope)24 DefaultScope (org.eclipse.core.runtime.preferences.DefaultScope)24 CoreException (org.eclipse.core.runtime.CoreException)22 IScopeContext (org.eclipse.core.runtime.preferences.IScopeContext)17 IStatus (org.eclipse.core.runtime.IStatus)16 InstanceScope (org.eclipse.core.runtime.preferences.InstanceScope)15 IOException (java.io.IOException)13 IProject (org.eclipse.core.resources.IProject)13 Status (org.eclipse.core.runtime.Status)13 ArrayList (java.util.ArrayList)11 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)11 ContentAssistProcessorTestBuilder (org.eclipse.xtext.ui.testing.ContentAssistProcessorTestBuilder)10 File (java.io.File)9 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)9 IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)9 Job (org.eclipse.core.runtime.jobs.Job)8 Preferences (org.osgi.service.prefs.Preferences)8