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);
}
}
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;
}
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;
}
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;
}
Aggregations