Search in sources :

Example 1 with UserDashboardEditorPart

use of com.cubrid.common.ui.cubrid.user.editor.UserDashboardEditorPart in project cubrid-manager by CUBRID.

the class OpenTargetAction method openUsersDetailInfoEditor.

/**
	 * open users detail info part
	 * @param database
	 */
public void openUsersDetailInfoEditor(CubridDatabase database) {
    IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    if (null == window) {
        return;
    }
    if (database == null) {
        return;
    }
    /*Check it open same editor*/
    IEditorPart editorPart = getOpenedEditorPart(database, UserDashboardEditorPart.ID);
    if (editorPart == null) {
        UsersDashboardInput input = new UsersDashboardInput(database);
        try {
            editorPart = window.getActivePage().openEditor(input, UserDashboardEditorPart.ID);
        } catch (PartInitException e) {
            LOGGER.error("Can not initialize the users view list UI.", e);
        }
    } else {
        UserDashboardEditorPart userDetailInfoPart = (UserDashboardEditorPart) editorPart;
        window.getActivePage().activate(userDetailInfoPart);
        userDetailInfoPart.refresh();
    }
}
Also used : UserDashboardEditorPart(com.cubrid.common.ui.cubrid.user.editor.UserDashboardEditorPart) IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) UsersDashboardInput(com.cubrid.common.ui.cubrid.user.editor.UsersDashboardInput) IEditorPart(org.eclipse.ui.IEditorPart) PartInitException(org.eclipse.ui.PartInitException)

Example 2 with UserDashboardEditorPart

use of com.cubrid.common.ui.cubrid.user.editor.UserDashboardEditorPart in project cubrid-manager by CUBRID.

the class OpenTargetAction method getOpenedEditorPart.

/**
	 * Get  opened IEditorPart
	 * @param database CubridDatabase
	 * @param editorId String
	 * @return
	 */
private IEditorPart getOpenedEditorPart(CubridDatabase database, String editorId) {
    IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    if (window == null) {
        return null;
    }
    IEditorReference[] editorReferences = window.getActivePage().getEditorReferences();
    for (IEditorReference reference : editorReferences) {
        if (reference.getId().equals(editorId)) {
            IEditorPart editor = reference.getEditor(false);
            if (editor != null) {
                if (editor instanceof TriggerDashboardEditorPart) {
                    TriggerDashboardEditorPart triggerDetailInfoPart = (TriggerDashboardEditorPart) editor;
                    if (triggerDetailInfoPart.getDatabase().equals(database)) {
                        return editor;
                    }
                } else if (editor instanceof SerialDashboardEditorPart) {
                    SerialDashboardEditorPart serialDetailInfoPart = (SerialDashboardEditorPart) editor;
                    if (serialDetailInfoPart.getDatabase().equals(database)) {
                        return editor;
                    }
                } else if (editor instanceof ViewDashboardEditorPart) {
                    ViewDashboardEditorPart viewsDetailInfoPart = (ViewDashboardEditorPart) editor;
                    if (viewsDetailInfoPart.getDatabase().equals(database)) {
                        return editor;
                    }
                } else if (editor instanceof UserDashboardEditorPart) {
                    UserDashboardEditorPart userDetailInfoPart = (UserDashboardEditorPart) editor;
                    if (userDetailInfoPart.getDatabase().equals(database)) {
                        return editor;
                    }
                } else {
                    return editor;
                }
            }
        }
    }
    return null;
}
Also used : UserDashboardEditorPart(com.cubrid.common.ui.cubrid.user.editor.UserDashboardEditorPart) IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) IEditorReference(org.eclipse.ui.IEditorReference) ViewDashboardEditorPart(com.cubrid.common.ui.cubrid.view.editor.ViewDashboardEditorPart) SerialDashboardEditorPart(com.cubrid.common.ui.cubrid.serial.editor.SerialDashboardEditorPart) IEditorPart(org.eclipse.ui.IEditorPart) TriggerDashboardEditorPart(com.cubrid.common.ui.cubrid.trigger.editor.TriggerDashboardEditorPart)

Aggregations

UserDashboardEditorPart (com.cubrid.common.ui.cubrid.user.editor.UserDashboardEditorPart)2 IEditorPart (org.eclipse.ui.IEditorPart)2 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)2 SerialDashboardEditorPart (com.cubrid.common.ui.cubrid.serial.editor.SerialDashboardEditorPart)1 TriggerDashboardEditorPart (com.cubrid.common.ui.cubrid.trigger.editor.TriggerDashboardEditorPart)1 UsersDashboardInput (com.cubrid.common.ui.cubrid.user.editor.UsersDashboardInput)1 ViewDashboardEditorPart (com.cubrid.common.ui.cubrid.view.editor.ViewDashboardEditorPart)1 IEditorReference (org.eclipse.ui.IEditorReference)1 PartInitException (org.eclipse.ui.PartInitException)1