Search in sources :

Example 11 with CMWizardDialog

use of com.cubrid.common.ui.spi.dialog.CMWizardDialog in project cubrid-manager by CUBRID.

the class LeafNodePart method performRequest.

/**
	 * @see org.eclipse.gef.editparts.AbstractEditPart#performRequest(org.eclipse.gef.Request)
	 * @param req the request to be performed
	 */
public void performRequest(Request req) {
    Shell shell = replEditor.getSite().getShell();
    if (req.getType() == RequestConstants.REQ_OPEN) {
        if (getModel() instanceof MasterNode) {
            SetMasterDbInfoWizard wizard = new SetMasterDbInfoWizard((MasterNode) getModel());
            wizard.setEditable(replEditor.isEditable());
            CMWizardDialog dialog = new CMWizardDialog(shell, wizard);
            dialog.setPageSize(560, 300);
            dialog.open();
        } else if (getModel() instanceof DistributorNode) {
            SetDistributorDbInfoDialog dialog = new SetDistributorDbInfoDialog(shell);
            dialog.setDistributor((DistributorNode) getModel());
            dialog.setEditable(replEditor.isEditable());
            dialog.open();
        } else if (getModel() instanceof SlaveNode) {
            SetSlaveDbInfoDialog dialog = new SetSlaveDbInfoDialog(shell);
            dialog.setSlave((SlaveNode) getModel());
            dialog.setEditable(replEditor.isEditable());
            dialog.open();
        }
    }
}
Also used : MasterNode(com.cubrid.cubridmanager.ui.replication.editor.model.MasterNode) Shell(org.eclipse.swt.widgets.Shell) SlaveNode(com.cubrid.cubridmanager.ui.replication.editor.model.SlaveNode) SetDistributorDbInfoDialog(com.cubrid.cubridmanager.ui.replication.editor.dialog.SetDistributorDbInfoDialog) 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 12 with CMWizardDialog

use of com.cubrid.common.ui.spi.dialog.CMWizardDialog in project cubrid-manager by CUBRID.

the class AddShardAction method run.

/**
	 * Open a dialog to add a shard.
	 */
public void run() {
    Object[] obj = this.getSelectedObj();
    if (obj != null && obj.length > 0) {
        if (!isSupported(obj[0])) {
            this.setEnabled(false);
            return;
        }
        node = (ICubridNode) obj[0];
        server = node.getServer();
    }
    CMWizardDialog dialog = new CMWizardDialog(getShell(), new AddShardWizard(server)) {

        /**
			 * Overwrite the method. Auto add IPageChangingListener(s);
			 * 
			 * @param parent
			 *            of the control.
			 * @return Control
			 */
        protected Control createContents(Composite parent) {
            Control result = super.createContents(parent);
            IWizardPage[] pages = this.getWizard().getPages();
            for (IWizardPage page : pages) {
                if (page instanceof IPageChangingListener) {
                    this.addPageChangingListener((IPageChangingListener) page);
                }
                if (page instanceof IPageChangedListener) {
                    this.addPageChangedListener((IPageChangedListener) page);
                }
            }
            return result;
        }
    };
    dialog.setPageSize(660, 450);
    dialog.open();
}
Also used : AddShardWizard(com.cubrid.cubridmanager.ui.shard.control.AddShardWizard) IPageChangedListener(org.eclipse.jface.dialogs.IPageChangedListener) Control(org.eclipse.swt.widgets.Control) Composite(org.eclipse.swt.widgets.Composite) IWizardPage(org.eclipse.jface.wizard.IWizardPage) IPageChangingListener(org.eclipse.jface.dialogs.IPageChangingListener) CMWizardDialog(com.cubrid.common.ui.spi.dialog.CMWizardDialog)

Example 13 with CMWizardDialog

use of com.cubrid.common.ui.spi.dialog.CMWizardDialog in project cubrid-manager by CUBRID.

the class AddBrokerMonitorAction method run.

/**
	 * open add broker monitor dialog.
	 * 
	 * @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;
    }
    HostMonitorPart hostMonPart = (HostMonitorPart) objArr[0];
    HostNode hostNode = (HostNode) hostMonPart.getModel();
    Dashboard dashboard = (Dashboard) hostMonPart.getParent().getModel();
    if (hostNode != null && dashboard != null) {
        AddHostAndDbWizard wizard = new AddHostAndDbWizard(hostNode, dashboard.getHostNodeList(), 2);
        CMWizardDialog dialog = new CMWizardDialog(getShell(), wizard);
        dialog.setPageSize(660, 380);
        int returnCode = dialog.open();
        if (returnCode == IDialogConstants.OK_ID) {
            List<HostNode> addedHostNodeList = wizard.getAddedHostNodeList();
            HAUtil.mergeHostNode(dashboard, addedHostNodeList);
            HAUtil.calcLocation(dashboard.getHostNodeList());
        }
    }
}
Also used : HostNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode) AddHostAndDbWizard(com.cubrid.cubridmanager.ui.mondashboard.dialog.wizard.AddHostAndDbWizard) Dashboard(com.cubrid.cubridmanager.ui.mondashboard.editor.model.Dashboard) HostMonitorPart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.HostMonitorPart) CMWizardDialog(com.cubrid.common.ui.spi.dialog.CMWizardDialog)

Example 14 with CMWizardDialog

use of com.cubrid.common.ui.spi.dialog.CMWizardDialog in project cubrid-manager by CUBRID.

the class AddHostMonitorAction method run.

/**
	 * Open add host monitor dialog.
	 * 
	 * @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 = (DashboardPart) objArr[0];
    Dashboard dashboard = (Dashboard) dp.getModel();
    if (dashboard != null) {
        AddHostAndDbWizard wizard = new AddHostAndDbWizard(null, dashboard.getHostNodeList(), 0);
        CMWizardDialog dialog = new CMWizardDialog(getShell(), wizard);
        dialog.setPageSize(660, 380);
        int returnCode = dialog.open();
        if (returnCode == IDialogConstants.OK_ID) {
            List<HostNode> addedHostNodeList = wizard.getAddedHostNodeList();
            HAUtil.mergeHostNode(dashboard, addedHostNodeList);
            HAUtil.calcLocation(dashboard.getHostNodeList());
        }
    }
}
Also used : DashboardPart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.DashboardPart) HostNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode) AddHostAndDbWizard(com.cubrid.cubridmanager.ui.mondashboard.dialog.wizard.AddHostAndDbWizard) Dashboard(com.cubrid.cubridmanager.ui.mondashboard.editor.model.Dashboard) CMWizardDialog(com.cubrid.common.ui.spi.dialog.CMWizardDialog)

Aggregations

CMWizardDialog (com.cubrid.common.ui.spi.dialog.CMWizardDialog)14 AddHostAndDbWizard (com.cubrid.cubridmanager.ui.mondashboard.dialog.wizard.AddHostAndDbWizard)4 HostNode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode)4 Composite (org.eclipse.swt.widgets.Composite)4 Dashboard (com.cubrid.cubridmanager.ui.mondashboard.editor.model.Dashboard)3 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)3 SelectionEvent (org.eclipse.swt.events.SelectionEvent)3 GridData (org.eclipse.swt.layout.GridData)3 Button (org.eclipse.swt.widgets.Button)3 CreatePartitionWizard (com.cubrid.common.ui.cubrid.table.control.CreatePartitionWizard)2 ICubridNode (com.cubrid.common.ui.spi.model.ICubridNode)2 HostMonitorPart (com.cubrid.cubridmanager.ui.mondashboard.editor.parts.HostMonitorPart)2 SetDistributorDbInfoDialog (com.cubrid.cubridmanager.ui.replication.editor.dialog.SetDistributorDbInfoDialog)2 SetSlaveDbInfoDialog (com.cubrid.cubridmanager.ui.replication.editor.dialog.SetSlaveDbInfoDialog)2 SetMasterDbInfoWizard (com.cubrid.cubridmanager.ui.replication.editor.dialog.wizard.SetMasterDbInfoWizard)2 DistributorNode (com.cubrid.cubridmanager.ui.replication.editor.model.DistributorNode)2 MasterNode (com.cubrid.cubridmanager.ui.replication.editor.model.MasterNode)2 SlaveNode (com.cubrid.cubridmanager.ui.replication.editor.model.SlaveNode)2 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)2 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)2