1 package net.sourceforge.phpeclipse.xdebug.core;
4 import net.sourceforge.phpeclipse.xdebug.php.launching.IXDebugConstants;
5 import org.eclipse.ui.preferences.ScopedPreferenceStore;
6 import org.eclipse.core.runtime.IStatus;
7 import org.eclipse.core.runtime.Plugin;
8 import org.eclipse.core.runtime.Status;
9 import org.eclipse.core.runtime.preferences.InstanceScope;
10 import org.eclipse.debug.core.DebugPlugin;
11 import org.eclipse.debug.core.IBreakpointManager;
12 import org.eclipse.debug.core.model.IBreakpoint;
13 import org.eclipse.jface.preference.IPreferenceStore;
14 import org.osgi.framework.BundleContext;
16 public class XDebugCorePlugin extends Plugin {
17 private static XDebugCorePlugin plugin;
18 public static final String PLUGIN_ID = "net.sourceforge.phpeclipse.xdebug.core"; //$NON-NLS-1$
20 private XDebugProxy fXDebugProxy;
22 private ScopedPreferenceStore preferenceStore;
28 public XDebugCorePlugin() {
34 * This method is called upon plug-in activation
36 public void start(BundleContext context) throws Exception {
41 * This method is called when the plug-in is stopped
43 public void stop(BundleContext context) throws Exception {
45 if (fXDebugProxy != null)
51 * Returns the shared instance.
53 public static XDebugCorePlugin getDefault() {
57 public static IBreakpoint[] getBreakpoints() {
58 return getBreakpointManager().getBreakpoints(IXDebugConstants.ID_PHP_DEBUG_MODEL);
61 public static IBreakpointManager getBreakpointManager() {
62 return DebugPlugin.getDefault().getBreakpointManager();
65 public static void log(int severity, String message) {
66 Status status = new Status(severity, PLUGIN_ID, IStatus.OK, message, null) ;
67 XDebugCorePlugin.log(status) ;
70 public static void log(IStatus status) {
71 getDefault().getLog().log(status);
74 public static void log(Throwable e) {
75 log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, "PHPLaunchingPlugin.internalErrorOccurred", e)); //$NON-NLS-1$
78 public static String getUniqueIdentifier() {
82 /*public void setProxyPort(int port) {
83 if(fXDebugProxy!=null) {
84 if (fXDebugProxy.isRunning()) {
91 public XDebugProxy getXDebugProxy() {
92 if (fXDebugProxy == null) {
93 int debugPort=getPreferenceStore().getInt(IXDebugPreferenceConstants.DEBUGPORT_PREFERENCE);
95 debugPort=IXDebugPreferenceConstants.DEFAULT_DEBUGPORT;
96 fXDebugProxy= new XDebugProxy(debugPort);
101 public IPreferenceStore getPreferenceStore() {
102 // Create the preference store lazily.
103 if (preferenceStore == null) {
104 preferenceStore = new ScopedPreferenceStore(new InstanceScope(),getBundle().getSymbolicName());
107 return preferenceStore;