VariousSimpleTools.java :  » IDE » tIDE » tide » exttools » Java Open Source

Java Open Source » IDE » tIDE 
tIDE » tide » exttools » VariousSimpleTools.java
package tide.exttools;

import tide.editor.MainEditorFrame;
import snow.utils.SysUtils;
import java.awt.event.*;
import java.awt.event.ActionListener;
import java.awt.Insets;
import tide.project.ProjectSettings;
import snow.utils.gui.*;
import java.awt.BorderLayout;
import javax.swing.*;

/** Tools just configured through a path, like the Thread Dump Analyser...
*
* TODO: https://visualvm.dev.java.net/
*/
public final class VariousSimpleTools
{
   private VariousSimpleTools()
   {
   }

   public static void configureSAPMemoryAnalyser(final JFrame parent, final ProjectSettings proj)
   {
   }

   public static void configureTDA(final JFrame parent, final ProjectSettings proj)
   {
      JDialog d = new JDialog(parent, "TDA settings", true);
      JPanel p = new JPanel();
      d.add(p, BorderLayout.CENTER);
      GridLayout3 gl3 = new GridLayout3(2, p);

      gl3.addExplanationArea("Thread Dump Analyser is an external simple application to analyse thread dumps."
        +"\nIt appears as a tab in the jConsole launched from tIDE.");


      JButton help = new JButton("TDA Homepage", Icons.createHelpIcon(16,true));
      help.setMargin(new Insets(0,2,0,2));
      help.setFocusPainted(false);
      gl3.addSeparator();
      gl3.add(help);
      gl3.addSeparator();
      help.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) {
            try
            {
               SysUtils.openBrowser("https://tda.dev.java.net/");
            }
            catch(Exception e) {}
      } });

      FileField path = new FileField(
         proj.getProperty("TDA_EXT_TOOL", "C:/java/tools/tda/tda.jar"),
         false, "Please select tda.jar", JFileChooser.FILES_ONLY
         );
      path.allowedExtensions.add("jar");
      path.setAutoColorized();

      gl3.add("Path to TDA.jar");
      gl3.add(path, true);


      JButton jc = new JButton("Launch jConsole");
      jc.setMargin(new Insets(0,2,0,2));
      jc.setFocusPainted(false);

      gl3.addSeparator();
      gl3.add(jc);
      jc.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) {
            try
            {
               MainEditorFrame.instance.outputPanels.processesManager.launchJConsole(null);
            }
            catch(Exception e) {}
      } });


      CloseControlPanel ccpd = new CloseControlPanel(d, true, true, "Ok");
      d.add(ccpd, BorderLayout.SOUTH);

      d.pack();
      d.setLocationRelativeTo(parent);
      d.setVisible(true); // Modal => waits

      if(ccpd.getWasCancelled())
      {
         return;
      }

      proj.setProperty("TDA_EXT_TOOL", path.getTextField().getText());
   }

   public static void main(String[] args)
   {
      configureTDA(null, new ProjectSettings());
   }

}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.