1 package net.sourceforge.phpeclipse.xdebug.core;
4 import net.sourceforge.phpeclipse.xdebug.php.launching.IXDebugConstants;
5 //import org.eclipse.ui.plugin.AbstractUIPlugin;// *;
6 import org.eclipse.ui.preferences.ScopedPreferenceStore;
7 //import org.eclipse.core.resources.IWorkspace;
8 //import org.eclipse.core.resources.ResourcesPlugin;
9 //import org.eclipse.core.resources.IWorkspace;
10 //import org.eclipse.core.resources.ResourcesPlugin;
11 import org.eclipse.core.runtime.IStatus;
12 import org.eclipse.core.runtime.Plugin;
13 //import org.eclipse.core.runtime.Plugin;
14 import org.eclipse.core.runtime.Status;
15 import org.eclipse.core.runtime.preferences.InstanceScope;
16 import org.eclipse.debug.core.DebugPlugin;
17 import org.eclipse.debug.core.IBreakpointManager;
18 import org.eclipse.debug.core.model.IBreakpoint;
19 import org.eclipse.jface.preference.IPreferenceStore;
20 //import org.eclipse.jface.resource.ImageDescriptor;
21 import org.osgi.framework.BundleContext;
23 public class XDebugCorePlugin extends Plugin {
24 private static XDebugCorePlugin plugin;
25 public static final String PLUGIN_ID = "net.sourceforge.phpeclipse.xdebug.core"; //$NON-NLS-1$
27 private XDebugProxy fXDebugProxy;
29 private ScopedPreferenceStore preferenceStore;
35 public XDebugCorePlugin() {
40 * This method is called upon plug-in activation
42 public void start(BundleContext context) throws Exception {
47 * This method is called when the plug-in is stopped
49 public void stop(BundleContext context) throws Exception {
51 if (fXDebugProxy != null)
57 * Returns the shared instance.
59 public static XDebugCorePlugin getDefault() {
63 /*public static IWorkspace getWorkspace() {
64 return ResourcesPlugin.getWorkspace();
67 public static IBreakpoint[] getBreakpoints() {
68 return getBreakpointManager().getBreakpoints(IXDebugConstants.ID_PHP_DEBUG_MODEL);
71 public static /*static*/ IBreakpointManager getBreakpointManager() {
72 return DebugPlugin.getDefault().getBreakpointManager();
75 public static void log(int severity, String message) {
76 Status status = new Status(severity, PLUGIN_ID, IStatus.OK, message, null) ;
77 XDebugCorePlugin.log(status) ;
80 public static void log(IStatus status) {
81 getDefault().getLog().log(status);
84 public static void log(Throwable e) {
85 log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, "PHPLaunchingPlugin.internalErrorOccurred", e)); //$NON-NLS-1$
88 public static String getUniqueIdentifier() {
92 public void setProxyPort(int port) {
93 if(fXDebugProxy!=null) {
94 if (fXDebugProxy.isRunning()) {
101 public XDebugProxy getXDebugProxy() {
102 if (fXDebugProxy == null) {
103 int debugPort=getPreferenceStore().getInt(IXDebugPreferenceConstants.DEBUGPORT_PREFERENCE);
105 debugPort=IXDebugPreferenceConstants.DEFAULT_DEBUGPORT;
106 fXDebugProxy= new XDebugProxy(debugPort);
111 public IPreferenceStore getPreferenceStore() {
112 // Create the preference store lazily.
113 if (preferenceStore == null) {
114 preferenceStore = new ScopedPreferenceStore(new InstanceScope(),getBundle().getSymbolicName());
117 return preferenceStore;