void AddEntry (TreeIter iter, SolutionFolderItem entry)
		{
			string icon;
			if (entry.ParentFolder == null)
				icon = MonoDevelop.Ide.Gui.Stock.Solution;
			else if (entry is SolutionFolder)
				icon = MonoDevelop.Ide.Gui.Stock.SolutionFolderClosed;
			else if (entry is Project)
				icon = ((Project)entry).StockIcon;
			else
				icon = MonoDevelop.Ide.Gui.Stock.Project;
			
			bool visible = builder.CanBuild (entry);
			bool selected = selectedEntries.ContainsKey (entry);
			
			if (!(entry is SolutionFolder) && !visible)
				return;
			
			if (!iter.Equals (TreeIter.Zero))
				iter = store.AppendValues (iter, icon, entry.Name, entry, selected && visible, visible);
			else
				iter = store.AppendValues (icon, entry.Name, entry, selected && visible, visible);
			
			if (selected)
				tree.ExpandToPath (store.GetPath (iter));
			
			if (entry is SolutionFolder) {
				foreach (SolutionFolderItem ce in ((SolutionFolder)entry).Items) {
					AddEntry (iter, ce);
				}
			}
		}
		public bool CanDeploy (SolutionFolderItem entry, MakefileType type)
		{
			Project project = entry as Project;
			if ( project == null ) return false;
			if ( FindSetupForProject ( project ) == null ) return false;
			return true;
		}
		public override DeployFileCollection GetDeployFiles (DeployContext ctx, SolutionFolderItem entry, ConfigurationSelector configuration)
		{
			if (entry is IDeployable)
				return new DeployFileCollection (((IDeployable)entry).GetDeployFiles (configuration));
			
			return base.GetDeployFiles (ctx, entry, configuration);
		}
		public void Fill (PackageBuilder builder, SolutionFolderItem selection)
		{
			store.Clear ();
			
			this.builder = builder;
			if (selection is SolutionFolder) {
				foreach (SolutionFolderItem e in ((SolutionFolder)selection).GetAllItems ()) {
					if (builder.CanBuild (e))
						selectedEntries [e] = e;
				}
			}
			else if (selection != null) {
				selectedEntries [selection] = selection;
			}
			
			if (selection != null)
				solution = selection.ParentSolution;
			else {
				solution = IdeApp.ProjectOperations.CurrentSelectedSolution;
				if (solution == null) {
					solution = IdeApp.ProjectOperations.CurrentSelectedWorkspaceItem.GetAllItems<Solution> ().FirstOrDefault();
					if (solution == null)
						return;
				}
			}
			AddEntry (TreeIter.Zero, solution.RootFolder);
		}
Ejemplo n.º 5
0
		public DeployDialog (SolutionFolderItem defaultEntry, bool createBuilderOnly)
		{
			this.Build();
			notebook.ShowTabs = false;
			this.defaultEntry = defaultEntry;
			
			if (createBuilderOnly) {
				vboxSaveProject.Hide ();
				checkSave.Active = true;
				checkSave.Hide ();
				saveSeparator.Hide ();
			}
			else {
				pageSave.Hide ();
				FillProjectSelectors ();
			}
			
			store = new ListStore (typeof(Xwt.Drawing.Image), typeof(string), typeof(object));
			targetsTree.Model = store;
			
			targetsTree.HeadersVisible = false;
			CellRendererImage cr = new CellRendererImage();
			cr.Yalign = 0;
			targetsTree.AppendColumn ("", cr, "image", 0);
			targetsTree.AppendColumn ("", new Gtk.CellRendererText(), "markup", 1);
			
			targetsTree.Selection.Changed += delegate (object s, EventArgs a) {
				UpdateButtons ();
			};
			
			FillBuilders ();
			
			UpdateButtons ();
		}
		public static string GetHeader (SolutionFolderItem policyParent, string fileName, bool newFile)
		{
			StandardHeaderPolicy headerPolicy = policyParent != null ? policyParent.Policies.Get<StandardHeaderPolicy> () : MonoDevelop.Projects.Policies.PolicyService.GetDefaultPolicy<StandardHeaderPolicy> ();
			TextStylePolicy textPolicy = policyParent != null ? policyParent.Policies.Get<TextStylePolicy> ("text/plain") : MonoDevelop.Projects.Policies.PolicyService.GetDefaultPolicy<TextStylePolicy> ("text/plain");
			AuthorInformation authorInfo = policyParent != null ? policyParent.AuthorInformation : AuthorInformation.Default;
			
			return GetHeader (authorInfo, headerPolicy, textPolicy, fileName, newFile);
		}
		public void Install (ProgressMonitor monitor, SolutionFolderItem entry, string appName, string prefix, ConfigurationSelector configuration)
		{
			this.appName = appName;
			
			using (DeployContext ctx = new DeployContext (this, DeployService.CurrentPlatform, prefix)) {
				InstallEntry (monitor, ctx, entry, configuration);
			}
		}
Ejemplo n.º 8
0
			TagModel GetTagModel (SolutionFolderItem policyParent, Project project, string language, string identifier, string fileName)
			{
				var model = new TagModel();
				var projectModel = ProjectTagModel ?? Outer.ProjectTagModel;
				if (projectModel != null)
					model.InnerModels = new [] { projectModel };
				ModifyTags (policyParent, project, language, identifier, fileName, ref model.OverrideTags);
				return model;
			}
		public override bool AddToProject (SolutionFolderItem policyParent, Project project, string language, string directory, string name)
		{
			if (!GtkDesignInfo.SupportsDesigner (project)) {
				ReferenceManager mgr = new ReferenceManager (project as DotNetProject);
				mgr.GtkPackageVersion = mgr.DefaultGtkVersion;
				mgr.Dispose ();
			}

			GtkDesignInfo info = GtkDesignInfo.FromProject ((DotNetProject) project);
				
			GuiBuilderProject gproject = info.GuiBuilderProject;
			
			string fileName = fileTemplate.GetFileName (policyParent, project, language, directory, name);
			fileTemplate.AddToProject (policyParent, project, language, directory, name);

			FileService.NotifyFileChanged (fileName);

			DotNetProject netProject = project as DotNetProject;
			string ns = netProject != null ? netProject.GetDefaultNamespace (fileName) : "";
			string cname = Path.GetFileNameWithoutExtension (fileName);
			string fullName = ns.Length > 0 ? ns + "." + cname : cname;
			string[,] tags = { 
				{"Name", cname},
				{"Namespace", ns},
				{"FullName", fullName}
			};

			XmlElement widgetElem = steticTemplate ["widget"];
			if (widgetElem != null) {
				string content = widgetElem.OuterXml;
				content = StringParserService.Parse (content, tags);
				
				XmlDocument doc = new XmlDocument ();
				doc.LoadXml (content);
				
				gproject.AddNewComponent (doc.DocumentElement);
				gproject.SaveAll (false);
				IdeApp.ProjectOperations.SaveAsync (project);
				return true;
			}
			
			widgetElem = steticTemplate ["action-group"];
			if (widgetElem != null) {
				string content = widgetElem.OuterXml;
				content = StringParserService.Parse (content, tags);
				
				XmlDocument doc = new XmlDocument ();
				doc.LoadXml (content);
				
				gproject.SteticProject.AddNewActionGroup (doc.DocumentElement);
				gproject.SaveAll (false);
				IdeApp.ProjectOperations.SaveAsync (project);
				return true;
			}
			
			throw new InvalidOperationException ("<widget> or <action-group> element not found in widget template.");
		}
		void AddClasses (ITreeBuilder builder, SolutionFolderItem entry)
		{
			if (entry is SolutionFolder) {
				foreach (SolutionFolderItem e in ((SolutionFolder)entry).Items)
					AddClasses (builder, e);
			} else if (entry is Project) {
				ProjectNodeBuilder.BuildChildNodes (builder, entry as Project);
			}
		}
		public override bool AddToProject (SolutionFolderItem policyParent, Project project, string language, string directory, string name)
		{
			var model = CombinedTagModel.GetTagModel (ProjectTagModel, policyParent, project, language, name, null);
			var fileName = StringParserService.Parse (name, model);

			project.ProjectProperties.SetValue (typeAtt.Value, string.IsNullOrEmpty (fileName) ? propertyInnerText : string.Concat (fileName, extension));

			return true;
		}
		public override bool AddToProject (SolutionFolderItem policyParent, Project project, string language, string directory, string name)
		{
			ProjectFile file = template.AddFileToProject (policyParent, project, language, directory, name);
			if (file != null) {
				file.BuildAction = BuildAction.EmbeddedResource;
				return true;
			}
			else
				return false;
		}
		public virtual DeployFileCollection GetDeployFiles (DeployContext ctx, SolutionFolderItem entry, ConfigurationSelector configuration)
		{
			if (entry is SolutionFolder)
				return GetCombineDeployFiles (ctx, (SolutionFolder) entry, configuration);
			else if (entry is Project)
				return GetProjectDeployFiles (ctx, (Project) entry, configuration);
			else if (Next != null)
				return Next.GetDeployFiles (ctx, entry, configuration);
			else
				return new DeployFileCollection ();
		}
Ejemplo n.º 14
0
		public SolutionItemReference (SolutionFolderItem item)
		{
			if (item is SolutionItem) {
				path = ((SolutionItem)item).FileName;
			} else {
				path = item.ParentSolution.FileName;
				if ((item is SolutionFolder) && ((SolutionFolder)item).IsRoot)
					id = ":root:";
				else
					id = item.ItemId;
			}
		}
		public override void ModifyTags (SolutionFolderItem policyParent, Project project, string language, string identifier, string fileName, ref Dictionary<string,string> tags)
		{
			base.ModifyTags (policyParent, project, language, identifier, fileName, ref tags);
			if (fileName == null)
				return;
			
			tags ["AspNetMaster"] = "";
			tags ["AspNetMasterContent"] = "";
			
			var aspProj = project.GetService<AspNetAppProjectFlavor> ();
			if (aspProj == null)
				throw new InvalidOperationException ("MasterContentFileDescriptionTemplate is only valid for ASP.NET projects");
			
			ProjectFile masterPage = null;
			
			var dialog = new MonoDevelop.Ide.Projects.ProjectFileSelectorDialog (project, null, "*.master");
			try {
				dialog.Title = GettextCatalog.GetString ("Select a Master Page...");
				int response = MonoDevelop.Ide.MessageService.RunCustomDialog (dialog);
				if (response == (int)Gtk.ResponseType.Ok)
					masterPage = dialog.SelectedFile;
			} finally {
				dialog.Destroy ();
				dialog.Dispose ();
			}
			if (masterPage == null)
				return;
			
			tags ["AspNetMaster"] = aspProj.LocalToVirtualPath (masterPage);
			
			try {
				var pd = TypeSystemService.ParseFile (project, masterPage.FilePath).Result
						as WebFormsParsedDocument;
				if (pd == null)
					return;
				
				var sb = new System.Text.StringBuilder ();
				foreach (string id in pd.XDocument.GetAllPlaceholderIds ()) {
					sb.Append ("<asp:Content ContentPlaceHolderID=\"");
					sb.Append (id);
					sb.Append ("\" ID=\"");
					sb.Append (id);
					sb.Append ("Content\" runat=\"server\">\n</asp:Content>\n");
				}
				
				tags["AspNetMasterContent"] = sb.ToString ();
			}
			catch (Exception ex) {
				//no big loss if we just insert blank space
				//it's just a template for the user to start editing
				LoggingService.LogWarning ("Error generating AspNetMasterContent for template", ex);
			}
		}
		public static void Install (SolutionFolderItem entry, ConfigurationSelector configuration)
		{
			using (ProgressMonitor mon = IdeApp.Workbench.ProgressMonitors.GetRunProgressMonitor ()) {
				InstallDialog dlg = new InstallDialog (entry);
				try {
					if (MessageService.RunCustomDialog (dlg) == (int) Gtk.ResponseType.Ok)
						DeployService.Install (mon, entry, dlg.Prefix, dlg.AppName, configuration);
				} finally {
					dlg.Destroy ();
					dlg.Dispose ();
				}
			}
		}
Ejemplo n.º 17
0
        void CleanItemProperties(PropertyBag props, SolutionFolderItem item, string path)
        {
            props.RemoveValue(path);

            SolutionFolder sf = item as SolutionFolder;

            if (sf != null)
            {
                foreach (SolutionFolderItem ci in sf.Items)
                {
                    CleanItemProperties(props, ci, path + "." + ci.Name);
                }
            }
        }
Ejemplo n.º 18
0
		public override void InitializeSettings (SolutionFolderItem entry)
		{
			if (string.IsNullOrEmpty (targetDir))
				targetDir = entry.BaseDirectory;
			if (string.IsNullOrEmpty (defaultConfig)) {
				SolutionItem se = entry as SolutionItem;
				defaultConfig = se != null ? se.GetConfigurations () [0] : null;
			}
			if (File.Exists (Path.Combine (entry.BaseDirectory, "autogen.sh")) ||
			    File.Exists (Path.Combine (entry.BaseDirectory, "configure"))) {
				generateFiles = false;
			}
			else
				generateFiles = true;
		}
Ejemplo n.º 19
0
        void GetAllItems <T> (List <T> list, SolutionFolderItem item) where T : SolutionFolderItem
        {
            if (item is T)
            {
                list.Add((T)item);
            }

            if (item is SolutionFolder)
            {
                foreach (SolutionFolderItem ce in ((SolutionFolder)item).Items)
                {
                    GetAllItems <T> (list, ce);
                }
            }
        }
Ejemplo n.º 20
0
        void SetupNewItem(SolutionFolderItem item, SolutionFolderItem replacedItem)
        {
            SolutionItem eitem = item as SolutionItem;

            if (eitem != null)
            {
                eitem.ConvertToFormat(FileFormat);
                eitem.NeedsReload = false;
                if (eitem.SupportsConfigurations() || replacedItem != null)
                {
                    if (replacedItem == null)
                    {
                        // Register the new entry in every solution configuration
                        foreach (SolutionConfiguration conf in Configurations)
                        {
                            conf.AddItem(eitem);
                        }
                        // If there is no startup project or it is an invalid one, use the new project as startup if possible
                        if (!Loading && (StartupItem == null || !StartupItem.SupportsExecute()) && eitem.SupportsExecute())
                        {
                            StartupItem = eitem;
                        }
                    }
                    else
                    {
                        // Reuse the configuration information of the replaced item
                        foreach (SolutionConfiguration conf in Configurations)
                        {
                            conf.ReplaceItem((SolutionItem)replacedItem, eitem);
                        }
                        if (StartupItem == replacedItem)
                        {
                            StartupItem = eitem;
                        }
                        else
                        {
                            int i = MultiStartupItems.IndexOf((SolutionItem)replacedItem);
                            if (i != -1)
                            {
                                MultiStartupItems [i] = eitem;
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 21
0
        void CollectItemProperties(PropertyBag props, SolutionFolderItem item, string path)
        {
            if (!item.UserProperties.IsEmpty && item.ParentFolder != null)
            {
                props.SetValue(path, item.UserProperties);
            }

            SolutionFolder sf = item as SolutionFolder;

            if (sf != null)
            {
                foreach (SolutionFolderItem ci in sf.Items)
                {
                    CollectItemProperties(props, ci, path + "." + ci.Name);
                }
            }
        }
Ejemplo n.º 22
0
		public Makefile Deploy (AutotoolsContext ctx, SolutionFolderItem entry, ProgressMonitor monitor)
		{
			Makefile mkfile = new Makefile ();
			TranslationProject project = (TranslationProject) entry;
			
			StringBuilder files = new StringBuilder ();
			foreach (Translation t in project.Translations) {
				files.Append ("\\\n\t" + t.FileName);
			}
			
			string dir;
			if (project.OutputType == TranslationOutputType.SystemPath) {
				dir = ctx.DeployContext.GetResolvedPath (TargetDirectory.CommonApplicationDataRoot, "locale");
			} else {
				dir = ctx.DeployContext.GetResolvedPath (TargetDirectory.ProgramFiles, project.RelPath);
			}
			dir = dir.Replace ("@prefix@", "$(prefix)");
			dir = dir.Replace ("@PACKAGE@", "$(PACKAGE)");
			
			TemplateEngine templateEngine = new TemplateEngine ();
			templateEngine.Variables ["TOP_SRCDIR"] = FileService.AbsoluteToRelativePath (project.BaseDirectory, ctx.TargetSolution.BaseDirectory);
			templateEngine.Variables ["FILES"] = files.ToString ();
			templateEngine.Variables ["BUILD_DIR"] = ".";
			templateEngine.Variables ["INSTALL_DIR"] = "$(DESTDIR)" + dir;
			templateEngine.Variables ["ALL_TARGET"] = (ctx.TargetSolution.BaseDirectory == project.BaseDirectory) ? "all-local" : "all";
			
			StringWriter sw = new StringWriter ();
			
			string mt;
			if (ctx.MakefileType == MakefileType.AutotoolsMakefile)
				mt = "Makefile.am.template";
			else
				mt = "Makefile.template";

			using (Stream stream = GetType().Assembly.GetManifestResourceStream (mt)) {
				StreamReader reader = new StreamReader (stream);

				templateEngine.Process (reader, sw);
				reader.Close ();
			}

			mkfile.Append (sw.ToString ());
			
			return mkfile;
		}
		public override bool AddToProject (SolutionFolderItem policyParent, Project project, string language, string directory, string entryName)
		{
			string[,] customTags = new string[,] {
				{"ProjectName", project.Name},
				{"EntryName", entryName},
				{"EscapedProjectName", GetDotNetIdentifier (project.Name) }
			};				
			
			string substName = StringParserService.Parse (this.name, customTags);
			
			foreach (FileDescriptionTemplate fdt in innerTemplate.Files) {
				if (fdt.EvaluateCreateCondition ()) {
					if (!fdt.AddToProject (policyParent, project, language, directory, substName))
						return false;
				}
			}
			return true;
		}
Ejemplo n.º 24
0
 public SolutionItemReference(SolutionFolderItem item)
 {
     if (item is SolutionItem)
     {
         path = ((SolutionItem)item).FileName;
     }
     else
     {
         path = item.ParentSolution.FileName;
         if ((item is SolutionFolder) && ((SolutionFolder)item).IsRoot)
         {
             id = ":root:";
         }
         else
         {
             id = item.ItemId;
         }
     }
 }
Ejemplo n.º 25
0
        void LoadItemProperties(PropertyBag props, SolutionFolderItem item, string path)
        {
            PropertyBag info = props.GetValue <PropertyBag> (path);

            if (info != null)
            {
                item.LoadUserProperties(info);
                props.RemoveValue(path);
            }

            SolutionFolder sf = item as SolutionFolder;

            if (sf != null)
            {
                foreach (SolutionFolderItem ci in sf.Items)
                {
                    LoadItemProperties(props, ci, path + "." + ci.Name);
                }
            }
        }
Ejemplo n.º 26
0
		internal static void GenerateMakefiles (SolutionFolderItem entry, Solution solution)
		{
			if (solution == null) {
				AlertButton generateMakefilesButton = new AlertButton (GettextCatalog.GetString ("_Generate Makefiles"));
				if (MessageService.AskQuestion (GettextCatalog.GetString ("Generating Makefiles is not supported for single projects. Do you want to generate them for the full solution - '{0}' ?", entry.ParentSolution.Name),
				                                AlertButton.Cancel,
				                                generateMakefilesButton) == generateMakefilesButton) 
					solution = ((SolutionFolderItem)entry).ParentSolution;
				else
					return;
			}

			DeployContext ctx = null;
			ProgressMonitor monitor = null;

			GenerateMakefilesDialog dialog = new GenerateMakefilesDialog (solution);
			try {
				if (MessageService.RunCustomDialog (dialog) != (int) Gtk.ResponseType.Ok)
					return;

				SolutionDeployer deployer = new SolutionDeployer (dialog.GenerateAutotools);
				if ( deployer.HasGeneratedFiles ( solution ) )
				{
					string msg = GettextCatalog.GetString ( "{0} already exist for this solution.  Would you like to overwrite them?", dialog.GenerateAutotools ? "Autotools files" : "Makefiles" );
					if (MonoDevelop.Ide.MessageService.AskQuestion (msg, AlertButton.Cancel, AlertButton.OverwriteFile) != AlertButton.OverwriteFile)
						return;
				}

				ctx = new DeployContext (new TarballDeployTarget (dialog.GenerateAutotools), "Linux", null);
				monitor = IdeApp.Workbench.ProgressMonitors.GetToolOutputProgressMonitor (true);
				deployer.GenerateFiles (ctx, solution, dialog.DefaultConfiguration, monitor);
			} finally {
				dialog.Destroy ();
				dialog.Dispose ();
				if (ctx != null)
					ctx.Dispose ();
				if (monitor != null)
					monitor.Dispose ();
			}
		}
Ejemplo n.º 27
0
			public override Stream CreateFileContent (SolutionFolderItem policyParent, Project project, string language, string fileName, string identifier)
			{
				if (Outer.FormatCode)
				{
					return base.CreateFileContent(policyParent, project, language, fileName, identifier);
				}

				var model = GetTagModel (policyParent, project, language, identifier, fileName);
				string text = CreateContent (project, model.OverrideTags, language);

				text = ProcessContent (text, model);
				var memoryStream = new MemoryStream ();
				byte[] preamble = Encoding.UTF8.GetPreamble ();
				memoryStream.Write (preamble, 0, preamble.Length);
				if (AddStandardHeader) {
					string header = StandardHeaderService.GetHeader (policyParent, fileName, true);
					byte[] bytes = Encoding.UTF8.GetBytes (header);
					memoryStream.Write (bytes, 0, bytes.Length);
				}

				var textDocument = TextEditorFactory.CreateNewDocument ();
				//var textDocument = new TextDocument ();
				textDocument.Text = text;
				var textStylePolicy = (policyParent == null) ? PolicyService.GetDefaultPolicy<TextStylePolicy> ("text/plain") : policyParent.Policies.Get<TextStylePolicy> ("text/plain");
				string eolMarker = TextStylePolicy.GetEolMarker (textStylePolicy.EolMarker);
				byte[] eol = Encoding.UTF8.GetBytes (eolMarker);
				string indent = (!textStylePolicy.TabsToSpaces) ? null : new string (' ', textStylePolicy.TabWidth);
				foreach (var current in textDocument.GetLines()) {
					string line = textDocument.GetTextAt (current.Offset, current.Length);
					if (indent != null) {
						line = line.Replace ("	", indent);
					}
					byte[] bytes = Encoding.UTF8.GetBytes (line);
					memoryStream.Write (bytes, 0, bytes.Length);
					memoryStream.Write (eol, 0, eol.Length);
				}
				memoryStream.Position = 0;
				return memoryStream;				
			}
		void InstallEntry (ProgressMonitor monitor, DeployContext ctx, SolutionFolderItem entry, ConfigurationSelector configuration)
		{
			foreach (DeployFile df in DeployService.GetDeployFiles (ctx, new SolutionFolderItem[] { entry }, configuration)) {
				string targetPath = df.ResolvedTargetFile;
				if (targetPath == null) {
					monitor.ReportWarning ("Could not copy file '" + df.RelativeTargetPath + "': Unknown target directory.");
					continue;
				}
				
				CopyFile (monitor, df.SourcePath, df.ResolvedTargetFile, df.FileAttributes);
			}
			
			SolutionFolder c = entry as SolutionFolder;
			if (c != null) {
				monitor.BeginTask ("Installing solution '" + c.Name + "'", c.Items.Count);
				foreach (SolutionFolderItem ce in c.Items) {
					InstallEntry (monitor, ctx, ce, configuration);
					monitor.Step (1);
				}
				monitor.EndTask ();
			}
		}
		public PackagingFeatureWidget (SolutionFolder parentFolder, SolutionFolderItem entry)
		{
			this.Build();
			this.entry = entry;
			this.parentFolder = parentFolder;

			creatingPackProject = entry is PackagingProject;
			
			if (!creatingPackProject) {
				var packProjects = parentFolder.ParentSolution.GetAllItems<PackagingProject> ().ToList ();
				newPackProject = new PackagingProject ();
			
				string label = GettextCatalog.GetString ("Create packages for this project in a new Packaging Project");
				AddCreatePackageSection (box, label, newPackProject, packProjects.Count > 0);
			
				foreach (PackagingProject project in packProjects)
					AddProject (project);
			} else {
				string label = GettextCatalog.GetString ("Select packages to add to the new Packaging Project");
				AddCreatePackageSection (box, label, (PackagingProject) entry, false);
			}
		}
		public void ApplyFeature (SolutionFolder parentCombine, SolutionFolderItem entry)
		{
			TranslationProject newProject;
			if (entry is TranslationProject)
				newProject = (TranslationProject) entry;
			else {
				newProject = new TranslationProject ();
				newProject.Name = entry.Name + "Translation";
				string path = System.IO.Path.Combine (parentCombine.BaseDirectory, newProject.Name);
				if (!System.IO.Directory.Exists (path))
					System.IO.Directory.CreateDirectory (path);
				newProject.FileName = System.IO.Path.Combine (path, newProject.Name + ".mdse");
				parentCombine.Items.Add (newProject);
			}
			
			TreeIter iter;
			if (store.GetIterFirst (out iter)) {
				do {
					string code = (string)store.GetValue (iter, 1);
					newProject.AddNewTranslation (code, new ProgressMonitor ());
				} while (store.IterNext (ref iter));
			}
		}
Ejemplo n.º 31
0
        void DisconnectChildEntryEvents(SolutionFolderItem entry)
        {
            if (entry is Project)
            {
                Project pce = entry as Project;
                pce.FileRemovedFromProject       -= NotifyFileRemovedFromProject;
                pce.FileAddedToProject           -= NotifyFileAddedToProject;
                pce.FileChangedInProject         -= NotifyFileChangedInProject;
                pce.FilePropertyChangedInProject -= NotifyFilePropertyChangedInProject;
                pce.FileRenamedInProject         -= NotifyFileRenamedInProject;
                if (pce is DotNetProject)
                {
                    ((DotNetProject)pce).ReferenceRemovedFromProject -= NotifyReferenceRemovedFromProject;
                    ((DotNetProject)pce).ReferenceAddedToProject     -= NotifyReferenceAddedToProject;
                }
            }

            if (entry is SolutionFolder)
            {
                SolutionFolder cce = entry as SolutionFolder;
                cce.FileRemovedFromProject       -= NotifyFileRemovedFromProject;
                cce.FileAddedToProject           -= NotifyFileAddedToProject;
                cce.FileChangedInProject         -= NotifyFileChangedInProject;
                cce.FilePropertyChangedInProject -= NotifyFilePropertyChangedInProject;
                cce.FileRenamedInProject         -= NotifyFileRenamedInProject;
                cce.ReferenceRemovedFromProject  -= NotifyReferenceRemovedFromProject;
                cce.ReferenceAddedToProject      -= NotifyReferenceAddedToProject;
                cce.ItemSaved -= NotifyItemSaved;
            }

            if (entry is SolutionItem)
            {
                ((SolutionItem)entry).Saved -= NotifyItemSaved;
//				((SolutionEntityItem)entry).ReloadRequired -= NotifyItemReloadRequired;
            }
            entry.Modified -= NotifyItemModified;
        }
Ejemplo n.º 32
0
        void ConnectChildEntryEvents(SolutionFolderItem item)
        {
            if (item is Project)
            {
                Project project = item as Project;
                project.FileRemovedFromProject       += NotifyFileRemovedFromProject;
                project.FileAddedToProject           += NotifyFileAddedToProject;
                project.FileChangedInProject         += NotifyFileChangedInProject;
                project.FilePropertyChangedInProject += NotifyFilePropertyChangedInProject;
                project.FileRenamedInProject         += NotifyFileRenamedInProject;
                if (item is DotNetProject)
                {
                    ((DotNetProject)project).ReferenceRemovedFromProject += NotifyReferenceRemovedFromProject;
                    ((DotNetProject)project).ReferenceAddedToProject     += NotifyReferenceAddedToProject;
                }
            }

            if (item is SolutionFolder)
            {
                SolutionFolder folder = item as SolutionFolder;
                folder.FileRemovedFromProject       += NotifyFileRemovedFromProject;
                folder.FileAddedToProject           += NotifyFileAddedToProject;
                folder.FileChangedInProject         += NotifyFileChangedInProject;
                folder.FilePropertyChangedInProject += NotifyFilePropertyChangedInProject;
                folder.FileRenamedInProject         += NotifyFileRenamedInProject;
                folder.ReferenceRemovedFromProject  += NotifyReferenceRemovedFromProject;
                folder.ReferenceAddedToProject      += NotifyReferenceAddedToProject;
                folder.ItemSaved += NotifyItemSaved;
            }

            if (item is SolutionItem)
            {
                ((SolutionItem)item).Saved += NotifyItemSaved;
//				((SolutionEntityItem)item).ReloadRequired += NotifyItemReloadRequired;
            }
            item.Modified += NotifyItemModified;
        }
		public BasicOptionPanelWidget (Project entry, bool creatingProject)
		{
			this.Build();
			
			WidgetFlags |= Gtk.WidgetFlags.NoShowAll;
			
			this.entry = entry;
			if (entry is DotNetProject) {
				DotNetProject project = (DotNetProject) entry;
				boxExe.Visible = (project.CompileTarget == CompileTarget.Exe || project.CompileTarget == CompileTarget.WinExe);
				boxLibrary.Visible = (project.CompileTarget == CompileTarget.Library || project.GetOutputFileName (ConfigurationSelector.Default).FileName.EndsWith (".dll"));
			} else {
				boxExe.Visible = boxLibrary.Visible = false;
			}
			
			LinuxDeployData data = LinuxDeployData.GetLinuxDeployData (entry);
			checkScript.Active = data.GenerateScript;
			entryScript.Text = data.ScriptName;
			checkPcFile.Active = data.GeneratePcFile;
			entryScript.Sensitive = checkScript.Active;
			
			if (!creatingProject)
				checkDesktop.Visible = false;
		}
Ejemplo n.º 34
0
 public SolutionItemModifiedEventInfo(SolutionFolderItem item, string hint) : base(item)
 {
     this.hint = hint;
 }
Ejemplo n.º 35
0
 /*protected virtual*/ void OnWriteSolutionFolderItemData(ProgressMonitor monitor, SlnPropertySet properties, SolutionFolderItem item)
 {
     if (item is SolutionItem)
     {
         ((SolutionItem)item).WriteSolutionData(monitor, properties);
     }
 }
Ejemplo n.º 36
0
 internal protected override void OnReadSolutionFolderItemData(ProgressMonitor monitor, SlnPropertySet properties, SolutionFolderItem item)
 {
     Solution.OnReadSolutionFolderItemData(monitor, properties, item);
 }
Ejemplo n.º 37
0
        public void ModelQueries()
        {
            DotNetProject     it2, it3, it4;
            DummySolutionItem it1;
            string            someFile, someId;

            Workspace ws  = new Workspace();
            Workspace cws = new Workspace();

            ws.Items.Add(cws);

            Solution sol1 = new Solution();

            cws.Items.Add(sol1);
            sol1.RootFolder.Items.Add(it1 = new DummySolutionItem());
            sol1.RootFolder.Items.Add(it2 = Services.ProjectService.CreateDotNetProject("C#"));

            Solution sol2 = new Solution();

            cws.Items.Add(sol2);
            SolutionFolder f = new SolutionFolder();

            sol2.RootFolder.Items.Add(f);
            f.Items.Add(it3 = Services.ProjectService.CreateDotNetProject("C#"));
            f.Items.Add(it4 = Services.ProjectService.CreateDotNetProject("C#"));

            it3.Name     = "it3";
            it4.FileName = "/test/it4";
            someFile     = it4.FileName;
            someId       = it3.ItemId;
            Assert.IsFalse(string.IsNullOrEmpty(someId));

            Assert.AreEqual(2, sol1.Items.Count);
            Assert.IsTrue(sol1.Items.Contains(it1));
            Assert.IsTrue(sol1.Items.Contains(it2));

            Assert.AreEqual(2, sol2.Items.Count);
            Assert.IsTrue(sol2.Items.Contains(it3));
            Assert.IsTrue(sol2.Items.Contains(it4));

            var its = ws.GetAllItems <SolutionFolderItem> ().ToList();

            Assert.AreEqual(7, its.Count);
            Assert.IsTrue(its.Contains(it1));
            Assert.IsTrue(its.Contains(it2));
            Assert.IsTrue(its.Contains(it3));
            Assert.IsTrue(its.Contains(it4));
            Assert.IsTrue(its.Contains(sol1.RootFolder));
            Assert.IsTrue(its.Contains(sol2.RootFolder));
            Assert.IsTrue(its.Contains(f));

            var its2 = ws.GetAllItems <DotNetProject> ().ToList();

            Assert.AreEqual(3, its2.Count);
            Assert.IsTrue(its2.Contains(it2));
            Assert.IsTrue(its2.Contains(it3));
            Assert.IsTrue(its2.Contains(it4));

            var its3 = ws.GetAllItems <Project> ().ToList();

            Assert.AreEqual(3, its3.Count);
            Assert.IsTrue(its3.Contains(it2));
            Assert.IsTrue(its3.Contains(it3));
            Assert.IsTrue(its3.Contains(it4));

            var its4 = ws.GetAllItems <Solution> ().ToList();

            Assert.AreEqual(2, its4.Count);
            Assert.IsTrue(its4.Contains(sol1));
            Assert.IsTrue(its4.Contains(sol2));

            var its5 = ws.GetAllItems <WorkspaceItem> ().ToList();

            Assert.AreEqual(4, its5.Count);
            Assert.IsTrue(its5.Contains(ws));
            Assert.IsTrue(its5.Contains(cws));
            Assert.IsTrue(its5.Contains(sol2));
            Assert.IsTrue(its5.Contains(sol2));

            var its6 = ws.GetAllItems <Workspace> ().ToList();

            Assert.AreEqual(2, its6.Count);
            Assert.IsTrue(its6.Contains(ws));
            Assert.IsTrue(its6.Contains(cws));

            SolutionFolderItem si = sol2.GetSolutionItem(someId);

            Assert.AreEqual(it3, si);

            SolutionItem fi = sol2.FindSolutionItem(someFile);

            Assert.AreEqual(it4, fi);

            fi = sol2.FindProjectByName("it3");
            Assert.AreEqual(it3, fi);

            fi = sol2.FindProjectByName("it4");
            Assert.AreEqual(it4, fi);

            fi = sol2.FindProjectByName("it2");
            Assert.IsNull(fi);
        }
Ejemplo n.º 38
0
 internal void WriteSolutionFolderItemData(ProgressMonitor monitor, SlnPropertySet properties, SolutionFolderItem item)
 {
     SolutionExtension.OnWriteSolutionFolderItemData(monitor, properties, item);
 }
Ejemplo n.º 39
0
 public SolutionItemChangeEventArgs(SolutionFolderItem item, Solution parentSolution, bool reloading) : base(item, parentSolution)
 {
     this.reloading = reloading;
 }
Ejemplo n.º 40
0
        public async Task <SolutionFolderItem> ReloadItem(ProgressMonitor monitor, SolutionFolderItem sitem)
        {
            if (Items.IndexOf(sitem) == -1)
            {
                throw new InvalidOperationException("Solution item '" + sitem.Name + "' does not belong to folder '" + Name + "'");
            }

            SolutionItem item = sitem as SolutionItem;

            if (item != null)
            {
                // Load the new item

                SolutionItem newItem;
                try {
                    if (ParentSolution.IsSolutionItemEnabled(item.FileName))
                    {
                        using (var ctx = new SolutionLoadContext(ParentSolution))
                            newItem = await Services.ProjectService.ReadSolutionItem(monitor, item.FileName, null, ctx : ctx, itemGuid : item.ItemId);
                    }
                    else
                    {
                        UnknownSolutionItem e = new UnloadedSolutionItem()
                        {
                            FileName = item.FileName
                        };
                        e.ItemId   = item.ItemId;
                        e.TypeGuid = item.TypeGuid;
                        newItem    = e;
                    }
                } catch (Exception ex) {
                    UnknownSolutionItem e = new UnknownSolutionItem();
                    e.LoadError = ex.Message;
                    e.FileName  = item.FileName;
                    newItem     = e;
                }

                if (!Items.Contains(item))
                {
                    // The old item is gone, which probably means it has already been reloaded (BXC20615), or maybe removed.
                    // In this case, there isn't anything else we can do
                    newItem.Dispose();

                    // Find the replacement if it exists
                    return(Items.OfType <SolutionItem> ().FirstOrDefault(it => it.FileName == item.FileName));
                }

                // Replace in the file list
                Items.Replace(item, newItem);

                item.ParentFolder = null;
                DisconnectChildEntryEvents(item);
                ConnectChildEntryEvents(newItem);

                NotifyModified("Items");
                OnItemRemoved(new SolutionItemChangeEventArgs(item, ParentSolution, true)
                {
                    ReplacedItem = item
                }, true);
                OnItemAdded(new SolutionItemChangeEventArgs(newItem, ParentSolution, true)
                {
                    ReplacedItem = item
                }, true);

                item.Dispose();
                return(newItem);
            }
            else
            {
                return(sitem);
            }
        }
 public SolutionItemRenamedEventArgs(SolutionFolderItem node, string oldName, string newName)
     : base(node)
 {
     this.oldName = oldName;
     this.newName = newName;
 }
Ejemplo n.º 42
0
		public static void Install (ProgressMonitor monitor, SolutionFolderItem entry, string prefix, string appName, ConfigurationSelector configuration)
		{
			InstallResolver res = new InstallResolver ();
			res.Install (monitor, entry, appName, prefix, configuration);
		}
Ejemplo n.º 43
0
		public static DeployFileCollection GetDeployFiles (DeployContext ctx, SolutionFolderItem entry, ConfigurationSelector configuration)
		{
			ArrayList todel = new ArrayList ();
			
			DeployFileCollection col = GetExtensionChain ().GetDeployFiles (ctx, entry, configuration);
			foreach (DeployFile df in col) {
				if (!ctx.IncludeFile (df)) {
					todel.Add (df);
					continue;
				}
				df.SetContext (ctx);
				if (df.ContainsPathReferences) {
					string name = df.DisplayName;
					df.SourcePath = ProcessFileTemplate (ctx, df.SourcePath);
					df.DisplayName = name;
				}
			}
			foreach (DeployFile df in todel) {
				col.Remove (df);
			}
			return col;
		}
Ejemplo n.º 44
0
 public SolutionItemEventArgs(SolutionFolderItem entry)
 {
     this.entry = entry;
 }
Ejemplo n.º 45
0
 public SolutionItemEventArgs(SolutionFolderItem entry, Solution solution)
 {
     this.solution = solution;
     this.entry    = entry;
 }
Ejemplo n.º 46
0
 public void AddItem(SolutionFolderItem item)
 {
     AddItem(item, false);
 }
Ejemplo n.º 47
0
 public SolutionItemModifiedEventArgs(SolutionFolderItem item, string hint)
 {
     Add(new SolutionItemModifiedEventInfo(item, hint));
 }
Ejemplo n.º 48
0
 internal void NotifyItemRemoved(SolutionFolderItem item, bool removedFromSolution)
 {
     DisconnectChildEntryEvents(item);
     NotifyModified("Items");
     OnItemRemoved(new SolutionItemChangeEventArgs(item, ParentSolution, false), removedFromSolution);
 }
		public static void CheckHandlerUsesMSBuildEngine (SolutionFolderItem item, out bool useByDefault, out bool require)
		{
			var handler = item as Project;
			if (handler == null) {
				useByDefault = require = false;
				return;
			}
			useByDefault = handler.MSBuildEngineSupport.HasFlag (MSBuildSupport.Supported);
			require = handler.MSBuildEngineSupport.HasFlag (MSBuildSupport.Required);
		}
Ejemplo n.º 50
0
 internal protected virtual void OnWriteSolutionFolderItemData(ProgressMonitor monitor, SlnPropertySet properties, SolutionFolderItem item)
 {
     next.OnWriteSolutionFolderItemData(monitor, properties, item);
 }
Ejemplo n.º 51
0
		public static DeployFileCollection GetDeployFiles (DeployContext ctx, SolutionFolderItem[] entries, ConfigurationSelector configuration)
		{
			DeployFileCollection col = new DeployFileCollection ();
			foreach (SolutionFolderItem e in entries) {
				col.AddRange (GetDeployFiles (ctx, e, configuration));
			}
			return col;
		}
Ejemplo n.º 52
0
        public async Task <SolutionFolderItem> ReloadItem(ProgressMonitor monitor, SolutionFolderItem sitem)
        {
            if (Items.IndexOf(sitem) == -1)
            {
                throw new InvalidOperationException("Solution item '" + sitem.Name + "' does not belong to folder '" + Name + "'");
            }

            if (sitem is SolutionItem item)
            {
                // Load the new item

                SolutionItem newItem;
                try {
                    if (ParentSolution.IsSolutionItemEnabled(item.FileName))
                    {
                        using (var ctx = new SolutionLoadContext(ParentSolution))
                            newItem = await Services.ProjectService.ReadSolutionItem(monitor, item.FileName, null, ctx : ctx, itemGuid : item.ItemId);
                    }
                    else
                    {
                        UnknownSolutionItem e = new UnloadedSolutionItem()
                        {
                            FileName = item.FileName
                        };
                        e.ItemId   = item.ItemId;
                        e.TypeGuid = item.TypeGuid;
                        newItem    = e;
                    }
                } catch (Exception ex) {
                    newItem = new UnknownSolutionItem {
                        LoadError = ex.Message,
                        FileName  = item.FileName
                    };
                }

                if (!Items.Contains(item))
                {
                    // The old item is gone, which probably means it has already been reloaded (BXC20615), or maybe removed.
                    // In this case, there isn't anything else we can do
                    newItem.Dispose();

                    // Find the replacement if it exists
                    return(Items.OfType <SolutionItem> ().FirstOrDefault(it => it.FileName == item.FileName));
                }

                // Replace in the file list
                Items.Replace(item, newItem);

                item.ParentFolder = null;
                DisconnectChildEntryEvents(item);
                ConnectChildEntryEvents(newItem);

                // Shutdown project builder before the ItemAdded event is fired. This should prevent the old out of
                // date project builder being used by the TypeSystemService when getting reference information. The
                // TypeSystemService loads the project when the ItemAdded event is fired before the item is disposed.
                // Disposing the project will also shutdown the project builder but this happens too late and can
                // result in the old project builder being used which does not have the latest project xml.
                if (item is Project)
                {
                    await RemoteBuildEngineManager.UnloadProject(item.FileName);
                }

                NotifyModified("Items");
                OnItemRemoved(new SolutionItemChangeEventArgs(item, ParentSolution, true)
                {
                    ReplacedItem = item
                }, true);
                OnItemAdded(new SolutionItemChangeEventArgs(newItem, ParentSolution, true)
                {
                    ReplacedItem = item
                }, true);

                item.Dispose();
                return(newItem);
            }

            return(sitem);
        }
Ejemplo n.º 53
0
		public static PackageBuilder[] GetSupportedPackageBuilders (SolutionFolderItem entry)
		{
			object[] builders = AddinManager.GetExtensionObjects ("/MonoDevelop/DeployService/PackageBuilders", false);
			ArrayList list = new ArrayList ();
			foreach (PackageBuilder builder in builders) {
				if (builder.CanBuild (entry)) {
					PackageBuilder b = builder.Clone ();
					b.InitializeSettings (entry);
					list.Add (b);
				}
			}

			return (PackageBuilder[]) list.ToArray (typeof(PackageBuilder));
		}
Ejemplo n.º 54
0
 public SolutionItemSavedEventArgs(SolutionFolderItem item, Solution parentSolution, bool savingSolution) : base(item, parentSolution)
 {
     this.savingSolution = savingSolution;
 }