Пример #1
0
  @Override
  public Object execute(ExecutionEvent event) throws ExecutionException {

    SwiperUtil.logInfo("**** Performing Explicit Filtering");

    processSelection(event);

    if (this.desProject == null) {

      SwiperUtil.logError("Could not determine the Designer Project");

      return null;
    }

    initSwiperSettings();

    for (IFile designerFile : filesTofilter) {

      try {

        IFile diskFile = SwiperUtil.getRelevantDiskFile(this.desProject, designerFile);

        if (diskFile != null && diskFile.exists()) {

          SwiperUtil.logTrace(
              diskFile.getName() + " has been explicitly told to filter - Filter It");

          if (SwiperUtil.shouldFilter(designerFile)) {
            filterDiskFile(designerFile, diskFile, new NullProgressMonitor());
          } else {
            SwiperUtil.logTrace("Not Configured to filter " + designerFile.getName());
          }
        }

      } catch (CoreException e) {
        SwiperUtil.logError(e.getMessage());
      }
    }

    return super.execute(event);
  }
Пример #2
0
  public void filterDiskFile(IResource designerResource, IFile diskFile, IProgressMonitor monitor) {

    SwiperUtil.logTrace("About To Filter" + diskFile.getName());

    if (!diskFile.exists()) return;

    try {

      Transformer transformer = getTransformer();

      if (diskFile != null) {
        filter(diskFile, transformer, monitor);
        SwiperUtil.logInfo("Filtered " + diskFile.getName());
      }

    } catch (TransformerConfigurationException e) {

      String message = e.getMessage();
      SwiperUtil.addMarker(designerResource, "Swiper Error " + message, IMarker.SEVERITY_INFO);

    } catch (TransformerException e) {
      String message = e.getMessage();
      SwiperUtil.addMarker(designerResource, "Swiper Error " + message, IMarker.SEVERITY_INFO);

    } catch (CoreException e) {
      String message = e.getMessage();
      SwiperUtil.addMarker(designerResource, "Swiper Error " + message, IMarker.SEVERITY_INFO);

    } catch (FileNotFoundException e) {
      String message = e.getMessage();
      SwiperUtil.addMarker(designerResource, "Swiper Error " + message, IMarker.SEVERITY_WARNING);
    } catch (IOException e) {
      String message = e.getMessage();
      SwiperUtil.addMarker(designerResource, "Swiper Error " + message, IMarker.SEVERITY_WARNING);
    } finally {

    }
  }