[80616] BeanInfo cache. First pass.
diff --git a/plugins/org.eclipse.jem.util/jemutil/org/eclipse/jem/internal/util/emf/workbench/ProjectResourceSetImpl.java b/plugins/org.eclipse.jem.util/jemutil/org/eclipse/jem/internal/util/emf/workbench/ProjectResourceSetImpl.java
index 452e4d2..20021eb 100644
--- a/plugins/org.eclipse.jem.util/jemutil/org/eclipse/jem/internal/util/emf/workbench/ProjectResourceSetImpl.java
+++ b/plugins/org.eclipse.jem.util/jemutil/org/eclipse/jem/internal/util/emf/workbench/ProjectResourceSetImpl.java
@@ -10,18 +10,16 @@
*******************************************************************************/
/*
* $$RCSfile: ProjectResourceSetImpl.java,v $$
- * $$Revision: 1.5 $$ $$Date: 2005/02/03 22:47:35 $$
+ * $$Revision: 1.6 $$ $$Date: 2005/02/04 23:12:28 $$
*/
package org.eclipse.jem.internal.util.emf.workbench;
import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
import org.eclipse.core.resources.IProject;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.impl.NotificationImpl;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
@@ -29,9 +27,8 @@
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.emf.ecore.resource.impl.URIConverterImpl;
import org.eclipse.emf.ecore.xmi.XMLResource;
-import org.eclipse.jem.util.emf.workbench.ProjectResourceSet;
-import org.eclipse.jem.util.emf.workbench.ResourceHandler;
-import org.eclipse.jem.util.emf.workbench.ResourceSetWorkbenchSynchronizer;
+
+import org.eclipse.jem.util.emf.workbench.*;
import org.eclipse.jem.util.emf.workbench.nature.EMFNature;
import org.eclipse.jem.util.logger.proxy.Logger;
import org.eclipse.jem.util.plugin.JEMUtilPlugin;
@@ -42,10 +39,8 @@
protected List resourceHandlers = new ArrayList();
protected ResourceSetWorkbenchSynchronizer synchronizer;
protected ProjectResourceSetImpl() {
- HashMap resourceMap = new HashMap(10);
- resourceMap.put(XMLResource.OPTION_USE_PARSER_POOL, EMFNature.SHARED_PARSER_POOL);
- loadOptions = resourceMap;
setURIResourceMap(new HashMap(10)); // Tell it to cache uri->resource access.
+ getLoadOptions().put(XMLResource.OPTION_USE_PARSER_POOL, EMFNature.SHARED_PARSER_POOL);
}
public ProjectResourceSetImpl(IProject aProject) {
this();
@@ -117,7 +112,26 @@
}
return null;
}
+
public void release() {
+ // Send out notification of release.
+ if (eNotificationRequired()) {
+ eNotify(new NotificationImpl(SPECIAL_NOTIFICATION_TYPE, null, null, Notification.NO_INDEX, false) {
+ /* (non-Javadoc)
+ * @see org.eclipse.emf.common.notify.impl.NotificationImpl#getFeatureID(java.lang.Class)
+ */
+ public int getFeatureID(Class expectedClass) {
+ return PROJECTRESOURCESET_ABOUT_TO_RELEASE_ID;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.emf.common.notify.impl.NotificationImpl#getNotifier()
+ */
+ public Object getNotifier() {
+ return ProjectResourceSetImpl.this;
+ }
+ });
+ }
setIsReleasing(true);
if (synchronizer != null)
synchronizer.dispose();
diff --git a/plugins/org.eclipse.jem.util/jemutil/org/eclipse/jem/util/emf/workbench/ProjectResourceSet.java b/plugins/org.eclipse.jem.util/jemutil/org/eclipse/jem/util/emf/workbench/ProjectResourceSet.java
index ba38087..db076db 100644
--- a/plugins/org.eclipse.jem.util/jemutil/org/eclipse/jem/util/emf/workbench/ProjectResourceSet.java
+++ b/plugins/org.eclipse.jem.util/jemutil/org/eclipse/jem/util/emf/workbench/ProjectResourceSet.java
@@ -10,22 +10,48 @@
*******************************************************************************/
/*
* $$RCSfile: ProjectResourceSet.java,v $$
- * $$Revision: 1.1 $$ $$Date: 2005/01/07 20:19:23 $$
+ * $$Revision: 1.2 $$ $$Date: 2005/02/04 23:12:01 $$
*/
package org.eclipse.jem.util.emf.workbench;
import org.eclipse.core.resources.IProject;
+import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.resource.ResourceSet;
/**
* A ResourceSet for an entire project. It allows sharing of resources from multiple editors/viewers for a project.
+ * <p>
+ * An additional Notification type is sent out by ProjectResourceSet's of project resource set about to be released. A release is
+ * called when projects are about to be closed. They release all of the resources and unload them. This notification can be used
+ * to know that this is about to happen and to do something before the resources become invalid. It will be sent out just before the
+ * resource set will be released.
*
+ * @see ProjectResourceSet#SPECIAL_NOTIFICATION_TYPE
+ * @see ProjectResourceSet#PROJECTRESOURCESET_ABOUT_TO_RELEASE_ID
* @since 1.0.0
*/
public interface ProjectResourceSet extends ResourceSet {
IProject getProject();
+
+ /**
+ * Notification type in notifications from the ProjectResourceSet for
+ * special notifications, and not the standard ones from ResourceSet.
+ *
+ * @see org.eclipse.emf.common.notify.Notification#getEventType()
+ * @since 1.1.0
+ */
+ static int SPECIAL_NOTIFICATION_TYPE = Notification.EVENT_TYPE_COUNT+4;
+
+ /**
+ * Notification Feature ID for resource set about to be released.
+ * Use {@link org.eclipse.emf.common.notify.Notification#getFeatureID(java.lang.Class)} to
+ * get this id. The getFeature() on notification will return null.
+ *
+ * @since 1.1.0
+ */
+ static int PROJECTRESOURCESET_ABOUT_TO_RELEASE_ID = 1000;
/**
* Call when the ResourceSet is no longer to be used.