Skip to content

Commit faf4e84

Browse files
committed
Fix doubling of edit menu and fix vertical positioning of checkbox
see https://forum.image.sc/t/shiny-new-script-editor/64160/28?u=tferr
1 parent bdf65bf commit faf4e84

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

src/main/java/org/scijava/ui/swing/script/TextEditor.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2170,9 +2170,10 @@ public TextEditorTab open(final File file) {
21702170
tab.editorPane.loadPreferences();
21712171
addDefaultAccelerators(tab.editorPane);
21722172
} else {
2173-
// the Edit menu can only be populated after an editor
2174-
// pane exists, as it reads actions from its input map
2175-
assembleEditMenu();
2173+
// the Edit menu can only be populated after an editor pane exists, as it reads
2174+
// actions from its input map. We will built it here, if it has not been assembled
2175+
// yet.
2176+
if (undo == null) assembleEditMenu();
21762177
}
21772178
synchronized (tab.editorPane) { // tab is never null at this location.
21782179
tab.editorPane.open(file);
@@ -2420,9 +2421,9 @@ void updateLanguageMenu(final ScriptLanguage language) {
24202421
runMenu.setEnabled(isRunnable);
24212422
compileAndRun.setText(isCompileable ? "Compile and Run" : "Run");
24222423
compileAndRun.setEnabled(isRunnable);
2423-
runSelection.setEnabled(isRunnable && !isCompileable);
2424-
compile.setEnabled(isCompileable);
2425-
autoSave.setEnabled(isCompileable);
2424+
runSelection.setEnabled(isRunnable && !isCompileable);
2425+
compile.setEnabled(isCompileable);
2426+
autoSave.setEnabled(isCompileable);
24262427
makeJar.setEnabled(isCompileable);
24272428
makeJarWithSource.setEnabled(isCompileable);
24282429

@@ -2438,8 +2439,8 @@ void updateLanguageMenu(final ScriptLanguage language) {
24382439
openMacroFunctions.setEnabled(isMacro);
24392440
openSourceForClass.setEnabled(!isMacro);
24402441

2441-
openHelp.setEnabled(!isMacro && isRunnable);
2442-
openHelpWithoutFrames.setEnabled(!isMacro && isRunnable);
2442+
openHelp.setEnabled(!isMacro && isRunnable);
2443+
openHelpWithoutFrames.setEnabled(!isMacro && isRunnable);
24432444
nextError.setEnabled(!isMacro && isRunnable);
24442445
previousError.setEnabled(!isMacro && isRunnable);
24452446

src/main/java/org/scijava/ui/swing/script/TextEditorTab.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ public void dragEnter(final DropTargetDragEvent e) {
154154
bc.gridy = 0;
155155
bc.weightx = 0;
156156
bc.weighty = 0;
157-
bc.anchor = GridBagConstraints.NORTHWEST;
157+
bc.anchor = GridBagConstraints.CENTER;
158158
bc.fill = GridBagConstraints.HORIZONTAL;
159159
runit = new JButton("Run");
160160
runit.setToolTipText("Control+R, F5, or F11");

0 commit comments

Comments
 (0)