Search in sources :

Example 6 with BndPreferences

use of bndtools.preferences.BndPreferences in project bndtools by bndtools.

the class BndPreferencePage method performOk.

@Override
public boolean performOk() {
    BndPreferences prefs = new BndPreferences();
    prefs.setHideInitCnfWizard(noCheckCnf);
    prefs.setWarnExistingLaunch(warnExistingLaunch);
    prefs.setBuildBeforeLaunch(buildBeforeLaunch);
    prefs.setEditorOpenSourceTab(editorOpenSourceTab);
    prefs.setWorkspaceOffline(workspaceIsOffline);
    return true;
}
Also used : BndPreferences(bndtools.preferences.BndPreferences)

Example 7 with BndPreferences

use of bndtools.preferences.BndPreferences in project bndtools by bndtools.

the class ReposPreferencePage method init.

@Override
public void init(IWorkbench workbench) {
    BndPreferences prefs = new BndPreferences();
    enableTemplateRepo = prefs.getEnableTemplateRepo();
    templateRepos = new ArrayList<>(prefs.getTemplateRepoUriList());
}
Also used : BndPreferences(bndtools.preferences.BndPreferences)

Example 8 with BndPreferences

use of bndtools.preferences.BndPreferences in project bndtools by bndtools.

the class ReposPreferencePage method performOk.

@Override
public boolean performOk() {
    BndPreferences prefs = new BndPreferences();
    prefs.setEnableTemplateRepo(enableTemplateRepo);
    prefs.setTemplateRepoUriList(templateRepos);
    return true;
}
Also used : BndPreferences(bndtools.preferences.BndPreferences)

Example 9 with BndPreferences

use of bndtools.preferences.BndPreferences in project bndtools by bndtools.

the class AbstractNewBndProjectWizard method processGeneratedProject.

/**
     * Modify the newly generated Java project; this method is executed from within a workspace operation so is free to
     * make workspace resource modifications.
     *
     * @throws CoreException
     */
protected void processGeneratedProject(ProjectPaths projectPaths, BndEditModel bndModel, IJavaProject project, IProgressMonitor monitor) throws CoreException {
    SubMonitor progress = SubMonitor.convert(monitor, 3);
    Document document = new Document("");
    bndModel.saveChangesTo(document);
    progress.worked(1);
    ByteArrayInputStream bndInput;
    try {
        bndInput = new ByteArrayInputStream(document.get().getBytes("UTF-8"));
    } catch (UnsupportedEncodingException e) {
        return;
    }
    IFile bndBndFile = project.getProject().getFile(Project.BNDFILE);
    if (bndBndFile.exists()) {
        bndBndFile.setContents(bndInput, false, false, progress.newChild(1));
    }
    BndProject proj = generateBndProject(project.getProject(), progress.newChild(1));
    progress.setWorkRemaining(proj.getResources().size());
    for (Map.Entry<String, BndProjectResource> resource : proj.getResources().entrySet()) {
        importResource(project.getProject(), resource.getKey(), resource.getValue(), progress.newChild(1));
    }
    if (!bndBndFile.exists()) {
        bndBndFile.create(bndInput, false, progress.newChild(1));
    }
    /* Version control ignores */
    VersionControlIgnoresManager versionControlIgnoresManager = Plugin.getDefault().getVersionControlIgnoresManager();
    Set<String> enabledIgnorePlugins = new BndPreferences().getVersionControlIgnoresPluginsEnabled(versionControlIgnoresManager, project, null);
    Map<String, String> sourceOutputLocations = JavaProjectUtils.getSourceOutputLocations(project);
    versionControlIgnoresManager.createProjectIgnores(enabledIgnorePlugins, project.getProject().getLocation().toFile(), sourceOutputLocations, projectPaths.getTargetDir());
    /* Headless build files */
    HeadlessBuildManager headlessBuildManager = Plugin.getDefault().getHeadlessBuildManager();
    Set<String> enabledPlugins = new BndPreferences().getHeadlessBuildPluginsEnabled(headlessBuildManager, null);
    headlessBuildManager.setup(enabledPlugins, false, project.getProject().getLocation().toFile(), true, enabledIgnorePlugins, new LinkedList<String>());
    /* refresh the project; files were created outside of Eclipse API */
    project.getProject().refreshLocal(IResource.DEPTH_INFINITE, progress);
    project.getProject().build(IncrementalProjectBuilder.CLEAN_BUILD, progress);
}
Also used : IFile(org.eclipse.core.resources.IFile) BndPreferences(bndtools.preferences.BndPreferences) VersionControlIgnoresManager(org.bndtools.versioncontrol.ignores.manager.api.VersionControlIgnoresManager) HeadlessBuildManager(org.bndtools.headless.build.manager.api.HeadlessBuildManager) SubMonitor(org.eclipse.core.runtime.SubMonitor) UnsupportedEncodingException(java.io.UnsupportedEncodingException) Document(aQute.bnd.properties.Document) BndProject(bndtools.editor.model.BndProject) ByteArrayInputStream(java.io.ByteArrayInputStream) Map(java.util.Map) BndProjectResource(org.bndtools.api.BndProjectResource)

Example 10 with BndPreferences

use of bndtools.preferences.BndPreferences in project bndtools by bndtools.

the class GeneratedResourcesPreferencePage method performOk.

@Override
public boolean performOk() {
    BndPreferences prefs = new BndPreferences();
    prefs.setEnableSubBundles(enableSubs);
    prefs.setNoAskPackageInfo(noAskPackageInfo);
    prefs.setHeadlessBuildCreate(headlessBuildCreate);
    Collection<NamedPlugin> pluginsInformation = headlessBuildManager.getAllPluginsInformation();
    if (pluginsInformation.size() > 0) {
        prefs.setHeadlessBuildPlugins(headlessBuildPlugins);
    }
    prefs.setVersionControlIgnoresCreate(versionControlIgnoresCreate);
    pluginsInformation = versionControlIgnoresManager.getAllPluginsInformation();
    if (pluginsInformation.size() > 0) {
        prefs.setVersionControlIgnoresPlugins(versionControlIgnoresPlugins);
    }
    return true;
}
Also used : BndPreferences(bndtools.preferences.BndPreferences) NamedPlugin(org.bndtools.api.NamedPlugin)

Aggregations

BndPreferences (bndtools.preferences.BndPreferences)18 CoreException (org.eclipse.core.runtime.CoreException)6 IStatus (org.eclipse.core.runtime.IStatus)6 Status (org.eclipse.core.runtime.Status)6 MultiStatus (org.eclipse.core.runtime.MultiStatus)4 IResource (org.eclipse.core.resources.IResource)3 Attrs (aQute.bnd.header.Attrs)2 File (java.io.File)2 UnsupportedEncodingException (java.io.UnsupportedEncodingException)2 URISyntaxException (java.net.URISyntaxException)2 ArrayList (java.util.ArrayList)2 LinkedList (java.util.LinkedList)2 TimeoutException (java.util.concurrent.TimeoutException)2 NamedPlugin (org.bndtools.api.NamedPlugin)2 HeadlessBuildManager (org.bndtools.headless.build.manager.api.HeadlessBuildManager)2 VersionControlIgnoresManager (org.bndtools.versioncontrol.ignores.manager.api.VersionControlIgnoresManager)2 IFile (org.eclipse.core.resources.IFile)2 IProject (org.eclipse.core.resources.IProject)2 ILaunch (org.eclipse.debug.core.ILaunch)2 ILaunchConfiguration (org.eclipse.debug.core.ILaunchConfiguration)2