use of com.cubrid.common.ui.spi.model.CubridServer in project cubrid-manager by CUBRID.
the class UnifyHostConfigAction method run.
/**
* Open unify host config dialog
*/
public void run() {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window == null) {
return;
}
CubridServer[] cubridServers = handleSelectionObj(this.getSelectedObj());
if (cubridServers == null || cubridServers.length == 0) {
CommonUITool.openWarningBox(Messages.errNoLoginedServerToEditConfig);
return;
}
UnifyHostConfigDialog dialog = new UnifyHostConfigDialog(getShell(), cubridServers);
if (dialog.open() == IDialogConstants.OK_ID) {
try {
window.getActivePage().openEditor(dialog.getEditorInput(), UnifyHostConfigEditor.ID);
} catch (PartInitException ex) {
LOGGER.error(ex.getMessage());
}
}
}
use of com.cubrid.common.ui.spi.model.CubridServer in project cubrid-manager by CUBRID.
the class DisConnectHostAction method doRun.
public void doRun(Object[] objArr) {
if (CubridNavigatorView.findNavigationView() == null) {
LOGGER.error("CubridNavigatorView.findNavigationView() is null.");
return;
}
ISelectionProvider provider = CubridNavigatorView.findNavigationView().getViewer();
if (!(provider instanceof TreeViewer)) {
return;
}
List<CubridServer> connectedServers = new ArrayList<CubridServer>();
StringBuffer hostNames = new StringBuffer();
for (int i = 0; objArr != null && i < objArr.length; i++) {
if (!isSupported(objArr[i])) {
setEnabled(false);
continue;
}
ICubridNode node = (ICubridNode) objArr[i];
if (node instanceof CubridServer) {
connectedServers.add((CubridServer) node);
hostNames.append(node.getLabel());
if (i != objArr.length - 1) {
hostNames.append(",");
}
}
}
String msg = Messages.bind(Messages.msgConfirmDisconnectHost, hostNames.toString());
boolean isDisconnectHost = CommonUITool.openConfirmBox(getShell(), msg);
if (!isDisconnectHost) {
return;
}
for (CubridServer server : connectedServers) {
boolean isContinue = HostUtils.processHostDisconnected(server);
if (isContinue) {
TreeViewer viewer = (TreeViewer) provider;
viewer.refresh(server, true);
viewer.setSelection(null, true);
viewer.setSelection(new StructuredSelection(server), true);
ActionManager.getInstance().fireSelectionChanged(getSelection());
LayoutManager.getInstance().fireSelectionChanged(getSelection());
CubridNodeManager.getInstance().fireCubridNodeChanged(new CubridNodeChangedEvent(server, CubridNodeChangedEventType.SERVER_DISCONNECTED));
}
}
}
use of com.cubrid.common.ui.spi.model.CubridServer in project cubrid-manager by CUBRID.
the class EditCmConfigAction 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;
}
use of com.cubrid.common.ui.spi.model.CubridServer in project cubrid-manager by CUBRID.
the class EditCmConfigAction method run.
/**
* Open the edit cm property editor
*/
public void run() {
final Object[] obj = this.getSelectedObj();
if (obj == null || obj.length <= 0) {
setEnabled(false);
return;
}
CubridServer server = (CubridServer) getSelectedObj()[0];
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window == null) {
return;
}
ConfEditInput editorInput = new ConfEditInput();
String id = ConfigType.CUBRID_MANAGER.getValue() + "&" + server.getId();
editorInput.setId(id);
editorInput.setServerInfo(server.getServerInfo());
editorInput.setName(server.getName());
editorInput.setServerName(server.getServerName());
editorInput.setServerPort(server.getMonPort());
String[] tipMsg = new String[] { ConfigType.CUBRID_MANAGER.getValue(), server.getName(), server.getServerName(), server.getMonPort() };
String toolTipText = Messages.bind(Messages.msgEditorTooltip, tipMsg);
editorInput.setToolTipText(toolTipText);
try {
window.getActivePage().openEditor(editorInput, EditCmConfigEditor.ID);
} catch (PartInitException ex) {
LOGGER.error(ex.getMessage());
}
}
use of com.cubrid.common.ui.spi.model.CubridServer in project cubrid-manager by CUBRID.
the class EditCubridConfigAction method run.
/**
* Open the edit cubrid property editor
*/
public void run() {
final Object[] obj = this.getSelectedObj();
if (obj == null || obj.length <= 0) {
setEnabled(false);
return;
}
CubridServer server = (CubridServer) getSelectedObj()[0];
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window == null) {
return;
}
ConfEditInput editorInput = new ConfEditInput();
String id = ConfigType.CUBRID.getValue() + "&" + server.getId();
editorInput.setId(id);
editorInput.setServerInfo(server.getServerInfo());
editorInput.setName(server.getName());
editorInput.setServerName(server.getServerName());
editorInput.setServerPort(server.getMonPort());
String[] tipMsg = new String[] { ConfigType.CUBRID.getValue(), server.getName(), server.getServerName(), server.getMonPort() };
String toolTipText = Messages.bind(Messages.msgEditorTooltip, tipMsg);
editorInput.setToolTipText(toolTipText);
try {
window.getActivePage().openEditor(editorInput, EditCubridConfigEditor.ID);
} catch (PartInitException ex) {
LOGGER.error(ex.getMessage());
}
}
Aggregations