use of com.cubrid.common.ui.spi.model.CubridServer 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);
}
use of com.cubrid.common.ui.spi.model.CubridServer in project cubrid-manager by CUBRID.
the class LoginQueryEditDialog method buttonPressed.
/**
* @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int)
* @param buttonId the id of the button that was pressed (see
* <code>IDialogConstants.*_ID</code> constants)
*/
protected void buttonPressed(int buttonId) {
if (buttonId == IDialogConstants.OK_ID || buttonId == TEST_CONNECT_ID) {
String brokerIp = connectionComp.getBrokerIpText().getText();
CubridServer cubridServer = DatabaseNavigatorMenu.SELF_DATABASE.getServer();
ServerInfo serverInfo = new ServerInfo();
serverInfo.setServerName(DatabaseNavigatorMenu.SELF_DATABASE_ID);
serverInfo.setHostAddress(brokerIp);
cubridServer.setServerInfo(serverInfo);
String databaseName = connectionComp.getDatabaseCombo().getText();
DatabaseInfo dbInfo = new DatabaseInfo(databaseName, cubridServer.getServerInfo());
dbInfo.setBrokerIP(brokerIp);
dbInfo.setBrokerPort(connectionComp.getBrokerPortCombo().getText());
dbInfo.getServerInfo().setJdbcDriverVersion(connectionComp.getJdbcCombo().getText());
String userName = connectionComp.getUserNameText().getText();
String password = connectionComp.getPasswordText().getText();
DbUserInfo userInfo = new DbUserInfo();
userInfo.setDbName(databaseName);
userInfo.setName(userName);
userInfo.setNoEncryptPassword(password);
dbInfo.setAuthLoginedDbUserInfo(userInfo);
int currentShardId = connectionComp.getCurShardId();
dbInfo.setCurrentShardId(currentShardId);
String charset = connectionComp.getCharsetCombo().getText();
dbInfo.setCharSet(charset);
boolean isShard = connectionComp.getBtnShard().getSelection();
dbInfo.setShard(isShard);
boolean sureCharset = CommonUITool.openConfirmBox(Messages.bind(com.cubrid.cubridmanager.ui.host.Messages.msgConfirmCharset, charset));
if (!sureCharset) {
connectionComp.getCharsetCombo().setFocus();
return;
}
TaskExecutor taskExcutor = new ConnectDatabaseExecutor(dbInfo);
new ExecTaskWithProgress(taskExcutor).exec();
if (!taskExcutor.isSuccess()) {
return;
}
if (buttonId == TEST_CONNECT_ID) {
CommonUITool.openInformationBox(com.cubrid.cubridmanager.ui.common.Messages.titleSuccess, com.cubrid.cubridmanager.ui.host.Messages.msgTestConnSuccess);
return;
}
dbInfo.setLogined(true);
dbInfo.setRunningType(DbRunningType.CS);
DatabaseNavigatorMenu.SELF_DATABASE.setDatabaseInfo(dbInfo);
}
super.buttonPressed(buttonId);
}
use of com.cubrid.common.ui.spi.model.CubridServer in project cubrid-manager by CUBRID.
the class LoginQueryEditDialog method fillBrokerPortCombo.
/**
*
* Fill in the broker port combo
*
* @param serverName the server name
*/
private void fillBrokerPortCombo(String serverName) {
CubridServer cubridServer = serverMap.get(serverName);
BrokerInfos brokerInfos = cubridServer.getServerInfo().getBrokerInfos();
if (brokerInfos != null && brokerInfos.getBorkerInfoList() != null && brokerInfos.getBorkerInfoList().getBrokerInfoList() != null) {
List<BrokerInfo> brokerList = brokerInfos.getBorkerInfoList().getBrokerInfoList();
Combo brokerPortCombo = connectionComp.getBrokerPortCombo();
brokerPortCombo.removeAll();
for (int i = 0; i < brokerList.size(); i++) {
brokerPortCombo.add(brokerList.get(i).getPort());
}
if (!brokerList.isEmpty()) {
brokerPortCombo.select(0);
}
}
}
use of com.cubrid.common.ui.spi.model.CubridServer in project cubrid-manager by CUBRID.
the class LoginQueryEditDialog method initial.
/**
* initialize some values
*
*/
private void initial() {
//load the register CUBRID server and CUBRID database
List<CubridServer> servers = CMHostNodePersistManager.getInstance().getAllServers();
serverMap = new HashMap<String, CubridServer>();
databaseMap = new HashMap<String, List<CubridDatabase>>();
allHostCombo.removeAll();
for (CubridServer server : servers) {
serverMap.put(server.getName(), server);
allHostCombo.add(server.getName());
List<ICubridNode> children = server.getChildren();
for (ICubridNode child : children) {
if (!NodeType.DATABASE_FOLDER.equals(child.getType())) {
continue;
}
ICubridNode[] dbs = child.getChildren(new NullProgressMonitor());
if (dbs.length == 0) {
continue;
}
List<CubridDatabase> dbList = new ArrayList<CubridDatabase>();
for (ICubridNode database : dbs) {
if (NodeType.DATABASE.equals(database.getType())) {
CubridDatabase db = (CubridDatabase) database;
dbList.add(db);
}
}
databaseMap.put(server.getName(), dbList);
}
}
//load the self defined CUBRID server and CUBRID database
CubridServer selfDefinedServer = DatabaseNavigatorMenu.SELF_DATABASE.getServer();
if (selfDefinedServer == null) {
selfDefinedServer = new CubridServer(DatabaseNavigatorMenu.SELF_DATABASE_ID, DatabaseNavigatorMenu.SELF_DATABASE_SELECTED_LABEL, null, null);
DatabaseNavigatorMenu.SELF_DATABASE.setServer(selfDefinedServer);
}
serverMap.put(selfDefinedServer.getName(), selfDefinedServer);
allHostCombo.add(selfDefinedServer.getName());
List<CubridDatabase> dbList = new ArrayList<CubridDatabase>();
dbList.add(DatabaseNavigatorMenu.SELF_DATABASE);
databaseMap.put(selfDefinedServer.getName(), dbList);
connectionComp.init(null, this);
changeSelection();
}
use of com.cubrid.common.ui.spi.model.CubridServer in project cubrid-manager by CUBRID.
the class ServerConfigPropertyPage method initial.
/**
* initial the page content
*/
private void initial() {
CubridServer server = node.getServer();
ServerInfo serverInfo = server == null ? null : server.getServerInfo();
if (server != null && serverInfo != null) {
hostNameInfoLabel.setText(server.getLabel());
hostAddressInfoLabel.setText(server.getHostAddress());
portInfoLabel.setText(server.getMonPort());
userNameInfoLabel.setText(server.getUserName());
jdbcInfoLabel.setText(server.getJdbcDriverVersion());
ServerType serverType = serverInfo.getServerType();
String type = "server,broker";
if (serverType == ServerType.BROKER) {
type = "broker";
} else if (serverType == ServerType.DATABASE) {
type = "server";
}
serverTypeInfoLabel.setText(type);
}
}
Aggregations