com-sun-tools-visualvm-coredump

16:33:47.563 INFO  jd.cli.Main - Decompiling com-sun-tools-visualvm-coredump.jar
package com.sun.tools.visualvm.coredump;

import com.sun.tools.visualvm.core.datasource.DataSource;
import com.sun.tools.visualvm.core.snapshot.Snapshot;
import com.sun.tools.visualvm.core.snapshot.SnapshotsSupport;
import java.io.File;
import java.io.IOException;
import org.openide.util.NbBundle;
import org.openide.util.Utilities;

public abstract class CoreDump
  extends Snapshot
{
  private final File jdkHome;
  
  public CoreDump(File file, File jdkHome)
    throws IOException
  {
    this(file, jdkHome, null);
  }
  
  public CoreDump(File file, File jdkHome, DataSource master)
    throws IOException
  {
    super(file, CoreDumpSupport.getCategory(), master);
    if ((!file.exists()) || (!file.isFile())) {
      throw new IOException("File " + file.getAbsolutePath() + " does not exist");
    }
    if (jdkHome != null)
    {
      if ((!jdkHome.exists()) || (!jdkHome.isDirectory())) {
        throw new IOException("Java Home " + jdkHome.getAbsolutePath() + " does not exist");
      }
      this.jdkHome = jdkHome;
    }
    else
    {
      this.jdkHome = new File(System.getProperty("java.home")).getCanonicalFile();
    }
  }
  
  public final String getExecutable()
  {
    String home = getJDKHome();
    
    String exec = home + File.separatorChar + "bin" + File.separatorChar + "java";
    if (Utilities.isWindows()) {
      exec = exec + ".exe";
    }
    return exec;
  }
  
  public final String getJDKHome()
  {
    return jdkHome.getAbsolutePath();
  }
  
  public boolean supportsSaveAs()
  {
    return true;
  }
  
  public void saveAs()
  {
    SnapshotsSupport.getInstance().saveAs(this, NbBundle.getMessage(CoreDump.class, "LBL_Save_Core_Dump_As"));
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.coredump.CoreDump
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.coredump;

import com.sun.tools.visualvm.core.snapshot.SnapshotDescriptor;
import java.awt.Image;
import org.openide.util.ImageUtilities;
import org.openide.util.NbBundle;

public class CoreDumpDescriptor
  extends SnapshotDescriptor<CoreDump>
{
  private static final Image ICON = ImageUtilities.loadImage("com/sun/tools/visualvm/coredump/resources/coredump.png", true);
  
  public CoreDumpDescriptor(CoreDump coreDump)
  {
    super(coreDump, resolveSnapshotName(coreDump), NbBundle.getMessage(CoreDumpDescriptor.class, "DESCR_CoreDump"), ICON, resolvePosition(coreDump, 2147483646, true), 0);
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.coredump.CoreDumpDescriptor
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.coredump;

import com.sun.tools.visualvm.core.datasource.Storage;
import com.sun.tools.visualvm.core.datasource.descriptor.DataSourceDescriptorFactory;
import com.sun.tools.visualvm.core.datasupport.Utils;
import com.sun.tools.visualvm.core.snapshot.RegisteredSnapshotCategories;
import com.sun.tools.visualvm.core.snapshot.SnapshotCategory;
import com.sun.tools.visualvm.core.ui.DataSourceViewsManager;
import com.sun.tools.visualvm.core.ui.PluggableDataSourceViewProvider;
import com.sun.tools.visualvm.coredump.impl.CoreDumpCategory;
import com.sun.tools.visualvm.coredump.impl.CoreDumpDescriptorProvider;
import com.sun.tools.visualvm.coredump.impl.CoreDumpOverviewViewProvider;
import com.sun.tools.visualvm.coredump.impl.CoreDumpProvider;
import java.io.File;
import org.openide.util.Utilities;

public final class CoreDumpSupport
{
  private static final String COREDUMPS_STORAGE_DIRNAME = "coredumps";
  private static final Object coredumpsStorageDirectoryLock = new Object();
  private static File coredumpsStorageDirectory;
  private static final Object coredumpsStorageDirectoryStringLock = new Object();
  private static String coredumpsStorageDirectoryString;
  private static CoreDumpOverviewViewProvider viewProvider = new CoreDumpOverviewViewProvider();
  private static CoreDumpCategory category = new CoreDumpCategory();
  private static final Object currentJDKHomeLock = new Object();
  private static String currentJDKHome;
  
  public static PluggableDataSourceViewProvider<CoreDump> getOverviewView()
  {
    return viewProvider;
  }
  
  public static SnapshotCategory getCategory()
  {
    return category;
  }
  
  public static String getCurrentJDKHome()
  {
    synchronized (currentJDKHomeLock)
    {
      if (currentJDKHome == null)
      {
        currentJDKHome = System.getProperty("java.home");
        String jreSuffix = File.separator + "jre";
        if (currentJDKHome.endsWith(jreSuffix)) {
          currentJDKHome = currentJDKHome.substring(0, currentJDKHome.length() - jreSuffix.length());
        }
      }
      return currentJDKHome;
    }
  }
  
  static String getStorageDirectoryString()
  {
    synchronized (coredumpsStorageDirectoryStringLock)
    {
      if (coredumpsStorageDirectoryString == null) {
        coredumpsStorageDirectoryString = Storage.getPersistentStorageDirectoryString() + File.separator + "coredumps";
      }
      return coredumpsStorageDirectoryString;
    }
  }
  
  public static File getStorageDirectory()
  {
    synchronized (coredumpsStorageDirectoryLock)
    {
      if (coredumpsStorageDirectory == null)
      {
        String snapshotsStorageString = getStorageDirectoryString();
        coredumpsStorageDirectory = new File(snapshotsStorageString);
        if ((coredumpsStorageDirectory.exists()) && (coredumpsStorageDirectory.isFile())) {
          throw new IllegalStateException("Cannot create coredumps storage directory " + snapshotsStorageString + ", file in the way");
        }
        if ((coredumpsStorageDirectory.exists()) && ((!coredumpsStorageDirectory.canRead()) || (!coredumpsStorageDirectory.canWrite()))) {
          throw new IllegalStateException("Cannot access coredumps storage directory " + snapshotsStorageString + ", read&write permission required");
        }
        if (!Utils.prepareDirectory(coredumpsStorageDirectory)) {
          throw new IllegalStateException("Cannot create coredumps storage directory " + snapshotsStorageString);
        }
      }
      return coredumpsStorageDirectory;
    }
  }
  
  public static boolean storageDirectoryExists()
  {
    return new File(getStorageDirectoryString()).isDirectory();
  }
  
  static void register()
  {
    if (Utilities.isWindows()) {
      return;
    }
    DataSourceDescriptorFactory.getDefault().registerProvider(new CoreDumpDescriptorProvider());
    CoreDumpsContainer.sharedInstance();
    CoreDumpProvider.register();
    RegisteredSnapshotCategories.sharedInstance().registerCategory(category);
    DataSourceViewsManager.sharedInstance().addViewProvider(viewProvider, CoreDump.class);
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.coredump.CoreDumpSupport
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.coredump;

import com.sun.tools.visualvm.core.datasource.DataSource;
import com.sun.tools.visualvm.core.datasource.descriptor.DataSourceDescriptor;
import com.sun.tools.visualvm.core.model.AbstractModelProvider;

class CoreDumpsContainer$1
  extends AbstractModelProvider<DataSourceDescriptor, DataSource>
{
  CoreDumpsContainer$1(CoreDumpsContainer paramCoreDumpsContainer) {}
  
  public DataSourceDescriptor createModelFor(DataSource ds)
  {
    if (CoreDumpsContainer.sharedInstance().equals(ds)) {
      return new CoreDumpsContainerDescriptor();
    }
    return null;
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.coredump.CoreDumpsContainer.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.coredump;

import com.sun.tools.visualvm.core.datasource.DataSource;
import com.sun.tools.visualvm.core.datasource.DataSourceContainer;
import com.sun.tools.visualvm.core.datasource.descriptor.DataSourceDescriptor;
import com.sun.tools.visualvm.core.datasource.descriptor.DataSourceDescriptorFactory;
import com.sun.tools.visualvm.core.model.AbstractModelProvider;

public final class CoreDumpsContainer
  extends DataSource
{
  private static CoreDumpsContainer sharedInstance;
  
  public static synchronized CoreDumpsContainer sharedInstance()
  {
    if (sharedInstance == null) {
      sharedInstance = new CoreDumpsContainer();
    }
    return sharedInstance;
  }
  
  private CoreDumpsContainer()
  {
    DataSourceDescriptorFactory.getDefault().registerProvider(new AbstractModelProvider()
    {
      public DataSourceDescriptor createModelFor(DataSource ds)
      {
        if (CoreDumpsContainer.sharedInstance().equals(ds)) {
          return new CoreDumpsContainerDescriptor();
        }
        return null;
      }
    });
    DataSource.ROOT.getRepository().addDataSource(this);
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.coredump.CoreDumpsContainer
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.coredump;

import com.sun.tools.visualvm.core.datasource.DataSource;
import com.sun.tools.visualvm.core.datasource.descriptor.DataSourceDescriptor;
import java.awt.Image;
import java.util.Comparator;
import org.openide.util.ImageUtilities;
import org.openide.util.NbBundle;

public final class CoreDumpsContainerDescriptor
  extends DataSourceDescriptor<CoreDumpsContainer>
{
  private static final Image NODE_ICON = ImageUtilities.loadImage("com/sun/tools/visualvm/coredump/resources/coredumps.png", true);
  
  CoreDumpsContainerDescriptor()
  {
    super(CoreDumpsContainer.sharedInstance(), NbBundle.getMessage(CoreDumpsContainerDescriptor.class, "LBL_VM_Coredumps"), null, NODE_ICON, 20, 3);
    
    setChildrenComparator(CoreDumpsSorting.instance().getInitialSorting());
  }
  
  public void setChildrenComparator(Comparator<DataSource> newComparator)
  {
    super.setChildrenComparator(newComparator);
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.coredump.CoreDumpsContainerDescriptor
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.coredump;

import java.awt.Component;
import javax.swing.JMenu;

class CoreDumpsSorting$1
  extends JMenu
{
  CoreDumpsSorting$1(CoreDumpsSorting paramCoreDumpsSorting) {}
  
  protected void fireMenuSelected()
  {
    Component[] items = getMenuComponents();
    for (Component item : items) {
      if ((item instanceof CoreDumpsSorting.SortAction)) {
        ((CoreDumpsSorting.SortAction)item).updateAction();
      }
    }
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.coredump.CoreDumpsSorting.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.coredump;

import com.sun.tools.visualvm.core.datasource.DataSource;
import com.sun.tools.visualvm.core.datasource.descriptor.DataSourceDescriptor;
import com.sun.tools.visualvm.core.datasource.descriptor.DataSourceDescriptorFactory;
import java.util.Comparator;

final class CoreDumpsSorting$2
  implements Comparator<DataSource>
{
  public int compare(DataSource d1, DataSource d2)
  {
    DataSourceDescriptor dd1 = DataSourceDescriptorFactory.getDescriptor(d1);
    DataSourceDescriptor dd2 = DataSourceDescriptorFactory.getDescriptor(d2);
    
    return dd1.getName().compareTo(dd2.getName());
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.coredump.CoreDumpsSorting.2
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.coredump;

import com.sun.tools.visualvm.core.datasource.DataSource;
import com.sun.tools.visualvm.core.datasource.descriptor.DataSourceDescriptor;
import com.sun.tools.visualvm.core.datasource.descriptor.DataSourceDescriptorFactory;
import java.util.Comparator;
import java.util.List;
import java.util.prefs.Preferences;

class CoreDumpsSorting$3
  implements CoreDumpsSorting.Sorter
{
  CoreDumpsSorting$3(CoreDumpsSorting paramCoreDumpsSorting) {}
  
  public void sort(Comparator<DataSource> comparator)
  {
    DataSourceDescriptor d = DataSourceDescriptorFactory.getDescriptor(CoreDumpsContainer.sharedInstance());
    if ((d instanceof CoreDumpsContainerDescriptor))
    {
      ((CoreDumpsContainerDescriptor)d).setChildrenComparator(comparator);
      CoreDumpsSorting.access$100(this$0).putInt("CoreDumps.sorting", CoreDumpsSorting.access$000().indexOf(comparator));
    }
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.coredump.CoreDumpsSorting.3
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.coredump;

import com.sun.tools.visualvm.core.datasource.DataSource;
import com.sun.tools.visualvm.core.datasource.descriptor.DataSourceDescriptor;
import com.sun.tools.visualvm.core.datasource.descriptor.DataSourceDescriptorFactory;
import java.awt.event.ActionEvent;
import java.util.Comparator;
import javax.swing.JRadioButtonMenuItem;
import org.openide.awt.Mnemonics;

class CoreDumpsSorting$SortAction
  extends JRadioButtonMenuItem
{
  private final CoreDumpsSorting.Sorter sorter;
  private final Comparator<DataSource> comparator;
  private boolean currentlySelected;
  
  CoreDumpsSorting$SortAction(String name, Comparator<DataSource> comparator, CoreDumpsSorting.Sorter sorter)
  {
    Mnemonics.setLocalizedText(this, name);
    this.comparator = comparator;
    this.sorter = sorter;
  }
  
  void updateAction()
  {
    DataSourceDescriptor d = DataSourceDescriptorFactory.getDescriptor(CoreDumpsContainer.sharedInstance());
    
    setEnabled(d instanceof CoreDumpsContainerDescriptor);
    currentlySelected = (d.getChildrenComparator() == comparator);
    setSelected(currentlySelected);
  }
  
  protected void fireActionPerformed(ActionEvent e)
  {
    if (!currentlySelected) {
      sorter.sort(comparator);
    }
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.coredump.CoreDumpsSorting.SortAction
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.coredump;

import com.sun.tools.visualvm.core.datasource.DataSource;
import java.util.Comparator;

abstract interface CoreDumpsSorting$Sorter
{
  public abstract void sort(Comparator<DataSource> paramComparator);
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.coredump.CoreDumpsSorting.Sorter
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.coredump;

import com.sun.tools.visualvm.core.datasource.DataSource;
import com.sun.tools.visualvm.core.datasource.descriptor.DataSourceDescriptor;
import com.sun.tools.visualvm.core.datasource.descriptor.DataSourceDescriptorFactory;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.prefs.Preferences;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JRadioButtonMenuItem;
import org.openide.awt.Mnemonics;
import org.openide.util.NbBundle;
import org.openide.util.NbPreferences;
import org.openide.util.Utilities;
import org.openide.util.actions.Presenter.Menu;

final class CoreDumpsSorting
  implements Presenter.Menu
{
  private static final String PROP_HOSTS_SORTING = "CoreDumps.sorting";
  private static CoreDumpsSorting instance;
  private static final Comparator<DataSource> BY_TIME_COMPARATOR = ;
  private static final Comparator<DataSource> BY_NAME_COMPARATOR = byNameComparator();
  private static final List<Comparator<DataSource>> COMPARATORS = new ArrayList();
  private final Preferences prefs;
  private JMenuItem presenter;
  private final Sorter sorter;
  
  static
  {
    COMPARATORS.add(BY_TIME_COMPARATOR);COMPARATORS.add(BY_NAME_COMPARATOR);
  }
  
  public static synchronized CoreDumpsSorting instance()
  {
    if (instance == null) {
      instance = new CoreDumpsSorting();
    }
    return instance;
  }
  
  public JMenuItem getMenuPresenter()
  {
    if (presenter == null) {
      presenter = createPresenter();
    }
    return presenter;
  }
  
  Comparator<DataSource> getInitialSorting()
  {
    return (Comparator)COMPARATORS.get(prefs.getInt("CoreDumps.sorting", COMPARATORS.indexOf(BY_TIME_COMPARATOR)));
  }
  
  private JMenuItem createPresenter()
  {
    JMenu menu = new JMenu()
    {
      protected void fireMenuSelected()
      {
        Component[] items = getMenuComponents();
        for (Component item : items) {
          if ((item instanceof CoreDumpsSorting.SortAction)) {
            ((CoreDumpsSorting.SortAction)item).updateAction();
          }
        }
      }
    };
    Mnemonics.setLocalizedText(menu, NbBundle.getMessage(CoreDumpsSorting.class, "ACT_SortCoreDumps"));
    if (Utilities.isWindows())
    {
      menu.setEnabled(false);
    }
    else
    {
      menu.add(new SortAction(NbBundle.getMessage(CoreDumpsSorting.class, "ACT_TimeAdded"), BY_TIME_COMPARATOR, sorter));
      
      menu.add(new SortAction(NbBundle.getMessage(CoreDumpsSorting.class, "ACT_DisplayName"), BY_NAME_COMPARATOR, sorter));
    }
    return menu;
  }
  
  private static Comparator<DataSource> byTimeComparator()
  {
    return null;
  }
  
  private static Comparator<DataSource> byNameComparator()
  {
    new Comparator()
    {
      public int compare(DataSource d1, DataSource d2)
      {
        DataSourceDescriptor dd1 = DataSourceDescriptorFactory.getDescriptor(d1);
        DataSourceDescriptor dd2 = DataSourceDescriptorFactory.getDescriptor(d2);
        
        return dd1.getName().compareTo(dd2.getName());
      }
    };
  }
  
  private CoreDumpsSorting()
  {
    prefs = NbPreferences.forModule(CoreDumpsSorting.class);
    
    sorter = new Sorter()
    {
      public void sort(Comparator<DataSource> comparator)
      {
        DataSourceDescriptor d = DataSourceDescriptorFactory.getDescriptor(CoreDumpsContainer.sharedInstance());
        if ((d instanceof CoreDumpsContainerDescriptor))
        {
          ((CoreDumpsContainerDescriptor)d).setChildrenComparator(comparator);
          prefs.putInt("CoreDumps.sorting", CoreDumpsSorting.COMPARATORS.indexOf(comparator));
        }
      }
    };
  }
  
  private static abstract interface Sorter
  {
    public abstract void sort(Comparator<DataSource> paramComparator);
  }
  
  private static class SortAction
    extends JRadioButtonMenuItem
  {
    private final CoreDumpsSorting.Sorter sorter;
    private final Comparator<DataSource> comparator;
    private boolean currentlySelected;
    
    SortAction(String name, Comparator<DataSource> comparator, CoreDumpsSorting.Sorter sorter)
    {
      Mnemonics.setLocalizedText(this, name);
      this.comparator = comparator;
      this.sorter = sorter;
    }
    
    void updateAction()
    {
      DataSourceDescriptor d = DataSourceDescriptorFactory.getDescriptor(CoreDumpsContainer.sharedInstance());
      
      setEnabled(d instanceof CoreDumpsContainerDescriptor);
      currentlySelected = (d.getChildrenComparator() == comparator);
      setSelected(currentlySelected);
    }
    
    protected void fireActionPerformed(ActionEvent e)
    {
      if (!currentlySelected) {
        sorter.sort(comparator);
      }
    }
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.coredump.CoreDumpsSorting
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.coredump;

import org.openide.modules.ModuleInstall;

final class Installer
  extends ModuleInstall
{
  public void restored() {}
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.coredump.Installer
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.coredump.impl;

import com.sun.tools.visualvm.core.ui.actions.SingleDataSourceAction;
import com.sun.tools.visualvm.coredump.CoreDumpsContainer;
import java.awt.Image;
import java.awt.event.ActionEvent;
import javax.swing.ImageIcon;
import org.openide.util.ImageUtilities;
import org.openide.util.NbBundle;
import org.openide.util.Utilities;

class AddVMCoredumpAction
  extends SingleDataSourceAction<CoreDumpsContainer>
{
  private static final String ICON_PATH = "com/sun/tools/visualvm/coredump/resources/addCoredump.png";
  private static final Image ICON = ImageUtilities.loadImage("com/sun/tools/visualvm/coredump/resources/addCoredump.png");
  private boolean tracksSelection = false;
  private static AddVMCoredumpAction alwaysEnabled;
  private static AddVMCoredumpAction selectionAware;
  
  public static synchronized AddVMCoredumpAction alwaysEnabled()
  {
    if (alwaysEnabled == null)
    {
      alwaysEnabled = new AddVMCoredumpAction();
      alwaysEnabled.putValue("SmallIcon", new ImageIcon(ICON));
      alwaysEnabled.putValue("iconBase", "com/sun/tools/visualvm/coredump/resources/addCoredump.png");
    }
    return alwaysEnabled;
  }
  
  public static synchronized AddVMCoredumpAction selectionAware()
  {
    if (selectionAware == null)
    {
      selectionAware = new AddVMCoredumpAction();
      selectionAwaretracksSelection = true;
    }
    return selectionAware;
  }
  
  public void actionPerformed(CoreDumpsContainer contanier, ActionEvent e)
  {
    CoreDumpConfigurator newCoreDumpConfiguration = CoreDumpConfigurator.defineCoreDump();
    if (newCoreDumpConfiguration != null) {
      CoreDumpProvider.createCoreDump(newCoreDumpConfiguration.getCoreDumpFile(), newCoreDumpConfiguration.getDisplayname(), newCoreDumpConfiguration.getJavaHome(), newCoreDumpConfiguration.deleteSourceFile());
    }
  }
  
  protected boolean isEnabled(CoreDumpsContainer contanier)
  {
    return true;
  }
  
  protected void initialize()
  {
    if (Utilities.isWindows()) {
      setEnabled(false);
    } else if (tracksSelection) {
      super.initialize();
    }
  }
  
  private AddVMCoredumpAction()
  {
    super(CoreDumpsContainer.class);
    putValue("Name", NbBundle.getMessage(AddVMCoredumpAction.class, "LBL_Add_VM_Coredump"));
    putValue("ShortDescription", NbBundle.getMessage(AddVMCoredumpAction.class, "ToolTip_Add_VM_Coredump"));
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.coredump.impl.AddVMCoredumpAction
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.coredump.impl;

import com.sun.tools.visualvm.core.snapshot.SnapshotCategory;
import com.sun.tools.visualvm.coredump.CoreDump;
import org.openide.util.NbBundle;

public class CoreDumpCategory
  extends SnapshotCategory<CoreDump>
{
  private static final String NAME = NbBundle.getMessage(CoreDumpCategory.class, "LBL_Core_Dumps");
  private static final String PREFIX = null;
  private static final String SUFFIX = null;
  
  public CoreDumpCategory()
  {
    super(NAME, CoreDump.class, PREFIX, SUFFIX, Integer.MIN_VALUE);
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.coredump.impl.CoreDumpCategory
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.coredump.impl;

import java.io.File;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JTextField;

class CoreDumpConfigurator$1
  implements Runnable
{
  CoreDumpConfigurator$1(CoreDumpConfigurator paramCoreDumpConfigurator) {}
  
  public void run()
  {
    String coreDumpname = this$0.getCoreDumpFile();
    File coreDumpFile = new File(coreDumpname);
    
    String jdkHome = this$0.getJavaHome();
    File jdkHomeFile = new File(jdkHome);
    if (!CoreDumpConfigurator.access$000(this$0).isSelected())
    {
      CoreDumpConfigurator.access$102(this$0, true);
      File file = new File(coreDumpname);
      if (file.isFile()) {
        CoreDumpConfigurator.access$200(this$0).setText(file.getName());
      }
      CoreDumpConfigurator.access$102(this$0, false);
    }
    String displayname = this$0.getDisplayname();
    CoreDumpConfigurator.access$200(this$0).setEnabled(CoreDumpConfigurator.access$000(this$0).isSelected());
    
    CoreDumpConfigurator.access$300(this$0).setEnabled((coreDumpFile.exists()) && (coreDumpFile.isFile()) && (jdkHomeFile.exists()) && (jdkHomeFile.isDirectory()) && (displayname.length() > 0));
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.coredump.impl.CoreDumpConfigurator.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.coredump.impl;

import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;

class CoreDumpConfigurator$2
  implements DocumentListener
{
  CoreDumpConfigurator$2(CoreDumpConfigurator paramCoreDumpConfigurator) {}
  
  public void insertUpdate(DocumentEvent e)
  {
    CoreDumpConfigurator.access$400(this$0);
  }
  
  public void removeUpdate(DocumentEvent e)
  {
    CoreDumpConfigurator.access$400(this$0);
  }
  
  public void changedUpdate(DocumentEvent e)
  {
    CoreDumpConfigurator.access$400(this$0);
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.coredump.impl.CoreDumpConfigurator.2
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.coredump.impl;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

class CoreDumpConfigurator$3
  implements ActionListener
{
  CoreDumpConfigurator$3(CoreDumpConfigurator paramCoreDumpConfigurator) {}
  
  public void actionPerformed(ActionEvent e)
  {
    CoreDumpConfigurator.access$500(this$0);
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.coredump.impl.CoreDumpConfigurator.3
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.coredump.impl;

import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;

class CoreDumpConfigurator$4
  implements DocumentListener
{
  CoreDumpConfigurator$4(CoreDumpConfigurator paramCoreDumpConfigurator) {}
  
  public void insertUpdate(DocumentEvent e)
  {
    CoreDumpConfigurator.access$400(this$0);
  }
  
  public void removeUpdate(DocumentEvent e)
  {
    CoreDumpConfigurator.access$400(this$0);
  }
  
  public void changedUpdate(DocumentEvent e)
  {
    CoreDumpConfigurator.access$400(this$0);
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.coredump.impl.CoreDumpConfigurator.4
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.coredump.impl;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

class CoreDumpConfigurator$5
  implements ActionListener
{
  CoreDumpConfigurator$5(CoreDumpConfigurator paramCoreDumpConfigurator) {}
  
  public void actionPerformed(ActionEvent e)
  {
    CoreDumpConfigurator.access$600(this$0);
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.coredump.impl.CoreDumpConfigurator.5
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.coredump.impl;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

class CoreDumpConfigurator$6
  implements ActionListener
{
  CoreDumpConfigurator$6(CoreDumpConfigurator paramCoreDumpConfigurator) {}
  
  public void actionPerformed(ActionEvent e)
  {
    CoreDumpConfigurator.access$400(this$0);
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.coredump.impl.CoreDumpConfigurator.6
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.coredump.impl;

import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;

class CoreDumpConfigurator$7
  implements DocumentListener
{
  CoreDumpConfigurator$7(CoreDumpConfigurator paramCoreDumpConfigurator) {}
  
  public void insertUpdate(DocumentEvent e)
  {
    CoreDumpConfigurator.access$400(this$0);
  }
  
  public void removeUpdate(DocumentEvent e)
  {
    CoreDumpConfigurator.access$400(this$0);
  }
  
  public void changedUpdate(DocumentEvent e)
  {
    CoreDumpConfigurator.access$400(this$0);
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.coredump.impl.CoreDumpConfigurator.7
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.coredump.impl;

import com.sun.tools.visualvm.core.snapshot.SnapshotCategory;
import com.sun.tools.visualvm.coredump.CoreDumpSupport;
import java.awt.Dialog;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JFileChooser;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.text.Document;
import org.openide.DialogDescriptor;
import org.openide.DialogDisplayer;
import org.openide.awt.Mnemonics;
import org.openide.util.NbBundle;
import org.openide.windows.WindowManager;

class CoreDumpConfigurator
  extends JPanel
{
  private boolean internalChange = false;
  private static CoreDumpConfigurator defaultInstance;
  private JLabel coreDumpFileLabel;
  private JTextField coreDumpFileField;
  private JButton coreDumpFileButton;
  private JLabel javaHomeFileLabel;
  private JTextField javaHomeFileField;
  private JButton javaHomeFileButton;
  private JCheckBox displaynameCheckbox;
  private JTextField displaynameField;
  private JCheckBox deleteSourceCheckbox;
  private JButton okButton;
  
  public static CoreDumpConfigurator defineCoreDump()
  {
    CoreDumpConfigurator hc = getDefault();
    hc.setupDefineCoreDump();
    
    DialogDescriptor dd = new DialogDescriptor(hc, NbBundle.getMessage(CoreDumpConfigurator.class, "Title_Add_VM_Coredump"), true, new Object[] { okButton, DialogDescriptor.CANCEL_OPTION }, okButton, 0, null, null);
    
    Dialog d = DialogDisplayer.getDefault().createDialog(dd);
    d.pack();
    d.setVisible(true);
    if (dd.getValue() == okButton) {
      return hc;
    }
    return null;
  }
  
  public String getCoreDumpFile()
  {
    return coreDumpFileField.getText().trim();
  }
  
  public String getDisplayname()
  {
    return displaynameField.getText().trim();
  }
  
  public String getJavaHome()
  {
    return javaHomeFileField.getText().trim();
  }
  
  public boolean deleteSourceFile()
  {
    return deleteSourceCheckbox.isSelected();
  }
  
  private CoreDumpConfigurator()
  {
    initComponents();
    update();
  }
  
  private static CoreDumpConfigurator getDefault()
  {
    if (defaultInstance == null) {
      defaultInstance = new CoreDumpConfigurator();
    }
    return defaultInstance;
  }
  
  private void setupDefineCoreDump()
  {
    coreDumpFileField.setEnabled(true);
    displaynameCheckbox.setSelected(false);
    displaynameCheckbox.setEnabled(true);
    coreDumpFileField.setText("");
    displaynameField.setText("");
    javaHomeFileField.setText(CoreDumpSupport.getCurrentJDKHome());
    javaHomeFileField.setEnabled(true);
    deleteSourceCheckbox.setSelected(false);
  }
  
  private void update()
  {
    if (internalChange) {
      return;
    }
    SwingUtilities.invokeLater(new Runnable()
    {
      public void run()
      {
        String coreDumpname = getCoreDumpFile();
        File coreDumpFile = new File(coreDumpname);
        
        String jdkHome = getJavaHome();
        File jdkHomeFile = new File(jdkHome);
        if (!displaynameCheckbox.isSelected())
        {
          internalChange = true;
          File file = new File(coreDumpname);
          if (file.isFile()) {
            displaynameField.setText(file.getName());
          }
          internalChange = false;
        }
        String displayname = getDisplayname();
        displaynameField.setEnabled(displaynameCheckbox.isSelected());
        
        okButton.setEnabled((coreDumpFile.exists()) && (coreDumpFile.isFile()) && (jdkHomeFile.exists()) && (jdkHomeFile.isDirectory()) && (displayname.length() > 0));
      }
    });
  }
  
  private void chooseJavaHome()
  {
    JFileChooser chooser = new JFileChooser(new File(getJavaHome()));
    chooser.setDialogTitle(NbBundle.getMessage(CoreDumpConfigurator.class, "LBL_Select_JDK_Home"));
    chooser.setFileSelectionMode(1);
    int returnVal = chooser.showOpenDialog(WindowManager.getDefault().getMainWindow());
    if (returnVal == 0) {
      javaHomeFileField.setText(chooser.getSelectedFile().getAbsolutePath());
    }
  }
  
  private void chooseCoreDump()
  {
    JFileChooser chooser = new JFileChooser(new File(getCoreDumpFile()));
    chooser.setDialogTitle(NbBundle.getMessage(CoreDumpConfigurator.class, "LBL_Select_VM_Coredump"));
    chooser.setAcceptAllFileFilterUsed(false);
    chooser.setFileFilter(CoreDumpSupport.getCategory().getFileFilter());
    int returnVal = chooser.showOpenDialog(WindowManager.getDefault().getMainWindow());
    if (returnVal == 0) {
      coreDumpFileField.setText(chooser.getSelectedFile().getAbsolutePath());
    }
  }
  
  private void initComponents()
  {
    setLayout(new GridBagLayout());
    
    coreDumpFileLabel = new JLabel();
    Mnemonics.setLocalizedText(coreDumpFileLabel, NbBundle.getMessage(CoreDumpConfigurator.class, "LBL_VM_Coredump_file"));
    GridBagConstraints constraints = new GridBagConstraints();
    gridx = 0;
    gridy = 0;
    gridwidth = 1;
    fill = 0;
    anchor = 13;
    insets = new Insets(15, 10, 0, 0);
    add(coreDumpFileLabel, constraints);
    
    coreDumpFileField = new JTextField();
    coreDumpFileLabel.setLabelFor(coreDumpFileField);
    coreDumpFileField.setPreferredSize(new Dimension(220, coreDumpFileField.getPreferredSize().height));
    coreDumpFileField.getDocument().addDocumentListener(new DocumentListener()
    {
      public void insertUpdate(DocumentEvent e)
      {
        CoreDumpConfigurator.this.update();
      }
      
      public void removeUpdate(DocumentEvent e)
      {
        CoreDumpConfigurator.this.update();
      }
      
      public void changedUpdate(DocumentEvent e)
      {
        CoreDumpConfigurator.this.update();
      }
    });
    constraints = new GridBagConstraints();
    gridx = 1;
    gridy = 0;
    weightx = 1.0D;
    gridwidth = 1;
    fill = 2;
    anchor = 17;
    insets = new Insets(15, 5, 0, 0);
    add(coreDumpFileField, constraints);
    
    coreDumpFileButton = new JButton();
    Mnemonics.setLocalizedText(coreDumpFileButton, NbBundle.getMessage(CoreDumpConfigurator.class, "LBL_Browse"));
    coreDumpFileButton.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        CoreDumpConfigurator.this.chooseCoreDump();
      }
    });
    constraints = new GridBagConstraints();
    gridx = 2;
    gridy = 0;
    gridwidth = 1;
    fill = 0;
    anchor = 17;
    insets = new Insets(15, 5, 0, 10);
    add(coreDumpFileButton, constraints);
    
    javaHomeFileLabel = new JLabel();
    Mnemonics.setLocalizedText(javaHomeFileLabel, NbBundle.getMessage(CoreDumpConfigurator.class, "LBL_JDK_home"));
    constraints = new GridBagConstraints();
    gridx = 0;
    gridy = 1;
    gridwidth = 1;
    fill = 0;
    anchor = 13;
    insets = new Insets(8, 10, 0, 0);
    add(javaHomeFileLabel, constraints);
    
    javaHomeFileField = new JTextField();
    javaHomeFileLabel.setLabelFor(javaHomeFileField);
    javaHomeFileField.setPreferredSize(new Dimension(220, javaHomeFileField.getPreferredSize().height));
    javaHomeFileField.getDocument().addDocumentListener(new DocumentListener()
    {
      public void insertUpdate(DocumentEvent e)
      {
        CoreDumpConfigurator.this.update();
      }
      
      public void removeUpdate(DocumentEvent e)
      {
        CoreDumpConfigurator.this.update();
      }
      
      public void changedUpdate(DocumentEvent e)
      {
        CoreDumpConfigurator.this.update();
      }
    });
    constraints = new GridBagConstraints();
    gridx = 1;
    gridy = 1;
    gridwidth = 1;
    fill = 2;
    anchor = 17;
    insets = new Insets(8, 5, 0, 0);
    add(javaHomeFileField, constraints);
    
    javaHomeFileButton = new JButton();
    Mnemonics.setLocalizedText(javaHomeFileButton, NbBundle.getMessage(CoreDumpConfigurator.class, "LBL_Browse1"));
    javaHomeFileButton.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        CoreDumpConfigurator.this.chooseJavaHome();
      }
    });
    constraints = new GridBagConstraints();
    gridx = 2;
    gridy = 1;
    gridwidth = 1;
    fill = 0;
    anchor = 17;
    insets = new Insets(8, 5, 0, 10);
    add(javaHomeFileButton, constraints);
    
    displaynameCheckbox = new JCheckBox();
    Mnemonics.setLocalizedText(displaynameCheckbox, NbBundle.getMessage(CoreDumpConfigurator.class, "LBL_Display_name"));
    displaynameCheckbox.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        CoreDumpConfigurator.this.update();
      }
    });
    constraints = new GridBagConstraints();
    gridx = 0;
    gridy = 2;
    gridwidth = 1;
    fill = 0;
    anchor = 17;
    insets = new Insets(8, 10, 0, 0);
    add(displaynameCheckbox, constraints);
    
    displaynameField = new JTextField();
    displaynameField.setPreferredSize(new Dimension(220, displaynameField.getPreferredSize().height));
    displaynameField.getDocument().addDocumentListener(new DocumentListener()
    {
      public void insertUpdate(DocumentEvent e)
      {
        CoreDumpConfigurator.this.update();
      }
      
      public void removeUpdate(DocumentEvent e)
      {
        CoreDumpConfigurator.this.update();
      }
      
      public void changedUpdate(DocumentEvent e)
      {
        CoreDumpConfigurator.this.update();
      }
    });
    constraints = new GridBagConstraints();
    gridx = 1;
    gridy = 2;
    gridwidth = 0;
    fill = 2;
    anchor = 17;
    insets = new Insets(8, 5, 0, 10);
    add(displaynameField, constraints);
    
    deleteSourceCheckbox = new JCheckBox();
    Mnemonics.setLocalizedText(deleteSourceCheckbox, NbBundle.getMessage(CoreDumpConfigurator.class, "LBL_Delete_source_file"));
    constraints = new GridBagConstraints();
    gridx = 0;
    gridy = 3;
    gridwidth = 0;
    fill = 0;
    anchor = 17;
    insets = new Insets(18, 10, 0, 0);
    add(deleteSourceCheckbox, constraints);
    
    JPanel spacer = new JPanel(null);
    spacer.setOpaque(false);
    constraints = new GridBagConstraints();
    gridx = 0;
    gridy = 4;
    weighty = 1.0D;
    gridwidth = 0;
    fill = 1;
    anchor = 18;
    insets = new Insets(0, 0, 15, 0);
    add(spacer, constraints);
    
    okButton = new JButton(NbBundle.getMessage(CoreDumpConfigurator.class, "LBL_OK"));
    
    displaynameCheckbox.setBorder(coreDumpFileLabel.getBorder());
    deleteSourceCheckbox.setBorder(coreDumpFileLabel.getBorder());
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.coredump.impl.CoreDumpConfigurator
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.coredump.impl;

import com.sun.tools.visualvm.core.datasource.DataSource;
import com.sun.tools.visualvm.core.datasource.descriptor.DataSourceDescriptor;
import com.sun.tools.visualvm.core.model.AbstractModelProvider;
import com.sun.tools.visualvm.coredump.CoreDump;
import com.sun.tools.visualvm.coredump.CoreDumpDescriptor;

public class CoreDumpDescriptorProvider
  extends AbstractModelProvider<DataSourceDescriptor, DataSource>
{
  public DataSourceDescriptor createModelFor(DataSource ds)
  {
    if ((ds instanceof CoreDump)) {
      return new CoreDumpDescriptor((CoreDump)ds);
    }
    return null;
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.coredump.impl.CoreDumpDescriptorProvider
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.coredump.impl;

import com.sun.tools.visualvm.core
1 2 3

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2019. Infinite Loop Ltd