Example usage for org.eclipse.jface.dialogs IDialogConstants CANCEL_ID

List of usage examples for org.eclipse.jface.dialogs IDialogConstants CANCEL_ID

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs IDialogConstants CANCEL_ID.

Prototype

int CANCEL_ID

To view the source code for org.eclipse.jface.dialogs IDialogConstants CANCEL_ID.

Click Source Link

Document

Button id for a "Cancel" button (value 1).

Usage

From source file:com.clustercontrol.infra.view.action.CheckInfraManagementAction.java

License:Open Source License

/**
 * ?????????????//from ww  w .  j  av  a 2 s. c  om
 *
 * @param view ?
 *
 * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart)
 */

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    this.window = HandlerUtil.getActiveWorkbenchWindow(event);
    // In case this action has been disposed
    if (null == this.window || !isEnabled()) {
        return null;
    }

    // ???
    this.viewPart = HandlerUtil.getActivePart(event);
    if (!(viewPart instanceof InfraManagementView)) {
        return null;
    }

    InfraManagementView infraManagementView = null;
    try {
        infraManagementView = (InfraManagementView) viewPart.getAdapter(InfraManagementView.class);
    } catch (Exception e) {
        m_log.info("execute " + e.getMessage());
        return null;
    }

    if (infraManagementView == null) {
        m_log.info("execute: view is null");
        return null;
    }

    StructuredSelection selection = null;
    if (!(infraManagementView.getComposite().getTableViewer().getSelection() instanceof StructuredSelection)) {
        return null;
    }
    selection = (StructuredSelection) infraManagementView.getComposite().getTableViewer().getSelection();
    if (selection == null) {
        return null;
    }

    List<?> sList = (List<?>) selection.toList();
    Map<String, List<String>> managementIdMap = new ConcurrentHashMap<String, List<String>>();

    for (Object obj : sList) {
        List<?> list = (List<?>) obj;
        String managerName = null;
        if (list == null) {
            continue;
        }
        managerName = (String) list.get(GetInfraManagementTableDefine.MANAGER_NAME);
        if (managementIdMap.get(managerName) == null) {
            managementIdMap.put(managerName, new ArrayList<String>());
        }
    }

    for (Object obj : sList) {
        List<?> list = (List<?>) obj;
        String managementId = null;
        String managerName = null;
        if (list != null) {
            managementId = (String) list.get(GetInfraManagementTableDefine.MANAGEMENT_ID);
            managerName = (String) list.get(GetInfraManagementTableDefine.MANAGER_NAME);
            managementIdMap.get(managerName).add(managementId);
        }
    }

    Map<String, List<InfraManagementInfo>> managementMap = new ConcurrentHashMap<String, List<InfraManagementInfo>>();
    Map<String, String> errorMsgs = new ConcurrentHashMap<>();
    StringBuffer idbuf = new StringBuffer();
    int size = 0;
    for (Map.Entry<String, List<String>> entry : managementIdMap.entrySet()) {
        String managerName = entry.getKey();
        if (managementMap.get(managerName) == null) {
            managementMap.put(managerName, new ArrayList<InfraManagementInfo>());
        }
        for (String managementId : entry.getValue()) {
            try {
                InfraEndpointWrapper wrapper = InfraEndpointWrapper.getWrapper(managerName);
                InfraManagementInfo management = wrapper.getInfraManagement(managementId);
                managementMap.get(managerName).add(management);
                if (size > 0) {
                    idbuf.append(", ");
                }
                idbuf.append(managementId);

            } catch (InvalidRole_Exception e) {
                // ???
                errorMsgs.put(managerName, Messages.getString("message.accesscontrol.16"));
            } catch (HinemosUnknown_Exception | InvalidUserPass_Exception | NotifyNotFound_Exception
                    | InfraManagementNotFound_Exception e) {
                m_log.error("execute() : " + e.getClass().getName() + ", " + e.getMessage());
                Object[] arg = new Object[] { Messages.getString("infra.module.id"),
                        Messages.getString("infra.module.check"), Messages.getString("failed"),
                        HinemosMessage.replace(e.getMessage()) };
                errorMsgs.put(managerName, Messages.getString("message.infra.action.result", arg));
            }
            size++;
        }
    }

    //
    if (0 < errorMsgs.size()) {
        UIManager.showMessageBox(errorMsgs, true);
        return null;
    }

    boolean allRun = false;
    RunDialog dialog = new RunDialog(null,
            Messages.getString("message.infra.confirm.action",
                    new Object[] { Messages.getString("infra.management.id"),
                            Messages.getString("infra.module.check"), idbuf.toString() }));
    if (dialog.open() == IDialogConstants.CANCEL_ID) {
        return null;
    }
    allRun = dialog.isAllRun();

    errorMsgs = new ConcurrentHashMap<>();
    for (Map.Entry<String, List<InfraManagementInfo>> entry : managementMap.entrySet()) {
        String managerName = entry.getKey();
        for (InfraManagementInfo management : entry.getValue()) {
            List<AccessInfo> accessInfoList = AccessUtil.getAccessInfoList(viewPart.getSite().getShell(),
                    management.getFacilityId(), management.getOwnerRoleId(), managerName,
                    infraManagementView.isUseNodeProp());
            // ?????????null?????
            // ???????
            if (accessInfoList == null) {
                continue;
            }
            List<String> moduleIdList = new ArrayList<String>();
            for (InfraModuleInfo info : management.getModuleList()) {
                moduleIdList.add(info.getModuleId());
            }
            String managementId = management.getManagementId();

            try {
                InfraEndpointWrapper wrapper = InfraEndpointWrapper.getWrapper(managerName);
                String sessionId = wrapper.createSession(managementId, moduleIdList, accessInfoList);

                while (true) {
                    ModuleResult moduleResult = wrapper.checkInfraModule(sessionId, !allRun);
                    if (!allRun && !ModuleUtil.displayResult(moduleResult.getModuleId(), moduleResult)) {
                        break;
                    }
                    if (!moduleResult.isHasNext()) {
                        break;
                    }
                }
                wrapper.deleteSession(sessionId);
                MessageDialog.openInformation(null, Messages.getString("message"),
                        Messages.getString("message.infra.management.check.end"));
            } catch (InvalidRole_Exception e) {
                // ???
                errorMsgs.put(managerName, Messages.getString("message.accesscontrol.16"));
                continue;
            } catch (HinemosUnknown_Exception | InvalidUserPass_Exception | InfraManagementNotFound_Exception
                    | InfraModuleNotFound_Exception | SessionNotFound_Exception | FacilityNotFound_Exception
                    | InvalidSetting_Exception e) {
                m_log.error("execute() :  " + e.getClass().getName() + ", " + e.getMessage());
                Object[] arg = new Object[] { Messages.getString("infra.module.id"),
                        Messages.getString("infra.module.check"), Messages.getString("failed"),
                        HinemosMessage.replace(e.getMessage()) };
                errorMsgs.put(managerName, Messages.getString("message.infra.action.result", arg));
                continue;
            } catch (Exception e) {
                m_log.error("execute() :  " + e.getClass().getName() + ", " + e.getMessage());
                Object[] arg = new Object[] { Messages.getString("infra.module.id"),
                        Messages.getString("infra.module.check"), Messages.getString("failed"),
                        HinemosMessage.replace(e.getMessage()) };
                errorMsgs.put(managerName, Messages.getString("message.infra.action.result", arg));
                continue;
            }
        }
    }

    //
    if (0 < errorMsgs.size()) {
        UIManager.showMessageBox(errorMsgs, true);
    }

    infraManagementView.update();
    return null;
}

From source file:com.clustercontrol.infra.view.action.CheckInfraModuleAction.java

License:Open Source License

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    this.window = HandlerUtil.getActiveWorkbenchWindow(event);
    // In case this action has been disposed
    if (null == this.window || !isEnabled()) {
        return null;
    }//from   w  w  w .ja v  a  2s .  c  o  m

    // ???
    this.viewPart = HandlerUtil.getActivePart(event);
    if (!(viewPart instanceof InfraModuleView)) {
        return null;
    }

    InfraModuleView infraModuleView = null;
    try {
        infraModuleView = (InfraModuleView) viewPart.getAdapter(InfraModuleView.class);
    } catch (Exception e) {
        m_log.info("execute " + e.getMessage());
        return null;
    }
    if (infraModuleView == null) {
        m_log.info("execute: view is null");
        return null;
    }

    StructuredSelection selection = null;
    if (infraModuleView.getComposite().getTableViewer().getSelection() instanceof StructuredSelection) {
        selection = (StructuredSelection) infraModuleView.getComposite().getTableViewer().getSelection();
    }

    InfraManagementInfo management = null;
    String managerName = infraModuleView.getComposite().getManagerName();

    try {
        InfraEndpointWrapper wrapper = InfraEndpointWrapper.getWrapper(managerName);
        management = wrapper.getInfraManagement(infraModuleView.getComposite().getManagementId());
    } catch (InvalidRole_Exception e) {
        // ???
        MessageDialog.openError(null, Messages.getString("failed"),
                Messages.getString("message.accesscontrol.16"));
        return null;
    } catch (HinemosUnknown_Exception | InvalidUserPass_Exception | NotifyNotFound_Exception
            | InfraManagementNotFound_Exception e) {
        m_log.error("execute() : " + e.getClass().getName() + ", " + e.getMessage());
        MessageDialog.openError(null, Messages.getString("failed"),
                Messages.getString("message.infra.action.result",
                        new Object[] { Messages.getString("infra.module.id"),
                                Messages.getString("infra.module.check"), Messages.getString("failed"),
                                HinemosMessage.replace(e.getMessage()) }));
        return null;
    }

    if (selection == null || management == null) {
        return null;
    }

    String moduleId = (String) ((ArrayList<?>) selection.getFirstElement())
            .get(GetInfraModuleTableDefine.MODULE_ID);

    boolean allRun = false;
    RunDialog dialog = new RunDialog(null, Messages.getString("message.infra.confirm.action", new Object[] {
            Messages.getString("infra.module.id"), Messages.getString("infra.module.check"), moduleId }));
    if (dialog.open() == IDialogConstants.CANCEL_ID) {
        return null;
    }
    allRun = dialog.isAllRun();

    List<AccessInfo> accessInfoList = AccessUtil.getAccessInfoList(viewPart.getSite().getShell(),
            management.getFacilityId(), management.getOwnerRoleId(), managerName,
            infraModuleView.isUseNodeProp());
    // ?????????null?????
    // ???????
    if (accessInfoList == null) {
        return null;
    }
    List<String> moduleIdList = new ArrayList<String>();
    moduleIdList.add(moduleId);
    try {
        InfraEndpointWrapper wrapper = InfraEndpointWrapper.getWrapper(managerName);
        String sessionId = wrapper.createSession(management.getManagementId(), moduleIdList, accessInfoList);
        while (true) {
            ModuleResult moduleResult = wrapper.checkInfraModule(sessionId, !allRun);
            if (!allRun && !ModuleUtil.displayResult(moduleResult.getModuleId(), moduleResult)) {
                break;
            }
            if (!moduleResult.isHasNext()) {
                break;
            }
        }
        MessageDialog.openInformation(null, Messages.getString("message"),
                Messages.getString("message.infra.management.check.end"));
        wrapper.deleteSession(sessionId);
    } catch (InvalidRole_Exception e) {
        // ???
        MessageDialog.openError(null, Messages.getString("failed"),
                Messages.getString("message.accesscontrol.16"));
        return null;
    } catch (HinemosUnknown_Exception | InvalidUserPass_Exception | InfraManagementNotFound_Exception
            | InfraModuleNotFound_Exception | SessionNotFound_Exception | FacilityNotFound_Exception
            | InvalidSetting_Exception e) {
        m_log.error("execute() :  " + e.getClass().getName() + ", " + e.getMessage());
        MessageDialog.openError(null, Messages.getString("failed"),
                Messages.getString("message.infra.action.result",
                        new Object[] { Messages.getString("infra.module.id"),
                                Messages.getString("infra.module.run"), Messages.getString("failed"),
                                HinemosMessage.replace(e.getMessage()) }));
        return null;
    } catch (Exception e) {
        m_log.error("execute() :  " + e.getClass().getName() + ", " + e.getMessage());
        MessageDialog.openError(null, Messages.getString("failed"),
                Messages.getString("message.infra.action.result",
                        new Object[] { Messages.getString("infra.module.id"),
                                Messages.getString("infra.module.run"), Messages.getString("failed"),
                                HinemosMessage.replace(e.getMessage()) }));
        return null;
    }
    infraModuleView.update(infraModuleView.getComposite().getManagerName(),
            infraModuleView.getComposite().getManagementId());
    return null;
}

From source file:com.clustercontrol.infra.view.action.RunInfraManagementAction.java

License:Open Source License

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    this.window = HandlerUtil.getActiveWorkbenchWindow(event);
    // In case this action has been disposed
    if (null == this.window || !isEnabled()) {
        return null;
    }// ww  w.  j a va  2  s.c om

    // ???
    this.viewPart = HandlerUtil.getActivePart(event);
    if (!(viewPart instanceof InfraManagementView)) {
        return null;
    }

    InfraManagementView infraManagementView = null;
    try {
        infraManagementView = (InfraManagementView) viewPart.getAdapter(InfraManagementView.class);
    } catch (Exception e) {
        m_log.info("execute " + e.getMessage());
        return null;
    }
    if (infraManagementView == null) {
        m_log.info("execute: view is null");
        return null;
    }

    StructuredSelection selection = null;
    if (!(infraManagementView.getComposite().getTableViewer().getSelection() instanceof StructuredSelection)) {
        return null;
    }
    selection = (StructuredSelection) infraManagementView.getComposite().getTableViewer().getSelection();
    if (selection == null) {
        return null;
    }

    List<?> sList = (List<?>) selection.toList();
    Map<String, List<String>> managementIdMap = new ConcurrentHashMap<String, List<String>>();

    for (Object obj : sList) {
        List<?> list = (List<?>) obj;
        String managerName = null;
        if (list == null) {
            continue;
        }
        managerName = (String) list.get(GetInfraManagementTableDefine.MANAGER_NAME);
        if (managementIdMap.get(managerName) == null) {
            managementIdMap.put(managerName, new ArrayList<String>());
        }
    }

    for (Object obj : sList) {
        List<?> list = (List<?>) obj;
        String managementId = null;
        String managerName = null;
        if (list != null) {
            managementId = (String) list.get(GetInfraManagementTableDefine.MANAGEMENT_ID);
            managerName = (String) list.get(GetInfraManagementTableDefine.MANAGER_NAME);
            managementIdMap.get(managerName).add(managementId);
        }
    }

    Map<String, List<InfraManagementInfo>> managementMap = new ConcurrentHashMap<String, List<InfraManagementInfo>>();
    Map<String, String> errorMsgs = new ConcurrentHashMap<>();
    StringBuffer idbuf = new StringBuffer();
    int size = 0;
    for (Map.Entry<String, List<String>> entry : managementIdMap.entrySet()) {
        String managerName = entry.getKey();
        if (managementMap.get(managerName) == null) {
            managementMap.put(managerName, new ArrayList<InfraManagementInfo>());
        }
        for (String managementId : entry.getValue()) {
            try {
                InfraEndpointWrapper wrapper = InfraEndpointWrapper.getWrapper(managerName);
                InfraManagementInfo management = wrapper.getInfraManagement(managementId);
                managementMap.get(managerName).add(management);
                if (size > 0) {
                    idbuf.append(", ");
                }
                idbuf.append(managementId);
            } catch (InvalidRole_Exception e) {
                // ???
                errorMsgs.put(managerName, Messages.getString("message.accesscontrol.16"));
            } catch (HinemosUnknown_Exception | InvalidUserPass_Exception | NotifyNotFound_Exception
                    | InfraManagementNotFound_Exception e) {
                m_log.error("execute() : " + e.getClass().getName() + ", " + e.getMessage());
                Object[] arg = new Object[] { Messages.getString("infra.module.id"),
                        Messages.getString("infra.module.run"), Messages.getString("failed"),
                        HinemosMessage.replace(e.getMessage()) };
                errorMsgs.put(managerName, Messages.getString("message.infra.action.result", arg));
            }
            size++;
        }
    }

    //
    if (0 < errorMsgs.size()) {
        UIManager.showMessageBox(errorMsgs, true);
        return null;
    }

    boolean allRun = false;
    RunDialog dialog = new RunDialog(null,
            Messages.getString("message.infra.confirm.action",
                    new Object[] { Messages.getString("infra.management.id"),
                            Messages.getString("infra.module.run"), idbuf.toString() }));
    if (dialog.open() == IDialogConstants.CANCEL_ID) {
        return null;
    }
    allRun = dialog.isAllRun();

    errorMsgs = new ConcurrentHashMap<>();
    for (Map.Entry<String, List<InfraManagementInfo>> entry : managementMap.entrySet()) {
        String managerName = entry.getKey();
        for (InfraManagementInfo management : entry.getValue()) {
            List<AccessInfo> accessInfoList = AccessUtil.getAccessInfoList(viewPart.getSite().getShell(),
                    management.getFacilityId(), management.getOwnerRoleId(), managerName,
                    infraManagementView.isUseNodeProp());
            // ?????????null?????
            // ???????
            if (accessInfoList == null) {
                continue;
            }
            List<String> moduleIdList = new ArrayList<String>();
            for (InfraModuleInfo info : management.getModuleList()) {
                moduleIdList.add(info.getModuleId());
            }
            String managementId = management.getManagementId();

            try {
                InfraEndpointWrapper wrapper = InfraEndpointWrapper.getWrapper(managerName);
                String sessionId = wrapper.createSession(managementId, moduleIdList, accessInfoList);

                while (true) {
                    ModuleResult moduleResult = wrapper.runInfraModule(sessionId);
                    if (!allRun && !ModuleUtil.displayResult(moduleResult.getModuleId(), moduleResult)) {
                        break;
                    }
                    if (!moduleResult.isHasNext()) {
                        break;
                    }
                }
                wrapper.deleteSession(sessionId);
                MessageDialog.openInformation(null, Messages.getString("message"),
                        Messages.getString("message.infra.management.run.end"));
            } catch (InvalidRole_Exception e) {
                // ???
                errorMsgs.put(managerName, Messages.getString("message.accesscontrol.16"));
                continue;
            } catch (HinemosUnknown_Exception | InvalidUserPass_Exception | InfraManagementNotFound_Exception
                    | InfraModuleNotFound_Exception | SessionNotFound_Exception | FacilityNotFound_Exception
                    | InvalidSetting_Exception e) {
                m_log.error("execute() :  " + e.getClass().getName() + ", " + e.getMessage());
                Object[] arg = new Object[] { Messages.getString("infra.module.id"),
                        Messages.getString("infra.module.run"), Messages.getString("failed"),
                        HinemosMessage.replace(e.getMessage()) };
                errorMsgs.put(managerName, Messages.getString("message.infra.action.result", arg));
                continue;
            } catch (Exception e) {
                m_log.error("execute() :  " + e.getClass().getName() + ", " + e.getMessage());
                Object[] arg = new Object[] { Messages.getString("infra.module.id"),
                        Messages.getString("infra.module.run"), Messages.getString("failed"),
                        HinemosMessage.replace(e.getMessage()) };
                errorMsgs.put(managerName, Messages.getString("message.infra.action.result", arg));
                continue;
            }
        }
    }

    //
    if (0 < errorMsgs.size()) {
        UIManager.showMessageBox(errorMsgs, true);
    }

    infraManagementView.update();
    return null;
}

From source file:com.clustercontrol.infra.view.action.RunInfraModuleAction.java

License:Open Source License

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    this.window = HandlerUtil.getActiveWorkbenchWindow(event);
    // In case this action has been disposed
    if (null == this.window || !isEnabled()) {
        return null;
    }/*w  w w . jav a  2 s. c  o  m*/

    // ???
    this.viewPart = HandlerUtil.getActivePart(event);
    if (!(viewPart instanceof InfraModuleView)) {
        return null;
    }

    InfraModuleView infraModuleView = null;
    try {
        infraModuleView = (InfraModuleView) viewPart.getAdapter(InfraModuleView.class);
    } catch (Exception e) {
        m_log.info("execute " + e.getMessage());
        return null;
    }
    if (infraModuleView == null) {
        m_log.info("execute: view is null");
        return null;
    }

    StructuredSelection selection = null;
    if (infraModuleView.getComposite().getTableViewer().getSelection() instanceof StructuredSelection) {
        selection = (StructuredSelection) infraModuleView.getComposite().getTableViewer().getSelection();
    }

    InfraManagementInfo management = null;
    String managerName = infraModuleView.getComposite().getManagerName();
    try {
        InfraEndpointWrapper wrapper = InfraEndpointWrapper.getWrapper(managerName);
        management = wrapper.getInfraManagement(infraModuleView.getComposite().getManagementId());
    } catch (InvalidRole_Exception e) {
        // ???
        MessageDialog.openError(null, Messages.getString("failed"),
                Messages.getString("message.accesscontrol.16"));
        return null;
    } catch (HinemosUnknown_Exception | InvalidUserPass_Exception | NotifyNotFound_Exception
            | InfraManagementNotFound_Exception e) {
        m_log.error("execute() : " + e.getClass().getName() + ", " + e.getMessage());
        MessageDialog.openError(null, Messages.getString("failed"),
                Messages.getString("message.infra.action.result",
                        new Object[] { Messages.getString("infra.module.id"),
                                Messages.getString("infra.module.run"), Messages.getString("failed"),
                                HinemosMessage.replace(e.getMessage()) }));
        return null;
    }

    if (selection == null || management == null) {
        return null;
    }
    String moduleId = (String) ((ArrayList<?>) selection.getFirstElement())
            .get(GetInfraModuleTableDefine.MODULE_ID);

    boolean allRun = false;
    RunDialog dialog = new RunDialog(null, Messages.getString("message.infra.confirm.action", new Object[] {
            Messages.getString("infra.module.id"), Messages.getString("infra.module.run"), moduleId }));
    if (dialog.open() == IDialogConstants.CANCEL_ID) {
        return null;
    }
    allRun = dialog.isAllRun();

    List<AccessInfo> accessInfoList = AccessUtil.getAccessInfoList(viewPart.getSite().getShell(),
            management.getFacilityId(), management.getOwnerRoleId(), managerName,
            infraModuleView.isUseNodeProp());
    // ?????????null?????
    // ???????
    if (accessInfoList == null) {
        return null;
    }

    // module??
    InfraModuleInfo module = null;
    for (InfraModuleInfo m : management.getModuleList()) {
        if (moduleId.equals(m.getModuleId())) {
            module = m;
            break;
        }
    }
    if (module == null) {
        return null;
    }

    List<String> moduleIdList = new ArrayList<String>();
    moduleIdList.add(moduleId);
    try {
        InfraEndpointWrapper wrapper = InfraEndpointWrapper.getWrapper(managerName);
        String sessionId = wrapper.createSession(management.getManagementId(), moduleIdList, accessInfoList);
        while (true) {
            ModuleResult moduleResult = wrapper.runInfraModule(sessionId);
            if (!allRun && !ModuleUtil.displayResult(moduleResult.getModuleId(), moduleResult)) {
                break;
            }
            if (!moduleResult.isHasNext()) {
                break;
            }
        }
        wrapper.deleteSession(sessionId);
        MessageDialog.openInformation(null, Messages.getString("message"),
                Messages.getString("message.infra.management.run.end"));
    } catch (InvalidRole_Exception e) {
        // ???
        MessageDialog.openError(null, Messages.getString("failed"),
                Messages.getString("message.accesscontrol.16"));
        return null;
    } catch (HinemosUnknown_Exception | InvalidUserPass_Exception | InfraManagementNotFound_Exception
            | InfraModuleNotFound_Exception | SessionNotFound_Exception | FacilityNotFound_Exception
            | InvalidSetting_Exception e) {
        m_log.error("execute() :  " + e.getClass().getName() + ", " + e.getMessage());
        MessageDialog.openError(null, Messages.getString("failed"),
                Messages.getString("message.infra.action.result",
                        new Object[] { Messages.getString("infra.module.id"),
                                Messages.getString("infra.module.run"), Messages.getString("failed"),
                                HinemosMessage.replace(e.getMessage()) }));
        return null;
    } catch (Exception e) {
        m_log.error("execute() :  " + e.getClass().getName() + ", " + e.getMessage());
        MessageDialog.openError(null, Messages.getString("failed"),
                Messages.getString("message.infra.action.result",
                        new Object[] { Messages.getString("infra.module.id"),
                                Messages.getString("infra.module.run"), Messages.getString("failed"),
                                HinemosMessage.replace(e.getMessage()) }));
        return null;
    }

    infraModuleView.update(infraModuleView.getComposite().getManagerName(),
            infraModuleView.getComposite().getManagementId());
    return null;
}

From source file:com.clustercontrol.monitor.dialog.EventInfoDialog.java

License:Open Source License

/**
 * ?????/*from  w  w w. j a v  a  2  s.  c  o m*/
 *
 * @param parent ???
 */
@Override
protected void createButtonsForButtonBar(Composite parent) {
    //?(ok)
    this.createButton(parent, IDialogConstants.OK_ID, Messages.getString("register"), true);
    // ?(cancel)
    this.createButton(parent, IDialogConstants.CANCEL_ID, Messages.getString("cancel"), false);

}

From source file:com.clustercontrol.monitor.dialog.StatusInfoDialog.java

License:Open Source License

/**
 * ?????/*from  w  w w  .  j  av  a 2  s .  co m*/
 *
 * @param parent ???
 */
@Override
protected void createButtonsForButtonBar(Composite parent) {
    // ?(cancel)
    this.createButton(parent, IDialogConstants.CANCEL_ID, Messages.getString("cancel"), false);
}

From source file:com.clustercontrol.monitor.view.action.EventReportAction.java

License:Open Source License

/**
 * [??]?????????//  w  ww  . java  2 s  . co  m
 * ???
 * <p>
 * <ol>
 * <li>[??]???</li>
 * <li>?????????</li>
 * <li>??????ID????</li>
 * <li>ID???????? </li>
 * <li>???</li>
 * </ol>
 *
 * @see org.eclipse.core.commands.IHandler#execute
 * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
 * @see com.clustercontrol.monitor.dialog.EventReportDialog
 * @see com.clustercontrol.monitor.util.EventReportGenerator#run(String, Property, ArrayList, int, String)
 */
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    this.window = HandlerUtil.getActiveWorkbenchWindow(event);
    // In case this action has been disposed
    if (null == this.window || !isEnabled()) {
        return null;
    }

    // ???
    this.viewPart = HandlerUtil.getActivePart(event);
    EventView view = null;
    try {
        view = (EventView) this.viewPart.getAdapter(EventView.class);
    } catch (Exception e) {
        m_log.info("execute " + e.getMessage());
        return null;
    }

    if (view == null) {
        m_log.info("execute: view is null");
        return null;
    }

    FacilityTreeItem item = view.getScopeTreeComposite().getSelectItem();
    if (null == item || item.getData().getFacilityType() == FacilityConstant.TYPE_COMPOSITE) {
        MessageDialog.openError(null, Messages.getString("failed"), Messages.getString("message.monitor.47"));
        return null;
    }

    String managerName;
    String facilityId;
    if (item.getData().getFacilityType() == FacilityConstant.TYPE_MANAGER) {
        facilityId = RoleSettingTreeConstant.ROOT_ID;
        managerName = item.getData().getFacilityId();
    } else {
        facilityId = item.getData().getFacilityId();
        FacilityTreeItem manager = ScopePropertyUtil.getManager(item);
        managerName = manager.getData().getFacilityId();
    }

    // ?
    EventReportDialog dialog = new EventReportDialog(this.viewPart.getSite().getShell(), managerName,
            facilityId);

    // ????????
    int btnId = dialog.open();
    if (btnId == IDialogConstants.OK_ID) {
        m_log.debug(dialog.getFilePath() + " exported");
        if (!ClusterControlPlugin.isRAP()) {
            MessageDialog.openInformation(null, Messages.getString("successful"), Messages
                    .getString("message.monitor.45", new String[] { dialog.getFileName(), managerName }));
        }
    } else if (btnId == IDialogConstants.CANCEL_ID) {
        // Do nothing
    } else {
        MessageDialog.openError(null, Messages.getString("failed"), Messages.getString("message.monitor.46"));
    }
    return null;
}

From source file:com.clustercontrol.notify.dialog.NotifyCommandCreateDialog.java

License:Open Source License

/**
 * ????<BR>//from   w  ww  .j  a  v a 2 s.  c  om
 * ??<code> true </code>???????<code> false </code>?????????
 *
 * @param parent
 *            ??
 *
 * @see #createButtonsForButtonBar(Composite)
 */
@Override
protected void createButtonsForButtonBar(Composite parent) {

    if (!this.referenceFlg) {
        super.createButtonsForButtonBar(parent);
    } else {
        // ?
        // TODO Remove the following hard-code. IDialogConstants.*_LABEL will causes IncompatibleClassChangeError on RAP
        this.createButton(parent, IDialogConstants.CANCEL_ID, "Close", false);
    }
}

From source file:com.clustercontrol.notify.dialog.NotifyListDialog.java

License:Open Source License

/**
 * ????<BR>//from   w w  w  .j  av a 2 s.  c  o  m
 * ?????
 *
 * @param parent ??
 */
@Override
protected void createButtonsForButtonBar(Composite parent) {
    // TODO Remove the following hard-codes. IDialogConstants.*_LABEL will cause IncompatibleClassChangeError in RAP.
    if (!isSelect) {
        // ?
        this.createButton(parent, IDialogConstants.CANCEL_ID, "Close", false);
    } else {
        // ?
        this.createButton(parent, IDialogConstants.CANCEL_ID, "OK", false);
    }
}

From source file:com.clustercontrol.notify.dialog.NotifyStatusCreateDialog.java

License:Open Source License

/**
 * ????<BR>// w ww  . ja  v  a 2 s  .  c o  m
 * ??<code> true </code>???????<code> false </code>?????????
 *
 * @param parent ??
 *
 * @see #createButtonsForButtonBar(Composite)
 */
@Override
protected void createButtonsForButtonBar(Composite parent) {

    if (!this.referenceFlg) {
        super.createButtonsForButtonBar(parent);
    } else {
        // ?
        // TODO Remove the following hard-code. IDialogConstants.*_LABEL will causes IncompatibleClassChangeError on RAP
        this.createButton(parent, IDialogConstants.CANCEL_ID, "Cancel", false);
    }
}