Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpfullbright2007-05-21 19:15:33 +0000
committerpfullbright2007-05-21 19:15:33 +0000
commit7be9ba5c49106da555a83d72e90a5fb54740a75d (patch)
tree15429183178258d674c62c8b8b01999802df9551 /jpa/plugins
parent0929340be989c7c32345e7204a7cc08cc3cd7ad9 (diff)
downloadwebtools.dali-7be9ba5c49106da555a83d72e90a5fb54740a75d.tar.gz
webtools.dali-7be9ba5c49106da555a83d72e90a5fb54740a75d.tar.xz
webtools.dali-7be9ba5c49106da555a83d72e90a5fb54740a75d.zip
bug 181812 - fixed NPE on project rename
Diffstat (limited to 'jpa/plugins')
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaModelManager.java32
1 files changed, 20 insertions, 12 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaModelManager.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaModelManager.java
index b7b53529db..a92adec995 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaModelManager.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaModelManager.java
@@ -396,26 +396,33 @@ public class JpaModelManager
// could be problems here ...
JpaProject jpaProject = (JpaProject) model.getJpaProject(project);
switch (delta.getKind()) {
- case IResourceDelta.ADDED :
- // shouldn't have to do anything - model should be created with facet
- break;
-
case IResourceDelta.REMOVED :
- // not really sure what should be done here ...
+ // we should have already handled this in the PRE_DELETE event
break;
+ case IResourceDelta.ADDED :
+ // if project is renamed (for instance, we should act as though it's been opened)
+ // fall through
+
case IResourceDelta.CHANGED :
if ((delta.getFlags() & IResourceDelta.OPEN) != 0) {
- if (project.isOpen() && jpaProject == null) {
- try {
- JpaModelManager.instance().createFilledJpaProject(project);
- }
- catch (CoreException ce) {
- JptCorePlugin.log(ce);
+ if (project.isOpen()) {
+ // project has been opened, but don't create it if it's already there
+ // (which can happen on project creation)
+ if (jpaProject == null) {
+ try {
+ JpaModelManager.instance().createFilledJpaProject(project);
+ }
+ catch (CoreException ce) {
+ JptCorePlugin.log(ce);
+ }
}
}
else {
- model.disposeProject(jpaProject);
+ // project has been closed. dispose jpa project if it exists.
+ if (jpaProject != null) {
+ model.disposeProject(jpaProject);
+ }
}
}
else if ((delta.getFlags() & IResourceDelta.DESCRIPTION) != 0) {
@@ -517,6 +524,7 @@ public class JpaModelManager
ElementChangeProcessor() {
super();
}
+
public void elementChanged(ElementChangedEvent event) {
JpaModelManager.instance().model.handleEvent(event);
}

Back to the top