Inheritance: SolutionEntityItem
Example #1
0
		/// <summary>
		/// Shows the getting started page for the given project.
		/// </summary>
		/// <param name="project">The project for which the getting started page should be shown</param>
		/// <param name="pageHint">A hint to the getting started page for cases when the provide may need assistance in determining the correct content to show</param>
		public static void ShowGettingStarted (Project project, string pageHint = null)
		{
			var provider = project.GetGettingStartedProvider ();
			if (provider != null) {
				provider.ShowGettingStarted (project, pageHint);
			}
		}
		public IViewContent CreateContent (MonoDevelop.Core.FilePath fileName, string mimeType, Project ownerProject)
		{
			var openFile = new GtkPlugOpenedFile();
			openFile.FileReference = fileName;
			openFile.SocketComms = new TcpListener(0);
			openFile.StartProcess = new Action(() =>
				{
					openFile.NetworkRequestLayer = new GtkPlugNetworkRequestLayer(openFile.SocketComms);
					Console.WriteLine("Instance process is listening on port " + ((IPEndPoint)openedFileList.SocketComms.Server.LocalEndPoint).Port);
					openFile.GtkPlugProcess = editor.SpawnHostProcessExecutable(openedFileList, 
						new string[]
						{
							"instance",
							((IPEndPoint)openFile.SocketComms.Server.LocalEndPoint).Port
								.ToString(System.Globalization.CultureInfo.InvariantCulture),
								//viewSocket.SocketID.ToString(System.Globalization.CultureInfo.InvariantCulture),
								fileName,
							});
					openFile.GtkPlugProcess.EnableRaisingEvents = true;
					openFile.NetworkRequestLayer.BlockUntilConnected();
				});
			openFile.StartProcess();
			openedFileList.OpenedFiles.Add(openFile);

			var viewSocket = new GtkSocketViewContent(openFile);
			return viewSocket;
		}
		public bool ValidateChanges (Project project)
		{
			data.setIntegrationEnabled(IntegrationEnabledCheckbox.Active);
			Console.Out.WriteLine("Called Validate Changes!\n");
			JamplusIntegrationConfig.setOptions(data);
			return true;
		}
Example #4
0
        public static void BuildChildNodes(ITreeBuilder builder, Project project)
        {
            if (project is DotNetProject)
            {
                builder.AddChild(((DotNetProject)project).References);
            }
            bool publicOnly = builder.Options ["PublicApiOnly"];
            var  dom        = TypeSystemService.GetCompilationAsync(project).Result;

            if (dom == null)
            {
                return;
            }
            bool             nestedNamespaces = builder.Options ["NestedNamespaces"];
            HashSet <string> addedNames       = new HashSet <string> ();

            foreach (var ns in dom.Assembly.GlobalNamespace.GetNamespaceMembers())
            {
                if (nestedNamespaces)
                {
                    if (!addedNames.Contains(ns.Name))
                    {
                        builder.AddChild(new ProjectNamespaceData(project, ns));
                        addedNames.Add(ns.Name);
                    }
                }
                else
                {
                    FillNamespaces(builder, project, ns);
                }
            }
            builder.AddChildren(dom.Assembly.GlobalNamespace.GetTypeMembers()
                                .Where(type => !publicOnly || type.DeclaredAccessibility == Accessibility.Public)
                                .Select(type => new ClassData(project, type)));
        }
		public PListEditorWidget (IPlistEditingHandler handler, Project proj, PDictionary plist)
		{
			var summaryScrolledWindow = new PListEditorSection ();
			AppendPage (summaryScrolledWindow, new Label (GettextCatalog.GetString ("Summary")));
			
			var advancedScrolledWindow = new PListEditorSection ();
			AppendPage (advancedScrolledWindow, new Label (GettextCatalog.GetString ("Advanced")));
			
			foreach (var section in handler.GetSections (proj, plist)) {
				var expander = new MacExpander () {
					ContentLabel = section.Name,
					Expandable = true,
				};
				expander.SetWidget (section.Widget);
				
				if (section.IsAdvanced) {
					advancedScrolledWindow.AddExpander (expander);
				} else {
					summaryScrolledWindow.AddExpander (expander);
				}
				
				if (section.CheckVisible != null) {
					expander.Visible = section.CheckVisible (plist);
					//capture section for closure
					var s = section;
					plist.Changed += delegate {
						expander.Visible = s.CheckVisible (plist);
					};
				}
			}
			Show ();
		}
        public static IEnumerable <string> GetDefinedSymbols(MonoDevelop.Projects.Project project)
        {
            var workspace = IdeApp.Workspace;

            if (workspace == null || project == null)
            {
                yield break;
            }
            var configuration = project.GetConfiguration(workspace.ActiveConfiguration) as DotNetProjectConfiguration;

            if (configuration != null)
            {
                var cparams = configuration.CompilationParameters as CSharpCompilerParameters;
                if (cparams != null)
                {
                    string[] syms = cparams.DefineSymbols.Split(';', ',', ' ', '\t');
                    foreach (string s in syms)
                    {
                        string ss = s.Trim();
                        if (ss.Length > 0)
                        {
                            yield return(ss);
                        }
                    }
                }
                // Workaround for mcs defined symbol
                if (configuration.TargetRuntime.RuntimeId == "Mono")
                {
                    yield return("__MonoCS__");
                }
            }
        }
        protected virtual async Task <Document> DoShow()
        {
            if (doc != null)
            {
                doc.Select();
                return(doc);
            }
            MonoDevelop.Projects.Project p = null;
            foreach (var curP in IdeApp.ProjectOperations.CurrentSelectedSolution.GetAllProjects())
            {
                if (curP.ItemId == project)
                {
                    p = curP;
                    break;
                }
            }

            //in case the document was reopened we want to set again
            var document = await IdeApp.Workbench.OpenDocument(new FileOpenInformation (fileName, p, true));

            if (isDocument)
            {
                SetDocument(document);
            }

            return(document);
        }
Example #8
0
		public GuiBuilderProject (Project project, string fileName)
		{
			this.fileName = fileName;
			this.Project = project;
			Counters.GuiProjectsLoaded++;
			//GuiBuilderService.NotifyGuiProjectLoaded ();
		}
        async Task UpdateStyleParent(MonoDevelop.Projects.Project styleParent, string mimeType)
        {
            RemovePolicyChangeHandler();

            if (string.IsNullOrEmpty(mimeType))
            {
                mimeType = "text/plain";
            }

            var mimeTypes = DesktopService.GetMimeTypeInheritanceChain(mimeType);

            if (styleParent != null)
            {
                policyContainer = styleParent.Policies;
            }
            else
            {
                policyContainer = MonoDevelop.Projects.Policies.PolicyService.DefaultPolicies;
            }
            var currentPolicy = policyContainer.Get <TextStylePolicy> (mimeTypes);

            policyContainer.PolicyChanged += HandlePolicyChanged;
            ((DefaultSourceEditorOptions)textEditor.Options).UpdateStylePolicy(currentPolicy);

            var context = await EditorConfigService.GetEditorConfigContext(textEditor.FileName, default(CancellationToken));

            if (context == null)
            {
                return;
            }
            ((DefaultSourceEditorOptions)textEditor.Options).SetContext(context);
        }
		public override bool AddToProject (SolutionItem parent, Project project, string language, string directory, string name)
		{
			// Replace template variables
			
			string cname = Path.GetFileNameWithoutExtension (name);
			string[,] tags = { 
				{"Name", cname},
			};
			
			string content = addinTemplate.OuterXml;
			content = StringParserService.Parse (content, tags);
			
			// Create the manifest
			
			XmlDocument doc = new XmlDocument ();
			doc.LoadXml (content);

			string file = Path.Combine (directory, "manifest.addin.xml");
			doc.Save (file);
			
			project.AddFile (file, BuildAction.EmbeddedResource);
			
			AddinData.EnableAddinAuthoringSupport ((DotNetProject)project);
			return true;
		}
		public void InstallPackages (
			string packageSourceUrl,
			Project project,
			IEnumerable<PackageManagementPackageReference> packages)
		{
			InstallPackages (packageSourceUrl, project, packages, licensesAccepted: false);
		}
        public ProjectFile AddFileToProject(SolutionItem policyParent, Project project, string language, string directory, string name)
        {
            generatedFile = SaveFile (policyParent, project, language, directory, name);
            if (generatedFile != null) {
                string buildAction = this.buildAction ?? project.GetDefaultBuildAction (generatedFile);
                ProjectFile projectFile = project.AddFile (generatedFile, buildAction);

                if (!string.IsNullOrEmpty (dependsOn)) {
                    Dictionary<string,string> tags = new Dictionary<string,string> ();
                    ModifyTags (policyParent, project, language, name, generatedFile, ref tags);
                    string parsedDepName = StringParserService.Parse (dependsOn, tags);
                    if (projectFile.DependsOn != parsedDepName)
                        projectFile.DependsOn = parsedDepName;
                }

                if (!string.IsNullOrEmpty (customTool))
                    projectFile.Generator = customTool;

                DotNetProject netProject = project as DotNetProject;
                if (netProject != null) {
                    // Add required references
                    foreach (string aref in references) {
                        string res = netProject.AssemblyContext.GetAssemblyFullName (aref, netProject.TargetFramework);
                        res = netProject.AssemblyContext.GetAssemblyNameForVersion (res, netProject.TargetFramework);
                        if (!ContainsReference (netProject, res))
                            netProject.References.Add (new ProjectReference (ReferenceType.Package, aref));
                    }
                }

                return projectFile;
            } else
                return null;
        }
Example #13
0
 public SuggestedHandlerCompletionData(MonoDevelop.Projects.Project project, CodeMemberMethod methodInfo, INamedTypeSymbol codeBehindClass, Location codeBehindClassLocation)
 {
     this.project                 = project;
     this.methodInfo              = methodInfo;
     this.codeBehindClass         = codeBehindClass;
     this.codeBehindClassLocation = codeBehindClassLocation;
 }
                MonoDevelop.Projects.Project GetProject(TextDocument doc)
                {
                    // There is no reference between document & higher level infrastructure,
                    // therefore it's a bit tricky to find the right project.

                    MonoDevelop.Projects.Project project = null;
                    var view = doc.Annotation <MonoDevelop.SourceEditor.SourceEditorView> ();

                    if (view != null)
                    {
                        project = view.Project;
                    }

                    if (project == null)
                    {
                        var ideDocument = IdeApp.Workbench.GetDocument(doc.FileName);
                        if (ideDocument != null)
                        {
                            project = ideDocument.Project;
                        }
                    }

                    if (project == null)
                    {
                        project = IdeApp.Workspace.GetProjectContainingFile(doc.FileName);
                    }

                    return(project);
                }
		public GeneralProjectOptionsWidget (Project project, OptionsDialog dialog)
		{
			Build ();
			
			this.project = project;
			this.dialog = dialog;
			
			nameLabel.UseUnderline = true;
			
			descriptionLabel.UseUnderline = true;

			projectNameEntry.Text = project.Name;
			projectDescriptionTextView.Buffer.Text = project.Description;

			if (project is DotNetProject) {
				projectDefaultNamespaceEntry.Text = ((DotNetProject)project).DefaultNamespace;
			} else if (project is SharedAssetsProject) {
				projectDefaultNamespaceEntry.Text = ((SharedAssetsProject)project).DefaultNamespace;
			} else {
				defaultNamespaceLabel.Visible = false;
				projectDefaultNamespaceEntry.Visible = false;
			}
			
			entryVersion.Text = project.Version;
			checkSolutionVersion.Active = project.SyncVersionWithSolution;
			entryVersion.Sensitive = !project.SyncVersionWithSolution;
		}
Example #16
0
		public override ParsedDocument Parse (bool storeAst, string fileName, TextReader reader, Project project = null)
		{
			var doc = new DefaultParsedDocument (fileName);
			doc.Flags |= ParsedDocumentFlags.NonSerializable;
			ProjectInformation pi = ProjectInformationManager.Instance.Get (project);
			
			string content = reader.ReadToEnd ();
			string[] contentLines = content.Split (new string[]{Environment.NewLine}, StringSplitOptions.None);
			
			var globals = new DefaultUnresolvedTypeDefinition ("", GettextCatalog.GetString ("(Global Scope)"));
			lock (pi) {
				// Add containers to type list
				foreach (LanguageItem li in pi.Containers ()) {
					if (null == li.Parent && FilePath.Equals (li.File, fileName)) {
						var tmp = AddLanguageItem (pi, globals, li, contentLines) as IUnresolvedTypeDefinition;
						if (null != tmp){ doc.TopLevelTypeDefinitions.Add (tmp); }
					}
				}
				
				// Add global category for unscoped symbols
				foreach (LanguageItem li in pi.InstanceMembers ()) {
					if (null == li.Parent && FilePath.Equals (li.File, fileName)) {
						AddLanguageItem (pi, globals, li, contentLines);
					}
				}
			}
			
			doc.TopLevelTypeDefinitions.Add (globals);
			return doc;
		}
		internal static GuiBuilderWindow GetWindow (string file, Project project)
		{
			if (!IdeApp.Workspace.IsOpen)
				return null;
			if (!GtkDesignInfo.HasDesignedObjects (project))
				return null;
			GtkDesignInfo info = GtkDesignInfo.FromProject (project);
			if (file.StartsWith (info.GtkGuiFolder))
				return null;
			var docId = TypeSystemService.GetDocumentId (project, file);
			if (docId == null)
				return null;
			var doc = TypeSystemService.GetCodeAnalysisDocument (docId);
			if (doc == null)
				return null;
			Microsoft.CodeAnalysis.SemanticModel semanticModel;
			try {
				semanticModel = doc.GetSemanticModelAsync ().Result;
			} catch {
				return null;
			}
			if (semanticModel == null)
				return null;
			var root = semanticModel.SyntaxTree.GetRoot ();
			foreach (var classDeclaration in root.DescendantNodesAndSelf (child => !(child is BaseTypeDeclarationSyntax)).OfType<ClassDeclarationSyntax> ()) {
				var c = semanticModel.GetDeclaredSymbol (classDeclaration);
				GuiBuilderWindow win = info.GuiBuilderProject.GetWindowForClass (c.ToDisplayString (Microsoft.CodeAnalysis.SymbolDisplayFormat.CSharpErrorMessageFormat));
				if (win != null)
					return win;
			}
			return null;
		}
		public override DeployFileCollection GetProjectDeployFiles (DeployContext ctx, Project project, ConfigurationSelector config)
		{
			DeployFileCollection col = base.GetProjectDeployFiles (ctx, project, config);
			
			LinuxDeployData data = LinuxDeployData.GetLinuxDeployData (project);
			
			if (ctx.Platform == "Linux") {
				DotNetProject netProject = project as DotNetProject;
				if (netProject != null) {
					DotNetProjectConfiguration conf = netProject.GetConfiguration (config) as DotNetProjectConfiguration;
					if (conf != null) {
						if (conf.CompileTarget == CompileTarget.Exe || conf.CompileTarget == CompileTarget.WinExe) {
							if (data.GenerateScript) {
								col.Add (GenerateLaunchScript (ctx, netProject, data, conf));
							}
						}
						if (conf.CompileTarget == CompileTarget.Library || conf.CompiledOutputName.FileName.EndsWith (".dll")) {
							if (data.GeneratePcFile) {
								col.Add (GeneratePcFile (ctx, netProject, data, conf));
							}
						}
					}
				}
			}
			
			// If the project is deploying an app.desktop file, rename it to the name of the project.
			foreach (DeployFile file in col) {
				if (Path.GetFileName (file.RelativeTargetPath) == "app.desktop") {
					string dir = Path.GetDirectoryName (file.RelativeTargetPath);
					file.RelativeTargetPath = Path.Combine (dir, data.PackageName + ".desktop");
				}
			}
			
			return col;
		}
Example #19
0
        void ISupportsProjectReload.Update(MonoDevelop.Projects.Project project)
        {
            if (gproject != null && gproject.Project == project)
            {
                return;
            }

            if (designer != null)
            {
                designerStatus = designer.SaveStatus();
            }

            CloseDesigner();
            CloseProject();
            if (project != null)
            {
                GuiBuilderWindow w = GuiBuilderDisplayBinding.GetWindow(this.ContentName, project);
                if (w != null)
                {
                    AttachWindow(w);
                    if (designerStatus != null)
                    {
                        designer.LoadStatus(designerStatus);
                    }
                    designerStatus = null;
                }
            }
        }
		public override bool ShouldEnableFor (Project proj, string creationPath, string language)
		{
			if (proj == null)
				//FIXME: check the language's capabilities
				return false;
			
			DotNetProject dnp = proj as DotNetProject;
			if (dnp == null)
				return false;

			bool supported = dnp.SupportsPartialTypes;
			bool enabled = dnp.UsePartialTypes;
			
			switch (filter) {
			case PartialTypeRequirement.None:
				return true;
			case PartialTypeRequirement.Unsupported:
				return (supported == false);
			case PartialTypeRequirement.Supported:
				return (supported == true);
			case PartialTypeRequirement.Disabled:
				return (enabled == false);	
			case PartialTypeRequirement.Enabled:
				return (enabled == true);
			}
			
			return true;
		}
		public SuggestedHandlerCompletionData (MonoDevelop.Projects.Project project, CodeMemberMethod methodInfo, INamedTypeSymbol codeBehindClass, Location codeBehindClassLocation)
		{
			this.project = project;
			this.methodInfo = methodInfo;
			this.codeBehindClass = codeBehindClass;
			this.codeBehindClassLocation = codeBehindClassLocation;
		}
		public override bool ShouldEnableFor (Project proj, string creationPath)
		{
			if (condition == ClrVersionCondition.None)
				return true;
			
			DotNetProject dnp = proj as DotNetProject;
			if (dnp != null) {
				ClrVersion pver = dnp.TargetFramework.ClrVersion;
				switch (condition) {
				case ClrVersionCondition.Equal:
					return (pver == clrVersion);
				case ClrVersionCondition.NotEqual:
					return (pver != clrVersion);
				case ClrVersionCondition.GreaterThan:
					return (pver > clrVersion);
				case ClrVersionCondition.GreaterThanOrEqual:
					return (pver >= clrVersion);
				case ClrVersionCondition.LessThan:
					return (pver < clrVersion);
				case ClrVersionCondition.LessThanOrEqual:
					return (pver <= clrVersion);							
				}
			}
			
			return false;
		}
		public override DeployFileCollection GetProjectDeployFiles (DeployContext ctx, Project project, 
		                                                            ConfigurationSelector configuration)
		{
			DeployFileCollection files = base.GetProjectDeployFiles (ctx, project, configuration);
			
			AspNetAppProject aspProj = project as AspNetAppProject;
			
			//none of this needs to happen if it's just happening during solution build
			if (aspProj == null || ctx.ProjectBuildOnly)
				return files;
			
			//audit the DeployFiles to make sure they're allowed and laid out for ASP.NET
			foreach (DeployFile df in files) {
				//rewrite ProgramFiles target to ASP.NET's "bin" target
				if (df.TargetDirectoryID == TargetDirectory.ProgramFiles) {
					df.RelativeTargetPath = Path.Combine ("bin", df.RelativeTargetPath);
				}
			}
			
			//add all ASP.NET files marked as content. They go relative to the application root, which we assume to be ProgramFiles
			foreach (ProjectFile pf in aspProj.Files) {
				if (pf.BuildAction == BuildAction.Content)
					files.Add (new DeployFile (aspProj, pf.FilePath, pf.ProjectVirtualPath, TargetDirectory.ProgramFiles));
			}
			
			return files;
		}
		public SuggestedHandlerCompletionData (Project project, CodeMemberMethod methodInfo, IType codeBehindClass, IType codeBehindClassPart)
		{
			this.project = project;
			this.methodInfo = methodInfo;
			this.codeBehindClass = codeBehindClass;
			this.codeBehindClassPart = codeBehindClassPart;
		}
Example #25
0
		void GetFolderContent (Project project, string folder, out ProjectFileCollection files, out ArrayList folders)
		{
			files = new ProjectFileCollection ();
			folders = new ArrayList ();
			string folderPrefix = folder + Path.DirectorySeparatorChar;
			
			foreach (ProjectFile file in project.Files)
			{
				string dir;

				if (file.Subtype != Subtype.Directory) {
					if (file.DependsOnFile != null)
						continue;
					
					dir = file.IsLink
						? project.BaseDirectory.Combine (file.ProjectVirtualPath).ParentDirectory
						: file.FilePath.ParentDirectory;
						
					if (dir == folder) {
						files.Add (file);
						continue;
					}
				} else
					dir = file.Name;
				
				// add the directory if it isn't already present
				if (dir.StartsWith (folderPrefix)) {
					int i = dir.IndexOf (Path.DirectorySeparatorChar, folderPrefix.Length);
					if (i != -1) dir = dir.Substring (0,i);
					if (!folders.Contains (dir))
						folders.Add (dir);
				}
			}
		}
		public void LoadPanelContents (Project project, ItemConfiguration[] configurations)
		{
			this.configurations = configurations;
			
			int signAsm = -1;
			
			keyFile = null;
			foreach (DotNetProjectConfiguration c in configurations) {
				int r = c.SignAssembly ? 1 : 0;
				if (signAsm == -1)
					signAsm = r;
				else if (signAsm != r)
					signAsm = 2;
				if (keyFile == null)
					keyFile = c.AssemblyKeyFile;
				else if (keyFile != c.AssemblyKeyFile)
					keyFile = "?";
			}
			
			if (signAsm == 2)
				signAssemblyCheckbutton.Inconsistent = true;
			else {
				signAssemblyCheckbutton.Inconsistent = false;
				signAssemblyCheckbutton.Active = signAsm == 1;
			}
			
			if (keyFile == null || keyFile == "?")
				this.strongNameFileEntry.Path = string.Empty;
			else
				this.strongNameFileEntry.Path = keyFile;
			
			this.strongNameFileEntry.DefaultPath = project.BaseDirectory;
			this.strongNameFileLabel.Sensitive = this.strongNameFileEntry.Sensitive = signAsm != 0;
			this.signAssemblyCheckbutton.Toggled += new EventHandler (SignAssemblyCheckbuttonActivated);
		}
Example #27
0
        public virtual void DoUpdateFileTags(MonoDevelop.Projects.Project project, string filename, IEnumerable <string> headers)
        {
            ProjectInformation info = ProjectInformationManager.Instance.Get(project);

            lock (info) {
                info.RemoveFileInfo(filename);

                IEnumerable <string> tags = GetTags(project, filename, headers);
                if (tags == null)
                {
                    return;
                }

                foreach (string tagEntry in tags)
                {
                    if (tagEntry.StartsWith("!_"))
                    {
                        continue;
                    }

                    Tag tag = ParseTag(tagEntry);

                    if (tag != null)
                    {
                        AddInfo(info, tag, tagEntry);
                    }
                }
            }
        }
		public override string CreateContent (Project project, Dictionary<string, string> tags, string language)
		{
			if (language == null || language == "")
				throw new InvalidOperationException ("Language not defined in CodeDom based template.");
			
			var binding = GetLanguageBinding (language);
			
			CodeDomProvider provider = null;
			if (binding != null)
				provider = binding.GetCodeDomProvider ();
			
			if (provider == null)
				throw new InvalidOperationException ("The language '" + language + "' does not have support for CodeDom.");

			var xcd = new XmlCodeDomReader ();
			var cu = xcd.ReadCompileUnit (domContent);
			
			foreach (CodeNamespace cns in cu.Namespaces)
				cns.Name = StripImplicitNamespace (project, tags, cns.Name);
			
			CodeGeneratorOptions options = new CodeGeneratorOptions ();
			options.IndentString = "\t";
			options.BracingStyle = "C";
			
			StringWriter sw = new StringWriter ();
			provider.GenerateCodeFromCompileUnit (cu, sw, options);
			sw.Close ();
			
			return StripHeaderAndBlankLines (sw.ToString (), provider);
		}
        public bool CanHandle(FilePath fileName, string mimeType, MonoDevelop.Projects.Project ownerProject)
        {
            if (excludeThis)
            {
                return(false);
            }

            if (fileName.IsNullOrEmpty)
            {
                return(false);
            }

            if (!IdeApp.Workspace.IsOpen)
            {
                return(false);
            }

            if (GetActionGroup(fileName) == null)
            {
                return(false);
            }

            excludeThis = true;
            var db = DisplayBindingService.GetDefaultViewBinding(fileName, mimeType, ownerProject);

            excludeThis = false;
            return(db != null);
        }
		static Task<AnalyzersFromAssembly> GetProjectDiagnosticsAsync (Project project, string language, CancellationToken cancellationToken)
		{
			if (project == null)
				return Task.FromResult (AnalyzersFromAssembly.Empty);
			AnalyzersFromAssembly result;
			if (diagnosticCache.TryGetValue(project, out result)) 
				return Task.FromResult (result);

			result = new AnalyzersFromAssembly ();

			var dotNetProject = project as DotNetProject;
			if (dotNetProject != null) {
				var proxy = new DotNetProjectProxy (dotNetProject);
				if (proxy.HasPackages ()) {
					var packagesPath = new SolutionPackageRepositoryPath (proxy);
					foreach (var file in Directory.EnumerateFiles (packagesPath.PackageRepositoryPath, "*.dll", SearchOption.AllDirectories)) {
						cancellationToken.ThrowIfCancellationRequested ();
						try {
							var asm = Assembly.LoadFrom (file);
							result.AddAssembly (asm);
						} catch (Exception) {
						}
					}
				}
			}
			diagnosticCache[project] = result;
			return Task.FromResult (result);
		}
		void IDisposable.Dispose ()
		{
			if (project != null) {
				project.FilePropertyChangedInProject -= OnFilePropertyChangedInProject;
				project = null;
			}
		}
		public virtual DeployFileCollection GetProjectDeployFiles (DeployContext ctx, Project project, ConfigurationSelector configuration)
		{
			if (Next != null)
				return Next.GetDeployFiles (ctx, project, configuration);
			else
				return new DeployFileCollection ();
		}
Example #33
0
            internal async Task <ProjectInfo> LoadProjectIfCacheOutOfDate(MonoDevelop.Projects.Project p, string framework, CancellationToken token)
            {
                if (!workspaceCache.TryGetCachedItems(p, workspace.MetadataReferenceManager, projectMap, framework, out var cacheInfo))
                {
                    // No cached info need to load the project
                    return(await LoadProject(p, token, null, null, framework).ConfigureAwait(false));
                }

                var config = await GetDotNetProjectConfiguration(p, framework);

                var updatedCacheInfo = await LoadProjectCacheInfo(p, config, framework, token).ConfigureAwait(false);

                if (updatedCacheInfo == null)
                {
                    return(null);
                }

                workspaceCache.OnCacheInfoUsed(p);

                if (updatedCacheInfo.Equals(cacheInfo))
                {
                    return(null);
                }

                // Update cache.
                if (config != null)
                {
                    workspaceCache.Update(config, framework, p, projectMap, updatedCacheInfo);
                }

                return(await LoadProject(p, token, null, updatedCacheInfo, framework).ConfigureAwait(false));
            }
		public ProjectFileSelectorDialog (Project project, string defaultFilterName, string defaultFilterPattern, string [] buildActions)
		{
			this.project = project;
			this.defaultFilter = new SelectFileDialogFilter (defaultFilterName, defaultFilterPattern ?? "*");
			this.buildActions = buildActions;
			
			this.Build();
			
			projBuf = ImageService.GetIcon (project.StockIcon, IconSize.Menu);
			dirClosedBuf = ImageService.GetIcon (MonoDevelop.Ide.Gui.Stock.ClosedFolder, IconSize.Menu);
			dirOpenBuf = ImageService.GetIcon (MonoDevelop.Ide.Gui.Stock.OpenFolder, IconSize.Menu);
			
			TreeViewColumn projectCol = new TreeViewColumn ();
			projectCol.Title = GettextCatalog.GetString ("Project Folders");
			var pixRenderer = new CellRendererImage ();
			CellRendererText txtRenderer = new CellRendererText ();
			projectCol.PackStart (pixRenderer, false);
			projectCol.PackStart (txtRenderer, true);
			projectCol.SetCellDataFunc (pixRenderer, new TreeCellDataFunc (PixDataFunc));
			projectCol.SetCellDataFunc (txtRenderer, new TreeCellDataFunc (TxtDataFunc));
			projectTree.Model = dirStore;
			projectTree.AppendColumn (projectCol);
			TreeIter projectIter = dirStore.AppendValues ("", FilePath.Empty);
			InitDirs (projectIter);
			projectTree.ExpandAll ();
			projectTree.RowActivated += delegate {
				fileList.GrabFocus ();
			};
			projectTree.KeyPressEvent += ProjectListKeyPressEvent;
			
			TreeViewColumn fileCol = new TreeViewColumn ();
			var filePixRenderer = new CellRendererImage ();
			fileCol.Title = GettextCatalog.GetString ("Files");
			fileCol.PackStart (filePixRenderer, false);
			fileCol.PackStart (txtRenderer, true);
			fileCol.AddAttribute (filePixRenderer, "image", 1);
			fileCol.SetCellDataFunc (txtRenderer, new TreeCellDataFunc (TxtFileDataFunc));
			fileList.Model = fileStore;
			fileList.AppendColumn (fileCol);
			fileList.RowActivated += delegate {
				TreeIter iter;
				if (fileList.Selection.GetSelected (out iter))
					Respond (ResponseType.Ok);
			};
			fileList.KeyPressEvent += FileListKeyPressEvent;
			fileList.KeyReleaseEvent += FileListKeyReleaseEvent;
			
			TreeIter root;
			if (dirStore.GetIterFirst (out root))
				projectTree.Selection.SelectIter (root);
			
			UpdateFileList (null, null);
			
			projectTree.Selection.Changed += UpdateFileList;
			fileList.Selection.Changed += UpdateSensitivity;
			
			
			this.DefaultResponse = ResponseType.Cancel;
			this.Modal = true;
		}
Example #35
0
 public FileProvider(string fileName, Project project, int selectionStartPostion, int selectionEndPosition)
 {
     FileName = fileName;
     Project = project;
     SelectionStartPosition = selectionStartPostion;
     SelectionEndPosition = selectionEndPosition;
 }
Example #36
0
        public override void BuildNode(ITreeBuilder treeBuilder, object dataObject, NodeInfo nodeInfo)
        {
            Project p = dataObject as Project;

            nodeInfo.Label = p.Name;
            nodeInfo.Icon  = Context.GetIcon(p.StockIcon);
        }
Example #37
0
		public Enumeration (Tag tag, Project project, string ctags_output) : base (tag, project)
		{
			if (GetNamespace (tag, ctags_output)) return;
			if (GetClass (tag, ctags_output)) return;
			if (GetStructure (tag, ctags_output)) return;
			if (GetUnion (tag, ctags_output)) return;
		}
Example #38
0
        public static CSharpFormattingOptions GetFormattingOptions(this MonoDevelop.Projects.Project project)
        {
            var types      = MonoDevelop.Ide.DesktopService.GetMimeTypeInheritanceChain(MonoDevelop.CSharp.Formatting.CSharpFormatter.MimeType);
            var codePolicy = project != null?project.Policies.Get <MonoDevelop.CSharp.Formatting.CSharpFormattingPolicy> (types) :
                                 MonoDevelop.Projects.Policies.PolicyService.GetDefaultPolicy <MonoDevelop.CSharp.Formatting.CSharpFormattingPolicy> (types);

            return(codePolicy.CreateOptions());
        }
		public bool CanHandle (FilePath fileName, string mimeType, Project ownerProject)
		{
			if (ownerProject == null || !XcodeProjectTracker.TrackerEnabled || !(ownerProject is IXcodeTrackedProject))
				return false;
			if (mimeType == "application/vnd.apple-interface-builder")
				return true;
			return fileName.IsNotNull && fileName.HasExtension (".xib");
		}
		public IViewContent CreateContent (FilePath filePath, string mimeType, Project project)
		{
			foreach (TranslationProject tp in IdeApp.Workspace.GetAllItems<TranslationProject>  ())
				if (tp.BaseDirectory == Path.GetDirectoryName (filePath))
					return new Editor.CatalogEditorView (tp, filePath);
			
			return new Editor.CatalogEditorView (null, filePath);
		}
 //FIXME: why is file loaded separately from constructor?
 public ResXEditorView(string resxFile, Project project)
 {
     catalog = new ResourceCatalog (project);
     resXEditorWidget = new ResXEditorWidget ();
     catalog.DirtyChanged += delegate (object sender, EventArgs args) {
         IsDirty = catalog.IsDirty;
     };
 }
		public LanguageItem (Tag tag, Project project)
		{
			this.project = project;
			this.name = tag.Name;
			this.file = tag.File;
			this.line = tag.Line;
			this.access = tag.Access;
		}
Example #43
0
        public CodeBinder(MonoDevelop.Projects.Project project, ITextFileProvider textFileProvider, Stetic.Component targetObject)
        {
            this.project          = project;
            this.textFileProvider = textFileProvider;

            gproject = GtkDesignInfo.FromProject(project).GuiBuilderProject;

            TargetObject = targetObject;
        }
Example #44
0
        public void InitializeItem(SolutionItem policyParent, ProjectCreateInformation projectCreateInformation, string defaultLanguage, SolutionEntityItem item)
        {
            MonoDevelop.Projects.Project project = item as MonoDevelop.Projects.Project;

            if (project == null)
            {
                MessageService.ShowError(GettextCatalog.GetString("Can't create project with type: {0}", type));
                return;
            }

            string pname = StringParserService.Parse(name, new string[, ] {
                {
                    "ProjectName",
                    projectCreateInformation.ProjectName
                }
            });

            // Set the file before setting the name, to make sure the file extension is kept
            project.FileName = Path.Combine(projectCreateInformation.ProjectBasePath, pname);
            project.Name     = pname;

            var dnp = project as DotNetProject;

            if (dnp != null)
            {
                if (policyParent.ParentSolution != null && !policyParent.ParentSolution.FileFormat.SupportsFramework(dnp.TargetFramework))
                {
                    SetClosestSupportedTargetFramework(policyParent.ParentSolution.FileFormat, dnp);
                }
                foreach (ProjectReference projectReference in references)
                {
                    dnp.References.Add(projectReference);
                }
            }

            foreach (SingleFileDescriptionTemplate resourceTemplate in resources)
            {
                try {
                    ProjectFile projectFile = new ProjectFile(resourceTemplate.SaveFile(policyParent, project, defaultLanguage, project.BaseDirectory, null));
                    projectFile.BuildAction = BuildAction.EmbeddedResource;
                    project.Files.Add(projectFile);
                } catch (Exception ex) {
                    MessageService.ShowException(ex, GettextCatalog.GetString("File {0} could not be written.", resourceTemplate.Name));
                    LoggingService.LogError(GettextCatalog.GetString("File {0} could not be written.", resourceTemplate.Name), ex);
                }
            }

            foreach (FileDescriptionTemplate fileTemplate in files)
            {
                try {
                    fileTemplate.AddToProject(policyParent, project, defaultLanguage, project.BaseDirectory, null);
                } catch (Exception ex) {
                    MessageService.ShowException(ex, GettextCatalog.GetString("File {0} could not be written.", fileTemplate.Name));
                    LoggingService.LogError(GettextCatalog.GetString("File {0} could not be written.", fileTemplate.Name), ex);
                }
            }
        }
Example #45
0
 VersionStamp GetVersionStamp(MonoDevelop.Projects.Project project)
 {
     try {
         return(VersionStamp.Create(File.GetLastWriteTimeUtc(project.FileName)));
     } catch (Exception e) {
         LoggingService.LogInternalError("Failed to create version stamp", e);
         return(VersionStamp.Create());
     }
 }
Example #46
0
        public VsTestUnitTest(IVsTestTestRunner testRunner, TestCase test, MonoDevelop.Projects.Project project)
            : base(test.DisplayName)
        {
            this.Project    = project;
            this.testRunner = testRunner;
            this.test       = test;

            Init();
        }
Example #47
0
            static bool CanGenerateAnalysisContextForNonCompileable(MonoDevelop.Projects.Project p, MonoDevelop.Projects.ProjectFile f)
            {
                var mimeType = IdeServices.DesktopService.GetMimeTypeForUri(f.FilePath);
                var node     = IdeApp.TypeSystemService.GetTypeSystemParserNode(mimeType, f.BuildAction);

                if (node?.Parser == null)
                {
                    return(false);
                }
                return(node.Parser.CanGenerateAnalysisDocument(mimeType, f.BuildAction, p.SupportedLanguages));
            }
Example #48
0
        void AddProjectContent(ITreeBuilder builder, Project p)
        {
            builder.AddChildren(namesp.GetNamespaceMembers()
                                .Where(ns => !builder.HasChild(ns.Name, typeof(NamespaceData)))
                                .Select(ns => new ProjectNamespaceData(project, ns)));
            //			bool nestedNs = builder.Options ["NestedNamespaces"];
            bool publicOnly = builder.Options ["PublicApiOnly"];

            builder.AddChildren(namesp.GetAllTypes()
                                .Where(type => !publicOnly || type.DeclaredAccessibility == Accessibility.Public)
                                .Select(type => new ClassData(project, type)));
        }
Example #49
0
        public IViewContent CreateContent(FilePath fileName, string mimeType, MonoDevelop.Projects.Project ownerProject)
        {
            excludeThis = true;
            var           db   = DisplayBindingService.GetDefaultViewBinding(fileName, mimeType, ownerProject);
            GtkDesignInfo info = GtkDesignInfo.FromProject((DotNetProject)ownerProject);

            var             content = db.CreateContent(fileName, mimeType, ownerProject);
            ActionGroupView view    = new ActionGroupView(content, GetActionGroup(fileName), info.GuiBuilderProject);

            excludeThis = false;
            return(view);
        }
        public ImportsOptionsPanelWidget(MonoDevelop.Projects.Project project)
        {
            this.Build();

            this.project   = (DotNetProject)project;
            currentImports = new List <Import> (project.Items.GetAll <Import> ());

            treeview1.AppendColumn("Import", new Gtk.CellRendererText(), "text", 0);
            treeview1.Model = imports;
            imports.SetSortColumnId(0, Gtk.SortType.Ascending);
            LoadImports();
        }
Example #51
0
        public static CSharpParseOptions GetCompilerArguments(MonoDevelop.Projects.Project project)
        {
            var compilerArguments = new CSharpParseOptions();

            //		compilerArguments.TabSize = 1;

            if (project == null || MonoDevelop.Ide.IdeApp.Workspace == null)
            {
                // compilerArguments.AllowUnsafeBlocks = true;
                return(compilerArguments);
            }

            var configuration = project.GetConfiguration(MonoDevelop.Ide.IdeApp.Workspace.ActiveConfiguration) as DotNetProjectConfiguration;

            if (configuration == null)
            {
                return(compilerArguments);
            }

            compilerArguments = compilerArguments.WithPreprocessorSymbols(configuration.GetDefineSymbols());

            var par = configuration.CompilationParameters as CSharpCompilerParameters;

            if (par == null)
            {
                return(compilerArguments);
            }


            // compilerArguments.AllowUnsafeBlocks = par.UnsafeCode;
            compilerArguments = compilerArguments.WithLanguageVersion(ConvertLanguageVersion(par.LangVersion));
//			compilerArguments.CheckForOverflow = par.GenerateOverflowChecks;

//			compilerArguments.WarningLevel = par.WarningLevel;
//			compilerArguments.TreatWarningsAsErrors = par.TreatWarningsAsErrors;
//			if (!string.IsNullOrEmpty (par.NoWarnings)) {
//				foreach (var warning in par.NoWarnings.Split (';', ',', ' ', '\t')) {
//					int w;
//					try {
//						w = int.Parse (warning);
//					} catch (Exception) {
//						continue;
//					}
//					compilerArguments.DisabledWarnings.Add (w);
//				}
//			}

            return(compilerArguments);
        }
Example #52
0
        public static CompilerSettings GetCompilerArguments(MonoDevelop.Projects.Project project)
        {
            var compilerArguments = new CompilerSettings();

            compilerArguments.TabSize = 1;

            if (project == null || MonoDevelop.Ide.IdeApp.Workspace == null)
            {
                compilerArguments.Unsafe = true;
                return(compilerArguments);
            }

            var configuration = project.GetConfiguration(MonoDevelop.Ide.IdeApp.Workspace.ActiveConfiguration) as DotNetProjectConfiguration;
            var par           = configuration != null ? configuration.CompilationParameters as CSharpCompilerParameters : null;

            if (par == null)
            {
                return(compilerArguments);
            }

            if (!string.IsNullOrEmpty(par.DefineSymbols))
            {
                foreach (var sym in par.DefineSymbols.Split(';', ',', ' ', '\t').Where(s => !string.IsNullOrWhiteSpace(s)))
                {
                    compilerArguments.AddConditionalSymbol(sym);
                }
            }

            compilerArguments.Unsafe           = par.UnsafeCode;
            compilerArguments.Version          = ConvertLanguageVersion(par.LangVersion);
            compilerArguments.Checked          = par.GenerateOverflowChecks;
            compilerArguments.WarningLevel     = par.WarningLevel;
            compilerArguments.EnhancedWarnings = par.TreatWarningsAsErrors;
            if (!string.IsNullOrEmpty(par.NoWarnings))
            {
                foreach (var warning in par.NoWarnings.Split(';', ',', ' ', '\t'))
                {
                    int w;
                    try {
                        w = int.Parse(warning);
                    } catch (Exception) {
                        continue;
                    }
                    compilerArguments.SetIgnoreWarning(w);
                }
            }

            return(compilerArguments);
        }
Example #53
0
 internal static IEnumerable <string> GetFrameworks(MonoDevelop.Projects.Project p)
 {
     if (p.HasMultipleTargetFrameworks && p is DotNetProject dotNetProject)
     {
         var frameworks = dotNetProject.TargetFrameworkMonikers;
         foreach (var framework in frameworks)
         {
             yield return(framework.ShortName);
         }
     }
     else
     {
         yield return(null);
     }
 }
        public Task <Compilation> GetCompilationAsync(MonoDevelop.Projects.Project project, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (project == null)
            {
                throw new ArgumentNullException(nameof(project));
            }

            var roslynProject = GetProject(project, cancellationToken);

            if (roslynProject != null)
            {
                return(roslynProject.GetCompilationAsync(cancellationToken));
            }
            return(Task.FromResult(default(Compilation)));
        }
 public static Microsoft.CodeAnalysis.Project GetCodeAnalysisProject(MonoDevelop.Projects.Project project)
 {
     if (project == null)
     {
         throw new ArgumentNullException(nameof(project));
     }
     foreach (var w in workspaces)
     {
         var projectId = w.GetProjectId(project);
         if (projectId != null)
         {
             return(w.CurrentSolution.GetProject(projectId));
         }
     }
     return(null);
 }
Example #56
0
        public bool CanHandle(MonoDevelop.Core.FilePath fileName, string mimeType, MonoDevelop.Projects.Project ownerProject)
        {
            if (exclude)
            {
                return(false);
            }

            if (mimeType != null && mimeType == "application/x-xeto")
            {
                return(true);
            }

            var info = Eto.Designer.BuilderInfo.Find(fileName);

            return(info != null);
        }
Example #57
0
            /// <summary>
            /// This checks that the new project was modified whilst it was being added to the
            /// workspace and re-plays project modifications to the workspace as though they
            /// happened after the project was added. This ensures any updated references due to
            /// a NuGet restore are made available to the type system.
            /// </summary>
            internal void ReloadModifiedProject(MonoDevelop.Projects.Project project)
            {
                lock (workspace.projectModifyLock) {
                    if (!workspace.modifiedProjects.Any())
                    {
                        return;
                    }

                    int removed = workspace.modifiedProjects.RemoveAll(p => p == project);
                    if (removed > 0)
                    {
                        var args = new MonoDevelop.Projects.SolutionItemModifiedEventArgs(project, "References");
                        workspace.OnProjectModified(project, args);
                    }
                }
            }
 public static Microsoft.CodeAnalysis.ProjectId GetProjectId(MonoDevelop.Projects.Project project)
 {
     if (project == null)
     {
         throw new ArgumentNullException("project");
     }
     foreach (var w in workspaces)
     {
         var projectId = w.GetProjectId(project);
         if (projectId != null)
         {
             return(projectId);
         }
     }
     return(null);
 }
Example #59
0
            async Task <ProjectCacheInfo> LoadProjectCacheInfo(
                MonoDevelop.Projects.Project p,
                DotNetProjectConfiguration config,
                string framework,
                CancellationToken token)
            {
                await TypeSystemService.SafeFreezeLoad().ConfigureAwait(false);

                if (token.IsCancellationRequested)
                {
                    return(null);
                }

                var(references, projectReferences) = await metadataHandler.Value.CreateReferences(p, framework, token).ConfigureAwait(false);

                if (token.IsCancellationRequested)
                {
                    return(null);
                }

                var configSelector = config?.Selector;

                if (p is MonoDevelop.Projects.DotNetProject && configSelector != null && !string.IsNullOrEmpty(framework))
                {
                    configSelector = new MonoDevelop.Projects.DotNetProjectFrameworkConfigurationSelector(config.Selector, framework);
                }

                await TypeSystemService.SafeFreezeLoad().ConfigureAwait(false);

                var sourceFiles = await p.GetSourceFilesAsync(configSelector).ConfigureAwait(false);

                if (token.IsCancellationRequested)
                {
                    return(null);
                }

                await TypeSystemService.SafeFreezeLoad().ConfigureAwait(false);

                var analyzerFiles = await p.GetAnalyzerFilesAsync(configSelector).ConfigureAwait(false);

                return(new ProjectCacheInfo {
                    AnalyzerFiles = analyzerFiles,
                    SourceFiles = sourceFiles,
                    ProjectReferences = projectReferences,
                    References = references
                });
            }
 internal Microsoft.CodeAnalysis.Project GetProject(MonoDevelop.Projects.Project project, CancellationToken cancellationToken = default(CancellationToken))
 {
     foreach (var w in workspaces)
     {
         var projectId = w.GetProjectId(project);
         if (projectId == null)
         {
             continue;
         }
         var roslynProject = w.CurrentSolution.GetProject(projectId);
         if (roslynProject == null)
         {
             continue;
         }
         return(roslynProject);
     }
     return(null);
 }