Search in sources :

Example 1 with ShowViewDialog

use of org.eclipse.ui.internal.dialogs.ShowViewDialog in project eclipse.platform.ui by eclipse-platform.

the class UIDialogs method testShowView.

@Test
public void testShowView() {
    IWorkbench workbench = getWorkbench();
    Shell shell = workbench.getActiveWorkbenchWindow().getShell();
    // Get the view identifier, if any.
    IEclipseContext ctx = workbench.getService(IEclipseContext.class);
    EModelService modelService = workbench.getService(EModelService.class);
    EPartService partService = workbench.getService(EPartService.class);
    MApplication app = workbench.getService(MApplication.class);
    MWindow window = workbench.getService(MWindow.class);
    Dialog dialog = new ShowViewDialog(shell, app, window, modelService, partService, ctx);
    DialogCheck.assertDialog(dialog);
}
Also used : IWorkbench(org.eclipse.ui.IWorkbench) Shell(org.eclipse.swt.widgets.Shell) EModelService(org.eclipse.e4.ui.workbench.modeling.EModelService) EPartService(org.eclipse.e4.ui.workbench.modeling.EPartService) SelectPerspectiveDialog(org.eclipse.ui.internal.dialogs.SelectPerspectiveDialog) ProjectLocationSelectionDialog(org.eclipse.ui.dialogs.ProjectLocationSelectionDialog) TypeFilteringDialog(org.eclipse.ui.dialogs.TypeFilteringDialog) ContainerSelectionDialog(org.eclipse.ui.dialogs.ContainerSelectionDialog) FileExtensionDialog(org.eclipse.ui.internal.dialogs.FileExtensionDialog) EditorSelectionDialog(org.eclipse.ui.dialogs.EditorSelectionDialog) AboutDialog(org.eclipse.ui.internal.dialogs.AboutDialog) ProgressMonitorDialog(org.eclipse.jface.dialogs.ProgressMonitorDialog) SaveAsDialog(org.eclipse.ui.dialogs.SaveAsDialog) SavePerspectiveDialog(org.eclipse.ui.internal.dialogs.SavePerspectiveDialog) Dialog(org.eclipse.jface.dialogs.Dialog) ListSelectionDialog(org.eclipse.ui.dialogs.ListSelectionDialog) ShowViewDialog(org.eclipse.ui.internal.dialogs.ShowViewDialog) IEclipseContext(org.eclipse.e4.core.contexts.IEclipseContext) ShowViewDialog(org.eclipse.ui.internal.dialogs.ShowViewDialog) MWindow(org.eclipse.e4.ui.model.application.ui.basic.MWindow) MApplication(org.eclipse.e4.ui.model.application.MApplication) Test(org.junit.Test)

Example 2 with ShowViewDialog

use of org.eclipse.ui.internal.dialogs.ShowViewDialog in project eclipse.platform.ui by eclipse-platform.

the class UIDialogsAuto method testShowView.

@Test
public void testShowView() {
    IWorkbench workbench = getWorkbench();
    Shell shell = workbench.getActiveWorkbenchWindow().getShell();
    // Get the view identifier, if any.
    IEclipseContext ctx = workbench.getService(IEclipseContext.class);
    EModelService modelService = workbench.getService(EModelService.class);
    EPartService partService = workbench.getService(EPartService.class);
    MApplication app = workbench.getService(MApplication.class);
    MWindow window = workbench.getService(MWindow.class);
    Dialog dialog = new ShowViewDialog(shell, app, window, modelService, partService, ctx);
    DialogCheck.assertDialogTexts(dialog);
}
Also used : IWorkbench(org.eclipse.ui.IWorkbench) Shell(org.eclipse.swt.widgets.Shell) EModelService(org.eclipse.e4.ui.workbench.modeling.EModelService) EPartService(org.eclipse.e4.ui.workbench.modeling.EPartService) SelectPerspectiveDialog(org.eclipse.ui.internal.dialogs.SelectPerspectiveDialog) ProjectLocationSelectionDialog(org.eclipse.ui.dialogs.ProjectLocationSelectionDialog) TypeFilteringDialog(org.eclipse.ui.dialogs.TypeFilteringDialog) ContainerSelectionDialog(org.eclipse.ui.dialogs.ContainerSelectionDialog) FileExtensionDialog(org.eclipse.ui.internal.dialogs.FileExtensionDialog) EditorSelectionDialog(org.eclipse.ui.dialogs.EditorSelectionDialog) AboutDialog(org.eclipse.ui.internal.dialogs.AboutDialog) ProgressMonitorDialog(org.eclipse.jface.dialogs.ProgressMonitorDialog) SaveAsDialog(org.eclipse.ui.dialogs.SaveAsDialog) AboutPluginsDialog(org.eclipse.ui.internal.dialogs.AboutPluginsDialog) SavePerspectiveDialog(org.eclipse.ui.internal.dialogs.SavePerspectiveDialog) Dialog(org.eclipse.jface.dialogs.Dialog) ListSelectionDialog(org.eclipse.ui.dialogs.ListSelectionDialog) ShowViewDialog(org.eclipse.ui.internal.dialogs.ShowViewDialog) IEclipseContext(org.eclipse.e4.core.contexts.IEclipseContext) ShowViewDialog(org.eclipse.ui.internal.dialogs.ShowViewDialog) MWindow(org.eclipse.e4.ui.model.application.ui.basic.MWindow) MApplication(org.eclipse.e4.ui.model.application.MApplication) Test(org.junit.Test)

Example 3 with ShowViewDialog

use of org.eclipse.ui.internal.dialogs.ShowViewDialog in project tdq-studio-se by Talend.

the class ShowViewAction method run.

/*
     * (non-Javadoc)
     *
     * @see org.eclipse.jface.action.Action#run()
     */
@Override
public void run() {
    IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    final IWorkbenchPage page = window.getActivePage();
    if (page == null) {
        return;
    }
    Params parameters = getParams();
    final ShowViewDialog dialog = new ShowViewDialog(window.getShell(), parameters.getApplication(), parameters.getWindow(), parameters.getModelService(), parameters.getPartService(), getEclipseContext());
    dialog.open();
    if (dialog.getReturnCode() == Window.CANCEL) {
        return;
    }
    final MPartDescriptor[] descriptors = dialog.getSelection();
    for (int i = 0; i < descriptors.length; ++i) {
        try {
            page.showView(descriptors[i].getElementId());
        } catch (PartInitException e) {
            StatusUtil.handleStatus(e.getStatus(), // $NON-NLS-1$ //$NON-NLS-2$
            Messages.getString("WorkbenchMessages.ShowView_errorTitle") + ": " + e.getMessage(), StatusManager.SHOW);
        }
    }
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) MPartDescriptor(org.eclipse.e4.ui.model.application.descriptor.basic.MPartDescriptor) ShowViewDialog(org.eclipse.ui.internal.dialogs.ShowViewDialog) PartInitException(org.eclipse.ui.PartInitException)

Example 4 with ShowViewDialog

use of org.eclipse.ui.internal.dialogs.ShowViewDialog in project eclipse.platform.ui by eclipse-platform.

the class ShowViewHandler method openOther.

/**
 * Opens a view selection dialog, allowing the user to chose a view.
 */
private static void openOther(ExecutionEvent event, IWorkbenchWindow workbenchWindow, MApplication app, EPartService partService) {
    Shell shell = HandlerUtil.getActiveShell(event);
    IEclipseContext ctx = workbenchWindow.getService(IEclipseContext.class);
    EModelService modelService = workbenchWindow.getService(EModelService.class);
    MWindow window = workbenchWindow.getService(MWindow.class);
    final ShowViewDialog dialog = new ShowViewDialog(shell, app, window, modelService, partService, ctx);
    dialog.open();
    if (dialog.getReturnCode() == Window.CANCEL) {
        return;
    }
    final MPartDescriptor[] descriptors = dialog.getSelection();
    for (MPartDescriptor descriptor : descriptors) {
        openView(workbenchWindow, descriptor, partService);
    }
}
Also used : Shell(org.eclipse.swt.widgets.Shell) EModelService(org.eclipse.e4.ui.workbench.modeling.EModelService) IEclipseContext(org.eclipse.e4.core.contexts.IEclipseContext) MPartDescriptor(org.eclipse.e4.ui.model.application.descriptor.basic.MPartDescriptor) ShowViewDialog(org.eclipse.ui.internal.dialogs.ShowViewDialog) MWindow(org.eclipse.e4.ui.model.application.ui.basic.MWindow)

Aggregations

ShowViewDialog (org.eclipse.ui.internal.dialogs.ShowViewDialog)4 IEclipseContext (org.eclipse.e4.core.contexts.IEclipseContext)3 MWindow (org.eclipse.e4.ui.model.application.ui.basic.MWindow)3 EModelService (org.eclipse.e4.ui.workbench.modeling.EModelService)3 Shell (org.eclipse.swt.widgets.Shell)3 MApplication (org.eclipse.e4.ui.model.application.MApplication)2 MPartDescriptor (org.eclipse.e4.ui.model.application.descriptor.basic.MPartDescriptor)2 EPartService (org.eclipse.e4.ui.workbench.modeling.EPartService)2 Dialog (org.eclipse.jface.dialogs.Dialog)2 ProgressMonitorDialog (org.eclipse.jface.dialogs.ProgressMonitorDialog)2 IWorkbench (org.eclipse.ui.IWorkbench)2 ContainerSelectionDialog (org.eclipse.ui.dialogs.ContainerSelectionDialog)2 EditorSelectionDialog (org.eclipse.ui.dialogs.EditorSelectionDialog)2 ListSelectionDialog (org.eclipse.ui.dialogs.ListSelectionDialog)2 ProjectLocationSelectionDialog (org.eclipse.ui.dialogs.ProjectLocationSelectionDialog)2 SaveAsDialog (org.eclipse.ui.dialogs.SaveAsDialog)2 TypeFilteringDialog (org.eclipse.ui.dialogs.TypeFilteringDialog)2 AboutDialog (org.eclipse.ui.internal.dialogs.AboutDialog)2 FileExtensionDialog (org.eclipse.ui.internal.dialogs.FileExtensionDialog)2 SavePerspectiveDialog (org.eclipse.ui.internal.dialogs.SavePerspectiveDialog)2