Package org.eclipse.core.resources

Examples of org.eclipse.core.resources.IWorkspace.validateName()


      setPageComplete(false);
      return;
      }

    // check whether the project name is valid
    final IStatus nameStatus = workspace.validateName(name, IResource.PROJECT);
    if(!nameStatus.isOK()) {
      setErrorMessage(nameStatus.getMessage());
      setPageComplete(false);
      return;
    }
View Full Code Here


        IInputValidator validator = new IInputValidator() {
            public String isValid(String string) {
                if (resource.getName().equals(string)) {
                    return IDEWorkbenchMessages.RenameResourceAction_nameMustBeDifferent;
                }
                IStatus status = workspace.validateName(string, resource.getType());
                if (!status.isOK()) {
                    return status.getMessage();
                }
                if (workspace.getRoot().exists(prefix.append(string))) {
                    return IDEWorkbenchMessages.RenameResourceAction_nameExists;
View Full Code Here

        final IWorkspace workspace = container.getWorkspace();
        final String returnValue[] = { null };

        final IInputValidator validator = new IInputValidator() {
            public String isValid(String string) {
                IStatus status = workspace.validateName(string, IResource.FILE);
                if (!status.isOK()) {
                    return status.getMessage();
                }
                if (container.getFile(new Path(string)).exists()) {
                    return "File already exists";
View Full Code Here

            setErrorMessage(null);
            setMessage("Project name is empty");
            return false;
        }

        IStatus nameStatus = workspace.validateName(projectFieldContents, IResource.PROJECT);
        if (!nameStatus.isOK()) {
            setErrorMessage(nameStatus.getMessage());
            return false;
        }
View Full Code Here

            setErrorMessage(null);
            setMessage(IDEWorkbenchMessages.WizardNewProjectCreationPage_projectNameEmpty);
            return false;
        }

        IStatus nameStatus = workspace.validateName(projectFieldContents,
                IResource.PROJECT);
        if (!nameStatus.isOK()) {
            setErrorMessage(nameStatus.getMessage());
            return false;
        }
View Full Code Here

      typeName = typeName.trim(); // grammar allows spaces
      char[] scannedID = scannedIdentifier(typeName, sourceLevel, complianceLevel);
      if (scannedID == null) {
        return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Messages.bind(Messages.convention_illegalIdentifier, typeName), null);
      }
      IStatus status = workspace.validateName(new String(scannedID), IResource.FOLDER);
      if (!status.isOK()) {
        return status;
      }
      if (firstToken && scannedID.length > 0 && ScannerHelper.isUpperCase(scannedID[0])) {
        if (warningStatus == null) {
View Full Code Here

        setMessage(NewWizardMessages.ScriptProjectWizardFirstPage_Message_enterProjectName);
        setPageComplete(false);
        return;
      }
      // check whether the project name is valid
      final IStatus nameStatus = workspace.validateName(name,
          IResource.PROJECT);
      if (!nameStatus.isOK()) {
        setErrorMessage(nameStatus.getMessage());
        setPageComplete(false);
        return;
View Full Code Here

  private boolean isValidProjectName(String name) {
    if (name.length() == 0) {
      return false;
    }
    final IWorkspace workspace = DLTKUIPlugin.getWorkspace();
    return workspace.validateName(name, IResource.PROJECT).isOK()
        && workspace.getRoot().findMember(name) == null;
  }

  public void update(Observable o, Object arg) {
    if (o instanceof LocationGroup) {
View Full Code Here

            IWorkspace workspace = getComponentWizardModel().getProject().getWorkspace();

            boolean nameErrorEncountered = false;

            // Check fileName
            IStatus fileNameStatus = workspace.validateName(fileName, IResource.FILE);
            if (fileNameStatus.getCode() != IStatus.OK) {
                logger.info(String.format("Creating a file name of %s is invalid because: %s", fileName, fileNameStatus.getMessage()));
                nameErrorEncountered = true;
            }
View Full Code Here

                logger.info(String.format("Creating a file name of %s is invalid because: %s", fileName, fileNameStatus.getMessage()));
                nameErrorEncountered = true;
            }

            // Check metaName
            IStatus metaNameStatus = workspace.validateName(metaName, IResource.FILE);
            if (metaNameStatus.getCode() != IStatus.OK) {
                logger.info(String.format("Creating a meta file name of %s is invalid because: %s", fileName, fileNameStatus.getMessage()));
                nameErrorEncountered = true;
            }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.