Author: bbrodt
Date: 2011-03-17 11:02:25 -0400 (Thu, 17 Mar 2011)
New Revision: 29864
Modified:
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/Messages.java
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/messages.properties
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/util/BPELUtil.java
Log:
https://issues.jboss.org/browse/JBIDE-8601
Display error dialog instead of ignoring hyperlink clicks
Modified: trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/Messages.java
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/Messages.java 2011-03-17
12:58:55 UTC (rev 29863)
+++
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/Messages.java 2011-03-17
15:02:25 UTC (rev 29864)
@@ -241,6 +241,12 @@
public static String BPELUtil__unknown_URI__54;
public static String BPELUtil_HiddenSequence_2;
public static String BPELUtil_Sequence_1;
+
+ //
https://issues.jboss.org/browse/JBIDE-8601
+ public static String BPELUtil__Error;
+ public static String BPELUtil_NoEditorForNullObject;
+ public static String BPELUtil_NoEditorForObject;
+
public static String BPELVariableAdapter_Variable_1;
public static String BPELXYLayoutEditPolicy_Add_Part_1;
public static String BPELXYLayoutEditPolicy_Move_Part_2;
Modified:
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/messages.properties
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/messages.properties 2011-03-17
12:58:55 UTC (rev 29863)
+++
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/messages.properties 2011-03-17
15:02:25 UTC (rev 29864)
@@ -132,10 +132,14 @@
BPELPreferencePage_WSIL_Description = The document above contains links to other WSIL
documents shown below.\nYou can add or remove WSIL links to/from the above document.\nThe
result will be shown in the WSIL browser of the editor.
#
BPELUIRegistry_Expression_language_editors_must_provide_expressionLanguage_and_class__8=Expression
language editors must provide expressionLanguage and class.
+BPELUtil__Error=Error
BPELUtil__unknown_URI__54=<unknown URI>
BPELUtil_HiddenSequence_2=HiddenSequence
BPELUtil_Sequence_1=Sequence
BPELUtil_NCName=Not a valid NCName
+BPELUtil_NoEditorForNullObject=Cannot open editor for null object
+BPELUtil_NoEditorForObject=Cannot open editor for object of type {0}
+
BPELVariableAdapter_Variable_1=Variable
BPELXYLayoutEditPolicy_Add_Part_1=Add Part
BPELXYLayoutEditPolicy_Move_Part_2=Move Part
Modified:
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/util/BPELUtil.java
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/util/BPELUtil.java 2011-03-17
12:58:55 UTC (rev 29863)
+++
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/util/BPELUtil.java 2011-03-17
15:02:25 UTC (rev 29864)
@@ -118,10 +118,12 @@
import org.eclipse.gef.GraphicalViewer;
import org.eclipse.gef.Tool;
import org.eclipse.jface.dialogs.IInputValidator;
+import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.window.Window;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.accessibility.ACC;
import org.eclipse.swt.accessibility.AccessibleControlEvent;
@@ -1724,14 +1726,34 @@
public static void openEditor(EObject modelObject, BPELEditor editor) {
try {
//
https://issues.jboss.org/browse/JBIDE-8044
- Assert.isNotNull(modelObject);
- Assert.isNotNull(modelObject.eResource());
- //
https://jira.jboss.org/browse/JBIDE-7351
- // try to resolve proxies here, otherwise we don't know editor input
- if (modelObject.eIsProxy()) {
- modelObject = EmfModelQuery.resolveProxy(editor.getProcess(), modelObject);
+ if (modelObject==null) {
+ //
https://issues.jboss.org/browse/JBIDE-8601
+ MessageDialog.openError(editor.getEditorSite().getShell(),
+ Messages.BPELUtil__Error,
+ Messages.BPELUtil_NoEditorForNullObject);
+ return;
}
- IFile file = BPELUtil.getFileFromURI(modelObject.eResource().getURI());
+
+ EObject resolvedObject = null;
+ if (modelObject.eResource()==null) {
+ //
https://jira.jboss.org/browse/JBIDE-7351
+ // try to resolve proxies here, otherwise we don't know editor input
+ if (modelObject.eIsProxy()) {
+ resolvedObject = EmfModelQuery.resolveProxy(editor.getProcess(), modelObject);
+ }
+ }
+ else
+ resolvedObject = modelObject;
+
+ if (resolvedObject==null) {
+ //
https://issues.jboss.org/browse/JBIDE-8601
+ MessageDialog.openError(editor.getEditorSite().getShell(),
+ Messages.BPELUtil__Error, NLS.bind(
+ Messages.BPELUtil_NoEditorForObject,
+ (new Object[] { modelObject.getClass().getSimpleName() })));
+ return;
+ }
+ IFile file = BPELUtil.getFileFromURI(resolvedObject.eResource().getURI());
IDE.openEditor(editor.getSite().getWorkbenchWindow().getActivePage(), file);
} catch (PartInitException ex) {
BPELUIPlugin.log(ex, IStatus.WARNING);