Skip to content

Commit

Permalink
Add select all support to debugger
Browse files Browse the repository at this point in the history
Supported in all text windows, and controlled via ctrl/cmd-A, as users expect.

Fixes #399.
  • Loading branch information
garfieldnate committed Sep 26, 2024
1 parent 9c7c62f commit a86f3d7
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 0 deletions.
18 changes: 18 additions & 0 deletions Java/Debugger/src/edu/umich/soar/debugger/menu/EditMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ public void actionPerformed(ActionEvent e)
}
};

private final AbstractAction m_SelectAll = new AbstractAction("&Select All\t" + SHORTCUT_HINT + "A")
{
@Override
public void actionPerformed(ActionEvent e) {
selectAll();
}
};

private final AbstractAction m_Search = new AbstractAction("&Find...\t" + SHORTCUT_HINT + "F")
{
@Override
Expand Down Expand Up @@ -76,6 +84,7 @@ private BaseMenu makeMenu(Menu parent, String title)

menu.add(m_Copy);
menu.add(m_Paste);
menu.add(m_SelectAll, SHORTCUT_KEY + 'A');
menu.addSeparator();
menu.add(m_Search, SHORTCUT_KEY + 'F');

Expand Down Expand Up @@ -117,4 +126,13 @@ private void paste()
if (view != null)
view.paste();
}

private void selectAll()
{
edu.umich.soar.debugger.modules.AbstractView view = m_Frame
.getMainWindow().getFocusView();
if (view != null) {
view.selectAll();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ public void copy()
// Usually nothing to copy in fixed views
}

@Override
public void selectAll() {
// Usually nothing to select in fixed views
}

/************************************************************************
*
* Search for the next occurance of 'text' in this view and place the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ public void copy()
m_Text.copy();
}

@Override
public void selectAll()
{
m_Text.selectAll();
}

/************************************************************************
*
* Search for the next occurrence of {@code text} in this view and place the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,8 @@ public void paste()
this.executeAgentCommand(textData, true);
}

public abstract void selectAll();

// Creates a convenient listener for Control-V.
// Adding a key listener for this event allows us to call our paste method
// so commands are pasted into the command
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@ public void paste()
m_Text.paste();
}

@Override
public void selectAll() {
m_Text.selectAll();
}

@Override
public void setTextFont(Font f)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,12 @@ public void copy()
m_FoldingText.getTextWindow().copy();
}

@Override
public void selectAll()
{
m_FoldingText.getTextWindow().selectAll();
}

/************************************************************************
*
* Search for the next occurance of 'text' in this view and place the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,11 @@ public void copy()
{
}

@Override
public void selectAll()
{
}

@Override
public void displayText(String text)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,11 @@ public void copy()
{
textBox.copy();
}
@Override
public void selectAll()
{
textBox.selectAll();
}

@Override
protected ParseSelectedText.SelectedObject getCurrentSelection(int mouseX,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ public void copy()
m_Text.copy();
}

@Override
public void selectAll()
{
m_Text.selectAll();
}

/********************************************************************************************
*
* Scroll the display control to the bottom
Expand Down

0 comments on commit a86f3d7

Please sign in to comment.