diff options
author | Petya Sabeva | 2012-08-28 11:27:46 +0000 |
---|---|---|
committer | Petya Sabeva | 2012-08-28 11:27:46 +0000 |
commit | 354f6efd05e0e929bfa89cf6dc47d01f1d7dc3b5 (patch) | |
tree | 469ed56a741fd93d082cca70b1b15ffe8fadfeca | |
parent | 9eafbee1fd7f91461baebe0b262a3dc41e7db514 (diff) | |
download | webtools.dali-354f6efd05e0e929bfa89cf6dc47d01f1d7dc3b5.tar.gz webtools.dali-354f6efd05e0e929bfa89cf6dc47d01f1d7dc3b5.tar.xz webtools.dali-354f6efd05e0e929bfa89cf6dc47d01f1d7dc3b5.zip |
Revert previous changes: Trying to change the dali model synchronously,
using ProjectManager.execute(command, ExtendedCommandExecutor)
Change-Id: I5a3992f9d03759256bc4f118c10d5cce05888bf0
2 files changed, 13 insertions, 56 deletions
diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/META-INF/MANIFEST.MF b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/META-INF/MANIFEST.MF index 142825a656..80b1d02e36 100644 --- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/META-INF/MANIFEST.MF +++ b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/META-INF/MANIFEST.MF @@ -28,8 +28,7 @@ Require-Bundle: org.eclipse.core.expressions;bundle-version="[3.4.0,4.0.0)", org.eclipse.ui.views.properties.tabbed;bundle-version="[3.4.0,4.0.0)", org.eclipse.wst.common.emf;bundle-version="[1.1.200,2.0.0)", org.eclipse.wst.common.project.facet.core;bundle-version="[1.3.0,2.0.0)", - org.eclipse.core.filesystem;bundle-version="1.3.100", - org.eclipse.jpt.common.ui;bundle-version="1.2.0" + org.eclipse.core.filesystem;bundle-version="1.3.100" Export-Package: org.eclipse.jpt.jpadiagrameditor.ui.internal;x-internal:=true, org.eclipse.jpt.jpadiagrameditor.ui.internal.dialog;x-internal:=true, org.eclipse.jpt.jpadiagrameditor.ui.internal.facade;x-internal:=true, diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JpaArtifactFactory.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JpaArtifactFactory.java index 9e90dbc6b4..8c00d4dfdf 100644 --- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JpaArtifactFactory.java +++ b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JpaArtifactFactory.java @@ -30,7 +30,6 @@ import java.util.Set; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.emf.transaction.RecordingCommand; @@ -61,12 +60,9 @@ import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute; import org.eclipse.jpt.common.core.resource.java.JavaResourceCompilationUnit; import org.eclipse.jpt.common.core.resource.java.JavaResourceType; import org.eclipse.jpt.common.core.resource.java.NestableAnnotation; -import org.eclipse.jpt.common.ui.internal.utility.SynchronousUiCommandExecutor; -import org.eclipse.jpt.common.utility.command.Command; import org.eclipse.jpt.common.utility.internal.iterables.SubListIterableWrapper; import org.eclipse.jpt.jpa.core.JpaFile; import org.eclipse.jpt.jpa.core.JpaProject; -import org.eclipse.jpt.jpa.core.JpaProjectManager; import org.eclipse.jpt.jpa.core.MappingKeys; import org.eclipse.jpt.jpa.core.context.AttributeMapping; import org.eclipse.jpt.jpa.core.context.Embeddable; @@ -1471,24 +1467,20 @@ public class JpaArtifactFactory { inverseJPAName = rel.getInverseAttributeName(); } } -// ICompilationUnit cu = fp.getCompilationUnit(jpt); -// renameAttribute(cu, oldName, newName, fp, this.isMethodAnnotated(jpt)); -// refreshEntityModel(fp, jpt); -// JavaPersistentAttribute newAt = jpt.getAttributeNamed(newName); -// if (newAt == null) { -// //TODO this is wrong, should not need to do any of these updates or syncs. -// //should be changing the dali model synchronously so that all the syncs/updates are completed -// //take a look at the JpaProjectManager.execute(Command, ExtendedCommandExecutor) -// jpt.getJavaResourceType().getJavaResourceCompilationUnit().synchronizeWithJavaSource(); -// jpt.update(); -// jpt.synchronizeWithResourceModel(); -// newAt = jpt.getAttributeNamed(newName); -// } - Command renameAttr = new RenameAttributeCommand(jpt, oldName, newName, fp); - getJpaProjectManager().execute(renameAttr, SynchronousUiCommandExecutor.instance()); - + ICompilationUnit cu = fp.getCompilationUnit(jpt); + renameAttribute(cu, oldName, newName, fp, this.isMethodAnnotated(jpt)); + refreshEntityModel(fp, jpt); JavaPersistentAttribute newAt = jpt.getAttributeNamed(newName); if (newAt == null) { + //TODO this is wrong, should not need to do any of these updates or syncs. + //should be changing the dali model synchronously so that all the syncs/updates are completed + //take a look at the JpaProjectManager.execute(Command, ExtendedCommandExecutor) + jpt.getJavaResourceType().getJavaResourceCompilationUnit().synchronizeWithJavaSource(); + jpt.update(); + jpt.synchronizeWithResourceModel(); + newAt = jpt.getAttributeNamed(newName); + } + if (newAt == null) { JPADiagramEditorPlugin.logError("The attribute " + newName + " could not be resolved", new NullPointerException()); //$NON-NLS-1$ //$NON-NLS-2$ } fp.addRemoveIgnore(jpt, oldAt.getName()); @@ -1523,40 +1515,6 @@ public class JpaArtifactFactory { return newAt; } - private class RenameAttributeCommand implements Command { - - private JavaPersistentType jpt; - private String oldName; - private String newName; - private IJPAEditorFeatureProvider fp; - - - public RenameAttributeCommand(JavaPersistentType jpt, String oldName, - String newName, IJPAEditorFeatureProvider fp){ - - super(); - this.jpt = jpt; - this.oldName = oldName; - this.newName = newName; - this.fp = fp; - - } - - public void execute() { - ICompilationUnit cu = this.fp.getCompilationUnit(this.jpt); - try { - renameAttribute(cu, this.oldName, this.newName, this.fp, isMethodAnnotated(this.jpt)); - } catch (InterruptedException e) { - JPADiagramEditorPlugin.logError("Cannot rename attribute", e); //$NON-NLS-1$ - } - } - - } - - private JpaProjectManager getJpaProjectManager() { - return (JpaProjectManager) ResourcesPlugin.getWorkspace().getAdapter(JpaProjectManager.class); - } - private void updateRelation(JavaPersistentType jpt, IJPAEditorFeatureProvider fp, IRelation rel) { UpdateAttributeFeature updateFeature = new UpdateAttributeFeature(fp); |