mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-06 12:00:04 +02:00
Merge remote-tracking branch 'origin/dragonmacher-GT-2705-9.0' into Ghidra_9.0.2
This commit is contained in:
commit
b82a0115a1
37 changed files with 441 additions and 694 deletions
|
@ -47,7 +47,12 @@ public class ActionContext {
|
|||
}
|
||||
|
||||
/**
|
||||
* For Testing
|
||||
* Constructor
|
||||
*
|
||||
* @param provider the ComponentProvider that generated this context.
|
||||
* @param contextObject an optional contextObject that the ComponentProvider can provide
|
||||
* @param sourceObject an optional source object; this can be anything that actions wish to
|
||||
* later retrieve
|
||||
*/
|
||||
public ActionContext(ComponentProvider provider, Object contextObject, Object sourceObject) {
|
||||
this(provider, contextObject);
|
||||
|
@ -55,8 +60,8 @@ public class ActionContext {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the {@link #ComponentProvider} that generated this ActionContext
|
||||
* @return
|
||||
* Returns the {@link ComponentProvider} that generated this ActionContext
|
||||
* @return the provider
|
||||
*/
|
||||
public ComponentProvider getComponentProvider() {
|
||||
return provider;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
/* ###
|
||||
* 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.
|
||||
|
@ -19,69 +18,75 @@ package docking.widgets.tree.support;
|
|||
import java.awt.datatransfer.*;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import docking.widgets.tree.GTreeNode;
|
||||
|
||||
/**
|
||||
* A transferable for sharing data via drag/drop and clipboard operations for GTrees.
|
||||
* A transferable for sharing data via drag/drop and clipboard operations for GTrees
|
||||
*/
|
||||
public class GTreeNodeTransferable implements Transferable {
|
||||
private final List<GTreeNode> selectedData;
|
||||
private final GTreeTransferHandler transferHandler;
|
||||
private final List<GTreeNode> selectedData;
|
||||
private final GTreeTransferHandler transferHandler;
|
||||
|
||||
/**
|
||||
* Creates this transferable based upon the selected data and uses the given transfer
|
||||
* handler to perform {@link Transferable} operations.
|
||||
* @param handler the handler used to perform transfer operations.
|
||||
* @param selectedData The
|
||||
*/
|
||||
public GTreeNodeTransferable( GTreeTransferHandler handler, List<GTreeNode> selectedData) {
|
||||
this.selectedData = selectedData;
|
||||
this.transferHandler = handler;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all of the original selected data contained by this transferable.
|
||||
* @return all of the original selected data contained by this transferable
|
||||
*/
|
||||
public List<GTreeNode> getAllData() {
|
||||
return selectedData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the transfer data from the selection based upon the given flavor.
|
||||
* @param transferNodes The nodes from which to get the data.
|
||||
* @param flavor The flavor of data to retreive from the given selection.
|
||||
* @return the transfer data from the selection based upon the given flavor.
|
||||
* @throws UnsupportedFlavorException if the given flavor is not one of the supported flavors
|
||||
* returned by {@link #getSupportedDataFlavors(List)}.
|
||||
*/
|
||||
public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException {
|
||||
return transferHandler.getTransferData(selectedData, flavor);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the DataFlavors for the types of data that this transferable supports, based upon
|
||||
* the given selection.
|
||||
* @param transferNodes The nodes to base the DataFlavor selection upon.
|
||||
* @return the DataFlavors for the types of data that this transferable supports, based upon
|
||||
* the given selection.
|
||||
/**
|
||||
* Creates this transferable based upon the selected data and uses the given transfer
|
||||
* handler to perform {@link Transferable} operations
|
||||
*
|
||||
* @param handler the handler used to perform transfer operations
|
||||
* @param selectedData The selected tree nodes
|
||||
*/
|
||||
public DataFlavor[] getTransferDataFlavors() {
|
||||
return transferHandler.getSupportedDataFlavors(selectedData);
|
||||
}
|
||||
public GTreeNodeTransferable(GTreeTransferHandler handler, List<GTreeNode> selectedData) {
|
||||
this.transferHandler = Objects.requireNonNull(handler);
|
||||
this.selectedData = Objects.requireNonNull(selectedData);
|
||||
}
|
||||
|
||||
/**
|
||||
* A convenience method to determine if this transferable supports the given flavor.
|
||||
* @return true if this transferable supports the given flavor.
|
||||
*/
|
||||
public boolean isDataFlavorSupported(DataFlavor flavor) {
|
||||
DataFlavor[] flavors = transferHandler.getSupportedDataFlavors(selectedData);
|
||||
for(int i=0;i<flavors.length;i++) {
|
||||
if (flavors[i].equals(flavor)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Returns all of the original selected data contained by this transferable.
|
||||
* @return all of the original selected data contained by this transferable
|
||||
*/
|
||||
public List<GTreeNode> getAllData() {
|
||||
return selectedData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the transfer data from the selection based upon the given flavor
|
||||
|
||||
* @param flavor The flavor of data to retrieve from the given selection.
|
||||
* @return the transfer data from the selection based upon the given flavor.
|
||||
* @throws UnsupportedFlavorException if the given flavor is not one of the supported flavors
|
||||
* returned by {@link #getTransferDataFlavors()}
|
||||
*/
|
||||
@Override
|
||||
public Object getTransferData(DataFlavor flavor)
|
||||
throws UnsupportedFlavorException, IOException {
|
||||
return transferHandler.getTransferData(selectedData, flavor);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the DataFlavors for the types of data that this transferable supports, based upon
|
||||
* the given selection
|
||||
*
|
||||
* @return the DataFlavors for the types of data that this transferable supports, based upon
|
||||
* the given selection
|
||||
*/
|
||||
@Override
|
||||
public DataFlavor[] getTransferDataFlavors() {
|
||||
return transferHandler.getSupportedDataFlavors(selectedData);
|
||||
}
|
||||
|
||||
/**
|
||||
* A convenience method to determine if this transferable supports the given flavor
|
||||
* @return true if this transferable supports the given flavor
|
||||
*/
|
||||
@Override
|
||||
public boolean isDataFlavorSupported(DataFlavor flavor) {
|
||||
DataFlavor[] flavors = transferHandler.getSupportedDataFlavors(selectedData);
|
||||
for (DataFlavor f : flavors) {
|
||||
if (f.equals(flavor)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue