use of org.eclipse.wst.sse.core.internal.text.BasicStructuredDocumentRegion in project webtools.sourceediting by eclipse.
the class TestObjects method testDeletedFlag.
public void testDeletedFlag() {
BasicStructuredDocumentRegion region = new BasicStructuredDocumentRegion();
region.setParentDocument(new BasicStructuredDocument());
boolean deleted = region.isDeleted();
boolean ended = region.isEnded();
region.setDeleted(!deleted);
assertEquals(!deleted, region.isDeleted());
assertEquals(ended, region.isEnded());
}
use of org.eclipse.wst.sse.core.internal.text.BasicStructuredDocumentRegion in project webtools.sourceediting by eclipse.
the class JSPedCSSModelParser method insertStructuredDocumentRegion.
/**
*/
protected CSSNodeImpl insertStructuredDocumentRegion(IStructuredDocumentRegion region) {
CSSModelCreationContext creationContext = getCreationContext();
if (creationContext == null || region == null) {
return null;
}
String type = ((BasicStructuredDocumentRegion) region).getType();
CSSNodeImpl modified = null;
if (type == JSPedCSSRegionContexts.CSS_JSP_DIRECTIVE) {
boolean isInclude = region.getText().indexOf("include") != -1;
if (isInclude) {
modified = insertUnknownImport(region);
} else {
modified = insertUnknownRule(region);
}
}
// post process
if (modified != null) {
if (modified instanceof CSSStructuredDocumentRegionContainer) {
((CSSStructuredDocumentRegionContainer) modified).propagateRangeStructuredDocumentRegion();
}
}
return modified != null ? modified : super.insertStructuredDocumentRegion(region);
}
use of org.eclipse.wst.sse.core.internal.text.BasicStructuredDocumentRegion in project webtools.sourceediting by eclipse.
the class TestObjects method testEndedFlag.
public void testEndedFlag() {
BasicStructuredDocumentRegion region = new BasicStructuredDocumentRegion();
region.setParentDocument(new BasicStructuredDocument());
boolean deleted = region.isDeleted();
boolean ended = region.isEnded();
region.setEnded(!ended);
assertEquals(!ended, region.isEnded());
assertEquals(deleted, region.isDeleted());
}
use of org.eclipse.wst.sse.core.internal.text.BasicStructuredDocumentRegion in project webtools.sourceediting by eclipse.
the class CSSModelParser method insertStructuredDocumentRegion.
/**
* currently public but may be made default access protected in future.
*/
protected CSSNodeImpl insertStructuredDocumentRegion(IStructuredDocumentRegion region) {
if (fCreationContext == null || region == null) {
return null;
}
String type = ((BasicStructuredDocumentRegion) region).getType();
CSSNodeImpl modified = null;
ICSSNode target = fCreationContext.getTargetNode();
if ((fParseFloating && target == null) || target instanceof ICSSRuleContainer) {
if (type == CSSRegionContexts.CSS_DELIMITER) {
modified = insertSemiColonForRule(region);
} else if (type == CSSRegionContexts.CSS_LBRACE) {
modified = insertBraceOpen(region);
} else if (type == CSSRegionContexts.CSS_RBRACE) {
modified = insertBraceClose(region);
} else if (type == CSSRegionContexts.CSS_MEDIA || type == CSSRegionContexts.CSS_PAGE || type == CSSRegionContexts.CSS_FONT_FACE || CSSUtil.isSelectorText(region)) {
checkNextNode(region, CSSRegionContexts.CSS_LBRACE);
} else if (type == CSSRegionContexts.CSS_IMPORT || type == CSSRegionContexts.CSS_CHARSET) {
checkNextNode(region, CSSRegionContexts.CSS_DELIMITER);
}
} else if ((target instanceof CSSRuleDeclContainer || target instanceof CSSStyleDeclaration) && type == CSSRegionContexts.CSS_DECLARATION_PROPERTY) {
modified = insertStyleDeclarationItem(region);
} else if (target instanceof ICSSStyleDeclItem && type == CSSRegionContexts.CSS_DECLARATION_DELIMITER) {
modified = insertSemiColonForStyleDeclarationItem(region);
} else if (type == CSSRegionContexts.CSS_RBRACE) {
modified = insertBraceClose(region);
}
// post process
if (modified != null) {
if (modified instanceof CSSStructuredDocumentRegionContainer) {
((CSSStructuredDocumentRegionContainer) modified).propagateRangeStructuredDocumentRegion();
}
}
return modified;
}
Aggregations