use of org.eclipse.jdt.internal.ui.viewsupport.SelectionProviderMediator in project tdi-studio-se by Talend.
the class JobHierarchyViewPart method createPartControl.
@Override
public void createPartControl(Composite container) {
fParent = container;
addResizeListener(fParent);
fPagebook = new PageBook(container, SWT.NONE);
// page 1 of page book (no hierarchy label)
fNoHierarchyShownLabel = new Label(fPagebook, SWT.TOP + SWT.LEFT + SWT.WRAP);
fNoHierarchyShownLabel.setText(showEmptyLabel);
// page 2 of page book (viewers)
fTypeMethodsSplitter = new SashForm(fPagebook, SWT.VERTICAL);
fTypeMethodsSplitter.setVisible(false);
fTypeViewerViewForm = new ViewForm(fTypeMethodsSplitter, SWT.NONE);
Control typeViewerControl = createTypeViewerControl(fTypeViewerViewForm);
fTypeViewerViewForm.setContent(typeViewerControl);
dependencyViewerViewForm = new ViewForm(fTypeMethodsSplitter, SWT.NONE);
fTypeMethodsSplitter.setWeights(new int[] { 65, 35 });
Control dependencyViewerPart = createMethodViewerControl(dependencyViewerViewForm);
dependencyViewerViewForm.setContent(dependencyViewerPart);
dependencyViewerPaneLabel = new CLabel(dependencyViewerViewForm, SWT.NONE);
dependencyViewerViewForm.setTopLeft(dependencyViewerPaneLabel);
ToolBar methodViewerToolBar = new ToolBar(dependencyViewerViewForm, SWT.FLAT | SWT.WRAP);
dependencyViewerViewForm.setTopCenter(methodViewerToolBar);
initDragAndDrop();
MenuManager menu = new MenuManager();
menu.add(focusOnTypeAction);
fNoHierarchyShownLabel.setMenu(menu.createContextMenu(fNoHierarchyShownLabel));
fPagebook.showPage(fNoHierarchyShownLabel);
int layout;
try {
layout = fDialogSettings.getInt(DIALOGSTORE_VIEWLAYOUT);
if (layout < 0 || layout > 3) {
layout = VIEW_LAYOUT_AUTOMATIC;
}
} catch (NumberFormatException e) {
layout = VIEW_LAYOUT_AUTOMATIC;
}
// force the update
fCurrentLayout = -1;
// will fill the main tool bar
setViewLayout(layout);
// set the filter menu items
IActionBars actionBars = getViewSite().getActionBars();
IMenuManager viewMenu = actionBars.getMenuManager();
// for (int i = 0; i < fViewActions.length; i++) {
// ToggleViewAction action = fViewActions[i];
// viewMenu.add(action);
// action.setEnabled(false);
// }
// viewMenu.add(new Separator());
// IMenuManager layoutSubMenu = new MenuManager(TypeHierarchyMessages.TypeHierarchyViewPart_layout_submenu);
//$NON-NLS-1$
IMenuManager layoutSubMenu = new MenuManager(Messages.getString("FocusOnJobAction.TypeHierarchyViewPart_layout_submenu"));
viewMenu.add(layoutSubMenu);
for (int i = 0; i < fToggleOrientationActions.length; i++) {
layoutSubMenu.add(fToggleOrientationActions[i]);
}
viewMenu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
// selection provider
int nHierarchyViewers = fAllViewers.length;
StructuredViewer[] trackedViewers = new StructuredViewer[nHierarchyViewers + 1];
for (int i = 0; i < nHierarchyViewers; i++) {
trackedViewers[i] = fAllViewers[i];
}
trackedViewers[nHierarchyViewers] = dependencyViewer;
fSelectionProviderMediator = new SelectionProviderMediator(trackedViewers, getCurrentViewer());
getSite().setSelectionProvider(fSelectionProviderMediator);
ActionGroup[] actionGroups = new ActionGroup[] { new JobActionGroup() };
fActionGroups = new CompositeActionGroup(actionGroups);
fActionGroups.fillActionBars(actionBars);
}
Aggregations