Package org.bndtools.api

Examples of org.bndtools.api.ProjectPaths


    @Override
    public IClasspathEntry[] getSourceClasspathEntries() {
        IPath projectPath = new Path(getProjectName()).makeAbsolute();

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

        List<IClasspathEntry> newEntries = new ArrayList<IClasspathEntry>(2);
        newEntries.add(JavaCore.newSourceEntry(projectPath.append(projectPaths.getSrc()), null, projectPath.append(projectPaths.getBin())));

        if (projectTemplate == null || projectTemplate.enableTestSourceFolder())
            newEntries.add(JavaCore.newSourceEntry(projectPath.append(projectPaths.getTestSrc()), null, projectPath.append(projectPaths.getTestBin())));

        return newEntries.toArray(new IClasspathEntry[newEntries.size()]);
    }
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);
            }
        } 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

     */
    @Override
    protected BndProject generateBndProject(IProject project, IProgressMonitor monitor) {
        BndProject proj = super.generateBndProject(project, monitor);

        ProjectPaths projectPaths = ProjectPaths.get(pageOne.getProjectLayout());
        IProjectTemplate template = templatePage.getTemplate();
        if (template != null) {
            String name = pageTwo.getJavaProject().getProject().getName();
            template.modifyInitialBndProject(proj, name, projectPaths);
        }
View Full Code Here

        try {
            IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(builder.getBase().getName());
            IJavaProject javaProject = JavaCore.create(project);
            Map<String,String> sourceOutputLocations = JavaProjectUtils.getSourceOutputLocations(javaProject);

            ProjectPaths bndLayout = ProjectPaths.get(ProjectLayout.BND);
            String src = builder.getProperty(Constants.DEFAULT_PROP_SRC_DIR, bndLayout.getSrc());
            String bin = builder.getProperty(Constants.DEFAULT_PROP_BIN_DIR, bndLayout.getBin());
            String testSrc = builder.getProperty(Constants.DEFAULT_PROP_TESTSRC_DIR, bndLayout.getTestSrc());
            String testBin = builder.getProperty(Constants.DEFAULT_PROP_TESTBIN_DIR, bndLayout.getTestBin());

            List<IStatus> reports = new LinkedList<IStatus>();

            int index = 0;
            for (Map.Entry<String,String> entry : sourceOutputLocations.entrySet()) {
View Full Code Here

    @Override
    public IClasspathEntry[] getSourceClasspathEntries() {
        IPath projectPath = new Path(getProjectName()).makeAbsolute();

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

        List<IClasspathEntry> newEntries = new ArrayList<IClasspathEntry>(2);
        newEntries.add(JavaCore.newSourceEntry(projectPath.append(projectPaths.getSrc()), null, projectPath.append(projectPaths.getBin())));

        if (projectTemplate == null || projectTemplate.enableTestSourceFolder())
            newEntries.add(JavaCore.newSourceEntry(projectPath.append(projectPaths.getTestSrc()), null, projectPath.append(projectPaths.getTestBin())));

        return newEntries.toArray(new IClasspathEntry[newEntries.size()]);
    }
View Full Code Here

                }
            }
        };

        for (ProjectLayout projectLayout : ProjectLayout.values()) {
            ProjectPaths projectPaths = ProjectPaths.get(projectLayout);
            final Button radioButton = new Button(group, SWT.RADIO);
            radioButton.setText(projectPaths.getTitle());
            radioButton.setData(projectLayout);
            radioButton.setSelection(this.chosenProjectLayout == projectLayout);
            radioButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
            radioButton.setToolTipText(projectPaths.getToolTip());
            radioButton.addSelectionListener(radioListener);

            layoutChoices.add(radioButton);
        }
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

     */
    @Override
    protected BndProject generateBndProject(IProject project, IProgressMonitor monitor) {
        BndProject proj = super.generateBndProject(project, monitor);

        ProjectPaths projectPaths = ProjectPaths.get(pageOne.getProjectLayout());
        IProjectTemplate template = templatePage.getTemplate();
        if (template != null) {
            String name = pageTwo.getJavaProject().getProject().getName();
            template.modifyInitialBndProject(proj, name, projectPaths);
        }
View Full Code Here

TOP

Related Classes of org.bndtools.api.ProjectPaths

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.