Search in sources :

Example 1 with MessageDialog.openError

use of org.eclipse.jface.dialogs.MessageDialog.openError in project n4js by eclipse.

the class TestResultsView method performRelaunch.

/**
 * Invoked when user performs {@link #actionRelaunch}.
 */
protected void performRelaunch() {
    if (null != currentRoot) {
        final TestSession session = from(registeredSessions).firstMatch(s -> s.root == currentRoot).orNull();
        if (null != session) {
            final TestConfiguration configurationToReRun = session.configuration;
            registeredSessions.remove(session);
            try {
                final TestConfiguration newConfiguration = testerFrontEnd.createConfiguration(configurationToReRun);
                testerFrontEndUI.runInUI(newConfiguration);
            } catch (Exception e) {
                String message = "Test class not found in the workspace.";
                if (!Strings.isNullOrEmpty(e.getMessage())) {
                    message += " Reason: " + e.getMessage();
                }
                MessageDialog.openError(getShell(), "Cannot open editor", message);
            }
        }
    }
}
Also used : SashForm(org.eclipse.swt.custom.SashForm) StyledText(org.eclipse.swt.custom.StyledText) IN4JSEclipseCore(org.eclipse.n4js.ui.projectModel.IN4JSEclipseCore) Point(org.eclipse.swt.graphics.Point) TestEndedEvent(org.eclipse.n4js.tester.events.TestEndedEvent) ERROR(org.eclipse.n4js.tester.domain.TestStatus.ERROR) Composite(org.eclipse.swt.widgets.Composite) PartInitException(org.eclipse.ui.PartInitException) IN4JSEclipseProject(org.eclipse.n4js.ui.projectModel.IN4JSEclipseProject) FluentIterable.from(com.google.common.collect.FluentIterable.from) ITreeContentProvider(org.eclipse.jface.viewers.ITreeContentProvider) MessageDialog(org.eclipse.jface.dialogs.MessageDialog) Separator(org.eclipse.jface.action.Separator) Text(org.eclipse.swt.widgets.Text) SEPARATOR(org.eclipse.core.runtime.IPath.SEPARATOR) PlatformUI(org.eclipse.ui.PlatformUI) FAILED(org.eclipse.n4js.tester.domain.TestStatus.FAILED) MenuManager(org.eclipse.jface.action.MenuManager) TestCase(org.eclipse.n4js.tester.domain.TestCase) Lists.newArrayList(com.google.common.collect.Lists.newArrayList) UIUtils.getShell(org.eclipse.n4js.ui.utils.UIUtils.getShell) SWT(org.eclipse.swt.SWT) SKIPPED_FIXME(org.eclipse.n4js.tester.domain.TestStatus.SKIPPED_FIXME) SessionFinishedEvent(org.eclipse.n4js.tester.events.SessionFinishedEvent) Joiner(com.google.common.base.Joiner) SKIPPED_NOT_IMPLEMENTED(org.eclipse.n4js.tester.domain.TestStatus.SKIPPED_NOT_IMPLEMENTED) ViewPart(org.eclipse.ui.part.ViewPart) URI(org.eclipse.emf.common.util.URI) TestEvent(org.eclipse.n4js.tester.events.TestEvent) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) TesterUiActivator(org.eclipse.n4js.tester.ui.TesterUiActivator) Strings.isNullOrEmpty(com.google.common.base.Strings.isNullOrEmpty) ControlListener(org.eclipse.swt.events.ControlListener) ArrayList(java.util.ArrayList) ControlEvent(org.eclipse.swt.events.ControlEvent) Strings(com.google.common.base.Strings) TestTree(org.eclipse.n4js.tester.domain.TestTree) Ints.asList(com.google.common.primitives.Ints.asList) IFile(org.eclipse.core.resources.IFile) GridData(org.eclipse.swt.layout.GridData) DoubleClickEvent(org.eclipse.jface.viewers.DoubleClickEvent) ID(org.eclipse.n4js.tester.domain.ID) PASSED(org.eclipse.n4js.tester.domain.TestStatus.PASSED) TesterFrontEnd(org.eclipse.n4js.tester.TesterFrontEnd) TestStatus(org.eclipse.n4js.tester.domain.TestStatus) IMemento(org.eclipse.ui.IMemento) IViewSite(org.eclipse.ui.IViewSite) IActionBars(org.eclipse.ui.IActionBars) Display.getDefault(org.eclipse.swt.widgets.Display.getDefault) ImageDescriptor(org.eclipse.jface.resource.ImageDescriptor) SKIPPED_IGNORE(org.eclipse.n4js.tester.domain.TestStatus.SKIPPED_IGNORE) Color(org.eclipse.swt.graphics.Color) IMenuManager(org.eclipse.jface.action.IMenuManager) ToolTip(org.eclipse.jface.window.ToolTip) GridLayout(org.eclipse.swt.layout.GridLayout) Inject(com.google.inject.Inject) IAction(org.eclipse.jface.action.IAction) ToolBar(org.eclipse.swt.widgets.ToolBar) IToolBarManager(org.eclipse.jface.action.IToolBarManager) AllowConcurrentEvents(com.google.common.eventbus.AllowConcurrentEvents) IViewPart(org.eclipse.ui.IViewPart) IDoubleClickListener(org.eclipse.jface.viewers.IDoubleClickListener) ITableLabelProvider(org.eclipse.jface.viewers.ITableLabelProvider) MessageDialog.openError(org.eclipse.jface.dialogs.MessageDialog.openError) Display(org.eclipse.swt.widgets.Display) TestSuite(org.eclipse.n4js.tester.domain.TestSuite) Collectors(java.util.stream.Collectors) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) List(java.util.List) Tree(org.eclipse.swt.widgets.Tree) SessionFailedEvent(org.eclipse.n4js.tester.events.SessionFailedEvent) ITableColorProvider(org.eclipse.jface.viewers.ITableColorProvider) ISelection(org.eclipse.jface.viewers.ISelection) TreeViewer(org.eclipse.jface.viewers.TreeViewer) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) Arrays.copyOfRange(java.util.Arrays.copyOfRange) TestConfiguration(org.eclipse.n4js.tester.TestConfiguration) TestElement(org.eclipse.n4js.tester.domain.TestElement) IMenuListener(org.eclipse.jface.action.IMenuListener) IURIEditorOpener(org.eclipse.xtext.ui.editor.IURIEditorOpener) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) System.lineSeparator(java.lang.System.lineSeparator) NONE(org.eclipse.swt.SWT.NONE) SKIPPED(org.eclipse.n4js.tester.domain.TestStatus.SKIPPED) Image(org.eclipse.swt.graphics.Image) TestStartedEvent(org.eclipse.n4js.tester.events.TestStartedEvent) Event(org.eclipse.swt.widgets.Event) EditorContentExtractor(org.eclipse.n4js.ui.editor.EditorContentExtractor) TesterEventBus(org.eclipse.n4js.tester.TesterEventBus) TesterFrontEndUI(org.eclipse.n4js.tester.ui.TesterFrontEndUI) SKIPPED_PRECONDITION(org.eclipse.n4js.tester.domain.TestStatus.SKIPPED_PRECONDITION) Subscribe(com.google.common.eventbus.Subscribe) SessionStartedEvent(org.eclipse.n4js.tester.events.SessionStartedEvent) IWorkbenchActionConstants(org.eclipse.ui.IWorkbenchActionConstants) StyledTextDescriptor(org.eclipse.n4js.ui.editor.StyledTextDescriptor) SessionEndedEvent(org.eclipse.n4js.tester.events.SessionEndedEvent) Iterator(java.util.Iterator) Viewer(org.eclipse.jface.viewers.Viewer) Action(org.eclipse.jface.action.Action) TestResult(org.eclipse.n4js.tester.domain.TestResult) TreeItem(org.eclipse.swt.widgets.TreeItem) TreeViewerBuilder(org.eclipse.n4js.ui.viewer.TreeViewerBuilder) ToolBarManager(org.eclipse.jface.action.ToolBarManager) Menu(org.eclipse.swt.widgets.Menu) LabelProvider(org.eclipse.jface.viewers.LabelProvider) Control(org.eclipse.swt.widgets.Control) TestConfiguration(org.eclipse.n4js.tester.TestConfiguration) PartInitException(org.eclipse.ui.PartInitException)

Aggregations

Joiner (com.google.common.base.Joiner)1 Strings (com.google.common.base.Strings)1 Strings.isNullOrEmpty (com.google.common.base.Strings.isNullOrEmpty)1 FluentIterable.from (com.google.common.collect.FluentIterable.from)1 Lists.newArrayList (com.google.common.collect.Lists.newArrayList)1 AllowConcurrentEvents (com.google.common.eventbus.AllowConcurrentEvents)1 Subscribe (com.google.common.eventbus.Subscribe)1 Ints.asList (com.google.common.primitives.Ints.asList)1 Inject (com.google.inject.Inject)1 System.lineSeparator (java.lang.System.lineSeparator)1 ArrayList (java.util.ArrayList)1 Arrays.copyOfRange (java.util.Arrays.copyOfRange)1 Iterator (java.util.Iterator)1 List (java.util.List)1 Collectors (java.util.stream.Collectors)1 IFile (org.eclipse.core.resources.IFile)1 SEPARATOR (org.eclipse.core.runtime.IPath.SEPARATOR)1 URI (org.eclipse.emf.common.util.URI)1 Action (org.eclipse.jface.action.Action)1 IAction (org.eclipse.jface.action.IAction)1