mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-13 16:36:15 +00:00
fix codacy warnings
This commit is contained in:
parent
b5a50fd62a
commit
1bec33604b
@ -26,7 +26,6 @@ import org.openide.util.Utilities;
|
|||||||
import org.openide.util.actions.Presenter;
|
import org.openide.util.actions.Presenter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* Base class for actions that act on the selected AccountDeviceInstanceKeys.
|
* Base class for actions that act on the selected AccountDeviceInstanceKeys.
|
||||||
* getPopupPresenter() provides a JMenuItem that works (i.e., has an icon) in
|
* getPopupPresenter() provides a JMenuItem that works (i.e., has an icon) in
|
||||||
* custom context menus and also in the Netbeans Explorer views.
|
* custom context menus and also in the Netbeans Explorer views.
|
||||||
@ -39,8 +38,7 @@ abstract class AbstractCVTAction extends AbstractAction implements Presenter.Pop
|
|||||||
* @return The selected accounts
|
* @return The selected accounts
|
||||||
*/
|
*/
|
||||||
Collection<? extends AccountDeviceInstanceKey> getSelectedAccounts() {
|
Collection<? extends AccountDeviceInstanceKey> getSelectedAccounts() {
|
||||||
final Collection<? extends AccountDeviceInstanceKey> lookupAll = Utilities.actionsGlobalContext().lookupAll(AccountDeviceInstanceKey.class);
|
return Utilities.actionsGlobalContext().lookupAll(AccountDeviceInstanceKey.class);
|
||||||
return lookupAll;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -64,5 +62,4 @@ abstract class AbstractCVTAction extends AbstractAction implements Presenter.Pop
|
|||||||
* @return An ImageIcon used to represent this action.
|
* @return An ImageIcon used to represent this action.
|
||||||
*/
|
*/
|
||||||
abstract ImageIcon getIcon();
|
abstract ImageIcon getIcon();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,6 @@ package org.sleuthkit.autopsy.communications;
|
|||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.common.eventbus.EventBus;
|
import com.google.common.eventbus.EventBus;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Set;
|
|
||||||
import org.sleuthkit.datamodel.CommunicationsFilter;
|
import org.sleuthkit.datamodel.CommunicationsFilter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -25,7 +25,6 @@ import com.google.common.collect.MultimapBuilder;
|
|||||||
import com.mxgraph.model.mxCell;
|
import com.mxgraph.model.mxCell;
|
||||||
import com.mxgraph.model.mxICell;
|
import com.mxgraph.model.mxICell;
|
||||||
import com.mxgraph.util.mxConstants;
|
import com.mxgraph.util.mxConstants;
|
||||||
import com.mxgraph.view.mxCellState;
|
|
||||||
import com.mxgraph.view.mxGraph;
|
import com.mxgraph.view.mxGraph;
|
||||||
import com.mxgraph.view.mxStylesheet;
|
import com.mxgraph.view.mxStylesheet;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
@ -38,7 +37,6 @@ import java.util.Map;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.CancellationException;
|
import java.util.concurrent.CancellationException;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
import java.util.function.Consumer;
|
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import javax.swing.SwingWorker;
|
import javax.swing.SwingWorker;
|
||||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||||
@ -243,20 +241,20 @@ final class CommunicationsGraph extends mxGraph {
|
|||||||
*/
|
*/
|
||||||
private class RebuildWorker extends SwingWorker<Void, Void> {
|
private class RebuildWorker extends SwingWorker<Void, Void> {
|
||||||
|
|
||||||
private final ProgressIndicator progress;
|
private final ProgressIndicator progressIndicator;
|
||||||
private final CommunicationsManager commsManager;
|
private final CommunicationsManager commsManager;
|
||||||
private final CommunicationsFilter currentFilter;
|
private final CommunicationsFilter currentFilter;
|
||||||
|
|
||||||
RebuildWorker(ProgressIndicator progress, CommunicationsManager commsManager, CommunicationsFilter currentFilter) {
|
RebuildWorker(ProgressIndicator progress, CommunicationsManager commsManager, CommunicationsFilter currentFilter) {
|
||||||
this.progress = progress;
|
this.progressIndicator = progress;
|
||||||
this.currentFilter = currentFilter;
|
this.currentFilter = currentFilter;
|
||||||
this.commsManager = commsManager;
|
this.commsManager = commsManager;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Void doInBackground() throws Exception {
|
protected Void doInBackground() {
|
||||||
progress.start("Loading accounts");
|
progressIndicator.start("Loading accounts");
|
||||||
int progressCounter = 0;
|
int progressCounter = 0;
|
||||||
try {
|
try {
|
||||||
/**
|
/**
|
||||||
@ -278,7 +276,7 @@ final class CommunicationsGraph extends mxGraph {
|
|||||||
final AccountDeviceInstanceKey relatedADIKey = new AccountDeviceInstanceKey(relatedADI, currentFilter, adiRelationshipsCount);
|
final AccountDeviceInstanceKey relatedADIKey = new AccountDeviceInstanceKey(relatedADI, currentFilter, adiRelationshipsCount);
|
||||||
relatedAccounts.put(relatedADI, relatedADIKey); //store related accounts
|
relatedAccounts.put(relatedADI, relatedADIKey); //store related accounts
|
||||||
}
|
}
|
||||||
progress.progress(++progressCounter);
|
progressIndicator.progress(++progressCounter);
|
||||||
}
|
}
|
||||||
|
|
||||||
Set<AccountDeviceInstance> accounts = relatedAccounts.keySet();
|
Set<AccountDeviceInstance> accounts = relatedAccounts.keySet();
|
||||||
@ -286,9 +284,9 @@ final class CommunicationsGraph extends mxGraph {
|
|||||||
Map<AccountPair, Long> relationshipCounts = commsManager.getRelationshipCountsPairwise(accounts, currentFilter);
|
Map<AccountPair, Long> relationshipCounts = commsManager.getRelationshipCountsPairwise(accounts, currentFilter);
|
||||||
|
|
||||||
int total = relationshipCounts.size();
|
int total = relationshipCounts.size();
|
||||||
int k = 0;
|
int progress = 0;
|
||||||
String progressText = "";
|
String progressText = "";
|
||||||
progress.switchToDeterminate("", 0, total);
|
progressIndicator.switchToDeterminate("", 0, total);
|
||||||
for (Map.Entry<AccountPair, Long> entry : relationshipCounts.entrySet()) {
|
for (Map.Entry<AccountPair, Long> entry : relationshipCounts.entrySet()) {
|
||||||
Long count = entry.getValue();
|
Long count = entry.getValue();
|
||||||
AccountPair relationshipKey = entry.getKey();
|
AccountPair relationshipKey = entry.getKey();
|
||||||
@ -300,11 +298,10 @@ final class CommunicationsGraph extends mxGraph {
|
|||||||
mxCell addEdge = addOrUpdateEdge(count, account1, account2);
|
mxCell addEdge = addOrUpdateEdge(count, account1, account2);
|
||||||
progressText = addEdge.getId();
|
progressText = addEdge.getId();
|
||||||
}
|
}
|
||||||
progress.progress(progressText, k++);
|
progressIndicator.progress(progressText, progress++);
|
||||||
}
|
}
|
||||||
} catch (TskCoreException tskCoreException) {
|
} catch (TskCoreException tskCoreException) {
|
||||||
logger.log(Level.SEVERE, "Error", tskCoreException);
|
logger.log(Level.SEVERE, "Error", tskCoreException);
|
||||||
} finally {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
@ -320,7 +317,7 @@ final class CommunicationsGraph extends mxGraph {
|
|||||||
} catch (CancellationException ex) {
|
} catch (CancellationException ex) {
|
||||||
logger.log(Level.INFO, "Graph visualization cancelled");
|
logger.log(Level.INFO, "Graph visualization cancelled");
|
||||||
} finally {
|
} finally {
|
||||||
progress.finish();
|
progressIndicator.finish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,14 +32,6 @@ import java.util.Set;
|
|||||||
*/
|
*/
|
||||||
final class LockedVertexModel {
|
final class LockedVertexModel {
|
||||||
|
|
||||||
void registerhandler(Object handler) {
|
|
||||||
eventBus.register(handler);
|
|
||||||
}
|
|
||||||
|
|
||||||
void unregisterhandler(Object handler) {
|
|
||||||
eventBus.unregister(handler);
|
|
||||||
}
|
|
||||||
|
|
||||||
private final EventBus eventBus = new EventBus();
|
private final EventBus eventBus = new EventBus();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -49,6 +41,16 @@ final class LockedVertexModel {
|
|||||||
*/
|
*/
|
||||||
private final Set<mxCell> lockedVertices = new HashSet<>();
|
private final Set<mxCell> lockedVertices = new HashSet<>();
|
||||||
|
|
||||||
|
|
||||||
|
void registerhandler(Object handler) {
|
||||||
|
eventBus.register(handler);
|
||||||
|
}
|
||||||
|
|
||||||
|
void unregisterhandler(Object handler) {
|
||||||
|
eventBus.unregister(handler);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lock the given vertices so that applying a layout algorithm doesn't move
|
* Lock the given vertices so that applying a layout algorithm doesn't move
|
||||||
* them. The user can still manually position the vertices.
|
* them. The user can still manually position the vertices.
|
||||||
|
@ -35,7 +35,6 @@ import org.sleuthkit.autopsy.corecomponents.DataResultPanel;
|
|||||||
import org.sleuthkit.autopsy.corecomponents.DataResultViewerTable;
|
import org.sleuthkit.autopsy.corecomponents.DataResultViewerTable;
|
||||||
import org.sleuthkit.autopsy.corecomponents.TableFilterNode;
|
import org.sleuthkit.autopsy.corecomponents.TableFilterNode;
|
||||||
import org.sleuthkit.autopsy.directorytree.DataResultFilterNode;
|
import org.sleuthkit.autopsy.directorytree.DataResultFilterNode;
|
||||||
import org.sleuthkit.datamodel.AccountDeviceInstance;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The right hand side of the CVT. Has a DataResultPanel to show a listing of
|
* The right hand side of the CVT. Has a DataResultPanel to show a listing of
|
||||||
|
@ -23,6 +23,10 @@ import javax.swing.ImageIcon;
|
|||||||
import org.openide.util.ImageUtilities;
|
import org.openide.util.ImageUtilities;
|
||||||
import org.openide.util.NbBundle;
|
import org.openide.util.NbBundle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Action that pins the AccountDevicesIntanceKeys in the ActionsGlobalContext to
|
||||||
|
* the visualizaion
|
||||||
|
*/
|
||||||
@NbBundle.Messages({"PinAccountsAction.pluralText=Add Selected Accounts to Visualization",
|
@NbBundle.Messages({"PinAccountsAction.pluralText=Add Selected Accounts to Visualization",
|
||||||
"PinAccountsAction.singularText=Add Selected Account to Visualization"})
|
"PinAccountsAction.singularText=Add Selected Account to Visualization"})
|
||||||
final class PinAccountsAction extends AbstractCVTAction {
|
final class PinAccountsAction extends AbstractCVTAction {
|
||||||
@ -39,7 +43,7 @@ final class PinAccountsAction extends AbstractCVTAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent event) {
|
||||||
CVTEvents.getCVTEventBus().post(new CVTEvents.PinAccountsEvent(getSelectedAccounts(), false));
|
CVTEvents.getCVTEventBus().post(new CVTEvents.PinAccountsEvent(getSelectedAccounts(), false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,9 +19,13 @@
|
|||||||
package org.sleuthkit.autopsy.communications;
|
package org.sleuthkit.autopsy.communications;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
import com.google.common.eventbus.EventBus;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Model of what accounts are pinned to a visualization.
|
||||||
|
*/
|
||||||
class PinnedAccountModel {
|
class PinnedAccountModel {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -32,6 +36,16 @@ class PinnedAccountModel {
|
|||||||
*/
|
*/
|
||||||
private final Set<AccountDeviceInstanceKey> pinnedAccountDevices = new HashSet<>();
|
private final Set<AccountDeviceInstanceKey> pinnedAccountDevices = new HashSet<>();
|
||||||
|
|
||||||
|
private final EventBus eventBus = new EventBus();
|
||||||
|
|
||||||
|
void registerhandler(Object handler) {
|
||||||
|
eventBus.register(handler);
|
||||||
|
}
|
||||||
|
|
||||||
|
void unregisterhandler(Object handler) {
|
||||||
|
eventBus.unregister(handler);
|
||||||
|
}
|
||||||
|
|
||||||
boolean isAccountPinned(AccountDeviceInstanceKey account) {
|
boolean isAccountPinned(AccountDeviceInstanceKey account) {
|
||||||
return pinnedAccountDevices.contains(account);
|
return pinnedAccountDevices.contains(account);
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,8 @@ import org.openide.util.ImageUtilities;
|
|||||||
import org.openide.util.NbBundle;
|
import org.openide.util.NbBundle;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Action that clears any pinned accounts and pins the AcountDevicesInstanceKeys
|
||||||
|
* in the ActionsGlobalContext to the visualization.
|
||||||
*/
|
*/
|
||||||
@NbBundle.Messages(value = {"ResetAndPinAccountsAction.singularText=Visualize Only Selected Account",
|
@NbBundle.Messages(value = {"ResetAndPinAccountsAction.singularText=Visualize Only Selected Account",
|
||||||
"ResetAndPinAccountsAction.pluralText=Visualize Only Selected Accounts"})
|
"ResetAndPinAccountsAction.pluralText=Visualize Only Selected Accounts"})
|
||||||
@ -42,7 +43,7 @@ final class ResetAndPinAccountsAction extends AbstractCVTAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent event) {
|
||||||
CVTEvents.getCVTEventBus().post(new CVTEvents.PinAccountsEvent(getSelectedAccounts(), true));
|
CVTEvents.getCVTEventBus().post(new CVTEvents.PinAccountsEvent(getSelectedAccounts(), true));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,5 +56,4 @@ final class ResetAndPinAccountsAction extends AbstractCVTAction {
|
|||||||
ImageIcon getIcon() {
|
ImageIcon getIcon() {
|
||||||
return ICON;
|
return ICON;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,6 @@ package org.sleuthkit.autopsy.communications;
|
|||||||
|
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@ -48,7 +47,7 @@ import org.sleuthkit.datamodel.TskCoreException;
|
|||||||
*/
|
*/
|
||||||
final class SelectionNode extends AbstractNode {
|
final class SelectionNode extends AbstractNode {
|
||||||
|
|
||||||
SelectionNode(Children children, Lookup lookup) {
|
private SelectionNode(Children children, Lookup lookup) {
|
||||||
super(children, lookup);
|
super(children, lookup);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,9 +129,9 @@ final class SelectionNode extends AbstractNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Node createNodeForKey(Content t) {
|
protected Node createNodeForKey(Content content) {
|
||||||
if (t instanceof BlackboardArtifact) {
|
if (content instanceof BlackboardArtifact) {
|
||||||
return new RelationshipNode((BlackboardArtifact) t);
|
return new RelationshipNode((BlackboardArtifact) content);
|
||||||
} else {
|
} else {
|
||||||
throw new UnsupportedOperationException("Cannot create a RelationshipNode for non BlackboardArtifact content.");
|
throw new UnsupportedOperationException("Cannot create a RelationshipNode for non BlackboardArtifact content.");
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,10 @@ import javax.swing.ImageIcon;
|
|||||||
import org.openide.util.ImageUtilities;
|
import org.openide.util.ImageUtilities;
|
||||||
import org.openide.util.NbBundle;
|
import org.openide.util.NbBundle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Action that unpins the AcccountDeviceInstanceKeys in the ActionsGlobalContext
|
||||||
|
* form the visualization.
|
||||||
|
*/
|
||||||
@NbBundle.Messages({"UnpinAccountsAction.pluralText=Remove Selected Accounts",
|
@NbBundle.Messages({"UnpinAccountsAction.pluralText=Remove Selected Accounts",
|
||||||
"UnpinAccountsAction.singularText=Remove Selected Account"})
|
"UnpinAccountsAction.singularText=Remove Selected Account"})
|
||||||
final class UnpinAccountsAction extends AbstractCVTAction {
|
final class UnpinAccountsAction extends AbstractCVTAction {
|
||||||
|
@ -873,7 +873,10 @@ final public class VisualizationPanel extends JPanel implements Lookup.Provider
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class CancelationListener implements ActionListener {
|
/**
|
||||||
|
* Listener that closes a ModalDialogProgreessIndicator when invoked.
|
||||||
|
*/
|
||||||
|
final private class CancelationListener implements ActionListener {
|
||||||
|
|
||||||
private Future<?> cancellable;
|
private Future<?> cancellable;
|
||||||
private ModalDialogProgressIndicator progress;
|
private ModalDialogProgressIndicator progress;
|
||||||
@ -891,6 +894,9 @@ final public class VisualizationPanel extends JPanel implements Lookup.Provider
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Action that un-locks the selected vertices.
|
||||||
|
*/
|
||||||
@NbBundle.Messages({
|
@NbBundle.Messages({
|
||||||
"VisualizationPanel.unlockAction.singularText=Unlock Selected Account",
|
"VisualizationPanel.unlockAction.singularText=Unlock Selected Account",
|
||||||
"VisualizationPanel.unlockAction.pluralText=Unlock Selected Accounts",})
|
"VisualizationPanel.unlockAction.pluralText=Unlock Selected Accounts",})
|
||||||
@ -911,6 +917,9 @@ final public class VisualizationPanel extends JPanel implements Lookup.Provider
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Action that locks the selected vertices.
|
||||||
|
*/
|
||||||
@NbBundle.Messages({
|
@NbBundle.Messages({
|
||||||
"VisualizationPanel.lockAction.singularText=Lock Selected Account",
|
"VisualizationPanel.lockAction.singularText=Lock Selected Account",
|
||||||
"VisualizationPanel.lockAction.pluralText=Lock Selected Accounts"})
|
"VisualizationPanel.lockAction.pluralText=Lock Selected Accounts"})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user