Search in sources :

Example 1 with HAPropertyPage

use of com.cubrid.cubridmanager.ui.common.control.HAPropertyPage in project cubrid-manager by CUBRID.

the class PreferenceUtil method createPropertyDialog.

/**
	 * Create property dialog related with CUBRID node
	 *
	 * @param parentShell the parent shell
	 * @param node the ICubridNode object
	 * @return the Dialog object
	 */
public static Dialog createPropertyDialog(Shell parentShell, ICubridNode node) {
    PreferenceManager mgr = new PreferenceManager();
    String type = node.getType();
    ServerType serverType = node.getServer().getServerInfo().getServerType();
    if (CubridNodeType.SERVER.equals(type)) {
        // cubrid manager server property
        ServerConfigPropertyPage cmServerPropertyPage = new ServerConfigPropertyPage(node, Messages.msgCmServerPropertyPageName);
        PreferenceNode cmServerNode = new PreferenceNode(Messages.msgCmServerPropertyPageName);
        cmServerNode.setPage(cmServerPropertyPage);
        mgr.addToRoot(cmServerNode);
        PreferenceNode categoryNode = createCategoryNode(Messages.msgConfigureParameterPageName, Messages.msgConfigureParameterPageName, Messages.msgDetailConfigureParameter);
        mgr.addToRoot(categoryNode);
        if (serverType == ServerType.BOTH || serverType == ServerType.DATABASE) {
            // service node
            ServicePropertyPage servicePorpertyPage = new ServicePropertyPage(node, Messages.msgServicePropertyPageName);
            PreferenceNode serviceNode = new PreferenceNode(Messages.msgServicePropertyPageName);
            serviceNode.setPage(servicePorpertyPage);
            categoryNode.add(serviceNode);
            // database server node
            DatabaseConfigPropertyPage databaseServerPorpertyPage = new DatabaseConfigPropertyPage(node, Messages.msgDatabaseServerCommonPropertyPageName, true);
            PreferenceNode databaseServerNode = new PreferenceNode(Messages.msgDatabaseServerCommonPropertyPageName);
            databaseServerNode.setPage(databaseServerPorpertyPage);
            categoryNode.add(databaseServerNode);
            // HA configuraiton
            if (CompatibleUtil.isSupportNewHAConfFile(node.getServer().getServerInfo())) {
                HAPropertyPage haPropertyPage = new HAPropertyPage(node, Messages.msgHAPropertyPageName);
                PreferenceNode haNode = new PreferenceNode(Messages.msgHAPropertyPageName);
                haNode.setPage(haPropertyPage);
                categoryNode.add(haNode);
            }
        }
        if (serverType == ServerType.BOTH || serverType == ServerType.BROKER) {
            // brokers node
            BrokersParameterPropertyPage brokersParameterPorpertyPage = new BrokersParameterPropertyPage(node, Messages.msgBrokerPropertyPageName);
            PreferenceNode brokersParameterNode = new PreferenceNode(Messages.msgBrokerPropertyPageName);
            brokersParameterNode.setPage(brokersParameterPorpertyPage);
            categoryNode.add(brokersParameterNode);
        }
        // mananger node
        ManagerServerPropertyPage managerPorpertyPage = new ManagerServerPropertyPage(node, Messages.msgManagerPropertyPageName);
        PreferenceNode managerNode = new PreferenceNode(Messages.msgManagerPropertyPageName);
        managerNode.setPage(managerPorpertyPage);
        categoryNode.add(managerNode);
        // query editor node
        if (serverType == ServerType.BOTH || serverType == ServerType.DATABASE) {
            CubridServer server = node.getServer();
            QueryOptionPreferencePage queryEditorPage = new QueryOptionPreferencePage(server);
            PreferenceNode queryEditorNode = new PreferenceNode(Messages.msgQueryPropertyPageName);
            queryEditorNode.setPage(queryEditorPage);
            mgr.addToRoot(queryEditorNode);
        }
    } else if (CubridNodeType.DATABASE_FOLDER.equals(type)) {
        // database server node
        DatabaseConfigPropertyPage databaseServerPorpertyPage = new DatabaseConfigPropertyPage(node, Messages.msgDatabaseServerCommonPropertyPageName, true);
        PreferenceNode databaseServerNode = new PreferenceNode(Messages.msgDatabaseServerCommonPropertyPageName);
        databaseServerNode.setPage(databaseServerPorpertyPage);
        mgr.addToRoot(databaseServerNode);
    } else if (CubridNodeType.DATABASE.equals(type)) {
        // database parameter
        DatabaseConfigPropertyPage databaseParameterPorpertyPage = new DatabaseConfigPropertyPage(node, Messages.msgDatabaseServerPropertyPageName, false);
        PreferenceNode databaseParameterNode = new PreferenceNode(Messages.msgDatabaseServerPropertyPageName);
        databaseParameterNode.setPage(databaseParameterPorpertyPage);
        // database query
        CubridDatabase database = (CubridDatabase) node;
        DatabaseConnectionPropertyPage page = new DatabaseConnectionPropertyPage(database, Messages.msgQueryPropertyPageName);
        PreferenceNode queryNode = new PreferenceNode(Messages.msgQueryPropertyPageName);
        queryNode.setPage(page);
        mgr.addToRoot(queryNode);
        mgr.addToRoot(databaseParameterNode);
    } else if (CubridNodeType.BROKER_FOLDER.equals(type)) {
        // brokers node
        BrokersParameterPropertyPage brokersParameterPorpertyPage = new BrokersParameterPropertyPage(node, Messages.msgBrokerPropertyPageName);
        PreferenceNode brokersParameterNode = new PreferenceNode(Messages.msgBrokerPropertyPageName);
        brokersParameterNode.setPage(brokersParameterPorpertyPage);
        mgr.addToRoot(brokersParameterNode);
    }
    if (CubridNodeType.BROKER.equals(type)) {
        BrokerParameterPropertyPage brokerParameterPorpertyPage = new BrokerParameterPropertyPage(node, node.getLabel());
        PreferenceNode brokerParameterNode = new PreferenceNode(node.getLabel());
        brokerParameterNode.setPage(brokerParameterPorpertyPage);
        mgr.addToRoot(brokerParameterNode);
    } else if (CubridNodeType.SHARD_FOLDER.equals(type)) {
        ShardsParameterPropertyPage shardsParameterPorpertyPage = new ShardsParameterPropertyPage(node, node.getName());
        PreferenceNode shardsParameterNode = new PreferenceNode(Messages.msgShardsFolderName);
        shardsParameterNode.setPage(shardsParameterPorpertyPage);
        mgr.addToRoot(shardsParameterNode);
    } else if (CubridNodeType.SHARD.equals(type)) {
        ShardParameterPropertyPage shardParameterPorpertyPage = new ShardParameterPropertyPage(node, node.getName());
        PreferenceNode shardParameterNode = new PreferenceNode(node.getName());
        shardParameterNode.setPage(shardParameterPorpertyPage);
        mgr.addToRoot(shardParameterNode);
    }
    CMPreferenceDialog dlg = new CMPreferenceDialog(parentShell, mgr, Messages.titlePropertiesDialog);
    dlg.setPreferenceStore(CubridManagerUIPlugin.getDefault().getPreferenceStore());
    return dlg;
}
Also used : ServerType(com.cubrid.cubridmanager.core.common.model.ServerType) ShardParameterPropertyPage(com.cubrid.cubridmanager.ui.shard.control.ShardParameterPropertyPage) BrokerParameterPropertyPage(com.cubrid.cubridmanager.ui.broker.control.BrokerParameterPropertyPage) PreferenceNode(org.eclipse.jface.preference.PreferenceNode) BrokersParameterPropertyPage(com.cubrid.cubridmanager.ui.broker.control.BrokersParameterPropertyPage) ShardsParameterPropertyPage(com.cubrid.cubridmanager.ui.shard.control.ShardsParameterPropertyPage) DatabaseConnectionPropertyPage(com.cubrid.cubridmanager.ui.cubrid.database.control.DatabaseConnectionPropertyPage) QueryOptionPreferencePage(com.cubrid.common.ui.query.preference.QueryOptionPreferencePage) CubridServer(com.cubrid.common.ui.spi.model.CubridServer) PreferenceManager(org.eclipse.jface.preference.PreferenceManager) CMPreferenceDialog(com.cubrid.common.ui.spi.dialog.CMPreferenceDialog) ServerConfigPropertyPage(com.cubrid.cubridmanager.ui.common.control.ServerConfigPropertyPage) ManagerServerPropertyPage(com.cubrid.cubridmanager.ui.common.control.ManagerServerPropertyPage) DatabaseConfigPropertyPage(com.cubrid.cubridmanager.ui.common.control.DatabaseConfigPropertyPage) HAPropertyPage(com.cubrid.cubridmanager.ui.common.control.HAPropertyPage) CubridDatabase(com.cubrid.common.ui.spi.model.CubridDatabase) ServicePropertyPage(com.cubrid.cubridmanager.ui.common.control.ServicePropertyPage)

Aggregations

QueryOptionPreferencePage (com.cubrid.common.ui.query.preference.QueryOptionPreferencePage)1 CMPreferenceDialog (com.cubrid.common.ui.spi.dialog.CMPreferenceDialog)1 CubridDatabase (com.cubrid.common.ui.spi.model.CubridDatabase)1 CubridServer (com.cubrid.common.ui.spi.model.CubridServer)1 ServerType (com.cubrid.cubridmanager.core.common.model.ServerType)1 BrokerParameterPropertyPage (com.cubrid.cubridmanager.ui.broker.control.BrokerParameterPropertyPage)1 BrokersParameterPropertyPage (com.cubrid.cubridmanager.ui.broker.control.BrokersParameterPropertyPage)1 DatabaseConfigPropertyPage (com.cubrid.cubridmanager.ui.common.control.DatabaseConfigPropertyPage)1 HAPropertyPage (com.cubrid.cubridmanager.ui.common.control.HAPropertyPage)1 ManagerServerPropertyPage (com.cubrid.cubridmanager.ui.common.control.ManagerServerPropertyPage)1 ServerConfigPropertyPage (com.cubrid.cubridmanager.ui.common.control.ServerConfigPropertyPage)1 ServicePropertyPage (com.cubrid.cubridmanager.ui.common.control.ServicePropertyPage)1 DatabaseConnectionPropertyPage (com.cubrid.cubridmanager.ui.cubrid.database.control.DatabaseConnectionPropertyPage)1 ShardParameterPropertyPage (com.cubrid.cubridmanager.ui.shard.control.ShardParameterPropertyPage)1 ShardsParameterPropertyPage (com.cubrid.cubridmanager.ui.shard.control.ShardsParameterPropertyPage)1 PreferenceManager (org.eclipse.jface.preference.PreferenceManager)1 PreferenceNode (org.eclipse.jface.preference.PreferenceNode)1