/** * If this style sheet comes from an <code>@import</code> rule, the <code>ownerRule</code> attribute will * contain the <code>CSSImportRule</code>. In that case, the * <code>ownerNode</code> attribute in the * <code>StyleSheet</code> interface will be <code>null</code>. * If the style sheet comes from an element or a processing * instruction, the <code>ownerRule</code> attribute will be * <code>null</code> and the <code>ownerNode</code> attribute * will contain the <code>Node</code>. */ public CSSRule getOwnerRule() { Assert.isTrue(false, CSSCoreMessages.You_cannot_use_CSSStyleShe_UI_); //$NON-NLS-1$ = "You cannot use CSSStyleSheet.getOwnerRule() because of many referencers of this rule\nPlease use getOnwerRules()" // for @import return null; }
public String resolve(String base, String publicId, String systemId) { String result = systemId; if (base == null) { base = getResourceLocation(); // bug 117320, ensure base URI is 'protocal' qualified before // passing it thru to URIResolver // bug 117424, we should be able to assume that the base location // is non-null Assert.isNotNull(base, "Base location is expected to be non null."); //$NON-NLS-1$ base = URIHelper.addImpliedFileProtocol(base); } result = URIResolverPlugin.createResolver().resolve(base, publicId, systemId); return result; }
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; }
protected void preLoadAdapt(IStructuredModel structuredModel) { super.preLoadAdapt(structuredModel); IDOMModel domModel = (IDOMModel) structuredModel; // // document must have already been set for this to // work. Document document = domModel.getDocument(); Assert.isNotNull(document); // if there is a model in the adapter, this will adapt it to // first node. After that the PropagatingAdater spreads over the // children being // created. Each time that happends, a side effect is to // also "spread" sprecific registered adapters, // they two can propigate is needed. // This 'get' causes first to be be attached. PropagatingAdapter propagatingAdapter = (PropagatingAdapter) ((INodeNotifier) document).getAdapterFor(PropagatingAdapter.class); // may make this easier to use in futue propagatingAdapter.addAdaptOnCreateFactory(new PageDirectiveWatcherFactory()); if (Debug.debugNotificationAndEvents) { propagatingAdapter.addAdaptOnCreateFactory(new DebugAdapterFactory()); } // For JSPs, the ModelQueryAdapter must be "attached" to the document // before content is set in the model, so taglib initization can // take place. ((INodeNotifier) document).getAdapterFor(ModelQueryAdapter.class); // }
/** * @param ownerNode * org.w3c.dom.Node if the case of external CSS model, you * should set null, else if internal css, you should set * STYLE-tag node, else if inline css, you should set the * element that is the owner of style-attribute. */ public void setOwnerDOMNode(Node node) { // prohibit owner change Assert.isTrue(ownerNode == null); ownerNode = node; if (ownerNode != null) { // for internal/inline CSS context try { setId(ID_NON_EXTERNAL_CSS); } catch (ResourceInUse e) { // impossible } } }
public void initializeFactoryRegistry(FactoryRegistry registry) { Assert.isNotNull(registry); INodeAdapterFactory factory = null; if (!registry.contains(DocumentTypeAdapter.class)) { factory = new HTMLDocumentTypeAdapterFactory(); registry.addFactory(factory); } if (!registry.contains(ModelParserAdapter.class)) { factory = HTMLModelParserAdapterFactory.getInstance(); registry.addFactory(factory); } if (!registry.contains(IStyleSelectorAdapter.class)) { factory = HTMLStyleSelectorAdapterFactory.getInstance(); registry.addFactory(factory); } if (!registry.contains(IStyleSheetAdapter.class)) { factory = StyleAdapterFactory.getInstance(); registry.addFactory(factory); } }
/** * Generate or format source between children('child' and its previous * sibling) and append to string buffer */ public final StringBuffer formatBefore(ICSSNode node, ICSSNode child, IRegion exceptFor) { Assert.isTrue(child == null || child.getParentNode() == node); StringBuffer buf = new StringBuffer(); formatBefore(node, child, /* (child != null) ? (child.getCssText()) : */"", buf, exceptFor);//$NON-NLS-1$ return buf; }
Assert.isNotNull(oldEmbeddedContentType, "Program error: invalid call during model initialization"); //$NON-NLS-1$
public void setStructuredDocument(IStructuredDocument newDocument) { Assert.isTrue(newDocument != null, "null document"); //$NON-NLS-1$ Assert.isTrue(newDocument.getParser() != null, "null document parser"); //$NON-NLS-1$ Assert.isTrue(newDocument.getParser() instanceof JSPSourceParser, "can only listen to document with a JSPSourceParser"); //$NON-NLS-1$ getSourceParser().removeStructuredDocumentRegionHandler(this); setSourceParser((JSPSourceParser) newDocument.getParser()); getSourceParser().addStructuredDocumentRegionHandler(this); } }
Assert.isNotNull(oldEmbeddedContentType, "Program error: invalid call during model initialization"); //$NON-NLS-1$
public void bufferCreated(IFileBuffer buffer) { if (buffer instanceof ITextFileBuffer) { IDocument document = ((ITextFileBuffer) buffer).getDocument(); // ignore non-JSP documents synchronized (_instance.fJSPdocuments) { if (!_instance.fJSPdocuments.contains(document)) return; } Assert.isTrue(document instanceof IStructuredDocument, getClass().getName() + " SetupParticipant was called for non-IStructuredDocument"); //$NON-NLS-1$ DocumentInfo info = new DocumentInfo(); info.document = (IStructuredDocument) document; info.textFileBuffer = (ITextFileBuffer) buffer; info.tldDocumentManager = new TLDCMDocumentManager(); info.tldDocumentManager.setSourceParser((JSPSourceParser) info.document.getParser()); synchronized (_instance.fDocumentMap) { _instance.fDocumentMap.put(document, info); } TaglibIndex.addTaglibIndexListener(info); if (document instanceof BasicStructuredDocument) { ((BasicStructuredDocument) document).reparse(this); } } }
public void uninitializeFactoryRegistry(FactoryRegistry registry) { Assert.isNotNull(registry); // ISSUE: should these factories be released? Or just // removed from this registry, because we are getting ready to // re-add them? INodeAdapterFactory factory = null; if (!registry.contains(DocumentTypeAdapter.class)) { factory = registry.getFactoryFor(DocumentTypeAdapter.class); factory.release(); registry.removeFactory(factory); } if (!registry.contains(ModelParserAdapter.class)) { factory = registry.getFactoryFor(ModelParserAdapter.class); factory.release(); registry.removeFactory(factory); } if (!registry.contains(IStyleSelectorAdapter.class)) { factory = registry.getFactoryFor(IStyleSelectorAdapter.class); factory.release(); registry.removeFactory(factory); } if (!registry.contains(IStyleSheetAdapter.class)) { factory = registry.getFactoryFor(IStyleSheetAdapter.class); factory.release(); registry.removeFactory(factory); } }
int offset = region.getStart(); if (offset < 0) { Assert.isTrue(false); break;
protected void addContentBasedFactories(IStructuredModel structuredModel) { FactoryRegistry factoryRegistry = structuredModel.getFactoryRegistry(); Assert.isNotNull(factoryRegistry, "Program Error: client caller must ensure model has factory registry"); //$NON-NLS-1$ INodeAdapterFactory factory = null; factory = factoryRegistry.getFactoryFor(IJFaceNodeAdapter.class); if (factory == null) { factory = new JFaceNodeAdapterFactory(); factoryRegistry.addFactory(factory); } // cs... added for inferred grammar support // if (structuredModel != null) { ModelQuery modelQuery = ModelQueryUtil.getModelQuery(structuredModel); if (modelQuery != null) { CMDocumentManager documentManager = modelQuery.getCMDocumentManager(); if (documentManager != null) { IPreferenceStore store = XMLUIPlugin.getDefault().getPreferenceStore(); boolean useInferredGrammar = (store != null) ? store.getBoolean(XMLUIPreferenceNames.USE_INFERRED_GRAMMAR) : true; documentManager.setPropertyEnabled(CMDocumentManager.PROPERTY_ASYNC_LOAD, true); documentManager.setPropertyEnabled(CMDocumentManager.PROPERTY_AUTO_LOAD, false); documentManager.setPropertyEnabled(CMDocumentManager.PROPERTY_USE_CACHED_RESOLVED_URI, true); DOMObserver domObserver = new DOMObserver(structuredModel); domObserver.setGrammarInferenceEnabled(useInferredGrammar); domObserver.init(); } } } }