Search in sources :

Example 6 with HANodePart

use of com.cubrid.cubridmanager.ui.mondashboard.editor.parts.HANodePart in project cubrid-manager by CUBRID.

the class MonitorDetailAction method run.

/**
	 * Open monitor detail windows.
	 */
public void run() {
    Object[] objArr = this.getSelectedObj();
    if (objArr == null || objArr.length <= 0 || !isSupported(objArr[0])) {
        setEnabled(false);
        return;
    }
    HANodePart part = null;
    if (objArr[0] instanceof HostMonitorPart) {
        part = (HostMonitorPart) objArr[0];
    } else if (objArr[0] instanceof DatabaseMonitorPart) {
        part = (DatabaseMonitorPart) objArr[0];
    } else if (objArr[0] instanceof BrokerMonitorPart) {
        part = (BrokerMonitorPart) objArr[0];
    }
    if (part != null) {
        SelectionRequest sr = new SelectionRequest();
        sr.setType(RequestConstants.REQ_OPEN);
        part.performRequest(sr);
    }
}
Also used : BrokerMonitorPart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.BrokerMonitorPart) SelectionRequest(org.eclipse.gef.requests.SelectionRequest) HostMonitorPart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.HostMonitorPart) DatabaseMonitorPart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.DatabaseMonitorPart) HANodePart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.HANodePart)

Example 7 with HANodePart

use of com.cubrid.cubridmanager.ui.mondashboard.editor.parts.HANodePart in project cubrid-manager by CUBRID.

the class GefViewerKeyHandler method moveHANodesByKey.

/**
	 * move figures by keyboard.
	 * 
	 * @param event KeyEvent
	 * @return if handled the event return true else return false.
	 */
private boolean moveHANodesByKey(KeyEvent event) {
    List<?> selectedEditParts = getViewer().getSelectedEditParts();
    boolean flag = false;
    for (Object obj : selectedEditParts) {
        if (!(obj instanceof HANodePart)) {
            continue;
        }
        GraphicalEditPart editPart = (GraphicalEditPart) obj;
        Command command = null;
        if ((event.stateMask & SWT.ALT) == 0 && (event.stateMask & SWT.CTRL) == 0 && (event.stateMask & SWT.SHIFT) == 0 && (event.keyCode == SWT.ARROW_DOWN || event.keyCode == SWT.ARROW_LEFT || event.keyCode == SWT.ARROW_RIGHT || event.keyCode == SWT.ARROW_UP)) {
            HANode node = (HANode) editPart.getModel();
            ChangeBoundsRequest request = new ChangeBoundsRequest(RequestConstants.REQ_MOVE);
            request.setLocation(node.getLocation());
            request.setEditParts(editPart);
            //get move delta
            Point moveDelta = null;
            switch(event.keyCode) {
                case SWT.ARROW_LEFT:
                    moveDelta = new Point(-1, 0);
                    break;
                case SWT.ARROW_RIGHT:
                    moveDelta = new Point(1, 0);
                    break;
                case SWT.ARROW_UP:
                    moveDelta = new Point(0, -1);
                    break;
                case SWT.ARROW_DOWN:
                    moveDelta = new Point(0, 1);
                    break;
                default:
                    return true;
            }
            request.setMoveDelta(moveDelta);
            command = editPart.getCommand(request);
        }
        if (command != null && !(command instanceof UnexecutableCommand)) {
            command.execute();
            flag = true;
        }
    }
    return flag;
}
Also used : ChangeBoundsRequest(org.eclipse.gef.requests.ChangeBoundsRequest) UnexecutableCommand(org.eclipse.gef.commands.UnexecutableCommand) Command(org.eclipse.gef.commands.Command) Point(org.eclipse.draw2d.geometry.Point) GraphicalEditPart(org.eclipse.gef.GraphicalEditPart) HANode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.HANode) UnexecutableCommand(org.eclipse.gef.commands.UnexecutableCommand) HANodePart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.HANodePart)

Example 8 with HANodePart

use of com.cubrid.cubridmanager.ui.mondashboard.editor.parts.HANodePart in project cubrid-manager by CUBRID.

the class DashboardLayoutEditPolicy method createChangeConstraintCommand.

/**
	 * Create command when figure's constraint change
	 * 
	 * @param child the figure's editpart
	 * @param constraint constraint of figure
	 * @return command which controls figure's size.
	 */
protected Command createChangeConstraintCommand(EditPart child, Object constraint) {
    if (child instanceof HANodePart) {
        NodeResizeCommand cmd = new NodeResizeCommand();
        cmd.setNode((HANode) child.getModel());
        cmd.setNewRect((Rectangle) constraint);
        return cmd;
    }
    return null;
}
Also used : NodeResizeCommand(com.cubrid.cubridmanager.ui.mondashboard.editor.command.NodeResizeCommand) HANodePart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.HANodePart)

Example 9 with HANodePart

use of com.cubrid.cubridmanager.ui.mondashboard.editor.parts.HANodePart in project cubrid-manager by CUBRID.

the class ClearNodeErrorMsgAction method isSupported.

/**
	 * Always support
	 * 
	 * @see com.cubrid.common.ui.spi.action.ISelectionAction#isSupported(java.lang.Object)
	 * @param obj Object
	 * @return boolean support:true;not support:false;
	 */
public boolean isSupported(Object obj) {
    IStructuredSelection selection = (IStructuredSelection) getSelection();
    Iterator<?> iterator = selection.iterator();
    boolean result = false;
    while (iterator.hasNext()) {
        Object objSelected = iterator.next();
        if (objSelected instanceof HANodePart) {
            result = true;
        }
    }
    return result;
}
Also used : IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) HANodePart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.HANodePart)

Aggregations

HANodePart (com.cubrid.cubridmanager.ui.mondashboard.editor.parts.HANodePart)9 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)5 HANode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.HANode)3 EditPart (org.eclipse.gef.EditPart)3 DashboardPart (com.cubrid.cubridmanager.ui.mondashboard.editor.parts.DashboardPart)2 GraphicalEditPart (org.eclipse.gef.GraphicalEditPart)2 NodeResizeCommand (com.cubrid.cubridmanager.ui.mondashboard.editor.command.NodeResizeCommand)1 BrokerMonitorPart (com.cubrid.cubridmanager.ui.mondashboard.editor.parts.BrokerMonitorPart)1 DatabaseMonitorPart (com.cubrid.cubridmanager.ui.mondashboard.editor.parts.DatabaseMonitorPart)1 HostMonitorPart (com.cubrid.cubridmanager.ui.mondashboard.editor.parts.HostMonitorPart)1 Point (org.eclipse.draw2d.geometry.Point)1 Command (org.eclipse.gef.commands.Command)1 UnexecutableCommand (org.eclipse.gef.commands.UnexecutableCommand)1 ChangeBoundsRequest (org.eclipse.gef.requests.ChangeBoundsRequest)1 SelectionRequest (org.eclipse.gef.requests.SelectionRequest)1