~ubuntu-branches/ubuntu/trusty/monodevelop/trusty-proposed

« back to all changes in this revision

Viewing changes to src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringOptions.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-05-12 09:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20130512094603-mad323bzcxvmcam0
Tags: upstream-4.0.5+dfsg
ImportĀ upstreamĀ versionĀ 4.0.5+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
78
78
                                return new TextLocation (Document.Editor.Caret.Line, Document.Editor.Caret.Column);
79
79
                        }
80
80
                }
81
 
                public readonly CompilationUnit Unit;
 
81
                public readonly SyntaxTree Unit;
82
82
 
83
83
                public RefactoringOptions ()
84
84
                {
88
88
                {
89
89
                        this.Document = doc;
90
90
                        if (doc != null && doc.ParsedDocument != null) {
91
 
                                Unit = doc.ParsedDocument.GetAst<CompilationUnit> ();
92
 
                                resolver = CreateResolver (Unit);
 
91
                                var sharedResolver = doc.GetSharedResolver ();
 
92
                                if (sharedResolver == null)
 
93
                                        return;
 
94
                                resolver = sharedResolver.Result;
 
95
                                Unit = resolver != null ? resolver.RootNode as SyntaxTree : null;
93
96
                        }
94
97
                }
95
98
 
96
 
                public CSharpAstResolver CreateResolver (CompilationUnit unit)
97
 
                {
98
 
                        var parsedDocument = Document.ParsedDocument;
99
 
                        if (parsedDocument == null)
100
 
                                return null;
101
 
 
102
 
                        var parsedFile = parsedDocument.ParsedFile as CSharpParsedFile;
103
 
                        
104
 
                        if (unit == null || parsedFile == null)
105
 
                                return null;
106
 
 
107
 
                        return new CSharpAstResolver (Document.Compilation, unit, parsedFile);
108
 
                }
109
 
 
110
99
                public Mono.TextEditor.TextEditorData GetTextEditorData ()
111
100
                {
112
101
                        return Document.Editor;
180
169
                public static List<string> GetUsedNamespaces (Document doc, TextLocation loc)
181
170
                {
182
171
                        var result = new List<string> ();
183
 
                        var pf = doc.ParsedDocument.ParsedFile as CSharpParsedFile;
 
172
                        var pf = doc.ParsedDocument.ParsedFile as CSharpUnresolvedFile;
184
173
                        if (pf == null)
185
174
                                return result;
186
175
                        var scope = pf.GetUsingScope (loc);
203
192
                
204
193
                public AstType CreateShortType (IType fullType)
205
194
                {
206
 
                        var parsedFile = Document.ParsedDocument.ParsedFile as CSharpParsedFile;
 
195
                        var parsedFile = Document.ParsedDocument.ParsedFile as CSharpUnresolvedFile;
207
196
                        
208
197
                        var csResolver = parsedFile.GetResolver (Document.Compilation, Document.Editor.Caret.Location);
209
198