public static IObjectEditor CreateObjectEditor(object contextObject, string command) {
			if (contextObject == null) {
				return null;
			}
			
			if (command == "" || command == null) {
				command = "Default";
			}
			
			IObjectEditor editor = null;
			if (contextObject is OleDbDataSource) {
				editor = new OleDbDataSourceEditor();
			}
			else if (contextObject is DataSource) 
			{
				editor = new DataSourceEditor();
			}
			if (contextObject.GetType() == typeof(MetadataFile)) 
			{
				editor = new OREntityEditor();
			}
			if (contextObject.GetType() == typeof(CodeGeneratorCommand)) {
				if (command.ToUpper() == "EDIT") {
					editor = new CodeGenerationTemplateEditor();
				} else {
 					editor = new CodeGeneratorCommandEditor();
				}
 			}
 			if (contextObject is Ch3Etah.Core.ProjectLib.InputParameterCollection) {
 				editor = new InputParameterCollectionEditor((Ch3Etah.Core.ProjectLib.InputParameterCollection) contextObject);
 			}
			if (contextObject is Template)
			{
				string path = ((Template)contextObject).GetFullPath();
				return new TextFileEditor(path);
			}
			if (contextObject is MacroLibrary)
			{
				string path = ((MacroLibrary)contextObject).GetFullPath();
				return new TextFileEditor(path);
			}
			if (editor != null) 
			{
 				editor.SelectedObject = contextObject;
 			}
			return editor;
		}
		public CodeGeneratorCommandEditor() {
			//
			// The InitializeComponent() call is required for Windows Forms designer support.
			//
			InitializeComponent();

			tvwIndividualMetadataFiles = new MetadataFileSelector();
			grpMultiOutput.Controls.Add(tvwIndividualMetadataFiles);
			tvwIndividualMetadataFiles.BringToFront();
			tvwIndividualMetadataFiles.Dock = DockStyle.Fill;
			
//			tvwGroupedMetadataFiles = new MetadataFileSelector();
//			pageBatchMetadataFiles.Controls.Add(tvwGroupedMetadataFiles);
//			tvwGroupedMetadataFiles.BringToFront();
//			tvwGroupedMetadataFiles.Dock = DockStyle.Fill;

			inputParametersEditor = new InputParameterCollectionEditor();
			panelBottomLeft.Controls.Add(inputParametersEditor);
			inputParametersEditor.BringToFront();
			inputParametersEditor.Dock = DockStyle.Fill;

			toolTipProvider.SetToolTip(btnEditTemplate, "Edit Template");
			toolTipProvider.SetToolTip(chkAutoSelectMetadataFiles, "Auto-select metadata files that are compatible with the current template when they are added to the project.\r\nIt is generally recommended that you leave this checked, unless you know that you only want to execute the template for specific files.");

			Enabled = false;
		}
Exemplo n.º 3
0
		private void EditProjectParameters_Click(object sender, EventArgs e) {
			IObjectEditor editor = new InputParameterCollectionEditor(_project.InputParameters);
			ObjectEditorManager.OpenObjectEditor(editor);
		}
		public CodeGeneratorCommandEditor() {
			//
			// The InitializeComponent() call is required for Windows Forms designer support.
			//
			InitializeComponent();

			tvwIndividualMetadataFiles = new MetadataFileSelector();
			grpMultiOutput.Controls.Add(tvwIndividualMetadataFiles);
			tvwIndividualMetadataFiles.BringToFront();
			tvwIndividualMetadataFiles.Dock = DockStyle.Fill;

//			tvwGroupedMetadataFiles = new MetadataFileSelector();
//			pageBatchMetadataFiles.Controls.Add(tvwGroupedMetadataFiles);
//			tvwGroupedMetadataFiles.BringToFront();
//			tvwGroupedMetadataFiles.Dock = DockStyle.Fill;

			inputParametersEditor = new InputParameterCollectionEditor();
			panelBottomLeft.Controls.Add(inputParametersEditor);
			inputParametersEditor.BringToFront();
			inputParametersEditor.Dock = DockStyle.Fill;

			toolTipProvider.SetToolTip(btnEditTemplate, "Edit Template");

			Enabled = false;
		}