generated from JetBrains/intellij-platform-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #394 from marhali/fix/illegal-dependency-usage
Fix/illegal dependency usage
- Loading branch information
Showing
5 changed files
with
36 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
src/main/java/de/marhali/easyi18n/assistance/folding/XmlFoldingBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package de.marhali.easyi18n.assistance.folding; | ||
|
||
import com.intellij.lang.ASTNode; | ||
import com.intellij.openapi.util.Pair; | ||
import com.intellij.psi.PsiElement; | ||
import com.intellij.psi.util.PsiTreeUtil; | ||
import com.intellij.psi.xml.XmlAttributeValue; | ||
|
||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
public class XmlFoldingBuilder extends AbstractFoldingBuilder { | ||
@Override | ||
@NotNull List<Pair<String, PsiElement>> extractRegions(@NotNull PsiElement root) { | ||
return PsiTreeUtil.findChildrenOfType(root, XmlAttributeValue.class) | ||
.stream() | ||
.map((attributeValue -> Pair.pair(attributeValue.getValue(), (PsiElement) attributeValue))) | ||
.collect(Collectors.toList()); | ||
} | ||
|
||
@Override | ||
@Nullable String extractText(@NotNull ASTNode node) { | ||
XmlAttributeValue attributeValue = node.getPsi(XmlAttributeValue.class); | ||
return attributeValue.getValue(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters