Very ugly start of a first wizard page. Needs a lot of cleanup!
[phpeclipse.git] / net.sourceforge.phpeclipse.xdebug.ui / src / net / sourceforge / phpeclipse / xdebug / ui / XDebugBreakpointAdapterFactory.java
1 /*
2  * Created on 25.11.2004
3  *
4  * TODO To change the template for this generated file go to
5  * Window - Preferences - Java - Code Style - Code Templates
6  */
7 package net.sourceforge.phpeclipse.xdebug.ui;
8
9 import org.eclipse.core.resources.IResource;
10 import org.eclipse.core.runtime.IAdapterFactory;
11 import org.eclipse.debug.ui.actions.IToggleBreakpointsTarget;
12 import org.eclipse.ui.texteditor.ITextEditor;
13
14 /**
15  * @author Axel
16  *
17  * TODO To change the template for this generated type comment go to
18  * Window - Preferences - Java - Code Style - Code Templates
19  */
20 public class XDebugBreakpointAdapterFactory implements IAdapterFactory {
21         /* (non-Javadoc)
22          * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
23          */
24         public Object getAdapter(Object adaptableObject, Class adapterType) {
25                 if (adaptableObject instanceof ITextEditor) {
26                         ITextEditor editorPart = (ITextEditor) adaptableObject;
27                         IResource resource = (IResource) editorPart.getEditorInput().getAdapter(IResource.class);
28                         if (resource != null) {
29                                 String extension = resource.getFileExtension();
30                                 if (extension != null && extension.equals("pda")) {
31                                         return new XDebugLineBreakpointAdapter();
32                                 }
33                         }                       
34                 }
35                 return null;
36         }
37         /* (non-Javadoc)
38          * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
39          */
40         public Class[] getAdapterList() {
41                 return new Class[]{IToggleBreakpointsTarget.class};
42         }
43 }