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.repository.dialog.NodeReleaseDialog.java
License:Open Source License
/** * OK?????/*from w w w . ja v a2s . c o m*/ */ @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.releaseNodeScope(facilityId, this.filterItems); // ?? ClientSession.doCheck(); // ?? Object[] arg = { this.managerName }; MessageDialog.openInformation(null, Messages.getString("successful"), Messages.getString("message.repository.12", 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.13") + errMessage); } }
From source file:com.clustercontrol.repository.dialog.ScopeCreateDialog.java
License:Open Source License
/** * ????// w w w . ja v a2 s .co m * * @param parent * ? */ @Override protected void customizeDialog(Composite parent) { Shell shell = this.getShell(); // shell.setText(Messages.getString("dialog.repository.scope.create.modify")); // GridLayout layout = new GridLayout(1, true); layout.marginWidth = 10; layout.marginHeight = 10; parent.setLayout(layout); GridData gridData = new GridData(); /* * ID */ Label labelRoleId = new Label(parent, SWT.LEFT); WidgetTestUtil.setTestId(this, "roleid", labelRoleId); gridData = new GridData(); gridData.horizontalSpan = 1; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; labelRoleId.setLayoutData(gridData); labelRoleId.setText(Messages.getString("owner.role.id") + " : "); if (!this.isModifyDialog()) { this.m_ownerRoleId = new RoleIdListComposite(parent, SWT.NONE, this.managerName, true, Mode.OWNER_ROLE); } else { this.m_ownerRoleId = new RoleIdListComposite(parent, SWT.NONE, this.managerName, false, Mode.OWNER_ROLE); } WidgetTestUtil.setTestId(this, null, m_ownerRoleId); gridData = new GridData(); gridData.horizontalSpan = 1; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; m_ownerRoleId.setLayoutData(gridData); /* * */ // Label label = new Label(parent, SWT.LEFT); gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; gridData.horizontalSpan = 1; label.setLayoutData(gridData); label.setText(Messages.getString("attribute") + " : "); // table = new Tree(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.FULL_SELECTION); WidgetTestUtil.setTestId(this, null, table); gridData = new GridData(); gridData.horizontalAlignment = GridData.FILL; gridData.verticalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; gridData.grabExcessVerticalSpace = true; gridData.horizontalSpan = 1; table.setLayoutData(gridData); table.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { update(); } }); this.propertySheet = new PropertySheet(table); // ??? Property property = null; RepositoryEndpointWrapper wrapper = RepositoryEndpointWrapper.getWrapper(this.managerName); if (this.isModifyDialog) { try { ScopeInfo scopeInfo = wrapper.getScope(this.facilityId); if (scopeInfo == null) throw new HinemosUnknown("ScopeInfo is null, facilityId : " + this.facilityId); // ID? if (scopeInfo.getOwnerRoleId() != null) { m_ownerRoleId.setText(scopeInfo.getOwnerRoleId()); } property = getScopeProperty(scopeInfo, PropertyDefineConstant.MODE_MODIFY); } catch (InvalidRole_Exception e) { // ?????? MessageDialog.openInformation(null, Messages.getString("message"), Messages.getString("message.accesscontrol.16")); } catch (Exception e) { m_log.warn("getScopeProperty(), " + HinemosMessage.replace(e.getMessage()), e); MessageDialog.openError(null, Messages.getString("failed"), Messages.getString("message.hinemos.failure.unexpected") + ", " + HinemosMessage.replace(e.getMessage())); } } else { try { ScopeInfo scopeInfo = wrapper.getScope(null); // ID? if (scopeInfo == null) throw new HinemosUnknown("ScopeInfo is null"); if (scopeInfo.getOwnerRoleId() != null) { m_ownerRoleId.setText(scopeInfo.getOwnerRoleId()); } property = getScopeProperty(scopeInfo, PropertyDefineConstant.MODE_ADD); } catch (InvalidRole_Exception e) { // ?????? MessageDialog.openInformation(null, Messages.getString("message"), Messages.getString("message.accesscontrol.16")); } catch (Exception e) { m_log.warn("getScopeProperty(), " + HinemosMessage.replace(e.getMessage()), e); MessageDialog.openError(null, Messages.getString("failed"), Messages.getString("message.hinemos.failure.unexpected") + ", " + HinemosMessage.replace(e.getMessage())); } } if (property != null) this.propertySheet.setInput(property); // ?? Label line = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL); gridData = new GridData(); gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; gridData.horizontalSpan = 1; line.setLayoutData(gridData); // ?? Display display = shell.getDisplay(); shell.setLocation((display.getBounds().width - shell.getSize().x) / 2, (display.getBounds().height - shell.getSize().y) / 2); // ? this.update(); }
From source file:com.clustercontrol.repository.dialog.ScopeCreateDialog.java
License:Open Source License
/** * ?????//from ww w. j a v a 2s. co 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 = ""; Property copy = PropertyUtil.copy(property); PropertyUtil.deletePropertyDefine(copy); RepositoryEndpointWrapper wrapper = RepositoryEndpointWrapper.getWrapper(this.managerName); Object[] arg = { this.managerName }; if (!this.isModifyDialog()) { // ??? try { ScopeInfo scopeinfo = ScopePropertyUtil.property2scope(copy); if (m_ownerRoleId.getText().length() > 0) { scopeinfo.setOwnerRoleId(m_ownerRoleId.getText()); } wrapper.addScope(parentFacilityId, scopeinfo); // ?? ClientSession.doCheck(); MessageDialog.openInformation(null, Messages.getString("successful"), Messages.getString("message.repository.14", arg)); result = true; } catch (FacilityDuplicate_Exception e) { //ID? ArrayList<?> values = PropertyUtil.getPropertyValue(copy, ScopeConstant.FACILITY_ID); String args[] = { (String) values.get(0) }; // ID???????? 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()); } MessageDialog.openError(null, Messages.getString("failed"), Messages.getString("message.repository.15") + errMessage); } } else { // ?? try { ScopeInfo scopeInfo = ScopePropertyUtil.property2scope(copy); if (m_ownerRoleId.getText().length() > 0) { scopeInfo.setOwnerRoleId(m_ownerRoleId.getText()); } wrapper.modifyScope(scopeInfo); // ?? ClientSession.doCheck(); MessageDialog.openInformation(null, Messages.getString("successful"), Messages.getString("message.repository.18", 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.19") + errMessage); } } } return result; }
From source file:com.clustercontrol.repository.view.action.ProgramExecutionAction.java
License:Open Source License
/** * @see org.eclipse.core.commands.IHandler#execute *//*from w w w. j a v a 2s. c o m*/ @Override public Object execute(ExecutionEvent event) throws ExecutionException { this.viewPart = HandlerUtil.getActivePart(event); // ??????ID? NodeListView view = null; try { view = (NodeListView) this.viewPart.getAdapter(NodeListView.class); } catch (Exception e) { m_log.info("execute " + e.getMessage()); return null; } if (view == null) { m_log.info("execute: view is null"); return null; } StructuredSelection selection = (StructuredSelection) view.getComposite().getTableViewer().getSelection(); List<?> list = (List<?>) selection.getFirstElement(); if (list == null) { return null; } String managerName = (String) list.get(GetNodeListTableDefine.MANAGER_NAME); String facilityId = (String) list.get(GetNodeListTableDefine.FACILITY_ID); if (facilityId == null) { return null; } // ? String execProg = ClusterControlPlugin.getDefault().getPreferenceStore() .getString(RepositoryPreferencePage.P_PROGRAM_EXECUTION); // ?? if (execProg.equals("")) { MessageDialog.openWarning(null, Messages.getString("warning"), Messages.getString("message.repository.49")); return null; } // ???????#????? if (execProg.indexOf("#") != -1) { try { // ???????????? RepositoryEndpointWrapper wrapper = RepositoryEndpointWrapper.getWrapper(managerName); execProg = wrapper.replaceNodeVariable(facilityId, execProg); } catch (InvalidRole_Exception e) { // ?????? MessageDialog.openInformation(null, Messages.getString("message"), Messages.getString("message.accesscontrol.16")); } catch (Exception e) { m_log.warn("run(), " + e.getMessage(), e); MessageDialog.openError(null, Messages.getString("failed"), Messages.getString("message.hinemos.failure.unexpected") + ", " + HinemosMessage.replace(e.getMessage())); } } // ????? String[] args = null; try { String user = System.getProperty("user.name"); args = CommandCreator.createCommand(user, execProg, PlatformType.WINDOWS, false); } catch (HinemosUnknown e) { m_log.warn("run(), " + e.getMessage(), e); MessageDialog.openError(null, Messages.getString("failed"), Messages.getString("message.hinemos.failure.unexpected") + ", " + HinemosMessage.replace(e.getMessage())); } StringBuffer message = new StringBuffer(); for (String arg : args) { message.append(arg + " "); } String messageStr = message.toString(); if (MessageDialog.openConfirm(null, Messages.getString("confirmed"), Messages.getString("message.repository.46", new String[] { messageStr }))) { // ? m_log.debug("program execution start : " + messageStr); try { new CommandExecutor(args).execute(); } catch (Exception e) { MessageDialog.openError(null, Messages.getString("failed"), Messages.getString("message.repository.48") + ", " + HinemosMessage.replace(e.getMessage())); } } return null; }
From source file:com.clustercontrol.snmp.action.GetSnmp.java
License:Open Source License
/** * SNMP???//from w w w . j a va 2 s .c om * * @param monitorId ID * @return SNMP */ public MonitorInfo getSnmp(String managerName, String monitorId) { MonitorInfo info = null; try { MonitorSettingEndpointWrapper wrapper = MonitorSettingEndpointWrapper.getWrapper(managerName); info = wrapper.getMonitor(monitorId); } catch (InvalidRole_Exception e) { // ?????? MessageDialog.openInformation(null, Messages.getString("message"), Messages.getString("message.accesscontrol.16")); } catch (Exception e) { // ? m_log.warn("getSnmp(), " + HinemosMessage.replace(e.getMessage()), e); MessageDialog.openInformation(null, Messages.getString("message"), Messages.getString("message.hinemos.failure.unexpected") + ", " + HinemosMessage.replace(e.getMessage())); } return info; }
From source file:com.clustercontrol.snmptrap.dialog.SnmpTrapCreateDialog.java
License:Open Source License
/** * ????// w ww .j av a 2 s.c o m * * @param parent * ? */ @Override protected void customizeDialog(Composite parent) { Shell shell = this.getShell(); // shell.setText(Messages.getString("dialog.snmptrap.create.modify")); // ???? Label label = null; // ???? GridData gridData = null; // GridLayout layout = new GridLayout(1, true); layout.marginWidth = 10; layout.marginHeight = 10; layout.numColumns = MAX_COLUMN; parent.setLayout(layout); // //SNMP????????????? //true?? m_monitorBasic = new MonitorBasicScopeComposite(parent, SWT.NONE, true, this); gridData = new GridData(); gridData.horizontalSpan = MAX_COLUMN; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; m_monitorBasic.setLayoutData(gridData); if (this.managerName != null) { m_monitorBasic.getManagerListComposite().setText(this.managerName); } /* * ? */ groupRule = new Group(parent, SWT.NONE); WidgetTestUtil.setTestId(this, "rule", groupRule); layout = new GridLayout(1, true); layout.marginWidth = 5; layout.marginHeight = 5; layout.numColumns = MAX_COLUMN; groupRule.setLayout(layout); gridData = new GridData(); gridData.horizontalSpan = MAX_COLUMN; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; groupRule.setLayoutData(gridData); groupRule.setText(Messages.getString("monitor.rule")); m_monitorRule = new MonitorRuleComposite(groupRule, SWT.NONE); gridData = new GridData(); gridData.horizontalSpan = MAX_COLUMN; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; m_monitorRule.setLayoutData(gridData); // ????? this.m_monitorRule.setRunIntervalEnabled(false); /* * */ groupMonitor = new Group(parent, SWT.NONE); layout = new GridLayout(1, true); layout.marginWidth = 5; layout.marginHeight = 5; layout.numColumns = MAX_COLUMN; groupMonitor.setLayout(layout); gridData = new GridData(); gridData.horizontalSpan = MAX_COLUMN; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; groupMonitor.setLayoutData(gridData); groupMonitor.setText(Messages.getString("monitor.run")); // ? this.confirmMonitorValid = new Button(groupMonitor, SWT.CHECK); WidgetTestUtil.setTestId(this, "confirmmonitorvalid", confirmMonitorValid); gridData = new GridData(); gridData.horizontalSpan = 2; gridData.horizontalAlignment = GridData.FILL; gridData.verticalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; gridData.grabExcessVerticalSpace = true; this.confirmMonitorValid.setLayoutData(gridData); this.confirmMonitorValid.setText(Messages.getString("monitor.run")); this.confirmMonitorValid.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { // ?/ if (confirmMonitorValid.getSelection()) { setMonitorEnabled(true); } else { setMonitorEnabled(false); } } }); /* * */ // Group groupCheckRule = new Group(groupMonitor, SWT.NONE); WidgetTestUtil.setTestId(this, "checkrule", groupCheckRule); layout = new GridLayout(1, true); layout.marginWidth = 5; layout.marginHeight = 5; layout.numColumns = MAX_COLUMN; groupCheckRule.setLayout(layout); gridData = new GridData(); gridData.horizontalSpan = MAX_COLUMN - 2; gridData.horizontalAlignment = GridData.FILL; gridData.verticalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; gridData.grabExcessVerticalSpace = true; groupCheckRule.setLayoutData(gridData); groupCheckRule.setText(Messages.getString("trap.definition")); /* * */ Group groupCommunity = new Group(groupRule, SWT.NONE); WidgetTestUtil.setTestId(this, "community", groupCommunity); layout = new GridLayout(1, true); layout.marginWidth = 5; layout.marginHeight = 5; layout.numColumns = MAX_COLUMN; groupCommunity.setLayout(layout); gridData = new GridData(); gridData.horizontalSpan = MAX_COLUMN / 2; gridData.horizontalAlignment = GridData.FILL; gridData.verticalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; gridData.grabExcessVerticalSpace = true; groupCommunity.setLayoutData(gridData); groupCommunity.setText(Messages.getString("community")); // this.buttonCommunityCheckOn = new Button(groupCommunity, SWT.CHECK); WidgetTestUtil.setTestId(this, "communitycheckon", buttonCommunityCheckOn); gridData = new GridData(); gridData.horizontalSpan = 4; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; this.buttonCommunityCheckOn.setLayoutData(gridData); this.buttonCommunityCheckOn.setText(Messages.getString("valid")); this.buttonCommunityCheckOn.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { update(); } }); // label = new Label(groupCommunity, SWT.NONE); WidgetTestUtil.setTestId(this, "communityname", label); gridData = new GridData(); gridData.horizontalSpan = 6; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; label.setLayoutData(gridData); label.setText(Messages.getString("community.name") + " : "); // this.textCommunityName = new Text(groupCommunity, SWT.BORDER | SWT.LEFT); WidgetTestUtil.setTestId(this, "communitiname", textCommunityName); gridData = new GridData(); gridData.horizontalSpan = 10; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; this.textCommunityName.setLayoutData(gridData); this.textCommunityName.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent arg0) { update(); } }); /* * */ Group groupCharset = new Group(groupRule, SWT.NONE); WidgetTestUtil.setTestId(this, "charset", groupCharset); layout = new GridLayout(1, true); layout.marginWidth = 5; layout.marginHeight = 5; layout.numColumns = MAX_COLUMN; groupCharset.setLayout(layout); gridData = new GridData(); gridData.horizontalSpan = MAX_COLUMN / 2; gridData.horizontalAlignment = GridData.FILL; gridData.verticalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; gridData.grabExcessVerticalSpace = true; groupCharset.setLayoutData(gridData); groupCharset.setText(Messages.getString("charset.convert")); // this.buttonCharsetConvertOn = new Button(groupCharset, SWT.CHECK); WidgetTestUtil.setTestId(this, "charsetconvert", buttonCharsetConvertOn); gridData = new GridData(); gridData.horizontalSpan = 4; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; this.buttonCharsetConvertOn.setLayoutData(gridData); this.buttonCharsetConvertOn.setText(Messages.getString("valid")); this.buttonCharsetConvertOn.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { update(); } }); // label = new Label(groupCharset, SWT.NONE); WidgetTestUtil.setTestId(this, "snmptrapcode", label); gridData = new GridData(); gridData.horizontalSpan = 12; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; label.setLayoutData(gridData); label.setText(Messages.getString("charset.snmptrap.code") + " : "); // this.textCharsetName = new Text(groupCharset, SWT.BORDER | SWT.LEFT); WidgetTestUtil.setTestId(this, "charsetname", textCharsetName); gridData = new GridData(); gridData.horizontalSpan = 4; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; this.textCharsetName.setLayoutData(gridData); this.textCharsetName.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent arg0) { update(); } }); /* * OID */ Group groupOid = new Group(groupCheckRule, SWT.NONE); WidgetTestUtil.setTestId(this, "oid", groupOid); layout = new GridLayout(MAX_COLUMN, true); layout.marginWidth = 5; layout.marginHeight = 5; groupOid.setLayout(layout); gridData = new GridData(); gridData.horizontalSpan = MAX_COLUMN; gridData.horizontalAlignment = GridData.FILL; gridData.verticalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; gridData.grabExcessVerticalSpace = true; groupOid.setLayoutData(gridData); groupOid.setText("OID"); this.buttonNotifyNonSpecifiedTrap = new Button(groupOid, SWT.CHECK); WidgetTestUtil.setTestId(this, "communitycheckoff", buttonNotifyNonSpecifiedTrap); gridData = new GridData(); gridData.horizontalSpan = 10; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; this.buttonNotifyNonSpecifiedTrap.setLayoutData(gridData); this.buttonNotifyNonSpecifiedTrap .setText(Messages.getString("monitor.snmptrap.notify.on.non.specified.trap.receipt")); this.buttonNotifyNonSpecifiedTrap.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { update(); } }); this.comboPriority = new Combo(groupOid, SWT.BORDER | SWT.LEFT | SWT.SINGLE | SWT.READ_ONLY); WidgetTestUtil.setTestId(this, "priority", comboPriority); gridData = new GridData(); gridData.horizontalSpan = 3; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; this.comboPriority.setLayoutData(gridData); this.comboPriority.add(PriorityMessage.STRING_CRITICAL); this.comboPriority.add(PriorityMessage.STRING_WARNING); this.comboPriority.add(PriorityMessage.STRING_INFO); this.comboPriority.add(PriorityMessage.STRING_UNKNOWN); this.comboPriority.setText(PriorityMessage.STRING_UNKNOWN); this.comboPriority.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent arg0) { update(); } }); // label = new Label(groupOid, SWT.NONE); WidgetTestUtil.setTestId(this, "space1", label); gridData = new GridData(); gridData.horizontalSpan = MAX_COLUMN - 13; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; label.setLayoutData(gridData); // this.tableDefineListComposite = new TrapDefineListComposite(groupOid, SWT.NONE, new TrapDefineCompositeDefine()); WidgetTestUtil.setTestId(this, "oidlist", tableDefineListComposite); gridData = new GridData(); gridData.horizontalSpan = MAX_COLUMN; gridData.horizontalAlignment = GridData.FILL; gridData.verticalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; gridData.grabExcessVerticalSpace = true; this.tableDefineListComposite.setLayoutData(gridData); /* * ?? */ groupNotifyAttribute = new Group(groupMonitor, SWT.NONE); layout = new GridLayout(1, true); layout.marginWidth = 5; layout.marginHeight = 5; layout.numColumns = 1; groupNotifyAttribute.setLayout(layout); gridData = new GridData(); gridData.horizontalSpan = MAX_COLUMN; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; groupNotifyAttribute.setLayoutData(gridData); groupNotifyAttribute.setText(Messages.getString("notify.attribute")); this.m_notifyInfo = new NotifyInfoComposite(groupNotifyAttribute, SWT.NONE); gridData = new GridData(); gridData.horizontalSpan = 1; gridData.horizontalAlignment = GridData.FILL; gridData.heightHint = 120; gridData.grabExcessHorizontalSpace = true; this.m_notifyInfo.setLayoutData(gridData); // ? MonitorInfo info = null; if (this.monitorId == null) { // ??? info = new MonitorInfo(); this.setInfoInitialValue(info); } else { // ???? try { MonitorSettingEndpointWrapper wrapper = MonitorSettingEndpointWrapper.getWrapper(getManagerName()); info = wrapper.getMonitor(this.monitorId); } 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.openInformation(null, Messages.getString("message"), Messages.getString("message.traputil.4") + errMessage); throw new InternalError(e.getMessage()); } } /* * ? */ groupCollect = new Group(parent, SWT.NONE); WidgetTestUtil.setTestId(this, "collect", groupCollect); layout = new GridLayout(1, true); layout.marginWidth = HALF_MARGIN; layout.marginHeight = HALF_MARGIN; layout.numColumns = BASIC_UNIT; groupCollect.setLayout(layout); gridData = new GridData(); gridData.horizontalSpan = BASIC_UNIT; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; groupCollect.setLayoutData(gridData); groupCollect.setText(Messages.getString("collection.run")); // ?? this.confirmCollectValid = new Button(groupCollect, SWT.CHECK); WidgetTestUtil.setTestId(this, "confirmcollectvalid", confirmCollectValid); gridData = new GridData(); gridData.horizontalSpan = WIDTH_TITLE; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; this.confirmCollectValid.setLayoutData(gridData); this.confirmCollectValid.setText(Messages.getString("collection.run")); this.confirmCollectValid.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { // ?/ if (confirmCollectValid.getSelection()) { setCollectorEnabled(true); } else { setCollectorEnabled(false); } } }); // label = new Label(groupCollect, SWT.NONE); WidgetTestUtil.setTestId(this, "logFormat", label); gridData = new GridData(); gridData.horizontalSpan = WIDTH_TITLE; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; label.setLayoutData(gridData); label.setText(Messages.getString("hub.log.format.id") + " : "); // this.logFormat = new Combo(groupCollect, SWT.BORDER | SWT.LEFT | SWT.READ_ONLY); WidgetTestUtil.setTestId(this, "logFormat", logFormat); gridData = new GridData(); gridData.horizontalSpan = BASIC_UNIT - (WIDTH_TITLE * 2); gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; this.logFormat.setLayoutData(gridData); this.logFormat.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent arg0) { update(); } }); // ?? Label line = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL); WidgetTestUtil.setTestId(this, "line", line); gridData = new GridData(); gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; gridData.horizontalSpan = MAX_COLUMN; line.setLayoutData(gridData); //?pack:resize to be its preferred size shell.pack(); shell.setSize(new Point(850, shell.getSize().y)); // ?? Display display = shell.getDisplay(); shell.setLocation((display.getBounds().width - shell.getSize().x) / 2, (display.getBounds().height - shell.getSize().y) / 2); this.setInputData(info); }
From source file:com.clustercontrol.snmptrap.dialog.SnmpTrapCreateDialog.java
License:Open Source License
/** * ?????//w w w .j a v a 2 s . co m * * @return true?false * * @see com.clustercontrol.dialog.CommonDialog#action() */ @Override protected boolean action() { boolean result = false; MonitorInfo info = this.inputData; String managerName = this.getManagerName(); MonitorSettingEndpointWrapper wrapper = MonitorSettingEndpointWrapper.getWrapper(managerName); if (info != null) { 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.sql.action.GetJdbc.java
License:Open Source License
/** * SQL???// w w w . ja va 2 s . com * * @param monitorId ID * @param monitorType * @return SQL */ public static List<List<String>> getJdbcDriverList(String managerName) { List<List<String>> list = new ArrayList<List<String>>(); try { MonitorSettingEndpointWrapper wrapper = MonitorSettingEndpointWrapper.getWrapper(managerName); List<JdbcDriverInfo> driverList = wrapper.getJdbcDriverList(); for (JdbcDriverInfo driver : driverList) { ArrayList<String> a = new ArrayList<String>(); a.add(driver.getJdbcDriverName()); a.add(driver.getJdbcDriverClass()); list.add(a); } } catch (InvalidRole_Exception e) { // ?????? MessageDialog.openInformation(null, Messages.getString("message"), Messages.getString("message.accesscontrol.16")); } catch (Exception e) { // ? m_log.warn("getJdbcDriverList(), " + HinemosMessage.replace(e.getMessage()), e); MessageDialog.openInformation(null, Messages.getString("message"), Messages.getString("message.hinemos.failure.unexpected") + ", " + HinemosMessage.replace(e.getMessage())); } return list; }
From source file:com.clustercontrol.sql.action.GetSql.java
License:Open Source License
/** * SQL???//from ww w. ja va2 s . c o m * * @param monitorId ID * @return SQL */ public MonitorInfo getSql(String managerName, String monitorId) { MonitorInfo info = null; try { MonitorSettingEndpointWrapper wrapper = MonitorSettingEndpointWrapper.getWrapper(managerName); info = wrapper.getMonitor(monitorId); } catch (InvalidRole_Exception e) { // ?????? MessageDialog.openInformation(null, Messages.getString("message"), Messages.getString("message.accesscontrol.16")); } catch (Exception e) { // ? m_log.warn("getSql(), " + e.getMessage(), e); MessageDialog.openInformation(null, Messages.getString("message"), Messages.getString("message.hinemos.failure.unexpected") + ", " + HinemosMessage.replace(e.getMessage())); } return info; }
From source file:com.clustercontrol.winevent.dialog.WinEventDialog.java
License:Open Source License
/** * ????/*from ww w .j a va 2s .co m*/ * * @param parent ? */ @Override protected void customizeDialog(Composite parent) { super.customizeDialog(parent); // shell.setText(Messages.getString("dialog.winevent.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, "wineventlevel", label); gridData = new GridData(); gridData.horizontalSpan = WIDTH_TITLE_LONG; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; label.setLayoutData(gridData); label.setText(Messages.getString("winevent.level") + " : "); // (?) this.levelCritical = new Button(groupCheckRule, SWT.CHECK); WidgetTestUtil.setTestId(this, "criticalcheck", levelCritical); gridData = new GridData(); gridData.horizontalSpan = WIDTH_VALUE_LONG; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; this.levelCritical.setLayoutData(gridData); this.levelCritical.setText(Messages.getString("winevent.level.critical")); // () this.levelWarning = new Button(groupCheckRule, SWT.CHECK); WidgetTestUtil.setTestId(this, "warningcheck", levelWarning); gridData = new GridData(); gridData.horizontalSpan = WIDTH_VALUE_LONG; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; this.levelWarning.setLayoutData(gridData); this.levelWarning.setText(Messages.getString("winevent.level.warning")); // () this.levelVerbose = new Button(groupCheckRule, SWT.CHECK); WidgetTestUtil.setTestId(this, "verbosecheck", levelVerbose); gridData = new GridData(); gridData.horizontalSpan = WIDTH_VALUE_LONG; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; this.levelVerbose.setLayoutData(gridData); this.levelVerbose.setText(Messages.getString("winevent.level.verbose")); // () this.levelError = new Button(groupCheckRule, SWT.CHECK); WidgetTestUtil.setTestId(this, "errorcheck", levelError); gridData = new GridData(); gridData.horizontalSpan = WIDTH_VALUE_LONG; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; this.levelError.setLayoutData(gridData); this.levelError.setText(Messages.getString("winevent.level.error")); // () this.levelInformational = new Button(groupCheckRule, SWT.CHECK); WidgetTestUtil.setTestId(this, "infomationalcheck", levelInformational); gridData = new GridData(); gridData.horizontalSpan = WIDTH_VALUE_LONG; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; this.levelInformational.setLayoutData(gridData); this.levelInformational.setText(Messages.getString("winevent.level.informational")); /* * */ // label = new Label(groupCheckRule, SWT.NONE); WidgetTestUtil.setTestId(this, "wineveltlog", label); gridData = new GridData(); gridData.horizontalSpan = WIDTH_TITLE_LONG; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; label.setLayoutData(gridData); label.setText(Messages.getString("winevent.log") + " : "); // this.logName = new Text(groupCheckRule, SWT.BORDER | SWT.LEFT); WidgetTestUtil.setTestId(this, "logname", logName); gridData = new GridData(); gridData.horizontalSpan = WIDTH_TEXT_LONG; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; this.logName.setLayoutData(gridData); this.logName.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent arg0) { update(); } }); /* * */ // label = new Label(groupCheckRule, SWT.NONE); WidgetTestUtil.setTestId(this, "wineventsource", label); gridData = new GridData(); gridData.horizontalSpan = WIDTH_TITLE_LONG; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; label.setLayoutData(gridData); label.setText(Messages.getString("winevent.source") + " : "); // this.source = new Text(groupCheckRule, SWT.BORDER | SWT.LEFT); WidgetTestUtil.setTestId(this, "source", source); gridData = new GridData(); gridData.horizontalSpan = WIDTH_TEXT_LONG; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; this.source.setLayoutData(gridData); this.source.setMessage(Messages.getString("message.winevent.1")); /* * ID */ // label = new Label(groupCheckRule, SWT.NONE); WidgetTestUtil.setTestId(this, "wineventid", label); gridData = new GridData(); gridData.horizontalSpan = WIDTH_TITLE_LONG; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; label.setLayoutData(gridData); label.setText(Messages.getString("winevent.id") + " : "); // this.eventId = new Text(groupCheckRule, SWT.BORDER | SWT.LEFT); WidgetTestUtil.setTestId(this, "eventid", eventId); gridData = new GridData(); gridData.horizontalSpan = WIDTH_TEXT_LONG; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; this.eventId.setLayoutData(gridData); this.eventId.setMessage(Messages.getString("message.winevent.2")); /* * ? */ // label = new Label(groupCheckRule, SWT.NONE); WidgetTestUtil.setTestId(this, "wineventcategory", label); gridData = new GridData(); gridData.horizontalSpan = WIDTH_TITLE_LONG; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; label.setLayoutData(gridData); label.setText(Messages.getString("winevent.category") + " : "); // this.category = new Text(groupCheckRule, SWT.BORDER | SWT.LEFT); WidgetTestUtil.setTestId(this, "category", category); gridData = new GridData(); gridData.horizontalSpan = WIDTH_TEXT_LONG; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; this.category.setLayoutData(gridData); this.category.setMessage(Messages.getString("message.winevent.3")); /* * */ // label = new Label(groupCheckRule, SWT.NONE); WidgetTestUtil.setTestId(this, "keywords", label); gridData = new GridData(); gridData.horizontalSpan = WIDTH_TITLE_LONG; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; label.setLayoutData(gridData); label.setText(Messages.getString("winevent.keywords") + " : "); // this.keywords = new Text(groupCheckRule, SWT.BORDER | SWT.LEFT); WidgetTestUtil.setTestId(this, "keywords", keywords); gridData = new GridData(); gridData.horizontalSpan = WIDTH_TEXT_LONG; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; this.keywords.setLayoutData(gridData); this.keywords.setMessage(Messages.getString("message.winevent.4")); // ????? this.m_monitorRule.setRunIntervalEnabled(false); // this.adjustDialog(); // ? MonitorInfo info = null; if (this.monitorId == null) { // ??? info = new MonitorInfo(); this.setInfoInitialValue(info); } else { // ???? try { MonitorSettingEndpointWrapper wrapper = MonitorSettingEndpointWrapper.getWrapper(managerName); info = wrapper.getMonitor(this.monitorId); } catch (InvalidRole_Exception e) { // ?????? MessageDialog.openInformation(null, Messages.getString("message"), Messages.getString("message.accesscontrol.16")); throw new InternalError(e.getMessage()); } catch (Exception e) { // ? m_log.warn("customizeDialog(), " + HinemosMessage.replace(e.getMessage()), e); MessageDialog.openInformation(null, Messages.getString("message"), Messages.getString("message.hinemos.failure.unexpected") + ", " + HinemosMessage.replace(e.getMessage())); throw new InternalError(e.getMessage()); } } this.setInputData(info); this.update(); }