use of com.cubrid.common.ui.spi.model.ICubridNode in project cubrid-manager by CUBRID.
the class ExecuteSqlLogAction method isSupported.
/**
* @see com.cubrid.common.ui.spi.action.ISelectionAction#isSupported(java
* .lang.Object)
* @param obj Object
* @return boolean
*/
public boolean isSupported(Object obj) {
if (obj instanceof ICubridNode) {
ICubridNode node = (ICubridNode) obj;
if (node.getServer() == null) {
return false;
}
ServerUserInfo serverUserInfo = node.getServer().getServerInfo().getLoginedUserInfo();
if (serverUserInfo == null || serverUserInfo.getCasAuth() != CasAuthType.AUTH_ADMIN) {
return false;
}
if (CubridNodeType.BROKER_SQL_LOG.equals(node.getType())) {
return true;
}
}
return false;
}
use of com.cubrid.common.ui.spi.model.ICubridNode in project cubrid-manager by CUBRID.
the class DeleteMonitorDashboardAction method run.
/**
* Delete the selected monitoring dash board
*/
public void run() {
Object[] objArr = this.getSelectedObj();
if (objArr == null || objArr.length <= 0) {
setEnabled(false);
return;
}
StringBuffer dashboardNames = new StringBuffer();
for (int i = 0; objArr != null && i < objArr.length; i++) {
if (!isSupported(objArr[i])) {
setEnabled(false);
return;
}
ICubridNode node = (ICubridNode) objArr[i];
dashboardNames.append(node.getLabel());
if (i != objArr.length - 1) {
dashboardNames.append(",");
}
}
boolean isDelete = CommonUITool.openConfirmBox(getShell(), Messages.bind(Messages.msgConfirmDeleteDashboard, dashboardNames.toString()));
if (!isDelete) {
return;
}
ISelectionProvider provider = this.getSelectionProvider();
if (provider instanceof TreeViewer) {
TreeViewer viewer = (TreeViewer) provider;
for (int i = 0; i < objArr.length; i++) {
ICubridNode node = (ICubridNode) objArr[i];
LayoutUtil.closeEditorAndView(node);
MonitorDashboardPersistManager.getInstance().removeMonitorDashboard(node);
CubridNodeManager.getInstance().fireCubridNodeChanged(new CubridNodeChangedEvent(node, CubridNodeChangedEventType.NODE_REMOVE));
}
/*TOOLS-3666 Refresh the input of TreeViewer*/
viewer.setInput(CubridMonitorNavigatorView.getTreeViewerInput());
}
}
use of com.cubrid.common.ui.spi.model.ICubridNode in project cubrid-manager by CUBRID.
the class RemoveAllScriptLogAction method isSupported.
/**
* @see com.cubrid.common.ui.spi.action.ISelectionAction#isSupported(java
* .lang.Object)
* @param obj Object
* @return boolean(whether to support)
*/
public boolean isSupported(Object obj) {
if (obj instanceof ICubridNode) {
ICubridNode node = (ICubridNode) obj;
if (node.getServer() == null) {
return false;
}
ServerUserInfo serverUserInfo = node.getServer().getServerInfo().getLoginedUserInfo();
if (serverUserInfo == null || serverUserInfo.getCasAuth() != CasAuthType.AUTH_ADMIN) {
return false;
}
if (CubridNodeType.BROKER_SQL_LOG_FOLDER.equals(node.getType())) {
return true;
}
}
return false;
}
use of com.cubrid.common.ui.spi.model.ICubridNode in project cubrid-manager by CUBRID.
the class RemoveLogAction method isSupported.
/**
* @see com.cubrid.common.ui.spi.action.ISelectionAction#isSupported(java
* .lang.Object)
* @param obj Object
* @return boolean(whether to support)
*/
public boolean isSupported(Object obj) {
if (obj instanceof Object[]) {
return true;
}
if (!(obj instanceof ICubridNode)) {
return false;
}
ICubridNode node = (ICubridNode) obj;
if (node.getServer() == null) {
return false;
}
ServerUserInfo serverUserInfo = node.getServer().getServerInfo().getLoginedUserInfo();
String type = node.getType();
if (CubridNodeType.BROKER_SQL_LOG.equals(type)) {
if (serverUserInfo == null || serverUserInfo.getCasAuth() != CasAuthType.AUTH_ADMIN) {
return false;
}
return true;
} else if (CubridNodeType.LOGS_BROKER_ACCESS_LOG.equals(type) || CubridNodeType.LOGS_BROKER_ERROR_LOG.equals(type) || CubridNodeType.LOGS_SERVER_DATABASE_LOG.equals(type)) {
if (serverUserInfo == null || !serverUserInfo.isAdmin()) {
return false;
}
if (CubridNodeType.LOGS_SERVER_DATABASE_LOG.equals(type) && isLastDbServerLog(node)) {
return false;
}
return true;
}
return false;
}
use of com.cubrid.common.ui.spi.model.ICubridNode in project cubrid-manager by CUBRID.
the class TimeSetAction method run.
/**
* Open dialog
*/
public void run() {
TimeSetDialog timeSetDialog = new TimeSetDialog(getShell());
timeSetDialog.create();
timeSetDialog.getShell().setSize(580, 275);
if (timeSetDialog.open() == Dialog.OK) {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window == null) {
return;
}
Object[] obj = this.getSelectedObj();
if (!isSupported(obj[0])) {
setEnabled(false);
return;
}
ICubridNode node = (ICubridNode) obj[0];
LogInfo logInfo = (LogInfo) node.getAdapter(LogInfo.class);
GetLogListTask task = new GetLogListTask(node.getServer().getServerInfo());
task.setPath(logInfo.getPath());
task.setStart("1");
task.setEnd("100");
TaskExecutor taskExcutor = new CommonTaskExec(Messages.loadLogTaskName);
taskExcutor.addTask(task);
new ExecTaskWithProgress(taskExcutor).exec();
if (!taskExcutor.isSuccess()) {
return;
}
LogContentInfo logContentInfo = (LogContentInfo) task.getLogContent();
IEditorPart editor;
try {
editor = window.getActivePage().openEditor(node, LogEditorPart.ID);
((LogEditorPart) editor).setTableInfo(logContentInfo, true);
} catch (PartInitException e) {
LOGGER.error(e.getMessage(), e);
}
}
}
Aggregations