Package aQute.bnd.build.model

Examples of aQute.bnd.build.model.BndEditModel


     */
    @SuppressWarnings({
            "static-method", "unused"
    })
    protected BndEditModel generateBndModel(IProgressMonitor monitor) {
        return new BndEditModel();
    }
View Full Code Here


                    public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
                        try {
                            SubMonitor progress = SubMonitor.convert(monitor, 3);

                            // Generate the Bnd model
                            final BndEditModel bndModel = generateBndModel(progress.newChild(1));

                            // Make changes to the project
                            final IWorkspaceRunnable op = new IWorkspaceRunnable() {
                                @Override
                                public void run(IProgressMonitor monitor) throws CoreException {
View Full Code Here

     * @param monitor
     */
    @Override
    protected BndEditModel generateBndModel(IProgressMonitor monitor) {
        ProjectPaths bndPaths = ProjectPaths.get(ProjectLayout.BND);
        BndEditModel model = super.generateBndModel(monitor);

        ProjectPaths projectPaths = ProjectPaths.get(pageOne.getProjectLayout());

        IProjectTemplate template = templatePage.getTemplate();
        if (template != null) {
            String name = pageTwo.getJavaProject().getProject().getName();
            model.setBundleVersion(DEFAULT_BUNDLE_VERSION);
            template.modifyInitialBndModel(model, name, projectPaths);
        }
        try {
            Map<String,String> sourceOutputLocations = JavaProjectUtils.getSourceOutputLocations(pageTwo.getJavaProject());
            if (sourceOutputLocations != null) {
                int nr = 1;
                for (Map.Entry<String,String> entry : sourceOutputLocations.entrySet()) {
                    String src = entry.getKey();
                    String bin = entry.getValue();

                    if (nr == 1) {
                        if (!bndPaths.getSrc().equals(src)) {
                            model.genericSet(Constants.DEFAULT_PROP_SRC_DIR, src);
                        }
                        if (!bndPaths.getBin().equals(bin)) {
                            model.genericSet(Constants.DEFAULT_PROP_BIN_DIR, bin);
                        }
                        nr = 2;
                    } else if (nr == 2) {
                        if (!bndPaths.getTestSrc().equals(src)) {
                            model.genericSet(Constants.DEFAULT_PROP_TESTSRC_DIR, src);
                        }
                        if (!bndPaths.getTestBin().equals(bin)) {
                            model.genericSet(Constants.DEFAULT_PROP_TESTBIN_DIR, bin);
                        }
                        nr = 2;
                    } else {
                        // if for some crazy reason we end up with more than 2 paths, we log them in
                        // extension properties (we cannot write comments) but this should never happen
                        // anyway since the second page will not complete if there are not exactly 2 paths
                        // so this could only happen if someone adds another page (that changes them again)
                        model.genericSet("X-WARN-" + nr, "Ignoring source path " + src + " -> " + bin);
                        nr++;
                    }
                }
            }

            String projectTargetDir = projectPaths.getTargetDir();
            if (!bndPaths.getTargetDir().equals(projectTargetDir)) {
                model.genericSet(Constants.DEFAULT_PROP_TARGET_DIR, projectTargetDir);
            }

            if (ProjectLayout.MAVEN == projectPaths.getLayout()) {
                model.setBundleVersion("1.0.0.SNAPSHOT");
                model.genericSet(Constants.OUTPUTMASK, "${@bsn}-${version;===S;${@version}}.jar");
            }
        } catch (Exception e) {
            ErrorDialog.openError(getShell(), "Error", "", new Status(IStatus.ERROR, Plugin.PLUGIN_ID, 0, MessageFormat.format("Error setting paths in Bnd project descriptor file ({0}).", Project.BNDFILE), e));
        }

View Full Code Here

                document = new Document(new String(bytes, resource.getCharset()));
            } else {
                document = new Document(""); //$NON-NLS-1$
            }

            final BndEditModel model = new BndEditModel();
            model.loadFrom(document);

            String currentVersion = model.getBundleVersionString();
            String templateVersion = updateTemplateVersion(currentVersion, bundleVersion);
            model.setBundleVersion(templateVersion);
            properties.setProperty(Constants.BUNDLE_VERSION, templateVersion);

            final Document finalDoc = document;
            Runnable run = new Runnable() {
                public void run() {
                    model.saveChangesTo(finalDoc);

                    try {
                        writeFully(finalDoc.get(), resource, false);
                        resource.refreshLocal(IResource.DEPTH_ZERO, null);
                    } catch (CoreException e) {
View Full Code Here

        document = new Document(new String(bytes, resource.getCharset()));
      } else {
        document = new Document(""); //$NON-NLS-1$
      }

      final BndEditModel model = new BndEditModel();
      model.loadFrom(document);

      String currentVersion = model.getBundleVersionString();
      String templateVersion = updateTemplateVersion(currentVersion, bundleVersion);
      model.setBundleVersion(templateVersion);
      properties.setProperty(Constants.BUNDLE_VERSION, templateVersion);

      final Document finalDoc = document;
      Runnable run = new Runnable() {
        public void run() {
          model.saveChangesTo(finalDoc);

          try {
            writeFully(finalDoc.get(), resource, false);
            resource.refreshLocal(IResource.DEPTH_ZERO, null);
          } catch (CoreException e) {
View Full Code Here

TOP

Related Classes of aQute.bnd.build.model.BndEditModel

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.