Search in sources :

Example 1 with OpenViewsDetailInfoPartProgress

use of com.cubrid.common.ui.spi.progress.OpenViewsDetailInfoPartProgress in project cubrid-manager by CUBRID.

the class ViewDashboardEditorPart method refresh.

public void refresh() {
    OpenViewsDetailInfoPartProgress progress = new OpenViewsDetailInfoPartProgress(database);
    progress.loadViewsInfo();
    if (progress.isSuccess()) {
        viewList = progress.getViewList();
        viewsDetailInfoTable.setInput(viewList);
        viewsDetailInfoTable.refresh();
        List<CTabItem> closeTabItem = new ArrayList<CTabItem>();
        for (CTabItem cTabItem : tabFolder.getItems()) {
            ViewsDetailInfoCTabItem viewsDetailInfoCTabItem = (ViewsDetailInfoCTabItem) cTabItem;
            //refresh column data
            if (findItemName(viewsDetailInfoCTabItem.getText())) {
                SchemaInfo schemaInfo = database.getDatabaseInfo().getSchemaInfo(viewsDetailInfoCTabItem.getText());
                viewsDetailInfoCTabItem.getViewInfoComposite().setInput(schemaInfo);
            } else {
                //tag non-exist view tab
                closeTabItem.add(cTabItem);
            }
        }
        //dispose non-exist view tab
        for (CTabItem cTabItem : closeTabItem) {
            cTabItem.dispose();
        }
        //if the select item is disposed ,set the first on selection
        if (tabFolder.getItems().length > 0 && tabFolder.getSelection().isDisposed()) {
            tabFolder.setSelection(0);
        }
        viewChangeFlag = false;
    }
}
Also used : ViewsDetailInfoCTabItem(com.cubrid.common.ui.cubrid.view.editor.ViewDashboardComposite.ViewsDetailInfoCTabItem) OpenViewsDetailInfoPartProgress(com.cubrid.common.ui.spi.progress.OpenViewsDetailInfoPartProgress) ArrayList(java.util.ArrayList) ViewsDetailInfoCTabItem(com.cubrid.common.ui.cubrid.view.editor.ViewDashboardComposite.ViewsDetailInfoCTabItem) CTabItem(org.eclipse.swt.custom.CTabItem) SchemaInfo(com.cubrid.common.core.common.model.SchemaInfo)

Example 2 with OpenViewsDetailInfoPartProgress

use of com.cubrid.common.ui.spi.progress.OpenViewsDetailInfoPartProgress in project cubrid-manager by CUBRID.

the class OpenTargetAction method openViewsDetailInfoEditor.

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

Aggregations

OpenViewsDetailInfoPartProgress (com.cubrid.common.ui.spi.progress.OpenViewsDetailInfoPartProgress)2 SchemaInfo (com.cubrid.common.core.common.model.SchemaInfo)1 ViewsDetailInfoCTabItem (com.cubrid.common.ui.cubrid.view.editor.ViewDashboardComposite.ViewsDetailInfoCTabItem)1 ViewDashboardEditorPart (com.cubrid.common.ui.cubrid.view.editor.ViewDashboardEditorPart)1 ViewDashboardInput (com.cubrid.common.ui.cubrid.view.editor.ViewDashboardInput)1 ArrayList (java.util.ArrayList)1 CTabItem (org.eclipse.swt.custom.CTabItem)1 IEditorPart (org.eclipse.ui.IEditorPart)1 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)1 PartInitException (org.eclipse.ui.PartInitException)1