Search in sources :

Example 16 with BndPreferences

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

the class BndEditor method showHighestPriorityPage.

void showHighestPriorityPage() {
    int selectedPrio = Integer.MIN_VALUE;
    String selected = null;
    BndPreferences prefs = new BndPreferences();
    if (prefs.getEditorOpenSourceTab()) {
        selected = SOURCE_PAGE;
        selectedPrio = 0;
    } else {
        for (Object pageObj : pages) {
            IFormPage page = (IFormPage) pageObj;
            int priority = 0;
            if (page instanceof IPriority)
                priority = ((IPriority) page).getPriority();
            if (priority > selectedPrio) {
                selected = page.getId();
                selectedPrio = priority;
            }
        }
    }
    if (selected != null)
        setActivePage(selected);
}
Also used : BndPreferences(bndtools.preferences.BndPreferences) IFormPage(org.eclipse.ui.forms.editor.IFormPage) IPriority(bndtools.editor.common.IPriority)

Example 17 with BndPreferences

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

the class ExportPatternsListPart method doAddClauses.

@Override
protected void doAddClauses(Collection<? extends ExportedPackage> pkgs, int index, boolean select) {
    List<FileVersionTuple> missingPkgInfoDirs;
    try {
        missingPkgInfoDirs = new ArrayList<FileVersionTuple>(findSourcePackagesWithoutPackageInfo(pkgs));
    } catch (Exception e) {
        ErrorDialog.openError(getManagedForm().getForm().getShell(), "Error", null, new Status(IStatus.ERROR, Plugin.PLUGIN_ID, 0, "Error finding source package for exported 1packages.", e));
        missingPkgInfoDirs = Collections.emptyList();
    }
    List<FileVersionTuple> generatePkgInfoDirs = new ArrayList<FileVersionTuple>(missingPkgInfoDirs.size());
    BndPreferences prefs = new BndPreferences();
    boolean noAskPackageInfo = prefs.getNoAskPackageInfo();
    if (noAskPackageInfo || missingPkgInfoDirs.isEmpty()) {
        generatePkgInfoDirs.addAll(missingPkgInfoDirs);
    } else {
        PackageInfoDialog dlg = new PackageInfoDialog(getSection().getShell(), missingPkgInfoDirs);
        if (dlg.open() == Window.CANCEL)
            return;
        prefs.setNoAskPackageInfo(dlg.isDontAsk());
        generatePkgInfoDirs.addAll(dlg.getSelectedPackageDirs());
    }
    try {
        generatePackageInfos(generatePkgInfoDirs);
    } catch (CoreException e) {
        ErrorDialog.openError(getManagedForm().getForm().getShell(), "Error", null, new Status(IStatus.ERROR, Plugin.PLUGIN_ID, 0, "Error generated packageinfo files.", e));
    }
    // Actually add the new exports
    super.doAddClauses(pkgs, index, select);
}
Also used : MultiStatus(org.eclipse.core.runtime.MultiStatus) IStatus(org.eclipse.core.runtime.IStatus) Status(org.eclipse.core.runtime.Status) BndPreferences(bndtools.preferences.BndPreferences) FileVersionTuple(bndtools.editor.contents.PackageInfoDialog.FileVersionTuple) CoreException(org.eclipse.core.runtime.CoreException) ArrayList(java.util.ArrayList) PackageInfoDialog(bndtools.editor.contents.PackageInfoDialog) CoreException(org.eclipse.core.runtime.CoreException) InvocationTargetException(java.lang.reflect.InvocationTargetException) UnsupportedEncodingException(java.io.UnsupportedEncodingException)

Example 18 with BndPreferences

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

the class ReposTemplateLoader method addPreferenceConfiguredRepos.

private static void addPreferenceConfiguredRepos(List<Repository> repos, Reporter reporter) {
    BndPreferences bndPrefs = null;
    try {
        bndPrefs = new BndPreferences();
    } catch (Exception e) {
    // e.printStackTrace();
    }
    if (bndPrefs != null && bndPrefs.getEnableTemplateRepo()) {
        List<String> repoUris = bndPrefs.getTemplateRepoUriList();
        try {
            FixedIndexedRepo prefsRepo = loadRepo(repoUris);
            repos.add(prefsRepo);
        } catch (IOException | URISyntaxException ex) {
            reporter.exception(ex, "Error loading preference repository: %s", repoUris);
        }
    }
}
Also used : BndPreferences(bndtools.preferences.BndPreferences) IOException(java.io.IOException) URISyntaxException(java.net.URISyntaxException) FixedIndexedRepo(aQute.bnd.deployer.repository.FixedIndexedRepo) URISyntaxException(java.net.URISyntaxException) IOException(java.io.IOException)

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