protected String getPreferredNewLineDelimiter(IFile file) { String delimiter = ContentTypeEncodingPreferences.getPreferredNewLineDelimiter(ContentTypeIdForHTML.ContentTypeID_HTML); if (delimiter == null) delimiter = super.getPreferredNewLineDelimiter(file); return delimiter; }
/** * */ public void set(IDocument document) { set(new DocumentReader(document, 0)); }
public IDocument createDocument() { IStructuredDocument structuredDocument = StructuredDocumentFactory.getNewStructuredDocumentInstance(new JSPSourceParser()); return structuredDocument; }
public IStructuredDocument getStructuredDocument() { IStructuredDocument structuredDocument = null; structuredDocument = super.getStructuredDocument(); if (structuredDocument != null) return structuredDocument; // the first time Assert.isNotNull(getModelHandler()); structuredDocument = (IStructuredDocument) getModelHandler().getDocumentLoader().createNewStructuredDocument(); setStructuredDocument(structuredDocument); return structuredDocument; }
/** * Resets the input. */ public void reset(java.io.Reader reader, int position) { primReset(); fOffset = position; getTokenizer().reset(reader, position); if (reader instanceof DocumentReader) { IDocument doc = ((DocumentReader) reader).getDocument(); if (doc instanceof CharSequence) { fCharSequenceSource = (CharSequence) doc; } else { // old fashioned IDocument fDocumentInput = ((DocumentReader) reader).getDocument(); } } else if (reader instanceof CharSequenceReader) { fCharSequenceSource = ((CharSequenceReader) reader).getOriginalSource(); } }
/** * Determine the MIME content type specified in a page directive. This * should appear "as early as possible in the JSP page" according to the * JSP v1.2 specification. */ private EmbeddedTypeHandler getEmbeddedType(IFile file) throws UnsupportedEncodingException, CoreException, IOException { EmbeddedTypeHandler handler = null; if (fFullPreparedReader == null) { handler = getJSPDefaultEmbeddedType(); } else { String mimeType = null; IDocumentCharsetDetector jspProvider = getDocumentEncodingDetector(); Reader fullPreparedReader = getFullPreparedReader(); BufferedLimitedReader limitedReader = new BufferedLimitedReader(fullPreparedReader, CodedIO.MAX_BUF_SIZE); jspProvider.set(limitedReader); if (jspProvider instanceof IJSPHeadContentDetector) { mimeType = ((IJSPHeadContentDetector) jspProvider).getContentType(); fullPreparedReader.reset(); } EmbeddedTypeRegistry reg = getEmbeddedContentTypeRegistry(); if (mimeType == null || mimeType.length() == 0) { handler = getJSPDefaultEmbeddedType(); } else { handler = reg.getTypeFor(mimeType); } } return handler; }
protected IEncodedDocument newEncodedDocument() { IStructuredDocument structuredDocument = StructuredDocumentFactory.getNewStructuredDocumentInstance(getParser()); if (structuredDocument instanceof BasicStructuredDocument) { ((BasicStructuredDocument) structuredDocument).setReParser(new XMLStructuredDocumentReParser()); } return structuredDocument; }
protected String getPreferredNewLineDelimiter(IFile file) { String delimiter = ContentTypeEncodingPreferences.getPreferredNewLineDelimiter(CSS_ID); if (delimiter == null) delimiter = super.getPreferredNewLineDelimiter(file); return delimiter; }
public void set(IDocument document) { set(new DocumentReader(document, 0)); } }
private void setCssValueTextCore(String value) throws DOMException { // use temporary document synchronized (CSSStyleDeclarationImpl.class) { if (sharedStructuredDocument == null) { IDocumentLoader loader = new CSSDocumentLoader(); sharedStructuredDocument = (IStructuredDocument) loader.createNewStructuredDocument(); ((CSSSourceParser) sharedStructuredDocument.getParser()).setParserMode(CSSSourceParser.MODE_DECLARATION_VALUE); } sharedStructuredDocument.set(value); IStructuredDocumentRegion node = sharedStructuredDocument.getFirstStructuredDocumentRegion(); if (node == null) { return; } if (node.getNext() != null) { throw new DOMException(DOMException.INVALID_MODIFICATION_ERR, "");//$NON-NLS-1$ } CSSDeclarationItemParser itemParser = new CSSDeclarationItemParser(getOwnerDocument()); itemParser.setStructuredDocumentTemporary(true); // make a copy of nodelist because setupValues will destroy list ITextRegionList nodeList = new TextRegionListImpl(node.getRegions()); itemParser.setupValues(this, node, nodeList); } }
protected IEncodedDocument newEncodedDocument() { IStructuredDocument structuredDocument = StructuredDocumentFactory.getNewStructuredDocumentInstance(getParser()); ((BasicStructuredDocument) structuredDocument).setReParser(new XMLStructuredDocumentReParser()); return structuredDocument; }
protected String getPreferredNewLineDelimiter(IFile file) { String delimiter = ContentTypeEncodingPreferences.getPreferredNewLineDelimiter(ContentTypeIdForXML.ContentTypeID_XML); if (delimiter == null) delimiter = super.getPreferredNewLineDelimiter(file); return delimiter; }
public void set(IDocument document) { set(new DocumentReader(document, 0)); } }
private void loadTagFile(CMElementDeclarationImpl ed, IFile tagFile, boolean allowIncludes) { try { IStructuredDocument document = (IStructuredDocument) new ModelHandlerForJSP().getDocumentLoader().createNewStructuredDocument(tagFile); IStructuredDocumentRegion documentRegion = document.getFirstStructuredDocumentRegion(); while (documentRegion != null) {
protected IEncodedDocument newEncodedDocument() { // DMW: I copied this from CSSModelImple ... // but am not sure its right IStructuredDocument structuredDocument = StructuredDocumentFactory.getNewStructuredDocumentInstance(getParser()); CSSStructuredDocumentReParser reParser = new CSSStructuredDocumentReParser(); reParser.setStructuredDocument(structuredDocument); ((BasicStructuredDocument) structuredDocument).setReParser(reParser); return structuredDocument; }
protected String getPreferredNewLineDelimiter(IFile file) { String delimiter = ContentTypeEncodingPreferences.getPreferredNewLineDelimiter(ContentTypeIdForJSP.ContentTypeID_JSP); if (delimiter == null) delimiter = super.getPreferredNewLineDelimiter(file); return delimiter; }
public void set(IDocument document) { set(new DocumentReader(document, 0)); }
/** * This method must return a new instance of IStructuredDocument, that has * been initialized with appropriate parser. For many loaders, the * (default) parser used is known for any input. For others, the correct * parser (and its initialization) is normall dependent on the content of * the file. This no-argument method should assume "empty input" and would * therefore return the default parser for the default contentType. * * If the parser is to handle tag libraries, it must have a TaglibSupport * object with a valid URIResolver and this IStructuredDocument attached * to it before the contents are set on the IStructuredDocument. */ public IStructuredDocument newStructuredDocument() { IStructuredDocument structuredDocument = StructuredDocumentFactory.getNewStructuredDocumentInstance(getParser()); ((BasicStructuredDocument) structuredDocument).setReParser(new JSPReParser()); // structuredDocument.setDocumentPartitioner(new // JSPJavaDocumentPartioner()); // even though this is an "empty model" ... we want it to have at // least the // default embeddeded content type handler EmbeddedTypeHandler embeddedType = getJSPDefaultEmbeddedType(null); embeddedType.initializeParser((JSPCapableParser) structuredDocument.getParser()); return structuredDocument; }
/** * This method must return a new instance of IStructuredDocument, that has * been initialized with appropriate parser. For many loaders, the * (default) parser used is known for any input. For others, the correct * parser (and its initialization) is normall dependent on the content of * the file. This no-argument method should assume "empty input" and would * therefore return the default parser for the default contentType. If the * parser is to handle tag libraries, it must have a TaglibSupport object * with a valid URIResolver and this IStructuredDocument attached to it * before the contents are set on the IStructuredDocument. */ protected IEncodedDocument newEncodedDocument() { IStructuredDocument structuredDocument = StructuredDocumentFactory.getNewStructuredDocumentInstance(getParser()); ((BasicStructuredDocument) structuredDocument).setReParser(new JSPReParser()); // structuredDocument.setDocumentPartitioner(new // JSPJavaDocumentPartioner()); // even though this is an "empty model" ... we want it to have at // least // the // default embeddeded content type handler EmbeddedTypeHandler embeddedType = getJSPDefaultEmbeddedType(); embeddedType.initializeParser((JSPCapableParser) structuredDocument.getParser()); return structuredDocument; }
public boolean parse(String filePath) { getLocalParser().removeStructuredDocumentRegionHandler(this); // from outer class List blockMarkers = this.fTranslator.getBlockMarkers(); IStructuredDocument document = StructuredDocumentFactory.getNewStructuredDocumentInstance(getLocalParser()); String contents = getContents(filePath); if (contents == null) return false; // this adds the current markers from the outer class list // to this parser so parsing works correctly for (int i = 0; i < blockMarkers.size(); i++) { addBlockMarker((BlockMarker) blockMarkers.get(i)); } reset(contents); // forceParse(); document.set(contents); IStructuredDocumentRegion cursor = document.getFirstStructuredDocumentRegion(); while (cursor != null) { nodeParsed(cursor); cursor = cursor.getNext(); } getLocalParser().addStructuredDocumentRegionHandler(this); return true; }