Package org.jetbrains.lang.manifest.psi

Examples of org.jetbrains.lang.manifest.psi.ManifestFile


import java.util.List;

public class OsgiManifestPsiTest extends LightIdeaTestCase {
  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());
View Full Code Here


    assertNotNull(clause2.getDirective("d"));
    assertNull(clause2.getDirective("z"));
  }

  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);
  }
View Full Code Here

    assertAssignment(file, true, "a3", null);
    assertAssignment(file, false, "a1", null);
  }

  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);
  }
View Full Code Here

    assertAssignment(file, false, "d3", null);
    assertAssignment(file, true, "d1", null);
  }

  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);
  }
View Full Code Here

    myFixture.configureByText("MANIFEST.MF", original);

    WriteCommandAction.runWriteCommandAction(null, new Runnable() {
          @Override
          public void run() {
        ManifestFile manifestFile = (ManifestFile)myFixture.getFile();
        if (replace) {
          OsgiPsiUtil.setHeader(manifestFile, "TestHeader", "TestValue");
        }
        else {
          OsgiPsiUtil.appendToHeader(manifestFile, "TestHeader", "TestValue");
View Full Code Here

      return OsmorcBundle.message("UnregisteredActivatorInspection.fix.manifest");
    }

    @Override
    public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
      ManifestFile manifestFile = getVerifiedManifestFile(descriptor.getEndElement());
      if (manifestFile != null) {
        OsgiPsiUtil.setHeader(manifestFile, Constants.BUNDLE_ACTIVATOR, myActivatorClass);
      }
    }
View Full Code Here

      String message = OsmorcBundle.message("inspection.fix.no.manifest");
      Notifications.Bus.notify(new Notification("osmorc", getFamilyName(), message, NotificationType.WARNING));
      return null;
    }

    ManifestFile manifestFile = manifest.getManifestFile();
    if (!CommonRefactoringUtil.checkReadOnlyStatus(manifestFile)) {
      return null;
    }

    return manifestFile;
View Full Code Here

      return OsmorcBundle.message("PackageAccessibilityInspection.fix");
    }

    @Override
    public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
      ManifestFile manifestFile = getVerifiedManifestFile(descriptor.getPsiElement());
      if (manifestFile != null) {
        OsgiPsiUtil.appendToHeader(manifestFile, Constants.IMPORT_PACKAGE, myPackageToImport);
      }
    }
View Full Code Here

TOP

Related Classes of org.jetbrains.lang.manifest.psi.ManifestFile

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.