Package org.eclipse.core.resources

Examples of org.eclipse.core.resources.IWorkspace$ProjectOrder


    while (dot != -1 && dot < length-1) {
      if ((dot = name.indexOf(DOT, dot+1)) != -1 && dot < length-1 && name.charAt(dot+1) == DOT) {
        return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Messages.convention_package_consecutiveDotsName, null);
        }
    }
    IWorkspace workspace = ResourcesPlugin.getWorkspace();
    StringTokenizer st = new StringTokenizer(name, "."); //$NON-NLS-1$
    boolean firstToken = true;
    IStatus warningStatus = null;
    while (st.hasMoreTokens()) {
      String typeName = st.nextToken();
      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


    if (IS_CASE_SENSITIVE) {
      return externalPath;
    }
   
    // if not external path, return original path
    IWorkspace workspace = ResourcesPlugin.getWorkspace();
    if (workspace == null) return externalPath; // protection during shutdown (30487)
    if (workspace.getRoot().findMember(externalPath) != null) {
      return externalPath;
    }

    IPath canonicalPath = null;
    try {
View Full Code Here

   *    reporting and cancellation are not desired
   * @exception CoreException if the operation failed.
   * @since 3.0
   */
  public static void run(IWorkspaceRunnable action, ISchedulingRule rule, IProgressMonitor monitor) throws CoreException {
    IWorkspace workspace = ResourcesPlugin.getWorkspace();
    if (workspace.isTreeLocked()) {
      new BatchOperation(action).run(monitor);
    } else {
      // use IWorkspace.run(...) to ensure that a build will be done in autobuild mode
      workspace.run(new BatchOperation(action), rule, IWorkspace.AVOID_UPDATE, monitor);
    }
  }
View Full Code Here

   */
  private ArrayList determineAffectedPackageFragments(IPath location) throws JavaModelException {
    ArrayList fragments = new ArrayList();

    // see if this will cause any package fragments to be affected
    IWorkspace workspace = ResourcesPlugin.getWorkspace();
    IResource resource = null;
    if (location != null) {
      resource = workspace.getRoot().findMember(location);
    }
    if (resource != null && resource.getType() == IResource.FOLDER) {
      IFolder folder = (IFolder) resource;
      // only changes if it actually existed
      IClasspathEntry[] classpath = this.project.getExpandedClasspath();
View Full Code Here

          ISourceProject project = pc.getProject();
          dpath = project != null ?
              project.getRawProject().getLocation().append(dpath)
              : dpath;
              System.err.println("The path is " + dpath);
              IWorkspace workspace= ResourcesPlugin.getWorkspace();
              final IFile dfile = workspace.getRoot().getFileForLocation(dpath);
              Job job = new Job("Compile " + dpath) {
                @Override protected IStatus run(IProgressMonitor monitor) {
                  if (new FregeBuilder().compiled(dfile, monitor))
                    return Status.OK_STATUS;
                  return Status.CANCEL_STATUS;
View Full Code Here

    final String fr = pack.replaceAll("\\.", "/") + ".fr";    // the file name
    final String segments[] = pack.split("\\.");
    if (this.fProject == null) return null;                     // too bad, doesn't work with project.
    // final IProject rp = this.fProject.getRawProject();
    final IJavaProject jp = getFD().getJp();
    IWorkspace workspace = ResourcesPlugin.getWorkspace();
    IPath wroot = workspace.getRoot().getLocation();
   
    IFile newsrc = null;
    IPath srcpath = null;
    IPath binPath = null;
    try {
      binPath = jp.getOutputLocation();
    } catch (JavaModelException e) {
      return null;
    }

    srcpath = binPath.append(fr);
    newsrc = workspace.getRoot().getFile(srcpath);
    if (newsrc == null) return null// couldn't get file handle here
    if (newsrc.exists()) return srcpath;
   
    IFolder folder = workspace.getRoot().getFolder(binPath);
    // System.err.println("Parser.getSource start in folder " + folder.getLocation());
    InputStream stream = null;
   
    try {
      // create the intermediate directories
      for (int i=0; i < segments.length-1; i++) {
        binPath = binPath.append(segments[i]);
        folder = workspace.getRoot().getFolder(binPath);
        // System.err.println("Parser.getSource continue in folder " + folder.getLocation());
        if (folder.exists()) {
          // System.err.println("Parser.getSource exists " + folder.getLocation());
        }
        else {
View Full Code Here

      project = sourceProject;
      if (project != null) {
        IProject rp = project.getRawProject();
       
        // System.out.println("The raw project has type: " + jp.getClass());
        IWorkspace workspace = ResourcesPlugin.getWorkspace();
        IPath wroot = workspace.getRoot().getLocation();
        // IProjectNatureDescriptor[] nds = workspace.getNatureDescriptors();
        boolean isJava = false;
       
        try {
            isJava = rp.hasNature("org.eclipse.jdt.core.javanature");
           
        } catch (CoreException e) {
            // e.printStackTrace();
            // System.out.println("The " + nd.getNatureId() + " is not supported, or so it seems.");
        }

        if (isJava) {
          IJavaProject jp = JavaCore.create(rp);
          javaProject = jp;
          projectPath = jp.getPath();
          try {
            IResource bpres = workspace.getRoot().findMember(jp.getOutputLocation());
            bp = bpres != null
                  ? bpres.getLocation().toString()
                  : wroot.append(jp.getOutputLocation()).toPortableString();
            IClasspathEntry[] cpes = jp.getResolvedClasspath(true);
            fp = bp;
            sp = ".";
            for (IClasspathEntry cpe: cpes) {
              if (cpe.getEntryKind() == IClasspathEntry.CPE_SOURCE) {
                if (sp.length() > 0) sp += System.getProperty("path.separator");
                sp += cpe.getPath().makeRelativeTo(jp.getPath()).toString();
              }
              else {
                if (fp.length() > 0) fp += System.getProperty("path.separator");
               
                IResource res = workspace.getRoot().findMember(cpe.getPath());
                String lib = res != null ? res.getLocation().toString() : "no res";
                String lib1 =  cpe.getPath().toString();
                String lib2 =  cpe.getPath().makeRelativeTo(jp.getPath()).toString();
                String lib3 =  cpe.getPath().makeRelativeTo(wroot).makeRelative().toString();
                String lib4 =  cpe.getPath().makeRelativeTo(wroot).toString();
View Full Code Here

        // get a project descriptor
        IPath newPath = null;
        if (!mainPage.useDefaults())
            newPath = mainPage.getLocationPath();

        IWorkspace workspace = ResourcesPlugin.getWorkspace();
        final IProjectDescription description = workspace
                .newProjectDescription(newProjectHandle.getName());
        description.setLocation(newPath);
        addNatures(description);

        // create the new project operation
View Full Code Here

   
    disableAutoBuild();
  }
 
  protected static void disableAutoBuild() {
    IWorkspace workspace = ResourcesPlugin.getWorkspace();
    IWorkspaceDescription desc= workspace.getDescription();
    desc.setAutoBuilding(false);
    try {
      workspace.setDescription(desc);
    } catch (CoreException e) {
      throw melnorme.utilbox.core.ExceptionAdapter.unchecked(e);
    }
  }
View Full Code Here

        // On button click, this displays the python module picker dialog.
        fMainModuleBrowseButton.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                IWorkspace workspace = ResourcesPlugin.getWorkspace();
                // IFile currentFile = getMainModuleFile();
                IResource resource = workspace.getRoot().findMember(fProjectName);

                if (resource instanceof IProject) {
                    IProject project = (IProject) resource;

                    FileDialog fd = new FileDialog(lParent.getShell(), SWT.OPEN);
                    fd.setText("Choose Grinder Properties File");
                    fd.setFilterPath(project.getLocation().toOSString());
                    String[] filterExt = { "*.properties" };
                    fd.setFilterExtensions(filterExt);
                    String result = fd.open();

                    if ((result != null) && (result.length() > 0)) {
                        fMainModuleText.setText(result);
                    }
                }

            }
        });

        // Create a ModifyListener, used to listen for project modifications in
        // the ProjectBlock.
        // This assumes that the Project is in a Text control...
        fProjectModifyListener = new ModifyListener() {
            public void modifyText(ModifyEvent e) {
                Widget widget = e.widget;
                if (widget instanceof Text) {
                    Text text = (Text) widget;
                    fProjectName = text.getText();
                    IWorkspace workspace = ResourcesPlugin.getWorkspace();
                    IResource resource = workspace.getRoot().findMember(fProjectName);

                    boolean enabled = false;
                    if ((resource != null) && (resource instanceof IProject)) {
                        IProject project = (IProject) resource;
                        PythonNature nature = PythonNature.getPythonNature(project);
View Full Code Here

TOP

Related Classes of org.eclipse.core.resources.IWorkspace$ProjectOrder

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.