Skip to content

Commit 4b75f20

Browse files
committed
Release 0.2.11
1 parent 44f6c10 commit 4b75f20

28 files changed

Lines changed: 930 additions & 493 deletions

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ plugins {
55
}
66

77
group = "org.exbin.deltahex.intellij"
8-
version = "0.2.11.snapshot"
8+
version = "0.2.11"
99
val ideLocalPath = providers.gradleProperty("ideLocalPath").getOrElse("")
1010

1111
repositories {

changes.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
0.2.11
1+
0.2.11 (2025-02-08)
22
- Added Base 64 conversion
33
- Added option for inspector input fields font
44
- Added icon set support

src/main/java/org/exbin/bined/intellij/BinEdIntelliJEditorProvider.java

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ public class BinEdIntelliJEditorProvider implements MultiEditorProvider, BinEdEd
6464
@Nullable
6565
protected BinEdFileHandler activeFile = null;
6666
private BinaryStatusApi binaryStatus;
67+
private TextEncodingStatusApi textEncodingStatusApi;
6768
private EditorModificationListener editorModificationListener;
6869

6970
public BinEdIntelliJEditorProvider() {
@@ -164,8 +165,10 @@ public Optional<FileHandler> getActiveFile() {
164165
}
165166

166167
public void setActiveFile(@Nullable FileHandler fileHandler) {
167-
activeFile = (BinEdFileHandler) fileHandler;
168-
activeFileChanged();
168+
if (activeFile != fileHandler) {
169+
activeFile = (BinEdFileHandler) fileHandler;
170+
activeFileChanged();
171+
}
169172
}
170173

171174
public void activeFileChanged() {
@@ -185,6 +188,7 @@ public void activeFileChanged() {
185188
extCodeArea = activeFile.getCodeArea();
186189
undoHandler = activeFile.getUndoRedo().orElse(null);
187190
clipboardActionsHandler = activeFile;
191+
updateStatus();
188192
}
189193

190194
componentActivationListener.updated(FileHandler.class, activeFile);
@@ -211,6 +215,10 @@ public void updateStatus() {
211215
updateCurrentSelectionRange();
212216
updateCurrentMemoryMode();
213217
updateCurrentEditMode();
218+
219+
if (textEncodingStatusApi != null) {
220+
updateCurrentEncoding();
221+
}
214222
}
215223

216224
private void updateCurrentDocumentSize() {
@@ -271,7 +279,16 @@ private void updateCurrentEditMode() {
271279

272280
@Override
273281
public void registerEncodingStatus(TextEncodingStatusApi encodingStatus) {
274-
encodingStatus.setEncoding(activeFile.getCharset().name());
282+
this.textEncodingStatusApi = encodingStatus;
283+
updateCurrentEncoding();
284+
}
285+
286+
public void updateCurrentEncoding() {
287+
if (textEncodingStatusApi == null) {
288+
return;
289+
}
290+
291+
textEncodingStatusApi.setEncoding(activeFile.getCharset().name());
275292
}
276293

277294
@Override

src/main/java/org/exbin/bined/intellij/BinEdNativeFile.java

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,12 @@
3434
import org.exbin.framework.App;
3535
import org.exbin.framework.bined.BinEdEditorComponent;
3636
import org.exbin.framework.bined.BinEdFileHandler;
37+
import org.exbin.framework.bined.BinEdFileManager;
3738
import org.exbin.framework.bined.BinedModule;
3839
import org.exbin.framework.bined.FileHandlingMode;
3940
import org.exbin.framework.bined.gui.BinEdComponentPanel;
41+
import org.exbin.framework.bined.preferences.BinaryEditorPreferences;
42+
import org.exbin.framework.preferences.api.PreferencesModuleApi;
4043

4144
import javax.annotation.Nonnull;
4245
import javax.annotation.Nullable;
@@ -61,13 +64,20 @@ public class BinEdNativeFile {
6164
private VirtualFile virtualFile;
6265

6366
public BinEdNativeFile() {
67+
BinedModule binedModule = App.getModule(BinedModule.class);
68+
BinEdFileManager fileManager = binedModule.getFileManager();
69+
6470
fileHandler = BinEdVirtualFile.createBinEdFileHandler();
71+
fileManager.initFileHandler(fileHandler);
72+
6573
filePanel.setFileHandler(fileHandler);
66-
BinedModule binedModule = App.getModule(BinedModule.class);
67-
binedModule.getFileManager().initFileHandler(fileHandler);
6874
BinaryUndoIntelliJHandler undoHandler = new BinaryUndoIntelliJHandler();
6975
fileHandler.setUndoHandler(undoHandler);
7076

77+
PreferencesModuleApi preferencesModule = App.getModule(PreferencesModuleApi.class);
78+
BinaryEditorPreferences binaryEditorPreferences = new BinaryEditorPreferences(preferencesModule.getAppPreferences());
79+
fileHandler.onInitFromPreferences(binaryEditorPreferences);
80+
7181
SectCodeArea codeArea = filePanel.getCodeArea();
7282

7383
// componentPanel.setModifiedChangeListener(() -> {
@@ -77,6 +87,10 @@ public BinEdNativeFile() {
7787
// TODO editorFile.fileSync();
7888
// TODO filePanel.getToolbarPanel().documentOriginalSize = virtualFile.getLength();
7989
// binedModule.getFileManager().initCommandHandler(componentPanel.getComponentPanel());
90+
BinEdToolbarPanel toolbarPanel = filePanel.getToolbarPanel();
91+
toolbarPanel.setUndoHandler(fileHandler.getCodeAreaUndoHandler().get());
92+
93+
toolbarPanel.loadFromPreferences(binaryEditorPreferences);
8094
}
8195

8296
public void registerUndoRedo(BinaryUndoIntelliJHandler undoIntelliJHandler) {
@@ -125,7 +139,9 @@ public void openFile(VirtualFile virtualFile) {
125139
codeArea.setEditMode(editable ? EditMode.EXPANDING : EditMode.READ_ONLY);
126140

127141
opened = true;
128-
// TODO fileSync / documentOriginalSize = codeArea.getDataSize();
142+
fileHandler.fileSync();
143+
BinedModule binedModule = App.getModule(BinedModule.class);
144+
((BinEdIntelliJEditorProvider) binedModule.getEditorProvider()).updateStatus();
129145
updateModified();
130146
}
131147

@@ -140,6 +156,9 @@ public void saveDocument() {
140156
application.runWriteAction(() -> {
141157
try {
142158
virtualFile.setBinaryContent(fileContent);
159+
fileHandler.fileSync();
160+
BinedModule binedModule = App.getModule(BinedModule.class);
161+
((BinEdIntelliJEditorProvider) binedModule.getEditorProvider()).updateStatus();
143162
} catch (IOException e) {
144163
throw createBrokenVirtualFileException(e);
145164
}

src/main/java/org/exbin/bined/intellij/BinEdNativeFileEditor.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@
2424
import com.intellij.openapi.util.UserDataHolder;
2525
import com.intellij.openapi.util.UserDataHolderBase;
2626
import com.intellij.openapi.vfs.VirtualFile;
27+
import org.exbin.bined.operation.undo.BinaryDataUndoRedo;
2728
import org.exbin.framework.App;
29+
import org.exbin.framework.bined.BinEdFileManager;
2830
import org.exbin.framework.bined.BinedModule;
2931

3032
import javax.annotation.Nonnull;
@@ -58,6 +60,10 @@ public BinEdNativeFileEditor(Project project, final VirtualFile virtualFile) {
5860
undoHandler.setFileEditor(this);
5961
nativeFile.registerUndoRedo(undoHandler);
6062

63+
BinedModule binedModule = App.getModule(BinedModule.class);
64+
BinEdFileManager fileManager = binedModule.getFileManager();
65+
fileManager.initCommandHandler(nativeFile.getEditorFile().getComponent());
66+
6167
propertyChangeSupport = new PropertyChangeSupport(this);
6268
}
6369

src/main/java/org/exbin/bined/intellij/BinEdPluginStartupActivity.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ public static void initialize() {
239239

240240
private static void registerActionHandler(String actionId, int modifiers, int key) {
241241
registerActionHandlerCodeArea(actionId, codeAreaComponent ->
242-
codeAreaComponent.getCommandHandler().keyPressed(new KeyEvent(codeAreaComponent, 0, 0, modifiers, key))
242+
codeAreaComponent.getCommandHandler().keyPressed(new KeyEvent(codeAreaComponent, 0, 0, modifiers, key, KeyEvent.CHAR_UNDEFINED))
243243
);
244244
}
245245

@@ -492,8 +492,7 @@ public void beforeFileClosed(@Nonnull FileEditorManager source, @Nonnull Virtual
492492
return;
493493
}
494494

495-
if (file instanceof BinEdVirtualFile && !((BinEdVirtualFile) file).isMoved()
496-
&& !((BinEdVirtualFile) file).isClosing()) {
495+
if (file instanceof BinEdVirtualFile && !((BinEdVirtualFile) file).isClosing()) {
497496
((BinEdVirtualFile) file).setClosing(true);
498497
BinEdFileHandler fileHandler = ((BinEdVirtualFile) file).getEditorFile();
499498
if (fileHandler.isModified() && ((BinEdComponentFileApi) fileHandler).isSaveSupported()) {
@@ -678,10 +677,14 @@ private void init() {
678677
binedBookmarksModule.register();
679678
BinedMacroModule binedMacroModule = App.getModule(BinedMacroModule.class);
680679
binedMacroModule.register();
680+
BinedOperationBouncycastleModule binedOperationBouncycastleModule = App.getModule(BinedOperationBouncycastleModule.class);
681+
binedOperationBouncycastleModule.register();
681682

682683
initialIntegrationOptions = new IntegrationPreferences(preferences);
683684
applyIntegrationOptions(initialIntegrationOptions);
684685

686+
UiModuleApi uiModule = App.getModule(UiModuleApi.class);
687+
uiModule.executePostInitActions();
685688
FrameModuleApi frameModule = App.getModule(FrameModuleApi.class);
686689
frameModule.createMainMenu();
687690
ActionModuleApi actionModule = App.getModule(ActionModuleApi.class);
@@ -721,10 +724,7 @@ private void init() {
721724
fileManager.addBinEdComponentExtension(component -> Optional.of(new BinEdIntelliJComponentSearch()));
722725

723726
BinedOperationModule binedOperationModule = App.getModule(BinedOperationModule.class);
724-
binedOperationModule.setEditorProvider(editorProvider);
725-
726-
BinedOperationBouncycastleModule binedOperationBouncycastleModule = App.getModule(BinedOperationBouncycastleModule.class);
727-
binedOperationBouncycastleModule.register();
727+
binedOperationModule.addBasicMethods();
728728

729729
BinedToolContentModule binedToolContentModule = App.getModule(BinedToolContentModule.class);
730730

@@ -786,6 +786,8 @@ public JScrollPane createScrollPane() {
786786
return new JBScrollPane();
787787
}
788788
});
789+
binedInspectorModule.registerViewValuesPanelMenuActions();
790+
binedInspectorModule.registerViewValuesPanelPopupMenuActions();
789791

790792
BinedCompareModule binedCompareModule = App.getModule(BinedCompareModule.class);
791793
binedCompareModule.registerToolsOptionsMenuActions();
@@ -864,8 +866,6 @@ public void applyPreferencesChanges(IntegrationOptionsImpl options) {
864866
binedToolContentModule.registerDragDropContentMenu();
865867
binedInspectorModule.registerViewValuesPanelMenuActions();
866868
binedInspectorModule.registerOptionsPanels();
867-
binedMacroModule.registerMacrosPopupMenuActions();
868-
binedBookmarksModule.registerBookmarksPopupMenuActions();
869869

870870
String toolsSubMenuId = BinEdIntelliJPlugin.PLUGIN_PREFIX + "toolsMenu";
871871
MenuManagement menuManagement = actionModule.getMenuManagement(BinedModule.MODULE_ID);

src/main/java/org/exbin/bined/intellij/BinEdSettingsConfigurable.java

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,28 @@
1818
import com.intellij.openapi.options.Configurable;
1919
import com.intellij.openapi.options.ConfigurationException;
2020
import com.intellij.openapi.project.DumbAware;
21-
import org.exbin.bined.intellij.options.gui.BinEdOptionsPanelBorder;
21+
import org.exbin.framework.App;
22+
import org.exbin.framework.options.action.OptionsAction;
23+
import org.exbin.framework.options.api.OptionsModuleApi;
24+
import org.exbin.framework.options.api.OptionsPageReceiver;
25+
import org.exbin.framework.options.gui.OptionsListPanel;
26+
import org.exbin.framework.preferences.api.PreferencesModuleApi;
2227
import org.jetbrains.annotations.Nullable;
2328

2429
import javax.annotation.Nonnull;
2530
import javax.swing.JComponent;
31+
import java.awt.event.FocusAdapter;
32+
import java.awt.event.FocusEvent;
2633
import java.util.ResourceBundle;
2734

2835
/**
29-
* TODO: Settings component.
36+
* Settings component.
3037
*
3138
* @author ExBin Project (https://exbin.org)
3239
*/
3340
public class BinEdSettingsConfigurable implements Configurable, DumbAware {
3441

35-
private BinEdOptionsPanelBorder optionsPanelWrapper;
42+
private OptionsListPanel optionsListPanel;
3643
private boolean modified = true;
3744
private ResourceBundle resourceBundle = BinEdIntelliJPlugin.getResourceBundle();
3845

@@ -48,19 +55,24 @@ public String getDisplayName() {
4855
@Nullable
4956
@Override
5057
public JComponent createComponent() {
51-
optionsPanelWrapper = new BinEdOptionsPanelBorder();
52-
// BinEdOptionsPanel optionsPanel = optionsPanelWrapper.getOptionsPanel();
53-
// BinEdManager binEdManager = BinEdManager.getInstance();
54-
// optionsPanel.setPreferences(binEdManager.getPreferences());
55-
// optionsPanel.loadFromPreferences();
56-
// optionsPanelWrapper.addFocusListener(new FocusAdapter() {
57-
// @Override
58-
// public void focusGained(FocusEvent e) {
59-
// modified = true;
60-
// optionsPanelWrapper.firePropertyChange("modified", false, true);
61-
// }
62-
// });
63-
return optionsPanelWrapper;
58+
PreferencesModuleApi preferencesModule = App.getModule(PreferencesModuleApi.class);
59+
OptionsAction.OptionsPagesProvider optionsPagesProvider = (OptionsPageReceiver optionsTreePanel) -> {
60+
OptionsModuleApi optionsModule = App.getModule(OptionsModuleApi.class);
61+
optionsModule.passOptionsPages(optionsTreePanel);
62+
};
63+
optionsListPanel = new OptionsListPanel();
64+
optionsPagesProvider.registerOptionsPages(optionsListPanel);
65+
optionsListPanel.setPreferences(preferencesModule.getAppPreferences());
66+
optionsListPanel.pagesFinished();
67+
optionsListPanel.loadAllFromPreferences();
68+
optionsListPanel.addFocusListener(new FocusAdapter() {
69+
@Override
70+
public void focusGained(FocusEvent e) {
71+
modified = true;
72+
}
73+
});
74+
75+
return optionsListPanel;
6476
}
6577

6678
@Override
@@ -70,7 +82,6 @@ public boolean isModified() {
7082

7183
@Override
7284
public void apply() throws ConfigurationException {
73-
// BinEdOptionsPanel optionsPanel = optionsPanelWrapper.getOptionsPanel();
74-
// optionsPanel.saveToPreferences();
85+
optionsListPanel.saveAndApplyAll();
7586
}
7687
}

src/main/java/org/exbin/bined/intellij/BinEdVirtualFile.java

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
*/
1616
package org.exbin.bined.intellij;
1717

18-
import com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl;
1918
import com.intellij.openapi.project.DumbAware;
2019
import com.intellij.openapi.vfs.LocalFileSystem;
2120
import com.intellij.openapi.vfs.VirtualFile;
@@ -28,8 +27,12 @@
2827
import org.exbin.framework.App;
2928
import org.exbin.framework.bined.BinEdEditorComponent;
3029
import org.exbin.framework.bined.BinEdFileHandler;
30+
import org.exbin.framework.bined.BinEdFileManager;
3131
import org.exbin.framework.bined.BinedModule;
3232
import org.exbin.framework.bined.gui.BinEdComponentPanel;
33+
import org.exbin.framework.bined.preferences.BinaryEditorPreferences;
34+
import org.exbin.framework.file.action.FileActions;
35+
import org.exbin.framework.preferences.api.PreferencesModuleApi;
3336
import org.jetbrains.annotations.Nullable;
3437

3538
import javax.annotation.Nonnull;
@@ -75,15 +78,27 @@ public BinEdVirtualFile(VirtualFile parentFile) {
7578
this.displayName = "";
7679
}
7780

81+
fileHandler.registerUndoHandler();
7882
BinedModule binedModule = App.getModule(BinedModule.class);
79-
binedModule.getFileManager().initComponentPanel(fileHandler.getComponent());
80-
binedModule.getFileManager().initFileHandler(fileHandler);
83+
BinEdFileManager fileManager = binedModule.getFileManager();
84+
fileManager.initFileHandler(fileHandler);
85+
fileManager.initCommandHandler(fileHandler.getComponent());
86+
8187
filePanel.setFileHandler(fileHandler);
82-
fileHandler.registerUndoHandler();
88+
PreferencesModuleApi preferencesModule = App.getModule(PreferencesModuleApi.class);
89+
BinaryEditorPreferences binaryEditorPreferences = new BinaryEditorPreferences(preferencesModule.getAppPreferences());
90+
fileHandler.onInitFromPreferences(binaryEditorPreferences);
91+
fileHandler.setNewData(binaryEditorPreferences.getEditorPreferences().getFileHandlingMode());
8392

8493
BinEdToolbarPanel toolbarPanel = filePanel.getToolbarPanel();
8594
toolbarPanel.setUndoHandler(fileHandler.getCodeAreaUndoHandler().get());
86-
toolbarPanel.setSaveAction(e -> fileHandler.saveFile());
95+
toolbarPanel.setSaveAction(e -> {
96+
fileHandler.saveFile();
97+
fileHandler.fileSync();
98+
((BinEdIntelliJEditorProvider) binedModule.getEditorProvider()).updateStatus();
99+
});
100+
101+
toolbarPanel.loadFromPreferences(binaryEditorPreferences);
87102
}
88103

89104
@Nonnull
@@ -265,11 +280,6 @@ public int hashCode() {
265280
return getPath().hashCode();
266281
}
267282

268-
public boolean isMoved() {
269-
Boolean closingToReopen = getUserData(FileEditorManagerImpl.CLOSING_TO_REOPEN);
270-
return closingToReopen != null && closingToReopen;
271-
}
272-
273283
public boolean isClosing() {
274284
return closing;
275285
}
@@ -292,16 +302,20 @@ public JComponent getPreferredFocusedComponent() {
292302
public void openFile(BinEdFileHandler fileHandler) {
293303
if (!isDirectory() && isValid()) {
294304
File file = extractFile(this);
305+
fileHandler.clearFile();
295306
if (file.isFile() && file.exists()) {
296-
fileHandler.clearFile();
297307
fileHandler.loadFromFile(file.toURI(), null);
308+
fileHandler.fileSync();
298309
} else {
299310
try (InputStream stream = getInputStream()) {
300311
fileHandler.loadFromStream(stream);
312+
fileHandler.fileSync();
301313
} catch (IOException ex) {
302314
Logger.getLogger(BinEdFileHandler.class.getName()).log(Level.SEVERE, null, ex);
303315
}
304316
}
305317
}
318+
BinedModule binedModule = App.getModule(BinedModule.class);
319+
((BinEdIntelliJEditorProvider) binedModule.getEditorProvider()).updateStatus();
306320
}
307321
}

0 commit comments

Comments
 (0)