Search in sources :

Example 1 with IJvm

use of org.talend.designer.runtime.visualization.IJvm 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)

Example 2 with IJvm

use of org.talend.designer.runtime.visualization.IJvm in project tdi-studio-se by Talend.

the class ActiveJvm method refreshHost.

/**
     * Refreshes the host.
     * 
     * @return True if JVM has been added to host
     * @throws JvmCoreException
     */
private boolean refreshHost() throws JvmCoreException {
    //$NON-NLS-1$
    String[] elements = mBeanServer.getRuntimeName().split("@");
    if (elements == null || elements.length != 2) {
        throw new JvmCoreException(IStatus.ERROR, Messages.getHostNameFailedMsg, new Exception());
    }
    String hostName = elements[1];
    Host host = (Host) JvmModel.getInstance().getHost(hostName);
    if (host == null) {
        host = new Host(hostName);
    } else {
        for (IJvm jvm : host.getActiveJvms()) {
            if (jvm.getPid() == getPid()) {
                return false;
            }
        }
    }
    host.addActiveJvm(this);
    setHost(host);
    return true;
}
Also used : IHost(org.talend.designer.runtime.visualization.IHost) IJvm(org.talend.designer.runtime.visualization.IJvm) MalformedURLException(java.net.MalformedURLException) IOException(java.io.IOException) CoreException(org.eclipse.core.runtime.CoreException) JvmCoreException(org.talend.designer.runtime.visualization.JvmCoreException) JvmCoreException(org.talend.designer.runtime.visualization.JvmCoreException)

Aggregations

IJvm (org.talend.designer.runtime.visualization.IJvm)2 IOException (java.io.IOException)1 MalformedURLException (java.net.MalformedURLException)1 CoreException (org.eclipse.core.runtime.CoreException)1 StyledString (org.eclipse.jface.viewers.StyledString)1 IHost (org.talend.designer.runtime.visualization.IHost)1 ISnapshot (org.talend.designer.runtime.visualization.ISnapshot)1 ITerminatedJvm (org.talend.designer.runtime.visualization.ITerminatedJvm)1 JvmCoreException (org.talend.designer.runtime.visualization.JvmCoreException)1