Skip to main content

This CGIT instance is deprecated, and repositories have been moved to Gitlab or Github. See the repository descriptions for specific locations.

summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/modelquery')
-rw-r--r--bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/modelquery/ModelQueryAdapterFactoryForEmbeddedXML.java50
-rw-r--r--bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/modelquery/ModelQueryAdapterFactoryForXML.java216
-rw-r--r--bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/modelquery/ModelQueryUtil.java64
-rw-r--r--bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/modelquery/XMLCatalogIdResolver.java93
-rw-r--r--bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/modelquery/XMLModelQueryAssociationProvider.java60
-rw-r--r--bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/modelquery/XMLModelQueryImpl.java38
6 files changed, 0 insertions, 521 deletions
diff --git a/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/modelquery/ModelQueryAdapterFactoryForEmbeddedXML.java b/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/modelquery/ModelQueryAdapterFactoryForEmbeddedXML.java
deleted file mode 100644
index 12e3609228..0000000000
--- a/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/modelquery/ModelQueryAdapterFactoryForEmbeddedXML.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.xml.core.internal.modelquery;
-
-
-
-import org.eclipse.wst.sse.core.internal.provisional.INodeAdapter;
-import org.eclipse.wst.sse.core.internal.provisional.INodeNotifier;
-import org.eclipse.wst.xml.core.internal.contentmodel.modelquery.CMDocumentManager;
-import org.eclipse.wst.xml.core.internal.ssemodelquery.ModelQueryAdapter;
-
-
-public class ModelQueryAdapterFactoryForEmbeddedXML extends ModelQueryAdapterFactoryForXML {
-
-
- /**
- * Constructor for ModelQueryAdapterFactoryForEmbeddedXML.
- */
- public ModelQueryAdapterFactoryForEmbeddedXML() {
- super(ModelQueryAdapter.class, false);
- }
-
- protected void configureDocumentManager(CMDocumentManager mgr) {
- super.configureDocumentManager(mgr);
- mgr.setPropertyEnabled(CMDocumentManager.PROPERTY_ASYNC_LOAD, true);
- }
-
- /**
- * ISSUE: this "forces" a new one to always be created/returned,
- * not "cached" on the node. That seems incorrect.
- * Simply using shouldRegisterFalse should work, except,
- * there might have been one there that someone else already
- * explicitly put there, so this is only way I know to
- * override that. Especially complicated here since a number
- * of adapters are for ModelQueryAdapter.class.
- */
- public INodeAdapter adapt(INodeNotifier object) {
- return adaptNew(object);
- }
-}
diff --git a/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/modelquery/ModelQueryAdapterFactoryForXML.java b/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/modelquery/ModelQueryAdapterFactoryForXML.java
deleted file mode 100644
index 47bc5af2c7..0000000000
--- a/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/modelquery/ModelQueryAdapterFactoryForXML.java
+++ /dev/null
@@ -1,216 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.xml.core.internal.modelquery;
-
-
-
-import java.io.File;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.wst.common.uriresolver.internal.provisional.URIResolver;
-import org.eclipse.wst.sse.core.internal.provisional.AbstractAdapterFactory;
-import org.eclipse.wst.sse.core.internal.provisional.IModelStateListener;
-import org.eclipse.wst.sse.core.internal.provisional.INodeAdapter;
-import org.eclipse.wst.sse.core.internal.provisional.INodeAdapterFactory;
-import org.eclipse.wst.sse.core.internal.provisional.INodeNotifier;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-import org.eclipse.wst.xml.core.internal.contentmodel.modelquery.CMDocumentManager;
-import org.eclipse.wst.xml.core.internal.contentmodel.modelquery.ModelQuery;
-import org.eclipse.wst.xml.core.internal.contentmodel.util.CMDocumentCache;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
-import org.eclipse.wst.xml.core.internal.ssemodelquery.ModelQueryAdapter;
-import org.eclipse.wst.xml.core.internal.ssemodelquery.ModelQueryAdapterImpl;
-
-
-public class ModelQueryAdapterFactoryForXML extends AbstractAdapterFactory {
-
- protected ModelQueryAdapterImpl modelQueryAdapterImpl;
- IStructuredModel stateNotifier = null;
- private InternalModelStateListener internalModelStateListener;
-
- /**
- * ModelQueryAdapterFactoryForXML constructor comment.
- */
- public ModelQueryAdapterFactoryForXML() {
- this(ModelQueryAdapter.class, true);
- }
-
- /**
- * ModelQueryAdapterFactoryForXML constructor comment.
- *
- * @param adapterKey
- * java.lang.Object
- * @param registerAdapters
- * boolean
- */
- protected ModelQueryAdapterFactoryForXML(Object adapterKey, boolean registerAdapters) {
- super(adapterKey, registerAdapters);
- }
-
- class InternalModelStateListener implements IModelStateListener {
-
- /**
- * @see IModelStateListener#modelAboutToBeChanged(IStructuredModel)
- */
- public void modelAboutToBeChanged(IStructuredModel model) {
- }
-
- /**
- * @see IModelStateListener#modelChanged(IStructuredModel)
- */
- public void modelChanged(IStructuredModel model) {
- }
-
- /**
- * @see IModelStateListener#modelDirtyStateChanged(IStructuredModel,
- * boolean)
- */
- public void modelDirtyStateChanged(IStructuredModel model, boolean isDirty) {
- }
-
- /**
- * @see IModelStateListener#modelResourceDeleted(IStructuredModel)
- */
- public void modelResourceDeleted(IStructuredModel model) {
- }
-
- /**
- * @see IModelStateListener#modelResourceMoved(IStructuredModel,
- * IStructuredModel)
- */
- public void modelResourceMoved(IStructuredModel oldModel, IStructuredModel newModel) {
- stateNotifier.removeModelStateListener(this);
- stateNotifier = newModel;
- updateResolver(stateNotifier);
- stateNotifier.addModelStateListener(this);
- }
-
- public void modelAboutToBeReinitialized(IStructuredModel structuredModel) {
- // TODO Auto-generated method stub
-
- }
-
- public void modelReinitialized(IStructuredModel structuredModel) {
- updateResolver(structuredModel);
-
- }
-
-
- }
-
- protected boolean autoLoadCM() {
- // until the existence of a CMDocumentRequesterFactory to create the
- // load requests,
- // return true
- return true;
- }
-
- protected void configureDocumentManager(CMDocumentManager mgr) {
- // this depends on there being a CMDocumentRequesterFactory installed
- mgr.setPropertyEnabled(CMDocumentManager.PROPERTY_AUTO_LOAD, autoLoadCM());
- }
-
- public INodeAdapterFactory copy() {
-
- return new ModelQueryAdapterFactoryForXML(getAdapterKey(), isShouldRegisterAdapter());
- }
-
- /**
- * createAdapter method comment.
- */
- protected INodeAdapter createAdapter(INodeNotifier target) {
-
- if (org.eclipse.wst.sse.core.internal.util.Debug.displayInfo)
- System.out.println("-----------------------ModelQueryAdapterFactoryForXML.createAdapter" + target); //$NON-NLS-1$
- if (modelQueryAdapterImpl == null) {
- if (target instanceof IDOMNode) {
- IDOMNode xmlNode = (IDOMNode) target;
- IStructuredModel model = xmlNode.getModel();
- stateNotifier = xmlNode.getModel();
- stateNotifier.addModelStateListener(getInternalModelStateListener());
- String baseLocation = null;
- String modelBaseLocation = model.getBaseLocation();
- if (modelBaseLocation != null) {
- File file = new Path(modelBaseLocation).toFile();
- if (file.exists()) {
- baseLocation = file.getAbsolutePath();
- }
- else {
- IPath basePath = new Path(modelBaseLocation);
- IPath derivedPath = null;
- if (basePath.segmentCount() > 1)
- derivedPath = ResourcesPlugin.getWorkspace().getRoot().getFile(basePath).getLocation();
- else
- derivedPath = ResourcesPlugin.getWorkspace().getRoot().getLocation().append(basePath);
- if (derivedPath != null) {
- baseLocation = derivedPath.toString();
- }
- }
- }
- if (org.eclipse.wst.sse.core.internal.util.Debug.displayInfo)
- System.out.println("----------------ModelQueryAdapterFactoryForXML... baseLocation : " + baseLocation); //$NON-NLS-1$
-
- ModelQuery modelQuery = null;
- URIResolver idResolver = null;
-
- if (org.eclipse.wst.sse.core.internal.util.Debug.displayInfo)
- System.out.println("********XMLModelQueryImpl"); //$NON-NLS-1$
- org.eclipse.wst.sse.core.internal.util.URIResolver resolver = model.getResolver();
- if (baseLocation != null || resolver != null) {
- idResolver = new XMLCatalogIdResolver(baseLocation, resolver);
- }
- modelQuery = new XMLModelQueryImpl(CMDocumentCache.getInstance(), idResolver);
-
- // cs todo...
- // for now we create a CMDocumentCache on a 'per editor' basis
- // in the future we need to support a CMDocumentCache that is
- // shared between editors
- // nsd comment: may not be appropriate depending on
- CMDocumentManager documentManager = modelQuery.getCMDocumentManager();
- if (documentManager != null) {
- configureDocumentManager(documentManager);
- }
- modelQueryAdapterImpl = new ModelQueryAdapterImpl(CMDocumentCache.getInstance(), modelQuery, idResolver);
- }
- }
- return modelQueryAdapterImpl;
- }
-
- public void release() {
- super.release();
- if (stateNotifier != null)
- stateNotifier.removeModelStateListener(getInternalModelStateListener());
- stateNotifier = null;
- if (modelQueryAdapterImpl != null)
- modelQueryAdapterImpl.release();
- }
-
- protected void updateResolver(IStructuredModel model) {
- String baseLocation = model.getBaseLocation();
- IFile baseFile = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(model.getBaseLocation()));
- if (baseFile != null) {
- baseLocation = baseFile.getLocation().toString();
- }
- modelQueryAdapterImpl.setIdResolver(new XMLCatalogIdResolver(baseLocation, model.getResolver()));
- }
-
- private final InternalModelStateListener getInternalModelStateListener() {
- if (internalModelStateListener == null) {
- internalModelStateListener = new InternalModelStateListener();
- }
- return internalModelStateListener;
- }
-}
diff --git a/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/modelquery/ModelQueryUtil.java b/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/modelquery/ModelQueryUtil.java
deleted file mode 100644
index fd7572f1f3..0000000000
--- a/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/modelquery/ModelQueryUtil.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.xml.core.internal.modelquery;
-
-
-
-import org.eclipse.wst.common.uriresolver.internal.provisional.URIResolver;
-import org.eclipse.wst.sse.core.internal.provisional.INodeNotifier;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-import org.eclipse.wst.xml.core.internal.contentmodel.modelquery.ModelQuery;
-import org.eclipse.wst.xml.core.internal.contentmodel.util.CMDocumentCache;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
-import org.eclipse.wst.xml.core.internal.ssemodelquery.ModelQueryAdapter;
-import org.w3c.dom.Document;
-
-
-/**
- * This class is used to associate ModelQuery (and related data) with a
- * Document (or IStructuredModel).
- */
-public class ModelQueryUtil {
-
- public static CMDocumentCache getCMDocumentCache(Document node) {
- ModelQueryAdapter modelQueryAdapter = getModelQueryAdapter(node);
- return modelQueryAdapter != null ? modelQueryAdapter.getCMDocumentCache() : null;
- }
-
- public static URIResolver getIdResolver(Document node) {
- ModelQueryAdapter modelQueryAdapter = getModelQueryAdapter(node);
- return modelQueryAdapter != null ? modelQueryAdapter.getIdResolver() : null;
- }
-
- public static ModelQuery getModelQuery(Document node) {
- ModelQueryAdapter modelQueryAdapter = getModelQueryAdapter(node);
- return modelQueryAdapter != null ? modelQueryAdapter.getModelQuery() : null;
- }
-
- public static ModelQuery getModelQuery(IStructuredModel model) {
- if ((!(model instanceof IDOMModel)) || model == null)
- return null;
- return getModelQuery(((IDOMModel) model).getDocument());
- }
-
- public static ModelQueryAdapter getModelQueryAdapter(Document node) {
- ModelQueryAdapter result = null;
-
- if (node instanceof INodeNotifier) {
- INodeNotifier notifier = (INodeNotifier) node;
- result = (ModelQueryAdapter) notifier.getAdapterFor(ModelQueryAdapter.class);
- }
-
- return result;
- }
-}
diff --git a/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/modelquery/XMLCatalogIdResolver.java b/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/modelquery/XMLCatalogIdResolver.java
deleted file mode 100644
index d1fd40f69d..0000000000
--- a/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/modelquery/XMLCatalogIdResolver.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.xml.core.internal.modelquery;
-
-
-import org.eclipse.wst.common.uriresolver.internal.provisional.URIResolverPlugin;
-import org.eclipse.wst.common.uriresolver.internal.util.URIHelper;
-import org.eclipse.wst.sse.core.internal.util.Assert;
-import org.eclipse.wst.sse.core.internal.util.URIResolver;
-import org.eclipse.wst.xml.core.internal.Logger;
-
-
-// TODO cs : remove this class and utilize the common URIResolver directly
-// We need to update some of the ModelQuery related code to pass the
-// 'baseLocation' thru
-// and then there'll be node need for this class.
-//
-public class XMLCatalogIdResolver implements org.eclipse.wst.common.uriresolver.internal.provisional.URIResolver {
- protected String resourceLocation;
-
- protected URIResolver uriresolver;
-
- private XMLCatalogIdResolver() {
- super();
- }
-
- private XMLCatalogIdResolver(String resourceLocation) {
- this();
- this.resourceLocation = resourceLocation;
- }
-
- public XMLCatalogIdResolver(String resourceLocation, URIResolver uriresolver) {
- this(resourceLocation);
-// this constructor should not be called with two null arguments.
-// If so, an assert will occur later when resolve is called.
-// See 118371 XMLCatalogIdResolver#resolve throws AssertionFailedException
-//
-// but, I'm not enabling this check now due to lateness in cycle.
-// if (resourceLocation == null && uriresolver == null) {
-// throw new IllegalArgumentException("both location and resolver can not be null");
-// }
- this.uriresolver = uriresolver;
- }
-
-
- /**
- * Gets the resourceLocation.
- *
- * @return Returns a String
- */
- private String getResourceLocation() {
- String location = resourceLocation;
- if (location == null) {
- if (uriresolver != null)
- location = uriresolver.getFileBaseLocation();
- }
- return location;
- }
-
-
- 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 String resolvePhysicalLocation(String baseLocation, String publicId, String logicalLocation) {
- // This class should never be called to perform physical resolution!
- // If it does we should log it as an error
- Logger.log(Logger.ERROR_DEBUG, "XMLCatalogIDResolver.resolvePhysicalLocation() called unexpectedly"); //$NON-NLS-1$
- return logicalLocation;
- }
-}
diff --git a/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/modelquery/XMLModelQueryAssociationProvider.java b/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/modelquery/XMLModelQueryAssociationProvider.java
deleted file mode 100644
index da470adea8..0000000000
--- a/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/modelquery/XMLModelQueryAssociationProvider.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.xml.core.internal.modelquery;
-
-
-
-import org.eclipse.wst.common.uriresolver.internal.provisional.URIResolver;
-import org.eclipse.wst.xml.core.internal.contentmodel.modelqueryimpl.XMLAssociationProvider;
-import org.eclipse.wst.xml.core.internal.contentmodel.util.CMDocumentCache;
-import org.w3c.dom.Document;
-
-/**
- * XMLModelQueryAssociationProvider
- *
- * This added and/or made public specifically for experimentation. It will
- * change as this functionality becomes API. See
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=119084
- *
- */
-public class XMLModelQueryAssociationProvider extends XMLAssociationProvider {
-
- protected URIResolver idResolver;
-
- public XMLModelQueryAssociationProvider(CMDocumentCache cache, URIResolver idResolver) {
- super(cache);
- this.idResolver = idResolver;
- }
-
- protected String resolveGrammarURI(Document document, String publicId, String systemId) {
-
- // CS : spooky code alert!
- // this look really strange because we're passing null in as the first
- // argument
- // however we're assuming the use of a 'fudged' URIResolver that knows
- // the
- // correct baseLocation and will call to the URIResolver framework
- // properly
-
- // CS : note that we should never call resolvePhysical at this point.
- // Physical resolution should only occur when we're interesting to
- // opening the actual stream.
- // The CMDocumentFactory implementation would be responsible for
- // calling resolvePhysical.
- // All we need to do here is return a 'logical' URI
-
- if (idResolver == null)
- return null;
- return idResolver.resolve(null, publicId, systemId);
- }
-}
diff --git a/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/modelquery/XMLModelQueryImpl.java b/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/modelquery/XMLModelQueryImpl.java
deleted file mode 100644
index 2992a799d6..0000000000
--- a/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/modelquery/XMLModelQueryImpl.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.xml.core.internal.modelquery;
-
-
-
-import org.eclipse.wst.common.uriresolver.internal.provisional.URIResolver;
-import org.eclipse.wst.xml.core.internal.contentmodel.modelqueryimpl.ModelQueryImpl;
-import org.eclipse.wst.xml.core.internal.contentmodel.util.CMDocumentCache;
-import org.eclipse.wst.xml.core.internal.ssemodelquery.MovableModelQuery;
-
-
-public class XMLModelQueryImpl extends ModelQueryImpl implements MovableModelQuery {
-
- protected CMDocumentCache fCache = null;
-
- public XMLModelQueryImpl(CMDocumentCache cache, URIResolver idResolver) {
- super(new XMLModelQueryAssociationProvider(cache, idResolver));
- fCache = cache;
- }
-
- /**
- * @see MovableModelQuery#setIdResolver(URIResolver)
- */
- public void setIdResolver(URIResolver newIdResolver) {
- modelQueryAssociationProvider = new XMLModelQueryAssociationProvider(fCache, newIdResolver);
- }
-}

Back to the top