Search in sources :

Example 6 with ITreeLeaf

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

the class LaunchesListener method launchesChanged.

@Override
public void launchesChanged(final ILaunch[] launches) {
    for (int i = 0; i < launches.length; i++) {
        ILaunch launched = launches[i];
        List<ITreeLeaf> children = executorMonitorView.getRoot().children();
        for (int j = 0, size = children.size(); i < size; i++) {
            final LaunchElement launchElement = (LaunchElement) children.get(j);
            if (launched.equals(launchElement.launch())) {
                launchElement.changed();
                PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {

                    @Override
                    public void run() {
                        executorMonitorView.getTreeViewer().expandToLevel(launchElement, 3);
                        executorMonitorView.getTreeViewer().refresh(launchElement);
                    }
                });
            }
        }
    }
    executorMonitorView.updateActions();
}
Also used : ILaunch(org.eclipse.debug.core.ILaunch) ITreeLeaf(org.eclipse.titan.executor.executors.ITreeLeaf)

Example 7 with ITreeLeaf

use of org.eclipse.titan.executor.executors.ITreeLeaf 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 8 with ITreeLeaf

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

the class NotificationView method getInitialInput.

private ITreeLeaf getInitialInput() {
    final ISelection selection = getSite().getPage().getSelection(EXECUTORMONITOR_VIEW_ID);
    if (null == selection || selection.isEmpty()) {
        return null;
    }
    final IStructuredSelection structuredSelection = (IStructuredSelection) selection;
    ITreeLeaf element = (ITreeLeaf) structuredSelection.getFirstElement();
    if (null != element) {
        while (!(element instanceof LaunchElement)) {
            element = element.parent();
        }
    }
    return element;
}
Also used : ISelection(org.eclipse.jface.viewers.ISelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ITreeLeaf(org.eclipse.titan.executor.executors.ITreeLeaf) LaunchElement(org.eclipse.titan.executor.views.executormonitor.LaunchElement)

Example 9 with ITreeLeaf

use of org.eclipse.titan.executor.executors.ITreeLeaf 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 ITreeLeaf

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

the class TestSetTab method performApply.

@Override
public void performApply(final ILaunchConfigurationWorkingCopy configuration) {
    List<String> testsetNames = new ArrayList<String>();
    List<List<String>> testSets = new ArrayList<List<String>>();
    for (ITreeLeaf testSet : treeRoot.children()) {
        testsetNames.add(testSet.name());
        List<String> testcases = new ArrayList<String>();
        for (ITreeLeaf testcase : ((TestsetTreeElement) testSet).children()) {
            testcases.add(testcase.name());
        }
        testSets.add(testcases);
    }
    configuration.setAttribute(AVAILABLECONTROLPARTS_LABEL, availableControlparts);
    configuration.setAttribute(AVAILABLETESTCASES_LABEL, availableTestcases);
    configuration.setAttribute(TESTSETNAMES_LABEL, testsetNames);
    for (int i = 0, size = testSets.size(); i < size; i++) {
        configuration.setAttribute(TESTCASESOF_PREFIX + testsetNames.get(i), testSets.get(i));
    }
    setErrorMessage(null);
}
Also used : ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) ITreeLeaf(org.eclipse.titan.executor.executors.ITreeLeaf)

Aggregations

ITreeLeaf (org.eclipse.titan.executor.executors.ITreeLeaf)16 BaseExecutor (org.eclipse.titan.executor.executors.BaseExecutor)9 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)8 LaunchElement (org.eclipse.titan.executor.views.executormonitor.LaunchElement)7 List (java.util.List)4 ILaunch (org.eclipse.debug.core.ILaunch)4 MainControllerElement (org.eclipse.titan.executor.views.executormonitor.MainControllerElement)4 ArrayList (java.util.ArrayList)3 ILaunchConfiguration (org.eclipse.debug.core.ILaunchConfiguration)2 Action (org.eclipse.jface.action.Action)2 ISelection (org.eclipse.jface.viewers.ISelection)2 File (java.io.File)1 FileWriter (java.io.FileWriter)1 IOException (java.io.IOException)1 PrintWriter (java.io.PrintWriter)1 Iterator (java.util.Iterator)1 IFile (org.eclipse.core.resources.IFile)1 IWorkspaceRoot (org.eclipse.core.resources.IWorkspaceRoot)1 IProcess (org.eclipse.debug.core.model.IProcess)1 MenuManager (org.eclipse.jface.action.MenuManager)1