SCM
diff --git a/1.5/plugins/org.eclipse.epf.library.edit/src/org/eclipse/epf/library/edit/LibraryEditPlugin.java b/1.5/plugins/org.eclipse.epf.library.edit/src/org/eclipse/epf/library/edit/LibraryEditPlugin.java
index 8a372ac..b83d3c5 100644
--- a/1.5/plugins/org.eclipse.epf.library.edit/src/org/eclipse/epf/library/edit/LibraryEditPlugin.java
+++ b/1.5/plugins/org.eclipse.epf.library.edit/src/org/eclipse/epf/library/edit/LibraryEditPlugin.java
@@ -120,6 +120,9 @@
* @return The image.
*/
public Object getSharedImage(URI imageURI) {
+ if(imageURI == null) {
+ return null;
+ }
try {
return imageURI.toURL();
} catch (MalformedURLException e) {
diff --git a/1.5/plugins/org.eclipse.epf.library.edit/src/org/eclipse/epf/library/edit/element/ContentPackageItemProvider.java b/1.5/plugins/org.eclipse.epf.library.edit/src/org/eclipse/epf/library/edit/element/ContentPackageItemProvider.java
index 4b34d42..1a6183d 100644
--- a/1.5/plugins/org.eclipse.epf.library.edit/src/org/eclipse/epf/library/edit/element/ContentPackageItemProvider.java
+++ b/1.5/plugins/org.eclipse.epf.library.edit/src/org/eclipse/epf/library/edit/element/ContentPackageItemProvider.java
@@ -21,7 +21,6 @@
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.edit.command.AddCommand;
import org.eclipse.emf.edit.command.CommandParameter;
import org.eclipse.emf.edit.domain.EditingDomain;
@@ -252,14 +251,6 @@
txt = TngUtil
.getLabel(object, getString("_UI_ContentPackage_type")); //$NON-NLS-1$
}
- // check if the object has its own resource and it is modified to add
- // the dirty flag
- //
- Resource res = ((EObject) object).eResource();
- if (res != null && res.getContents().get(0) == object
- && res.isModified()) {
- txt = txt + "*"; //$NON-NLS-1$
- }
return txt;
}
diff --git a/1.5/plugins/org.eclipse.epf.library.persistence/src/org/eclipse/epf/library/persistence/util/FileSynchronizer.java b/1.5/plugins/org.eclipse.epf.library.persistence/src/org/eclipse/epf/library/persistence/util/FileSynchronizer.java
index 0925f09..bdf7f34 100644
--- a/1.5/plugins/org.eclipse.epf.library.persistence/src/org/eclipse/epf/library/persistence/util/FileSynchronizer.java
+++ b/1.5/plugins/org.eclipse.epf.library.persistence/src/org/eclipse/epf/library/persistence/util/FileSynchronizer.java
@@ -194,8 +194,7 @@
public boolean visit(IResourceDelta delta) throws CoreException {
if (delta == null)
return false;
- if ((delta.getFlags() & IResourceDelta.MARKERS) != IResourceDelta.MARKERS
- && delta.getResource().getType() == IResource.FILE) {
+ if (delta.getResource().getType() == IResource.FILE) {
switch (delta.getKind()) {
case IResourceDelta.CHANGED:
FileInfo info = (FileInfo) getFileInfo(delta.getResource());
diff --git a/1.5/plugins/org.eclipse.epf.library.persistence/src/org/eclipse/epf/persistence/MultiFileXMIResourceImpl.java b/1.5/plugins/org.eclipse.epf.library.persistence/src/org/eclipse/epf/persistence/MultiFileXMIResourceImpl.java
index cc637b3..5297b61 100644
--- a/1.5/plugins/org.eclipse.epf.library.persistence/src/org/eclipse/epf/persistence/MultiFileXMIResourceImpl.java
+++ b/1.5/plugins/org.eclipse.epf.library.persistence/src/org/eclipse/epf/persistence/MultiFileXMIResourceImpl.java
@@ -1178,6 +1178,10 @@
void setResourceDescriptor(ResourceDescriptor resDesc) {
resourceDescriptor = resDesc;
}
+
+ public ResourceDescriptor getResourceDescriptor() {
+ return resourceDescriptor;
+ }
/* (non-Javadoc)
* @see org.eclipse.epf.library.persistence.ILibraryResource#getLoadStamp()
diff --git a/1.5/plugins/org.eclipse.epf.library.persistence/src/org/eclipse/epf/persistence/refresh/RefreshJob.java b/1.5/plugins/org.eclipse.epf.library.persistence/src/org/eclipse/epf/persistence/refresh/RefreshJob.java
index c35a580..0efa416 100644
--- a/1.5/plugins/org.eclipse.epf.library.persistence/src/org/eclipse/epf/persistence/refresh/RefreshJob.java
+++ b/1.5/plugins/org.eclipse.epf.library.persistence/src/org/eclipse/epf/persistence/refresh/RefreshJob.java
@@ -344,8 +344,13 @@
public boolean visit(IResourceDelta delta) throws CoreException {
Resource resource;
- if ((delta.getFlags() & IResourceDelta.MARKERS) != IResourceDelta.MARKERS
- && delta.getResource().getType() == IResource.FILE) {
+// System.out.println("type=" + delta.getResource().getType());
+// System.out.println("kind=" + delta.getKind());
+// System.out.println(delta.getFlags() != IResourceDelta.MARKERS);
+// if(delta.getResource().getFullPath().toString().endsWith("plugin.xmi")) {
+// System.out.println(delta.getResource().getFullPath().toString());
+// }
+ if (delta.getResource().getType() == IResource.FILE) {
switch (delta.getKind()) {
case IResourceDelta.ADDED:
// handle added resource
diff --git a/1.5/plugins/org.eclipse.epf.library.persistence/src/org/eclipse/epf/persistence/util/PersistenceUtil.java b/1.5/plugins/org.eclipse.epf.library.persistence/src/org/eclipse/epf/persistence/util/PersistenceUtil.java
index 413f1db..1f0c19f 100644
--- a/1.5/plugins/org.eclipse.epf.library.persistence/src/org/eclipse/epf/persistence/util/PersistenceUtil.java
+++ b/1.5/plugins/org.eclipse.epf.library.persistence/src/org/eclipse/epf/persistence/util/PersistenceUtil.java
@@ -206,16 +206,14 @@
}
public static Resource getResource(String path, ResourceSet resourceSet) {
- URI uri = URI.createFileURI(path);
- for (Iterator iter = new ArrayList<Resource>(resourceSet.getResources())
- .iterator(); iter.hasNext();) {
- Resource resource = (Resource) iter.next();
- if (uri.equals(MultiFileSaveUtil.getFinalURI(resource))) {
+ File file = new File(path);
+ for (Resource resource : new ArrayList<Resource>(resourceSet.getResources())) {
+ URI finalURI = MultiFileSaveUtil.getFinalURI(resource);
+ if(finalURI.isFile() && file.equals(new File(finalURI.toFileString()))) {
return resource;
}
}
return null;
-
}
/**
diff --git a/1.5/plugins/org.eclipse.epf.library.persistence/src/org/eclipse/epf/persistence/util/UnresolvedProxyMarkerManager.java b/1.5/plugins/org.eclipse.epf.library.persistence/src/org/eclipse/epf/persistence/util/UnresolvedProxyMarkerManager.java
index b4c1db6..60401f7 100644
--- a/1.5/plugins/org.eclipse.epf.library.persistence/src/org/eclipse/epf/persistence/util/UnresolvedProxyMarkerManager.java
+++ b/1.5/plugins/org.eclipse.epf.library.persistence/src/org/eclipse/epf/persistence/util/UnresolvedProxyMarkerManager.java
@@ -28,6 +28,7 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceStatus;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.resources.WorkspaceJob;
@@ -48,6 +49,7 @@
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.epf.common.utils.ExtensionHelper;
import org.eclipse.epf.common.utils.IMarkerAttributeContributer;
+import org.eclipse.epf.common.utils.StrUtil;
import org.eclipse.epf.persistence.FileManager;
import org.eclipse.epf.persistence.MultiFileResourceSetImpl;
import org.eclipse.epf.persistence.MultiFileSaveUtil;
@@ -321,23 +323,29 @@
IFile file = workspace.getRoot().getFileForLocation(path);
if (file != null) {
String location = containerURI != null ? containerURI
- .toFileString() : ""; //$NON-NLS-1$
+ .toFileString() : StrUtil.EMPTY_STRING;
try {
- file.refreshLocal(IResource.DEPTH_ZERO, null);
- IMarker marker = findMarker(file, proxyURI.toString(), 0, 0);
- if (marker != null) {
- marker.setAttribute(OWNER_GUID, ownerGUID);
- return;
+ file.refreshLocal(IResource.DEPTH_ZERO, null);
+ IMarker marker = findMarker(file, proxyURI.toString(), 0, 0);
+ if (marker != null) {
+ marker.setAttribute(OWNER_GUID, ownerGUID);
+ return;
+ }
+ createMarker(re, proxyURI, errMsg, ownerGUID, file,
+ location, proxyURI.toString(), 0, 0);
+ } catch (CoreException e) {
+ IStatus status = e.getStatus();
+ int code;
+ if(status instanceof IResourceStatus &&
+ ((code = ((IResourceStatus) status).getCode()) == IResourceStatus.MARKER_NOT_FOUND
+ || code == IResourceStatus.RESOURCE_NOT_FOUND)) {
+ // do nothing
+ } else {
+ PersistencePlugin.getDefault().getLogger().logError(e);
+ if (MultiFileSaveUtil.DEBUG) {
+ e.printStackTrace();
}
- createMarker(re, proxyURI,
- errMsg, ownerGUID, file,
- location, proxyURI.toString(), 0,
- 0);
- } catch (CoreException ex) {
- CommonPlugin.INSTANCE.log(ex);
- if (MultiFileSaveUtil.DEBUG) {
- ex.printStackTrace();
}
}
}
@@ -871,23 +879,34 @@
public void validateAllMarkers() {
boolean newlyAdded = false;
+ boolean invalid = false;
if(!elementGUIToMarkersMap.isEmpty()) {
ArrayList<Collection<ValidObject>> validObjectCollections = null;
synchronized (elementGUIToMarkersMap) {
- if(!elementGUIToMarkersMap.isEmpty()) {
- validObjectCollections = new ArrayList<Collection<ValidObject>>(elementGUIToMarkersMap.values());
+ if(!elementGUIToMarkersMap.isEmpty()) {
+ validObjectCollections = new ArrayList<Collection<ValidObject>>();
+ for (Collection<ValidObject> collection : elementGUIToMarkersMap.values()) {
+ if(!collection.isEmpty()) {
+ validObjectCollections.add(new ArrayList<ValidObject>(collection));
+ }
+ }
}
}
if(validObjectCollections != null) {
synchronized(resourcesToValidateMarkers) {
- for (Collection<ValidObject> markers :validObjectCollections) {
+ for (Collection<ValidObject> markers : validObjectCollections) {
for (ValidObject vo : markers) {
IMarker marker = (IMarker) vo.object;
try {
- String location = (String)marker.getAttribute(IMarker.LOCATION);
- URI uri = URI.createFileURI(location);
- Resource resource = resourceSet.getResource(uri, true);
- newlyAdded = resourcesToValidateMarkers.add(resource) | newlyAdded;
+ if(marker.exists()) {
+ String location = (String)marker.getAttribute(IMarker.LOCATION);
+ URI uri = URI.createFileURI(location);
+ Resource resource = resourceSet.getResource(uri, true);
+ newlyAdded = resourcesToValidateMarkers.add(resource) | newlyAdded;
+ } else {
+ vo.valid = false;
+ invalid = true;
+ }
} catch (CoreException e) {
PersistencePlugin.getDefault().getLogger().logError(e);
}
@@ -899,13 +918,15 @@
}
if(newlyAdded) {
schedule(DELAY);
+ } else if(invalid) {
+ removeMarkers(new NullProgressMonitor());
}
}
public void doValidateMarkers(Resource resource) {
try {
IResource file = FileManager.getResourceForLocation(resource.getURI().toFileString());
- if(file instanceof IFile) {
+ if(file instanceof IFile && file.exists()) {
IMarker[] markers = file.findMarkers(MARKER_ID, false, IResource.DEPTH_ZERO);
HashSet<IMarker> markersToUpdate = new HashSet<IMarker>();
for (int i = 0; i < markers.length; i++) {
diff --git a/1.5/plugins/org.eclipse.epf.library/src/org/eclipse/epf/library/util/LibraryProblemMonitor.java b/1.5/plugins/org.eclipse.epf.library/src/org/eclipse/epf/library/util/LibraryProblemMonitor.java
index ae7c9d3..6c05c73 100644
--- a/1.5/plugins/org.eclipse.epf.library/src/org/eclipse/epf/library/util/LibraryProblemMonitor.java
+++ b/1.5/plugins/org.eclipse.epf.library/src/org/eclipse/epf/library/util/LibraryProblemMonitor.java
@@ -20,8 +20,10 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IResourceStatus;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
@@ -213,7 +215,14 @@
marker.setAttribute(IMarker.LOCATION, location);
marker.setAttribute(Guid, plugin.getGuid());
- } catch (Exception e) {
+ } catch (CoreException e) {
+ IStatus status = e.getStatus();
+ if(status instanceof IResourceStatus && ((IResourceStatus) status).getCode() == IResourceStatus.RESOURCE_NOT_FOUND) {
+ // do nothing
+ } else {
+ LibraryPlugin.getDefault().getLogger().logError(e);
+ }
+ } catch(Exception e) {
LibraryPlugin.getDefault().getLogger().logError(e);
}
if (marker == null) {