Autopsy  3.1
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 
20 package org.sleuthkit.autopsy.directorytree;
21 
22 import java.awt.event.ActionEvent;
23 import java.util.logging.Level;
24 import javax.swing.AbstractAction;
25 import javax.swing.SwingUtilities;
26 import org.openide.nodes.Node;
27 import org.openide.windows.Mode;
28 import org.openide.windows.WindowManager;
33 
37 public class NewWindowViewAction extends AbstractAction{
38 
39  private static Logger logger = Logger.getLogger(NewWindowViewAction.class.getName());
40 
41  private Node contentNode ;
42 
43  public NewWindowViewAction(String title, Node contentNode){
44  super(title);
45  this.contentNode = contentNode;
46  }
47 
48  @Override
49  public void actionPerformed(ActionEvent e) {
50  String name = "DataContent"; //NON-NLS
51  String s = contentNode.getLookup().lookup(String.class);
52  if (s != null) {
53  name = s;
54  } else {
55  Content c = contentNode.getLookup().lookup(Content.class);
56  if (c != null) {
57  try {
58  name = c.getUniquePath();
59  } catch (TskCoreException ex) {
60  logger.log(Level.SEVERE, "Except while calling Content.getUniquePath() on " + c); //NON-NLS
61  }
62  }
63  }
64 
66 
67  Mode m = WindowManager.getDefault().findMode("outputFloat"); //NON-NLS
68  m.dockInto(dctc);
69  dctc.open();
70 
71  // Queue setting the node on the EDT thread to be done later so the dctc
72  // can completely initialize.
73  SwingUtilities.invokeLater(new Runnable() {
74  @Override
75  public void run() {
76  dctc.setNode(contentNode);
77  dctc.toFront();
78  dctc.requestActive();
79  }
80  });
81  }
82 
83 
84 
85 }
static DataContentTopComponent createUndocked(String filePath, Node givenNode)
static Logger getLogger(String name)
Definition: Logger.java:131

Copyright © 2012-2015 Basis Technology. Generated on: Mon Oct 19 2015
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.