use of org.eclipse.jface.action.IMenuManager in project GT by Tencent.
the class DevicesView method createSourContextMenu.
private void createSourContextMenu() {
MenuManager menuMgr = new MenuManager();
menuMgr.setRemoveAllWhenShown(true);
menuMgr.addMenuListener(new IMenuListener() {
@Override
public void menuAboutToShow(IMenuManager manager) {
DevicesView.this.fillSourContextMenu(manager);
}
});
Menu menu = menuMgr.createContextMenu(sourcePkgTableViewer.getControl());
sourcePkgTableViewer.getControl().setMenu(menu);
getSite().registerContextMenu(menuMgr, sourcePkgTableViewer);
}
use of org.eclipse.jface.action.IMenuManager in project GT by Tencent.
the class APTSMAPSCTabItem method createContextMenu.
private void createContextMenu() {
MenuManager menuMgr = new MenuManager();
menuMgr.setRemoveAllWhenShown(true);
menuMgr.addMenuListener(new IMenuListener() {
@Override
public void menuAboutToShow(IMenuManager manager) {
APTSMAPSCTabItem.this.fillContextMenu(manager);
}
});
Menu menu = menuMgr.createContextMenu(viewer.getControl());
viewer.getControl().setMenu(menu);
}
use of org.eclipse.jface.action.IMenuManager in project dbeaver by serge-rider.
the class HexManager method createEditorPart.
/**
* Creates editor part of parent application. Can only be called once per Manager object.
*
* @param parent composite where the part will be drawn.
* @throws IllegalStateException when editor part exists already (method called twice or more)
* @throws NullPointerException if textsParent is null
*/
public Composite createEditorPart(Composite parent, int style) {
if (hexEditControl != null)
throw new IllegalStateException("Editor part exists already");
if (parent == null)
throw new NullPointerException("Null parent");
textsParent = parent;
hexEditControl = new HexEditControl(textsParent, style);
hexEditControl.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
if (fontText != null && !fontText.isDisposed())
fontText.dispose();
}
});
if (fontData != null) {
fontText = new Font(Display.getCurrent(), fontData);
hexEditControl.setFont(fontText);
}
//hexEditControl.addLongSelectionListener(new ControlSelectionAdapter(ControlSelectionAdapter.UPDATE_POSITION_TEXT));
hexEditControl.addListener(SWT.Modify, new Listener() {
@Override
public void handleEvent(Event event) {
if (statusLine != null)
statusLine.updateInsertModeText(hexEditControl == null || !hexEditControl.isOverwriteMode());
}
});
if (listOfStatusChangedListeners != null) {
for (Listener listOfStatusChangedListener : listOfStatusChangedListeners) {
hexEditControl.addListener(SWT.Modify, listOfStatusChangedListener);
}
listOfStatusChangedListeners = null;
}
if (listOfLongListeners != null) {
for (SelectionListener listOfLongListener : listOfLongListeners) {
hexEditControl.addLongSelectionListener(listOfLongListener);
}
listOfLongListeners = null;
}
{
// Context menu
MenuManager menuManager = new MenuManager();
menuManager.setRemoveAllWhenShown(true);
menuManager.addMenuListener(new IMenuListener() {
@Override
public void menuAboutToShow(IMenuManager manager) {
if (menuListener != null) {
menuListener.menuAboutToShow(manager);
}
}
});
Menu contextMenu = menuManager.createContextMenu(hexEditControl.getHexText());
hexEditControl.getHexText().setMenu(contextMenu);
contextMenu = menuManager.createContextMenu(hexEditControl.getPreviewText());
hexEditControl.getPreviewText().setMenu(contextMenu);
//getSite().registerContextMenu(menuManager, this);
}
return hexEditControl;
}
use of org.eclipse.jface.action.IMenuManager in project translationstudio8 by heartsome.
the class PortingActionProvider method addImportMenu.
private void addImportMenu(IMenuManager aMenu) {
importWizardActionGroup.setContext(getContext());
if (importWizardActionGroup.getWizardActionIds().length == 0) {
aMenu.appendToGroup(ICommonMenuConstants.GROUP_PORT, importAction);
return;
}
IMenuManager submenu = new MenuManager(WorkbenchNavigatorMessages.PortingActionProvider_ImportResourcesMenu_label, COMMON_NAVIGATOR_IMPORT_MENU);
importWizardActionGroup.fillContextMenu(submenu);
submenu.add(new Separator(ICommonMenuConstants.GROUP_ADDITIONS));
submenu.add(new Separator());
submenu.add(importAction);
aMenu.appendToGroup(ICommonMenuConstants.GROUP_PORT, submenu);
}
use of org.eclipse.jface.action.IMenuManager in project translationstudio8 by heartsome.
the class ApplicationActionBarAdvisor method fillMenuBar.
protected void fillMenuBar(IMenuManager menuBar) {
MenuManager fileMenu = new MenuManager("&File", IWorkbenchActionConstants.M_FILE);
menuBar.add(fileMenu);
fileMenu.add(exitAction);
MenuManager editMenu = new MenuManager("&Edit", IWorkbenchActionConstants.M_EDIT);
menuBar.add(editMenu);
editMenu.add(preferenceAction);
}
Aggregations