IDEMPIERE-3545 Add plugin information in About window / fix index out of bounds issue - and avoid starting a fragment
This commit is contained in:
parent
71138cdef9
commit
174ff192a4
|
@ -48,6 +48,7 @@ Import-Package: groovy.transform.stc;version="2.4.7",
|
||||||
org.jfree.data.time,
|
org.jfree.data.time,
|
||||||
org.jfree.util,
|
org.jfree.util,
|
||||||
org.osgi.framework;version="1.7.0",
|
org.osgi.framework;version="1.7.0",
|
||||||
|
org.osgi.framework.wiring;version="1.2.0",
|
||||||
org.osgi.service.component.annotations;version="1.3.0",
|
org.osgi.service.component.annotations;version="1.3.0",
|
||||||
org.osgi.service.event;version="1.3.0",
|
org.osgi.service.event;version="1.3.0",
|
||||||
org.osgi.util.tracker;version="1.5.0",
|
org.osgi.util.tracker;version="1.5.0",
|
||||||
|
|
|
@ -65,6 +65,7 @@ import org.compiere.util.Util;
|
||||||
import org.osgi.framework.Bundle;
|
import org.osgi.framework.Bundle;
|
||||||
import org.osgi.framework.BundleContext;
|
import org.osgi.framework.BundleContext;
|
||||||
import org.osgi.framework.BundleException;
|
import org.osgi.framework.BundleException;
|
||||||
|
import org.osgi.framework.wiring.BundleRevision;
|
||||||
import org.zkoss.util.media.AMedia;
|
import org.zkoss.util.media.AMedia;
|
||||||
import org.zkoss.zhtml.Pre;
|
import org.zkoss.zhtml.Pre;
|
||||||
import org.zkoss.zhtml.Text;
|
import org.zkoss.zhtml.Text;
|
||||||
|
@ -445,16 +446,37 @@ public class AboutWindow extends Window implements EventListener<Event> {
|
||||||
if (bundle == null)
|
if (bundle == null)
|
||||||
return;
|
return;
|
||||||
int state = bundle.getState();
|
int state = bundle.getState();
|
||||||
|
boolean isFragment = false;
|
||||||
|
BundleRevision rev = bundle.adapt(BundleRevision.class);
|
||||||
|
if (rev != null) {
|
||||||
|
isFragment = (rev.getTypes() & BundleRevision.TYPE_FRAGMENT) != 0;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
boolean hasFragments = false;
|
||||||
|
if (!isFragment) {
|
||||||
|
if (rev.getWiring() != null) {
|
||||||
|
if (rev.getWiring().getProvidedWires(BundleRevision.HOST_NAMESPACE).size() > 0) {
|
||||||
|
hasFragments = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
if (bundle.getBundleId() == 0) {
|
if (bundle.getBundleId() == 0) {
|
||||||
// bundle 0 cannot be stopped
|
// bundle 0 cannot be stopped
|
||||||
} else if (state == Bundle.ACTIVE) {
|
} else if (state == Bundle.ACTIVE) {
|
||||||
pluginActions.getItemAtIndex(PLUGIN_ACTION_STOP).setVisible(true);
|
pluginActions.getItemAtIndex(PLUGIN_ACTION_STOP).setVisible(true);
|
||||||
} else if (state == Bundle.RESOLVED) {
|
} else if (state == Bundle.RESOLVED) {
|
||||||
pluginActions.getItemAtIndex(PLUGIN_ACTION_START).setVisible(true);
|
if (!isFragment) {
|
||||||
|
pluginActions.getItemAtIndex(PLUGIN_ACTION_START).setVisible(true);
|
||||||
|
}
|
||||||
} else if (state == Bundle.INSTALLED) {
|
} else if (state == Bundle.INSTALLED) {
|
||||||
// no options yet for installed
|
if (!isFragment) {
|
||||||
|
pluginActions.getItemAtIndex(PLUGIN_ACTION_START).setVisible(true);
|
||||||
|
}
|
||||||
} else if (state == Bundle.STARTING) {
|
} else if (state == Bundle.STARTING) {
|
||||||
// no options yet for starting
|
if (!isFragment) {
|
||||||
|
pluginActions.getItemAtIndex(PLUGIN_ACTION_START).setVisible(true);
|
||||||
|
}
|
||||||
} else if (state == Bundle.STOPPING) {
|
} else if (state == Bundle.STOPPING) {
|
||||||
// no options yet for stopping
|
// no options yet for stopping
|
||||||
} else if (state == Bundle.UNINSTALLED) {
|
} else if (state == Bundle.UNINSTALLED) {
|
||||||
|
@ -466,8 +488,7 @@ public class AboutWindow extends Window implements EventListener<Event> {
|
||||||
Bundle retValue = null;
|
Bundle retValue = null;
|
||||||
int idx = pluginsTable.getSelectedIndex();
|
int idx = pluginsTable.getSelectedIndex();
|
||||||
if (idx >= 0) {
|
if (idx >= 0) {
|
||||||
Integer selectedPlugin = (Integer) pluginsTable.getModel().getDataAt(idx, 1);
|
Vector<Object> pluginVector = pluginData.get(idx);
|
||||||
Vector<Object> pluginVector = pluginData.get(selectedPlugin);
|
|
||||||
int pluginId = ((IDColumn)pluginVector.get(0)).getRecord_ID();
|
int pluginId = ((IDColumn)pluginVector.get(0)).getRecord_ID();
|
||||||
BundleContext bundleCtx = WebUIActivator.getBundleContext();
|
BundleContext bundleCtx = WebUIActivator.getBundleContext();
|
||||||
retValue = bundleCtx.getBundle(pluginId);
|
retValue = bundleCtx.getBundle(pluginId);
|
||||||
|
@ -505,6 +526,7 @@ public class AboutWindow extends Window implements EventListener<Event> {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void refreshPluginTable() {
|
private void refreshPluginTable() {
|
||||||
|
int idx = pluginsTable.getSelectedIndex();
|
||||||
pluginsTable.getModel().removeAll(pluginData);
|
pluginsTable.getModel().removeAll(pluginData);
|
||||||
pluginData.removeAllElements();
|
pluginData.removeAllElements();
|
||||||
|
|
||||||
|
@ -521,6 +543,7 @@ public class AboutWindow extends Window implements EventListener<Event> {
|
||||||
}
|
}
|
||||||
ListModelTable model = new ListModelTable(pluginData);
|
ListModelTable model = new ListModelTable(pluginData);
|
||||||
pluginsTable.setData(model, pluginColumnNames);
|
pluginsTable.setData(model, pluginColumnNames);
|
||||||
|
pluginsTable.setSelectedIndex(idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Tabpanel createInfo() {
|
protected Tabpanel createInfo() {
|
||||||
|
|
Loading…
Reference in New Issue