private void mnu_editConnect(object sender, EventArgs e) { TreeViewObjectExplorer tv = TreeView as TreeViewObjectExplorer; if (TreeView != null) { TreeNodeObject np = null; ClassPointer root = null; TreeNode tn = this.Parent; while (tn != null) { np = tn as TreeNodeObject; if (np != null) { root = np.OwnerIdentity as ClassPointer; if (root != null) { break; } } tn = tn.Parent; } if (root != null) { LimnorProject.SetActiveProject(root.Project); DlgConnectionManager dlg = new DlgConnectionManager(); dlg.UseProjectScope = true; dlg.EnableCancel(false); //set selection of _connect dlg.SetSelection(_connect); dlg.ShowDialog(TreeView.FindForm()); np.ResetNextLevel(tv); } } }
public virtual void OnNodeAfterSelection(TreeViewEventArgs e) { HtmlElement_Base he = HtmlElement; Guid guid = Guid.Empty; if (string.CompareOrdinal(he.tagName, "body") != 0) { if (he.ElementGuid != Guid.Empty) { guid = he.ElementGuid; } } if (guid != Guid.Empty) { TreeViewObjectExplorer tv = this.TreeView as TreeViewObjectExplorer; if (tv != null) { TreeNodeClassRoot r = tv.RootClassNode; if (r != null && r.ClassData.DesignerHolder != null) { r.ClassData.DesignerHolder.OnSelectedHtmlElement(guid, tv); } } } }
public override void LoadNextLevel(TreeViewObjectExplorer tv, TreeNodeObject parentNode) { ClassPointer root = parentNode.OwnerIdentity as ClassPointer; IList <Guid> gl = root.GetDatabaseConnectionsUsed(); IList <Guid> gl2 = root.Project.GetObjectGuidList(); List <Guid> lst = new List <Guid>(); lst.AddRange(gl); foreach (Guid g in gl2) { if (!lst.Contains(g)) { lst.Add(g); } } if (lst.Count > 0) { foreach (Guid g in lst) { ConnectionItem ci = ConnectionItem.LoadConnection(g, false, false); if (ci != null) { parentNode.Nodes.Add(new TreeNodeDatabaseConnection(ci)); } } } }
public TreeNodeLocalizeResource(ResourcePointer owner, CultureInfo culture) { _pointer = owner; _culture = culture; Text = string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0} [{1}]", _culture.NativeName, _culture.Name); ImageIndex = TreeViewObjectExplorer.GetLangaugeImageByName(_culture.Name); SelectedImageIndex = ImageIndex; }
public override bool IsTargeted() { TreeViewObjectExplorer tv = this.TreeView as TreeViewObjectExplorer; if (tv != null) { return(tv.SelectionType == EnumObjectSelectType.Object); } return(false); }
public TreeNodeLocalizeResource(ResourcePointer owner, string culture) { _pointer = owner; _name = culture; if (string.CompareOrdinal("zh", _name) == 0) { _culture = CultureInfo.GetCultureInfo("zh-CHT"); Text = "中文 zh"; ImageIndex = TreeViewObjectExplorer.GetLangaugeImageByName(_name); SelectedImageIndex = ImageIndex; } }
public void ResetImageIndex() { if (string.IsNullOrEmpty(_name)) { ImageIndex = TreeViewObjectExplorer.GetSelectedImageIndex(TreeViewObjectExplorer.GetLangaugeImageByName(_culture.Name)); } else { ImageIndex = TreeViewObjectExplorer.GetSelectedImageIndex(TreeViewObjectExplorer.GetLangaugeImageByName(_name)); } SelectedImageIndex = ImageIndex; }
public void ResetResourcesCollectionNodes() { TreeViewObjectExplorer tv = TreeView as TreeViewObjectExplorer; for (int i = 0; i < Nodes.Count; i++) { TreeNodeResourceCollection tnc = Nodes[i] as TreeNodeResourceCollection; if (tnc != null) { tnc.ResetNextLevel(tv); } } }
public TreeNodeHtmlElementCollection(TreeViewObjectExplorer tv, TreeNodeObject parentNode, ClassPointer objectPointer, UInt32 scopeMethodId) : base(tv, parentNode, false, objectPointer, scopeMethodId) { Text = "Html Document"; ImageIndex = TreeNodeHtmlElement.GetHtmlElementIconbyKey("html"); SelectedImageIndex = ImageIndex; List <TreeNodeLoader> lst = GetLoaderNodes(); foreach (TreeNodeLoader tnl in lst) { Nodes.Add(tnl); } }
public MenuItem[] GetContextMenuItems(bool bReadOnly) { MenuItem[] mns = new MenuItem[2]; if (string.IsNullOrEmpty(_name)) { mns[0] = new MenuItemWithBitmap("Set UI language", mn_setLanguage, TreeViewObjectExplorer.GetLangaugeBitmapByName(_culture.Name)); } else { mns[0] = new MenuItemWithBitmap("Set UI language", mn_setLanguage, TreeViewObjectExplorer.GetLangaugeBitmapByName(_name)); } mns[1] = new MenuItemWithBitmap("Remove", mn_delLanguage, Resources._cancel.ToBitmap()); return(mns); }
protected override void OnLoadNextLevel() { TreeViewObjectExplorer tv = this.TreeView as TreeViewObjectExplorer; if (IsForSelection) { Nodes.Add(new TreeNodePropertyCollection(tv, this, true, ResourceManager, 0)); } else { Nodes.Add(new TreeNodeCultureCollection(ResourceManager)); } AddResourceCollections(this.ResourceManager, Nodes, IsForSelection); }
private void mnu_connections(object sender, EventArgs e) { TreeViewObjectExplorer tv = TreeView as TreeViewObjectExplorer; if (tv != null) { ClassPointer root = OwnerIdentity as ClassPointer; LimnorProject.SetActiveProject(root.Project); DlgConnectionManager dlg = new DlgConnectionManager(); dlg.UseProjectScope = true; dlg.EnableCancel(false); dlg.ShowDialog(TreeView.FindForm()); ResetNextLevel(tv); } }
public void OnLanguageChanged() { if (string.IsNullOrEmpty(_resman.DesignerLanguageName)) { this.Hide(); } else { this.Show(); } picLang.Image = TreeViewObjectExplorer.GetLangaugeBitmapByName(_resman.DesignerLanguageName); lblLang.Text = _resman.DesingerCultureDisplay; this.Width = lblLang.Left + lblLang.Width + 3; this.Refresh(); }
public override void LoadNextLevel(TreeViewObjectExplorer tv, TreeNodeObject parentNode) { UInt32 scopeId = parentNode.ScopeMethodId; HtmlElement_Base objRef = (HtmlElement_Base)parentNode.OwnerIdentity; parentNode.Nodes.Add(new TreeNodeHtmlPropertyCollection(tv, parentNode, objRef, scopeId)); if (parentNode.SelectionTarget == EnumObjectSelectType.All || parentNode.SelectionTarget == EnumObjectSelectType.Event || !string.IsNullOrEmpty(parentNode.EventScope)) { parentNode.Nodes.Add(new TreeNodeHtmlEventCollection(tv, parentNode, objRef, scopeId)); } if (parentNode.SelectionTarget == EnumObjectSelectType.All || parentNode.SelectionTarget == EnumObjectSelectType.Method || parentNode.SelectionTarget == EnumObjectSelectType.Action || parentNode.SelectionTarget == EnumObjectSelectType.Object) { parentNode.Nodes.Add(new TreeNodeHtmlMethodCollection(tv, parentNode, objRef, scopeId)); } }
public TreeNodeCulture(CultureInfo c, ProjectResources rm) { _culture = c; _resman = rm; Text = string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0} [{1}]", c.NativeName, c.Name); if (string.CompareOrdinal(_culture.Name, _resman.DesignerLanguageName) == 0) { ImageIndex = TreeViewObjectExplorer.GetSelectedImageIndex(TreeViewObjectExplorer.GetLangaugeImageByName(_culture.Name)); } else { ImageIndex = TreeViewObjectExplorer.GetLangaugeImageByName(_culture.Name); } SelectedImageIndex = ImageIndex; }
public override void LoadNextLevel(TreeViewObjectExplorer tv, TreeNodeObject parentNode) { if (tv.RootClassNode != null && tv.RootClassNode.RootObjectId != null) { parentNode.Nodes.Add(new TreeNodeHtmlElementCurrent(new HtmlElementUnknown(tv.RootClassNode.RootObjectId))); } TreeNodeHtmlElementCollection tnhec = parentNode as TreeNodeHtmlElementCollection; IList <HtmlElement_BodyBase> hl = tnhec.UsedHtmlElements; if (hl != null && hl.Count > 0) { for (int i = 0; i < hl.Count; i++) { parentNode.Nodes.Add(new TreeNodeHtmlElement(hl[i])); } } }
public ObjectExplorerView(LimnorXmlDesignerLoader2 designerLoader) { InitializeComponent(); _loader = designerLoader; BackColor = Color.LightGray; _objExplorer = new TreeViewObjectExplorer(); _objExplorer.SetProject(designerLoader.Project); _objExplorer.ActionsHolder = _loader.GetRootId(); this.splitContainer1.Panel1.Controls.Add(_objExplorer); _objExplorer.Dock = DockStyle.Fill; txtDesc.AcceptsTab = true; txtDesc.AcceptsReturn = true; ContextMenu cm = new ContextMenu(); cm.MenuItems.Add(new MenuItem("View/Edit", mnu_editDesc)); txtDesc.ContextMenu = cm; }
public ObjectExplorerView(IVsTextLines textLines, LimnorXmlDesignerLoader designerLoader) { InitializeComponent(); _loader = designerLoader; _textLines = textLines; BackColor = Color.LightGray; _objExplorer = new TreeViewObjectExplorer(); _objExplorer.SetProject(designerLoader.Project); this.splitContainer1.Panel1.Controls.Add(_objExplorer); _objExplorer.Dock = DockStyle.Fill; AdviseTextLinesEvents(true); txtDesc.AcceptsTab = true; txtDesc.AcceptsReturn = true; ContextMenu cm = new ContextMenu(); cm.MenuItems.Add(new MenuItem("View/Edit", mnu_editDesc)); txtDesc.ContextMenu = cm; }
public override void LoadNextLevel(TreeViewObjectExplorer tv, TreeNodeObject parentNode) { List <string> ss = new List <string>(); AssemblyCacheEnum ace = new AssemblyCacheEnum(null); string s; s = ace.GetNextAssembly(); while (!string.IsNullOrEmpty(s)) { ss.Add(s); s = ace.GetNextAssembly(); } ss.Sort(); for (int i = 0; i < ss.Count; i++) { parentNode.Nodes.Add(new TreeNodeAssembly(ss[i])); } }
public TreeNodeCulture(string nm, ProjectResources rm) { _name = nm; _resman = rm; if (string.CompareOrdinal("zh", nm) == 0) { _culture = CultureInfo.GetCultureInfo("zh-CHT"); Text = "中文 zh"; if (string.CompareOrdinal(_culture.Name, _resman.DesignerLanguageName) == 0) { ImageIndex = TreeViewObjectExplorer.GetSelectedImageIndex(TreeViewObjectExplorer.GetLangaugeImageByName(_culture.Name)); } else { ImageIndex = TreeViewObjectExplorer.GetLangaugeImageByName(_culture.Name); } SelectedImageIndex = ImageIndex; } }
private void mi_useIt(object sender, EventArgs e) { if (!(this.HtmlElement is HtmlElementUnknown) && this.HtmlElement.ElementGuid == Guid.Empty) { HtmlElement_BodyBase hbb = this.HtmlElement as HtmlElement_BodyBase; if (hbb != null) { TreeViewObjectExplorer tv = this.TreeView as TreeViewObjectExplorer; if (tv != null) { TreeNodeClassRoot ownerNode = tv.DesignerRootNode; if (ownerNode != null) { ClassPointer root = ownerNode.ClassData.RootClassID; root.UseHtmlElement(hbb, tv.FindForm()); } } } } }
public void CreateContextmenu() { ContextMenu mnu = new ContextMenu(); mnu.MenuItems.Add(new MenuItemWithBitmap("Edit resources", mnu_editresources, Resources.resx.ToBitmap())); // if (_resman.Languages.Count > 0) { mnu.MenuItems.Add(new MenuItem("-")); MenuItemWithBitmap m = new MenuItemWithBitmap("default culture", mnu_changeCulture, TreeViewObjectExplorer.GetLangaugeBitmapByName(string.Empty)); m.Tag = ""; mnu.MenuItems.Add(m); foreach (string s in _resman.Languages) { if (string.CompareOrdinal(s, "zh") == 0) { m = new MenuItemWithBitmap("中文 zh", mnu_changeCulture, TreeViewObjectExplorer.GetLangaugeBitmapByName(s)); m.Tag = s; mnu.MenuItems.Add(m); } else { CultureInfo c = CultureInfo.GetCultureInfo(s); if (c != null) { m = new MenuItemWithBitmap(ProjectResources.CultureDisplay(c), mnu_changeCulture, TreeViewObjectExplorer.GetLangaugeBitmapByName(s)); m.Tag = s; mnu.MenuItems.Add(m); } } } } // this.ContextMenu = mnu; lblLang.ContextMenu = mnu; picLang.ContextMenu = mnu; }
public override void LoadNextLevel(TreeViewObjectExplorer tv, TreeNodeObject parentNode) { if (tv != null && tv.RootId != null && parentNode != null && parentNode.OwnerPointer != null && parentNode.OwnerPointer.RootPointer != null) { if (tv.Project != null && (tv.Project.ProjectType == EnumProjectType.WebAppPhp || tv.Project.ProjectType == EnumProjectType.WebAppAspx)) { if (tv.RootId.ClassId != parentNode.OwnerPointer.RootPointer.ClassId) { return; } } } IObjectPointer objRef = parentNode.OwnerPointer; TreeNodeClassRoot topClass = parentNode.TopLevelRootClassNode; bool forPhp = false; if (tv.Project != null) { forPhp = (tv.Project.ProjectType == EnumProjectType.WebAppPhp); } Dictionary <UInt32, IAction> actions = null; if (topClass != null) { if (!topClass.StaticScope) { actions = topClass.GetActions(); } } else { TreeNodeClassType rootType = parentNode.TopLevelNode as TreeNodeClassType; if (rootType != null) { actions = rootType.GetActions(); } } SortedList <string, TreeNode> newNodes = new SortedList <string, TreeNode>(); HtmlElement_BodyBase heb = (HtmlElement_BodyBase)parentNode.OwnerIdentity; MethodInfo[] mifs = heb.GetType().GetMethods(); if (mifs != null) { for (int i = 0; i < mifs.Length; i++) { if (parentNode.SelectionTarget == EnumObjectSelectType.Object) { if (mifs[i].ReturnType.Equals(typeof(void))) { continue; } ParameterInfo[] ps = mifs[i].GetParameters(); if (ps != null && ps.Length > 0) { continue; } } if (VPLUtil.IsNotForProgramming(mifs[i])) { continue; } if (!WebClientMemberAttribute.IsClientMethod(mifs[i]) && !WebServerMemberAttribute.IsServerMethod(mifs[i])) { continue; } MethodInfoPointer mp = new MethodInfoPointer(); mp.Owner = objRef; mp.SetMethodInfo(mifs[i]); int c; TreeNodeMethod nodeMethod = new TreeNodeMethod(ForStatic, mp); string key = mp.GetMethodSignature(out c); TreeNode nodeExist; if (newNodes.TryGetValue(key, out nodeExist)) { TreeNodeMethod mnd = (TreeNodeMethod)nodeExist; if (mnd.MethodInformation.DeclaringType.Equals(mnd.MethodInformation.ReflectedType)) { key = key + " - " + mifs[i].DeclaringType.Name; newNodes.Add(key, nodeMethod); } else { if (mifs[i].DeclaringType.Equals(mifs[i].ReflectedType)) { newNodes[key] = nodeMethod; key = key + " - " + mnd.MethodInformation.DeclaringType.Name; newNodes.Add(key, mnd); } else { key = key + " - " + mifs[i].DeclaringType.Name; newNodes.Add(key, nodeMethod); } } } else { newNodes.Add(key, nodeMethod); } //load actions if (actions != null) { bool bHasActions = false; foreach (IAction a in actions.Values) { ActionClass ac = a as ActionClass; if (ac != null) { MethodPointer mp0 = ac.ActionMethod as MethodPointer; if (mp0 != null) { if (mp0.IsSameObjectRef(mp)) { bHasActions = true; break; } } } } if (bHasActions) { nodeMethod.ShowActionIcon(); } } } parentNode.AddSortedNodes(newNodes); } }
public TreeNodeHtmlMethodCollection(TreeViewObjectExplorer tv, TreeNodeObject parentNode, HtmlElement_Base objectPointer, UInt32 scopeMethodId) : base(tv, parentNode, false, objectPointer, scopeMethodId) { Text = "Methods inherited"; Nodes.Add(new HtmlMethodLoader()); }
//load languages public override void LoadNextLevel(TreeViewObjectExplorer tv, TreeNodeObject parentNode) { }
public override void ResetNextLevel(TreeViewObjectExplorer tv) { NextLevelLoaded = true; base.ResetNextLevel(tv); }
public override void LoadNextLevel(TreeViewObjectExplorer tv, TreeNodeObject parentNode) { TreeNodeResourceCollection tc = (TreeNodeResourceCollection)parentNode; tc.OnLoadNextLevel(); }
public languageItem(string name) { _name = name; _img = TreeViewObjectExplorer.GetLangaugeBitmapByName(_name); }
public TreeNodeHtmlEventCollection(TreeViewObjectExplorer tv, TreeNodeObject parentNode, HtmlElement_Base objectPointer, UInt32 scopeMethodId) : base(tv, parentNode, false, objectPointer, scopeMethodId) { Text = "Events inherited"; }
public override void LoadNextLevel(TreeViewObjectExplorer tv, TreeNodeObject parentNode) { UInt32 scopeId = parentNode.ScopeMethodId; SortedList <string, TreeNode> newNodes = new SortedList <string, TreeNode>(); HtmlElement_BodyBase heb = (HtmlElement_BodyBase)parentNode.OwnerIdentity; PropertyDescriptorCollection pifs = TypeDescriptor.GetProperties(heb.GetType()); TreeNodeClassRoot topClass = parentNode.TopLevelRootClassNode; Dictionary <UInt32, IAction> actions = null; if (topClass != null) { if (!topClass.StaticScope) { actions = topClass.GetActions(); } } else { if (tv != null) { if (tv.RootClassNode != null) { actions = tv.RootClassNode.GetActions(); } } if (actions == null) { TreeNodeClassType rootType = parentNode.TopLevelNode as TreeNodeClassType; if (rootType != null) { actions = rootType.GetActions(); } } } for (int i = 0; i < pifs.Count; i++) { if (NotForProgrammingAttribute.IsNotForProgramming(pifs[i])) { continue; } if (!WebClientMemberAttribute.IsClientProperty(pifs[i]) && !WebServerMemberAttribute.IsServerProperty(pifs[i])) { continue; } TreeNodeProperty nodeProperty; PropertyPointer pp; pp = new PropertyPointer(); pp.Owner = new HtmlElementPointer(heb); pp.SetPropertyInfo(pifs[i]); if (!newNodes.ContainsKey(pp.Name)) { nodeProperty = new TreeNodeProperty(ForStatic, pp); try { newNodes.Add(pp.Name, nodeProperty); } catch (Exception err) { MathNode.Log(tv != null ? tv.FindForm() : null, err); } //load actions bool bHasActions = false; if (string.CompareOrdinal(pp.Name, "Cursor") == 0) { bHasActions = false; } if (actions != null) { foreach (IAction a in actions.Values) { if (a != null && a.IsStatic == parentNode.IsStatic) { if (nodeProperty.IncludeAction(a, tv, scopeId, false)) { bHasActions = true; break; } } } if (bHasActions) { nodeProperty.OnShowActionIcon(); } } } } parentNode.AddSortedNodes(newNodes); }