public CSSProfile findProfileFor(ICSSNode node) { ICSSModel model = null; if (node != null) { ICSSDocument doc = node.getOwnerDocument(); if (doc != null) { model = doc.getModel(); } } return findProfileFor(model); }
/** */ public FactoryRegistry getFactoryRegistry() { ICSSModel model = getOwnerDocument().getModel(); if (model != null) { FactoryRegistry reg = model.getFactoryRegistry(); if (reg != null) return reg; } return null; }
/** * */ String getLineDelimiter(ICSSNode node) { ICSSModel model = (node != null) ? node.getOwnerDocument().getModel() : null; return (model != null) ? model.getStructuredDocument().getLineDelimiter() : "\n"; //$NON-NLS-1$ // TODO : check whether to use model.getLineDelimiter() or // model.getStructuredDocument().getLineDelimiter() }
/** * */ protected void notifyValueChanged(String oldValue) { // for model ICSSDocument doc = getContainerDocument(); if (doc == null) return; CSSModelImpl model = (CSSModelImpl) doc.getModel(); if (model == null) return; model.valueChanged(this, oldValue); // for adapters notify(CHANGE, new Short(fPrimitiveType), null, null, getStartOffset()); }
/** * */ protected void begin(ICSSNode node) { if (baseModel == null) { baseModel = node.getOwnerDocument().getModel(); if (baseModel instanceof ICSSModel && ((ICSSModel) baseModel).getStyleSheetType() != ICSSModel.EXTERNAL) { IDOMNode xmlNode = (IDOMNode) ((ICSSModel) baseModel).getOwnerDOMNode(); baseModel = xmlNode.getModel(); } } }
protected void notifyAttrReplaced(CSSNodeImpl newAttr, CSSNodeImpl oldAttr) { // for model ICSSDocument doc = getContainerDocument(); if (doc == null) return; CSSModelImpl model = (CSSModelImpl) doc.getModel(); if (model == null) return; model.attrReplaced(this, newAttr, oldAttr); // for adapters int type = CHANGE; if (newAttr == null) type = REMOVE; else if (oldAttr == null) type = ADD; notify(type, oldAttr, oldAttr, newAttr, getStartOffset()); }
/** * */ protected void formatPost(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])) && !regions[i].getType().equals(CSSRegionContexts.CSS_DELIMITER)) appendDelimBefore(node, regions[i], source); source.append(decoratedRegion(regions[i], 0, stgy)); } }
/** * */ protected void formatPost(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])) appendDelimBefore(node, regions[i], source); source.append(decoratedRegion(regions[i], 0, stgy)); } }
/** * */ protected void formatPost(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])) appendDelimBefore(node, regions[i], source); source.append(decoratedRegion(regions[i], 0, stgy)); } }
/** * */ public int getChildInsertPos(ICSSNode node) { int n = ((IndexedRegion) node).getEndOffset(); if (n > 0) { IStructuredDocumentRegion flatNode = node.getOwnerDocument().getModel().getStructuredDocument().getRegionAtCharacterOffset(n - 1); if (flatNode.getRegionAtCharacterOffset(n - 1).getType() == CSSRegionContexts.CSS_DELIMITER) return n - 1; return n; } return -1; }
/** * */ public int getChildInsertPos(ICSSNode node) { int n = ((IndexedRegion) node).getEndOffset(); if (n > 0) { IStructuredDocumentRegion flatNode = node.getOwnerDocument().getModel().getStructuredDocument().getRegionAtCharacterOffset(n - 1); if (flatNode.getRegionAtCharacterOffset(n - 1).getType() == CSSRegionContexts.CSS_DECLARATION_VALUE_PARENTHESIS_CLOSE) return n - 1; return n; } return -1; }
/** * */ protected void formatPost(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])) appendDelimBefore(node, regions[i], source); source.append(decoratedRegion(regions[i], 0, stgy)); } }
/** * */ protected void formatBefore(ICSSNode node, ICSSNode child, IRegion region, String toAppend, 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(decoratedRegion(regions[i], 2, stgy)); } }
/** * */ protected void formatPost(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(decoratedRegion(regions[i], 2, stgy)); } }
/** * */ protected void formatPost(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(decoratedIdentRegion(regions[i], stgy)); } }
/** * */ public int getChildInsertPos(ICSSNode node) { int n = ((IndexedRegion) node).getEndOffset(); if (n > 0) { IStructuredDocumentRegion flatNode = node.getOwnerDocument().getModel().getStructuredDocument().getRegionAtCharacterOffset(n - 1); if (flatNode.getRegionAtCharacterOffset(n - 1).getType() == CSSRegionContexts.CSS_DELIMITER) return n - 1; return n; } return -1; }
/** * */ public int getChildInsertPos(ICSSNode node) { int n = ((IndexedRegion) node).getEndOffset(); if (n > 0) { IStructuredDocumentRegion flatNode = node.getOwnerDocument().getModel().getStructuredDocument().getRegionAtCharacterOffset(n - 1); if (flatNode.getRegionAtCharacterOffset(n - 1).getType() == CSSRegionContexts.CSS_LBRACE) return n - 1; return n; } return -1; }
/** * @param cssText * java.lang.String */ public void setCssText(String cssText) { if (firstStructuredDocumentRegion != null) { getOwnerDocument().getModel().getStructuredDocument().replaceText(this, getStartOffset(), getEndOffset() - getStartOffset(), cssText); } else super.setCssText(cssText); }
/** * */ 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); }
/** * */ 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); }