Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpsabeva2012-03-29 08:03:25 -0400
committerpsabeva2012-03-29 08:03:25 -0400
commitdf3381ad017a5d728ed338715fb73d1df4e58bff (patch)
treed160ad446d53db22301bb05e589e791020c1d206
parent390f632f1ce6d9adc14d564c4b9e9eaf4d5e1785 (diff)
downloadwebtools.dali-df3381ad017a5d728ed338715fb73d1df4e58bff.tar.gz
webtools.dali-df3381ad017a5d728ed338715fb73d1df4e58bff.tar.xz
webtools.dali-df3381ad017a5d728ed338715fb73d1df4e58bff.zip
[363583] - Set a meaningful error message when the xml under diagrams folder is trying to be opened with JPA Diagram Editor.
-rw-r--r--jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/JPADiagramEditor.java15
-rw-r--r--jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/i18n/JPAEditorMessages.java2
-rw-r--r--jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/i18n/messages.properties1
3 files changed, 14 insertions, 4 deletions
diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/JPADiagramEditor.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/JPADiagramEditor.java
index e008d5cc69..867058ea26 100644
--- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/JPADiagramEditor.java
+++ b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/JPADiagramEditor.java
@@ -18,6 +18,7 @@ package org.eclipse.jpt.jpadiagrameditor.ui.internal;
import java.lang.reflect.InvocationTargetException;
import java.util.Iterator;
import java.util.List;
+
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -62,8 +63,10 @@ import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.JPAEditorConstants;
import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.JPAEditorUtil;
import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.JpaArtifactFactory;
import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.Wrp;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PartInitException;
@@ -243,14 +246,18 @@ public class JPADiagramEditor extends DiagramEditor {
}
}
- public void init(IEditorSite site, IEditorInput input)
- throws PartInitException {
+ public void init(IEditorSite site, IEditorInput input) throws PartInitException {
IFile entityFile = (IFile) input.getAdapter(IFile.class);
if (entityFile != null && entityFile.getFileExtension().equals("java")) { //$NON-NLS-1$
initWithFileEditorInput(site, entityFile);
- } else
- super.init(site, input);
+ } else {
+ if(input instanceof IFileEditorInput){
+ throw new PartInitException(NLS.bind(JPAEditorMessages.JPADiagramEditor_openDiagramErrorMSG, entityFile.getName()));
+ } else {
+ super.init(site, input);
+ }
+ }
}
@Override
diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/i18n/JPAEditorMessages.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/i18n/JPAEditorMessages.java
index 208eb6592f..531f29ede3 100644
--- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/i18n/JPAEditorMessages.java
+++ b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/i18n/JPAEditorMessages.java
@@ -97,6 +97,8 @@ public class JPAEditorMessages extends NLS {
public static String JpaArtifactFactory_CanNotCheckReturnType;
+ public static String JPADiagramEditor_openDiagramErrorMSG;
+
public static String JPADiagramEditor_waitingForMoin;
public static String JPADiagramPropertyPage_errSavePropsMsgTitle;
diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/i18n/messages.properties b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/i18n/messages.properties
index 9af5b772be..f79f7be164 100644
--- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/i18n/messages.properties
+++ b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/i18n/messages.properties
@@ -83,6 +83,7 @@ DiscardAndRemoveAllEntitiesFeature_ContextMenuOperationDescription=Remove All En
JpaArtifactFactory_CanNotCheckReturnType=Cannot check the return type
+JPADiagramEditor_openDiagramErrorMSG=Could not open editor, because {0} is not a valid JPA project. Use Open With to open this file with a different editor.
JPADiagramEditor_waitingForMoin=Waiting for MOIN connection initialization...
JPADiagramPropertyPage_errSavePropsMsgTitle=Cannot Save Properties

Back to the top