[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [bpmn2-modeler-dev] [PATCH] IURIEditorInputs support.
|
Hi,
Can someone apply this patch, please?
On Mon, Mar 11, 2013 at 4:07 PM, Andrey Pavlenko
<andrey.a.pavlenko@xxxxxxxxx> wrote:
> Currently it's not possible to open a bpmn2 file located somewhere in
> file system, outside the workspace - editor fails with "Invalid Editor
> Input" error. This fix adds support for all inputs implementing the
> IURIEditorInput interface.
>
> Signed-off-by: Andrey Pavlenko <andrey.a.pavlenko@xxxxxxxxx>
> ---
> .../src/org/eclipse/bpmn2/modeler/ui/editor/BPMN2Editor.java | 3 ++-
> .../src/org/eclipse/bpmn2/modeler/ui/wizards/FileService.java | 4 ++++
> 2 files changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/editor/BPMN2Editor.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/editor/BPMN2Editor.java
> index b74cbf4..3ceaf03 100644
> --- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/editor/BPMN2Editor.java
> +++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/editor/BPMN2Editor.java
> @@ -198,6 +198,7 @@ import org.eclipse.ui.IEditorReference;
> import org.eclipse.ui.IEditorSite;
> import org.eclipse.ui.IPartListener2;
> import org.eclipse.ui.IStorageEditorInput;
> +import org.eclipse.ui.IURIEditorInput;
> import org.eclipse.ui.IWorkbench;
> import org.eclipse.ui.IWorkbenchListener;
> import org.eclipse.ui.IWorkbenchPage;
> @@ -351,7 +352,7 @@ public class BPMN2Editor extends DiagramEditor implements IPropertyChangeListene
> String targetNamespace = null;
> bpmnDiagram = null;
>
> - if (input instanceof IStorageEditorInput) {
> + if ((input instanceof IStorageEditorInput) || (input instanceof IURIEditorInput)) {
> input = createNewDiagramEditorInput(site, input, diagramType, targetNamespace);
> }
> else if (input instanceof DiagramEditorInput) {
> diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/wizards/FileService.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/wizards/FileService.java
> index eab3035..a66ae86 100644
> --- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/wizards/FileService.java
> +++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/wizards/FileService.java
> @@ -65,6 +65,7 @@ import org.eclipse.graphiti.ui.internal.editor.GFWorkspaceCommandStackImpl;
> import org.eclipse.ui.IEditorInput;
> import org.eclipse.ui.IEditorSite;
> import org.eclipse.ui.IStorageEditorInput;
> +import org.eclipse.ui.IURIEditorInput;
> import org.eclipse.ui.part.FileEditorInput;
>
> public class FileService {
> @@ -241,6 +242,9 @@ public class FileService {
> } else if (input instanceof FileEditorInput) {
> IPath path = ((FileEditorInput) input).getFile().getFullPath();
> return URI.createPlatformResourceURI(path.toString(), true);
> + } else if (input instanceof IURIEditorInput) {
> + String uri = ((IURIEditorInput) input).getURI().toString();
> + return URI.createURI(uri, true);
> } else if (input instanceof IStorageEditorInput) {
> IStorageEditorInput sei = (IStorageEditorInput) input;
>
> --
> 1.8.1.5
>