public CustomCommandWidget (WorkspaceObject entry, CustomCommand cmd, ConfigurationSelector configSelector, CustomCommandType[] supportedTypes) { this.Build(); this.supportedTypes = supportedTypes; this.cmd = cmd; updating = true; if (cmd == null) comboType.AppendText (GettextCatalog.GetString ("(Select a project operation)")); foreach (var ct in supportedTypes) comboType.AppendText (commandNames [(int)ct]); updating = false; this.entry = entry; UpdateControls (); this.WidgetFlags |= Gtk.WidgetFlags.NoShowAll; StringTagModelDescription tagModel; if (entry is SolutionFolderItem) tagModel = ((SolutionFolderItem)entry).GetStringTagModelDescription (configSelector); else if (entry is WorkspaceItem) tagModel = ((WorkspaceItem)entry).GetStringTagModelDescription (); else tagModel = new StringTagModelDescription (); tagSelectorDirectory.TagModel = tagModel; tagSelectorDirectory.TargetEntry = workingdirEntry; tagSelectorCommand.TagModel = tagModel; tagSelectorCommand.TargetEntry = entryCommand; }
public VersionControlItem (Repository repository, WorkspaceObject workspaceObject, FilePath path, bool isDirectory, VersionInfo versionInfo) { Path = path; Repository = repository; WorkspaceObject = workspaceObject; IsDirectory = isDirectory; this.versionInfo = versionInfo; }
protected UnitTest (string name, WorkspaceObject ownerSolutionItem) { this.name = name; this.ownerSolutionItem = ownerSolutionItem; ownerSolutionEntityItem = ownerSolutionItem as SolutionItem; if (ownerSolutionEntityItem != null) ownerSolutionEntityItem.DefaultConfigurationChanged += OnConfugurationChanged; }
internal protected override bool SupportsObject (WorkspaceObject item) { var p = item as SolutionItem; if (p == null) return false; return FlavorGuid == null || p.GetItemTypeGuids ().Any (id => id.Equals (FlavorGuid, StringComparison.OrdinalIgnoreCase)); }
void HandleTreeSelectionChanged (object sender, EventArgs e) { TreeIter it; if (tree.Selection.GetSelected (out it)) currentSelection = (WorkspaceObject) store.GetValue (it, 2); else currentSelection = null; if (SelectionChanged != null) SelectionChanged (this, EventArgs.Empty); }
public UnitTest CreateUnitTest (WorkspaceObject entry) { var ext = entry.GetService<MonoMakefileProjectExtension> (); if (ext != null) { var project = (DotNetProject) entry; if (ext.UnitTest != null) return (UnitTest) ext.UnitTest; string testFileBase = ext.GetTestFileBase (); UnitTest testSuite = new MonoTestSuite (project, project.Name, testFileBase); ext.UnitTest = testSuite; return testSuite; } return null; }
public UnitTest CreateUnitTest (WorkspaceObject entry) { UnitTest test = null; if (entry is DotNetProject) test = NUnitProjectTestSuite.CreateTest ((DotNetProject)entry); UnitTestGroup grp = test as UnitTestGroup; if (grp != null && !grp.HasTests) { test.Dispose (); return null; } return test; }
internal protected override bool SupportsObject (WorkspaceObject item) { var s = item as SolutionItem; if (s == null) return false; var res = FlavorGuid == null || s.GetItemTypeGuids ().Any (id => id.Equals (FlavorGuid, StringComparison.OrdinalIgnoreCase)); if (!res) return false; var p = item as DotNetProject; if (p == null || LanguageName == null) return true; return LanguageName == p.LanguageName; }
public VersionControlItem (Repository repository, WorkspaceObject workspaceObject, FilePath path, bool isDirectory, VersionInfo versionInfo) { Path = path; Repository = repository; WorkspaceObject = workspaceObject; IsDirectory = isDirectory; this.versionInfo = versionInfo; var obj = workspaceObject; while (obj != null) { var p = obj as Project; if (p != null) ContainerProject = p; obj = obj.ParentObject; } }
public static void AddTask (string fileName, string message, int column, int line, TaskSeverity taskType, WorkspaceObject workspaceObject) { // HACK: Use a compiler error since we cannot add an error // task otherwise (task type property is read-only and // no constructors usable). BuildError error = new BuildError (); error.Column = column; error.Line = line; error.ErrorText = message; error.FileName = fileName; error.IsWarning = false; //Task task = new Task(fileName, message, column, line); TaskListEntry task = new TaskListEntry (error); task.WorkspaceObject = workspaceObject; task.Owner = ActiveEditor; TaskService.Errors.Add(task); }
public UnitTest CreateUnitTest (WorkspaceObject entry) { UnitTest test = null; if (entry is SolutionFolder) test = SolutionFolderTestGroup.CreateTest ((SolutionFolder)entry); if (entry is Solution) test = SolutionFolderTestGroup.CreateTest (((Solution)entry).RootFolder); if (entry is Workspace) test = WorkspaceTestGroup.CreateTest ((Workspace)entry); UnitTestGroup grp = test as UnitTestGroup; if (grp != null && !grp.HasTests) { test.Dispose (); return null; } return test; }
public static bool Publish (WorkspaceObject entry, FilePath localPath, bool test) { if (test) return VersionControlService.CheckVersionControlInstalled () && VersionControlService.GetRepository (entry) == null; List<FilePath> files = new List<FilePath> (); // Build the list of files to be checked in string moduleName = entry.Name; if (localPath == entry.BaseDirectory) { GetFiles (files, entry); } else if (entry is Project) { foreach (ProjectFile file in ((Project)entry).Files.GetFilesInPath (localPath)) if (file.Subtype != Subtype.Directory) files.Add (file.FilePath); } else return false; if (files.Count == 0) return false; SelectRepositoryDialog dlg = new SelectRepositoryDialog (SelectRepositoryMode.Publish); try { dlg.ModuleName = moduleName; dlg.Message = GettextCatalog.GetString ("Initial check-in of module {0}", moduleName); do { if (MessageService.RunCustomDialog (dlg) == (int) Gtk.ResponseType.Ok && dlg.Repository != null) { AlertButton publishButton = new AlertButton ("_Publish"); if (MessageService.AskQuestion (GettextCatalog.GetString ("Are you sure you want to publish the project?"), GettextCatalog.GetString ("The project will be published to the repository '{0}', module '{1}'.", dlg.Repository.Name, dlg.ModuleName), AlertButton.Cancel, publishButton) == publishButton) { PublishWorker w = new PublishWorker (dlg.Repository, dlg.ModuleName, localPath, files.ToArray (), dlg.Message); w.Start (); break; } } else break; } while (true); } finally { dlg.Destroy (); dlg.Dispose (); } return true; }
public UnitTest CreateUnitTest (WorkspaceObject entry) { UnitTest test = null; if (entry is SolutionFolder) test = SolutionFolderTestGroup.CreateTest ((SolutionFolder)entry); if (entry is Solution) test = SolutionFolderTestGroup.CreateTest (((Solution)entry).RootFolder); if (entry is Workspace) test = WorkspaceTestGroup.CreateTest ((Workspace)entry); if (entry is DotNetProject) test = NUnitProjectTestSuite.CreateTest ((DotNetProject)entry); if (entry is NUnitAssemblyGroupProject) test = ((NUnitAssemblyGroupProject)entry).RootTest; UnitTestGroup grp = test as UnitTestGroup; if (grp != null && !grp.HasTests) { test.Dispose (); return null; } return test; }
bool IsSelectable (WorkspaceObject item) { if (SelectableFilter != null && !SelectableFilter (item)) return false; if (selectableTypes.Count > 0) return selectableTypes.Any (t => t.IsInstanceOfType (item)); return true; }
public TaskListEntry (BuildError error, object owner) { parentObject = error.SourceTarget as WorkspaceObject; file = error.FileName; this.owner = owner; description = error.ErrorText; column = error.Column; line = error.Line; if (!string.IsNullOrEmpty (error.ErrorNumber)) description += " (" + error.ErrorNumber + ")"; if (error.IsWarning) severity = error.ErrorNumber == "COMMENT" ? TaskSeverity.Information : TaskSeverity.Warning; else severity = TaskSeverity.Error; priority = TaskPriority.Normal; code = error.ErrorNumber; category = error.Subcategory; helpKeyword = error.HelpKeyword; }
IEnumerable<WorkspaceObject> GetAllChildren (WorkspaceObject item) { var res = GetChildren (item); return res.Concat (res.SelectMany (GetAllChildren)); }
protected bool IsVisible (WorkspaceObject item) { return true; }
protected override bool SupportsObject(WorkspaceObject item) { return(DotNetCoreSupportsObject(item) && !IsWebProject((DotNetProject)item)); }
public AppliesToCondition(WorkspaceObject workspaceObject) { this.workspaceObject = workspaceObject; }
public bool IsBuilding (WorkspaceObject ob) { var owner = currentBuildOperationOwner as WorkspaceObject; return owner != null && !currentBuildOperation.IsCompleted && ContainsTarget (ob, owner); }
public static XslCompiledTransform ValidateStylesheet(ProgressMonitor monitor, string xml, string fileName, WorkspaceObject workspaceObject) { monitor.BeginTask(GettextCatalog.GetString("Validating stylesheet..."), 1); bool error = true; XslCompiledTransform xslt = null; try { StringReader reader = new StringReader(xml); XPathDocument doc = new XPathDocument(reader); xslt = new XslCompiledTransform(); xslt.Load(doc, null, new XmlUrlResolver()); error = false; } catch (XsltCompileException ex) { monitor.ReportError(ex.Message, ex); AddTask(fileName, ex.Message, ex.LinePosition, ex.LineNumber, TaskSeverity.Error, workspaceObject); } catch (XsltException ex) { monitor.ReportError(ex.Message, ex); AddTask(fileName, ex.Message, ex.LinePosition, ex.LineNumber, TaskSeverity.Error, workspaceObject); } catch (XmlException ex) { monitor.ReportError(ex.Message, ex); AddTask(fileName, ex.Message, ex.LinePosition, ex.LineNumber, TaskSeverity.Error, workspaceObject); } if (error) { monitor.Log.WriteLine(GettextCatalog.GetString("Validation failed.")); TaskService.ShowErrors(); } else { monitor.Log.WriteLine(GettextCatalog.GetString("Stylesheet is valid.")); } return(error? null: xslt); }
public TaskListEntry(FilePath file, string description, int column, int line, TaskSeverity severity, TaskPriority priority, WorkspaceObject parent, object owner) : this(file, description, column, line, severity, priority, parent, owner, null) { }
public TaskListEntry(FilePath file, string description, int column, int line, TaskSeverity severity, TaskPriority priority, WorkspaceObject parent, object owner, string category) { this.file = file; this.description = description; this.column = column; this.line = line; this.severity = severity; this.priority = priority; this.owner = owner; this.parentObject = parent; this.category = category; }
async Task <Document> LoadFile(FilePath fileName, ProgressMonitor monitor, DocumentControllerDescription binding, WorkspaceObject project, FileOpenInformation fileInfo) { // Make sure composition manager is ready since ScrollToRequestedCaretLocation will use it await Runtime.GetService <CompositionManager> (); string mimeType = desktopService.GetMimeTypeForUri(fileName); var fileDescriptor = new FileDescriptor(fileName, mimeType, project); try { Counters.OpenDocumentTimer.Trace("Creating content"); DocumentController controller; try { fileInfo.DocumentControllerDescription = binding; controller = fileInfo.DocumentController = await binding.CreateController(fileDescriptor); } catch (InvalidEncodingException iex) { monitor.ReportError(GettextCatalog.GetString("The file '{0}' could not opened. {1}", fileName, iex.Message), null); return(null); } catch (OverflowException) { monitor.ReportError(GettextCatalog.GetString("The file '{0}' could not opened. File too large.", fileName), null); return(null); } if (controller == null) { monitor.ReportError(GettextCatalog.GetString("The file '{0}' could not be opened.", fileName), null); return(null); } Counters.OpenDocumentTimer.Trace("Loading file"); try { await controller.Initialize(fileDescriptor, GetStoredMemento (fileName)); controller.OriginalContentName = fileInfo.OriginalFileName; if (fileInfo.Owner != null) { controller.Owner = fileInfo.Owner; } } catch (InvalidEncodingException iex) { monitor.ReportError(GettextCatalog.GetString("The file '{0}' could not opened. {1}", fileName, iex.Message), iex); return(null); } catch (OverflowException) { monitor.ReportError(GettextCatalog.GetString("The file '{0}' could not opened. File too large.", fileName), null); return(null); } } catch (Exception ex) { monitor.ReportError(GettextCatalog.GetString("The file '{0}' could not be opened.", fileName), ex); return(null); } Counters.OpenDocumentTimer.Trace("Showing view"); var doc = await ShowView(fileInfo); ScrollToRequestedCaretLocation(doc, fileInfo); return(doc); }
async Task <(bool Success, Document Content)> RealOpenFile(ProgressMonitor monitor, FileOpenInformation openFileInfo) { FilePath fileName; await InitDesktopService(); Counters.OpenDocumentTimer.Trace("Checking file"); string origName = openFileInfo.FileName; if (origName == null) { monitor.ReportError(GettextCatalog.GetString("Invalid file name"), null); return(false, null); } fileName = openFileInfo.FileName; if (!origName.StartsWith("http://", StringComparison.Ordinal)) { fileName = fileName.FullPath; } //Debug.Assert(FileService.IsValidPath(fileName)); if (FileService.IsDirectory(fileName)) { monitor.ReportError(GettextCatalog.GetString("{0} is a directory", fileName), null); return(false, null); } // test, if file fileName exists if (!origName.StartsWith("http://", StringComparison.Ordinal)) { // test, if an untitled file should be opened if (!Path.IsPathRooted(origName)) { foreach (Document doc in Documents) { if (doc.IsNewDocument && doc.FilePath == origName) { doc.Select(); ScrollToRequestedCaretLocation(doc, openFileInfo); return(true, doc); } } } if (!File.Exists(fileName)) { monitor.ReportError(GettextCatalog.GetString("File not found: {0}", fileName), null); return(false, null); } } Counters.OpenDocumentTimer.Trace("Looking for binding"); var documentControllerService = await ServiceProvider.GetService <DocumentControllerService> (); IExternalDisplayBinding externalBinding = null; DocumentControllerDescription internalBinding = null; WorkspaceObject project = null; if (openFileInfo.Owner == null) { var workspace = await ServiceProvider.GetService <RootWorkspace> (); // Set the project if one can be found. The project on the FileOpenInformation // is used to add project metadata to the OpenDocumentTimer counter. project = workspace.GetProjectContainingFile(fileName); // In some cases, the file may be a symlinked file. We cannot find the resolved symlink path // in the project, so we should try looking up the original file. if (project == null) { project = workspace.GetProjectContainingFile(openFileInfo.OriginalFileName); } openFileInfo.Owner = project; } else { project = openFileInfo.Owner; } var displayBindingService = await ServiceProvider.GetService <DisplayBindingService> (); var fileDescriptor = new FileDescriptor(fileName, null, project); var internalViewers = await documentControllerService.GetSupportedControllers(fileDescriptor); var externalViewers = displayBindingService.GetDisplayBindings(fileName, null, project as Project).OfType <IExternalDisplayBinding> ().ToList(); if (openFileInfo.DocumentControllerDescription != null) { internalBinding = openFileInfo.DocumentControllerDescription; } else { var bindings = displayBindingService.GetDisplayBindings(fileName, null, project as Project).ToList(); if (openFileInfo.Options.HasFlag(OpenDocumentOptions.OnlyInternalViewer)) { internalBinding = internalViewers.FirstOrDefault(d => d.CanUseAsDefault) ?? internalViewers.FirstOrDefault(); } else if (openFileInfo.Options.HasFlag(OpenDocumentOptions.OnlyExternalViewer)) { externalBinding = externalViewers.FirstOrDefault(d => d.CanUseAsDefault) ?? externalViewers.FirstOrDefault(); } else { internalBinding = internalViewers.FirstOrDefault(d => d.CanUseAsDefault); if (internalBinding == null) { externalBinding = externalViewers.FirstOrDefault(d => d.CanUseAsDefault); if (externalBinding == null) { internalBinding = internalViewers.FirstOrDefault(); if (internalBinding == null) { externalBinding = externalViewers.FirstOrDefault(); } } } } } Document newContent = null; try { if (internalBinding != null) { newContent = await LoadFile(fileName, monitor, internalBinding, project, openFileInfo); } else if (externalBinding != null) { var extBinding = (IExternalDisplayBinding)externalBinding; var app = extBinding.GetApplication(fileName, null, project as Project); app.Launch(fileName); } else if (!openFileInfo.Options.HasFlag(OpenDocumentOptions.OnlyInternalViewer)) { try { Counters.OpenDocumentTimer.Trace("Showing in browser"); desktopService.OpenFile(fileName); } catch (Exception ex) { LoggingService.LogError("Error opening file: " + fileName, ex); MessageService.ShowError(GettextCatalog.GetString("File '{0}' could not be opened", fileName)); return(false, null); } } Counters.OpenDocumentTimer.Trace("Adding to recent files"); desktopService.RecentFiles.AddFile(fileName, project); } catch (Exception ex) { monitor.ReportError(GettextCatalog.GetString("The file '{0}' could not be opened.", fileName), ex); return(false, null); } return(true, newContent); }
public static void AddTask(string fileName, string message, int column, int line, TaskSeverity taskType, WorkspaceObject workspaceObject) { // HACK: Use a compiler error since we cannot add an error // task otherwise (task type property is read-only and // no constructors usable). BuildError error = new BuildError(); error.Column = column; error.Line = line; error.ErrorText = message; error.FileName = fileName; error.IsWarning = false; //Task task = new Task(fileName, message, column, line); TaskListEntry task = new TaskListEntry(error); task.WorkspaceObject = workspaceObject; task.Owner = ActiveEditor; TaskService.Errors.Add(task); }
public TaskListEntry (FilePath file, string description, int column, int line, TaskSeverity severity, TaskPriority priority, WorkspaceObject parent, object owner) : this (file, description, column, line, severity, priority, parent, owner, null) { }
protected bool DotNetCoreSupportsObject(WorkspaceObject item) { return(base.SupportsObject(item) && IsSdkProject((DotNetProject)item)); }
protected UnitTestGroup(string name, WorkspaceObject ownerSolutionItem) : base(name, ownerSolutionItem) { }
/// <summary> /// Validates the schema. /// </summary> public static XmlSchema ValidateSchema(ProgressMonitor monitor, string xml, string fileName, WorkspaceObject workspaceObject) { monitor.BeginTask(GettextCatalog.GetString("Validating schema..."), 1); bool error = false; XmlSchema schema = null; try { StringReader stringReader = new StringReader(xml); XmlTextReader xmlReader = new XmlTextReader(stringReader); xmlReader.XmlResolver = null; ValidationEventHandler callback = delegate(object source, ValidationEventArgs args) { if (args.Severity == XmlSeverityType.Warning) { monitor.ReportWarning(args.Message); } else { monitor.ReportError(args.Message, args.Exception); error = true; } AddTask(fileName, args.Message, args.Exception.LinePosition, args.Exception.LineNumber, (args.Severity == XmlSeverityType.Warning)? TaskSeverity.Warning : TaskSeverity.Error, workspaceObject); }; schema = XmlSchema.Read(xmlReader, callback); XmlSchemaSet sset = new XmlSchemaSet(); sset.Add(schema); sset.ValidationEventHandler += callback; sset.Compile(); } catch (XmlSchemaException ex) { monitor.ReportError(ex.Message, ex); AddTask(fileName, ex.Message, ex.LinePosition, ex.LineNumber, TaskSeverity.Error, workspaceObject); error = true; } catch (XmlException ex) { monitor.ReportError(ex.Message, ex); AddTask(fileName, ex.Message, ex.LinePosition, ex.LineNumber, TaskSeverity.Error, workspaceObject); error = true; } if (error) { monitor.Log.WriteLine(GettextCatalog.GetString("Validation failed.")); TaskService.ShowErrors(); } else { monitor.Log.WriteLine(GettextCatalog.GetString("Schema is valid.")); } monitor.EndTask(); return(error? null: schema); }
/// <summary> /// Validates the xml against known schemas. /// </summary> public static XmlDocument ValidateXml(ProgressMonitor monitor, string xml, string fileName, WorkspaceObject workspaceObject) { monitor.BeginTask(GettextCatalog.GetString("Validating XML..."), 1); bool error = false; XmlDocument doc = null; StringReader stringReader = new StringReader(xml); XmlReaderSettings settings = new XmlReaderSettings(); settings.ValidationFlags = XmlSchemaValidationFlags.ProcessIdentityConstraints | XmlSchemaValidationFlags.ProcessInlineSchema | XmlSchemaValidationFlags.ProcessSchemaLocation | XmlSchemaValidationFlags.ReportValidationWarnings; settings.ValidationType = ValidationType.Schema; settings.DtdProcessing = DtdProcessing.Parse; ValidationEventHandler validationHandler = delegate(object sender, System.Xml.Schema.ValidationEventArgs args) { if (args.Severity == XmlSeverityType.Warning) { monitor.Log.WriteLine(args.Message); AddTask(fileName, args.Exception.Message, args.Exception.LinePosition, args.Exception.LineNumber, TaskSeverity.Warning, workspaceObject); } else { AddTask(fileName, args.Exception.Message, args.Exception.LinePosition, args.Exception.LineNumber, TaskSeverity.Error, workspaceObject); monitor.Log.WriteLine(args.Message); error = true; } }; settings.ValidationEventHandler += validationHandler; try { foreach (XmlSchemaCompletionData sd in XmlSchemaManager.SchemaCompletionDataItems) { settings.Schemas.Add(sd.Schema); } settings.Schemas.Compile(); XmlReader reader = XmlReader.Create(stringReader, settings); doc = new XmlDocument(); doc.Load(reader); } catch (XmlSchemaException ex) { monitor.ReportError(ex.Message, ex); AddTask(fileName, ex.Message, ex.LinePosition, ex.LineNumber, TaskSeverity.Error, workspaceObject); error = true; } catch (XmlException ex) { monitor.ReportError(ex.Message, ex); AddTask(fileName, ex.Message, ex.LinePosition, ex.LineNumber, TaskSeverity.Error, workspaceObject); error = true; } finally { if (stringReader != null) { stringReader.Dispose(); } settings.ValidationEventHandler -= validationHandler; } if (error) { monitor.Log.WriteLine(GettextCatalog.GetString("Validation failed.")); TaskService.ShowErrors(); } else { monitor.Log.WriteLine(GettextCatalog.GetString("XML is valid.")); } monitor.EndTask(); return(error? null: doc); }
protected override bool SupportsObject(WorkspaceObject item) { return(base.SupportsObject(item) && IsDotNetCoreProject((DotNetProject)item)); }
public NUnitAssemblyTestSuite(string name, WorkspaceObject ownerSolutionItem) : base(name, ownerSolutionItem) { }
public SystemFolder(FilePath absolutePath, WorkspaceObject parent, bool showTransparent) { this.absolutePath = absolutePath; this.parent = parent; this.showTransparent = showTransparent; }
public SystemFolder(FilePath absolutePath, WorkspaceObject parent) : this(absolutePath, parent, true) { }
public static UnitTest FindRootTest(WorkspaceObject item) { return(FindRootTest(RootTests, item)); }
bool SetSelection (TreeIter it, WorkspaceObject selected, HashSet<WorkspaceObject> active) { do { WorkspaceObject item = (WorkspaceObject) store.GetValue (it, 2); if (selected != null && item == selected) { tree.Selection.SelectIter (it); tree.ExpandToPath (store.GetPath (it)); tree.ScrollToCell (store.GetPath (it), tree.Columns[0], false, 0, 0); if (active == null) return true; } bool val = (bool) store.GetValue (it, 3); bool newVal = active != null ? active.Contains (item) : val; if (val != newVal) store.SetValue (it, 3, newVal); TreeIter ci; if (store.IterChildren (out ci, it)) { if (SetSelection (ci, selected, active)) return true; } } while (store.IterNext (ref it)); return false; }
public FileOpenInformation(FilePath filePath, WorkspaceObject project = null) { this.OriginalFileName = filePath; this.FileName = filePath; this.Owner = project; }
IEnumerable<WorkspaceObject> GetChildren (WorkspaceObject item) { if (item is SolutionFolder) { return ((SolutionFolder)item).Items; } else if (item is Solution) { return ((Solution)item).RootFolder.Items; } else if (item is Workspace) { return ((Workspace)item).Items; } else return new WorkspaceObject [0]; }
public Task <Document> OpenDocument(FilePath fileName, WorkspaceObject project, OpenDocumentOptions options = OpenDocumentOptions.Default) { return(OpenDocument(fileName, project, -1, -1, options, null, null)); }
protected bool IsCheckboxVisible (WorkspaceObject item) { if (!ShowCheckboxes) return false; return IsSelectable (item); }
public void ShowOptions (WorkspaceObject entry) { ShowOptions (entry, null); }
public FileDescriptor(FilePath filePath, string mimeType, WorkspaceObject owner) { FilePath = filePath; MimeType = mimeType; Owner = owner; }
protected override bool SupportsObject(WorkspaceObject item) { return(base.SupportsObject(item) && IdeApp.IsInitialized); }
public bool BelongsToItem (WorkspaceObject item, bool checkHierarchy) { if (!checkHierarchy) return item == parentObject; WorkspaceObject cit = parentObject; do { if (cit == item) return true; if (cit is SolutionFolderItem) { var sfi = (SolutionFolderItem) cit; if (sfi.ParentFolder != null) cit = sfi.ParentFolder; else cit = sfi.ParentSolution; } else if (cit is WorkspaceItem) { cit = ((WorkspaceItem)cit).ParentWorkspace; } else cit = null; } while (cit != null); return false; }
public Task <Document> OpenDocument(FilePath fileName, WorkspaceObject project, bool bringToFront) { return(OpenDocument(fileName, project, bringToFront ? OpenDocumentOptions.Default : OpenDocumentOptions.Default& ~OpenDocumentOptions.BringToFront)); }
public TaskListEntry (FilePath file, string description, int column, int line, TaskSeverity severity, TaskPriority priority, WorkspaceObject parent, object owner, string category) { this.file = file; this.description = description; this.column = column; this.line = line; this.severity = severity; this.priority = priority; this.owner = owner; this.parentObject = parent; this.category = category; }
internal static bool ContainsTarget (WorkspaceObject owner, WorkspaceObject target) { if (owner == target) return true; else if (target is RootWorkspace) return ContainsTarget (owner, IdeApp.ProjectOperations.CurrentSelectedSolution); else if (owner is WorkspaceItem) return ((WorkspaceItem)owner).ContainsItem (target); return false; }
static void GetFiles (List<FilePath> files, WorkspaceObject entry) { // Ensure that we strip out all linked files from outside of the solution/projects path. if (entry is IWorkspaceFileObject) files.AddRange (((IWorkspaceFileObject)entry).GetItemFiles (true).Where (file => file.CanonicalPath.IsChildPathOf (entry.BaseDirectory))); }
public static bool Publish(WorkspaceObject entry, FilePath localPath, bool test) { if (test) { return(VersionControlService.CheckVersionControlInstalled() && VersionControlService.GetRepository(entry) == null); } List <FilePath> files = new List <FilePath> (); // Build the list of files to be checked in string moduleName = entry.Name; if (localPath == entry.BaseDirectory) { GetFiles(files, entry); } else if (entry is Project) { foreach (ProjectFile file in ((Project)entry).Files.GetFilesInPath(localPath)) { if (file.Subtype != Subtype.Directory) { files.Add(file.FilePath); } } } else { return(false); } if (files.Count == 0) { return(false); } SelectRepositoryDialog dlg = new SelectRepositoryDialog(SelectRepositoryMode.Publish); try { dlg.ModuleName = moduleName; dlg.Message = GettextCatalog.GetString("Initial check-in of module {0}", moduleName); do { if (MessageService.RunCustomDialog(dlg) == (int)Gtk.ResponseType.Ok && dlg.Repository != null) { AlertButton publishButton = new AlertButton(GettextCatalog.GetString("_Publish")); if (MessageService.AskQuestion(GettextCatalog.GetString("Are you sure you want to publish the project?"), GettextCatalog.GetString("The project will be published to the repository '{0}', module '{1}'.", dlg.Repository.Name, dlg.ModuleName), AlertButton.Cancel, publishButton) == publishButton) { PublishWorker w = new PublishWorker(dlg.Repository, dlg.ModuleName, localPath, files.ToArray(), dlg.Message); w.Start(); break; } } else { break; } } while (true); } finally { dlg.Destroy(); dlg.Dispose(); } return(true); }
public bool IsRunning (WorkspaceObject target) { var owner = currentRunOperationOwner as WorkspaceObject; return owner != null && !currentRunOperation.IsCompleted && ContainsTarget (target, owner); }
/// <summary> /// Checks that the xml in this view is well-formed. /// </summary> public static XmlDocument ValidateWellFormedness(ProgressMonitor monitor, string xml, string fileName, WorkspaceObject workspaceObject) { monitor.BeginTask(GettextCatalog.GetString("Validating XML..."), 1); bool error = false; XmlDocument doc = null; try { doc = new XmlDocument(); doc.LoadXml(xml); } catch (XmlException ex) { monitor.ReportError(ex.Message, ex); AddTask(fileName, ex.Message, ex.LinePosition, ex.LineNumber, TaskSeverity.Error, workspaceObject); error = true; } if (error) { monitor.Log.WriteLine(GettextCatalog.GetString("Validation failed.")); TaskService.ShowErrors(); } else { monitor.Log.WriteLine(GettextCatalog.GetString("XML is valid.")); } monitor.EndTask(); return(error? null: doc); }
public Task SaveAsync (WorkspaceObject item) { if (item is IWorkspaceFileObject) return SaveAsync ((IWorkspaceFileObject)item); if (item.ParentObject != null) return SaveAsync (item.ParentObject); return Task.FromResult (0); }
public Task <Document> OpenDocument(FilePath fileName, WorkspaceObject project, int line, int column, Encoding encoding, OpenDocumentOptions options = OpenDocumentOptions.Default) { return(OpenDocument(fileName, project, line, column, options, encoding, null)); }
public async void ShowOptions (WorkspaceObject entry, string panelId) { if (entry is SolutionItem) { var selectedProject = (SolutionItem) entry; var optionsDialog = new ProjectOptionsDialog (IdeApp.Workbench.RootWindow, selectedProject); var conf = selectedProject.GetConfiguration (IdeApp.Workspace.ActiveConfiguration); optionsDialog.CurrentConfig = conf != null ? conf.Name : null; optionsDialog.CurrentPlatform = conf != null ? conf.Platform : null; try { if (panelId != null) optionsDialog.SelectPanel (panelId); if (MessageService.RunCustomDialog (optionsDialog) == (int)Gtk.ResponseType.Ok) { foreach (object ob in optionsDialog.ModifiedObjects) { if (ob is Solution) { await SaveAsync ((Solution)ob); return; } } await SaveAsync (selectedProject); IdeApp.Workspace.SavePreferences (); IdeApp.Workbench.ReparseOpenDocuments (); } } finally { optionsDialog.Destroy (); optionsDialog.Dispose (); } } else if (entry is Solution) { Solution solution = (Solution) entry; var optionsDialog = new CombineOptionsDialog (IdeApp.Workbench.RootWindow, solution); optionsDialog.CurrentConfig = IdeApp.Workspace.ActiveConfigurationId; try { if (panelId != null) optionsDialog.SelectPanel (panelId); if (MessageService.RunCustomDialog (optionsDialog) == (int) Gtk.ResponseType.Ok) { await SaveAsync (solution); await IdeApp.Workspace.SavePreferences (solution); } } finally { optionsDialog.Destroy (); optionsDialog.Dispose (); } } else { ItemOptionsDialog optionsDialog = new ItemOptionsDialog (IdeApp.Workbench.RootWindow, entry); try { if (panelId != null) optionsDialog.SelectPanel (panelId); if (MessageService.RunCustomDialog (optionsDialog) == (int) Gtk.ResponseType.Ok) { if (entry is IWorkspaceFileObject) await SaveAsync ((IWorkspaceFileObject) entry); else { SolutionFolderItem si = entry as SolutionFolderItem; if (si.ParentSolution != null) await SaveAsync (si.ParentSolution); } IdeApp.Workspace.SavePreferences (); } } finally { optionsDialog.Destroy (); optionsDialog.Dispose (); } } }
public override void BuildNode(ITreeBuilder builder, object dataObject, NodeInfo nodeInfo) { if (!builder.Options["ShowVersionControlOverlays"]) { return; } // Add status overlays if (dataObject is WorkspaceObject) { WorkspaceObject ce = (WorkspaceObject)dataObject; Repository rep = VersionControlService.GetRepository(ce); if (rep != null) { rep.GetDirectoryVersionInfo(ce.BaseDirectory, false, false); AddFolderOverlay(rep, ce.BaseDirectory, nodeInfo, false); } return; } else if (dataObject is ProjectFolder) { ProjectFolder ce = (ProjectFolder)dataObject; if (ce.ParentWorkspaceObject != null) { Repository rep = VersionControlService.GetRepository(ce.ParentWorkspaceObject); if (rep != null) { rep.GetDirectoryVersionInfo(ce.Path, false, false); AddFolderOverlay(rep, ce.Path, nodeInfo, true); } } return; } WorkspaceObject prj; FilePath file; if (dataObject is ProjectFile) { ProjectFile pfile = (ProjectFile)dataObject; prj = pfile.Project; file = pfile.FilePath; } else { SystemFile pfile = (SystemFile)dataObject; prj = pfile.ParentWorkspaceObject; file = pfile.Path; } if (prj == null) { return; } Repository repo = VersionControlService.GetRepository(prj); if (repo == null) { return; } VersionInfo vi = repo.GetVersionInfo(file); var overlay = VersionControlService.LoadOverlayIconForStatus(vi.Status); if (overlay != null) { nodeInfo.OverlayBottomRight = overlay; } }