use of org.eclipse.ui.IWorkbench in project translationstudio8 by heartsome.
the class Application method stop.
/* (non-Javadoc)
* @see org.eclipse.equinox.app.IApplication#stop()
*/
public void stop() {
final IWorkbench workbench = PlatformUI.getWorkbench();
if (workbench == null)
return;
final Display display = workbench.getDisplay();
display.syncExec(new Runnable() {
public void run() {
if (!display.isDisposed())
workbench.close();
}
});
}
use of org.eclipse.ui.IWorkbench in project translationstudio8 by heartsome.
the class AbstractShieldCommandStartup method earlyStartup.
public void earlyStartup() {
Set<String> unusedCommand = getUnusedCommandSet();
IWorkbench workbench = PlatformUI.getWorkbench();
ICommandService commandService = (ICommandService) workbench.getService(ICommandService.class);
Command command;
for (String commandId : unusedCommand) {
command = commandService.getCommand(commandId);
command.undefine();
}
}
use of org.eclipse.ui.IWorkbench in project translationstudio8 by heartsome.
the class ShieldStartup method earlyStartup.
public void earlyStartup() {
IWorkbench workbench = PlatformUI.getWorkbench();
// 在工作台初始化后,移除平台默认的 scheme
IBindingService bindingService = (IBindingService) workbench.getService(IBindingService.class);
Scheme[] schemes = bindingService.getDefinedSchemes();
for (int i = 0; i < schemes.length; i++) {
String id = schemes[i].getId();
if (id.equals(platformDefaultScheme) || id.equals(platformEmacsScheme)) {
schemes[i].undefine();
}
}
}
use of org.eclipse.ui.IWorkbench in project gfm_viewer by satyagraha.
the class LogConsole method start.
public static void start(String name) {
instance = new LogConsole(name);
// due to JobManager shutting down we need to stop early
PlatformUI.getWorkbench().addWorkbenchListener(new IWorkbenchListener() {
@Override
public boolean preShutdown(IWorkbench workbench, boolean forced) {
stop();
return true;
}
@Override
public void postShutdown(IWorkbench workbench) {
// no-op
}
});
}
use of org.eclipse.ui.IWorkbench in project cubrid-manager by CUBRID.
the class AddMonitorStatisticPageAction method run.
/**
* Override the run method in order to open an instance of status monitor
* dialog
*
*/
public void run() {
Object[] obj = this.getSelectedObj();
ICubridNode node = null;
if (obj.length > 0) {
node = (ICubridNode) obj[0];
}
String hostId = null;
boolean isSingleHost = node != null && CubridNodeType.MONITOR_FOLDER.equals(node.getType());
if (isSingleHost) {
ServerInfo serverInfo = node.getServer().getServerInfo();
hostId = serverInfo.getServerName();
if (!serverInfo.isSupportMonitorStatistic()) {
CommonUITool.openWarningBox(Messages.needEnableMonitorStatisticMsg);
return;
}
}
AddStatisticPageDialog dialog = new AddStatisticPageDialog(getShell());
dialog.setCubridServerId(hostId);
if (dialog.open() == Dialog.OK) {
final String iconPath = "icons/navigator/status_item.png";
String labelName = dialog.getName();
String pageName = labelName;
if (hostId != null) {
pageName += "@" + hostId;
}
MonitorStatistic monitorStatisticNode = new MonitorStatistic(pageName, labelName, iconPath);
monitorStatisticNode.setType(CubridNodeType.MONITOR_STATISTIC_PAGE);
monitorStatisticNode.setEditorId(MonitorStatisticEditor.ID);
if (isSingleHost) {
monitorStatisticNode.setMultiHost(false);
ServerInfo serverInfo = node.getServer().getServerInfo();
monitorStatisticNode.setIp(serverInfo.getHostAddress());
monitorStatisticNode.setPort(serverInfo.getHostMonPort());
} else {
monitorStatisticNode.setMultiHost(true);
}
MonitorStatisticPersistManager persistManager = MonitorStatisticPersistManager.getInstance();
persistManager.addMonitorStatistic(monitorStatisticNode, hostId);
persistManager.saveStatistic();
//refresh TreeViewer
TreeViewer treeViewer = (TreeViewer) this.getSelectionProvider();
if (isSingleHost) {
node.addChild(monitorStatisticNode);
treeViewer.add(node, monitorStatisticNode);
} else {
/*TOOLS-3665 Refresh the input of TreeViewer*/
treeViewer.setInput(CubridMonitorNavigatorView.getTreeViewerInput());
}
CubridNodeManager.getInstance().fireCubridNodeChanged(new CubridNodeChangedEvent(monitorStatisticNode, CubridNodeChangedEventType.NODE_ADD));
try {
IWorkbench workbench = PlatformUI.getWorkbench();
IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
workbenchWindow.getActivePage().openEditor(monitorStatisticNode, MonitorStatisticEditor.ID);
} catch (Exception ignore) {
}
} else {
//TODO
}
}
Aggregations