Search in sources :

Example 1 with CubridBroker

use of com.cubrid.cubridmanager.ui.spi.model.CubridBroker in project cubrid-manager by CUBRID.

the class StartRetargetAction method run.

/**
	 * start database or broker
	 */
public void run() {
    final Object[] obj = this.getSelectedObj();
    if (!isSupported(obj[0])) {
        return;
    }
    ICubridNode node = (ICubridNode) obj[0];
    if (NodeType.SERVER.equals(node.getType())) {
        StartServiceAction startServiceAction = (StartServiceAction) ActionManager.getInstance().getAction(StartServiceAction.ID);
        startServiceAction.run();
    }
    if (node instanceof ISchemaNode) {
        StartDatabaseAction startDatabaseAction = (StartDatabaseAction) ActionManager.getInstance().getAction(StartDatabaseAction.ID);
        startDatabaseAction.run();
    }
    if (node instanceof CubridBroker) {
        StartBrokerAction startBrokerAction = (StartBrokerAction) ActionManager.getInstance().getAction(StartBrokerAction.ID);
        startBrokerAction.run();
    }
    if (node instanceof CubridBrokerFolder) {
        StartBrokerEnvAction startBrokerEnvAction = (StartBrokerEnvAction) ActionManager.getInstance().getAction(StartBrokerEnvAction.ID);
        startBrokerEnvAction.run();
    }
}
Also used : StartBrokerEnvAction(com.cubrid.cubridmanager.ui.broker.action.StartBrokerEnvAction) ISchemaNode(com.cubrid.common.ui.spi.model.ISchemaNode) StartBrokerAction(com.cubrid.cubridmanager.ui.broker.action.StartBrokerAction) CubridBroker(com.cubrid.cubridmanager.ui.spi.model.CubridBroker) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode) StartDatabaseAction(com.cubrid.cubridmanager.ui.cubrid.database.action.StartDatabaseAction) CubridBrokerFolder(com.cubrid.cubridmanager.ui.spi.model.CubridBrokerFolder)

Example 2 with CubridBroker

use of com.cubrid.cubridmanager.ui.spi.model.CubridBroker in project cubrid-manager by CUBRID.

the class StopRetargetAction method run.

/**
	 * stop database or broker
	 */
public void run() {
    final Object[] obj = this.getSelectedObj();
    if (!isSupported(obj[0])) {
        return;
    }
    ICubridNode node = (ICubridNode) obj[0];
    if (NodeType.SERVER.equals(node.getType())) {
        StopServiceAction stopServiceAction = (StopServiceAction) ActionManager.getInstance().getAction(StopServiceAction.ID);
        stopServiceAction.run();
    }
    if (node instanceof ISchemaNode) {
        StopDatabaseAction stopDatabaseAction = (StopDatabaseAction) ActionManager.getInstance().getAction(StopDatabaseAction.ID);
        stopDatabaseAction.run();
    }
    if (node instanceof CubridBroker) {
        StopBrokerAction stopBrokerAction = (StopBrokerAction) ActionManager.getInstance().getAction(StopBrokerAction.ID);
        stopBrokerAction.run();
    }
    if (node instanceof CubridBrokerFolder) {
        StopBrokerEnvAction stopBrokerEnvAction = (StopBrokerEnvAction) ActionManager.getInstance().getAction(StopBrokerEnvAction.ID);
        stopBrokerEnvAction.run();
    }
}
Also used : StopBrokerEnvAction(com.cubrid.cubridmanager.ui.broker.action.StopBrokerEnvAction) ISchemaNode(com.cubrid.common.ui.spi.model.ISchemaNode) StopDatabaseAction(com.cubrid.cubridmanager.ui.cubrid.database.action.StopDatabaseAction) CubridBroker(com.cubrid.cubridmanager.ui.spi.model.CubridBroker) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode) CubridBrokerFolder(com.cubrid.cubridmanager.ui.spi.model.CubridBrokerFolder) StopBrokerAction(com.cubrid.cubridmanager.ui.broker.action.StopBrokerAction)

Example 3 with CubridBroker

use of com.cubrid.cubridmanager.ui.spi.model.CubridBroker in project cubrid-manager by CUBRID.

the class RestartBrokerAction method isSupportedNode.

public static boolean isSupportedNode(Object obj) {
    if (obj instanceof CubridBroker) {
        CubridBroker selection = ((CubridBroker) obj);
        if (selection.getServer() == null || selection.getServer().getServerInfo() == null) {
            return false;
        }
        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 4 with CubridBroker

use of com.cubrid.cubridmanager.ui.spi.model.CubridBroker 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 5 with CubridBroker

use of com.cubrid.cubridmanager.ui.spi.model.CubridBroker in project cubrid-manager by CUBRID.

the class NavigatorTreeLabelProvider method getImage.

/* (non-Javadoc)
	 * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
	 */
public Image getImage(Object element) {
    String iconPath = "";
    if (element instanceof CubridServer) {
        CubridServer server = (CubridServer) element;
        if (server.isConnected()) {
            iconPath = server.getConnectedIconPath();
        } else {
            iconPath = server.getDisConnectedIconPath();
        }
        Image serverImage = CubridManagerUIPlugin.getImage(iconPath);
        return decorateServerImgae(serverImage, server);
    } else if (element instanceof CubridDatabase) {
        CubridDatabase database = (CubridDatabase) element;
        if (database.getRunningType() == DbRunningType.STANDALONE && database.isLogined()) {
            iconPath = database.getStopAndLoginIconPath();
        } else if (database.getRunningType() == DbRunningType.STANDALONE && !database.isLogined()) {
            iconPath = database.getStopAndLogoutIconPath();
        } else if (database.getRunningType() == DbRunningType.CS && database.isLogined()) {
            iconPath = database.getStartAndLoginIconPath();
        } else if (database.getRunningType() == DbRunningType.CS && !database.isLogined()) {
            iconPath = database.getStartAndLogoutIconPath();
        }
        Image databaseImage = CubridManagerUIPlugin.getImage(iconPath);
        return decorateDatabaseImgae(databaseImage, database);
    } else if (element instanceof CubridBrokerFolder) {
        CubridBrokerFolder brokerFolder = (CubridBrokerFolder) element;
        if (brokerFolder.isRunning()) {
            iconPath = brokerFolder.getStartedIconPath();
        } else {
            iconPath = brokerFolder.getStopedIconPath();
        }
    } else if (element instanceof CubridBroker) {
        CubridBroker broker = (CubridBroker) element;
        if (broker.isRunning()) {
            iconPath = broker.getStartedIconPath();
        } else {
            iconPath = broker.getStopedIconPath();
        }
    } else if (element instanceof CubridShardFolder) {
        // TODO shard
        CubridShardFolder shardFolder = (CubridShardFolder) element;
        // if (shardFolder.isEnable()) {
        if (shardFolder.isRunning()) {
            iconPath = shardFolder.getStartedIconPath();
        } else {
            iconPath = shardFolder.getStopedIconPath();
        }
    // } else {
    // iconPath = shardFolder.getDisableIconPath();
    // }
    } else if (element instanceof CubridShard) {
        CubridShard shard = (CubridShard) element;
        if (shard.isRunning()) {
            iconPath = shard.getStartedIconPath();
        } else {
            iconPath = shard.getStopedIconPath();
        }
    } else if (element instanceof ICubridNode) {
        ICubridNode node = (ICubridNode) element;
        iconPath = node.getIconPath();
    }
    if (iconPath != null && iconPath.length() > 0) {
        return CubridManagerUIPlugin.getImage(iconPath.trim());
    }
    return super.getImage(element);
}
Also used : CubridShard(com.cubrid.cubridmanager.ui.spi.model.CubridShard) CubridBroker(com.cubrid.cubridmanager.ui.spi.model.CubridBroker) CubridShardFolder(com.cubrid.cubridmanager.ui.spi.model.CubridShardFolder) StyledString(org.eclipse.jface.viewers.StyledString) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode) CubridServer(com.cubrid.common.ui.spi.model.CubridServer) Image(org.eclipse.swt.graphics.Image) DecoratedImage(com.cubrid.common.ui.decorator.DecoratedImage) CubridDatabase(com.cubrid.common.ui.spi.model.CubridDatabase) CubridBrokerFolder(com.cubrid.cubridmanager.ui.spi.model.CubridBrokerFolder)

Aggregations

CubridBroker (com.cubrid.cubridmanager.ui.spi.model.CubridBroker)12 ICubridNode (com.cubrid.common.ui.spi.model.ICubridNode)6 CubridBrokerFolder (com.cubrid.cubridmanager.ui.spi.model.CubridBrokerFolder)6 ServerUserInfo (com.cubrid.cubridmanager.core.common.model.ServerUserInfo)5 BrokerInfo (com.cubrid.cubridmanager.core.broker.model.BrokerInfo)4 CubridServer (com.cubrid.common.ui.spi.model.CubridServer)3 CubridDatabase (com.cubrid.common.ui.spi.model.CubridDatabase)2 ISchemaNode (com.cubrid.common.ui.spi.model.ISchemaNode)2 BrokerInfos (com.cubrid.cubridmanager.core.broker.model.BrokerInfos)2 ServerInfo (com.cubrid.cubridmanager.core.common.model.ServerInfo)2 CommonQueryTask (com.cubrid.cubridmanager.core.common.task.CommonQueryTask)2 CubridShardFolder (com.cubrid.cubridmanager.ui.spi.model.CubridShardFolder)2 DecoratedImage (com.cubrid.common.ui.decorator.DecoratedImage)1 CubridNodeChangedEvent (com.cubrid.common.ui.spi.event.CubridNodeChangedEvent)1 DatabaseEditorConfig (com.cubrid.common.ui.spi.model.DatabaseEditorConfig)1 ICubridNodeLoader (com.cubrid.common.ui.spi.model.ICubridNodeLoader)1 Shards (com.cubrid.cubridmanager.core.shard.model.Shards)1 GetShardConfTask (com.cubrid.cubridmanager.core.shard.task.GetShardConfTask)1 GetShardStatusTask (com.cubrid.cubridmanager.core.shard.task.GetShardStatusTask)1 StartBrokerAction (com.cubrid.cubridmanager.ui.broker.action.StartBrokerAction)1