diff options
Diffstat (limited to 'bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/UnknownRuleFormatter.java')
-rw-r--r-- | bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/UnknownRuleFormatter.java | 86 |
1 files changed, 0 insertions, 86 deletions
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/UnknownRuleFormatter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/UnknownRuleFormatter.java deleted file mode 100644 index 406a408660..0000000000 --- a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/UnknownRuleFormatter.java +++ /dev/null @@ -1,86 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.css.core.internal.formatter; - - - -import org.eclipse.jface.text.IRegion; -import org.eclipse.wst.css.core.internal.cleanup.CSSCleanupStrategy; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSNode; -import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion; -import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument; -import org.w3c.dom.css.CSSUnknownRule; - - -/** - * - */ -public class UnknownRuleFormatter extends DefaultCSSSourceFormatter { - - private static UnknownRuleFormatter instance; - - /** - * - */ - UnknownRuleFormatter() { - super(); - } - - /** - * - */ - protected void formatPre(ICSSNode node, StringBuffer source) { - CSSCleanupStrategy stgy = getCleanupStrategy(node); - - int start = ((IndexedRegion) node).getStartOffset(); - int end = ((IndexedRegion) node).getEndOffset(); - if (end > 0) { // format source - IStructuredDocument structuredDocument = node.getOwnerDocument().getModel().getStructuredDocument(); - CompoundRegion[] regions = getRegionsWithoutWhiteSpaces(structuredDocument, new FormatRegion(start, end - start), stgy); - for (int i = 0; i < regions.length; i++) { - if (i != 0) - appendSpaceBefore(node, regions[i], source); - source.append(decoratedPropValueRegion(regions[i], stgy)); - } - } - else { // generate source - CSSUnknownRule rule = (CSSUnknownRule) node; - source.append(rule.getCssText()); - } - } - - /** - * - */ - protected void formatPre(ICSSNode node, IRegion region, StringBuffer source) { - CSSCleanupStrategy stgy = getCleanupStrategy(node); - - IStructuredDocument structuredDocument = node.getOwnerDocument().getModel().getStructuredDocument(); - CompoundRegion[] regions = getRegionsWithoutWhiteSpaces(structuredDocument, region, stgy); - CompoundRegion[] outside = getOutsideRegions(structuredDocument, region); - for (int i = 0; i < regions.length; i++) { - if (i != 0 || needS(outside[0])) - appendSpaceBefore(node, regions[i], source); - source.append(decoratedPropValueRegion(regions[i], stgy)); - } - if (needS(outside[1]) && !isIncludesPreEnd(node, region)) - appendSpaceBefore(node, outside[1], source); - } - - /** - * - */ - public synchronized static UnknownRuleFormatter getInstance() { - if (instance == null) - instance = new UnknownRuleFormatter(); - return instance; - } -}
\ No newline at end of file |