Plugin for displaying plugins.
https://sourceforge.net/tracker/?func=detail&aid=2700937&group_id=176962&atid=879334
This commit is contained in:
parent
e92f647b61
commit
3fa24305c7
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>pluginList</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.ManifestBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.pde.PluginNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
|
@ -0,0 +1,8 @@
|
|||
#Mon Mar 15 20:45:28 CET 2010
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
||||
org.eclipse.jdt.core.compiler.compliance=1.6
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.6
|
|
@ -0,0 +1,4 @@
|
|||
#Wed Mar 17 17:21:50 CET 2010
|
||||
eclipse.preferences.version=1
|
||||
pluginProject.extensions=true
|
||||
resolve.requirebundle=false
|
|
@ -0,0 +1,13 @@
|
|||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: PluginList
|
||||
Bundle-SymbolicName: org.adempiere.plugin.list;singleton:=true
|
||||
Bundle-Version: 0.0.0.2
|
||||
Bundle-Activator: org.adempiere.plugin.list.Activator
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Eclipse-LazyStart: true
|
||||
Import-Package: org.osgi.framework;version="1.3.0"
|
||||
Require-Bundle: org.adempiere.pluginUtils;bundle-version="0.0.0",
|
||||
org.adempiere.base;bundle-version="0.0.0",
|
||||
org.adempiere.client;bundle-version="0.0.0"
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<adempiereAD
|
||||
Name="PluginList" Version="0.0.0.1" CompVer="all" DataBase="1"
|
||||
Description="List of Plugins"
|
||||
creator="-" creatorcontact="-" createddate="2009-03-25 15:52:18" updateddate="2009-03-25 15:52:18" PackOutVer="005">
|
||||
<menu
|
||||
ADMenuNameID="Plugin List" ADWindowNameID="" ADProcessNameID="" ADFormNameID="Plugin List" ADTaskNameID="" ADWorkbenchNameID="" ADWorkflowNameID=""
|
||||
ADParentMenuNameID="System Rules" ADParentSeqno="0" Action="X" Description="Plugin List" EntityType="U" isActive="true" isReadOnly="false" isSOTrx="false" isSummary="false">
|
||||
<form
|
||||
ADFormNameID="Plugin List" Classname="osgi://org.adempiere.plugin.list.PluginList"
|
||||
isBetaFunctionality="false" AccessLevel="6" Description="" isActive="true" EntityType="U" Help="" Name="Plugin List"/>
|
||||
</menu>
|
||||
</adempiereAD>
|
|
@ -0,0 +1,5 @@
|
|||
source.. = src/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.,\
|
||||
plugin.xml
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?eclipse version="3.4"?>
|
||||
<plugin>
|
||||
<extension
|
||||
point="org.compiere.apps.form.FormPanel">
|
||||
<client
|
||||
class="org.adempiere.plugin.list.PluginList">
|
||||
</client>
|
||||
</extension>
|
||||
|
||||
</plugin>
|
|
@ -0,0 +1,19 @@
|
|||
package org.adempiere.plugin.list;
|
||||
|
||||
import org.adempiere.plugin.utils.AdempiereActivator;
|
||||
import org.osgi.framework.BundleActivator;
|
||||
import org.osgi.framework.BundleContext;
|
||||
|
||||
public class Activator extends AdempiereActivator implements BundleActivator {
|
||||
|
||||
static private BundleContext ctx;
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
ctx = getContext();
|
||||
}
|
||||
|
||||
public static BundleContext getPluginContext() {
|
||||
return ctx;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,142 @@
|
|||
package org.adempiere.plugin.list;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Component;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.Vector;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.table.DefaultTableModel;
|
||||
|
||||
import org.compiere.apps.form.FormFrame;
|
||||
import org.compiere.apps.form.FormPanel;
|
||||
import org.compiere.apps.form.VFileImport;
|
||||
import org.compiere.minigrid.MiniTable;
|
||||
import org.compiere.swing.CPanel;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.osgi.framework.Bundle;
|
||||
import org.osgi.framework.BundleContext;
|
||||
import org.osgi.framework.BundleException;
|
||||
|
||||
public class PluginList implements FormPanel, ActionListener {
|
||||
|
||||
private static CLogger log = CLogger.getCLogger(PluginList.class);
|
||||
private int m_WindowNo;
|
||||
private FormFrame m_frame;
|
||||
private CPanel northPanel = new CPanel();
|
||||
private CPanel centerPanel = new CPanel();
|
||||
private CPanel confirmPanel = new CPanel();
|
||||
private MiniTable pluginTable = new MiniTable();
|
||||
private JScrollPane centerScrollPane = new JScrollPane();
|
||||
private JButton refreshButton = new JButton();
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
if (m_frame != null)
|
||||
m_frame.dispose();
|
||||
m_frame = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(int WindowNo, FormFrame frame) {
|
||||
log.info("");
|
||||
m_WindowNo = WindowNo;
|
||||
m_frame = frame;
|
||||
try
|
||||
{
|
||||
jbInit();
|
||||
frame.getContentPane().add(northPanel, BorderLayout.NORTH);
|
||||
frame.getContentPane().add(centerPanel, BorderLayout.CENTER);
|
||||
frame.getContentPane().add(confirmPanel, BorderLayout.SOUTH);
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
log.log(Level.SEVERE, "init", e);
|
||||
}
|
||||
}
|
||||
|
||||
private void jbInit() {
|
||||
centerPanel.add(centerScrollPane, BorderLayout.CENTER);
|
||||
centerScrollPane.getViewport().add(pluginTable, null);
|
||||
updatePlugins();
|
||||
|
||||
refreshButton.setText("Refresh");
|
||||
refreshButton.addActionListener(this);
|
||||
confirmPanel.add(refreshButton);
|
||||
}
|
||||
|
||||
private void updatePlugins() {
|
||||
DefaultTableModel dataModel = new DefaultTableModel(getData(), getColumnNames());
|
||||
pluginTable.setModel(dataModel);
|
||||
pluginTable.autoSize();
|
||||
}
|
||||
|
||||
private Vector<Vector<Object>> getData() {
|
||||
BundleContext ctx = getContext();
|
||||
Vector<Vector<Object>> result = new Vector<Vector<Object>>();
|
||||
for (Bundle bundle : ctx.getBundles()) {
|
||||
Vector<Object> col = new Vector<Object>();
|
||||
col.add(bundle.getBundleId());
|
||||
col.add(state(bundle.getState()));
|
||||
col.add(bundle.getSymbolicName());
|
||||
col.add(bundle.getVersion());
|
||||
result.add(col);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private BundleContext getContext() {
|
||||
return Activator.getPluginContext();
|
||||
}
|
||||
|
||||
private String state(int state) {
|
||||
switch (state) {
|
||||
case Bundle.ACTIVE:
|
||||
return "ACTIVE";
|
||||
case Bundle.INSTALLED:
|
||||
return "INSTALLED";
|
||||
case Bundle.RESOLVED:
|
||||
return "RESOLVED";
|
||||
case Bundle.STARTING:
|
||||
return "STARTING";
|
||||
case Bundle.STOPPING:
|
||||
return "STOPPING";
|
||||
case Bundle.UNINSTALLED:
|
||||
return "UNINSTALLED";
|
||||
default:
|
||||
return "UNKNOWN";
|
||||
}
|
||||
}
|
||||
|
||||
private Vector<String> getColumnNames() {
|
||||
Vector<String> result = new Vector<String>();
|
||||
result.add("Id");
|
||||
result.add("State");
|
||||
result.add("Name");
|
||||
result.add("Version");
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (e.getSource().equals(refreshButton))
|
||||
refreshClicked(e);
|
||||
}
|
||||
|
||||
private void refreshClicked(ActionEvent e) {
|
||||
int row = pluginTable.getSelectedRow();
|
||||
if (row==-1)
|
||||
return;
|
||||
long id = (Long) pluginTable.getValueAt(row, 0);
|
||||
Bundle bundle = getContext().getBundle(id);
|
||||
try {
|
||||
bundle.update();
|
||||
} catch (BundleException ex) {
|
||||
log.log(Level.SEVERE, "refresh", ex);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue