Ejemplo n.º 1
0
 /**
  * Handle the shell close. Set the return code to <code>SWT.DEFAULT</code> as there has been no
  * explicit close by the user.
  *
  * @see org.eclipse.jface.window.Window#handleShellCloseEvent()
  */
 @Override
 protected void handleShellCloseEvent() {
   // Sets a return code of SWT.DEFAULT since none of the dialog buttons
   // were pressed to close the dialog.
   super.handleShellCloseEvent();
   setReturnCode(SWT.DEFAULT);
 }
  /**
   * check that we get non-null versions of the <code>IconAndMessageDialog</code> images so we know
   * that the code using them can rely on them.
   *
   * <p>Note that they can be <code>null</code> from SWT.
   */
  public void testGetIconMessageDialogImages() {

    IconAndMessageDialog iconDialog =
        new MessageDialog(null, "testGetDialogIcons", null, "Message", Window.CANCEL, 0, "cancel");

    Image[] images =
        new Image[] {
          iconDialog.getErrorImage(),
          iconDialog.getInfoImage(),
          iconDialog.getQuestionImage(),
          iconDialog.getWarningImage()
        };

    for (Image image : images) {
      assertTrue("Returned null image", image != null);
    }
  }
 /*
  * (non-Javadoc)
  *
  * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
  */
 @Override
 protected void createButtonsForButtonBar(Composite parent) {
   createButton(
       parent,
       IDialogConstants.DETAILS_ID,
       Messages.ConfirmConflictMessageDialog_showConflicts,
       false);
   super.createButtonsForButtonBar(parent);
 }
Ejemplo n.º 4
0
 @Override
 protected void configureShell(Shell shell) {
   super.configureShell(shell);
   if (title != null) {
     shell.setText(title);
   }
   if (titleImage != null) {
     shell.setImage(titleImage);
   }
 }
  /*
   * (non-Javadoc)
   *
   * @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int)
   */
  @Override
  protected void buttonPressed(int buttonId) {
    ConsistencyService service = ConsistencyService.getInstance();
    if (buttonId == IDialogConstants.OK_ID) {
      selectedStrategy = getSelectedStrategy();
    } else if (buttonId == IDialogConstants.DETAILS_ID) {
      setReturnCode(IDialogConstants.DETAILS_ID);
      close();
      return;
    }
    if (!rememberBun.getSelection()) {
      service.setWarnUserWhenConflict(true);

    } else {
      service.setWarnUserWhenConflict(false);
      service.setConflictStrategy(selectedStrategy);
    }

    super.buttonPressed(buttonId);
  }