Search in sources :

Example 1 with JobAutoDashboardEditorPart

use of com.cubrid.cubridmanager.ui.cubrid.jobauto.editor.JobAutoDashboardEditorPart in project cubrid-manager by CUBRID.

the class OpenJobAutomationInfoAction method openJobsDetailInfoEditor.

/**
		 * open job detail info part
		 * @param database
		 */
public void openJobsDetailInfoEditor(CubridDatabase database) {
    IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    if (null == window) {
        return;
    }
    if (database == null) {
        return;
    }
    /*Check it open same editor*/
    IEditorPart editorPart = getOpenedEditorPart(database, JobAutoDashboardEditorPart.ID);
    if (editorPart == null) {
        OpenJobAutomationInfoPartProgress progress = new OpenJobAutomationInfoPartProgress(database);
        progress.loadJobAutomationInfoList();
        if (progress.isSuccess()) {
            JobAutoDashboardInput input = new JobAutoDashboardInput(database, progress.getBackupPlanInfoList(), progress.getQueryPlanInfoList());
            try {
                window.getActivePage().openEditor(input, JobAutoDashboardEditorPart.ID);
            } catch (PartInitException e) {
                LOGGER.error("Can not initialize the trigger view list UI.", e);
            }
        }
    } else {
        JobAutoDashboardEditorPart jobAutoDetailInfoPart = (JobAutoDashboardEditorPart) editorPart;
        window.getActivePage().activate(jobAutoDetailInfoPart);
        jobAutoDetailInfoPart.refreshAll();
    }
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) OpenJobAutomationInfoPartProgress(com.cubrid.cubridmanager.ui.cubrid.jobauto.progress.OpenJobAutomationInfoPartProgress) JobAutoDashboardInput(com.cubrid.cubridmanager.ui.cubrid.jobauto.editor.JobAutoDashboardInput) JobAutoDashboardEditorPart(com.cubrid.cubridmanager.ui.cubrid.jobauto.editor.JobAutoDashboardEditorPart) IEditorPart(org.eclipse.ui.IEditorPart) PartInitException(org.eclipse.ui.PartInitException)

Example 2 with JobAutoDashboardEditorPart

use of com.cubrid.cubridmanager.ui.cubrid.jobauto.editor.JobAutoDashboardEditorPart in project cubrid-manager by CUBRID.

the class OpenJobAutomationInfoAction 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 JobAutoDashboardEditorPart) {
                    JobAutoDashboardEditorPart jobAutoDetailInfoPart = (JobAutoDashboardEditorPart) editor;
                    if (jobAutoDetailInfoPart.getDatabase().equals(database)) {
                        return editor;
                    }
                }
            }
        }
    }
    return null;
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) IEditorReference(org.eclipse.ui.IEditorReference) JobAutoDashboardEditorPart(com.cubrid.cubridmanager.ui.cubrid.jobauto.editor.JobAutoDashboardEditorPart) IEditorPart(org.eclipse.ui.IEditorPart)

Aggregations

JobAutoDashboardEditorPart (com.cubrid.cubridmanager.ui.cubrid.jobauto.editor.JobAutoDashboardEditorPart)2 IEditorPart (org.eclipse.ui.IEditorPart)2 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)2 JobAutoDashboardInput (com.cubrid.cubridmanager.ui.cubrid.jobauto.editor.JobAutoDashboardInput)1 OpenJobAutomationInfoPartProgress (com.cubrid.cubridmanager.ui.cubrid.jobauto.progress.OpenJobAutomationInfoPartProgress)1 IEditorReference (org.eclipse.ui.IEditorReference)1 PartInitException (org.eclipse.ui.PartInitException)1