Search in sources :

Example 6 with ManifestFile

use of org.jetbrains.lang.manifest.psi.ManifestFile in project intellij-community by JetBrains.

the class ManifestPsiTest method testHeader.

public void testHeader() {
    ManifestFile file = createFile("Header: value\nEmpty-Header:\nBad-Header\n");
    assertHeaderValue(file, "Header", "value");
    assertHeaderValue(file, "Empty-Header", "");
    assertHeaderValue(file, "Bad-Header", null);
}
Also used : ManifestFile(org.jetbrains.lang.manifest.psi.ManifestFile)

Example 7 with ManifestFile

use of org.jetbrains.lang.manifest.psi.ManifestFile in project intellij-plugins by JetBrains.

the class OsgiManifestPsiTest method testAttributes.

public void testAttributes() {
    ManifestFile file = createFile("Import-Package: com.acme;a1=value1;a2=value2");
    assertAssignment(file, true, "a1", "value1");
    assertAssignment(file, true, "a2", "value2");
    assertAssignment(file, true, "a3", null);
    assertAssignment(file, false, "a1", null);
}
Also used : ManifestFile(org.jetbrains.lang.manifest.psi.ManifestFile)

Example 8 with ManifestFile

use of org.jetbrains.lang.manifest.psi.ManifestFile in project intellij-plugins by JetBrains.

the class OsgiManifestPsiTest method testDirectives.

public void testDirectives() {
    ManifestFile file = createFile("Import-Package: com.acme;d1:=value1;d2:=value2");
    assertAssignment(file, false, "d1", "value1");
    assertAssignment(file, false, "d2", "value2");
    assertAssignment(file, false, "d3", null);
    assertAssignment(file, true, "d1", null);
}
Also used : ManifestFile(org.jetbrains.lang.manifest.psi.ManifestFile)

Example 9 with ManifestFile

use of org.jetbrains.lang.manifest.psi.ManifestFile in project intellij-plugins by JetBrains.

the class OsgiManifestPsiTest method testBundleVersion.

public void testBundleVersion() {
    ManifestFile file = createFile("Bundle-Version: 1.2.3.b300\n");
    Header header = file.getHeader("Bundle-Version");
    assertNotNull(header);
    Object value = HeaderParserRepository.getInstance().getConvertedValue(header);
    assertEquals(new Version(1, 2, 3, "b300"), value);
}
Also used : Header(org.jetbrains.lang.manifest.psi.Header) Version(org.osgi.framework.Version) ManifestFile(org.jetbrains.lang.manifest.psi.ManifestFile)

Example 10 with ManifestFile

use of org.jetbrains.lang.manifest.psi.ManifestFile in project intellij-plugins by JetBrains.

the class OsgiManifestPsiTest method testClauses.

public void testClauses() {
    ManifestFile file = createFile("Import-Package: a.b,c.d;a=value;d:=value");
    Header header = file.getHeader("Import-Package");
    assertNotNull(header);
    List<HeaderValue> clauses = header.getHeaderValues();
    assertEquals(2, clauses.size());
    Clause clause1 = (Clause) clauses.get(0), clause2 = (Clause) clauses.get(1);
    assertEquals(0, clause1.getAttributes().size());
    assertEquals(0, clause1.getDirectives().size());
    assertEquals(1, clause2.getAttributes().size());
    assertEquals(1, clause2.getDirectives().size());
    assertNotNull(clause2.getAttribute("a"));
    assertNull(clause2.getAttribute("b"));
    assertNotNull(clause2.getDirective("d"));
    assertNull(clause2.getDirective("z"));
}
Also used : HeaderValue(org.jetbrains.lang.manifest.psi.HeaderValue) Header(org.jetbrains.lang.manifest.psi.Header) Clause(org.osmorc.manifest.lang.psi.Clause) ManifestFile(org.jetbrains.lang.manifest.psi.ManifestFile)

Aggregations

ManifestFile (org.jetbrains.lang.manifest.psi.ManifestFile)13 Header (org.jetbrains.lang.manifest.psi.Header)4 PsiFile (com.intellij.psi.PsiFile)3 Nullable (org.jetbrains.annotations.Nullable)2 HeaderValue (org.jetbrains.lang.manifest.psi.HeaderValue)2 OsmorcFacet (org.osmorc.facet.OsmorcFacet)2 OsmorcFacetConfiguration (org.osmorc.facet.OsmorcFacetConfiguration)2 Module (com.intellij.openapi.module.Module)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 PsiElement (com.intellij.psi.PsiElement)1 PsiReference (com.intellij.psi.PsiReference)1 IncorrectOperationException (com.intellij.util.IncorrectOperationException)1 List (java.util.List)1 HeaderValuePart (org.jetbrains.lang.manifest.psi.HeaderValuePart)1 Section (org.jetbrains.lang.manifest.psi.Section)1 Version (org.osgi.framework.Version)1 Clause (org.osmorc.manifest.lang.psi.Clause)1