public void DeployProject(Project project)
        {
            if (project.DeployInformation.DeployTarget.Length == 0) {
                Runtime.MessageService.ShowError(GettextCatalog.GetString ("Can't deploy: you forgot to specify a deployment script"));
                return;
            }

            try {
                FileUtilityService fileUtilityService = Runtime.FileUtilityService;
                foreach (ProjectFile fInfo in project.ProjectFiles) {
                    try {
                        if (!project.DeployInformation.IsFileExcluded(fInfo.Name)) {
                            string newFileName = fileUtilityService.GetDirectoryNameWithSeparator(project.DeployInformation.DeployTarget) + fileUtilityService.AbsoluteToRelativePath(project.BaseDirectory, fInfo.Name);
                            if (!Directory.Exists(Path.GetDirectoryName(newFileName))) {
                                Directory.CreateDirectory(Path.GetDirectoryName(newFileName));
                            }
                            File.Copy(fInfo.Name, newFileName, true);
                        }
                    } catch (Exception e) {
                        throw new ApplicationException("Error while copying '" + fInfo.Name + "' to '" + fileUtilityService.GetDirectoryNameWithSeparator(project.DeployInformation.DeployTarget) + fileUtilityService.AbsoluteToRelativePath(project.BaseDirectory, fInfo.Name) + "'.\nException thrown was :\n" + e.ToString());
                    }
                }
            } catch (Exception e) {
                Runtime.MessageService.ShowError(e);
            }
        }
        public IncludeFilesDialog(Project project, StringCollection newFiles)
        {
            Runtime.LoggingService.Info ("*** Include files dialog ***");
            // we must do it from *here* otherwise, we get this assembly, not the caller
            Glade.XML glade = new Glade.XML (null, "Base.glade", "IncludeFilesDialogWidget", null);
            glade.Autoconnect (this);

            // set up dialog title
            this.IncludeFilesDialogWidget.Title = String.Format (GettextCatalog.GetString ("Found new files in {0}"), project.Name);

            newFilesOnlyRadioButton.Active = true;
            this.newFiles = newFiles;
            this.project  = project;

            this.InitialiseIncludeFileList();

            // wire in event handlers
            okbutton.Clicked += new EventHandler(AcceptEvent);
            cancelbutton.Clicked += new EventHandler(CancelEvent);
            selectAllButton.Clicked += new EventHandler(SelectAll);
            deselectAllButton.Clicked += new EventHandler(DeselectAll);

            // FIXME: I'm pretty sure that these radio buttons
            // don't actually work in SD 0.98 either, so disabling them
            newFilesOnlyRadioButton.Sensitive = false;
            allFilesRadioButton.Sensitive = false;
        }
        public static void MoveCopyFile(Project project, ITreeNavigator nav, string filename, bool move, bool alreadyInPlace)
        {
            if (Runtime.FileUtilityService.IsDirectory (filename))
                return;

            ProjectFolder folder = nav.GetParentDataItem (typeof(ProjectFolder), true) as ProjectFolder;

            string name = System.IO.Path.GetFileName (filename);
            string baseDirectory = folder != null ? folder.Path : project.BaseDirectory;
            string newfilename = alreadyInPlace ? filename : Path.Combine (baseDirectory, name);

            if (filename != newfilename) {
                if (File.Exists (newfilename)) {
                    if (!Runtime.MessageService.AskQuestion (string.Format (GettextCatalog.GetString ("The file '{0}' already exists. Do you want to replace it?"), newfilename), "MonoDevelop"))
                        return;
                }
                File.Copy (filename, newfilename, true);
                if (move)
                    Runtime.FileService.RemoveFile (filename);
            }

            if (project.IsCompileable (newfilename)) {
                project.AddFile (newfilename, BuildAction.Compile);
            } else {
                project.AddFile (newfilename, BuildAction.Nothing);
            }

            Runtime.ProjectService.SaveCombine();
        }
        public InsightWindow(SourceEditorView control, Project project, string fileName)
            : base(WindowType.Popup)
        {
            this.control             = control;
            this.fileName = fileName;
            this.project = project;
            /*System.Drawing.Point caretPos  = control.ActiveTextAreaControl.TextArea.Caret.Position;
            System.Drawing.Point visualPos = new System.Drawing.Point(control.ActiveTextAreaControl.TextArea.TextView.GetDrawingXPos(caretPos.Y, caretPos.X) + control.ActiveTextAreaControl.TextArea.TextView.DrawingPosition.X,
                      (int)((1 + caretPos.Y) * control.ActiveTextAreaControl.TextArea.TextView.FontHeight) - control.ActiveTextAreaControl.TextArea.VirtualTop.Y - 1 + control.ActiveTextAreaControl.TextArea.TextView.DrawingPosition.Y);*/

            //control.ActiveTextAreaControl.Caret.PositionChanged += new EventHandler(CaretOffsetChanged);
            //			control.TextAreaPainter.IHaveTheFocusChanged += focusEventHandler;

            AddEvents ((int) (Gdk.EventMask.KeyPressMask));
            this.SkipPagerHint = true;
            this.SkipTaskbarHint = true;
            this.Decorated = false;
            this.BorderWidth = 2;
            this.TypeHint = Gdk.WindowTypeHint.Dialog;

            desc = new Gtk.Label ("");
            current = new Gtk.Label ("");
            max = new Gtk.Label ("");
            HBox mainBox = new HBox (false, 2);
            mainBox.PackStart (new Gtk.Image (Gtk.Stock.GotoTop, Gtk.IconSize.Menu), false, false, 2);
            mainBox.PackStart (current, false, false, 2);
            mainBox.PackStart (new Gtk.Label (" of "), false, false, 2);
            mainBox.PackStart (max, false, false, 2);
            mainBox.PackStart (new Gtk.Image (Gtk.Stock.GotoBottom, Gtk.IconSize.Menu), false, false, 2);
            mainBox.PackStart (desc);
            Gtk.Frame framer = new Gtk.Frame ();
            framer.Add (mainBox);
            this.Add (framer);
        }
        public AbstractBrowserNode BuildProjectTreeNode(Project project)
        {
            ProjectBrowserNode projectNode = new ProjectBrowserNode(project);

            //projectNode.IconImage = iconService.GetImageForProjectType(project.ProjectType);

            // create 'empty' directories
            for (int i = 0; i < project.ProjectFiles.Count; ++i) {
                if (project.ProjectFiles[i].Subtype == Subtype.Directory) {
                    string directoryName   = fileUtilityService.AbsoluteToRelativePath(project.BaseDirectory, project.ProjectFiles[i].Name);

                    // if directoryname starts with ./ oder .\
                    if (directoryName.StartsWith(".")) {
                        directoryName =  directoryName.Substring(2);
                    }

                    string parentDirectory = Path.GetFileName(directoryName);

                    AbstractBrowserNode currentPathNode = GetPath(directoryName, projectNode, true);

                    DirectoryNode newFolderNode  = new DirectoryNode(project.ProjectFiles[i].Name);
                    //newFolderNode.OpenedImage = resourceService.GetBitmap ("Icons.16x16.OpenFolderBitmap");
                    //newFolderNode.ClosedImage = resourceService.GetBitmap ("Icons.16x16.ClosedFolderBitmap");

                    currentPathNode.Nodes.Add(newFolderNode);

                }
            }

            // create file tree
            for (int i = 0; i < project.ProjectFiles.Count; ++i) {
                if (project.ProjectFiles[i].Subtype != Subtype.Directory) {
                    ProjectFile fileInformation = project.ProjectFiles[i];

                    string relativeFile = fileUtilityService.AbsoluteToRelativePath(project.BaseDirectory, fileInformation.Name);

                    string fileName     = Path.GetFileName(fileInformation.Name);

                    switch (fileInformation.BuildAction) {

                        case BuildAction.Exclude:
                            break;

                        default:
                            AbstractBrowserNode currentPathNode = GetPath(relativeFile, projectNode, true);

                            AbstractBrowserNode newNode = new FileNode(fileInformation);
                            newNode.ContextmenuAddinTreePath = FileNode.ProjectFileContextMenuPath;
                            currentPathNode.Nodes.Add(newNode);
                            break;
                    }
                }
            }

            return projectNode;
        }
示例#6
0
 public Task(Project project, CompilerError error)
 {
     this.project = project;
     type        = error.IsWarning ? error.ErrorNumber == "COMMENT" ? TaskType.Comment : TaskType.Warning : TaskType.Error;
     column      = error.Column;
     line        = error.Line;
     description = error.ErrorText;
     if (error.ErrorNumber != String.Empty)
         description += "(" + error.ErrorNumber + ")";
     fileName    = error.FileName;
 }
 public NUnitProjectTestSuite(Project project)
     : base(project.Name, project)
 {
     storeId = Path.GetFileName (project.FileName);
     resultsPath = Path.Combine (project.BaseDirectory, "test-results");
     ResultsStore = new XmlResultsStore (resultsPath, storeId);
     this.project = project;
     lastAssemblyTime = GetAssemblyTime ();
     project.NameChanged += new CombineEntryRenamedEventHandler (OnProjectRenamed);
     Runtime.ProjectService.EndBuild += new ProjectCompileEventHandler (OnProjectBuilt);
 }
 /*		static string[] extensions = {
     "",
     ".exe",
     ".dll"
 };
 */
 public void DeployProject(Project project)
 {
     if (project.DeployInformation.DeployTarget.Length == 0) {
         Runtime.MessageService.ShowError(GettextCatalog.GetString ("Can't deploy: no deployment target set"));
         return;
     }
     try {
         if (File.Exists (project.GetOutputFileName ()))
             File.Copy (project.GetOutputFileName (), Path.GetFileName (project.GetOutputFileName ()), true);
         else
             throw new Exception("Assembly not found.");
     } catch (Exception e) {
         Runtime.MessageService.ShowError(e);
     }
 }
        public ProjectCodeCompletionDatabase(Project project, ParserDatabase parserDatabase)
            : base(parserDatabase)
        {
            initialFileCheck = true;

            SetLocation (project.BaseDirectory, project.Name);

            this.project = project;
            Read ();

            UpdateFromProject ();

            project.FileChangedInProject += new ProjectFileEventHandler (OnFileChanged);
            project.FileAddedToProject += new ProjectFileEventHandler (OnFileAdded);
            project.FileRemovedFromProject += new ProjectFileEventHandler (OnFileRemoved);
            project.FileRenamedInProject += new ProjectFileRenamedEventHandler (OnFileRenamed);
        }
 public void DeployProject(Project project)
 {
     if (project.DeployInformation.DeployScript.Length == 0) {
         Runtime.MessageService.ShowError(GettextCatalog.GetString ("Can't deploy: you forgot to specify a deployment script"));
         return;
     }
     try {
         FileUtilityService fileUtilityService = Runtime.FileUtilityService;
         if (fileUtilityService.TestFileExists(project.DeployInformation.DeployScript)) {
             ProcessStartInfo pInfo = new ProcessStartInfo(project.DeployInformation.DeployScript);
             pInfo.WorkingDirectory = Path.GetDirectoryName(project.DeployInformation.DeployScript);
             Process.Start(pInfo);
         }
     } catch (Exception e) {
         Runtime.MessageService.ShowError(e, GettextCatalog.GetString ("Error while executing deploy script"));
     }
 }
        public static void BuildChildNodes(ITreeBuilder builder, Project project)
        {
            bool publicOnly = builder.Options ["PublicApiOnly"];

            IParserContext ctx = Runtime.ProjectService.ParserDatabase.GetProjectParserContext (project);
            ArrayList list = ctx.GetNamespaceContents ("", false);
            foreach (object ob in list) {
                if (ob is string) {
                    if (builder.Options ["NestedNamespaces"])
                        builder.AddChild (new NamespaceData (project, ob as string));
                    else {
                        FillNamespaces (builder, project, ob as string);
                    }
                }
                else if (!publicOnly || ((IClass)ob).IsPublic)
                    builder.AddChild (new ClassData (project, ob as IClass));
            }
        }
        Gtk.CellRendererText textRenderer; // used to set an editable node

        #endregion Fields

        #region Constructors

        public ProjectOptionsDialog(Gtk.Window parentWindow, Project project, IAddInTreeNode node, IAddInTreeNode configurationNode)
            : base(parentWindow, null, null)
        {
            this.project = project;
            this.configurationNode = configurationNode;
            this.Title = GettextCatalog.GetString ("Project Options");

            properties = new DefaultProperties();
            properties.SetProperty("Project", project);

            AddNodes(properties, Gtk.TreeIter.Zero, node.BuildChildItems(this));

            //
            // This code has to add treeview node items to the treeview. under a configuration node
            //
            AddConfigurationNodes();

            //TreeView.ButtonReleaseEvent += new EventHandler (OnButtonRelease);

            SelectFirstNode ();
        }
            public CompileFileOptionsWidget(IProperties CustomizationObject)
                : base("Base.glade", "CompileFileOptionsPanel")
            {
                this.project = (Project)((IProperties)CustomizationObject).GetProperty("Project");

                includeLabel.UseUnderline = true;
                store = new ListStore (typeof(bool), typeof(string));
                store.SetSortColumnId (1, SortType.Ascending);
                includeTreeView.Selection.Mode = SelectionMode.None;
                includeTreeView.Model = store;
                CellRendererToggle rendererToggle = new CellRendererToggle ();
                rendererToggle.Activatable = true;
                rendererToggle.Toggled += new ToggledHandler (ItemToggled);
                includeTreeView.AppendColumn ("Choosen", rendererToggle, "active", 0);
                includeTreeView.AppendColumn ("Name", new CellRendererText (), "text", 1);

                foreach (ProjectFile info in project.ProjectFiles) {
                    if (info.BuildAction == BuildAction.Nothing || info.BuildAction == BuildAction.Compile) {
                        string name = Runtime.FileUtilityService.AbsoluteToRelativePath(
                            project.BaseDirectory, info.Name).Substring(2);
                        store.AppendValues (info.BuildAction == BuildAction.Compile ? true : false, name);
                    }
                }
            }
        public SelectReferenceDialog(Project configureProject)
        {
            Glade.XML refXML = new Glade.XML (null, "Base.glade", "AddReferenceDialog", null);
            refXML.Autoconnect (this);

            refTreeStore = new TreeStore (typeof (string), typeof(string), typeof(string), typeof(ProjectReference));
            ReferencesTreeView.Model = refTreeStore;

            ReferencesTreeView.AppendColumn (GettextCatalog.GetString("Reference Name"), new CellRendererText (), "text", 0);
            ReferencesTreeView.AppendColumn (GettextCatalog.GetString ("Type"), new CellRendererText (), "text", 1);
            ReferencesTreeView.AppendColumn (GettextCatalog.GetString ("Location"), new CellRendererText (), "text", 2);

            projectRefPanel = new ProjectReferencePanel (this);
            gacRefPanel = new GacReferencePanel (this);
            SetProject (configureProject);

            mainBook.RemovePage (mainBook.CurrentPage);
            mainBook.AppendPage (gacRefPanel, new Label (GettextCatalog.GetString ("Global Assembly Cache")));
            mainBook.AppendPage (projectRefPanel, new Label (GettextCatalog.GetString ("Projects")));
            mainBook.AppendPage (new AssemblyReferencePanel (this), new Label (GettextCatalog.GetString (".Net Assembly")));
            ReferencesTreeView.Selection.Changed += new EventHandler (OnChanged);
            AddReferenceDialog.ShowAll ();
            OnChanged (null, null);
        }
        public void SetupDataProvider(Project project, string fileName, SourceEditorView textArea)
        {
            this.fileName = fileName;
            this.textArea = textArea;
            Gtk.TextIter initialIter = textArea.Buffer.GetIterAtMark (textArea.Buffer.InsertMark);
            initialOffset = initialIter.Offset;

            string word         = TextUtilities.GetExpressionBeforeOffset(textArea, initialOffset);
            string methodObject = word;

            // the parser works with 1 based coordinates
            int caretLineNumber      = initialIter.Line + 1;
            int caretColumn          = initialIter.LineOffset + 1;

            IParserContext parserContext;
            if (project != null)
                parserContext = Runtime.ProjectService.ParserDatabase.GetProjectParserContext (project);
            else
                parserContext = Runtime.ProjectService.ParserDatabase.GetFileParserContext (fileName);

            ResolveResult results = parserContext.Resolve (methodObject, caretLineNumber, caretColumn, fileName, textArea.Buffer.Text);

            if (results != null && results.Type != null) {
                foreach (IClass c in parserContext.GetClassInheritanceTree (results.Type)) {
                    foreach (IIndexer indexer in c.Indexer) {
                        methods.Add(indexer);
                    }
                }

                //FIXME: This shouldnt be commented out, but i replaced the parser and cant figure this out
                /*foreach (object o in results.ResolveContents) {
                    if (o is IClass) {
                        foreach (IClass c in ((IClass)o).ClassInheritanceTree) {
                            foreach (IIndexer indexer in c.Indexer) {
                                methods.Add(indexer);
                            }
                        }
                    }
                }*/
            }
        }
 public ProjectFileRenamedEventArgs(Project project, ProjectFile file, string oldName)
     : base(project, file)
 {
     this.oldName = oldName;
 }
 public ProjectFileEventArgs(Project project, ProjectFile file)
 {
     this.project = project;
     this.file = file;
 }
 public ProjectReferenceEventArgs(Project project, ProjectReference reference)
 {
     this.project = project;
     this.reference = reference;
 }
 public ProjectFolder(string absolutePath, Project project, object parent)
 {
     this.parent = parent;
     this.project = project;
     this.absolutePath = absolutePath;
 }
 public ProjectFolder(string absolutePath, Project project)
     : this(absolutePath, project, null)
 {
 }
 void AddFiles(Project project)
 {
     foreach (ProjectFile file in project.ProjectFiles) {
         if (file.BuildAction == BuildAction.Compile &&
             file.Subtype     == Subtype.Code) {
             files.Add(file.Name);
         }
     }
 }
 public void GenerateMakefile(Project project, Combine parentCombine)
 {
     compilerServices.GenerateMakefile(project, parentCombine);
 }
        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.ProjectFiles)
            {
                string dir;

                // Resource files are shown in a special resource folder (?!?!).
                if (file.BuildAction == BuildAction.EmbedAsResource)
                    continue;

                if (file.Subtype != Subtype.Directory) {
                    dir = Path.GetDirectoryName (file.Name);
                    if (dir == folder) {
                        files.Add (file);
                        continue;
                    }
                } else
                    dir = file.Name;

                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 GenerateMakefile(Project project, Combine parentCombine)
 {
     // FIXME: dont abort for now
     // throw new NotImplementedException ();
 }
 public bool CanBuildProjectTree(Project project)
 {
     DotNetProject dp = project as DotNetProject;
     return dp != null && dp.LanguageName == VBLanguageBinding.LanguageName;
 }
        public void SaveFile(Project project, string filename, string content, bool showFile)
        {
            project.ProjectFiles.Add (new ProjectFile(filename));

            StreamWriter sr = System.IO.File.CreateText (filename);
            sr.Write (Runtime.StringParserService.Parse(content, new string[,] { {"PROJECT", txt_name.Text}, {"FILE", System.IO.Path.GetFileName(filename)}}));
            sr.Close();

            if (showFile) {
                string longfilename = fileUtilityService.GetDirectoryNameWithSeparator (ProjectSolution) + Runtime.StringParserService.Parse(filename, new string[,] { {"PROJECT", txt_name.Text}});
                Runtime.FileService.OpenFile (longfilename);
            }
        }
示例#27
0
 public bool CanParse(Project project)
 {
     return project.ProjectType == "VBNET";
 }
 public ClassInformationEventArgs(string fileName, ClassUpdateInformation classInformation, Project project)
 {
     this.project = project;
     this.fileName = fileName;
     this.classInformation = classInformation;
 }
 public void GenerateMakefile(Project project, Combine parentCombine)
 {
     compilerManager.GenerateMakefile (project, parentCombine);
 }
 public static NUnitProjectTestSuite CreateTest(Project project)
 {
     foreach (ProjectReference p in project.ProjectReferences)
         if (p.Reference.IndexOf ("nunit.framework") != -1)
             return new NUnitProjectTestSuite (project);
     return null;
 }