public final void apply(ICSSNode root) { travStack = new Stack(); if (fTraverseImported) { traversedSheets = new Vector(); if (root != null && root.getOwnerDocument() != null && root.getOwnerDocument().getNodeType() == ICSSNode.STYLESHEET_NODE) { traversedSheets.add(root.getOwnerDocument()); } } // first call begin() begin(root); // traverse traverse(root); // last call end() end(root); }
/** * */ private void appendAfterColonSpace(ICSSNode node, StringBuffer source) { Preferences preferences = CSSCorePlugin.getDefault().getPluginPreferences(); int n = preferences.getInt(CSSCorePreferenceNames.FORMAT_PROP_POST_DELIM); if (preferences.getInt(CSSCorePreferenceNames.LINE_WIDTH) > 0 && (!preferences.getBoolean(CSSCorePreferenceNames.WRAPPING_PROHIBIT_WRAP_ON_ATTR) || node.getOwnerDocument().getNodeType() != ICSSNode.STYLEDECLARATION_NODE)) { int length = getLastLineLength(node, source); int append = getFirstChildRegionLength(node); if (length + n + append > preferences.getInt(CSSCorePreferenceNames.LINE_WIDTH)) { source.append(getLineDelimiter(node)); source.append(getIndent(node)); source.append(getIndentString()); n = 0; // no space is necessary } } // no delimiter case while (n-- > 0) source.append(" ");//$NON-NLS-1$ }
/** * */ protected void appendSpaceBefore(ICSSNode node, String toAppend, StringBuffer source) { if (node == null || source == null) return; if (isCleanup() && !getCleanupStrategy(node).isFormatSource()) return; // for not formatting case on cleanup action Preferences preferences = CSSCorePlugin.getDefault().getPluginPreferences(); if (toAppend != null && toAppend.startsWith("{") && preferences.getBoolean(CSSCorePreferenceNames.WRAPPING_NEWLINE_ON_OPEN_BRACE)) {//$NON-NLS-1$ source.append(getLineDelimiter(node)); source.append(getIndent(node)); return; } else if (/* ! mgr.isOnePropertyPerLine() && */preferences.getInt(CSSCorePreferenceNames.LINE_WIDTH) > 0 && (!preferences.getBoolean(CSSCorePreferenceNames.WRAPPING_PROHIBIT_WRAP_ON_ATTR) || node.getOwnerDocument().getNodeType() != ICSSNode.STYLEDECLARATION_NODE)) { int n = getLastLineLength(node, source); int append = (toAppend != null) ? TextUtilities.indexOf(DefaultLineTracker.DELIMITERS, toAppend, 0)[0] : 0; if (toAppend != null) append = (append < 0) ? toAppend.length() : append; if (n + append + 1 > preferences.getInt(CSSCorePreferenceNames.LINE_WIDTH)) { source.append(getLineDelimiter(node)); source.append(getIndent(node)); source.append(getIndentString()); return; } } source.append(" ");//$NON-NLS-1$ }
source.append(getIndentString()); else if (preferences.getInt(CSSCorePreferenceNames.LINE_WIDTH) > 0 && (!preferences.getBoolean(CSSCorePreferenceNames.WRAPPING_PROHIBIT_WRAP_ON_ATTR) || node.getOwnerDocument().getNodeType() != ICSSNode.STYLEDECLARATION_NODE)) { int length = getLastLineLength(node, source); int append = 1;
if (preferences.getInt(CSSCorePreferenceNames.LINE_WIDTH) > 0 && (!preferences.getBoolean(CSSCorePreferenceNames.WRAPPING_PROHIBIT_WRAP_ON_ATTR) || node.getOwnerDocument().getNodeType() != ICSSNode.STYLEDECLARATION_NODE)) { int length = getLastLineLength(node, source); int append = 1;
if (removed != null || added != null || getDocument().getNodeType() == ICSSNode.STYLEDECLARATION_NODE) {
if (preferences.getInt(CSSCorePreferenceNames.LINE_WIDTH) > 0 && (!preferences.getBoolean(CSSCorePreferenceNames.WRAPPING_PROHIBIT_WRAP_ON_ATTR) || node.getOwnerDocument().getNodeType() != ICSSNode.STYLEDECLARATION_NODE)) { int length = getLastLineLength(node, source); int append = 1; if (preferences.getInt(CSSCorePreferenceNames.LINE_WIDTH) > 0 && (!preferences.getBoolean(CSSCorePreferenceNames.WRAPPING_PROHIBIT_WRAP_ON_ATTR) || node.getOwnerDocument().getNodeType() != ICSSNode.STYLEDECLARATION_NODE)) { int length = getLastLineLength(node, source); int append = 1;
added[i] = list.getSelector(i); if (removed != null || added != null || getDocument().getNodeType() == ICSSNode.STYLEDECLARATION_NODE) { getStyleNotifier().fire(removed, added, null);
if (removed != null || added != null || getDocument().getNodeType() == ICSSNode.STYLEDECLARATION_NODE) {