Skip to content

Commit

Permalink
Acceleo 3 did not reload java classes located in the workspace when they
Browse files Browse the repository at this point in the history
changed. This has now been fixed.
  • Loading branch information
Kellindil authored and sbegaudeau committed Apr 11, 2012
1 parent 5a10d09 commit 3f73def
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,12 @@ public boolean visit(IResourceDelta delta) throws CoreException {
if ("class".equals(resource.getFullPath().getFileExtension())) { //$NON-NLS-1$
final IClassFileReader reader = ToolFactory.createDefaultClassFileReader(resource
.getLocation().toOSString(), IClassFileReader.CLASSFILE_ATTRIBUTES);
changedClasses.add(new String(reader.getClassName()));
changedClasses.add(new String(reader.getClassName()).replace("/", ".")); //$NON-NLS-1$ //$NON-NLS-2$
}
break;
case IResource.PROJECT:
changedProjects.add((IProject)resource);
visit = true;
break;
default:
visit = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import java.util.concurrent.Callable;

import org.eclipse.acceleo.common.interpreter.CompilationResult;
import org.eclipse.acceleo.common.utils.ModelUtils;
import org.eclipse.acceleo.internal.parser.AcceleoParserMessages;
import org.eclipse.acceleo.model.mtl.Module;
import org.eclipse.acceleo.model.mtl.Query;
Expand Down Expand Up @@ -175,7 +174,11 @@ public CompilationResult call() throws Exception {
if (resourceSet == null) {
resourceSet = new ResourceSetImpl();
}
final Resource resource = ModelUtils.createResource(moduleDescriptor.getModuleURI(), resourceSet);
final Resource old = resourceSet.getResource(moduleDescriptor.getModuleURI(), false);
if (old != null) {
resourceSet.getResources().remove(old);
}
final Resource resource = resourceSet.createResource(moduleDescriptor.getModuleURI());

AcceleoSourceBuffer source = new AcceleoSourceBuffer(new StringBuffer(moduleDescriptor
.getModuleContent()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,9 @@ public boolean equals(Object obj) {
equal = true;
} else {
ModuleDescriptor other = (ModuleDescriptor)obj;
equal = moduleURI.equals(other.moduleURI) && qualifiedName.equals(other.qualifiedName)
&& moduleContent.equals(other.moduleContent);
equal = getModuleURI().equals(other.getModuleURI())
&& getQualifiedName().equals(other.getQualifiedName())
&& getModuleContent().equals(other.getModuleContent());
}

return equal;
Expand All @@ -101,6 +102,6 @@ public boolean equals(Object obj) {
*/
@Override
public int hashCode() {
return moduleURI.hashCode() + qualifiedName.hashCode() + moduleContent.hashCode();
return getModuleURI().hashCode() + getQualifiedName().hashCode() + getModuleContent().hashCode();
}
}

0 comments on commit 3f73def

Please sign in to comment.