19 package org.sleuthkit.autopsy.corecomponents;
21 import java.beans.PropertyChangeEvent;
22 import java.util.ArrayList;
23 import java.util.List;
24 import java.util.logging.Level;
25 import javax.swing.JTabbedPane;
26 import org.openide.explorer.ExplorerManager;
27 import org.openide.explorer.ExplorerUtils;
28 import org.openide.nodes.Node;
29 import org.openide.util.NbBundle;
30 import org.openide.windows.TopComponent;
31 import org.openide.windows.WindowManager;
43 @SuppressWarnings(
"PMD.SingularField")
50 private static final long serialVersionUID = 1L;
55 private final ExplorerManager explorerManager =
new ExplorerManager();
60 private static final ArrayList<DataContentTopComponent> newWindowList =
new ArrayList<>();
61 private static final String PREFERRED_ID =
"DataContentTopComponent";
62 private static final String DEFAULT_NAME = NbBundle.getMessage(
DataContentTopComponent.class,
"CTL_DataContentTopComponent");
63 private static final String TOOLTIP_TEXT = NbBundle.getMessage(
DataContentTopComponent.class,
"HINT_DataContentTopComponent");
68 setToolTipText(TOOLTIP_TEXT);
70 this.isDefault = isDefault;
73 add(dataContentPanel);
75 associateLookup(ExplorerUtils.createLookup(explorerManager, getActionMap()));
77 putClientProperty(TopComponent.PROP_CLOSING_DISABLED, isDefault);
78 logger.log(Level.INFO,
"Created DataContentTopComponent instance: {0}",
this);
96 newWindowList.add(dctc);
110 if (defaultInstance == null) {
113 return defaultInstance;
123 TopComponent win = WindowManager.
getDefault().findTopComponent(PREFERRED_ID);
125 logger.log(Level.INFO,
"Cannot find " + PREFERRED_ID +
" component. It will "
126 +
"not be located properly in the window system.");
131 return (DataContentTopComponent) win;
134 logger.log(Level.INFO,
"There seem to be multiple components with the '" + PREFERRED_ID
135 +
"' ID. That is a potential source of errors and unexpected behavior.");
142 return explorerManager;
147 return TopComponent.PERSISTENCE_NEVER;
157 dataContentPanel.
setNode(null);
159 if (!this.isDefault) {
160 newWindowList.remove(
this);
166 if (this.isDefault) {
169 return this.getName();
175 dataContentPanel.
setNode(selectedNode);
176 this.selectedNode = selectedNode;
193 return (this.isDefault ==
false) ||( openCase.
hasData() ==
false);
224 return newWindowList;
235 setLayout(
new javax.swing.BoxLayout(
this, javax.swing.BoxLayout.Y_AXIS));
ExplorerManager getExplorerManager()
static synchronized DataContentTopComponent getDefault()
void setNode(Node selectedNode)
JTabbedPane getTabPanels()
void setNode(Node selectedNode)
final DataContentPanel dataContentPanel
static DataContentTopComponent createUndocked(String filePath, Node givenNode)
DataContentTopComponent(boolean isDefault, String name)
static synchronized DataContentTopComponent findInstance()
JTabbedPane getTabPanels()
static DataContentTopComponent defaultInstance
static List< DataContentTopComponent > getNewWindowList()
synchronized static Logger getLogger(String name)
static Case getCurrentCaseThrows()
void propertyChange(PropertyChangeEvent evt)