Exemple #1
0
		/// <summary>
		/// Dispose of connect actions.
		/// </summary>
		protected override void Dispose(bool disposing)
		{
			try
			{
				if(disposing)
				{
					if(manyToOneRelationshipConnectAction != null)
					{
						manyToOneRelationshipConnectAction.Dispose();
						manyToOneRelationshipConnectAction = null;
					}
					if(manyToManyRelationshipConnectAction != null)
					{
						manyToManyRelationshipConnectAction.Dispose();
						manyToManyRelationshipConnectAction = null;
					}
					if(oneToOneRelationshipConnectAction != null)
					{
						oneToOneRelationshipConnectAction.Dispose();
						oneToOneRelationshipConnectAction = null;
					}
					if(nestedRelationshipConnectAction != null)
					{
						nestedRelationshipConnectAction.Dispose();
						nestedRelationshipConnectAction = null;
					}
					if(inheritanceRelationshipConnectAction != null)
					{
						inheritanceRelationshipConnectAction.Dispose();
						inheritanceRelationshipConnectAction = null;
					}
					UnsubscribeCompartmentItemsEvents();
				}
			}
			finally
			{
				base.Dispose(disposing);
			}
		}
Exemple #2
0
		/// <summary>
		/// Override to provide the right mouse action when trying
		/// to create links on the diagram
		/// </summary>
		/// <param name="pointArgs"></param>
		public override void OnViewMouseEnter(DslDiagrams::DiagramPointEventArgs pointArgs)
		{
			if (pointArgs  == null) throw new global::System.ArgumentNullException("pointArgs");
		
			DslDiagrams::DiagramView activeView = ActiveDiagramView;
			if(activeView != null)
			{
				DslDiagrams::MouseAction action = null;
				if (SelectedToolboxItemSupportsFilterString(activeView, global::Castle.ActiveWriter.ActiveWriterToolboxHelper.ManyToOneRelationshipFilterString))
				{
					if (manyToOneRelationshipConnectAction == null)
					{
						manyToOneRelationshipConnectAction = new global::Castle.ActiveWriter.ManyToOneRelationshipConnectAction(this);
						manyToOneRelationshipConnectAction.MouseActionDeactivated += new DslDiagrams::MouseAction.MouseActionDeactivatedEventHandler(OnConnectActionDeactivated);
					}
					action = manyToOneRelationshipConnectAction;
				} 
				else if (SelectedToolboxItemSupportsFilterString(activeView, global::Castle.ActiveWriter.ActiveWriterToolboxHelper.ManyToManyRelationshipFilterString))
				{
					if (manyToManyRelationshipConnectAction == null)
					{
						manyToManyRelationshipConnectAction = new global::Castle.ActiveWriter.ManyToManyRelationshipConnectAction(this);
						manyToManyRelationshipConnectAction.MouseActionDeactivated += new DslDiagrams::MouseAction.MouseActionDeactivatedEventHandler(OnConnectActionDeactivated);
					}
					action = manyToManyRelationshipConnectAction;
				} 
				else if (SelectedToolboxItemSupportsFilterString(activeView, global::Castle.ActiveWriter.ActiveWriterToolboxHelper.OneToOneRelationshipFilterString))
				{
					if (oneToOneRelationshipConnectAction == null)
					{
						oneToOneRelationshipConnectAction = new global::Castle.ActiveWriter.OneToOneRelationshipConnectAction(this);
						oneToOneRelationshipConnectAction.MouseActionDeactivated += new DslDiagrams::MouseAction.MouseActionDeactivatedEventHandler(OnConnectActionDeactivated);
					}
					action = oneToOneRelationshipConnectAction;
				} 
				else if (SelectedToolboxItemSupportsFilterString(activeView, global::Castle.ActiveWriter.ActiveWriterToolboxHelper.NestedRelationshipFilterString))
				{
					if (nestedRelationshipConnectAction == null)
					{
						nestedRelationshipConnectAction = new global::Castle.ActiveWriter.NestedRelationshipConnectAction(this);
						nestedRelationshipConnectAction.MouseActionDeactivated += new DslDiagrams::MouseAction.MouseActionDeactivatedEventHandler(OnConnectActionDeactivated);
					}
					action = nestedRelationshipConnectAction;
				} 
				else if (SelectedToolboxItemSupportsFilterString(activeView, global::Castle.ActiveWriter.ActiveWriterToolboxHelper.InheritanceRelationshipFilterString))
				{
					if (inheritanceRelationshipConnectAction == null)
					{
						inheritanceRelationshipConnectAction = new global::Castle.ActiveWriter.InheritanceRelationshipConnectAction(this);
						inheritanceRelationshipConnectAction.MouseActionDeactivated += new DslDiagrams::MouseAction.MouseActionDeactivatedEventHandler(OnConnectActionDeactivated);
					}
					action = inheritanceRelationshipConnectAction;
				} 
				else
				{
					action = null;
				}
				
				if (pointArgs.DiagramClientView.ActiveMouseAction != action)
				{
					try
					{
						changingMouseAction = true;
						pointArgs.DiagramClientView.ActiveMouseAction = action;
					}
					finally
					{
						changingMouseAction = false;
					}
				}
			}
		}