Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 39289 Details for
Bug 137063
GMFResource's abort on error load option is internal API
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch to publish some internal APIs
bug137063.patch (text/plain), 45.35 KB, created by
Christian Damus
on 2006-04-24 11:30:48 EDT
(
hide
)
Description:
Patch to publish some internal APIs
Filename:
MIME Type:
Creator:
Christian Damus
Created:
2006-04-24 11:30:48 EDT
Size:
45.35 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.gmf.runtime.emf.core >Index: src/org/eclipse/gmf/runtime/emf/core/internal/resources/GMFResource.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.runtime.emf.core/src/org/eclipse/gmf/runtime/emf/core/internal/resources/GMFResource.java,v >retrieving revision 1.2 >diff -u -r1.2 GMFResource.java >--- src/org/eclipse/gmf/runtime/emf/core/internal/resources/GMFResource.java 24 Feb 2006 14:56:32 -0000 1.2 >+++ src/org/eclipse/gmf/runtime/emf/core/internal/resources/GMFResource.java 24 Apr 2006 15:12:54 -0000 >@@ -11,63 +11,26 @@ > > package org.eclipse.gmf.runtime.emf.core.internal.resources; > >-import org.eclipse.emf.common.notify.Adapter; >-import org.eclipse.emf.common.notify.Notification; >-import org.eclipse.emf.common.notify.NotificationChain; > import org.eclipse.emf.common.util.URI; >-import org.eclipse.emf.ecore.EObject; >-import org.eclipse.emf.ecore.EStructuralFeature; >-import org.eclipse.emf.ecore.resource.ResourceSet; > import org.eclipse.emf.ecore.xmi.XMLHelper; > import org.eclipse.emf.ecore.xmi.XMLLoad; >-import org.eclipse.emf.ecore.xmi.XMLSave; >-import org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl; >-import org.eclipse.emf.ecore.xmi.impl.XMISaveImpl; >-import org.eclipse.gmf.runtime.emf.core.internal.util.EMFCoreConstants; >-import org.eclipse.gmf.runtime.emf.core.internal.util.Util; > > /** > * Custom implementation of an XMIResource. > * > * @author rafikj >+ * >+ * @deprecated Use the {@link org.eclipse.gmf.runtime.emf.core.resources.GMFResource} >+ * class, instead > */ > public class GMFResource >- extends XMIResourceImpl { >- >- /** >- * Use this option to abort loading a resource immediately when an error occurs. >- * The default is <code>Boolean.FALSE</code> unless set to <code>Boolean.TRUE</code> explicitly. >- */ >- public static final String OPTION_ABORT_ON_ERROR = "ABORT_ON_ERROR"; //$NON-NLS-1$ >- >- private boolean useIDAttributes = false; >+ extends org.eclipse.gmf.runtime.emf.core.resources.GMFResource { > > /** > * Constructor. > */ > public GMFResource(URI uri) { >- > super(uri); >- >- setTrackingModification(true); >- } >- >- protected boolean useUUIDs() { >- return true; >- } >- >- /** >- * Should we use ID attribute? >- */ >- public void setUseIDAttributes(boolean b) { >- useIDAttributes = b; >- } >- >- /** >- * Should we use ID attribute? >- */ >- protected boolean useIDAttributes() { >- return useIDAttributes; > } > > protected XMLHelper createXMLHelper() { >@@ -77,121 +40,4 @@ > protected XMLLoad createXMLLoad() { > return new GMFLoad(createXMLHelper()); > } >- >- protected XMLSave createXMLSave() { >- return new XMISaveImpl(createXMLHelper()); >- } >- >- /** >- * @see org.eclipse.emf.ecore.resource.Resource#getEObject(java.lang.String) >- */ >- public EObject getEObject(String uriFragment) { >- >- int index = uriFragment.indexOf(EMFCoreConstants.FRAGMENT_SEPARATOR); >- >- if (index != -1) >- uriFragment = uriFragment.substring(0, index); >- >- return super.getEObject(uriFragment); >- } >- >- /** >- * Get the saved ID of an EObject. >- */ >- public static String getSavedID(EObject eObject) { >- return (String) DETACHED_EOBJECT_TO_ID_MAP.get(eObject); >- } >- >- /** >- * @see org.eclipse.emf.ecore.resource.Resource#setURI(org.eclipse.emf.common.util.URI) >- */ >- public void setURI(URI uri) { >- >- if (getResourceSet() != null) { >- setRawURI(Util.denormalizeURI(uri, getResourceSet())); >- } >- } >- >- public NotificationChain basicSetResourceSet(ResourceSet rset, NotificationChain notifications) { >- // when I am added to a new resource set, my optimally denormalized URI >- // may change according to its different URI converter >- if (rset != null) { >- setURI(getURI()); >- } >- >- return super.basicSetResourceSet(rset, notifications); >- } >- >- /** >- * Set the URI of the resource without processing it. >- */ >- public void setRawURI(URI uri) { >- >- URI oldURI = getURI(); >- >- if ((uri == oldURI) || ((uri != null) && (uri.equals(oldURI)))) >- return; >- >- super.setURI(uri); >- } >- >- /** >- * The inherited implementation creates an adapter that <em>always</em> sets >- * the modified state. We prefer to check, first, whether the resource >- * is already modified so that we don't generate redundant notifications. >- * Moreover, we additionally set modified state only for changes that are >- * in non-transient features of objects contained (recursively) by >- * non-transient references. >- */ >- protected Adapter createModificationTrackingAdapter() { >- return new ModificationTrackingAdapter() { >- public void notifyChanged(Notification notification) { >- if (!isModified() && !isTransient( >- notification.getNotifier(), notification.getFeature())) { >- >- super.notifyChanged(notification); >- } >- } >- >- /** >- * Check if the feature or one of the notifier's containers is >- * transient. >- * >- * @param notifier a notifier >- * @param feature the feature that changed >- * >- * @return <code>true</code> if the feature is transient or if the >- * notifier or any of its ancestors is contained by a transient >- * reference; <code>false</code>, otherwise >- */ >- private boolean isTransient(Object notifier, Object feature) { >- if (feature instanceof EStructuralFeature) { >- if (((EStructuralFeature) feature).isTransient()) >- return true; >- else >- // calling isTransient could be a lengthy operation. >- // It is safe to cast because the adapter is only >- // attached to EObjects, not to the resource >- return isTransient((EObject) notifier); >- } >- return false; >- } >- >- /** >- * Is object transient? >- */ >- private boolean isTransient(EObject eObject) { >- EStructuralFeature containmentFeature = eObject.eContainmentFeature(); >- while (containmentFeature != null) { >- if (containmentFeature.isTransient()) >- return true; >- eObject = eObject.eContainer(); >- if (eObject != null) >- containmentFeature = eObject.eContainmentFeature(); >- else >- break; >- } >- return false; >- }}; >- } > } >\ No newline at end of file >Index: src/org/eclipse/gmf/runtime/emf/core/internal/resources/PathmapManager.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.runtime.emf.core/src/org/eclipse/gmf/runtime/emf/core/internal/resources/PathmapManager.java,v >retrieving revision 1.3 >diff -u -r1.3 PathmapManager.java >--- src/org/eclipse/gmf/runtime/emf/core/internal/resources/PathmapManager.java 20 Apr 2006 14:42:45 -0000 1.3 >+++ src/org/eclipse/gmf/runtime/emf/core/internal/resources/PathmapManager.java 24 Apr 2006 15:12:55 -0000 >@@ -52,6 +52,8 @@ > import org.eclipse.gmf.runtime.emf.core.internal.plugin.EMFCoreDebugOptions; > import org.eclipse.gmf.runtime.emf.core.internal.plugin.EMFCorePlugin; > import org.eclipse.gmf.runtime.emf.core.internal.util.EMFCoreConstants; >+import org.eclipse.gmf.runtime.emf.core.resources.GMFResource; >+import org.eclipse.gmf.runtime.emf.core.resources.IPathmapManager; > import org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil; > import org.osgi.framework.Bundle; > import org.osgi.service.prefs.BackingStoreException; >@@ -61,7 +63,7 @@ > * > * @author rafikj > */ >-public class PathmapManager extends AdapterImpl { >+public class PathmapManager extends AdapterImpl implements IPathmapManager { > // path maps can be defined using an extension point: Pathmaps > // or by referencing an eclipse path variable > // or by adding a pathmap manually >@@ -200,7 +202,7 @@ > public static void removePathVariableReference(String pathVariable) { > if (referencedPathVariablesList.contains(pathVariable)) { > referencedPathVariablesList.remove(pathVariable); >- removePathVariable(pathVariable); >+ unsetPathVariable(pathVariable); > } > } > >@@ -305,10 +307,16 @@ > } > } > >+ public IStatus addPathVariable(String name, String value) { >+ setPathVariable(name, value); >+ >+ return Status.OK_STATUS; // TODO: report accurate status >+ } >+ > /** > * Remove a pathmap variable. > */ >- public static void removePathVariable(String var) { >+ public static void unsetPathVariable(String var) { > PATH_MAP.remove(var); > > for (Iterator i = allInstances().iterator(); i.hasNext();) { >@@ -316,6 +324,12 @@ > } > } > >+ public IStatus removePathVariable(String name) { >+ unsetPathVariable(name); >+ >+ return Status.OK_STATUS; // TODO: report accurate status >+ } >+ > /** > * Obtains the resource set for which I manage the path mappings. > * >Index: src/org/eclipse/gmf/runtime/emf/core/internal/resources/GMFHandler.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.runtime.emf.core/src/org/eclipse/gmf/runtime/emf/core/internal/resources/GMFHandler.java,v >retrieving revision 1.2 >diff -u -r1.2 GMFHandler.java >--- src/org/eclipse/gmf/runtime/emf/core/internal/resources/GMFHandler.java 22 Feb 2006 17:55:34 -0000 1.2 >+++ src/org/eclipse/gmf/runtime/emf/core/internal/resources/GMFHandler.java 24 Apr 2006 15:12:54 -0000 >@@ -1,5 +1,5 @@ > /****************************************************************************** >- * Copyright (c) 2004 IBM Corporation and others. >+ * Copyright (c) 2004, 2006 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 >@@ -11,37 +11,22 @@ > > package org.eclipse.gmf.runtime.emf.core.internal.resources; > >-import java.util.HashMap; >-import java.util.Iterator; > import java.util.Map; > >-import org.eclipse.emf.common.util.URI; >-import org.eclipse.emf.ecore.EFactory; >-import org.eclipse.emf.ecore.EObject; >-import org.eclipse.emf.ecore.EPackage; >-import org.eclipse.emf.ecore.EStructuralFeature; >-import org.eclipse.emf.ecore.InternalEObject; >-import org.eclipse.emf.ecore.resource.Resource; >-import org.eclipse.emf.ecore.resource.impl.ResourceImpl; >-import org.eclipse.emf.ecore.xmi.XMIException; > import org.eclipse.emf.ecore.xmi.XMLHelper; > import org.eclipse.emf.ecore.xmi.XMLResource; >-import org.eclipse.emf.ecore.xmi.impl.SAXXMIHandler; >-import org.eclipse.emf.ecore.xml.type.AnyType; >-import org.eclipse.gmf.runtime.emf.core.internal.exceptions.AbortResourceLoadException; > > /** > * The SAX handler for MSL resources. Updates demand-created packages with their > * namespace prefixes and schema locations. > * > * @author khussey >+ * >+ * @deprecated Use the {@link org.eclipse.gmf.runtime.emf.core.resources.GMFHandler} >+ * class, instead > */ > public class GMFHandler >- extends SAXXMIHandler { >- >- protected final Map urisToProxies; >- >- protected boolean abortOnError; >+ extends org.eclipse.gmf.runtime.emf.core.resources.GMFHandler { > > /** > * Constructs a new MSL handler for the specified resource with the >@@ -56,98 +41,5 @@ > */ > public GMFHandler(XMLResource xmiResource, XMLHelper helper, Map options) { > super(xmiResource, helper, options); >- >- urisToProxies = new HashMap(); >- if (Boolean.TRUE.equals(options.get(GMFResource.OPTION_ABORT_ON_ERROR))) { >- abortOnError = true; >- } >- } >- >- /** >- * @see org.eclipse.emf.ecore.xmi.impl.XMLHandler#endDocument() >- */ >- public void endDocument() { >- super.endDocument(); >- >- if (null != extendedMetaData) { >- >- for (Iterator demandedPackages = extendedMetaData >- .demandedPackages().iterator(); demandedPackages.hasNext();) { >- >- EPackage ePackage = (EPackage) demandedPackages.next(); >- String nsURI = ePackage.getNsURI(); >- >- if (null != nsURI) { >- >- if (null != urisToLocations) { >- URI locationURI = (URI) urisToLocations.get(nsURI); >- >- if (null != locationURI) { >- // set the schema location >- Resource resource = new ResourceImpl(); >- resource.setURI(locationURI); >- resource.getContents().add(ePackage); >- } >- } >- >- for (Iterator entries = helper.getPrefixToNamespaceMap() >- .iterator(); entries.hasNext();) { >- >- Map.Entry entry = (Map.Entry) entries.next(); >- >- if (nsURI.equals(entry.getValue())) { >- // set the namespace prefix >- ePackage.setNsPrefix((String) entry.getKey()); >- } >- } >- } >- } >- } >- } >- >- /** >- * @see org.eclipse.emf.ecore.xmi.impl.XMLHandler#validateCreateObjectFromFactory(org.eclipse.emf.ecore.EFactory, >- * java.lang.String, org.eclipse.emf.ecore.EObject, >- * org.eclipse.emf.ecore.EStructuralFeature) >- */ >- protected EObject validateCreateObjectFromFactory(EFactory factory, >- String typeName, EObject newObject, EStructuralFeature feature) { >- >- if (!(objects.peek() instanceof AnyType) && null != newObject >- && newObject.eIsProxy() && !sameDocumentProxies.contains(newObject)) { >- >- URI proxyURI = ((InternalEObject) newObject).eProxyURI(); >- >- Map typeNamesToProxies = (Map) urisToProxies.get(proxyURI); >- >- if (null == typeNamesToProxies) { >- urisToProxies.put(proxyURI, typeNamesToProxies = new HashMap()); >- } >- >- EObject proxy = (EObject) typeNamesToProxies.get(typeName); >- >- if (null == proxy) { >- typeNamesToProxies.put(typeName, proxy = newObject); >- } >- >- // canonicalize proxies >- newObject = proxy; >- } >- >- return super.validateCreateObjectFromFactory(factory, typeName, >- newObject, feature); >- } >- >- /** >- * @see org.eclipse.emf.ecore.xmi.impl.XMLHandler#error(org.eclipse.emf.ecore.xmi.XMIException) >- */ >- public void error(XMIException e) { >- super.error(e); >- if (abortOnError) { >- if (e.getWrappedException() != null) { >- throw new AbortResourceLoadException(e.getWrappedException()); >- } >- throw new AbortResourceLoadException(e); >- } > } > } >\ No newline at end of file >Index: src/org/eclipse/gmf/runtime/emf/core/internal/resources/GMFHelper.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.runtime.emf.core/src/org/eclipse/gmf/runtime/emf/core/internal/resources/GMFHelper.java,v >retrieving revision 1.2 >diff -u -r1.2 GMFHelper.java >--- src/org/eclipse/gmf/runtime/emf/core/internal/resources/GMFHelper.java 22 Feb 2006 17:55:34 -0000 1.2 >+++ src/org/eclipse/gmf/runtime/emf/core/internal/resources/GMFHelper.java 24 Apr 2006 15:12:54 -0000 >@@ -1,5 +1,5 @@ > /****************************************************************************** >- * Copyright (c) 2004 IBM Corporation and others. >+ * Copyright (c) 2004, 2006 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 >@@ -11,19 +11,19 @@ > > package org.eclipse.gmf.runtime.emf.core.internal.resources; > >-import org.eclipse.emf.common.util.URI; > import org.eclipse.emf.ecore.xmi.XMLResource; >-import org.eclipse.emf.ecore.xmi.impl.XMIHelperImpl; >-import org.eclipse.gmf.runtime.emf.core.internal.util.EMFCoreConstants; > > /** > * This class changes the behavior of the default XMIHelper so that references > * between projects are not deresolved. > * > * @author rafikj >+ * >+ * @deprecated Use the {@link org.eclipse.gmf.runtime.emf.core.resources.GMFHelper} >+ * class, instead > */ > public class GMFHelper >- extends XMIHelperImpl { >+ extends org.eclipse.gmf.runtime.emf.core.resources.GMFHelper { > > /** > * Constructor. >@@ -31,22 +31,4 @@ > public GMFHelper(XMLResource resource) { > super(resource); > } >- >- /** >- * @see org.eclipse.emf.ecore.xmi.XMLHelper#deresolve(org.eclipse.emf.common.util.URI) >- */ >- public URI deresolve(URI uri) { >- >- // if this both target and container are within a platform resource and >- // projects >- // or plugins are different then do not deresolve. >- if (((EMFCoreConstants.PLATFORM_SCHEME.equals(uri.scheme())) && (EMFCoreConstants.PLATFORM_SCHEME >- .equals(resourceURI.scheme()))) >- && ((uri.segmentCount() > 2) && (resourceURI.segmentCount() > 2)) >- && ((!uri.segments()[0].equals(resourceURI.segments()[0])) || (!uri >- .segments()[1].equals(resourceURI.segments()[1])))) >- return uri; >- >- return super.deresolve(uri); >- } > } >\ No newline at end of file >Index: src/org/eclipse/gmf/runtime/emf/core/internal/resources/GMFLoad.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.runtime.emf.core/src/org/eclipse/gmf/runtime/emf/core/internal/resources/GMFLoad.java,v >retrieving revision 1.1 >diff -u -r1.1 GMFLoad.java >--- src/org/eclipse/gmf/runtime/emf/core/internal/resources/GMFLoad.java 8 Feb 2006 14:52:11 -0000 1.1 >+++ src/org/eclipse/gmf/runtime/emf/core/internal/resources/GMFLoad.java 24 Apr 2006 15:12:54 -0000 >@@ -1,5 +1,5 @@ > /****************************************************************************** >- * Copyright (c) 2004 IBM Corporation and others. >+ * Copyright (c) 2004, 2006 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 >@@ -11,17 +11,8 @@ > > package org.eclipse.gmf.runtime.emf.core.internal.resources; > >-import java.io.IOException; >-import java.io.InputStream; >-import java.util.Map; >- >-import org.eclipse.emf.ecore.resource.Resource; >-import org.eclipse.emf.ecore.xmi.UnresolvedReferenceException; > import org.eclipse.emf.ecore.xmi.XMLHelper; >-import org.eclipse.emf.ecore.xmi.XMLResource; > import org.eclipse.emf.ecore.xmi.impl.SAXWrapper; >-import org.eclipse.emf.ecore.xmi.impl.XMILoadImpl; >-import org.eclipse.gmf.runtime.emf.core.internal.exceptions.AbortResourceLoadException; > import org.xml.sax.helpers.DefaultHandler; > > /** >@@ -29,9 +20,12 @@ > * UnresolvedReferenceExceptions are not thrown back. > * > * @author rafikj >+ * >+ * @deprecated Use the {@link org.eclipse.gmf.runtime.emf.core.resources.GMFLoad} >+ * class, instead > */ > public class GMFLoad >- extends XMILoadImpl { >+ extends org.eclipse.gmf.runtime.emf.core.resources.GMFLoad { > > /** > * Constructor. >@@ -41,25 +35,6 @@ > } > > /** >- * @see org.eclipse.emf.ecore.xmi.XMLLoad#load(org.eclipse.emf.ecore.xmi.XMLResource, >- * java.io.InputStream, java.util.Map) >- */ >- public void load(XMLResource r, InputStream s, Map o) >- throws IOException { >- >- try { >- >- super.load(r, s, o); >- >- } catch (Resource.IOWrappedException e) { >- if (!(e.getWrappedException() instanceof UnresolvedReferenceException)) >- throw e; >- } catch (AbortResourceLoadException arle) { >- throw new Resource.IOWrappedException((Exception)arle.getCause()); >- } >- } >- >- /** > * @see org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl#makeDefaultHandler() > */ > protected DefaultHandler makeDefaultHandler() { >Index: src/org/eclipse/gmf/runtime/emf/core/resources/IResourceHelper.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.runtime.emf.core/src/org/eclipse/gmf/runtime/emf/core/resources/IResourceHelper.java,v >retrieving revision 1.3 >diff -u -r1.3 IResourceHelper.java >--- src/org/eclipse/gmf/runtime/emf/core/resources/IResourceHelper.java 7 Mar 2006 02:40:43 -0000 1.3 >+++ src/org/eclipse/gmf/runtime/emf/core/resources/IResourceHelper.java 24 Apr 2006 15:12:55 -0000 >@@ -14,8 +14,6 @@ > import org.eclipse.emf.common.notify.Adapter; > import org.eclipse.emf.ecore.EClass; > import org.eclipse.emf.ecore.EObject; >-import org.eclipse.emf.ecore.resource.Resource; >-import org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil; > > > /** >Index: src/org/eclipse/gmf/runtime/emf/core/resources/package.html >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.runtime.emf.core/src/org/eclipse/gmf/runtime/emf/core/resources/package.html,v >retrieving revision 1.4 >diff -u -r1.4 package.html >--- src/org/eclipse/gmf/runtime/emf/core/resources/package.html 12 Apr 2006 17:54:51 -0000 1.4 >+++ src/org/eclipse/gmf/runtime/emf/core/resources/package.html 24 Apr 2006 15:12:55 -0000 >@@ -4,7 +4,7 @@ > <!-- > > /****************************************************************************** >- * Copyright (c) 2005 IBM Corporation and others. >+ * Copyright (c) 2005, 2006 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 >@@ -28,10 +28,19 @@ > creates GMF resources. It is not intended to be used by client code, but to > be referenced on the EMF <tt>org.eclipse.emf.ecore.extension_parser</tt> > extension point to associate the client application's file extension with the >-resource factory. >+resource factory. Associated with this factory is the >+{@link org.eclipse.gmf.runtime.emf.core.resources.GMFResource} class which is >+GMF's custom resource implementation, supporting path map URIs and automatic >+URI denormalization and modification tracking. >+</p> >+<p> >+This package also defines a {@link org.eclipse.gmf.runtime.emf.core.resources.PathmapManager} >+class which has static API methods for managing path map variables, in particular >+for defining path maps statically for your plug-in's resources. > </p> > > @see org.eclipse.gmf.runtime.emf.core.resources.GMFResourceFactory >+@see org.eclipse.gmf.runtime.emf.core.resources.PathmapManager > > @canBeSeenBy %partners > >Index: src/org/eclipse/gmf/runtime/emf/core/resources/GMFResourceFactory.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.runtime.emf.core/src/org/eclipse/gmf/runtime/emf/core/resources/GMFResourceFactory.java,v >retrieving revision 1.1 >diff -u -r1.1 GMFResourceFactory.java >--- src/org/eclipse/gmf/runtime/emf/core/resources/GMFResourceFactory.java 8 Feb 2006 14:52:10 -0000 1.1 >+++ src/org/eclipse/gmf/runtime/emf/core/resources/GMFResourceFactory.java 24 Apr 2006 15:12:55 -0000 >@@ -20,7 +20,6 @@ > import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl; > import org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl; > >-import org.eclipse.gmf.runtime.emf.core.internal.resources.GMFResource; > import org.eclipse.gmf.runtime.emf.core.internal.util.EMFCoreConstants; > > /** >Index: src/org/eclipse/gmf/runtime/emf/core/resources/IExtendedResourceFactory.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.runtime.emf.core/src/org/eclipse/gmf/runtime/emf/core/resources/IExtendedResourceFactory.java,v >retrieving revision 1.2 >diff -u -r1.2 IExtendedResourceFactory.java >--- src/org/eclipse/gmf/runtime/emf/core/resources/IExtendedResourceFactory.java 22 Feb 2006 17:55:34 -0000 1.2 >+++ src/org/eclipse/gmf/runtime/emf/core/resources/IExtendedResourceFactory.java 24 Apr 2006 15:12:55 -0000 >@@ -12,7 +12,6 @@ > package org.eclipse.gmf.runtime.emf.core.resources; > > import org.eclipse.emf.ecore.EObject; >-import org.eclipse.emf.ecore.resource.Resource; > import org.eclipse.emf.transaction.TransactionalEditingDomain; > > >Index: src/org/eclipse/gmf/runtime/emf/core/internal/exceptions/AbortResourceLoadException.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.runtime.emf.core/src/org/eclipse/gmf/runtime/emf/core/internal/exceptions/AbortResourceLoadException.java,v >retrieving revision 1.2 >diff -u -r1.2 AbortResourceLoadException.java >--- src/org/eclipse/gmf/runtime/emf/core/internal/exceptions/AbortResourceLoadException.java 8 Feb 2006 14:52:13 -0000 1.2 >+++ src/org/eclipse/gmf/runtime/emf/core/internal/exceptions/AbortResourceLoadException.java 24 Apr 2006 15:12:54 -0000 >@@ -17,8 +17,13 @@ > * abort loading at any time. > * > * @author Christian Vogt (cvogt) >+ * >+ * @deprecated Use the {@link org.eclipse.gmf.runtime.emf.core.resources.AbortResourceLoadException} >+ * exception, instead. > */ >-public class AbortResourceLoadException extends RuntimeException { >+public class AbortResourceLoadException extends org.eclipse.gmf.runtime.emf.core.resources.AbortResourceLoadException { >+ >+ private static final long serialVersionUID = 1317448650831196205L; > > /** > * Initializes me without any details. >@@ -44,7 +49,6 @@ > * the cause of this exception. > */ > public AbortResourceLoadException(Throwable cause) { >- super(null == cause ? null >- : cause.toString(), cause); >+ super(cause); > } > } >Index: src/org/eclipse/gmf/runtime/emf/core/clipboard/CopyingResource.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.runtime.emf.core/src/org/eclipse/gmf/runtime/emf/core/clipboard/CopyingResource.java,v >retrieving revision 1.5 >diff -u -r1.5 CopyingResource.java >--- src/org/eclipse/gmf/runtime/emf/core/clipboard/CopyingResource.java 24 Feb 2006 14:56:32 -0000 1.5 >+++ src/org/eclipse/gmf/runtime/emf/core/clipboard/CopyingResource.java 24 Apr 2006 15:12:54 -0000 >@@ -35,7 +35,7 @@ > import org.eclipse.gmf.runtime.common.core.util.Trace; > import org.eclipse.gmf.runtime.emf.core.internal.plugin.EMFCoreDebugOptions; > import org.eclipse.gmf.runtime.emf.core.internal.plugin.EMFCorePlugin; >-import org.eclipse.gmf.runtime.emf.core.internal.resources.GMFResource; >+import org.eclipse.gmf.runtime.emf.core.resources.GMFResource; > import org.eclipse.gmf.runtime.emf.core.internal.util.EMFCoreConstants; > import org.eclipse.gmf.runtime.emf.core.internal.util.Util; > import org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil; >Index: src/org/eclipse/gmf/runtime/emf/core/resources/GMFHelper.java >=================================================================== >RCS file: src/org/eclipse/gmf/runtime/emf/core/resources/GMFHelper.java >diff -N src/org/eclipse/gmf/runtime/emf/core/resources/GMFHelper.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/gmf/runtime/emf/core/resources/GMFHelper.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,52 @@ >+/****************************************************************************** >+ * Copyright (c) 2004, 2006 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 >+ ****************************************************************************/ >+ >+package org.eclipse.gmf.runtime.emf.core.resources; >+ >+import org.eclipse.emf.common.util.URI; >+import org.eclipse.emf.ecore.xmi.XMLResource; >+import org.eclipse.emf.ecore.xmi.impl.XMIHelperImpl; >+import org.eclipse.gmf.runtime.emf.core.internal.util.EMFCoreConstants; >+ >+/** >+ * This class changes the behavior of the default XMIHelper so that references >+ * between projects are not deresolved. >+ * >+ * @author rafikj >+ */ >+public class GMFHelper >+ extends XMIHelperImpl { >+ >+ /** >+ * Constructor. >+ */ >+ public GMFHelper(XMLResource resource) { >+ super(resource); >+ } >+ >+ /** >+ * @see org.eclipse.emf.ecore.xmi.XMLHelper#deresolve(org.eclipse.emf.common.util.URI) >+ */ >+ public URI deresolve(URI uri) { >+ >+ // if this both target and container are within a platform resource and >+ // projects >+ // or plugins are different then do not deresolve. >+ if (((EMFCoreConstants.PLATFORM_SCHEME.equals(uri.scheme())) && (EMFCoreConstants.PLATFORM_SCHEME >+ .equals(resourceURI.scheme()))) >+ && ((uri.segmentCount() > 2) && (resourceURI.segmentCount() > 2)) >+ && ((!uri.segments()[0].equals(resourceURI.segments()[0])) || (!uri >+ .segments()[1].equals(resourceURI.segments()[1])))) >+ return uri; >+ >+ return super.deresolve(uri); >+ } >+} >Index: src/org/eclipse/gmf/runtime/emf/core/resources/GMFResource.java >=================================================================== >RCS file: src/org/eclipse/gmf/runtime/emf/core/resources/GMFResource.java >diff -N src/org/eclipse/gmf/runtime/emf/core/resources/GMFResource.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/gmf/runtime/emf/core/resources/GMFResource.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,197 @@ >+/****************************************************************************** >+ * Copyright (c) 2004-2006 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 >+ ****************************************************************************/ >+ >+package org.eclipse.gmf.runtime.emf.core.resources; >+ >+import org.eclipse.emf.common.notify.Adapter; >+import org.eclipse.emf.common.notify.Notification; >+import org.eclipse.emf.common.notify.NotificationChain; >+import org.eclipse.emf.common.util.URI; >+import org.eclipse.emf.ecore.EObject; >+import org.eclipse.emf.ecore.EStructuralFeature; >+import org.eclipse.emf.ecore.resource.ResourceSet; >+import org.eclipse.emf.ecore.xmi.XMLHelper; >+import org.eclipse.emf.ecore.xmi.XMLLoad; >+import org.eclipse.emf.ecore.xmi.XMLSave; >+import org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl; >+import org.eclipse.emf.ecore.xmi.impl.XMISaveImpl; >+import org.eclipse.gmf.runtime.emf.core.internal.util.EMFCoreConstants; >+import org.eclipse.gmf.runtime.emf.core.internal.util.Util; >+ >+/** >+ * Custom implementation of an XMIResource. >+ * >+ * @author rafikj >+ */ >+public class GMFResource >+ extends XMIResourceImpl { >+ >+ /** >+ * Use this option to abort loading a resource immediately when an error occurs. >+ * The default is <code>Boolean.FALSE</code> unless set to <code>Boolean.TRUE</code> explicitly. >+ */ >+ public static final String OPTION_ABORT_ON_ERROR = "ABORT_ON_ERROR"; //$NON-NLS-1$ >+ >+ private boolean useIDAttributes = false; >+ >+ /** >+ * Constructor. >+ */ >+ public GMFResource(URI uri) { >+ >+ super(uri); >+ >+ setTrackingModification(true); >+ } >+ >+ protected boolean useUUIDs() { >+ return true; >+ } >+ >+ /** >+ * Should we use ID attribute? >+ */ >+ public void setUseIDAttributes(boolean b) { >+ useIDAttributes = b; >+ } >+ >+ /** >+ * Should we use ID attribute? >+ */ >+ protected boolean useIDAttributes() { >+ return useIDAttributes; >+ } >+ >+ protected XMLHelper createXMLHelper() { >+ return new GMFHelper(this); >+ } >+ >+ protected XMLLoad createXMLLoad() { >+ return new GMFLoad(createXMLHelper()); >+ } >+ >+ protected XMLSave createXMLSave() { >+ return new XMISaveImpl(createXMLHelper()); >+ } >+ >+ /** >+ * @see org.eclipse.emf.ecore.resource.Resource#getEObject(java.lang.String) >+ */ >+ public EObject getEObject(String uriFragment) { >+ >+ int index = uriFragment.indexOf(EMFCoreConstants.FRAGMENT_SEPARATOR); >+ >+ if (index != -1) >+ uriFragment = uriFragment.substring(0, index); >+ >+ return super.getEObject(uriFragment); >+ } >+ >+ /** >+ * Get the saved ID of an EObject. >+ */ >+ public static String getSavedID(EObject eObject) { >+ return (String) DETACHED_EOBJECT_TO_ID_MAP.get(eObject); >+ } >+ >+ /** >+ * @see org.eclipse.emf.ecore.resource.Resource#setURI(org.eclipse.emf.common.util.URI) >+ */ >+ public void setURI(URI uri) { >+ >+ if (getResourceSet() != null) { >+ setRawURI(Util.denormalizeURI(uri, getResourceSet())); >+ } >+ } >+ >+ public NotificationChain basicSetResourceSet(ResourceSet rset, NotificationChain notifications) { >+ // when I am added to a new resource set, my optimally denormalized URI >+ // may change according to its different URI converter >+ if (rset != null) { >+ setURI(getURI()); >+ } >+ >+ return super.basicSetResourceSet(rset, notifications); >+ } >+ >+ /** >+ * Set the URI of the resource without processing it. >+ */ >+ public void setRawURI(URI uri) { >+ >+ URI oldURI = getURI(); >+ >+ if ((uri == oldURI) || ((uri != null) && (uri.equals(oldURI)))) >+ return; >+ >+ super.setURI(uri); >+ } >+ >+ /** >+ * The inherited implementation creates an adapter that <em>always</em> sets >+ * the modified state. We prefer to check, first, whether the resource >+ * is already modified so that we don't generate redundant notifications. >+ * Moreover, we additionally set modified state only for changes that are >+ * in non-transient features of objects contained (recursively) by >+ * non-transient references. >+ */ >+ protected Adapter createModificationTrackingAdapter() { >+ return new ModificationTrackingAdapter() { >+ public void notifyChanged(Notification notification) { >+ if (!isModified() && !isTransient( >+ notification.getNotifier(), notification.getFeature())) { >+ >+ super.notifyChanged(notification); >+ } >+ } >+ >+ /** >+ * Check if the feature or one of the notifier's containers is >+ * transient. >+ * >+ * @param notifier a notifier >+ * @param feature the feature that changed >+ * >+ * @return <code>true</code> if the feature is transient or if the >+ * notifier or any of its ancestors is contained by a transient >+ * reference; <code>false</code>, otherwise >+ */ >+ private boolean isTransient(Object notifier, Object feature) { >+ if (feature instanceof EStructuralFeature) { >+ if (((EStructuralFeature) feature).isTransient()) >+ return true; >+ else >+ // calling isTransient could be a lengthy operation. >+ // It is safe to cast because the adapter is only >+ // attached to EObjects, not to the resource >+ return isTransient((EObject) notifier); >+ } >+ return false; >+ } >+ >+ /** >+ * Is object transient? >+ */ >+ private boolean isTransient(EObject eObject) { >+ EStructuralFeature containmentFeature = eObject.eContainmentFeature(); >+ while (containmentFeature != null) { >+ if (containmentFeature.isTransient()) >+ return true; >+ eObject = eObject.eContainer(); >+ if (eObject != null) >+ containmentFeature = eObject.eContainmentFeature(); >+ else >+ break; >+ } >+ return false; >+ }}; >+ } >+} >Index: src/org/eclipse/gmf/runtime/emf/core/resources/AbortResourceLoadException.java >=================================================================== >RCS file: src/org/eclipse/gmf/runtime/emf/core/resources/AbortResourceLoadException.java >diff -N src/org/eclipse/gmf/runtime/emf/core/resources/AbortResourceLoadException.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/gmf/runtime/emf/core/resources/AbortResourceLoadException.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,52 @@ >+/****************************************************************************** >+ * Copyright (c) 2006 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 >+ ****************************************************************************/ >+ >+package org.eclipse.gmf.runtime.emf.core.resources; >+ >+/** >+ * This exception is intended to be thrown during Resource load when an >+ * error occurs. This RuntimeException wrapper is required in order to >+ * abort loading at any time. >+ * >+ * @author Christian Vogt (cvogt) >+ */ >+public class AbortResourceLoadException extends RuntimeException { >+ >+ private static final long serialVersionUID = -5621491416138595586L; >+ >+ /** >+ * Initializes me without any details. >+ */ >+ public AbortResourceLoadException() { >+ super(); >+ } >+ >+ /** >+ * Initializes me with a useful message. >+ * >+ * @param message >+ * a message >+ */ >+ public AbortResourceLoadException(String message) { >+ super(message); >+ } >+ >+ /** >+ * Initializes me with a cause. >+ * >+ * @param cause >+ * the cause of this exception. >+ */ >+ public AbortResourceLoadException(Throwable cause) { >+ super(null == cause ? null >+ : cause.toString(), cause); >+ } >+} >Index: src/org/eclipse/gmf/runtime/emf/core/resources/GMFLoad.java >=================================================================== >RCS file: src/org/eclipse/gmf/runtime/emf/core/resources/GMFLoad.java >diff -N src/org/eclipse/gmf/runtime/emf/core/resources/GMFLoad.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/gmf/runtime/emf/core/resources/GMFLoad.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,67 @@ >+/****************************************************************************** >+ * Copyright (c) 2004, 2006 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 >+ ****************************************************************************/ >+ >+package org.eclipse.gmf.runtime.emf.core.resources; >+ >+import java.io.IOException; >+import java.io.InputStream; >+import java.util.Map; >+ >+import org.eclipse.emf.ecore.resource.Resource; >+import org.eclipse.emf.ecore.xmi.UnresolvedReferenceException; >+import org.eclipse.emf.ecore.xmi.XMLHelper; >+import org.eclipse.emf.ecore.xmi.XMLResource; >+import org.eclipse.emf.ecore.xmi.impl.SAXWrapper; >+import org.eclipse.emf.ecore.xmi.impl.XMILoadImpl; >+import org.xml.sax.helpers.DefaultHandler; >+ >+/** >+ * This class changes the behavior of the default XMILoader so that >+ * UnresolvedReferenceExceptions are not thrown back. >+ * >+ * @author rafikj >+ */ >+public class GMFLoad >+ extends XMILoadImpl { >+ >+ /** >+ * Constructor. >+ */ >+ public GMFLoad(XMLHelper helper) { >+ super(helper); >+ } >+ >+ /** >+ * @see org.eclipse.emf.ecore.xmi.XMLLoad#load(org.eclipse.emf.ecore.xmi.XMLResource, >+ * java.io.InputStream, java.util.Map) >+ */ >+ public void load(XMLResource r, InputStream s, Map o) >+ throws IOException { >+ >+ try { >+ >+ super.load(r, s, o); >+ >+ } catch (Resource.IOWrappedException e) { >+ if (!(e.getWrappedException() instanceof UnresolvedReferenceException)) >+ throw e; >+ } catch (AbortResourceLoadException arle) { >+ throw new Resource.IOWrappedException((Exception)arle.getCause()); >+ } >+ } >+ >+ /** >+ * @see org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl#makeDefaultHandler() >+ */ >+ protected DefaultHandler makeDefaultHandler() { >+ return new SAXWrapper(new GMFHandler(resource, helper, options)); >+ } >+} >Index: src/org/eclipse/gmf/runtime/emf/core/resources/GMFHandler.java >=================================================================== >RCS file: src/org/eclipse/gmf/runtime/emf/core/resources/GMFHandler.java >diff -N src/org/eclipse/gmf/runtime/emf/core/resources/GMFHandler.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/gmf/runtime/emf/core/resources/GMFHandler.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,152 @@ >+/****************************************************************************** >+ * Copyright (c) 2004, 2006 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 >+ ****************************************************************************/ >+ >+package org.eclipse.gmf.runtime.emf.core.resources; >+ >+import java.util.HashMap; >+import java.util.Iterator; >+import java.util.Map; >+ >+import org.eclipse.emf.common.util.URI; >+import org.eclipse.emf.ecore.EFactory; >+import org.eclipse.emf.ecore.EObject; >+import org.eclipse.emf.ecore.EPackage; >+import org.eclipse.emf.ecore.EStructuralFeature; >+import org.eclipse.emf.ecore.InternalEObject; >+import org.eclipse.emf.ecore.resource.Resource; >+import org.eclipse.emf.ecore.resource.impl.ResourceImpl; >+import org.eclipse.emf.ecore.xmi.XMIException; >+import org.eclipse.emf.ecore.xmi.XMLHelper; >+import org.eclipse.emf.ecore.xmi.XMLResource; >+import org.eclipse.emf.ecore.xmi.impl.SAXXMIHandler; >+import org.eclipse.emf.ecore.xml.type.AnyType; >+ >+/** >+ * The SAX handler for MSL resources. Updates demand-created packages with their >+ * namespace prefixes and schema locations. >+ * >+ * @author khussey >+ */ >+public class GMFHandler >+ extends SAXXMIHandler { >+ >+ protected final Map urisToProxies; >+ >+ protected boolean abortOnError; >+ >+ /** >+ * Constructs a new MSL handler for the specified resource with the >+ * specified helper and options. >+ * >+ * @param xmiResource >+ * The resource for the new handler. >+ * @param helper >+ * The helper for the new handler. >+ * @param options >+ * The load options for the new handler. >+ */ >+ public GMFHandler(XMLResource xmiResource, XMLHelper helper, Map options) { >+ super(xmiResource, helper, options); >+ >+ urisToProxies = new HashMap(); >+ if (Boolean.TRUE.equals(options.get(GMFResource.OPTION_ABORT_ON_ERROR))) { >+ abortOnError = true; >+ } >+ } >+ >+ /** >+ * @see org.eclipse.emf.ecore.xmi.impl.XMLHandler#endDocument() >+ */ >+ public void endDocument() { >+ super.endDocument(); >+ >+ if (null != extendedMetaData) { >+ >+ for (Iterator demandedPackages = extendedMetaData >+ .demandedPackages().iterator(); demandedPackages.hasNext();) { >+ >+ EPackage ePackage = (EPackage) demandedPackages.next(); >+ String nsURI = ePackage.getNsURI(); >+ >+ if (null != nsURI) { >+ >+ if (null != urisToLocations) { >+ URI locationURI = (URI) urisToLocations.get(nsURI); >+ >+ if (null != locationURI) { >+ // set the schema location >+ Resource resource = new ResourceImpl(); >+ resource.setURI(locationURI); >+ resource.getContents().add(ePackage); >+ } >+ } >+ >+ for (Iterator entries = helper.getPrefixToNamespaceMap() >+ .iterator(); entries.hasNext();) { >+ >+ Map.Entry entry = (Map.Entry) entries.next(); >+ >+ if (nsURI.equals(entry.getValue())) { >+ // set the namespace prefix >+ ePackage.setNsPrefix((String) entry.getKey()); >+ } >+ } >+ } >+ } >+ } >+ } >+ >+ /** >+ * @see org.eclipse.emf.ecore.xmi.impl.XMLHandler#validateCreateObjectFromFactory(org.eclipse.emf.ecore.EFactory, >+ * java.lang.String, org.eclipse.emf.ecore.EObject, >+ * org.eclipse.emf.ecore.EStructuralFeature) >+ */ >+ protected EObject validateCreateObjectFromFactory(EFactory factory, >+ String typeName, EObject newObject, EStructuralFeature feature) { >+ >+ if (!(objects.peek() instanceof AnyType) && null != newObject >+ && newObject.eIsProxy() && !sameDocumentProxies.contains(newObject)) { >+ >+ URI proxyURI = ((InternalEObject) newObject).eProxyURI(); >+ >+ Map typeNamesToProxies = (Map) urisToProxies.get(proxyURI); >+ >+ if (null == typeNamesToProxies) { >+ urisToProxies.put(proxyURI, typeNamesToProxies = new HashMap()); >+ } >+ >+ EObject proxy = (EObject) typeNamesToProxies.get(typeName); >+ >+ if (null == proxy) { >+ typeNamesToProxies.put(typeName, proxy = newObject); >+ } >+ >+ // canonicalize proxies >+ newObject = proxy; >+ } >+ >+ return super.validateCreateObjectFromFactory(factory, typeName, >+ newObject, feature); >+ } >+ >+ /** >+ * @see org.eclipse.emf.ecore.xmi.impl.XMLHandler#error(org.eclipse.emf.ecore.xmi.XMIException) >+ */ >+ public void error(XMIException e) { >+ super.error(e); >+ if (abortOnError) { >+ if (e.getWrappedException() != null) { >+ throw new AbortResourceLoadException(e.getWrappedException()); >+ } >+ throw new AbortResourceLoadException(e); >+ } >+ } >+} >Index: src/org/eclipse/gmf/runtime/emf/core/resources/IPathmapManager.java >=================================================================== >RCS file: src/org/eclipse/gmf/runtime/emf/core/resources/IPathmapManager.java >diff -N src/org/eclipse/gmf/runtime/emf/core/resources/IPathmapManager.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/gmf/runtime/emf/core/resources/IPathmapManager.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,55 @@ >+/****************************************************************************** >+ * Copyright (c) 2002, 2006 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 >+ ****************************************************************************/ >+ >+package org.eclipse.gmf.runtime.emf.core.resources; >+ >+import org.eclipse.core.runtime.IStatus; >+ >+/** >+ * Specification of an object that manages URI mappings (path variables) for >+ * the <code>pathmap</code> URI scheme on an editing domain's resource set. >+ * >+ * @author rafikj >+ */ >+public interface IPathmapManager { >+ >+ /** >+ * Set the value of a path variable. >+ * >+ * @param name the path variable name >+ * @param value the path variable value (a file URI) >+ * >+ * @return a status indicating success (OK) or failure (ERROR) to set the >+ * path variable. In case of error, the status message provides a >+ * user-friendly explanation of the reason >+ */ >+ IStatus addPathVariable(String name, String value); >+ >+ /** >+ * Removes a path variable and its value. >+ * >+ * @param name the path variable name >+ * >+ * @return a status indicating success (OK) or failure (ERROR) to remove the >+ * path variable. In case of error, the status message provides a >+ * user-friendly explanation of the reason >+ */ >+ IStatus removePathVariable(String name); >+ >+ /** >+ * Queries the current value of a path variable. >+ * >+ * @param name the path variable name >+ * @return the path variable value (a URI) or an empty string if >+ * the specified variable is undefined >+ */ >+ String getPathVariable(String name); >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 137063
: 39289