use of org.talend.designer.runtime.visualization.ITerminatedJvm in project tdi-studio-se by Talend.
the class Host method addTerminatedJvm.
/**
* Adds the terminated JVM.
*
* @param pid The process ID.
* @param port The port
* @param mainClass The main class
* @return The terminated JVM
*/
public ITerminatedJvm addTerminatedJvm(int pid, int port, String mainClass) {
for (ITerminatedJvm jvm : terminatedJvms) {
if (jvm.getPid() == pid) {
return jvm;
}
}
TerminatedJvm terminatedJvm = new TerminatedJvm(pid, port, mainClass, this);
terminatedJvms.add((ITerminatedJvm) terminatedJvm);
return terminatedJvm;
}
use of org.talend.designer.runtime.visualization.ITerminatedJvm 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;
}
}
}
use of org.talend.designer.runtime.visualization.ITerminatedJvm in project tdi-studio-se by Talend.
the class JvmTreeLabelProvider method getStyledText.
/*
* @see IStyledLabelProvider#getStyledText(Object)
*/
@Override
public StyledString getStyledText(Object element) {
StyledString text = new StyledString();
if (element instanceof IJvm) {
//$NON-NLS-1$
String prefix = "";
String mainClass = ((IJvm) element).getMainClass();
String suffix = getIdInicator((IJvm) element);
if (element instanceof ITerminatedJvm) {
//$NON-NLS-1$
prefix = "<terminated>";
}
text.append(prefix).append(mainClass).append(suffix);
text.setStyle(prefix.length() + mainClass.length(), suffix.length(), StyledString.DECORATIONS_STYLER);
} else if (element instanceof ISnapshot) {
String fileName = ((ISnapshot) element).getFileStore().getName();
text.append(fileName);
String date = ((ISnapshot) element).getTimeStamp();
if (date != null) {
//$NON-NLS-1$ //$NON-NLS-2$
text.append(" (").append(date).append(")");
}
} else {
text.append(element.toString());
}
return text;
}
Aggregations