/** This is a callback that will allow us to create the viewer and initialize it. */ public void createPartControl(Composite parent) { Table table = createTableWithColumns(parent); viewer = new TableViewer(table); GridData gd = new GridData(GridData.FILL_BOTH); viewer.getControl().setLayoutData(gd); // Create the help context id for the viewer's control PlatformUI.getWorkbench().getHelpSystem().setHelp(viewer.getControl(), "YetiPlugIn.viewer"); viewer.setContentProvider(new OverviewContentProvider()); // Get the content for the viewer, setInput will call getElements in the // contentProvider viewer.setLabelProvider(new OverviewLabelProvider()); viewer.setInput(YetiPlugIn.getOverviewArrayList()); /* viewer.setContentProvider( new ViewSummaryContentProvider()); // Get the content for the viewer, setInput will call getElements in the // contentProvider viewer.setLabelProvider(new ViewSummaryLabelProvider()); viewer.setInput(YetiPlugIn.getSummaryInfoArrayList()); // Share Viewer Selection with other workbench parts getViewSite().setSelectionProvider(viewer); viewer.addSelectionChangedListener(this); */ }
private void hookContextMenu() { MenuManager menuMgr = new MenuManager("#PopupMenu"); menuMgr.setRemoveAllWhenShown(true); menuMgr.addMenuListener( new IMenuListener() { public void menuAboutToShow(IMenuManager manager) { SampleView.this.fillContextMenu(manager); } }); Menu menu = menuMgr.createContextMenu(viewer.getControl()); viewer.getControl().setMenu(menu); getSite().registerContextMenu(menuMgr, viewer); }
/** Register the context menu for the viewer so that commands may be added to it. */ private void registerContextMenu() { MenuManager contextMenu = new MenuManager(); contextMenu.setRemoveAllWhenShown(true); getSite().registerContextMenu(contextMenu, mViewer); Control control = mViewer.getControl(); Menu menu = contextMenu.createContextMenu(control); control.setMenu(menu); }
/** This is a callback that will allow us to create the viewer and initialize it. */ public void createPartControl(Composite parent) { viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); viewer.setContentProvider(new ViewContentProvider()); viewer.setLabelProvider(new ViewLabelProvider()); viewer.setSorter(new NameSorter()); viewer.setInput(getViewSite()); // Delegator // Create the help context id for the viewer's control PlatformUI.getWorkbench().getHelpSystem().setHelp(viewer.getControl(), "test.viewer"); makeActions(); hookContextMenu(); hookDoubleClickAction(); contributeToActionBars(); }
/* (non-Javadoc) * @see org.eclipse.pde.internal.core.IPluginModelListener#modelsChanged(org.eclipse.pde.internal.core.PluginModelDelta) */ public void modelsChanged(PluginModelDelta delta) { final Control control = fPluginTable.getControl(); if (!control.isDisposed()) { control .getDisplay() .asyncExec( new Runnable() { public void run() { if (!control.isDisposed()) { fPluginTable.refresh(); updateRemoveButtons(true, true); } } }); } }
/** * Returns the clipboard for this view. * * @return the clipboard for this view */ public Clipboard getClipboard() { if (mClipboard == null) { mClipboard = new Clipboard(mViewer.getControl().getDisplay()); } return mClipboard; }
/** Passing the focus request to the viewer's control. */ public void setFocus() { viewer.getControl().setFocus(); }
private void showMessage(String message) { MessageDialog.openInformation(viewer.getControl().getShell(), "Sample View", message); }