plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/launch/WebApplicationSourceLocator.java
changeset 484 f5df819c1852
parent 471 06589bf52fa7
equal deleted inserted replaced
483:109da596fa9d 484:f5df819c1852
    49         ISourceLookupDirector {
    49         ISourceLookupDirector {
    50     public static final class WebApplicationSourceLookupParticipant extends AbstractSourceLookupParticipant {
    50     public static final class WebApplicationSourceLookupParticipant extends AbstractSourceLookupParticipant {
    51         private final ResourceManager resourceManager;
    51         private final ResourceManager resourceManager;
    52         private final WebApplicationSourceLocator locator;
    52         private final WebApplicationSourceLocator locator;
    53 
    53 
    54         public WebApplicationSourceLookupParticipant(WebApplicationSourceLocator locator,
    54         public WebApplicationSourceLookupParticipant(WebApplicationSourceLocator sourceLocator,
    55                 ResourceManager resourceManager) {
    55                 ResourceManager resourcesManager) {
    56             this.locator = locator;
    56             this.locator = sourceLocator;
    57             this.resourceManager = resourceManager;
    57             this.resourceManager = resourcesManager;
    58         }
    58         }
    59 
    59 
    60         public String getSourceName(Object object) throws CoreException {
    60         public String getSourceName(Object object) throws CoreException {
    61             Script script = null;
    61             Script script = null;
    62             if (object instanceof StackFrame) {
    62             if (object instanceof StackFrame) {
    78         }
    78         }
    79     }
    79     }
    80 
    80 
    81     private final ResourceManager resourceManager;
    81     private final ResourceManager resourceManager;
    82 
    82 
    83     public WebApplicationSourceLocator(ResourceManager resourceManager) {
    83     public WebApplicationSourceLocator(ResourceManager resourcesManager) {
    84         this.resourceManager = resourceManager;
    84         this.resourceManager = resourcesManager;
    85     }
    85     }
    86 
    86 
    87     public String fileUrl(Script script) throws CoreException {
    87     public String fileUrl(Script script) throws CoreException {
    88         String name = script.getName();
    88         String name = script.getName();
    89         try {
    89         try {
   112         }
   112         }
   113         return null;
   113         return null;
   114     }
   114     }
   115 
   115 
   116     public Object getSourceElement(IStackFrame stackFrame) {
   116     public Object getSourceElement(IStackFrame stackFrame) {
   117 		if (stackFrame instanceof StackFrame == false) {
   117         if (!(stackFrame instanceof StackFrame)) {
   118 			return null;
   118             return null;
   119 		}
   119         }
   120 		StackFrame jsStackFrame = (StackFrame) stackFrame;
   120         StackFrame jsStackFrame = (StackFrame) stackFrame;
   121 
   121 
   122 		Script script = jsStackFrame.getCallFrame().getScript();
   122         Script script = jsStackFrame.getCallFrame().getScript();
   123 		if (script == null) {
   123         if (script == null) {
   124 			return null;
   124             return null;
   125 		}
   125         }
   126 
   126 
   127 		IFile resource = resourceManager.getResource(script);
   127         IFile resource = resourceManager.getResource(script);
   128 		if (resource != null) {
   128         if (resource != null) {
   129 			return resource;
   129             return resource;
   130 		} else {
   130         } else {
   131 			File file = PreviewerPlugin.getDefault().getHttpPreviewer().getLocalFile(script.getName());
   131             File file = PreviewerPlugin.getDefault().getHttpPreviewer().getLocalFile(script.getName());
   132             if (file != null) {
   132             if (file != null) {
   133 				try {
   133                 try {
   134 					return EFS.getStore(file.toURI());
   134                     return EFS.getStore(file.toURI());
   135 				} catch (CoreException e) {
   135                 } catch (CoreException e) {
   136 					Activator.log(e);
   136                     Activator.log(e);
   137 				}
   137                 }
   138 			}
   138             }
   139 		}
   139         }
   140 		return null;
   140         return null;
   141 	}
   141     }
   142 
   142 
   143     public void initializeParticipants() {
   143     public void initializeParticipants() {
   144         addParticipants(new ISourceLookupParticipant[] { new WebApplicationSourceLookupParticipant(this,
   144         addParticipants(new ISourceLookupParticipant[] { new WebApplicationSourceLookupParticipant(this,
   145                 resourceManager) });
   145                 resourceManager) });
   146     }
   146     }