Search in sources :

Example 1 with ITerminatedJvm

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;
}
Also used : ITerminatedJvm(org.talend.designer.runtime.visualization.ITerminatedJvm) ITerminatedJvm(org.talend.designer.runtime.visualization.ITerminatedJvm)

Example 2 with ITerminatedJvm

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;
        }
    }
}
Also used : IActiveJvm(org.talend.designer.runtime.visualization.IActiveJvm) IPath(org.eclipse.core.runtime.IPath) ITerminatedJvm(org.talend.designer.runtime.visualization.ITerminatedJvm) JvmModelEvent(org.talend.designer.runtime.visualization.JvmModelEvent) JvmCoreException(org.talend.designer.runtime.visualization.JvmCoreException)

Example 3 with ITerminatedJvm

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;
}
Also used : ISnapshot(org.talend.designer.runtime.visualization.ISnapshot) IJvm(org.talend.designer.runtime.visualization.IJvm) StyledString(org.eclipse.jface.viewers.StyledString) StyledString(org.eclipse.jface.viewers.StyledString) ITerminatedJvm(org.talend.designer.runtime.visualization.ITerminatedJvm)

Aggregations

ITerminatedJvm (org.talend.designer.runtime.visualization.ITerminatedJvm)3 IPath (org.eclipse.core.runtime.IPath)1 StyledString (org.eclipse.jface.viewers.StyledString)1 IActiveJvm (org.talend.designer.runtime.visualization.IActiveJvm)1 IJvm (org.talend.designer.runtime.visualization.IJvm)1 ISnapshot (org.talend.designer.runtime.visualization.ISnapshot)1 JvmCoreException (org.talend.designer.runtime.visualization.JvmCoreException)1 JvmModelEvent (org.talend.designer.runtime.visualization.JvmModelEvent)1