public void Update() { // If not still building, try reconfiguring the Java editor if (!Helpers.VSHelpers.IsBuildInProgress()) { JavaEditorFactory.Configure(TextView, SubjectBuffers); } }
void BuildTicker_Elapsed(object sender, ElapsedEventArgs e) { // If build is done, stop timer and try to reconfigure the Java editor if (!Helpers.VSHelpers.IsBuildInProgress()) { JavaEditorFactory.Configure(TextView, SubjectBuffers); BuildTicker.Enabled = false; } }
public void SubjectBuffersConnected(IWpfTextView textView, ConnectionReason reason, System.Collections.ObjectModel.Collection <Microsoft.VisualStudio.Text.ITextBuffer> subjectBuffers) { Telemetry.Client.Get().TrackEvent("App.EditorOpen"); TextViews.Add(textView); if (TextViews.Count == 1) { IdleCookie = RegisterIdleLoop(ServiceProvider, this); } var javaEditor = JavaEditorFactory.Configure(textView, subjectBuffers); if (javaEditor == null) { JavaEditorFactory.Unconfigure(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 // eclipseWorkspace = EclipseWorkspace.FromFilePath(fileName); //var javaPkgServer = JavaPkgServerMgr.GetProxy(eclipseWorkspace); //textView.Properties.AddProperty(typeof(ServerProxy), javaPkgServer); //JavaEditor javaEditor = null; //JavaUnconfiguredEditor javaUnconfiguredEditor = null; //if (javaPkgServer != null) //{ // 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 // { // // Usually preset when opening a source file from a .jar // javaEditor.TypeRootIdentifier = presetTypeRootIdentifier; // javaEditor.DisableParsing(); // No need to parse .class files for squiggles // } //} //else //{ // javaUnconfiguredEditor = textView.Properties.GetOrCreateSingletonProperty<JavaUnconfiguredEditor>(() => new JavaUnconfiguredEditor(subjectBuffers, textView, JavaPkgServerMgr, eclipseWorkspace)); // Telemetry.Client.Get().TrackEvent("App.EditorOpenUnconfigured"); //} textView.GotAggregateFocus += textView_GotAggregateFocus; //foreach(var buffer in subjectBuffers) //{ // buffer.Properties.AddProperty(typeof(ServerProxy), javaPkgServer); // if (javaUnconfiguredEditor != null) buffer.Properties.AddProperty(typeof(JavaUnconfiguredEditor), javaUnconfiguredEditor); // if (javaEditor != null) // { // 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; // } // } //} }