static string GenerateReferenceStub(IProgressMonitor monitor, ConfigurationSelector configurationSelector, DotNetProjectConfiguration configuration, ProjectReference reference)
        {
            StringBuilder result = new StringBuilder();

            foreach (string fileName in reference.GetReferencedFileNames(configurationSelector))
            {
                string name       = Path.GetFileNameWithoutExtension(Path.GetFileName(fileName));
                string outputName = Path.Combine(configuration.OutputDirectory, name + ".jar");
                if (!System.IO.File.Exists(outputName))
                {
                    monitor.Log.WriteLine(String.Format(GettextCatalog.GetString("Generating {0} reference stub ..."), name));
                    monitor.Log.WriteLine("ikvmstub \"" + fileName + "\"");
                    ProcessWrapper p = Runtime.ProcessService.StartProcess("ikvmstub", "\"" + fileName + "\"", configuration.OutputDirectory, monitor.Log, monitor.Log, null);
                    p.WaitForExit();
                    if (p.ExitCode != 0)
                    {
                        monitor.ReportError("Stub generation failed.", null);
                        if (File.Exists(outputName))
                        {
                            try {
                                File.Delete(outputName);
                            } catch {
                                // Ignore
                            }
                        }
                    }
                }
                AppendClasspath(result, outputName);
            }
            return(result.ToString());
        }
Esempio n. 2
0
        internal override void OnProjectReferenceRemoved(ProjectReference pref)
        {
            var netProject = Project as DotNetProject;

            if (netProject == null)
            {
                return;
            }

            var db = (ProjectCodeCompletionDatabase)database;

            if (pref.ReferenceType != ReferenceType.Project)
            {
                foreach (var fileName in pref.GetReferencedFileNames(ConfigurationSelector.Default))
                {
                    var uri = ProjectCodeCompletionDatabase.GetReferenceUri(netProject, fileName);
                    if (db.HasReference(uri))
                    {
                        db.RemoveReference(uri);
                    }
                }
            }
            else
            {
                var uri = "Project:" + pref.Reference;
                if (db.HasReference(uri))
                {
                    db.RemoveReference(uri);
                }
            }

            this.UpdateReferences();
        }
Esempio n. 3
0
        //HACK: we don't have the info to do this properly, really the package management addin should handle this
        static bool IsFromPackage(ProjectReference r)
        {
            if (r.ReferenceType != ReferenceType.Assembly)
            {
                return(false);
            }
            var packagesDir = r.Project.ParentSolution.BaseDirectory.Combine("packages");

            return(r.GetReferencedFileNames(null).Any(f => ((FilePath)f).IsChildPathOf(packagesDir)));
        }
        public override void ActivateItem()
        {
            ProjectReference pref = CurrentNode.DataItem as ProjectReference;

            if (pref != null)
            {
                foreach (string fileName in pref.GetReferencedFileNames(IdeApp.Workspace.ActiveConfiguration))
                {
                    IdeApp.Workbench.OpenDocument(fileName);
                }
            }
        }
 IEnumerable <string> GetReferenceKeys(ProjectReference pr)
 {
     if (pr.ReferenceType == ReferenceType.Project)
     {
         Project referencedProject = Project.ParentSolution.FindProjectByName(pr.Reference);
         yield return("Project:" + (referencedProject != null ? referencedProject.FileName : new FilePath("null")));
     }
     else
     {
         foreach (string s in pr.GetReferencedFileNames(ConfigurationSelector.Default))
         {
             yield return("Assembly:" + Path.GetFullPath(s));
         }
     }
 }
        public override void BuildChildNodes(ITreeBuilder builder, object dataObject)
        {
            ProjectReference          pref       = (ProjectReference)dataObject;
            Dictionary <string, bool> namespaces = new Dictionary <string, bool> ();
            bool nestedNs = builder.Options ["NestedNamespaces"];

            foreach (string fileName in pref.GetReferencedFileNames(IdeApp.Workspace.ActiveConfiguration))
            {
                ICompilationUnit unit = DomCecilCompilationUnit.Load(fileName, false, true);
                if (unit == null)
                {
                    continue;
                }
                foreach (IType type in unit.Types)
                {
                    if (type.IsSpecialName || type.Name.Contains("<") || type.Name.Contains(">") || type.Name.Contains("$"))
                    {
                        continue;
                    }
                    if (String.IsNullOrEmpty(type.Namespace))
                    {
                        builder.AddChild(new ClassData(null, type));
                        continue;
                    }
                    string ns = type.Namespace;
                    if (nestedNs)
                    {
                        int idx = ns.IndexOf('.');
                        if (idx >= 0)
                        {
                            ns = ns.Substring(0, idx);
                        }
                    }
                    if (namespaces.ContainsKey(ns))
                    {
                        continue;
                    }
                    namespaces[ns] = true;
                    builder.AddChild(new CompilationUnitNamespaceData(unit, ns));
                }
            }
        }
		IEnumerable<string> GetReferenceKeys (ProjectReference pr)
		{
			if (pr.ReferenceType == ReferenceType.Project) {
				Project referencedProject = Project.ParentSolution.FindProjectByName (pr.Reference);
				yield return "Project:" + (referencedProject != null ? referencedProject.FileName : new FilePath ("null"));
			} else {
				foreach (string s in pr.GetReferencedFileNames (ConfigurationSelector.Default))
					yield return "Assembly:" + Path.GetFullPath (s);
			}
		}
		internal override void OnProjectReferenceRemoved (ProjectReference pref)
		{
			var netProject = Project as DotNetProject;
			if (netProject == null)
				return;
			
			var db = (ProjectCodeCompletionDatabase) database;
			if (pref.ReferenceType != ReferenceType.Project) {
				foreach (var fileName in pref.GetReferencedFileNames (ConfigurationSelector.Default)){
					var uri = ProjectCodeCompletionDatabase.GetReferenceUri (netProject, fileName);
					if (db.HasReference (uri))
						db.RemoveReference (uri);
				}
			} else {
				var uri = "Project:"+ pref.Reference;
				if (db.HasReference (uri))
					db.RemoveReference (uri);
			}
			
			this.UpdateReferences ();
		}