Search in sources :

Example 6 with CubridBrokerFolder

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());
}
Also used : CommonTaskExec(com.cubrid.common.ui.spi.progress.CommonTaskExec) TaskExecutor(com.cubrid.common.ui.spi.progress.TaskExecutor) ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) TreeViewer(org.eclipse.jface.viewers.TreeViewer) ExecTaskWithProgress(com.cubrid.common.ui.spi.progress.ExecTaskWithProgress) StartBrokerEnvTask(com.cubrid.cubridmanager.core.broker.task.StartBrokerEnvTask) CubridBrokerFolder(com.cubrid.cubridmanager.ui.spi.model.CubridBrokerFolder)

Example 7 with CubridBrokerFolder

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;
}
Also used : ServerUserInfo(com.cubrid.cubridmanager.core.common.model.ServerUserInfo) CubridBrokerFolder(com.cubrid.cubridmanager.ui.spi.model.CubridBrokerFolder)

Example 8 with CubridBrokerFolder

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;
}
Also used : CubridBroker(com.cubrid.cubridmanager.ui.spi.model.CubridBroker) ServerUserInfo(com.cubrid.cubridmanager.core.common.model.ServerUserInfo) CubridBrokerFolder(com.cubrid.cubridmanager.ui.spi.model.CubridBrokerFolder)

Example 9 with CubridBrokerFolder

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());
}
Also used : CommonTaskExec(com.cubrid.common.ui.spi.progress.CommonTaskExec) StopBrokerEnvTask(com.cubrid.cubridmanager.core.broker.task.StopBrokerEnvTask) TaskExecutor(com.cubrid.common.ui.spi.progress.TaskExecutor) ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) TreeViewer(org.eclipse.jface.viewers.TreeViewer) ExecTaskWithProgress(com.cubrid.common.ui.spi.progress.ExecTaskWithProgress) CubridBrokerFolder(com.cubrid.cubridmanager.ui.spi.model.CubridBrokerFolder)

Example 10 with CubridBrokerFolder

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);
    }
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) CubridServer(com.cubrid.common.ui.spi.model.CubridServer) CubridBrokerFolder(com.cubrid.cubridmanager.ui.spi.model.CubridBrokerFolder)

Aggregations

CubridBrokerFolder (com.cubrid.cubridmanager.ui.spi.model.CubridBrokerFolder)16 ServerUserInfo (com.cubrid.cubridmanager.core.common.model.ServerUserInfo)8 CubridBroker (com.cubrid.cubridmanager.ui.spi.model.CubridBroker)6 ICubridNode (com.cubrid.common.ui.spi.model.ICubridNode)5 CubridServer (com.cubrid.common.ui.spi.model.CubridServer)4 ISchemaNode (com.cubrid.common.ui.spi.model.ISchemaNode)2 CommonTaskExec (com.cubrid.common.ui.spi.progress.CommonTaskExec)2 ExecTaskWithProgress (com.cubrid.common.ui.spi.progress.ExecTaskWithProgress)2 TaskExecutor (com.cubrid.common.ui.spi.progress.TaskExecutor)2 ServerInfo (com.cubrid.cubridmanager.core.common.model.ServerInfo)2 TreeViewer (org.eclipse.jface.viewers.TreeViewer)2 DecoratedImage (com.cubrid.common.ui.decorator.DecoratedImage)1 CubridNodeChangedEvent (com.cubrid.common.ui.spi.event.CubridNodeChangedEvent)1 CubridDatabase (com.cubrid.common.ui.spi.model.CubridDatabase)1 DefaultCubridNode (com.cubrid.common.ui.spi.model.DefaultCubridNode)1 ICubridNodeLoader (com.cubrid.common.ui.spi.model.ICubridNodeLoader)1 StartBrokerEnvTask (com.cubrid.cubridmanager.core.broker.task.StartBrokerEnvTask)1 StopBrokerEnvTask (com.cubrid.cubridmanager.core.broker.task.StopBrokerEnvTask)1 ServerType (com.cubrid.cubridmanager.core.common.model.ServerType)1 StartBrokerAction (com.cubrid.cubridmanager.ui.broker.action.StartBrokerAction)1