List of usage examples for org.eclipse.jface.dialogs IDialogConstants OK_ID
int OK_ID
To view the source code for org.eclipse.jface.dialogs IDialogConstants OK_ID.
Click Source Link
From source file:com.clustercontrol.notify.dialog.NotifyJobCreateDialog.java
License:Open Source License
/** * ??????????// w w w . ja va 2s . co m * * @param parent ?? * * @see com.clustercontrol.notify.dialog.NotifyBasicCreateDialog#customizeDialog(Composite) */ @Override protected void customizeSettingDialog(Composite parent) { final Shell shell = this.getShell(); // shell.setText(Messages.getString("dialog.notify.job.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); /* * */ // Group groupJob = new Group(parent, SWT.NONE); WidgetTestUtil.setTestId(this, "job", groupJob); layout = new GridLayout(1, true); layout.marginWidth = 5; layout.marginHeight = 5; layout.numColumns = 16; groupJob.setLayout(layout); gridData = new GridData(); gridData.horizontalSpan = 15; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; groupJob.setLayoutData(gridData); groupJob.setText(Messages.getString("notifies.job")); /* * */ Group groupScope = new Group(groupJob, SWT.NONE); WidgetTestUtil.setTestId(this, "scope", groupScope); groupScope.setText(Messages.getString("notify.job.scope")); layout = new GridLayout(1, true); layout.marginWidth = 5; layout.marginHeight = 5; layout.numColumns = 16; groupScope.setLayout(layout); gridData = new GridData(); gridData.horizontalSpan = 16; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; groupScope.setLayoutData(gridData); // this.m_radioGenerationNodeValue = new Button(groupScope, SWT.RADIO); WidgetTestUtil.setTestId(this, "generationnodevalue", m_radioGenerationNodeValue); gridData = new GridData(); gridData.horizontalSpan = 16; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; this.m_radioGenerationNodeValue.setLayoutData(gridData); this.m_radioGenerationNodeValue.setText(Messages.getString("notify.node.generation") + " : "); this.m_radioGenerationNodeValue.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { Button check = (Button) e.getSource(); WidgetTestUtil.setTestId(this, null, check); if (check.getSelection()) { m_radioFixedValue.setSelection(false); m_scopeSelect.setEnabled(false); } } }); // this.m_radioFixedValue = new Button(groupScope, SWT.RADIO); WidgetTestUtil.setTestId(this, "fixedvalue", m_radioFixedValue); gridData = new GridData(); gridData.horizontalSpan = 3; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; this.m_radioFixedValue.setLayoutData(gridData); this.m_radioFixedValue.setText(Messages.getString("notify.node.fix") + " : "); this.m_radioFixedValue.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { Button check = (Button) e.getSource(); WidgetTestUtil.setTestId(this, null, check); if (check.getSelection()) { m_radioGenerationNodeValue.setSelection(false); m_scopeSelect.setEnabled(true); } update(); } }); this.m_textScope = new Text(groupScope, SWT.BORDER | SWT.READ_ONLY); WidgetTestUtil.setTestId(this, "scope", m_textScope); gridData = new GridData(); gridData.horizontalSpan = 5; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; this.m_textScope.setLayoutData(gridData); this.m_textScope.setText(""); this.m_scopeSelect = new Button(groupScope, SWT.NONE); WidgetTestUtil.setTestId(this, "scopeselect", m_scopeSelect); gridData = new GridData(); gridData.horizontalSpan = 2; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; this.m_scopeSelect.setLayoutData(gridData); this.m_scopeSelect.setText(Messages.getString("refer")); this.m_scopeSelect.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { ScopeTreeDialog dialog = new ScopeTreeDialog(shell, m_notifyBasic.getManagerListComposite().getText(), m_notifyBasic.getRoleIdList().getText()); if (dialog.open() == IDialogConstants.OK_ID) { FacilityTreeItem selectItem = dialog.getSelectItem(); FacilityInfo info = selectItem.getData(); FacilityPath path = new FacilityPath(ClusterControlPlugin.getDefault().getSeparator()); m_facilityPath = path.getPath(selectItem); m_facilityId = info.getFacilityId(); m_textScope.setText(HinemosMessage.replace(m_facilityPath)); update(); } } }); label = new Label(groupScope, SWT.NONE); WidgetTestUtil.setTestId(this, null, label); gridData = new GridData(); gridData.horizontalSpan = 5; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; label.setLayoutData(gridData); // label = new Label(groupJob, SWT.NONE); WidgetTestUtil.setTestId(this, "space1", label); gridData = new GridData(); gridData.horizontalSpan = 16; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; label.setLayoutData(gridData); /* * ?? ??? */ // ?? label = new Label(groupJob, SWT.NONE); WidgetTestUtil.setTestId(this, "priority", label); gridData = new GridData(); gridData.horizontalSpan = WIDTH_PRIORITY; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; label.setLayoutData(gridData); label.setText(Messages.getString("priority")); // ? label = new Label(groupJob, SWT.NONE); WidgetTestUtil.setTestId(this, "run", label); gridData = new GridData(); gridData.horizontalSpan = WIDTH_JOB_RUN; gridData.horizontalAlignment = GridData.CENTER; gridData.grabExcessHorizontalSpace = true; label.setLayoutData(gridData); label.setText(Messages.getString("notify.attribute")); // ID label = new Label(groupJob, SWT.NONE); WidgetTestUtil.setTestId(this, "jobunitid", label); gridData = new GridData(); gridData.horizontalSpan = WIDTH_JOBUNIT_ID; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; label.setLayoutData(gridData); label.setText(Messages.getString("jobunit.id")); // ID label = new Label(groupJob, SWT.NONE); WidgetTestUtil.setTestId(this, "jobid", label); gridData = new GridData(); gridData.horizontalSpan = WIDTH_JOB_ID; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; label.setLayoutData(gridData); label.setText(Messages.getString("job.id")); // ? label = new Label(groupJob, SWT.NONE); WidgetTestUtil.setTestId(this, "refer", label); gridData = new GridData(); gridData.horizontalSpan = WIDTH_REF_BTN; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; label.setLayoutData(gridData); // label = new Label(groupJob, SWT.NONE); WidgetTestUtil.setTestId(this, "failurecallvalue", label); gridData = new GridData(); gridData.horizontalSpan = WIDTH_FAILURE_PRIORITY; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; label.setLayoutData(gridData); label.setText(Messages.getString("failure.call.value")); // ?? label = this.getLabelPriority(groupJob, Messages.getString("info"), PriorityColorConstant.COLOR_INFO); this.m_checkJobRunInfo = this.getCheckJobRun(groupJob); WidgetTestUtil.setTestId(this, "jobruninfo", m_checkJobRunInfo); this.m_textJobunitIdInfo = this.getTextJobunitId(groupJob); WidgetTestUtil.setTestId(this, "jobunitidinfo", m_textJobunitIdInfo); this.m_textJobIdInfo = this.getTextJobId(groupJob); WidgetTestUtil.setTestId(this, "jobidinfo", m_textJobIdInfo); this.m_buttonReferInfo = this.getButtonJobRefer(groupJob); WidgetTestUtil.setTestId(this, "referinfo", m_buttonReferInfo); this.m_comboFailurePriorityInfo = this.getComboPriority(groupJob); WidgetTestUtil.setTestId(this, "failurepriority", m_comboFailurePriorityInfo); this.m_buttonReferInfo .addSelectionListener(new JobIdSelectionListener(shell, m_notifyBasic.getManagerListComposite(), m_textJobunitIdInfo, m_textJobIdInfo, m_notifyBasic.getRoleIdList())); // ?? label = this.getLabelPriority(groupJob, Messages.getString("warning"), PriorityColorConstant.COLOR_WARNING); this.m_checkJobRunWarning = this.getCheckJobRun(groupJob); WidgetTestUtil.setTestId(this, "jobrunwarning", m_checkJobRunWarning); this.m_textJobunitIdWarning = this.getTextJobunitId(groupJob); WidgetTestUtil.setTestId(this, "jobunitidwarning", m_textJobunitIdWarning); this.m_textJobIdWarning = this.getTextJobId(groupJob); WidgetTestUtil.setTestId(this, "jobidwarnitng", m_textJobIdWarning); this.m_buttonReferWarning = this.getButtonJobRefer(groupJob); WidgetTestUtil.setTestId(this, "referwarning", m_buttonReferWarning); this.m_comboFailurePriorityWarning = this.getComboPriority(groupJob); WidgetTestUtil.setTestId(this, "failureprioritywarning", m_comboFailurePriorityWarning); this.m_buttonReferWarning .addSelectionListener(new JobIdSelectionListener(shell, m_notifyBasic.getManagerListComposite(), m_textJobunitIdWarning, m_textJobIdWarning, m_notifyBasic.getRoleIdList())); // ??? label = this.getLabelPriority(groupJob, Messages.getString("critical"), PriorityColorConstant.COLOR_CRITICAL); this.m_checkJobRunCritical = this.getCheckJobRun(groupJob); WidgetTestUtil.setTestId(this, "criticalcheck", m_checkJobRunCritical); this.m_textJobunitIdCritical = this.getTextJobunitId(groupJob); WidgetTestUtil.setTestId(this, "jobunitidcritical", m_textJobunitIdCritical); this.m_textJobIdCritical = this.getTextJobId(groupJob); WidgetTestUtil.setTestId(this, "jobidcritical", m_textJobIdCritical); this.m_buttonReferCritical = this.getButtonJobRefer(groupJob); WidgetTestUtil.setTestId(this, "refercritical", m_buttonReferCritical); this.m_comboFailurePriorityCritical = this.getComboPriority(groupJob); WidgetTestUtil.setTestId(this, "failureprioritycritical", m_comboFailurePriorityCritical); this.m_buttonReferCritical .addSelectionListener(new JobIdSelectionListener(shell, m_notifyBasic.getManagerListComposite(), m_textJobunitIdCritical, m_textJobIdCritical, m_notifyBasic.getRoleIdList())); // ??? label = this.getLabelPriority(groupJob, Messages.getString("unknown"), PriorityColorConstant.COLOR_UNKNOWN); this.m_checkJobRunUnknown = this.getCheckJobRun(groupJob); WidgetTestUtil.setTestId(this, "jobrununknown", m_checkJobRunUnknown); this.m_textJobunitIdUnknown = this.getTextJobunitId(groupJob); WidgetTestUtil.setTestId(this, "jobunitidunknown", m_textJobunitIdUnknown); this.m_textJobIdUnknown = this.getTextJobId(groupJob); WidgetTestUtil.setTestId(this, "jobidunknown", m_textJobIdUnknown); this.m_buttonReferUnknown = this.getButtonJobRefer(groupJob); WidgetTestUtil.setTestId(this, "referunknown", m_buttonReferUnknown); this.m_comboFailurePriorityUnknown = this.getComboPriority(groupJob); WidgetTestUtil.setTestId(this, "failurepriorityunknown", m_comboFailurePriorityUnknown); this.m_buttonReferUnknown .addSelectionListener(new JobIdSelectionListener(shell, m_notifyBasic.getManagerListComposite(), m_textJobunitIdUnknown, m_textJobIdUnknown, m_notifyBasic.getRoleIdList())); }
From source file:com.clustercontrol.notify.dialog.NotifyListDialog.java
License:Open Source License
/** * ????// w w w .j a v a 2 s . c o m * * @param parent ?? * * @see com.clustercontrol.notify.composite.NotifyListComposite */ @Override protected void customizeDialog(Composite parent) { Shell shell = this.getShell(); // shell.setText(Messages.getString("dialog.notify.list")); // GridLayout layout = new GridLayout(8, true); layout.marginWidth = 10; layout.marginHeight = 10; layout.numColumns = 8; parent.setLayout(layout); /* * */ this.notifyListComposite = new NotifyListComposite(parent, SWT.BORDER, isSelect, this.ownerRoleId); this.notifyListComposite.setManagerName(this.managerName); WidgetTestUtil.setTestId(this, "notifylist", notifyListComposite); GridData gridData = new GridData(); gridData.horizontalAlignment = GridData.FILL; gridData.verticalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; gridData.grabExcessVerticalSpace = true; gridData.horizontalSpan = 7; gridData.heightHint = SWT.MIN; this.notifyListComposite.setLayoutData(gridData); this.notifyListComposite.setSelectNotify(this.notify); this.notifyListComposite.update(); // ??????????????????? if (!this.notifyListComposite.isShowFlg()) { this.close(); return; } /* * ? */ Composite composite = new Composite(parent, SWT.NONE); WidgetTestUtil.setTestId(this, "button", composite); layout = new GridLayout(1, true); layout.numColumns = 1; composite.setLayout(layout); gridData = new GridData(); gridData.horizontalAlignment = GridData.FILL; gridData.verticalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; gridData.grabExcessVerticalSpace = true; gridData.horizontalSpan = 1; composite.setLayoutData(gridData); // this.buttonAdd = this.createButton(composite, Messages.getString("add")); WidgetTestUtil.setTestId(this, "add", buttonAdd); this.buttonAdd.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { NotifyTypeDialog dialog = new NotifyTypeDialog(getParentShell(), notifyListComposite, managerName); dialog.open(); } }); // Label dummy = new Label(composite, SWT.NONE); WidgetTestUtil.setTestId(this, "dummy", dummy); this.buttonModify = this.createButton(composite, Messages.getString("modify")); WidgetTestUtil.setTestId(this, "modify", buttonModify); this.buttonModify.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { String notifyId = null; Integer notifyType = null; Table notifyListModifyTable = notifyListComposite.getTableViewer().getTable(); WidgetTestUtil.setTestId(this, "modify", notifyListModifyTable); TableItem[] item = notifyListModifyTable.getSelection(); if (item != null && item.length > 0) { try { notifyId = (String) ((ArrayList<?>) item[0].getData()) .get(GetNotifyTableDefineCheckBox.NOTIFY_ID); notifyType = (Integer) ((ArrayList<?>) item[0].getData()) .get(GetNotifyTableDefineCheckBox.NOTIFY_TYPE); } catch (Exception ex) { Logger.getLogger(this.getClass()).debug(ex.getMessage(), ex); } } if (notifyId != null && notifyType != null) { NotifyModifyAction action = new NotifyModifyAction(); if (action.openDialog(getParentShell(), NotifyListDialog.this.managerName, notifyId, notifyType) == IDialogConstants.OK_ID) { int selectIndex = notifyListModifyTable.getSelectionIndex(); notifyListComposite.update(); notifyListModifyTable.setSelection(selectIndex); } } else { MessageDialog.openWarning(null, Messages.getString("warning"), Messages.getString("message.notify.8")); } } }); // dummy = new Label(composite, SWT.NONE); WidgetTestUtil.setTestId(this, "dummydelete", dummy); this.buttonDelete = this.createButton(composite, Messages.getString("delete")); WidgetTestUtil.setTestId(this, "delete", buttonDelete); this.buttonDelete.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { String notifyId = null; Table notifyListDeleteTable = notifyListComposite.getTableViewer().getTable(); WidgetTestUtil.setTestId(this, "delete", notifyListDeleteTable); TableItem[] item = notifyListDeleteTable.getSelection(); List<String> notifyIdList = new ArrayList<String>(); if (item == null || item.length == 0) { return; } for (int i = 0; i < item.length; i++) { WidgetTestUtil.setTestId(this, "item" + i, item[i]); notifyId = (String) ((ArrayList<?>) item[i].getData()) .get(GetNotifyTableDefineCheckBox.NOTIFY_ID); notifyIdList.add(notifyId); } String[] args = new String[1]; String msg = null; if (notifyIdList.isEmpty() == false) { if (notifyIdList.size() == 1) { args[0] = notifyIdList.get(0); msg = "message.notify.7"; } else { args[0] = Integer.toString(notifyIdList.size()); msg = "message.notify.51"; } DeleteNotify deleteNotify = new DeleteNotify(); if (deleteNotify.useCheck(managerName, notifyIdList) == Window.OK) { // ?ID????????? if (MessageDialog.openConfirm(null, Messages.getString("confirmed"), Messages.getString(msg, args))) { boolean result = deleteNotify.delete(managerName, notifyIdList); if (result) { notifyListComposite.update(); } // else{ // MessageDialog.openError( // null, // Messages.getString("failed"), // Messages.getString("message.notify.6", args)); // } } } } else { MessageDialog.openWarning(null, Messages.getString("warning"), Messages.getString("message.notify.9")); } } }); // dummy = new Label(composite, SWT.NONE); WidgetTestUtil.setTestId(this, "dummy1", dummy); dummy = new Label(composite, SWT.NONE); WidgetTestUtil.setTestId(this, "dummy2", dummy); this.buttonValid = this.createButton(composite, Messages.getString("valid")); WidgetTestUtil.setTestId(this, "valid", buttonValid); this.buttonValid.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { //?? setValid(true); } }); // this.buttonInvalid = this.createButton(composite, Messages.getString("invalid")); WidgetTestUtil.setTestId(this, "invalid", buttonInvalid); this.buttonInvalid.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { //?? setValid(false); } }); // ?? 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 = 8; line.setLayoutData(gridData); // ?? Display display = shell.getDisplay(); shell.setLocation((display.getBounds().width - shell.getSize().x) / 2, (display.getBounds().height - shell.getSize().y) / 2); //?pack:resize to be its preferred size shell.pack(); shell.setSize(new Point(sizeX, sizeY)); }
From source file:com.clustercontrol.notify.dialog.NotifyLogEscalateCreateDialog.java
License:Open Source License
/** * ??????????/*ww w . ja v a 2 s.co m*/ * * @param parent ?? * * @see com.clustercontrol.notify.dialog.NotifyBasicCreateDialog#customizeDialog(Composite) */ @Override protected void customizeSettingDialog(Composite parent) { final Shell shell = this.getShell(); // shell.setText(Messages.getString("dialog.notify.log.escalate.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); /* * */ // Group groupLogEscalate = new Group(parent, SWT.NONE); WidgetTestUtil.setTestId(this, "logescalate", groupLogEscalate); layout = new GridLayout(1, true); layout.marginWidth = 5; layout.marginHeight = 5; layout.numColumns = 15; groupLogEscalate.setLayout(layout); gridData = new GridData(); gridData.horizontalSpan = 15; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; groupLogEscalate.setLayoutData(gridData); groupLogEscalate.setText(Messages.getString("notifies.log.escalate") + " : "); /* * */ Group groupScope = new Group(groupLogEscalate, SWT.NONE); WidgetTestUtil.setTestId(this, "scope", groupScope); groupScope.setText(Messages.getString("notify.log.escalate.scope")); layout = new GridLayout(1, true); layout.marginWidth = 5; layout.marginHeight = 5; layout.numColumns = 15; groupScope.setLayout(layout); gridData = new GridData(); gridData.horizontalSpan = 15; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; groupScope.setLayoutData(gridData); // this.m_radioGenerationNodeValue = new Button(groupScope, SWT.RADIO); WidgetTestUtil.setTestId(this, "generationnode", m_radioGenerationNodeValue); gridData = new GridData(); gridData.horizontalSpan = 15; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; this.m_radioGenerationNodeValue.setLayoutData(gridData); this.m_radioGenerationNodeValue.setText(Messages.getString("notify.node.generation") + " : "); this.m_radioGenerationNodeValue.addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { Button check = (Button) e.getSource(); WidgetTestUtil.setTestId(this, null, check); if (check.getSelection()) { m_radioFixedValue.setSelection(false); m_scopeSelect.setEnabled(false); } update(); } @Override public void widgetDefaultSelected(SelectionEvent e) { } }); // this.m_radioFixedValue = new Button(groupScope, SWT.RADIO); WidgetTestUtil.setTestId(this, "fixedvalue", m_radioFixedValue); gridData = new GridData(); gridData.horizontalSpan = 3; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; this.m_radioFixedValue.setLayoutData(gridData); this.m_radioFixedValue.setText(Messages.getString("notify.node.fix") + " : "); this.m_radioFixedValue.addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { Button check = (Button) e.getSource(); WidgetTestUtil.setTestId(this, null, check); if (check.getSelection()) { m_radioGenerationNodeValue.setSelection(false); m_scopeSelect.setEnabled(true); } update(); } @Override public void widgetDefaultSelected(SelectionEvent e) { } }); this.m_textScope = new Text(groupScope, SWT.BORDER | SWT.READ_ONLY); WidgetTestUtil.setTestId(this, "scope", m_textScope); gridData = new GridData(); gridData.horizontalSpan = 5; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; this.m_textScope.setLayoutData(gridData); this.m_textScope.setText(""); this.m_textScope.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent arg0) { update(); } }); this.m_scopeSelect = new Button(groupScope, SWT.NONE); WidgetTestUtil.setTestId(this, "scope", m_scopeSelect); gridData = new GridData(); gridData.horizontalSpan = 2; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; this.m_scopeSelect.setLayoutData(gridData); this.m_scopeSelect.setText(Messages.getString("refer")); this.m_scopeSelect.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { ScopeTreeDialog dialog = new ScopeTreeDialog(shell, m_notifyBasic.getManagerListComposite().getText(), m_notifyBasic.getRoleIdList().getText()); if (dialog.open() == IDialogConstants.OK_ID) { FacilityTreeItem selectItem = dialog.getSelectItem(); FacilityInfo info = selectItem.getData(); FacilityPath path = new FacilityPath(ClusterControlPlugin.getDefault().getSeparator()); m_facilityPath = path.getPath(selectItem); m_facilityId = info.getFacilityId(); m_textScope.setText(HinemosMessage.replace(m_facilityPath)); update(); } } }); // label = new Label(groupScope, SWT.NONE); WidgetTestUtil.setTestId(this, "space1", label); gridData = new GridData(); gridData.horizontalSpan = 5; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; label.setLayoutData(gridData); // ? label = new Label(groupScope, SWT.NONE); WidgetTestUtil.setTestId(this, "portnumber", label); gridData = new GridData(); gridData.horizontalSpan = 3; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; label.setLayoutData(gridData); label.setText(Messages.getString("port.number") + " : "); this.m_textEscalatePort = new Text(groupScope, SWT.BORDER); WidgetTestUtil.setTestId(this, "escalateport", m_textEscalatePort); gridData = new GridData(); gridData.horizontalSpan = 2; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; this.m_textEscalatePort.setLayoutData(gridData); this.m_textEscalatePort.setText("514"); this.m_textEscalatePort.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent arg0) { update(); } }); // label = new Label(groupScope, SWT.NONE); WidgetTestUtil.setTestId(this, "space2", label); gridData = new GridData(); gridData.horizontalSpan = 10; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; label.setLayoutData(gridData); // label = new Label(groupLogEscalate, SWT.NONE); WidgetTestUtil.setTestId(this, "space3", label); gridData = new GridData(); gridData.horizontalSpan = 15; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; label.setLayoutData(gridData); /* * ?? ??? */ // ?? label = new Label(groupLogEscalate, SWT.NONE); WidgetTestUtil.setTestId(this, "priority", label); gridData = new GridData(); gridData.horizontalSpan = WIDTH_PRIORITY; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; label.setLayoutData(gridData); label.setText(Messages.getString("priority")); // ? label = new Label(groupLogEscalate, SWT.NONE); WidgetTestUtil.setTestId(this, "attiribute", label); gridData = new GridData(); gridData.horizontalSpan = WIDTH_CHECK; gridData.horizontalAlignment = GridData.CENTER; gridData.grabExcessHorizontalSpace = true; label.setLayoutData(gridData); label.setText(Messages.getString("notify.attribute")); // Facility label = new Label(groupLogEscalate, SWT.NONE); WidgetTestUtil.setTestId(this, "facility", label); gridData = new GridData(); gridData.horizontalSpan = WIDTH_COMBO_FACILITY; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; label.setLayoutData(gridData); label.setText("Syslog Facility"); // Severity label = new Label(groupLogEscalate, SWT.NONE); WidgetTestUtil.setTestId(this, "severity", label); gridData = new GridData(); gridData.horizontalSpan = WIDTH_COMBO_SEVERITY; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; label.setLayoutData(gridData); label.setText("Syslog Severity"); // label = new Label(groupLogEscalate, SWT.NONE); WidgetTestUtil.setTestId(this, "message", label); gridData = new GridData(); gridData.horizontalSpan = WIDTH_MESSAGE; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; label.setLayoutData(gridData); label.setText(Messages.getString("message")); //?? label = this.getLabelPriority(groupLogEscalate, Messages.getString("info"), PriorityColorConstant.COLOR_INFO); this.m_checkLogEscalateRunInfo = this.getCheckLogEscalateRun(groupLogEscalate); WidgetTestUtil.setTestId(this, "escalaterun", m_checkLogEscalateRunInfo); this.m_comboLogEscalateFacilityInfo = this.getComboLogEscalateFacility(groupLogEscalate); WidgetTestUtil.setTestId(this, "escalatefacility", m_comboLogEscalateFacilityInfo); this.m_comboLogEscalateSeverityInfo = this.getComboLogEscalateSeverity(groupLogEscalate); WidgetTestUtil.setTestId(this, "escalateseverity", m_comboLogEscalateSeverityInfo); this.m_textLogEscalateMessageInfo = this.getStyledTextMessage(groupLogEscalate); WidgetTestUtil.setTestId(this, "escalatemessage", m_textLogEscalateMessageInfo); this.m_checkLogEscalateRunInfo.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { setEnabled(m_checkLogEscalateRunInfo.getSelection(), m_comboLogEscalateFacilityInfo, m_comboLogEscalateSeverityInfo, m_textLogEscalateMessageInfo); update(); } }); setEnabled(false, m_comboLogEscalateFacilityInfo, m_comboLogEscalateSeverityInfo, m_textLogEscalateMessageInfo); //?? label = this.getLabelPriority(groupLogEscalate, Messages.getString("warning"), PriorityColorConstant.COLOR_WARNING); this.m_checkLogEscalateRunWarning = this.getCheckLogEscalateRun(groupLogEscalate); WidgetTestUtil.setTestId(this, "runwarning", m_checkLogEscalateRunWarning); this.m_comboLogEscalateFacilityWarning = this.getComboLogEscalateFacility(groupLogEscalate); WidgetTestUtil.setTestId(this, "facilitywarning", m_comboLogEscalateFacilityWarning); this.m_comboLogEscalateSeverityWarning = this.getComboLogEscalateSeverity(groupLogEscalate); WidgetTestUtil.setTestId(this, "serveritywarning", m_comboLogEscalateSeverityWarning); this.m_textLogEscalateMessageWarning = this.getStyledTextMessage(groupLogEscalate); WidgetTestUtil.setTestId(this, "messagewarning", m_textLogEscalateMessageWarning); this.m_checkLogEscalateRunWarning.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { setEnabled(m_checkLogEscalateRunWarning.getSelection(), m_comboLogEscalateFacilityWarning, m_comboLogEscalateSeverityWarning, m_textLogEscalateMessageWarning); update(); } }); setEnabled(false, m_comboLogEscalateFacilityWarning, m_comboLogEscalateSeverityWarning, m_textLogEscalateMessageWarning); //??? label = this.getLabelPriority(groupLogEscalate, Messages.getString("critical"), PriorityColorConstant.COLOR_CRITICAL); this.m_checkLogEscalateRunCritical = this.getCheckLogEscalateRun(groupLogEscalate); WidgetTestUtil.setTestId(this, "runcritical", m_checkLogEscalateRunCritical); this.m_comboLogEscalateFacilityCritical = this.getComboLogEscalateFacility(groupLogEscalate); WidgetTestUtil.setTestId(this, "facilitycritical", m_comboLogEscalateFacilityCritical); this.m_comboLogEscalateSeverityCritical = this.getComboLogEscalateSeverity(groupLogEscalate); WidgetTestUtil.setTestId(this, "severritycritical", m_comboLogEscalateSeverityCritical); this.m_textLogEscalateMessageCritical = this.getStyledTextMessage(groupLogEscalate); WidgetTestUtil.setTestId(this, "messagecritical", m_textLogEscalateMessageCritical); this.m_checkLogEscalateRunCritical.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { setEnabled(m_checkLogEscalateRunCritical.getSelection(), m_comboLogEscalateFacilityCritical, m_comboLogEscalateSeverityCritical, m_textLogEscalateMessageCritical); update(); } }); setEnabled(false, m_comboLogEscalateFacilityCritical, m_comboLogEscalateSeverityCritical, m_textLogEscalateMessageCritical); //??? label = this.getLabelPriority(groupLogEscalate, Messages.getString("unknown"), PriorityColorConstant.COLOR_UNKNOWN); this.m_checkLogEscalateRunUnknown = this.getCheckLogEscalateRun(groupLogEscalate); WidgetTestUtil.setTestId(this, "rununknown", m_checkLogEscalateRunUnknown); this.m_comboLogEscalateFacilityUnknown = this.getComboLogEscalateFacility(groupLogEscalate); WidgetTestUtil.setTestId(this, "facilityunknown", m_comboLogEscalateFacilityUnknown); this.m_comboLogEscalateSeverityUnknown = this.getComboLogEscalateSeverity(groupLogEscalate); WidgetTestUtil.setTestId(this, "severityunknown", m_comboLogEscalateSeverityUnknown); this.m_textLogEscalateMessageUnknown = this.getStyledTextMessage(groupLogEscalate); WidgetTestUtil.setTestId(this, "messageunknown", m_textLogEscalateMessageUnknown); this.m_checkLogEscalateRunUnknown.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { setEnabled(m_checkLogEscalateRunUnknown.getSelection(), m_comboLogEscalateFacilityUnknown, m_comboLogEscalateSeverityUnknown, m_textLogEscalateMessageUnknown); update(); } }); setEnabled(false, m_comboLogEscalateFacilityUnknown, m_comboLogEscalateSeverityUnknown, m_textLogEscalateMessageUnknown); }
From source file:com.clustercontrol.notify.dialog.NotifyTypeDialog.java
License:Open Source License
/** * Show create dialog and do not close after OK pressed */// w w w. j av a 2 s. com @Override protected void okPressed() { ValidateResult result = null; // ??null? if (this.getSelectItem() == null) { result = new ValidateResult(); result.setValid(false); result.setID(Messages.getString("message.hinemos.1")); result.setMessage(Messages.getString("message.notify.28")); displayError(result); } // DB????????? Integer notifyType = this.getSelectItem(); NotifyModifyAction action = new NotifyModifyAction(); if (action.openDialog(getParentShell(), this.managerName, null, notifyType) == IDialogConstants.OK_ID) { composite.update(); } }
From source file:com.clustercontrol.notify.mail.composite.actioin.MailTemplateDoubleClickListener.java
License:Open Source License
/** * ?????<BR>// w w w . ja va2 s . c om * []????????????? * <P> * <ol> * <li>???????ID????</li> * <li>ID????????</li> * </ol> * * @param event * * @see com.clustercontrol.notify.mail.dialog.MailTemplateCreateDialog * @see org.eclipse.jface.viewers.IDoubleClickListener#doubleClick(org.eclipse.jface.viewers.DoubleClickEvent) */ @Override public void doubleClick(DoubleClickEvent event) { String managerName = null; String mailTemplateId = null; //ID? if (((StructuredSelection) event.getSelection()).getFirstElement() != null) { ArrayList<?> info = (ArrayList<?>) ((StructuredSelection) event.getSelection()).getFirstElement(); managerName = (String) info.get(GetMailTemplateListTableDefine.MANAGER_NAME); mailTemplateId = (String) info.get(GetMailTemplateListTableDefine.MAIL_TEMPLATE_ID); } if (mailTemplateId != null) { // ? MailTemplateCreateDialog dialog = new MailTemplateCreateDialog(m_composite.getShell(), managerName, mailTemplateId, PropertyDefineConstant.MODE_MODIFY); // ??????????? if (dialog.open() == IDialogConstants.OK_ID) { Table table = m_composite.getTableViewer().getTable(); WidgetTestUtil.setTestId(this, null, table); int selectIndex = table.getSelectionIndex(); m_composite.update(); table.setSelection(selectIndex); } } }
From source file:com.clustercontrol.notify.mail.view.action.MailTemplateCopyAction.java
License:Open Source License
@Override public Object execute(ExecutionEvent event) throws ExecutionException { // ???/*from w w w.ja v a 2 s .c om*/ this.viewPart = HandlerUtil.getActivePart(event); MailTemplateListView view = null; try { view = (MailTemplateListView) this.viewPart.getAdapter(MailTemplateListView.class); } catch (Exception e) { m_log.info("execute " + e.getMessage()); return null; } if (view == null) { m_log.info("execute: view is null"); return null; } MailTemplateListComposite composite = (MailTemplateListComposite) view.getListComposite(); WidgetTestUtil.setTestId(this, null, composite); WidgetTestUtil.setTestId(this, null, composite); StructuredSelection selection = (StructuredSelection) composite.getTableViewer().getSelection(); List<?> list = (List<?>) selection.getFirstElement(); String managerName = null; String mailTemplateId = null; if (list != null && list.size() > 0) { managerName = (String) list.get(GetMailTemplateListTableDefine.MANAGER_NAME); mailTemplateId = (String) list.get(GetMailTemplateListTableDefine.MAIL_TEMPLATE_ID); } Table table = composite.getTableViewer().getTable(); WidgetTestUtil.setTestId(this, null, table); // ??????? if (mailTemplateId != null) { MailTemplateCreateDialog dialog = new MailTemplateCreateDialog(view.getListComposite().getShell(), managerName, mailTemplateId, PropertyDefineConstant.MODE_ADD); if (dialog.open() == IDialogConstants.OK_ID) { int selectIndex = table.getSelectionIndex(); composite.update(); table.setSelection(selectIndex); } } else { MessageDialog.openWarning(null, Messages.getString("warning"), Messages.getString("message.notify.mail.8")); } return null; }
From source file:com.clustercontrol.notify.mail.view.action.MailTemplateModifyAction.java
License:Open Source License
@Override public Object execute(ExecutionEvent event) throws ExecutionException { // ???//from w w w. j a v a2s. c o m this.viewPart = HandlerUtil.getActivePart(event); MailTemplateListView view = null; try { view = (MailTemplateListView) this.viewPart.getAdapter(MailTemplateListView.class); } catch (Exception e) { m_log.info("execute " + e.getMessage()); return null; } if (view == null) { m_log.info("execute: view is null"); return null; } MailTemplateListComposite composite = (MailTemplateListComposite) view.getListComposite(); WidgetTestUtil.setTestId(this, null, composite); StructuredSelection selection = (StructuredSelection) composite.getTableViewer().getSelection(); List<?> list = (List<?>) selection.getFirstElement(); String managerName = null; String mailTemplateId = null; if (list != null && list.size() > 0) { managerName = (String) list.get(GetMailTemplateListTableDefine.MANAGER_NAME); mailTemplateId = (String) list.get(GetMailTemplateListTableDefine.MAIL_TEMPLATE_ID); } Table table = composite.getTableViewer().getTable(); WidgetTestUtil.setTestId(this, null, table); // ??????? if (mailTemplateId != null) { MailTemplateCreateDialog dialog = new MailTemplateCreateDialog(view.getListComposite().getShell(), managerName, mailTemplateId, PropertyDefineConstant.MODE_MODIFY); if (dialog.open() == IDialogConstants.OK_ID) { int selectIndex = table.getSelectionIndex(); composite.update(); table.setSelection(selectIndex); } } else { MessageDialog.openWarning(null, Messages.getString("warning"), Messages.getString("message.notify.mail.8")); } return null; }
From source file:com.clustercontrol.notify.view.action.NotifyCopyAction.java
License:Open Source License
@Override public Object execute(ExecutionEvent event) throws ExecutionException { // ???//from w ww.j a v a 2s. co m 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(); WidgetTestUtil.setTestId(this, null, composite); StructuredSelection selection = (StructuredSelection) composite.getTableViewer().getSelection(); List<?> list = (List<?>) selection.getFirstElement(); String managerName = null; String notifyId = null; Integer notifyType = null; if (list != null && list.size() > 0) { managerName = (String) list.get(NotifyTableDefineNoCheckBox.MANAGER_NAME); notifyId = (String) list.get(NotifyTableDefineNoCheckBox.NOTIFY_ID); notifyType = (Integer) list.get(NotifyTableDefineNoCheckBox.NOTIFY_TYPE); } Table table = composite.getTableViewer().getTable(); WidgetTestUtil.setTestId(this, null, table); // ??????? if (notifyId != null && notifyType != null) { Shell shell = view.getListComposite().getShell(); if (openDialog(shell, managerName, notifyId, notifyType) == IDialogConstants.OK_ID) { int selectIndex = table.getSelectionIndex(); composite.update(); table.setSelection(selectIndex); } } else { MessageDialog.openWarning(null, Messages.getString("warning"), Messages.getString("message.notify.8")); } return null; }
From source file:com.clustercontrol.repository.composite.action.NodeDoubleClickListener.java
License:Open Source License
/** * ?????<BR>/* w ww. j a v a 2 s.c o m*/ * ?[]????????????? * <P> * <ol> * <li>???????ID????</li> * <li>ID????????</li> * </ol> * * @param event * * @see com.clustercontrol.repository.dialog.NodeCreateDialog * @see org.eclipse.jface.viewers.IDoubleClickListener#doubleClick(org.eclipse.jface.viewers.DoubleClickEvent) */ @Override public void doubleClick(DoubleClickEvent event) { String managerName = null; String facilityId = null; //ID? if (((StructuredSelection) event.getSelection()).getFirstElement() != null) { ArrayList<?> info = (ArrayList<?>) ((StructuredSelection) event.getSelection()).getFirstElement(); managerName = (String) info.get(GetNodeListTableDefine.MANAGER_NAME); facilityId = (String) info.get(GetNodeListTableDefine.FACILITY_ID); } if (facilityId != null) { // ? NodeCreateDialog dialog = new NodeCreateDialog(m_composite.getShell(), managerName, facilityId, true); // ??????????? if (dialog.open() == IDialogConstants.OK_ID) { m_composite.update(); } } }
From source file:com.clustercontrol.repository.composite.action.ScopeDoubleClickListener.java
License:Open Source License
/** * ?????<BR>//from www . ja va 2 s .c o m * ?[]????????????? * <P> * <ol> * <li>????????ID????</li> * <li>?[]???????</li> * <li>?????ID??????</li> * <li>?[]????ID?????</li> * <li>ID????????</li> * </ol> * * @param event * * @see com.clustercontrol.repository.dialog.ScopeCreateDialog * @see org.eclipse.jface.viewers.IDoubleClickListener#doubleClick(org.eclipse.jface.viewers.DoubleClickEvent) */ @Override public void doubleClick(DoubleClickEvent event) { FacilityTreeItem selectFacilityTreeItem = null; ArrayList<?> item = null; String facilityId = null; if (((StructuredSelection) event.getSelection()).getFirstElement() != null) { //?? item = (ArrayList<?>) ((StructuredSelection) event.getSelection()).getFirstElement(); } //?[]?? IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); IViewPart viewPart = page.findView(ScopeListView.ID); if (viewPart != null) { if (item != null) { facilityId = (String) item.get(GetScopeListTableDefine.FACILITY_ID); if (m_composite.getFacilityTreeItem() != null) { List<FacilityTreeItem> items = m_composite.getFacilityTreeItem().getChildren(); for (int i = 0; i < items.size(); i++) { if (facilityId.equals(items.get(i).getData().getFacilityId())) { selectFacilityTreeItem = items.get(i); break; } } } } if (selectFacilityTreeItem != null) { //? m_composite.setSelectFacilityTreeItem(selectFacilityTreeItem); // ??? if (facilityId != null && !selectFacilityTreeItem.getData().isBuiltInFlg() && selectFacilityTreeItem.getData().getFacilityType() == FacilityConstant.TYPE_SCOPE) { FacilityTreeItem manager = ScopePropertyUtil.getManager(selectFacilityTreeItem); String managerName = manager.getData().getFacilityId(); // ? ScopeCreateDialog dialog = new ScopeCreateDialog(m_composite.getShell(), managerName, facilityId, true); // ??????????? if (dialog.open() == IDialogConstants.OK_ID) { ClientSession.doCheck(); m_composite.update(selectFacilityTreeItem); } } } } }