Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsdimov2011-06-27 14:14:40 +0000
committersdimov2011-06-27 14:14:40 +0000
commit9506e159dbabc7e71577ccd05b5bdeddea191c96 (patch)
tree67e907a121bdbcfc41e7b7a2472c002dd03b0fc7 /jpa_diagram_editor
parent458597a5a40cffd0cdffdea44ede9d4948c05555 (diff)
downloadwebtools.dali-9506e159dbabc7e71577ccd05b5bdeddea191c96.tar.gz
webtools.dali-9506e159dbabc7e71577ccd05b5bdeddea191c96.tar.xz
webtools.dali-9506e159dbabc7e71577ccd05b5bdeddea191c96.zip
[338948] Cancel rename of an attribute and the diagram still gets edited
Diffstat (limited to 'jpa_diagram_editor')
-rw-r--r--jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/DirectEditAttributeFeature.java6
-rw-r--r--jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/DirectEditJPAEntityFeature.java7
-rw-r--r--jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/RefactorEntityFeature.java13
-rw-r--r--jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JpaArtifactFactory.java18
4 files changed, 28 insertions, 16 deletions
diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/DirectEditAttributeFeature.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/DirectEditAttributeFeature.java
index a8e268749c..bd0b3850a5 100644
--- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/DirectEditAttributeFeature.java
+++ b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/DirectEditAttributeFeature.java
@@ -110,7 +110,11 @@ public class DirectEditAttributeFeature extends AbstractDirectEditingFeature {
inverseJPTName = rel.getInverse().getName();
if (oldAt.getName().equals(value))
return;
- JpaArtifactFactory.instance().renameAttribute(oldAt, value, inverseJPTName, getFeatureProvider());
+ try {
+ JpaArtifactFactory.instance().renameAttribute(oldAt, value, inverseJPTName, getFeatureProvider());
+ } catch (InterruptedException e) {
+ return;
+ }
if (pe.getGraphicsAlgorithm() == null)
return;
diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/DirectEditJPAEntityFeature.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/DirectEditJPAEntityFeature.java
index d67baa9149..932838d4dc 100644
--- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/DirectEditJPAEntityFeature.java
+++ b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/DirectEditJPAEntityFeature.java
@@ -36,6 +36,7 @@ import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
import org.eclipse.jpt.jpa.core.context.persistence.ClassRef;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
+import org.eclipse.jpt.jpadiagrameditor.ui.internal.JPADiagramEditorPlugin;
import org.eclipse.jpt.jpadiagrameditor.ui.internal.i18n.JPAEditorMessages;
import org.eclipse.jpt.jpadiagrameditor.ui.internal.propertypage.JPADiagramPropertyPage;
import org.eclipse.jpt.jpadiagrameditor.ui.internal.provider.IJPAEditorFeatureProvider;
@@ -139,7 +140,11 @@ public class DirectEditJPAEntityFeature extends AbstractDirectEditingFeature {
String newAtName = JPAEditorUtil.decapitalizeFirstLetter(value);
if (JpaArtifactFactory.instance().isMethodAnnotated(at))
newAtName = JPAEditorUtil.produceValidAttributeName(newAtName);
- newAtName = JpaArtifactFactory.instance().renameAttribute(at, newAtName, jpt.getName(), getFeatureProvider()).getName();
+ try {
+ newAtName = JpaArtifactFactory.instance().renameAttribute(at, newAtName, jpt.getName(), getFeatureProvider()).getName();
+ } catch (InterruptedException e) {
+ JPADiagramEditorPlugin.logError(e);
+ }
final GraphicsAlgorithm algo = pel.getGraphicsAlgorithm().getGraphicsAlgorithmChildren().get(0);
final String attName = newAtName;
diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/RefactorEntityFeature.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/RefactorEntityFeature.java
index f4a381d1e0..ff85eb4381 100644
--- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/RefactorEntityFeature.java
+++ b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/RefactorEntityFeature.java
@@ -293,11 +293,20 @@ public abstract class RefactorEntityFeature extends AbstractCustomFeature {
ICompilationUnit cu = getFeatureProvider().getCompilationUnit((JavaPersistentType) at.getParent());
if (!cu.exists()) {
at = (JavaPersistentAttribute)at.getPersistenceUnit().getPersistentType(newJptName).getAttributeNamed(at.getName());
- JavaPersistentAttribute newAt = JpaArtifactFactory.instance().renameAttribute(at, JPAEditorUtil.returnSimpleName(newJptName), newJptName, getFeatureProvider());
+ JavaPersistentAttribute newAt = null;
+ try {
+ newAt = JpaArtifactFactory.instance().renameAttribute(at, JPAEditorUtil.returnSimpleName(newJptName), newJptName, getFeatureProvider());
+ } catch (InterruptedException e) {
+ JPADiagramEditorPlugin.logError(e);
+ }
atOldToNewName.put(at.getName(), newAt.getName());
newSelfAts.add(newAt);
} else {
- JpaArtifactFactory.instance().renameAttribute(at, JPAEditorUtil.returnSimpleName(newJptName), newJptName, getFeatureProvider());
+ try {
+ JpaArtifactFactory.instance().renameAttribute(at, JPAEditorUtil.returnSimpleName(newJptName), newJptName, getFeatureProvider());
+ } catch (InterruptedException e) {
+ JPADiagramEditorPlugin.logError(e);
+ }
}
}
Iterator<JavaPersistentAttribute> itr = newSelfAts.iterator();
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 0d4c50b857..230628b08b 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
@@ -1497,7 +1497,7 @@ public class JpaArtifactFactory {
public JavaPersistentAttribute renameAttribute(JavaPersistentType jpt,
String oldName, String newName, String inverseEntityName,
- IJPAEditorFeatureProvider fp) {
+ IJPAEditorFeatureProvider fp) throws InterruptedException {
newName = JPAEditorUtil.decapitalizeFirstLetter(newName);
if (JpaArtifactFactory.instance().isMethodAnnotated(jpt)) {
newName = JPAEditorUtil.produceValidAttributeName(newName);
@@ -1587,13 +1587,13 @@ public class JpaArtifactFactory {
}
public JavaPersistentAttribute renameAttribute(JavaPersistentAttribute jpa,
- String newName, String newEntityName, IJPAEditorFeatureProvider fp) {
+ String newName, String newEntityName, IJPAEditorFeatureProvider fp) throws InterruptedException {
return renameAttribute((JavaPersistentType)jpa.getParent(), jpa.getName(), newName,
newEntityName, fp);
}
private void renameAttribute(ICompilationUnit cu, String oldName,
- String newName, IJPAEditorFeatureProvider fp, boolean isMethodAnnotated) {
+ String newName, IJPAEditorFeatureProvider fp, boolean isMethodAnnotated) throws InterruptedException {
IType javaType = cu.findPrimaryType();
if (javaType == null)
return;
@@ -1656,7 +1656,7 @@ public class JpaArtifactFactory {
}
- private void renameField(IField field, String newName, boolean isMethodAnnotated) {
+ private void renameField(IField field, String newName, boolean isMethodAnnotated) throws InterruptedException {
if (!field.exists())
return;
String oldName = field.getElementName();
@@ -1671,8 +1671,6 @@ public class JpaArtifactFactory {
.getWorkbench().getActiveWorkbenchWindow();
Shell sh = ww.getShell();
s.perform(sh, ww);
- } catch (InterruptedException e) {
- JPADiagramEditorPlugin.logError("Cannot rename the field of the attribute " + oldName, e); //$NON-NLS-1$
} catch (InvocationTargetException e) {
JPADiagramEditorPlugin.logError("Cannot rename the field of the attribute " + oldName, e); //$NON-NLS-1$
}
@@ -1681,7 +1679,7 @@ public class JpaArtifactFactory {
}
}
- private void renameGetter(IMethod getter, String newName) {
+ private void renameGetter(IMethod getter, String newName) throws InterruptedException {
if (!getter.exists())
return;
String oldName = getter.getElementName();
@@ -1703,8 +1701,6 @@ public class JpaArtifactFactory {
.getWorkbench().getActiveWorkbenchWindow();
Shell sh = ww.getShell();
s.perform(sh, ww);
- } catch (InterruptedException e) {
- JPADiagramEditorPlugin.logError("Cannot rename the getter of the attribute " + oldName, e); //$NON-NLS-1$
} catch (InvocationTargetException e) {
JPADiagramEditorPlugin.logError("Cannot rename the getter of the attribute " + oldName, e); //$NON-NLS-1$
}
@@ -1713,7 +1709,7 @@ public class JpaArtifactFactory {
}
}
- private void renameSetter(IMethod setter, String newName) {
+ private void renameSetter(IMethod setter, String newName) throws InterruptedException {
if (!setter.exists())
return;
String oldName = setter.getElementName();
@@ -1729,8 +1725,6 @@ public class JpaArtifactFactory {
.getWorkbench().getActiveWorkbenchWindow();
Shell sh = ww.getShell();
s.perform(sh, ww);
- } catch (InterruptedException e) {
- JPADiagramEditorPlugin.logError("Cannot rename the setter of the attribute " + oldName, e); //$NON-NLS-1$
} catch (InvocationTargetException e) {
JPADiagramEditorPlugin.logError("Cannot rename the setter of the attribute " + oldName, e); //$NON-NLS-1$
}

Back to the top