From fe502f500f2f351d6fe4cd4d0ec5704fd7398f5b Mon Sep 17 00:00:00 2001 From: hajdam Date: Thu, 15 Aug 2019 09:32:04 +0200 Subject: [PATCH] Release 0.2.0.1 --- bined-jdeveloper-extension.jpr | 2 +- changes.txt | 2 +- .../bined-jdeveloper-extension.jpr | 13 ++++++- .../exbin/bined/jdeveloper/BinaryNode.java | 35 +++++++------------ .../jdeveloper/OpenAsBinaryController.java | 13 ++++--- .../OpenFileAsBinaryController.java | 4 --- .../exbin/bined/jdeveloper/BinaryNode.java | 35 +++++++------------ .../jdeveloper/OpenAsBinaryController.java | 13 ++++--- .../OpenFileAsBinaryController.java | 4 --- 9 files changed, 54 insertions(+), 67 deletions(-) diff --git a/bined-jdeveloper-extension.jpr b/bined-jdeveloper-extension.jpr index 64cfbf8..9a4de88 100644 --- a/bined-jdeveloper-extension.jpr +++ b/bined-jdeveloper-extension.jpr @@ -8,7 +8,7 @@ - + diff --git a/changes.txt b/changes.txt index 3ca3a39..ec80e54 100644 --- a/changes.txt +++ b/changes.txt @@ -1,4 +1,4 @@ -0.2.0.1 +0.2.0.1 (2019-08-15) - Fixed issue with limitation to single editor only - Added legacy version for 11g diff --git a/legacy/11g/bined-jdeveloper-extension/bined-jdeveloper-extension.jpr b/legacy/11g/bined-jdeveloper-extension/bined-jdeveloper-extension.jpr index ae5fc53..fdfa8e7 100644 --- a/legacy/11g/bined-jdeveloper-extension/bined-jdeveloper-extension.jpr +++ b/legacy/11g/bined-jdeveloper-extension/bined-jdeveloper-extension.jpr @@ -92,7 +92,7 @@ - + @@ -136,6 +136,10 @@ + + + + @@ -165,6 +169,13 @@ + + + + + + + diff --git a/legacy/11g/bined-jdeveloper-extension/src/org/exbin/bined/jdeveloper/BinaryNode.java b/legacy/11g/bined-jdeveloper-extension/src/org/exbin/bined/jdeveloper/BinaryNode.java index 17b528d..9bc4b0c 100644 --- a/legacy/11g/bined-jdeveloper-extension/src/org/exbin/bined/jdeveloper/BinaryNode.java +++ b/legacy/11g/bined-jdeveloper-extension/src/org/exbin/bined/jdeveloper/BinaryNode.java @@ -17,6 +17,8 @@ import com.sun.org.apache.xerces.internal.impl.xs.opti.DefaultNode; +import java.io.IOException; + import java.net.MalformedURLException; import java.net.URL; @@ -27,23 +29,19 @@ import oracle.ide.model.Node; +import oracle.javatools.icons.OracleIcons; + /** * Node used for binary data. - * - * Not sure how to force JDeveloper to ignore Node so let's use fake URL. + * + * Report as data: instead of file: so that no additional tabs will be opened. * * @author ExBin Project (http://exbin.org) - * @version 0.2.0 2019/08/14 + * @version 0.2.0 2019/08/15 */ public class BinaryNode extends Node { - private static final String FAKE_PROTOCOL = "orgexbinbined"; - private static final URLStreamHandler FAKE_PROTOCOL_HANDLER = new URLStreamHandler() { - @Override - protected URLConnection openConnection(URL u) { - return FAKE_PROTOCOL.equals(u.getProtocol()) ? new FakeURLStreamHandler(u) : null; - } - }; + private static final String WRAPPED_PREFIX = "orgexbinbined::/"; // Prevent existence of the real file URL private Node wrappedNode; @@ -74,7 +72,7 @@ public String getLongLabel() { public Icon getIcon() { if (wrappedNode == null) return super.getIcon(); - return wrappedNode.getIcon(); + return new javax.swing.ImageIcon(getClass().getResource("/org/exbin/bined/jdeveloper/resources/icons/icon.png")); } @Override @@ -90,19 +88,10 @@ public URL getURL() { URL wrappedUrl = wrappedNode.getURL(); try { - return new URL(FAKE_PROTOCOL, wrappedUrl.getHost(), wrappedUrl.getPort(), wrappedUrl.getProtocol() + "/" + wrappedUrl.getFile(), FAKE_PROTOCOL_HANDLER); + return new URL(wrappedUrl.getProtocol(), wrappedUrl.getHost(), wrappedUrl.getPort(), WRAPPED_PREFIX + wrappedUrl.getFile()); } catch (MalformedURLException e) { return super.getURL(); } } - - private static class FakeURLStreamHandler extends URLConnection { - public FakeURLStreamHandler(URL url) { - super(url); - } - - @Override - public void connect() { - } - } -} \ No newline at end of file +} + \ No newline at end of file diff --git a/legacy/11g/bined-jdeveloper-extension/src/org/exbin/bined/jdeveloper/OpenAsBinaryController.java b/legacy/11g/bined-jdeveloper-extension/src/org/exbin/bined/jdeveloper/OpenAsBinaryController.java index 8e7a144..02a6275 100644 --- a/legacy/11g/bined-jdeveloper-extension/src/org/exbin/bined/jdeveloper/OpenAsBinaryController.java +++ b/legacy/11g/bined-jdeveloper-extension/src/org/exbin/bined/jdeveloper/OpenAsBinaryController.java @@ -17,23 +17,21 @@ import oracle.ide.Context; import oracle.ide.Ide; -import oracle.ide.controller.Controller; import oracle.ide.controller.IdeAction; -import oracle.ide.editor.Editor; +import oracle.ide.controller.TriggerController; import oracle.ide.editor.EditorManager; -import oracle.ide.editor.OpenEditorOptions; import oracle.ide.extension.RegisteredByExtension; import oracle.ide.model.Element; import oracle.ide.model.Locatable; /** * Controller for action org.exbin.bined.jdeveloper.openasbinary. - * + * * @version 0.2.0 2019/08/11 * @author ExBin Project (http://exbin.org) */ @RegisteredByExtension("org.exbin.bined.jdeveloper") -public final class OpenAsBinaryController implements Controller { +public final class OpenAsBinaryController implements TriggerController { private static final String OPEN_AS_BINARY_ID = "org.exbin.bined.jdeveloper.openAsBinaryAction"; static final int OPEN_AS_BINARY_CMD_ID = Ide.findOrCreateCmdID(OPEN_AS_BINARY_ID); @@ -64,6 +62,11 @@ public boolean update(IdeAction action, Context context) { return true; } + @Override + public Object getInvalidStateMessage(IdeAction action, Context context) { + return "Unknown error"; + } + private boolean actionIsEnabled(Context context) { final Element[] selection = context.getSelection(); if (selection == null || selection.length != 1 || diff --git a/legacy/11g/bined-jdeveloper-extension/src/org/exbin/bined/jdeveloper/OpenFileAsBinaryController.java b/legacy/11g/bined-jdeveloper-extension/src/org/exbin/bined/jdeveloper/OpenFileAsBinaryController.java index 9882f56..3a8c148 100644 --- a/legacy/11g/bined-jdeveloper-extension/src/org/exbin/bined/jdeveloper/OpenFileAsBinaryController.java +++ b/legacy/11g/bined-jdeveloper-extension/src/org/exbin/bined/jdeveloper/OpenFileAsBinaryController.java @@ -22,12 +22,8 @@ import oracle.ide.controller.Controller; import oracle.ide.controller.IdeAction; import oracle.ide.dialogs.DialogUtil; -import oracle.ide.editor.Editor; import oracle.ide.editor.EditorManager; -import oracle.ide.editor.OpenEditorOptions; import oracle.ide.extension.RegisteredByExtension; -import oracle.ide.model.Element; -import oracle.ide.model.Locatable; import oracle.ide.model.Node; import oracle.ide.net.URLChooser; diff --git a/src/org/exbin/bined/jdeveloper/BinaryNode.java b/src/org/exbin/bined/jdeveloper/BinaryNode.java index 17b528d..9bc4b0c 100644 --- a/src/org/exbin/bined/jdeveloper/BinaryNode.java +++ b/src/org/exbin/bined/jdeveloper/BinaryNode.java @@ -17,6 +17,8 @@ import com.sun.org.apache.xerces.internal.impl.xs.opti.DefaultNode; +import java.io.IOException; + import java.net.MalformedURLException; import java.net.URL; @@ -27,23 +29,19 @@ import oracle.ide.model.Node; +import oracle.javatools.icons.OracleIcons; + /** * Node used for binary data. - * - * Not sure how to force JDeveloper to ignore Node so let's use fake URL. + * + * Report as data: instead of file: so that no additional tabs will be opened. * * @author ExBin Project (http://exbin.org) - * @version 0.2.0 2019/08/14 + * @version 0.2.0 2019/08/15 */ public class BinaryNode extends Node { - private static final String FAKE_PROTOCOL = "orgexbinbined"; - private static final URLStreamHandler FAKE_PROTOCOL_HANDLER = new URLStreamHandler() { - @Override - protected URLConnection openConnection(URL u) { - return FAKE_PROTOCOL.equals(u.getProtocol()) ? new FakeURLStreamHandler(u) : null; - } - }; + private static final String WRAPPED_PREFIX = "orgexbinbined::/"; // Prevent existence of the real file URL private Node wrappedNode; @@ -74,7 +72,7 @@ public String getLongLabel() { public Icon getIcon() { if (wrappedNode == null) return super.getIcon(); - return wrappedNode.getIcon(); + return new javax.swing.ImageIcon(getClass().getResource("/org/exbin/bined/jdeveloper/resources/icons/icon.png")); } @Override @@ -90,19 +88,10 @@ public URL getURL() { URL wrappedUrl = wrappedNode.getURL(); try { - return new URL(FAKE_PROTOCOL, wrappedUrl.getHost(), wrappedUrl.getPort(), wrappedUrl.getProtocol() + "/" + wrappedUrl.getFile(), FAKE_PROTOCOL_HANDLER); + return new URL(wrappedUrl.getProtocol(), wrappedUrl.getHost(), wrappedUrl.getPort(), WRAPPED_PREFIX + wrappedUrl.getFile()); } catch (MalformedURLException e) { return super.getURL(); } } - - private static class FakeURLStreamHandler extends URLConnection { - public FakeURLStreamHandler(URL url) { - super(url); - } - - @Override - public void connect() { - } - } -} \ No newline at end of file +} + \ No newline at end of file diff --git a/src/org/exbin/bined/jdeveloper/OpenAsBinaryController.java b/src/org/exbin/bined/jdeveloper/OpenAsBinaryController.java index 8e7a144..02a6275 100644 --- a/src/org/exbin/bined/jdeveloper/OpenAsBinaryController.java +++ b/src/org/exbin/bined/jdeveloper/OpenAsBinaryController.java @@ -17,23 +17,21 @@ import oracle.ide.Context; import oracle.ide.Ide; -import oracle.ide.controller.Controller; import oracle.ide.controller.IdeAction; -import oracle.ide.editor.Editor; +import oracle.ide.controller.TriggerController; import oracle.ide.editor.EditorManager; -import oracle.ide.editor.OpenEditorOptions; import oracle.ide.extension.RegisteredByExtension; import oracle.ide.model.Element; import oracle.ide.model.Locatable; /** * Controller for action org.exbin.bined.jdeveloper.openasbinary. - * + * * @version 0.2.0 2019/08/11 * @author ExBin Project (http://exbin.org) */ @RegisteredByExtension("org.exbin.bined.jdeveloper") -public final class OpenAsBinaryController implements Controller { +public final class OpenAsBinaryController implements TriggerController { private static final String OPEN_AS_BINARY_ID = "org.exbin.bined.jdeveloper.openAsBinaryAction"; static final int OPEN_AS_BINARY_CMD_ID = Ide.findOrCreateCmdID(OPEN_AS_BINARY_ID); @@ -64,6 +62,11 @@ public boolean update(IdeAction action, Context context) { return true; } + @Override + public Object getInvalidStateMessage(IdeAction action, Context context) { + return "Unknown error"; + } + private boolean actionIsEnabled(Context context) { final Element[] selection = context.getSelection(); if (selection == null || selection.length != 1 || diff --git a/src/org/exbin/bined/jdeveloper/OpenFileAsBinaryController.java b/src/org/exbin/bined/jdeveloper/OpenFileAsBinaryController.java index 9882f56..3a8c148 100644 --- a/src/org/exbin/bined/jdeveloper/OpenFileAsBinaryController.java +++ b/src/org/exbin/bined/jdeveloper/OpenFileAsBinaryController.java @@ -22,12 +22,8 @@ import oracle.ide.controller.Controller; import oracle.ide.controller.IdeAction; import oracle.ide.dialogs.DialogUtil; -import oracle.ide.editor.Editor; import oracle.ide.editor.EditorManager; -import oracle.ide.editor.OpenEditorOptions; import oracle.ide.extension.RegisteredByExtension; -import oracle.ide.model.Element; -import oracle.ide.model.Locatable; import oracle.ide.model.Node; import oracle.ide.net.URLChooser;