예제 #1
0
		/// <summary>
		/// Returns the EntityRelationShipConnectionType associated with this action.
		/// </summary>
		protected override DslDiagrams::ConnectionType[] GetConnectionTypes(DslDiagrams::ShapeElement sourceShapeElement, DslDiagrams::ShapeElement targetShapeElement)
		{
			if(this.connectionTypes == null)
			{
				this.connectionTypes = new DslDiagrams::ConnectionType[] { new EntityRelationShipConnectionType() };
			}
			
			return this.connectionTypes;
		}
예제 #2
0
			private static DslDiagrams::ShapeElement RemovePassThroughShapes(DslDiagrams::ShapeElement shape)
			{
				if (shape is DslDiagrams::Compartment)
				{
					return shape.ParentShape;
				}
				DslDiagrams::SwimlaneShape swimlane = shape as DslDiagrams::SwimlaneShape;
				if (swimlane != null && swimlane.ForwardDragDropToParent)
				{
					return shape.ParentShape;
				}
				return shape;
			}
예제 #3
0
        protected override GraphicsPath GetPath(DslDiagrams.RectangleD bounds)
        {
            var path = DecoratorPath;
            //Fill the circle
            this.FillDecorator = true;
            
            //Draw an ellipse, moving the top left to compensate for line width

            //TODO: Figure out how to retrieve the line width programmatically. DslDefinition.Connector.Thickness

            //path.AddEllipse((float)(bounds.X + .01), (float)(bounds.Y + .01), (float)(bounds.Width * .8), (float)(bounds.Height * .8));
            //path.AddLines()
            return path;
        }
예제 #4
0
		/// <summary>
		/// Initializes style set resources for this shape type
		/// </summary>
		/// <param name="classStyleSet">The style set for this shape class</param>
		protected override void InitializeResources(DslDiagrams::StyleSet classStyleSet)
		{
			base.InitializeResources(classStyleSet);
			
			// Line pen settings for this connector.
			DslDiagrams::PenSettings linePen = new DslDiagrams::PenSettings();
			linePen.Color = global::System.Drawing.Color.FromArgb(255, 113, 111, 110);
			classStyleSet.OverridePen(DslDiagrams::DiagramPens.ConnectionLineDecorator, linePen);
			linePen.Width = 0.01f;
			classStyleSet.OverridePen(DslDiagrams::DiagramPens.ConnectionLine, linePen);
			DslDiagrams::BrushSettings lineBrush = new DslDiagrams::BrushSettings();
			lineBrush.Color = global::System.Drawing.Color.FromArgb(255, 113, 111, 110);
			classStyleSet.OverrideBrush(DslDiagrams::DiagramBrushes.ConnectionLineDecorator, lineBrush);
			
		}
예제 #5
0
		/// <summary>
		/// Gets the cursor corresponding to the given mouse position.
		/// </summary>
		/// <remarks>
		/// Changes the cursor to Cursors.No before the first mouse click if the source shape is not valid.
		/// </remarks>
		public override global::System.Windows.Forms.Cursor GetCursor(global::System.Windows.Forms.Cursor currentCursor, DslDiagrams::DiagramClientView diagramClientView, DslDiagrams::PointD mousePosition)
		{
			if (this.MouseDownHitShape == null && currentCursor != global::System.Windows.Forms.Cursors.No)
			{
				DslDiagrams::DiagramHitTestInfo hitTestInfo = new DslDiagrams::DiagramHitTestInfo(diagramClientView);
				this.Diagram.DoHitTest(mousePosition, hitTestInfo);
				DslDiagrams::ShapeElement shape = hitTestInfo.HitDiagramItem.Shape;

				DslDiagrams::ConnectionType connectionType = GetConnectionTypes(shape, null)[0];
				string warningString = string.Empty;
				if (!connectionType.CanCreateConnection(shape, null, ref warningString))
				{
					return global::System.Windows.Forms.Cursors.No;
				}
			}
			return base.GetCursor(currentCursor, diagramClientView, mousePosition);
		}
			/// <summary>
			/// Called by the base ConnectAction class to ask whether the given source and target are valid.
			/// </summary>
			/// <remarks>
			/// Always return true here, to give CanCreateConnection a chance to decide.
			/// </remarks>
			public override bool IsValidSourceAndTarget(DslDiagrams::ShapeElement sourceShapeElement, DslDiagrams::ShapeElement targetShapeElement)
			{
				return true;
			}
		/// <summary>
		/// Constructs a new ViewLinkConnectAction for the given Diagram.
		/// </summary>
		public ViewLinkConnectAction(DslDiagrams::Diagram diagram): base(diagram, true) 
		{
		}
		/// <summary>
		/// Constructs a new AssociationConnectAction for the given Diagram.
		/// </summary>
		public AssociationConnectAction(DslDiagrams::Diagram diagram): base(diagram, true) 
		{
		}
예제 #9
0
		/// <summary>
		/// Constructs a new AggregateStateRelationshipConnectAction for the given Diagram.
		/// </summary>
		public AggregateStateRelationshipConnectAction(DslDiagrams::Diagram diagram): base(diagram, true) 
		{
			global::System.Resources.ResourceManager resourceManager = global::FourDeep.Dizzle.DizzleDomainModel.SingletonResourceManager;
			global::System.Globalization.CultureInfo resourceCulture = global::System.Globalization.CultureInfo.CurrentUICulture;

			byte[] sourceCursorBytes = (byte[])resourceManager.GetObject("AggregateStateRelationshipSourceCursor", resourceCulture);
			using(global::System.IO.MemoryStream sourceCursorStream = new global::System.IO.MemoryStream(sourceCursorBytes))
			{ 
				this.sourceCursor = new global::System.Windows.Forms.Cursor(sourceCursorStream);
			}
			byte[] targetCursorBytes = (byte[])resourceManager.GetObject("AggregateStateRelationshipTargetCursor", resourceCulture);
			using(global::System.IO.MemoryStream targetCursorStream = new global::System.IO.MemoryStream(targetCursorBytes))
			{ 
				this.targetCursor = new global::System.Windows.Forms.Cursor(targetCursorStream);
			}
		}
예제 #10
0
		/// <summary>
		/// Ensure outer decorators are placed appropriately.  This is called during view fixup,
		/// after the shape has been associated with the model element.
		/// </summary>
		public override void OnBoundsFixup(DslDiagrams::BoundsFixupState fixupState, int iteration, bool createdDuringViewFixup)
		{
			base.OnBoundsFixup(fixupState, iteration, createdDuringViewFixup);
			
			if(iteration == 0)
			{
				foreach(DslDiagrams::Decorator decorator in this.Decorators)
				{
					if(decorator.RequiresHost)
					{
						decorator.RepositionHostShape(decorator.GetHostShape(this));
					}
				}
			}
		}
		/// <summary>
		/// Constructs a new ExtensionPointCreateAction for the given Diagram.
		/// </summary>
		public ExtensionPointCreateAction(DslDiagrams::Diagram diagram): base(diagram)
		{
		}
예제 #12
0
		/// <summary>
		/// Helper method to find shapes for either end of a connector by looking for shapes associated with either end of the relationship mapped to the connector.
		/// </summary>
		private DslDiagrams::NodeShape[] GetEndShapesForConnector(DslDiagrams::BinaryLinkShape connector)
		{
			DslModeling::ElementLink link = connector.ModelElement as DslModeling::ElementLink;
			DslDiagrams::NodeShape sourceShape = null, targetShape = null;
			if (link != null)
			{
				global::System.Collections.ObjectModel.ReadOnlyCollection<DslModeling::ModelElement> linkedElements = link.LinkedElements;
				if (linkedElements.Count == 2)
				{
					DslDiagrams::Diagram currentDiagram = this.Diagram;
					DslModeling::LinkedElementCollection<DslDiagrams::PresentationElement> presentationElements = DslDiagrams::PresentationViewsSubject.GetPresentation(linkedElements[0]);
					foreach (DslDiagrams::PresentationElement presentationElement in presentationElements)
					{
						DslDiagrams::NodeShape shape = presentationElement as DslDiagrams::NodeShape;
						if (shape != null && shape.Diagram == currentDiagram)
						{
							sourceShape = shape;
							break;
						}
					}
					
					presentationElements = DslDiagrams::PresentationViewsSubject.GetPresentation(linkedElements[1]);
					foreach (DslDiagrams::PresentationElement presentationElement in presentationElements)
					{
						DslDiagrams::NodeShape shape = presentationElement as DslDiagrams::NodeShape;
						if (shape != null && shape.Diagram == currentDiagram)
						{
							targetShape = shape;
							break;
						}
					}
		
				}
			}
			
			return new DslDiagrams::NodeShape[] { sourceShape, targetShape };
		}
예제 #13
0
		internal void GetSourceAndTargetForConnector(DslDiagrams::BinaryLinkShape connector, out DslDiagrams::NodeShape sourceShape, out DslDiagrams::NodeShape targetShape)
		{
			sourceShape = null;
			targetShape = null;
			
			if (sourceShape == null || targetShape == null)
			{
				DslDiagrams::NodeShape[] endShapes = GetEndShapesForConnector(connector);
				if(sourceShape == null)
				{
					sourceShape = endShapes[0];
				}
				if(targetShape == null)
				{
					targetShape = endShapes[1];
				}
			}
		}
예제 #14
0
		/// <summary>
		/// Called during view fixup to configure the given child element, after it has been created.
		/// </summary>
		/// <remarks>
		/// Custom code for choosing the shapes attached to either end of a connector is called from here.
		/// </remarks>
		protected override void OnChildConfiguring(DslDiagrams::ShapeElement child, bool createdDuringViewFixup)
		{
			DslDiagrams::NodeShape sourceShape;
			DslDiagrams::NodeShape targetShape;
			DslDiagrams::BinaryLinkShape connector = child as DslDiagrams::BinaryLinkShape;
			if(connector == null)
			{
				base.OnChildConfiguring(child, createdDuringViewFixup);
				return;
			}
			this.GetSourceAndTargetForConnector(connector, out sourceShape, out targetShape);
			
			global::System.Diagnostics.Debug.Assert(sourceShape != null && targetShape != null, "Unable to find source and target shapes for connector.");
			connector.Connect(sourceShape, targetShape);
		}
예제 #15
0
		/// <summary>
		/// Returns the ProductionWorkflowConnectorConnectionType associated with this action.
		/// </summary>
		protected override DslDiagrams::ConnectionType[] GetConnectionTypes(DslDiagrams::ShapeElement sourceShapeElement, DslDiagrams::ShapeElement targetShapeElement)
		{
			if(this.connectionTypes == null)
			{
				this.connectionTypes = new DslDiagrams::ConnectionType[] { new ProductionWorkflowConnectorConnectionType() };
			}
			
			return this.connectionTypes;
		}
		/// <summary>
		/// Constructs a new CollectionCreateAction for the given Diagram.
		/// </summary>
		public CollectionCreateAction(DslDiagrams::Diagram diagram): base(diagram)
		{
		}
		/// <summary>
		/// Constructs a new ElementCreateAction for the given Diagram.
		/// </summary>
		public ElementCreateAction(DslDiagrams::Diagram diagram): base(diagram)
		{
		}
예제 #18
0
		/// <summary>
		/// Most connectors are mapped to element links, but there can be exceptions. This method tell if a connector should be
		/// mapped to an element link.
		/// </summary>
		public override bool IsConnectorMappedToLink(DslDiagrams::BinaryLinkShape connector)
		{
			#region Check Parameters
			global::System.Diagnostics.Debug.Assert(connector != null);
			if (connector == null)
				throw new global::System.ArgumentNullException("connector");
			#endregion
			if (connector.GetType() == typeof(global::Microsoft.Practices.ServiceFactory.DataContracts.DataContractAggregationConnector))
				return false;
			return base.IsConnectorMappedToLink(connector);
		}
예제 #19
0
		/// <summary>
		/// Initializes style set resources for this shape type
		/// </summary>
		/// <param name="classStyleSet">The style set for this shape class</param>
		protected override void InitializeResources(DslDiagrams::StyleSet classStyleSet)
		{
			base.InitializeResources(classStyleSet);
			
			// Outline pen settings for this shape.
			DslDiagrams::PenSettings outlinePen = new DslDiagrams::PenSettings();
			outlinePen.Width = 0.01F;
			classStyleSet.OverridePen(DslDiagrams::DiagramPens.ShapeOutline, outlinePen);
		}
예제 #20
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 = this.ActiveDiagramView;
			if(activeView != null)
			{
				bool stickyMode = false;
				DslDesign::ModelingToolboxItem selectedToolboxItem = activeView.Toolbox.GetSelectedToolboxItem() as DslDesign::ModelingToolboxItem;
				if (selectedToolboxItem != null && selectedToolboxItem.Id == this.stickyToolboxItemId)
				{
					stickyMode = true;
				}
				else
				{
					stickyMode = false;
					this.stickyToolboxItemId = null;
				}
		
				DslDiagrams::MouseAction action = null;
				if (SelectedToolboxItemSupportsFilterString(activeView, global::Microsoft.Practices.ServiceFactory.DataContracts.DataContractDslToolboxHelper.DataContractToolFilterString))
				{
					if (this.dataContractToolCreateAction == null)
					{
						this.dataContractToolCreateAction = new global::Microsoft.Practices.ServiceFactory.DataContracts.DataContractToolCreateAction(this);
						this.dataContractToolCreateAction.MouseActionDeactivated += new DslDiagrams::MouseAction.MouseActionDeactivatedEventHandler(OnToolboxActionDeactivated);
					}
					this.dataContractToolCreateAction.StickyMode = stickyMode;
					action = this.dataContractToolCreateAction;
				}
				else if (SelectedToolboxItemSupportsFilterString(activeView, global::Microsoft.Practices.ServiceFactory.DataContracts.DataContractDslToolboxHelper.DataContractEnumToolFilterString))
				{
					if (this.dataContractEnumToolCreateAction == null)
					{
						this.dataContractEnumToolCreateAction = new global::Microsoft.Practices.ServiceFactory.DataContracts.DataContractEnumToolCreateAction(this);
						this.dataContractEnumToolCreateAction.MouseActionDeactivated += new DslDiagrams::MouseAction.MouseActionDeactivatedEventHandler(OnToolboxActionDeactivated);
					}
					this.dataContractEnumToolCreateAction.StickyMode = stickyMode;
					action = this.dataContractEnumToolCreateAction;
				}
				else if (SelectedToolboxItemSupportsFilterString(activeView, global::Microsoft.Practices.ServiceFactory.DataContracts.DataContractDslToolboxHelper.PrimitiveDataTypeCollectionToolFilterString))
				{
					if (this.primitiveDataTypeCollectionToolCreateAction == null)
					{
						this.primitiveDataTypeCollectionToolCreateAction = new global::Microsoft.Practices.ServiceFactory.DataContracts.PrimitiveDataTypeCollectionToolCreateAction(this);
						this.primitiveDataTypeCollectionToolCreateAction.MouseActionDeactivated += new DslDiagrams::MouseAction.MouseActionDeactivatedEventHandler(OnToolboxActionDeactivated);
					}
					this.primitiveDataTypeCollectionToolCreateAction.StickyMode = stickyMode;
					action = this.primitiveDataTypeCollectionToolCreateAction;
				}
				else if (SelectedToolboxItemSupportsFilterString(activeView, global::Microsoft.Practices.ServiceFactory.DataContracts.DataContractDslToolboxHelper.DataContractCollectionToolFilterString))
				{
					if (this.dataContractCollectionToolCreateAction == null)
					{
						this.dataContractCollectionToolCreateAction = new global::Microsoft.Practices.ServiceFactory.DataContracts.DataContractCollectionToolCreateAction(this);
						this.dataContractCollectionToolCreateAction.MouseActionDeactivated += new DslDiagrams::MouseAction.MouseActionDeactivatedEventHandler(OnToolboxActionDeactivated);
					}
					this.dataContractCollectionToolCreateAction.StickyMode = stickyMode;
					action = this.dataContractCollectionToolCreateAction;
				}
				else if (SelectedToolboxItemSupportsFilterString(activeView, global::Microsoft.Practices.ServiceFactory.DataContracts.DataContractDslToolboxHelper.FaultContractToolFilterString))
				{
					if (this.faultContractToolCreateAction == null)
					{
						this.faultContractToolCreateAction = new global::Microsoft.Practices.ServiceFactory.DataContracts.FaultContractToolCreateAction(this);
						this.faultContractToolCreateAction.MouseActionDeactivated += new DslDiagrams::MouseAction.MouseActionDeactivatedEventHandler(OnToolboxActionDeactivated);
					}
					this.faultContractToolCreateAction.StickyMode = stickyMode;
					action = this.faultContractToolCreateAction;
				}
				else if (SelectedToolboxItemSupportsFilterString(activeView, global::Microsoft.Practices.ServiceFactory.DataContracts.DataContractDslToolboxHelper.AggregationConnectionToolFilterString))
				{
					if (this.aggregationConnectionToolConnectAction == null)
					{
						this.aggregationConnectionToolConnectAction = new global::Microsoft.Practices.ServiceFactory.DataContracts.AggregationConnectionToolConnectAction(this);
						this.aggregationConnectionToolConnectAction.MouseActionDeactivated += new DslDiagrams::MouseAction.MouseActionDeactivatedEventHandler(OnToolboxActionDeactivated);
					}
					this.aggregationConnectionToolConnectAction.StickyMode = stickyMode;
					action = this.aggregationConnectionToolConnectAction;
				} 
				else
				{
					action = null;
				}
				
				if (pointArgs.DiagramClientView.ActiveMouseAction != action)
				{
					try
					{
						this.changingMouseAction = true;
						pointArgs.DiagramClientView.ActiveMouseAction = action;
					}
					finally
					{
						this.changingMouseAction = false;
					}
				}
			}
		}
예제 #21
0
		/// <summary>
		/// Initializes style set resources for this shape type
		/// </summary>
		/// <param name="classStyleSet">The style set for this shape class</param>
		protected override void InitializeResources(DslDiagrams::StyleSet classStyleSet)
		{
			base.InitializeResources(classStyleSet);
			
			// Outline pen settings for this shape.
			DslDiagrams::PenSettings outlinePen = new DslDiagrams::PenSettings();
			outlinePen.Color = global::System.Drawing.Color.FromArgb(255, 204, 204, 102);
			outlinePen.Width = 0.01F;
			classStyleSet.OverridePen(DslDiagrams::DiagramPens.ShapeOutline, outlinePen);
			// Fill brush settings for this shape.
			DslDiagrams::BrushSettings backgroundBrush = new DslDiagrams::BrushSettings();
			backgroundBrush.Color = global::System.Drawing.Color.FromArgb(255, 255, 255, 204);
			classStyleSet.OverrideBrush(DslDiagrams::DiagramBrushes.ShapeBackground, backgroundBrush);
		
		}
예제 #22
0
		/// <summary>
		/// Initializes style set resources for this shape type
		/// </summary>
		/// <param name="classStyleSet">The style set for this shape class</param>
		protected override void InitializeResources(DslDiagrams::StyleSet classStyleSet)
		{
			base.InitializeResources(classStyleSet);
			
			// Line pen settings for this connector.
			DslDiagrams::PenSettings linePen = new DslDiagrams::PenSettings();
			linePen.Color = global::System.Drawing.Color.FromKnownColor(global::System.Drawing.KnownColor.DarkGoldenrod);
			classStyleSet.OverridePen(DslDiagrams::DiagramPens.ConnectionLineDecorator, linePen);
			linePen.Width = 0.0125f;
			linePen.DashStyle = global::System.Drawing.Drawing2D.DashStyle.Dash;
			classStyleSet.OverridePen(DslDiagrams::DiagramPens.ConnectionLine, linePen);
			DslDiagrams::BrushSettings lineBrush = new DslDiagrams::BrushSettings();
			lineBrush.Color = global::System.Drawing.Color.FromKnownColor(global::System.Drawing.KnownColor.DarkGoldenrod);
			classStyleSet.OverrideBrush(DslDiagrams::DiagramBrushes.ConnectionLineDecorator, lineBrush);
			
		}
예제 #23
0
		/// <summary>
		/// Associates custom source and target cursors with the connect action.
		/// </summary>
		protected override global::System.Windows.Forms.Cursor GetCursorFromCursorType(DslDiagrams::ConnectActionCursor connectActionCursor)
		{
			if(connectActionCursor == DslDiagrams::ConnectActionCursor.Searching)
			{
				return this.sourceCursor;
			}
			if(connectActionCursor == DslDiagrams::ConnectActionCursor.Allowed)
			{
				return this.targetCursor;
			}
			return base.GetCursorFromCursorType(connectActionCursor);
		}
예제 #24
0
파일: Diagram.cs 프로젝트: npenin/uss
		/// <summary>
		/// Most connectors are mapped to element links, but there can be exceptions. This method tell if a connector should be
		/// mapped to an element link.
		/// </summary>
		public override bool IsConnectorMappedToLink(DslDiagrams::BinaryLinkShape connector)
		{
			#region Check Parameters
			global::System.Diagnostics.Debug.Assert(connector != null);
			if (connector == null)
				throw new global::System.ArgumentNullException("connector");
			#endregion
			if (connector.GetType() == typeof(global::Evaluant.Uss.SqlMapper.Mapping.Relationshipshape))
				return false;
			return base.IsConnectorMappedToLink(connector);
		}
		/// <summary>
		/// Constructs a new InheritanceConnectAction for the given Diagram.
		/// </summary>
		public InheritanceConnectAction(DslDiagrams::Diagram diagram): base(diagram, true) 
		{
		}
예제 #26
0
파일: Diagram.cs 프로젝트: npenin/uss
		/// <summary>
		/// Virtual method to provide a filter when to select the mouse action
		/// </summary>
		/// <param name="activeView">Currently active view</param>
		/// <param name="filter">filter string used to filter the toolbox items</param>
		protected virtual bool SelectedToolboxItemSupportsFilterString(DslDiagrams::DiagramView activeView, string filter)
		{
			return activeView.SelectedToolboxItemSupportsFilterString(filter);
		}
			/// <summary>
			/// Called by the base ConnectAction class to determine if the given shapes can be connected.
			/// </summary>
			/// <remarks>
			/// This implementation delegates calls to the ConnectionBuilder EntityHasViewsBuilder.
			/// </remarks>
			public override bool CanCreateConnection(DslDiagrams::ShapeElement sourceShapeElement, DslDiagrams::ShapeElement targetShapeElement, ref string connectionWarning)
			{
				bool canConnect = true;
				
				if(sourceShapeElement == null) throw new global::System.ArgumentNullException("sourceShapeElement");
				sourceShapeElement = RemovePassThroughShapes(sourceShapeElement);
				DslModeling::ModelElement sourceElement = sourceShapeElement.ModelElement;
				if(sourceElement == null) sourceElement = sourceShapeElement;
				
				DslModeling::ModelElement targetElement = null;
				if (targetShapeElement != null)
				{
					targetShapeElement = RemovePassThroughShapes(targetShapeElement);
					targetElement = targetShapeElement.ModelElement;
					if(targetElement == null) targetElement = targetShapeElement;
			
				}

				// base.CanCreateConnection must be called to check whether existing Locks prevent this link from getting created.	
				canConnect = base.CanCreateConnection(sourceShapeElement, targetShapeElement, ref connectionWarning);
				if (canConnect)
				{				
					if(targetShapeElement == null)
					{
						return EntityHasViewsBuilder.CanAcceptSource(sourceElement);
					}
					else
					{				
						return EntityHasViewsBuilder.CanAcceptSourceAndTarget(sourceElement, targetElement);
					}
				}
				else
				{
					//return false
					return canConnect;
				}
			}
예제 #28
0
파일: Diagram.cs 프로젝트: npenin/uss
		/// <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 = this.ActiveDiagramView;
			if(activeView != null)
			{
				DslDiagrams::MouseAction action = null;
				if (SelectedToolboxItemSupportsFilterString(activeView, global::Evaluant.Uss.SqlMapper.Mapping.SqlMapperMappingToolboxHelper.ExampleRelationshipFilterString))
				{
					if (this.exampleRelationshipConnectAction == null)
					{
						this.exampleRelationshipConnectAction = new global::Evaluant.Uss.SqlMapper.Mapping.ExampleRelationshipConnectAction(this);
						this.exampleRelationshipConnectAction.MouseActionDeactivated += new DslDiagrams::MouseAction.MouseActionDeactivatedEventHandler(OnConnectActionDeactivated);
					}
					action = this.exampleRelationshipConnectAction;
				} 
				else
				{
					action = null;
				}
				
				if (pointArgs.DiagramClientView.ActiveMouseAction != action)
				{
					try
					{
						this.changingMouseAction = true;
						pointArgs.DiagramClientView.ActiveMouseAction = action;
					}
					finally
					{
						this.changingMouseAction = false;
					}
				}
			}
		}
			/// <summary>
			/// Called by the base ConnectAction class to create the underlying relationship.
			/// </summary>
			/// <remarks>
			/// This implementation delegates calls to the ConnectionBuilder EntityHasViewsBuilder.
			/// </remarks>
			public override void CreateConnection(DslDiagrams::ShapeElement sourceShapeElement, DslDiagrams::ShapeElement targetShapeElement, DslDiagrams::PaintFeedbackArgs paintFeedbackArgs)
			{
				if(sourceShapeElement == null) throw new global::System.ArgumentNullException("sourceShapeElement");
				if(targetShapeElement == null) throw new global::System.ArgumentNullException("targetShapeElement");
				
				sourceShapeElement = RemovePassThroughShapes(sourceShapeElement);
				targetShapeElement = RemovePassThroughShapes(targetShapeElement);
				
				DslModeling::ModelElement sourceElement = sourceShapeElement.ModelElement;
				if(sourceElement == null) sourceElement = sourceShapeElement;
				DslModeling::ModelElement targetElement = targetShapeElement.ModelElement;
				if(targetElement == null) targetElement = targetShapeElement;
				EntityHasViewsBuilder.Connect(sourceElement, targetElement);
			}
예제 #30
0
파일: Diagram.cs 프로젝트: npenin/uss
		/// <summary>
		/// Snap toolbox selection back to regular pointer after using a custom connect action.
		/// </summary>
		private void OnConnectActionDeactivated(object sender, DslDiagrams::DiagramEventArgs e)
		{
			OnMouseActionDeactivated();
		}