Beispiel #1
0
        protected override void Context()
        {
            _treeNodeFactory  = A.Fake <ITreeNodeFactory>();
            _projectRetriever = A.Fake <IProjectRetriever>();
            _observedDataTask = A.Fake <IObservedDataTask>();
            sut = new ObservedDataInExplorerPresenter(_projectRetriever, _treeNodeFactory, _observedDataTask);

            _explorerPresenter       = A.Fake <IExplorerPresenter>();
            _classificationPresenter = A.Fake <IClassificationPresenter>();
            _explorerView            = A.Fake <IExplorerView>();

            A.CallTo(() => _explorerPresenter.BaseView).Returns(_explorerView);

            _rootNodeObservedDataFolder = new RootNodeType("ObservedData", ApplicationIcons.ObservedDataFolder, ClassificationType.ObservedData);
            _rootNodeIndividualFolder   = new RootNodeType("Individual", ApplicationIcons.IndividualFolder);
            _observationRootNode        = new RootNode(_rootNodeObservedDataFolder);
            _individualRootNode         = new RootNode(_rootNodeIndividualFolder);

            sut.InitializeWith(_explorerPresenter, _classificationPresenter, _rootNodeObservedDataFolder);
            _project = A.Fake <IProject>();

            A.CallTo(() => _explorerPresenter.NodeByType(_rootNodeObservedDataFolder)).Returns(_observationRootNode);
            A.CallTo(() => _explorerView.TreeView.NodeById(_rootNodeObservedDataFolder.Id)).Returns(_observationRootNode);
            A.CallTo(() => _explorerView.AddNode(A <ITreeNode> ._)).ReturnsLazily(s => s.Arguments[0].DowncastTo <ITreeNode>());
        }
Beispiel #2
0
 public FallbackNodeFactory(
     ITreeNodeFactory <TModel> customFactory,
     ITreeNodeFactory <TModel> fallbackFactory)
 {
     this.CustomFactory   = customFactory;
     this.FallbackFactory = fallbackFactory;
 }
 public DecoratorNodeFactory(
     ITreeNodeFactory <TModel> factory,
     IEnumerable <ITreeNodeDecorator> decorators)
 {
     this.NodeFactory    = factory;
     this.NodeDecorators = decorators.ToList();
 }
        public ObjectExplorerPresenter(IObjectExplorerView view)
        {
            nodesForItem = new Dictionary <ObjectExplorerItem, List <ITreeNode> >();

            View = view;

            view.Loaded          += View_Load;
            view.NodeMouseClick  += View_NodeMouseClick;
            view.NodeAfterSelect += View_NodeAfterSelect;

            Container = ContainerDelivery.GetContainer();

            TreeNodeFactory = Container.Resolve <ITreeNodeFactory>();
            ObjectExplorerRepositoryFactory = Container.Resolve <IObjectExplorerRepositoryFactory>();
            MenuFactory = Container.Resolve <IMenuFactory>();
            CommandBus  = Container.Resolve <ICommandBus>();

            documentsController = Container.Resolve <IDocumentsController>();
            documentsController.DocumentActivationChanged += DocumentsController_DocumentActivationChanged;

            documentConnector = Container.Resolve <IDocumentConnector>();
            documentConnector.ConnectingStarted  += DocumentConnector_ConnectingStarted;
            documentConnector.ConnectingFinished += DocumentConnector_ConnectingFinished;
            documentConnector.Disconnected       += DocumentConnector_Disconnected;
        }
 public ResourceSearchStrategy(ApiVisibility apiVisibility, SearchRequest request, IProducerConsumerCollection <SearchResult> resultQueue)
     : base(request, resultQueue)
 {
     this.treeNodeFactory = request.TreeNodeFactory;
     this.apiVisibility   = apiVisibility;
     this.searchInside    = true;
 }
Beispiel #6
0
        protected override void Context()
        {
            _view                               = A.Fake <IParameterIdentificationSimulationSelectionView>();
            _treeNodeFactory                    = A.Fake <ITreeNodeFactory>();
            _applicationController              = A.Fake <IApplicationController>();
            _lazyLoadTask                       = A.Fake <ILazyLoadTask>();
            _treeNodeContextMenuFactory         = A.Fake <ITreeNodeContextMenuFactory>();
            _multipleTreeNodeContextMenuFactory = A.Fake <IMultipleTreeNodeContextMenuFactory>();
            _dialogCreator                      = A.Fake <IDialogCreator>();
            _parameterIdentificationTask        = A.Fake <IParameterIdentificationTask>();
            sut = new ParameterIdentificationSimulationSelectionPresenter(_view, _treeNodeFactory, _applicationController, _lazyLoadTask, _treeNodeContextMenuFactory,
                                                                          _multipleTreeNodeContextMenuFactory, _dialogCreator, _parameterIdentificationTask);

            _parameterIdentification = new ParameterIdentification();
            _simulation = A.Fake <ISimulation>().WithId("Id").WithName("S");
            _parameterIdentification.AddSimulation(_simulation);
            _outputMapping = new OutputMapping
            {
                OutputSelection = new SimulationQuantitySelection(_simulation, new QuantitySelection("PATH", QuantityType.Drug))
            };
            _parameterIdentification.AddOutputMapping(_outputMapping);

            _simulationNode = A.Fake <ITreeNode>();
            A.CallTo(() => _treeNodeFactory.CreateFor(_simulation)).Returns(_simulationNode);

            _simulationSelectionPresenter = A.Fake <ISelectionSimulationPresenter>();
            A.CallTo(() => _applicationController.Start <ISelectionSimulationPresenter>()).Returns(_simulationSelectionPresenter);

            sut.EditParameterIdentification(_parameterIdentification);
        }
Beispiel #7
0
 public CustomSolutionNode(IVsSolutionHierarchyNode node,
                           Lazy <ITreeNode> parent,
                           ITreeNodeFactory <IVsSolutionHierarchyNode> nodeFactory,
                           IAdapterService adapterService)
     : base(SolutionNodeKind.Custom, node, parent, nodeFactory, adapterService)
 {
 }
Beispiel #8
0
 protected override void Context()
 {
     _view = A.Fake <IMoleculeListView>();
     _moleculeBuilderToDTOMoleculeBuilderMapper = A.Fake <IMoleculeBuilderToMoleculeBuilderDTOMapper>();
     _viewItemContextMenuFactory = A.Fake <IViewItemContextMenuFactory>();
     _context         = A.Fake <IMoBiContext>();
     _treeNodeFactory = A.Fake <ITreeNodeFactory>();
     sut = new MoleculeListPresenter(_view, _moleculeBuilderToDTOMoleculeBuilderMapper, _viewItemContextMenuFactory,
                                     _context, _treeNodeFactory);
 }
Beispiel #9
0
 public ParameterIdentificationSimulationSelectionPresenter(IParameterIdentificationSimulationSelectionView view, ITreeNodeFactory treeNodeFactory,
                                                            IApplicationController applicationController, ILazyLoadTask lazyLoadTask, ITreeNodeContextMenuFactory treeNodeContextMenuFactory,
                                                            IMultipleTreeNodeContextMenuFactory multipleTreeNodeContextMenuFactory, IDialogCreator dialogCreator, IParameterIdentificationTask parameterIdentificationTask) : base(view)
 {
     _treeNodeFactory                    = treeNodeFactory;
     _applicationController              = applicationController;
     _lazyLoadTask                       = lazyLoadTask;
     _treeNodeContextMenuFactory         = treeNodeContextMenuFactory;
     _multipleTreeNodeContextMenuFactory = multipleTreeNodeContextMenuFactory;
     _dialogCreator                      = dialogCreator;
     _parameterIdentificationTask        = parameterIdentificationTask;
 }
Beispiel #10
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FolderNode"/> class.
        /// </summary>
        /// <param name="hierarchyNode">The underlying hierarchy represented by this node.</param>
        /// <param name="parentNode">The parent node accessor.</param>
        /// <param name="nodeFactory">The factory for child nodes.</param>
        /// <param name="adapter">The adapter service that implements the smart cast <see cref="ITreeNode.As{T}"/>.</param>
        public FolderNode(
            IVsSolutionHierarchyNode hierarchyNode,
            Lazy <ITreeNode> parentNode,
            ITreeNodeFactory <IVsSolutionHierarchyNode> nodeFactory,
            IAdapterService adapter)
            : base(SolutionNodeKind.Folder, hierarchyNode, parentNode, nodeFactory, adapter)
        {
            Guard.NotNull(() => parentNode, parentNode);

            this.Folder = new Lazy <EnvDTE.ProjectItem>(
                () => (EnvDTE.ProjectItem)hierarchyNode.VsHierarchy.Properties(hierarchyNode.ItemId).ExtenderObject);
        }
Beispiel #11
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ReferenceNode"/> class.
        /// </summary>
        /// <param name="hierarchyNode">The underlying hierarchy represented by this node.</param>
        /// <param name="parentNode">The parent node accessor.</param>
        /// <param name="nodeFactory">The factory for child nodes.</param>
        /// <param name="adapter">The adapter service that implements the smart cast <see cref="ITreeNode.As{T}"/>.</param>
        public ReferenceNode(
            IVsSolutionHierarchyNode hierarchyNode,
            Lazy <ITreeNode> parentNode,
            ITreeNodeFactory <IVsSolutionHierarchyNode> nodeFactory,
            IAdapterService adapter)
            : base(SolutionNodeKind.Reference, hierarchyNode, parentNode, nodeFactory, adapter)
        {
            Guard.NotNull(() => parentNode, parentNode);

            this.Reference = new Lazy <VSLangProj.Reference>(
                () => (VSLangProj.Reference)hierarchyNode.VsHierarchy.Properties(hierarchyNode.ItemId).ExtenderObject);
        }
Beispiel #12
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ReferencesNode"/> class.
        /// </summary>
        /// <param name="hierarchyNode">The underlying hierarchy represented by this node.</param>
        /// <param name="parentNode">The parent node accessor.</param>
        /// <param name="nodeFactory">The factory for child nodes.</param>
        /// <param name="adapter">The adapter service that implements the smart cast <see cref="ITreeNode.As{T}"/>.</param>
        public ReferencesNode(
            IVsSolutionHierarchyNode hierarchyNode,
            Lazy <ITreeNode> parentNode,
            ITreeNodeFactory <IVsSolutionHierarchyNode> nodeFactory,
            IAdapterService adapter)
            : base(SolutionNodeKind.ReferencesFolder, hierarchyNode, parentNode, nodeFactory, adapter)
        {
            Guard.NotNull(() => parentNode, parentNode);

            this.References = new Lazy <References>(() =>
                                                    ((VSProject)((Project)hierarchyNode.VsHierarchy.Properties(VSConstants.VSITEMID_ROOT).ExtenderObject).Object).References);
        }
 protected override void Context()
 {
     _view = A.Fake <IBuildingBlockFromTemplateView>();
     _templateTaskQuery     = A.Fake <ITemplateTaskQuery>();
     _objectTypeResolver    = A.Fake <IObjectTypeResolver>();
     _treeNodeFactory       = A.Fake <ITreeNodeFactory>();
     _contextMenuFactory    = A.Fake <ITreeNodeContextMenuFactory>();
     _applicationController = A.Fake <IApplicationController>();
     _dialogCreator         = A.Fake <IDialogCreator>();
     _startOptions          = A.Fake <IStartOptions>();
     sut = new TemplatePresenter(_view, _templateTaskQuery, _objectTypeResolver, _treeNodeFactory, _contextMenuFactory, _applicationController, _dialogCreator, _startOptions);
 }
Beispiel #14
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ProjectNode"/> class.
        /// </summary>
        /// <param name="hierarchyNode">The underlying hierarchy represented by this node.</param>
        /// <param name="parentNode">The parent node accessor.</param>
        /// <param name="nodeFactory">The factory for child nodes.</param>
        /// <param name="adapter">The adapter service that implements the smart cast <see cref="ITreeNode.As{T}"/>.</param>
        public ProjectNode(
            IVsSolutionHierarchyNode hierarchyNode,
            Lazy <ITreeNode> parentNode,
            ITreeNodeFactory <IVsSolutionHierarchyNode> nodeFactory,
            IAdapterService adapter)
            : base(SolutionNodeKind.Project, hierarchyNode, parentNode, nodeFactory, adapter)
        {
            Guard.NotNull(() => parentNode, parentNode);

            this.Project       = new Lazy <EnvDTE.Project>(() => (EnvDTE.Project)hierarchyNode.VsHierarchy.Properties(hierarchyNode.ItemId).ExtenderObject);
            this.properties    = new Lazy <GlobalProjectProperties>(() => new GlobalProjectProperties(this));
            this.Configuration = new ProjectConfiguration(this);
        }
        public static ITreeNode ToUITreeNode(this ObjectExplorerItem item, ITreeNodeFactory factory, Action <ITreeNode, ObjectExplorerItem> action)
        {
            ITreeNode uinode = factory.Create();

            uinode.Text = item.Name;
            uinode.Data = item;
            action?.Invoke(uinode, item);
            foreach (var explorerItem in item.Items)
            {
                uinode.Nodes.Add(explorerItem.ToUITreeNode(factory, action));
            }

            return(uinode);
        }
Beispiel #16
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ProjectItemNode"/> class.
 /// </summary>
 /// <param name="kind">The kind of project node.</param>
 /// <param name="hierarchyNode">The underlying hierarchy represented by this node.</param>
 /// <param name="parentNode">The parent node accessor.</param>
 /// <param name="nodeFactory">The factory for child nodes.</param>
 /// <param name="adapter">The adapter service that implements the smart cast <see cref="ITreeNode.As{T}"/>.</param>
 public ProjectItemNode(
     SolutionNodeKind kind,
     IVsSolutionHierarchyNode hierarchyNode,
     Lazy <ITreeNode> parentNode,
     ITreeNodeFactory <IVsSolutionHierarchyNode> nodeFactory,
     IAdapterService adapter)
     : base(kind, hierarchyNode, parentNode, nodeFactory, adapter)
 {
     this.nodeFactory   = nodeFactory;
     this.owningProject = new Lazy <IProjectNode>(() =>
     {
         var owningHierarchy = new VsSolutionHierarchyNode(hierarchyNode.VsHierarchy, VSConstants.VSITEMID_ROOT);
         return(this.nodeFactory.CreateNode(GetParent(owningHierarchy), owningHierarchy) as IProjectNode);
     });
 }
		/// <summary>
		/// Initializes a new instance of the <see cref="ProjectItemNode"/> class.
		/// </summary>
		/// <param name="kind">The kind of project node.</param>
		/// <param name="hierarchyNode">The underlying hierarchy represented by this node.</param>
		/// <param name="parentNode">The parent node accessor.</param>
		/// <param name="nodeFactory">The factory for child nodes.</param>
		/// <param name="adapter">The adapter service that implements the smart cast <see cref="ITreeNode.As{T}"/>.</param>
		public ProjectItemNode(
			SolutionNodeKind kind,
			IVsSolutionHierarchyNode hierarchyNode,
			Lazy<ITreeNode> parentNode,
			ITreeNodeFactory<IVsSolutionHierarchyNode> nodeFactory,
			IAdapterService adapter)
			: base(kind, hierarchyNode, parentNode, nodeFactory, adapter)
		{
			this.nodeFactory = nodeFactory;
			this.owningProject = new Lazy<IProjectNode>(() =>
			{
				var owningHierarchy = new VsSolutionHierarchyNode(hierarchyNode.VsHierarchy, VSConstants.VSITEMID_ROOT);
				return this.nodeFactory.CreateNode(GetParent(owningHierarchy), owningHierarchy) as IProjectNode;
			});
		}
Beispiel #18
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SolutionTreeNode"/> class.
        /// </summary>
        /// <param name="nodeKind">Kind of the node.</param>
        /// <param name="hierarchyNode">The underlying hierarchy represented by this node.</param>
        /// <param name="parentNode">The parent node accessor.</param>
        /// <param name="nodeFactory">The factory for child nodes.</param>
        /// <param name="adapter">The adapter service that implements the smart cast <see cref="ITreeNode.As{T}"/>.</param>
        protected SolutionTreeNode(
            SolutionNodeKind nodeKind,
            IVsSolutionHierarchyNode hierarchyNode,
            Lazy <ITreeNode> parentNode,
            ITreeNodeFactory <IVsSolutionHierarchyNode> nodeFactory,
            IAdapterService adapter)
        {
            Guard.NotNull(() => hierarchyNode, hierarchyNode);
            Guard.NotNull(() => nodeFactory, nodeFactory);
            Guard.NotNull(() => adapter, adapter);

            this.hierarchyNode = hierarchyNode;
            this.factory       = nodeFactory;
            this.adapter       = adapter;
            this.window        = new Lazy <IVsUIHierarchyWindow>(() => GetWindow(this.hierarchyNode.ServiceProvider));
            this.parent        = parentNode ?? new Lazy <ITreeNode>(() => null);
            this.DisplayName   = this.hierarchyNode.VsHierarchy.Properties(hierarchyNode.ItemId).DisplayName;
            this.Kind          = nodeKind;

            Func <bool> getHiddenProperty = () => GetProperty <bool?>(
                this.hierarchyNode.VsHierarchy,
                __VSHPROPID.VSHPROPID_IsHiddenItem,
                this.hierarchyNode.ItemId).GetValueOrDefault();

            this.isHidden = parentNode != null ?
                            new Lazy <bool>(() => getHiddenProperty() || parentNode.Value.IsHidden) :
                            new Lazy <bool>(() => getHiddenProperty());

            if (System.Diagnostics.Debugger.IsAttached)
            {
                this.debuggerDisplay = BuildDebuggerDisplay();
            }

            this.solutionNode = new Lazy <ISolutionNode>(() =>
            {
                var solutionHierarchy = new VsSolutionHierarchyNode(
                    (IVsHierarchy)this.hierarchyNode.ServiceProvider.GetService <SVsSolution, IVsSolution>(),
                    VSConstants.VSITEMID_ROOT);

                return((ISolutionNode)this.factory.CreateNode(null, solutionHierarchy));
            });
        }
Beispiel #19
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SolutionItemNode"/> class.
        /// </summary>
        /// <param name="hierarchyNode">The underlying hierarchy represented by this node.</param>
        /// <param name="parentNode">The parent node accessor.</param>
        /// <param name="nodeFactory">The factory for child nodes.</param>
        /// <param name="adapter">The adapter service that implements the smart cast <see cref="ITreeNode.As{T}"/>.</param>
        public SolutionItemNode(
            IVsSolutionHierarchyNode hierarchyNode,
            Lazy <ITreeNode> parentNode,
            ITreeNodeFactory <IVsSolutionHierarchyNode> nodeFactory,
            IAdapterService adapter)
            : base(SolutionNodeKind.SolutionItem, hierarchyNode, parentNode, nodeFactory, adapter)
        {
            Guard.NotNull(() => parentNode, parentNode);

            this.nodeFactory = nodeFactory;

            this.Item = new Lazy <EnvDTE.ProjectItem>(
                () => (EnvDTE.ProjectItem)hierarchyNode.VsHierarchy.Properties(hierarchyNode.ItemId).ExtenderObject);

            this.owningFolder = new Lazy <ISolutionFolderNode>(() =>
            {
                var owningHierarchy = new VsSolutionHierarchyNode(hierarchyNode.VsHierarchy, VSConstants.VSITEMID_ROOT);
                return(this.nodeFactory.CreateNode(GetParent(owningHierarchy), owningHierarchy) as ISolutionFolderNode);
            });
        }
Beispiel #20
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SolutionNode"/> class.
 /// </summary>
 /// <param name="hierarchyNode">The underlying hierarchy represented by this node.</param>
 /// <param name="childNodeFactory">The factory for child nodes.</param>
 /// <param name="looseNodeFactory">The explorer node factory used to create "loose" nodes from solution explorer.</param>
 /// <param name="locator">The service locator.</param>
 /// <param name="adapter">The adapter service that implements the smart cast <see cref="ITreeNode.As{T}"/>.</param>
 /// <param name="solutionEvents">The solution events.</param>
 /// <param name="uiThread">The UI thread.</param>
 public SolutionNode(
     IVsSolutionHierarchyNode hierarchyNode,
     // This is the regular node factory for trees, that receives a lazy
     // pointer to the parent tree node.
     ITreeNodeFactory <IVsSolutionHierarchyNode> childNodeFactory,
     // This factory is used to create "loose" nodes from solution explorer
     ISolutionExplorerNodeFactory looseNodeFactory,
     IServiceLocator locator,
     IAdapterService adapter,
     ISolutionEvents solutionEvents,
     // Retrieving current selection must be done on the UI thread.
     IUIThread uiThread)
     : base(SolutionNodeKind.Solution, hierarchyNode, null, childNodeFactory, adapter)
 {
     this.Solution            = new Lazy <EnvDTE.Solution>(() => hierarchyNode.ServiceProvider.GetService <EnvDTE.DTE>().Solution);
     this.nodeFactory         = childNodeFactory;
     this.explorerNodeFactory = looseNodeFactory;
     this.events    = solutionEvents;
     this.selection = new Lazy <IVsMonitorSelection>(() => locator.GetService <SVsShellMonitorSelection, IVsMonitorSelection>());
     this.uiThread  = uiThread;
 }
 public ObservedDataInExplorerPresenter(IProjectRetriever projectRetriever, ITreeNodeFactory treeNodeFactory, IObservedDataTask observedDataTask)
 {
     _projectRetriever = projectRetriever;
     _treeNodeFactory  = treeNodeFactory;
     _observedDataTask = observedDataTask;
 }
Beispiel #22
0
 public ParameterAnalysablesInExplorerPresenter(IParameterIdentificationTask parameterIdentificationTask, ISensitivityAnalysisTask sensitivityAnalysisTask, ITreeNodeFactory treeNodeFactory)
 {
     _parameterIdentificationTask = parameterIdentificationTask;
     _sensitivityAnalysisTask     = sensitivityAnalysisTask;
     _treeNodeFactory             = treeNodeFactory;
 }
 public IndividualMoleculesPresenter(IMoleculesView view, IMoleculeExpressionTask <Individual> moleculeExpressionTask, ITreeNodeFactory treeNodeFactory,
                                     ITreeNodeContextMenuFactory contextMenuFactory, IDialogCreator dialogCreator, IEntityTask entityTask,
                                     IRootNodeToIndividualExpressionsPresenterMapper <Individual> expressionsPresenterMapper, INoItemInSelectionPresenter noItemInSelectionPresenter)
     : base(view, moleculeExpressionTask, treeNodeFactory, contextMenuFactory, dialogCreator, entityTask, expressionsPresenterMapper, noItemInSelectionPresenter)
 {
 }
 public HierarchicalSimulationPresenter(IHierarchicalStructureView view, IMoBiContext context,
                                        IObjectBaseToObjectBaseDTOMapper objectBaseMapper,
                                        ISimulationSettingsToObjectBaseDTOMapper simulationSettingsMapper, ITreeNodeFactory treeNodeFactory, IViewItemContextMenuFactory contextMenuFactory)
     : base(view, context, objectBaseMapper, treeNodeFactory)
 {
     _simulationSettingsMapper = simulationSettingsMapper;
     _contextMenuFactory       = contextMenuFactory;
 }
Beispiel #25
0
 public HierarchicalSpatialStructurePresenter(IHierarchicalStructureView view, IMoBiContext context,
                                              IObjectBaseToObjectBaseDTOMapper objectBaseMapper, IViewItemContextMenuFactory contextMenuFactory, ITreeNodeFactory treeNodeFactory)
     : base(view, context, objectBaseMapper, treeNodeFactory)
 {
     _contextMenuFactory = contextMenuFactory;
 }
 public static T CreateNode <T>(this ITreeNodeFactory nodeFactory) where T : class, ITreeNode
 {
     return(nodeFactory.CreateNode(typeof(T)) as T);
 }
 public EditorEnvironment(ITreeNodeFactory nodeFactory, IUndoRedoStack undoRedoStack)
 {
     NodeFactory   = nodeFactory;
     UndoRedoStack = undoRedoStack;
 }
Beispiel #28
0
 public DesignDataService(IDesignDataHelper designDataHelper, ITreeNodeFactory treeNodeFactory, ITreeNodeCollectionFactory treeNodeCollectionFactory)
 {
     _designDataHelper = designDataHelper;
     _treeNodeFactory  = treeNodeFactory;
 }