Example #1
0
        DocumentTabService(IDocumentTabUIContextLocatorProvider documentTabUIContextLocatorProvider, DocumentTreeView documentTreeView, ITabServiceProvider tabServiceProvider, IDocumentTabContentFactoryService documentTabContentFactoryService, IDocumentTabServiceSettings documentTabServiceSettings, IWpfFocusService wpfFocusService, IDecompilationCache decompilationCache, [ImportMany] IEnumerable <Lazy <IReferenceDocumentTabContentProvider, IReferenceDocumentTabContentProviderMetadata> > referenceDocumentTabContentProviders, [ImportMany] IEnumerable <Lazy <IDefaultDocumentTabContentProvider, IDefaultDocumentTabContentProviderMetadata> > defaultDocumentTabContentProviders, [ImportMany] IEnumerable <Lazy <IReferenceHandler, IReferenceHandlerMetadata> > referenceHandlers)
        {
            Settings = documentTabServiceSettings;
            this.documentTabUIContextLocatorProvider = documentTabUIContextLocatorProvider;
            this.documentTabContentFactoryService    = documentTabContentFactoryService;
            this.wpfFocusService    = wpfFocusService;
            this.decompilationCache = decompilationCache;
            this.referenceDocumentTabContentProviders = referenceDocumentTabContentProviders.OrderBy(a => a.Metadata.Order).ToArray();
            this.defaultDocumentTabContentProviders   = defaultDocumentTabContentProviders.OrderBy(a => a.Metadata.Order).ToArray();
            this.referenceHandlers = referenceHandlers.OrderBy(a => a.Metadata.Order).ToArray();
            var tvElem = documentTreeView.TreeView.UIObject;

            tvElem.IsVisibleChanged += TreeView_IsVisibleChanged;
            isTreeViewVisible        = tvElem.IsVisible;
            DocumentTreeView         = documentTreeView;
            DocumentTreeView.DocumentService.CollectionChanged += DocumentService_CollectionChanged;
            DocumentTreeView.SelectionChanged     += DocumentTreeView_SelectionChanged;
            DocumentTreeView.NodesTextChanged     += DocumentTreeView_NodesTextChanged;
            DocumentTreeView.NodeActivated        += DocumentTreeView_NodeActivated;
            DocumentTreeView.TreeView.NodeRemoved += TreeView_NodeRemoved;
            tabService      = tabServiceProvider.Create();
            TabGroupService = tabService.Create(new TabGroupServiceOptions(MenuConstants.GUIDOBJ_DOCUMENTS_TABCONTROL_GUID));
            TabGroupService.TabSelectionChanged      += TabGroupService_TabSelectionChanged;
            TabGroupService.TabGroupSelectionChanged += TabGroupService_TabGroupSelectionChanged;
        }
    private void PopulateTreeView()
    {
        Gtk.TreeViewColumn idColumn = new Gtk.TreeViewColumn();
        idColumn.Title = Mono.Unix.Catalog.GetString("Id");
        Gtk.CellRendererText idCell = new Gtk.CellRendererText();
        idColumn.PackStart(idCell, true);

        Gtk.TreeViewColumn dateColumn = new Gtk.TreeViewColumn();
        dateColumn.Title = Mono.Unix.Catalog.GetString("Date");
        Gtk.CellRendererText dateCell = new Gtk.CellRendererText();
        dateColumn.PackStart(dateCell, true);

        Gtk.TreeViewColumn nameColumn = new Gtk.TreeViewColumn();
        nameColumn.Title = Mono.Unix.Catalog.GetString("Name");
        Gtk.CellRendererText nameCell = new Gtk.CellRendererText();
        nameColumn.PackStart(nameCell, true);

        DocumentTreeView.AppendColumn(idColumn);
        DocumentTreeView.AppendColumn(dateColumn);
        DocumentTreeView.AppendColumn(nameColumn);

        idColumn.AddAttribute(idCell, "text", 0);
        dateColumn.AddAttribute(dateCell, "text", 1);
        nameColumn.AddAttribute(nameCell, "text", 2);
    }
Example #3
0
        HashSet <IDsDocument> GetModifiedDocuments(IDsDocument document)
        {
            var documentsHash = new HashSet <IDsDocument>();

            documentsHash.Add(document);
            var node = DocumentTreeView.FindNode(document);

            if (node is IModuleDocumentNode)
            {
                if (node.Document.AssemblyDef != null && node.Document.AssemblyDef.ManifestModule == node.Document.ModuleDef)
                {
                    var asmNode = node.GetAssemblyNode();
                    Debug.Assert(asmNode != null);
                    if (asmNode != null)
                    {
                        documentsHash.Add(asmNode.Document);
                    }
                }
            }
            else if (node is IAssemblyDocumentNode)
            {
                node.TreeNode.EnsureChildrenLoaded();
                var manifestModNode = node.TreeNode.DataChildren.FirstOrDefault() as IModuleDocumentNode;
                Debug.Assert(manifestModNode != null);
                if (manifestModNode != null)
                {
                    documentsHash.Add(manifestModNode.Document);
                }
            }
            return(documentsHash);
        }
Example #4
0
        void DocumentTreeView_NodeActivated(object sender, DocumentTreeNodeActivatedEventArgs e)
        {
            e.Handled = true;

            var asmRefNode = e.Node as IAssemblyReferenceNode;

            if (asmRefNode != null)
            {
                var asm = DocumentTreeView.DocumentService.Resolve(asmRefNode.AssemblyRef, asmRefNode.GetModule());
                Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => {
                    var asmNode = DocumentTreeView.FindNode(asm);
                    if (asmNode != null)
                    {
                        DocumentTreeView.TreeView.SelectItems(new ITreeNodeData[] { asmNode });
                    }
                }));
                return;
            }

            var derivedTypeNode = e.Node as IDerivedTypeNode;

            if (derivedTypeNode != null)
            {
                var td = derivedTypeNode.TypeDef;
                Debug.Assert(td != null);
                Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => {
                    var typeNode = DocumentTreeView.FindNode(td);
                    if (typeNode != null)
                    {
                        DocumentTreeView.TreeView.SelectItems(new ITreeNodeData[] { typeNode });
                    }
                }));
                return;
            }

            var baseTypeNode = e.Node as IBaseTypeNode;

            if (baseTypeNode != null)
            {
                var tdr = baseTypeNode.TypeDefOrRef;
                Debug.Assert(tdr != null);
                var td = tdr?.ScopeType.ResolveTypeDef();
                Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => {
                    var typeNode = DocumentTreeView.FindNode(td);
                    if (typeNode != null)
                    {
                        DocumentTreeView.TreeView.SelectItems(new ITreeNodeData[] { typeNode });
                    }
                }));
                return;
            }

            var tab = ActiveTabContentImpl;

            if (tab == null)
            {
                return;
            }
            SetFocus(tab);
        }
Example #5
0
        private void UpdateDocumentPreview()
        {
            DocumentTreeView.UpdateDocument();
            DocumentJsonView.UpdateDocument();


            /*if (DetailViewSelector.SelectedIndex == 1)
             * {
             *
             * }*/

            // TODO: Update only changed node and keep tree state

            /*var document = DbSelectedItems.FirstOrDefault();
             * if (document != null)
             * {
             *  DocumentTreeView.ItemsSource = new DocumentTreeItemsSource(document);
             *
             *  if (document.Collection is FileCollectionReference reference)
             *  {
             *      var fileInfo = reference.GetFileObject(document);
             *      FilePreview.LoadFile(fileInfo);
             *      BorderFilePreview.Visibility = Visibility.Visible;
             *  }
             *  else
             *  {
             *      BorderFilePreview.Visibility = Visibility.Collapsed;
             *  }
             * }*/
        }
Example #6
0
 private void UpdateDocumentPreview()
 {
     DocumentTreeView.UpdateDocument();
     DocumentJsonView.UpdateDocument();
 }
		DocumentTreeViewAppSettingsModifiedListener(DocumentTreeView documentTreeView) {
			this.documentTreeView = documentTreeView;
		}