author | Johnson Ma <johnson.ma@nokia.com> |
Tue, 30 Mar 2010 14:39:29 +0800 | |
changeset 1 | 96906a986c3b |
permissions | -rw-r--r-- |
1
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
1 |
/* |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
2 |
* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
3 |
* All rights reserved. |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
4 |
* This component and the accompanying materials are made available |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
5 |
* under the terms of "Eclipse Public License v1.0" |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
6 |
* which accompanies this distribution, and is available |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
8 |
* |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
9 |
* Initial Contributors: |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
10 |
* Nokia Corporation - initial contribution. |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
11 |
* |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
12 |
* Contributors: |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
13 |
* |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
14 |
* Description: |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
15 |
* |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
16 |
*/ |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
17 |
package com.nokia.testfw.resultview; |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
18 |
|
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
19 |
|
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
20 |
import org.eclipse.core.resources.IContainer; |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
21 |
import org.eclipse.core.resources.IFile; |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
22 |
import org.eclipse.core.resources.IProject; |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
23 |
import org.eclipse.core.resources.IResource; |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
24 |
import org.eclipse.core.resources.ResourcesPlugin; |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
25 |
import org.eclipse.core.runtime.CoreException; |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
26 |
import org.eclipse.core.runtime.IStatus; |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
27 |
import org.eclipse.jface.text.BadLocationException; |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
28 |
import org.eclipse.jface.text.IDocument; |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
29 |
import org.eclipse.jface.text.IRegion; |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
30 |
import org.eclipse.ui.IEditorInput; |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
31 |
import org.eclipse.ui.IEditorPart; |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
32 |
import org.eclipse.ui.IWorkbenchPage; |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
33 |
import org.eclipse.ui.PlatformUI; |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
34 |
import org.eclipse.ui.ide.IDE; |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
35 |
import org.eclipse.ui.texteditor.IDocumentProvider; |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
36 |
import org.eclipse.ui.texteditor.ITextEditor; |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
37 |
|
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
38 |
/** |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
39 |
* @author xiaoma |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
40 |
* |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
41 |
*/ |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
42 |
public class WorkspaceUtils { |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
43 |
|
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
44 |
/** |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
45 |
* open specified file in associate editor, move cursor to the right position |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
46 |
* @return true, the file opened successfully |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
47 |
*/ |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
48 |
public static boolean openFile(String fileName, int line, int column) { |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
49 |
//find file in workspace |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
50 |
IFile file = findFileByName(fileName); |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
51 |
if (file == null) { |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
52 |
ResultViewPlugin.log(IStatus.WARNING, "can't find file to open:" + fileName); |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
53 |
return false; |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
54 |
} |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
55 |
|
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
56 |
try { |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
57 |
// //open editor |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
58 |
IWorkbenchPage page = |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
59 |
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
60 |
IEditorPart part = IDE.openEditor(page, file, true); |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
61 |
selectLine(part, line); |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
62 |
//todo: find a way to locate line and column |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
63 |
|
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
64 |
// HashMap map = new HashMap(); |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
65 |
// map.put(IMarker.LINE_NUMBER, new Integer(line)); |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
66 |
// IMarker marker = file.createMarker(IMarker.TEXT); |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
67 |
// marker.setAttributes(map); |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
68 |
// marker.delete(); |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
69 |
|
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
70 |
} catch (Exception e) { |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
71 |
// TODO Auto-generated catch block |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
72 |
e.printStackTrace(); |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
73 |
} |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
74 |
|
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
75 |
|
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
76 |
return false; |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
77 |
} |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
78 |
|
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
79 |
private static void selectLine(IEditorPart editorPart, int lineNumber) { |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
80 |
if (lineNumber > 0 && editorPart instanceof ITextEditor) { |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
81 |
ITextEditor textEditor = (ITextEditor)editorPart; |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
82 |
IEditorInput input = editorPart.getEditorInput(); |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
83 |
|
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
84 |
int offset = 0; |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
85 |
int length = 0; |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
86 |
IDocumentProvider provider = textEditor.getDocumentProvider(); |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
87 |
try { |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
88 |
provider.connect(input); |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
89 |
} catch (CoreException e) { |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
90 |
// unable to link |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
91 |
e.printStackTrace(); |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
92 |
return; |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
93 |
} |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
94 |
IDocument document = provider.getDocument(input); |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
95 |
try { |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
96 |
IRegion region= document.getLineInformation(lineNumber - 1); |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
97 |
offset = region.getOffset(); |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
98 |
length = region.getLength(); |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
99 |
} catch (BadLocationException e) { |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
100 |
// unable to link |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
101 |
e.printStackTrace(); |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
102 |
} |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
103 |
provider.disconnect(input); |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
104 |
if (offset >= 0 && length >=0) { |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
105 |
textEditor.selectAndReveal(offset, length); |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
106 |
} |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
107 |
} |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
108 |
} |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
109 |
|
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
110 |
/** |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
111 |
* find flie by name. |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
112 |
* this will loop up all files in workspace opened project and return the first matched |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
113 |
* file |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
114 |
* @return the file or null |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
115 |
*/ |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
116 |
private static IFile findFileByName(String fileName) { |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
117 |
IProject[] projects = |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
118 |
ResourcesPlugin.getWorkspace().getRoot().getProjects(); |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
119 |
for (IProject project : projects) { |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
120 |
if (!project.isOpen()) { |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
121 |
continue; |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
122 |
} |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
123 |
IFile file = findFileByName(project, fileName); |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
124 |
if (file != null) { |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
125 |
return file; |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
126 |
} |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
127 |
} |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
128 |
return null; |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
129 |
} |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
130 |
|
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
131 |
private static IFile findFileByName(IContainer container, String fileName) { |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
132 |
IResource file = null; |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
133 |
file = container.findMember(fileName); |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
134 |
if (file != null && file instanceof IFile) { |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
135 |
return (IFile)file; |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
136 |
} |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
137 |
try { |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
138 |
for (IResource res:container.members()) { |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
139 |
if (res instanceof IContainer) { |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
140 |
file = findFileByName((IContainer)res, fileName); |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
141 |
if (file != null) { |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
142 |
return (IFile)file; |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
143 |
} |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
144 |
} |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
145 |
} |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
146 |
} catch (CoreException e) { |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
147 |
e.printStackTrace(); |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
148 |
return null; |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
149 |
} |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
150 |
return null; |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
151 |
} |
96906a986c3b
contribute ITE to symbian foundation
Johnson Ma <johnson.ma@nokia.com>
parents:
diff
changeset
|
152 |
} |