use of org.eclipse.jface.action.IMenuManager in project tdi-studio-se by Talend.
the class CallerCalleeTabPage method createCallerViewer.
/**
* Creates the caller viewer.
*
* @param parent The parent composite
* @param propertySheet The property sheet
*/
private void createCallerViewer(Composite parent, PropertySheet propertySheet) {
callerFilteredTree = new HotSpotsFilteredTree(parent, propertySheet.getViewSite().getActionBars()) {
@Override
protected void addMenus(IMenuManager manager) {
manager.add(new Separator());
manager.add(new ConfigureCpuProfilerAction(cpuSection));
}
@Override
public ViewerType getViewerType() {
return ViewerType.Caller;
}
@Override
protected String getMethodColumnName() {
return Messages.callerColumnLabel;
}
@Override
protected String getMethodColumnToolTip() {
return Messages.calleeColumnToolTip;
}
};
TreeViewer callerViewer = callerFilteredTree.getViewer();
callerViewer.setContentProvider(new AbstractContentProvider() {
@Override
public Object[] getElements(Object inputElement) {
if (inputElement instanceof ICpuModel) {
return ((ICpuModel) inputElement).getCallers();
}
return new Object[0];
}
});
callerViewer.setLabelProvider(new HotSpotsLabelProvider(callerFilteredTree));
callerViewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
callerFilteredTree.updateStatusLine((IStructuredSelection) event.getSelection());
}
});
callerFilteredTree.sortColumn(callerViewer.getTree().getColumn(1));
}
use of org.eclipse.jface.action.IMenuManager in project tdi-studio-se by Talend.
the class InvokeDialog method configureTree.
/**
* Configures the tree.
*
* @param tree The tree
*/
private void configureTree(Tree tree) {
tree.setLinesVisible(true);
tree.setHeaderVisible(true);
for (PropertiesColumn column : PropertiesColumn.values()) {
TreeColumn treeColumn = new TreeColumn(tree, SWT.NONE);
treeColumn.setText(column.label);
treeColumn.setWidth(column.defalutWidth);
treeColumn.setAlignment(column.alignment);
treeColumn.setToolTipText(column.toolTip);
}
//$NON-NLS-1$
MenuManager menuMgr = new MenuManager("#PopupMenu");
menuMgr.setRemoveAllWhenShown(true);
menuMgr.addMenuListener(new IMenuListener() {
@Override
public void menuAboutToShow(IMenuManager manager) {
manager.add(copyAction);
}
});
Menu menu = menuMgr.createContextMenu(tree);
tree.setMenu(menu);
}
use of org.eclipse.jface.action.IMenuManager in project tdi-studio-se by Talend.
the class PropertiesFilteredTree method createContextMenu.
/**
* Creates the context menu.
*
* @param actionBars
* The action bars
*/
private void createContextMenu(IActionBars actionBars) {
actions = createActions(actionBars);
// create menu manager
//$NON-NLS-1$
MenuManager menuMgr = new MenuManager("#PopupMenu");
menuMgr.setRemoveAllWhenShown(true);
menuMgr.addMenuListener(new IMenuListener() {
@Override
public void menuAboutToShow(IMenuManager manager) {
menuAboutToshow();
for (Action action : actions) {
manager.add(action);
}
}
});
// create context menu
Menu menu = menuMgr.createContextMenu(getViewer().getControl());
getViewer().getControl().setMenu(menu);
}
use of org.eclipse.jface.action.IMenuManager in project tdi-studio-se by Talend.
the class StackTraceViewer method createContextMenu.
/**
* Creates the context menu.
*
* @param actionBars The action bars
*/
private void createContextMenu(IActionBars actionBars) {
// create actions
openAction = OpenDeclarationAction.createOpenDeclarationAction(actionBars);
copyAction = CopyAction.createCopyAction(actionBars);
// create menu manager
//$NON-NLS-1$
MenuManager menuMgr = new MenuManager("#PopupMenu");
menuMgr.setRemoveAllWhenShown(true);
menuMgr.addMenuListener(new IMenuListener() {
@Override
public void menuAboutToShow(IMenuManager manager) {
manager.add(openAction);
manager.add(new Separator());
manager.add(copyAction);
}
});
// create context menu
Menu menu = menuMgr.createContextMenu(getControl());
getControl().setMenu(menu);
}
use of org.eclipse.jface.action.IMenuManager in project tdi-studio-se by Talend.
the class MBeanFilteredTree method createContextMenu.
/**
* Creates the context menu.
*
* @param section The property section
*/
private void createContextMenu(final AbstractJvmPropertySection section) {
//$NON-NLS-1$
MenuManager menuMgr = new MenuManager("#PopupMenu");
menuMgr.setRemoveAllWhenShown(true);
menuMgr.addMenuListener(new IMenuListener() {
@Override
public void menuAboutToShow(IMenuManager manager) {
SubscribeAction subscribeAction = new SubscribeAction(getViewer().getSelection(), section);
manager.add(subscribeAction);
}
});
Menu menu = menuMgr.createContextMenu(getViewer().getControl());
getViewer().getControl().setMenu(menu);
}
Aggregations