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

Copyright © 2012-2015 Basis Technology. Generated on: Wed Apr 6 2016
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.