use of org.eclipse.titan.executor.executors.ITreeLeaf in project titan.EclipsePlug-ins by eclipse.
the class TestcasesLabelProvider method getImage.
@Override
public Image getImage(final Object element) {
if (element instanceof TestsetTreeElement) {
final List<ITreeLeaf> temp = ((TestsetTreeElement) element).children();
String name;
for (ITreeLeaf aTemp : temp) {
name = aTemp.name();
if (availableTestcases.contains(name) || availableControlparts.contains(name)) {
return ImageCache.getImage("testset.gif");
}
}
return ImageCache.getImage("erroneous.gif");
} else if (element instanceof TestCaseTreeElement) {
final String name = ((TestCaseTreeElement) element).name();
if (availableTestcases.contains(name) || availableControlparts.contains(name)) {
return ImageCache.getImage("testcase.gif");
}
return ImageCache.getImage("erroneous.gif");
}
return super.getImage(element);
}
use of org.eclipse.titan.executor.executors.ITreeLeaf 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);
}
use of org.eclipse.titan.executor.executors.ITreeLeaf in project titan.EclipsePlug-ins by eclipse.
the class ExecutorMonitorView method terminateSelected.
private void terminateSelected() {
if (null == viewer || viewer.getSelection().isEmpty()) {
return;
}
IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
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()) {
executor.terminate(false);
}
}
}
updateActions();
}
use of org.eclipse.titan.executor.executors.ITreeLeaf in project titan.EclipsePlug-ins by eclipse.
the class LaunchesListener method launchesTerminated.
@Override
public void launchesTerminated(final ILaunch[] launches) {
for (ILaunch launched : launches) {
for (ITreeLeaf element : executorMonitorView.getRoot().children()) {
final LaunchElement launchElement = (LaunchElement) element;
if (launched.equals(launchElement.launch())) {
launchElement.changed();
MainControllerElement mainController;
if (1 == ((LaunchElement) element).children().size()) {
mainController = (MainControllerElement) ((LaunchElement) element).children().get(0);
} else {
mainController = null;
}
if (null != mainController) {
mainController.executor().terminate(true);
}
PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
@Override
public void run() {
executorMonitorView.getTreeViewer().refresh(launchElement);
}
});
}
}
}
executorMonitorView.updateActions();
}
use of org.eclipse.titan.executor.executors.ITreeLeaf in project titan.EclipsePlug-ins by eclipse.
the class NotificationView 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 (null == selectedElement) {
setTitleToolTip(null);
clearAction.setEnabled(false);
saveAsAction.setEnabled(false);
} else {
setTitleToolTip(selectedElement.name());
clearAction.setEnabled(true);
saveAsAction.setEnabled(true);
}
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.notifications().isEmpty()) {
viewer.reveal(executor.notifications().get(executor.notifications().size() - 1));
}
}
}
}
Aggregations