Search in sources :

Example 61 with IWorkbench

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();
        }
    });
}
Also used : IWorkbench(org.eclipse.ui.IWorkbench) Display(org.eclipse.swt.widgets.Display)

Example 62 with IWorkbench

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();
    }
}
Also used : IWorkbench(org.eclipse.ui.IWorkbench) Command(org.eclipse.core.commands.Command) ICommandService(org.eclipse.ui.commands.ICommandService)

Example 63 with IWorkbench

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();
        }
    }
}
Also used : IWorkbench(org.eclipse.ui.IWorkbench) Scheme(org.eclipse.jface.bindings.Scheme) IBindingService(org.eclipse.ui.keys.IBindingService)

Example 64 with IWorkbench

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
        }
    });
}
Also used : IWorkbenchListener(org.eclipse.ui.IWorkbenchListener) IWorkbench(org.eclipse.ui.IWorkbench)

Example 65 with IWorkbench

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
    }
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) MonitorStatisticPersistManager(com.cubrid.cubridmanager.ui.spi.persist.MonitorStatisticPersistManager) TreeViewer(org.eclipse.jface.viewers.TreeViewer) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode) CubridNodeChangedEvent(com.cubrid.common.ui.spi.event.CubridNodeChangedEvent) IWorkbench(org.eclipse.ui.IWorkbench) AddStatisticPageDialog(com.cubrid.cubridmanager.ui.monstatistic.dialog.AddStatisticPageDialog) MonitorStatistic(com.cubrid.common.ui.spi.model.MonitorStatistic)

Aggregations

IWorkbench (org.eclipse.ui.IWorkbench)105 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)32 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)31 IEditorPart (org.eclipse.ui.IEditorPart)21 PartInitException (org.eclipse.ui.PartInitException)20 WizardDialog (org.eclipse.jface.wizard.WizardDialog)15 CoreException (org.eclipse.core.runtime.CoreException)12 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)12 Shell (org.eclipse.swt.widgets.Shell)11 IResource (org.eclipse.core.resources.IResource)9 ISelection (org.eclipse.jface.viewers.ISelection)9 Display (org.eclipse.swt.widgets.Display)8 ArrayList (java.util.ArrayList)7 IFile (org.eclipse.core.resources.IFile)7 IEditorDescriptor (org.eclipse.ui.IEditorDescriptor)7 IProject (org.eclipse.core.resources.IProject)6 TreeViewer (org.eclipse.jface.viewers.TreeViewer)6 TableEditorInput (com.cubrid.common.ui.cubrid.table.editor.TableEditorInput)5 ICubridNode (com.cubrid.common.ui.spi.model.ICubridNode)5 ExecTaskWithProgress (com.cubrid.common.ui.spi.progress.ExecTaskWithProgress)5