private void initSwiperSettings() { IProject prj = this.desProject.getProject(); if (prj != null) { this.customFilterPath = SwiperUtil.getCustomFilterFilePath(prj); this.mimicDoraXmlDeclaration = SwiperUtil.isMimicXmlDeclaration(prj); this.mimicDxlExportEOF = SwiperUtil.isMimicDxlExportEOF(prj); } else { SwiperUtil.logError( "DesignerProject.getProject() is null, couldn't retrieve Swiper settings"); } }
private void processSelection(ExecutionEvent event) { this.desProject = null; ISelection selection = HandlerUtil.getCurrentSelection(event); if (selection instanceof StructuredSelection) { StructuredSelection ss = (StructuredSelection) selection; IProject project = null; List<?> list = ss.toList(); // Check to determine first project for (Object o : list) { if (o instanceof IFile) { IFile file = (IFile) o; if (project == null) { project = file.getProject(); } } } // if we found the project, assign the this.desProject if (project != null) { if (DominoResourcesPlugin.isDominoDesignerProject(project)) { try { this.desProject = DominoResourcesPlugin.getDominoDesignerProject(project); } catch (NsfException e) { SwiperUtil.logError(e.getMessage()); } } } else { // If we can't figure out the project then it is no good return; } // Add files that belong to that project for (Object o : list) { if (o instanceof IFile) { IFile file = (IFile) o; if (file.getProject() == project) { filesTofilter.add(file); } } } } }
@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); }
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 { } }