public async System.Threading.Tasks.Task CollectSignatureLists(ISignatureHelpSession newSession) { JavaEditor javaEditor = null; if (TextBuffer.Properties.TryGetProperty <JavaEditor>(typeof(JavaEditor), out javaEditor) && javaEditor.TypeRootIdentifier != null) { var textReader = new TextSnapshotToTextReader(TextBuffer.CurrentSnapshot) as TextReader; var position = newSession.GetTriggerPoint(TextBuffer).GetPosition(TextBuffer.CurrentSnapshot); var paramHelpRequest = ProtocolHandlers.CreateParamHelpRequest( textReader, javaEditor.TypeRootIdentifier, position); var paramHelpResponse = await javaEditor.JavaPkgServer.Send(javaEditor, paramHelpRequest); if (paramHelpResponse.responseType == Protocol.Response.ResponseType.ParamHelp && paramHelpResponse.paramHelpResponse != null) { if (paramHelpResponse.paramHelpResponse.status && paramHelpResponse.paramHelpResponse.signatures.Count != 0) { var applicableTo = TextBuffer.CurrentSnapshot.CreateTrackingSpan(new Span(paramHelpResponse.paramHelpResponse.scopeStart, paramHelpResponse.paramHelpResponse.scopeLength), SpanTrackingMode.EdgeInclusive, 0); int selectedParameterIndex = paramHelpResponse.paramHelpResponse.paramCount; Signatures = TransformSignatures(TextBuffer, paramHelpResponse.paramHelpResponse.signatures, applicableTo, selectedParameterIndex); } } } }
public static JavaEditorBase Disconnect(IWpfTextView textView, Collection <ITextBuffer> subjectBuffers) { ServerProxy javaPkgServer = null; JavaEditor javaEditor = null; JavaUnconfiguredEditor javaUnconfiguredEditor = null; textView.Properties.TryGetProperty <ServerProxy>(typeof(ServerProxy), out javaPkgServer); textView.Properties.TryGetProperty <JavaEditor>(typeof(JavaEditor), out javaEditor); textView.Properties.TryGetProperty <JavaUnconfiguredEditor>(typeof(JavaUnconfiguredEditor), out javaUnconfiguredEditor); textView.Properties.RemoveProperty(typeof(JavaUnconfiguredEditor)); textView.Properties.RemoveProperty(typeof(ServerProxy)); textView.Properties.RemoveProperty(typeof(JavaEditor)); foreach (var buffer in subjectBuffers) { buffer.Properties.RemoveProperty(typeof(JavaUnconfiguredEditor)); buffer.Properties.RemoveProperty(typeof(ServerProxy)); buffer.Properties.RemoveProperty(typeof(JavaEditor)); } if (javaPkgServer != null && javaEditor != null && javaEditor.TypeRootIdentifier != null) { javaPkgServer.Send(javaEditor, ProtocolHandlers.CreateDisposeTypeRootRequest(javaEditor.TypeRootIdentifier)).ContinueWith((System.Threading.Tasks.Task <Protocol.Response> responseTask) => { JavaPkgServerMgr.ReleaseProxy(javaPkgServer); }); } return(javaEditor != null ? (JavaEditorBase)javaEditor : (JavaEditorBase)javaUnconfiguredEditor); }
public async System.Threading.Tasks.Task CollectCompletionSets(ICompletionSession newSession) { JavaEditor javaEditor = null; if (TextBuffer.Properties.TryGetProperty <JavaEditor>(typeof(JavaEditor), out javaEditor) && javaEditor.TypeRootIdentifier != null) { var textReader = new TextSnapshotToTextReader(TextBuffer.CurrentSnapshot) as TextReader; var autocompleteRequest = ProtocolHandlers.CreateAutocompleteRequest( textReader, javaEditor.TypeRootIdentifier, newSession.GetTriggerPoint(TextBuffer).GetPosition(TextBuffer.CurrentSnapshot)); var autocompleteResponse = await javaEditor.JavaPkgServer.Send(javaEditor, autocompleteRequest); if (autocompleteResponse.responseType == Protocol.Response.ResponseType.Autocomplete && autocompleteResponse.autocompleteResponse != null) { if (autocompleteResponse.autocompleteResponse.status && autocompleteResponse.autocompleteResponse.proposals.Count != 0) { CompletionSetList = new List <CompletionSet>(); var list = TransformCompletions(TextBuffer.CurrentSnapshot, autocompleteResponse.autocompleteResponse.proposals); CompletionSetList.Add(new CompletionSet("Autocomplete", "Autocomplete", GetReplacementSpanFromCompletions(TextBuffer.CurrentSnapshot, autocompleteResponse.autocompleteResponse.proposals.First()), list, null)); // FindTokenSpanAtPosition(newSession.GetTriggerPoint(TextBuffer), newSession), list, null)); } } } }
public ServerProxy Configure(string eclipsePath) { Telemetry.Client.Get().TrackEvent("App.ConfigureEditor"); // Remove itself from properties TextView.Properties.RemoveProperty(typeof(JavaUnconfiguredEditor)); // Set path in registry Registry.SetValue("HKEY_CURRENT_USER\\Software\\Microsoft\\JavaPkgSrv", "EclipseInstall", eclipsePath, RegistryValueKind.String); // Reboot editor var fileName = VSHelpers.GetFileName(TextView); var eclipseWorkspace = EclipseWorkspace.FromFilePath(fileName); var javaPkgServer = JavaPkgServerManager.GetProxy(eclipseWorkspace); var javaEditor = new JavaEditor(SubjectBuffers, TextView, javaPkgServer, eclipseWorkspace); Telemetry.Client.Get().TrackEvent("App.EditorOpenConfigured"); javaPkgServer.Send(javaEditor, ProtocolHandlers.CreateOpenTypeRootRequest(fileName)).ContinueWith((System.Threading.Tasks.Task<Protocol.Response> responseTask) => { var openTypeResponse = responseTask.Result; if (openTypeResponse.responseType == Protocol.Response.ResponseType.OpenTypeRoot && openTypeResponse.openTypeRootResponse != null) { javaEditor.TypeRootIdentifier = openTypeResponse.openTypeRootResponse.typeRootIdentifier; } }); TextView.Properties.RemoveProperty(typeof(ServerProxy)); TextView.Properties.AddProperty(typeof(ServerProxy), javaPkgServer); TextView.Properties.RemoveProperty(typeof(JavaEditor)); TextView.Properties.AddProperty(typeof(JavaEditor), javaEditor); foreach (var buffer in SubjectBuffers) { buffer.Properties.RemoveProperty(typeof(JavaUnconfiguredEditor)); buffer.Properties.RemoveProperty(typeof(ServerProxy)); buffer.Properties.AddProperty(typeof(ServerProxy), javaPkgServer); buffer.Properties.RemoveProperty(typeof(JavaEditor)); buffer.Properties.AddProperty(typeof(JavaEditor), javaEditor); JavaOutline outline = null; if (buffer.Properties.TryGetProperty<JavaOutline>(typeof(JavaOutline), out outline)) { outline.JavaEditor = javaEditor; } JavaSquiggles squiggles = null; if (buffer.Properties.TryGetProperty<JavaSquiggles>(typeof(JavaSquiggles), out squiggles)) { squiggles.JavaEditor = javaEditor; } } return javaPkgServer; }
public ServerProxy Configure(string eclipsePath) { Telemetry.Client.Get().TrackEvent("App.ConfigureEditor"); // Remove itself from properties TextView.Properties.RemoveProperty(typeof(JavaUnconfiguredEditor)); // Set path in registry Registry.SetValue("HKEY_CURRENT_USER\\Software\\Microsoft\\JavaPkgSrv", "EclipseInstall", eclipsePath, RegistryValueKind.String); // Reboot editor var fileName = VSHelpers.GetFileName(TextView); var eclipseWorkspace = EclipseWorkspace.FromFilePath(fileName); var javaPkgServer = JavaPkgServerManager.GetProxy(eclipseWorkspace); var javaEditor = new JavaEditor(SubjectBuffers, TextView, javaPkgServer, eclipseWorkspace); Telemetry.Client.Get().TrackEvent("App.EditorOpenConfigured"); javaPkgServer.Send(javaEditor, ProtocolHandlers.CreateOpenTypeRootRequest(fileName)).ContinueWith((System.Threading.Tasks.Task <Protocol.Response> responseTask) => { var openTypeResponse = responseTask.Result; if (openTypeResponse.responseType == Protocol.Response.ResponseType.OpenTypeRoot && openTypeResponse.openTypeRootResponse != null) { javaEditor.TypeRootIdentifier = openTypeResponse.openTypeRootResponse.typeRootIdentifier; } }); TextView.Properties.RemoveProperty(typeof(ServerProxy)); TextView.Properties.AddProperty(typeof(ServerProxy), javaPkgServer); TextView.Properties.RemoveProperty(typeof(JavaEditor)); TextView.Properties.AddProperty(typeof(JavaEditor), javaEditor); foreach (var buffer in SubjectBuffers) { buffer.Properties.RemoveProperty(typeof(JavaUnconfiguredEditor)); buffer.Properties.RemoveProperty(typeof(ServerProxy)); buffer.Properties.AddProperty(typeof(ServerProxy), javaPkgServer); buffer.Properties.RemoveProperty(typeof(JavaEditor)); buffer.Properties.AddProperty(typeof(JavaEditor), javaEditor); JavaOutline outline = null; if (buffer.Properties.TryGetProperty <JavaOutline>(typeof(JavaOutline), out outline)) { outline.JavaEditor = javaEditor; } JavaSquiggles squiggles = null; if (buffer.Properties.TryGetProperty <JavaSquiggles>(typeof(JavaSquiggles), out squiggles)) { squiggles.JavaEditor = javaEditor; } } return(javaPkgServer); }
public Task <Protocol.Response> Send(JavaEditor javaEditor, Protocol.Request request) { var source = new TaskCompletionSource <Protocol.Response>(); lock (WorkItems) { WorkItems.Enqueue(new Tuple <Protocol.Request, TaskCompletionSource <Protocol.Response>, JavaEditor>(request, source, javaEditor)); Telemetry_MaxQueueLength = Math.Max(WorkItems.Count, Telemetry_MaxQueueLength); } return(source.Task); }
private void ProcessOnIdle() { foreach (var view in TextViews) { JavaEditor javaEditor = null; if (view.Properties.TryGetProperty <JavaEditor>(typeof(JavaEditor), out javaEditor)) { javaEditor.Update(view.TextSnapshot); javaEditor.RunIdleLoop(); } } }
void javaEditor_EditorReplaced(object sender, JavaEditorBase newEditor) { JavaEditor javaEditor = sender as JavaEditor; if (javaEditor != null) { javaEditor.OperationStarted -= javaEditor_OperationStarted; javaEditor.OperationCompleted -= javaEditor_OperationCompleted; } (sender as JavaEditorBase).EditorReplaced -= javaEditor_EditorReplaced; JavaEditor newJavaEditor = newEditor as JavaEditor; if (newJavaEditor != null) { newJavaEditor.OperationStarted += javaEditor_OperationStarted; newJavaEditor.OperationCompleted += javaEditor_OperationCompleted; } newEditor.EditorReplaced += javaEditor_EditorReplaced; if (newEditor is JavaUnconfiguredEditor) { if (Root != null) { Root.Dispatcher.Invoke((Action) delegate() { if (!Helpers.VSHelpers.IsBuildInProgress()) { Root.MessageBanner = "Java file is not part of an workspace. Intellisense is not available"; } else { Root.MessageBanner = "Provisioning build needs to complete (Status.StillBuilding). Intellisense is not available"; } }); } } else { if (Root != null) { Root.Dispatcher.Invoke((Action) delegate() { Root.MessageBanner = string.Empty; }); } } }
void textView_GotAggregateFocus(object sender, EventArgs e) { var textView = sender as IWpfTextView; JavaEditor javaEditor = null; JavaUnconfiguredEditor javaUnconfiguredEditor = null; if (textView.Properties.TryGetProperty <JavaEditor>(typeof(JavaEditor), out javaEditor)) { // Force an update in case something changed in the configuration since the last time we opened the file in the editor javaEditor.Update(textView.TextSnapshot, true); } else if (textView.Properties.TryGetProperty <JavaUnconfiguredEditor>(typeof(JavaUnconfiguredEditor), out javaUnconfiguredEditor)) { javaUnconfiguredEditor.Update(); } }
public JavaMargin(IWpfTextView textView) { TextView = textView; Root = new JavaMarginUI(); JavaEditor javaEditor = null; JavaUnconfiguredEditor javaUnconfiguredEditor = null; if (textView.Properties.TryGetProperty <JavaEditor>(typeof(JavaEditor), out javaEditor)) { javaEditor.OperationStarted += javaEditor_OperationStarted; javaEditor.OperationCompleted += javaEditor_OperationCompleted; javaEditor.EditorReplaced += javaEditor_EditorReplaced; } else if (textView.Properties.TryGetProperty <JavaUnconfiguredEditor>(typeof(JavaUnconfiguredEditor), out javaUnconfiguredEditor)) { Root.MessageBanner = "Java file is not part of an workspace. Intellisense is not available"; javaUnconfiguredEditor.EditorReplaced += javaEditor_EditorReplaced; } // Check JDK installation var jdkStatus = Helpers.JDKHelpers.GetJavaPathDirectory(); switch (jdkStatus.Item2) { case Helpers.JDKHelpers.Status.JDKRegKeyNotFound: Root.MessageBanner = "Java Developer Kit installation not found (Status.JDKRegKeyNotFound). Intellisense is not available"; break; case Helpers.JDKHelpers.Status.CurrentVersionRegKeyNotFound: Root.MessageBanner = "Java Developer Kit installation not found (Status.CurrentVersionRegKeyNotFound). Intellisense is not available"; break; case Helpers.JDKHelpers.Status.JavaHomeFolderNotFound: Root.MessageBanner = "Java Developer Kit installation not found (Status.JavaHomeFolderNotFound). Intellisense is not available"; break; case Helpers.JDKHelpers.Status.JavaBinFolderNotFound: Root.MessageBanner = "Java Developer Kit installation not found (Status.JavaBinFolderNotFound). Intellisense is not available"; break; case Helpers.JDKHelpers.Status.JavaExeFileNotFound: Root.MessageBanner = "Java Developer Kit installation not found (Status.JavaExeFileNotFound). Intellisense is not available"; break; } }
private void UpdateCurrentParameter(int position) { JavaEditor javaEditor = null; if (TextView.Properties.TryGetProperty <JavaEditor>(typeof(JavaEditor), out javaEditor)) { javaEditor.PostOnIdle(typeof(JavaSignatureHelpSessionSignatures), () => { JavaSignatureHelpSessionSignatures precomputedSignatures; if (SignatureSession != null && !SignatureSession.IsDismissed && SignatureSession.Properties.TryGetProperty <JavaSignatureHelpSessionSignatures>(typeof(JavaSignatureHelpSessionSignatures), out precomputedSignatures)) { var fireAndForgetTask = precomputedSignatures.UpdateParameterCount(SignatureSession.SelectedSignature as JavaMethodSignature, position); } }); } }
public JavaSquiggles(ITextBuffer buffer, IBufferTagAggregatorFactoryService AggregatorFactory) { this.TextBuffer = buffer; this.AggregatorFactory = AggregatorFactory; JavaEditor javaEditor = null; if (buffer.Properties.TryGetProperty <JavaEditor>(typeof(JavaEditor), out javaEditor)) { javaEditor.FileParseMessagesAvailable += JavaEditor_FileParseMessagesAvailable; } else { // Sometimes (all the time?) the outline class gets created before the SubjectBuffersConnected call is made buffer.Properties.AddProperty(typeof(JavaSquiggles), this); } }
public async Task UpdateParameterCount(JavaMethodSignature signature, int position) { if (signature == null || signature.Parameters.Count == 0) { return; } JavaEditor javaEditor = null; if (TextBuffer.Properties.TryGetProperty <JavaEditor>(typeof(JavaEditor), out javaEditor)) { var paramsSpan = signature.ApplicableToSpan.GetSpan(TextBuffer.CurrentSnapshot); var callSpan = new Span(paramsSpan.Start - 1, paramsSpan.Length + 2); var callText = TextBuffer.CurrentSnapshot.GetText(callSpan); var callPosition = position - callSpan.Start; // position is relative to the whole document var updateRequest = ProtocolHandlers.CreateParamHelpPositionUpdateRequest(callText, callPosition); try { var updateResponse = await javaEditor.JavaPkgServer.Send(javaEditor, updateRequest); if (updateResponse.responseType == Protocol.Response.ResponseType.ParamHelpPositionUpdate && updateResponse.paramHelpPositionUpdateResponse != null) { if (updateResponse.paramHelpPositionUpdateResponse.status) { if (signature.Parameters.Count > updateResponse.paramHelpPositionUpdateResponse.paramCount) { signature.CurrentParameter = signature.Parameters[updateResponse.paramHelpPositionUpdateResponse.paramCount]; } else { signature.CurrentParameter = signature.Parameters.Last(); } } } } catch (TaskCanceledException tce) { // Repeated cursor movement may lead to many update requests. Some will get cancelled by the ServerProxy } } }
internal async Task RequestQuickInfo(ITextView textView, ITrackingPoint triggerPoint) { JavaEditor javaEditor = null; if (TextBuffer.Properties.TryGetProperty <JavaEditor>(typeof(JavaEditor), out javaEditor) && javaEditor.TypeRootIdentifier != null) { var textReader = new TextSnapshotToTextReader(TextBuffer.CurrentSnapshot) as TextReader; var position = triggerPoint.GetPosition(TextBuffer.CurrentSnapshot); var quickInfoRequest = ProtocolHandlers.CreateQuickInfoRequest(textReader, javaEditor.TypeRootIdentifier, position); var quickInfoResponse = await javaEditor.JavaPkgServer.Send(javaEditor, quickInfoRequest); if (quickInfoResponse.responseType == Protocol.Response.ResponseType.QuickInfo && quickInfoResponse.quickInfoResponse != null) { foreach (var element in quickInfoResponse.quickInfoResponse.elements) { QuickInfoContent.Add(element.definition); // TODO: Better javadoc rendering + "\n\n" + element.javaDoc; } } } }
public void Dispose() { if (!isDisposed) { Root = null; JavaEditor javaEditor = null; JavaUnconfiguredEditor javaUnconfiguredEditor = null; if (TextView.Properties.TryGetProperty <JavaEditor>(typeof(JavaEditor), out javaEditor)) { javaEditor.OperationStarted -= javaEditor_OperationStarted; javaEditor.OperationCompleted -= javaEditor_OperationCompleted; javaEditor.EditorReplaced -= javaEditor_EditorReplaced; } else if (TextView.Properties.TryGetProperty <JavaUnconfiguredEditor>(typeof(JavaUnconfiguredEditor), out javaUnconfiguredEditor)) { javaUnconfiguredEditor.EditorReplaced -= javaEditor_EditorReplaced; } GC.SuppressFinalize(this); isDisposed = true; } }
public async Task Run(IVsEditorAdaptersFactoryService editorFactory) { JavaEditor javaEditor = null; if (TextView.Properties.TryGetProperty <JavaEditor>(typeof(JavaEditor), out javaEditor) && javaEditor.TypeRootIdentifier != null) { var textReader = new TextSnapshotToTextReader(TextView.TextBuffer.CurrentSnapshot) as TextReader; var position = CaretPoint.Position; var findDefinitionRequest = ProtocolHandlers.CreateFindDefinitionRequest(textReader, javaEditor.TypeRootIdentifier, position); var findDefinitionResponse = await javaEditor.JavaPkgServer.Send(javaEditor, findDefinitionRequest); if (findDefinitionResponse.responseType == Protocol.Response.ResponseType.FindDefinition && findDefinitionResponse.findDefinitionResponse != null) { var elements = findDefinitionResponse.findDefinitionResponse.elements; StringBuilder sb = new StringBuilder(); foreach (var element in elements) { if (element.hasSource && element.filePath.EndsWith(".java")) { Telemetry.Client.Get().TrackEvent("App.OpenSourceFile"); string fullPath = element.filePath; // (findDefinitionResponse.findDefinitionResponse.workspaceRootPath + element.filePath).Replace('/', '\\'); var window = VSHelpers.OpenDocument(fullPath, null); var textView = VSHelpers.GetWpfTextView(VSHelpers.GetTextView(window)); textView.Caret.MoveTo(new SnapshotPoint(textView.TextBuffer.CurrentSnapshot, element.positionStart)); textView.Selection.Select(new SnapshotSpan(textView.TextBuffer.CurrentSnapshot, element.positionStart, element.positionLength), false); textView.Caret.EnsureVisible(); } else if (element.hasSource && element.filePath.EndsWith(".jar")) { Telemetry.Client.Get().TrackEvent("App.OpenSourceFileFromJar"); string folderName = Path.GetTempPath() + ".javacache" + Path.DirectorySeparatorChar + Path.GetFileName(element.filePath); string fileName = folderName + Path.DirectorySeparatorChar + element.fileName; // Check first if window is already opened var window = VSHelpers.IsDocumentOpened(fileName); if (window != null) { // Bring to front window.Show(); } else { // If no editor is opened, create (or recreate) the temp file string contents = element.fileContents; Directory.CreateDirectory(folderName); using (StreamWriter sw = new StreamWriter(fileName)) sw.Write(element.fileContents); JavaEditorFactory.DefinitionCache[fileName] = new Tuple <EclipseWorkspace, Protocol.TypeRootIdentifier>(javaEditor.EclipseWorkspace, element.typeRootIdentifier); // Write info to be able to reconnect temp file to ISense services on reload using (StreamWriter sw = new StreamWriter(fileName + ".id")) { sw.WriteLine(javaEditor.EclipseWorkspace.Name); sw.WriteLine(element.typeRootIdentifier.handle); } // Open in editor as a readonly file window = VSHelpers.OpenDocument(fileName, null); } var textView = VSHelpers.GetWpfTextView(VSHelpers.GetTextView(window)); var vsTextBuffer = VSHelpers.GetTextBuffer(editorFactory, textView.TextBuffer); VSHelpers.MakeEditorReadOnly(vsTextBuffer, true); textView.Caret.MoveTo(new SnapshotPoint(textView.TextBuffer.CurrentSnapshot, element.positionStart)); textView.Selection.Select(new SnapshotSpan(textView.TextBuffer.CurrentSnapshot, element.positionStart, element.positionLength), false); textView.Caret.EnsureVisible(); } else { // TODO: Prompt user to map source file to class file // TODO: Show disasembly if no mapping MessageBox.Show("Cannot navigate to symbol " + element.definition + ". Source not available.", "Source not found"); Telemetry.Client.Get().TrackEvent("App.OpenSourceFileNoSource"); } break; // TODO: Handle ambiguous symbol resolution } if (elements.Count > 1) { Telemetry.Client.Get().TrackEvent("App.OpenSourceFileAmbiguousSymbol"); } } } }
public Task<Protocol.Response> Send(JavaEditor javaEditor, Protocol.Request request) { var source = new TaskCompletionSource<Protocol.Response>(); lock (WorkItems) { WorkItems.Enqueue(new Tuple<Protocol.Request, TaskCompletionSource<Protocol.Response>, JavaEditor>(request, source, javaEditor)); Telemetry_MaxQueueLength = Math.Max(WorkItems.Count, Telemetry_MaxQueueLength); } return source.Task; }
public static JavaEditor Configure(IWpfTextView textView, Collection <ITextBuffer> subjectBuffers) { var oldEditor = Disconnect(textView, subjectBuffers); EclipseWorkspace eclipseWorkspace = null; Protocol.TypeRootIdentifier presetTypeRootIdentifier = null; string fileName = VSHelpers.GetFileName(textView); if (DefinitionCache.ContainsKey(fileName)) { eclipseWorkspace = DefinitionCache[fileName].Item1; presetTypeRootIdentifier = DefinitionCache[fileName].Item2; DefinitionCache.Remove(fileName); } else if (File.Exists(fileName + ".id")) { string[] info = File.ReadAllLines(fileName + ".id"); if (info.Length >= 2) { eclipseWorkspace = EclipseWorkspace.FromRootPath(info[0]); presetTypeRootIdentifier = new Protocol.TypeRootIdentifier(); presetTypeRootIdentifier.handle = info[1]; } } else { eclipseWorkspace = EclipseWorkspace.FromFilePath(fileName); } var javaPkgServer = JavaPkgServerMgr.GetProxy(eclipseWorkspace); JavaEditor javaEditor = null; if (javaPkgServer != null) { textView.Properties.AddProperty(typeof(ServerProxy), javaPkgServer); javaEditor = textView.Properties.GetOrCreateSingletonProperty <JavaEditor>(() => new JavaEditor(subjectBuffers, textView, javaPkgServer, eclipseWorkspace)); Telemetry.Client.Get().TrackEvent("App.EditorOpenConfigured"); if (presetTypeRootIdentifier == null) { javaPkgServer.Send(javaEditor, ProtocolHandlers.CreateOpenTypeRootRequest(fileName)).ContinueWith((System.Threading.Tasks.Task <Protocol.Response> responseTask) => { var openTypeResponse = responseTask.Result; if (openTypeResponse.responseType == Protocol.Response.ResponseType.OpenTypeRoot && openTypeResponse.openTypeRootResponse != null) { javaEditor.TypeRootIdentifier = openTypeResponse.openTypeRootResponse.typeRootIdentifier; } }); } else if (File.Exists(fileName + ".id")) { // Reopening a .class file from the cache javaPkgServer.Send(javaEditor, ProtocolHandlers.CreataAddTypeRootRequest(presetTypeRootIdentifier)).ContinueWith((System.Threading.Tasks.Task <Protocol.Response> responseTask) => { var addTypeResponse = responseTask.Result; if (addTypeResponse.responseType == Protocol.Response.ResponseType.AddTypeRoot && addTypeResponse.addTypeRootResponse != null) { javaEditor.TypeRootIdentifier = addTypeResponse.addTypeRootResponse.typeRootIdentifier; } }); javaEditor.DisableParsing(); // No need to parse .class files from .jar for squiggles } else { // Usually preset when opening a source file from a .jar via gotodef javaEditor.TypeRootIdentifier = presetTypeRootIdentifier; javaEditor.DisableParsing(); // No need to parse .class files from .jar for squiggles } } else { return(null); } if (oldEditor != null) { oldEditor.Fire_EditorReplaced(javaEditor); } foreach (var buffer in subjectBuffers) { buffer.Properties.AddProperty(typeof(ServerProxy), javaPkgServer); buffer.Properties.AddProperty(typeof(JavaEditor), javaEditor); JavaOutline outline = null; if (buffer.Properties.TryGetProperty <JavaOutline>(typeof(JavaOutline), out outline)) { outline.JavaEditor = javaEditor; } JavaSquiggles squiggles = null; if (buffer.Properties.TryGetProperty <JavaSquiggles>(typeof(JavaSquiggles), out squiggles)) { squiggles.JavaEditor = javaEditor; } } return(javaEditor); }
public JavaParser(JavaEditor javaEditor, ITextSnapshot textSnapshot) { Parent = javaEditor; TextSnapshot = textSnapshot; }