List of usage examples for org.eclipse.jface.dialogs MessageDialog openWarning
public static void openWarning(Shell parent, String title, String message)
From source file:com.clustercontrol.dialog.CommonDialog.java
License:Open Source License
/** * ???/*from w w w . j av a 2 s . co m*/ * <p> * * ??????? * * @param result * ValidateResult */ protected void displayError(ValidateResult result) { MessageDialog.openWarning(null, result.getID(), result.getMessage()); }
From source file:com.clustercontrol.editor.IntegerPropertyDefine.java
License:Open Source License
@Override public void modify(Property element, Object value) { try {/*from w w w . ja v a2 s .c o m*/ if (((String) value).length() == 0) { element.setValue(""); } else if (element.getLowerBound() <= Integer.parseInt((String) value) && Integer.parseInt((String) value) <= element.getUpperBound()) { Integer check = Integer.valueOf(value.toString()); element.setValue(check); } else { String[] args = { String.valueOf(element.getLowerBound()), String.valueOf(element.getUpperBound()) }; // MessageDialog.openWarning(null, Messages.getString("message.hinemos.1"), Messages.getString("message.hinemos.8", args)); } } catch (NumberFormatException e) { } }
From source file:com.clustercontrol.editor.IPv4PropertyDefine.java
License:Open Source License
@Override public void modify(Property element, Object value) { boolean check = false; try {//www . j av a2s .c o m if (((String) value).length() == 0) { check = true; } else if (((String) value).matches(".{1,3}?\\..{1,3}?\\..{1,3}?\\..{1,3}?")) { Inet4Address.getByName((String) value); check = true; } } catch (UnknownHostException e) { } if (check) { element.setValue(value); } else { // MessageDialog.openWarning(null, Messages.getString("message.hinemos.1"), Messages.getString("message.repository.24")); } }
From source file:com.clustercontrol.editor.IPv6PropertyDefine.java
License:Open Source License
@Override public void modify(Property element, Object value) { boolean check = false; try {/*from ww w . ja va 2 s. c o m*/ if (((String) value).length() == 0) { check = true; } // ??IPv4??????IPv6?????????? // IPv6????????Inet6Address? InetAddress address = Inet6Address.getByName((String) value); // IPv6??????? if (address instanceof Inet6Address) { check = true; } } catch (UnknownHostException e) { } if (check) { element.setValue(value); } else { // MessageDialog.openWarning(null, Messages.getString("message.hinemos.1"), Messages.getString("message.repository.25")); } }
From source file:com.clustercontrol.editor.PasswordPropertyDefine.java
License:Open Source License
@Override public void modify(Property element, Object value) { // try {/* w ww . jav a 2s . c o m*/ // if ( ((String) value).getBytes("UTF-8").length <= element.getStringUpperValue() ) { if (((String) value).length() <= element.getStringUpperValue()) { element.setValue(value); } else { String[] args = { String.valueOf(element.getStringUpperValue()) }; // MessageDialog.openWarning(null, Messages.getString("message.hinemos.1"), Messages.getString("message.hinemos.7", args)); } /* } catch (UnsupportedEncodingException e) { }*/ }
From source file:com.clustercontrol.editor.TextAreaPropertyDefine.java
License:Open Source License
@Override public void modify(Property element, Object value) { if (value instanceof String) { //try {/*w ww . j a v a 2s . co m*/ if (element.getStringUpperValue() == DataRangeConstant.TEXT) { element.setValue(value); } //else if ( ((String) value).getBytes("UTF-8").length <= element.getStringUpperValue() ) { else if (((String) value).length() <= element.getStringUpperValue()) { element.setValue(value); } else { String[] args = { String.valueOf(element.getStringUpperValue()) }; // MessageDialog.openWarning(null, Messages.getString("message.hinemos.1"), Messages.getString("message.hinemos.7", args)); } /*} catch (UnsupportedEncodingException e) { }*/ } }
From source file:com.clustercontrol.editor.TextPropertyDefine.java
License:Open Source License
@Override public void modify(Property element, Object value) { //try {//from w w w. j a va2s. co m // if ( ((String) value).getBytes("UTF-8").length <= element.getStringUpperValue() ) { if (((String) value).length() <= element.getStringUpperValue()) { element.setValue(value); } else { String[] args = { String.valueOf(element.getStringUpperValue()) }; // MessageDialog.openWarning(null, Messages.getString("message.hinemos.1"), Messages.getString("message.hinemos.7", args)); } /*} catch (UnsupportedEncodingException e) { }*/ }
From source file:com.clustercontrol.editor.TimePropertyDefine.java
License:Open Source License
@Override public void modify(Property element, Object value) { boolean check = false; SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss"); formatter.setTimeZone(TimezoneUtil.getTimeZone()); Date date = null;//from w ww . j a v a 2 s . co m try { //0??24(??48)??? date = TimeStringConverter.parseTime((String) value); check = true; } catch (ParseException e) { //??????????????? // formatter = new SimpleDateFormat("HH:mm:ss"); // formatter.setTimeZone(TimezoneUtil.getTimeZone()); // try { // date = formatter.parse((String) value); // check = true; // } catch (ParseException e1) { // } } if (check) { element.setValue(date); } else { // MessageDialog.openWarning(null, Messages.getString("message.hinemos.1"), Messages.getString("message.hinemos.6")); } }
From source file:com.clustercontrol.hub.composite.LogFormatKeyListComposite.java
License:Open Source License
/** * ?????//from www . ja va 2 s .co m */ private void initialize() { /* * []? */ GridLayout layout = new GridLayout(1, true); this.setLayout(layout); layout.marginHeight = 0; layout.marginWidth = 0; Table tblLogFormatKeyList = new Table(this, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION); WidgetTestUtil.setTestId(this, null, tblLogFormatKeyList); tblLogFormatKeyList.setHeaderVisible(true); tblLogFormatKeyList.setLinesVisible(true); GridData gridData = new GridData(); gridData.horizontalAlignment = GridData.FILL; gridData.verticalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; gridData.grabExcessVerticalSpace = true; tblLogFormatKeyList.setLayoutData(gridData); // ?? m_tableViewer = new CommonTableViewer(tblLogFormatKeyList); m_tableViewer.createTableColumn(getTableColumnInfoList(), SORT_COLUMN_INDEX, SORT_ORDER); m_tableViewer.addDoubleClickListener(new IDoubleClickListener() { @Override public void doubleClick(DoubleClickEvent event) { //????? String order = getSelectionLogFormatKey(); // ? Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); //???LogFormatKey???? LogFormatKey logFormatKey = getLogFormatKeyListByKey(order); if (logFormatKey != null) { LogKeyPatternDialog dialog = new LogKeyPatternDialog(shell, PropertyDefineConstant.MODE_MODIFY, m_keyList, logFormatKey); if (dialog.open() == IDialogConstants.OK_ID) { getLogFormatKeyList().remove(logFormatKey); addLogFormatKeyList(dialog.getLogFormatKey()); update(); } } else { MessageDialog.openWarning(null, Messages.getString("warning"), Messages.getString("message.monitor.30")); } } }); }
From source file:com.clustercontrol.hub.dialog.LogFormatDialog.java
License:Open Source License
/** * ????/*from ww w .j av a2 s.c om*/ * * @param parent ? */ @Override protected void customizeDialog(final Composite parent) { shell = this.getShell(); parent.getShell().setText(Messages.getString("dialog.hub.log.format")); /** * * ????? */ GridLayout baseLayout = new GridLayout(1, true); baseLayout.marginWidth = 10; baseLayout.marginHeight = 10; //? parent.setLayout(baseLayout); Composite logFormatComposite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(1, true); layout.marginWidth = 5; layout.marginHeight = 5; logFormatComposite.setLayout(layout); GridData gridData = new GridData(); gridData.verticalAlignment = SWT.FILL; // gridData.heightHint = 664; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; logFormatComposite.setLayoutData(gridData); /** TOP Composite */ Composite topComposite = new Composite(logFormatComposite, SWT.NONE); GridData gd_composite = new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1); gd_composite.heightHint = 121; topComposite.setLayoutData(gd_composite); topComposite.setLayout(new GridLayout(2, false)); //? Label label = new Label(topComposite, SWT.LEFT); label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); label.setText(Messages.getString("facility.manager")); if (mode == PropertyDefineConstant.MODE_MODIFY) { managerListComposite = new ManagerListComposite(topComposite, SWT.NONE, false); } else { managerListComposite = new ManagerListComposite(topComposite, SWT.NONE, true); managerListComposite.getComboManagerName().addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { // Update String managerName = managerListComposite.getText(); roleIdListComposite.createRoleIdList(managerName); } }); } gridData = new GridData(); gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; managerListComposite.setLayoutData(gridData); if (null != managerName) { managerListComposite.setText(managerName); } //ID Label labelFormatId = new Label(topComposite, SWT.LEFT); GridData gd_labelFormatId = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1); gd_labelFormatId.widthHint = 136; labelFormatId.setLayoutData(gd_labelFormatId); labelFormatId.setText(Messages.getString("hub.log.format.id")); txtFormatId = new Text(topComposite, SWT.BORDER); txtFormatId.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); txtFormatId.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent arg0) { update(); } }); // Label lblDescription = new Label(topComposite, SWT.LEFT); lblDescription.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); lblDescription.setText(Messages.getString("description")); txtDescription = new Text(topComposite, SWT.BORDER); txtDescription.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); // ID Label labelRoleId = new Label(topComposite, SWT.LEFT); labelRoleId.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); labelRoleId.setText(Messages.getString("owner.role.id")); if (this.mode == PropertyDefineConstant.MODE_MODIFY) { roleIdListComposite = new RoleIdListComposite(topComposite, SWT.NONE, this.managerListComposite.getText(), false, Mode.OWNER_ROLE); } else { roleIdListComposite = new RoleIdListComposite(topComposite, SWT.NONE, this.managerListComposite.getText(), true, Mode.OWNER_ROLE); } gridData = new GridData(); gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; roleIdListComposite.setLayoutData(gridData); // Group timestampLayout = new Group(logFormatComposite, SWT.NONE); GridData gd_timestampLayout = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1); gd_timestampLayout.heightHint = 58; timestampLayout.setLayoutData(gd_timestampLayout); timestampLayout.setText(Messages.getString("dialog.hub.log.format.date.extraction")); timestampLayout.setLayout(new GridLayout(2, false)); Label lblTimestampRegex = new Label(timestampLayout, SWT.NONE); GridData gd_lblTimestampRegex = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1); gd_lblTimestampRegex.widthHint = 144; lblTimestampRegex.setLayoutData(gd_lblTimestampRegex); lblTimestampRegex.setText(Messages.getString("dialog.hub.log.format.date.extraction.pattern")); txtTimestampRegex = new Text(timestampLayout, SWT.BORDER); GridData gd_txtTimestampRegex = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1); gd_txtTimestampRegex.widthHint = 237; txtTimestampRegex.setLayoutData(gd_txtTimestampRegex); Label lblTimestampFormat = new Label(timestampLayout, SWT.NONE); GridData gd_lblTimestampFormat = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1); gd_lblTimestampFormat.widthHint = 113; lblTimestampFormat.setLayoutData(gd_lblTimestampFormat); lblTimestampFormat.setText(Messages.getString("dialog.hub.log.format.date.extraction.format")); txtTimestampFormat = new Text(timestampLayout, SWT.BORDER); GridData gd_txtTimestampFormat = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1); gd_txtTimestampFormat.widthHint = 296; txtTimestampFormat.setLayoutData(gd_txtTimestampFormat); txtTimestampFormat.setMessage("ex. yyyy-MM-dd HH:mm:ss"); // Group keypatLayout = new Group(logFormatComposite, SWT.NONE); keypatLayout.setLayout(new GridLayout(2, false)); GridData gridData_1 = new GridData(); gridData_1.grabExcessHorizontalSpace = true; gridData_1.horizontalAlignment = GridData.FILL; keypatLayout.setLayoutData(gridData_1); keypatLayout.setText(Messages.getString("hub.log.format.key.pattern")); logFormatKeyListComposite = new LogFormatKeyListComposite(keypatLayout, SWT.BORDER, managerName); GridData gd_logFormatKeyListComposite = new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1); gd_logFormatKeyListComposite.heightHint = 217; gd_logFormatKeyListComposite.widthHint = 393; logFormatKeyListComposite.setLayoutData(gd_logFormatKeyListComposite); Composite composite = new Composite(keypatLayout, SWT.NONE); composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1)); composite.setLayout(new GridLayout(1, false)); btnAddKeyPattern = new Button(composite, SWT.NONE); GridData gd_btnAddKeyPattern = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1); gd_btnAddKeyPattern.widthHint = 75; btnAddKeyPattern.setLayoutData(gd_btnAddKeyPattern); btnAddKeyPattern.setText(Messages.getString("add")); btnAddKeyPattern.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { // ? Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); LogKeyPatternDialog dialog = new LogKeyPatternDialog(shell, PropertyDefineConstant.MODE_ADD, logFormatKeyListComposite.getLogFormatKeyList()); if (dialog.open() == IDialogConstants.OK_ID) { logFormatKeyListComposite.addLogFormatKeyList(dialog.getLogFormatKey()); logFormatKeyListComposite.update(); } } }); btnModifyKeyPattern = new Button(composite, SWT.NONE); btnModifyKeyPattern.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); btnModifyKeyPattern.setText(Messages.getString("modify")); btnModifyKeyPattern.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { //????? String order = logFormatKeyListComposite.getSelectionLogFormatKey(); // ? Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); //???LogFormatKey???? LogFormatKey logFormatKey = logFormatKeyListComposite.getLogFormatKeyListByKey(order); if (logFormatKey != null) { LogKeyPatternDialog dialog = new LogKeyPatternDialog(shell, PropertyDefineConstant.MODE_MODIFY, logFormatKeyListComposite.getLogFormatKeyList(), logFormatKey); if (dialog.open() == IDialogConstants.OK_ID) { logFormatKeyListComposite.getLogFormatKeyList().remove(logFormatKey); logFormatKeyListComposite.addLogFormatKeyList(dialog.getLogFormatKey()); logFormatKeyListComposite.update(); } } else { MessageDialog.openWarning(null, Messages.getString("warning"), Messages.getString("message.monitor.30")); } } }); btnDelKeyPattern = new Button(composite, SWT.NONE); btnDelKeyPattern.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); btnDelKeyPattern.setText(Messages.getString("delete")); btnDelKeyPattern.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { //????? String order = logFormatKeyListComposite.getSelectionLogFormatKey(); //???LogFormatKey???? LogFormatKey logFormatKey = logFormatKeyListComposite.getLogFormatKeyListByKey(order); String[] args = new String[1]; args[0] = order; if (logFormatKey != null) { if (MessageDialog.openConfirm(null, Messages.getString("confirmed"), Messages.getString("message.hub.log.format.pattern.delete", args))) { logFormatKeyListComposite.getLogFormatKeyList().remove(logFormatKey); logFormatKeyListComposite.update(); } } else { MessageDialog.openWarning(null, Messages.getString("warning"), Messages.getString("message.monitor.30")); } } }); btnCopyKeyPattern = new Button(composite, SWT.NONE); btnCopyKeyPattern.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); btnCopyKeyPattern.setText(Messages.getString("copy")); btnCopyKeyPattern.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { //????? String order = logFormatKeyListComposite.getSelectionLogFormatKey(); if (order != null) { // ? Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); //???LogFormatKey???? LogFormatKey logFormatKey = logFormatKeyListComposite.getLogFormatKeyListByKey(order); if (logFormatKey != null) { LogKeyPatternDialog dialog = new LogKeyPatternDialog(shell, PropertyDefineConstant.MODE_COPY, logFormatKeyListComposite.getLogFormatKeyList(), logFormatKey); if (dialog.open() == IDialogConstants.OK_ID) { logFormatKeyListComposite.addLogFormatKeyList(dialog.getLogFormatKey()); logFormatKeyListComposite.update(); //logFormatKeyListComposite.setSelection(); } } } else { MessageDialog.openWarning(null, Messages.getString("warning"), Messages.getString("message.monitor.30")); } } }); this.reflectLogFormat(); update(); }