From 0e5ca488ef4ddc8d1c8cd3eb5291a0f7a4045884 Mon Sep 17 00:00:00 2001 From: Markus Alexander Kuppe <tlaplus.net@lemmster.de> Date: Fri, 21 Feb 2020 10:50:24 -0800 Subject: [PATCH] Display absolute path to spec/module file on the Toolbox's status line instead of on the editor's content description. The latter wastes too much screen estate. [Refactor][Toolbox] --- .../editor/basic/TLAEditorAndPDFViewer.java | 41 ++++++++----------- 1 file changed, 18 insertions(+), 23 deletions(-) diff --git a/org.lamport.tla.toolbox.editor.basic/src/org/lamport/tla/toolbox/editor/basic/TLAEditorAndPDFViewer.java b/org.lamport.tla.toolbox.editor.basic/src/org/lamport/tla/toolbox/editor/basic/TLAEditorAndPDFViewer.java index c6312a74c..3d7597949 100644 --- a/org.lamport.tla.toolbox.editor.basic/src/org/lamport/tla/toolbox/editor/basic/TLAEditorAndPDFViewer.java +++ b/org.lamport.tla.toolbox.editor.basic/src/org/lamport/tla/toolbox/editor/basic/TLAEditorAndPDFViewer.java @@ -90,8 +90,6 @@ public class TLAEditorAndPDFViewer extends FormEditor implements INavigationLoca addPage(tlaEditorIndex, tlaEditor, tlaEditorInput); setPageText(tlaEditorIndex, "TLA Module"); - setDescription(); - } catch (PartInitException e) { // I hope you don't choke swallowing all those exceptions... @@ -283,7 +281,6 @@ public class TLAEditorAndPDFViewer extends FormEditor implements INavigationLoca { FileEditorInput fin = (FileEditorInput) newInput; setPartName(fin.getFile().getName()); - setDescription(); } } } @@ -348,26 +345,24 @@ public class TLAEditorAndPDFViewer extends FormEditor implements INavigationLoca { return tlaEditor; } - - /** - * Sets the text that appears above the text viewer. - * Currently, this is the full file path. - */ - private void setDescription() - { - IEditorInput input = getEditorInput(); - if (input != null) - { - if (input instanceof FileEditorInput) - { - FileEditorInput fin = (FileEditorInput) input; - setContentDescription(fin.getPath().toOSString()); - } else - { - setContentDescription(input.getName()); - } - } - } + + @Override + public void setFocus() { + super.setFocus(); + + // Show the OS's location of this spec in the Toolbox's status line (bottom + // left). Before, this was shown in this editor's content description but this + // wastes too much space. + final IEditorInput input = getEditorInput(); + if (input != null) { + if (input instanceof FileEditorInput) { + FileEditorInput fin = (FileEditorInput) input; + tlaEditor.setStatusMessage(String.format("%s [ %s ]", getPartName(), fin.getPath().toOSString())); + } else { + tlaEditor.setStatusMessage(input.getName()); + } + } + } /** * Sets the TLA module editor as the active -- GitLab