use of org.eclipse.ui.internal.WorkbenchWindow in project GT by Tencent.
the class StatusBar method init.
@SuppressWarnings("restriction")
public void init() {
WorkbenchWindow curworkbenchWindow = (WorkbenchWindow) PlatformUI.getWorkbench().getActiveWorkbenchWindow();
curworkbenchWindow.setStatusLineVisible(true);
lineManager = curworkbenchWindow.getStatusLineManager();
statusItem = new StatusLineContributionItem("APT", 100);
lineManager.add(statusItem);
}
use of org.eclipse.ui.internal.WorkbenchWindow in project translationstudio8 by heartsome.
the class OpenToolBarHandler method execute.
public Object execute(ExecutionEvent event) throws ExecutionException {
final IWorkbenchWindow activeWorkbenchWindow = HandlerUtil.getActiveWorkbenchWindowChecked(event);
if (activeWorkbenchWindow instanceof WorkbenchWindow) {
WorkbenchWindow window = (WorkbenchWindow) activeWorkbenchWindow;
window.toggleToolbarVisibility();
}
ICommandService commandService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
commandService.refreshElements(event.getCommand().getId(), null);
return null;
}
use of org.eclipse.ui.internal.WorkbenchWindow in project cubrid-manager by CUBRID.
the class CubridStatusLineContrItem method changeStuatusLineForNavigator.
/**
*
* Change status line for navigator selection
*
* @param selection the ISelection object
*/
public void changeStuatusLineForNavigator(ISelection selection) {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window == null) {
return;
}
WorkbenchWindow workbenchWindow = null;
StatusLineManager statusLineManager = null;
if (window instanceof WorkbenchWindow) {
workbenchWindow = (WorkbenchWindow) window;
statusLineManager = workbenchWindow.getStatusLineManager();
}
//workbenchWindow.setStatus("");
clearStatusLine();
updateStatusLineForRestoreQueryEditor();
if (selection == null || selection.isEmpty()) {
return;
}
Object obj = ((IStructuredSelection) selection).getFirstElement();
if (!(obj instanceof ICubridNode)) {
return;
}
CubridNavigatorView navigatorView = CubridNavigatorView.findNavigationView();
boolean isShowGroup = navigatorView == null ? false : navigatorView.savedIsShowGroup();
ICubridNode cubridNode = (ICubridNode) obj;
String nodePath = cubridNode.getLabel();
ICubridNode parent = cubridNode.getParent();
while (parent != null) {
if (!isShowGroup && NodeType.GROUP.equals(parent.getType())) {
break;
}
nodePath = parent.getLabel() + "/" + nodePath;
parent = parent.getParent();
}
//workbenchWindow.setStatus(nodePath);
CubridServer server = cubridNode.getServer();
ServerInfo serverInfo = server == null ? null : server.getServerInfo();
if (serverInfo == null || !serverInfo.isConnected()) {
return;
}
if (statusLineManager != null) {
updateStatusLine(statusLineManager, cubridNode);
}
}
use of org.eclipse.ui.internal.WorkbenchWindow in project cubrid-manager by CUBRID.
the class CubridStatusLineContrItem method clearStatusLine.
/**
*
* Clear the status line information of CUBRID Manager
*
*/
public void clearStatusLine() {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window == null) {
return;
}
if (window instanceof WorkbenchWindow) {
StatusLineManager statusLineManager = ((WorkbenchWindow) window).getStatusLineManager();
if (statusLineManager != null) {
statusLineManager.remove(RESTORE_QUERY_EDITORS_CONTR_ID);
statusLineManager.remove(UPDATE_APP_CONTR_ID);
statusLineManager.remove(SERVER_INFO_CONTR_ID);
statusLineManager.remove(DB_INFO_CONTR_ID);
statusLineManager.remove(OBJ_NUM_INFO_CONTR_ID);
statusLineManager.update(true);
}
}
}
use of org.eclipse.ui.internal.WorkbenchWindow in project cubrid-manager by CUBRID.
the class CubridStatusLineContrItem method changeStuatusLineForNavigator.
/**
*
* Change status line for navigator selection
*
* @param selection the ISelection object
*/
public void changeStuatusLineForNavigator(ISelection selection) {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window == null) {
return;
}
//window.setStatus("");
clearStatusLine();
updateStatusLineForRestoreQueryEditor();
if (selection == null || selection.isEmpty()) {
return;
}
Object obj = ((IStructuredSelection) selection).getFirstElement();
if (!(obj instanceof ICubridNode)) {
return;
}
CubridNavigatorView navigatorView = CubridNavigatorView.getNavigatorView(CubridQueryNavigatorView.ID);
boolean isShowGroup = false;
if (navigatorView != null) {
isShowGroup = navigatorView.isShowGroup();
}
ICubridNode cubridNode = (ICubridNode) obj;
String nodePath = cubridNode.getLabel();
ICubridNode parent = cubridNode.getParent();
while (parent != null) {
if (!isShowGroup && NodeType.GROUP.equals(parent.getType())) {
break;
}
nodePath = parent.getLabel() + "/" + nodePath;
parent = parent.getParent();
}
//window.setStatus(nodePath);
if (window instanceof WorkbenchWindow) {
StatusLineManager statusLineManager = ((WorkbenchWindow) window).getStatusLineManager();
if (statusLineManager != null) {
updateStatusLine(statusLineManager, cubridNode);
}
}
}
Aggregations