Search in sources :

Example 91 with ICubridNode

use of com.cubrid.common.ui.spi.model.ICubridNode in project cubrid-manager by CUBRID.

the class ERSchema method getTableTreeNode.

public ICubridNode getTableTreeNode(String tableName) {
    ICubridNode node = this.getCubridDatabase().getChild(getCubridDatabase().getId() + ICubridNodeLoader.NODE_SEPARATOR + CubridTablesFolderLoader.TABLES_FOLDER_ID);
    if (node == null || !node.getLoader().isLoaded()) {
        return null;
    }
    List<ICubridNode> tableNodes = node.getChildren();
    for (ICubridNode tableNode : tableNodes) {
        if (tableNode == null) {
            continue;
        }
        if (tableNode.getName().equals(tableName)) {
            return tableNode;
        }
    }
    return null;
}
Also used : ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode)

Example 92 with ICubridNode

use of com.cubrid.common.ui.spi.model.ICubridNode in project cubrid-manager by CUBRID.

the class ERSchemaEditor method initializeGraphicalViewer.

protected void initializeGraphicalViewer() {
    IEditorInput input = this.getEditorInput();
    if (input instanceof ICubridNode) {
        ICubridNode node = (ICubridNode) input;
        ERSchema erSchema = (ERSchema) node.getAdapter(ERSchema.class);
        getGraphicalViewer().setContents(erSchema);
    }
}
Also used : ERSchema(com.cubrid.common.ui.er.model.ERSchema) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode) IEditorInput(org.eclipse.ui.IEditorInput)

Example 93 with ICubridNode

use of com.cubrid.common.ui.spi.model.ICubridNode in project cubrid-manager by CUBRID.

the class CubridSPFolderLoader method load.

/**
	 * 
	 * Load children object for parent
	 * 
	 * @param parent the parent node
	 * @param monitor the IProgressMonitor object
	 */
public void load(ICubridNode parent, final IProgressMonitor monitor) {
    synchronized (this) {
        if (isLoaded()) {
            return;
        }
        CubridDatabase database = ((ISchemaNode) parent).getDatabase();
        if (!database.isLogined() || database.getRunningType() == DbRunningType.STANDALONE) {
            parent.removeAllChild();
            CubridNodeManager.getInstance().fireCubridNodeChanged(new CubridNodeChangedEvent((ICubridNode) parent, CubridNodeChangedEventType.CONTAINER_NODE_REFRESH));
            return;
        }
        // add function folder
        String functionFolderId = parent.getId() + NODE_SEPARATOR + FUNCTION_FOLDER_ID;
        ICubridNode functionFolder = parent.getChild(functionFolderId);
        if (functionFolder == null) {
            functionFolder = new DefaultSchemaNode(functionFolderId, FUNCTION_FOLDER_NAME, "icons/navigator/folder.png");
            functionFolder.setType(NodeType.STORED_PROCEDURE_FUNCTION_FOLDER);
            functionFolder.setContainer(true);
            ICubridNodeLoader loader = new CubridFunctionFolderLoader();
            loader.setLevel(getLevel());
            functionFolder.setLoader(loader);
            parent.addChild(functionFolder);
            if (getLevel() == DEFINITE_LEVEL) {
                functionFolder.getChildren(monitor);
            }
        } else {
            if (functionFolder.getLoader() != null && functionFolder.getLoader().isLoaded()) {
                functionFolder.getLoader().setLoaded(false);
                functionFolder.getChildren(monitor);
            }
        }
        // add procedure folder
        String procedureFolderId = parent.getId() + NODE_SEPARATOR + PROCEDURE_FOLDER_ID;
        ICubridNode procedureFolder = parent.getChild(procedureFolderId);
        if (procedureFolder == null) {
            procedureFolder = new DefaultSchemaNode(procedureFolderId, PROCEDURE_FOLDER_NAME, "icons/navigator/folder.png");
            procedureFolder.setType(NodeType.STORED_PROCEDURE_PROCEDURE_FOLDER);
            procedureFolder.setContainer(true);
            ICubridNodeLoader loader = new CubridProcedureFolderLoader();
            loader.setLevel(getLevel());
            procedureFolder.setLoader(loader);
            parent.addChild(procedureFolder);
            if (getLevel() == DEFINITE_LEVEL) {
                procedureFolder.getChildren(monitor);
            }
        } else {
            if (procedureFolder.getLoader() != null && procedureFolder.getLoader().isLoaded()) {
                procedureFolder.getLoader().setLoaded(false);
                procedureFolder.getChildren(monitor);
            }
        }
        setLoaded(true);
        CubridNodeManager.getInstance().fireCubridNodeChanged(new CubridNodeChangedEvent((ICubridNode) parent, CubridNodeChangedEventType.CONTAINER_NODE_REFRESH));
    }
}
Also used : ICubridNodeLoader(com.cubrid.common.ui.spi.model.ICubridNodeLoader) ISchemaNode(com.cubrid.common.ui.spi.model.ISchemaNode) CubridNodeChangedEvent(com.cubrid.common.ui.spi.event.CubridNodeChangedEvent) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode) CubridDatabase(com.cubrid.common.ui.spi.model.CubridDatabase) DefaultSchemaNode(com.cubrid.common.ui.spi.model.DefaultSchemaNode)

Example 94 with ICubridNode

use of com.cubrid.common.ui.spi.model.ICubridNode in project cubrid-manager by CUBRID.

the class CubridEditorPart method close.

/**
	 * close the editors which are the same server 
	 * @param event
	 * @param database
	 */
public void close(CubridNodeChangedEvent event, CubridServer server) {
    ICubridNode cubridNode = event.getCubridNode();
    CubridNodeChangedEventType eventType = event.getType();
    if (cubridNode == null || eventType == null) {
        return;
    }
    if (event.getSource() instanceof CubridServer) {
        CubridServer eventCubridServer = (CubridServer) event.getSource();
        if (eventCubridServer.equals(server)) {
            IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
            if (window == null) {
                return;
            }
            window.getActivePage().closeEditor(this, true);
        }
    }
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) CubridNodeChangedEventType(com.cubrid.common.ui.spi.event.CubridNodeChangedEventType) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode) CubridServer(com.cubrid.common.ui.spi.model.CubridServer)

Example 95 with ICubridNode

use of com.cubrid.common.ui.spi.model.ICubridNode in project cubrid-manager by CUBRID.

the class CubridEditorPart method init.

/**
	 * Initializes this editor with the given editor site and input.
	 * 
	 * @param site the editor site
	 * @param input the editor input
	 * @exception PartInitException if this editor was not initialized
	 *            successfully
	 */
public void init(IEditorSite site, IEditorInput input) throws PartInitException {
    setSite(site);
    setInput(input);
    if (input != null && input.getToolTipText() != null) {
        setTitleToolTip(input.getToolTipText());
    }
    String title = this.getPartName();
    CubridServer server = null;
    String serverName = "";
    String port = "";
    if (input instanceof ICubridNode) {
        cubridNode = (ICubridNode) input;
        server = cubridNode.getServer();
        if (null != server) {
            serverName = server.getLabel();
            port = server.getMonPort();
        }
    }
    if (input != null) {
        if (title == null) {
            if (null == server) {
                setPartName(input.getName());
            } else {
                setPartName(input.getName() + "@" + serverName + ":" + port);
            }
        } else {
            if (null == server) {
                setPartName(title + " - " + input.getName());
            } else {
                setPartName(title + " - " + input.getName() + "@" + serverName + ":" + port);
            }
        }
    }
    CubridNodeManager.getInstance().addCubridNodeChangeListener(this);
}
Also used : ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode) CubridServer(com.cubrid.common.ui.spi.model.CubridServer)

Aggregations

ICubridNode (com.cubrid.common.ui.spi.model.ICubridNode)362 CubridDatabase (com.cubrid.common.ui.spi.model.CubridDatabase)67 ArrayList (java.util.ArrayList)67 DefaultSchemaNode (com.cubrid.common.ui.spi.model.DefaultSchemaNode)62 TreeViewer (org.eclipse.jface.viewers.TreeViewer)62 CubridNodeChangedEvent (com.cubrid.common.ui.spi.event.CubridNodeChangedEvent)55 ISchemaNode (com.cubrid.common.ui.spi.model.ISchemaNode)55 CubridServer (com.cubrid.common.ui.spi.model.CubridServer)41 ServerInfo (com.cubrid.cubridmanager.core.common.model.ServerInfo)40 ServerUserInfo (com.cubrid.cubridmanager.core.common.model.ServerUserInfo)33 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)32 DatabaseInfo (com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo)31 ICubridNodeLoader (com.cubrid.common.ui.spi.model.ICubridNodeLoader)27 ExecTaskWithProgress (com.cubrid.common.ui.spi.progress.ExecTaskWithProgress)26 CubridGroupNode (com.cubrid.common.ui.spi.model.CubridGroupNode)25 DefaultCubridNode (com.cubrid.common.ui.spi.model.DefaultCubridNode)25 TaskExecutor (com.cubrid.common.ui.spi.progress.TaskExecutor)25 ISelectionProvider (org.eclipse.jface.viewers.ISelectionProvider)25 CommonTaskExec (com.cubrid.common.ui.spi.progress.CommonTaskExec)23 CubridNavigatorView (com.cubrid.common.ui.common.navigator.CubridNavigatorView)22