use of org.eclipse.titan.executor.executors.ITreeLeaf in project titan.EclipsePlug-ins by eclipse.
the class TestSetTab method createActions.
private void createActions() {
newTestset = new Action("create new testset") {
@Override
public void run() {
if (null == testsetViewer) {
return;
}
TestsetDialog dialog = new TestsetDialog(getShell(), "Create new testset");
if (dialog.open() != Window.OK) {
return;
}
String testsetName = dialog.getTestsetName();
List<ITreeLeaf> children = treeRoot.children();
for (ITreeLeaf aChildren : children) {
if (aChildren.name().equals(testsetName)) {
return;
}
}
treeRoot.addChildToEnd(new TestsetTreeElement(testsetName));
testsetViewer.refresh();
updateLaunchConfigurationDialog();
super.run();
}
};
newTestset.setToolTipText("creates a new testset");
newTestset.setEnabled(true);
rename = new Action("rename testset") {
@Override
public void run() {
if (null == testsetViewer || testsetViewer.getSelection().isEmpty()) {
return;
}
IStructuredSelection selection = (IStructuredSelection) testsetViewer.getSelection();
TestsetDialog dialog = new TestsetDialog(getShell(), "Rename testset");
dialog.setTestsetName(((TestsetTreeElement) selection.getFirstElement()).name());
if (dialog.open() != Window.OK) {
return;
}
String testsetName = dialog.getTestsetName();
List<ITreeLeaf> children = treeRoot.children();
for (ITreeLeaf aChildren : children) {
if (aChildren.name().equals(testsetName)) {
return;
}
}
((TestsetTreeElement) selection.getFirstElement()).name(testsetName);
testsetViewer.refresh();
updateLaunchConfigurationDialog();
super.run();
}
};
rename.setToolTipText("rename selected testset");
rename.setEnabled(false);
remove = new Action("remove") {
@Override
public void run() {
if (null == testsetViewer || testsetViewer.getSelection().isEmpty()) {
return;
}
testsetViewer.getTree().setRedraw(false);
IStructuredSelection selection = (IStructuredSelection) testsetViewer.getSelection();
for (Iterator<?> iterator = selection.iterator(); iterator.hasNext(); ) {
TreeLeaf element = (TreeLeaf) iterator.next();
if (null != element.parent()) {
((TestsetTreeElement) element.parent()).remove(element);
element.dispose();
}
}
testsetViewer.getTree().setRedraw(true);
testsetViewer.refresh();
updateLaunchConfigurationDialog();
super.run();
}
};
remove.setToolTipText("removes the selected elements");
remove.setEnabled(false);
}
use of org.eclipse.titan.executor.executors.ITreeLeaf in project titan.EclipsePlug-ins by eclipse.
the class ExecutorMonitorContentProvider method getChildren.
@Override
public ITreeLeaf[] getChildren(final Object parentElement) {
if (parentElement instanceof MainControllerElement) {
final BaseExecutor executor = ((MainControllerElement) parentElement).executor();
final List<ITreeLeaf> children = executor.mainControllerRoot().children();
return children.toArray(new ITreeLeaf[children.size()]);
} else if (parentElement instanceof ITreeBranch) {
final List<ITreeLeaf> children = ((ITreeBranch) parentElement).children();
return children.toArray(new ITreeLeaf[children.size()]);
}
return new ITreeBranch[] {};
}
use of org.eclipse.titan.executor.executors.ITreeLeaf in project titan.EclipsePlug-ins by eclipse.
the class ExecutorMonitorView method removeSelected.
private void removeSelected() {
if (null == viewer || viewer.getSelection().isEmpty()) {
return;
}
IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
viewer.getTree().setRedraw(false);
for (Iterator<?> iterator = selection.iterator(); iterator.hasNext(); ) {
ITreeLeaf element = (ITreeLeaf) iterator.next();
while (!(element instanceof LaunchElement)) {
element = element.parent();
}
ILaunch launched = ((LaunchElement) element).launch();
ILaunchConfiguration launchConfiguration = launched.getLaunchConfiguration();
MainControllerElement mainController;
if (1 == ((LaunchElement) element).children().size()) {
mainController = (MainControllerElement) ((LaunchElement) element).children().get(0);
} else {
mainController = null;
}
if (isSupportedConfiguration(launchConfiguration) && null != mainController) {
BaseExecutor executor = mainController.executor();
if (executor.isTerminated()) {
DebugPlugin.getDefault().getLaunchManager().removeLaunch(launched);
}
}
}
viewer.setSelection(null);
updateActions();
viewer.getTree().setRedraw(true);
}
use of org.eclipse.titan.executor.executors.ITreeLeaf in project titan.EclipsePlug-ins by eclipse.
the class TestExecutionView 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;
}
use of org.eclipse.titan.executor.executors.ITreeLeaf 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);
}
Aggregations