public Preferences getPreferences() { if (fPreferences == null) { fPreferences = SSECorePlugin.getDefault().getPluginPreferences(); } return fPreferences; }
public void release() { // give the adapter instance a chance to release its factories getAdapterInstance().release(); }
/** * Gets the adapterInstance. * * @return Returns a PropagatingAdapter */ private PropagatingAdapter getAdapterInstance() { if (fAdapterInstance == null) { fAdapterInstance = new PropagatingAdapterImpl(); if (fContributedFactories != null) { for (int i = 0; i < fContributedFactories.size(); i++) fAdapterInstance.addAdaptOnCreateFactory((PropagatingAdapterFactory) fContributedFactories.get(i)); } } return fAdapterInstance; }
IStructuredModel sModel = null; try { sModel = StructuredModelManager.getModelManager().getExistingModelForRead(fDocument); if (sModel != null) { FactoryRegistry factoryRegistry = sModel.getFactoryRegistry(); if (!factoryRegistry.contains(ProjectionModelNodeAdapterXML.class) && createIfNeeded) { ProjectionModelNodeAdapterFactoryXML newFactory = new ProjectionModelNodeAdapterFactoryXML(); factoryRegistry.addFactory(newFactory); PropagatingAdapter propagatingAdapter = (PropagatingAdapter) ((INodeNotifier) document).getAdapterFor(PropagatingAdapter.class); if (propagatingAdapter != null) { propagatingAdapter.addAdaptOnCreateFactory(newFactory); factory = (ProjectionModelNodeAdapterFactoryXML) factoryRegistry.getFactoryFor(ProjectionModelNodeAdapterXML.class); sModel.releaseFromRead();
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); // }
public void setModel(IStructuredModel model) { if (_model != null) { if (_model.getUndoManager() != null) _model.getUndoManager().disconnect(this); _model.removeModelStateListener(_internalModelListener); _model.addModelStateListener(_internalModelListener); if (_model.getUndoManager() != null) { _model.getUndoManager().connect(this); updateActionsWhenModelChange(); if (adapter != null) { INodeAdapterFactory factory = RefresherFactory.getInstance(); adapter.addAdaptOnCreateFactory(factory); adapter.initializeForFactory(factory, doc); ((IDOMModel) model).getFactoryRegistry().addFactory( CSSStyleAdapterFactory.getInstance()); ((IDOMModel) model).getFactoryRegistry().addFactory( new PageVariableAdapterFactory()); doc.addAdapter(new DocumentPageVariableAdapter(doc));
protected void preLoadAdapt(IStructuredModel structuredModel) { IDOMModel domModel = (IDOMModel) structuredModel; // // document must have already been set for this to // work. Document document = domModel.getDocument(); Assert.isNotNull(document, JSPCoreMessages.JSPDocumentLoader_1); // 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()); // 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); }
public INodeAdapterFactory copy() { PropagatingAdapterFactory clonedInstance = new PropagatingAdapterFactoryImpl(getAdapterKey(), isShouldRegisterAdapter()); // clone this adapters specific list of adapter factories too if (fContributedFactories != null) { Iterator iterator = fContributedFactories.iterator(); clonedInstance.setContributedFactories(new ArrayList()); while (iterator.hasNext()) { INodeAdapterFactory existingFactory = (INodeAdapterFactory) iterator.next(); clonedInstance.addContributedFactories(existingFactory.copy()); } } return clonedInstance; }