aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntoine DE TROOSTEMBERGH2012-01-19 11:21:10 (EST)
committerIgor Fedorenko2012-05-05 07:14:37 (EDT)
commit38fae6d9c40314f410f338c8f759aa627927c916 (patch)
treecb280ad5320b95b9045e561e09bce06c0ea2cc7e
parentef8e5067cb7ea05fb902d462d48c3773b6621d84 (diff)
downloadm2e-core-38fae6d9c40314f410f338c8f759aa627927c916.zip
m2e-core-38fae6d9c40314f410f338c8f759aa627927c916.tar.gz
m2e-core-38fae6d9c40314f410f338c8f759aa627927c916.tar.bz2
366652 Fixed Update Maven Project dialog failure in some casesmilestones/1.1/1.1.0.20120505-1126
Update Maven Project dialog failed to show up for projects not stored on standard filesystems. One particular example is IBM Jazz, but the same problem is likely with other team providers. The solution is to use eclipse filesystem api to get project location. Signed-off-by: Igor Fedorenko <igor@ifedorenko.com>
-rw-r--r--org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/dialogs/UpdateMavenProjectsDialog.java29
1 files changed, 23 insertions, 6 deletions
diff --git a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/dialogs/UpdateMavenProjectsDialog.java b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/dialogs/UpdateMavenProjectsDialog.java
index 89906c6..8281e5c 100644
--- a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/dialogs/UpdateMavenProjectsDialog.java
+++ b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/dialogs/UpdateMavenProjectsDialog.java
@@ -22,6 +22,8 @@ import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileStore;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IWorkspaceRoot;
@@ -117,6 +119,22 @@ public class UpdateMavenProjectsDialog extends TitleAreaDialog implements IMenuL
shell.setText(getDialogTitle());
}
+ private String getElePath(Object element) {
+ if(element instanceof IProject) {
+ IProject project = (IProject) element;
+ URI locationURI = project.getLocationURI();
+
+ try {
+ IFileStore store = EFS.getStore(locationURI);
+ File file = store.toLocalFile(0, null);
+ return file.toString() + SEPARATOR;
+ } catch(CoreException ex) {
+ log.error(ex.getMessage(), ex);
+ }
+ }
+ return null;
+ }
+
/**
* Create contents of the dialog.
*
@@ -155,7 +173,7 @@ public class UpdateMavenProjectsDialog extends TitleAreaDialog implements IMenuL
public Object[] getChildren(Object parentElement) {
if(parentElement instanceof IProject) {
- String elePath = new File(((IProject) parentElement).getLocationURI()).toString() + SEPARATOR;
+ String elePath = getElePath(parentElement);
String prevPath = null;
List<IProject> children = new ArrayList<IProject>();
for(String path : projectPaths) {
@@ -174,7 +192,7 @@ public class UpdateMavenProjectsDialog extends TitleAreaDialog implements IMenuL
}
public Object getParent(Object element) {
- String elePath = new File(((IProject) element).getLocationURI()).toString() + SEPARATOR;
+ String elePath = getElePath(element);
String prevPath = null;
for(String path : projectPaths) {
if(elePath.length() != path.length() && elePath.startsWith(path)
@@ -187,7 +205,7 @@ public class UpdateMavenProjectsDialog extends TitleAreaDialog implements IMenuL
public boolean hasChildren(Object element) {
if(element instanceof IProject) {
- String elePath = new File(((IProject) element).getLocationURI()).toString() + SEPARATOR;
+ String elePath = getElePath(element);
for(String path : projectPaths) {
if(elePath.length() != path.length() && path.startsWith(elePath)) {
return true;
@@ -356,9 +374,8 @@ public class UpdateMavenProjectsDialog extends TitleAreaDialog implements IMenuL
for(IProject project : ResourcesPlugin.getWorkspace().getRoot().getProjects()) {
try {
if(project.isAccessible() && project.hasNature(IMavenConstants.NATURE_ID)) {
- URI locationURI = project.getLocationURI();
- if(locationURI != null) {
- projectPaths.add(new File(locationURI).toString() + SEPARATOR);
+ if(project.getLocationURI() != null) {
+ projectPaths.add(getElePath(project));
}
}
} catch(CoreException ex) {