01: package tide.exttools;
02:
03: import tide.editor.MainEditorFrame;
04: import snow.utils.SysUtils;
05: import java.awt.event.*;
06: import java.awt.event.ActionListener;
07: import java.awt.Insets;
08: import tide.project.ProjectSettings;
09: import snow.utils.gui.*;
10: import java.awt.BorderLayout;
11: import javax.swing.*;
12:
13: /** Tools just configured through a path, like the Thread Dump Analyser...
14: *
15: * TODO: https://visualvm.dev.java.net/
16: */
17: public final class VariousSimpleTools {
18: private VariousSimpleTools() {
19: }
20:
21: public static void configureSAPMemoryAnalyser(final JFrame parent,
22: final ProjectSettings proj) {
23: }
24:
25: public static void configureTDA(final JFrame parent,
26: final ProjectSettings proj) {
27: JDialog d = new JDialog(parent, "TDA settings", true);
28: JPanel p = new JPanel();
29: d.add(p, BorderLayout.CENTER);
30: GridLayout3 gl3 = new GridLayout3(2, p);
31:
32: gl3
33: .addExplanationArea("Thread Dump Analyser is an external simple application to analyse thread dumps."
34: + "\nIt appears as a tab in the jConsole launched from tIDE.");
35:
36: JButton help = new JButton("TDA Homepage", Icons
37: .createHelpIcon(16, true));
38: help.setMargin(new Insets(0, 2, 0, 2));
39: help.setFocusPainted(false);
40: gl3.addSeparator();
41: gl3.add(help);
42: gl3.addSeparator();
43: help.addActionListener(new ActionListener() {
44: public void actionPerformed(ActionEvent ae) {
45: try {
46: SysUtils.openBrowser("https://tda.dev.java.net/");
47: } catch (Exception e) {
48: }
49: }
50: });
51:
52: FileField path = new FileField(proj.getProperty("TDA_EXT_TOOL",
53: "C:/java/tools/tda/tda.jar"), false,
54: "Please select tda.jar", JFileChooser.FILES_ONLY);
55: path.allowedExtensions.add("jar");
56: path.setAutoColorized();
57:
58: gl3.add("Path to TDA.jar");
59: gl3.add(path, true);
60:
61: JButton jc = new JButton("Launch jConsole");
62: jc.setMargin(new Insets(0, 2, 0, 2));
63: jc.setFocusPainted(false);
64:
65: gl3.addSeparator();
66: gl3.add(jc);
67: jc.addActionListener(new ActionListener() {
68: public void actionPerformed(ActionEvent ae) {
69: try {
70: MainEditorFrame.instance.outputPanels.processesManager
71: .launchJConsole(null);
72: } catch (Exception e) {
73: }
74: }
75: });
76:
77: CloseControlPanel ccpd = new CloseControlPanel(d, true, true,
78: "Ok");
79: d.add(ccpd, BorderLayout.SOUTH);
80:
81: d.pack();
82: d.setLocationRelativeTo(parent);
83: d.setVisible(true); // Modal => waits
84:
85: if (ccpd.getWasCancelled()) {
86: return;
87: }
88:
89: proj.setProperty("TDA_EXT_TOOL", path.getTextField().getText());
90: }
91:
92: public static void main(String[] args) {
93: configureTDA(null, new ProjectSettings());
94: }
95:
96: }
|