Beispiel #1
0
		public PluginUI(PluginMain plugin, FDMenus menus, 
			FileActions fileActions, ProjectActions projectActions)
		{
			this.plugin = plugin;
			this.menus = menus;
			this.Tag = "Project";
			this.Text = "Project Explorer";

			#region Build TreeView

			menu = new ProjectContextMenu(menus);
			menu.Rename.Click += new EventHandler(RenameNode);

			treeBar = new TreeBar(menus,menu);
			treeBar.Dock = DockStyle.Top;
			treeBar.Visible = false;

			tree = new ProjectTreeView();
			tree.Visible = false;
			tree.Dock = DockStyle.Fill;
			tree.ImageIndex = 0;
			tree.ImageList = Icons.ImageList;
			tree.LabelEdit = true;
			tree.SelectedImageIndex = 0;
			tree.ShowRootLines = false;
			tree.HideSelection = false;
			tree.ContextMenu = menu;
			tree.DoubleClick += new EventHandler(tree_DoubleClick);
			tree.AfterLabelEdit += new NodeLabelEditEventHandler(tree_AfterLabelEdit);
			tree.BeforeLabelEdit += new NodeLabelEditEventHandler(tree_BeforeLabelEdit);
			tree.AfterSelect += new TreeViewEventHandler(tree_AfterSelect);
			
			this.Controls.Add(tree);
			this.Controls.Add(treeBar);

			#endregion

			#region Instructions

			LinkLabel link = new LinkLabel();
			link.Text = "Create a new project\nor\nOpen an existing project";
			link.Links.Add(0,20,"create");
			link.Links.Add(24,24,"open");
			link.LinkClicked += new LinkLabelLinkClickedEventHandler(link_LinkClicked);
			link.TextAlign = ContentAlignment.MiddleCenter;
			link.Dock = DockStyle.Fill;
			link.ContextMenu = new ContextMenu();
			this.Controls.Add(link);

			#endregion

			// we care about some of these events
			fileActions.FileCreated += new FileNameHandler(NewFileCreated);
			fileActions.ProjectModified += new ProjectModifiedHandler(ProjectModified);
			projectActions.ProjectModified += new ProjectModifiedHandler(ProjectModified);
		}
Beispiel #2
0
		public void Initialize()
		{
			MainFormRef = MainForm; // Mika: added
			
			Icons.Initialize(MainForm);
			Settings.Initialize(MainForm);
			PluginData.Load();

			showProjectClasspaths = Settings.ShowProjectClasspaths;
			showGlobalClasspaths = Settings.ShowGlobalClasspaths;

			MainForm.IgnoredKeys.Add(Keys.F5);
			MainForm.IgnoredKeys.Add(Keys.F8);

			#region Actions and Event Listeners

			menus = new FDMenus(MainForm);
			menus.View.Click += new EventHandler(OpenPanel);
			menus.GlobalClasspaths.Click += new EventHandler(OpenGlobalClasspaths);
			menus.ProjectMenu.NewProject.Click += new EventHandler(NewProject);
			menus.ProjectMenu.OpenProject.Click += new EventHandler(OpenProject);
			menus.ProjectMenu.CloseProject.Click += new EventHandler(CloseProject);
			menus.ProjectMenu.TestMovie.Click += new EventHandler(TestMovie);
			menus.ProjectMenu.BuildProject.Click += new EventHandler(BuildProject);
			menus.ProjectMenu.Properties.Click += new EventHandler(OpenProjectProperties);
			menus.RecentComboBox.RequestProject += new ProjectRequestHandler(GetProject);
			menus.RecentComboBox.OpenProject += new ProjectOpenHandler(OpenProjectSilent);

			buildActions = new BuildActions(MainForm);
			buildActions.BuildComplete += new BuildCompleteHandler(BuildComplete);
			buildActions.ClasspathsChanged += new EventHandler(ProjectClasspathsChanged);

			flashDevelopActions = new FlashDevelopActions(MainForm);

			fileActions = new FileActions(pluginUI);
			fileActions.OpenFile += new FileNameHandler(OpenFile);
			fileActions.FileDeleted += new FileNameHandler(FileDeleted);
			fileActions.FileMoved += new FileMovedHandler(FileMoved);

			projectActions = new ProjectActions(pluginUI);
		
			// create our UI surface and a docking panel for it
			pluginUI = new PluginUI(this,menus,fileActions,projectActions);
			pluginUI.NewProject += new EventHandler(NewProject);
			pluginUI.OpenProject += new EventHandler(OpenProject);
			pluginUI.Rename += new RenameEventHandler(fileActions.Rename);
			pluginUI.Tree.MovePath += new DragPathEventHandler(fileActions.Move);
			pluginUI.Tree.CopyPath += new DragPathEventHandler(fileActions.Copy);
			pluginUI.Menu.Open.Click += new EventHandler(TreeOpenItems);
			pluginUI.Menu.Execute.Click += new EventHandler(TreeExecuteItems);
			pluginUI.Menu.Insert.Click += new EventHandler(TreeInsertItem);
			pluginUI.Menu.AddLibrary.Click += new EventHandler(TreeAddLibraryItems);
			pluginUI.Menu.AlwaysCompile.Click += new EventHandler(TreeAlwaysCompileItems);
			pluginUI.Menu.Cut.Click += new EventHandler(TreeCutItems);
			pluginUI.Menu.Copy.Click += new EventHandler(TreeCopyItems);
			pluginUI.Menu.Paste.Click += new EventHandler(TreePasteItems);
			pluginUI.Menu.Delete.Click += new EventHandler(TreeDeleteItems);
			pluginUI.Menu.LibraryOptions.Click += new EventHandler(TreeLibraryOptions);
			pluginUI.Menu.Hide.Click += new EventHandler(TreeHideItems);
			pluginUI.Menu.ShowHidden.Click += new EventHandler(ToggleShowHidden);
			pluginUI.Menu.AddNewClass.Click += new EventHandler(TreeAddNewClass);
			pluginUI.Menu.AddNewXml.Click += new EventHandler(TreeAddXml);
			pluginUI.Menu.AddNewFile.Click += new EventHandler(TreeAddFile);
			pluginUI.Menu.AddNewFolder.Click += new EventHandler(TreeAddFolder);
			pluginUI.Menu.AddLibraryAsset.Click += new EventHandler(TreeAddAsset);
			pluginUI.Menu.AddExistingFile.Click += new EventHandler(TreeAddExistingFile);
			pluginUI.TreeBar.Refresh.Click += new EventHandler(TreeRefreshNode);

			menus.RecentComboBox.Rebuild();

			#endregion

			pluginPanel = MainForm.CreateDockingPanel(pluginUI, Guid, 
				Icons.Project.Img, DockState.DockRight);

			// try to open the last opened project
			string lastProject = Settings.LastProject;

			if (Settings.LastProject != "" && File.Exists(Settings.LastProject))
			{
				OpenProjectSilent(lastProject);
				// if we open the last project right away, we need to give ASCompletion
				// some time before we can trust that it received our classpaths ok
				startupTimer = new Timer();
				startupTimer.Tick += new EventHandler(ProjectClasspathsChanged);
				startupTimer.Interval = 1000;
				startupTimer.Start();
			}
			else Project = null;

			try
			{
				ProjectIcon.Associate(); // make sure .fdp points to this instance of FD
			}
			catch(UnauthorizedAccessException)
			{
				// silent
			}
			catch(Exception)
			{
				// silent?
			}
		}