use of org.eclipse.xtext.util.MergeableManifest2.Attributes in project xtext-core by eclipse.
the class ManifestMerger2Test method testMergeRequiredBundles.
@Test
public void testMergeRequiredBundles() throws Exception {
String packageName = getClass().getPackage().getName().replace('.', '/');
InputStream resourceAsStream = getClass().getResourceAsStream("/" + packageName + "/Test_Manifest.MF");
MergeableManifest2 manifest = new MergeableManifest2(resourceAsStream);
Attributes attrs = manifest.getMainAttributes();
String before = attrs.get(MergeableManifest2.REQUIRE_BUNDLE).replaceAll("\\s", "");
manifest.addRequiredBundles(Collections.singleton("foo.bar.baz"));
String after = attrs.get(MergeableManifest2.REQUIRE_BUNDLE);
assertEquals(before + ",foo.bar.baz", after.replaceAll("\\s", ""));
}
use of org.eclipse.xtext.util.MergeableManifest2.Attributes in project xtext-core by eclipse.
the class ManifestMerger2Test method testNoChanges.
@Test
public void testNoChanges() throws Exception {
String packageName = getClass().getPackage().getName().replace('.', '/');
InputStream resourceAsStream = getClass().getResourceAsStream("/" + packageName + "/Test_Manifest.MF");
MergeableManifest2 manifest = new MergeableManifest2(resourceAsStream);
Attributes attrs = manifest.getMainAttributes();
String before = attrs.get(MergeableManifest2.EXPORT_PACKAGE).replaceAll("\\s", "");
manifest.addExportedPackages(Collections.singleton("foo.bar.baz"));
String after = attrs.get(MergeableManifest2.EXPORT_PACKAGE);
assertEquals(before + ",foo.bar.baz", after.replaceAll("\\s", ""));
}
use of org.eclipse.xtext.util.MergeableManifest2.Attributes in project certmgr by hdecarne.
the class StoreController method updateDetailsViewHelper.
private void updateDetailsViewHelper(TreeItem<AttributeModel> parentItem, Attributes attribute, boolean expand) {
TreeItem<AttributeModel> attributeItem = new TreeItem<>(new AttributeModel(attribute));
List<Attributes> attributeChildren = attribute.children();
int childCount = attributeChildren.size();
int childIndex = 0;
for (Attributes child : attributeChildren) {
if (childIndex >= DETAILS_VIEW_ATTRIBUTE_LIMIT) {
attributeItem.getChildren().add(new TreeItem<>(new AttributeModel(StoreI18N.formatSTR_TEXT_DETAILS_OMITTED(childCount - childIndex))));
break;
}
updateDetailsViewHelper(attributeItem, child, false);
childIndex++;
}
parentItem.getChildren().add(attributeItem);
attributeItem.setExpanded(expand);
}
use of org.eclipse.xtext.util.MergeableManifest2.Attributes in project omegat by omegat-org.
the class XMLUtils method convertAttributes.
/**
* Converts attributes from org.xml.sax package to OmegaT's.
*/
public static Attributes convertAttributes(org.xml.sax.Attributes attributes) {
Attributes res = new Attributes();
if (attributes == null) {
return res;
}
for (int i = 0; i < attributes.getLength(); i++) {
String name = StringUtil.makeValidXML(attributes.getQName(i));
String value = StringUtil.makeValidXML(attributes.getValue(i));
Attribute attr = new Attribute(name, value);
res.add(attr);
}
return res;
}
Aggregations