Package org.eclipse.core.runtime

Examples of org.eclipse.core.runtime.Preferences


public class CleanupProcessorXML extends AbstractStructuredCleanupProcessor {
  protected IStructuredCleanupPreferences fCleanupPreferences = null;
 
  public void cleanupModel(IStructuredModel structuredModel) {
    Preferences preferences = getModelPreferences();
    if (preferences != null && preferences.getBoolean(XMLCorePreferenceNames.FIX_XML_DECLARATION)) {
      IDOMDocument document = ((DOMModelImpl) structuredModel).getDocument();
      if (!fixExistingXmlDecl(document)) {
        String encoding = preferences.getString(CommonEncodingPreferenceNames.OUTPUT_CODESET);
        Node xml = document.createProcessingInstruction("xml", "version=\"1.0\" " + "encoding=\"" + encoding +"\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
        document.insertBefore(xml, document.getFirstChild());
      }
    }
    super.cleanupModel(structuredModel);
View Full Code Here


  public IStructuredFormatPreferences getFormatPreferences() {
    if (fFormatPreferences == null) {
      fFormatPreferences = new StructuredFormatPreferencesXML();

      Preferences preferences = getModelPreferences();
      if (preferences != null) {
        fFormatPreferences.setLineWidth(preferences.getInt(XMLCorePreferenceNames.LINE_WIDTH));
        ((StructuredFormatPreferencesXML) fFormatPreferences).setSplitMultiAttrs(preferences.getBoolean(XMLCorePreferenceNames.SPLIT_MULTI_ATTRS));
        ((StructuredFormatPreferencesXML) fFormatPreferences).setAlignEndBracket(preferences.getBoolean(XMLCorePreferenceNames.ALIGN_END_BRACKET));
        ((StructuredFormatPreferencesXML) fFormatPreferences).setPreservePCDATAContent(preferences.getBoolean(XMLCorePreferenceNames.PRESERVE_CDATACONTENT));
        fFormatPreferences.setClearAllBlankLines(preferences.getBoolean(XMLCorePreferenceNames.CLEAR_ALL_BLANK_LINES));

        char indentChar = ' ';
        String indentCharPref = preferences.getString(XMLCorePreferenceNames.INDENTATION_CHAR);
        if (XMLCorePreferenceNames.TAB.equals(indentCharPref)) {
          indentChar = '\t';
        }
        int indentationWidth = preferences.getInt(XMLCorePreferenceNames.INDENTATION_SIZE);

        StringBuffer indent = new StringBuffer();
        for (int i = 0; i < indentationWidth; i++) {
          indent.append(indentChar);
        }
View Full Code Here

  public IStructuredCleanupPreferences getCleanupPreferences() {
    if (fCleanupPreferences == null) {
      fCleanupPreferences = new StructuredCleanupPreferences();

      Preferences preferences = getModelPreferences();
      if (preferences != null) {
        fCleanupPreferences.setCompressEmptyElementTags(preferences.getBoolean(XMLCorePreferenceNames.COMPRESS_EMPTY_ELEMENT_TAGS));
        fCleanupPreferences.setInsertRequiredAttrs(preferences.getBoolean(XMLCorePreferenceNames.INSERT_REQUIRED_ATTRS));
        fCleanupPreferences.setInsertMissingTags(preferences.getBoolean(XMLCorePreferenceNames.INSERT_MISSING_TAGS));
        fCleanupPreferences.setQuoteAttrValues(preferences.getBoolean(XMLCorePreferenceNames.QUOTE_ATTR_VALUES));
        fCleanupPreferences.setFormatSource(preferences.getBoolean(XMLCorePreferenceNames.FORMAT_SOURCE));
        fCleanupPreferences.setConvertEOLCodes(preferences.getBoolean(XMLCorePreferenceNames.CONVERT_EOL_CODES));
        fCleanupPreferences.setEOLCode(preferences.getString(XMLCorePreferenceNames.CLEANUP_EOL_CODE));
      }
    }

    return fCleanupPreferences;
  }
View Full Code Here

  public IStructuredCleanupPreferences getCleanupPreferences() {
    if (fCleanupPreferences == null) {
      fCleanupPreferences = new StructuredCleanupPreferences();

      Preferences preferences = getModelPreferences();
      if (preferences != null) {
        fCleanupPreferences.setCompressEmptyElementTags(preferences.getBoolean(XMLCorePreferenceNames.COMPRESS_EMPTY_ELEMENT_TAGS));
        fCleanupPreferences.setInsertRequiredAttrs(preferences.getBoolean(XMLCorePreferenceNames.INSERT_REQUIRED_ATTRS));
        fCleanupPreferences.setInsertMissingTags(preferences.getBoolean(XMLCorePreferenceNames.INSERT_MISSING_TAGS));
        fCleanupPreferences.setQuoteAttrValues(preferences.getBoolean(XMLCorePreferenceNames.QUOTE_ATTR_VALUES));
        fCleanupPreferences.setFormatSource(preferences.getBoolean(XMLCorePreferenceNames.FORMAT_SOURCE));
        fCleanupPreferences.setConvertEOLCodes(preferences.getBoolean(XMLCorePreferenceNames.CONVERT_EOL_CODES));
        fCleanupPreferences.setEOLCode(preferences.getString(XMLCorePreferenceNames.CLEANUP_EOL_CODE));
      }
    }

    return fCleanupPreferences;
  }
View Full Code Here

    // TODO... initiate a timed release of the entries in the CMDocumentCache
    publicIdTable = new Hashtable();
  }
 
  private void initializeGlobalCMDocumentCacheSettings() {
    Preferences preferences = XMLCorePlugin.getDefault().getPluginPreferences();
    if(preferences != null) {
      globalCMDocumentCacheEnabled = preferences.getBoolean(XMLCorePreferenceNames.CMDOCUMENT_GLOBAL_CACHE_ENABLED);
    }
  }
View Full Code Here

    // new file page
    newFilePage = new NewFilePage(fSelection);
    newFilePage.setTitle(XMLWizardsMessages._UI_WIZARD_CREATE_XML_FILE_HEADING);
    newFilePage.setDescription(XMLWizardsMessages._UI_WIZARD_CREATE_XML_FILE_EXPL);
    newFilePage.defaultName = (grammarURI != null) ? URIHelper.removeFileExtension(URIHelper.getLastSegment(grammarURI)) : "NewFile"; //$NON-NLS-1$
    Preferences preference = XMLCorePlugin.getDefault().getPluginPreferences();
    String ext = preference.getString(XMLCorePreferenceNames.DEFAULT_EXTENSION);
    newFilePage.defaultFileExtension = "." + ext; //$NON-NLS-1$
    newFilePage.filterExtensions = filePageFilterExtensions;
    addPage(newFilePage);

    if (grammarURI == null) {
View Full Code Here

  public String[] getIndentPrefixes(ISourceViewer sourceViewer, String contentType) {
    Vector vector = new Vector();

    // prefix[0] is either '\t' or ' ' x tabWidth, depending on preference
    Preferences preferences = XMLCorePlugin.getDefault().getPluginPreferences();
    int indentationWidth = preferences.getInt(XMLCorePreferenceNames.INDENTATION_SIZE);
    String indentCharPref = preferences.getString(XMLCorePreferenceNames.INDENTATION_CHAR);
    boolean useSpaces = XMLCorePreferenceNames.SPACE.equals(indentCharPref);

    for (int i = 0; i <= indentationWidth; i++) {
      StringBuffer prefix = new StringBuffer();
      boolean appendTab = false;
View Full Code Here

      inputStream.close();
    }
  }

  private String getUserPreferredCharset() {
    Preferences preference = XMLCorePlugin.getDefault().getPluginPreferences();
    String charSet = preference.getString(CommonEncodingPreferenceNames.OUTPUT_CODESET);
    return charSet;
  }
View Full Code Here

        BaseWidgetUtils.createSpacer( composite, 1 );
        expandBaseEntriesButton = BaseWidgetUtils.createCheckbox( composite,
            "Expand base entries when opening connection", 1 );
        expandBaseEntriesButton.setSelection( getPreferenceStore().getBoolean(
            BrowserCommonConstants.PREFERENCE_BROWSER_EXPAND_BASE_ENTRIES ) );
        Preferences coreStore = BrowserCorePlugin.getDefault().getPluginPreferences();
        checkForChildrenButton = BaseWidgetUtils.createCheckbox( composite, "Check for children", 1 );
        checkForChildrenButton
            .setSelection( coreStore.getBoolean( BrowserCoreConstants.PREFERENCE_CHECK_FOR_CHILDREN ) );
        showAliasAndReferralObjectsButton = BaseWidgetUtils.createCheckbox( composite,
            "Show alias and referral objects", 1 );
        showAliasAndReferralObjectsButton.setSelection( coreStore
            .getBoolean( BrowserCoreConstants.PREFERENCE_SHOW_ALIAS_AND_REFERRAL_OBJECTS ) );
        fetchSubentriesButton = BaseWidgetUtils.createCheckbox( composite,
            "Fetch subentries (requires additional search request)", 1 );
        fetchSubentriesButton.setSelection( coreStore.getBoolean( BrowserCoreConstants.PREFERENCE_FETCH_SUBENTRIES ) );

        updateEnabled();

        applyDialogFont( composite );
View Full Code Here


    public boolean performOk()
    {

        Preferences coreStore = BrowserCorePlugin.getDefault().getPluginPreferences();
        coreStore.setValue( BrowserCoreConstants.PREFERENCE_CHECK_FOR_CHILDREN, this.checkForChildrenButton
            .getSelection() );
        coreStore.setValue( BrowserCoreConstants.PREFERENCE_SHOW_ALIAS_AND_REFERRAL_OBJECTS,
            this.showAliasAndReferralObjectsButton.getSelection() );
        coreStore
            .setValue( BrowserCoreConstants.PREFERENCE_FETCH_SUBENTRIES, this.fetchSubentriesButton.getSelection() );
        BrowserCorePlugin.getDefault().savePluginPreferences();

        getPreferenceStore().setValue( BrowserCommonConstants.PREFERENCE_BROWSER_EXPAND_BASE_ENTRIES,
            this.expandBaseEntriesButton.getSelection() );
View Full Code Here

TOP

Related Classes of org.eclipse.core.runtime.Preferences

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.