List of usage examples for org.eclipse.jface.dialogs MessageDialog WARNING
int WARNING
To view the source code for org.eclipse.jface.dialogs MessageDialog WARNING.
Click Source Link
From source file:org.eclipse.birt.report.designer.internal.ui.dialogs.BindingDialogHelper.java
License:Open Source License
private boolean canProcessFunctionTypeError(String function, String type, String recommended) { MessageDialog dialog = new MessageDialog(UIUtil.getDefaultShell(), Messages.getString("Warning"), //$NON-NLS-1$ null, Messages.getFormattedString("BindingDialogHelper.warning.function", //$NON-NLS-1$ new String[] { recommended }), MessageDialog.WARNING, new String[] { Messages.getString(Messages.getString("BindingDialogHelper.warning.button.yes")), //$NON-NLS-1$ Messages.getString(Messages.getString("BindingDialogHelper.warning.button.no")) //$NON-NLS-1$ }, 0);/*from w ww .j a v a 2s. co m*/ return dialog.open() == 0; }
From source file:org.eclipse.birt.report.designer.internal.ui.dialogs.BindingDialogHelper.java
License:Open Source License
private boolean canProcessParamTypeError(String expression, String parameter) { MessageDialog dialog = new MessageDialog(UIUtil.getDefaultShell(), Messages.getString("Warning"), //$NON-NLS-1$ null, Messages.getFormattedString("BindingDialogHelper.warning.parameter", //$NON-NLS-1$ new String[] { expression, parameter }), MessageDialog.WARNING, new String[] { Messages.getString("BindingDialogHelper.warning.button.yes"), //$NON-NLS-1$ Messages.getString("BindingDialogHelper.warning.button.no") //$NON-NLS-1$ }, 0);//from w w w . java2 s .c o m return dialog.open() == 0; }
From source file:org.eclipse.birt.report.designer.ui.cubebuilder.page.CubeBuilder.java
License:Open Source License
private boolean checkCubeLink() { List childList = new ArrayList(); if (input != null) { DimensionHandle[] dimensions = (DimensionHandle[]) input.getContents(ICubeModel.DIMENSIONS_PROP) .toArray(new DimensionHandle[0]); for (int i = 0; i < dimensions.length; i++) { TabularHierarchyHandle hierarchy = (TabularHierarchyHandle) dimensions[i].getDefaultHierarchy(); if (hierarchy != null && hierarchy.getDataSet() != null && hierarchy.getDataSet() != input.getDataSet()) childList.add(hierarchy); }//from w ww . j a v a2 s.c o m } if (childList.size() == 0) return true; else { boolean flag = true; HashMap conditionMap = new HashMap(); for (int i = 0; i < childList.size(); i++) { flag = true; HierarchyHandle hierarchy = (HierarchyHandle) childList.get(i); Iterator iter = input.joinConditionsIterator(); while (iter.hasNext()) { DimensionConditionHandle condition = (DimensionConditionHandle) iter.next(); HierarchyHandle conditionHierarchy = condition.getHierarchy(); if (ModuleUtil.isEqualHierarchiesForJointCondition(conditionHierarchy, hierarchy)) { if (condition.getJoinConditions() != null) { Iterator iter1 = condition.getJoinConditions().iterator(); while (iter1.hasNext()) { iter1.next(); int number = conditionMap.containsKey(conditionHierarchy) ? ((Integer) conditionMap.get(conditionHierarchy)).intValue() : 0; conditionMap.put(conditionHierarchy, ++number); flag = false; } } } } if (flag) break; } if (flag) { conditionMap.clear(); String[] buttons = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }; MessageDialog d = new MessageDialog(getShell(), Messages.getString("MissLinkDialog.Title"), //$NON-NLS-1$ null, Messages.getString("MissLinkDialog.Question"), //$NON-NLS-1$ MessageDialog.WARNING, buttons, 0); int result = d.open(); if (result == 1) return true; else { this.showSelectionPage(getLinkGroupNode()); return false; } } conditionMap.clear(); return true; } }
From source file:org.eclipse.birt.report.designer.ui.cubebuilder.page.CubeGroupContent.java
License:Open Source License
private boolean checkColumnDataType(ResultSetColumnHandle dataField) { if (dataField.getDataType().equals(DesignChoiceConstants.COLUMN_DATA_TYPE_ANY)) { MessageDialog dialog = new MessageDialog(UIUtil.getDefaultShell(), Messages.getString("CubeGroupContent.MeasureDataTypeErrorDialog.Title"), //$NON-NLS-1$ null, Messages.getFormattedString("CubeGroupContent.MeasureDataTypeErrorDialog.Message", //$NON-NLS-1$ new Object[] { OlapUtil.getDataFieldDisplayName(dataField) }), MessageDialog.WARNING, new String[] { IDialogConstants.OK_LABEL }, 0); dialog.open();/*from w w w . j a v a 2 s . com*/ return false; } return true; }
From source file:org.eclipse.birt.report.designer.ui.dialogs.ExpressionBuilder.java
License:Open Source License
protected void okPressed() { if (!validateScript()) { MessageDialog dialog = new MessageDialog(getShell(), Messages.getString("ExpressionBuilder.Script.Warning"), //$NON-NLS-1$ null, // Accept the default window icon. Messages.getString("ExpressionBuilder.Script.Confirm"), //$NON-NLS-1$ MessageDialog.WARNING, new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 1); // Cancel is the default. if (dialog.open() != 0) { return; }/* w w w.ja v a2s.c om*/ } expression = sourceViewer.getTextWidget().getText().trim(); super.okPressed(); }
From source file:org.eclipse.birt.report.designer.ui.dialogs.ThumbnailBuilder.java
License:Open Source License
private boolean continueSaveImage(String fileName) { final int MAX_PIXEL = 1024 * 768; final long FILE_SIZE = 1 * 1024 * 1024; File file = new File(fileName); if (file.length() <= FILE_SIZE) { Image locImage = null;/*from ww w. jav a 2 s . c o m*/ try { locImage = new Image(null, fileName); ImageData imageData = locImage.getImageData(); if (locImage != null && locImage.getImageData() != null) { int imagePixel = imageData.height * imageData.width; if (imagePixel <= MAX_PIXEL) { return true; } } } catch (Throwable e) { // catch the image format exception, doesn't do anything. } finally { if (locImage != null) { locImage.dispose(); } } } MessageDialog dialog = new MessageDialog(UIUtil.getDefaultShell(), Messages.getString("ThumbnailBuilder.PreviewImage.WarningDialog.Title"), //$NON-NLS-1$ null, // accept Messages.getString("ThumbnailBuilder.PreviewImage.WarningDialog.Prompt"), //$NON-NLS-1$ MessageDialog.WARNING, new String[] { IDialogConstants.PROCEED_LABEL, IDialogConstants.CANCEL_LABEL }, 1); boolean ret = (dialog.open() == 0) ? true : false; return ret; }
From source file:org.eclipse.bpel.common.ui.editmodel.EditModelCommandStack.java
License:Open Source License
protected boolean validateEdit(Command command) { Resource[] resources = getResources(command); if (resources.length == 0) return true; boolean disposeShell = false; Shell shell;//from ww w. j a v a 2 s . com IWorkbenchWindow win = CommonUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow(); if (win != null) { shell = win.getShell(); } else { disposeShell = true; shell = new Shell(); } try { IFile[] files = new IFile[resources.length]; StringBuffer filesString = new StringBuffer(); for (int i = 0; i < resources.length; i++) { Resource resource = resources[i]; files[i] = EditModel.getIFileForURI(resource.getURI()); filesString.append(files[i].getName()); if (i < resources.length - 1) filesString.append(", "); //$NON-NLS-1$ } IStatus stat = ResourcesPlugin.getWorkspace().validateEdit(files, shell); if (stat.getSeverity() == IStatus.CANCEL) { return false; } else if (!stat.isOK()) { String[] buttons = { IDialogConstants.OK_LABEL }; // String msg; if (files.length == 1) msg = NLS.bind(Messages.EditModelCommandStack_validateEdit_message0, (new String[] { filesString.toString(), stat.getMessage() })); else msg = NLS.bind(Messages.EditModelCommandStack_validateEdit_message1, (new String[] { filesString.toString(), stat.getMessage() })); MessageDialog dialog = new MessageDialog(shell, Messages.EditModelCommandStack_validateEdit_title, null, // accept the default windowing system icon msg, MessageDialog.WARNING, buttons, 0); dialog.open(); return false; } } finally { if (disposeShell) shell.dispose(); } return true; }
From source file:org.eclipse.cdt.internal.ui.actions.FormatAllAction.java
License:Open Source License
@Override public void run(IStructuredSelection selection) { ITranslationUnit[] tus = getTranslationUnits(selection); if (tus.length == 0) return;//from w ww . ja va 2 s. c om if (tus.length > 1) { int returnCode = OptionalMessageDialog.open("FormatAll", //$NON-NLS-1$ getShell(), ActionMessages.FormatAllAction_noundo_title, null, ActionMessages.FormatAllAction_noundo_message, MessageDialog.WARNING, new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 0); if (returnCode != OptionalMessageDialog.NOT_SHOWN && returnCode != Window.OK) return; } IStatus status = Resources.makeCommittable(getResources(tus), getShell()); if (!status.isOK()) { ErrorDialog.openError(getShell(), ActionMessages.FormatAllAction_failedvalidateedit_title, ActionMessages.FormatAllAction_failedvalidateedit_message, status); return; } runOnMultiple(tus); }
From source file:org.eclipse.cdt.internal.ui.text.contentassist.ContentAssistProcessor.java
License:Open Source License
/** * Informs the user about the fact that there are no enabled categories in the default content * assist set and shows a link to the preferences. *//*from w ww. j a v a 2s. co m*/ private boolean informUserAboutEmptyDefaultCategory() { if (OptionalMessageDialog.isDialogEnabled(PREF_WARN_ABOUT_EMPTY_ASSIST_CATEGORY)) { final Shell shell = CUIPlugin.getActiveWorkbenchShell(); String title = ContentAssistMessages.ContentAssistProcessor_all_disabled_title; String message = ContentAssistMessages.ContentAssistProcessor_all_disabled_message; // see PreferencePage#createControl for the 'defaults' label final String restoreButtonLabel = JFaceResources.getString("defaults"); //$NON-NLS-1$ final String linkMessage = Messages.format( ContentAssistMessages.ContentAssistProcessor_all_disabled_preference_link, LegacyActionTools.removeMnemonics(restoreButtonLabel)); final int restoreId = IDialogConstants.CLIENT_ID + 10; final int settingsId = IDialogConstants.CLIENT_ID + 11; final OptionalMessageDialog dialog = new OptionalMessageDialog(PREF_WARN_ABOUT_EMPTY_ASSIST_CATEGORY, shell, title, null /* default image */, message, MessageDialog.WARNING, new String[] { restoreButtonLabel, IDialogConstants.CLOSE_LABEL }, 1) { /* * @see org.eclipse.cdt.internal.ui.dialogs.OptionalMessageDialog#createCustomArea(org.eclipse.swt.widgets.Composite) */ @Override protected Control createCustomArea(Composite composite) { // wrap link and checkbox in one composite without space Composite parent = new Composite(composite, SWT.NONE); GridLayout layout = new GridLayout(); layout.marginHeight = 0; layout.marginWidth = 0; layout.verticalSpacing = 0; parent.setLayout(layout); Composite linkComposite = new Composite(parent, SWT.NONE); layout = new GridLayout(); layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); linkComposite.setLayout(layout); Link link = new Link(linkComposite, SWT.NONE); link.setText(linkMessage); link.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { setReturnCode(settingsId); close(); } }); GridData gridData = new GridData(SWT.FILL, SWT.BEGINNING, true, false); gridData.widthHint = this.getMinimumMessageWidth(); link.setLayoutData(gridData); // create checkbox and "don't show this message" prompt super.createCustomArea(parent); return parent; } /* * @see org.eclipse.jface.dialogs.MessageDialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) */ @Override protected void createButtonsForButtonBar(Composite parent) { Button[] buttons = new Button[2]; buttons[0] = createButton(parent, restoreId, restoreButtonLabel, false); buttons[1] = createButton(parent, IDialogConstants.CLOSE_ID, IDialogConstants.CLOSE_LABEL, true); setButtons(buttons); } }; int returnValue = dialog.open(); if (restoreId == returnValue || settingsId == returnValue) { if (restoreId == returnValue) { IPreferenceStore store = CUIPlugin.getDefault().getPreferenceStore(); store.setToDefault(PreferenceConstants.CODEASSIST_CATEGORY_ORDER); store.setToDefault(PreferenceConstants.CODEASSIST_EXCLUDED_CATEGORIES); } if (settingsId == returnValue) PreferencesUtil .createPreferenceDialogOn(shell, "org.eclipse.cdt.ui.preferences.CodeAssistPreferenceAdvanced", null, null) //$NON-NLS-1$ .open(); CompletionProposalComputerRegistry registry = CompletionProposalComputerRegistry.getDefault(); registry.reload(); return true; } } return false; }
From source file:org.eclipse.datatools.enablement.sybase.asa.schemaobjecteditor.examples.tableeditor.pages.columns.ASATableEditorColumnsViewer.java
License:Open Source License
/** * Configure the columns table.//from ww w. j a va2s . c o m * */ protected void configureTable() { _viewer.getTable().setHeaderVisible(true); _viewer.getTable().setLinesVisible(true); _viewer.getTable().setLayoutData(new GridData(GridData.FILL_BOTH)); CellEditor editors[] = new CellEditor[_data.getColumnCount()]; String[] properties = new String[_data.getColumnCount()]; for (int i = 0; i < _data.getColumnCount(); i++) { TableColumn col = new TableColumn(_viewer.getTable(), SWT.NONE); col.setText(_data.getColumnName(i)); col.pack(); col.setWidth(ASATableEditorColumnsTableData.COLUMN_LENGTH[i]); if (i == ASATableEditorColumnsTableData.MARKER_COLUMN) { col.setResizable(false); } // Hide the unique column if not needed if (!_needMarkerColumn && i == ASATableEditorColumnsTableData.MARKER_COLUMN) { col.setResizable(false); col.setWidth(0); col.setText(""); //$NON-NLS-1$ } // Hide the unique column if not needed if (!_needUniqueColumn && i == ASATableEditorColumnsTableData.UNIQUE_COLUMN) { col.setResizable(false); col.setWidth(0); col.setText(""); //$NON-NLS-1$ } CellEditor currentEditor = null; switch (i) { case ASATableEditorColumnsTableData.PRI_KEY_COLUMN: currentEditor = new TableCheckBoxCellEditor(_viewer); break; case ASATableEditorColumnsTableData.NAME_COLUMN: currentEditor = new TableCellEditor(_viewer); break; case ASATableEditorColumnsTableData.TYPE_COLUMN: SQLDevToolsConfiguration config = SQLToolsFacade.getConfigurationByVendorIdentifier( ProfileUtil.getDatabaseVendorDefinitionId(_databaseIdentifier.getProfileName())); DataTypeProvider provider = config.getSQLDataService().getDataTypeProvider(); currentEditor = new TableComboBoxCellEditor(_viewer, provider.getAvailableDataTypesDisplayString( DataTypeProvider.TABLE_COLUMN, getOriginalSchema(), _databaseIdentifier)); break; case ASATableEditorColumnsTableData.NULLABLE_COLUMN: currentEditor = new TableCheckBoxCellEditor(_viewer); break; case ASATableEditorColumnsTableData.DEFAULT_COLUMN: currentEditor = new TableDialogCellEditor(_viewer) { public Object openDialogBox(Control cellEditorWindow) { if (_viewer.getRow() == null) { return null; } ASATableEditorColumnRowData row = (ASATableEditorColumnRowData) _viewer.getRow(); SybaseASABaseColumn column = ((ASATableEditorColumnRowData) _viewer.getRow()).getColumn(); if (column.getDataType() == null) { String[] buttons = new String[] { IDialogConstants.OK_LABEL }; MessageDialog d = new MessageDialog(ExamplePlugin.getActiveWorkbenchShell(), Messages.ASATableEditorColumnsViewer_warning, null, Messages.ASATableEditorColumnsViewer_invalid_data_type, MessageDialog.WARNING, buttons, 0); d.open(); return null; } ColumnDefaultValueInputDialog dlg = new ColumnDefaultValueInputDialog( cellEditorWindow.getShell(), column, !(column.isIsComputedColumn() || true)); if (dlg.open() == Window.OK) { row.updateValue(ASATableEditorColumnsTableData.DEFAULT_COLUMN, column.getDefaultValue()); _viewer.refresh(); _viewer.getCursor().edit(); } return null; } }; break; case ASATableEditorColumnsTableData.UNIQUE_COLUMN: // dont create editor for the unique column if not needed if (_needUniqueColumn) { currentEditor = new TableCheckBoxCellEditor(_viewer); } break; case ASATableEditorColumnsTableData.COMMENT_COLUMN: currentEditor = new TableCellEditor(_viewer); break; default: break; } editors[i] = currentEditor; properties[i] = _data.getColumnName(i); } _viewer.setColumnProperties(properties); _viewer.setCellEditors(editors); _viewer.setCellModifier(_modifier); }