use of org.eclipse.jst.jsp.core.internal.parser.JSPSourceParser in project webtools.sourceediting by eclipse.
the class StructuredTextPartitionerForJSP method isAction.
/**
* @param sdRegion
* @param offset
* @return
*/
private boolean isAction(IStructuredDocumentRegion sdRegion, int offset) {
if (!sdRegion.getType().equals(DOMRegionContext.XML_TAG_NAME))
return false;
/*
* shouldn't get a tag name region type unless a tag name region
* exists at [1]
*/
ITextRegion tagNameRegion = sdRegion.getRegions().get(1);
String tagName = sdRegion.getText(tagNameRegion);
RegionParser parser = fStructuredDocument.getParser();
if (parser instanceof JSPSourceParser) {
if (tagName.equals(fLastCheckedPrefix))
return true;
List fCustomActionPrefixes = ((JSPSourceParser) parser).getNestablePrefixes();
for (int i = 0; i < fCustomActionPrefixes.size(); i++) if (tagName.startsWith(((TagMarker) fCustomActionPrefixes.get(i)).getTagName())) {
fLastCheckedPrefix = ((TagMarker) fCustomActionPrefixes.get(i)).getTagName();
return true;
}
}
return false;
}
use of org.eclipse.jst.jsp.core.internal.parser.JSPSourceParser in project webtools.sourceediting by eclipse.
the class ScanningTests method newParser.
public static RegionParser newParser() {
JSPSourceParser parser = new JSPSourceParser();
parser.addBlockMarker(new BlockMarker("foo", null, DOMRegionContext.BLOCK_TEXT, true));
parser.addBlockMarker(new BlockMarker("globalFoo", null, DOMRegionContext.BLOCK_TEXT, true));
// parser.addBlockMarker(new BlockMarker("jsp:text", null, XMLRegionContext.XML_CDATA_TEXT, true));
return parser;
}
use of org.eclipse.jst.jsp.core.internal.parser.JSPSourceParser in project webtools.sourceediting by eclipse.
the class UnitTests method setUpJSP.
/**
* Set up a JSP model
*/
protected void setUpJSP() {
IModelManager mm = StructuredModelManager.getModelManager();
try {
fModel = mm.createStructuredDocumentFor("dummy.jsp", (InputStream) null, null);
} catch (IOException e) {
// do nothing, since dummy
}
fModel = StructuredDocumentFactory.getNewStructuredDocumentInstance(new JSPSourceParser());
fModel.addDocumentChangedListener(proxy);
tree = new DOMModelImpl();
if (tree != null) {
fModel.addDocumentChangingListener((IStructuredDocumentListener) tree);
tree.setStructuredDocument(fModel);
}
}
use of org.eclipse.jst.jsp.core.internal.parser.JSPSourceParser in project webtools.sourceediting by eclipse.
the class DocumentFactoryForJSP method getParser.
public RegionParser getParser() {
// remember, the Loader
// will need to finish initialization of parser
// based on "embedded content"
JSPSourceParser parser = new JSPSourceParser();
// add default nestable tag list
addNestablePrefix(parser, JSP11Namespace.JSP_TAG_PREFIX);
return parser;
}
use of org.eclipse.jst.jsp.core.internal.parser.JSPSourceParser in project webtools.sourceediting by eclipse.
the class JSPDocumentLoader method getParser.
public RegionParser getParser() {
// remember, the Loader
// will need to finish initialization of parser
// based on "embedded content"
JSPSourceParser parser = new JSPSourceParser();
// add default nestable tag list
addNestablePrefix(parser, JSP11Namespace.JSP_TAG_PREFIX);
return parser;
}
Aggregations