Search in sources :

Example 1 with NodePart

use of com.cubrid.cubridmanager.ui.replication.editor.parts.NodePart in project cubrid-manager by CUBRID.

the class EditAction method run.

/**
	 * @see org.eclipse.jface.action.Action#run()
	 */
public void run() {
    IWorkbenchPart workbenchPart = this.getWorkbenchPart();
    if (!(workbenchPart instanceof ReplicationEditor) || !isEnabled()) {
        return;
    }
    ReplicationEditor replEditor = (ReplicationEditor) workbenchPart;
    Shell shell = replEditor.getSite().getShell();
    NodePart nodePart = (NodePart) getSelectedObjects().get(0);
    if (nodePart.getModel() instanceof MasterNode) {
        SetMasterDbInfoWizard wizard = new SetMasterDbInfoWizard((MasterNode) nodePart.getModel());
        wizard.setEditable(replEditor.isEditable());
        CMWizardDialog dialog = new CMWizardDialog(shell, wizard);
        dialog.setPageSize(560, 300);
        dialog.open();
    } else if (nodePart.getModel() instanceof DistributorNode) {
        SetDistributorDbInfoDialog dialog = new SetDistributorDbInfoDialog(shell);
        dialog.setDistributor((DistributorNode) nodePart.getModel());
        dialog.setEditable(replEditor.isEditable());
        dialog.open();
    } else if (nodePart.getModel() instanceof SlaveNode) {
        SetSlaveDbInfoDialog dialog = new SetSlaveDbInfoDialog(shell);
        dialog.setSlave((SlaveNode) nodePart.getModel());
        dialog.setEditable(replEditor.isEditable());
        dialog.open();
    } else if (nodePart.getModel() instanceof HostNode) {
        SetHostInfoDialog dialog = new SetHostInfoDialog(shell);
        dialog.setHostInfo((HostNode) nodePart.getModel());
        dialog.setEditable(replEditor.isEditable());
        dialog.open();
    }
}
Also used : MasterNode(com.cubrid.cubridmanager.ui.replication.editor.model.MasterNode) SlaveNode(com.cubrid.cubridmanager.ui.replication.editor.model.SlaveNode) HostNode(com.cubrid.cubridmanager.ui.replication.editor.model.HostNode) SetHostInfoDialog(com.cubrid.cubridmanager.ui.replication.editor.dialog.SetHostInfoDialog) ReplicationEditor(com.cubrid.cubridmanager.ui.replication.editor.ReplicationEditor) Shell(org.eclipse.swt.widgets.Shell) IWorkbenchPart(org.eclipse.ui.IWorkbenchPart) SetDistributorDbInfoDialog(com.cubrid.cubridmanager.ui.replication.editor.dialog.SetDistributorDbInfoDialog) NodePart(com.cubrid.cubridmanager.ui.replication.editor.parts.NodePart) SetMasterDbInfoWizard(com.cubrid.cubridmanager.ui.replication.editor.dialog.wizard.SetMasterDbInfoWizard) CMWizardDialog(com.cubrid.common.ui.spi.dialog.CMWizardDialog) SetSlaveDbInfoDialog(com.cubrid.cubridmanager.ui.replication.editor.dialog.SetSlaveDbInfoDialog) DistributorNode(com.cubrid.cubridmanager.ui.replication.editor.model.DistributorNode)

Example 2 with NodePart

use of com.cubrid.cubridmanager.ui.replication.editor.parts.NodePart in project cubrid-manager by CUBRID.

the class DiagramLayoutEditPolicy method createChangeConstraintCommand.

/**
	 * @see org.eclipse.gef.editpolicies.ConstrainedLayoutEditPolicy#createChangeConstraintCommand(org.eclipse.gef.EditPart,
	 *      java.lang.Object)
	 * @param child the EditPart of the child being changed
	 * @param constraint the new constraint, after being
	 *        {@link #translateToModelConstraint(Object) translated}
	 * @return Command
	 */
protected Command createChangeConstraintCommand(EditPart child, Object constraint) {
    if (!(child instanceof NodePart)) {
        return null;
    }
    if (!(constraint instanceof Rectangle)) {
        return null;
    }
    ChangeNodeConstraintCommand cmd = new ChangeNodeConstraintCommand();
    cmd.setNode((Node) child.getModel());
    cmd.setLocation(((Rectangle) constraint).getLocation());
    cmd.setDimension(((Rectangle) constraint).getSize());
    return cmd;
}
Also used : Rectangle(org.eclipse.draw2d.geometry.Rectangle) NodePart(com.cubrid.cubridmanager.ui.replication.editor.parts.NodePart) ChangeNodeConstraintCommand(com.cubrid.cubridmanager.ui.replication.editor.commands.ChangeNodeConstraintCommand)

Example 3 with NodePart

use of com.cubrid.cubridmanager.ui.replication.editor.parts.NodePart in project cubrid-manager by CUBRID.

the class ContainerNodeLayoutEditPolicy method createChangeConstraintCommand.

/**
	 * @see org.eclipse.gef.editpolicies.ConstrainedLayoutEditPolicy#createChangeConstraintCommand(org.eclipse.gef.EditPart,
	 *      java.lang.Object)
	 * @param child the EditPart of the child being changed
	 * @param constraint the new constraint, after being
	 *        {@link #translateToModelConstraint(Object) translated}
	 * @return Command
	 */
protected Command createChangeConstraintCommand(EditPart child, Object constraint) {
    if (!(child instanceof NodePart)) {
        return null;
    }
    if (!(constraint instanceof Rectangle)) {
        return null;
    }
    ChangeNodeConstraintCommand cmd = new ChangeNodeConstraintCommand();
    cmd.setNode((Node) child.getModel());
    cmd.setLocation(((Rectangle) constraint).getLocation());
    cmd.setDimension(((Rectangle) constraint).getSize());
    return cmd;
}
Also used : Rectangle(org.eclipse.draw2d.geometry.Rectangle) NodePart(com.cubrid.cubridmanager.ui.replication.editor.parts.NodePart) ChangeNodeConstraintCommand(com.cubrid.cubridmanager.ui.replication.editor.commands.ChangeNodeConstraintCommand)

Aggregations

NodePart (com.cubrid.cubridmanager.ui.replication.editor.parts.NodePart)3 ChangeNodeConstraintCommand (com.cubrid.cubridmanager.ui.replication.editor.commands.ChangeNodeConstraintCommand)2 Rectangle (org.eclipse.draw2d.geometry.Rectangle)2 CMWizardDialog (com.cubrid.common.ui.spi.dialog.CMWizardDialog)1 ReplicationEditor (com.cubrid.cubridmanager.ui.replication.editor.ReplicationEditor)1 SetDistributorDbInfoDialog (com.cubrid.cubridmanager.ui.replication.editor.dialog.SetDistributorDbInfoDialog)1 SetHostInfoDialog (com.cubrid.cubridmanager.ui.replication.editor.dialog.SetHostInfoDialog)1 SetSlaveDbInfoDialog (com.cubrid.cubridmanager.ui.replication.editor.dialog.SetSlaveDbInfoDialog)1 SetMasterDbInfoWizard (com.cubrid.cubridmanager.ui.replication.editor.dialog.wizard.SetMasterDbInfoWizard)1 DistributorNode (com.cubrid.cubridmanager.ui.replication.editor.model.DistributorNode)1 HostNode (com.cubrid.cubridmanager.ui.replication.editor.model.HostNode)1 MasterNode (com.cubrid.cubridmanager.ui.replication.editor.model.MasterNode)1 SlaveNode (com.cubrid.cubridmanager.ui.replication.editor.model.SlaveNode)1 Shell (org.eclipse.swt.widgets.Shell)1 IWorkbenchPart (org.eclipse.ui.IWorkbenchPart)1