Package qwickie.util

Examples of qwickie.util.FileSearcher


        if (oldFile.exists() && oldFile.isAccessible()) { // if there's a file in the same folder
          oldFile.refreshLocal(SAVE_IF_DIRTY, paramIProgressMonitor);
          oldFile.move(newPath, true, true, paramIProgressMonitor);
        }

        FileSearcher fs = new FileSearcher(sourceType.getJavaProject().getProject(), sourceType.getTypeQualifiedName() + "*");
        ResourcesPlugin.getWorkspace().getRoot().accept(fs);
        List<IFile> ffs = fs.getFoundFiles();

        for (IFile ff : ffs) {
          if (ff != null && ff.exists() && ff.isAccessible() && FileSearcher.haveSameRelativePathToParentSourceFolder(ff, oldFile)) {
            IPath nfn = ff.getFullPath().removeLastSegments(1).append(getArguments().getNewName());
            if (ff.getName().startsWith(sourceType.getTypeQualifiedName() + "_")) { // variation
              nfn = ff.getFullPath().removeLastSegments(1).append(getArguments().getNewName() + ff.getName().substring(ff.getName().indexOf("_")));
            } else if (ff.getName().startsWith(sourceType.getTypeQualifiedName() + "$")) { // inner type
              nfn = ff.getFullPath().removeLastSegments(1).append(getArguments().getNewName() + ff.getName().substring(ff.getName().indexOf("$")));
            } else {
              nfn = nfn.addFileExtension("html");
            }
            ff.refreshLocal(SAVE_IF_DIRTY, paramIProgressMonitor);
            ff.move(nfn, true, true, paramIProgressMonitor);
          }
        }

        fs = new FileSearcher(sourceType.getJavaProject().getProject(), sourceType.getTypeQualifiedName() + ".properties");
        ResourcesPlugin.getWorkspace().getRoot().accept(fs);
        ffs = fs.getFoundFiles();

        for (IFile ff : ffs) {
          if (ff != null && ff.exists() && ff.isAccessible() && FileSearcher.haveSameRelativePathToParentSourceFolder(ff, oldFile)) {
            IPath nfn = ff.getFullPath().removeLastSegments(1).append(getArguments().getNewName());
            if (ff.getName().startsWith(sourceType.getTypeQualifiedName() + "_")) { // variation
View Full Code Here


    final IFile file = getFile(filename);
    // is there a html file in the same folder?
    if (file != null && file.exists()) {
      htmlFilenames.add(filename);
    } else { // if not, search for one with the same name
      final FileSearcher fs = new FileSearcher(project, new Path(filename).lastSegment());
      try {
        final IJavaProject javaProject = (IJavaProject) project.getNature(JavaCore.NATURE_ID);
        final IPackageFragmentRoot[] packageFragmentRoots = javaProject.getPackageFragmentRoots();
        project.accept(fs);
        for (final IFile foundFile : fs.getFoundFiles()) {
          for (final IPackageFragmentRoot packageFragmentRoot : packageFragmentRoots) {
            if (packageFragmentRoot.getKind() == 1) { // if it's in a source folder
              if (packageFragmentRoot.getPath().segment(1).equals(foundFile.getFullPath().segment(1))) { // starting with /src
                htmlFilenames.add(foundFile.getFullPath().toPortableString());
              }
            }
          }
        }
      } catch (final CoreException e1) {
      }
    }
    FileSearcher fs = new FileSearcher(project, new Path(filename).removeFileExtension().lastSegment() + "$*");
    try {
      project.accept(fs);
      for (final IFile foundFile : fs.getFoundFiles()) {
        htmlFilenames.add(foundFile.getFullPath().toPortableString());
      }
    } catch (CoreException e) {
    }

View Full Code Here

      // }
      // it is an inner class
      // if (searchName.contains("$")) {
      // searchName = searchName.split("\\$")[0].concat(".java");
      // }
      final FileSearcher fs = new FileSearcher(openedResource.getProject(), searchName);
      try {
        final IProject project = openedResource.getProject();
        project.accept(fs);

        if (fs.getFoundFiles().size() > 1) { // more then one file found means, there are other packages with the same filenames
          List<IPath> sourceRoots = FileSearcher.getSourceFolders(project);
          IPath orp = openedResource.getFullPath().removeLastSegments(1);
          for (IPath sourceRoot : sourceRoots) {
            if (sourceRoot.isPrefixOf(orp)) {
              for (IFile ff : fs.getFoundFiles()) {
                final IPath ffr = ff.getFullPath().removeFirstSegments(sourceRoot.segmentCount()).removeLastSegments(1);
                orp = openedResource.getFullPath().removeFirstSegments(sourceRoot.segmentCount()).removeLastSegments(1);
                if (orp.toPortableString().equals(ffr.toPortableString())) {
                  return ff;
                }
              }
            }
          }
        } else if (fs.getFoundFile() != null) {
          return fs.getFoundFile();
        }
      } catch (final CoreException e1) {
      }
    }
View Full Code Here

    // is there a file in the same folder, with the same name? then take this one first
    if (file != null && file.exists()) {
      filenames.add(filename);
    } else { // if not, search for one with the same name
      final FileSearcher fs = new FileSearcher(openedResource.getProject(), openedResource.getFullPath().removeFileExtension().lastSegment() + "*." + ext);
      try {
        final IProject project = openedResource.getProject();
        project.accept(fs);
        final List<IFile> ffs = fs.getFoundFiles();
        if (ffs != null) {
          for (final IFile ff : ffs) {
            filenames.add(ff.getFullPath().toPortableString());
          }
        }
View Full Code Here

TOP

Related Classes of qwickie.util.FileSearcher

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.