Search in sources :

Example 1 with FrameworkType

use of com.intellij.framework.FrameworkType in project intellij-community by JetBrains.

the class FacetImporter method isFacetDetectionDisabled.

protected boolean isFacetDetectionDisabled(Project project) {
    final DetectionExcludesConfiguration excludesConfiguration = DetectionExcludesConfiguration.getInstance(project);
    final FrameworkType frameworkType = FrameworkDetectionUtil.findFrameworkTypeForFacetDetector(myFacetType);
    if (frameworkType == null)
        return false;
    return excludesConfiguration.isExcludedFromDetection(frameworkType);
}
Also used : FrameworkType(com.intellij.framework.FrameworkType) DetectionExcludesConfiguration(com.intellij.framework.detection.DetectionExcludesConfiguration)

Example 2 with FrameworkType

use of com.intellij.framework.FrameworkType in project intellij-community by JetBrains.

the class DetectedFrameworksTree method createNodesGroupedByType.

private void createNodesGroupedByType(CheckedTreeNode root, final List<? extends DetectedFrameworkDescription> frameworks) {
    Map<FrameworkType, FrameworkTypeNode> groupNodes = new HashMap<>();
    for (DetectedFrameworkDescription framework : frameworks) {
        final FrameworkType type = framework.getDetector().getFrameworkType();
        FrameworkTypeNode group = groupNodes.get(type);
        if (group == null) {
            group = new FrameworkTypeNode(type);
            groupNodes.put(type, group);
            root.add(group);
        }
        group.add(new DetectedFrameworkNode(framework, myContext));
    }
}
Also used : FrameworkType(com.intellij.framework.FrameworkType) DetectedFrameworkDescription(com.intellij.framework.detection.DetectedFrameworkDescription)

Example 3 with FrameworkType

use of com.intellij.framework.FrameworkType in project intellij-community by JetBrains.

the class DetectionExcludesConfigurable method doAddAction.

private void doAddAction(AnActionButton button) {
    final List<FrameworkType> types = new ArrayList<>();
    for (FrameworkType type : FrameworkDetectorRegistry.getInstance().getFrameworkTypes()) {
        if (!isExcluded(type)) {
            types.add(type);
        }
    }
    Collections.sort(types, (o1, o2) -> o1.getPresentableName().compareToIgnoreCase(o2.getPresentableName()));
    types.add(0, null);
    final ListPopup popup = JBPopupFactory.getInstance().createListPopup(new BaseListPopupStep<FrameworkType>("Framework to Exclude", types) {

        @Override
        public Icon getIconFor(FrameworkType value) {
            return value != null ? value.getIcon() : null;
        }

        @NotNull
        @Override
        public String getTextFor(FrameworkType value) {
            return value != null ? value.getPresentableName() : "All Frameworks...";
        }

        @Override
        public boolean hasSubstep(FrameworkType selectedValue) {
            return selectedValue != null;
        }

        @Override
        public PopupStep onChosen(final FrameworkType frameworkType, boolean finalChoice) {
            if (frameworkType == null) {
                return doFinalStep(() -> chooseDirectoryAndAdd(null));
            } else {
                return addExcludedFramework(frameworkType);
            }
        }
    });
    final RelativePoint popupPoint = button.getPreferredPopupPoint();
    if (popupPoint != null) {
        popup.show(popupPoint);
    } else {
        popup.showInCenterOf(myMainPanel);
    }
}
Also used : FrameworkType(com.intellij.framework.FrameworkType) ArrayList(java.util.ArrayList) ListPopup(com.intellij.openapi.ui.popup.ListPopup) RelativePoint(com.intellij.ui.awt.RelativePoint) NotNull(org.jetbrains.annotations.NotNull) BaseListPopupStep(com.intellij.openapi.ui.popup.util.BaseListPopupStep) PopupStep(com.intellij.openapi.ui.popup.PopupStep)

Example 4 with FrameworkType

use of com.intellij.framework.FrameworkType in project intellij-community by JetBrains.

the class DetectionExcludesConfigurationTest method testAddExcludedFileForExcludedFramework.

public void testAddExcludedFileForExcludedFramework() {
    final FrameworkType type = getType();
    getConfiguration().addExcludedFramework(type);
    getConfiguration().addExcludedFile(myTempDir, type);
    assertEmpty(getState().getFiles());
    getConfiguration().addExcludedFile(myTempDir, null);
    assertOneElement(getState().getFiles());
}
Also used : FrameworkType(com.intellij.framework.FrameworkType)

Example 5 with FrameworkType

use of com.intellij.framework.FrameworkType in project intellij-community by JetBrains.

the class DetectionExcludesConfigurable method reset.

@Override
public void reset() {
    myModel.clear();
    final ExcludesConfigurationState state = myConfiguration.getActualState();
    myEnabledDetectionCheckBox.setSelected(state.isDetectionEnabled());
    for (String typeId : state.getFrameworkTypes()) {
        final FrameworkType frameworkType = FrameworkDetectorRegistry.getInstance().findFrameworkType(typeId);
        myModel.add(frameworkType != null ? new ValidExcludeListItem(frameworkType, null) : new InvalidExcludeListItem(typeId, null));
    }
    for (ExcludedFileState fileState : state.getFiles()) {
        VirtualFile file = VirtualFileManager.getInstance().findFileByUrl(fileState.getUrl());
        final String typeId = fileState.getFrameworkType();
        if (typeId == null) {
            myModel.add(file != null ? new ValidExcludeListItem(null, file) : new InvalidExcludeListItem(null, fileState.getUrl()));
        } else {
            final FrameworkType frameworkType = FrameworkDetectorRegistry.getInstance().findFrameworkType(typeId);
            myModel.add(frameworkType != null && file != null ? new ValidExcludeListItem(frameworkType, file) : new InvalidExcludeListItem(typeId, fileState.getUrl()));
        }
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) FrameworkType(com.intellij.framework.FrameworkType)

Aggregations

FrameworkType (com.intellij.framework.FrameworkType)7 DetectionExcludesConfiguration (com.intellij.framework.detection.DetectionExcludesConfiguration)2 VirtualFile (com.intellij.openapi.vfs.VirtualFile)2 DetectedFrameworkDescription (com.intellij.framework.detection.DetectedFrameworkDescription)1 ListPopup (com.intellij.openapi.ui.popup.ListPopup)1 PopupStep (com.intellij.openapi.ui.popup.PopupStep)1 BaseListPopupStep (com.intellij.openapi.ui.popup.util.BaseListPopupStep)1 RelativePoint (com.intellij.ui.awt.RelativePoint)1 ArrayList (java.util.ArrayList)1 NotNull (org.jetbrains.annotations.NotNull)1