Search in sources :

Example 1 with ISnapshot

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

the class DeleteAction method run.

/*
     * @see Action#run()
     */
@Override
public void run() {
    if (!confirm()) {
        return;
    }
    // delete JVMs
    deleteJvms();
    // delete remote hosts
    for (IHost host : remoteHosts) {
        jvms = host.getTerminatedJvms();
        deleteJvms();
    }
    for (IHost host : remoteHosts) {
        JvmModel.getInstance().removeHost(host);
    }
    // delete snapshots
    for (ISnapshot snapshot : snapshots) {
        closeEditor(snapshot.getFileStore());
        snapshot.getJvm().deleteSnapshot(snapshot);
    }
    treeViewer.refresh();
}
Also used : ISnapshot(org.talend.designer.runtime.visualization.ISnapshot) IHost(org.talend.designer.runtime.visualization.IHost)

Example 2 with ISnapshot

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

the class AbstractJvm method refreshSnapshots.

/**
     * Refreshes the snapshots.
     */
protected void refreshSnapshots() {
    snapshots = new ArrayList<ISnapshot>();
    IPath baseDirectory;
    try {
        baseDirectory = getBaseDirectory();
    } catch (JvmCoreException e) {
        // do nothing
        return;
    }
    File[] files = baseDirectory.toFile().listFiles();
    if (files == null) {
        return;
    }
    for (File file : files) {
        String fileName = file.getName();
        if (Snapshot.isValidFile(fileName)) {
            Snapshot snapshot = new Snapshot(Util.getFileStore(fileName, baseDirectory), this);
            snapshots.add(snapshot);
        }
    }
}
Also used : ISnapshot(org.talend.designer.runtime.visualization.ISnapshot) IPath(org.eclipse.core.runtime.IPath) ISnapshot(org.talend.designer.runtime.visualization.ISnapshot) File(java.io.File) JvmCoreException(org.talend.designer.runtime.visualization.JvmCoreException)

Example 3 with ISnapshot

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

ISnapshot (org.talend.designer.runtime.visualization.ISnapshot)3 File (java.io.File)1 IPath (org.eclipse.core.runtime.IPath)1 StyledString (org.eclipse.jface.viewers.StyledString)1 IHost (org.talend.designer.runtime.visualization.IHost)1 IJvm (org.talend.designer.runtime.visualization.IJvm)1 ITerminatedJvm (org.talend.designer.runtime.visualization.ITerminatedJvm)1 JvmCoreException (org.talend.designer.runtime.visualization.JvmCoreException)1