Autopsy  3.1
Graphical digital forensics platform for The Sleuth Kit and other tools.
DataResultViewerThumbnail.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2013 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.corecomponents;
20 
21 import java.awt.Color;
22 import java.awt.Cursor;
23 import java.awt.EventQueue;
24 import java.beans.PropertyChangeEvent;
25 import java.beans.PropertyChangeListener;
26 import java.util.Arrays;
27 import java.util.concurrent.ExecutionException;
28 import java.util.logging.Level;
29 import javax.swing.JOptionPane;
30 
31 import org.openide.util.NbBundle;
33 import javax.swing.ListSelectionModel;
34 import javax.swing.SwingWorker;
35 import org.netbeans.api.progress.ProgressHandle;
36 import org.netbeans.api.progress.ProgressHandleFactory;
37 import org.openide.DialogDisplayer;
38 import org.openide.NotifyDescriptor;
39 import org.openide.explorer.ExplorerManager;
40 import org.openide.explorer.view.IconView;
41 import org.openide.nodes.AbstractNode;
42 import org.openide.nodes.Children;
43 import org.openide.nodes.Node;
44 import org.openide.nodes.NodeEvent;
45 import org.openide.nodes.NodeListener;
46 import org.openide.nodes.NodeMemberEvent;
47 import org.openide.nodes.NodeReorderEvent;
48 import org.openide.util.Exceptions;
53 
62 // @@@ Restore implementation of DataResultViewerThumbnail as a DataResultViewer
63 // service provider when DataResultViewers can be made compatible with node
64 // multi-selection actions.
65 //@ServiceProvider(service = DataResultViewer.class)
66  final class DataResultViewerThumbnail extends AbstractDataResultViewer {
67 
68  private static final Logger logger = Logger.getLogger(DataResultViewerThumbnail.class.getName());
69  //flag to keep track if images are being loaded
70  private int curPage;
71  private int totalPages;
72  private int curPageImages;
73  private int iconSize = ImageUtils.ICON_SIZE_MEDIUM;
74  private final PageUpdater pageUpdater = new PageUpdater();
75 
80  public DataResultViewerThumbnail(ExplorerManager explorerManager) {
81  super(explorerManager);
82  initialize();
83  }
84 
89  public DataResultViewerThumbnail() {
90  initialize();
91  }
92 
93  private void initialize() {
94  initComponents();
95 
96  ((IconView) thumbnailScrollPanel).setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
97  em.addPropertyChangeListener(new ExplorerManagerNodeSelectionListener());
98 
99  curPage = -1;
100  totalPages = 0;
101  curPageImages = 0;
102  }
103 
109  @SuppressWarnings("unchecked")
110  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
111  private void initComponents() {
112 
113  thumbnailScrollPanel = new IconView();
114  pageLabel = new javax.swing.JLabel();
115  pagesLabel = new javax.swing.JLabel();
116  pagePrevButton = new javax.swing.JButton();
117  pageNextButton = new javax.swing.JButton();
118  imagesLabel = new javax.swing.JLabel();
119  imagesRangeLabel = new javax.swing.JLabel();
120  pageNumLabel = new javax.swing.JLabel();
121  filePathLabel = new javax.swing.JLabel();
122  goToPageLabel = new javax.swing.JLabel();
123  goToPageField = new javax.swing.JTextField();
124  thumbnailSizeComboBox = new javax.swing.JComboBox<>();
125 
126  thumbnailScrollPanel.setPreferredSize(new java.awt.Dimension(582, 348));
127 
128  pageLabel.setText(org.openide.util.NbBundle.getMessage(DataResultViewerThumbnail.class, "DataResultViewerThumbnail.pageLabel.text")); // NOI18N
129 
130  pagesLabel.setText(org.openide.util.NbBundle.getMessage(DataResultViewerThumbnail.class, "DataResultViewerThumbnail.pagesLabel.text")); // NOI18N
131 
132  pagePrevButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/corecomponents/btn_step_back.png"))); // NOI18N NON-NLS
133  pagePrevButton.setText(org.openide.util.NbBundle.getMessage(DataResultViewerThumbnail.class, "DataResultViewerThumbnail.pagePrevButton.text")); // NOI18N
134  pagePrevButton.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/corecomponents/btn_step_back_disabled.png"))); // NOI18N NON-NLS
135  pagePrevButton.setMargin(new java.awt.Insets(2, 0, 2, 0));
136  pagePrevButton.setPreferredSize(new java.awt.Dimension(55, 23));
137  pagePrevButton.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/corecomponents/btn_step_back_hover.png"))); // NOI18N NON-NLS
138  pagePrevButton.addActionListener(new java.awt.event.ActionListener() {
139  public void actionPerformed(java.awt.event.ActionEvent evt) {
140  pagePrevButtonActionPerformed(evt);
141  }
142  });
143 
144  pageNextButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/corecomponents/btn_step_forward.png"))); // NOI18N NON-NLS
145  pageNextButton.setText(org.openide.util.NbBundle.getMessage(DataResultViewerThumbnail.class, "DataResultViewerThumbnail.pageNextButton.text")); // NOI18N
146  pageNextButton.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/corecomponents/btn_step_forward_disabled.png"))); // NOI18N NON-NLS
147  pageNextButton.setMargin(new java.awt.Insets(2, 0, 2, 0));
148  pageNextButton.setMaximumSize(new java.awt.Dimension(27, 23));
149  pageNextButton.setMinimumSize(new java.awt.Dimension(27, 23));
150  pageNextButton.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/corecomponents/btn_step_forward_hover.png"))); // NOI18N NON-NLS
151  pageNextButton.addActionListener(new java.awt.event.ActionListener() {
152  public void actionPerformed(java.awt.event.ActionEvent evt) {
153  pageNextButtonActionPerformed(evt);
154  }
155  });
156 
157  imagesLabel.setText(org.openide.util.NbBundle.getMessage(DataResultViewerThumbnail.class, "DataResultViewerThumbnail.imagesLabel.text")); // NOI18N
158 
159  imagesRangeLabel.setText(org.openide.util.NbBundle.getMessage(DataResultViewerThumbnail.class, "DataResultViewerThumbnail.imagesRangeLabel.text")); // NOI18N
160 
161  pageNumLabel.setText(org.openide.util.NbBundle.getMessage(DataResultViewerThumbnail.class, "DataResultViewerThumbnail.pageNumLabel.text")); // NOI18N
162 
163  filePathLabel.setText(org.openide.util.NbBundle.getMessage(DataResultViewerThumbnail.class, "DataResultViewerThumbnail.filePathLabel.text")); // NOI18N
164 
165  goToPageLabel.setText(org.openide.util.NbBundle.getMessage(DataResultViewerThumbnail.class, "DataResultViewerThumbnail.goToPageLabel.text")); // NOI18N
166 
167  goToPageField.setText(org.openide.util.NbBundle.getMessage(DataResultViewerThumbnail.class, "DataResultViewerThumbnail.goToPageField.text")); // NOI18N
168  goToPageField.addActionListener(new java.awt.event.ActionListener() {
169  public void actionPerformed(java.awt.event.ActionEvent evt) {
170  goToPageFieldActionPerformed(evt);
171  }
172  });
173 
174  thumbnailSizeComboBox.setModel(new javax.swing.DefaultComboBoxModel<String>(new String[] {
175  NbBundle.getMessage(this.getClass(), "DataResultViewerThumbnail.comboBox.smallThumbnails"),
176  NbBundle.getMessage(this.getClass(), "DataResultViewerThumbnail.comboBox.mediumThumbnails"),
177  NbBundle.getMessage(this.getClass(), "DataResultViewerThumbnail.comboBox.largeThumbnails") }));
178  thumbnailSizeComboBox.addActionListener(new java.awt.event.ActionListener() {
179  public void actionPerformed(java.awt.event.ActionEvent evt) {
180  thumbnailSizeComboBoxActionPerformed(evt);
181  }
182  });
183 
184  javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
185  this.setLayout(layout);
186  layout.setHorizontalGroup(
187  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
188  .addComponent(thumbnailScrollPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 642, Short.MAX_VALUE)
189  .addGroup(layout.createSequentialGroup()
190  .addContainerGap()
191  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
192  .addComponent(filePathLabel)
193  .addGroup(layout.createSequentialGroup()
194  .addComponent(pageLabel)
195  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
196  .addComponent(pageNumLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)
197  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
198  .addComponent(pagesLabel)
199  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
200  .addComponent(pagePrevButton, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
201  .addGap(0, 0, 0)
202  .addComponent(pageNextButton, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
203  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
204  .addComponent(goToPageLabel)
205  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
206  .addComponent(goToPageField, javax.swing.GroupLayout.PREFERRED_SIZE, 54, javax.swing.GroupLayout.PREFERRED_SIZE)
207  .addGap(12, 12, 12)
208  .addComponent(imagesLabel)
209  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
210  .addComponent(imagesRangeLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE)
211  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
212  .addComponent(thumbnailSizeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
213  .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
214  );
215  layout.setVerticalGroup(
216  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
217  .addGroup(layout.createSequentialGroup()
218  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
219  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
220  .addComponent(pageLabel)
221  .addComponent(pagesLabel)
222  .addComponent(pagePrevButton, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
223  .addComponent(pageNumLabel))
224  .addComponent(pageNextButton, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
225  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
226  .addComponent(imagesLabel)
227  .addComponent(imagesRangeLabel)
228  .addComponent(goToPageLabel)
229  .addComponent(goToPageField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
230  .addComponent(thumbnailSizeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
231  .addGap(0, 0, 0)
232  .addComponent(thumbnailScrollPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
233  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
234  .addComponent(filePathLabel))
235  );
236  }// </editor-fold>//GEN-END:initComponents
237 
238  private void pagePrevButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_pagePrevButtonActionPerformed
239  previousPage();
240  }//GEN-LAST:event_pagePrevButtonActionPerformed
241 
242  private void pageNextButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_pageNextButtonActionPerformed
243  nextPage();
244  }//GEN-LAST:event_pageNextButtonActionPerformed
245 
246  private void goToPageFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_goToPageFieldActionPerformed
247  goToPage(goToPageField.getText());
248  }//GEN-LAST:event_goToPageFieldActionPerformed
249 
250  private void thumbnailSizeComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_thumbnailSizeComboBoxActionPerformed
251 
252  iconSize = ImageUtils.ICON_SIZE_MEDIUM; //default size
253  switch(thumbnailSizeComboBox.getSelectedIndex()) {
254  case 0:
255  iconSize = ImageUtils.ICON_SIZE_SMALL;
256  break;
257  case 2:
258  iconSize = ImageUtils.ICON_SIZE_LARGE;
259  break;
260  }
261 
262  Node root = em.getRootContext();
263  for (Children c : Arrays.asList(root.getChildren()) ) {
264  ((ThumbnailViewChildren)c).setIconSize(iconSize);
265  }
266 
267  for (Node page : root.getChildren().getNodes()) {
268  for (Node node : page.getChildren().getNodes()) {
269  ((ThumbnailViewNode)node).setIconSize(iconSize);
270  }
271  }
272 
273  // Temporarily set the explored context to the root, instead of a child node.
274  // This is a workaround hack to convince org.openide.explorer.ExplorerManager to
275  // update even though the new and old Node values are identical. This in turn
276  // will cause the entire view to update completely. After this we
277  // immediately set the node back to the current child by calling switchPage().
278  em.setExploredContext(root);
279  switchPage();
280  }//GEN-LAST:event_thumbnailSizeComboBoxActionPerformed
281 
282  // Variables declaration - do not modify//GEN-BEGIN:variables
283  private javax.swing.JLabel filePathLabel;
284  private javax.swing.JTextField goToPageField;
285  private javax.swing.JLabel goToPageLabel;
286  private javax.swing.JLabel imagesLabel;
287  private javax.swing.JLabel imagesRangeLabel;
288  private javax.swing.JLabel pageLabel;
289  private javax.swing.JButton pageNextButton;
290  private javax.swing.JLabel pageNumLabel;
291  private javax.swing.JButton pagePrevButton;
292  private javax.swing.JLabel pagesLabel;
293  private javax.swing.JScrollPane thumbnailScrollPanel;
294  private javax.swing.JComboBox<String> thumbnailSizeComboBox;
295  // End of variables declaration//GEN-END:variables
296 
297  @Override
298  public boolean isSupported(Node selectedNode) {
299  if (selectedNode == null) {
300  return false;
301  }
302  return true;
303  }
304 
305  @Override
306  public void setNode(Node givenNode) {
307  // change the cursor to "waiting cursor" for this operation
308  setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
309  try {
310  if (givenNode != null) {
311  ThumbnailViewChildren childNode = new ThumbnailViewChildren(givenNode, iconSize);
312 
313  final Node root = new AbstractNode(childNode);
314  pageUpdater.setRoot(root);
315  root.addNodeListener(pageUpdater);
316  em.setRootContext(root);
317  } else {
318  Node emptyNode = new AbstractNode(Children.LEAF);
319  em.setRootContext(emptyNode); // make empty node
320 
321  IconView iv = ((IconView) this.thumbnailScrollPanel);
322  iv.setBackground(Color.BLACK);
323  }
324  } finally {
325  this.setCursor(null);
326  }
327  }
328 
329  @Override
330  public String getTitle() {
331  return NbBundle.getMessage(this.getClass(), "DataResultViewerThumbnail.title");
332  }
333 
334  @Override
335  public DataResultViewer createInstance() {
336  return new DataResultViewerThumbnail();
337  }
338 
339  @Override
340  public void resetComponent() {
341  super.resetComponent();
342  this.totalPages = 0;
343  this.curPage = -1;
344  curPageImages = 0;
345  updateControls();
346 
347  }
348 
349  @Override
350  public void clearComponent() {
351  this.thumbnailScrollPanel.removeAll();
352  this.thumbnailScrollPanel = null;
353 
354  super.clearComponent();
355  }
356 
357  private void nextPage() {
358  if (curPage < totalPages) {
359  curPage++;
360 
361  switchPage();
362  }
363  }
364 
365  private void previousPage() {
366  if (curPage > 1) {
367  curPage--;
368 
369  switchPage();
370  }
371  }
372 
373  private void goToPage(String pageNumText) {
374  int newPage;
375  try {
376  newPage = Integer.parseInt(pageNumText);
377  }
378  catch (NumberFormatException e) {
379  //ignore input
380  return;
381  }
382 
383  if (newPage > totalPages || newPage < 1) {
384  JOptionPane.showMessageDialog(this,
385  NbBundle.getMessage(this.getClass(),
386  "DataResultViewerThumbnail.goToPageTextField.msgDlg",
387  totalPages),
388  NbBundle.getMessage(this.getClass(),
389  "DataResultViewerThumbnail.goToPageTextField.err"),
390  JOptionPane.WARNING_MESSAGE);
391  return;
392  }
393 
394  curPage = newPage;
395  switchPage();
396  }
397 
398  private void switchPage() {
399 
400  EventQueue.invokeLater(new Runnable() {
401  @Override
402  public void run() {
403  setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
404  }
405  });
406 
407  //Note the nodes factories are likely creating nodes in EDT anyway, but worker still helps
408  new SwingWorker<Object, Void>() {
409  private ProgressHandle progress;
410 
411  @Override
412  protected Object doInBackground() throws Exception {
413  pagePrevButton.setEnabled(false);
414  pageNextButton.setEnabled(false);
415  goToPageField.setEnabled(false);
416  progress = ProgressHandleFactory.createHandle(
417  NbBundle.getMessage(this.getClass(), "DataResultViewerThumbnail.genThumbs"));
418  progress.start();
419  progress.switchToIndeterminate();
420  Node root = em.getRootContext();
421  Node pageNode = root.getChildren().getNodeAt(curPage - 1);
422  em.setExploredContext(pageNode);
423  curPageImages = pageNode.getChildren().getNodesCount();
424  return null;
425  }
426 
427  @Override
428  protected void done() {
429  progress.finish();
430  setCursor(null);
431  updateControls();
432  // see if any exceptions were thrown
433  try {
434  get();
435  } catch (InterruptedException | ExecutionException ex) {
436  NotifyDescriptor d =
437  new NotifyDescriptor.Message(
438  NbBundle.getMessage(this.getClass(), "DataResultViewerThumbnail.switchPage.done.errMsg",
439  ex.getMessage()),
440  NotifyDescriptor.ERROR_MESSAGE);
441  DialogDisplayer.getDefault().notify(d);
442  logger.log(Level.SEVERE, "Error making thumbnails: " + ex.getMessage()); //NON-NLS
443  } // catch and ignore if we were cancelled
444  catch (java.util.concurrent.CancellationException ex) {
445  }
446  }
447  }.execute();
448 
449  }
450 
451  private void updateControls() {
452  if (totalPages == 0) {
453  pagePrevButton.setEnabled(false);
454  pageNextButton.setEnabled(false);
455  goToPageField.setEnabled(false);
456  pageNumLabel.setText("");
457  imagesRangeLabel.setText("");
458  } else {
459  pageNumLabel.setText(
460  NbBundle.getMessage(this.getClass(), "DataResultViewerThumbnail.pageNumbers.curOfTotal",
461  Integer.toString(curPage), Integer.toString(totalPages)));
462  final int imagesFrom = (curPage - 1) * ThumbnailViewChildren.IMAGES_PER_PAGE + 1;
463  final int imagesTo = curPageImages + (curPage - 1) * ThumbnailViewChildren.IMAGES_PER_PAGE;
464  imagesRangeLabel.setText(imagesFrom + "-" + imagesTo);
465 
466  pageNextButton.setEnabled(!(curPage == totalPages));
467  pagePrevButton.setEnabled(!(curPage == 1));
468  goToPageField.setEnabled(totalPages>1);
469 
470  }
471 
472  }
473 
477  private class PageUpdater implements NodeListener {
478 
479  private Node root;
480 
481  void setRoot(Node root) {
482  this.root = root;
483  }
484 
485  @Override
486  public void propertyChange(PropertyChangeEvent evt) {
487  }
488 
489  @Override
490  public void childrenAdded(NodeMemberEvent nme) {
491  totalPages = root.getChildren().getNodesCount();
492 
493  if (totalPages == 0) {
494  curPage = -1;
495  updateControls();
496  return;
497  }
498 
499  if (curPage == -1 || curPage > totalPages) {
500  curPage = 1;
501  }
502 
503  //force load the curPage node
504  final Node pageNode = root.getChildren().getNodeAt(curPage - 1);
505 
506  //em.setSelectedNodes(new Node[]{pageNode});
507  if (pageNode != null) {
508  pageNode.addNodeListener(new NodeListener() {
509  @Override
510  public void childrenAdded(NodeMemberEvent nme) {
511  curPageImages = pageNode.getChildren().getNodesCount();
512  updateControls();
513  }
514 
515  @Override
516  public void childrenRemoved(NodeMemberEvent nme) {
517  curPageImages = 0;
518  updateControls();
519  }
520 
521  @Override
522  public void childrenReordered(NodeReorderEvent nre) {
523  }
524 
525  @Override
526  public void nodeDestroyed(NodeEvent ne) {
527  }
528 
529  @Override
530  public void propertyChange(PropertyChangeEvent evt) {
531  }
532  });
533 
534  em.setExploredContext(pageNode);
535  }
536 
537 
538  updateControls();
539 
540  }
541 
542  @Override
543  public void childrenRemoved(NodeMemberEvent nme) {
544  totalPages = 0;
545  curPage = -1;
546  updateControls();
547  }
548 
549  @Override
550  public void childrenReordered(NodeReorderEvent nre) {
551  }
552 
553  @Override
554  public void nodeDestroyed(NodeEvent ne) {
555  }
556  }
557 
558  private class ExplorerManagerNodeSelectionListener implements PropertyChangeListener {
559  @Override
560  public void propertyChange(PropertyChangeEvent evt) {
561  if (evt.getPropertyName().equals(ExplorerManager.PROP_SELECTED_NODES)) {
562  setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
563  try {
564  Node[] selectedNodes = em.getSelectedNodes();
565  if (selectedNodes.length == 1) {
566  AbstractFile af = selectedNodes[0].getLookup().lookup(AbstractFile.class);
567  if (af == null) {
568  filePathLabel.setText("");
569  }
570  else {
571  try {
572  String uPath = af.getUniquePath();
573  filePathLabel.setText(uPath);
574  filePathLabel.setToolTipText(uPath);
575  }
576  catch (TskCoreException e){
577  logger.log(Level.WARNING, "Could not get unique path for content: {0}", af.getName()); //NON-NLS
578  }
579  }
580  }
581  else {
582  filePathLabel.setText("");
583  }
584  }
585  finally {
586  setCursor(null);
587  }
588  }
589  }
590  }
591 }

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.