Search in sources :

Example 6 with BaseExecutor

use of org.eclipse.titan.executor.executors.BaseExecutor in project titan.EclipsePlug-ins by eclipse.

the class LaunchElement method dispose.

@Override
public void dispose() {
    if (ExecutorStorage.getExecutorMap().containsKey(launch)) {
        final BaseExecutor executor = ExecutorStorage.getExecutorMap().get(launch);
        executor.dispose();
        ExecutorStorage.getExecutorMap().remove(launch);
    }
    LaunchStorage.getLaunchElementMap().remove(launch);
    launch = null;
    super.dispose();
}
Also used : BaseExecutor(org.eclipse.titan.executor.executors.BaseExecutor)

Example 7 with BaseExecutor

use of org.eclipse.titan.executor.executors.BaseExecutor in project titan.EclipsePlug-ins by eclipse.

the class TestExecutionView method createTooltip.

private void createTooltip(final ITreeLeaf element) {
    if (null == element) {
        setTitleToolTip(null);
        return;
    }
    final List<ExecutedTestcase> executedTestCases = new ArrayList<ExecutedTestcase>();
    final List<ITreeLeaf> children = ((LaunchElement) actualInput).children();
    ITreeLeaf executorElement;
    for (ITreeLeaf aChildren : children) {
        executorElement = aChildren;
        if (executorElement instanceof MainControllerElement) {
            BaseExecutor executor = ((MainControllerElement) executorElement).executor();
            if (null != executor) {
                executedTestCases.addAll(executor.executedTests());
            }
        }
    }
    if (executedTestCases.isEmpty()) {
        setTitleToolTip(element.name());
        return;
    }
    String statistics = createStatistics(element, executedTestCases);
    setTitleToolTip(statistics);
}
Also used : BaseExecutor(org.eclipse.titan.executor.executors.BaseExecutor) ArrayList(java.util.ArrayList) ITreeLeaf(org.eclipse.titan.executor.executors.ITreeLeaf) LaunchElement(org.eclipse.titan.executor.views.executormonitor.LaunchElement) MainControllerElement(org.eclipse.titan.executor.views.executormonitor.MainControllerElement)

Example 8 with BaseExecutor

use of org.eclipse.titan.executor.executors.BaseExecutor in project titan.EclipsePlug-ins by eclipse.

the class NotificationView method createActions.

private void createActions() {
    clearAction = new Action("Clear") {

        @Override
        public void run() {
            if (null != actualInput && actualInput instanceof LaunchElement) {
                final List<ITreeLeaf> children = ((LaunchElement) actualInput).children();
                for (ITreeLeaf aChildren : children) {
                    final BaseExecutor executor = ((MainControllerElement) aChildren).executor();
                    if (null != executor) {
                        executor.notifications().clear();
                        viewer.refresh();
                    }
                }
            }
        }
    };
    clearAction.setToolTipText("Clear");
    clearAction.setImageDescriptor(ImageCache.getImageDescriptor("trash_enabled.gif"));
    clearAction.setDisabledImageDescriptor(ImageCache.getImageDescriptor("trash_disabled.gif"));
    clearAction.setEnabled(false);
    saveAsAction = new Action("Save As") {

        @Override
        public void run() {
            saveAs();
        }
    };
    saveAsAction.setToolTipText("Save As");
    saveAsAction.setImageDescriptor(ImageCache.getImageDescriptor("saveas_edit.gif"));
    saveAsAction.setEnabled(false);
    followLastRecord = new Action("Follow the last record") {

        @Override
        public void run() {
            isFollowing = followLastRecord.isChecked();
        }
    };
    followLastRecord.setToolTipText("Toggles the follow the last line behavior");
    followLastRecord.setEnabled(true);
    followLastRecord.setChecked(isFollowing);
}
Also used : Action(org.eclipse.jface.action.Action) BaseExecutor(org.eclipse.titan.executor.executors.BaseExecutor) List(java.util.List) ITreeLeaf(org.eclipse.titan.executor.executors.ITreeLeaf) LaunchElement(org.eclipse.titan.executor.views.executormonitor.LaunchElement)

Example 9 with BaseExecutor

use of org.eclipse.titan.executor.executors.BaseExecutor in project titan.EclipsePlug-ins by eclipse.

the class TestExecutionView method selectionChanged.

@Override
public void selectionChanged(final IWorkbenchPart part, final ISelection selection) {
    if (this.equals(part) || !(selection instanceof IStructuredSelection) || null == viewer.getContentProvider()) {
        return;
    }
    ITreeLeaf selectedElement;
    if (selection.isEmpty()) {
        selectedElement = null;
    } else {
        selectedElement = (ITreeLeaf) ((IStructuredSelection) selection).getFirstElement();
    }
    if (null != selectedElement) {
        while (!(selectedElement instanceof LaunchElement)) {
            selectedElement = selectedElement.parent();
        }
    }
    if (null != actualInput && actualInput.equals(selectedElement)) {
        viewer.refresh(false);
    } else {
        viewer.setInput(selectedElement);
        actualInput = selectedElement;
    }
    if (isFollowing && null != actualInput && actualInput instanceof LaunchElement) {
        final List<ITreeLeaf> children = ((LaunchElement) actualInput).children();
        for (ITreeLeaf aChildren : children) {
            final BaseExecutor executor = ((MainControllerElement) aChildren).executor();
            if (null != executor && !executor.executedTests().isEmpty()) {
                viewer.reveal(executor.executedTests().get(executor.executedTests().size() - 1));
            }
        }
    }
    createTooltip(selectedElement);
    if (null == selectedElement) {
        saveAsAction.setEnabled(false);
    } else {
        saveAsAction.setEnabled(true);
    }
}
Also used : BaseExecutor(org.eclipse.titan.executor.executors.BaseExecutor) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ITreeLeaf(org.eclipse.titan.executor.executors.ITreeLeaf) LaunchElement(org.eclipse.titan.executor.views.executormonitor.LaunchElement) MainControllerElement(org.eclipse.titan.executor.views.executormonitor.MainControllerElement)

Example 10 with BaseExecutor

use of org.eclipse.titan.executor.executors.BaseExecutor in project titan.EclipsePlug-ins by eclipse.

the class ExecutorMonitorView method createPartControl.

@Override
public void createPartControl(final Composite parent) {
    viewer = new TreeViewer(parent, SWT.H_SCROLL | SWT.V_SCROLL);
    contentProvider = new ExecutorMonitorContentProvider();
    viewer.setContentProvider(contentProvider);
    labelProvider = new ExecutorMonitorLabelProvider();
    viewer.setLabelProvider(labelProvider);
    createActions();
    manager = new MenuManager("menuManager");
    createEmptyContextMenu();
    createToolBar();
    Activator.setMainView(this);
    viewer.setInput(getInitialInput());
    viewer.expandToLevel(2);
    updateActions();
    getSite().setSelectionProvider(viewer);
    launchListener = new LaunchesListener(this);
    DebugPlugin.getDefault().getLaunchManager().addLaunchListener(launchListener);
    selectionChangedListener = new ISelectionChangedListener() {

        @Override
        public void selectionChanged(final SelectionChangedEvent event) {
            IStructuredSelection selection = (IStructuredSelection) event.getSelection();
            ITreeLeaf element = (ITreeLeaf) selection.getFirstElement();
            updateActions();
            if (null == element) {
                return;
            }
            if (element instanceof LaunchElement) {
                createLauncherContextMenu();
            } else if (element instanceof MainControllerElement) {
                createExecutorContextMenu((MainControllerElement) element);
                BaseExecutor executor = ((MainControllerElement) element).executor();
                IProcess process = executor.getProcess();
                if (null == process) {
                    return;
                }
                IConsole console = DebugUITools.getConsole(process);
                if (null == console) {
                    return;
                }
                IConsole[] consoles = ConsolePlugin.getDefault().getConsoleManager().getConsoles();
                boolean exists = false;
                for (IConsole console2 : consoles) {
                    if (console2.equals(console)) {
                        exists = true;
                    }
                }
                if (!exists) {
                    ConsolePlugin.getDefault().getConsoleManager().addConsoles(new IConsole[] { console });
                }
                ConsolePlugin.getDefault().getConsoleManager().showConsoleView(console);
                ConsolePlugin.getDefault().getConsoleManager().refresh(console);
            } else {
                createEmptyContextMenu();
            }
        }
    };
    viewer.addSelectionChangedListener(selectionChangedListener);
}
Also used : TreeViewer(org.eclipse.jface.viewers.TreeViewer) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) IConsole(org.eclipse.ui.console.IConsole) BaseExecutor(org.eclipse.titan.executor.executors.BaseExecutor) MenuManager(org.eclipse.jface.action.MenuManager) ITreeLeaf(org.eclipse.titan.executor.executors.ITreeLeaf) IProcess(org.eclipse.debug.core.model.IProcess)

Aggregations

BaseExecutor (org.eclipse.titan.executor.executors.BaseExecutor)15 ITreeLeaf (org.eclipse.titan.executor.executors.ITreeLeaf)9 ILaunch (org.eclipse.debug.core.ILaunch)7 LaunchElement (org.eclipse.titan.executor.views.executormonitor.LaunchElement)7 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)5 ILaunchConfiguration (org.eclipse.debug.core.ILaunchConfiguration)4 MainControllerElement (org.eclipse.titan.executor.views.executormonitor.MainControllerElement)4 List (java.util.List)2 Map (java.util.Map)2 File (java.io.File)1 FileWriter (java.io.FileWriter)1 IOException (java.io.IOException)1 PrintWriter (java.io.PrintWriter)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 IFile (org.eclipse.core.resources.IFile)1 IWorkspaceRoot (org.eclipse.core.resources.IWorkspaceRoot)1 DebugException (org.eclipse.debug.core.DebugException)1 IProcess (org.eclipse.debug.core.model.IProcess)1 Action (org.eclipse.jface.action.Action)1