Search in sources :

Example 1 with ServiceDashboardEditor

use of com.cubrid.cubridmanager.ui.service.editor.ServiceDashboardEditor in project cubrid-manager by CUBRID.

the class ServiceDashboardAction method run.

/**
	 * @see org.eclipse.jface.action.Action#run() Override the run method in
	 *      order to complete showing brokers status server to a broker
	 */
public void run() {
    IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    if (null == window) {
        return;
    }
    /*Check it open same editor*/
    ServiceDashboardEditor editorPart = findOpenedEditorPart();
    if (editorPart == null) {
        ServiceDashboardEditorInput editorInput = new ServiceDashboardEditorInput();
        editorInput.setName("");
        editorInput.setToolTipText(Messages.serviceDashboardPartToolTip);
        try {
            editorPart = (ServiceDashboardEditor) window.getActivePage().openEditor(editorInput, ServiceDashboardEditor.ID);
            editorPart.loadAllData();
        } catch (PartInitException ex) {
            LOGGER.error(ex.getMessage());
        }
    } else {
        window.getActivePage().activate(editorPart);
        editorPart.loadAllData();
    }
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) PartInitException(org.eclipse.ui.PartInitException) ServiceDashboardEditorInput(com.cubrid.cubridmanager.ui.service.editor.ServiceDashboardEditorInput) ServiceDashboardEditor(com.cubrid.cubridmanager.ui.service.editor.ServiceDashboardEditor)

Example 2 with ServiceDashboardEditor

use of com.cubrid.cubridmanager.ui.service.editor.ServiceDashboardEditor in project cubrid-manager by CUBRID.

the class ServiceDashboardAction method findOpenedEditorPart.

/**
	 * Get all opened query editor
	 * 
	 * @return
	 */
private ServiceDashboardEditor findOpenedEditorPart() {
    IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    if (window == null) {
        return null;
    }
    IEditorReference[] editorReferences = window.getActivePage().getEditorReferences();
    for (IEditorReference reference : editorReferences) {
        if (reference.getId().equals(ServiceDashboardEditor.ID)) {
            ServiceDashboardEditor editor = (ServiceDashboardEditor) reference.getEditor(false);
            if (editor != null) {
                return editor;
            }
        }
    }
    return null;
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) IEditorReference(org.eclipse.ui.IEditorReference) ServiceDashboardEditor(com.cubrid.cubridmanager.ui.service.editor.ServiceDashboardEditor)

Aggregations

ServiceDashboardEditor (com.cubrid.cubridmanager.ui.service.editor.ServiceDashboardEditor)2 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)2 ServiceDashboardEditorInput (com.cubrid.cubridmanager.ui.service.editor.ServiceDashboardEditorInput)1 IEditorReference (org.eclipse.ui.IEditorReference)1 PartInitException (org.eclipse.ui.PartInitException)1