use of com.cubrid.common.ui.spi.model.CubridServer in project cubrid-manager by CUBRID.
the class ImportCmConfigAction method run.
/**
* Open the importcm property dialog
*/
public void run() {
final Object[] obj = this.getSelectedObj();
if (obj == null || obj.length <= 0) {
setEnabled(false);
return;
}
CubridServer server = (CubridServer) getSelectedObj()[0];
ImportConfigDialog dialog = new ImportConfigDialog(getShell(), ConfigType.CUBRID_MANAGER);
if (dialog.open() == Dialog.OK) {
List<String> contents = dialog.getImportFileContent();
ConfigParaHelp.performImportCmConf(server.getServerInfo(), contents);
}
}
use of com.cubrid.common.ui.spi.model.CubridServer 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);
}
}
}
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);
}
}
}
Aggregations