List of usage examples for org.eclipse.jface.dialogs MessageDialog INFORMATION
int INFORMATION
To view the source code for org.eclipse.jface.dialogs MessageDialog INFORMATION.
Click Source Link
From source file:org.eclipse.birt.report.designer.internal.ui.views.actions.PasteAction.java
License:Open Source License
/** * Runs this action. Copies the content. Each action implementation must * define the steps needed to carry out this action. The default * implementation of this method in <code>Action</code> does nothing. */// w ww . j av a 2s . c o m public void run() { List infoList = new ArrayList(); if (!canPaste(infoList)) { String message = null; if (infoList.size() != 0) { message = ((SemanticException) infoList.get(0)).getLocalizedMessage(); if (message != null) { MessageDialog prefDialog = new MessageDialog(UIUtil.getDefaultShell(), Messages.getString("PasteAction.dlg.title"), //$NON-NLS-1$ null, message, MessageDialog.INFORMATION, new String[] { Messages.getString("PasteAction.ok") //$NON-NLS-1$ }, 0); prefDialog.open(); } } return; } try { CommandUtils.executeCommand("org.eclipse.birt.report.designer.ui.command.pasteAction", null); //$NON-NLS-1$ } catch (Exception e) { // TODO Auto-generated catch block logger.log(Level.SEVERE, e.getMessage(), e); } }
From source file:org.eclipse.birt.report.designer.ui.editor.pages.xml.ReportXMLSourceEditorFormPage.java
License:Open Source License
public boolean canLeaveThePage() { if (isDirty()) { MessageDialog prefDialog = new MessageDialog(UIUtil.getDefaultShell(), Messages.getString("XMLSourcePage.Error.Dialog.title"), //$NON-NLS-1$ null, Messages.getString("XMLSourcePage.Error.Dialog.Message.PromptMsg"), //$NON-NLS-1$ MessageDialog.INFORMATION, new String[] { Messages.getString("XMLSourcePage.Error.Dialog.Message.Yes"), //$NON-NLS-1$ Messages.getString("XMLSourcePage.Error.Dialog.Message.No"), //$NON-NLS-1$ Messages.getString("XMLSourcePage.Error.Dialog.Message.Cancel") }, //$NON-NLS-1$ 0);/*from w w w.j a v a 2s . com*/ int ret = prefDialog.open(); switch (ret) { case 0: isLeaving = true; getReportEditor().doSave(null); break; case 1: if (getEditorInput() != null) { this.setInput(getEditorInput()); } clearDirtyFlag(); break; case 2: return false; } } int errorLine = getErrorLIine(false); if (errorLine > -1) { if (errorDetail != null && errorDetail.getErrorCode().equals(ErrorDetail.DESIGN_EXCEPTION_UNSUPPORTED_VERSION)) { MessageDialog.openError(Display.getCurrent().getActiveShell(), Messages.getString("XMLSourcePage.Error.Dialog.title"), //$NON-NLS-1$ errorDetail.getMessage()); } else { // Display.getCurrent( ).beep( ); MessageDialog.openError(Display.getCurrent().getActiveShell(), Messages.getString("XMLSourcePage.Error.Dialog.title"), //$NON-NLS-1$ Messages.getString("XMLSourcePage.Error.Dialog.Message.InvalidFile")); //$NON-NLS-1$ } setFocus(); setHighlightLine(errorLine); return false; } return true; }
From source file:org.eclipse.birt.report.designer.ui.editors.pages.ReportXMLSourceEditorFormPage.java
License:Open Source License
public boolean canLeaveThePage() { if (isDirty()) { MessageDialog prefDialog = new MessageDialog(UIUtil.getDefaultShell(), Messages.getString("XMLSourcePage.Error.Dialog.title"), //$NON-NLS-1$ null, Messages.getString("XMLSourcePage.Error.Dialog.Message.PromptMsg"), //$NON-NLS-1$ MessageDialog.INFORMATION, new String[] { Messages.getString("XMLSourcePage.Error.Dialog.Message.Yes"), //$NON-NLS-1$ Messages.getString("XMLSourcePage.Error.Dialog.Message.No"), //$NON-NLS-1$ Messages.getString("XMLSourcePage.Error.Dialog.Message.Cancel") }, //$NON-NLS-1$ 0);//from w w w. j a v a2 s .c o m int ret = prefDialog.open(); switch (ret) { case 0: getEditor().doSave(null); break; case 1: if (getEditorInput() != null) { this.setInput(getEditorInput()); } break; case 2: return false; } } int errorLine = getErrorLIine(false); if (errorLine > -1) { if (errorDetail != null && errorDetail.getErrorCode().equals(ErrorDetail.DESIGN_EXCEPTION_UNSUPPORTED_VERSION)) { MessageDialog.openError(Display.getCurrent().getActiveShell(), Messages.getString("XMLSourcePage.Error.Dialog.title"), //$NON-NLS-1$ errorDetail.getMessage()); } else { // Display.getCurrent( ).beep( ); MessageDialog.openError(Display.getCurrent().getActiveShell(), Messages.getString("XMLSourcePage.Error.Dialog.title"), //$NON-NLS-1$ Messages.getString("XMLSourcePage.Error.Dialog.Message.InvalidFile")); //$NON-NLS-1$ } setFocus(); setHighlightLine(errorLine); return false; } return true; }
From source file:org.eclipse.birt.report.designer.ui.samples.ide.action.IDEOpenSampleReportAction.java
License:Open Source License
private IProject createProject(String projectName, boolean isJavaProject) { ProjectNameDialog projectNameDlg = new ProjectNameDialog(UIUtil.getDefaultShell()); projectNameDlg.setTitle(Messages.getString("IDEOpenSampleReportAction.ProjectNameDialog.Title.PrjectName")); projectNameDlg.setProjectName(projectName); if (projectNameDlg.open() == Window.CANCEL) { return null; }// www .jav a 2 s . c o m projectName = projectNameDlg.getProjectName(); final IProject projectHandle = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); if (projectHandle.exists()) { String[] buttonLabels = new String[] { IDialogConstants.PROCEED_LABEL, Messages.getString("IDEOpenSampleReportAction.MessageDialog.ProjectExists.ButtonText"), IDialogConstants.CANCEL_LABEL }; MessageDialog messageDlg = new MessageDialog(UIUtil.getDefaultShell(), Messages.getString("IDEOpenSampleReportAction.MessageDialog.ProjectExists.Title"), null, Messages.getFormattedString("IDEOpenSampleReportAction.MessageDialog.ProjectExists.Message", buttonLabels), MessageDialog.INFORMATION, buttonLabels, 0); messageDlg.open(); if (messageDlg.getReturnCode() == 0) { // proceed return projectHandle; } if (messageDlg.getReturnCode() == 1) { // overwrite try { projectHandle.delete(true, null); } catch (CoreException e) { // TODO Auto-generated catch block e.printStackTrace(); } } if (messageDlg.getReturnCode() == 2) { // cancel return null; } } final IProjectDescription description = ResourcesPlugin.getWorkspace() .newProjectDescription(projectHandle.getName()); if (isJavaProject == true) { String[] natures = new String[] { JavaCore.NATURE_ID, "org.eclipse.birt.report.designer.ui.reportprojectnature", //$NON-NLS-1$ }; description.setNatureIds(natures); addJavaBuildSpec(description); } else { String[] natures = new String[] { "org.eclipse.birt.report.designer.ui.reportprojectnature", //$NON-NLS-1$ }; description.setNatureIds(natures); } // create the new project operation WorkspaceModifyOperation op = new WorkspaceModifyOperation() { protected void execute(IProgressMonitor monitor) throws CoreException { create(description, projectHandle, monitor); } }; try { new ProgressMonitorDialog(composite.getShell()).run(false, true, op); } catch (InterruptedException e) { ExceptionUtil.handle(e); return null; } catch (InvocationTargetException e) { // ie.- one of the steps resulted in a core exception Throwable t = e.getTargetException(); if (t instanceof CoreException) { if (((CoreException) t).getStatus().getCode() == IResourceStatus.CASE_VARIANT_EXISTS) { MessageDialog.openError(composite.getShell(), Messages.getString("NewReportProjectWizard.errorMessage"), //$NON-NLS-1$ Messages.getFormattedString("NewReportProjectWizard.caseVariantExistsError", //$NON-NLS-1$ new String[] { projectHandle.getName() }) //, ); } else { ErrorDialog.openError(composite.getShell(), Messages.getString("NewReportProjectWizard.errorMessage"), //$NON-NLS-1$ null, // no special message ((CoreException) t).getStatus()); } } else { // CoreExceptions are handled above, but unexpected runtime // exceptions and errors may still occur. ExceptionUtil.handle(e); MessageDialog.openError(composite.getShell(), Messages.getString("NewReportProjectWizard.errorMessage"), //$NON-NLS-1$ Messages.getFormattedString("NewReportProjectWizard.internalError", //$NON-NLS-1$ new Object[] { t.getMessage() })); } return null; } return projectHandle; }
From source file:org.eclipse.birt.report.item.crosstab.ui.views.attributes.provider.CrosstabBindingComboPropertyDescriptorProvider.java
License:Open Source License
public void save(Object value) throws SemanticException { int ret = 0;/*from w ww .j ava 2 s.c o m*/ // If choose binding Cube as None if (getCube() != null) { if (getCube().equals(value)) return; MessageDialog prefDialog = new MessageDialog(UIUtil.getDefaultShell(), Messages.getString("CrosstabDataBinding.title.ChangeCube"), //$NON-NLS-1$ null, Messages.getString("CrosstabDataBinding.message.changeCube"), //$NON-NLS-1$ MessageDialog.INFORMATION, new String[] { org.eclipse.birt.report.designer.nls.Messages .getString("AttributeView.dialg.Message.Yes"), //$NON-NLS-1$ org.eclipse.birt.report.designer.nls.Messages .getString("AttributeView.dialg.Message.No"), //$NON-NLS-1$ org.eclipse.birt.report.designer.nls.Messages .getString("AttributeView.dialg.Message.Cancel") }, //$NON-NLS-1$ 0); ret = prefDialog.open(); switch (ret) { // Clear binding info case 0: resetCubeReference((CubeHandle) value, true); break; // Doesn't clear binding info case 1: resetCubeReference((CubeHandle) value, false); break; // Cancel. case 2: int index = getItems().indexOf(getCube()); if (index > -1) { ((CCombo) section.getComboControl().getControl()).select(index); } else { ((CCombo) section.getComboControl().getControl()).deselectAll(); } break; } } else { resetCubeReference((CubeHandle) value, false); } // super.save( value ); }
From source file:org.eclipse.birt.report.item.crosstab.ui.views.attributes.provider.CrosstabSimpleComboPropertyDescriptorProvider.java
License:Open Source License
public void save(Object value) throws SemanticException { int ret = 0;/* w w w . j a v a 2 s . com*/ // If choose binding Cube as None if (!NONE.equals(getCubeName())) { MessageDialog prefDialog = new MessageDialog(UIUtil.getDefaultShell(), Messages.getString("CrosstabDataBinding.title.ChangeCube"), //$NON-NLS-1$ null, Messages.getString("CrosstabDataBinding.message.changeCube"), //$NON-NLS-1$ MessageDialog.INFORMATION, new String[] { org.eclipse.birt.report.designer.nls.Messages .getString("AttributeView.dialg.Message.Yes"), //$NON-NLS-1$ org.eclipse.birt.report.designer.nls.Messages .getString("AttributeView.dialg.Message.No"), //$NON-NLS-1$ org.eclipse.birt.report.designer.nls.Messages .getString("AttributeView.dialg.Message.Cancel") }, //$NON-NLS-1$ 0); ret = prefDialog.open(); switch (ret) { // Clear binding info case 0: resetCubeReference(value, true); break; // Doesn't clear binding info case 1: resetCubeReference(value, false); break; // Cancel. case 2: section.getSimpleComboControl().setStringValue(getCubeName()); break; } } else { resetCubeReference(value, false); } // super.save( value ); }
From source file:org.eclipse.cdt.dstore.hosts.actions.QuickConnectAction.java
License:Open Source License
public void run() { HostsPlugin plugin = HostsPlugin.getInstance(); DataStore dataStore = plugin.getDataStore(); DataElement temp = dataStore.getTempRoot(); Connection tempConnection = new Connection("temp", _host, _port, "root", _directory, false, _useDaemon, temp);/*from w w w . j av a 2 s . c om*/ ConnectionStatus status = tempConnection.connect(dataStore.getDomainNotifier(), "org.eclipse.cdt.dstore.miners/fs.dat"); if (status == null) { // command cancelled } else if (status.isConnected()) { DataStore rmtDataStore = tempConnection.getDataStore(); DataElement host = rmtDataStore.getHostRoot(); DataElement input = host.get(0).dereference(); input.expandChildren(); DataElementFileDialog dialog = new DataElementFileDialog( _plugin.getLocalizedString("actions.Select_Directory"), input); dialog.open(); if (dialog.getReturnCode() == dialog.OK) { DataElement selected = dialog.getSelected(); if (selected != null) { _selected = selected.getSource(); } } tempConnection.disconnect(); } else { String msg = status.getMessage(); if (!status.isConnected()) { MessageDialog failD = new MessageDialog(null, _plugin.getLocalizedString("actions.Connection_Failure"), null, msg, MessageDialog.INFORMATION, new String[] { "OK" }, 0); failD.openInformation(new Shell(), _plugin.getLocalizedString("actions.Connection_Failure"), msg); } } }
From source file:org.eclipse.cdt.dstore.ui.connections.ConnectAction.java
License:Open Source License
public void run() { DataElement selected = _subject;//from w ww . jav a 2 s .com ConnectionStatus status = _connection.connect(_dataStore.getDomainNotifier()); if (status != null) { String msg = status.getMessage(); if (!status.isConnected()) { MessageDialog failD = new MessageDialog(null, _plugin.getLocalizedString("dialog.Connection_Failure"), null, msg, MessageDialog.INFORMATION, new String[] { "OK" }, 0); failD.openInformation(new Shell(), _plugin.getLocalizedString("dialog.Connection_Failure"), msg); } else { selected.setDepth(2); } } }
From source file:org.eclipse.cdt.internal.ui.editor.CEditor.java
License:Open Source License
private void updateScalabilityMode(IEditorInput input) { int lines = getDocumentProvider().getDocument(input).getNumberOfLines(); boolean wasEnabled = fEnableScalablilityMode; fEnableScalablilityMode = lines > getPreferenceStore() .getInt(PreferenceConstants.SCALABILITY_NUMBER_OF_LINES); if (fEnableScalablilityMode && !wasEnabled) { // Alert users that scalability mode should be turned on if (getPreferenceStore().getBoolean(PreferenceConstants.SCALABILITY_ALERT)) { MessageDialogWithToggle dialog = new MessageDialogWithToggle(Display.getCurrent().getActiveShell(), CEditorMessages.Scalability_info, null, CEditorMessages.Scalability_message, MessageDialog.INFORMATION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0, CEditorMessages.Scalability_reappear, false) { {/*from www .j ava 2 s .co m*/ setShellStyle(SWT.DIALOG_TRIM | SWT.MODELESS | SWT.ON_TOP | getDefaultOrientation()); } @Override protected void buttonPressed(int buttonId) { PreferenceConstants.getPreferenceStore().setValue(PreferenceConstants.SCALABILITY_ALERT, !getToggleState()); super.buttonPressed(buttonId); if (buttonId == IDialogConstants.YES_ID) { PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn( Display.getCurrent().getActiveShell(), "org.eclipse.cdt.ui.preferences.CScalabilityPreferences", null, null); //$NON-NLS-1$ dialog.open(); } } }; dialog.setBlockOnOpen(false); dialog.open(); } } }
From source file:org.eclipse.debug.ui.sourcelookup.CommonSourceNotFoundEditor.java
License:Open Source License
/** * Edits the source lookup path associated with the active debug context. * After the path is edited, source lookup is performed again and this * editor is closed./*from ww w .j a v a2 s .co m*/ */ protected void editSourceLookupPath() { ISourceLocator locator = null; ILaunch launch = null; IAdaptable selection = DebugUITools.getDebugContext(); if (selection == null) { new MessageDialog(getSite().getShell(), SourceLookupUIMessages.CommonSourceNotFoundEditor_0, null, SourceLookupUIMessages.CommonSourceNotFoundEditor_1, MessageDialog.INFORMATION, new String[] { IDialogConstants.OK_LABEL }, 0).open(); return; } if (selection.getAdapter(ILaunch.class) != null) { launch = (ILaunch) selection.getAdapter(ILaunch.class); locator = launch.getSourceLocator(); } else if (selection.getAdapter(IDebugElement.class) != null) { launch = ((IDebugElement) selection.getAdapter(IDebugElement.class)).getLaunch(); locator = launch.getSourceLocator(); } else { return; //should not occur } if (locator == null || !(locator instanceof AbstractSourceLookupDirector)) { return; } final SourceLookupDialog dialog = new SourceLookupDialog(DebugUIPlugin.getShell(), (AbstractSourceLookupDirector) locator); if (dialog.open() == Window.OK) { IWorkbenchPage page = getEditorSite().getPage(); SourceLookupManager.getDefault().displaySource(getArtifact(), page, true); closeEditor(); } }