private void AddOtherResourceItems(MergableMenu menu, string path)
        {
            bool addLibrary = project.HasLibraries && project.IsLibraryAsset(path);

            menu.Add(Open, 0);
            menu.Add(Execute, 0);
            menu.Add(ShellMenu, 0);
            menu.Add(Insert, 0);
            if (project.HasLibraries)
            {
                menu.Add(AddLibrary, 2, addLibrary);
            }
            if (addLibrary)
            {
                menu.Add(LibraryOptions, 2);
            }
            AddFileItems(menu, path);
        }
        private void AddFileItems(MergableMenu menu, string path, bool addPaste)
        {
            bool hidden     = project.IsPathHidden(path);
            bool showHidden = project.ShowHiddenPaths;

            menu.Add(Cut, 1);
            menu.Add(Copy, 1);

            if (addPaste)
            {
                menu.Add(Paste, 1);
            }

            menu.Add(Delete, 1);
            menu.Add(Rename, 1);
            menu.Add(Hide, 3, hidden);
            menu.Add(ShowHidden, 3, showHidden);
        }
Example #3
0
 private void AddProjectOutputItems(MergableMenu menu, ProjectOutputNode node)
 {
     if (node.FileExists)
     {
         menu.Add(Open, 0);
         menu.Add(Execute, 0);
         menu.Add(FindAndReplace, 0);
         if (Win32.ShouldUseWin32())
         {
             menu.Add(ShellMenu, 0);
         }
         AddFileItems(menu, node.BackingPath);
     }
     else
     {
         menu.Add(NoProjectOutput, 0);
     }
 }
Example #4
0
 private void AddGenericFileItems(MergableMenu menu, string path)
 {
     menu.Add(Open, 0);
     menu.Add(Execute, 0);
     menu.Add(ShellMenu, 0);
     menu.Add(Insert, 0);
     if (IsBuildable(path))
     {
         if (projectTree.SelectedPaths.Length == 1)
         {
             menu.Add(BuildProjectFile, 2);
         }
         else
         {
             menu.Add(BuildProjectFiles, 2);
         }
     }
     AddFileItems(menu, path);
 }
Example #5
0
        /// <summary>
        /// Configure ourself to be a menu relevant to the given Project with the
        /// given selected treeview nodes.
        /// </summary>
        public void Configure(ArrayList nodes)
        {
            base.Items.Clear();
            MergableMenu menu = new MergableMenu();

            foreach (GenericNode node in nodes)
            {
                MergableMenu newMenu = new MergableMenu();
                AddItems(newMenu, node);
                menu = (menu.Count > 0) ? menu.Combine(newMenu) : newMenu;
            }
            menu.Apply(this.Items);

            // deal with special menu items that can't be applied to multiple paths
            bool singleFile = (nodes.Count == 1);

            AddMenu.Enabled = singleFile;
            Rename.Enabled  = singleFile;
            Insert.Enabled  = singleFile;
            Paste.Enabled   = singleFile;

            // deal with naming the "Hide" button correctly
            if (nodes.Count > 1 || nodes.Count == 0)
            {
                HideItem.Text = TextHelper.GetString("Label.HideItems");
            }
            else
            {
                HideItem.Text = (nodes[0] is DirectoryNode) ? TextHelper.GetString("Label.HideFolder") : TextHelper.GetString("Label.HideFile");
            }

            // deal with shortcuts
            AssignShortcuts();
            if (this.Items.Contains(AddMenu) && AddMenu.Enabled)
            {
                BuildAddMenu();
            }
            if (base.Items.Count == 0)
            {
                base.Items.Add(NothingToDo);
            }
        }
Example #6
0
 private void AddFolderItems(MergableMenu menu, string path)
 {
     menu.Add(AddMenu, 0);
     menu.Add(Browse, 0);
     menu.Add(FindInFiles, 0);
     menu.Add(ShellMenu, 0);
     AddCompileTargetItems(menu, path, true);
     if (projectTree.SelectedPaths.Length == 1 && project.IsCompilable)
     {
         DirectoryNode node = projectTree.SelectedNode as DirectoryNode;
         if (node.InsideClasspath == node)
         {
             menu.Add(RemoveSourcePath, 2, true);
         }
         else if (node != null && (node.InsideClasspath == null || node.InsideClasspath is ProjectNode))
         {
             menu.Add(AddSourcePath, 2, false);
         }
     }
     AddFileItems(menu, path, true);
 }
Example #7
0
        private void AddSwcItems(MergableMenu menu, string path)
        {
            bool addLibrary = project.IsLibraryAsset(path);

            menu.Add(Execute, 0);
            menu.Add(ShellMenu, 0);
            menu.Add(AddLibrary, 2, addLibrary);
            if (addLibrary)
            {
                menu.Add(LibraryOptions, 2);
            }
            if (!this.IsExternalSwc(path))
            {
                AddFileItems(menu, path);
            }
            else
            {
                menu.Add(Copy, 1);
                menu.Add(Delete, 1);
            }
        }
        private void AddItems(MergableMenu menu, GenericNode node)
        {
            string path = node.BackingPath;

            if (node.IsInvalid)
            {
                return;
            }
            if (node is ProjectNode)
            {
                AddProjectItems(menu);
            }
            else if (node is DirectoryNode)
            {
                AddFolderItems(menu, path);
            }
            else if (node is FileNode)
            {
                AddGenericFileItems(menu, path);
            }
        }
        private void AddOtherResourceItems(MergableMenu menu, string path)
        {
            bool addLibrary = project.IsLibraryAsset(path);

            if (!project.UsesInjection)
            {
                menu.Add(Insert, 0);
            }

            menu.Add(Execute, 0);

            if (!project.UsesInjection)
            {
                menu.Add(AddLibrary, 2, addLibrary);
            }

            if (addLibrary)
            {
                menu.Add(LibraryOptions, 2);
            }

            AddFileItems(menu, path);
        }
Example #10
0
        private void AddProjectItems(MergableMenu menu)
        {
            bool showHidden = project.ShowHiddenPaths;

            menu.Add(TestMovie, 0);
            menu.Add(BuildProject, 0);
            if (HasSubProjects())
            {
                menu.Add(TestAllProjects, 0);
            }
            if (HasSubProjects())
            {
                menu.Add(BuildAllProjects, 0);
            }
            menu.Add(CloseProject, 0);
            menu.Add(AddMenu, 1);
            menu.Add(Browse, 1);
            menu.Add(FindInFiles, 1);
            menu.Add(ShellMenu, 1);
            menu.Add(Paste, 2);
            menu.Add(ShowHidden, 3, showHidden);
            menu.Add(Properties, 4);
        }
        /// <summary>
        /// Configure ourself to be a menu relevant to the given Project with the
        /// given selected treeview nodes.
        /// </summary>
        public void Configure(ArrayList nodes)
        {
            base.Items.Clear();
            MergableMenu menu = new MergableMenu();
            foreach (GenericNode node in nodes)
            {
                MergableMenu newMenu = new MergableMenu();
                AddItems(newMenu, node);
                menu = (menu.Count > 0) ? menu.Combine(newMenu) : newMenu;
            }
            menu.Apply(this.Items);

            // deal with special menu items that can't be applied to multiple paths
            bool singleFile = (nodes.Count == 1);
            AddMenu.Enabled = singleFile;
            Rename.Enabled = singleFile;
            Insert.Enabled = singleFile;
            Paste.Enabled = singleFile;

            // deal with naming the "Hide" button correctly
            if (nodes.Count > 1 || nodes.Count == 0) HideItem.Text = TextHelper.GetString("Label.HideItems");
            else HideItem.Text = (nodes[0] is DirectoryNode) ? TextHelper.GetString("Label.HideFolder") : TextHelper.GetString("Label.HideFile");

            // deal with shortcuts
            AssignShortcuts();
            if (this.Items.Contains(AddMenu) && AddMenu.Enabled) BuildAddMenu();
            if (base.Items.Count == 0) base.Items.Add(NothingToDo);
        }
 private void AddFileItems(MergableMenu menu, string path)
 {
     AddFileItems(menu, path, true);
 }
 private void AddProjectOutputItems(MergableMenu menu, ProjectOutputNode node)
 {
     if (node.FileExists)
     {
         menu.Add(Open, 0);
         menu.Add(Execute, 0);
         menu.Add(ShellMenu, 0);
         AddFileItems(menu, node.BackingPath);
     }
     else menu.Add(NoProjectOutput, 0);
 }
 private void AddSwfItems(MergableMenu menu, string path)
 {
     bool addLibrary = project.HasLibraries && project.IsLibraryAsset(path);
     menu.Add(Open, 0);
     menu.Add(Execute, 0);
     menu.Add(ShellMenu, 0);
     menu.Add(Insert, 0);
     if (addLibrary)
     {
         LibraryAsset asset = project.GetAsset(path);
         if (asset.SwfMode == SwfAssetMode.Library) menu.Add(Insert, 0);
     }
     if (project.HasLibraries) menu.Add(AddLibrary, 2, addLibrary);
     if (addLibrary) menu.Add(LibraryOptions, 2);
     AddFileItems(menu, path);
 }
 private void AddCssItems(MergableMenu menu, string path)
 {
     if (project.Language != "as3")
     {
         AddGenericFileItems(menu, path);
         return;
     }
     bool alwaysCompile = project.IsCompileTarget(path);
     menu.Add(Open, 0);
     menu.Add(Execute, 0);
     menu.Add(ShellMenu, 0);
     menu.Add(AlwaysCompile, 2, alwaysCompile);
     AddFileItems(menu, path);
 }
 private void AddGenericFileItems(MergableMenu menu, string path)
 {
     menu.Add(Open, 0);
     menu.Add(Execute, 0);
     AddFileItems(menu, path);
 }
 private void AddInvalidClassPathNodes(MergableMenu menu, string path)
 {
     menu.Add(RemoveSourcePath, 2, true);
 }
 private void AddGenericFileItems(MergableMenu menu, string path)
 {
     menu.Add(Open, 0);
     menu.Add(Execute, 0);
     menu.Add(FindAndReplace, 0);
     if (Win32.ShouldUseWin32()) menu.Add(ShellMenu, 0);
     menu.Add(Insert, 0);
     if (IsBuildable(path))
     {
         if (projectTree.SelectedPaths.Length == 1) menu.Add(BuildProjectFile, 2);
         else menu.Add(BuildProjectFiles, 2);
     }
     AddFileItems(menu, path);
 }
 private void AddFileItems(MergableMenu menu, string path, bool addPaste)
 {
     menu.Add(Cut, 1);
     menu.Add(Copy, 1);
     if (addPaste) menu.Add(Paste, 1);
     menu.Add(Delete, 1);
     menu.Add(Rename, 1);
     AddHideItems(menu, path, 3);
 }
 private void AddClasspathItems(MergableMenu menu)
 {
     menu.Add(AddMenu, 0);
     menu.Add(Paste, 1);
 }
		private void AddActionScriptItems(MergableMenu menu, string path)
		{
			bool alwaysCompile = project.IsCompileTarget(path);
			bool addLibrary = project.IsLibraryAsset(path);

			menu.Add(Open,0);
			menu.Add(Execute,0);
			menu.Add(AlwaysCompile,2,alwaysCompile);
			
			AddFileItems(menu,path);
		}
		private void AddGenericFileItems(MergableMenu menu, string path)
		{
			menu.Add(Open,0);
			menu.Add(Execute,0);
			AddFileItems(menu,path);
		}
		private void AddOtherResourceItems(MergableMenu menu, string path)
		{
			bool addLibrary = project.IsLibraryAsset(path);

			if (!project.UsesInjection)
				menu.Add(Insert,0);

			menu.Add(Execute,0);
			
			if (!project.UsesInjection)
				menu.Add(AddLibrary,2,addLibrary);

			if (addLibrary)
				menu.Add(LibraryOptions,2);

			AddFileItems(menu,path);
		}
 private void AddHideItems(MergableMenu menu, string path,int group)
 {
     bool hidden = project.IsPathHidden(path);
     bool showHidden = project.ShowHiddenPaths;
     menu.Add(ShowHidden, group, showHidden);
     menu.Add(HideItem, group, hidden);
 }
 private void AddExportItems(MergableMenu menu, ExportNode node)
 {
     // it DOES make sense to allow insert of assets inside the injection target!
     if (project.UsesInjection && project.GetRelativePath(node.ContainingSwfPath) != project.InputPath) return;
     if (node is ClassExportNode) menu.Add(Open, 0);
     menu.Add(Insert, 0);
 }
        private void AddItems(MergableMenu menu, GenericNode node)
        {
            string path = node.BackingPath;

            if (node.IsInvalid)
            {
                if (node is ClasspathNode)
                {
                    AddInvalidClassPathNodes(menu, path);
                }

                /*else if (node is FileNode)
                 * {
                 *  string ext = Path.GetExtension(path).ToLower();
                 *  if (FileInspector.IsSwc(path, ext)) AddInvalidSwcItems(menu, path);
                 * }*/
                return;
            }
            if (node is ProjectNode)
            {
                AddProjectItems(menu);
            }
            else if (node is ClasspathNode)
            {
                AddClasspathItems(menu, path);
            }
            else if (node is DirectoryNode)
            {
                AddFolderItems(menu, path);
            }
            else if (node is ProjectOutputNode)
            {
                AddProjectOutputItems(menu, node as ProjectOutputNode);
            }
            else if (node is ExportNode)
            {
                AddExportItems(menu, node as ExportNode);
            }
            else if (node is FileNode)
            {
                string ext = Path.GetExtension(path).ToLower();
                if (FileInspector.IsActionScript(path, ext))
                {
                    AddClassItems(menu, path);
                }
                else if (FileInspector.IsHaxeFile(path, ext))
                {
                    AddClassItems(menu, path);
                }
                else if (FileInspector.IsMxml(path, ext))
                {
                    AddClassItems(menu, path);
                }
                else if (FileInspector.IsCss(path, ext))
                {
                    AddCssItems(menu, path);
                }
                else if (FileInspector.IsSwf(path, ext))
                {
                    AddSwfItems(menu, path);
                }
                else if (FileInspector.IsSwc(path, ext))
                {
                    AddSwcItems(menu, path);
                }
                else if (FileInspector.IsResource(path, ext))
                {
                    AddOtherResourceItems(menu, path);
                }
                else
                {
                    AddGenericFileItems(menu, path);
                }
            }
        }
 private void AddClasspathItems(MergableMenu menu)
 {
     menu.Add(AddMenu, 0);
     menu.Add(Browse, 0);
     menu.Add(FindInFiles, 0);
     menu.Add(ShellMenu, 0);
     menu.Add(Paste, 1);
 }
 private void AddFileItems(MergableMenu menu, string path)
 {
     AddFileItems(menu, path, true);
 }
 private void AddActionScriptItems(MergableMenu menu, string path)
 {
     bool alwaysCompile = project.IsCompileTarget(path);
     menu.Add(Open, 0);
     menu.Add(Execute, 0);
     menu.Add(ShellMenu, 0);
     menu.Add(AlwaysCompile, 2, alwaysCompile);
     menu.Add(CopyClassName, 4);
     AddFileItems(menu, path);
 }
 private void AddItems(MergableMenu menu, GenericNode node)
 {
     if (node.IsInvalid) return;
     string path = node.BackingPath;
     if (node is ProjectNode) AddProjectItems(menu);
     else if (node is ClasspathNode) AddClasspathItems(menu);
     else if (node is DirectoryNode) AddFolderItems(menu, path);
     else if (node is ProjectOutputNode) AddProjectOutputItems(menu, node as ProjectOutputNode);
     else if (node is ExportNode) AddExportItems(menu, node as ExportNode);
     else if (node is FileNode)
     {
         string ext = Path.GetExtension(path).ToLower();
         if (FileInspector.IsActionScript(path, ext)) AddActionScriptItems(menu, path);
         else if (FileInspector.IsHaxeFile(path, ext)) AddHaxeFileItems(menu, path);
         else if (FileInspector.IsMxml(path, ext)) AddMxmlItems(menu, path);
         else if (FileInspector.IsCss(path, ext)) AddCssItems(menu, path);
         else if (FileInspector.IsSwf(path, ext)) AddSwfItems(menu, path);
         else if (FileInspector.IsSwc(path, ext)) AddSwcItems(menu, path);
         else if (FileInspector.IsResource(path, ext)) AddOtherResourceItems(menu, path);
         else AddGenericFileItems(menu, path);
     }
 }
 private void AddClasspathItems(MergableMenu menu, string path)
 {
     menu.Add(AddMenu, 0);
     menu.Add(Browse, 0);
     menu.Add(FindInFiles, 0);
     menu.Add(CommandPrompt, 0);
     if (Win32.ShouldUseWin32()) menu.Add(ShellMenu, 0);
     menu.Add(Paste, 1);
     menu.Add(RemoveSourcePath, 2, true);
     AddHideItems(menu, path, 3);
 }
 private void AddProjectItems(MergableMenu menu)
 {
     bool showHidden = project.ShowHiddenPaths;
     menu.Add(TestMovie, 0);
     menu.Add(BuildProject, 0);
     if (HasSubProjects()) menu.Add(TestAllProjects, 0);
     if (HasSubProjects()) menu.Add(BuildAllProjects, 0);
     menu.Add(CloseProject, 0);
     menu.Add(AddMenu, 1);
     menu.Add(Browse, 1);
     menu.Add(FindInFiles, 1);
     menu.Add(ShellMenu, 1);
     menu.Add(Paste, 2);
     menu.Add(ShowHidden, 3, showHidden);
     menu.Add(Properties, 4);
 }
 private void AddInvalidClassPathNodes(MergableMenu menu, string path)
 {
     menu.Add(RemoveSourcePath, 2, true);
 }
 private void AddFolderItems(MergableMenu menu, string path)
 {
     bool alwaysCompile = project.IsCompileTarget(path);
     menu.Add(AddMenu, 0);
     menu.Add(Browse, 0);
     menu.Add(FindInFiles, 0);
     menu.Add(ShellMenu, 0);
     if (project.Language == "as2") menu.Add(AlwaysCompile, 2, alwaysCompile);
     AddFileItems(menu, path, true);
 }
        private void AddFolderItems(MergableMenu menu, string path)
        {
            menu.Add(AddMenu, 0);
            menu.Add(Browse, 0);
            menu.Add(FindInFiles, 0);
            menu.Add(CommandPrompt, 0);
            if (Win32.ShouldUseWin32()) menu.Add(ShellMenu, 0);
            AddCompileTargetItems(menu, path, true);

            bool addLibrary = project.IsLibraryAsset(path);
            menu.Add(AddLibrary, 2, addLibrary);
            if (addLibrary) menu.Add(LibraryOptions, 2);

            if (projectTree.SelectedPaths.Length == 1 && project.IsCompilable)
            {
                DirectoryNode node = projectTree.SelectedNode as DirectoryNode;
                if (node.InsideClasspath == node) menu.Add(RemoveSourcePath, 2, true);
                else if (node != null && (node.InsideClasspath == null || node.InsideClasspath is ProjectNode))
                {
                    menu.Add(AddSourcePath, 2, false);
                }
            }
            AddFileItems(menu, path, true);
        }
 private void AddMxmlItems(MergableMenu menu, string path)
 {
     bool alwaysCompile = project.IsCompileTarget(path);
     menu.Add(Open, 0);
     menu.Add(Execute, 0);
     menu.Add(ShellMenu, 0);
     menu.Add(AlwaysCompile, 2, alwaysCompile);
     AddFileItems(menu, path);
 }
 private void AddClassItems(MergableMenu menu, string path)
 {
     menu.Add(Open, 0);
     menu.Add(Execute, 0);
     menu.Add(FindAndReplace, 0);
     if (Win32.ShouldUseWin32()) menu.Add(ShellMenu, 0);
     AddCompileTargetItems(menu, path, false);
     AddFileItems(menu, path);
 }
 private void AddOtherResourceItems(MergableMenu menu, string path)
 {
     bool addLibrary = project.HasLibraries && project.IsLibraryAsset(path);
     menu.Add(Open, 0);
     menu.Add(Execute, 0);
     menu.Add(ShellMenu, 0);
     menu.Add(Insert, 0);
     if (project.HasLibraries) menu.Add(AddLibrary, 2, addLibrary);
     if (addLibrary) menu.Add(LibraryOptions, 2);
     AddFileItems(menu, path);
 }
 private void AddCompileTargetItems(MergableMenu menu, string path, bool isFolder)
 {
     CompileTargetType result = project.AllowCompileTarget(path, isFolder);
     if (result != CompileTargetType.None)
     {
         bool isMain = false;
         if ((result & CompileTargetType.DocumentClass) > 0)
         {
             isMain = project.IsDocumentClass(path);
             if (isMain) menu.Add(DocumentClass, 2, true);
             else menu.Add(SetDocumentClass, 2, false);
         }
         if (!isMain && (result & CompileTargetType.AlwaysCompile) > 0)
         {
             menu.Add(AlwaysCompile, 2, project.IsCompileTarget(path));
         }
         if (!isFolder) menu.Add(CopyClassName, 2);
     }
 }
 private void AddSwcItems(MergableMenu menu, string path)
 {
     bool addLibrary = project.IsLibraryAsset(path);
     menu.Add(Execute, 0);
     menu.Add(ShellMenu, 0);
     menu.Add(AddLibrary, 2, addLibrary);
     if (addLibrary) menu.Add(LibraryOptions, 2);
     if (!this.IsExternalSwc(path)) AddFileItems(menu, path);
     else
     {
         menu.Add(Copy, 1);
         menu.Add(Delete, 1);
     }
 }
 private void AddCssItems(MergableMenu menu, string path)
 {
     if (project.Language == "as3") AddClassItems(menu, path);
     else AddGenericFileItems(menu, path);
 }
 private void AddFileItems(MergableMenu menu, string path, bool addPaste)
 {
     bool hidden = project.IsPathHidden(path);
     bool showHidden = project.ShowHiddenPaths;
     menu.Add(Cut, 1);
     menu.Add(Copy, 1);
     if (addPaste) menu.Add(Paste, 1);
     menu.Add(Delete, 1);
     menu.Add(Rename, 1);
     menu.Add(ShowHidden, 3, showHidden);
     menu.Add(HideItem, 3, hidden);
 }
 private void AddInvalidSwcItems(MergableMenu menu, string path)
 {
     bool addLibrary = project.IsLibraryAsset(path);
     if (addLibrary) menu.Add(LibraryOptions, 2);
 }
 private void AddGenericFileItems(MergableMenu menu, string path)
 {
     menu.Add(Open, 0);
     menu.Add(Execute, 0);
     menu.Add(ShellMenu, 0);
     menu.Add(Insert, 0);
     if (IsBuildable(path) && projectTree.SelectedPaths.Length == 1) menu.Add(BuildProjectFile, 0);
     if (IsBuildable(path) && projectTree.SelectedPaths.Length > 1) menu.Add(BuildProjectFiles, 0);
     AddFileItems(menu, path);
 }
 private void AddProjectOutputItems(MergableMenu menu, ProjectOutputNode node)
 {
     if (node.FileExists)
     {
         menu.Add(Open, 0);
         menu.Add(Execute, 0);
         menu.Add(FindAndReplace, 0);
         if (Win32.ShouldUseWin32()) menu.Add(ShellMenu, 0); 
         AddFileItems(menu, node.BackingPath);
     }
     else menu.Add(NoProjectOutput, 0);
 }