コード例 #1
0
  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;
      }
    }
  }
コード例 #2
0
 /** {@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);
 }
コード例 #3
0
 /* (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);
 }
コード例 #4
0
 /*
  * 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();
 }
コード例 #5
0
  /*
   * (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();
  }
コード例 #6
0
 @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]);
 }
コード例 #7
0
 @Override
 protected void okPressed() {
   if (currentExpressionEditor != null) {
     currentExpressionEditor.okPressed();
   }
   super.okPressed();
 }
コード例 #8
0
 @Override
 protected void constrainShellSize() {
   super.constrainShellSize();
   // record opening shell size
   if (lastShellSize == null) {
     lastShellSize = getShell().getSize();
   }
 }
コード例 #9
0
 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);
 }
コード例 #10
0
  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();
    }
  }
コード例 #11
0
  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();
    }
  }
コード例 #12
0
 /*
  * (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);
 }
コード例 #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();
 }
コード例 #14
0
 @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();
           }
         }
       });
 }
コード例 #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;
 }
コード例 #16
0
  @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);
  }
コード例 #17
0
 /** {@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);
 }
コード例 #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);
 }
コード例 #19
0
 @Override
 protected void configureShell(Shell newShell) {
   super.configureShell(newShell);
   newShell.setText(Messages.editExpression);
 }
コード例 #20
0
 protected void setShellStyle(int newShellStyle) {
   super.setShellStyle(newShellStyle | SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
 }
コード例 #21
0
 protected void cancelPressed() {
   this.fdCurrent = this.fdBackup;
   this.cdCurrent = this.cdBackup;
   super.cancelPressed();
 }
コード例 #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();
  }
コード例 #23
0
 @Override
 protected void okPressed() {
   if (okButton.isEnabled()) {
     super.okPressed();
   }
 }
コード例 #24
0
 /* (non-Javadoc)
  * Method declared in Window.
  */
 @Override
 protected void configureShell(Shell shell) {
   super.configureShell(shell);
   if (title != null) shell.setText(title);
 }
コード例 #25
0
 /** {@inheritDoc} */
 public void create() {
   super.create();
   getButton(OK).setEnabled(!fHistory.isEmpty());
 }
コード例 #26
0
 /*
  * @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;
 }
コード例 #27
0
 @Override
 protected void configureShell(Shell newShell) {
   super.configureShell(newShell);
   newShell.setText(Messages.getString("dialogs.XmlConverterConfigurationDialog.title"));
 }
コード例 #28
0
 /*
  * (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);
 }