use of org.eclipse.ui.internal.WorkbenchWindow in project cubrid-manager by CUBRID.
the class PerspectiveChangedListener method hidePerspectiveHide.
public void hidePerspectiveHide(PerspectiveChangeEvent event) {
WorkbenchWindow window = (WorkbenchWindow) PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window != null) {
ICoolBarManager coolBarManager = window.getCoolBarManager2();
IMenuManager menuManager = window.getMenuBarManager();
ActionAdvisor.getInstance().hideToolbar(coolBarManager);
ActionAdvisor.getInstance().hideMenu(menuManager);
}
}
use of org.eclipse.ui.internal.WorkbenchWindow in project translationstudio8 by heartsome.
the class ApplicationWorkbenchWindowAdvisor method setListenerToPespective.
/**
* 给默认透视图添加监听,当透视图发生改变时,触发相关事件 robert 2012-10-18
* @param commandService
*/
private void setListenerToPespective(final ICommandService commandService) {
final IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
IPerspectiveListener perspectiveListener = new IPerspectiveListener() {
public void perspectiveChanged(IWorkbenchPage page, IPerspectiveDescriptor perspective, String changeId) {
}
public void perspectiveActivated(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
// 改变透视图时,发出监听去检查品质检查结果视图的状态,从而让 视图 菜单的状态与之保持一致。
commandService.refreshElements("net.heartsome.cat.ts.ui.qa.handlers.OpenQAResultViewCommand", null);
// 显示状态栏与工具栏
IHandlerService handlerService = (IHandlerService) window.getService(IHandlerService.class);
IPreferenceStore preferenceStore = Activator.getDefault().getPreferenceStore();
boolean statusVisible = preferenceStore.getBoolean(TsPreferencesConstant.TS_statusBar_status);
if (!statusVisible) {
preferenceStore.setValue(TsPreferencesConstant.TS_statusBar_status, false);
try {
handlerService.executeCommand("net.heartsome.cat.ts.command.openStatusBar", null);
} catch (Exception ex) {
throw new RuntimeException("CommandTest.exitcommand not found");
}
}
WorkbenchWindow window_1 = (WorkbenchWindow) window;
if (!window_1.getCoolBarVisible()) {
try {
window_1.toggleToolbarVisibility();
commandService.refreshElements("net.heartsome.cat.ts.command.openToolBar", null);
} catch (Exception ex) {
throw new RuntimeException("CommandTest.exitcommand not found");
}
}
}
};
window.addPerspectiveListener(perspectiveListener);
}
use of org.eclipse.ui.internal.WorkbenchWindow in project cubrid-manager by CUBRID.
the class ActionManager method changeActionMenu.
/**
*
* Change action menu
*
*/
private void changeActionMenu() {
WorkbenchWindow window = (WorkbenchWindow) PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window == null) {
return;
}
IMenuManager menuBarManager = window.getMenuBarManager();
if (menuBarManager == null) {
return;
}
IMenuManager actionMenuManager = menuBarManager.findMenuUsingPath(IActionConstants.MENU_ACTION);
if (actionMenuManager != null) {
actionMenuManager.removeAll();
setActionsMenu(actionMenuManager);
menuBarManager.update(true);
}
}
use of org.eclipse.ui.internal.WorkbenchWindow in project cubrid-manager by CUBRID.
the class StatusLineContrItem method changeStuatusLineForViewOrEditPart.
/**
*
* When selection changed,change status line message for view part or editor
* part
*
* @param node the ICubridNode object
* @param workbenchPart the IWorkbenchPart object
*/
public void changeStuatusLineForViewOrEditPart(ICubridNode node, IWorkbenchPart workbenchPart) {
WorkbenchWindow window = (WorkbenchWindow) PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window == null) {
return;
}
String nodePath = "";
if (workbenchPart == null) {
if (null != node.getViewId()) {
IViewPart viewPart = LayoutUtil.getViewPart(node, node.getViewId());
if (viewPart != null) {
nodePath = viewPart.getTitle();
}
}
if (null != node.getEditorId()) {
IEditorPart editorPart = LayoutUtil.getEditorPart(node, node.getEditorId());
if (editorPart != null) {
nodePath = editorPart.getTitle();
}
}
} else {
nodePath = workbenchPart.getTitle();
}
//window.setStatus(nodePath == null ? "" : nodePath);
}
use of org.eclipse.ui.internal.WorkbenchWindow in project cubrid-manager by CUBRID.
the class CubridStatusLineContrItem method updateStatusLineForRestoreQueryEditor.
private void updateStatusLineForRestoreQueryEditor() {
final int countOfRestorableQueryEditors = ApplicationPersistUtil.getInstance().countOfRestorableQueryEditorsAtLastSession();
if (countOfRestorableQueryEditors <= 0) {
return;
}
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
StatusLineManager statusLineManager = null;
if (window instanceof WorkbenchWindow) {
statusLineManager = ((WorkbenchWindow) window).getStatusLineManager();
}
if (statusLineManager == null) {
return;
}
IContributionItem scaleItem = new ControlContribution(RESTORE_QUERY_EDITORS_CONTR_ID) {
protected Control createControl(Composite parent) {
Button btn = new Button(parent, SWT.None);
String buttonTitle = Messages.bind(com.cubrid.common.ui.common.Messages.restoreQueryEditorTitle, countOfRestorableQueryEditors);
btn.setText(buttonTitle);
btn.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
ActionManager manager = ActionManager.getInstance();
IAction action = manager.getAction(RestoreQueryEditorAction.ID);
if (action != null && action instanceof RestoreQueryEditorAction) {
action.run();
}
}
});
return btn;
}
;
};
statusLineManager.add(scaleItem);
}
Aggregations