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

The following examples show how to use org.eclipse.jface.dialogs.MessageDialog#WARNING . These examples are extracted from open source projects. 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
private void ok() {
  if ( Utils.isEmpty( wStepname.getText() ) ) {
    return;
  }
  getMeta( joinMeta );
  // Show a warning (optional)
  if ( "Y".equalsIgnoreCase( props.getCustomParameter( STRING_SORT_WARNING_PARAMETER, "Y" ) ) ) {
    MessageDialogWithToggle md =
      new MessageDialogWithToggle( shell,
        BaseMessages.getString( PKG, "MultiMergeJoinDialog.InputNeedSort.DialogTitle" ),
        null,
        BaseMessages.getString( PKG, "MultiMergeJoinDialog.InputNeedSort.DialogMessage", Const.CR ) + Const.CR,
        MessageDialog.WARNING,
        new String[] { BaseMessages.getString( PKG, "MultiMergeJoinDialog.InputNeedSort.Option1" ) },
        0,
        BaseMessages.getString( PKG, "MultiMergeJoinDialog.InputNeedSort.Option2" ),
        "N".equalsIgnoreCase( props.getCustomParameter( STRING_SORT_WARNING_PARAMETER, "Y" ) ) );
    MessageDialogWithToggle.setDefaultImage( GUIResource.getInstance().getImageSpoon() );
    md.open();
    props.setCustomParameter( STRING_SORT_WARNING_PARAMETER, md.getToggleState() ? "N" : "Y" );
    props.saveProps();
  }
  stepname = wStepname.getText(); // return value
  dispose();
}
 
Example 2
private boolean showConfigWarning() {
    String msg = "If you change the configuration, all attribute values associated with the current configuration will be lost. Do you want to continue?"; // $NLX-ApplicationLayoutBasicsPanel.Youareabouttochangetheconfigurati-1$
    MessageDialog dlg = new MessageDialog(
            getShell(), 
            "Domino Designer", // $NLX-ApplicationLayoutDropDialog.Dominodesigner-1$
            null, // image 
            msg,  
            MessageDialog.WARNING, 
            new String[]{ "Continue", "Cancel" }, // $NLX-ApplicationLayoutBasicsPanel.Continue-1$ $NLX-ApplicationLayoutBasicsPanel.Cancel-2$
            1);

    int code = dlg.open();
    // "Continue" was returning 256.. but then started returning 0 at some point...did SWT version change (it was pending)?
    boolean bShouldContinue = (code == MessageDialog.OK);  //Only continue if 'OK' (Continue) is pressed - otherwise bail out

    return bShouldContinue;
}
 
Example 3
public boolean shouldSet(DataNode.ComputedField cf, Object instance, String value, DataChangeNotifier notifier) {
            boolean ok = true;
            if (null == value) {
                // do we need to check contents?
//                Element callback = getCallback(cf.getName(), cf.hasName());
//                if (null != callback && isCallbackModified(callback)) {
                String[] buttons = {"Yes", "No"}; // $NLX-ApplicationLayoutCallbackPanel.Yes-1$ $NLX-ApplicationLayoutCallbackPanel.No-2$
                MessageDialog dlg = new MessageDialog(ApplicationLayoutCallbackPanel.this.getShell(), "Domino Designer",  // $NLX-ApplicationLayoutCallbackPanel.DominoDesigner-1$
                        null, "Removing the drop target will remove the callback and any content it contains. Do you want to continue?",    // $NLX-ApplicationLayoutCallbackPanel.Removingthedroptargetwillremoveth-1$
                        MessageDialog.WARNING, buttons, 1);
                
                int result = dlg.open();
                ok = (result == 0);  
//                }
            }  
            return ok;
        }
 
Example 4
Source Project: birt   File: CubeGroupContent.java    License: Eclipse Public License 1.0 6 votes vote down vote up
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( );
		return false;
	}
	return true;
}
 
Example 5
Source Project: olca-app   File: ProcessToolbar.java    License: Mozilla Public License 2.0 6 votes vote down vote up
private static void handleAmbiguousLinks(LinkingProperties props) {
	String msg = "There are ambiguous links between processes "
			+ "in the database. This can lead to different results "
			+ "in the calculation depending on the process linking.";
	String[] buttons = { "Show details", "Cancel" };
	var dialog = new MessageDialog(
			UI.shell(),
			"Direct calculation", // title
			null, // image
			msg,
			MessageDialog.WARNING, // image type
			0, // default button
			buttons);
	if (dialog.open() == 0) {
		LinkingPropertiesPage.show(props);
	}
}
 
Example 6
Source Project: EasyShell   File: CommandPage.java    License: Eclipse Public License 2.0 6 votes vote down vote up
@Override
public boolean performOk() {
    boolean save = true;
    if (!CommandDataStore.instance().isMigrated()) {
        String title = Activator.getResourceString("easyshell.command.page.dialog.migration.title");
        String question = Activator.getResourceString("easyshell.command.page.dialog.migration.question");
        MessageDialog dialog = new MessageDialog(
                null, title, null, question,
                MessageDialog.WARNING,
                new String[] {"Yes", "No"},
                1); // no is the default
        int result = dialog.open();
        if (result == 0) {
            CommandDataStore.instance().setMigrated(true);
        } else {
            save = false;
        }
    }
    if (save) {
        CommandDataStore.instance().save();
        MenuDataStore.instance().save();
    }
    return save;
}
 
Example 7
private void ok() {
  if ( Utils.isEmpty( wStepname.getText() ) ) {
    return;
  }

  stepname = wStepname.getText(); // return value

  int nrfields = wFields.nrNonEmpty();

  input.allocate( nrfields );

  //CHECKSTYLE:Indentation:OFF
  for ( int i = 0; i < nrfields; i++ ) {
    TableItem ti = wFields.getNonEmpty( i );
    input.getFieldName()[i] = ti.getText( 1 );
    input.getAscending()[i] =
      BaseMessages.getString( PKG, "System.Combo.Yes" ).equalsIgnoreCase( ti.getText( 2 ) );
  }

  // Show a warning (optional)
  //
  if ( "Y".equalsIgnoreCase( props.getCustomParameter( STRING_SORT_WARNING_PARAMETER, "Y" ) ) ) {
    MessageDialogWithToggle md =
      new MessageDialogWithToggle( shell,
        BaseMessages.getString( PKG, "SortedMergeDialog.InputNeedSort.DialogTitle" ),
        null,
        BaseMessages.getString( PKG, "SortedMergeDialog.InputNeedSort.DialogMessage", Const.CR ) + Const.CR,
        MessageDialog.WARNING,
        new String[] { BaseMessages.getString( PKG, "SortedMergeDialog.InputNeedSort.Option1" ) },
        0,
        BaseMessages.getString( PKG, "SortedMergeDialog.InputNeedSort.Option2" ),
        "N".equalsIgnoreCase( props.getCustomParameter( STRING_SORT_WARNING_PARAMETER, "Y" ) ) );
    MessageDialogWithToggle.setDefaultImage( GUIResource.getInstance().getImageSpoon() );
    md.open();
    props.setCustomParameter( STRING_SORT_WARNING_PARAMETER, md.getToggleState() ? "N" : "Y" );
    props.saveProps();
  }

  dispose();
}
 
Example 8
Source Project: hop   File: BaseTransformDialog.java    License: Apache License 2.0 5 votes vote down vote up
static MessageDialog getFieldsChoiceDialog( Shell shell, int existingFields, int newFields ) {
  MessageDialog messageDialog =
    new MessageDialog( shell,
      BaseMessages.getString( PKG, "BaseTransformDialog.GetFieldsChoice.Title" ), // "Warning!"
      null,
      BaseMessages.getString( PKG, "BaseTransformDialog.GetFieldsChoice.Message", "" + existingFields, "" + newFields ),
      MessageDialog.WARNING, new String[] {
      BaseMessages.getString( PKG, "BaseTransformDialog.AddNew" ),
      BaseMessages.getString( PKG, "BaseTransformDialog.Add" ),
      BaseMessages.getString( PKG, "BaseTransformDialog.ClearAndAdd" ),
      BaseMessages.getString( PKG, "BaseTransformDialog.Cancel" ), }, 0 );
  MessageDialog.setDefaultImage( GuiResource.getInstance().getImageHopUi() );
  return messageDialog;
}
 
Example 9
Source Project: saros   File: DialogUtils.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Opens a MessageDialog of the type {@link MessageDialog#WARNING} 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 openWarningMessageDialog(
    Shell shell, String dialogTitle, String dialogMessage) {
  MessageDialog md =
      new MessageDialog(
          shell,
          dialogTitle,
          null,
          dialogMessage,
          MessageDialog.WARNING,
          new String[] {IDialogConstants.OK_LABEL},
          0);
  return openWindow(md);
}
 
Example 10
protected void showUnsupportedConnectionMessageBox( DatabaseInterface dbi ) {
  String title = BaseMessages.getString( PKG, "TableOutput.UnsupportedConnection.DialogTitle" );
  String message = dbi.getUnsupportedTableOutputMessage();
  String close = BaseMessages.getString( PKG, "System.Button.Close" );

  MessageDialog dialog =
    new MessageDialog( shell, title, GUIResource.getInstance().getImageSpoon(), message, MessageDialog.WARNING,
      new String[] { close }, 0 );
  dialog.open();
}
 
Example 11
Source Project: hop   File: FieldsChangeSequenceDialog.java    License: Apache License 2.0 5 votes vote down vote up
private void ok() {
  if ( Utils.isEmpty( wTransformName.getText() ) ) {
    return;
  }
  transformName = wTransformName.getText(); // return value

  input.setStart( wStart.getText() );
  input.setIncrement( wIncrement.getText() );
  input.setResultFieldName( wResult.getText() );

  int nrFields = wFields.nrNonEmpty();
  input.allocate( nrFields );
  for ( int i = 0; i < nrFields; i++ ) {
    TableItem ti = wFields.getNonEmpty( i );
    //CHECKSTYLE:Indentation:OFF
    input.getFieldName()[ i ] = ti.getText( 1 );
  }

  if ( "Y".equalsIgnoreCase( props.getCustomParameter( STRING_CHANGE_SEQUENCE_WARNING_PARAMETER, "Y" ) ) ) {
    MessageDialogWithToggle md =
      new MessageDialogWithToggle( shell,
        BaseMessages.getString( PKG, "FieldsChangeSequenceDialog.InputNeedSort.DialogTitle" ),
        null,
        BaseMessages.getString( PKG, "FieldsChangeSequenceDialog.InputNeedSort.DialogMessage", Const.CR ) + Const.CR,
        MessageDialog.WARNING,
        new String[] { BaseMessages.getString( PKG, "FieldsChangeSequenceDialog.InputNeedSort.Option1" ) },
        0,
        BaseMessages.getString( PKG, "FieldsChangeSequenceDialog.InputNeedSort.Option2" ), "N".equalsIgnoreCase(
        props.getCustomParameter( STRING_CHANGE_SEQUENCE_WARNING_PARAMETER, "Y" ) ) );
    MessageDialogWithToggle.setDefaultImage( GuiResource.getInstance().getImageHopUi() );
    md.open();
    props.setCustomParameter( STRING_CHANGE_SEQUENCE_WARNING_PARAMETER, md.getToggleState() ? "N" : "Y" );
  }

  dispose();
}
 
Example 12
Source Project: hop   File: TableOutputDialog.java    License: Apache License 2.0 5 votes vote down vote up
protected void showUnsupportedConnectionMessageBox( IDatabase dbi ) {
  String title = BaseMessages.getString( PKG, "TableOutput.UnsupportedConnection.DialogTitle" );
  String message = dbi.getUnsupportedTableOutputMessage();
  String close = BaseMessages.getString( PKG, "System.Button.Close" );

  MessageDialog dialog =
    new MessageDialog( shell, title, GuiResource.getInstance().getImageHopUi(), message, MessageDialog.WARNING,
      new String[] { close }, 0 );
  dialog.open();
}
 
Example 13
Source Project: pentaho-kettle   File: MergeJoinDialog.java    License: Apache License 2.0 5 votes vote down vote up
private void ok() {
  if ( Utils.isEmpty( wStepname.getText() ) ) {
    return;
  }

  getMeta( input );

  // Show a warning (optional)
  //
  if ( "Y".equalsIgnoreCase( props.getCustomParameter( STRING_SORT_WARNING_PARAMETER, "Y" ) ) ) {
    MessageDialogWithToggle md =
      new MessageDialogWithToggle( shell,
        BaseMessages.getString( PKG, "MergeJoinDialog.InputNeedSort.DialogTitle" ),
        null,
        BaseMessages.getString( PKG, "MergeJoinDialog.InputNeedSort.DialogMessage", Const.CR ) + Const.CR,
        MessageDialog.WARNING,
        new String[] { BaseMessages.getString( PKG, "MergeJoinDialog.InputNeedSort.Option1" ) },
        0,
        BaseMessages.getString( PKG, "MergeJoinDialog.InputNeedSort.Option2" ), "N".equalsIgnoreCase(
          props.getCustomParameter( STRING_SORT_WARNING_PARAMETER, "Y" ) ) );
    MessageDialogWithToggle.setDefaultImage( GUIResource.getInstance().getImageSpoon() );
    md.open();
    props.setCustomParameter( STRING_SORT_WARNING_PARAMETER, md.getToggleState() ? "N" : "Y" );
    props.saveProps();
  }

  stepname = wStepname.getText(); // return value

  dispose();
}
 
Example 14
Source Project: EasyShell   File: MainPage.java    License: Eclipse Public License 2.0 5 votes vote down vote up
@Override
public boolean performOk() {
    if (!validateValues()) {
        return false;
    }
    boolean save = true;
    if (!GeneralDataStore.instance().isMigrated()) {
        String title = Activator.getResourceString("easyshell.main.page.dialog.migration.title");
        String question = Activator.getResourceString("easyshell.main.page.dialog.migration.question");
        MessageDialog dialog = new MessageDialog(
                null, title, null, question,
                MessageDialog.WARNING,
                new String[] {"Yes", "No"},
                1); // no is the default
        int result = dialog.open();
        if (result == 0) {
            GeneralDataStore.instance().setMigrated(true);
        } else {
            save = false;
        }
    }
    if (save) {
        GeneralDataStore.instance().getData().setDebug(debug.getSelection() ? Debug.debugYes : Debug.debugNo);
        GeneralDataStore.instance().getData().setToolTipAll(toolTipAll.getSelection() ? Tooltip.tooltipYes : Tooltip.tooltipNo);
        GeneralDataStore.instance().getData().setToolTipClipboard(toolTipClipboard.getSelection() ? Tooltip.tooltipYes : Tooltip.tooltipNo);
        GeneralDataStore.instance().getData().setToolTipError(toolTipError.getSelection() ? Tooltip.tooltipYes : Tooltip.tooltipNo);
        GeneralDataStore.instance().save();
    }
    return save;
}
 
Example 15
Source Project: hop   File: HopGuiWorkflowGraph.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * Go from serial to parallel to serial execution
 */
@GuiContextAction(
  id = "workflow-graph-transform-10600-parallel",
  parentId = HopGuiWorkflowActionContext.CONTEXT_ID,
  type = GuiActionType.Modify,
  name = "Parallel execution",
  tooltip = "Enable of disable parallel execution of next actions",
  image = "ui/images/parallel-hop.svg"
)
public void editEntryParallel( HopGuiWorkflowActionContext context ) {

  ActionCopy action = context.getActionCopy();
  ActionCopy originalAction = (ActionCopy) action.cloneDeep();

  action.setLaunchingInParallel( !action.isLaunchingInParallel() );
  ActionCopy jeNew = (ActionCopy) action.cloneDeep();

  hopGui.undoDelegate.addUndoChange( workflowMeta, new ActionCopy[] { originalAction }, new ActionCopy[] { jeNew }, new int[] { workflowMeta.indexOfAction( jeNew ) } );
  workflowMeta.setChanged();

  if ( action.isLaunchingInParallel() ) {
    // Show a warning (optional)
    //
    if ( "Y".equalsIgnoreCase( hopGui.getProps().getCustomParameter( STRING_PARALLEL_WARNING_PARAMETER, "Y" ) ) ) {
      MessageDialogWithToggle md =
        new MessageDialogWithToggle( hopShell(),
          BaseMessages.getString( PKG, "WorkflowGraph.ParallelActionsWarning.DialogTitle" ),
          null,
          BaseMessages.getString( PKG, "WorkflowGraph.ParallelActionsWarning.DialogMessage", Const.CR ) + Const.CR,
          MessageDialog.WARNING,
          new String[] { BaseMessages.getString( PKG, "WorkflowGraph.ParallelActionsWarning.Option1" ) },
          0,
          BaseMessages.getString( PKG, "WorkflowGraph.ParallelActionsWarning.Option2" ),
          "N".equalsIgnoreCase( hopGui.getProps().getCustomParameter( STRING_PARALLEL_WARNING_PARAMETER, "Y" ) ) );
      MessageDialogWithToggle.setDefaultImage( GuiResource.getInstance().getImageHopUi() );
      md.open();
      hopGui.getProps().setCustomParameter( STRING_PARALLEL_WARNING_PARAMETER, md.getToggleState() ? "N" : "Y" );
    }
  }
  redraw();

}
 
Example 16
public static boolean displayContinueDialog(Shell shell, String title, String msg) {
    MessageDialog dialog = new MessageDialog(shell, title, null,
        msg, MessageDialog.WARNING, new String[] {"Continue", "Cancel"}, 0); // $NLX-WizardUtils.Continue-1$ $NLX-WizardUtils.Cancel-2$
    return(dialog.open() == 0);
}
 
Example 17
Source Project: hop   File: UniqueRowsDialog.java    License: Apache License 2.0 4 votes vote down vote up
private void ok() {
  if ( Utils.isEmpty( wTransformName.getText() ) ) {
    return;
  }

  int nrFields = wFields.nrNonEmpty();
  input.allocate( nrFields );

  //CHECKSTYLE:Indentation:OFF
  for ( int i = 0; i < nrFields; i++ ) {
    TableItem item = wFields.getNonEmpty( i );
    input.getCompareFields()[ i ] = item.getText( 1 );
    input.getCaseInsensitive()[ i ] = "Y".equalsIgnoreCase( item.getText( 2 ) );
  }

  input.setCountField( wCountField.getText() );
  input.setCountRows( wCount.getSelection() );
  input.setRejectDuplicateRow( wRejectDuplicateRow.getSelection() );
  input.setErrorDescription( wErrorDesc.getText() );
  transformName = wTransformName.getText(); // return value

  if ( "Y".equalsIgnoreCase( props.getCustomParameter( STRING_SORT_WARNING_PARAMETER, "Y" ) ) ) {
    MessageDialogWithToggle md = new MessageDialogWithToggle( shell,
      BaseMessages.getString( PKG, "UniqueRowsDialog.InputNeedSort.DialogTitle" ),
      null,
      BaseMessages.getString( PKG, "UniqueRowsDialog.InputNeedSort.DialogMessage", Const.CR ) + Const.CR,
      MessageDialog.WARNING,
      new String[] { BaseMessages.getString( PKG, "UniqueRowsDialog.InputNeedSort.Option1" ) },
      0,
      BaseMessages.getString( PKG, "UniqueRowsDialog.InputNeedSort.Option2" ),
      "N".equalsIgnoreCase( props.getCustomParameter( STRING_SORT_WARNING_PARAMETER, "Y" ) ) );
    MessageDialogWithToggle.setDefaultImage( GuiResource.getInstance().getImageHopUi() );
    md.open();
    props.setCustomParameter( STRING_SORT_WARNING_PARAMETER, md.getToggleState() ? "N" : "Y" );
  }

  // Remove any error hops coming out of UniqueRows when Reject Duplicate Rows checkbox is unselected.
  if ( wRejectDuplicateRow.getSelection() == false ) {
    List<PipelineHopMeta> hops = this.pipelineMeta.getPipelineHops();
    IntStream.range( 0, hops.size() )
      .filter( hopInd -> {
        PipelineHopMeta hop = hops.get( hopInd );
        return (
          hop.isErrorHop()
            && hop.getFromTransform().getTransformPluginId().equals( this.input.getParentTransformMeta().getTransformPluginId() ) );
      } )
      .forEach( hopInd -> this.pipelineMeta.removePipelineHop( hopInd ) );
  }

  dispose();
}
 
Example 18
@Override
public void widgetSelected(SelectionEvent e) {

  Object source = e.getSource();
  // edit filter
  if (source == mBtnEditFilter) {

    ISelection selection = mFilterList.getSelection();
    openFilterEditor(selection);
    getContainer().updateButtons();
  }
  if (source == mMainTab) {
    mFileSetsEditor.refresh();
    getContainer().updateButtons();

  } else if (source == mChkSyncFormatter) {
    mProjectConfig.setSyncFormatter(mChkSyncFormatter.getSelection());
  } else if (source == mChkSimpleConfig) {
    try {

      mProjectConfig.setUseSimpleConfig(mChkSimpleConfig.getSelection());

      boolean showWarning = CheckstyleUIPluginPrefs
              .getBoolean(CheckstyleUIPluginPrefs.PREF_FILESET_WARNING);
      if (mProjectConfig.isUseSimpleConfig() && showWarning) {
        MessageDialogWithToggle dialog = new MessageDialogWithToggle(getShell(),
                Messages.CheckstylePropertyPage_titleWarnFilesets, null,
                Messages.CheckstylePropertyPage_msgWarnFilesets, MessageDialog.WARNING,
                new String[] { IDialogConstants.OK_LABEL }, 0,
                Messages.CheckstylePropertyPage_mgsWarnFileSetNagOption, showWarning) {
          /**
           * Overwritten because we don't want to store which button the user pressed but the
           * state of the toggle.
           *
           * @see MessageDialogWithToggle#buttonPressed(int)
           */
          @Override
          protected void buttonPressed(int buttonId) {
            getPrefStore().setValue(getPrefKey(), getToggleState());
            setReturnCode(buttonId);
            close();
          }

        };
        dialog.setPrefStore(CheckstyleUIPlugin.getDefault().getPreferenceStore());
        dialog.setPrefKey(CheckstyleUIPluginPrefs.PREF_FILESET_WARNING);
        dialog.open();

      }

      createFileSetsArea(mFileSetsContainer);
      mFileSetsContainer.redraw();
      mFileSetsContainer.update();
      mFileSetsContainer.layout();
    } catch (CheckstylePluginException ex) {
      CheckstyleUIPlugin.errorDialog(getShell(), Messages.errorChangingFilesetEditor, ex, true);
    }
  }

}
 
Example 19
private void validateAndWarn( Neo4JOutputMeta input ) {
  StringBuffer message = new StringBuffer();

  // Warn about running too many small UNWIND statements when using dynamic labels
  //
  boolean dynamicFrom = input.dynamicFromLabels() && input.isUsingCreate();
  if ( dynamicFrom ) {
    message.append( Const.CR );
    message.append( BaseMessages.getString( PKG, "Neo4JOutputDialog.Warning.SortDynamicFromLabels", Const.CR ) );
  }
  boolean dynamicTo = input.dynamicToLabels() && input.isUsingCreate();
  if ( dynamicTo ) {
    message.append( Const.CR );
    message.append( BaseMessages.getString( PKG, "Neo4JOutputDialog.Warning.SortDynamicToLabels", Const.CR ) );
  }
  if ( input.isOnlyCreatingRelationships() && input.isCreatingRelationships() && ( input.dynamicFromLabels() || input.dynamicToLabels() ) ) {
    message.append( Const.CR );
    message.append( BaseMessages.getString( PKG, "Neo4JOutputDialog.Warning.SortDynamicRelationshipLabel", Const.CR ) );
  }

  // Verify that the defined connection is available
  //
  try {
    MetaStoreFactory<NeoConnection> factory = new MetaStoreFactory<>( NeoConnection.class, metaStore, Neo4jDefaults.NAMESPACE );
    NeoConnection connection = factory.loadElement( input.getConnection() );
    if ( connection == null ) {
      message.append( Const.CR );
      message.append( BaseMessages.getString( PKG, "Neo4JOutputDialog.Warning.ReferencedNeo4jConnectionDoesntExist", input.getConnection(), Const.CR ) );
    }
  } catch ( Exception e ) {
    message.append( "There was an error verifying the existence of the used Neo4j connection" )
      .append( Const.CR )
      .append( Const.getStackTracker( e ) )
      .append( Const.CR );
  }

  // Warn people about the "Create indexes" button
  //
  if ( input.isCreatingIndexes() && ( input.dynamicFromLabels() || input.dynamicToLabels() ) ) {
    message.append( Const.CR );
    message.append( BaseMessages.getString( PKG, "Neo4JOutputDialog.Warning.CreateIndexesIsLimited", Const.CR ) );
  }

  if ( message.length() > 0 && "Y".equalsIgnoreCase( props.getCustomParameter( STRING_DYNAMIC_LABELS_WARNING, "Y" ) ) ) {

    MessageDialogWithToggle md =
      new MessageDialogWithToggle( shell,
        BaseMessages.getString( PKG, "Neo4JOutputDialog.DynamicLabelsWarning.DialogTitle" ), null,
        message.toString() + Const.CR,
        MessageDialog.WARNING,
        new String[] { BaseMessages.getString( PKG, "Neo4JOutputDialog.DynamicLabelsWarning.Understood" ) },
        0,
        BaseMessages.getString( PKG, "Neo4JOutputDialog.DynamicLabelsWarning.HideNextTime" ), "N".equalsIgnoreCase(
        props.getCustomParameter( STRING_DYNAMIC_LABELS_WARNING, "Y" ) ) );
    MessageDialogWithToggle.setDefaultImage( GUIResource.getInstance().getImageSpoon() );
    md.open();
    props.setCustomParameter( STRING_DYNAMIC_LABELS_WARNING, md.getToggleState() ? "N" : "Y" );
    props.saveProps();
  }

}
 
Example 20
Source Project: txtUML   File: Dialogs.java    License: Eclipse Public License 1.0 4 votes vote down vote up
public static boolean WarningConfirm(String title, String body){
	MessageDialog dialog = new MessageDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
			title, null,  body, MessageDialog.WARNING, new String[] { "Yes", "No"}, 0);
	return dialog.open() == 0;
}