Example usage for org.eclipse.jface.dialogs MessageDialog openInformation

List of usage examples for org.eclipse.jface.dialogs MessageDialog openInformation

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs MessageDialog openInformation.

Prototype

public static void openInformation(Shell parent, String title, String message) 

Source Link

Document

Convenience method to open a standard information dialog.

Usage

From source file:com.clustercontrol.infra.view.action.EnableInfraModuleAction.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.  j av a2s .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();
    }

    StringBuffer strModuleIds = new StringBuffer();
    List<String> moduleIds = new ArrayList<>();

    if (selection != null) {

        for (Object object : selection.toList()) {
            String tmpModuleId = (String) ((ArrayList<?>) object).get(GetInfraModuleTableDefine.MODULE_ID);
            moduleIds.add(tmpModuleId);
            strModuleIds.append(tmpModuleId + ", ");
        }
        strModuleIds.setLength(strModuleIds.length() - 2);
    }

    String managerName = infraModuleView.getComposite().getManagementId();

    if (MessageDialog.openConfirm(null, Messages.getString("confirmed"),
            Messages.getString("message.infra.confirm.action",
                    new Object[] { Messages.getString("infra.module.id"),
                            Messages.getString("infra.enable.setting"), strModuleIds })) == false) {
        return null;
    }

    InfraEndpointWrapper wrapper = InfraEndpointWrapper
            .getWrapper(infraModuleView.getComposite().getManagerName());

    try {
        InfraManagementInfo info = wrapper.getInfraManagement(managerName);
        for (String moduleId : moduleIds) {
            for (InfraModuleInfo module : info.getModuleList()) {
                if (module.getModuleId().equals(moduleId)) {
                    module.setValidFlg(true);
                    break;
                }
            }
        }

        try {
            wrapper.modifyInfraManagement(info);
        } catch (InvalidRole_Exception e) {
            // ???
            MessageDialog.openError(null, Messages.getString("failed"),
                    Messages.getString("message.accesscontrol.16"));
            return null;
        } catch (InvalidSetting_Exception | NotifyDuplicate_Exception | HinemosUnknown_Exception
                | InvalidUserPass_Exception | InfraManagementNotFound_Exception
                | InfraManagementDuplicate_Exception e) {
            m_log.debug("execute modifyInfraManagement, " + e.getMessage());
            MessageDialog.openError(null, Messages.getString("failed"),
                    Messages.getString("message.infra.action.result",
                            new Object[] { Messages.getString("infra.module.id"),
                                    Messages.getString("infra.enable.setting"), Messages.getString("failed"),
                                    strModuleIds }));
            return null;
        }
    } catch (HinemosUnknown_Exception | InvalidRole_Exception | InvalidUserPass_Exception
            | NotifyNotFound_Exception | InfraManagementNotFound_Exception e) {
        m_log.debug("execute getInfraManagement, " + e.getMessage());
    }

    MessageDialog.openInformation(null, Messages.getString("successful"),
            Messages.getString("message.infra.action.result",
                    new Object[] { Messages.getString("infra.module.id"),
                            Messages.getString("infra.enable.setting") + "(" + managerName + ")",
                            Messages.getString("successful"), strModuleIds }));
    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;
    }/*from w  ww.ja  v a  2  s  . c  o  m*/

    // ???
    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;
    }/*from w w w  .j  a 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.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.jmx.dialog.JmxCreateDialog.java

License:Open Source License

/**
 * ????//from   www .ja va2 s . c om
 *
 * @param parent
 *            ?
 */
@Override
protected void customizeDialog(Composite parent) {
    // ?????
    item1 = Messages.getString("select.value");
    item2 = Messages.getString("select.value");

    super.customizeDialog(parent);
    itemName.setEditable(false);
    measure.setEditable(false);

    // 
    shell.setText(Messages.getString("dialog.monitor.jmx.create.modify"));

    // ????
    Label label = null;
    // ????
    GridData gridData = null;

    /*
     * ????
     */
    Group groupCheckRule = new Group(groupRule, SWT.NONE);
    WidgetTestUtil.setTestId(this, "checkrule", groupCheckRule);
    GridLayout layout = new GridLayout(1, true);
    layout.marginWidth = 5;
    layout.marginHeight = 5;
    layout.numColumns = BASIC_UNIT;
    groupCheckRule.setLayout(layout);
    gridData = new GridData();
    gridData.horizontalSpan = BASIC_UNIT;
    gridData.horizontalAlignment = GridData.FILL;
    gridData.grabExcessHorizontalSpace = true;
    groupCheckRule.setLayoutData(gridData);
    groupCheckRule.setText(Messages.getString("check.rule"));

    /*
     * 
     */
    // 
    label = new Label(groupCheckRule, SWT.NONE);
    WidgetTestUtil.setTestId(this, "monitoritem", label);
    gridData = new GridData();
    gridData.horizontalSpan = 8;
    gridData.horizontalAlignment = GridData.FILL;
    gridData.grabExcessHorizontalSpace = true;
    label.setLayoutData(gridData);
    label.setText(Messages.getString("monitor.item") + " : ");
    // 
    this.m_comboCollectorItem = new Combo(groupCheckRule, SWT.DROP_DOWN | SWT.READ_ONLY);
    WidgetTestUtil.setTestId(this, "collectoritem", m_comboCollectorItem);
    gridData = new GridData();
    gridData.horizontalSpan = 22;
    gridData.horizontalAlignment = GridData.FILL;
    gridData.grabExcessHorizontalSpace = true;
    this.m_comboCollectorItem.setLayoutData(gridData);

    createComboCollectorItem();

    // ???????
    m_comboCollectorItem.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent arg0) {
            if (m_comboCollectorItem.getSelectionIndex() != -1) {
                itemName.setText(HinemosMessage
                        .replace(((JmxMasterInfo) m_comboCollectorItem.getData(m_comboCollectorItem.getText()))
                                .getName()));
                measure.setText(HinemosMessage
                        .replace(((JmxMasterInfo) m_comboCollectorItem.getData(m_comboCollectorItem.getText()))
                                .getMeasure()));
                update();
            }
        }
    });

    //????
    if (!updateFlg) {
        this.getMonitorBasicScope().getManagerListComposite().getComboManagerName()
                .addSelectionListener(new SelectionAdapter() {
                    @Override
                    public void widgetSelected(SelectionEvent e) {
                        itemName.setText(Messages.getString("select.value"));
                        measure.setText(Messages.getString("collection.unit"));
                        createComboCollectorItem();
                    }
                });
    }

    /*
     * 
     */
    // ?
    // 
    label = new Label(groupCheckRule, SWT.NONE);
    WidgetTestUtil.setTestId(this, "port", label);
    gridData = new GridData();
    gridData.horizontalSpan = 8;
    gridData.horizontalAlignment = GridData.FILL;
    gridData.grabExcessHorizontalSpace = true;
    label.setLayoutData(gridData);
    label.setText(Messages.getString("port") + " : ");

    // 
    this.m_textPort = new Text(groupCheckRule, SWT.BORDER | SWT.LEFT | SWT.SINGLE);
    WidgetTestUtil.setTestId(this, null, m_textPort);
    gridData = new GridData();
    gridData.horizontalSpan = 6;
    gridData.horizontalAlignment = GridData.FILL;
    gridData.grabExcessHorizontalSpace = true;
    this.m_textPort.setLayoutData(gridData);
    this.m_textPort.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent arg0) {
            update();
        }
    });

    // 
    label = new Label(groupCheckRule, SWT.NONE);
    WidgetTestUtil.setTestId(this, "blank1", label);
    gridData = new GridData();
    gridData.horizontalSpan = 16;
    gridData.horizontalAlignment = GridData.FILL;
    gridData.grabExcessHorizontalSpace = true;
    label.setLayoutData(gridData);

    // ??
    // 
    label = new Label(groupCheckRule, SWT.NONE);
    WidgetTestUtil.setTestId(this, "user", label);
    gridData = new GridData();
    gridData.horizontalSpan = 8;
    gridData.horizontalAlignment = GridData.FILL;
    gridData.grabExcessHorizontalSpace = true;
    label.setLayoutData(gridData);
    label.setText(Messages.getString("user") + " : ");

    // 
    this.m_textUser = new Text(groupCheckRule, SWT.BORDER | SWT.LEFT | SWT.SINGLE);
    WidgetTestUtil.setTestId(this, null, m_textUser);
    gridData = new GridData();
    gridData.horizontalSpan = 10;
    gridData.horizontalAlignment = GridData.FILL;
    gridData.grabExcessHorizontalSpace = true;
    this.m_textUser.setLayoutData(gridData);
    this.m_textUser.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent arg0) {
            update();
        }
    });

    // 
    label = new Label(groupCheckRule, SWT.NONE);
    WidgetTestUtil.setTestId(this, "blank2", label);
    gridData = new GridData();
    gridData.horizontalSpan = 12;
    gridData.horizontalAlignment = GridData.FILL;
    gridData.grabExcessHorizontalSpace = true;
    label.setLayoutData(gridData);

    // 

    // 
    label = new Label(groupCheckRule, SWT.NONE);
    WidgetTestUtil.setTestId(this, "password", label);
    gridData = new GridData();
    gridData.horizontalSpan = 8;
    gridData.horizontalAlignment = GridData.FILL;
    gridData.grabExcessHorizontalSpace = true;
    label.setLayoutData(gridData);
    label.setText(Messages.getString("password") + " : ");

    // 
    this.m_textPassword = new Text(groupCheckRule, SWT.BORDER | SWT.LEFT | SWT.SINGLE | SWT.PASSWORD);
    WidgetTestUtil.setTestId(this, null, m_textPassword);
    gridData = new GridData();
    gridData.horizontalSpan = 10;
    gridData.horizontalAlignment = GridData.FILL;
    gridData.grabExcessHorizontalSpace = true;
    this.m_textPassword.setLayoutData(gridData);
    this.m_textPassword.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent arg0) {
            update();
        }
    });

    // 
    label = new Label(groupCheckRule, SWT.NONE);
    WidgetTestUtil.setTestId(this, "blank3", label);
    gridData = new GridData();
    gridData.horizontalSpan = 12;
    gridData.horizontalAlignment = GridData.FILL;
    gridData.grabExcessHorizontalSpace = true;
    label.setLayoutData(gridData);

    /*
     * ??
     */
    // 
    label = new Label(groupCheckRule, SWT.NONE);
    gridData = new GridData();
    gridData.horizontalSpan = WIDTH_TITLE_LONG;
    gridData.horizontalAlignment = GridData.FILL;
    gridData.grabExcessHorizontalSpace = true;
    label.setLayoutData(gridData);
    label.setText(Messages.getString("convert.value") + " : ");
    // 
    this.m_comboConvertValue = new Combo(groupCheckRule, SWT.DROP_DOWN | SWT.READ_ONLY);
    WidgetTestUtil.setTestId(this, "convertvalue", m_comboConvertValue);
    gridData = new GridData();
    gridData.horizontalSpan = WIDTH_TEXT;
    gridData.horizontalAlignment = GridData.FILL;
    gridData.grabExcessHorizontalSpace = true;
    this.m_comboConvertValue.setLayoutData(gridData);
    this.m_comboConvertValue.add(ConvertValueMessage.STRING_NO);
    this.m_comboConvertValue.add(ConvertValueMessage.STRING_DELTA);

    // 
    label = new Label(groupCheckRule, SWT.NONE);
    WidgetTestUtil.setTestId(this, "blank4", label);
    gridData = new GridData();
    gridData.horizontalSpan = 12;
    gridData.horizontalAlignment = GridData.FILL;
    gridData.grabExcessHorizontalSpace = true;
    label.setLayoutData(gridData);

    // 
    this.adjustDialog();

    // ?
    MonitorInfo info = null;
    if (this.monitorId == null) {
        // ???
        info = new MonitorInfo();
        this.setInfoInitialValue(info);
        this.setInputData(info);
    } else {
        // ????
        try {
            MonitorSettingEndpointWrapper wrapper = MonitorSettingEndpointWrapper.getWrapper(managerName);
            info = wrapper.getMonitor(this.monitorId);
            this.setInputData(info);
        } catch (InvalidRole_Exception e) {
            // ??????
            MessageDialog.openInformation(null, Messages.getString("message"),
                    Messages.getString("message.accesscontrol.16"));

        } catch (Exception e) {
            // ?
            m_log.warn("customizeDialog() getMonitor, " + HinemosMessage.replace(e.getMessage()), e);
            MessageDialog.openInformation(null, Messages.getString("message"),
                    Messages.getString("message.hinemos.failure.unexpected") + ", "
                            + HinemosMessage.replace(e.getMessage()));
        }
    }
}

From source file:com.clustercontrol.jmx.dialog.JmxCreateDialog.java

License:Open Source License

/**
 * ?????/*  w  ww  .  j ava2  s. com*/
 *
 * @return true?false
 *
 * @see com.clustercontrol.dialog.CommonDialog#action()
 */
@Override
protected boolean action() {
    boolean result = false;

    MonitorInfo info = this.inputData;
    JmxMasterInfo selectJmxMasterInfo = (JmxMasterInfo) m_comboCollectorItem
            .getData(m_comboCollectorItem.getText());
    info.setItemName(selectJmxMasterInfo.getName());
    info.setMeasure(selectJmxMasterInfo.getMeasure());
    String managerName = this.getManagerName();
    MonitorSettingEndpointWrapper wrapper = MonitorSettingEndpointWrapper.getWrapper(managerName);
    String[] args = { info.getMonitorId(), managerName };
    if (!this.updateFlg) {
        // ???
        try {
            result = wrapper.addMonitor(info);

            if (result) {
                MessageDialog.openInformation(null, Messages.getString("successful"),
                        Messages.getString("message.monitor.33", args));
            } else {
                MessageDialog.openError(null, Messages.getString("failed"),
                        Messages.getString("message.monitor.34", args));
            }
        } catch (MonitorDuplicate_Exception e) {
            // ID????????
            MessageDialog.openInformation(null, Messages.getString("message"),
                    Messages.getString("message.monitor.53", args));

        } catch (Exception e) {
            String errMessage = "";
            if (e instanceof InvalidRole_Exception) {
                // ??????
                MessageDialog.openInformation(null, Messages.getString("message"),
                        Messages.getString("message.accesscontrol.16"));
            } else {
                errMessage = ", " + HinemosMessage.replace(e.getMessage());
            }

            MessageDialog.openError(null, Messages.getString("failed"),
                    Messages.getString("message.monitor.34", args) + errMessage);
        }
    } else {
        // ??
        String errMessage = "";
        try {
            result = wrapper.modifyMonitor(info);
        } catch (InvalidRole_Exception e) {
            // ??????
            MessageDialog.openInformation(null, Messages.getString("message"),
                    Messages.getString("message.accesscontrol.16"));
        } catch (Exception e) {
            errMessage = ", " + HinemosMessage.replace(e.getMessage());
        }

        if (result) {
            MessageDialog.openInformation(null, Messages.getString("successful"),
                    Messages.getString("message.monitor.35", args));
        } else {
            MessageDialog.openError(null, Messages.getString("failed"),
                    Messages.getString("message.monitor.36", args) + errMessage);
        }
    }
    return result;
}

From source file:com.clustercontrol.jobmanagement.action.GetJobKick.java

License:Open Source License

/**
 * []???<BR>//from w  w  w  .ja va2 s.  c o m
 *
 * @param managerName ???
 * @param jobkickId ID
 * @return []
 */
public static JobSchedule getJobSchedule(String managerName, String jobkickId) {
    JobSchedule jobSchedule = null;
    try {
        JobEndpointWrapper wrapper = JobEndpointWrapper.getWrapper(managerName);
        jobSchedule = wrapper.getJobSchedule(jobkickId);
    } catch (Exception e) {
        // ?
        m_log.warn("getJobSchedule(), " + e.getMessage(), e);
        MessageDialog.openInformation(null, Messages.getString("message"),
                Messages.getString("message.hinemos.failure.unexpected") + ", "
                        + HinemosMessage.replace(e.getMessage()));
    }
    return jobSchedule;
}

From source file:com.clustercontrol.jobmanagement.action.GetJobKick.java

License:Open Source License

/**
 * [?]???<BR>// w  w  w .j a va2s  . c o m
 *
 * @param jobkickId ID
 * @return [?]
 */
public static JobFileCheck getJobFileCheck(String managerName, String jobkickId) {
    JobFileCheck jobFileCheck = null;
    try {
        JobEndpointWrapper wrapper = JobEndpointWrapper.getWrapper(managerName);
        jobFileCheck = wrapper.getJobFileCheck(jobkickId);
    } catch (Exception e) {
        // ?
        m_log.warn("getJobFileCheck(), " + e.getMessage(), e);
        MessageDialog.openInformation(null, Messages.getString("message"),
                Messages.getString("message.hinemos.failure.unexpected") + ", "
                        + HinemosMessage.replace(e.getMessage()));
    }
    return jobFileCheck;
}

From source file:com.clustercontrol.jobmanagement.action.GetJobKick.java

License:Open Source License

/**
 * []???<BR>/* w  ww  . j a  va2 s . c  om*/
 *
 * @param jobkickId ID
 * @return []
 */
public static JobKick getJobManual(String managerName, String jobkickId) {
    JobKick jobKick = null;
    try {
        JobEndpointWrapper wrapper = JobEndpointWrapper.getWrapper(managerName);
        jobKick = wrapper.getJobManual(jobkickId);
    } catch (Exception e) {
        // ?
        m_log.warn("getJobManual(), " + e.getMessage(), e);
        MessageDialog.openInformation(null, Messages.getString("message"),
                Messages.getString("message.hinemos.failure.unexpected") + ", "
                        + HinemosMessage.replace(e.getMessage()));
    }
    return jobKick;
}

From source file:com.clustercontrol.jobmanagement.action.GetJobKick.java

License:Open Source License

/**
 * ???<BR>//from   w  w w.  j a v a 2  s  .  c o m
 *
 * @param jobkickId ID
 * @return 
 */
public static JobKick getJobKick(String managerName, String jobkickId) {
    JobKick jobKick = null;
    try {
        JobEndpointWrapper wrapper = JobEndpointWrapper.getWrapper(managerName);
        jobKick = wrapper.getJobKick(jobkickId);
    } catch (Exception e) {
        // ?
        m_log.warn("getJobKick(), " + e.getMessage(), e);
        MessageDialog.openInformation(null, Messages.getString("message"),
                Messages.getString("message.hinemos.failure.unexpected") + ", "
                        + HinemosMessage.replace(e.getMessage()));
    }
    return jobKick;
}

From source file:com.clustercontrol.jobmanagement.action.OperationJob.java

License:Open Source License

/**
 * ??SessionBean?????//from ww  w.  j a v a2s.  com
 *
 * @param property ??????
 * @return ??
 *
 */
public boolean operationJob(String managerName, Property property) {
    boolean result = false;
    PropertyUtil.deletePropertyDefine(property);

    try {
        JobEndpointWrapper wrapper = JobEndpointWrapper.getWrapper(managerName);
        wrapper.operationJob(JobPropertyUtil.property2jobOperation(property));
        result = true;
    } catch (InvalidRole_Exception e) {
        MessageDialog.openInformation(null, Messages.getString("message"),
                Messages.getString("message.accesscontrol.16"));
    } catch (Exception e) {
        if (e.getCause() instanceof NullPointerException) {
            // ??
            MessageDialog.openError(null, Messages.getString("message"), Messages.getString("message.job.21"));
        } else if (e.getCause() instanceof IllegalStateException) {
            // ??
            MessageDialog.openError(null, Messages.getString("message"), Messages.getString("message.job.36"));
        } else {
            // ??
            MessageDialog.openError(null, Messages.getString("message"),
                    Messages.getString("message.job.34") + ", " + HinemosMessage.replace(e.getMessage()));
        }
    }
    return result;
}