本文整理汇总了Java中com.intellij.framework.detection.FrameworkDetector类的典型用法代码示例。如果您正苦于以下问题:Java FrameworkDetector类的具体用法?Java FrameworkDetector怎么用?Java FrameworkDetector使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FrameworkDetector类属于com.intellij.framework.detection包,在下文中一共展示了FrameworkDetector类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: saveDetectors
import com.intellij.framework.detection.FrameworkDetector; //导入依赖的package包/类
private void saveDetectors() {
final File file = getDetectorsRegistryFile();
FileUtil.createIfDoesntExist(file);
try {
DataOutputStream output = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(file)));
try {
output.writeInt(REGISTRY_VERSION);
output.writeInt(myDetectorsVersion);
final FrameworkDetector[] detectors = FrameworkDetector.EP_NAME.getExtensions();
output.writeInt(detectors.length);
for (FrameworkDetector detector : detectors) {
output.writeUTF(detector.getDetectorId());
output.writeInt(myDetectorIds.get(detector.getDetectorId()));
output.writeInt(detector.getDetectorVersion());
}
}
finally {
output.close();
}
}
catch (IOException e) {
LOG.info(e);
}
}
示例2: FrameworkDetectionProcessor
import com.intellij.framework.detection.FrameworkDetector; //导入依赖的package包/类
public FrameworkDetectionProcessor(ProgressIndicator progressIndicator, final FrameworkDetectionContext context) {
myProgressIndicator = progressIndicator;
final FrameworkDetector[] detectors = FrameworkDetector.EP_NAME.getExtensions();
myDetectorsByFileType = new MultiMap<FileType, FrameworkDetectorData>();
for (FrameworkDetector detector : detectors) {
myDetectorsByFileType.putValue(detector.getFileType(), new FrameworkDetectorData(detector));
}
myContext = context;
}
示例3: getIndexer
import com.intellij.framework.detection.FrameworkDetector; //导入依赖的package包/类
@NotNull
@Override
public DataIndexer<Integer, Void, FileContent> getIndexer() {
final MultiMap<FileType, Pair<ElementPattern<FileContent>, Integer>> detectors = new MultiMap<FileType, Pair<ElementPattern<FileContent>, Integer>>();
for (FrameworkDetector detector : FrameworkDetector.EP_NAME.getExtensions()) {
detectors.putValue(detector.getFileType(), Pair.create(detector.createSuitableFilePattern(), myRegistry.getDetectorId(detector)));
}
return new DataIndexer<Integer, Void, FileContent>() {
@NotNull
@Override
public Map<Integer, Void> map(@NotNull FileContent inputData) {
final FileType fileType = inputData.getFileType();
if (!detectors.containsKey(fileType)) {
return Collections.emptyMap();
}
Map<Integer, Void> result = null;
for (Pair<ElementPattern<FileContent>, Integer> pair : detectors.get(fileType)) {
if (pair.getFirst().accepts(inputData)) {
if (LOG.isDebugEnabled()) {
LOG.debug(inputData.getFile() + " accepted by detector " + pair.getSecond());
}
if (result == null) {
result = new HashMap<Integer, Void>();
}
myDispatcher.getMulticaster().fileUpdated(inputData.getFile(), pair.getSecond());
result.put(pair.getSecond(), null);
}
}
return result != null ? result : Collections.<Integer, Void>emptyMap();
}
};
}
示例4: getInputFilter
import com.intellij.framework.detection.FrameworkDetector; //导入依赖的package包/类
@NotNull
@Override
public FileBasedIndex.InputFilter getInputFilter() {
final Set<FileType> acceptedTypes = new HashSet<FileType>();
for (FrameworkDetector detector : FrameworkDetector.EP_NAME.getExtensions()) {
acceptedTypes.add(detector.getFileType());
}
return new DefaultFileTypeSpecificInputFilter(acceptedTypes.toArray(new FileType[acceptedTypes.size()]));
}
示例5: getFrameworkTypes
import com.intellij.framework.detection.FrameworkDetector; //导入依赖的package包/类
@NotNull
@Override
public List<? extends FrameworkType> getFrameworkTypes() {
final List<FrameworkType> types = new ArrayList<FrameworkType>();
for (FrameworkDetector detector : FrameworkDetector.EP_NAME.getExtensions()) {
types.add(detector.getFrameworkType());
}
return types;
}
示例6: findFrameworkTypeForFacetDetector
import com.intellij.framework.detection.FrameworkDetector; //导入依赖的package包/类
@Nullable
public static FrameworkType findFrameworkTypeForFacetDetector(@NotNull FacetType<?, ?> facetType) {
for (FrameworkDetector detector : FrameworkDetector.EP_NAME.getExtensions()) {
if (detector instanceof FacetBasedFrameworkDetector<?, ?> &&
((FacetBasedFrameworkDetector)detector).getFacetType().equals(facetType)) {
return detector.getFrameworkType();
}
}
return null;
}
示例7: runDetector
import com.intellij.framework.detection.FrameworkDetector; //导入依赖的package包/类
private List<? extends DetectedFrameworkDescription> runDetector(Integer detectorId,
FileBasedIndex index,
DetectionExcludesConfiguration excludesConfiguration,
final boolean processNewFilesOnly) {
Collection<VirtualFile> acceptedFiles = index.getContainingFiles(FrameworkDetectionIndex.NAME, detectorId, GlobalSearchScope.projectScope(myProject));
final Collection<VirtualFile> filesToProcess;
if (processNewFilesOnly) {
filesToProcess = myDetectedFrameworksData.retainNewFiles(detectorId, acceptedFiles);
}
else {
filesToProcess = new ArrayList<VirtualFile>(acceptedFiles);
}
FrameworkDetector detector = FrameworkDetectorRegistry.getInstance().getDetectorById(detectorId);
if (detector == null) {
LOG.info("Framework detector not found by id " + detectorId);
return Collections.emptyList();
}
((DetectionExcludesConfigurationImpl)excludesConfiguration).removeExcluded(filesToProcess, detector.getFrameworkType());
if (LOG.isDebugEnabled()) {
LOG.debug("Detector '" + detector.getDetectorId() + "': " + acceptedFiles.size() + " accepted files, " + filesToProcess.size() + " files to process");
}
final List<? extends DetectedFrameworkDescription> frameworks;
if (!filesToProcess.isEmpty()) {
frameworks = detector.detect(filesToProcess, new FrameworkDetectionContextImpl(myProject));
}
else {
frameworks = Collections.emptyList();
}
return frameworks;
}
示例8: getIndexer
import com.intellij.framework.detection.FrameworkDetector; //导入依赖的package包/类
@NotNull
@Override
public DataIndexer<Integer, Void, FileContent> getIndexer() {
final MultiMap<FileType, Pair<ElementPattern<FileContent>, Integer>> detectors = new MultiMap<FileType, Pair<ElementPattern<FileContent>, Integer>>();
for (FrameworkDetector detector : FrameworkDetector.EP_NAME.getExtensions()) {
detectors.putValue(detector.getFileType(), Pair.create(detector.createSuitableFilePattern(), myRegistry.getDetectorId(detector)));
}
return new DataIndexer<Integer, Void, FileContent>() {
@NotNull
@Override
public Map<Integer, Void> map(FileContent inputData) {
final FileType fileType = inputData.getFileType();
if (!detectors.containsKey(fileType)) {
return Collections.emptyMap();
}
Map<Integer, Void> result = null;
for (Pair<ElementPattern<FileContent>, Integer> pair : detectors.get(fileType)) {
if (pair.getFirst().accepts(inputData)) {
if (LOG.isDebugEnabled()) {
LOG.debug(inputData.getFile() + " accepted by detector " + pair.getSecond());
}
if (result == null) {
result = new HashMap<Integer, Void>();
}
myDispatcher.getMulticaster().fileUpdated(inputData.getFile(), pair.getSecond());
result.put(pair.getSecond(), null);
}
}
return result != null ? result : Collections.<Integer, Void>emptyMap();
}
};
}
示例9: getInputFilter
import com.intellij.framework.detection.FrameworkDetector; //导入依赖的package包/类
@Override
public FileBasedIndex.InputFilter getInputFilter() {
final Set<FileType> acceptedTypes = new HashSet<FileType>();
for (FrameworkDetector detector : FrameworkDetector.EP_NAME.getExtensions()) {
acceptedTypes.add(detector.getFileType());
}
return new DefaultFileTypeSpecificInputFilter(acceptedTypes.toArray(new FileType[acceptedTypes.size()]));
}
示例10: getDetector
import com.intellij.framework.detection.FrameworkDetector; //导入依赖的package包/类
@NotNull
@Override
public FrameworkDetector getDetector()
{
return detector;
}
示例11: isEnabled
import com.intellij.framework.detection.FrameworkDetector; //导入依赖的package包/类
public static boolean isEnabled() {
return FrameworkDetector.EP_NAME.getExtensions().length > 0;
}
示例12: FrameworkDetectorData
import com.intellij.framework.detection.FrameworkDetector; //导入依赖的package包/类
public FrameworkDetectorData(FrameworkDetector detector) {
myDetector = detector;
myFilePattern = detector.createSuitableFilePattern();
}
示例13: getDetector
import com.intellij.framework.detection.FrameworkDetector; //导入依赖的package包/类
@NotNull
@Override
public FrameworkDetector getDetector() {
return myDetector;
}
示例14: getDetectorId
import com.intellij.framework.detection.FrameworkDetector; //导入依赖的package包/类
@Override
public int getDetectorId(@NotNull FrameworkDetector detector) {
return myDetectorIds.get(detector.getDetectorId());
}
示例15: getDetectorById
import com.intellij.framework.detection.FrameworkDetector; //导入依赖的package包/类
@Override
public FrameworkDetector getDetectorById(int id) {
return myDetectorById.get(id);
}