Package com.onpositive.gae.profiler

Source Code of com.onpositive.gae.profiler.CaptureSnapshotAction

/**
*
*/
package com.onpositive.gae.profiler;

import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.swt.widgets.Display;

import com.onpositive.gae.profiler.ProfilingAction.CaptureSnapshot;
import com.onpositive.gae.profiler.core.TakeSnapshot;

public final class CaptureSnapshotAction extends Action {
 
  public CaptureSnapshotAction(String text) {
    super(text);   
  }
 
  private boolean isDebug() {
    boolean isLocal = com.onpositive.gae.baseviewer.Activator.getDefault()
        .getPreferenceStore().getBoolean(
            "CONNECTION_MODE");
    return isLocal;
  }

  public void run() {
    if (!com.onpositive.gae.tools.license.LicenseChecker.checkLicense(isDebug())){
      return;
    }
    final TakeSnapshot takeSnapshot = new TakeSnapshot(
        "Capturing current performance data",isDebug());
    takeSnapshot.addJobChangeListener(new JobChangeAdapter() {

      public void done(IJobChangeEvent event) {
        if (event.getResult().isOK()){
          Display.getDefault().asyncExec(new CaptureSnapshot(takeSnapshot));
        }
      }

    });
    takeSnapshot.schedule();

  }
}
TOP

Related Classes of com.onpositive.gae.profiler.CaptureSnapshotAction

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.