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.process.dialog.ProcessCreateDialog.java
License:Open Source License
/** * ?????// w ww . j a va 2 s . com * * @return true?false * * @see com.clustercontrol.dialog.CommonDialog#action() */ @Override protected boolean action() { boolean result = false; MonitorInfo info = this.inputData; String managerName = this.getManagerName(); if (info != null) { String[] args = { info.getMonitorId(), managerName }; MonitorSettingEndpointWrapper wrapper = MonitorSettingEndpointWrapper.getWrapper(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.repository.action.DeleteNodeProperty.java
License:Open Source License
/** * ?????/*from ww w .j a v a2s . c o m*/ * * @param managerName ??? * @param facilityIdList */ public void delete(String managerName, List<String> facilityIdList) { try { RepositoryEndpointWrapper wrapper = RepositoryEndpointWrapper.getWrapper(managerName); wrapper.deleteNode(facilityIdList); // ?? ClientSession.doCheck(); // ?? String[] arg = { managerName }; MessageDialog.openInformation(null, Messages.getString("successful"), Messages.getString("message.repository.8", arg)); } catch (Exception e) { String errMessage = ""; if (e instanceof InvalidRole_Exception) { // ?????? MessageDialog.openInformation(null, Messages.getString("message"), Messages.getString("message.accesscontrol.16")); } else if (e instanceof UsedFacility_Exception) { // ??????? Object[] args = { facilityIdList, HinemosMessage.replace(((UsedFacility_Exception) e).getMessage()) }; MessageDialog.openInformation(null, Messages.getString("message"), Messages.getString("message.repository.28", args)); } else { errMessage = ", " + HinemosMessage.replace(e.getMessage()); } // ? MessageDialog.openError(null, Messages.getString("failed"), Messages.getString("message.repository.9") + errMessage); } return; }
From source file:com.clustercontrol.repository.action.DeleteScopeProperty.java
License:Open Source License
/** * ?????/* www .j a va 2s .c o m*/ * * @param facilityIdList * ID * @return ??????true */ public void delete(String managerName, List<String> facilityIdList) { try { RepositoryEndpointWrapper wrapper = RepositoryEndpointWrapper.getWrapper(managerName); wrapper.deleteScope(facilityIdList); // ?? ClientSession.doCheck(); // ?? Object[] arg = { managerName }; MessageDialog.openInformation(null, Messages.getString("successful"), Messages.getString("message.repository.16", arg)); } catch (Exception e) { String errMessage = ""; if (e instanceof InvalidRole_Exception) { // ?????? MessageDialog.openInformation(null, Messages.getString("message"), Messages.getString("message.accesscontrol.16")); } else if (e instanceof UsedFacility_Exception) { // ??????? Object[] args = { facilityIdList, HinemosMessage.replace(((UsedFacility_Exception) e).getMessage()) }; MessageDialog.openInformation(null, Messages.getString("message"), Messages.getString("message.repository.27", args)); } else { errMessage = ", " + HinemosMessage.replace(e.getMessage()); } // ? MessageDialog.openError(null, Messages.getString("failed"), Messages.getString("message.repository.17") + errMessage); } return; }
From source file:com.clustercontrol.repository.action.GetNodeProperty.java
License:Open Source License
public GetNodeProperty(String managerName, String facilityId, int mode) { this.managerName = managerName; this.facilityId = facilityId; this.mode = mode; try {//from w w w .j a va 2 s. c o m if (managerName == null || managerName.length() == 0 || this.facilityId == null || this.facilityId.length() == 0) { this.nodeInfo = new NodeInfo(); NodePropertyUtil.setDefaultNode(this.nodeInfo); } else { RepositoryEndpointWrapper wrapper = RepositoryEndpointWrapper.getWrapper(managerName); this.nodeInfo = wrapper.getNode(this.facilityId); } } catch (InvalidRole_Exception e) { // ?????? MessageDialog.openInformation(null, Messages.getString("message"), Messages.getString("message.accesscontrol.16")); } catch (FacilityNotFound_Exception e) { // FIXME // ??????? // ??? e.printStackTrace(); m_log.warn("getProperty(), " + e.getMessage(), e); } catch (Exception e) { m_log.warn("getProperty(), " + e.getMessage(), e); MessageDialog.openError(null, Messages.getString("failed"), Messages.getString("message.hinemos.failure.unexpected") + ", " + HinemosMessage.replace(e.getMessage())); } }
From source file:com.clustercontrol.repository.composite.AgentListComposite.java
License:Open Source License
/** * ????// w w w . j a va 2 s. c o m * <p> * * ???????????????? ??? <br> * ????????????? */ @Override public void update() { // ? List<AgentStatusInfo> list = null; ArrayList<Object> listInput = new ArrayList<Object>(); Map<String, String> errorMsgs = new ConcurrentHashMap<>(); this.statuslabel.setText(""); int cnt = 0; for (String managerName : EndpointManager.getActiveManagerSet()) { try { RepositoryEndpointWrapper wrapper = RepositoryEndpointWrapper.getWrapper(managerName); list = wrapper.getAgentStatusList(); } catch (InvalidRole_Exception e) { // ?????? MessageDialog.openInformation(null, Messages.getString("message"), Messages.getString("message.accesscontrol.16")); errorMsgs.put(managerName, Messages.getString("message.accesscontrol.16")); } catch (Exception e) { m_log.warn("update(), " + e.getMessage(), e); errorMsgs.put(managerName, Messages.getString("message.hinemos.failure.unexpected") + ", " + HinemosMessage.replace(e.getMessage())); } if (list == null) { list = new ArrayList<AgentStatusInfo>(); } for (AgentStatusInfo node : list) { ArrayList<Object> aList = new ArrayList<Object>(); aList.add(managerName); aList.add(node.getFacilityId()); aList.add(node.getFacilityName()); aList.add(new Date(node.getStartupTime())); aList.add(new Date(node.getLastLogin())); aList.add(node.getMultiplicity()); if (node.isNewFlag()) { aList.add(Messages.getString("done")); } else { aList.add(Messages.getString("not.yet")); } aList.add(null); listInput.add(aList); cnt++; } } // if (0 < errorMsgs.size()) { StringBuffer msg = new StringBuffer(); for (Map.Entry<String, String> e : errorMsgs.entrySet()) { String eol = System.getProperty("line.separator"); msg.append("MANAGER[" + e.getKey() + "] : " + eol + " " + e.getValue() + eol + eol); } MessageDialog.openInformation(null, Messages.getString("message"), msg.toString()); } // this.tableViewer.setInput(listInput); // ? String[] args = { Integer.toString(cnt) }; String message = null; message = Messages.getString("records", args); this.totalLabel.setText(message); }
From source file:com.clustercontrol.repository.composite.NodeFilterComposite.java
License:Open Source License
/** * ????//from w w w. ja v a 2 s . co m * <p> * * ???????????????? ??? <br> * ????????????? */ @Override public void update() { // ? List<NodeInfo> list = null; Map<String, String> errorMsgs = new ConcurrentHashMap<>(); if (assignFlag) { List<NodeInfo> allList = null; // ? // ? if (this.condition == null) { this.statuslabel.setText(""); allList = new GetNodeList().getAll(this.managerName); } else { this.statuslabel.setText(Messages.getString("filtered.list")); allList = new GetNodeList().get(this.managerName, this.condition); } // ???????? try { RepositoryEndpointWrapper wrapper = RepositoryEndpointWrapper.getWrapper(this.managerName); List<NodeInfo> assignedList = wrapper.getNodeList(this.scopeId, 1); list = new ArrayList<NodeInfo>(); for (NodeInfo node : allList) { boolean flag = true; for (NodeInfo assignedNode : assignedList) { if (node.getFacilityId().equals(assignedNode.getFacilityId())) { flag = false; break; } } if (flag) { list.add(node); } } } catch (InvalidRole_Exception e) { errorMsgs.put(managerName, Messages.getString("message.accesscontrol.16")); throw new InternalError(e.getMessage()); } catch (Exception e) { m_log.warn("getAll(), " + e.getMessage(), e); errorMsgs.put(managerName, Messages.getString("message.hinemos.failure.unexpected") + ", " + HinemosMessage.replace(e.getMessage())); throw new InternalError(e.getMessage()); } } else { // ? this.statuslabel.setText(""); list = new ArrayList<NodeInfo>(); RepositoryEndpointWrapper wrapper = RepositoryEndpointWrapper.getWrapper(this.managerName); try { // RepositoryControllerBean.ONE_LEVEL = 1 list = wrapper.getNodeList(this.scopeId, 1); } catch (InvalidRole_Exception e) { // ?????? errorMsgs.put(managerName, Messages.getString("message.accesscontrol.16")); throw new InternalError(e.getMessage()); } catch (Exception e) { m_log.warn("update(), " + e.getMessage(), e); errorMsgs.put(managerName, Messages.getString("message.hinemos.failure.unexpected") + ", " + HinemosMessage.replace(e.getMessage())); throw new InternalError(e.getMessage()); } } // if (0 < errorMsgs.size()) { StringBuffer msg = new StringBuffer(); for (Map.Entry<String, String> e : errorMsgs.entrySet()) { String eol = System.getProperty("line.separator"); msg.append("MANAGER[" + e.getKey() + "] : " + eol + " " + e.getValue() + eol + eol); } MessageDialog.openInformation(null, Messages.getString("message"), msg.toString()); } ArrayList<Object> listInput = new ArrayList<Object>(); for (NodeInfo node : list) { ArrayList<Object> a = new ArrayList<Object>(); a.add(managerName); a.add(node.getFacilityId()); a.add(node.getFacilityName()); a.add(node.getPlatformFamily()); if (node.getIpAddressVersion() == 6) { a.add(node.getIpAddressV6()); } else { a.add(node.getIpAddressV4()); } a.add(node.getDescription()); a.add(node.getOwnerRoleId()); a.add(null); listInput.add(a); } // this.tableViewer.setInput(listInput); // ? String[] args = { String.valueOf(list.size()) }; String message = null; if (assignFlag) { if (this.condition == null) { message = Messages.getString("records", args); } else { message = Messages.getString("filtered.records", args); } } else { message = Messages.getString("records", args); } this.totalLabel.setText(message); }
From source file:com.clustercontrol.repository.composite.NodeScopeComposite.java
License:Open Source License
/** * ??????/* ww w. j a v a 2 s. c om*/ * * @param facilityId * ID * @param facilityName * ?? */ public void update(String managerName, String facilityId, String facilityName) { List<String> data = null; if (facilityId != null) { try { RepositoryEndpointWrapper wrapper = RepositoryEndpointWrapper.getWrapper(managerName); data = wrapper.getNodeScopeList(facilityId); } catch (InvalidRole_Exception e) { // ?????? MessageDialog.openInformation(null, Messages.getString("message"), Messages.getString("message.accesscontrol.16")); } catch (Exception e) { m_log.warn("update(), " + e.getMessage(), e); MessageDialog.openError(null, Messages.getString("failed"), Messages.getString("message.hinemos.failure.unexpected") + ", " + HinemosMessage.replace(e.getMessage())); } this.facilityIdLabel.setText(Messages.getString("facility.id") + " : " + facilityId); } else { this.facilityIdLabel.setText(Messages.getString("facility.id") + " : "); } if (facilityName != null) { this.facilityNameLabel.setText(Messages.getString("facility.name") + " : " + facilityName); } else { this.facilityNameLabel.setText(Messages.getString("facility.name") + " : "); } if (data == null) { data = new ArrayList<String>(); } ArrayList<ArrayList<String>> dataInput = new ArrayList<ArrayList<String>>(); for (String path : data) { ArrayList<String> a = new ArrayList<String>(); a.add(HinemosMessage.replace(path)); a.add(null); dataInput.add(a); } this.tableViewer.setInput(dataInput); }
From source file:com.clustercontrol.repository.dialog.NodeAssignDialog.java
License:Open Source License
/** * OK?????//from w w w . j a v a 2 s. com */ @Override protected void okPressed() { // ?? StructuredSelection selection = (StructuredSelection) this.nodeList.getTableViewer().getSelection(); Object[] items = selection.toArray(); if (items != null) { int size = items.length; this.filterItems = new ArrayList<String>(); for (int i = 0; i < size; i++) { this.filterItems.add((String) ((ArrayList<?>) items[i]).get(1)); } } // try { RepositoryEndpointWrapper wrapper = RepositoryEndpointWrapper.getWrapper(this.managerName); wrapper.assignNodeScope(facilityId, this.filterItems); // ?? ClientSession.doCheck(); // ?? Object[] arg = { this.managerName }; MessageDialog.openInformation(null, Messages.getString("successful"), Messages.getString("message.repository.6", arg)); super.okPressed(); } 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.repository.7") + errMessage); } }
From source file:com.clustercontrol.repository.dialog.NodeCreateDialog.java
License:Open Source License
/** * ?????/* ww w .j av a 2 s. c o m*/ * * @return true?false * * @see com.clustercontrol.dialog.CommonDialog#action() */ @Override protected boolean action() { boolean result = false; Property property = this.getInputData(); if (property != null) { String errMessage = ""; RepositoryEndpointWrapper wrapper = RepositoryEndpointWrapper .getWrapper(this.m_managerComposite.getText()); Object[] arg = { this.m_managerComposite.getText() }; if (!this.isModifyDialog()) { // ??? Property copy = PropertyUtil.copy(property); PropertyUtil.deletePropertyDefine(copy); try { nodeInfo = NodePropertyUtil.property2node(copy); if (m_ownerRoleId.getText().length() > 0) { nodeInfo.setOwnerRoleId(m_ownerRoleId.getText()); } wrapper.addNode(nodeInfo); // ?? ClientSession.doCheck(); MessageDialog.openInformation(null, Messages.getString("successful"), Messages.getString("message.repository.4", arg)); result = true; } catch (FacilityDuplicate_Exception e) { // ID???????? //ID? ArrayList<?> values = PropertyUtil.getPropertyValue(copy, NodeConstant.FACILITY_ID); String args[] = { (String) values.get(0) }; MessageDialog.openInformation(null, Messages.getString("message"), Messages.getString("message.repository.26", 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()); if (!(e instanceof InvalidSetting_Exception)) { m_log.warn("action()", e); } else { m_log.info("action()" + errMessage); } } MessageDialog.openError(null, Messages.getString("failed"), Messages.getString("message.repository.5") + errMessage); } } else { // ?? Property copy = PropertyUtil.copy(property); PropertyUtil.deletePropertyDefine(copy); try { nodeInfo = NodePropertyUtil.property2node(copy); if (m_ownerRoleId.getText().length() > 0) { nodeInfo.setOwnerRoleId(m_ownerRoleId.getText()); } wrapper.modifyNode(nodeInfo); // ?? ClientSession.doCheck(); MessageDialog.openInformation(null, Messages.getString("successful"), Messages.getString("message.repository.10", arg)); result = true; } 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.repository.11") + errMessage); } } } return result; }
From source file:com.clustercontrol.repository.dialog.NodeCreateDialog.java
License:Open Source License
/** *SNMP??????<BR>//from www . j ava2s . c o m * * @param pollingData SNMP?????IP?? * @param mode ?? * @return ? */ private static NodeInfoDeviceSearch getNodeInfoBySNMP(String managerName, String ipAddress, int port, String community, int version, int mode, String facilityID, String securityLevel, String user, String authPassword, String privPassword, String authProtocol, String privProtocol) { try { RepositoryEndpointWrapper wrapper = RepositoryEndpointWrapper.getWrapper(managerName); NodeInfoDeviceSearch nodeSnmp = wrapper.getNodePropertyBySNMP(ipAddress, port, community, version, facilityID, securityLevel, user, authPassword, privPassword, authProtocol, privProtocol); NodeInfo nodeInfo = nodeSnmp.getNodeInfo(); m_log.info("snmp2 " + nodeInfo.getNodeFilesystemInfo().size()); NodePropertyUtil.setDefaultNode(nodeInfo); return nodeSnmp; } catch (InvalidRole_Exception e) { MessageDialog.openInformation(null, Messages.getString("message"), Messages.getString("message.accesscontrol.16")); } catch (SnmpResponseError_Exception e) { MessageDialog.openWarning(null, Messages.getString("message"), Messages.getString("message.snmp.12")); } catch (Exception e) { m_log.warn("GetNodePropertyBySNMP(), " + HinemosMessage.replace(e.getMessage()), e); MessageDialog.openError(null, Messages.getString("failed"), Messages.getString("message.hinemos.failure.unexpected") + ", " + HinemosMessage.replace(e.getMessage())); } return null; }