use of com.cubrid.common.ui.spi.model.ICubridNode in project cubrid-manager by CUBRID.
the class PropertyAction method run.
/**
* Open property dialog,view and set property
*/
public void run() {
final Object[] obj = this.getSelectedObj();
if (!isSupported(obj[0])) {
return;
}
final ICubridNode node = (ICubridNode) obj[0];
String type = node.getType();
if (CubridNodeType.SERVER.equals(type) || CubridNodeType.DATABASE_FOLDER.equals(type) || CubridNodeType.DATABASE.equals(type) || CubridNodeType.BROKER_FOLDER.equals(type) || CubridNodeType.BROKER.equals(type)) {
TaskExecutor taskExcutor = new GetPropertyExecutor(node, getShell());
ServerInfo serverInfo = node.getServer().getServerInfo();
GetCubridConfParameterTask getCubridConfParameterTask = new GetCubridConfParameterTask(serverInfo);
GetBrokerConfParameterTask getBrokerConfParameterTask = new GetBrokerConfParameterTask(serverInfo);
GetCMConfParameterTask getCMConfParameterTask = new GetCMConfParameterTask(serverInfo);
if (CubridNodeType.SERVER.equals(type)) {
taskExcutor.addTask(getCubridConfParameterTask);
taskExcutor.addTask(getBrokerConfParameterTask);
taskExcutor.addTask(getCMConfParameterTask);
if (CompatibleUtil.isSupportNewHAConfFile(serverInfo)) {
GetHAConfParameterTask getHAConfParameterTask = new GetHAConfParameterTask(serverInfo);
taskExcutor.addTask(getHAConfParameterTask);
}
}
if (CubridNodeType.DATABASE_FOLDER.equals(type) || CubridNodeType.DATABASE.equals(type)) {
taskExcutor.addTask(getCubridConfParameterTask);
}
if (CubridNodeType.BROKER_FOLDER.equals(type) || CubridNodeType.BROKER.equals(type)) {
taskExcutor.addTask(getBrokerConfParameterTask);
}
new ExecTaskWithProgress(taskExcutor).busyCursorWhile();
}
if (!isCancel) {
Dialog dialog = PreferenceUtil.createPropertyDialog(getShell(), node);
dialog.open();
}
}
use of com.cubrid.common.ui.spi.model.ICubridNode in project cubrid-manager by CUBRID.
the class PropertyAction 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 ICubridNode) {
ICubridNode node = (ICubridNode) obj;
CubridServer server = node.getServer();
if (server == null || !server.isConnected()) {
return false;
}
ServerUserInfo userInfo = server.getServerInfo().getLoginedUserInfo();
String type = node.getType();
if (CubridNodeType.SERVER.equals(type) || CubridNodeType.DATABASE_FOLDER.equals(type) || CubridNodeType.DATABASE.equals(type)) {
return true;
} else if (CubridNodeType.BROKER_FOLDER.equals(type) || CubridNodeType.BROKER.equals(type) || CubridNodeType.SHARD_FOLDER.equals(type) || CubridNodeType.SHARD.equals(type)) {
return userInfo != null && (CasAuthType.AUTH_ADMIN == userInfo.getCasAuth() || CasAuthType.AUTH_MONITOR == userInfo.getCasAuth());
}
}
return false;
}
use of com.cubrid.common.ui.spi.model.ICubridNode in project cubrid-manager by CUBRID.
the class QueryNewAction method getSelectedSever.
/**
* Get current selected server
*
* @return CubridServer
*/
private CubridServer getSelectedSever() {
Object[] selected = getSelectedObj();
CubridServer server = null;
if (selected != null && selected.length >= 1) {
if (selected[0] instanceof ISchemaNode) {
server = ((ISchemaNode) selected[0]).getServer();
} else if (selected[0] instanceof ICubridNode) {
server = ((ICubridNode) selected[0]).getServer();
}
}
return server;
}
use of com.cubrid.common.ui.spi.model.ICubridNode in project cubrid-manager by CUBRID.
the class UserManagementAction 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 ICubridNode) {
ICubridNode node = (ICubridNode) obj;
CubridServer server = node.getServer();
if (server != null && server.isConnected() && server.getServerInfo() != null && server.getServerInfo().getLoginedUserInfo() != null && server.getServerInfo().getLoginedUserInfo().isAdmin()) {
return true;
}
}
return false;
}
use of com.cubrid.common.ui.spi.model.ICubridNode in project cubrid-manager by CUBRID.
the class HiddenElementAction method run.
/**
* Hidden the elements
*/
public void run() {
Object[] objArr = this.getSelectedObj();
if (!isSupported(objArr)) {
setEnabled(false);
return;
}
ISelectionProvider provider = this.getSelectionProvider();
if (!(provider instanceof TreeViewer)) {
return;
}
List<String> idGrayList = new ArrayList<String>();
List<String> idList = new ArrayList<String>();
for (Object obj : objArr) {
if (obj instanceof ICubridNode) {
ICubridNode node = (ICubridNode) obj;
idList.add(node.getId());
addParentToGrayFilter(idGrayList, node.getParent());
}
}
NodeFilterManager.getInstance().addIdFilterList(idList);
NodeFilterManager.getInstance().addIdGrayFilterList(idGrayList);
TreeViewer viewer = (TreeViewer) provider;
viewer.setFilters(NodeFilterManager.getInstance().getViewerFilter());
}
Aggregations