package uk.ac.ed.inf.common.ui.plotview;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.*;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
import uk.ac.ed.inf.common.ui.plotting.IChart;
import uk.ac.ed.inf.common.ui.plotview.views.PlotView;
public static final String PLUGIN_ID = "uk.ac.ed.inf.common.ui.plotview";
private static PlotViewPlugin plugin;
}
public static IStatus
wrapException(String message, Exception e) {
IStatus status = new Status(IStatus.ERROR, PLUGIN_ID, message, e);
plugin.getLog().log(status);
return status;
}
public void reveal(
final IChart chart) {
Display display = PlatformUI.getWorkbench().getDisplay();
display.syncExec(new Runnable() {
IWorkbenchWindow window = PlatformUI.getWorkbench()
.getActiveWorkbenchWindow();
if (window == null)
return;
PlotView plotView = null;
try {
plotView = (PlotView) window.getActivePage().showView(
PlotView.ID);
} catch (PartInitException e) {
PlotViewPlugin.getDefault().getLog().log(e.getStatus());
}
plotView.reveal(chart);
}
});
}
public void start(BundleContext context)
throws Exception {
super.start(context);
plugin = this;
}
public void stop(BundleContext context)
throws Exception {
plugin = null;
super.stop(context);
}
return plugin;
}
return imageDescriptorFromPlugin(PLUGIN_ID, path);
}
}