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);
}
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);
}
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);
}
}
}
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);
}
}
Aggregations