Search in sources :

Example 6 with CubridViewPart

use of com.cubrid.common.ui.spi.part.CubridViewPart in project cubrid-manager by CUBRID.

the class LayoutUtil method getViewPart.

/**
	 * 
	 * Get the view part of this cubrid node and viewId
	 * 
	 * @param cubridNode the ICubridNode object
	 * @param viewId the view id
	 * @return the IViewPart object
	 */
public static IViewPart getViewPart(ICubridNode cubridNode, String viewId) {
    IWorkbenchPage page = getActivePage();
    if (page == null) {
        return null;
    }
    IViewReference[] viewRefArr = page.getViewReferences();
    if (viewRefArr == null || viewRefArr.length == 0) {
        return null;
    }
    for (IViewReference viewRef : viewRefArr) {
        IViewPart viewPart = viewRef.getView(false);
        String id = viewRef.getId();
        if (viewPart instanceof CubridViewPart) {
            CubridViewPart cubridViewPart = (CubridViewPart) viewPart;
            ICubridNode node = cubridViewPart.getCubridNode();
            if (node != null && node.getId().equals(cubridNode.getId()) && viewId.equals(id)) {
                return viewPart;
            }
        }
    }
    return null;
}
Also used : IViewPart(org.eclipse.ui.IViewPart) CubridViewPart(com.cubrid.common.ui.spi.part.CubridViewPart) IViewReference(org.eclipse.ui.IViewReference) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode)

Example 7 with CubridViewPart

use of com.cubrid.common.ui.spi.part.CubridViewPart in project cubrid-manager by CUBRID.

the class LayoutUtil method getViewParts.

/**
	 * 
	 * Get the view parts of this CUBRID node
	 * 
	 * @param cubridNode the ICubridNode object
	 * @return List<IViewPart>
	 */
public static List<IViewPart> getViewParts(ICubridNode cubridNode) {
    List<IViewPart> viewPartList = new ArrayList<IViewPart>();
    IWorkbenchPage page = getActivePage();
    if (page == null) {
        return viewPartList;
    }
    IViewReference[] viewRefArr = page.getViewReferences();
    if (viewRefArr == null || viewRefArr.length == 0) {
        return viewPartList;
    }
    for (IViewReference viewRef : viewRefArr) {
        IViewPart viewPart = viewRef.getView(false);
        if (viewPart instanceof CubridViewPart) {
            CubridViewPart cubridViewPart = (CubridViewPart) viewPart;
            ICubridNode node = cubridViewPart.getCubridNode();
            if (node != null && node.getId().equals(cubridNode.getId())) {
                viewPartList.add(viewPart);
            }
        }
    }
    return viewPartList;
}
Also used : IViewPart(org.eclipse.ui.IViewPart) CubridViewPart(com.cubrid.common.ui.spi.part.CubridViewPart) IViewReference(org.eclipse.ui.IViewReference) ArrayList(java.util.ArrayList) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode)

Aggregations

ICubridNode (com.cubrid.common.ui.spi.model.ICubridNode)7 CubridViewPart (com.cubrid.common.ui.spi.part.CubridViewPart)7 IViewPart (org.eclipse.ui.IViewPart)7 IViewReference (org.eclipse.ui.IViewReference)7 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)6 IEditorInput (org.eclipse.ui.IEditorInput)5 IEditorReference (org.eclipse.ui.IEditorReference)5 PartInitException (org.eclipse.ui.PartInitException)5 ISchemaNode (com.cubrid.common.ui.spi.model.ISchemaNode)2 ArrayList (java.util.ArrayList)1 IWorkbench (org.eclipse.ui.IWorkbench)1 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)1