Java Code Examples for org.eclipse.jface.dialogs.MessageDialog#INFORMATION

The following examples show how to use org.eclipse.jface.dialogs.MessageDialog#INFORMATION . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AppraiseReviewTaskActivationListener.java    From git-appraise-eclipse with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Asks the user if they want to switch to the review branch, and performs
 * the switch if so.
 */
private void promptSwitchToReviewBranch(TaskRepository taskRepository, String reviewBranch) {
  MessageDialog dialog = new MessageDialog(null, "Appraise Review", null,
      "Do you want to switch to the review branch (" + reviewBranch + ")", MessageDialog.QUESTION,
      new String[] {"Yes", "No"}, 0);
  int result = dialog.open();
  if (result == 0) {
    Repository repo = AppraisePluginUtils.getGitRepoForRepository(taskRepository);
    try (Git git = new Git(repo)) {
      previousBranch = repo.getFullBranch();
      git.checkout().setName(reviewBranch).call();
    } catch (RefNotFoundException rnfe) {
      MessageDialog alert = new MessageDialog(null, "Oops", null,
          "Branch " + reviewBranch + " not found", MessageDialog.INFORMATION, new String[] {"OK"}, 0);
      alert.open();
    } catch (Exception e) {
      AppraiseUiPlugin.logError("Unable to switch to review branch: " + reviewBranch, e);
    }
  }
}
 
Example 2
Source File: ProcessToolbar.java    From olca-app with Mozilla Public License 2.0 6 votes vote down vote up
private static void handleUnambiguousLinks(
		Process process, LinkingProperties props) {
	String msg = "The processes in the database can be"
			+ " linked unambiguously";
	String[] buttons = { "Run calculation", "Show details", "Cancel" };
	var dialog = new MessageDialog(
			UI.shell(),
			"Direct calculation", // title
			null, // image
			msg,
			MessageDialog.INFORMATION, // image type
			0, // default button
			buttons);
	switch (dialog.open()) {
	case 0:
		runCalculation(process);
		break;
	case 1:
		LinkingPropertiesPage.show(props);
		break;
	default:
		break;
	}
}
 
Example 3
Source File: MergeTask.java    From MergeProcessor with Apache License 2.0 6 votes vote down vote up
/**
 * Asks the user if an already finished merge unit should really be executed.
 * 
 * @return {@code true} if an already finished merge unit should really be
 *         executed
 */
private boolean askUserToMergeFinishedMergeUnit() {
	final MergeUnitStatus status = mergeUnit.getStatus();
	String dialogMessage = NLS.bind(Messages.View_MergeSelection_Ignored_Todo_Question, mergeUnit.getFileName(),
			status);
	MessageDialog dialog = new MessageDialog(shellProvider.getShell(),
			Messages.View_MergeSelection_Ignored_Todo_Title, null, dialogMessage, MessageDialog.INFORMATION,
			new String[] { Messages.View_MergeSelection_Ignored_Todo_Yes,
					Messages.View_MergeSelection_Ignored_Todo_No },
			0);

	int choice = dialog.open();

	if (choice != 0) {
		// user didn't say 'yes' so we skip it...
		LOGGER.fine(() -> String.format("User skipped mergeUnit=%s with status %s.", mergeUnit, status));
		return false;
	}
	return true;
}
 
Example 4
Source File: AttributeViewPage.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public void run( )
{
	if ( view != null )
	{

		MessageDialog prefDialog = new MessageDialog( UIUtil.getDefaultShell( ),
				Messages.getString( "AttributeView.dialg.Message.Warning" ),//$NON-NLS-1$
				null,
				Messages.getString( "AttributeView.dialg.Message.PromptMsg" ),//$NON-NLS-1$
				MessageDialog.INFORMATION,
				new String[]{
						Messages.getString( "AttributeView.dialg.Message.Yes" ),//$NON-NLS-1$
						Messages.getString( "AttributeView.dialg.Message.No" )//$NON-NLS-1$
				},
				0 );
		int ret = prefDialog.open( );

		if ( !( ret == 2 ) )
		{

			if ( ret == Window.OK )
			{
				resetLocalProperties( ret );
				pageGenerator = builder.getPageGenerator( getModelList( selection ) );
				pageGenerator.createControl( container,
						getModelList( selection ) );
				setEnabled( false );
			}
		}

	}
}
 
Example 5
Source File: ProcessToolbar.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
static void show(Process process) {
	String hint = "The direct calculation creates an in-memory "
			+ "product system of all processes in the database. This only "
			+ "gives correct results when there are unambiguous links "
			+ "between these processes (e.g. every product is only produced "
			+ "by a single process or every product input has a default "
			+ "provider set). You can also check the linking properties of "
			+ "the databases under `Database > Check linking properties`.";
	String[] buttons = { "Run calculation", "Check linking", "Cancel" };

	MessageDialog dialog = new MessageDialog(
			UI.shell(),
			"Direct calculation", // title
			null, // image
			hint,
			MessageDialog.INFORMATION, // image type
			0, // default button
			buttons);

	switch (dialog.open()) {
	case 0:
		runCalculation(process);
		break;
	case 1:
		checkLinking(process);
		break;
	default:
		break;
	}
}
 
Example 6
Source File: ImportStatusDialog.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
public ImportStatusDialog(final Shell parentShell, final IStatus importStatus, String message, final boolean canOpen) {
    super(parentShell, org.bonitasoft.studio.importer.i18n.Messages.importResultTitle, null,
            message,
            importStatus.isOK() ? MessageDialog.INFORMATION : NONE,
            getLabels(canOpen,importStatus), 0);
    this.importStatus = importStatus;
}
 
Example 7
Source File: MultiStatusDialog.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private static int dialogImageType(MultiStatus status) {
    switch (status.getSeverity()) {
        case IStatus.ERROR:
            return MessageDialog.ERROR;
        case IStatus.WARNING:
            return MessageDialog.WARNING;
        case IStatus.INFO:
        default:
            return MessageDialog.INFORMATION;
    }
}
 
Example 8
Source File: SWTUtil.java    From goclipse with Eclipse Public License 1.0 5 votes vote down vote up
public static int statusLevelToMessageDialogKing(StatusLevel statusLevel) {
	switch (statusLevel) {
	case ERROR: return MessageDialog.ERROR;
	case WARNING: return MessageDialog.WARNING;
	case INFO: return MessageDialog.INFORMATION;
	case OK: return MessageDialog.OK;
	}
	throw assertFail();
}
 
Example 9
Source File: DialogUtils.java    From saros with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Opens a MessageDialog of the type {@link MessageDialog#INFORMATION} and dispatches a call to
 * forceActive (which gives a visual hint on the taskbar that the application wants focus).
 *
 * @param shell the parent shell
 * @param dialogTitle the dialog title, or <code>null</code> if none
 * @param dialogMessage the dialog message
 * @return
 */
public static int openInformationMessageDialog(
    Shell shell, String dialogTitle, String dialogMessage) {
  MessageDialog md =
      new MessageDialog(
          shell,
          dialogTitle,
          null,
          dialogMessage,
          MessageDialog.INFORMATION,
          new String[] {IDialogConstants.OK_LABEL},
          0);
  return openWindow(md);
}
 
Example 10
Source File: JavadocConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private void showConfirmValidationDialog(URL url) {
	String message= PreferencesMessages.JavadocConfigurationBlock_ValidLocation_message;
	String okLabel= PreferencesMessages.JavadocConfigurationBlock_OK_label;
	String openLabel= PreferencesMessages.JavadocConfigurationBlock_Open_label;
	MessageDialog dialog= new MessageDialog(fShell, fTitle, null, message, MessageDialog.INFORMATION, new String[] { okLabel, openLabel }, 0);
	if (dialog.open() == 1)
		spawnInBrowser(url);
}
 
Example 11
Source File: PasteAction.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * 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.
 */
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 );
	}
}
 
Example 12
Source File: MongoDBDataSetWizardPage.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
private void synchronizeSearchLimit( ) throws OdaException
{
	if ( !queryProps.hasRuntimeMetaDataSearchLimit( ) )
		return;

	int runtimeLimit = queryProps.getRuntimeMetaDataSearchLimit( )
			.intValue( );
	if ( runtimeLimit < this.searchLimit )
	{
		MessageDialog infoDialog = new MessageDialog( sComposite.getShell( ),
				Messages.getString( "MongoDBAdvancedSettingsDialog.MessageDialog.synchronizeSearchLimit.title" ),
				null,
				Messages.getString( "MongoDBAdvancedSettingsDialog.MessageDialog.synchronizeSearchLimit.message" ),
				MessageDialog.INFORMATION,
				new String[]{
					Messages.getString( "MongoDBAdvancedSettingsDialog.MessageDialog.synchronizeSearchLimit.button" )
				},
				0 );
		if ( infoDialog.open( ) == Window.OK )
		{
			this.searchLimit = runtimeLimit;
			docNumText.setText( String.valueOf( searchLimit ) );
			updateAvailableFieldsList( );

			refreshAvailableFieldsViewer( );
			availableFieldsViewer.expandToLevel( 2 );

			refreshSelectedFieldsViewer( );
			selectedFieldsTable.getTable( ).deselectAll( );
			autoSelectRootItem( );
		}
	}
}
 
Example 13
Source File: JDBCSelectionPageHelper.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public TestInProcessDialog( Shell parentShell )
{
	super( parentShell,
			"", //$NON-NLS-1$
			null,
			JdbcPlugin.getResourceString( "testInProcessDialog.text" ), //$NON-NLS-1$
			MessageDialog.INFORMATION,
			new String[]{},
			0 );
	testCancelled = false;
	// Test connection might be a long task, use a separate thread
	testJob = new TestConnectionJob( );				
	// Start the Job
	testJob.schedule( );
}
 
Example 14
Source File: UpdateMetaFileReaderJobListener.java    From developer-studio with Apache License 2.0 5 votes vote down vote up
public static int getUserPreference(String title, String message) {
	// Display activeDisplay = Display.getDefault();
	String userChoice = prefPage.getString(PreferenceConstants.UPDATE_NOTIFICATION_CONFIGURATION);
	if (userChoice == null || userChoice.isEmpty()) {
		userChoice = PreferenceConstants.NOTIFY_ME;
	}
	if (userChoice.equals(PreferenceConstants.NOTIFY_ME)) {
		MessageDialog dialog = new MessageDialog(Display.getDefault().getActiveShell(), title, null, message,
				MessageDialog.INFORMATION, new String[] { YES, SET_LATER }, 0);
		return dialog.open();
	}
	return USER_SCHEDULED_AUTOMATIC_INSTALL;// in case if user configured to
											// install updates automatically
	// with time preference
}
 
Example 15
Source File: ReportXMLSourceEditorFormPage.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
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" )}, 0 );//$NON-NLS-1$

		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;
}
 
Example 16
Source File: DataSetDescriptorProvider.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public void save( Object value ) throws SemanticException
{
	if ( value.equals( NONE ) )
	{
		value = null;
	}

	int ret = 0;

	// If current data set name is None and no column binding
	// existing, pop up dilog doesn't need.
	if ( !NONE.equals( load( ).toString( ) )
			|| getReportItemHandle( ).getColumnBindings( )
					.iterator( )
					.hasNext( ) )
	{
		MessageDialog prefDialog = new MessageDialog( UIUtil.getDefaultShell( ),
				Messages.getString( "dataBinding.title.changeDataSet" ),//$NON-NLS-1$
				null,
				Messages.getString( "dataBinding.message.changeDataSet" ),//$NON-NLS-1$
				MessageDialog.INFORMATION,
				new String[]{
						Messages.getString( "AttributeView.dialg.Message.Yes" ),//$NON-NLS-1$
						Messages.getString( "AttributeView.dialg.Message.No" ),//$NON-NLS-1$
						Messages.getString( "AttributeView.dialg.Message.Cancel" )}, 0 );//$NON-NLS-1$

		ret = prefDialog.open( );
	}

	switch ( ret )
	{
		// Clear binding info
		case 0 :
			resetDataSetReference( value, true );
			break;
		// Doesn't clear binding info
		case 1 :
			resetDataSetReference( value, false );
			break;
		// Cancel.
		case 2 :
			section.getComboControl( ).setStringValue( load( ) == null ? "" //$NON-NLS-1$
					: load( ).toString( ) );
	}

}
 
Example 17
Source File: ReportXMLSourceEditorFormPage.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
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" )}, 0 );//$NON-NLS-1$

		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;
}
 
Example 18
Source File: SelectConnectorConfigurationWizard.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
private int loadKind(Set<MissingDependency> dependenciesNotFound) {
    return dependenciesNotFound.isEmpty() ? MessageDialog.INFORMATION : MessageDialog.WARNING;
}
 
Example 19
Source File: CrosstabBindingComboPropertyDescriptorProvider.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public void save( Object value ) throws SemanticException
{
	int ret = 0;
	// 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" )}, 0 );//$NON-NLS-1$

		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 );
}
 
Example 20
Source File: InitFinishMessageDialog.java    From tesb-studio-se with Apache License 2.0 4 votes vote down vote up
public InitFinishMessageDialog(Shell parentShell, String[] bundlesName) {
    super(parentShell, "Initialize Finished", null, "", MessageDialog.INFORMATION,
            new String[] { IDialogConstants.OK_LABEL }, 0);
    this.bundlesName = bundlesName;
}