Autopsy  4.19.3
Graphical digital forensics platform for The Sleuth Kit and other tools.
NewWindowViewAction.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2011-2014 Basis Technology Corp.
5  * Contact: carrier <at> sleuthkit <dot> org
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 package org.sleuthkit.autopsy.directorytree;
20 
21 import java.awt.event.ActionEvent;
22 import java.util.logging.Level;
23 import javax.swing.AbstractAction;
24 import javax.swing.SwingUtilities;
25 import org.openide.nodes.Node;
26 import org.openide.windows.Mode;
27 import org.openide.windows.WindowManager;
30 import org.sleuthkit.datamodel.Content;
31 import org.sleuthkit.datamodel.TskCoreException;
32 
36 public class NewWindowViewAction extends AbstractAction {
37 
38  private static Logger logger = Logger.getLogger(NewWindowViewAction.class.getName());
39 
40  private Node contentNode;
41 
42  public NewWindowViewAction(String title, Node contentNode) {
43  super(title);
44  this.contentNode = contentNode;
45  }
46 
47  @Override
48  public void actionPerformed(ActionEvent e) {
49  String name = "DataContent"; //NON-NLS
50  String s = contentNode.getLookup().lookup(String.class);
51  if (s != null) {
52  name = s;
53  } else {
54  Content c = contentNode.getLookup().lookup(Content.class);
55  if (c != null) {
56  try {
57  name = c.getUniquePath();
58  } catch (TskCoreException ex) {
59  logger.log(Level.SEVERE, "Except while calling Content.getUniquePath() on " + c); //NON-NLS
60  }
61  }
62  }
63 
65 
66  Mode m = WindowManager.getDefault().findMode("outputFloat"); //NON-NLS
67  m.dockInto(dctc);
68  dctc.open();
69 
70  // Queue setting the node on the EDT thread to be done later so the dctc
71  // can completely initialize.
72  SwingUtilities.invokeLater(new Runnable() {
73  @Override
74  public void run() {
75  dctc.setNode(contentNode);
76  dctc.toFront();
77  dctc.requestActive();
78  }
79  });
80  }
81 
82 }
static DataContentTopComponent createUndocked(String filePath, Node givenNode)
synchronized static Logger getLogger(String name)
Definition: Logger.java:124

Copyright © 2012-2022 Basis Technology. Generated on: Thu Dec 8 2022
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.