private boolean isValidSelectedFile() { if (selectedFile == null) { return false; } if (!DartCore.isDartLikeFileName(selectedFile.getName())) { return false; } DartElement element = DartCore.create(selectedFile); if (element instanceof CompilationUnit) { CompilationUnit cu = (CompilationUnit) element; DartLibrary lib = cu.getLibrary(); if (lib instanceof DartLibraryImpl) { DartLibraryImpl impl = (DartLibraryImpl) lib; return impl.hasMain() && !impl.isBrowserApplication(); } } return false; }
@Override protected List<IFile> getSelectedResources() { @SuppressWarnings("unchecked") List<Object> res = super.getSelectedResources(); ArrayList<IFile> resources = new ArrayList<IFile>(); for (Object r : res) { if (r instanceof IFile && DartCore.isDartLikeFileName(((IResource) r).getName())) { resources.add((IFile) r); } } return resources; }
private void checkName(String name) { fileCount++; if (DartCore.isDartLikeFileName(name)) { dartCount++; } }