コード例 #1
0
    private void createNameControl(Composite parent) {
      Composite name = new Composite(parent, SWT.NONE);
      name.setLayoutData(new GridData(GridData.FILL_BOTH));
      GridLayout layout = new GridLayout(1, false);
      layout.marginHeight = 0;
      layout.marginWidth = 0;
      name.setLayout(layout);

      Label label = new Label(name, SWT.NONE);
      label.setText(RefactoringMessages.ChangeSignatureInputPage_method_name);

      final Text text = new Text(name, SWT.BORDER);
      text.setText(getChangeMethodSignatureProcessor().getMethodName());
      text.setLayoutData((new GridData(GridData.FILL_HORIZONTAL)));
      TextFieldNavigationHandler.install(text);

      if (getChangeMethodSignatureProcessor().canChangeNameAndReturnType()) {
        text.addModifyListener(
            new ModifyListener() {
              public void modifyText(ModifyEvent e) {
                getChangeMethodSignatureProcessor().setNewMethodName(text.getText());
                update(true);
              }
            });
      } else {
        text.setEnabled(false);
      }
    }
  private void createAccessorPart(Composite parent, final int nOfColumns, int textWidth) {
    createLabel(
        parent, NLSUIMessages.NLSAccessorConfigurationDialog_resourceBundle_title, nOfColumns);
    fAccessorPackage.createControl(parent, nOfColumns, textWidth);

    fAccessorClassName.doFillIntoGrid(parent, nOfColumns);
    Text accessorClassText = fAccessorClassName.getTextControl(null);
    LayoutUtil.setWidthHint(accessorClassText, convertWidthInCharsToPixels(60));
    TextFieldNavigationHandler.install(accessorClassText);

    fSubstitutionPattern.doFillIntoGrid(parent, nOfColumns);
    Text substitutionPatternText = fSubstitutionPattern.getTextControl(null);
    LayoutUtil.setWidthHint(substitutionPatternText, convertWidthInCharsToPixels(60));
    TextFieldNavigationHandler.install(substitutionPatternText);

    fSubstitutionPattern.setEnabled(!fRefactoring.isEclipseNLS());
  }
コード例 #3
0
    private void createReturnTypeControl(Composite parent) {
      Composite returnType = new Composite(parent, SWT.NONE);
      returnType.setLayoutData(new GridData(GridData.FILL_BOTH));
      GridLayout layout = new GridLayout(1, false);
      layout.marginHeight = 0;
      layout.marginWidth = 0;
      returnType.setLayout(layout);

      Label label = new Label(returnType, SWT.NONE);
      label.setText(RefactoringMessages.ChangeSignatureInputPage_return_type);

      final Text text = new Text(returnType, SWT.BORDER);
      text.setText(getChangeMethodSignatureProcessor().getReturnTypeString());
      text.setLayoutData((new GridData(GridData.FILL_HORIZONTAL)));
      TextFieldNavigationHandler.install(text);

      if (getChangeMethodSignatureProcessor().canChangeNameAndReturnType()) {
        text.addModifyListener(
            new ModifyListener() {
              public void modifyText(ModifyEvent e) {
                getChangeMethodSignatureProcessor().setNewReturnTypeName(text.getText());
                update(true);
              }
            });
      } else {
        text.setEnabled(false);
      }

      JavaTypeCompletionProcessor processor = new JavaTypeCompletionProcessor(true, true);
      StubTypeContext stubTypeContext = getChangeMethodSignatureProcessor().getStubTypeContext();
      processor.setCompletionContext(
          stubTypeContext.getCuHandle(),
          stubTypeContext.getBeforeString(),
          stubTypeContext.getAfterString());
      ControlContentAssistHelper.createTextContentAssistant(text, processor);
    }