void HandleProjectFileChangedInProject (object sender, ProjectFileEventArgs args)
		{
			foreach (ProjectFileEventInfo e in args) {
				if (IsXibFile (e.ProjectFile))
					ThreadPool.QueueUserWorkItem (delegate { UpdateXibCodebehind (e.ProjectFile); });
			}
		}
 internal static void Log(String messageFormat, ProjectFileEventArgs e)
 {
     foreach (ProjectFileEventInfo info in e) {
         ProjectFile projectFile = info.ProjectFile;
         Log (messageFormat, projectFile.Name);
     }
 }
Beispiel #3
0
		void HandleSolutionFileChangedInProject (object sender, ProjectFileEventArgs e)
		{
			if (e.Project is DotNetProject) {
				projectTimestamps [(DotNetProject)e.Project] = DateTime.Now;
				OnChanged ();
			}
		}
		void OnFilePropertyChangedInProject (object sender, ProjectFileEventArgs args)
		{
			var pad = IdeApp.Workbench.GetPad <PropertyPad> ();
			if (pad == null)
				return;

			var grid = ((PropertyPad)pad.Content).PropertyGrid;
			if (args.Any (arg => arg.ProjectFile == file))
				grid.Refresh ();
		}
		void OnFilePropertyChangedInProject (object sender, ProjectFileEventArgs args)
		{
			var pad = IdeApp.Workbench.GetPad <PropertyPad> ();
			if (pad == null)
				return;

			var grid = ((PropertyPad)pad.Content).PropertyGrid;
			if (grid.IsEditing)
				return;

			if (args.Any (arg => arg.ProjectFile == file))
				grid.Populate (saveEditSession: false);
		}
Beispiel #6
0
		void HandleProjectFileAddedToProject (object sender, ProjectFileEventArgs e)
		{
			if (e.Project.Loading)
				return;
			
			var pf = e.ProjectFile;
			if (IsDesignerFile (pf)) {
				var xibFile = GetXibFile (pf);
				if (xibFile != null)
					ThreadPool.QueueUserWorkItem (delegate { UpdateXibCodebehind (xibFile, pf, true); });
			} else if (IsXibFile (pf)) {
				ThreadPool.QueueUserWorkItem (delegate { UpdateXibCodebehind (pf, true); });
			}
		}
		void OnFileAdded (object o, ProjectFileEventArgs a)
		{
			if (a.ProjectFile.Name.EndsWith (".desktop")) {
				DesktopEntry de = new DesktopEntry ();
				try {
					de.Load (a.ProjectFile.Name);
					a.ProjectFile.BuildAction = BuildAction.Content;
					DeployProperties props = DeployService.GetDeployProperties (a.ProjectFile);
					props.TargetDirectory = LinuxTargetDirectory.DesktopApplications;
					if (string.IsNullOrEmpty (de.Exec)) {
						LinuxDeployData dd = LinuxDeployData.GetLinuxDeployData (a.Project);
						if (dd.GenerateScript && !string.IsNullOrEmpty (dd.ScriptName)) {
							de.Exec = dd.ScriptName;
							de.Save (a.ProjectFile.Name);
						}
					}
				} catch (Exception ex) {
					LoggingService.LogError ("Could not read .desktop file", ex);
				}
			}
		}
Beispiel #8
0
 protected override void OnFilePropertyChangedInProject(ProjectFileEventArgs e)
 {
     NeedsFullRebuild = true;
     base.OnFilePropertyChangedInProject (e);
 }
		void CheckFileChanges (ProjectFileEventArgs e)
		{
			bool updateTypes = false, updateProject = false;
			
			foreach (ProjectFileEventInfo finf in e) {
				if (finf.Project != dnp)
					continue;
				if (finf.ProjectFile.BuildAction == BuildAction.Compile) {
					updateTypes = true;
				} else if (IncludeInSyncedProject (finf.ProjectFile)) {
					updateProject = true;
				}
			}
			
			if (updateTypes) {
				using (var monitor = GetStatusMonitor (GettextCatalog.GetString ("Syncing types to Xcode..."))) {
					//FIXME: make this async (and safely async)
					//FIXME: only update the project if obj-c types change
					updateProject |= UpdateTypes (monitor);
				}
			}
			
			if (updateProject) {
				using (var monitor = GetStatusMonitor (GettextCatalog.GetString ("Syncing project to Xcode..."))) {
					//FIXME: make this async (and safely async)
					var running = xcode.CheckRunning ();
					UpdateXcodeProject (monitor);
					if (running) {
						try {
							xcode.OpenProject (monitor);
						} catch (AppleScriptException) {
							ShowXcodeScriptError ();
						} catch (TimeoutException) {
							ShowXcodeScriptError ();
						}
					}
				}
			}
		}
		protected override void OnFileAddedToProject (ProjectFileEventArgs e)
		{
			//short-circuit if the project is being deserialised
			if (Project.Loading) {
				base.OnFileAddedToProject (e);
				return;
			}

			bool webConfigChange = false;
			List<string> filesToAdd = new List<string> ();

			foreach (ProjectFileEventInfo fargs in e) {
				IEnumerable<string> files = MonoDevelop.DesignerSupport.CodeBehind.GuessDependencies
					(Project, fargs.ProjectFile, groupedExtensions);
				if (files != null)
					filesToAdd.AddRange (files);
				if (IsWebConfig (fargs.ProjectFile.FilePath))
					webConfigChange = true;
			}

			if (webConfigChange)
				UpdateWebConfigRefs ();

			//let the base fire the event before we add files
			//don't want to fire events out of order of files being added
			base.OnFileAddedToProject (e);

			//make sure that the parent and child files are in the project
			foreach (string file in filesToAdd) {
				//NOTE: this only adds files if they are not already in the project
				Project.AddFile (file);
			}
		}
		protected override void OnFileChangedInProject (ProjectFileEventArgs e)
		{
			IDELogger.Log ("MonobjcProject::OnFileChangedInProject '{0}'", e);

			this.ResolverHandler.ClearCache();
			this.XcodeHandler.ClearXcodeProject();

			base.OnFileChangedInProject (e);

			this.CodeBehindHandler.GenerateDesignCodeForXib (e);
		}
		void OnFileRemoved (object sender, ProjectFileEventArgs e)
		{
			ArrayList toDelete = new ArrayList ();

			foreach (ProjectFileEventInfo args in e) {
				var doc = TypeSystemService.ParseFile (args.Project, args.ProjectFile.Name);
				if (doc == null)
					continue;
	
				foreach (var t in doc.TopLevelTypeDefinitions) {
					GuiBuilderWindow win = GetWindowForClass (t.FullName);
					if (win != null)
						toDelete.Add (win);
				}
			}
			
			foreach (GuiBuilderWindow win in toDelete)
				Remove (win);
		}
Beispiel #13
0
		/// <summary>
		/// Raises the FileChangedInProject event.
		/// </summary>
		protected virtual void OnFileChangedInProject (ProjectFileEventArgs e)
		{
			if (FileChangedInProject != null) {
				FileChangedInProject (this, e);
			}
		}
Beispiel #14
0
		/// <summary>
		/// Raises the FileAddedToProject event.
		/// </summary>
		protected virtual void OnFileAddedToProject (ProjectFileEventArgs e)
		{
			buildActions = null;
			if (FileAddedToProject != null) {
				FileAddedToProject (this, e);
			}
		}
Beispiel #15
0
		/// <summary>
		/// Raises the FileRemovedFromProject event.
		/// </summary>
		protected virtual void OnFileRemovedFromProject (ProjectFileEventArgs e)
		{
			buildActions = null;
			if (FileRemovedFromProject != null) {
				FileRemovedFromProject (this, e);
			}
		}
Beispiel #16
0
		void NotifyFileAddedToProject (IEnumerable<ProjectFile> objs)
		{
			if (!objs.Any ())
				return;
			
			var args = new ProjectFileEventArgs ();
			
			foreach (ProjectFile file in objs) {
				if (file.Project != null)
					throw new InvalidOperationException ("ProjectFile already belongs to a project");
				file.SetProject (this);
				args.Add (new ProjectFileEventInfo (this, file));
				ResolveDependencies (file);
			}

			SetDirty ();
			NotifyModified ("Files");
			OnFileAddedToProject (args);
		}
Beispiel #17
0
		void NotifyFileRemovedFromProject (IEnumerable<ProjectFile> objs)
		{
			if (!objs.Any ())
				return;
			
			var args = new ProjectFileEventArgs ();
			
			foreach (ProjectFile file in objs) {
				file.SetProject (null);
				args.Add (new ProjectFileEventInfo (this, file));
				if (DependencyResolutionEnabled) {
					if (unresolvedDeps.Contains (file))
						unresolvedDeps.Remove (file);
					foreach (ProjectFile f in file.DependentChildren) {
						f.DependsOnFile = null;
						if (!string.IsNullOrEmpty (f.DependsOn))
							unresolvedDeps.Add (f);
					}
					file.DependsOnFile = null;
				}
			}
			SetDirty ();
			NotifyModified ("Files");
			OnFileRemovedFromProject (args);
		}
Beispiel #18
0
 protected override void OnFileRemovedFromProject(ProjectFileEventArgs e)
 {
     base.OnFileRemovedFromProject(e);
     NeedsFullRebuild = true;
     foreach (var pf in e)
         GlobalParseCache.RemoveModule (pf.ProjectFile.FilePath);
 }
		void OnFileAdded (object sender, ProjectFileEventArgs e)
		{
			foreach (ProjectFileEventInfo args in e) {
				var doc = TypeSystemService.ParseFile (args.Project, args.ProjectFile.Name);
				if (doc == null)
					continue;
	
				string dir = Path.Combine (Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData), "stetic"), "deleted-designs");
				if (!Directory.Exists (dir) || Directory.GetFiles (dir).Length == 0)
					continue;
	
				foreach (var t in doc.TopLevelTypeDefinitions) {
					string path = Path.Combine (dir, t.FullName + ".xml");
					if (!System.IO.File.Exists (path))
						continue;
					XmlDocument xmldoc = new XmlDocument ();
					xmldoc.Load (path);
					AddNewComponent (xmldoc.DocumentElement);
					System.IO.File.Delete (path);
				}
			}
		}
Beispiel #20
0
		//based on MoonlightProject
		protected override void OnFileAddedToProject (ProjectFileEventArgs args)
		{
			//short-circuit if the project is being deserialised
			if (Loading) {
				base.OnFileAddedToProject (args);
				return;
			}
			
			/* TODO
			if (String.IsNullOrEmpty (MainNibFile) && Path.GetFileName (e.ProjectFile.FilePath) == "MainWindow.xib") {
				MainNibFile = e.ProjectFile.FilePath;
			}
			*/
			
			List<string> filesToAdd = new List<string> ();
			foreach (ProjectFileEventInfo e in args) {
				//find any related files, e.g codebehind
				//FIXME: base this on the controller class names defined in the xib
				var files = MonoDevelop.DesignerSupport.CodeBehind.GuessDependencies (this, e.ProjectFile, groupedExtensions);
				if (files != null)
					filesToAdd.AddRange (files);
			}
			//let the base fire the event before we add files
			//don't want to fire events out of order of files being added
			base.OnFileAddedToProject (args);
			
			//make sure that the parent and child files are in the project
			foreach (string file in filesToAdd) {
				//NOTE: this only adds files if they are not already in the project
				AddFile (file);
			}
		}
Beispiel #21
0
		/// <summary>
		/// Raises the FilePropertyChangedInProject event.
		/// </summary>
		protected virtual void OnFilePropertyChangedInProject (ProjectFileEventArgs e)
		{
			buildActions = null;
			if (FilePropertyChangedInProject != null) {
				FilePropertyChangedInProject (this, e);
			}
		}
		void OnFileEvent (object o, ProjectFileEventArgs args)
		{
			if (!IdeApp.Workspace.IsOpen || !File.Exists (ObjectsFile))
				return;

			UpdateObjectsFile ();
		}
		//static void OnFileChanged (object s, ProjectFileEventArgs args)
		//{
		//	Repository repo = GetRepository (args.Project);
		//	if (repo != null)
		//		NotifyFileStatusChanged (repo, args.ProjectFile.FilePath, false);
		//}

		static void OnFileAdded (object s, ProjectFileEventArgs e)
		{
			FileUpdateEventArgs vargs = new FileUpdateEventArgs ();
			IProgressMonitor monitor = null;
			try {
				foreach (var repoFiles in e.GroupBy (i => i.Project)) {
					Repository repo = GetRepository (repoFiles.Key);
					if (repo == null)
						continue;
					var versionInfos = repo.GetVersionInfo (repoFiles.Select (f => f.ProjectFile.FilePath));
					FilePath[] paths = versionInfos.Where (i => i.CanAdd).Select (i => i.LocalPath).ToArray ();
					if (paths.Length > 0) {
						if (monitor == null)
							monitor = GetStatusMonitor ();
						repo.Add (paths, false, monitor);
					}
					vargs.AddRange (repoFiles.Select (i => new FileUpdateEventInfo (repo, i.ProjectFile.FilePath, i.ProjectFile.Subtype == Subtype.Directory)));
				}
			}
			finally {
				if (monitor != null)
					monitor.Dispose ();
			}
			if (vargs.Count > 0)
				NotifyFileStatusChanged (vargs);
		}
Beispiel #24
0
		void FileRemovedFromProject (object sender, ProjectFileEventArgs e)
		{
			if (!SyncingEnabled)
				return;
			
			XC4Debug.Log ("Files removed from project '{0}'", dnp.Name);
			foreach (var file in e)
				XC4Debug.Log ("   * Removed: {0}", file.ProjectFile.ProjectVirtualPath);
			
			XC4Debug.Indent ();
			try {
				if (e.Any (finf => finf.Project == dnp && IsInterfaceDefinition (finf.ProjectFile))) {
					if (!dnp.Files.Any (IsInterfaceDefinition)) {
						XC4Debug.Log ("Last Interface Definition file removed from '{0}', disabling Xcode sync.", dnp.Name);
						DisableSyncing ();
						return;
					}
				}
			} finally {
				XC4Debug.Unindent ();
			}
			
			CheckFileChanges (e);
		}
		protected override void OnFileAddedToProject (ProjectFileEventArgs e)
		{
			IDELogger.Log ("MonobjcProject::OnFileAddedToProject '{0}'", e);

			this.MigrationHandler.Migrate (e);
			this.ResolverHandler.ClearCache();
			this.XcodeHandler.ClearXcodeProject();

			IEnumerable<FilePath> dependencies = this.DependencyHandler.GuessDependencies (e);

			base.OnFileAddedToProject (e);

			this.DependencyHandler.AddFiles (dependencies);
			this.CodeBehindHandler.GenerateDesignCodeForXib (e);
			this.EmbeddingHandler.ApplyEmbedding(e);
		}
Beispiel #26
0
		void FileAddedToProject (object sender, ProjectFileEventArgs e)
		{
			if (!SyncingEnabled)
				return;
			
			XC4Debug.Log ("Files added to project '{0}'", dnp.Name);
			foreach (var file in e)
				XC4Debug.Log ("   * Added: {0}", file.ProjectFile.ProjectVirtualPath);
			
			CheckFileChanges (e);
		}
		protected override void OnFilePropertyChangedInProject (ProjectFileEventArgs e)
		{
			IDELogger.Log ("MonobjcProject::OnFilePropertyChangedInProject '{0}'", e);

			this.ResolverHandler.ClearCache();
			this.XcodeHandler.ClearXcodeProject();

			base.OnFilePropertyChangedInProject (e);

			this.EmbeddingHandler.ApplyEmbedding(e);
		}
Beispiel #28
0
		void FileChangedInProject (object sender, ProjectFileEventArgs e)
		{
			// avoid infinite recursion when we add files
			if (!SyncingEnabled || updatingProjectFiles)
				return;
			
			XC4Debug.Log ("Files changed in project '{0}'", dnp.Name);
			foreach (var file in e)
				XC4Debug.Log ("   * Changed: {0}", file.ProjectFile.ProjectVirtualPath);
			
			CheckFileChanges (e);
		}
		void HandleProjectChanged (object sender, ProjectFileEventArgs e)
		{
			if (e.Any (f => f.ProjectFile.FilePath == DocumentContext.Name))
				UpdateOwnerProjects ();
		}
Beispiel #30
0
		void FilePropertyChangedInProject (object sender, ProjectFileEventArgs e)
		{
			if (!SyncingEnabled)
				return;
			
			XC4Debug.Log ("File properties changed in project '{0}'", dnp.Name);
			foreach (var file in e)
				XC4Debug.Log ("   * Property Changed: {0}", file.ProjectFile.ProjectVirtualPath);
			
			CheckFileChanges (e);
		}