/// <summary>
        /// Checks if a reference can be added to the project. 
        /// It calls base to see if the reference is not already there,
        /// and that it is not circular reference.
        /// If the target project is a a Python Project we can not add the project reference 
        /// because this scenario is not supported.
        /// </summary>
        /// <param name="errorHandler">The error handler delegate to return</param>
        /// <returns>false if reference cannot be added, otherwise true</returns>
        protected override bool CanAddReference(out CannotAddReferenceErrorMessage errorHandler)
        {
            //If the target project is a Python Project then show an error message
            string referencedProjectType = GetProjectType(this.ReferencedProjectGuid);
            if (string.Compare(this.ProjectMgr.ProjectType, referencedProjectType, StringComparison.OrdinalIgnoreCase) == 0)
            {
                errorHandler = new CannotAddReferenceErrorMessage(ShowProjectReferenceErrorMessage);
                return false;
            }

            //If source project has designer files of subtype form and if the target output (assembly) does not exists
            //show a dialog that tells the user to build the target project before the project reference can be added
            if (!File.Exists(this.ReferencedProjectOutputPath) && HasFormItems())
            {
                errorHandler = new CannotAddReferenceErrorMessage(ShowProjectReferenceErrorMessage2);
                return false;
            }

            //finally we must evaluate the the rules applied on the base class
            if (!base.CanAddReference(out errorHandler))
            {
                return false;
            }

            return true;
        }
Example #2
0
        /// <summary>
        /// Validates that a reference can be added.
        /// </summary>
        /// <param name="errorHandler">A CannotAddReferenceErrorMessage delegate to show the error message.</param>
        /// <returns>true if the reference can be added.</returns>
        protected virtual bool CanAddReference(out CannotAddReferenceErrorMessage errorHandler)
        {
            // When this method is called this refererence has not yet been added to the hierarchy, only instantiated.
            errorHandler = null;
            ReferenceNode existingNode;

            if (this.IsAlreadyAdded(out existingNode))
            {
                errorHandler = new CannotAddReferenceErrorMessage(ShowReferenceAlreadyExistMessage);
                return(false);
            }

            return(true);
        }
        // =========================================================================================
        // Methods
        // =========================================================================================

        /// <summary>
        /// Validates that a reference can be added.
        /// </summary>
        /// <param name="errorHandler">A CannotAddReferenceErrorMessage delegate to show the error message.</param>
        /// <returns>true if the reference can be added.</returns>
        protected override bool CanAddReference(out CannotAddReferenceErrorMessage errorHandler)
        {
            if (!base.CanAddReference(out errorHandler))
            {
                return(false);
            }

            errorHandler = null;
            if (!WixReferenceValidator.IsValidWixExtension(this.Url, Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), this.ExtensionDirectory))
            {
                errorHandler = new CannotAddReferenceErrorMessage(this.ShowInvalidWixReferenceMessage);
                return(false);
            }

            return(true);
        }
        // =========================================================================================
        // Methods
        // =========================================================================================

        /// <summary>
        /// Validates that a reference can be added.
        /// </summary>
        /// <param name="errorHandler">A CannotAddReferenceErrorMessage delegate to show the error message.</param>
        /// <returns>true if the reference can be added.</returns>
        protected override bool CanAddReference(out CannotAddReferenceErrorMessage errorHandler)
        {
            if (!base.CanAddReference(out errorHandler))
            {
                return(false);
            }

            errorHandler = null;
            if (!WixReferenceValidator.IsValidWixLibrary(this.Url))
            {
                errorHandler = new CannotAddReferenceErrorMessage(this.ShowInvalidWixReferenceMessage);
                return(false);
            }

            return(true);
        }
        // =========================================================================================
        // Methods
        // =========================================================================================

        /// <summary>
        /// Validates that a reference can be added.
        /// </summary>
        /// <param name="errorHandler">A CannotAddReferenceErrorMessage delegate to show the error message.</param>
        /// <returns>true if the reference can be added.</returns>
        protected override bool CanAddReference(out CannotAddReferenceErrorMessage errorHandler)
        {
            if (!base.CanAddReference(out errorHandler))
            {
                return false;
            }

            errorHandler = null;
            if (!WixReferenceValidator.IsValidWixLibrary(this.Url))
            {
                errorHandler = new CannotAddReferenceErrorMessage(this.ShowInvalidWixReferenceMessage);
                return false;
            }

            return true;
        }
        /// <summary>
        /// Checks if a project reference can be added to the hierarchy. It calls base to see if the reference is not already there, then checks for circular references.
        /// </summary>
        /// <param name="errorHandler">The error handler delegate to return</param>
        /// <returns></returns>
        protected override bool CanAddReference(out CannotAddReferenceErrorMessage errorHandler)
        {
            // When this method is called this refererence has not yet been added to the hierarchy, only instantiated.
            if (!base.CanAddReference(out errorHandler))
            {
                return(false);
            }

            errorHandler = null;
            if (this.IsThisProjectReferenceInCycle())
            {
                errorHandler = new CannotAddReferenceErrorMessage(ShowCircularReferenceErrorMessage);
                return(false);
            }

            return(true);
        }
        protected override bool CanAddReference(out CannotAddReferenceErrorMessage errorHandler, out ReferenceNode existingNode)
        {
            // When this method is called this refererence has not yet been added to the hierarchy, only instantiated.
            if (!base.CanAddReference(out errorHandler, out existingNode))
            {
                return(false);
            }
            ThreadHelper.ThrowIfNotOnUIThread();

            errorHandler = null;
            if (this.IsThisProjectReferenceInCycle())
            {
                errorHandler = new CannotAddReferenceErrorMessage(ShowCircularReferenceErrorMessage);
                return(false);
            }

            return(true);
        }
Example #8
0
        /// <summary>
        /// Checks if a reference can be added to the project.
        /// It calls base to see if the reference is not already there,
        /// and that it is not circular reference.
        /// If the target project is a a Python Project we can not add the project reference
        /// because this scenario is not supported.
        /// </summary>
        /// <param name="errorHandler">The error handler delegate to return</param>
        /// <returns>false if reference cannot be added, otherwise true</returns>
        ///

        protected override bool CanAddReference(out CannotAddReferenceErrorMessage errorHandler, out ReferenceNode existingNode)
        {
            existingNode = null;

            //If source project has designer files of subtype form and if the target output (assembly) does not exists
            //show a dialog that tells the user to build the target project before the project reference can be added
            if (!File.Exists(this.ReferencedProjectOutputPath) && HasFormItems())
            {
                errorHandler = new CannotAddReferenceErrorMessage(ShowProjectReferenceErrorMessage2);
                return(false);
            }

            //finally we must evaluate the the rules applied on the base class
            if (!base.CanAddReference(out errorHandler, out existingNode))
            {
                return(false);
            }

            return(true);
        }
        /// <summary>
        /// Links a reference node to the project and hierarchy.
        /// </summary>
        public override void AddReference()
        {
            if (this.ProjectMgr == null)
            {
                return;
            }

            VerifyMacroAssembly();

            ReferenceContainerNode referencesFolder = (ReferenceContainerNode)((NemerleProjectNode)this.ProjectMgr).GetMacroReferenceContainer();

            Debug.Assert(referencesFolder != null, "Could not find the References node");

            CannotAddReferenceErrorMessage referenceErrorMessageHandler = null;

            if (!this.CanAddReference(out referenceErrorMessageHandler))
            {
                if (referenceErrorMessageHandler != null)
                {
                    referenceErrorMessageHandler.DynamicInvoke(new object[] { });
                }

                return;
            }

            // Link the node to the project file.
            this.BindReferenceData();

            // At this point force the item to be refreshed
            this.ItemNode.RefreshProperties();

            referencesFolder.AddChild(this);

            this.ProjectMgr.AddBuildDependency(this.buildDependency);

            return;
        }
        /// <summary>
        /// Checks if a project reference can be added to the hierarchy. It calls base to see if the reference is not already there, then checks for circular references.
        /// </summary>
        /// <param name="errorHandler">The error handler delegate to return</param>
        /// <returns></returns>
        protected override bool CanAddReference(out CannotAddReferenceErrorMessage errorHandler)
        {
            // When this method is called this refererence has not yet been added to the hierarchy, only instantiated.
            if(!base.CanAddReference(out errorHandler))
            {
                return false;
            }

            errorHandler = null;
            if(this.IsThisProjectReferenceInCycle())
            {
                errorHandler = new CannotAddReferenceErrorMessage(ShowCircularReferenceErrorMessage);
                return false;
            }

            return true;
        }
Example #11
0
        /// <summary>
        /// Validates that a reference can be added.
        /// </summary>
        /// <param name="errorHandler">A CannotAddReferenceErrorMessage delegate to show the error message.</param>
        /// <returns>true if the reference can be added.</returns>
        protected virtual bool CanAddReference(out CannotAddReferenceErrorMessage errorHandler)
        {
            // When this method is called this refererence has not yet been added to the hierarchy, only instantiated.
            errorHandler = null;
            if (this.IsAlreadyAdded())
            {
                return false;
            }

            return true;
        }
Example #12
0
        // =========================================================================================
        // Methods
        // =========================================================================================
        /// <summary>
        /// Validates that a reference can be added.
        /// </summary>
        /// <param name="errorHandler">A CannotAddReferenceErrorMessage delegate to show the error message.</param>
        /// <returns>true if the reference can be added.</returns>
        protected override bool CanAddReference(out CannotAddReferenceErrorMessage errorHandler)
        {
            if (!base.CanAddReference(out errorHandler))
            {
                return false;
            }

            errorHandler = null;
            if (!WixReferenceValidator.IsValidWixExtension(this.Url, Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), this.ExtensionDirectory))
            {
                errorHandler = new CannotAddReferenceErrorMessage(this.ShowInvalidWixReferenceMessage);
                return false;
            }

            return true;
        }
Example #13
0
		/// <summary>
		/// Validates that a reference can be added.
		/// </summary>
		/// <param name="errorHandler">A CannotAddReferenceErrorMessage delegate to show the error message.</param>
		/// <returns>true if the reference can be added.</returns>
		protected virtual bool CanAddReference(out CannotAddReferenceErrorMessage errorHandler)
		{
			// When this method is called this refererence has not yet been added to the hierarchy, only instantiated.
			errorHandler = null;
			ReferenceNode existingNode;
			if (this.IsAlreadyAdded(out existingNode))
			{
				errorHandler = new CannotAddReferenceErrorMessage(ShowReferenceAlreadyExistMessage);
				return false;
			}

			return true;
		}
Example #14
0
        protected virtual bool CanAddReference(out CannotAddReferenceErrorMessage errorHandler)
        {
            ReferenceNode existingNode;

            return(CanAddReference(out errorHandler, out existingNode));
        }