Search in sources :

Example 1 with HeaderClause

use of aQute.bnd.build.model.clauses.HeaderClause in project bnd by bndtools.

the class HeaderClauseListConverter method convert.

public List<R> convert(String input) throws IllegalArgumentException {
    if (input == null)
        return null;
    List<R> result = new ArrayList<R>();
    Parameters header = new Parameters(input);
    for (Entry<String, Attrs> entry : header.entrySet()) {
        String key = Processor.removeDuplicateMarker(entry.getKey());
        HeaderClause clause = new HeaderClause(key, entry.getValue());
        result.add(itemConverter.convert(clause));
    }
    return result;
}
Also used : Parameters(aQute.bnd.header.Parameters) ArrayList(java.util.ArrayList) Attrs(aQute.bnd.header.Attrs) HeaderClause(aQute.bnd.build.model.clauses.HeaderClause)

Example 2 with HeaderClause

use of aQute.bnd.build.model.clauses.HeaderClause in project bnd by bndtools.

the class BndEditModel method addBundleBlueprint.

public void addBundleBlueprint(String location) {
    List<HeaderClause> bpLocations = getBundleBlueprint();
    if (bpLocations == null)
        bpLocations = new ArrayList<HeaderClause>();
    else
        bpLocations = new ArrayList<HeaderClause>(bpLocations);
    bpLocations.add(new HeaderClause(location, null));
    setBundleBlueprint(bpLocations);
}
Also used : ArrayList(java.util.ArrayList) HeaderClause(aQute.bnd.build.model.clauses.HeaderClause)

Example 3 with HeaderClause

use of aQute.bnd.build.model.clauses.HeaderClause in project bndtools by bndtools.

the class PluginsPart method doEdit.

void doEdit() {
    HeaderClause header = (HeaderClause) ((IStructuredSelection) viewer.getSelection()).getFirstElement();
    if (header != null) {
        Attrs copyOfProperties = new Attrs(header.getAttribs());
        IConfigurationElement configElem = configElements.get(header.getName());
        PluginEditWizard wizard = new PluginEditWizard(configElem, copyOfProperties);
        WizardDialog dialog = new WizardDialog(getManagedForm().getForm().getShell(), wizard);
        if (dialog.open() == Window.OK && wizard.isChanged()) {
            header.getAttribs().clear();
            header.getAttribs().putAll(copyOfProperties);
            viewer.update(header, null);
            markDirty();
        }
    }
}
Also used : Attrs(aQute.bnd.header.Attrs) HeaderClause(aQute.bnd.build.model.clauses.HeaderClause) IConfigurationElement(org.eclipse.core.runtime.IConfigurationElement) WizardDialog(org.eclipse.jface.wizard.WizardDialog)

Example 4 with HeaderClause

use of aQute.bnd.build.model.clauses.HeaderClause in project bndtools by bndtools.

the class PluginsPart method doAdd.

void doAdd() {
    PluginSelectionWizard wizard = new PluginSelectionWizard();
    WizardDialog dialog = new WizardDialog(getManagedForm().getForm().getShell(), wizard);
    if (dialog.open() == Window.OK) {
        HeaderClause newPlugin = wizard.getHeader();
        data.add(newPlugin);
        viewer.add(newPlugin);
        markDirty();
    }
}
Also used : WizardDialog(org.eclipse.jface.wizard.WizardDialog) HeaderClause(aQute.bnd.build.model.clauses.HeaderClause)

Example 5 with HeaderClause

use of aQute.bnd.build.model.clauses.HeaderClause in project bndtools by bndtools.

the class BlueprintXmlFileWizard method updateBundleBlueprintIfNecessary.

private void updateBundleBlueprintIfNecessary(BndEditModel editModel, String blueprintrelativePath) {
    boolean alreadyMatched = false;
    List<HeaderClause> bundleBlueprint = editModel.getBundleBlueprint();
    if (bundleBlueprint != null) {
        for (HeaderClause hc : bundleBlueprint) {
            String clause = hc.getName();
            if (clause.length() == 0) {
                clause = OSGI_INF_BLUEPRINT_XML;
            } else if (clause.endsWith("/")) {
                clause += "*.xml";
            }
            // Match either absolute or Glob
            if ((!clause.contains("*") && clause.equals(blueprintrelativePath)) || (Glob.toPattern(clause).matcher(blueprintrelativePath).matches())) {
                alreadyMatched = true;
                break;
            }
        }
    }
    if (!alreadyMatched) {
        if ((Glob.toPattern(OSGI_INF_BLUEPRINT_XML).matcher(blueprintrelativePath).matches()))
            editModel.addBundleBlueprint(OSGI_INF_BLUEPRINT_XML);
        else
            editModel.addBundleBlueprint(blueprintrelativePath);
    }
}
Also used : HeaderClause(aQute.bnd.build.model.clauses.HeaderClause)

Aggregations

HeaderClause (aQute.bnd.build.model.clauses.HeaderClause)9 Attrs (aQute.bnd.header.Attrs)3 ArrayList (java.util.ArrayList)3 IConfigurationElement (org.eclipse.core.runtime.IConfigurationElement)2 WizardDialog (org.eclipse.jface.wizard.WizardDialog)2 Parameters (aQute.bnd.header.Parameters)1 URLDialog (bndtools.shared.URLDialog)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 URI (java.net.URI)1 URISyntaxException (java.net.URISyntaxException)1 Entry (java.util.Map.Entry)1 ImageDescriptor (org.eclipse.jface.resource.ImageDescriptor)1 StyledString (org.eclipse.jface.viewers.StyledString)1 Image (org.eclipse.swt.graphics.Image)1