Skip to content

Commit

Permalink
Release 0.2.4
Browse files Browse the repository at this point in the history
  • Loading branch information
hajdam committed Apr 11, 2021
1 parent 8d87e3f commit bfac5ad
Show file tree
Hide file tree
Showing 16 changed files with 131 additions and 43 deletions.
4 changes: 2 additions & 2 deletions changes.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
0.2.4
- Added String field in values panel (issue #8)
0.2.4 (2021-04-11)
- Added string field in values panel (issue #8)
- Fixed 2021.1: Can't close any tabs once a binary file is opened (issue #35)

0.2.3 (2020-07-30)
Expand Down
Binary file modified lib/bined-core-0.2.0-SNAPSHOT.jar
Binary file not shown.
Binary file modified lib/bined-extended-0.2.0-SNAPSHOT.jar
Binary file not shown.
Binary file modified lib/bined-highlight-swing-0.2.0-SNAPSHOT.jar
Binary file not shown.
Binary file modified lib/bined-operation-0.2.0-SNAPSHOT.jar
Binary file not shown.
Binary file modified lib/bined-operation-swing-0.2.0-SNAPSHOT.jar
Binary file not shown.
Binary file modified lib/bined-swing-0.2.0-SNAPSHOT.jar
Binary file not shown.
Binary file modified lib/bined-swing-extended-0.2.0-SNAPSHOT.jar
Binary file not shown.
8 changes: 4 additions & 4 deletions resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<idea-plugin version="2" url="https://bined.exbin.org/intellij-plugin">
<id>org.exbin.deltahex.intellij</id>
<name>BinEd - Binary/Hexadecimal Editor</name>
<version>0.2.4.snapshot</version>
<version>0.2.4</version>
<vendor email="[email protected]" url="https://exbin.org">ExBin Project</vendor>

<description><![CDATA[
Expand All @@ -11,7 +11,7 @@
<li>Associate file extension with Binary File file type in Options/Editor/File Types</li></ul>
<h1>Preview</h1>
<p><img src="https://bined.exbin.org/images/bined-intellij-plugin-preview-0.2.3.png" alt="[bined-intellij-plugin-preview]" width="382" height="65"/></p>
<p><img src="https://bined.exbin.org/images/bined-intellij-plugin-preview-0.2.4.png" alt="[bined-intellij-plugin-preview]" width="382" height="65"/></p>
<h1>Features</h1>
<ul><li>Visualize data as numerical (hexadecimal) codes and text representation</li>
Expand All @@ -32,7 +32,7 @@ Sources: <a href="https://github.com/exbin/bined-intellij-plugin">https://github
]]></description>

<change-notes><![CDATA[
<ul><li>Added String field in values panel</li>
<ul><li>Added string field in values panel</li>
<li>Fixed Can't close any tabs once a binary file is opened</li>
</ul>
]]>
Expand All @@ -51,7 +51,7 @@ Sources: <a href="https://github.com/exbin/bined-intellij-plugin">https://github
<depends optional="true" config-file="go-ext.xml">com.intellij.modules.go</depends>
<depends optional="true" config-file="ruby-ext.xml">com.intellij.modules.ruby</depends>
<depends optional="true" config-file="c-ext.xml">com.intellij.modules.clion</depends>
<depends optional="true" config-file="database-ext.xml">com.intellij.modules.database</depends>
<!-- <depends optional="true" config-file="database-ext.xml">com.intellij.modules.database</depends> -->

<project-components>
</project-components>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
Application.name = BinEd
Application.title = BinEd Binary/Hexadecimal Editor
Application.release = 0.2.4
Application.mode = DEV
Application.version = 0.2.4 DEV
Application.product= BinEd Binary/Hexadecimal Editor 0.2.4 DEV
Application.mode =
Application.version = 0.2.4
Application.product= BinEd Binary/Hexadecimal Editor 0.2.4
Application.vendor = ExBin Project
Application.homepage = https://bined.exbin.org/intellij-plugin/
Application.vendorId = ExBin Project
Expand Down
104 changes: 96 additions & 8 deletions src/org/exbin/bined/intellij/BinEdFileEditor.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileSystem;
import com.intellij.util.messages.MessageBus;
import com.intellij.util.messages.MessageBusConnection;

Expand All @@ -32,12 +33,15 @@
import javax.swing.*;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

/**
* File editor using BinEd editor component.
*
* @author ExBin Project (http://exbin.org)
* @version 0.2.4 2021/04/10
* @version 0.2.4 2021/04/11
*/
@ParametersAreNonnullByDefault
public class BinEdFileEditor implements FileEditor, DumbAware {
Expand All @@ -48,6 +52,7 @@ public class BinEdFileEditor implements FileEditor, DumbAware {
private String displayName;
private BinEdVirtualFile virtualFile;
private BinEdFileEditorState fileEditorState = new BinEdFileEditorState();
private static VirtualFile NULL_VIRTUAL_FILE = new NullVirtualFile();

public BinEdFileEditor(Project project, final BinEdVirtualFile virtualFile) {
this.project = project;
Expand Down Expand Up @@ -135,12 +140,12 @@ public String getName() {

@Nonnull
@Override
public FileEditorState getState(@Nonnull FileEditorStateLevel level) {
public FileEditorState getState(FileEditorStateLevel level) {
return fileEditorState;
}

@Override
public void setState(@Nonnull FileEditorState state) {
public void setState(FileEditorState state) {
}

@Override
Expand All @@ -164,12 +169,12 @@ public void deselectNotify() {
}

@Override
public void addPropertyChangeListener(@Nonnull PropertyChangeListener listener) {
public void addPropertyChangeListener(PropertyChangeListener listener) {
propertyChangeSupport.addPropertyChangeListener(listener);
}

@Override
public void removePropertyChangeListener(@Nonnull PropertyChangeListener listener) {
public void removePropertyChangeListener(PropertyChangeListener listener) {
propertyChangeSupport.removePropertyChangeListener(listener);
}

Expand All @@ -192,12 +197,12 @@ public void dispose() {

@Nullable
@Override
public <T> T getUserData(@Nonnull Key<T> key) {
public <T> T getUserData(Key<T> key) {
return null;
}

@Override
public <T> void putUserData(@Nonnull Key<T> key, @Nullable T value) {
public <T> void putUserData(Key<T> key, @Nullable T value) {
}

public void setDisplayName(String displayName) {
Expand All @@ -209,10 +214,93 @@ public BinEdVirtualFile getVirtualFile() {
return virtualFile;
}

@Nonnull
@Override
public VirtualFile getFile() { return virtualFile; }
public VirtualFile getFile() {
return NULL_VIRTUAL_FILE;
}

@Nonnull
public Project getProject() {
return project;
}

@ParametersAreNonnullByDefault
private static class NullVirtualFile extends VirtualFile {
@Nonnull
@Override
public String getName() {
return "NULL";
}

@Nonnull
@Override
public VirtualFileSystem getFileSystem() {
return new BinEdFileSystem();
}

@Nonnull
@Override
public String getPath() {
return "";
}

@Override
public boolean isWritable() {
return false;
}

@Override
public boolean isDirectory() {
return false;
}

@Override
public boolean isValid() {
return true;
}

@Nullable
@Override
public VirtualFile getParent() {
return null;
}

@Nonnull
@Override
public VirtualFile[] getChildren() {
return new VirtualFile[0];
}

@Nonnull
@Override
public OutputStream getOutputStream(Object requestor, long newModificationStamp, long newTimeStamp) throws IOException {
throw new UnsupportedOperationException();
}

@Nonnull
@Override
public byte[] contentsToByteArray() throws IOException {
return new byte[0];
}

@Override
public long getTimeStamp() {
return 0;
}

@Override
public long getLength() {
return 0;
}

@Override
public void refresh(boolean asynchronous, boolean recursive, @Nullable Runnable postRunnable) {
}

@Override
public InputStream getInputStream() throws IOException {
throw new UnsupportedOperationException();
}
}
}
21 changes: 13 additions & 8 deletions src/org/exbin/bined/intellij/BinEdNativeFileEditor.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
* Native file editor using BinEd editor component.
*
* @author ExBin Project (http://exbin.org)
* @version 0.2.2 2020/07/29
* @version 0.2.4 2021/04/11
*/
@ParametersAreNonnullByDefault
public class BinEdNativeFileEditor implements FileEditor, DumbAware {
Expand Down Expand Up @@ -75,12 +75,12 @@ public String getName() {

@Nonnull
@Override
public FileEditorState getState(@Nonnull FileEditorStateLevel level) {
public FileEditorState getState(FileEditorStateLevel level) {
return fileEditorState;
}

@Override
public void setState(@Nonnull FileEditorState state) {
public void setState(FileEditorState state) {
}

@Override
Expand All @@ -104,12 +104,12 @@ public void deselectNotify() {
}

@Override
public void addPropertyChangeListener(@Nonnull PropertyChangeListener listener) {
public void addPropertyChangeListener(PropertyChangeListener listener) {
propertyChangeSupport.addPropertyChangeListener(listener);
}

@Override
public void removePropertyChangeListener(@Nonnull PropertyChangeListener listener) {
public void removePropertyChangeListener(PropertyChangeListener listener) {
propertyChangeSupport.removePropertyChangeListener(listener);
}

Expand All @@ -132,25 +132,30 @@ public void dispose() {

@Nullable
@Override
public <T> T getUserData(@Nonnull Key<T> key) {
public <T> T getUserData(Key<T> key) {
return null;
}

@Override
public <T> void putUserData(@Nonnull Key<T> key, @Nullable T value) {
public <T> void putUserData(Key<T> key, @Nullable T value) {
}

public void setDisplayName(String displayName) {
this.displayName = displayName;
}

@Nonnull
public BinEdNativeFile getNativeFile() {
return nativeFile;
}

@Nonnull
@Override
public VirtualFile getFile() { return nativeFile.getVirtualFile(); }
public VirtualFile getFile() {
return nativeFile.getVirtualFile();
}

@Nonnull
public Project getProject() {
return project;
}
Expand Down
13 changes: 1 addition & 12 deletions src/org/exbin/bined/intellij/BinEdVirtualFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileSystem;
import com.intellij.openapi.vfs.VirtualFileWithId;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

Expand All @@ -35,7 +34,7 @@
* @author ExBin Project (http://exbin.org)
* @version 0.2.4 2021/04/11
*/
public class BinEdVirtualFile extends VirtualFile implements VirtualFileWithId {
public class BinEdVirtualFile extends VirtualFile {

public static final String PATH_PREFIX = "bined://";

Expand Down Expand Up @@ -192,14 +191,4 @@ public void setClosed(boolean closed) {
public JComponent getPreferredFocusedComponent() {
return editorFile.getPreferredFocusedComponent();
}

/**
* Seems like some versions of IDE taps into this for some reason.
*
* @return invalid ID
*/
@Override
public int getId() {
return 0;
}
}
2 changes: 1 addition & 1 deletion src/org/exbin/bined/intellij/BinaryFileType.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,6 @@ public boolean isReadOnly() {
@Nullable
@Override
public String getCharset(@NotNull VirtualFile file, @NotNull byte[] content) {
return CharsetToolkit.US_ASCII_CHARSET.name();
return "US-ASCII";
}
}
4 changes: 2 additions & 2 deletions src/org/exbin/bined/intellij/gui/BinEdToolbarPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ private void setActionSelection(AnAction action, boolean selected) {
toolbar.getPresentation(action).putClientProperty("selected", selected);
}

private static Icon load(String path) {
return IconLoader.getIcon(path);
private Icon load(String path) {
return IconLoader.getIcon(path, getClass());
}
}
12 changes: 9 additions & 3 deletions src/org/exbin/framework/preferences/PreferencesWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
/**
* Wrapper for preferences.
*
* @version 0.2.1 2019/08/08
* @version 0.2.4 2021/04/11
* @author ExBin Project (http://exbin.org)
*/
@ParametersAreNonnullByDefault
Expand Down Expand Up @@ -88,8 +88,14 @@ public void putLong(String key, long value) {
}

@Override
public long getLong(String key, long def) {
return preferences.getOrInitLong(prefix + key, def);
public long getLong(String key, long defaultValue) {
try {
String value = preferences.getValue(prefix + key);
return value == null ? defaultValue : Long.parseLong(value);
}
catch (NumberFormatException e) {
return defaultValue;
}
}

@Override
Expand Down

0 comments on commit bfac5ad

Please sign in to comment.