Lines 114-123
Link Here
|
114 |
// public static final String ATTRIBUTE_DEPENDENCIES_LAYOUT = "MavenProjectDependenciesLayout"; //NOI18N |
114 |
// public static final String ATTRIBUTE_DEPENDENCIES_LAYOUT = "MavenProjectDependenciesLayout"; //NOI18N |
115 |
private static final Logger LOG = Logger.getLogger(DependencyGraphTopComponent.class.getName()); |
115 |
private static final Logger LOG = Logger.getLogger(DependencyGraphTopComponent.class.getName()); |
116 |
private static final RequestProcessor RP = new RequestProcessor(DependencyGraphTopComponent.class); |
116 |
private static final RequestProcessor RP = new RequestProcessor(DependencyGraphTopComponent.class); |
|
|
117 |
private boolean everDisplayed; |
117 |
private final RequestProcessor.Task task_reload = RP.create(new Runnable() { |
118 |
private final RequestProcessor.Task task_reload = RP.create(new Runnable() { |
118 |
@Override |
119 |
@Override |
119 |
public void run() { |
120 |
public void run() { |
120 |
createScene(); |
121 |
SwingUtilities.invokeLater(new Runnable() { |
|
|
122 |
@Override public void run() { |
123 |
waitForApproval(); |
124 |
} |
125 |
}); |
121 |
} |
126 |
} |
122 |
}); |
127 |
}); |
123 |
|
128 |
|
Lines 297-322
Link Here
|
297 |
return TopComponent.PERSISTENCE_NEVER; |
302 |
return TopComponent.PERSISTENCE_NEVER; |
298 |
} |
303 |
} |
299 |
|
304 |
|
300 |
@Messages("LBL_Loading=Loading and constructing graph:") |
|
|
301 |
@Override public void componentOpened() { |
305 |
@Override public void componentOpened() { |
302 |
super.componentOpened(); |
306 |
super.componentOpened(); |
303 |
pane.setWheelScrollingEnabled(true); |
307 |
pane.setWheelScrollingEnabled(true); |
304 |
maxPathSpinner.setEnabled(false); |
|
|
305 |
maxPathSpinner.setVisible(false); |
306 |
lblPath.setVisible(false); |
307 |
txtFind.setEnabled(false); |
308 |
btnBigger.setEnabled(false); |
309 |
btnSmaller.setEnabled(false); |
310 |
comScopes.setEnabled(false); |
311 |
add(pane, BorderLayout.CENTER); |
308 |
add(pane, BorderLayout.CENTER); |
312 |
setPaneText(LBL_Loading(), true); |
|
|
313 |
result = getLookup().lookupResult(DependencyNode.class); |
309 |
result = getLookup().lookupResult(DependencyNode.class); |
314 |
result.addLookupListener(this); |
310 |
result.addLookupListener(this); |
315 |
result2 = getLookup().lookupResult(MavenProject.class); |
311 |
result2 = getLookup().lookupResult(MavenProject.class); |
316 |
result2.addLookupListener(this); |
312 |
result2.addLookupListener(this); |
317 |
result3 = getLookup().lookupResult(POMModel.class); |
313 |
result3 = getLookup().lookupResult(POMModel.class); |
318 |
result3.addLookupListener(this); |
314 |
result3.addLookupListener(this); |
319 |
createScene(); |
315 |
waitForApproval(); |
320 |
} |
316 |
} |
321 |
|
317 |
|
322 |
@Override |
318 |
@Override |
Lines 355-360
Link Here
|
355 |
|
351 |
|
356 |
jPanel1 = new javax.swing.JPanel(); |
352 |
jPanel1 = new javax.swing.JPanel(); |
357 |
jToolBar1 = new javax.swing.JToolBar(); |
353 |
jToolBar1 = new javax.swing.JToolBar(); |
|
|
354 |
btnGraph = new javax.swing.JButton(); |
358 |
btnBigger = new javax.swing.JButton(); |
355 |
btnBigger = new javax.swing.JButton(); |
359 |
btnSmaller = new javax.swing.JButton(); |
356 |
btnSmaller = new javax.swing.JButton(); |
360 |
lblFind = new javax.swing.JLabel(); |
357 |
lblFind = new javax.swing.JLabel(); |
Lines 371-376
Link Here
|
371 |
jToolBar1.setFloatable(false); |
368 |
jToolBar1.setFloatable(false); |
372 |
jToolBar1.setRollover(true); |
369 |
jToolBar1.setRollover(true); |
373 |
|
370 |
|
|
|
371 |
org.openide.awt.Mnemonics.setLocalizedText(btnGraph, org.openide.util.NbBundle.getMessage(DependencyGraphTopComponent.class, "DependencyGraphTopComponent.btnGraph.text")); // NOI18N |
372 |
btnGraph.setFocusable(false); |
373 |
btnGraph.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); |
374 |
btnGraph.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); |
375 |
btnGraph.addActionListener(new java.awt.event.ActionListener() { |
376 |
public void actionPerformed(java.awt.event.ActionEvent evt) { |
377 |
btnGraphActionPerformed(evt); |
378 |
} |
379 |
}); |
380 |
jToolBar1.add(btnGraph); |
381 |
|
374 |
btnBigger.setIcon(ImageUtilities.loadImageIcon(ZOOM_IN_ICON, true)); |
382 |
btnBigger.setIcon(ImageUtilities.loadImageIcon(ZOOM_IN_ICON, true)); |
375 |
btnBigger.setFocusable(false); |
383 |
btnBigger.setFocusable(false); |
376 |
btnBigger.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); |
384 |
btnBigger.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); |
Lines 454-463
Link Here
|
454 |
depthHighlight(); |
462 |
depthHighlight(); |
455 |
}//GEN-LAST:event_maxPathSpinnerStateChanged |
463 |
}//GEN-LAST:event_maxPathSpinnerStateChanged |
456 |
|
464 |
|
|
|
465 |
private void btnGraphActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGraphActionPerformed |
466 |
btnGraph.setEnabled(false); |
467 |
createScene(); |
468 |
}//GEN-LAST:event_btnGraphActionPerformed |
469 |
|
457 |
|
470 |
|
458 |
|
471 |
|
459 |
// Variables declaration - do not modify//GEN-BEGIN:variables |
472 |
// Variables declaration - do not modify//GEN-BEGIN:variables |
460 |
private javax.swing.JButton btnBigger; |
473 |
private javax.swing.JButton btnBigger; |
|
|
474 |
private javax.swing.JButton btnGraph; |
461 |
private javax.swing.JButton btnSmaller; |
475 |
private javax.swing.JButton btnSmaller; |
462 |
private javax.swing.JComboBox comScopes; |
476 |
private javax.swing.JComboBox comScopes; |
463 |
private javax.swing.JPanel jPanel1; |
477 |
private javax.swing.JPanel jPanel1; |
Lines 510-516
Link Here
|
510 |
return pane; |
524 |
return pane; |
511 |
} |
525 |
} |
512 |
|
526 |
|
513 |
@Messages("Err_CannotLoad=Cannot display Artifact's dependency tree.") |
527 |
@Messages({ |
|
|
528 |
"LBL_waiting_for_approval_first_time=Click Show Graph to compute and display dependencies.", |
529 |
"LBL_waiting_for_approval_dirty=Model has changed. Click Show Graph to refresh." |
530 |
}) |
531 |
private void waitForApproval() { |
532 |
setPaneText(everDisplayed ? LBL_waiting_for_approval_dirty() : LBL_waiting_for_approval_first_time(), false); |
533 |
btnGraph.setEnabled(true); |
534 |
maxPathSpinner.setEnabled(false); |
535 |
maxPathSpinner.setVisible(false); |
536 |
lblPath.setVisible(false); |
537 |
txtFind.setEnabled(false); |
538 |
btnBigger.setEnabled(false); |
539 |
btnSmaller.setEnabled(false); |
540 |
comScopes.setEnabled(false); |
541 |
} |
542 |
|
543 |
@Messages({ |
544 |
"Err_CannotLoad=Cannot display Artifact's dependency tree.", |
545 |
"LBL_Loading=Loading and constructing graph (this may take a while)." |
546 |
}) |
514 |
private void createScene() { |
547 |
private void createScene() { |
515 |
Iterator<? extends DependencyNode> it1 = result.allInstances().iterator(); |
548 |
Iterator<? extends DependencyNode> it1 = result.allInstances().iterator(); |
516 |
Iterator<? extends MavenProject> it2 = result2.allInstances().iterator(); |
549 |
Iterator<? extends MavenProject> it2 = result2.allInstances().iterator(); |
Lines 518-524
Link Here
|
518 |
final MavenProject prj = it2.hasNext() ? it2.next() : null; |
551 |
final MavenProject prj = it2.hasNext() ? it2.next() : null; |
519 |
if (prj != null && NbMavenProject.isErrorPlaceholder(prj)) { |
552 |
if (prj != null && NbMavenProject.isErrorPlaceholder(prj)) { |
520 |
setPaneText(Err_CannotLoad(), false); |
553 |
setPaneText(Err_CannotLoad(), false); |
|
|
554 |
return; |
521 |
} |
555 |
} |
|
|
556 |
everDisplayed = true; |
557 |
setPaneText(LBL_Loading(), true); |
522 |
final Project nbProj = getLookup().lookup(Project.class); |
558 |
final Project nbProj = getLookup().lookup(Project.class); |
523 |
if (prj != null && it1.hasNext()) { |
559 |
if (prj != null && it1.hasNext()) { |
524 |
final DependencyNode root = it1.next(); |
560 |
final DependencyNode root = it1.next(); |
Lines 604-610
Link Here
|
604 |
// Actions.connect(btn, act); |
640 |
// Actions.connect(btn, act); |
605 |
// toolbar.add(btn); |
641 |
// toolbar.add(btn); |
606 |
// } |
642 |
// } |
|
|
643 |
toolbar.addSeparator(); |
607 |
Dimension space = new Dimension(3, 0); |
644 |
Dimension space = new Dimension(3, 0); |
|
|
645 |
toolbar.add(btnGraph); |
608 |
toolbar.addSeparator(space); |
646 |
toolbar.addSeparator(space); |
609 |
toolbar.add(btnBigger); |
647 |
toolbar.add(btnBigger); |
610 |
toolbar.addSeparator(space); |
648 |
toolbar.addSeparator(space); |