List of usage examples for org.eclipse.jface.dialogs MessageDialog openInformation
public static void openInformation(Shell parent, String title, String message)
From source file:com.clustercontrol.notify.action.GetNotify.java
License:Open Source License
/** * ???<BR>//from www . j ava 2 s. com * ??SessionBean???? * * @param manegerName ??? * @param notifyId ??ID * @return * */ public NotifyInfo getNotify(String managerName, String notifyId) { NotifyInfo info = null; try { NotifyEndpointWrapper wrapper = NotifyEndpointWrapper.getWrapper(managerName); info = wrapper.getNotify(notifyId); } catch (InvalidRole_Exception e) { MessageDialog.openInformation(null, Messages.getString("message"), Messages.getString("message.accesscontrol.16")); } catch (Exception e) { m_log.warn("useCheck(), " + HinemosMessage.replace(e.getMessage()), e); MessageDialog.openError(null, Messages.getString("failed"), Messages.getString("message.hinemos.failure.unexpected") + ", " + HinemosMessage.replace(e.getMessage())); } return info; }
From source file:com.clustercontrol.notify.action.GetNotify.java
License:Open Source License
/** * ???<BR>//from ww w . j a v a 2 s . co m * ??SessionBean???? * * @return */ private Map<String, List<NotifyInfo>> getNotifyList() { Map<String, List<NotifyInfo>> dispDataMap = new ConcurrentHashMap<>(); List<NotifyInfo> records = null; for (String managerName : EndpointManager.getActiveManagerSet()) { try { NotifyEndpointWrapper wrapper = NotifyEndpointWrapper.getWrapper(managerName); records = wrapper.getNotifyList(); dispDataMap.put(managerName, records); } catch (InvalidRole_Exception e) { MessageDialog.openInformation(null, Messages.getString("message"), Messages.getString("message.accesscontrol.16")); } catch (Exception e) { m_log.warn("getNotifyList(), " + HinemosMessage.replace(e.getMessage()), e); MessageDialog.openError(null, Messages.getString("error"), Messages.getString("message.hinemos.failure.unexpected") + ", " + HinemosMessage.replace(e.getMessage())); } } return dispDataMap; }
From source file:com.clustercontrol.notify.action.ModifyNotify.java
License:Open Source License
/** * ???<BR>// w w w. ja va 2 s. c om * ??SessionBean???? * * @param managerName ??? * @param info ? * @return ??????<code> true </code> */ public boolean modify(String managerName, NotifyInfo info) { boolean result = false; String[] args = { info.getNotifyId(), managerName }; try { NotifyEndpointWrapper wrapper = NotifyEndpointWrapper.getWrapper(managerName); result = wrapper.modifyNotify(info); MessageDialog.openInformation(null, Messages.getString("successful"), Messages.getString("message.notify.3", 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.notify.4", args) + errMessage); } return result; }
From source file:com.clustercontrol.notify.mail.action.DeleteMailTemplate.java
License:Open Source License
/** * ???<BR>//from w ww . ja v a 2 s. c om * ??SessionBean???? * * @param managerName ??? * @param mailTemplateId ?ID * @return ??????<code> true </code> * */ public boolean delete(String managerName, String mailTemplateId) { boolean result = false; String[] args = { mailTemplateId, managerName }; try { MailTemplateEndpointWrapper wrapper = MailTemplateEndpointWrapper.getWrapper(managerName); result = wrapper.deleteMailTemplate(mailTemplateId); MessageDialog.openInformation(null, Messages.getString("successful"), Messages.getString("message.notify.mail.5", args)); } catch (InvalidRole_Exception e) { MessageDialog.openError(null, Messages.getString("failed"), Messages.getString("message.notify.mail.11", args)); } catch (Exception e) { m_log.warn("delete(), " + e.getMessage()); MessageDialog.openError(null, Messages.getString("failed"), Messages.getString("message.notify.mail.6", args) + " " + HinemosMessage.replace(e.getMessage())); } return result; }
From source file:com.clustercontrol.notify.mail.action.GetMailTemplate.java
License:Open Source License
/** * ???<BR>/*from w w w .j a v a2 s . co m*/ * ??SessionBean???? * * @return * */ public Map<String, List<MailTemplateInfo>> getMailTemplateList() { Map<String, List<MailTemplateInfo>> dispDataMap = new ConcurrentHashMap<>(); List<MailTemplateInfo> records = null; for (String managerName : EndpointManager.getActiveManagerSet()) { try { MailTemplateEndpointWrapper wrapper = MailTemplateEndpointWrapper.getWrapper(managerName); records = wrapper.getMailTemplateList(); dispDataMap.put(managerName, records); } catch (InvalidRole_Exception e) { MessageDialog.openInformation(null, Messages.getString("message"), Messages.getString("message.accesscontrol.16")); } catch (Exception e) { m_log.warn("getNotifyListByOwnerRole(), " + e.getMessage(), e); MessageDialog.openError(null, Messages.getString("failed"), Messages.getString("message.hinemos.failure.unexpected") + ", " + HinemosMessage.replace(e.getMessage())); } } return dispDataMap; }
From source file:com.clustercontrol.notify.mail.action.GetMailTemplate.java
License:Open Source License
/** * ID???????<BR>/*from w w w. ja va 2s. c om*/ * ??SessionBean???? * * @param managerName * @param ownerRoleId * @return * */ public List<MailTemplateInfo> getMailTemplateListByOwnerRole(String managerName, String ownerRoleId) { List<MailTemplateInfo> records = null; try { MailTemplateEndpointWrapper wrapper = MailTemplateEndpointWrapper.getWrapper(managerName); records = wrapper.getMailTemplateListByOwnerRole(ownerRoleId); } catch (InvalidRole_Exception e) { MessageDialog.openInformation(null, Messages.getString("message"), Messages.getString("message.accesscontrol.16")); } catch (Exception e) { m_log.warn("getMailTemplateListByOwnerRole(), " + e.getMessage(), e); MessageDialog.openError(null, Messages.getString("failed"), Messages.getString("message.hinemos.failure.unexpected") + ", " + HinemosMessage.replace(e.getMessage())); } return records; }
From source file:com.clustercontrol.notify.mail.composite.MailTemplateIdListComposite.java
License:Open Source License
/** * ????<BR>//www. ja va2s. co m * ID???ID????? * * @param ownerRoleId */ public void update(String ownerRoleId) { // ? this.m_comboMailTemplateId.removeAll(); // this.m_comboMailTemplateId.add(""); // ? List<String> list = null; try { MailTemplateEndpointWrapper wrapper = MailTemplateEndpointWrapper.getWrapper(this.managerName); List<MailTemplateInfo> listTmp = wrapper.getMailTemplateListByOwnerRole(ownerRoleId); list = new ArrayList<String>(); for (MailTemplateInfo info : listTmp) { list.add(info.getMailTemplateId()); } } catch (InvalidRole_Exception e) { MessageDialog.openInformation(null, Messages.getString("message"), Messages.getString("message.accesscontrol.16")); } catch (Exception e) { m_log.warn("update() getMailTemplateList, " + e.getMessage(), e); MessageDialog.openError(null, Messages.getString("failed"), Messages.getString("message.hinemos.failure.unexpected") + ", " + HinemosMessage.replace(e.getMessage())); } if (list != null) { // ID for (int index = 0; index < list.size(); index++) { this.m_comboMailTemplateId.add(list.get(index)); } } }
From source file:com.clustercontrol.notify.mail.dialog.MailTemplateCreateDialog.java
License:Open Source License
/** * ????/*from ww w .j a va2s.c om*/ * * @param parent ?? * * @see com.clustercontrol.notify.mail.action.GetMailTemplate#getMailTemplate(String) * @see #setInputData(MailTemplateInfoData) */ @Override protected void customizeDialog(Composite parent) { Shell shell = this.getShell(); // shell.setText(Messages.getString("dialog.mail.template.create.modify")); // ???? Label label = null; // ???? GridData gridData = null; // GridLayout layout = new GridLayout(1, true); layout.marginWidth = 10; layout.marginHeight = 10; layout.numColumns = 15; parent.setLayout(layout); /* * ? */ label = new Label(parent, SWT.LEFT); WidgetTestUtil.setTestId(this, "manager", label); gridData = new GridData(); gridData.horizontalSpan = WIDTH_LABEL; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; label.setLayoutData(gridData); label.setText(Messages.getString("facility.manager") + " : "); if (this.mode == PropertyDefineConstant.MODE_MODIFY || this.mode == PropertyDefineConstant.MODE_SHOW) { this.m_managerComposite = new ManagerListComposite(parent, SWT.NONE, false); } else { this.m_managerComposite = new ManagerListComposite(parent, SWT.NONE, true); } WidgetTestUtil.setTestId(this, "managerComposite", m_managerComposite); gridData = new GridData(); gridData.horizontalSpan = WIDTH_TEXT; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; this.m_managerComposite.setLayoutData(gridData); this.m_managerComposite.setText(this.managerName); if (this.mode != PropertyDefineConstant.MODE_MODIFY && this.mode != PropertyDefineConstant.MODE_SHOW) { this.m_managerComposite.getComboManagerName().addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { String managerName = m_managerComposite.getText(); m_ownerRoleId.createRoleIdList(managerName); } }); } /* * ID */ // label = new Label(parent, SWT.NONE); WidgetTestUtil.setTestId(this, "mailtempateid", label); gridData = new GridData(); gridData.horizontalSpan = WIDTH_LABEL; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; label.setLayoutData(gridData); label.setText(Messages.getString("mail.template.id") + " : "); // this.textMailTemplateId = new Text(parent, SWT.BORDER | SWT.LEFT); WidgetTestUtil.setTestId(this, "id", textMailTemplateId); gridData = new GridData(); gridData.horizontalSpan = WIDTH_TEXT; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; this.textMailTemplateId.setLayoutData(gridData); if (this.mode == PropertyDefineConstant.MODE_SHOW || this.mode == PropertyDefineConstant.MODE_MODIFY) { this.textMailTemplateId.setEnabled(false); } this.textMailTemplateId.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent arg0) { update(); } }); /* * */ // label = new Label(parent, SWT.NONE); WidgetTestUtil.setTestId(this, "description", label); gridData = new GridData(); gridData.horizontalSpan = WIDTH_LABEL; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; label.setLayoutData(gridData); label.setText(Messages.getString("description") + " : "); // this.textDescription = new Text(parent, SWT.BORDER | SWT.LEFT); WidgetTestUtil.setTestId(this, "description", textDescription); gridData = new GridData(); gridData.horizontalSpan = WIDTH_TEXT; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; this.textDescription.setLayoutData(gridData); /* * ID */ Label labelRoleId = new Label(parent, SWT.LEFT); WidgetTestUtil.setTestId(this, "roleid", labelRoleId); gridData = new GridData(); gridData.horizontalSpan = WIDTH_LABEL; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; labelRoleId.setLayoutData(gridData); labelRoleId.setText(Messages.getString("owner.role.id") + " : "); if (this.mode == PropertyDefineConstant.MODE_ADD) { this.m_ownerRoleId = new RoleIdListComposite(parent, SWT.NONE, managerName, true, Mode.OWNER_ROLE); } else { this.m_ownerRoleId = new RoleIdListComposite(parent, SWT.NONE, managerName, false, Mode.OWNER_ROLE); } WidgetTestUtil.setTestId(this, "ownerroleid", m_ownerRoleId); gridData = new GridData(); gridData.horizontalSpan = WIDTH_TEXT; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; m_ownerRoleId.setLayoutData(gridData); /* * */ /* * */ Group groupMailTemplate = new Group(parent, SWT.NONE); WidgetTestUtil.setTestId(this, "mailtemplate", groupMailTemplate); layout = new GridLayout(1, true); layout.marginWidth = 10; layout.marginHeight = 10; layout.numColumns = 15; groupMailTemplate.setLayout(layout); gridData = new GridData(); gridData.horizontalSpan = 15; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; groupMailTemplate.setLayoutData(gridData); groupMailTemplate.setText(Messages.getString("mail.template.setting")); /* * ?? */ // label = new Label(groupMailTemplate, SWT.NONE); WidgetTestUtil.setTestId(this, "subject", label); gridData = new GridData(); gridData.horizontalSpan = 2; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; label.setLayoutData(gridData); label.setText(Messages.getString("subject") + " : "); // this.textSubject = new TextWithParameterComposite(groupMailTemplate, SWT.BORDER | SWT.LEFT); WidgetTestUtil.setTestId(this, "subject", textSubject); gridData = new GridData(); gridData.horizontalSpan = 13; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; this.textSubject.setLayoutData(gridData); this.textSubject.setToolTipText(Messages.getString("notify.parameter.tooltip")); this.textSubject.setColor(new Color(groupMailTemplate.getDisplay(), new RGB(0, 0, 255))); this.textSubject.setInputUpper(DataRangeConstant.VARCHAR_256); this.textSubject.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent arg0) { update(); } }); /* * */ // label = new Label(groupMailTemplate, SWT.NONE); WidgetTestUtil.setTestId(this, "repositorybody", label); gridData = new GridData(); gridData.horizontalSpan = WIDTH; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; label.setLayoutData(gridData); label.setText(Messages.getString("response.body") + " : "); // this.textBody = new TextWithParameterComposite(groupMailTemplate, SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.LEFT); WidgetTestUtil.setTestId(this, "body", textBody); gridData = new GridData(); gridData.horizontalSpan = WIDTH; gridData.horizontalAlignment = GridData.FILL; gridData.verticalSpan = 50; gridData.verticalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; gridData.grabExcessVerticalSpace = true; this.textBody.setLayoutData(gridData); this.textBody.setToolTipText(Messages.getString("notify.parameter.tooltip")); this.textBody.setColor(new Color(groupMailTemplate.getDisplay(), new RGB(0, 0, 255))); // ?? Label line = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL); WidgetTestUtil.setTestId(this, "line", line); gridData = new GridData(); gridData.horizontalSpan = 15; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; line.setLayoutData(gridData); // ? // ???????????????????? shell.pack(); shell.setSize(new Point(550, shell.getSize().y)); // ?? Display display = shell.getDisplay(); shell.setLocation((display.getBounds().width - shell.getSize().x) / 2, (display.getBounds().height - shell.getSize().y) / 2); // ID??????????? MailTemplateInfo info = null; if (this.mailTemplateId != null) { try { MailTemplateEndpointWrapper wrapper = MailTemplateEndpointWrapper.getWrapper(this.managerName); info = wrapper.getMailTemplateInfo(this.mailTemplateId); } catch (InvalidRole_Exception e) { MessageDialog.openInformation(null, Messages.getString("message"), Messages.getString("message.accesscontrol.16")); return; } catch (Exception e) { m_log.warn("customizeDialog() getMailTemplateInfo, " + HinemosMessage.replace(e.getMessage()), e); MessageDialog.openError(null, Messages.getString("failed"), Messages.getString("message.hinemos.failure.unexpected") + ", " + HinemosMessage.replace(e.getMessage())); return; } } else { info = new MailTemplateInfo(); } this.setInputData(info); }
From source file:com.clustercontrol.notify.mail.dialog.MailTemplateCreateDialog.java
License:Open Source License
/** * ?????// w w w . j a va 2s . c o m * * @return true?false * * @see com.clustercontrol.dialog.CommonDialog#action() */ @Override protected boolean action() { boolean result = false; MailTemplateInfo info = this.getInputData(); if (info != null) { String errMessage = ""; String managerName = m_managerComposite.getText(); String[] args = { info.getMailTemplateId(), managerName }; MailTemplateEndpointWrapper wrapper = MailTemplateEndpointWrapper.getWrapper(managerName); if (this.mode == PropertyDefineConstant.MODE_ADD) { // ??? try { result = wrapper.addMailTemplate(info); MessageDialog.openInformation(null, Messages.getString("successful"), Messages.getString("message.notify.mail.1", args)); } catch (MailTemplateDuplicate_Exception e) { // ID???????? MessageDialog.openInformation(null, Messages.getString("message"), Messages.getString("message.notify.mail.10", args)); } catch (Exception e) { 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.notify.mail.2", args) + errMessage); } } else if (this.mode == PropertyDefineConstant.MODE_MODIFY) { // ?? try { result = wrapper.modifyMailTemplate(info); MessageDialog.openInformation(null, Messages.getString("successful"), Messages.getString("message.notify.mail.3", args)); } catch (Exception e) { 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.notify.mail.4", args) + errMessage); } } } return result; }
From source file:com.clustercontrol.notify.view.action.NotifyDisableAction.java
License:Open Source License
/** * /*from w w w . j av a2 s. co m*/ */ @Override public Object execute(ExecutionEvent event) throws ExecutionException { // ??? this.viewPart = HandlerUtil.getActivePart(event); NotifyListView view = null; try { view = (NotifyListView) this.viewPart.getAdapter(NotifyListView.class); } catch (Exception e) { m_log.info("execute " + e.getMessage()); return null; } if (view == null) { m_log.info("execute: view is null"); return null; } NotifyListComposite composite = (NotifyListComposite) view.getListComposite(); StructuredSelection selection = (StructuredSelection) composite.getTableViewer().getSelection(); Object[] objs = selection.toArray(); // 1???????? if (objs.length == 0) { MessageDialog.openConfirm(null, Messages.getString("confirmed"), Messages.getString("message.notify.8")); return null; } // 1?????? String notifyId = null; String[] args; StringBuffer targetList = new StringBuffer(); StringBuffer successList = new StringBuffer(); StringBuffer failureList = new StringBuffer(); Map<String, List<String>> disableMap = new ConcurrentHashMap<String, List<String>>(); for (int i = 0; i < objs.length; i++) { String managerName = (String) ((ArrayList<?>) objs[i]).get(NotifyTableDefineNoCheckBox.MANAGER_NAME); disableMap.put(managerName, new ArrayList<String>()); } for (int i = 0; i < objs.length; i++) { notifyId = (String) ((ArrayList<?>) objs[i]).get(NotifyTableDefineNoCheckBox.NOTIFY_ID); String managerName = (String) ((ArrayList<?>) objs[i]).get(NotifyTableDefineNoCheckBox.MANAGER_NAME); disableMap.get(managerName).add(notifyId); targetList.append(notifyId + "\n"); } // ?(NG) args = new String[] { targetList.toString() }; if (!MessageDialog.openConfirm(null, Messages.getString("confirmed"), Messages.getString("message.notify.37", args))) { return null; } boolean hasRole = true; // for (Map.Entry<String, List<String>> map : disableMap.entrySet()) { String managerName = map.getKey(); NotifyEndpointWrapper wrapper = NotifyEndpointWrapper.getWrapper(managerName); for (String targetId : map.getValue()) { try { wrapper.setNotifyStatus(targetId, false); successList.append(targetId + "(" + managerName + ")" + "\n"); } catch (InvalidRole_Exception e) { failureList.append(targetId + "\n"); m_log.warn("run() setNotifyStatus targetId=" + targetId + ", " + e.getMessage(), e); hasRole = false; } catch (Exception e) { failureList.append(targetId + "\n"); m_log.warn("run() setNotifyStatus targetId=" + targetId + ", " + e.getMessage(), e); } } } if (!hasRole) { // ???????? MessageDialog.openInformation(null, Messages.getString("message"), Messages.getString("message.accesscontrol.16")); } // ? if (successList.length() != 0) { args = new String[] { successList.toString() }; MessageDialog.openInformation(null, Messages.getString("successful"), Messages.getString("message.notify.38", args)); } // if (failureList.length() != 0) { args = new String[] { failureList.toString() }; MessageDialog.openError(null, Messages.getString("failed"), Messages.getString("message.notify.39", args)); } // ? composite.update(); return null; }