Package org.eclipse.jdt.internal.ui.dialogs

Examples of org.eclipse.jdt.internal.ui.dialogs.StatusInfo


   * Update modification of package input field.
   *
   * @return Package validation status
   */
  protected IStatus updatePackage() {
    StatusInfo status = new StatusInfo();
    fPackageDialogField.setStatus(getPackage().length() == 0 ? "(default)" : "");
    fPackageDialogField.enableButton(getPackageFragmentRoot() != null);

    String packName = getPackage();
    if (packName.length() > 0) {
      IStatus val = JavaConventions.validatePackageName(packName);
      if (val.getSeverity() == IStatus.ERROR) {
        status.setError("Package name is not valid." + val.getMessage());
        return status;
      } else if (val.getSeverity() == IStatus.WARNING) {
        status.setWarning("This package name is discouraged. " + val.getMessage());
        // continue
      }
    } else {
      status.setWarning("The use of the default package is discouraged.");
    }

    IPackageFragmentRoot root = getPackageFragmentRoot();
    if (root != null) {
      if (root.getJavaProject().exists() && packName.length() > 0) {
        try {
          IPath rootPath = root.getPath();
          IPath outputPath = root.getJavaProject().getOutputLocation();
          if (rootPath.isPrefixOf(outputPath) && !rootPath.equals(outputPath)) {
            // if the bin folder is inside of our root, don't allow
            // to name a package
            // like the bin folder
            IPath packagePath = rootPath.append(packName.replace('.', '/'));
            if (outputPath.isPrefixOf(packagePath)) {
              status.setError("Package clashes with project output folder.");
              return status;
            }
          }
        } catch (JavaModelException e) {
          JavaPlugin.log(e);
          // let pass
        }
      }

      fPackageFragment = root.getPackageFragment(packName);
    } else {
      status.setError(""); //$NON-NLS-1$
    }
    return status;
  }
View Full Code Here


   * Update modification of aspect name input field.
   *
   * @return Validation status
   */
  protected IStatus updateAspectName() {
    StatusInfo status = new StatusInfo();
    fAspect = null;
    String aspectName = getAspectName();
    if (aspectName.length() == 0) {
      status.setError("Aspect name is empty.");
      return status;
    }
    if (aspectName.indexOf('.') != -1) {
      status.setError("Aspect name must not be qualified.");
      return status;
    }

    IStatus val = JavaConventions.validateJavaTypeName(aspectName);
    if (val.getSeverity() == IStatus.ERROR) {
      status.setError("Aspect name is not valid. " + val.getMessage());
      return status;
    } else if (val.getSeverity() == IStatus.WARNING) {
      status.setWarning("Aspect name is discouraged. " + val.getMessage());
    }

    IPackageFragment pack = getPackageFragment();
    if (pack != null) {
      ICompilationUnit cu = pack.getCompilationUnit(aspectName + ".java"); //$NON-NLS-1$
      IResource resource = cu.getResource();
      if (resource.exists()) {
        status.setWarning("Aspect already exits. Only the crosscut will be created.");
        // TODO Check if aspect is a subclass of
        // ch.ethz.prose.DefaultAspect.
      }
      fAspect = cu.findPrimaryType();
    }
View Full Code Here

   * Update modification of crosscut type input field.
   *
   * @return Validation status
   */
  protected IStatus updateCrosscutType() {
    StatusInfo status = new StatusInfo();

    NewAspectCreationWizard wizard = (NewAspectCreationWizard) getWizard();
    String[] subItems = null;
    if (wizard == null) return status;
    switch (fCrosscutTypeDialogField.getSelectionIndex()) {
    case 0:
      fCrosscutPage = wizard.getMethodPage();
      fPointCutterDialogField.setItems(concat(PC_GENERIC_ALL, PC_METHOD));
      subItems = concat(PC_ALL, PC_METHOD);
      break;
    case 1:
    fCrosscutPage = wizard.getMethodRedefinePage();
    fPointCutterDialogField.setItems(concat(PC_GENERIC_ALL, PC_METHOD));
    subItems = concat(PC_ALL, PC_METHOD);
    break;
    case 2:
    case 3:
      fCrosscutPage = wizard.getFieldPage();
      fPointCutterDialogField.setItems(concat(PC_GENERIC_ALL, PC_FIELD));
      subItems = concat(PC_ALL, PC_FIELD);
      break;
    case 4:
    case 5:
      fCrosscutPage = wizard.getExceptionPage();
      fPointCutterDialogField.setItems(concat(PC_GENERIC_ALL, PC_EXCEPTION));
      subItems = concat(PC_ALL, PC_EXCEPTION);
      break;
    default:
      status.setError("Unknown crosscut type.");
    fCrosscutPage = null;
    return status;
    }
    fPointCutter1DialogField.setItems(subItems);
    fPointCutter2DialogField.setItems(subItems);
View Full Code Here

   * Update modification of point cutter input field.
   *
   * @return Validation status
   */
  protected IStatus updatePointCutter() {
    StatusInfo status = new StatusInfo();

    switch (fPointCutterDialogField.getSelectionIndex()) {
    case 0: // (none)
      fPointCutter1DialogField.setEnabled(false);
      fPointCutter2DialogField.setEnabled(false);
View Full Code Here

        Text text = fTargetClassDialogField.getTextControl(null);
        LayoutUtil.setWidthHint(text, convertWidthInCharsToPixels(40));
    }

    protected IStatus updateTargetClass() {
        StatusInfo status = new StatusInfo();
        IPackageFragmentRoot root = getMainPage().getPackageFragmentRoot();
        fTargetClassDialogField.enableButton(root != null);

        fTargetClass = null;

        String targetClassName = getTargetClassName();
        if (targetClassName.length() == 0) {
            // accept the empty field (stands for java.lang.Object)
            return status;
        }
        IStatus val = JavaConventions.validateJavaTypeName(targetClassName);
        if (val.getSeverity() == IStatus.ERROR) {
            status.setError("Target class name is not valid.");
            return status;
        }
        if (root != null) {
            try {
                IType type = resolveClassName(root.getJavaProject(), targetClassName);
                if (type == null) {
                    status.setWarning("Target class does not exist in current project.");
                    return status;
                }
                fTargetClass = type;
            } catch (JavaModelException e) {
                status.setError("Target class name is not valid.");
                JavaPlugin.log(e);
            }
        } else {
            status.setError(""); //$NON-NLS-1$
        }
        return status;
    }
View Full Code Here

        gd.grabExcessVerticalSpace = false;
        gd.widthHint = convertWidthInCharsToPixels(40);
    }

    protected IStatus updateArgumentTypes() {
        StatusInfo status = new StatusInfo();
        if (getTargetClassName().length() == 0 && fArgumentTypesDialogField.getElements().size() > 0) {
            status.setError("Target class must not be empty.");
        }
        return status;
    }
View Full Code Here

    public String getFieldTypeName() {
        return fFieldTypeDialogField.getText();
    }

    protected IStatus updateFieldType() {
        StatusInfo status = new StatusInfo();
        if (getTargetClassName().length() == 0 && getFieldTypeName().length() > 0) {
            status.setError("Target class must not be empty.");
        }
        return status;
    }
View Full Code Here

        gd.grabExcessVerticalSpace = false;
        gd.widthHint = convertWidthInCharsToPixels(40);
    }

    protected IStatus updateArgumentTypes() {
        StatusInfo status = new StatusInfo();
        if (getTargetClassName().length() == 0 && fArgumentTypesDialogField.getElements().size() > 0) {
            status.setError("Target class must not be empty.");
        }
        return status;
    }
View Full Code Here

        }
        source.append(" target");
    }

    protected IStatus updateTargetException() {
        StatusInfo status = new StatusInfo();
        IPackageFragmentRoot root = getMainPage().getPackageFragmentRoot();
        fTargetExceptionDialogField.enableButton(root != null);

        fTargetException = null;

        String targetClassName = getTargetExceptionName();
        if (targetClassName.length() == 0) {
            // accept the empty field (stands for java.lang.Object)
            return status;
        }
        IStatus val = JavaConventions.validateJavaTypeName(targetClassName);
        if (val.getSeverity() == IStatus.ERROR) {
            status.setError("Target exception name is not valid.");
            return status;
        }
        if (root != null) {
            try {
                IType type = resolveClassName(root.getJavaProject(), targetClassName);
                if (type == null) {
                    status.setWarning("Target exception does not exist in current project.");
                    return status;
                }
                // TODO Check if exception is subclass of Throwable
                fTargetException = type;
            } catch (JavaModelException e) {
                status.setError("Target exception name is not valid.");
                JavaPlugin.log(e);
            }
        } else {
            status.setError(""); //$NON-NLS-1$
        }
        return status;

    }
View Full Code Here

        fUseAddCommentButtonValue = false; // only used when enabled

        fCurrPackageCompletionProcessor = new JavaPackageCompletionProcessor();
        fEnclosingTypeCompletionProcessor = new JavaTypeCompletionProcessor(false, false, true);

        fPackageStatus = new StatusInfo();
        fEnclosingTypeStatus = new StatusInfo();

        fCanModifyPackage = true;
        fCanModifyEnclosingType = true;
        updateEnableState();

        fTypeNameStatus = new StatusInfo();
        fSuperClassStatus = new StatusInfo();
        fSuperInterfacesStatus = new StatusInfo();
        fModifierStatus = new StatusInfo();
    }
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.internal.ui.dialogs.StatusInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.