Search in sources :

Example 1 with HANodePart

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

the class GefViewerKeyHandler method keyPressed.

/**
	 * @see org.eclipse.gef.ui.parts.GraphicalViewerKeyHandler.keyPressed
	 * @param event KeyEvent
	 * @return true or false.
	 */
public boolean keyPressed(KeyEvent event) {
    GraphicalEditPart editPart = getFocusEditPart();
    if (editPart instanceof HANodePart) {
        if (moveHANodesByKey(event)) {
            return true;
        }
        if (deleteHANodeByKey(event)) {
            return true;
        }
    }
    if (editPart instanceof DashboardPart && event.keyCode == SWT.F5) {
        DashboardPart dp = (DashboardPart) editPart;
        dp.refresh();
        List<?> childEditPart = dp.getChildren();
        for (Object child : childEditPart) {
            ((EditPart) child).refresh();
        }
    }
    return super.keyPressed(event);
}
Also used : DashboardPart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.DashboardPart) GraphicalEditPart(org.eclipse.gef.GraphicalEditPart) EditPart(org.eclipse.gef.EditPart) GraphicalEditPart(org.eclipse.gef.GraphicalEditPart) HANodePart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.HANodePart)

Example 2 with HANodePart

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

the class ClearNodeErrorMsgAction method run.

/**
	 * Create a new figure in dashboard.
	 * 
	 * @see org.eclipse.jface.action.Action#run()
	 */
public void run() {
    IStructuredSelection selection = (IStructuredSelection) getSelection();
    Iterator<?> iterator = selection.iterator();
    EditPart root = null;
    while (iterator.hasNext()) {
        Object objSelected = iterator.next();
        if (objSelected instanceof HANodePart) {
            HANodePart ep = (HANodePart) objSelected;
            ((HANode) ep.getModel()).clearErrorMessages();
            root = ep.getParent();
        }
    }
    if (root != null) {
        root.refresh();
    }
}
Also used : EditPart(org.eclipse.gef.EditPart) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) HANode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.HANode) HANodePart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.HANodePart)

Example 3 with HANodePart

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

the class DashboardRefreshAction method run.

/**
	 * refresh dashboard run.
	 * 
	 * @see org.eclipse.jface.action.Action#run()
	 */
public void run() {
    Object[] objArr = this.getSelectedObj();
    if (objArr == null || objArr.length <= 0 || !isSupported(objArr[0])) {
        setEnabled(false);
        return;
    }
    DashboardPart dp = null;
    if (objArr[0] instanceof DashboardPart) {
        dp = (DashboardPart) objArr[0];
    } else {
        dp = (DashboardPart) ((EditPart) objArr[0]).getParent();
    }
    //Clear error messages
    IStructuredSelection selection = (IStructuredSelection) getSelection();
    Iterator<?> iterator = selection.iterator();
    while (iterator.hasNext()) {
        Object objSelected = iterator.next();
        if (objSelected instanceof HANodePart) {
            HANodePart ep = (HANodePart) objSelected;
            ((HANode) ep.getModel()).clearErrorMessages();
        }
    }
    dp.refresh();
    List<?> childEditPart = dp.getChildren();
    for (Object child : childEditPart) {
        ((EditPart) child).refresh();
    }
}
Also used : DashboardPart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.DashboardPart) EditPart(org.eclipse.gef.EditPart) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) HANode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.HANode) HANodePart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.HANodePart)

Example 4 with HANodePart

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

the class MinimizeFigureAction method run.

/**
	 * Create a new figure in dashboard.
	 * 
	 * @see org.eclipse.jface.action.Action#run()
	 */
public void run() {
    IStructuredSelection selection = (IStructuredSelection) getSelection();
    Iterator<?> iterator = selection.iterator();
    while (iterator.hasNext()) {
        Object objSelected = iterator.next();
        if (objSelected instanceof HANodePart) {
            HANodePart cmp = (HANodePart) objSelected;
            cmp.setMinimized(isChecked());
            cmp.refresh();
        }
    }
}
Also used : IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) HANodePart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.HANodePart)

Example 5 with HANodePart

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

the class MinimizeFigureAction 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 minimize = true;
    while (iterator.hasNext()) {
        Object objSelected = iterator.next();
        if (objSelected instanceof HANodePart) {
            HANodePart cmp = (HANodePart) objSelected;
            if (!cmp.isMinimized()) {
                minimize = false;
                break;
            }
        }
    }
    setChecked(minimize);
    return true;
}
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