use of org.eclipse.ui.OpenAndLinkWithEditorHelper in project eclipse.platform.text by eclipse.
the class AbstractTextSearchViewPage method createViewer.
private void createViewer(Composite parent, int layout) {
if ((layout & FLAG_LAYOUT_FLAT) != 0) {
TableViewer viewer = createTableViewer(parent);
fViewer = viewer;
configureTableViewer(viewer);
} else if ((layout & FLAG_LAYOUT_TREE) != 0) {
TreeViewer viewer = createTreeViewer(parent);
fViewer = viewer;
configureTreeViewer(viewer);
fCollapseAllAction.setViewer(viewer);
fExpandAllAction.setViewer(viewer);
}
fCopyToClipboardAction.setViewer(fViewer);
fSelectAllAction.setViewer(fViewer);
IToolBarManager tbm = getSite().getActionBars().getToolBarManager();
tbm.removeAll();
SearchView.createToolBarGroups(tbm);
fillToolbar(tbm);
tbm.update(false);
new OpenAndLinkWithEditorHelper(fViewer) {
@Override
protected void activate(ISelection selection) {
final int currentMode = OpenStrategy.getOpenMethod();
try {
OpenStrategy.setOpenMethod(OpenStrategy.DOUBLE_CLICK);
handleOpen(new OpenEvent(fViewer, selection));
} finally {
OpenStrategy.setOpenMethod(currentMode);
}
}
@Override
protected void linkToEditor(ISelection selection) {
// not supported by this part
}
@Override
protected void open(ISelection selection, boolean activate) {
handleOpen(new OpenEvent(fViewer, selection));
}
};
fViewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
fCurrentMatchIndex = -1;
fRemoveSelectedMatches.setEnabled(canRemoveMatchesWith(event.getSelection()));
}
});
fViewer.addSelectionChangedListener(fViewerAdapter);
Menu menu = fMenu.createContextMenu(fViewer.getControl());
fViewer.getControl().setMenu(menu);
updateLayoutActions();
getViewPart().updateLabel();
}
Aggregations