use of com.cubrid.common.ui.spi.model.CubridServer in project cubrid-manager by CUBRID.
the class ConnectHostAction method doRun.
public void doRun(CubridServer[] servers) {
if (servers.length == 0) {
return;
}
if (servers.length == 1) {
CubridServer server = servers[0];
if (server.isAutoSavePassword() && CubridWorkbenchContrItem.connectHost(server.getServerInfo(), true)) {
server.getLoader().setLoaded(false);
CubridNavigatorView view = CubridNavigatorView.getNavigatorView(CubridHostNavigatorView.ID);
if (view == null) {
LOGGER.error("view is null.");
return;
}
TreeViewer treeViewer = view.getViewer();
treeViewer.refresh(server, true);
treeViewer.expandToLevel(server, 1);
ActionManager.getInstance().fireSelectionChanged(treeViewer.getSelection());
LayoutManager.getInstance().fireSelectionChanged(treeViewer.getSelection());
CubridNodeChangedEvent event = new CubridNodeChangedEvent(server, CubridNodeChangedEventType.SERVER_CONNECTED);
CubridNodeManager.getInstance().fireCubridNodeChanged(event);
} else {
EditHostAction editHostAction = (EditHostAction) ActionManager.getInstance().getAction(EditHostAction.ID);
if (editHostAction != null) {
editHostAction.doRun(servers, true);
}
}
} else {
List<FailedHostServerInfo> failedServerList = new ArrayList<FailedHostServerInfo>();
for (CubridServer object : servers) {
CubridServer server = (CubridServer) object;
String errMsg = null;
if (server.isAutoSavePassword()) {
errMsg = CubridWorkbenchContrItem.connectHostWithErrMsg(server.getServerInfo(), false);
} else {
errMsg = "Incorrect or missing password.";
}
if (errMsg == null) {
server.getLoader().setLoaded(false);
CubridNavigatorView view = CubridNavigatorView.getNavigatorView(CubridHostNavigatorView.ID);
TreeViewer treeViewer = view.getViewer();
treeViewer.refresh(server, true);
treeViewer.expandToLevel(server, 1);
ActionManager.getInstance().fireSelectionChanged(treeViewer.getSelection());
LayoutManager.getInstance().fireSelectionChanged(treeViewer.getSelection());
CubridNodeManager.getInstance().fireCubridNodeChanged(new CubridNodeChangedEvent(server, CubridNodeChangedEventType.SERVER_CONNECTED));
} else {
failedServerList.add(new FailedHostServerInfo(server, errMsg));
}
}
if (failedServerList.size() > 0) {
NewMultiHostConnectionDialog dialog = new NewMultiHostConnectionDialog(getShell(), failedServerList);
dialog.open();
}
}
}
use of com.cubrid.common.ui.spi.model.CubridServer in project cubrid-manager by CUBRID.
the class ViewServerVersionAction method run.
/**
* View the server version
*/
public void run() {
Object[] obj = this.getSelectedObj();
if (!isSupported(obj[0])) {
this.setEnabled(false);
return;
}
if (obj[0] instanceof ICubridNode) {
ICubridNode node = (ICubridNode) obj[0];
CubridServer server = node.getServer();
EnvInfo envInfo = server.getServerInfo().getEnvInfo();
CommonUITool.openInformationBox(getShell(), Messages.bind(Messages.titleServerVersion, server.getLabel()), envInfo == null ? "" : envInfo.getServerVersion());
}
}
use of com.cubrid.common.ui.spi.model.CubridServer in project cubrid-manager by CUBRID.
the class ImportExportConnectionDialog method initExportTableData.
/**
* Init export data
*/
private void initExportTableData() {
List<CubridServer> servers = CMHostNodePersistManager.getInstance().getAllServers();
for (CubridServer server : servers) {
server.setData(serverOnSelection, true);
}
hostListView.setInput(servers);
hostListView.setAllChecked(true);
}
use of com.cubrid.common.ui.spi.model.CubridServer in project cubrid-manager by CUBRID.
the class SettingHostPage method init.
/**
* Init data
*
*/
private void init() {
HAModel haModel = getConfigHAWizard().getHaModel();
masterHostText.setText(haModel.getMasterServer().getServer().getServerName());
slaveHostCombo.removeAll();
String master = haModel.getMasterServer().getServer().getServerName();
List<CubridServer> serverList = CMHostNodePersistManager.getInstance().getAllServers();
for (CubridServer server : serverList) {
if (server.isConnected() && !master.equals(server.getServerName())) {
ServerInfo serverInfo = server.getServerInfo();
if (!CompatibleUtil.isSupportNewHAConfFile(serverInfo)) {
continue;
}
ServerUserInfo userInfo = serverInfo.getLoginedUserInfo();
if (userInfo == null || CasAuthType.AUTH_ADMIN != userInfo.getCasAuth()) {
continue;
}
slaveHostCombo.add(server.getName());
}
}
initMasterDBList();
}
use of com.cubrid.common.ui.spi.model.CubridServer in project cubrid-manager by CUBRID.
the class ImportCmConfigAction method isSupported.
/**
*
* Return whether this action support this object,if not support,this action
* will be disabled
*
* @param obj the Object
* @return <code>true</code> if support this obj;<code>false</code>
* otherwise
*/
public boolean isSupported(Object obj) {
if (obj instanceof CubridServer) {
CubridServer server = (CubridServer) obj;
ServerUserInfo userInfo = server.getServerInfo().getLoginedUserInfo();
if (userInfo == null || CasAuthType.AUTH_ADMIN != userInfo.getCasAuth()) {
return false;
}
return true;
}
return false;
}
Aggregations