コード例 #1
0
ファイル: PluginMain.cs プロジェクト: heon21st/flashdevelop
		// Receives only events in EventMask
		public void HandleEvent(object sender, NotifyEvent e)
		{
			TextEvent te = e as TextEvent;

			switch (e.Type)
			{
				// replace @MACRO type stuff with things we know about
				case EventType.ProcessArgs:
					if (Project != null)
					{
						// steal macro names and values from the very useful
						// BuildEvent macros, except instead of $(Var) we expect @VAR
						string[] globalCP = Settings.GlobalClasspaths.Split(';');
						BuildEventVars vars = new BuildEventVars(Project,globalCP);

						foreach (BuildEventInfo info in vars.GetVars())
							te.Text = te.Text.Replace("@"+info.Name.ToUpper(),info.Value);
					}
					break;
				case EventType.FileOpening:
					// if this is an .fdp file, we can handle it ourselves
					if (Path.GetExtension(te.Text).ToLower() == ".fdp")
					{
						te.Handled = true;
						OpenProjectSilent(te.Text);
						menus.RecentComboBox.Add(Project);
					}
					break;
				case EventType.FileOpen:
					
					if (fileActions.DocumentSeekRequest > 0)
					{
						// we just created a new class, put the cursor between the brackets.
						MainForm.CurSciControl.GotoPos(fileActions.DocumentSeekRequest);
						fileActions.DocumentSeekRequest = 0;
					}
					// add some support for additional known xml files (like asml)
					if (MainForm.CurSciControl.ConfigurationLanguage == "text" &&
					    FileHelper.IsXml(MainForm.CurFile))
						MainForm.CallCommand("ChangeSyntax","xml");

					OpenNextFile(); // it's safe to open any other files on the queue
					break;
				case EventType.ProcessStart:
					buildActions.NotifyBuildStarted();
					break;
				case EventType.ProcessEnd:
					string result = (e as TextEvent).Text;
					buildActions.NotifyBuildEnded(result);
					break;
				case EventType.Command:
					if (te.Text == COMMAND_SENDPROJECTINFO)
					{
						BroadcastProjectInfo();
						e.Handled = true;
					}
					else if (te.Text == COMMAND_BUILDPROJECT)
					{
						if (Project != null)
						{
							buildActions.Build(Project,false,pluginUI.IsTraceDisabled);
							e.Handled = true;
						}
					}
					else if (te.Text == COMMAND_HOTBUILD)
					{
						if (Project != null && Project.OutputPath.Length > 0)
						{
							buildActions.Build(Project,true,pluginUI.IsTraceDisabled);
							e.Handled = true;
						}
					}
					break;
				case EventType.SettingUpdate:
					if (Project == null)
						return;

					if (showProjectClasspaths != Settings.ShowProjectClasspaths ||
						showGlobalClasspaths != Settings.ShowGlobalClasspaths)
					{
						showProjectClasspaths = Settings.ShowProjectClasspaths;
						showGlobalClasspaths = Settings.ShowGlobalClasspaths;
						pluginUI.Tree.RebuildTree(true);
					}
					break;
					
				// PHILIPPE: handle copy/paste shortcuts
				case EventType.Shortcut:
					KeyEvent ke = e as KeyEvent;
					if (pluginUI.Tree.Focused && !pluginUI.IsEditingLabel && ke != null)
					{
						switch (ke.Value)
						{
							case Keys.Control|Keys.C:
								if (pluginUI.Menu.Copy.IsEnabled) TreeCopyItems(null, null);
								ke.Handled = true;
								break;
							case Keys.Control|Keys.X:
								if (pluginUI.Menu.Cut.IsEnabled) TreeCutItems(null, null);
								ke.Handled = true;
								break;
							case Keys.Control|Keys.V:
								if (pluginUI.Menu.Paste.IsEnabled) TreePasteItems(null, null);
								ke.Handled = true;
								break;
							case Keys.Delete:
								if (pluginUI.Menu.Delete.IsEnabled) TreeDeleteItems(null,null);
								ke.Handled = true;
								break;
							case Keys.Enter:
								
								break;
						}
					}
					break;
			}
		}
コード例 #2
0
		public BuildEventDialog(Project project)
		{
			InitializeComponent();

			this.project = project;
			this.vars = new BuildEventVars(project,Settings.GlobalClasspaths.Split(';'));

			foreach (BuildEventInfo info in vars.GetVars())
				Add(info);
		}