use of com.cubrid.cubridmanager.ui.common.control.DatabaseConfigPropertyPage 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;
}
Aggregations