use of org.eclipse.titan.executor.executors.BaseExecutor 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.BaseExecutor in project titan.EclipsePlug-ins by eclipse.
the class ExecutorMonitorView method removeAllTerminated.
private void removeAllTerminated() {
if (null == viewer) {
return;
}
for (int i = root.children().size() - 1; i >= 0; i--) {
LaunchElement element = (LaunchElement) root.children().get(i);
ILaunch launched = element.launch();
if (null == launched) {
// DebugPlugin.getDefault().getLaunchManager().removeLaunch(launched);
continue;
}
ILaunchConfiguration launchConfiguration = launched.getLaunchConfiguration();
MainControllerElement mainController;
if (1 == element.children().size()) {
mainController = (MainControllerElement) 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();
PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
@Override
public void run() {
viewer.refresh(root);
}
});
}
use of org.eclipse.titan.executor.executors.BaseExecutor in project titan.EclipsePlug-ins by eclipse.
the class ExecutorMonitorView method terminateAll.
private void terminateAll() {
if (null == viewer) {
return;
}
for (int i = root.children().size() - 1; i >= 0; i--) {
LaunchElement element = (LaunchElement) root.children().get(i);
ILaunch launched = element.launch();
ILaunchConfiguration launchConfiguration = launched.getLaunchConfiguration();
MainControllerElement mainController;
if (1 == (element).children().size()) {
mainController = (MainControllerElement) (element).children().get(0);
} else {
mainController = null;
}
if (isSupportedConfiguration(launchConfiguration) && null != mainController) {
BaseExecutor executor = mainController.executor();
if (!executor.isTerminated()) {
executor.terminate(false);
}
}
}
updateActions();
PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
@Override
public void run() {
viewer.refresh(root);
}
});
}
use of org.eclipse.titan.executor.executors.BaseExecutor 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.BaseExecutor in project titan.EclipsePlug-ins by eclipse.
the class ExecutorStorage method registerExecutorStorage.
/**
* Register the provided launch element.
* Only done if the launch is already registered.
*
* @param element the element to be registered
*/
public static void registerExecutorStorage(final LaunchElement element) {
ILaunch launch = element.launch();
if (ExecutorStorage.getExecutorMap().containsKey(launch)) {
final BaseExecutor executor = ExecutorStorage.getExecutorMap().get(launch);
if (null == executor.mainControllerRoot()) {
executor.mainControllerRoot(new MainControllerElement(BaseExecutor.MAIN_CONTROLLER, executor));
}
element.addChildToEnd(executor.mainControllerRoot());
}
}
Aggregations