use of org.apache.derby.ui.DerbyPlugin in project derby by apache.
the class DerbyUtils method launch.
// another launch mechanism
public void launch() throws CoreException {
DerbyPlugin plugin = DerbyPlugin.getDefault();
// constructs a classpath from the default JRE...
IPath systemLibs = new Path(JavaRuntime.JRE_CONTAINER);
IRuntimeClasspathEntry systemLibsEntry = JavaRuntime.newRuntimeContainerClasspathEntry(systemLibs, IRuntimeClasspathEntry.STANDARD_CLASSES);
systemLibsEntry.setClasspathProperty(IRuntimeClasspathEntry.BOOTSTRAP_CLASSES);
// include org.apache.derby.core plugin
IRuntimeClasspathEntry derbyCPEntry = null;
List classpath = new ArrayList();
classpath.add(systemLibsEntry.getMemento());
try {
ManifestElement[] elements_core, elements_ui;
elements_core = getElements(CommonNames.CORE_PATH);
elements_ui = getElements(CommonNames.UI_PATH);
Bundle bundle;
URL pluginURL, jarURL, localURL;
bundle = Platform.getBundle(CommonNames.CORE_PATH);
pluginURL = bundle.getEntry("/");
for (int i = 0; i < elements_core.length; i++) {
if (!elements_core[i].getValue().toLowerCase().endsWith("derbynet.jar")) {
jarURL = new URL(pluginURL, elements_core[i].getValue());
localURL = Platform.asLocalURL(jarURL);
derbyCPEntry = JavaRuntime.newArchiveRuntimeClasspathEntry(new Path(localURL.getPath()));
derbyCPEntry.setClasspathProperty(IRuntimeClasspathEntry.USER_CLASSES);
classpath.add(derbyCPEntry.getMemento());
}
}
bundle = Platform.getBundle(CommonNames.CORE_PATH);
pluginURL = bundle.getEntry("/");
for (int i = 0; i < elements_ui.length; i++) {
if (!elements_ui[i].getValue().toLowerCase().equals("ui.jar")) {
jarURL = new URL(pluginURL, elements_ui[i].getValue());
localURL = Platform.asLocalURL(jarURL);
derbyCPEntry = JavaRuntime.newArchiveRuntimeClasspathEntry(new Path(localURL.getPath()));
derbyCPEntry.setClasspathProperty(IRuntimeClasspathEntry.USER_CLASSES);
classpath.add(derbyCPEntry.getMemento());
}
}
} catch (Exception e) {
e.printStackTrace();
Logger.log("Error in launch() " + e, IStatus.ERROR);
}
}
use of org.apache.derby.ui.DerbyPlugin in project derby by apache.
the class IJAction method run.
/**
* @see IActionDelegate#run(IAction)
*/
public void run(IAction action) {
Shell shell = new Shell();
DerbyPlugin plugin = DerbyPlugin.getDefault();
if (plugin == null) {
MessageDialog.openInformation(shell, CommonNames.PLUGIN_NAME, Messages.NO_ACTION);
} else {
try {
if (currentJavaProject != null) {
currentProject = currentJavaProject.getProject();
}
if (currentProject.isNatureEnabled(CommonNames.DERBY_NATURE)) {
DerbyUtils.runIJ(currentScript, currentProject);
} else {
shell = new Shell();
MessageDialog.openInformation(shell, CommonNames.PLUGIN_NAME, Messages.NO_DERBY_NATURE + "\n" + Messages.ADD_N_TRY);
}
} catch (Exception e) {
Logger.log("IAction.run() error " + e, IStatus.ERROR);
}
}
}
use of org.apache.derby.ui.DerbyPlugin in project derby by apache.
the class SysInfoAction method run.
/**
* @see IActionDelegate#run(IAction)
*/
public void run(IAction action) {
Shell shell = new Shell();
DerbyPlugin plugin = DerbyPlugin.getDefault();
if (plugin == null) {
MessageDialog.openInformation(shell, CommonNames.PLUGIN_NAME, Messages.NO_ACTION);
} else {
try {
if (currentJavaProject != null) {
DerbyUtils.runSysInfo(currentJavaProject.getProject());
} else {
DerbyUtils.runSysInfo(currentProject);
}
} catch (CoreException ce) {
ce.printStackTrace(System.err);
} catch (Exception e) {
e.printStackTrace();
}
}
}
Aggregations