/* Select All */
fViewSite.getActionBars().setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), new Action() {
@Override
public void run() {
Control focusControl = fViewer.getControl().getDisplay().getFocusControl();
/* Select All in Text Widget */
if (focusControl instanceof Text) {
((Text) focusControl).selectAll();
}
/* Select All in Tree */
else {
((Tree) fViewer.getControl()).selectAll();
fViewer.setSelection(fViewer.getSelection());
}
}
});
/* Delete */
fViewSite.getActionBars().setGlobalActionHandler(ActionFactory.DELETE.getId(), new Action() {
@Override
public void run() {
fViewer.getControl().getParent().setRedraw(false);
try {
new DeleteTypesAction(fViewer.getControl().getShell(), (IStructuredSelection) fViewer.getSelection()).run();
} finally {
fViewer.getControl().getParent().setRedraw(true);
}
}
});
/* Reload */
fViewSite.getActionBars().setGlobalActionHandler(RetargetActions.RELOAD, new Action() {
@Override
public void run() {
new ReloadTypesAction((IStructuredSelection) fViewer.getSelection(), fViewSite.getShell()).run();
}
});
/* Cut */
fViewSite.getActionBars().setGlobalActionHandler(ActionFactory.CUT.getId(), new Action() {
@Override
public void run() {
Control focusControl = fViewer.getControl().getDisplay().getFocusControl();
/* Cut in Text Widget */
if (focusControl instanceof Text)
((Text) focusControl).cut();
}
});
/* Copy */
fViewSite.getActionBars().setGlobalActionHandler(ActionFactory.COPY.getId(), new Action() {
@Override
public void run() {
Control focusControl = fViewer.getControl().getDisplay().getFocusControl();
/* Copy in Text Widget */
if (focusControl instanceof Text)
((Text) focusControl).copy();
}
});
/* Paste */
fViewSite.getActionBars().setGlobalActionHandler(ActionFactory.PASTE.getId(), new Action() {
@Override
public void run() {
Control focusControl = fViewer.getControl().getDisplay().getFocusControl();
/* Paste in Text Widget */
if (focusControl instanceof Text)
((Text) focusControl).paste();
}