use of org.talend.designer.runtime.visualization.IActiveJvm in project tdi-studio-se by Talend.
the class DumpCpuProfilingDataAction method performRun.
/*
* @see AbstractJobAction#performRun(IProgressMonitor)
*/
@Override
protected IStatus performRun(IProgressMonitor monitor) {
IActiveJvm jvm = section.getJvm();
if (jvm == null) {
return Status.CANCEL_STATUS;
}
IFileStore fileStore = null;
try {
fileStore = jvm.getCpuProfiler().dump();
} catch (JvmCoreException e) {
Activator.log(Messages.dumpCpuProfileDataFailedMsg, e);
return Status.CANCEL_STATUS;
}
section.setPinned(true);
OpenSnapshotAction.openEditor(fileStore);
return Status.OK_STATUS;
}
use of org.talend.designer.runtime.visualization.IActiveJvm in project tdi-studio-se by Talend.
the class AbstractJvmPropertySection method setInput.
/*
* @see AbstractPropertySection#setInput(IWorkbenchPart, ISelection)
*/
@Override
public final void setInput(IWorkbenchPart part, ISelection selection) {
super.setInput(part, selection);
if (!(selection instanceof StructuredSelection)) {
return;
}
StructuredSelection structuredSelection = (StructuredSelection) selection;
Object firstElement = structuredSelection.getFirstElement();
if (!(firstElement instanceof IActiveJvm)) {
super.setInput(part, null);
return;
}
IActiveJvm oldJvm = jvm;
IActiveJvm newJvm = (IActiveJvm) firstElement;
jvm = newJvm;
if (oldJvm != newJvm || newJvm.isConnected()) {
updatePage();
}
addToolBarActions();
addLocalMenus();
if (newJvm.isConnected()) {
activateSection();
}
setInput(part, selection, newJvm, oldJvm);
}
use of org.talend.designer.runtime.visualization.IActiveJvm in project tdi-studio-se by Talend.
the class Host method addActiveJvm.
/**
* Adds the active JVM.
*
* @param jvm The active JVM.
* @return The active JVM
*/
protected IActiveJvm addActiveJvm(IActiveJvm jvm) {
for (IActiveJvm activeJvm : activeJvms) {
if (activeJvm.getPid() == jvm.getPid()) {
return jvm;
}
}
activeJvms.add(jvm);
JvmModel.getInstance().fireJvmModelChangeEvent(new JvmModelEvent(State.JvmAdded, jvm));
return jvm;
}
use of org.talend.designer.runtime.visualization.IActiveJvm in project tdi-studio-se by Talend.
the class Host method addLocalActiveJvm.
/*
* @see IHost#addLocalActiveJvm(int, String, String, String)
*/
@Override
public IActiveJvm addLocalActiveJvm(int pid, String mainClass, String url, String errorStateMessage) throws JvmCoreException {
for (IActiveJvm jvm : getActiveJvms()) {
if (jvm.getPid() == pid) {
return jvm;
}
}
ActiveJvm jvm = new ActiveJvm(pid, url, this);
jvm.setMainClass(mainClass);
jvm.setErrorStateMessage(errorStateMessage);
return addActiveJvm(jvm);
}
use of org.talend.designer.runtime.visualization.IActiveJvm in project tdi-studio-se by Talend.
the class Host method removeJvm.
/*
* @see IHost#removeJvm(int)
*/
@Override
public void removeJvm(int pid) {
IPath hostDir = null;
try {
hostDir = getHostDir();
} catch (JvmCoreException e) {
Activator.log(IStatus.ERROR, NLS.bind(Messages.removeJvmFailedMsg, +pid), e);
return;
}
for (ITerminatedJvm jvm : terminatedJvms) {
if (jvm.getPid() == pid) {
terminatedJvms.remove(jvm);
int id = (jvm.getPid() != -1) ? jvm.getPid() : jvm.getPort();
IPath dirPath = hostDir.append(File.separator + id + IJvm.DIR_SUFFIX);
Util.deleteDir(dirPath.toFile());
JvmModel.getInstance().fireJvmModelChangeEvent(new JvmModelEvent(State.JvmRemoved, null));
break;
}
}
for (IActiveJvm jvm : activeJvms) {
if (jvm.getPid() == pid) {
if (jvm.isConnected()) {
jvm.disconnect();
}
if (jvm.getShapshots().size() > 0) {
addTerminatedJvm(jvm.getPid(), -1, jvm.getMainClass());
} else {
int id = (jvm.getPid() != -1) ? jvm.getPid() : jvm.getPort();
IPath dirPath = hostDir.append(File.separator + id + IJvm.DIR_SUFFIX);
Util.deleteDir(dirPath.toFile());
}
activeJvms.remove(jvm);
JvmModel.getInstance().fireJvmModelChangeEvent(new JvmModelEvent(State.JvmRemoved, null));
break;
}
}
}
Aggregations