use of org.eclipse.ui.IActionBars in project GT by Tencent.
the class StubAnalysisView method createLocalToolBar.
private void createLocalToolBar() {
IActionBars bars = getViewSite().getActionBars();
IToolBarManager manager = bars.getToolBarManager();
manager.add(openLogOnPCAction);
manager.add(openLogOnPhoneAction);
}
use of org.eclipse.ui.IActionBars in project dbeaver by serge-rider.
the class DatabaseDataEditor method refreshActions.
private void refreshActions() {
IActionBars actionBars = getEditorSite().getActionBars();
actionBars.updateActionBars();
}
use of org.eclipse.ui.IActionBars in project cubrid-manager by CUBRID.
the class CubridNavigatorView method createPartControl.
/**
* Create the part control
*
* @param parent Composite
*/
public void createPartControl(Composite parent) {
ViewForm viewForm = new ViewForm(parent, SWT.NONE);
viewForm.setLayout(new GridLayout());
tv = new TreeViewer(viewForm, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
tv.setFilters(NodeFilterManager.getInstance().getViewerFilter());
//create the navigator
createNavigator();
//get the isShowGroup configuration
isShowGroup = savedIsShowGroup();
//set the tree view's input.
setTreeInput();
toolTip = new ToolTip(tv.getTree().getShell(), SWT.BALLOON);
toolTip.setAutoHide(true);
//Create the context menu
MenuManager contextMenuManager = new MenuManager("#PopupMenu", "navigatorContextMenu");
contextMenuManager.setRemoveAllWhenShown(true);
contextMenuManager.addMenuListener(new IMenuListener() {
public void menuAboutToShow(IMenuManager manager) {
buildPopupMenu(manager);
}
});
Menu contextMenu = contextMenuManager.createContextMenu(tv.getControl());
tv.getControl().setMenu(contextMenu);
// register the context menu for providing extension by extension point
IWorkbenchPartSite site = getSite();
site.registerContextMenu(contextMenuManager, tv);
site.setSelectionProvider(tv);
//add the select the object text composite to top left of toolbar
ToolBar toolBar = new ToolBar(viewForm, SWT.FLAT);
ToolBarManager toolBarManager = new ToolBarManager(toolBar);
SelectTreeObjContrItem textContrItem = new SelectTreeObjContrItem(tv);
toolBarManager.add(textContrItem);
toolBarManager.update(true);
viewForm.setContent(tv.getControl());
viewForm.setTopLeft(toolBar);
//add the other actions to the top right of toolbar
toolBar = new ToolBar(viewForm, SWT.FLAT | SWT.CENTER);
toolBarManager = new ToolBarManager(toolBar);
buildToolBar(toolBarManager);
toolBarManager.update(true);
viewForm.setTopRight(toolBar);
//Add the actions to view menu bar, you can add them by extension point or code define
IActionBars actionBar = getViewSite().getActionBars();
final IMenuManager menuManager = actionBar.getMenuManager();
menuManager.addMenuListener(new IMenuListener2() {
//reserve these actions by code define,these codes rebuild every time.
//hence when hide, remove them not including these actions by extension point
private IMenuManager lastMenuManager = new MenuManager();
public void menuAboutToShow(IMenuManager manager) {
lastMenuManager.removeAll();
//build the code defined actions
buildViewMenu(lastMenuManager);
for (IContributionItem item : lastMenuManager.getItems()) {
manager.add(item);
}
}
public void menuAboutToHide(IMenuManager manager) {
for (IContributionItem item : lastMenuManager.getItems()) {
manager.remove(item);
}
}
});
menuManager.add(new Separator());
activeContext();
addListener();
setFocus();
}
use of org.eclipse.ui.IActionBars in project cubrid-manager by CUBRID.
the class BrokerStatusView method makeActions.
/**
* This method is to create actions at tool bar
*
*/
private void makeActions() {
Action columnAction = new Action() {
public void run() {
BrokerStatusSettingDlg settingDlg = new BrokerStatusSettingDlg(null);
ServerInfo serverInfo = brokerNode.getServer().getServerInfo();
settingDlg.setServerInfo(serverInfo);
if (settingDlg.open() == Dialog.OK) {
refreshLayout();
}
}
/**
* refresh table layout
*/
private void refreshLayout() {
//refresh basic info table
if (isSupportNewBrokerParamPropery) {
TableLayout basicLayout = new TableLayout();
setBasicLayout(basicLayout);
basicTableViewer.getTable().setLayout(basicLayout);
basicTableViewer.getTable().layout();
}
//refresh apply server table
TableLayout asLayout = new TableLayout();
setAsLayout(asLayout);
asTableViewer.getTable().setLayout(asLayout);
asTableViewer.getTable().layout();
//refresh job queue table
TableLayout jqLayout = new TableLayout();
setJqLayout(jqLayout);
jqTableViewer.getTable().setLayout(jqLayout);
jqTableViewer.getTable().layout();
}
};
columnAction.setText(Messages.columnSettingTxt);
columnAction.setImageDescriptor(CubridManagerUIPlugin.getImageDescriptor("icons/action/setting-small.png"));
IActionBars bars = getViewSite().getActionBars();
IToolBarManager manager = bars.getToolBarManager();
manager.add(columnAction);
}
use of org.eclipse.ui.IActionBars in project cubrid-manager by CUBRID.
the class BrokerEnvStatusView method makeActions.
/**
* This method is to create actions at tool bar
*
*/
private void makeActions() {
Action columnAction = new Action() {
public void run() {
BrokerEnvStatusSettingDlg settingDlg = new BrokerEnvStatusSettingDlg(null);
if (settingDlg.open() == Dialog.OK) {
TableLayout tlayout = new TableLayout();
for (BrokerEnvStatusColumn column : BrokerEnvStatusColumn.values()) {
if (column.getValue() == -1) {
tlayout.addColumnData(new ColumnWeightData(0, 0, false));
} else {
tlayout.addColumnData(new ColumnWeightData(10, 40, true));
}
}
tableViewer.getTable().setLayout(tlayout);
tableViewer.getTable().layout();
}
}
};
columnAction.setText(Messages.envColumnSettingTxt);
columnAction.setImageDescriptor(CubridManagerUIPlugin.getImageDescriptor("icons/action/setting-small.png"));
IActionBars bars = getViewSite().getActionBars();
IToolBarManager manager = bars.getToolBarManager();
manager.add(columnAction);
}
Aggregations