Skip to content

Commit

Permalink
[bndtools] Create menu interface for LaunchToBndrun
Browse files Browse the repository at this point in the history
Signed-off-by: Fr Jeremy Krieg <[email protected]>
  • Loading branch information
kriegfrj committed Oct 26, 2023
1 parent 39f7d76 commit ab19e48
Show file tree
Hide file tree
Showing 8 changed files with 216 additions and 2 deletions.
10 changes: 8 additions & 2 deletions bndtools.core.services/bnd.bnd
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ Import-Package: \
# Bundle Content

-includepackage: \
org.bndtools.core.editors.quickfix
org.bndtools.core.editors.quickfix,\
org.bndtools.pde.launchtobndrun

-conditionalpackage: \
aQute.lib.*,\
Expand All @@ -36,4 +37,9 @@ Import-Package: \
org.eclipse.swt.cocoa.macosx.x86_64,\
org.eclipse.jface.text,\
org.osgi.service.component.annotations;version='1.3.0',\
slf4j.api
slf4j.api,\
org.eclipse.jface,\
org.eclipse.core.commands,\
org.eclipse.ui.ide,\
org.eclipse.ui.workbench,\
biz.aQute.bnd.pde
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
package org.bndtools.pde.launchtobndrun;

import java.util.Iterator;

import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.Path;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.ui.IObjectActionDelegate;
import org.eclipse.ui.IWorkbenchPart;
import org.osgi.service.component.annotations.Component;

import aQute.lib.io.IO;
import biz.aQute.bnd.pde.launch2bndrun.LaunchToBndrun;

@Component
public class LaunchToBndrunAction implements IObjectActionDelegate {

IFile[] selected;

@Override
public void run(IAction action) {
if (selected == null) {
return;
}
IFile s = selected[0];

try {
LaunchToBndrun lbr = new LaunchToBndrun(5, s.getContents());
String name = s.getName()
.replaceAll("\\.launch$", ".bndrun");

IFile f = s.getParent()
.getFile(new Path(name));
f.create(IO.stream(lbr.getDoc()
.get()), true, null);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

}

@Override
public void selectionChanged(IAction action, ISelection selection) {
if (selection == null || !(selection instanceof StructuredSelection)) {
selected = null;
return;
}
StructuredSelection ss = (StructuredSelection) selection;
selected = new IFile[ss.size()];
int n = 0;
for (@SuppressWarnings("unchecked")
Iterator<IFile> i = ss.iterator(); i.hasNext();) {
selected[n++] = i.next();
}
}

@Override
public void setActivePart(IAction action, IWorkbenchPart targetPart) {
// TODO Auto-generated method stub

}

}
16 changes: 16 additions & 0 deletions bndtools.core/_plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -882,6 +882,22 @@
</extension>

<extension point="org.eclipse.ui.popupMenus">
<objectContribution
adaptable="false"
id="bndtools.launchtobndrun"
nameFilter="*.launch"
objectClass="org.eclipse.core.resources.IFile">
<action
class="org.bndtools.facade.ExtensionFacade"
enablesFor="+"
id="org.bndtools.pde.launchtobndrun.LaunchToBndrunAction"
icon="icons/lorry.png"
label="Generate bndrun..."
menubarPath="additions"
tooltip="Generates a bndrun file corresponding to this launch file">
</action>
</objectContribution>

<objectContribution adaptable="true"
id="bndtools.nonBndProjectContribution"
objectClass="org.eclipse.core.resources.IProject">
Expand Down
1 change: 1 addition & 0 deletions bndtools.core/bndtools.cocoa.macosx.aarch64.bndrun
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
-runbundles: \
biz.aQute.bnd.embedded-repo;version=snapshot,\
biz.aQute.bnd.maven;version=snapshot,\
biz.aQute.bnd.pde;version=snapshot,\
biz.aQute.bnd.util;version=snapshot,\
biz.aQute.bndlib;version=snapshot,\
biz.aQute.repository;version=snapshot,\
Expand Down
1 change: 1 addition & 0 deletions bndtools.core/bndtools.cocoa.macosx.x86_64.bndrun
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
-runbundles: \
biz.aQute.bnd.embedded-repo;version=snapshot,\
biz.aQute.bnd.maven;version=snapshot,\
biz.aQute.bnd.pde;version=snapshot,\
biz.aQute.bnd.util;version=snapshot,\
biz.aQute.bndlib;version=snapshot,\
biz.aQute.repository;version=snapshot,\
Expand Down
1 change: 1 addition & 0 deletions bndtools.core/bndtools.gtk.linux.x86_64.bndrun
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
-runbundles: \
biz.aQute.bnd.embedded-repo;version=snapshot,\
biz.aQute.bnd.maven;version=snapshot,\
biz.aQute.bnd.pde;version=snapshot,\
biz.aQute.bnd.util;version=snapshot,\
biz.aQute.bndlib;version=snapshot,\
biz.aQute.repository;version=snapshot,\
Expand Down
122 changes: 122 additions & 0 deletions bndtools.core/bndtools.shared.latest.bndrun
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
# This run file contains all the cross-platform bundle and settings to run Bndtools.

# Do not run this, use the platform-specific bndrun files (which "-include" this)

-runfw: org.eclipse.osgi;version='[3.18.500.v20230801-1826,3.18.500.v20230801-1826]'

-runvm: \
-Xmx2g, \
-ea

-runpath: \
ch.qos.logback.classic,\
ch.qos.logback.core,\
org.apache.felix.logback,\
slf4j.api

-runproperties: \
eclipse.application=org.eclipse.ui.ide.workbench,\
eclipse.consoleLog=,\
eclipse.home.location=${fileuri;${.}/../bndtools.test/workspace},\
eclipse.launcher=bndtools.core,\
eclipse.product=org.eclipse.sdk.ide,\
osgi.console=,\
osgi.instance.area.default=../bndtools.test/workspace,\
org.osgi.framework.bootdelegation='javax.net,javax.management,javax.net.ssl',\
logback.configurationFile=${fileuri;${.}/logback.xml}

# Keep sorted so that we can diff
-runrequires: \
bnd.identity;id='biz.aQute.bnd.embedded-repo',\
bnd.identity;id='bndtools.api',\
bnd.identity;id='bndtools.builder',\
bnd.identity;id='bndtools.core',\
bnd.identity;id='bndtools.core.services',\
bnd.identity;id='bndtools.jareditor',\
bnd.identity;id='bndtools.m2e',\
bnd.identity;id='bndtools.m2e.debug.fragment',\
bnd.identity;id='bndtools.pde',\
bnd.identity;id='bndtools.release',\
bnd.identity;id='com.google.guava',\
bnd.identity;id='javax.annotation',\
bnd.identity;id='org.apache.ant',\
bnd.identity;id='org.apache.felix.gogo.command',\
bnd.identity;id='org.apache.felix.gogo.runtime',\
bnd.identity;id='org.apache.felix.gogo.shell',\
bnd.identity;id='org.bndtools.applaunch',\
bnd.identity;id='org.bndtools.headless.build.manager',\
bnd.identity;id='org.bndtools.headless.build.plugin.ant',\
bnd.identity;id='org.bndtools.headless.build.plugin.gradle',\
bnd.identity;id='org.bndtools.launch',\
bnd.identity;id='org.bndtools.remoteinstall',\
bnd.identity;id='org.bndtools.templates.template',\
bnd.identity;id='org.bndtools.templating',\
bnd.identity;id='org.bndtools.templating.gitrepo',\
bnd.identity;id='org.bndtools.versioncontrol.ignores.manager',\
bnd.identity;id='org.bndtools.versioncontrol.ignores.plugin.git',\
bnd.identity;id='org.eclipse.ant.core',\
bnd.identity;id='org.eclipse.ant.ui',\
bnd.identity;id='org.eclipse.emf.ant',\
bnd.identity;id='org.eclipse.emf.codegen.ecore.ui',\
bnd.identity;id='org.eclipse.emf.codegen.ui',\
bnd.identity;id='org.eclipse.emf.common.ui',\
bnd.identity;id='org.eclipse.emf.databinding',\
bnd.identity;id='org.eclipse.emf.databinding.edit',\
bnd.identity;id='org.eclipse.emf.edit.ui',\
bnd.identity;id='org.eclipse.emf.exporter',\
bnd.identity;id='org.eclipse.emf.importer',\
bnd.identity;id='org.eclipse.emf.importer.ecore',\
bnd.identity;id='org.eclipse.emf.importer.java',\
bnd.identity;id='org.eclipse.core.databinding.beans',\
bnd.identity;id='org.eclipse.core.filesystem',\
bnd.identity;id='org.eclipse.e4.tools.services',\
bnd.identity;id='org.eclipse.egit.ui',\
bnd.identity;id='org.eclipse.equinox.console',\
bnd.identity;id='org.eclipse.equinox.event',\
bnd.identity;id='org.eclipse.jdt.annotation',\
bnd.identity;id='org.eclipse.m2e.binaryproject.ui',\
bnd.identity;id='org.eclipse.m2e.discovery',\
bnd.identity;id='org.eclipse.m2e.editor',\
bnd.identity;id='org.eclipse.m2e.jdt.ui',\
bnd.identity;id='org.eclipse.m2e.profiles.core',\
bnd.identity;id='org.eclipse.m2e.profiles.ui',\
bnd.identity;id='org.eclipse.m2e.refactoring',\
bnd.identity;id='org.eclipse.m2e.scm',\
bnd.identity;id='org.eclipse.m2e.sourcelookup.ui',\
bnd.identity;id='org.eclipse.osgi.compatibility.state',\
bnd.identity;id='org.eclipse.pde.build',\
bnd.identity;id='org.eclipse.pde.core',\
bnd.identity;id='org.eclipse.pde.genericeditor.extension',\
bnd.identity;id='org.eclipse.pde.launching',\
bnd.identity;id='org.eclipse.pde.runtime',\
bnd.identity;id='org.eclipse.pde.ua.core',\
bnd.identity;id='org.eclipse.pde.ua.ui',\
bnd.identity;id='org.eclipse.pde.ui',\
bnd.identity;id='org.eclipse.sdk',\
bnd.identity;id='org.eclipse.ui.browser',\
bnd.identity;id='org.eclipse.ui.console',\
bnd.identity;id='org.eclipse.ui.ide',\
bnd.identity;id='org.eclipse.ui.ide.application',\
bnd.identity;id='junit-platform-commons';version='${range;[===,==+);${junit.platform.eclipse.version}}',\
bnd.identity;id='junit-platform-engine';version='${range;[===,==+);${junit.platform.eclipse.version}}',\
bnd.identity;id='junit-platform-launcher';version='${range;[===,==+);${junit.platform.eclipse.version}}'

-runblacklist: \
bnd.identity;id='biz.aQute.bnd.annotation',\
bnd.identity;id='biz.aQute.bnd.transform',\
bnd.identity;id='biz.aQute.junit',\
bnd.identity;id='org.apache.felix.scr';version='[0,2.1.16)',\
bnd.identity;id='osgi.*',\
bnd.identity;id='org.osgi.*.annotations'

-runrepos: \
"Workspace",\
"Maven Central",\
"Eclipse 4.29 (2023-09)"

-runee: JavaSE-17

# This will help us keep -runbundles sorted
-runstartlevel: \
order=sortbynameversion,\
begin=-1
1 change: 1 addition & 0 deletions bndtools.core/bndtools.win32.x86_64.bndrun
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
-runbundles: \
biz.aQute.bnd.embedded-repo;version=snapshot,\
biz.aQute.bnd.maven;version=snapshot,\
biz.aQute.bnd.pde;version=snapshot,\
biz.aQute.bnd.util;version=snapshot,\
biz.aQute.bndlib;version=snapshot,\
biz.aQute.repository;version=snapshot,\
Expand Down

0 comments on commit ab19e48

Please sign in to comment.