1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
| public void createPartControl(final Composite parent) {
final Menu menu = new Menu(parent);
final MenuItem menuItemCopyCell = new MenuItem(menu, SWT.PUSH);
menuItemCopyCell.setText("Copy Cell");
menuItemCopyCell.addSelectionListener(new SelectionListener(){
public void widgetDefaultSelected(SelectionEvent e) {}
public void widgetSelected(SelectionEvent e) {}
});
final MenuItem menuItemCopyLine = new MenuItem(menu, SWT.PUSH);
menuItemCopyLine.setText("Copy Line");
menuItemCopyLine.addSelectionListener(new SelectionListener(){
public void widgetDefaultSelected(SelectionEvent e) {}
public void widgetSelected(SelectionEvent e) {}
});
GridLayout layout = new GridLayout(2, false);
parent.setLayout(layout);
// méthode me permettant de créer mon viewer
// (ses colonnes, ses providers et son input)
viewer = createTableViewer(parent);
viewer.getTable().addMouseListener(new MouseListener(){
public void mouseDoubleClick(MouseEvent e) {}
public void mouseDown(MouseEvent e) {}
public void mouseUp(MouseEvent e) {
if (e.button == 3){
menu.setVisible(true);
}
}
});
createActions(); // actions utilisées dans le toolBar de la vue
createToolbar();
} |
Partager