Autopsy  4.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 2011-2017 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.openide.DialogDisplayer;
34 import org.openide.NotifyDescriptor;
35 import org.openide.explorer.ExplorerManager;
36 import org.openide.nodes.AbstractNode;
37 import org.openide.nodes.Children;
38 import org.openide.nodes.Node;
39 import org.openide.nodes.NodeEvent;
40 import org.openide.nodes.NodeListener;
41 import org.openide.nodes.NodeMemberEvent;
42 import org.openide.nodes.NodeReorderEvent;
43 import org.openide.util.NbBundle;
49 
58 // @@@ Restore implementation of DataResultViewerThumbnail as a DataResultViewer
59 // service provider when DataResultViewers can be made compatible with node
60 // multi-selection actions.
61 //@ServiceProvider(service = DataResultViewer.class)
62 final class DataResultViewerThumbnail extends AbstractDataResultViewer {
63 
64  private static final long serialVersionUID = 1L;
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  DataResultViewerThumbnail(ExplorerManager explorerManager) {
78  super(explorerManager);
79  initialize();
80  }
81 
86  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<>(
100  new String[]{Bundle.DataResultViewerThumbnail_thumbnailSizeComboBox_small(),
101  Bundle.DataResultViewerThumbnail_thumbnailSizeComboBox_medium(),
102  Bundle.DataResultViewerThumbnail_thumbnailSizeComboBox_large()}));
103  thumbnailSizeComboBox.setSelectedIndex(1);
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  int newIconSize;
253  switch (thumbnailSizeComboBox.getSelectedIndex()) {
254  case 0:
255  newIconSize = ImageUtils.ICON_SIZE_SMALL;
256  break;
257  case 2:
258  newIconSize = ImageUtils.ICON_SIZE_LARGE;
259  break;
260  case 1:
261  default:
262  newIconSize = ImageUtils.ICON_SIZE_MEDIUM; //default size
263  break;
264  }
265 
266  if (iconSize != newIconSize) {
267  iconSize = newIconSize;
268  Node root = em.getRootContext();
269  for (Children c : Arrays.asList(root.getChildren())) {
270  ((ThumbnailViewChildren) c).setIconSize(iconSize);
271  }
272 
273  for (Node page : root.getChildren().getNodes()) {
274  for (Node node : page.getChildren().getNodes()) {
275  ((ThumbnailViewNode) node).setIconSize(iconSize);
276  }
277  }
278 
279  // Temporarily set the explored context to the root, instead of a child node.
280  // This is a workaround hack to convince org.openide.explorer.ExplorerManager to
281  // update even though the new and old Node values are identical. This in turn
282  // will cause the entire view to update completely. After this we
283  // immediately set the node back to the current child by calling switchPage().
284  em.setExploredContext(root);
285  switchPage();
286  }
287  }//GEN-LAST:event_thumbnailSizeComboBoxActionPerformed
288 
289  // Variables declaration - do not modify//GEN-BEGIN:variables
290  private javax.swing.JLabel filePathLabel;
291  private javax.swing.JTextField goToPageField;
292  private javax.swing.JLabel goToPageLabel;
293  private org.openide.explorer.view.IconView iconView;
294  private javax.swing.JLabel imagesLabel;
295  private javax.swing.JLabel imagesRangeLabel;
296  private javax.swing.JLabel pageLabel;
297  private javax.swing.JButton pageNextButton;
298  private javax.swing.JLabel pageNumLabel;
299  private javax.swing.JButton pagePrevButton;
300  private javax.swing.JLabel pagesLabel;
301  private javax.swing.JComboBox<String> thumbnailSizeComboBox;
302  // End of variables declaration//GEN-END:variables
303 
304  @Override
305  public boolean isSupported(Node selectedNode) {
306  if (selectedNode == null) {
307  return false;
308  }
309  return true;
310  }
311 
312  @Override
313  public void setNode(Node givenNode) {
314  // change the cursor to "waiting cursor" for this operation
315  setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
316  try {
317  if (givenNode != null) {
318  ThumbnailViewChildren childNode = new ThumbnailViewChildren(givenNode, iconSize);
319 
320  final Node root = new AbstractNode(childNode);
321  pageUpdater.setRoot(root);
322  root.addNodeListener(pageUpdater);
323  em.setRootContext(root);
324  } else {
325  Node emptyNode = new AbstractNode(Children.LEAF);
326  em.setRootContext(emptyNode); // make empty node
327 
328  iconView.setBackground(Color.BLACK);
329  }
330  } finally {
331  this.setCursor(null);
332  }
333  }
334 
335  @Override
336  public String getTitle() {
337  return NbBundle.getMessage(this.getClass(), "DataResultViewerThumbnail.title");
338  }
339 
340  @Override
341  public DataResultViewer createInstance() {
342  return new DataResultViewerThumbnail();
343  }
344 
345  @Override
346  public void resetComponent() {
347  super.resetComponent();
348  this.totalPages = 0;
349  this.curPage = -1;
350  curPageImages = 0;
351  updateControls();
352 
353  }
354 
355  @Override
356  public void clearComponent() {
357  this.iconView.removeAll();
358  this.iconView = null;
359 
360  super.clearComponent();
361  }
362 
363  private void nextPage() {
364  if (curPage < totalPages) {
365  curPage++;
366 
367  switchPage();
368  }
369  }
370 
371  private void previousPage() {
372  if (curPage > 1) {
373  curPage--;
374 
375  switchPage();
376  }
377  }
378 
379  private void goToPage(String pageNumText) {
380  int newPage;
381  try {
382  newPage = Integer.parseInt(pageNumText);
383  } catch (NumberFormatException e) {
384  //ignore input
385  return;
386  }
387 
388  if (newPage > totalPages || newPage < 1) {
389  JOptionPane.showMessageDialog(this,
390  NbBundle.getMessage(this.getClass(),
391  "DataResultViewerThumbnail.goToPageTextField.msgDlg",
392  totalPages),
393  NbBundle.getMessage(this.getClass(),
394  "DataResultViewerThumbnail.goToPageTextField.err"),
395  JOptionPane.WARNING_MESSAGE);
396  return;
397  }
398 
399  curPage = newPage;
400  switchPage();
401  }
402 
403  private void switchPage() {
404 
405  EventQueue.invokeLater(() -> {
406  setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
407  });
408 
409  //Note the nodes factories are likely creating nodes in EDT anyway, but worker still helps
410  new SwingWorker<Object, Void>() {
411  private ProgressHandle progress;
412 
413  @Override
414  protected Object doInBackground() throws Exception {
415  pagePrevButton.setEnabled(false);
416  pageNextButton.setEnabled(false);
417  goToPageField.setEnabled(false);
418  progress = ProgressHandle.createHandle(
419  NbBundle.getMessage(this.getClass(), "DataResultViewerThumbnail.genThumbs"));
420  progress.start();
421  progress.switchToIndeterminate();
422  Node root = em.getRootContext();
423  Node pageNode = root.getChildren().getNodeAt(curPage - 1);
424  em.setExploredContext(pageNode);
425  curPageImages = pageNode.getChildren().getNodesCount();
426  return null;
427  }
428 
429  @Override
430  protected void done() {
431  progress.finish();
432  setCursor(null);
433  updateControls();
434  // see if any exceptions were thrown
435  try {
436  get();
437  } catch (InterruptedException | ExecutionException ex) {
438  NotifyDescriptor d
439  = new NotifyDescriptor.Message(
440  NbBundle.getMessage(this.getClass(), "DataResultViewerThumbnail.switchPage.done.errMsg",
441  ex.getMessage()),
442  NotifyDescriptor.ERROR_MESSAGE);
443  DialogDisplayer.getDefault().notify(d);
444  logger.log(Level.SEVERE, "Error making thumbnails: {0}", ex.getMessage()); //NON-NLS
445  } // catch and ignore if we were cancelled
446  catch (java.util.concurrent.CancellationException ex) {
447  }
448  }
449  }.execute();
450 
451  }
452 
453  private void updateControls() {
454  if (totalPages == 0) {
455  pagePrevButton.setEnabled(false);
456  pageNextButton.setEnabled(false);
457  goToPageField.setEnabled(false);
458  pageNumLabel.setText("");
459  imagesRangeLabel.setText("");
460  thumbnailSizeComboBox.setEnabled(false);
461  } else {
462  pageNumLabel.setText(
463  NbBundle.getMessage(this.getClass(), "DataResultViewerThumbnail.pageNumbers.curOfTotal",
464  Integer.toString(curPage), Integer.toString(totalPages)));
465  final int imagesFrom = (curPage - 1) * ThumbnailViewChildren.IMAGES_PER_PAGE + 1;
466  final int imagesTo = curPageImages + (curPage - 1) * ThumbnailViewChildren.IMAGES_PER_PAGE;
467  imagesRangeLabel.setText(imagesFrom + "-" + imagesTo);
468 
469  pageNextButton.setEnabled(!(curPage == totalPages));
470  pagePrevButton.setEnabled(!(curPage == 1));
471  goToPageField.setEnabled(totalPages > 1);
472  thumbnailSizeComboBox.setEnabled(true);
473  }
474 
475  }
476 
480  private class PageUpdater implements NodeListener {
481 
482  private Node root;
483 
484  void setRoot(Node root) {
485  this.root = root;
486  }
487 
488  @Override
489  public void propertyChange(PropertyChangeEvent evt) {
490  }
491 
492  @Override
493  public void childrenAdded(NodeMemberEvent nme) {
494  totalPages = root.getChildren().getNodesCount();
495 
496  if (totalPages == 0) {
497  curPage = -1;
498  updateControls();
499  return;
500  }
501 
502  if (curPage == -1 || curPage > totalPages) {
503  curPage = 1;
504  }
505 
506  //force load the curPage node
507  final Node pageNode = root.getChildren().getNodeAt(curPage - 1);
508 
509  //em.setSelectedNodes(new Node[]{pageNode});
510  if (pageNode != null) {
511  pageNode.addNodeListener(new NodeListener() {
512  @Override
513  public void childrenAdded(NodeMemberEvent nme) {
514  curPageImages = pageNode.getChildren().getNodesCount();
515  updateControls();
516  }
517 
518  @Override
519  public void childrenRemoved(NodeMemberEvent nme) {
520  curPageImages = 0;
521  updateControls();
522  }
523 
524  @Override
525  public void childrenReordered(NodeReorderEvent nre) {
526  }
527 
528  @Override
529  public void nodeDestroyed(NodeEvent ne) {
530  }
531 
532  @Override
533  public void propertyChange(PropertyChangeEvent evt) {
534  }
535  });
536 
537  em.setExploredContext(pageNode);
538  }
539 
540  updateControls();
541 
542  }
543 
544  @Override
545  public void childrenRemoved(NodeMemberEvent nme) {
546  totalPages = 0;
547  curPage = -1;
548  updateControls();
549  }
550 
551  @Override
552  public void childrenReordered(NodeReorderEvent nre) {
553  }
554 
555  @Override
556  public void nodeDestroyed(NodeEvent ne) {
557  }
558  }
559 
560  private class ExplorerManagerNodeSelectionListener implements PropertyChangeListener {
561 
562  @Override
563  public void propertyChange(PropertyChangeEvent evt) {
564  if (evt.getPropertyName().equals(ExplorerManager.PROP_SELECTED_NODES)) {
565  setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
566  try {
567  Node[] selectedNodes = em.getSelectedNodes();
568  if (selectedNodes.length == 1) {
569  AbstractFile af = selectedNodes[0].getLookup().lookup(AbstractFile.class);
570  if (af == null) {
571  filePathLabel.setText("");
572  } else {
573  try {
574  String uPath = af.getUniquePath();
575  filePathLabel.setText(uPath);
576  filePathLabel.setToolTipText(uPath);
577  } catch (TskCoreException e) {
578  logger.log(Level.WARNING, "Could not get unique path for content: {0}", af.getName()); //NON-NLS
579  }
580  }
581  } else {
582  filePathLabel.setText("");
583  }
584  } finally {
585  setCursor(null);
586  }
587  }
588  }
589  }
590 }

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