Skip to content

Commit b22574e

Browse files
committed
Fixes action owner usage
1 parent a8abf12 commit b22574e

File tree

26 files changed

+132
-125
lines changed

26 files changed

+132
-125
lines changed

Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/memview/actions/ZoomInAAction.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
7-
*
7+
*
88
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
9+
*
1010
* Unless required by applicable law or agreed to in writing, software
1111
* distributed under the License is distributed on an "AS IS" BASIS,
1212
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -31,7 +31,7 @@ public class ZoomInAAction extends DockingAction {
3131
private MemviewProvider provider;
3232

3333
public ZoomInAAction(MemviewProvider provider) {
34-
super("Zoom In (Addrs)", provider.getName());
34+
super("Zoom In (Addrs)", provider.getOwner());
3535
this.provider = provider;
3636
setEnabled(true);
3737

Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/memview/actions/ZoomInTAction.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
7-
*
7+
*
88
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
9+
*
1010
* Unless required by applicable law or agreed to in writing, software
1111
* distributed under the License is distributed on an "AS IS" BASIS,
1212
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -31,7 +31,7 @@ public class ZoomInTAction extends DockingAction {
3131
private MemviewProvider provider;
3232

3333
public ZoomInTAction(MemviewProvider provider) {
34-
super("Zoom In (Time)", provider.getName());
34+
super("Zoom In (Time)", provider.getOwner());
3535
this.provider = provider;
3636
setEnabled(true);
3737

Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/memview/actions/ZoomOutAAction.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
7-
*
7+
*
88
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
9+
*
1010
* Unless required by applicable law or agreed to in writing, software
1111
* distributed under the License is distributed on an "AS IS" BASIS,
1212
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -31,7 +31,7 @@ public class ZoomOutAAction extends DockingAction {
3131
private MemviewProvider provider;
3232

3333
public ZoomOutAAction(MemviewProvider provider) {
34-
super("Zoom Out (Addrs)", provider.getName());
34+
super("Zoom Out (Addrs)", provider.getOwner());
3535
this.provider = provider;
3636
setEnabled(true);
3737

Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/memview/actions/ZoomOutTAction.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
7-
*
7+
*
88
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
9+
*
1010
* Unless required by applicable law or agreed to in writing, software
1111
* distributed under the License is distributed on an "AS IS" BASIS,
1212
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -31,7 +31,7 @@ public class ZoomOutTAction extends DockingAction {
3131
private MemviewProvider provider;
3232

3333
public ZoomOutTAction(MemviewProvider provider) {
34-
super("Zoom Out (Time)", provider.getName());
34+
super("Zoom Out (Time)", provider.getOwner());
3535
this.provider = provider;
3636
setEnabled(true);
3737

Ghidra/Extensions/sample/src/main/java/ghidra/examples/HelloWorldComponentProvider.java

+8-17
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
7-
*
7+
*
88
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
9+
*
1010
* Unless required by applicable law or agreed to in writing, software
1111
* distributed under the License is distributed on an "AS IS" BASIS,
1212
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -37,8 +37,8 @@ public class HelloWorldComponentProvider extends ComponentProviderAdapter {
3737
private JPanel mainPanel;
3838
private DockingAction action;
3939

40-
public HelloWorldComponentProvider(PluginTool tool, String name) {
41-
super(tool, name, name);
40+
public HelloWorldComponentProvider(PluginTool tool, String owner) {
41+
super(tool, "Hello World", owner);
4242
buildMainPanel();
4343
setIcon(new GIcon("icon.sample.provider"));
4444
setHelpLocation(HELP);
@@ -51,7 +51,7 @@ public HelloWorldComponentProvider(PluginTool tool, String name) {
5151
private void createActions() {
5252

5353
// set actions for Hello->World menu item
54-
action = new DockingAction("Hello World", getName()) {
54+
action = new DockingAction("Hello World", getOwner()) {
5555
@Override
5656
public void actionPerformed(ActionContext context) {
5757
// pop up a "Hello World" dialog
@@ -66,7 +66,7 @@ public void actionPerformed(ActionContext context) {
6666
Icon icon = new GIcon("icon.sample.action.hello.world");
6767
action.setMenuBarData(new MenuData(new String[] { "Misc", "Hello World" }, icon));
6868
action.setKeyBindingData(
69-
new KeyBindingData(KeyStroke.getKeyStroke(KeyEvent.VK_W, InputEvent.CTRL_MASK)));
69+
new KeyBindingData(KeyStroke.getKeyStroke(KeyEvent.VK_W, InputEvent.CTRL_DOWN_MASK)));
7070

7171
// puts the action on the local toolbar.
7272
action.setToolBarData(new ToolBarData(icon));
@@ -77,7 +77,7 @@ public void actionPerformed(ActionContext context) {
7777
addLocalAction(action);
7878

7979
//Example popup action
80-
DockingAction popupAction = new DockingAction("Hello Popup", getName()) {
80+
DockingAction popupAction = new DockingAction("Hello Popup", getOwner()) {
8181
@Override
8282
public void actionPerformed(ActionContext context) {
8383
announce("Hello World");
@@ -136,9 +136,6 @@ public ActionContext getActionContext(MouseEvent event) {
136136
return null;
137137
}
138138

139-
/**
140-
* popup the Hello Dialog
141-
*/
142139
protected void announce(String message) {
143140
Msg.showInfo(getClass(), mainPanel, "Hello World", message);
144141
}
@@ -148,13 +145,7 @@ private class MyButton extends EmptyBorderButton {
148145
super(name);
149146
setBorder(BorderFactory.createEmptyBorder(10, 5, 10, 5));
150147

151-
addActionListener(new ActionListener() {
152-
153-
@Override
154-
public void actionPerformed(ActionEvent e) {
155-
announce("Hello World");
156-
}
157-
});
148+
addActionListener(e -> announce("Hello World"));
158149
}
159150
}
160151
}

Ghidra/Extensions/sample/src/main/java/ghidra/examples/ShowInfoComponentProvider.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
7-
*
7+
*
88
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
9+
*
1010
* Unless required by applicable law or agreed to in writing, software
1111
* distributed under the License is distributed on an "AS IS" BASIS,
1212
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -39,8 +39,8 @@ public class ShowInfoComponentProvider extends ComponentProviderAdapter {
3939
private Program currentProgram;
4040
private ProgramLocation currentLocation;
4141

42-
public ShowInfoComponentProvider(PluginTool tool, String name) {
43-
super(tool, name, name);
42+
public ShowInfoComponentProvider(PluginTool tool, String owner) {
43+
super(tool, "Show Location Info", owner);
4444
create();
4545
setIcon(PROVIDER_ICON);
4646
setDefaultWindowPosition(WindowPosition.BOTTOM);
@@ -102,7 +102,7 @@ private void create() {
102102
}
103103

104104
private void createActions() {
105-
clearAction = new DockingAction("Clear Text Area", getName()) {
105+
clearAction = new DockingAction("Clear Text Area", getOwner()) {
106106
@Override
107107
public void actionPerformed(ActionContext context) {
108108
textArea.setText("");

Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/gui/overview/BSimOverviewProvider.java

+6-4
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
7-
*
7+
*
88
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
9+
*
1010
* Unless required by applicable law or agreed to in writing, software
1111
* distributed under the License is distributed on an "AS IS" BASIS,
1212
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -102,12 +102,14 @@ private void createActions() {
102102
addLocalAction(new SelectionNavigationAction(plugin, table));
103103
HelpLocation help =
104104
new HelpLocation(BSimSearchPlugin.HELP_TOPIC, "Overview_Search_Info_Action");
105-
new ActionBuilder("Search Info", getName()).toolBarIcon(Icons.INFO_ICON)
105+
new ActionBuilder("Search Info", getOwner())
106+
.toolBarIcon(Icons.INFO_ICON)
106107
.helpLocation(help)
107108
.onAction(c -> showSearchInfo())
108109
.buildAndInstallLocal(this);
109110

110-
new ActionBuilder("Make Selection", getOwner()).popupMenuPath("Make Selection")
111+
new ActionBuilder("Make Selection", getOwner())
112+
.popupMenuPath("Make Selection")
111113
.description("Make a selection using selected rows")
112114
.helpLocation(
113115
new HelpLocation(BSimSearchPlugin.HELP_TOPIC, "Overview_Make_Selection"))

Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/gui/search/results/BSimSearchResultsProvider.java

+22-13
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
7-
*
7+
*
88
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
9+
*
1010
* Unless required by applicable law or agreed to in writing, software
1111
* distributed under the License is distributed on an "AS IS" BASIS,
1212
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -132,39 +132,45 @@ public void componentHidden() {
132132
}
133133

134134
private void createActions() {
135-
new ActionBuilder("Search Info", getName()).toolBarIcon(Icons.INFO_ICON)
135+
new ActionBuilder("Search Info", getOwner())
136+
.toolBarIcon(Icons.INFO_ICON)
136137
.helpLocation(new HelpLocation(BSimSearchPlugin.HELP_TOPIC, "Search_Info_Action"))
137138
.onAction(c -> showSearchInfo())
138139
.buildAndInstallLocal(this);
139140

140-
new ActionBuilder("Show Searched Functions", getName()).toolBarIcon(FUNCTIONS_ICON)
141+
new ActionBuilder("Show Searched Functions", getOwner())
142+
.toolBarIcon(FUNCTIONS_ICON)
141143
.helpLocation(new HelpLocation(BSimSearchPlugin.HELP_TOPIC, "Searched_Functions"))
142144
.onAction(c -> showSearchedFunctions())
143145
.buildAndInstallLocal(this);
144146

145-
new ActionBuilder("Filter Results", getName()).toolBarIcon(Icons.CONFIGURE_FILTER_ICON)
147+
new ActionBuilder("Filter Results", getOwner())
148+
.toolBarIcon(Icons.CONFIGURE_FILTER_ICON)
146149
.helpLocation(
147150
new HelpLocation(BSimSearchPlugin.HELP_TOPIC, "Filter_Results_Action"))
148151
.onAction(c -> showFilterPanel())
149152
.buildAndInstallLocal(this);
150153

151-
new ActionBuilder("Filter Executable", getName()).popupMenuPath("Filter on this Executable")
154+
new ActionBuilder("Filter Executable", getOwner())
155+
.popupMenuPath("Filter on this Executable")
152156
.description("Filter on a specific executable in the function match table")
153157
.helpLocation(new HelpLocation(BSimSearchPlugin.HELP_TOPIC, "Filter_On_Executable"))
154158
.withContext(ExecutableTableActionContext.class)
155159
.enabledWhen(c -> c.getSelectedRowCount() == 1)
156160
.onAction(this::filterOnExecutable)
157161
.buildAndInstallLocal(this);
158162

159-
new ActionBuilder("Load Executable", getName()).popupMenuPath("Load Executable")
163+
new ActionBuilder("Load Executable", getOwner())
164+
.popupMenuPath("Load Executable")
160165
.description("Load the selected executable into the Codebrowser")
161166
.helpLocation(new HelpLocation(BSimSearchPlugin.HELP_TOPIC, "Load_Executable"))
162167
.withContext(ExecutableTableActionContext.class)
163168
.enabledWhen(c -> c.getSelectedRowCount() == 1)
164169
.onAction(this::loadExecutable)
165170
.buildAndInstallLocal(this);
166171

167-
new ActionBuilder("Compare Functions", getName()).popupMenuPath("Compare Functions")
172+
new ActionBuilder("Compare Functions", getOwner())
173+
.popupMenuPath("Compare Functions")
168174
.popupMenuGroup("1")
169175
.keyBinding("shift c")
170176
.sharedKeyBinding()
@@ -175,23 +181,25 @@ private void createActions() {
175181
.onAction(this::compareFunctions)
176182
.buildAndInstallLocal(this);
177183

178-
new ActionBuilder("Apply Function Name", getName()).popupMenuPath("Apply Name")
184+
new ActionBuilder("Apply Function Name", getOwner())
185+
.popupMenuPath("Apply Name")
179186
.popupMenuGroup(APPLY_GROUP, "1")
180187
.helpLocation(new HelpLocation(BSimSearchPlugin.HELP_TOPIC, "Apply_Name"))
181188
.withContext(BSimMatchesTableActionContext.class)
182189
.enabledWhen(c -> c.getSelectedRowCount() > 0)
183190
.onAction(this::applyName)
184191
.buildAndInstallLocal(this);
185192

186-
new ActionBuilder("Apply Function Signature", getName()).popupMenuPath("Apply Signature")
193+
new ActionBuilder("Apply Function Signature", getOwner())
194+
.popupMenuPath("Apply Signature")
187195
.popupMenuGroup(APPLY_GROUP, "2")
188196
.helpLocation(new HelpLocation(BSimSearchPlugin.HELP_TOPIC, "Apply_Signature"))
189197
.withContext(BSimMatchesTableActionContext.class)
190198
.enabledWhen(c -> c.getSelectedRowCount() > 0)
191199
.onAction(this::applySignature)
192200
.buildAndInstallLocal(this);
193201

194-
new ActionBuilder("Apply Signature and Datatypes", getName())
202+
new ActionBuilder("Apply Signature and Datatypes", getOwner())
195203
.popupMenuPath("Apply Signature and Data Types")
196204
.popupMenuGroup(APPLY_GROUP, "3")
197205
.helpLocation(
@@ -201,7 +209,7 @@ private void createActions() {
201209
.onAction(this::applySignatureWithDatatypes)
202210
.buildAndInstallLocal(this);
203211

204-
showExecutableTableAction = new ToggleActionBuilder("Show Executables Table", getName())
212+
showExecutableTableAction = new ToggleActionBuilder("Show Executables Table", getOwner())
205213
.toolBarIcon(SPLIT_VIEW_ICON)
206214
.description("Toggles showing Executables table")
207215
.helpLocation(
@@ -212,7 +220,8 @@ private void createActions() {
212220

213221
addLocalAction(new SelectionNavigationAction(plugin, matchesTable.getTable()));
214222

215-
new ActionBuilder("Clear BSim Error Status", getName()).popupMenuPath("Clear error status")
223+
new ActionBuilder("Clear BSim Error Status", getOwner())
224+
.popupMenuPath("Clear error status")
216225
.helpLocation(new HelpLocation(BSimSearchPlugin.HELP_TOPIC, "Clear_Error_Status"))
217226
.withContext(BSimMatchesTableActionContext.class)
218227
.enabledWhen(this::canClearErrors)

Ghidra/Features/Base/src/main/java/ghidra/app/merge/tool/ListingMergePanelProvider.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
7-
*
7+
*
88
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
9+
*
1010
* Unless required by applicable law or agreed to in writing, software
1111
* distributed under the License is distributed on an "AS IS" BASIS,
1212
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -58,7 +58,7 @@ void dispose() {
5858
public List<DockingActionIf> getPopupActions(Tool dt, ActionContext context) {
5959
ListingPanel resultPanel = mergePanel.getResultPanel();
6060
if (resultPanel != null) {
61-
return resultPanel.getHeaderActions(getName());
61+
return resultPanel.getHeaderActions(getOwner());
6262
}
6363
return null;
6464
}

Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/CodeViewerProvider.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ private void createActions() {
461461
tool.addLocalAction(this, new CollapseAllDataAction(this));
462462
tool.addLocalAction(this, new ToggleExpandCollapseDataAction(this));
463463

464-
cloneCodeViewerAction = new CloneCodeViewerAction(getName(), this);
464+
cloneCodeViewerAction = new CloneCodeViewerAction(plugin.getName(), this);
465465
addLocalAction(cloneCodeViewerAction);
466466

467467
DockingAction action = new GotoPreviousFunctionAction(tool, plugin.getName());
@@ -982,7 +982,7 @@ public void setView(AddressSetView view) {
982982
@Override
983983
public List<DockingActionIf> getPopupActions(Tool dt, ActionContext context) {
984984
if (context.getComponentProvider() == this) {
985-
return listingPanel.getHeaderActions(getName());
985+
return listingPanel.getHeaderActions(getOwner());
986986
}
987987
return null;
988988
}

Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/interpreter/InterpreterComponentProvider.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
7-
*
7+
*
88
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
9+
*
1010
* Unless required by applicable law or agreed to in writing, software
1111
* distributed under the License is distributed on an "AS IS" BASIS,
1212
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -63,7 +63,7 @@ public InterpreterComponentProvider(InterpreterPanelPlugin plugin,
6363

6464
private void createActions() {
6565

66-
DockingAction clearAction = new DockingAction("Clear Interpreter", getName()) {
66+
DockingAction clearAction = new DockingAction("Clear Interpreter", getOwner()) {
6767
@Override
6868
public void actionPerformed(ActionContext context) {
6969
clear();

0 commit comments

Comments
 (0)