GP-5438: Fix 'Select All' and others in Dynamic Listing. (syncing needs follow-up work.)

This commit is contained in:
Dan 2025-04-01 12:48:30 +00:00
parent b319b3df7f
commit d7f63a9075
42 changed files with 432 additions and 358 deletions

View file

@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

View file

@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -31,7 +31,8 @@ import docking.action.ToggleDockingAction;
import generic.theme.GColor;
import ghidra.app.plugin.PluginCategoryNames;
import ghidra.app.plugin.core.codebrowser.MarkerServiceBackgroundColorModel;
import ghidra.app.plugin.core.debug.*;
import ghidra.app.plugin.core.debug.AbstractDebuggerPlugin;
import ghidra.app.plugin.core.debug.DebuggerPluginPackage;
import ghidra.app.plugin.core.debug.event.TraceClosedPluginEvent;
import ghidra.app.plugin.core.debug.gui.DebuggerResources.*;
import ghidra.app.plugin.core.debug.gui.action.DebuggerTrackLocationTrait;
@ -58,12 +59,21 @@ import ghidra.trace.model.program.TraceProgramView;
import ghidra.trace.model.time.schedule.TraceSchedule;
import ghidra.util.Msg;
@PluginInfo(shortDescription = "Compare memory state between times in a trace", description = "Provides a side-by-side diff view between snapshots (points in time) in a " +
"trace. The comparison is limited to raw bytes.", category = PluginCategoryNames.DEBUGGER, packageName = DebuggerPluginPackage.NAME, status = PluginStatus.RELEASED, eventsConsumed = {
@PluginInfo(
shortDescription = "Compare memory state between times in a trace",
description = "Provides a side-by-side diff view between snapshots (points in time) in a " +
"trace. The comparison is limited to raw bytes.",
category = PluginCategoryNames.DEBUGGER,
packageName = DebuggerPluginPackage.NAME,
status = PluginStatus.RELEASED,
eventsConsumed = {
TraceClosedPluginEvent.class,
}, eventsProduced = {}, servicesRequired = {
},
eventsProduced = {},
servicesRequired = {
DebuggerListingService.class,
}, servicesProvided = {})
},
servicesProvided = {})
public class DebuggerTraceViewDiffPlugin extends AbstractDebuggerPlugin {
static final Color COLOR_DIFF = new GColor("color.bg.highlight.listing.diff");

View file

@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -41,9 +41,4 @@ public class DebuggerListingActionContext extends ListingActionContext
public TraceProgramView getProgram() {
return (TraceProgramView) super.getProgram();
}
@Override
public DebuggerListingProvider getComponentProvider() {
return (DebuggerListingProvider) super.getComponentProvider();
}
}

View file

@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

View file

@ -408,7 +408,7 @@ public class DebuggerListingProvider extends CodeViewerProvider {
protected MarkerMarginProvider markerMarginProvider;
protected MarkerOverviewProvider markerOverviewProvider;
private SuppressableCallback<ProgramLocation> cbGoTo = new SuppressableCallback<>();
private final SuppressableCallback<ProgramLocation> cbGoTo = new SuppressableCallback<>();
protected final ForStaticSyncMappingChangeListener mappingChangeListener =
new ForStaticSyncMappingChangeListener();

View file

@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

View file

@ -1,25 +0,0 @@
/* ###
* IP: GHIDRA
* REVIEWED: YES
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ghidra.app.context;
/**
* Marker interface to signal a context specifically for actions that work on a range of
* program locations.
*/
public interface NavigatableRangeActionContext {
}

View file

@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -15,12 +15,14 @@
*/
package ghidra.app.context;
import docking.ActionContext;
/**
* An interface that signals the client supports navigation.
*
* <P>Note: the {@link NavigatableActionContext} is tied to {@link ProgramLocationActionContext}
* which has more baggage than just 'navigation'.
*/
public interface NavigationActionContext {
public interface NavigationActionContext extends ActionContext {
// marker interface
}

View file

@ -33,7 +33,6 @@ import ghidra.app.util.ListingHighlightProvider;
import ghidra.app.util.viewer.util.FieldNavigator;
import ghidra.framework.model.DomainObject;
import ghidra.framework.plugintool.ModalPluginTool;
import ghidra.framework.plugintool.Plugin;
import ghidra.framework.plugintool.util.PluginException;
import ghidra.program.model.address.Address;
import ghidra.program.model.listing.Program;
@ -45,9 +44,8 @@ import ghidra.util.SystemUtilities;
import help.Help;
import help.HelpService;
/**
* Top level object that manages each step of the merge/resolve conflicts
* process.
/**
* Top level object that manages each step of the merge/resolve conflicts process.
*/
public class ProgramMultiUserMergeManager extends MergeManager {
@ -113,6 +111,7 @@ public class ProgramMultiUserMergeManager extends MergeManager {
/**
* Returns one of the four programs involved in the merge as indicated by the version.
*
* @param version the program version to return. (LATEST, MY, ORIGINAL, or RESULT).
* @return the indicated program version or null if a valid version isn't specified.
* @see MergeConstants
@ -165,9 +164,12 @@ public class ProgramMultiUserMergeManager extends MergeManager {
}
/**
* Show the default merge panel. The default merge panel now shows the status of each phase
* of the merge and also the progress in the current phase.
*@param description description of current merge process near the top of the merge tool.
* Show the default merge panel.
* <p>
* The default merge panel now shows the status of each phase of the merge and also the progress
* in the current phase.
*
* @param description description of current merge process near the top of the merge tool.
*/
@Override
public void showDefaultMergePanel(final String description) {
@ -179,14 +181,15 @@ public class ProgramMultiUserMergeManager extends MergeManager {
}
/**
* Show the component that is used to resolve conflicts. This method
* is called by the MergeResolvers when user input is required. If the
* component is not null, this method blocks until the user either
* cancels the merge process or resolves a conflict. If comp is null,
* then the default component is displayed, and the method does not
* Show the component that is used to resolve conflicts.
* <p>
* This method is called by the MergeResolvers when user input is required. If the component is
* not null, this method blocks until the user either cancels the merge process or resolves a
* conflict. If comp is null, then the default component is displayed, and the method does not
* wait for user input.
* @param comp component to show; if component is null, show the
* default component and do not block
*
* @param comp component to show; if component is null, show the default component and do not
* block
* @param componentID id or name for the component
*/
@Override
@ -202,7 +205,7 @@ public class ProgramMultiUserMergeManager extends MergeManager {
showMergeTool();
Dimension oldSize = mergeTool.getSize();
if (listingPlugin != null) {
mergeTool.removePlugins(new Plugin[] { listingPlugin, goToPlugin });
mergeTool.removePlugins(java.util.List.of(listingPlugin, goToPlugin));
listingPlugin = null;
goToPlugin = null;
}
@ -227,6 +230,7 @@ public class ProgramMultiUserMergeManager extends MergeManager {
/**
* Show the listing merge panel.
*
* @param goToAddress the address to goto.
*/
public void showListingMergePanel(final Address goToAddress) {
@ -265,7 +269,9 @@ public class ProgramMultiUserMergeManager extends MergeManager {
/**
* Show the listing merge panel with each listing positioned to the indicated address.
* <p>
* A null can be passed for any address to indicate that listing should be empty.
*
* @param resultAddress the address for positioning the Result program's listing.
* @param latestAddress the address for positioning the Latest program's listing.
* @param myAddress the address for positioning the My program's listing.
@ -291,7 +297,9 @@ public class ProgramMultiUserMergeManager extends MergeManager {
/**
* Show the listing merge panel with each listing positioned to the indicated address.
* <p>
* A null can be passed for any address to indicate that listing should be empty.
*
* @param resultAddress the address for positioning the Result program's listing.
* @param latestAddress the address for positioning the Latest program's listing.
* @param myAddress the address for positioning the My program's listing.
@ -368,16 +376,19 @@ public class ProgramMultiUserMergeManager extends MergeManager {
return;
}
mergePanel.removeDomainObjectListener();
mergeTool.removePlugins(new Plugin[] { listingPlugin, goToPlugin });
mergeTool.removePlugins(java.util.List.of(listingPlugin, goToPlugin));
isShowingListingMergePanel = false;
mergePlugin.showDefaultComponent();
});
}
/**
* Returns the listing merge panel. This is the panel containing the four
* listing windows: result, latest, my, and original. The four listings are
* the center component of JPanel with a BorderLayout.
* Returns the listing merge panel.
* <p>
* This is the panel containing the four listing windows: result, latest, my, and original. The
* four listings are the center component of {@link JPanel} with a {@link BorderLayout}.
*
* @return the merge panel
*/
public ListingMergePanel getListingMergePanel() {
return mergePanel;
@ -385,6 +396,7 @@ public class ProgramMultiUserMergeManager extends MergeManager {
/**
* Determines if the modal merge tool is currently displayed on the screen.
*
* @return true if the merge tool is displayed.
*/
@Override
@ -394,6 +406,7 @@ public class ProgramMultiUserMergeManager extends MergeManager {
/**
* Determines if the four program Listing merge panel is currently displayed in the merge tool.
*
* @return true if the Listing merge panel is displayed.
*/
public boolean isShowingListingMergePanel() {
@ -402,7 +415,9 @@ public class ProgramMultiUserMergeManager extends MergeManager {
/**
* Determine if the listing panels should be rendered.
* <p>
* NOTE: This is provided for testing performance reasons only.
*
* @return true if listing panels should be rendered
*/
public boolean isShowListingPanel() {

View file

@ -299,6 +299,7 @@ public class ListingMergePanel extends JPanel
/**
* Color the background of all 4 listings to the indicated color for the indicated addresses.
*
* @param addrSet the addresses
*/
public void paintAllBackgrounds(AddressSetView addrSet) {
@ -365,6 +366,7 @@ public class ListingMergePanel extends JPanel
/**
* Adds a button press listener.
*
* @param listener the listener to add.
*/
public void addButtonPressedListener(ButtonPressedListener listener) {
@ -375,6 +377,7 @@ public class ListingMergePanel extends JPanel
/**
* Get the indicated program version.
*
* @param version LATEST, CHECKED_OUT, ORIGINAL, RESULT from MergeConstants
* @return the program
*/
@ -383,8 +386,8 @@ public class ListingMergePanel extends JPanel
}
/**
* Add the result program's listing model as a listener to the result program
* for domain object events.
* Add the result program's listing model as a listener to the result program for domain object
* events.
*/
public void addDomainObjectListener() {
DomainObjectListener listingModel = (DomainObjectListener) multiModel.getModel(RESULT);
@ -392,8 +395,8 @@ public class ListingMergePanel extends JPanel
}
/**
* Remove the result program's listing model as a listener to the result program
* for domain object events.
* Remove the result program's listing model as a listener to the result program for domain
* object events.
*/
public void removeDomainObjectListener() {
DomainObjectListener listingModel = (DomainObjectListener) multiModel.getModel(RESULT);

View file

@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -41,6 +41,7 @@ public class ListingMergePanelPlugin extends Plugin implements ProgramaticUseOnl
/**
* Constructor
*
* @param tool merge tool
* @param mergePanel merge panel
*/
@ -91,9 +92,7 @@ public class ListingMergePanelPlugin extends Plugin implements ProgramaticUseOnl
@Override
public void processEvent(PluginEvent event) {
if (event instanceof ProgramLocationPluginEvent) {
ProgramLocationPluginEvent evt = (ProgramLocationPluginEvent) event;
if (event instanceof ProgramLocationPluginEvent evt) {
ProgramLocation location = evt.getLocation();
ListingMergePanel mergePanel = (ListingMergePanel) provider.getComponent();
mergePanel.goTo(location, true);

View file

@ -39,7 +39,6 @@ public interface Navigatable {
* Commands this navigatable to goto (display) the given program and location
*
* @param program the program
*
* @param location the location in that program to display
* @return true if the goto was successful
*/
@ -81,8 +80,9 @@ public interface Navigatable {
public Icon getNavigatableIcon();
/**
* Returns true if this Navigatable is "connected". Navigatables are connected if they produce
* and consume location and selection events.
* Returns true if this Navigatable is "connected".
* <p>
* Navigatables are connected if they produce and consume location and selection events.
*
* @return true if this Navigatable is "connected"
*/
@ -199,9 +199,11 @@ public interface Navigatable {
Program program);
/**
* Returns a source for providing byte values of the program associated with this
* navigatable. For a static program, this is just a wrapper for a program's memory. But
* dynamic programs require special handling for reading bytes.
* Returns a source for providing byte values of the program associated with this navigatable.
* <p>
* For a static program, this is just a wrapper for a program's memory. But dynamic programs
* require special handling for reading bytes.
*
* @return a source of bytes for the navigatable's program
*/
public default AddressableByteSource getByteSource() {

View file

@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -296,11 +296,10 @@ public abstract class AbstractPatchAction extends DockingAction {
ListingActionContext lac = (ListingActionContext) context;
ComponentProvider provider = lac.getComponentProvider();
if (!(provider instanceof CodeViewerProvider)) {
if (!(provider instanceof CodeViewerProvider codeViewer)) {
return false;
}
CodeViewerProvider codeViewer = (CodeViewerProvider) provider;
if (codeViewer.isReadOnly()) {
return false;
}

View file

@ -767,7 +767,6 @@ public abstract class AbstractCodeBrowserPlugin<P extends CodeViewerProvider> ex
@Override
public boolean goTo(ProgramLocation location, boolean centerOnScreen) {
return Swing
.runNow(() -> connectedProvider.getListingPanel().goTo(location, centerOnScreen));
}

View file

@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -33,7 +33,8 @@ import ghidra.framework.model.DomainFile;
import ghidra.framework.options.SaveState;
import ghidra.framework.plugintool.*;
import ghidra.framework.plugintool.util.PluginStatus;
import ghidra.program.model.address.*;
import ghidra.program.model.address.AddressSet;
import ghidra.program.model.address.AddressSetView;
import ghidra.program.model.listing.Program;
import ghidra.program.util.ProgramLocation;
import ghidra.program.util.ProgramSelection;
@ -142,9 +143,7 @@ public class CodeBrowserPlugin extends AbstractCodeBrowserPlugin<CodeViewerProvi
updateHighlightProvider();
updateBackgroundColorModel();
setHighlight(new FieldSelection());
AddressFactory currentAddressFactory =
(currentProgram != null) ? currentProgram.getAddressFactory() : null;
setSelection(new ProgramSelection(currentAddressFactory));
setSelection(new ProgramSelection());
}
else if (event instanceof ProgramLocationPluginEvent) {
ProgramLocationPluginEvent evt = (ProgramLocationPluginEvent) event;

View file

@ -21,6 +21,7 @@ import docking.action.builder.ActionBuilder;
import docking.tool.ToolConstants;
import generic.theme.GIcon;
import ghidra.app.CorePluginPackage;
import ghidra.app.context.ListingActionContext;
import ghidra.app.plugin.PluginCategoryNames;
import ghidra.app.plugin.core.codebrowser.SelectEndpointsAction.RangeEndpoint;
import ghidra.app.plugin.core.table.TableComponentProvider;
@ -81,7 +82,7 @@ public class CodeBrowserSelectionPlugin extends Plugin {
.menuGroup(SELECT_GROUP, "a")
.keyBinding("ctrl A")
.helpLocation(new HelpLocation(HelpTopics.SELECTION, "Select All"))
.withContext(CodeViewerActionContext.class, true)
.withContext(ListingActionContext.class, true)
.inWindow(ActionBuilder.When.CONTEXT_MATCHES)
.onAction(c -> ((CodeViewerProvider) c.getComponentProvider()).selectAll())
.buildAndInstall(tool);
@ -90,7 +91,7 @@ public class CodeBrowserSelectionPlugin extends Plugin {
.menuPath(ToolConstants.MENU_SELECTION, "&Clear Selection")
.menuGroup(SELECT_GROUP, "b")
.helpLocation(new HelpLocation(HelpTopics.SELECTION, "Clear Selection"))
.withContext(CodeViewerActionContext.class, true)
.withContext(ListingActionContext.class, true)
.inWindow(ActionBuilder.When.CONTEXT_MATCHES)
.enabledWhen(c -> c.hasSelection())
.onAction(c -> ((CodeViewerProvider) c.getComponentProvider())
@ -101,7 +102,7 @@ public class CodeBrowserSelectionPlugin extends Plugin {
.menuPath(ToolConstants.MENU_SELECTION, "&Complement")
.menuGroup(SELECT_GROUP, "c")
.helpLocation(new HelpLocation(HelpTopics.SELECTION, "Select Complement"))
.withContext(CodeViewerActionContext.class, true)
.withContext(ListingActionContext.class, true)
.inWindow(ActionBuilder.When.CONTEXT_MATCHES)
.onAction(c -> ((CodeViewerProvider) c.getComponentProvider()).selectComplement())
.buildAndInstall(tool);
@ -112,7 +113,7 @@ public class CodeBrowserSelectionPlugin extends Plugin {
.menuPath(ToolConstants.MENU_SELECTION, "Create Table From Selection")
.menuGroup("SelectUtils")
.helpLocation(new HelpLocation(HelpTopics.CODE_BROWSER, "Selection_Tables"))
.withContext(CodeViewerActionContext.class, true)
.withContext(ListingActionContext.class, true)
.inWindow(ActionBuilder.When.CONTEXT_MATCHES)
.onAction(c -> createTable((CodeViewerProvider) c.getComponentProvider()))
.buildAndInstall(tool);
@ -121,7 +122,7 @@ public class CodeBrowserSelectionPlugin extends Plugin {
.menuPath(ToolConstants.MENU_SELECTION, CREATE_ADDRESS_RANGE_TABLE_ACTION_NAME)
.menuGroup("SelectUtils")
.helpLocation(new HelpLocation(HelpTopics.CODE_BROWSER, "Selection_Tables"))
.withContext(CodeViewerActionContext.class, true)
.withContext(ListingActionContext.class, true)
.inWindow(ActionBuilder.When.CONTEXT_MATCHES)
.onAction(
c -> createAddressRangeTable((CodeViewerProvider) c.getComponentProvider()))
@ -150,7 +151,7 @@ public class CodeBrowserSelectionPlugin extends Plugin {
String title = "Selected Ranges in " + program.getName();
TableComponentProvider<AddressRangeInfo> tableProvider =
tableService.showTableWithMarkers(title, "Address Ranges", model,
SearchConstants.SEARCH_HIGHLIGHT_COLOR, markerIcon, title, null);
SearchConstants.SEARCH_HIGHLIGHT_COLOR, markerIcon, title, componentProvider);
tableProvider.installRemoveItemsAction();
SelectEndpointsAction selectMin =
@ -186,7 +187,7 @@ public class CodeBrowserSelectionPlugin extends Plugin {
Icon markerIcon = new GIcon("icon.plugin.codebrowser.cursor.marker");
TableComponentProvider<Address> tableProvider =
tableService.showTableWithMarkers(title + " " + model.getName(), "Selections", model,
SearchConstants.SEARCH_HIGHLIGHT_COLOR, markerIcon, title, null);
SearchConstants.SEARCH_HIGHLIGHT_COLOR, markerIcon, title, componentProvider);
tableProvider.installRemoveItemsAction();
}

View file

@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -16,11 +16,9 @@
package ghidra.app.plugin.core.codebrowser;
import ghidra.app.context.ListingActionContext;
import ghidra.app.context.NavigatableRangeActionContext;
import ghidra.program.util.ProgramLocation;
public class CodeViewerActionContext extends ListingActionContext implements
NavigatableRangeActionContext {
public class CodeViewerActionContext extends ListingActionContext {
public CodeViewerActionContext(CodeViewerProvider provider) {
super(provider, provider);
@ -29,5 +27,4 @@ public class CodeViewerActionContext extends ListingActionContext implements
public CodeViewerActionContext(CodeViewerProvider provider, ProgramLocation location) {
super(provider, provider, location);
}
}

View file

@ -943,14 +943,14 @@ public class CodeViewerProvider extends NavigatableComponentProviderAdapter
public void selectAll() {
listingPanel.getFieldPanel().requestFocus();
ProgramSelection sel = new ProgramSelection(program.getAddressFactory(),
ProgramSelection sel = new ProgramSelection(
listingPanel.getAddressIndexMap().getOriginalAddressSet());
doSetSelection(sel);
}
public void selectComplement() {
AddressSet complement = listingPanel.selectComplement();
ProgramSelection sel = new ProgramSelection(program.getAddressFactory(), complement);
ProgramSelection sel = new ProgramSelection(complement);
doSetSelection(sel);
}

View file

@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -30,9 +30,9 @@ import ghidra.program.util.ProgramSelection;
import ghidra.util.HelpLocation;
/**
* Actions for creating a selection using two distinct steps. The first time the action
* is invoked, it records the current location as the start of a selection. The second time the
* action is invoked it creates a selection from the recorded location to the current location.
* Actions for creating a selection using two distinct steps. The first time the action is invoked,
* it records the current location as the start of a selection. The second time the action is
* invoked it creates a selection from the recorded location to the current location.
*/
public class MarkAndSelectionAction extends ToggleDockingAction {
private Navigatable markedNavigatable;

View file

@ -15,7 +15,7 @@
*/
package ghidra.app.plugin.core.gotoquery;
import static ghidra.framework.main.DataTreeDialogType.*;
import static ghidra.framework.main.DataTreeDialogType.OPEN;
import java.util.Stack;
@ -170,27 +170,27 @@ public class GoToHelper {
}
/**
* GoTo external address linkage location (pointer or thunk) within the current program
* which is associated with the specified external location.
* GoTo external address linkage location (pointer or thunk) within the current program which is
* associated with the specified external location.
* <p>
* For those use cases which should not popup a window the popupAllowed
* option should be <b>false</b>.
* For those use cases which should not popup a window the popupAllowed option should be
* <b>false</b>.
* <p>
* This method will generally cause navigation to a linkage location associated with
* the specified external location. A linkage location is either a pointer to the
* external location (identified by reference) or a thunk to the external
* location, provided the thunk does not reference a linkage pointer. If more than one
* linkage location exists and popupAllowed is <b>true</b>, a table will be displayed allowing
* the user to navigate to any of the linkage locations. If navigation is initiated from the
* only known linkage location, and popupAllowed is <b>true</b>, navigation to the external
* program will be attempted regardless of the current
* {@link NavigationOptions#isGotoExternalProgramEnabled} setting.
* This method will generally cause navigation to a linkage location associated with the
* specified external location. A linkage location is either a pointer to the external location
* (identified by reference) or a thunk to the external location, provided the thunk does not
* reference a linkage pointer. If more than one linkage location exists and popupAllowed is
* <b>true</b>, a table will be displayed allowing the user to navigate to any of the linkage
* locations. If navigation is initiated from the only known linkage location, and popupAllowed
* is <b>true</b>, navigation to the external program will be attempted regardless of the
* current {@link NavigationOptions#isGotoExternalProgramEnabled} setting.
*
* @param nav Navigatable
* @param externalLoc external location
* @param popupAllowed if true a table may be displayed when multiple linkage locations
* exist, otherwise navigation to the first linkage location will be performed
* @return true if navigation was successful or a list of possible linkage locations
* was displayed.
* @param popupAllowed if true a table may be displayed when multiple linkage locations exist,
* otherwise navigation to the first linkage location will be performed
* @return true if navigation was successful or a list of possible linkage locations was
* displayed.
*/
protected boolean goToExternalLinkage(Navigatable nav, ExternalLocation externalLoc,
boolean popupAllowed) {
@ -237,27 +237,28 @@ public class GoToHelper {
/**
* Navigate to either the external program location or address linkage location.
* This method will only navigate to the
* external program associated with the specified location if either checkNavigationOption
* is false, or the navigation option is set to Show External Program, or
* the current location is the same as the single linkage location. See
* {@link #goToExternalLinkage(Navigatable, ExternalLocation, boolean)} method for
* external linkage navigation behavior.
* <p>
* If navigation to an external program will be performed, the associated program will
* be identified and the location within that program found. Once this occurs, the
* external program will be opened within the current tool and navigation completed. If an
* external program association has not yet been established, the user will be prompted to make
* an association if they choose before completing the navigation.
* This method will only navigate to the external program associated with the specified location
* if either checkNavigationOption is false, or the navigation option is set to Show External
* Program, or the current location is the same as the single linkage location. See
* {@link #goToExternalLinkage(Navigatable, ExternalLocation, boolean)} method for external
* linkage navigation behavior.
* <p>
* If navigation to an external program will be performed, the associated program will be
* identified and the location within that program found. Once this occurs, the external program
* will be opened within the current tool and navigation completed. If an external program
* association has not yet been established, the user will be prompted to make an association if
* they choose before completing the navigation.
*
* @param nav Navigatable
* @param externalLocation external location
* @param checkNavigationOption if true the {@link NavigationOptions#isGotoExternalProgramEnabled}
* option will be used to determine if navigation to the external program will be
* attempted, or if navigation to the external linkage location within the current
* program will be attempted. If false, only navigation to the external linkage will be
* attempted.
* @return true if navigation to the external program was successful or navigation to a
* linkage location was performed.
* @param checkNavigationOption if true the
* {@link NavigationOptions#isGotoExternalProgramEnabled} option will be used to
* determine if navigation to the external program will be attempted, or if
* navigation to the external linkage location within the current program will be
* attempted. If false, only navigation to the external linkage will be attempted.
* @return true if navigation to the external program was successful or navigation to a linkage
* location was performed.
*/
public boolean goToExternalLocation(Navigatable nav, ExternalLocation externalLocation,
boolean checkNavigationOption) {

View file

@ -58,6 +58,7 @@ public final class GoToServicePlugin extends ProgramPlugin {
/**
* Creates a new instance of the <CODE>GoToServicePlugin</CODE>
*
* @param tool the tool
*/
public GoToServicePlugin(PluginTool tool) {

View file

@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -66,6 +66,7 @@ public class SetHighlightPlugin extends Plugin {
/**
* Constructor
*
* @param tool
*/
public SetHighlightPlugin(PluginTool tool) {

View file

@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

View file

@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -54,9 +54,9 @@ public abstract class AbstractTranslateAction extends DockingAction {
setPopupMenuData(dataListMenuData);
return isEnabledForContext((DataLocationListContext) context);
}
else if (context instanceof CodeViewerActionContext) {
else if (context instanceof CodeViewerActionContext cvac) {
setPopupMenuData(codeViewerMenuData);
return isEnabledForContext((CodeViewerActionContext) context);
return isEnabledForContext(cvac);
}
return false;
}

View file

@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -26,29 +26,31 @@ import ghidra.util.Swing;
import ghidra.util.task.TaskMonitor;
/**
* The GoToService provides a general service for plugins to generate GoTo
* events. The provider of this service will take care of interfacing with
* any history service that may be available.
* The GoToService provides a general service for plugins to generate GoTo events. The provider of
* this service will take care of interfacing with any history service that may be available.
* <p>
* This class will execute all {@code goTo} calls on the Java Swing thread. This will happen in
* a blocking manner if the client calls from any other thread. This has the potential to lead
* to deadlocks if the client is using custom synchronization. Care must be taken to not be
* holding any lock that will cause the Swing thread to block when using this class from any other
* thread. To work around this issue, clients can always call this service from within a
* This class will execute all {@code goTo} calls on the Java Swing thread. This will happen in a
* blocking manner if the client calls from any other thread. This has the potential to lead to
* deadlocks if the client is using custom synchronization. Care must be taken to not be holding any
* lock that will cause the Swing thread to block when using this class from any other thread. To
* work around this issue, clients can always call this service from within a
* {@link Swing#runLater(Runnable)} call, which will prevent any deadlock issues.
*/
@ServiceInfo(defaultProvider = GoToServicePlugin.class, description = "Navigate to a program location")
@ServiceInfo(
defaultProvider = GoToServicePlugin.class,
description = "Navigate to a program location")
public interface GoToService {
/**
* Characters that are allowed in words that the GoToService can use. These
* typically represent library name delimiters.
* Characters that are allowed in words that the GoToService can use. These typically represent
* library name delimiters.
*/
public static final char[] VALID_GOTO_CHARS = new char[] { '.', ':', '*' };
/**
* Generates a GoTo event and handles any history state that needs to be saved. This method
* will attempt to find the program that contains the given ProgramLocation.
* Generates a GoTo event and handles any history state that needs to be saved.
* <p>
* This method will attempt to find the program that contains the given ProgramLocation.
*
* @param loc location to go to
* @return true if the go to was successful
@ -57,11 +59,12 @@ public interface GoToService {
public boolean goTo(ProgramLocation loc);
/**
* Generates a GoTo event and handles any history state that needs to be saved. This
* overloaded version of {@link #goTo(Address)} uses the given program as the program within
* which to perform the GoTo. If the given program does not contain the given address, then
* the GoTo will not be performed and false will be returned. Passing <code>null</code> as the
* <code>program</code> parameter will cause this method to attempt to find a program that
* Generates a GoTo event and handles any history state that needs to be saved.
* <p>
* This overloaded version of {@link #goTo(Address)} uses the given program as the program
* within which to perform the GoTo. If the given program does not contain the given address,
* then the GoTo will not be performed and false will be returned. Passing <code>null</code> as
* the <code>program</code> parameter will cause this method to attempt to find a program that
* contains the given ProgramLocation.
*
* @param loc location to go to
@ -82,8 +85,10 @@ public interface GoToService {
public boolean goTo(Navigatable navigatable, ProgramLocation loc, Program program);
/**
* Generates a GoTo event to the given address. The refAddress is used to determine if
* there is a specific symbol reference from that reference.
* Generates a GoTo event to the given address.
* <p>
* The refAddress is used to determine if there is a specific symbol reference from that
* reference.
*
* @param navigatable the destination navigatable
* @param program program
@ -95,8 +100,10 @@ public interface GoToService {
Address refAddress);
/**
* Generates a GoTo event to the given address. The fromAddress is used to determine if
* there is a specific symbol reference from the current address.
* Generates a GoTo event to the given address.
* <p>
* The fromAddress is used to determine if there is a specific symbol reference from the current
* address.
*
* @param fromAddress the current address
* @param address the address to goto
@ -115,6 +122,7 @@ public interface GoToService {
/**
* Generates a GoTo event to the gotoAddress.
*
* @param goToAddress the address to goto
* @return true if the go to was successful
* @see #goTo(Address, Program)
@ -122,12 +130,13 @@ public interface GoToService {
public boolean goTo(Address goToAddress);
/**
* Generates a GoTo event to the gotoAddress. This overloaded version of
* {@link #goTo(Address)} uses the given program as the program within which to perform the
* GoTo. If the given program does not contain the given address, then the GoTo will not be
* performed and false will be returned. Passing <code>null</code> as the <code>program</code>
* parameter will cause this method to attempt to find a program that contains the given
* ProgramLocation.
* Generates a GoTo event to the gotoAddress.
* <p>
* This overloaded version of {@link #goTo(Address)} uses the given program as the program
* within which to perform the GoTo. If the given program does not contain the given address,
* then the GoTo will not be performed and false will be returned. Passing <code>null</code> as
* the <code>program</code> parameter will cause this method to attempt to find a program that
* contains the given ProgramLocation.
*
* @param goToAddress the address to goto
* @param program the program within which to perform the GoTo
@ -137,32 +146,34 @@ public interface GoToService {
public boolean goTo(Address goToAddress, Program program);
/**
* Navigate to either the external program location or address linkage location. Specific
* behavior may vary based upon implementation.
* Navigate to either the external program location or address linkage location.
* <p>
* Specific behavior may vary based upon implementation.
*
* @param externalLoc external location
* @param checkNavigationOption if true the service navigation option will be used to determine
* if navigation to the external program will be attempted, or if navigation to the
* external linkage location within the current program will be attempted. If false, the
* implementations default behavior will be performed.
* if navigation to the external program will be attempted, or if navigation to the
* external linkage location within the current program will be attempted. If false,
* the implementations default behavior will be performed.
* @return true if either navigation to the external program or to a linkage location was
* completed successfully.
* completed successfully.
*/
public boolean goToExternalLocation(ExternalLocation externalLoc,
boolean checkNavigationOption);
/**
* Navigate to either the external program location or address linkage location. Specific
* behavior may vary based upon implementation.
* Navigate to either the external program location or address linkage location.
* <p>
* Specific behavior may vary based upon implementation.
*
* @param navigatable Navigatable
* @param externalLoc external location
* @param checkNavigationOption if true the service navigation option will be used to determine
* if navigation to the external program will be attempted, or if navigation to the
* external linkage location within the current program will be attempted. If false, the
* implementations default behavior will be performed.
* if navigation to the external program will be attempted, or if navigation to the
* external linkage location within the current program will be attempted. If false,
* the implementations default behavior will be performed.
* @return true if either navigation to the external program or to a linkage location was
* completed successfully.
* completed successfully.
*/
public boolean goToExternalLocation(Navigatable navigatable, ExternalLocation externalLoc,
boolean checkNavigationOption);
@ -170,9 +181,9 @@ public interface GoToService {
/**
* Generates a GoTo event for the given query.
* <p>
* If the query results in more than one location, a list of locations will be displayed.
* If the query results in only one location, then a goto event will be fired(except for a
* wildcard query in which case a list will still be displayed.
* If the query results in more than one location, a list of locations will be displayed. If the
* query results in only one location, then a goto event will be fired(except for a wildcard
* query in which case a list will still be displayed.
* <p>
* The listener will be notified after query and will indicate the query status.
*
@ -188,9 +199,9 @@ public interface GoToService {
/**
* Generates a GoTo event for the given query.
* <p>
* If the query results in more than one location, a list of locations will be displayed.
* If the query results in only one location, then a goto event will be fired(except for a
* wildcard query in which case a list will still be displayed.
* If the query results in more than one location, a list of locations will be displayed. If the
* query results in only one location, then a goto event will be fired(except for a wildcard
* query in which case a list will still be displayed.
* <p>
* The listener will be notified after query and will indicate the query status.
*
@ -205,8 +216,10 @@ public interface GoToService {
GoToServiceListener listener, TaskMonitor monitor);
/**
* Returns the default navigatable that is the destination for GoTo events. This navigatable
* will not be null.
* Returns the default navigatable that is the destination for GoTo events.
* <p>
* This navigatable will not be null.
*
* @return the navigatable
*/
public Navigatable getDefaultNavigatable();

View file

@ -106,7 +106,7 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc
private String currentTextSelection;
/**
* Constructs a new ListingPanel using the given FormatManager and ServiceProvider.
* Constructs a new ListingPanel using the given FormatManager
*
* @param manager the FormatManager to use.
*/
@ -152,10 +152,10 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc
}
/**
* Constructs a new ListingPanel with the given FormatManager and ListingLayoutModel
* Constructs a new ListingPanel with the given FormatManager and ListingModel
*
* @param mgr the FormatManager to use
* @param model the ListingLayoutModel to use.
* @param model the ListingModel to use.
*/
public ListingPanel(FormatManager mgr, ListingModel model) {
this(mgr);
@ -171,8 +171,9 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc
return preferredSize;
}
/**
/**
* A width for new windows that shows a reasonable amount of the Listing
*
* @return the width
*/
protected int getNewWindowDefaultWidth() {
@ -203,7 +204,9 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc
}
/**
* Sets the ProgramLocationListener. Only one listener is supported
* Sets the ProgramLocationListener.
* <p>
* Only one listener is supported
*
* @param listener the ProgramLocationListener to use.
*/
@ -212,7 +215,9 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc
}
/**
* Sets the ProgramSelectionListener. Only one listener is supported
* Sets the ProgramSelectionListener.
* <p>
* Only one listener is supported
*
* @param listener the ProgramSelectionListener to use.
*/
@ -221,8 +226,9 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc
}
/**
* Sets the ProgramSelectionListener for selection changes while dragging. Only one listener is
* supported
* Sets the ProgramSelectionListener for selection changes while dragging.
* <p>
* Only one listener is supported
*
* @param listener the ProgramSelectionListener to use.
*/
@ -235,7 +241,7 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc
}
/**
* Sets the ListingLayoutModel to use.
* Sets the ListingModel to use.
*
* @param newModel the model to use.
*/
@ -249,6 +255,7 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc
/**
* Returns the current ListingModel used by this panel.
*
* @return the model
*/
public ListingModel getListingModel() {
@ -285,6 +292,7 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc
/**
* Returns true if the field header component is showing.
*
* @return true if showing
*/
public boolean isHeaderShowing() {
@ -493,8 +501,10 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc
}
/**
* Adds a {@link ListingHighlightProvider} to this listing. This highlight provider will be used with
* any other registered providers to paint all the highlights for this listing.
* Adds a {@link ListingHighlightProvider} to this listing.
* <p>
* This highlight provider will be used with any other registered providers to paint all the
* highlights for this listing.
*
* @param highlightProvider The provider to add
*/
@ -504,6 +514,7 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc
/**
* Returns the FieldPanel used by this ListingPanel.
*
* @return the field panel
*/
public FieldPanel getFieldPanel() {
@ -536,6 +547,7 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc
/**
* Returns the divider location between the left margin areas and the main display.
*
* @return the location
*/
public int getDividerLocation() {
@ -604,8 +616,9 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc
}
/**
* Moves the cursor to the given program location. Also, repositions the scrollbar to show that
* location, if the location is not on the screen.
* Moves the cursor to the given program location.
* <p>
* Also, repositions the scrollbar to show that location, if the location is not on the screen.
*
* @param loc the location to move to.
* @param centerWhenNotVisible this variable only has an effect if the given location is not on
@ -615,7 +628,6 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc
* @return true if successful
*/
public boolean goTo(ProgramLocation loc, boolean centerWhenNotVisible) {
Swing.assertSwingThread("goTo() must be called on the Swing thread");
final FieldLocation floc = getFieldLocation(loc);
@ -635,11 +647,12 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc
return true;
}
/**
/**
* Scroll the view of the listing to the given location.
*
* <p>
* If the given location is not displayed, this has no effect.
*
* @param location the location
*/
public void scrollTo(ProgramLocation location) {
@ -650,8 +663,9 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc
fieldPanel.scrollTo(fieldLocation);
}
/**
/**
* Center the view of the listing around the given location.
*
* @param location the location
*/
public void center(ProgramLocation location) {
@ -866,6 +880,7 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc
/**
* Gets the view of this listing panel (meant to be used in conjunction with
* {@link #setView(AddressSetView)}.
*
* @return the addresses
*/
public AddressSetView getView() {
@ -893,8 +908,10 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc
}
/**
* Sets the background color for the listing panel. This will set the background for the main
* listing display.
* Sets the background color for the listing panel.
* <p>
* This will set the background for the main listing display.
*
* @param c the color
*/
public void setTextBackgroundColor(Color c) {
@ -912,6 +929,7 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc
/**
* Returns true if this component has focus.
*
* @return true if this component has focus.
*/
public boolean isActive() {
@ -920,6 +938,7 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc
/**
* Returns the current program location of the cursor.
*
* @return the location
*/
public ProgramLocation getProgramLocation() {
@ -933,6 +952,7 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc
/**
* Get a program location for the given point.
*
* @param point the point
* @return program location, or null if point does not correspond to a program location
*/
@ -947,6 +967,7 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc
/**
* Get the margin providers in this ListingPanel.
*
* @return the providers
*/
public List<MarginProvider> getMarginProviders() {
@ -955,6 +976,7 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc
/**
* Get the overview providers in this ListingPanel.
*
* @return the providers
*/
public List<OverviewProvider> getOverviewProviders() {
@ -963,6 +985,7 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc
/**
* Returns true if the mouse is at a location that can be dragged.
*
* @return true if the mouse is at a location that can be dragged.
*/
public boolean isStartDragOk() {
@ -980,7 +1003,7 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc
/**
* Sets the cursor to the given program location with a given trigger
*
* <p>
* This method should only be used in automated testing to programmatically simulate a user
* navigating within the listing panel.
*
@ -1013,6 +1036,7 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc
/**
* Returns the AddressIndexMap currently used by this listing panel.
*
* @return the map
*/
public AddressIndexMap getAddressIndexMap() {
@ -1021,6 +1045,7 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc
/**
* Returns the vertical scrollbar used by this panel.
*
* @return the scroll bar
*/
public JScrollBar getVerticalScrollBar() {
@ -1029,6 +1054,7 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc
/**
* Returns the FormatManager used by this listing panel.
*
* @return the format manager
*/
public FormatManager getFormatManager() {
@ -1070,6 +1096,7 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc
/**
* Returns the current program selection.
*
* @return the selection
*/
public ProgramSelection getProgramSelection() {
@ -1091,6 +1118,7 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc
/**
* Sets the selection to the complement of the current selection in the listing view.
*
* @return the addresses
*/
public AddressSet selectComplement() {
@ -1196,8 +1224,9 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc
}
/**
* Returns the currently selected text. The value will only be non-null for selections within a
* single field.
* Returns the currently selected text.
* <p>
* The value will only be non-null for selections within a single field.
*
* @return the selected text or null
*/
@ -1210,8 +1239,9 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc
}
/**
* Sets listing panel to never show scroll bars. This is useful when you want this listing's
* parent to always be as big as this listing.
* Sets listing panel to never show scroll bars.
* <p>
* This is useful when you want this listing's parent to always be as big as this listing.
*/
public void setNeverSroll() {
scroller.setNeverScroll(true);

View file

@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -39,6 +39,7 @@ class ListingDisplayGoToService implements GoToService {
/**
* Constructs a goTo service for a dual listing panel.
*
* @param listingPanel the listing panel to be navigated to
*/
ListingDisplayGoToService(ListingPanel listingPanel) {
@ -154,9 +155,9 @@ class ListingDisplayGoToService implements GoToService {
}
/**
* Checks the address to make sure the listing won't navigate outside the addresses
* it currently has loaded. If it is not a valid address it will set a status message
* on the dual listing.
* Checks the address to make sure the listing won't navigate outside the addresses it currently
* has loaded. If it is not a valid address it will set a status message on the dual listing.
*
* @param addr the address to check
* @return true if the address is valid for navigation.
*/
@ -167,8 +168,8 @@ class ListingDisplayGoToService implements GoToService {
AddressIndexMap map = listingPanel.getAddressIndexMap();
AddressSetView addresses = map.getOriginalAddressSet();
if (!addresses.contains(addr)) {
DockingWindowManager.getActiveInstance().setStatusText(
"\"" + addr.toString() + "\" is outside the current listing's view.");
DockingWindowManager.getActiveInstance().setStatusText("""
"%s" is outside the current listing's view""".formatted(addr));
return false;
}
return true;

View file

@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -37,9 +37,9 @@ class ListingDisplayNavigator implements Navigatable {
/**
* Constructor for a dual listing navigator.
*
* @param listingPanel the dual listing whose left or right listing panel is to be controlled.
* @param goToService which side LEFT or RIGHT
* false means it's for the right side listing.
* @param goToService which side LEFT or RIGHT. false means it's for the right side listing.
*/
ListingDisplayNavigator(ListingPanel listingPanel, GoToService goToService) {

View file

@ -46,7 +46,7 @@ import ghidra.util.exception.CancelledException;
import ghidra.util.task.*;
/**
* Plugin for searching program memory.
* Plugin for searching program memory.
*/
//@formatter:off
@PluginInfo(

View file

@ -275,7 +275,7 @@ public class MemorySearchProvider extends ComponentProviderAdapter
* Performs a scan on the current results, keeping only the results that match the type of scan.
* Note: this method is public to facilitate testing.
*
* @param scanner the scanner to use to reduce the results.
* @param scanner the scanner to use to reduce the results.
*/
public void scan(Scanner scanner) {
setBusy(true);

View file

@ -35,12 +35,11 @@ import ghidra.program.util.ProgramSelection;
import ghidra.util.Msg;
/**
* Navigation is only supported if the underlying table model
* implements <code>ProgramTableModel</code> and the <code>setGoToService()</code> method
* has been called with a valid reference. When both of these conditions are met, then the
* table will navigate on a user's double-click or on an <code>Enter</code> key press. Also, if
* selection navigation is enabled, then this table will navigate <b>any time the selection of
* the table changes</b>. To prevent this feature call
* Navigation is only supported if the underlying table model implements {@link ProgramTableModel}
* and the <code>setGoToService()</code> method has been called with a valid reference. When both of
* these conditions are met, then the table will navigate on a user's double-click or on an
* <code>Enter</code> key press. Also, if selection navigation is enabled, then this table will
* navigate <b>any time the selection of the table changes</b>. To prevent this feature call
* {@link #setNavigateOnSelectionEnabled(boolean)} with a value of false.
*/
public class GhidraTable extends GTable {
@ -61,6 +60,7 @@ public class GhidraTable extends GTable {
/**
* Installs the default {@link TableCellRenderer}s for known Ghidra table cell data classes.
* <p>
* Subclasses can override this method to add additional types or to change the default
* associations.
*/
@ -79,10 +79,11 @@ public class GhidraTable extends GTable {
/**
* Sets the GoTo service to use when navigation is enabled on this table.
*
* @param goToService the GoTo service
* @param nav the navigable
* @deprecated use {@link #installNavigation(ServiceProvider)} or
* {@link #installNavigation(ServiceProvider,Navigatable)}
* {@link #installNavigation(ServiceProvider,Navigatable)}
*/
@Deprecated
public void installNavigation(GoToService goToService, Navigatable nav) {
@ -90,9 +91,10 @@ public class GhidraTable extends GTable {
}
/**
* Sets the service provider to use when navigation is enabled on this table. The service
* provider will be used to retrieve the {@link GoToService}, as needed after the system has
* been initialized. If you do not have a {@link Navigatable} preferences, then call
* Sets the service provider to use when navigation is enabled on this table.
* <p>
* The service provider will be used to retrieve the {@link GoToService}, as needed after the
* system has been initialized. If you do not have a {@link Navigatable} preferences, then call
* {@link #installNavigation(ServiceProvider)} instead.
*
* @param sp the service provider
@ -112,9 +114,10 @@ public class GhidraTable extends GTable {
}
/**
* Sets the service provider to use when navigation is enabled on this table. The service
* provider will be used to retrieve the {@link GoToService}, as needed after the system has
* been initialized.
* Sets the service provider to use when navigation is enabled on this table.
* <p>
* The service provider will be used to retrieve the {@link GoToService}, as needed after the
* system has been initialized.
*
* @param sp the service provider
*/
@ -164,8 +167,8 @@ public class GhidraTable extends GTable {
}
/**
* Removes any installed navigation components, such as listeners, a navigatable and the
* service provider.
* Removes any installed navigation components, such as listeners, a navigatable and the service
* provider.
*/
public void removeNavigation() {
removeKeyListener(navigationKeyListener);
@ -178,11 +181,13 @@ public class GhidraTable extends GTable {
/**
* Returns the program selection equivalent to the rows currently selected in the table.
* <p>
* This method is only valid when the underlying table model implements
* {@link ProgramTableModel}.
* <P>
* Returns null if no rows are selected or
* the underlying model does not implement <code>ProgramTableModel</code>.
* Returns null if no rows are selected or the underlying model does not implement
* <code>ProgramTableModel</code>.
*
* @return the program selection or null.
*/
public ProgramSelection getProgramSelection() {
@ -200,8 +205,8 @@ public class GhidraTable extends GTable {
}
/**
* Returns the program being used by this table; null if the underlying model does not
* implement {@link ProgramTableModel}
* Returns the program being used by this table; null if the underlying model does not implement
* {@link ProgramTableModel}
*
* @return the table's program
*/
@ -222,11 +227,11 @@ public class GhidraTable extends GTable {
}
/**
* Navigate to the program location denoted by the given row and column
* <p>
* Does nothing if no {@link GoToService} has been installed from
* {@link #installNavigation(GoToService, Navigatable)}. Also, this method will do
* nothing if this table's <code>TableModel</code> is not an instance of {@link ProgramTableModel}.
* Otherwise, this method will attempt to go to the program location denoted by the
* given row and column.
* {@link #installNavigation(GoToService, Navigatable)}. Also, this method will do nothing if
* this table's <code>TableModel</code> is not an instance of {@link ProgramTableModel}.
*
* @param row the row
* @param column the column
@ -269,12 +274,13 @@ public class GhidraTable extends GTable {
}
/**
* Does nothing if no {@link GoToService} has been installed from
* {@link #installNavigation(GoToService, Navigatable)}. Otherwise, this method will attempt
* to go to the program location denoted by the given row and column.
* Navigate to the program location denoted by the given row and column
* <p>
* This method differs from {@link #navigate(int, int)} in that this method will not
* navigate if {@link #navigateOnSelection} is <code>false</code>.
* Does nothing if no {@link GoToService} has been installed from
* {@link #installNavigation(GoToService, Navigatable)}.
* <p>
* This method differs from {@link #navigate(int, int)} in that this method will not navigate if
* {@link #navigateOnSelection} is <code>false</code>.
*/
protected void navigateOnCurrentSelection(int row, int column) {
if (!navigateOnSelection) {
@ -289,8 +295,9 @@ public class GhidraTable extends GTable {
}
/**
* Allows the user to enable and disable the table's feature that triggers navigation on
* certain selection events, like mouse clicking and pressing the 'Enter' key.
* Allows the user to enable and disable the table's feature that triggers navigation on certain
* selection events, like mouse clicking and pressing the 'Enter' key.
*
* @param enabled true enables the navigation on selection feature.
*/
public void setNavigateOnSelectionEnabled(boolean enabled) {
@ -328,6 +335,7 @@ public class GhidraTable extends GTable {
/**
* Selects the given row and performs a goto, if applicable.
*
* @param row The row to select
*/
@Override

View file

@ -34,10 +34,10 @@ import ghidra.util.table.GhidraTable;
import resources.Icons;
/**
* An action to make a program selection based on the given table's selection. For the context to
* work, the provider using this action must create an {@link ActionContext} that returns a
* context object that is the table passed to this action's constructor; otherwise, this action
* will not be enabled correctly.
* An action to make a program selection based on the given table's selection. For the context to
* work, the provider using this action must create an {@link ActionContext} that returns a context
* object that is the table passed to this action's constructor; otherwise, this action will not be
* enabled correctly.
*/
public class MakeProgramSelectionAction extends DockingAction {
@ -48,10 +48,13 @@ public class MakeProgramSelectionAction extends DockingAction {
private GhidraTable table;
/**
* Special constructor for clients that do not have a plugin. Clients using this
* constructor must override {@link #makeProgramSelection(ProgramSelection, ActionContext)}.
* Special constructor for clients that do not have a plugin.
* <p>
* Clients using this constructor must override
* {@link #makeProgramSelection(ProgramSelection, ActionContext)}.
*
* <p>Update: the preferred constructor for clients without a plugin is
* <p>
* Update: the preferred constructor for clients without a plugin is
* {@link #MakeProgramSelectionAction(Navigatable, String, GhidraTable)}.
*
* @param owner the action's owner
@ -66,8 +69,10 @@ public class MakeProgramSelectionAction extends DockingAction {
}
/**
* Special constructor for clients that do not have a plugin. Clients using this
* constructor must override {@link #makeProgramSelection(ProgramSelection, ActionContext)}.
* Special constructor for clients that do not have a plugin.
* <p>
* Clients using this constructor must override
* {@link #makeProgramSelection(ProgramSelection, ActionContext)}.
*
* @param navigatable the navigatable that will be used to make selections; may not be null
* @param owner the action's owner
@ -78,8 +83,10 @@ public class MakeProgramSelectionAction extends DockingAction {
}
/**
* Special constructor for clients that do not have a plugin. Clients using this
* constructor must override {@link #makeProgramSelection(ProgramSelection, ActionContext)}.
* Special constructor for clients that do not have a plugin.
* <p>
* Clients using this constructor must override
* {@link #makeProgramSelection(ProgramSelection, ActionContext)}.
*
* @param navigatable the navigatable that will be used to make selections; may not be null
* @param owner the action's owner
@ -95,8 +102,10 @@ public class MakeProgramSelectionAction extends DockingAction {
}
/**
* This normal constructor for this action. The given plugin will be used along with the
* given table to fire program selection events as the action is executed.
* The normal constructor for this action.
* <p>
* The given plugin will be used along with the given table to fire program selection events as
* the action is executed.
*
* @param plugin the plugin
* @param table the table

View file

@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -15,7 +15,8 @@
*/
package ghidra.app.plugin.core.codebrowser;
import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import javax.swing.table.TableColumnModel;
import javax.swing.table.TableModel;
@ -57,7 +58,6 @@ public class ExternalCodeBrowserNavigationTest extends AbstractCodeBrowserNaviga
GoToHelper spyGoToHelper = new GoToHelper(tool) {
@Override
public boolean goTo(final Navigatable navigatable, ProgramLocation loc, Program p) {
Msg.debug(this, "goTo() called with " + loc);
// Track last navigation location

View file

@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -23,8 +23,8 @@ import ghidra.program.util.ProgramLocation;
import ghidra.program.util.ProgramSelection;
/**
* A stub of the {@link Navigatable} interface. This can be used to supply a test navigatable
* or to spy on system internals by overriding methods as needed.
* A stub of the {@link Navigatable} interface. This can be used to supply a test navigatable or to
* spy on system internals by overriding methods as needed.
*/
public class TestDummyNavigatable implements Navigatable {
@ -148,7 +148,8 @@ public class TestDummyNavigatable implements Navigatable {
}
@Override
public void removeHighlightProvider(ListingHighlightProvider highlightProvider, Program program) {
public void removeHighlightProvider(ListingHighlightProvider highlightProvider,
Program program) {
// stub
}
}

View file

@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -23,8 +23,8 @@ import ghidra.program.util.ProgramLocation;
import ghidra.util.task.TaskMonitor;
/**
* A stub of the {@link GoToService} interface. This can be used to supply a test version
* of the service or to spy on system internals by overriding methods as needed.
* A stub of the {@link GoToService} interface. This can be used to supply a test version of the
* service or to spy on system internals by overriding methods as needed.
*/
public class TestDummyGoToService implements GoToService {

View file

@ -252,7 +252,6 @@ public class DecompilerProvider extends NavigatableComponentProviderAdapter
@Override
public boolean goTo(Program gotoProgram, ProgramLocation location) {
if (!isConnected()) {
if (program == null) {
// Special Case: this 'disconnected' provider is waiting to be initialized

View file

@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -15,7 +15,7 @@
*/
package ghidra.app.plugin.core.functiongraph;
import static ghidra.framework.model.DomainObjectEvent.*;
import static ghidra.framework.model.DomainObjectEvent.RESTORED;
import static ghidra.program.util.ProgramEvent.*;
import java.awt.event.MouseEvent;
@ -243,8 +243,9 @@ public class FGProvider extends VisualGraphComponentProvider<FGVertex, FGEdge, F
}
/**
* Gives to the clipboard of this provider the given string. This will prime the clipboard
* such that a copy action will copy the given string.
* Gives to the clipboard of this provider the given string.
* <p>
* This will prime the clipboard such that a copy action will copy the given string.
*
* @param string the string to set
*/
@ -354,9 +355,11 @@ public class FGProvider extends VisualGraphComponentProvider<FGVertex, FGEdge, F
}
/**
* Called to signal to this provider that it should update its state due to a new function
* being graphed. The UI is updated by the controller without this provider's knowledge.
* This call here is to signal that the provider needs to update its metadata.
* Called to signal to this provider that it should update its state due to a new function being
* graphed.
* <p>
* The UI is updated by the controller without this provider's knowledge. This call here is to
* signal that the provider needs to update its metadata.
*/
public void functionGraphDataChanged() {
updateTitle();
@ -480,8 +483,8 @@ public class FGProvider extends VisualGraphComponentProvider<FGVertex, FGEdge, F
}
/**
* Called when for location changes that are <b>external</b> to the function graph (e.g.,
* when the user clicks in Ghidra's Listing window)
* Called when for location changes that are <b>external</b> to the function graph (e.g., when
* the user clicks in Ghidra's Listing window)
*
* @param newLocation the new location
*/
@ -533,8 +536,7 @@ public class FGProvider extends VisualGraphComponentProvider<FGVertex, FGEdge, F
}
/**
* Tells this provider to refresh, which means to rebuild the graph and relayout the
* vertices.
* Tells this provider to refresh, which means to rebuild the graph and relayout the vertices.
*/
private void refresh(boolean keepPerspective) {
FGData functionGraphData = controller.getFunctionGraphData();
@ -563,16 +565,16 @@ public class FGProvider extends VisualGraphComponentProvider<FGVertex, FGEdge, F
}
/**
* Rebuilds the graph and restores the zoom and location of the graph to the values prior
* to rebuilding.
* Rebuilds the graph and restores the zoom and location of the graph to the values prior to
* rebuilding.
*/
public void refreshAndKeepPerspective() {
refresh(true);
}
/**
* Rebuilds the graph <b>and</b> will zoom the graph such that it fits on the screen and
* is centered.
* Rebuilds the graph <b>and</b> will zoom the graph such that it fits on the screen and is
* centered.
*/
public void refreshAndResetPerspective() {
refresh(false);
@ -643,8 +645,8 @@ public class FGProvider extends VisualGraphComponentProvider<FGVertex, FGEdge, F
}
/**
* Returns true when something destructive has happened to the data upon which the graph
* has created, like a memory block move.
* Returns true when something destructive has happened to the data upon which the graph has
* created, like a memory block move.
*/
private boolean graphDataMissing() {
FGData data = controller.getFunctionGraphData();

View file

@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -26,8 +26,8 @@ import ghidra.program.util.ProgramLocation;
import ghidra.util.task.TaskMonitor;
/**
* A service that provides the ability to go to a particular address or location in the
* right-hand listing of the Diff.
* A service that provides the ability to go to a particular address or location in the right-hand
* listing of the Diff.
*/
public class DiffGoToService implements GoToService {
@ -36,10 +36,11 @@ public class DiffGoToService implements GoToService {
private GoToHelper helper;
/**
* Creates a service that provides the ability to go to a particular address or location
* in the right-hand listing of the Diff.
* @param goToService basic GoToService for the left-side listing that this will override
* so it can go to addresses and locations in the right-side listing.
* Creates a service that provides the ability to go to a particular address or location in the
* right-hand listing of the Diff.
*
* @param goToService basic GoToService for the left-side listing that this will override so it
* can go to addresses and locations in the right-side listing.
* @param diffPlugin the plugin which provides the Diff capability.
*/
public DiffGoToService(GoToService goToService, ProgramDiffPlugin diffPlugin) {
@ -171,12 +172,13 @@ public class DiffGoToService implements GoToService {
}
private void showProgramFailureStatus() {
diffPlugin.getTool().setStatusInfo(
"Can't navigate from the Diff program to another program.");
diffPlugin.getTool()
.setStatusInfo("Can't navigate from the Diff program to another program.");
}
/**
* Go to the specified program location in the right hand Diff listing.
*
* @param loc go to this location
* @return true if the listing went to the location.
*/
@ -196,6 +198,7 @@ public class DiffGoToService implements GoToService {
/**
* Go to the specified address in the right hand Diff listing.
*
* @param addr go to this address
* @return true if the listing went to the address.
*/
@ -210,12 +213,11 @@ public class DiffGoToService implements GoToService {
}
/**
* Saving the first program's location (the left listing) in the navigation history.
* The second program's location (the right listing) isn't saved since the navigation is
* relative to a program in the tool's main listing. Also, if the second program's
* locations were saved in the history, their program wouldn't be found and would cause
* errors when restarting the application with the tool and primary program displayed, but
* no Diff program.
* Saving the first program's location (the left listing) in the navigation history. The second
* program's location (the right listing) isn't saved since the navigation is relative to a
* program in the tool's main listing. Also, if the second program's locations were saved in the
* history, their program wouldn't be found and would cause errors when restarting the
* application with the tool and primary program displayed, but no Diff program.
*/
private void saveLocation() {
Program firstProgram = diffPlugin.getFirstProgram();

View file

@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -27,9 +27,8 @@ import ghidra.util.datastruct.WeakDataStructureFactory;
import ghidra.util.datastruct.WeakSet;
/**
* This is a navigatable for use by the right-hand listing of the Diff.
* It should navigate within the Diff's listing, which would then reposition
* the CodeViewer's listing.
* This is a navigatable for use by the right-hand listing of the Diff. It should navigate within
* the Diff's listing, which would then reposition the CodeViewer's listing.
*/
class DiffNavigatable implements Navigatable {
@ -40,8 +39,11 @@ class DiffNavigatable implements Navigatable {
WeakDataStructureFactory.createCopyOnWriteWeakSet();
/**
* The navigatable for the Diff. The CodeViewerService provides Diff with a listing,
* so where appropriate this navigatable will defer to the CodeViewerService navigatable.
* The navigatable for the Diff.
* <p>
* The CodeViewerService provides Diff with a listing, so where appropriate this navigatable
* will defer to the CodeViewerService navigatable.
*
* @param diffPlugin the plugin for the Diff which can be used to obtain needed info.
* @param navigatable navigatable that the CodeViewerService provides.
*/
@ -179,7 +181,8 @@ class DiffNavigatable implements Navigatable {
}
@Override
public void removeHighlightProvider(ListingHighlightProvider highlightProvider, Program program) {
public void removeHighlightProvider(ListingHighlightProvider highlightProvider,
Program program) {
// CodeViewerProvider handles the other listing (the Diff listing) highlights.
navigatable.removeHighlightProvider(highlightProvider, program);
}

View file

@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

View file

@ -15,7 +15,8 @@
*/
package docking.widgets.fieldpanel;
import static docking.widgets.EventTrigger.*;
import static docking.widgets.EventTrigger.API_CALL;
import static docking.widgets.EventTrigger.INTERNAL_ONLY;
import java.awt.*;
import java.awt.event.*;
@ -347,6 +348,7 @@ public class FieldPanel extends JPanel
/**
* Returns true if the given field location is rendered on the screen; false if scrolled
* offscreen
*
* @param location the location
* @return true if the location is on the screen
*/
@ -689,8 +691,9 @@ public class FieldPanel extends JPanel
}
/**
* Returns the Field at the given x,y coordinates. Note the x,y must currently be visible on the
* screen or else this method will return null.
* Returns the Field at the given x,y coordinates.
* <p>
* Note the x,y must currently be visible on the screen or else this method will return null.
*
* @param x the x mouse coordinate in the component.
* @param y the y mouse coordinate in the component.
@ -841,8 +844,9 @@ public class FieldPanel extends JPanel
}
/**
* Sets the cursor on or off. When the cursor is turned off, there is no visible cursor
* displayed on the screen.
* Sets the cursor on or off.
* <p>
* When the cursor is turned off, there is no visible cursor displayed on the screen.
*
* @param cursorOn true turns the cursor on, false turns it off.
*/
@ -871,6 +875,7 @@ public class FieldPanel extends JPanel
* @param fieldNum the field on the line to go to.
* @param row the row in the field to go to.
* @param col the column in the field to go to.
* @param trigger the cause of the go to
* @param alwaysCenterCursor if true, centers cursor on screen. Otherwise, only centers cursor
* if cursor is offscreen.
*/
@ -945,8 +950,9 @@ public class FieldPanel extends JPanel
}
/**
* Returns a ViewerPosition object which contains the top of screen information. The
* ViewerPosition will have the index of the layout at the top of the screen and the yPos of
* Returns a ViewerPosition object which contains the top of screen information.
* <p>
* The ViewerPosition will have the index of the layout at the top of the screen and the yPos of
* that layout. For example, if the layout is completely displayed, yPos will be 0. If part of
* the layout is off the top off the screen, then yPos will have a negative value (indicating
* that it begins above the displayable part of the screen.
@ -962,8 +968,10 @@ public class FieldPanel extends JPanel
/**
* Scrolls the display to show the layout specified by index at the vertical position specified
* by yPos. Generally, the index will be layout at the top of the screen and the yPos will be
* &lt;= 0, meaning the layout may be partially off the top of the screen.
* by yPos.
* <p>
* Generally, the index will be layout at the top of the screen and the yPos will be &lt;= 0,
* meaning the layout may be partially off the top of the screen.
*
* @param index the index of the layout to show at the top of the screen.
* @param xPos the x position to set.
@ -1329,6 +1337,7 @@ public class FieldPanel extends JPanel
/**
* Finds the layout containing the given y position.
*
* @param y the y location
* @return the layout.
*/

View file

@ -172,11 +172,10 @@ public class VgSatelliteFeaturette<V extends VisualVertex,
return false;
}
if (!(context instanceof VisualGraphActionContext)) {
if (!(context instanceof VisualGraphActionContext vgContext)) {
return false;
}
VisualGraphActionContext vgContext = (VisualGraphActionContext) context;
return vgContext.shouldShowSatelliteActions();
}
};
@ -200,11 +199,10 @@ public class VgSatelliteFeaturette<V extends VisualVertex,
return false;
}
if (!(context instanceof VisualGraphActionContext)) {
if (!(context instanceof VisualGraphActionContext vgContext)) {
return false;
}
VisualGraphActionContext vgContext = (VisualGraphActionContext) context;
return vgContext.shouldShowSatelliteActions();
}
};