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;
		}
예제 #2
0
		private void EditOREntity_Click(object sender, EventArgs e) {
			MetadataFile file = tvwProject.SelectedNode.Tag as MetadataFile;
			OREntityEditor editor = new OREntityEditor(file);
			ObjectEditorManager.OpenObjectEditor(editor);
		}