mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-06 03:50:02 +02:00
Merge remote-tracking branch 'origin/patch'
Conflicts: Ghidra/Framework/Project/src/main/java/ghidra/framework/main/datatree/FindCheckoutsDialog.java
This commit is contained in:
commit
67f3bb2b79
2 changed files with 27 additions and 22 deletions
|
@ -32,8 +32,6 @@ import docking.widgets.table.GTableCellRenderingData;
|
|||
import docking.widgets.table.threaded.GThreadedTablePanel;
|
||||
import docking.widgets.table.threaded.ThreadedTableModelListener;
|
||||
import ghidra.framework.main.datatable.ProjectDataActionContext;
|
||||
import ghidra.framework.main.projectdata.actions.VersionControlCheckInAction;
|
||||
import ghidra.framework.main.projectdata.actions.VersionControlUndoCheckOutAction;
|
||||
import ghidra.framework.model.DomainFile;
|
||||
import ghidra.framework.model.DomainFolder;
|
||||
import ghidra.framework.plugintool.Plugin;
|
||||
|
@ -49,8 +47,6 @@ public class FindCheckoutsDialog extends DialogComponentProvider {
|
|||
private Plugin plugin;
|
||||
private DomainFolder folder;
|
||||
private JTable table;
|
||||
private VersionControlCheckInAction checkInAction;
|
||||
private VersionControlUndoCheckOutAction undoCheckOutAction;
|
||||
private boolean showMessage = true;
|
||||
private GThreadedTablePanel<CheckoutInfo> threadedTablePanel;
|
||||
|
||||
|
@ -107,28 +103,12 @@ public class FindCheckoutsDialog extends DialogComponentProvider {
|
|||
column.setPreferredWidth(180);
|
||||
}
|
||||
}
|
||||
|
||||
table.setPreferredScrollableViewportSize(
|
||||
new Dimension(threadedTablePanel.getPreferredSize().width, 150));
|
||||
table.getSelectionModel().addListSelectionListener(e -> setActionsEnabled());
|
||||
|
||||
addWorkPanel(threadedTablePanel);
|
||||
addDismissButton();
|
||||
|
||||
createActions();
|
||||
}
|
||||
|
||||
private void createActions() {
|
||||
checkInAction = new VersionControlCheckInAction(plugin, table);
|
||||
undoCheckOutAction = new VersionControlUndoCheckOutAction(plugin);
|
||||
|
||||
addAction(checkInAction);
|
||||
addAction(undoCheckOutAction);
|
||||
setActionsEnabled();
|
||||
}
|
||||
|
||||
private void setActionsEnabled() {
|
||||
boolean hasSelection = table.getSelectedRowCount() > 0;
|
||||
checkInAction.setEnabled(hasSelection);
|
||||
undoCheckOutAction.setEnabled(hasSelection);
|
||||
}
|
||||
|
||||
private List<DomainFile> getFileList() {
|
||||
|
|
|
@ -16,15 +16,19 @@
|
|||
package ghidra.framework.main.projectdata.actions;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.swing.Icon;
|
||||
|
||||
import docking.action.MenuData;
|
||||
import docking.action.ToolBarData;
|
||||
import docking.widgets.OptionDialog;
|
||||
import ghidra.framework.client.*;
|
||||
import ghidra.framework.main.datatable.ProjectDataTreeContextAction;
|
||||
import ghidra.framework.main.datatree.FindCheckoutsDialog;
|
||||
import ghidra.framework.main.datatree.ProjectDataTreeActionContext;
|
||||
import ghidra.framework.model.DomainFolder;
|
||||
import ghidra.framework.model.ProjectData;
|
||||
import ghidra.framework.plugintool.Plugin;
|
||||
import ghidra.util.HelpLocation;
|
||||
import resources.MultiIcon;
|
||||
|
@ -52,6 +56,27 @@ public class FindCheckoutsAction extends ProjectDataTreeContextAction {
|
|||
@Override
|
||||
protected void actionPerformed(ProjectDataTreeActionContext context) {
|
||||
DomainFolder domainFolder = context.getSelectedFolders().get(0);
|
||||
ProjectData projectData = domainFolder.getProjectData();
|
||||
RepositoryAdapter repository = projectData.getRepository();
|
||||
if (repository != null && !repository.isConnected()) {
|
||||
if (OptionDialog.OPTION_ONE != OptionDialog.showOptionDialogWithCancelAsDefaultButton(
|
||||
null, "Find Checkouts...",
|
||||
"Action requires connection to repository.\nWould you like to connect now?",
|
||||
"Connect", OptionDialog.QUESTION_MESSAGE)) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
repository.connect();
|
||||
}
|
||||
catch (NotConnectedException e) {
|
||||
// ignore - likely caused by cancellation
|
||||
return;
|
||||
}
|
||||
catch (IOException e) {
|
||||
ClientUtil.handleException(repository, e, "Find Checkouts", null);
|
||||
return;
|
||||
}
|
||||
}
|
||||
findCheckouts(domainFolder, context.getComponent());
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue