summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordhubner2009-04-21 04:08:55 (EDT)
committer dhubner2009-04-21 04:08:55 (EDT)
commit74927100b160939e4d7e764dbb1e0d62c45c8efe (patch)
treec5c66754725636a1fbd186c89881401319f30925
parent82e50eebfa345a103035fb6b0559b95d7a368369 (diff)
downloadorg.eclipse.mwe-74927100b160939e4d7e764dbb1e0d62c45c8efe.zip
org.eclipse.mwe-74927100b160939e4d7e764dbb1e0d62c45c8efe.tar.gz
org.eclipse.mwe-74927100b160939e4d7e764dbb1e0d62c45c8efe.tar.bz2
Patch for #272976
-rw-r--r--plugins/org.eclipse.emf.mwe.ui.editor/src/org/eclipse/emf/mwe/ui/internal/editor/analyzer/DefaultAnalyzer.java6
-rw-r--r--plugins/org.eclipse.emf.mwe.ui.editor/src/org/eclipse/emf/mwe/ui/internal/editor/utils/TypeUtils.java8
-rw-r--r--plugins/org.eclipse.emf.mwe.ui/src/org/eclipse/emf/mwe/ui/workflow/util/ProjectIncludingResourceLoader.java32
3 files changed, 30 insertions, 16 deletions
diff --git a/plugins/org.eclipse.emf.mwe.ui.editor/src/org/eclipse/emf/mwe/ui/internal/editor/analyzer/DefaultAnalyzer.java b/plugins/org.eclipse.emf.mwe.ui.editor/src/org/eclipse/emf/mwe/ui/internal/editor/analyzer/DefaultAnalyzer.java
index 0f98e08..3b6f503 100644
--- a/plugins/org.eclipse.emf.mwe.ui.editor/src/org/eclipse/emf/mwe/ui/internal/editor/analyzer/DefaultAnalyzer.java
+++ b/plugins/org.eclipse.emf.mwe.ui.editor/src/org/eclipse/emf/mwe/ui/internal/editor/analyzer/DefaultAnalyzer.java
@@ -28,7 +28,7 @@ import org.eclipse.jface.text.IDocument;
/**
* @author Patrick Schoenbach - Initial API and implementation
- * @version $Revision: 1.57 $
+ * @version $Revision: 1.58 $
*/
public class DefaultAnalyzer implements IElementAnalyzer {
@@ -62,7 +62,9 @@ public class DefaultAnalyzer implements IElementAnalyzer {
final IType parentType = parent.getMappedClassType();
final IType elementType = element.getMappedClassType();
if (elementType == null && !parent.isFragment()) {
- createMarker(element, "Element '" + element.getName() + "' could not be mapped");
+ // TODO this is a nasty workaround
+ if (parent.isComponent() && !parent.hasAttribute(IWorkflowAttribute.FILE_ATTRIBUTE))
+ createMarker(element, "Element '" + element.getName() + "' could not be mapped");
return;
}
diff --git a/plugins/org.eclipse.emf.mwe.ui.editor/src/org/eclipse/emf/mwe/ui/internal/editor/utils/TypeUtils.java b/plugins/org.eclipse.emf.mwe.ui.editor/src/org/eclipse/emf/mwe/ui/internal/editor/utils/TypeUtils.java
index f3f6f3a..0d5a546 100644
--- a/plugins/org.eclipse.emf.mwe.ui.editor/src/org/eclipse/emf/mwe/ui/internal/editor/utils/TypeUtils.java
+++ b/plugins/org.eclipse.emf.mwe.ui.editor/src/org/eclipse/emf/mwe/ui/internal/editor/utils/TypeUtils.java
@@ -53,7 +53,7 @@ import org.eclipse.jdt.core.search.TypeNameMatchRequestor;
/**
* @author Patrick Schoenbach - Initial API and implementation
- * @version $Revision: 1.34 $
+ * @version $Revision: 1.35 $
*/
public final class TypeUtils {
@@ -239,14 +239,14 @@ public final class TypeUtils {
if (reader != null) {
try {
- String content = new String();
+ StringBuilder content = new StringBuilder();
String line = reader.readLine();
while (line != null) {
- content += line + "\n";
+ content.append(line).append('\n');
line = reader.readLine();
}
reader.close();
- return content;
+ return content.toString();
}
catch (final IOException e) {
Log.logError("I/O error", e);
diff --git a/plugins/org.eclipse.emf.mwe.ui/src/org/eclipse/emf/mwe/ui/workflow/util/ProjectIncludingResourceLoader.java b/plugins/org.eclipse.emf.mwe.ui/src/org/eclipse/emf/mwe/ui/workflow/util/ProjectIncludingResourceLoader.java
index e901618..8ced902 100644
--- a/plugins/org.eclipse.emf.mwe.ui/src/org/eclipse/emf/mwe/ui/workflow/util/ProjectIncludingResourceLoader.java
+++ b/plugins/org.eclipse.emf.mwe.ui/src/org/eclipse/emf/mwe/ui/workflow/util/ProjectIncludingResourceLoader.java
@@ -10,26 +10,29 @@
*******************************************************************************/
package org.eclipse.emf.mwe.ui.workflow.util;
+import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.emf.mwe.core.resources.ResourceLoaderDefaultImpl;
import org.eclipse.emf.mwe.internal.ui.workflow.Activator;
-import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.JavaCore;
/**
* This ResourceLoader is capable of loading resources from a specific Java project within the workspace.
* Typical use is when invoking a workflow from within a plugin.
*
- * FIXME: Refactor this class to repect the EMFPlugin
+ * FIXME: Refactor this class to repect the EMFPlugin
*/
public class ProjectIncludingResourceLoader extends ResourceLoaderDefaultImpl {
- private ClassLoader projectCL;
+ private final ClassLoader projectCL;
public ProjectIncludingResourceLoader(final IProject project) throws CoreException {
@@ -38,24 +41,33 @@ public class ProjectIncludingResourceLoader extends ResourceLoaderDefaultImpl {
}
/**
- * Builds a classloader for a Java project from the workspace.
+ * Builds a classloader for a Java project from the workspace.
* @param project An Eclipse project
* @throws CoreException
*/
public ClassLoader createClassLoader (final IProject project) throws CoreException {
IJavaProject jp = JavaCore.create(project);
- IClasspathEntry[] javacp = jp.getResolvedClasspath(true);
- URL[] url = new URL[javacp.length];
+// IClasspathEntry[] javacp = jp.getResolvedClasspath(true);
+ IPackageFragmentRoot[] roots = jp.getAllPackageFragmentRoots();
+ URL[] urls = new URL[roots.length];
- for (int i=0; i<javacp.length; i++) {
+ IPath wsLocation = ResourcesPlugin.getWorkspace().getRoot().getLocation();
+ for (int i=0; i<roots.length; i++) {
try {
- url[i] = javacp[i].getPath().toFile().toURL();
+ IPath path = roots[i].getPath();
+ File file = path.toFile();
+ if (!file.exists()) {
+ path = wsLocation.append(path);
+ file = path.toFile();
+ }
+ URL url = file.toURL();
+ urls[i] = url;
} catch (MalformedURLException e) {
Activator.logError(e);
+ }
}
- }
- return new URLClassLoader(url);
+ return new URLClassLoader(urls);
}
@Override