List of usage examples for org.eclipse.jface.dialogs IMessageProvider ERROR
int ERROR
To view the source code for org.eclipse.jface.dialogs IMessageProvider ERROR.
Click Source Link
From source file:org.eclipse.birt.report.designer.data.ui.dataset.DataSetParametersPage.java
License:Open Source License
protected void refreshMessage() { getContainer().setMessage(DEFAULT_MESSAGE, IMessageProvider.NONE); if (!doSaveEmptyParameter(parameters)) { getContainer()// w ww . java 2s . com .setMessage(Messages.getFormattedString("dataset.editor.error.noInputParameterDefaultValue", //$NON-NLS-1$ new Object[] { this.getNoneValuedParameterName() }), IMessageProvider.ERROR); } }
From source file:org.eclipse.birt.report.designer.data.ui.dataset.DataSetSettingsPage.java
License:Open Source License
/** * Add row fetch limit control group.// ww w. j a va 2s . c om * * @param composite */ private void addDataFetchSettingGroup(Composite composite) { GridLayout groupGridLayout = new GridLayout(); groupGridLayout.numColumns = 5; GridData groupGridData = new GridData(GridData.FILL_HORIZONTAL); Group dataFetchSettingGroup = new Group(composite, SWT.NONE); dataFetchSettingGroup.setLayoutData(groupGridData); dataFetchSettingGroup.setLayout(groupGridLayout); dataFetchSettingGroup.setText(Messages.getString("dataset.editor.settings.dataFetchSetting")); //$NON-NLS-1$ fetchAllDataCheckBox = new Button(dataFetchSettingGroup, SWT.CHECK); GridData data = new GridData(); data.horizontalSpan = 5; fetchAllDataCheckBox.setLayoutData(data); fetchAllDataCheckBox.setText(Messages.getString("dataset.editor.settings.dataFetchSetting.fetchAll")); //$NON-NLS-1$ final Label dataFetchLabel = new Label(dataFetchSettingGroup, SWT.NONE); dataFetchLabel.setText(Messages.getString("SettingsPage.dataFetchSetting.label")); //$NON-NLS-1$ final Text rowFetchLimitText = new Text(dataFetchSettingGroup, SWT.BORDER); GridData gData = new GridData(GridData.FILL_HORIZONTAL); rowFetchLimitText.setLayoutData(gData); if (getDataSetRowFetchLimit() > 0) { fetchAllDataCheckBox.setSelection(false); rowFetchLimitText.setEnabled(true); dataFetchLabel.setEnabled(true); rowFetchLimitText.setText(Integer.toString(getDataSetRowFetchLimit())); } else { fetchAllDataCheckBox.setSelection(true); rowFetchLimitText.setEnabled(false); dataFetchLabel.setEnabled(false); rowFetchLimitText.setText(""); //$NON-NLS-1$ } fetchAllDataCheckBox.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { final boolean isSelection = fetchAllDataCheckBox.getSelection(); dataFetchLabel.setEnabled(!isSelection); rowFetchLimitText.setEnabled(!isSelection); if (isSelection) { rowFetchLimitText.setText(""); //$NON-NLS-1$ } } }); rowFetchLimitText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { int rowFetchLimit = 0; try { if (isNumber(rowFetchLimitText.getText())) { String rowLimitText = rowFetchLimitText.getText(); if (rowLimitText.trim().length() == 0) rowLimitText = "0"; //$NON-NLS-1$ rowFetchLimit = new Double(rowLimitText).intValue(); rowFetchLimit = rowFetchLimit < 0 ? 0 : rowFetchLimit; setDataSetRowFetchLimit(rowFetchLimit); getContainer().setMessage(DEFAULT_MESSAGE, IMessageProvider.NONE); } else { getContainer().setMessage( Messages.getString("dataset.editor.settings.dataFetchSetting.errorNumberFormat"), //$NON-NLS-1$ IMessageProvider.ERROR); } } catch (SemanticException e1) { getContainer().setMessage( Messages.getString("dataset.editor.settings.dataFetchSetting.errorNumberFormat"), //$NON-NLS-1$ IMessageProvider.ERROR); } } }); }
From source file:org.eclipse.birt.report.designer.data.ui.dataset.DataSetSettingsPage.java
License:Open Source License
private void addResultSetGroup(Composite composite) { GridLayout groupGridLayout = new GridLayout(); GridData groupGridData = new GridData(GridData.FILL_HORIZONTAL); Group resultSetNumberGroup = new Group(composite, SWT.NONE); resultSetNumberGroup.setLayoutData(groupGridData); resultSetNumberGroup.setLayout(groupGridLayout); resultSetNumberGroup// w w w . j a v a 2 s .c o m .setText(Messages.getString("dataset.editor.settings.resultsetselection.resultSetSelection")); //$NON-NLS-1$ selectResultSetCheckBox = new Button(resultSetNumberGroup, SWT.CHECK); GridData data = new GridData(); selectResultSetCheckBox.setLayoutData(data); selectResultSetCheckBox .setText(Messages.getString("dataset.editor.settings.resultsetselection.enableResultSetSelection")); //$NON-NLS-1$ Composite selectionComposite = new Composite(resultSetNumberGroup, SWT.NONE); GridLayout cmpLayout = new GridLayout(); cmpLayout.numColumns = 5; selectionComposite.setLayout(cmpLayout); GridData cmpGridData = new GridData(GridData.FILL_HORIZONTAL); selectionComposite.setLayoutData(cmpGridData); resultSetName = new Button(selectionComposite, SWT.RADIO); data = new GridData(); data.horizontalSpan = 3; resultSetName.setLayoutData(data); resultSetName .setText(Messages.getString("dataset.editor.settings.resultsetselection.selectResultSetByName")); //$NON-NLS-1$ final Text nameText = new Text(selectionComposite, SWT.BORDER); GridData gData = new GridData(GridData.FILL_HORIZONTAL); /* * gData.horizontalSpan = 2; gData.widthHint = 100; */ nameText.setLayoutData(gData); resultSetNumber = new Button(selectionComposite, SWT.RADIO); data = new GridData(); data.horizontalSpan = 3; resultSetNumber.setLayoutData(data); resultSetNumber .setText(Messages.getString("dataset.editor.settings.resultsetselection.selectResultSetByNumber")); //$NON-NLS-1$ final Text numberText = new Text(selectionComposite, SWT.BORDER); gData = new GridData(GridData.FILL_HORIZONTAL); numberText.setLayoutData(gData); selectResultSetCheckBox.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { final boolean selected = selectResultSetCheckBox.getSelection(); resultSetName.setEnabled(selected); resultSetNumber.setEnabled(selected); if (selected) { if (resultSetName.getSelection()) { numberText.setEnabled(false); nameText.setEnabled(true); } else if (resultSetNumber.getSelection()) { nameText.setEnabled(false); numberText.setEnabled(true); } else { nameText.setEnabled(selected); numberText.setEnabled(selected); } } else { nameText.setEnabled(selected); numberText.setEnabled(selected); } changed = true; } }); resultSetName.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { nameText.setEnabled(true); numberText.setEnabled(false); changed = true; } }); resultSetNumber.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { nameText.setEnabled(false); numberText.setEnabled(true); changed = true; } }); nameText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { DataSetSettingsPage.this.nameText = nameText.getText(); changed = true; } }); numberText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { int rsNumber = 0; if (isNumber(numberText.getText())) { String number = numberText.getText(); if (number.trim().length() == 0) number = "0"; //$NON-NLS-1$ DataSetSettingsPage.this.numberText = numberText.getText(); getContainer().setMessage(DEFAULT_MESSAGE, IMessageProvider.NONE); changed = true; } else { getContainer().setMessage( Messages.getString( "dataset.editor.settings.dataFetchSetting.errorNumberFormatForResultSet"), //$NON-NLS-1$ IMessageProvider.ERROR); } } }); if (((OdaDataSetHandle) ((DataSetEditor) getContainer()).getHandle()).getResultSetName() != null) { resultSetName.setSelection(true); nameText.setText(((OdaDataSetHandle) ((DataSetEditor) getContainer()).getHandle()).getResultSetName()); numberText.setEnabled(false); selectResultSetCheckBox.setSelection(true); } else if (((OdaDataSetHandle) ((DataSetEditor) getContainer()).getHandle()) .getPropertyHandle(IOdaDataSetModel.RESULT_SET_NUMBER_PROP).isSet()) { resultSetNumber.setSelection(true); numberText.setText(String.valueOf( ((OdaDataSetHandle) ((DataSetEditor) getContainer()).getHandle()).getResultSetNumber())); nameText.setEnabled(false); selectResultSetCheckBox.setSelection(true); } else { selectResultSetCheckBox.setSelection(false); resultSetName.setSelection(true); resultSetName.setEnabled(false); resultSetNumber.setEnabled(false); nameText.setEnabled(false); numberText.setEnabled(false); } }
From source file:org.eclipse.birt.report.designer.data.ui.dataset.JointDataSetPage.java
License:Open Source License
/** * /*from w w w . j ava 2s . co m*/ * @param name * @param expression * @param type */ private void populateDataSet(String name, String expression, int type) { int selectionIndex = -1; for (int i = 0; i < dataSetList.size(); i++) { DataSetHandle dataHandle = (DataSetHandle) dataSetList.get(i); if (dataHandle.getQualifiedName().equals(name)) { selectionIndex = i; break; } } if (type == LEFT_DATASET) { if (selectionIndex >= 0) { leftDataSetChooser.setSelection(new StructuredSelection(dataSetList.get(selectionIndex))); if (leftColumnList.getInput() != null && leftColumnList.getInput() instanceof DataSetViewData[]) { DataSetViewData[] dataSetItems = (DataSetViewData[]) leftColumnList.getInput(); if (dataSetItems.length > 0) { String rowExpr; for (int i = 0; i < dataSetItems.length; i++) { rowExpr = ExpressionUtil.createJSDataSetRowExpression(dataSetItems[i].getName()); if (rowExpr.equals(expression)) { selectionIndex = i; break; } } leftColumnList.setSelection(new StructuredSelection(dataSetItems[selectionIndex])); } } } else { setPageMessage(Messages.getString("JointDataSetPage.error.nodataset.left"), //$NON-NLS-1$ IMessageProvider.ERROR); } } if (type == RIGHT_DATASET) { if (selectionIndex >= 0) { rightDataSetChooser.setSelection(new StructuredSelection(dataSetList.get(selectionIndex))); if (rightColumnList.getInput() != null && rightColumnList.getInput() instanceof DataSetViewData[]) { DataSetViewData[] dataSetItems = (DataSetViewData[]) rightColumnList.getInput(); if (dataSetItems.length > 0) { String rowExpr; for (int i = 0; i < dataSetItems.length; i++) { rowExpr = ExpressionUtil.createJSDataSetRowExpression(dataSetItems[i].getName()); if (rowExpr.equals(expression)) { selectionIndex = i; break; } } rightColumnList.setSelection(new StructuredSelection(dataSetItems[selectionIndex])); } } } else { setPageMessage(Messages.getString("JointDataSetPage.error.nodataset.right"), //$NON-NLS-1$ IMessageProvider.ERROR); } } }
From source file:org.eclipse.birt.report.designer.data.ui.dataset.OutputColumnDefnPage.java
License:Open Source License
protected void doNew() { ColumnInputDialog inputDialog = new ColumnInputDialog(viewer.getControl().getShell(), Messages.getString("ResultSetColumnPage.inputDialog.newColumn.title"), //$NON-NLS-1$ new ColumnDefn()); if (inputDialog.open() == Window.OK) { ColumnDefn newColumn = inputDialog.getColumnDefn(); try {/* w w w . j av a 2s . co m*/ addNewDefn(newColumn); viewer.getViewer().refresh(); updateMessage(); } catch (SemanticException e) { getContainer().setMessage(Messages.getString("OutputColumnPage.error.createNewColumn"), //$NON-NLS-1$ IMessageProvider.ERROR); ExceptionHandler.handle(e); } } updateButtons(); }
From source file:org.eclipse.birt.report.designer.data.ui.dataset.OutputColumnDefnPage.java
License:Open Source License
protected void doEdit() { int index = viewer.getViewer().getTable().getSelectionIndex(); if (index >= 0 && index < viewer.getViewer().getTable().getItemCount()) { ColumnDefn currentColumn = (ColumnDefn) viewer.getViewer().getTable().getItem(index).getData(); String oldName = currentColumn.getColumnName(); ColumnInputDialog inputDialog = new ColumnInputDialog(viewer.getControl().getShell(), Messages.getString("ResultSetColumnPage.inputDialog.editColumn.title"), //$NON-NLS-1$ currentColumn);//w w w . j ava2 s .c o m if (inputDialog.open() == Window.OK) { updateColumnDefMap(oldName, inputDialog.getColumnDefn()); viewer.getViewer().refresh(); updateMessage(); } } else { getContainer().setMessage(Messages.getString("OutputColumnPage.error.invalidSelection"), //$NON-NLS-1$ IMessageProvider.ERROR); } updateButtons(); }
From source file:org.eclipse.birt.report.designer.data.ui.dataset.OutputColumnDefnPage.java
License:Open Source License
/** * Check the alias names whether is valid. The invalid situation may be the * same name of alias or the same name between column name and alias name. * //from www .ja v a 2 s.c o m */ private boolean isValid() { boolean validate = true; String newColumnNameOrAlias; if (columnHints == null) { columnHints = ((DataSetHandle) getContainer().getModel()) .getPropertyHandle(DataSetHandle.COLUMN_HINTS_PROP); } Iterator iterator1 = columnHints.iterator(); for (int i = 0; iterator1.hasNext() && validate; i++) { ColumnHintHandle columnHint = (ColumnHintHandle) iterator1.next(); newColumnNameOrAlias = columnHint.getAlias(); Iterator iterator2 = columnHints.iterator(); if (newColumnNameOrAlias != null && newColumnNameOrAlias.length() > 0) { for (int n = 0; iterator2.hasNext(); n++) { ColumnHintHandle columnHint2 = (ColumnHintHandle) iterator2.next(); if (i == n) continue; if ((columnHint2.getColumnName() != null && columnHint2.getColumnName().equals(newColumnNameOrAlias)) || (columnHint2.getAlias() != null && columnHint2.getAlias().equals(newColumnNameOrAlias))) { validate = false; getContainer().setMessage( Messages.getFormattedString("dataset.editor.error.columnOrAliasNameAlreadyUsed", //$NON-NLS-1$ new Object[] { newColumnNameOrAlias, n > i ? Integer.valueOf(i + 1) : Integer.valueOf(n + 1), n > i ? Integer.valueOf(n + 1) : Integer.valueOf(i + 1) }), IMessageProvider.ERROR); break; } } } } return validate; }
From source file:org.eclipse.birt.report.designer.data.ui.dataset.OutputColumnsPage.java
License:Open Source License
/** * validates that the new name/alias from a column hint or a new custom * column doesn't conflict with existing column names or aliases * /*from w w w .j av a 2s .c o m*/ */ private boolean isValid() { boolean validate = true; String newColumnNameOrAlias; DataSetViewData[] items = null; if (viewer == null || viewer.getViewer() == null) { try { items = DataSetProvider.getCurrentInstance() .getColumns(((DataSetEditor) getContainer()).getHandle(), false, true); } catch (Exception e) { ExceptionHandler.handle(e, true); } } else { items = (DataSetViewData[]) viewer.getViewer().getInput(); } for (int i = 0; items != null && i < items.length && validate; i++) { newColumnNameOrAlias = items[i].getAlias(); if (newColumnNameOrAlias != null && newColumnNameOrAlias.length() > 0) { for (int n = 0; n < items.length; n++) { if (i == n) continue; if ((items[n].getName() != null && items[n].getName().equals(newColumnNameOrAlias)) || (items[n].getAlias() != null && items[n].getAlias().equals(newColumnNameOrAlias))) { validate = false; getContainer().setMessage( Messages.getFormattedString("dataset.editor.error.columnOrAliasNameAlreadyUsed", //$NON-NLS-1$ new Object[] { newColumnNameOrAlias, Integer.valueOf(n + 1) }), IMessageProvider.ERROR); break; } } } } return validate; }
From source file:org.eclipse.birt.report.designer.data.ui.datasource.DataSourceEditor.java
License:Open Source License
public void updateMessage() { PropertyPage propertyPage = getCurrentPropertyPage(); if (propertyPage != null) { String message = propertyPage.getMessage(); int messageType = propertyPage.getMessageType(); // if error message exists, it takes precedence over page's non-error message if (messageType < IMessageProvider.ERROR) { String errMessage = propertyPage.getErrorMessage(); if (errMessage != null) { message = errMessage;/* ww w. j a v a 2 s. c o m*/ messageType = IMessageProvider.ERROR; } } setMessage(message, messageType); } }
From source file:org.eclipse.birt.report.designer.data.ui.datasource.DataSourceSelectionPage.java
License:Open Source License
public void validateDataSourceHandle(Object prevSelectedDataSourceType) { if (!(prevSelectedDataSourceType instanceof String) || !CASSANDRA_DATA_SOURCE_DISPLAY_NAME.equals(prevSelectedDataSourceType.toString())) { return;/*from w ww.jav a 2 s . c om*/ } if (validated) { if (errorMessage != null) { setMessage(errorMessage, IMessageProvider.ERROR); } return; } DataRequestSession session = null; ScriptContext scriptContext = null; try { session = DataRequestSession .newSession(new DataSessionContext(DataSessionContext.MODE_DIRECT_PRESENTATION)); scriptContext = session.getDataSessionContext().getDataEngineContext().getScriptContext(); IDataScriptEngine scriptEngine = (IDataScriptEngine) scriptContext .getScriptEngine(IDataScriptEngine.ENGINE_NAME); Context context = scriptEngine.getJSContext(scriptContext); context.getApplicationClassLoader().loadClass("me.prettyprint.hector.api.factory.HFactory"); } catch (BirtException e1) { try { retryCustomClassLoader(); } catch (ClassNotFoundException e) { errorMessage = Messages.getString("CassandraScriptedDataSource.error.classNotFound"); setMessage(errorMessage, IMessageProvider.ERROR); } } catch (ClassNotFoundException e) { try { retryCustomClassLoader(); } catch (ClassNotFoundException ex) { errorMessage = Messages.getString("CassandraScriptedDataSource.error.classNotFound"); setMessage(errorMessage, IMessageProvider.ERROR); } } finally { validated = true; session.shutdown(); scriptContext.close(); } }