Java Code Examples for org.eclipse.jface.dialogs.MessageDialogWithToggle#open()

The following examples show how to use org.eclipse.jface.dialogs.MessageDialogWithToggle#open() . 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: MultiMergeJoinDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
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
Source File: PaloCellInputDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public static void showPaloLibWarningDialog( Shell shell ) {
  PropsUI props = PropsUI.getInstance();

  if ( "Y".equalsIgnoreCase( props.getCustomParameter( STRING_PALO_LIB_WARNING_PARAMETER, "Y" ) ) ) {
    MessageDialogWithToggle md =
      new MessageDialogWithToggle(
        shell,
        BaseMessages.getString( PKG, "PaloCellInputDialog.PaloLibWarningDialog.DialogTitle" ),
        null,
        BaseMessages.getString( PKG, "PaloCellInputDialog.PaloLibWarningDialog.DialogMessage", Const.CR )
          + Const.CR,
        MessageDialog.WARNING,
        new String[]{ BaseMessages.getString( PKG, "PaloCellInputDialog.PaloLibWarningDialog.Option1" ) },
        0,
        BaseMessages.getString( PKG, "PaloCellInputDialog.PaloLibWarningDialog.Option2" ),
        "N".equalsIgnoreCase( props.getCustomParameter( STRING_PALO_LIB_WARNING_PARAMETER, "Y" )
        )
      );
    MessageDialogWithToggle.setDefaultImage( GUIResource.getInstance().getImageSpoon() );
    md.open();
    props.setCustomParameter( STRING_PALO_LIB_WARNING_PARAMETER, md.getToggleState() ? "N" : "Y" );
    props.saveProps();
  }
}
 
Example 3
Source File: TransGraph.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public void handleTransMetaChanges( TransMeta transMeta ) throws KettleException {
  if ( transMeta.hasChanged() ) {
    if ( spoon.props.getAutoSave() ) {
      spoon.saveToFile( transMeta );
    } else {
      MessageDialogWithToggle md =
        new MessageDialogWithToggle( shell, BaseMessages.getString( PKG, "TransLog.Dialog.FileHasChanged.Title" ),
          null, BaseMessages.getString( PKG, "TransLog.Dialog.FileHasChanged1.Message" ) + Const.CR
          + BaseMessages.getString( PKG, "TransLog.Dialog.FileHasChanged2.Message" ) + Const.CR,
          MessageDialog.QUESTION, new String[] { BaseMessages.getString( PKG, "System.Button.Yes" ),
          BaseMessages.getString( PKG, "System.Button.No" ) }, 0, BaseMessages.getString( PKG,
          "TransLog.Dialog.Option.AutoSaveTransformation" ), spoon.props.getAutoSave() );
      MessageDialogWithToggle.setDefaultImage( GUIResource.getInstance().getImageSpoon() );
      int answer = md.open();
      if ( ( answer & 0xFF ) == 0 ) {
        spoon.saveToFile( transMeta );
      }
      spoon.props.setAutoSave( md.getToggleState() );
    }
  }
}
 
Example 4
Source File: ExitDialog.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public static MessageDialogWithToggle openExitDialog(final Shell parentShell) {
    MessageDialogWithToggle dialog = null;
    if (deleteTenantOnExit()) {
        dialog = new ExitDialog(parentShell, IDEWorkbenchMessages.PromptOnExitDialog_shellTitle, null, null, WARNING, new String[] {
                IDialogConstants.OK_LABEL,
                IDialogConstants.CANCEL_LABEL },
                0, IDEWorkbenchMessages.PromptOnExitDialog_choice, false);
        dialog.open();
    } else {
        dialog = MessageDialogWithToggle
                .openOkCancelConfirm(parentShell,
                        IDEWorkbenchMessages.PromptOnExitDialog_shellTitle,
                        exitMessage(),
                        IDEWorkbenchMessages.PromptOnExitDialog_choice,
                        false, null, null);
    }
    return dialog;
}
 
Example 5
Source File: MultiMergeJoinDialog.java    From hop with Apache License 2.0 6 votes vote down vote up
private void ok() {
  if ( Utils.isEmpty( wTransformName.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().getImageHopUi() );
    md.open();
    props.setCustomParameter( STRING_SORT_WARNING_PARAMETER, md.getToggleState() ? "N" : "Y" );
  }
  transformName = wTransformName.getText(); // return value
  dispose();
}
 
Example 6
Source File: GuiResource.java    From hop with Apache License 2.0 6 votes vote down vote up
/**
 * Generic popup with a toggle option
 *
 * @param dialogTitle
 * @param image
 * @param message
 * @param dialogImageType
 * @param buttonLabels
 * @param defaultIndex
 * @param toggleMessage
 * @param toggleState
 * @return
 */
public Object[] messageDialogWithToggle( Shell shell, String dialogTitle, Image image, String message,
                                         int dialogImageType, String[] buttonLabels, int defaultIndex,
                                         String toggleMessage, boolean toggleState ) {
  int imageType = 0;
  switch ( dialogImageType ) {
    case Const.WARNING:
      imageType = MessageDialog.WARNING;
      break;
    default:
      break;
  }

  MessageDialogWithToggle md =
    new MessageDialogWithToggle( shell, dialogTitle, image, message, imageType, buttonLabels, defaultIndex,
      toggleMessage, toggleState );
  int idx = md.open();
  return new Object[] { Integer.valueOf( idx ), Boolean.valueOf( md.getToggleState() ) };
}
 
Example 7
Source File: HopGuiPipelineGraph.java    From hop with Apache License 2.0 6 votes vote down vote up
public void handlePipelineMetaChanges( PipelineMeta pipelineMeta ) throws HopException {
  if ( pipelineMeta.hasChanged() ) {
    if ( hopGui.getProps().getAutoSave() ) {
      save();
    } else {
      MessageDialogWithToggle md =
        new MessageDialogWithToggle( hopShell(), BaseMessages.getString( PKG, "PipelineLog.Dialog.FileHasChanged.Title" ),
          null, BaseMessages.getString( PKG, "PipelineLog.Dialog.FileHasChanged1.Message" ) + Const.CR
          + BaseMessages.getString( PKG, "PipelineLog.Dialog.FileHasChanged2.Message" ) + Const.CR,
          MessageDialog.QUESTION, new String[] { BaseMessages.getString( PKG, "System.Button.Yes" ),
          BaseMessages.getString( PKG, "System.Button.No" ) }, 0, BaseMessages.getString( PKG,
          "PipelineLog.Dialog.Option.AutoSavePipeline" ), hopGui.getProps().getAutoSave() );
      MessageDialogWithToggle.setDefaultImage( GuiResource.getInstance().getImageHopUi() );
      int answer = md.open();
      if ( ( answer & 0xFF ) == 0 ) {
        save();
      }
      hopGui.getProps().setAutoSave( md.getToggleState() );
    }
  }
}
 
Example 8
Source File: FieldsChangeSequenceDialog.java    From hop with 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 9
Source File: MergeJoinDialog.java    From hop with Apache License 2.0 5 votes vote down vote up
private void ok() {
  if ( Utils.isEmpty( wTransformName.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().getImageHopUi() );
    md.open();
    props.setCustomParameter( STRING_SORT_WARNING_PARAMETER, md.getToggleState() ? "N" : "Y" );
  }

  transformName = wTransformName.getText(); // return value

  dispose();
}
 
Example 10
Source File: GUIResource.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
/**
 * Generic popup with a toggle option
 */
public Object[] messageDialogWithToggle( Shell shell, String dialogTitle, Image image, String message,
                                         int dialogImageType, String[] buttonLabels, int defaultIndex,
                                         String toggleMessage, boolean toggleState ) {
  int imageType = 0;
  if ( dialogImageType == Const.WARNING ) {
    imageType = MessageDialog.WARNING;
  }

  MessageDialogWithToggle md =
    new MessageDialogWithToggle( shell, dialogTitle, image, message, imageType, buttonLabels, defaultIndex,
      toggleMessage, toggleState );
  int idx = md.open();
  return new Object[] { idx, md.getToggleState() };
}
 
Example 11
Source File: JobGraph.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public void handleJobMetaChanges( JobMeta jobMeta ) throws KettleException {
  if ( jobMeta.hasChanged() ) {
    if ( spoon.props.getAutoSave() ) {
      if ( log.isDetailed() ) {
        log.logDetailed( BaseMessages.getString( PKG, "JobLog.Log.AutoSaveFileBeforeRunning" ) );
      }
      spoon.saveToFile( jobMeta );
    } else {
      MessageDialogWithToggle md =
        new MessageDialogWithToggle(
          shell, BaseMessages.getString( PKG, "JobLog.Dialog.SaveChangedFile.Title" ), null, BaseMessages
            .getString( PKG, "JobLog.Dialog.SaveChangedFile.Message" )
            + Const.CR
            + BaseMessages.getString( PKG, "JobLog.Dialog.SaveChangedFile.Message2" )
            + Const.CR,
          MessageDialog.QUESTION,
          new String[] {
            BaseMessages.getString( PKG, "System.Button.Yes" ),
            BaseMessages.getString( PKG, "System.Button.No" ) },
          0, BaseMessages.getString( PKG, "JobLog.Dialog.SaveChangedFile.Toggle" ), spoon.props.getAutoSave() );
      int answer = md.open();
      if ( ( answer & 0xFF ) == 0 ) {
        spoon.saveToFile( jobMeta );
      }
      spoon.props.setAutoSave( md.getToggleState() );
    }
  }
}
 
Example 12
Source File: XPromptChange.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
public static Boolean promptChangeBoolean(String displayName, String toggleMessage, boolean currSelection) {
   MessageDialogWithToggle md =
      new MessageDialogWithToggle(Display.getCurrent().getActiveShell(), displayName, null, displayName,
         MessageDialog.QUESTION,
         new String[] {XViewerText.get("button.ok"), XViewerText.get("button.cancel")}, Window.OK, //$NON-NLS-1$ //$NON-NLS-2$
         (toggleMessage != null ? toggleMessage : displayName), currSelection);
   int result = md.open();
   if (result == Window.OK) {
      return md.getToggleState();
   }
   return null;
}
 
Example 13
Source File: HopGuiWorkflowGraph.java    From hop with Apache License 2.0 5 votes vote down vote up
public void handleWorkflowMetaChanges( WorkflowMeta workflowMeta ) throws HopException {
  if ( workflowMeta.hasChanged() ) {
    if ( hopGui.getProps().getAutoSave() ) {
      if ( log.isDetailed() ) {
        log.logDetailed( BaseMessages.getString( PKG, "WorkflowLog.Log.AutoSaveFileBeforeRunning" ) );
      }
      save();
    } else {
      MessageDialogWithToggle md =
        new MessageDialogWithToggle(
          hopShell(), BaseMessages.getString( PKG, "WorkflowLog.Dialog.SaveChangedFile.Title" ), null, BaseMessages
          .getString( PKG, "WorkflowLog.Dialog.SaveChangedFile.Message" )
          + Const.CR
          + BaseMessages.getString( PKG, "WorkflowLog.Dialog.SaveChangedFile.Message2" )
          + Const.CR,
          MessageDialog.QUESTION,
          new String[] {
            BaseMessages.getString( PKG, "System.Button.Yes" ),
            BaseMessages.getString( PKG, "System.Button.No" ) },
          0, BaseMessages.getString( PKG, "WorkflowLog.Dialog.SaveChangedFile.Toggle" ), hopGui.getProps().getAutoSave() );
      int answer = md.open();
      if ( ( answer & 0xFF ) == 0 ) {
        save();
      }
      hopGui.getProps().setAutoSave( md.getToggleState() );
    }
  }
}
 
Example 14
Source File: SetVariableDialog.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
private void ok() {
  if ( Utils.isEmpty( wStepname.getText() ) ) {
    return;
  }

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

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

  //CHECKSTYLE:Indentation:OFF
  for ( int i = 0; i < count; i++ ) {
    TableItem item = wFields.getNonEmpty( i );
    input.getFieldName()[i] = item.getText( 1 );
    input.getVariableName()[i] = item.getText( 2 );
    input.getVariableType()[i] = SetVariableMeta.getVariableType( item.getText( 3 ) );
    input.getDefaultValue()[i] = item.getText( 4 );
  }

  input.setUsingFormatting( wFormat.getSelection() );

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

  dispose();
}
 
Example 15
Source File: CheckstylePropertyPage.java    From eclipse-cs with GNU Lesser General Public License v2.1 4 votes vote down vote up
@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 16
Source File: Neo4JOutputDialog.java    From knowbi-pentaho-pdi-neo4j-output with Apache License 2.0 4 votes vote down vote up
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 17
Source File: ApplicationLayoutDropAction.java    From XPagesExtensionLibrary with Apache License 2.0 4 votes vote down vote up
private boolean showWarning() {
    
    IPreferenceStore prefs = ExtLibToolingPlugin.getDefault().getPreferenceStore();
    boolean bHidePrompt = true;
    if (prefs != null) {
        bHidePrompt = prefs.getBoolean(ExtLibToolingPlugin.PREFKEY_HIDE_XPAGE_WARNING);
    }
    
    if (bHidePrompt)
        return true;

    Shell shell = getControl().getShell();
    
    String msg = "You are placing the Application Layout control on an XPage.\n\nThe Application Layout control is most effective when placed in a custom control, where you can configure the layout once and then use the custom control on multiple pages."; // $NLX-ApplicationLayoutDropAction.YouareplacingtheApplicationLayout-1$
    
    MessageDialogWithToggle dlg = new MessageDialogWithToggle(
      shell, 
      "Application Layout",  // $NLX-ApplicationLayoutDropAction.ApplicationLayout-1$
      null, // image 
      msg,  
      MessageDialog.WARNING, 
      new String[]{ "Continue", "Cancel" }, // $NLX-ApplicationLayoutDropAction.Continue-1$ $NLX-ApplicationLayoutDropAction.Cancel-2$
      1,
      "Do not show this message again",   // $NLX-ApplicationLayoutDropAction.Donotshowthismessageagain-1$
      bHidePrompt) {
        // this is necessary because "Continue" maps to IDialogConstants.INTERNAL_ID, 
        // (and prefs are stored as "always" or "never" by the dialog)
        // if "Continue" text changes, the use of IDialogConstants.INTERNAL_ID may need to change.
        protected void buttonPressed(int buttonId) {
            super.buttonPressed(buttonId);
            if (buttonId == IDialogConstants.INTERNAL_ID  && getPrefStore() != null && getPrefKey() != null) {
                getPrefStore().setValue(getPrefKey(), getToggleState());
            }
        }
    };
    
    dlg.setPrefKey(ExtLibToolingPlugin.PREFKEY_HIDE_XPAGE_WARNING);
    dlg.setPrefStore(prefs);
    
    int code = dlg.open();
    boolean bShouldContinue = (code == IDialogConstants.INTERNAL_ID); 
    
    return bShouldContinue;
}
 
Example 18
Source File: DataSetParametersPage.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public void updateLinkedReportParameter( String originalLink )
{
		ScalarParameterHandle orignalHandle = null;
	if ( !originalLink.equals( Messages.getString( "DataSetParametersPage.reportParam.None" ) ) )
	{
		orignalHandle = ParameterPageUtil.getScalarParameter( originalLink,
				true );
	}
	ParameterHandle currentHandle = null;
	if ( !linkToScalarParameter.getText( )
			.equals( Messages.getString( "DataSetParametersPage.reportParam.None" ) ) )
	{
		currentHandle = ParameterPageUtil.getScalarParameter( linkToScalarParameter.getText( ),
				true );
	}
	
	OdaDataSetParameterHandle dataSetParameterHandle = (OdaDataSetParameterHandle) structureHandle;
	if ( currentHandle != null && orignalHandle != currentHandle )
	{
		boolean setting = ReportPlugin.getDefault( )
				.getPluginPreferences( )
				.getBoolean( DateSetPreferencePage.PROMPT_PARAM_UPDATE );
		String option = ReportPlugin.getDefault( )
				.getPluginPreferences( )
				.getString( DateSetPreferencePage.PROMPT_PARAM_UPDATE_OPTION );

		if ( setting )
		{
			if ( option != null && option.equals( DateSetPreferencePage.PROMPT_PARAM_UPDATE_OPTION_UPDATE ) )
			{
				executeLinkedReportParameterUpdate( currentHandle,
						dataSetParameterHandle );
			}
			return;
		}
		
		MessageDialogWithToggle dialog = new MessageDialogWithToggle( Workbench.getInstance( )
				.getDisplay( )
				.getActiveShell( ),
				Messages.getString( "DataSetParameterPage.updateReportParameter.title" ),
				null,
				Messages.getString( "DataSetParameterPage.updateReportParameter.message" ),
				MessageDialog.QUESTION,
				new String[]{
						Messages.getString( "DataSetParameterPage.updateReportParameter.promptButtonYes" ),
						Messages.getString( "DataSetParameterPage.updateReportParameter.promptButtonNo" )
				},
				1,
				Messages.getString( "DataSetParameterPage.updateReportParameter.propmtText" ),
				false );
		
		dialog.open( );
		
		if ( dialog.getReturnCode( ) == 256 )
		{
			executeLinkedReportParameterUpdate( currentHandle,dataSetParameterHandle );
		}
		
		if ( dialog.getToggleState( ) )
		{
			ReportPlugin.getDefault( )
					.getPluginPreferences( )
					.setValue( DateSetPreferencePage.PROMPT_PARAM_UPDATE,
							true );
			if ( dialog.getReturnCode( ) == 256 )
			{
				ReportPlugin.getDefault( )
						.getPluginPreferences( )
						.setValue( DateSetPreferencePage.PROMPT_PARAM_UPDATE_OPTION,
								DateSetPreferencePage.PROMPT_PARAM_UPDATE_OPTION_UPDATE );
			}
			else
			{
				ReportPlugin.getDefault( )
						.getPluginPreferences( )
						.setValue( DateSetPreferencePage.PROMPT_PARAM_UPDATE_OPTION,
								DateSetPreferencePage.PROMPT_PARAM_UPDATE_OPTION_IGNORE );
			}
		}
			
	}
	
}
 
Example 19
Source File: HopGuiWorkflowGraph.java    From hop with 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 20
Source File: UniqueRowsDialog.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
private void ok() {
  if ( Utils.isEmpty( wStepname.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() );
  stepname = wStepname.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().getImageSpoon() );
    md.open();
    props.setCustomParameter( STRING_SORT_WARNING_PARAMETER, md.getToggleState() ? "N" : "Y" );
    props.saveProps();
  }

  // Remove any error hops coming out of UniqueRows when Reject Duplicate Rows checkbox is unselected.
  if ( wRejectDuplicateRow.getSelection() == false ) {
    List<TransHopMeta> hops = this.transMeta.getTransHops();
    IntStream.range( 0, hops.size() )
      .filter( hopInd -> {
        TransHopMeta hop = hops.get( hopInd );
        return (
          hop.isErrorHop()
          && hop.getFromStep().getName().equals( this.input.getParentStepMeta().getName() ) );
      } )
      .forEach( hopInd -> this.transMeta.removeTransHop( hopInd ) );
  }

  dispose();
}