/// <summary>
        /// Add file to the manifest.
        /// </summary>
        public override void Execute()
        {
            EnterValueWindow dlg = new EnterValueWindow();

            dlg.Title       = "Manually Enter File";
            dlg.InputLabel  = "Enter category and API name separated by a slash\n (for example: ApexClass/BranchController):";
            dlg.ActionLabel = "Add";
            if (App.ShowDialog(dlg))
            {
                if (String.IsNullOrWhiteSpace(dlg.EnteredValue))
                {
                    throw new Exception("You must enter a category and API name to create a manual file entry.");
                }

                string[] parts = dlg.EnteredValue.Split(new char[] { '/' });
                if (parts.Length != 2)
                {
                    throw new Exception("Invalid entry.  You must enter a category and API name in the format CATEGORY/API_NAME.");
                }

                if (CurrentDocument != null)
                {
                    CurrentDocument.AddFile(new SourceFile(parts[0], parts[1]));
                }
            }
        }
        /// <summary>
        /// Opens a new data edit view.
        /// </summary>
        public override void Execute()
        {
            if (App.Instance.SalesForceApp.CurrentProject != null)
            {
                Project project = App.Instance.SalesForceApp.CurrentProject;

                EnterValueWindow dlg = new EnterValueWindow();
                dlg.Title       = "Create Snippet";
                dlg.ActionLabel = "Enter Snippet Name:";
                dlg.ActionLabel = "Create";
                if (App.ShowDialog(dlg))
                {
                    string path = System.IO.Path.Combine(Project.SystemSnippetsFolder, String.Format("{0}.snippet", dlg.EnteredValue));
                    if (System.IO.File.Exists(path))
                    {
                        throw new Exception("There is already a snippet named: " + dlg.EnteredValue);
                    }

                    using (System.IO.File.Create(path))
                    {
                    }

                    SnippetSystemFolderNode snippetFolderNode = App.Instance.Navigation.GetNode <SnippetSystemFolderNode>();
                    if (snippetFolderNode != null)
                    {
                        snippetFolderNode.AddSnippet(path);
                    }

                    App.Instance.Content.OpenDocument(new SnippetEditorDocument(project, path));
                }
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Opens a new data edit view.
        /// </summary>
        public override void Execute()
        {
            if (App.Instance.SalesForceApp.CurrentProject != null)
            {
                Project project = App.Instance.SalesForceApp.CurrentProject;

                EnterValueWindow dlg = new EnterValueWindow();
                dlg.Title       = "Create Manifest";
                dlg.ActionLabel = "Enter Manifest Name:";
                dlg.ActionLabel = "Create";
                if (App.ShowDialog(dlg))
                {
                    Manifest manifest = new Manifest(System.IO.Path.Combine(
                                                         project.ManifestFolder,
                                                         String.Format("{0}.xml", dlg.EnteredValue)));

                    if (App.Instance.SalesForceApp.CurrentProject.GetManifests().Contains(manifest))
                    {
                        throw new Exception("There is already a manifest named: " + manifest.Name);
                    }

                    manifest.Save();

                    ManifestFolderNode manifestFolderNode = App.Instance.Navigation.GetNode <ManifestFolderNode>();
                    if (manifestFolderNode != null)
                    {
                        manifestFolderNode.AddManifest(manifest);
                    }

                    App.Instance.Content.OpenDocument(new ManifestEditorDocument(project, manifest));
                }
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Create a new component.
        /// </summary>
        public override void Execute()
        {
            EnterValueWindow dlg = new EnterValueWindow();

            dlg.Title          = "Create Component";
            dlg.InputLabel     = "Component Name:";
            dlg.ActionLabel    = "Create";
            dlg.InputMaxLength = 80;
            if (App.ShowDialog(dlg))
            {
                Project project = App.Instance.SalesForceApp.CurrentProject;
                if (project != null)
                {
                    using (App.Wait("Creating Component"))
                    {
                        SourceFile file = project.Client.Meta.CreateComponent(dlg.EnteredValue, EditorSettings.VisualForceSettings.CreateHeader());
                        ApexComponentFolderNode folder = App.Instance.Navigation.GetNode <ApexComponentFolderNode>();
                        if (folder != null)
                        {
                            folder.AddApexComponent(file);
                        }

                        App.Instance.Content.OpenDocument(new VisualForceEditorDocument(project, file));
                    }
                }
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Comment out selected lines.
        /// </summary>
        public override void Execute()
        {
            if (App.Instance.SalesForceApp.CurrentProject != null)
            {
                EnterValueWindow dlg = new EnterValueWindow();
                dlg.Title       = "Search Files";
                dlg.InputLabel  = "Enter the text to search for\n(only files that have been indexed will be searched):";
                dlg.ActionLabel = "Search";
                if (App.ShowDialog(dlg))
                {
                    using (App.Wait("Searching"))
                    {
                        using (SearchIndex searchIndex = new SearchIndex(App.Instance.SalesForceApp.CurrentProject.SearchFolder))
                        {
                            SearchFilesResultDocument document = new SearchFilesResultDocument(
                                App.Instance.SalesForceApp.CurrentProject,
                                dlg.EnteredValue,
                                searchIndex.DocumentCount,
                                searchIndex.Search(String.Format("\"{0}\"", dlg.EnteredValue)));

                            App.Instance.Content.OpenDocument(document);
                        }
                    }
                }
            }
        }
Esempio n. 6
0
 /// <summary>
 /// Paste the text to the editor.
 /// </summary>
 public override void Execute()
 {
     if (CurrentDocument != null)
     {
         EnterValueWindow dlg = new EnterValueWindow();
         dlg.Title            = "Go to line";
         dlg.InputLabel       = "Line number:";
         dlg.ActionLabel      = "Go";
         dlg.InputRestriction = "[0-9]";
         if (App.ShowDialog(dlg) && !String.IsNullOrWhiteSpace(dlg.EnteredValue))
         {
             CurrentDocument.GotToLine(int.Parse(dlg.EnteredValue));
         }
     }
 }