protected void okPressed() {
    // CODINGSPECTATOR: This method gets invoked when the user presses OK. So, record the time of
    // the occurrence of this event.
    fWizard.addNavigationHistoryItem(
        new NavigationHistoryItem(fCurrentPage.getName(), IDialogConstants.OK_LABEL));

    IWizardPage current = fCurrentPage;
    saveInitialSize();
    if (fWizard.performFinish()) {
      saveSize();
      super.okPressed();
      return;
    }
    if (fCurrentPage == current) return;
    Assert.isTrue(IErrorWizardPage.PAGE_NAME.equals(fCurrentPage.getName()));
    if (fHasAdditionalPages) {
      // Show error page as a normal page
      showCurrentPage();
    } else if (showErrorDialog((ErrorWizardPage) fCurrentPage)) {
      // Show error page as a dialog
      if (fWizard.performFinish()) {
        super.okPressed();
        return;
      }
    }
  }
 /** {@inheritDoc} */
 protected void configureShell(final Shell shell) {
   super.configureShell(shell);
   shell.setText(JarPackagerMessages.JarRefactoringDialog_dialog_title);
   PlatformUI.getWorkbench()
       .getHelpSystem()
       .setHelp(shell, IJavaHelpContextIds.JARPACKAGER_REFACTORING_DIALOG);
 }
 /* (non-Javadoc)
  * Method declared on Dialog.
  */
 @Override
 protected void buttonPressed(int buttonId) {
   if (buttonId == IDialogConstants.OK_ID) {
     value = Boolean.parseBoolean(combo.getText());
   }
   super.buttonPressed(buttonId);
 }
 /*
  * Method declared on Dialog.
  *
  * The main result is to set the preference field in a particular way,
  * according to the particular button pressed, but without updating the
  * underlying preferences node.  Thus the effect of this method is to
  * change the field in the display without making the new value visible
  * to other fields.  For th	e new value to take effect it must be later
  * stored into the preferences node by some oher action (typically the
  * pressing of an Apply or OK button).
  *
  */
 protected void buttonPressed(int buttonId) {
   switch (buttonId) {
     case COPY_ID:
       if (!field.isInherited()) break;
       String value = field.getComboBoxControl().getText();
       prefUtils.setField(field, fieldHolder, value);
       break;
     case REMOVE_ID:
       // Can't clear a field that doesn't have a preference stored to start with;
       // the following is one way to check that.
       // Why would you do this if there weren't a preference stored?  May want to
       // clear a field that was edited (or otherwise set) locally but not yet stored.
       if (field.getPreferencesLevel().equals(field.getLevelFromWhichLoaded())) {
         preferencesService.clearPreferenceAtLevel(
             field.getPreferencesLevel(), field.getPreferenceName());
       }
       prefUtils.setField(field, fieldHolder);
       break;
       //	        case EMPTY_ID:
       //	        	prefUtils.setField(field, fieldHolder, field.getEmptyValue());
       //	        	break;
     default:
       super.buttonPressed(buttonId);
       break;
   }
   close();
 }
  /*
   * (non-Javadoc)
   *
   * @see org.eclipse.jface.dialogs.Dialog#okPressed()
   */
  protected void okPressed() {
    String result = getNameCheckResult();
    if (result != null) {
      MessageBox mb = new MessageBox(Display.getDefault().getActiveShell(), SWT.ICON_WARNING);
      mb.setText(
          Messages.getString("HyperlinkEditorDialog.HyperlinkName.Title.Warning")); // $NON-NLS-1$
      mb.setMessage(result);
      mb.open();
      fTxtHyperlinkLabel.setFocus();
      return;
    }

    if (fsBaseURL == null) {
      MessageBox mb = new MessageBox(Display.getDefault().getActiveShell(), SWT.ICON_WARNING);
      mb.setText(
          Messages.getString("HyperlinkEditorDialog.HyperlinkName.Title.Warning")); // $NON-NLS-1$
      mb.setMessage(Messages.getString("HyperlinkEditorDialog.BaseURL.Message")); // $NON-NLS-1$
      mb.open();
      fTxtHyperlinkLabel.setFocus();
      return;
    }
    fURLValue.getLabel().getCaption().setValue(fTxtHyperlinkLabel.getText().trim());
    fURLValue.setBaseUrl(fsBaseURL);
    fURLValue.setBaseParameterName(fTxtBaseParm.getText());
    fURLValue.setSeriesParameterName(fTxtSeriesParm.getText());
    fURLValue.setValueParameterName(fTxtValueParm.getText());
    super.okPressed();
  }
 @Override
 public void openTray(DialogTray tray)
     throws IllegalStateException, UnsupportedOperationException {
   super.openTray(tray);
   getShell().removeListener(SWT.Move, getShell().getListeners(SWT.Move)[0]);
   getShell().removeListener(SWT.Resize, getShell().getListeners(SWT.Resize)[0]);
 }
 @Override
 protected void okPressed() {
   if (currentExpressionEditor != null) {
     currentExpressionEditor.okPressed();
   }
   super.okPressed();
 }
 @Override
 protected void constrainShellSize() {
   super.constrainShellSize();
   // record opening shell size
   if (lastShellSize == null) {
     lastShellSize = getShell().getSize();
   }
 }
 protected void configureShell(Shell newShell) {
   super.configureShell(newShell);
   String title = fWizard.getDefaultPageTitle();
   if (title == null) title = fWizard.getWindowTitle();
   if (title == null) title = ""; // $NON-NLS-1$
   newShell.setText(title);
   fWizard.getRefactoring().setValidationContext(newShell);
 }
  protected void cancelPressed() {
    // CODINGSPECTATOR: Record the time of pressing the cancel button on the current page.
    fWizard.addNavigationHistoryItem(
        new NavigationHistoryItem(fCurrentPage.getName(), IDialogConstants.CANCEL_LABEL));

    if (fActiveRunningOperations == 0) {
      if (fWizard.performCancel()) super.cancelPressed();
    }
  }
  protected void handleShellCloseEvent() {
    // CODINGSPECTATOR: Record the time of quitting the refactoring by clicking on the close button
    // or pressing ESC.
    fWizard.addNavigationHistoryItem(
        new NavigationHistoryItem(fCurrentPage.getName(), NavigationHistoryItem.QUIT_DIALOG_EVENT));

    if (fActiveRunningOperations == 0) {
      if (fWizard.performCancel()) super.handleShellCloseEvent();
    }
  }
 /*
  * (non-Javadoc) Method declared on Dialog.
  */
 protected void buttonPressed(int buttonId) {
   if (buttonId == IDialogConstants.OK_ID) {
     if (this.absolutePathButton.getSelection()) {
       this.selectStr = this.pathList.get(0).toString();
     } else if (this.anyLocationButton.getSelection()) {
       this.selectStr = this.pathList.get(1).toString();
     } else this.selectStr = xmlPathField.getText();
   }
   super.buttonPressed(buttonId);
 }
Esempio n. 13
0
 /* (non-Javadoc)
  * @see org.eclipse.jface.dialogs.Dialog#okPressed()
  */
 protected void okPressed() {
   String text = getValue();
   try {
     DebugUIPlugin.getDefault()
         .getPreferenceStore()
         .setValue(IDebugUIConstants.PREF_MAX_DETAIL_LENGTH, Integer.parseInt(text));
   } catch (NumberFormatException e) {
     DebugUIPlugin.log(e);
   }
   super.okPressed();
 }
 @Override
 protected void configureShell(Shell newShell) {
   super.configureShell(newShell);
   newShell.setText(JFaceResources.getString("PreferenceDialog.title")); // $NON-NLS-1$
   newShell.addShellListener(
       new ShellAdapter() {
         @Override
         public void shellActivated(ShellEvent e) {
           if (lastShellSize == null) {
             lastShellSize = getShell().getSize();
           }
         }
       });
 }
Esempio n. 15
0
 /**
  * Constructor for Wizard.
  *
  * @param type
  */
 public ToolIntegrationWizard(boolean progressMonitor, String type) {
   setNeedsProgressMonitor(progressMonitor);
   configurationMap = new HashMap<>();
   configurationMap.put(
       ToolIntegrationConstants.INTEGRATION_TYPE,
       ToolIntegrationConstants.COMMON_TOOL_INTEGRATION_CONTEXT_TYPE);
   setWindowTitle(Messages.wizardTitle);
   serviceRegistryAccess = ServiceRegistry.createAccessFor(this);
   integrationService = serviceRegistryAccess.getService(ToolIntegrationService.class);
   integrationContextRegistry =
       serviceRegistryAccess.getService(ToolIntegrationContextRegistry.class);
   TrayDialog.setDialogHelpAvailable(true);
   wizardType = type;
 }
  @Override
  public void create() {
    super.create();
    String expressionType = inputExpression.getType();
    if (ExpressionConstants.CONSTANT_TYPE.equals(expressionType)) {
      if (!isSupportedConstantType(inputExpression.getReturnType())) {
        expressionType = ExpressionConstants.SCRIPT_TYPE;
      }
    }
    IExpressionProvider currentProvider =
        ExpressionEditorService.getInstance().getExpressionProvider(expressionType);
    if (currentProvider != null && expressionTypeViewer != null) {
      expressionTypeViewer.setSelection(new StructuredSelection(currentProvider));
    }

    getShell().layout(true, true);
  }
 /** {@inheritDoc} */
 protected void buttonPressed(final int buttonId) {
   if (buttonId == IDialogConstants.OK_ID) {
     fData.setRefactoringAware(true);
     final RefactoringDescriptorProxy[] descriptors = fHistoryControl.getCheckedDescriptors();
     Set set = new HashSet();
     IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
     for (int index = 0; index < descriptors.length; index++) {
       final String project = descriptors[index].getProject();
       if (project != null && !"".equals(project)) // $NON-NLS-1$
       set.add(root.getProject(project));
     }
     fData.setRefactoringProjects((IProject[]) set.toArray(new IProject[set.size()]));
     fData.setRefactoringDescriptors(descriptors);
     fData.setExportStructuralOnly(fExportStructural.getSelection());
     final IDialogSettings settings = fSettings;
     if (settings != null) settings.put(SETTING_SORT, fHistoryControl.isSortByProjects());
   }
   super.buttonPressed(buttonId);
 }
Esempio n. 18
0
 /*
  * @see org.eclipse.jface.window.Window#configureShell(Shell)
  */
 protected void configureShell(Shell shell) {
   super.configureShell(shell);
   PlatformUI.getWorkbench().getHelpSystem().setHelp(shell, IHelpContextIds.LOOP_DIALOG);
 }
 @Override
 protected void configureShell(Shell newShell) {
   super.configureShell(newShell);
   newShell.setText(Messages.editExpression);
 }
Esempio n. 20
0
 protected void setShellStyle(int newShellStyle) {
   super.setShellStyle(newShellStyle | SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
 }
Esempio n. 21
0
 protected void cancelPressed() {
   this.fdCurrent = this.fdBackup;
   this.cdCurrent = this.cdBackup;
   super.cancelPressed();
 }
Esempio n. 22
0
  @Override
  public void create() {
    super.create();
    super.getShell().setText(Messages.CustomizationDialog_customization);
    super.getShell().setImage(Activator.getDefault().getImage("/icons/papyrus.png")); // $NON-NLS-1$

    Composite contents = new Composite(getDialogArea(), SWT.NONE);
    contents.setLayout(new GridLayout(2, false));
    contents.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    Label label = new Label(contents, SWT.NONE);
    label.setText(Messages.CustomizationDialog_selectContextToEdit);
    label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));

    Collection<Context> contexts = ConfigurationManager.instance.getContexts();

    availableContexts = new List(contents, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
    availableContexts.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    availableContextsViewer = new ListViewer(availableContexts);
    availableContextsViewer.setContentProvider(CollectionContentProvider.instance);
    availableContextsViewer.setLabelProvider(
        new LabelProvider() {

          @Override
          public String getText(final Object element) {
            if (element != null && element instanceof Context) {
              Context context = (Context) element;
              return context.getName()
                  + (ConfigurationManager.instance.isPlugin(context)
                      ? Messages.CustomizationDialog_plugin
                      : ""); //$NON-NLS-1$
            }
            return super.getText(element);
          }
        });
    availableContextsViewer.setInput(contexts);
    availableContexts.addSelectionListener(this);

    Composite controls = new Composite(contents, SWT.NONE);
    controls.setLayout(new FillLayout(SWT.VERTICAL));

    copyContext = new Button(controls, SWT.PUSH);
    copyContext.setText(Messages.CustomizationDialog_copy);
    copyContext.setToolTipText(Messages.CustomizationDialog_createNewCopyByCopy);
    copyContext.setEnabled(false);
    copyContext.addSelectionListener(this);

    editContext = new Button(controls, SWT.PUSH);
    editContext.setText(Messages.CustomizationDialog_edit);
    editContext.setToolTipText(Messages.CustomizationDialog_editSelectedContext);
    editContext.setEnabled(false);
    editContext.addSelectionListener(this);

    removeContext = new Button(controls, SWT.PUSH);
    removeContext.setText(Messages.CustomizationDialog_delete);
    removeContext.setToolTipText(Messages.CustomizationDialog_removeSelectedContext);
    removeContext.setEnabled(false);
    removeContext.addSelectionListener(this);

    availableContextsViewer.addSelectionChangedListener(
        new ISelectionChangedListener() {

          public void selectionChanged(final SelectionChangedEvent event) {
            IStructuredSelection selection = (IStructuredSelection) event.getSelection();
            boolean activate = false;

            if (!selection.isEmpty()) {
              Context context = (Context) selection.getFirstElement();
              activate = !ConfigurationManager.instance.isPlugin(context);
            }

            editContext.setEnabled(activate);
            copyContext.setEnabled(!selection.isEmpty());
            removeContext.setEnabled(activate);
          }
        });

    //		generateContext = new Button(controls, SWT.PUSH);
    //		generateContext.setText("Generate");
    //		generateContext.setToolTipText("Generates a new Context from a Metamodel");
    //		generateContext.setEnabled(false);

    getShell().pack();
  }
Esempio n. 23
0
 @Override
 protected void okPressed() {
   if (okButton.isEnabled()) {
     super.okPressed();
   }
 }
Esempio n. 24
0
 /* (non-Javadoc)
  * Method declared in Window.
  */
 @Override
 protected void configureShell(Shell shell) {
   super.configureShell(shell);
   if (title != null) shell.setText(title);
 }
 /** {@inheritDoc} */
 public void create() {
   super.create();
   getButton(OK).setEnabled(!fHistory.isEmpty());
 }
 /*
  * @see org.eclipse.jface.dialogs.Dialog#setButtonLayoutData(org.eclipse.swt.widgets.Button)
  * @since 3.5
  */
 protected void setButtonLayoutData(Button button) {
   super.setButtonLayoutData(button);
   ((GridData) button.getLayoutData()).grabExcessHorizontalSpace = true;
 }
 @Override
 protected void configureShell(Shell newShell) {
   super.configureShell(newShell);
   newShell.setText(Messages.getString("dialogs.XmlConverterConfigurationDialog.title"));
 }
 /*
  * (non-Javadoc) Method declared on Window.
  */
 protected void configureShell(Shell newShell) {
   super.configureShell(newShell);
   newShell.setText(NLS.bind("Details for ''" + field.getLabelText() + "''", null));
   // PlatformUI.getWorkbench().getHelpSystem().setHelp(newShell,
   //		IWorkbenchHelpContextIds.ABOUT_DIALOG);
 }