use of com.cubrid.cubridmanager.ui.spi.model.CubridBrokerFolder in project cubrid-manager by CUBRID.
the class StartBrokerEnvAction method run.
/**
* Override the run method in order to complete starting broker environment
*
*/
public void run() {
final Object[] obj = this.getSelectedObj();
CubridBrokerFolder selection = (CubridBrokerFolder) obj[0];
if (null == selection) {
return;
}
ServerInfo serverInfo = selection.getServer().getServerInfo();
StartBrokerEnvTask task = new StartBrokerEnvTask(serverInfo);
TaskExecutor taskExecutor = new CommonTaskExec(Messages.startBrokerEnvTaskName);
taskExecutor.addTask(task);
new ExecTaskWithProgress(taskExecutor).exec();
if (!taskExecutor.isSuccess()) {
return;
}
selection.setRunning(true);
TreeViewer treeViewer = (TreeViewer) this.getSelectionProvider();
CommonUITool.refreshNavigatorTree(treeViewer, selection);
ActionManager.getInstance().fireSelectionChanged(getSelection());
}
use of com.cubrid.cubridmanager.ui.spi.model.CubridBrokerFolder in project cubrid-manager by CUBRID.
the class StartBrokerEnvAction method isSupportedNode.
/**
* Return whether this action support this object,if not support,this action
* will be disabled
*
* @see com.cubrid.common.ui.spi.action.ISelectionAction#isSupported(java
* .lang.Object)
* @param obj the object
* @return <code>true</code> if supported;<code>false</code>
*/
public static boolean isSupportedNode(Object obj) {
if (obj instanceof CubridBrokerFolder) {
CubridBrokerFolder selection = ((CubridBrokerFolder) obj);
ServerUserInfo userInfo = selection.getServer().getServerInfo().getLoginedUserInfo();
if (userInfo == null || CasAuthType.AUTH_ADMIN != userInfo.getCasAuth()) {
return false;
}
return !selection.isRunning();
}
return false;
}
use of com.cubrid.cubridmanager.ui.spi.model.CubridBrokerFolder in project cubrid-manager by CUBRID.
the class StopBrokerAction method isSupportedNode.
/**
* Return whether this action support this object,if not support,this action
* will be disabled
*
* @see com.cubrid.common.ui.spi.action.ISelectionAction#isSupported(java
* .lang.Object)
* @param obj the object
* @return <code>true</code> if supported;<code>false</code>
*/
public static boolean isSupportedNode(Object obj) {
if (obj instanceof CubridBroker) {
CubridBroker selection = ((CubridBroker) obj);
ServerUserInfo userInfo = selection.getServer().getServerInfo().getLoginedUserInfo();
if (userInfo == null || CasAuthType.AUTH_ADMIN != userInfo.getCasAuth()) {
return false;
}
CubridBrokerFolder parent = (CubridBrokerFolder) (selection.getParent());
return parent.isRunning() && selection.isRunning();
}
return false;
}
use of com.cubrid.cubridmanager.ui.spi.model.CubridBrokerFolder in project cubrid-manager by CUBRID.
the class StopBrokerEnvAction method run.
/**
* Override the run method in order to complete stopping broker environment
*/
public void run() {
if (!CommonUITool.openConfirmBox(CONFIRM_CONTENT)) {
return;
}
final Object[] obj = this.getSelectedObj();
CubridBrokerFolder selection = (CubridBrokerFolder) obj[0];
if (null == selection) {
return;
}
ServerInfo serverInfo = selection.getServer().getServerInfo();
StopBrokerEnvTask task = new StopBrokerEnvTask(serverInfo);
TaskExecutor taskExecutor = new CommonTaskExec(Messages.stopBrokerEnvTaskName);
taskExecutor.addTask(task);
new ExecTaskWithProgress(taskExecutor).exec();
if (!taskExecutor.isSuccess()) {
return;
}
selection.setRunning(false);
TreeViewer treeViewer = (TreeViewer) this.getSelectionProvider();
CommonUITool.refreshNavigatorTree(treeViewer, selection);
ActionManager.getInstance().fireSelectionChanged(getSelection());
}
use of com.cubrid.cubridmanager.ui.spi.model.CubridBrokerFolder in project cubrid-manager by CUBRID.
the class EditBrokerConfigAction method run.
public void run() {
final Object[] obj = this.getSelectedObj();
if (obj == null || obj.length <= 0) {
setEnabled(false);
return;
}
CubridServer server = null;
if (obj[0] instanceof CubridServer) {
server = (CubridServer) obj[0];
} else if (obj[0] instanceof CubridBrokerFolder) {
server = ((CubridBrokerFolder) obj[0]).getServer();
}
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window == null || server == null) {
return;
}
ConfEditInput editorInput = new ConfEditInput();
String id = ConfigType.CUBRID_BROKER.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_BROKER.getValue(), server.getName(), server.getServerName(), server.getMonPort() };
String toolTipText = Messages.bind(Messages.msgEditorTooltip, tipMsg);
editorInput.setToolTipText(toolTipText);
try {
window.getActivePage().openEditor(editorInput, EditCMCubridBrokerConfPart.ID);
} catch (Exception ex) {
LOGGER.error("", ex);
}
}
Aggregations