Search in sources :

Example 71 with IWorkbenchWindow

use of org.eclipse.ui.IWorkbenchWindow in project cubrid-manager by CUBRID.

the class QueryNewCustomAction method run.

/**
	 * @see org.eclipse.jface.action.Action#run()
	 */
public void run() {
    IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    if (window == null) {
        return;
    }
    Object[] selected = getSelectedObj();
    LoginQueryEditDialog dialog = new LoginQueryEditDialog(getShell());
    if (selected != null && selected.length == 1 && selected[0] instanceof ISchemaNode) {
        dialog.setSelServerName(((ISchemaNode) selected[0]).getServer().getServerName());
        dialog.setSelDatabaseName(((ISchemaNode) selected[0]).getDatabase().getName());
    } else if (selected != null && selected.length == 1 && selected[0] instanceof CubridServer) {
        dialog.setSelServerName(((CubridServer) selected[0]).getName());
    } else {
        dialog.setSelServerName(DatabaseNavigatorMenu.SELF_DATABASE_SELECTED_LABEL);
    }
    if (dialog.open() == IDialogConstants.OK_ID) {
        try {
            IEditorInput input = new QueryUnit();
            IEditorPart editor = window.getActivePage().openEditor(input, QueryEditorPart.ID);
            ((QueryEditorPart) editor).connect(DatabaseNavigatorMenu.SELF_DATABASE);
        } catch (PartInitException e) {
            LOGGER.error(e.getMessage());
        }
    }
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) QueryEditorPart(com.cubrid.common.ui.query.editor.QueryEditorPart) QueryUnit(com.cubrid.common.ui.query.editor.QueryUnit) ISchemaNode(com.cubrid.common.ui.spi.model.ISchemaNode) LoginQueryEditDialog(com.cubrid.cubridmanager.ui.common.dialog.LoginQueryEditDialog) IEditorPart(org.eclipse.ui.IEditorPart) PartInitException(org.eclipse.ui.PartInitException) CubridServer(com.cubrid.common.ui.spi.model.CubridServer) IEditorInput(org.eclipse.ui.IEditorInput)

Example 72 with IWorkbenchWindow

use of org.eclipse.ui.IWorkbenchWindow in project cubrid-manager by CUBRID.

the class OpenTargetAction method openTriggersDetailInfoEditor.

/**
	 * open trigger detail info part
	 * @param database
	 */
public void openTriggersDetailInfoEditor(CubridDatabase database) {
    IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    if (null == window) {
        return;
    }
    if (database == null) {
        return;
    }
    /*Check it open same editor*/
    IEditorPart editorPart = getOpenedEditorPart(database, TriggerDashboardEditorPart.ID);
    if (editorPart == null) {
        OpenTriggerDetailInfoPartProgress progress = new OpenTriggerDetailInfoPartProgress(database);
        progress.loadTriggerInfoList();
        if (progress.isSuccess()) {
            TriggerDashboardInput input = new TriggerDashboardInput(database, progress.getTriggerList());
            try {
                window.getActivePage().openEditor(input, TriggerDashboardEditorPart.ID);
            } catch (PartInitException e) {
                LOGGER.error("Can not initialize the trigger view list UI.", e);
            }
        }
    } else {
        TriggerDashboardEditorPart triggerDetailInfoPart = (TriggerDashboardEditorPart) editorPart;
        window.getActivePage().activate(triggerDetailInfoPart);
        triggerDetailInfoPart.refresh();
    }
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) OpenTriggerDetailInfoPartProgress(com.cubrid.common.ui.spi.progress.OpenTriggerDetailInfoPartProgress) TriggerDashboardInput(com.cubrid.common.ui.cubrid.trigger.editor.TriggerDashboardInput) IEditorPart(org.eclipse.ui.IEditorPart) PartInitException(org.eclipse.ui.PartInitException) TriggerDashboardEditorPart(com.cubrid.common.ui.cubrid.trigger.editor.TriggerDashboardEditorPart)

Example 73 with IWorkbenchWindow

use of org.eclipse.ui.IWorkbenchWindow in project cubrid-manager by CUBRID.

the class OpenTargetAction method run.

public void run() {
    IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    if (window == null) {
        return;
    }
    final Object[] obj = this.getSelectedObj();
    if (!isSupported(obj)) {
        setEnabled(false);
        return;
    }
    for (int i = 0; i < obj.length; i++) {
        if (!NodeUtil.isCubridNode(obj[i])) {
            continue;
        }
        ICubridNode node = (ICubridNode) obj[i];
        if (NodeUtil.isTableViewNode(node)) {
            DefaultSchemaNode table = (DefaultSchemaNode) obj[i];
            showObjectInfo(table);
        } else if (NodeUtil.isTableFolderNode(node)) {
            CubridNavigatorView view = CubridNavigatorView.findNavigationView();
            if (view == null) {
                return;
            }
            //if not expand ,expand the node and wait until all children be added
            TreeViewer treeViewer = view.getViewer();
            if (!treeViewer.getExpandedState(node)) {
                treeViewer.expandToLevel(node, 1);
                while (node.getChildren().size() == 0) {
                    ThreadUtil.sleep(500);
                }
            }
            showTableDashboard(NodeUtil.getCubridDatabase(node));
        } else if (NodeUtil.isViewFolderNode(node)) {
            CubridNavigatorView view = CubridNavigatorView.getNavigatorView("com.cubrid.cubridquery.connection.navigator");
            if (view == null) {
                view = CubridNavigatorView.getNavigatorView("com.cubrid.cubridmanager.host.navigator");
            }
            if (view == null) {
                return;
            }
            //if not expand ,expand the node and wait until all children be added
            TreeViewer treeViewer = view.getViewer();
            if (!treeViewer.getExpandedState(node)) {
                treeViewer.expandToLevel(node, 1);
                while (node.getChildren().size() == 0) {
                    ThreadUtil.sleep(500);
                }
            }
            openViewsDetailInfoEditor(NodeUtil.getCubridDatabase(node));
        } else if (NodeUtil.isSerialFolderNode(node)) {
            CubridNavigatorView view = CubridNavigatorView.findNavigationView();
            if (view == null) {
                return;
            }
            //if not expand ,expand the node and wait until all children be added
            TreeViewer treeViewer = view.getViewer();
            if (!treeViewer.getExpandedState(node)) {
                treeViewer.expandToLevel(node, 1);
                while (node.getChildren().size() == 0) {
                    ThreadUtil.sleep(500);
                }
            }
            openSerialsDetailInfoEditor(NodeUtil.getCubridDatabase(node), null);
        } else if (NodeUtil.isTriggerFolderNode(node)) {
            CubridNavigatorView view = CubridNavigatorView.findNavigationView();
            if (view == null) {
                return;
            }
            //if not expand ,expand the node and wait until all children be added
            TreeViewer treeViewer = view.getViewer();
            if (!treeViewer.getExpandedState(node)) {
                treeViewer.expandToLevel(node, 1);
                while (node.getChildren().size() == 0) {
                    ThreadUtil.sleep(500);
                }
            }
            openTriggersDetailInfoEditor(NodeUtil.getCubridDatabase(node));
        } else if (NodeUtil.isUserFolderNode(node)) {
            CubridNavigatorView view = CubridNavigatorView.findNavigationView();
            if (view == null) {
                return;
            }
            //if not expand ,expand the node and wait until all children be added
            TreeViewer treeViewer = view.getViewer();
            if (!treeViewer.getExpandedState(node)) {
                treeViewer.expandToLevel(node, 1);
                while (node.getChildren().size() == 0) {
                    ThreadUtil.sleep(500);
                }
            }
            openUsersDetailInfoEditor(NodeUtil.getCubridDatabase(node));
        }
    }
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) CubridNavigatorView(com.cubrid.common.ui.common.navigator.CubridNavigatorView) TreeViewer(org.eclipse.jface.viewers.TreeViewer) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode) DefaultSchemaNode(com.cubrid.common.ui.spi.model.DefaultSchemaNode)

Example 74 with IWorkbenchWindow

use of org.eclipse.ui.IWorkbenchWindow in project cubrid-manager by CUBRID.

the class AboutAction method run.

public void run() {
    IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    if (window == null) {
        return;
    }
    new AboutDialog(window.getShell(), productName, versionId, aboutImageDescriptor).open();
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) AboutDialog(com.cubrid.common.ui.common.dialog.AboutDialog)

Example 75 with IWorkbenchWindow

use of org.eclipse.ui.IWorkbenchWindow in project cubrid-manager by CUBRID.

the class BrokerLogTopMergeAction method run.

public void run() {
    IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    if (window == null) {
        return;
    }
    new BrokerLogTopMergeDialog(window.getShell()).open();
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) BrokerLogTopMergeDialog(com.cubrid.common.ui.common.dialog.BrokerLogTopMergeDialog)

Aggregations

IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)363 IEditorPart (org.eclipse.ui.IEditorPart)136 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)102 PartInitException (org.eclipse.ui.PartInitException)81 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)41 QueryEditorPart (com.cubrid.common.ui.query.editor.QueryEditorPart)39 IViewPart (org.eclipse.ui.IViewPart)39 ArrayList (java.util.ArrayList)37 IEditorReference (org.eclipse.ui.IEditorReference)35 ICubridNode (com.cubrid.common.ui.spi.model.ICubridNode)32 IWorkbench (org.eclipse.ui.IWorkbench)32 IFile (org.eclipse.core.resources.IFile)30 ISelection (org.eclipse.jface.viewers.ISelection)29 XLIFFEditorImplWithNatTable (net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable)27 Shell (org.eclipse.swt.widgets.Shell)26 XLFHandler (net.heartsome.cat.ts.core.file.XLFHandler)24 CoreException (org.eclipse.core.runtime.CoreException)23 IWorkbenchPart (org.eclipse.ui.IWorkbenchPart)21 IProject (org.eclipse.core.resources.IProject)20 QueryUnit (com.cubrid.common.ui.query.editor.QueryUnit)19