コード例 #1
0
        /// <summary>
        /// Adds an add action to the change group.
        /// </summary>
        /// <param name="change">The change being processed</param>
        /// <param name="group">The change grouing this change is to be a part of</param>
        internal virtual void Branch(Change change, ChangeGroup group)
        {
            //Determine wether the source path is mapped.
            //If this isnt the case, we are going to raise a conflict for this
            //We have to perform this check for branch and rename operations.
            if (!m_provider.IsPathMapped(change.CopyFromFullServerPath))
            {
                raiseBranchParentNotFoundConflictForBranch(group, change);
                return;
            }

            //Initialize the tables that are needed for rename detection
            InitializeDeleteLookupTables(CurrentChangeset);
            InitializeRenameLookupTable(CurrentChangeset);

            if (IsRenameCase(change, group))
            {
                Rename(change, group);
            }
            else
            {
                if (change.ItemType == WellKnownContentType.VersionControlledFolder)
                {
                    ProcessFolderBranch(change, group);
                }
                else
                {
                    ProcessFileBranch(change, group);
                }
            }
        }
コード例 #2
0
        private void raiseBranchParentNotFoundConflictForBranch(ChangeGroup group, Change conflictChange)
        {
            MigrationConflict      branchParentNotFoundConflict = VCBranchParentNotFoundConflictType.CreateConflict(conflictChange.Path);
            List <MigrationAction> retActions;

            ConflictResolutionResult resolutionResult = m_provider.ConflictManager.TryResolveNewConflict(group.SourceId, branchParentNotFoundConflict, out retActions);

            if ((resolutionResult.Resolved) && (resolutionResult.ResolutionType == ConflictResolutionType.UpdatedConflictedChangeAction))
            {
                InitializeDeleteLookupTables(CurrentChangeset);
                if (conflictChange.ItemType == WellKnownContentType.VersionControlledFolder)
                {
                    resolveParentNotFoundConflictForFolder(group, conflictChange);
                }
                else if (conflictChange.ItemType == WellKnownContentType.VersionControlledFile)
                {
                    resolveParentNotFoundConflictForFile(group, conflictChange);
                }
                else
                {
                    var message = string.Format(SubversionVCAdapterResource.ChangeTypeNotFoundExceptionMessage, conflictChange.ItemType);
                    Debug.Fail(message);
                    throw new NotSupportedException(message);
                }
            }
            else
            {
                throw new MigrationUnresolvedConflictException(branchParentNotFoundConflict);
            }
        }
コード例 #3
0
        /// <summary>
        /// This method is used to analyze wether there is a delete action on a parent item. If there is a delete on a parent item we have to remap it
        /// so that we pend the proper delete operation on this item. Therefore we have to inject a proper delete action for the mapping level rather than
        /// on the original and highest level
        /// </summary>
        /// <param name="mapping">The URI to the mapped item that is the child of the actual real change</param>
        /// <param name="change">The change being processed</param>
        /// <param name="group">The change grouing this change is to be a part of</param>
        private void analyzeNotMappedDeleteOperations(Uri mapping, Change change, ChangeGroup changeGroup)
        {
            //we have to construct a fake change in order to pend it properly
            var fakeChange = new Change(change.Changeset, mapping.AbsolutePath, null, -1, change.ItemType, change.ChangeAction);

            createMigrationAction(fakeChange, null, changeGroup, WellKnownChangeActionId.Delete);
        }
コード例 #4
0
        private void AddCSSNodeChanges(ChangeGroup group)
        {
            m_hwmCSSMaxSeqId.Reload();
            int startSeqId = m_hwmCSSMaxSeqId.Value > 0 ? m_hwmCSSMaxSeqId.Value : 0;

            CSSAdapter cssAdapter = new CSSAdapter(m_migrationSource.WorkItemStore.Core.Css, m_configurationService.SourceId);

            Project     p = m_migrationSource.WorkItemStore.WorkItemStore.Projects[m_migrationSource.WorkItemStore.Core.Config.Project];
            int         maxSeqId;
            XmlDocument changes = cssAdapter.GetTeamProjectSpecificCSSNodeChanges(p, startSeqId, out maxSeqId);

            if (null != changes)
            {
                group.CreateAction(
                    WellKnownChangeActionId.SyncContext,
                    new WorkItemContextSyncMigrationItem(s_CssNodeChangesContentType),
                    s_CssNodeChangesContentType.FriendlyName,
                    "",
                    "0",
                    "",
                    s_CssNodeChangesContentType.ReferenceName,
                    changes);
            }

            if (maxSeqId > startSeqId)
            {
                m_hwmCSSMaxSeqId.Update(maxSeqId);
            }
        }
コード例 #5
0
        internal string GetChangeComment(ChangeGroup group)
        {
            string migrationComment = m_commentDecorationService.GetChangeGroupCommentSuffix(group.Name);

            // ToDo, embed conflict resolution into comment

            /*
             * string resolutionDesc = string.Empty;
             * StringBuilder resolutionDescSB = new StringBuilder();
             * resolutionDescSB.Append("Applied conflict resolution rules: ");
             * string resolutionDescFormat = "{0}; ";
             * List<ConflictResolutionRule> rulesAppliedOnGroup;
             * if (m_conflictManagementService.TryGetResolutionRulesAppliedToGroup(group, out rulesAppliedOnGroup))
             * {
             *  foreach (ConflictResolutionRule rule in rulesAppliedOnGroup)
             *  {
             *      resolutionDescSB.AppendFormat(resolutionDescFormat, rule.RuleReferenceName);
             *  }
             *  resolutionDesc = resolutionDescSB.ToString();
             * }
             * migrationComment = m_commentDecorationService.AddToChangeGroupCommentSuffix(migrationComment, resolutionDesc);
             * */

            return(group.Comment + " " + migrationComment);
        }
コード例 #6
0
        public override ConversionResult ProcessChangeGroup(ChangeGroup changeGroup)
        {
            TraceManager.TraceInformation("POC:MP:ProcessChangeGroup - {0}", changeGroup.Name);

            ConversionResult convResult         = null;
            Guid             targetSideSourceId = m_configurationService.SourceId;
            Guid             sourceSideSourceId = m_configurationService.MigrationPeer;

            convResult = new ConversionResult(sourceSideSourceId, targetSideSourceId);

            foreach (MigrationAction action in changeGroup.Actions)
            {
                TraceManager.TraceInformation("     > {0} - {1}", action.Path, action.SourceItem.GetType().ToString());
                if (action.Action == WellKnownChangeActionId.Add && action.ItemTypeReferenceName == WellKnownContentType.VersionControlledFile.ReferenceName)
                {
                    // action.SourceItem.Download(action.Path);
                    pocUtil.AddFile(action.Path);
                }
                else if (action.Action == WellKnownChangeActionId.Add && action.ItemTypeReferenceName == WellKnownContentType.VersionControlledFolder.ReferenceName)
                {
                    //  action.SourceItem.Download(action.Path);
                    pocUtil.CreateFolder(action.Path);
                }
            }
            convResult.ChangeId = changeGroup.ReflectedChangeGroupId.ToString(); // we do not have a unique id on this side yet ... hijacking the other side's ID
            convResult.ItemConversionHistory.Add(new ItemConversionHistory(changeGroup.Name, string.Empty, convResult.ChangeId, string.Empty));
            return(convResult);
        }
コード例 #7
0
        /// <summary>
        /// Generate the ChangeGroups to "force sync" the latest contents of a set of work items
        /// </summary>
        /// <param name="workItemIdsToForceSync">List of work item Ids to force sync</param>
        public void GenerateDeltaForForceSync(IEnumerable <string> workItemIdsToForceSync)
        {
            IEnumerable <TfsMigrationWorkItem> itemsToForcSync = m_migrationSource.WorkItemStore.GetItems(workItemIdsToForceSync);

            var changeGroups = new List <ChangeGroup>();

            foreach (TfsMigrationWorkItem itemToForceSync in itemsToForcSync)
            {
                TraceManager.TraceVerbose(string.Format("Start generating field information to force sync Work Item #{0}", itemToForceSync.WorkItem.Id));

                // Get a change group with all of the latest field values (except computed fields) and set ChangeGroup.IsForcedSync
                ChangeGroup changeGroup = itemToForceSync.GetChangeGroupForLatestFieldValues(m_changeGroupService);
                if (changeGroup != null)
                {
                    changeGroup.IsForcedSync = true;
                    changeGroups.Add(changeGroup);
                }

                // Get a change group to add all of the current attachments and set ChangeGroup.IsForcedSync
                changeGroup = itemToForceSync.GetChangeGroupForLatestAttachments(m_changeGroupService);
                if (changeGroup != null)
                {
                    changeGroup.IsForcedSync = true;
                    changeGroups.Add(changeGroup);
                }

                // persist change groups to DB
                SaveDeltaEntries(changeGroups);
                changeGroups.Clear();
            }
        }
コード例 #8
0
        protected override void OnMouseUp(object sender, MouseButtonEventArgs e)
        {
            if (hasDragStarted)
            {
                if (operation != null)
                {
                    operation.Commit();
                    operation = null;
                }
            }
            else
            {
                CreateComponentTool.AddItemWithDefaultSize(container, createdItem, e.GetPosition(positionRelativeTo));
            }
            if (changeGroup != null)
            {
                changeGroup.Commit();
                changeGroup = null;
            }

            if (designPanel.Context.Services.Component is XamlComponentService)
            {
                ((XamlComponentService)designPanel.Context.Services.Component).RaiseComponentRegisteredAndAddedToContainer(createdItem);
            }

            base.OnMouseUp(sender, e);
        }
コード例 #9
0
 /// <summary>
 /// The main entry for all changes that are not mapped
 /// </summary>
 /// <param name="change">The change that needs to be analyzed</param>
 /// <param name="changeGroup">The changegroup that stores the analysis result</param>
 internal void ExecuteNonMapped(Change change, ChangeGroup changeGroup, int[] mappedChanges)
 {
     //Check wether the action is a folder and a recusrive action. Recursive actions are branch and delete
     //We have to check wether the mapped change is a child of the recursive action because in that case we would be affected of this change too
     if ((change.ChangeAction == ChangeAction.Copy || change.ChangeAction == ChangeAction.Delete || change.ChangeAction == ChangeAction.Add) &&
         change.ItemType == WellKnownContentType.VersionControlledFolder)
     {
         //now we have to check wether the current mapping is a child of the action.
         //In this case we have to execute the action because it recursively affects us
         foreach (var mapping in m_provider.ConfigurationManager.MappedServerPaths)
         {
             if (PathUtils.IsChildItem(change.FullServerPath, mapping))
             {
                 if (change.ChangeAction == ChangeAction.Copy)
                 {
                     analyzeNotMappedBranchOperations(mapping, change, changeGroup, mappedChanges);
                 }
                 else if (change.ChangeAction == ChangeAction.Delete)
                 {
                     analyzeNotMappedDeleteOperations(mapping, change, changeGroup);
                 }
                 else if (change.ChangeAction == ChangeAction.Add)
                 {
                     analyzeNotMappedAddOperations(mapping, change, changeGroup);
                 }
             }
         }
     }
 }
コード例 #10
0
        /// <summary>
        /// Adds an rename action to the change group.
        /// </summary>
        /// <param name="change">The change being processed</param>
        /// <param name="group">The change grouing this change is to be a part of</param>
        private void Rename(Change change, ChangeGroup group)
        {
            var parent = PathUtils.GetParent(change.CopyFromFullServerPath);
            var item   = PathUtils.GetItemName(change.CopyFromFullServerPath);

            var intermediate = reviseSourceName(change.Changeset.Repository, parent);
            var revisedPath  = PathUtils.Combine(intermediate, item);

            //we crate the rename action
            group.CreateAction(WellKnownChangeActionId.Rename,
                               new SubversionMigrationItem(change),
                               change.CopyFromPath,
                               change.Path,
                               change.CopyFromRevision.ToString(),
                               null,
                               change.ItemType.ReferenceName,
                               null);

            //and then we are going to remove the delete record from the lookup table.
            //The lookup table will be flushed later and therefore this delete operation will be skipped
            if (m_deleteLookupTable.ContainsKey(revisedPath))
            {
                m_deleteLookupTable.Remove(revisedPath);
            }
            else
            {
                Debug.Fail("Trying to remove a key from the deletelookup table. This case should never occur");
            }

            //we have to check wether the file has been modified. If this is the case we have to pend an aditional edit
            if (HasContentChanges(change))
            {
                createMigrationAction(change, change.Path, group, WellKnownChangeActionId.Edit);
            }
        }
コード例 #11
0
        /// <summary>
        /// This method analyzes wether a branch is a simple branch or actually a rename case
        /// In subversion, every rename operation is a combination of branch / delete
        /// </summary>
        /// <param name="change">The change being processed</param>
        /// <param name="changeGroup">The change grouing this change is to be a part of</param>
        /// <returns>true if it is a rename case; false otherwise</returns>
        private bool IsRenameCase(Change change, ChangeGroup changeGroup)
        {
            //Root cannot be a rename case. Therefore we could skip that
            if (PathUtils.AreEqual(new Uri(change.Changeset.Repository), new Uri(change.CopyFromFullServerPath)))
            {
                return(false);
            }

            //we have to revise the parent path of this item only.
            //We do not have to do that for the item name itself because the item name remains stable in the copy from field
            var parent = PathUtils.GetParent(change.CopyFromFullServerPath);
            var item   = PathUtils.GetItemName(change.CopyFromFullServerPath);

            var intermediate = reviseSourceName(change.Changeset.Repository, parent);
            var revisedPath  = PathUtils.Combine(intermediate, item);

            //we check wether there is a delete record corosponding to this branch.
            //If this is the case we have to check the start revision.
            //It is a rename if we branched from the previous revision
            if (m_deleteLookupTable.ContainsKey(revisedPath))
            {
                // Todo Don't need the revision check
                return(true);

                /*if (change.CopyFromRevision == change.Revision - 1)
                 * {
                 *  return true;
                 * }*/
            }

            return(false);
        }
コード例 #12
0
 public CreateComponentMouseGesture(DesignItem clickedOn, DesignItem createdItem, ChangeGroup changeGroup)
 {
     this.container          = clickedOn;
     this.createdItem        = createdItem;
     this.positionRelativeTo = clickedOn.View;
     this.changeGroup        = changeGroup;
 }
コード例 #13
0
        private void AddGlobalList(ChangeGroup group)
        {
            Project p = m_migrationSource.WorkItemStore.WorkItemStore.Projects[m_migrationSource.WorkItemStore.Core.Config.Project];
            //TODO: support "Ignored Lists"
            XmlDocument globalListDoc = m_migrationSource.WorkItemStore.GetGlobalList(p, new List <string>().AsReadOnly());

            if (null == globalListDoc)
            {
                return;
            }

            byte[] newDocHash  = new byte[0];
            bool   hashMatched = m_md5Utility.CompareDocHash(globalListDoc, m_globalListDocMD5, ref newDocHash);

            if (!hashMatched)
            {
                group.CreateAction(
                    WellKnownChangeActionId.SyncContext,
                    new WorkItemContextSyncMigrationItem(WellKnownContentType.ValueListCollection),
                    WellKnownContentType.ValueListCollection.FriendlyName,
                    "",
                    "0",
                    "",
                    WellKnownContentType.ValueListCollection.ReferenceName,
                    globalListDoc);
                m_md5Utility.UpdateDocHash(ref m_globalListDocMD5, newDocHash);
            }
        }
コード例 #14
0
            protected override void OnMouseDoubleClick(object sender, MouseButtonEventArgs e)
            {
                base.OnMouseDoubleClick(sender, e);

                if (newLine.View is Polyline)
                {
                    ((Polyline)newLine.View).Points.RemoveAt(((Polyline)newLine.View).Points.Count - 1);
                    newLine.Properties[Polyline.PointsProperty]
                    .SetValue(string.Join(",", ((Polyline)newLine.View).Points));
                }
                else
                {
                    ((Polygon)newLine.View).Points.RemoveAt(((Polygon)newLine.View).Points.Count - 1);
                    newLine.Properties[Polygon.PointsProperty]
                    .SetValue(string.Join(",", ((Polygon)newLine.View).Points));
                }

                if (changeGroup != null)
                {
                    changeGroup.Commit();
                    changeGroup = null;
                }

                Stop();
            }
コード例 #15
0
        void OnMouseDown(object sender, MouseButtonEventArgs e)
        {
            if (e.ChangedButton == MouseButton.Left && MouseGestureBase.IsOnlyButtonPressed(e, MouseButton.Left))
            {
                e.Handled = true;
                IDesignPanel             designPanel = (IDesignPanel)sender;
                DesignPanelHitTestResult result      = designPanel.HitTest(e.GetPosition(designPanel), false, true, HitTestType.Default);
                if (result.ModelHit != null)
                {
                    var darwItemBehaviors = result.ModelHit.Extensions.OfType <IDrawItemExtension>();
                    var drawItembehavior  = darwItemBehaviors.FirstOrDefault(x => x.CanItemBeDrawn(componentType));
                    if (drawItembehavior != null && drawItembehavior.CanItemBeDrawn(componentType))
                    {
                        drawItembehavior.StartDrawItem(result.ModelHit, componentType, designPanel, e, SetPropertiesForDrawnItem);
                    }
                    else
                    {
                        var placementBehavior = result.ModelHit.GetBehavior <IPlacementBehavior>();
                        if (placementBehavior != null)
                        {
                            var createdItem = CreateItem(designPanel.Context);

                            new CreateComponentMouseGesture(result.ModelHit, createdItem, changeGroup).Start(designPanel, e);
                            // CreateComponentMouseGesture now is responsible for the changeGroup created by CreateItem()
                            changeGroup = null;
                        }
                    }
                }
            }
        }
コード例 #16
0
        // TODO : Remove all hide/show extensions from here.
        void drag_Started(DragListener drag)
        {
            var designPanel = ExtendedItem.Services.DesignPanel as DesignPanel;

            if (designPanel != null)
            {
                var p = VisualTreeHelper.GetParent(designPanel);
                while (p != null && !(p is ZoomControl))
                {
                    p = VisualTreeHelper.GetParent(p);
                }
                zoom = p as ZoomControl;
            }

            /* Abort editing Text if it was editing, because it interferes with the undo stack. */
            foreach (var extension in this.ExtendedItem.Extensions)
            {
                if (extension is InPlaceEditorExtension)
                {
                    ((InPlaceEditorExtension)extension).AbortEdit();
                }
            }

            oldSize = new Size(ModelTools.GetWidth(ExtendedItem.View), ModelTools.GetHeight(ExtendedItem.View));
            if (resizeBehavior != null)
            {
                operation = PlacementOperation.Start(extendedItemArray, PlacementType.Resize);
            }
            else
            {
                changeGroup = this.ExtendedItem.Context.OpenGroup("Resize", extendedItemArray);
            }
            _isResizing = true;
            ShowSizeAndHideHandles();
        }
コード例 #17
0
 public VCContentConflict(ConflictType conflictType, ChangeGroup changeGroup, string conflictDetails, string actionPath)
     : base(conflictType,
            Status.Unresolved,
            conflictDetails,
            string.Format("{0};{1}", actionPath, changeGroup.Name))
 {
 }
コード例 #18
0
        // TODO : Remove all hide/show extensions from here.
        void drag_Started(DragListener drag)
        {
            /* Abort editing Text if it was editing, because it interferes with the undo stack. */
            foreach (var extension in this.ExtendedItem.Extensions)
            {
                if (extension is InPlaceEditorExtension)
                {
                    ((InPlaceEditorExtension)extension).AbortEdit();
                }
            }

            drag.Transform = this.ExtendedItem.GetCompleteAppliedTransformationToView();

            oldSize = new Size(ModelTools.GetWidth(ExtendedItem.View), ModelTools.GetHeight(ExtendedItem.View));
            if (resizeBehavior != null)
            {
                operation = PlacementOperation.Start(extendedItemArray, PlacementType.Resize);
            }
            else
            {
                changeGroup = this.ExtendedItem.Context.OpenGroup("Resize", extendedItemArray);
            }
            _isResizing = true;
            ShowSizeAndHideHandles();
        }
コード例 #19
0
        public override void BasicActionHandler(MigrationAction action, ChangeGroup group)
        {
            try
            {
                VersionControlPath.GetFullPath(action.Path, true);
                if (!string.IsNullOrEmpty(action.FromPath))
                {
                    VersionControlPath.GetFullPath(action.FromPath, true);
                }
            }
            catch (Exception e)
            {
                MigrationConflict pathTooLongConflict = VCInvalidPathConflictType.CreateConflict(action, e.Message, action.Path);

                List <MigrationAction>   returnActions;
                ConflictResolutionResult resolutionResult = ((TfsVCAnalysisProvider)AnalysisProvider).ConflictManager.TryResolveNewConflict(
                    group.SourceId, pathTooLongConflict, out returnActions);
                if (resolutionResult.Resolved)
                {
                    switch (resolutionResult.ResolutionType)
                    {
                    case ConflictResolutionType.SkipConflictedChangeAction:
                        return;

                    default:
                        Debug.Fail("Unknown resolution result");
                        return;
                    }
                }
                return;
            }
            base.BasicActionHandler(action, group);
        }
コード例 #20
0
        /// <summary>
        /// Is called to create the item used by the CreateComponentTool.
        /// </summary>
        protected virtual DesignItem CreateItem(DesignContext context)
        {
            ChangeGroup = context.RootItem.OpenGroup("Add Control");
            var item = CreateItem(context, componentType);

            return(item);
        }
コード例 #21
0
 private void ColorEditorPopup_Closed(object sender, EventArgs e)
 {
     if (_changeGroup != null) {
         _changeGroup.Commit();
         _changeGroup = null;
     }
 }
コード例 #22
0
 void drag_Completed(DragListener drag)
 {
     if (operation != null)
     {
         if (drag.IsCanceled)
         {
             operation.Abort();
         }
         else
         {
             operation.Commit();
         }
         operation = null;
     }
     else
     {
         if (drag.IsCanceled)
         {
             changeGroup.Abort();
         }
         else
         {
             changeGroup.Commit();
         }
         changeGroup = null;
     }
     _isResizing = false;
     HideSizeAndShowHandles();
 }
コード例 #23
0
        public void UndoRedoChangeGroupTest()
        {
            DesignItem  button = CreateCanvasContext("<Button/>");
            UndoService s      = button.Context.Services.GetService <UndoService>();

            Assert.IsFalse(s.CanUndo);
            Assert.IsFalse(s.CanRedo);
            using (ChangeGroup g = button.OpenGroup("Resize")) {
                button.Properties["Width"].SetValue(100.0);
                button.Properties["Height"].SetValue(200.0);
                g.Commit();
            }
            Assert.IsTrue(s.CanUndo);
            Assert.IsFalse(s.CanRedo);
            AssertCanvasDesignerOutput(@"<Button Width=""100"" Height=""200"" />", button.Context);
            s.Undo();
            Assert.IsFalse(s.CanUndo);
            Assert.IsTrue(s.CanRedo);
            AssertCanvasDesignerOutput(@"<Button />", button.Context);
            s.Redo();
            Assert.IsTrue(s.CanUndo);
            Assert.IsFalse(s.CanRedo);
            AssertCanvasDesignerOutput(@"<Button Width=""100"" Height=""200"" />", button.Context);
            AssertLog("");
        }
コード例 #24
0
        private void resolveParentNotFoundConflictForFolder(ChangeGroup group, Change change)
        {
            //We have to query the list of all files based on the branch source.
            //Subversion only pends one recursive branch action rather than a action for all files
            //Therefore we have to resolve this list manually
            var items = CurrentRepository.GetItems(change.FullServerPath, change.Changeset.Revision, true);

            //pend an action for every single item
            //We do not have to handle the root folder individually since it is one item in the collection already
            foreach (var sourceItem in items)
            {
                var migrationItem = new SubversionMigrationItem(sourceItem, change.Changeset.Revision);

                group.CreateAction(WellKnownChangeActionId.Add,
                                   migrationItem,
                                   null,
                                   sourceItem.Path,
                                   null,
                                   null,
                                   sourceItem.ItemType.ReferenceName,
                                   null);

                //There might be subsequent delete operations that could be pending due to rename or move operations.
                //Therefore we have to check the delete table for every single file and folder and drop it if needed
                DropNotNeededDeleteActions(sourceItem.FullServerPath);
            }
        }
コード例 #25
0
        private void createAddActionForSnapshot(ChangeGroup snapshotGroup, string localPath, bool isDirectory)
        {
            string    serverPath = m_clearCaseServer.GetServerPathFromViewLocalPath(localPath);
            CCElement element    = null;

            try
            {
                element = m_clearCaseServer.ApplicationClass.get_Element(serverPath);
            }
            catch (ArgumentException)
            {
                TraceManager.TraceWarning(String.Format("Unable to get ClearCase Element corresponding to local path: '{0}'", localPath));
                return;
            }
            snapshotGroup.CreateAction(
                WellKnownChangeActionId.Add,
                new ClearCaseMigrationItem(
                    m_clearCaseServer.ViewName,
                    element.Version.ExtendedPath,
                    isDirectory),
                null,
                serverPath,
                null,
                null,
                isDirectory ? WellKnownContentType.VersionControlledFolder.ReferenceName : WellKnownContentType.VersionControlledFile.ReferenceName,
                null);
        }
コード例 #26
0
 /// <summary>
 /// Adds an edit action to the change group.
 /// </summary>
 /// <param name="change">The change being processed</param>
 /// <param name="group">The change grouing this change is to be a part of</param>
 internal virtual void Edit(Change change, ChangeGroup group)
 {
     //Subversion reports edit on folders as well if any property changed. Therfore we can skip this
     if (change.ItemType != WellKnownContentType.VersionControlledFolder)
     {
         createMigrationAction(change, null, group, WellKnownChangeActionId.Edit);
     }
 }
コード例 #27
0
		DesignItem CreateItem(DesignContext context, Type componentType)
		{
			object newInstance = context.Services.ExtensionManager.CreateInstanceWithCustomInstanceFactory(componentType, null);
			DesignItem item = context.Services.Component.RegisterComponentForDesigner(newInstance);
			changeGroup = item.OpenGroup("Draw Polyline");
			context.Services.ExtensionManager.ApplyDefaultInitializers(item);
			return item;
		}
コード例 #28
0
        private void resolveParentNotFoundConflictForFile(ChangeGroup group, Change conflictChange)
        {
            createMigrationAction(conflictChange, conflictChange.Path, group, WellKnownChangeActionId.Add);

            //There might be subsequent delete operations that could be pending due to rename or move operations.
            //Therefore we have to check the delete table for every single file and folder and drop it if needed
            DropNotNeededDeleteActions(conflictChange.FullServerPath);
        }
コード例 #29
0
            public DrawPolylineMouseGesture(DesignItem newLine, IInputElement relativeTo, ChangeGroup changeGroup)
            {
                this.newLine            = newLine;
                this.positionRelativeTo = relativeTo;
                this.changeGroup        = changeGroup;

                startPoint = Mouse.GetPosition(null);
            }
 /// <summary>
 /// Populates the changegroup with the needed meta data like author, comments and so on
 /// </summary>
 /// <param name="group">The changegroup that has to be populated</param>
 /// <param name="logRecord">The logRecord of subversion</param>
 private static void populateChangeGroupMetaData(ChangeGroup group, ChangeSet changeSet)
 {
     group.Owner          = changeSet.Author;
     group.Comment        = changeSet.Comment;
     group.ChangeTimeUtc  = changeSet.CommitTime.ToUniversalTime();
     group.Status         = ChangeStatus.Delta;
     group.ExecutionOrder = changeSet.Revision;
 }
コード例 #31
0
 private static void populateChangeGroupMetaData(ChangeGroup group, Changeset changeset)
 {
     group.Owner          = changeset.Owner;
     group.Comment        = changeset.Comment;
     group.ChangeTimeUtc  = changeset.CreationDate.ToUniversalTime();
     group.Status         = ChangeStatus.Delta;
     group.ExecutionOrder = changeset.ChangesetId;
 }
コード例 #32
0
        protected override void OnMouseUp(MouseButtonEventArgs e)
        {
            var pnode = this.DataContext as PropertyNode;
            var colorEditorPopup = new ColorEditorPopup();
            colorEditorPopup.PlacementTarget = this;
            colorEditorPopup.IsOpen = true;
            colorEditorPopup.solidBrushEditor.Color = (Color)pnode.Value;
            colorEditorPopup.Closed += ColorEditorPopup_Closed;
            DependencyPropertyDescriptor.FromProperty(SolidBrushEditor.ColorProperty, typeof(SolidBrushEditor))
                .AddValueChanged(colorEditorPopup.solidBrushEditor,
                (s, ee) => {
                    if (_changeGroup == null) {
                        _changeGroup = pnode.Context.OpenGroup("change color",
                                               pnode.Properties.Select(p => p.DesignItem).ToArray());

                    }
                    pnode.Value = colorEditorPopup.solidBrushEditor.Color;
                });
        }
コード例 #33
0
			public DrawLineMouseGesture(LineHandlerExtension l, IInputElement relativeTo, ChangeGroup changeGroup)
			{
				this.l = l;
				this.positionRelativeTo = relativeTo;
				this.changeGroup = changeGroup;
			}
コード例 #34
0
		protected override void OnDragStarted()
		{
			group = PropertyNode.Context.OpenGroup("drag number", 
				PropertyNode.Properties.Select(p => p.DesignItem).ToArray());
		}
コード例 #35
0
		protected override void OnStopped()
		{
			if (operation != null) {
				operation.Abort();
				operation = null;
			}
			if (changeGroup != null) {
				changeGroup.Abort();
				changeGroup = null;
			}
			if (services.Tool.CurrentTool is CreateComponentTool) {
				services.Tool.CurrentTool = services.Tool.PointerTool;
			}
			base.OnStopped();
		}
コード例 #36
0
			protected override void OnMouseDoubleClick(object sender, MouseButtonEventArgs e)
			{
				base.OnMouseDoubleClick(sender, e);
				
				if (newLine.View is Polyline) {
					((Polyline)newLine.View).Points.RemoveAt(((Polyline)newLine.View).Points.Count - 1);
					newLine.Properties[Polyline.PointsProperty].SetValue(string.Join(",", ((Polyline)newLine.View).Points));
				} else {
					((Polygon)newLine.View).Points.RemoveAt(((Polygon)newLine.View).Points.Count - 1);
					newLine.Properties[Polygon.PointsProperty].SetValue(string.Join(",", ((Polygon)newLine.View).Points));
				}
				
				if (changeGroup != null)
				{
					changeGroup.Commit();
					changeGroup = null;
				}
				
				Stop();
			}
コード例 #37
0
ファイル: InPlaceEditor.cs プロジェクト: fanyjie/SharpDevelop
		/// <summary>
		/// Change is committed if the user releases the Escape Key.
		/// </summary>
		/// <param name="e"></param>
		protected override void OnKeyUp(KeyEventArgs e)
		{
			base.OnKeyUp(e);
			if(e.KeyboardDevice.Modifiers != ModifierKeys.Shift) {
				switch(e.Key) {						
					case Key.Enter:
						// Commit the changes to DOM.
						if(property!=null)
							designItem.Properties[property].SetValue(Bind);
						if(designItem.Properties[Control.FontFamilyProperty].ValueOnInstance!=editor.FontFamily)
							designItem.Properties[Control.FontFamilyProperty].SetValue(editor.FontFamily);
						if((double)designItem.Properties[Control.FontSizeProperty].ValueOnInstance!=editor.FontSize)
							designItem.Properties[Control.FontSizeProperty].SetValue(editor.FontSize);
						if((FontStretch)designItem.Properties[Control.FontStretchProperty].ValueOnInstance!=editor.FontStretch)
							designItem.Properties[Control.FontStretchProperty].SetValue(editor.FontStretch);
						if((FontStyle)designItem.Properties[Control.FontStyleProperty].ValueOnInstance!=editor.FontStyle)
							designItem.Properties[Control.FontStyleProperty].SetValue(editor.FontStyle);
						if((FontWeight)designItem.Properties[Control.FontWeightProperty].ValueOnInstance!=editor.FontWeight)
							designItem.Properties[Control.FontWeightProperty].SetValue(editor.FontWeight);
						
						if (changeGroup != null && _isChangeGroupOpen){
							changeGroup.Commit();
							_isChangeGroupOpen=false;
						}
						changeGroup = null;
						this.Visibility = Visibility.Hidden;
						textBlock.Visibility = Visibility.Visible;
						break;
					case Key.Escape:
						AbortEditing();
						break;
				}
			}else if(e.Key == Key.Enter){
				editor.Text.Insert(editor.CaretIndex, Environment.NewLine);
			}
		}
コード例 #38
0
			protected override void OnMouseDoubleClick(object sender, MouseButtonEventArgs e)
			{
				base.OnMouseDoubleClick(sender, e);
				
				figure.Segments.RemoveAt(figure.Segments.Count - 1);
				geometry.Properties[PathGeometry.FiguresProperty].SetValue(figure.ToString());
				
				if (changeGroup != null) {
					changeGroup.Commit();
					changeGroup = null;
				}
				
				Stop();
			}
コード例 #39
0
		// TODO : Remove all hide/show extensions from here.
		void drag_Started(DragListener drag)
		{
			var designPanel = ExtendedItem.Services.DesignPanel as DesignPanel;
			if (designPanel != null)
			{
				var p = VisualTreeHelper.GetParent(designPanel);
				while (p != null && !(p is ZoomControl))
				{
					p = VisualTreeHelper.GetParent(p);
				}
				zoom = p as ZoomControl;
			}
			
			/* Abort editing Text if it was editing, because it interferes with the undo stack. */
			foreach(var extension in this.ExtendedItem.Extensions){
				if(extension is InPlaceEditorExtension){
					((InPlaceEditorExtension)extension).AbortEdit();
				}
			}
			
			oldSize = new Size(ModelTools.GetWidth(ExtendedItem.View), ModelTools.GetHeight(ExtendedItem.View));
			if (resizeBehavior != null)
				operation = PlacementOperation.Start(extendedItemArray, PlacementType.Resize);
			else {
				changeGroup = this.ExtendedItem.Context.OpenGroup("Resize", extendedItemArray);
			}
			_isResizing=true;
			ShowSizeAndHideHandles();
		}
コード例 #40
0
ファイル: GridAdorner.cs プロジェクト: fanyjie/SharpDevelop
		protected void Stop()
		{
			ReleaseMouseCapture();
			mouseIsDown = false;
			if (activeChangeGroup != null) {
				activeChangeGroup.Abort();
				activeChangeGroup = null;
			}
		}
コード例 #41
0
ファイル: GridAdorner.cs プロジェクト: fanyjie/SharpDevelop
		protected override void OnMouseMove(MouseEventArgs e)
		{
			if (mouseIsDown) {
				double mousePos = GetCoordinate(e.GetPosition(grid));
				if (activeChangeGroup == null) {
					if (Math.Abs(mousePos - mouseStartPos)
					    >= GetCoordinate(new Point(SystemParameters.MinimumHorizontalDragDistance, SystemParameters.MinimumVerticalDragDistance))) {
						activeChangeGroup = gridItem.OpenGroup("Change grid row/column size");
						RememberOriginalSize();
					}
				}
				if (activeChangeGroup != null) {
					ChangeSize(mousePos - mouseStartPos);
				}
			}
		}
コード例 #42
0
        /// <summary>
        /// Change is committed if the user releases the Escape Key.
        /// </summary>
        /// <param name="e"></param>
        protected override void OnKeyUp(KeyEventArgs e)
        {
            base.OnKeyUp(e);
            if (e.KeyboardDevice.Modifiers != ModifierKeys.Shift)
            {
                switch (e.Key)
                {
                    case Key.Enter:
                        // Commit the changes to DOM.
                        if (designItem.Properties[Control.FontFamilyProperty].ValueOnInstance != editor.FontFamily)
                            designItem.Properties[Control.FontFamilyProperty].SetValue(editor.FontFamily);
                        if ((double)designItem.Properties[Control.FontSizeProperty].ValueOnInstance != editor.FontSize)
                            designItem.Properties[Control.FontSizeProperty].SetValue(editor.FontSize);
                        if ((FontStretch)designItem.Properties[Control.FontStretchProperty].ValueOnInstance != editor.FontStretch)
                            designItem.Properties[Control.FontStretchProperty].SetValue(editor.FontStretch);
                        if ((FontStyle)designItem.Properties[Control.FontStyleProperty].ValueOnInstance != editor.FontStyle)
                            designItem.Properties[Control.FontStyleProperty].SetValue(editor.FontStyle);
                        if ((FontWeight)designItem.Properties[Control.FontWeightProperty].ValueOnInstance != editor.FontWeight)
                            designItem.Properties[Control.FontWeightProperty].SetValue(editor.FontWeight);

                        if (changeGroup != null && _isChangeGroupOpen)
                        {
                            FormatedTextEditor.SetTextBlockTextFromRichTextBlox(this.designItem, editor);
                            changeGroup.Commit();
                            _isChangeGroupOpen = false;
                        }
                        changeGroup = null;
                        this.Visibility = Visibility.Hidden;
                        this.designItem.ReapplyAllExtensions();
                        ((TextBlock)designItem.Component).Visibility = Visibility.Visible;
                        break;
                    case Key.Escape:
                        AbortEditing();
                        break;
                }
            }
            else if (e.Key == Key.Enter)
            {
                editor.Selection.Text += Environment.NewLine;
            }
        }
コード例 #43
0
 public void StartEditing()
 {
     if (changeGroup == null)
     {
         changeGroup = designItem.OpenGroup("Change Text");
         _isChangeGroupOpen = true;
     }
     this.Visibility = Visibility.Visible;
 }
コード例 #44
0
		// TODO : Remove all hide/show extensions from here.
		void drag_Started(DragListener drag)
		{
			/* Abort editing Text if it was editing, because it interferes with the undo stack. */
			foreach(var extension in this.ExtendedItem.Extensions){
				if(extension is InPlaceEditorExtension){
					((InPlaceEditorExtension)extension).AbortEdit();
				}
			}
				
			oldSize = new Size(ModelTools.GetWidth(ExtendedItem.View), ModelTools.GetHeight(ExtendedItem.View));
			if (resizeBehavior != null)
				operation = PlacementOperation.Start(extendedItemArray, PlacementType.Resize);
			else {
				changeGroup = this.ExtendedItem.Context.OpenGroup("Resize", extendedItemArray);
			}
			_isResizing=true;
			ShowSizeAndHideHandles();
		}
コード例 #45
0
 private void ColorEditorPopup_Closed(object sender, EventArgs e)
 {
     if (_changeGroup != null) {
         _changeGroup.Commit();
         _changeGroup = null;
     }
 }
コード例 #46
0
		void OnMouseDown(object sender, MouseButtonEventArgs e)
		{
			if (e.ChangedButton == MouseButton.Left && MouseGestureBase.IsOnlyButtonPressed(e, MouseButton.Left)) {
				e.Handled = true;
				IDesignPanel designPanel = (IDesignPanel)sender;
				DesignPanelHitTestResult result = designPanel.HitTest(e.GetPosition(designPanel), false, true);
				if (result.ModelHit != null) {
					IPlacementBehavior behavior = result.ModelHit.GetBehavior<IPlacementBehavior>();
					if (behavior != null) {
						DesignItem createdItem = CreateItem(designPanel.Context);
						
						new CreateComponentMouseGesture(result.ModelHit, createdItem, changeGroup).Start(designPanel, e);
						// CreateComponentMouseGesture now is responsible for the changeGroup created by CreateItem()
						changeGroup = null;
					}
				}
			}
		}
コード例 #47
0
			protected override void OnMouseUp(object sender, MouseButtonEventArgs e)
			{
				l.DragListener.ExternalStop();
				if (changeGroup != null)
				{
					changeGroup.Commit();
					changeGroup = null;
				}
				base.OnMouseUp(sender, e);
			}
コード例 #48
0
ファイル: GridAdorner.cs プロジェクト: fanyjie/SharpDevelop
		protected override void OnMouseUp(MouseButtonEventArgs e)
		{
			if (activeChangeGroup != null) {
				activeChangeGroup.Commit();
				activeChangeGroup = null;
			}
			Stop();
		}
コード例 #49
0
		/// <summary>
		/// Is called to create the item used by the CreateComponentTool.
		/// </summary>
		protected virtual DesignItem CreateItem(DesignContext context)
		{
			object newInstance = context.Services.ExtensionManager.CreateInstanceWithCustomInstanceFactory(componentType, null);
			DesignItem item = context.Services.Component.RegisterComponentForDesigner(newInstance);
			changeGroup = item.OpenGroup("Drop Control");
			context.Services.Component.SetDefaultPropertyValues(item);
			context.Services.ExtensionManager.ApplyDefaultInitializers(item);
			return item;
		}
コード例 #50
0
			public DrawPathMouseGesture(PathFigure figure, DesignItem newLine, IInputElement relativeTo, ChangeGroup changeGroup, Transform transform)
			{
				this.newLine = newLine;
				this.positionRelativeTo = relativeTo;
				this.changeGroup = changeGroup;
				this.figure = figure;
				this.matrix = transform.Value;
				matrix.Invert();
				
				sP = Mouse.GetPosition(null);
				
				geometry = newLine.Properties[Path.DataProperty].Value;
			}
コード例 #51
0
		void OnMouseDown(object sender, MouseButtonEventArgs e)
		{
			if (e.ChangedButton == MouseButton.Left && MouseGestureBase.IsOnlyButtonPressed(e, MouseButton.Left)) {
				e.Handled = true;
				IDesignPanel designPanel = (IDesignPanel)sender;
				DesignPanelHitTestResult result = designPanel.HitTest(e.GetPosition(designPanel), false, true, HitTestType.Default);
				if (result.ModelHit != null) {
					var darwItemBehaviors = result.ModelHit.Extensions.OfType<IDrawItemExtension>();
					var drawItembehavior = darwItemBehaviors.FirstOrDefault(x => x.CanItemBeDrawn(componentType));
					if (drawItembehavior != null && drawItembehavior.CanItemBeDrawn(componentType)) {
						drawItembehavior.StartDrawItem(result.ModelHit, componentType, designPanel, e);
					}
					else {
						var placementBehavior = result.ModelHit.GetBehavior<IPlacementBehavior>();
						if (placementBehavior != null) {
							var createdItem = CreateItem(designPanel.Context);
							
							new CreateComponentMouseGesture(result.ModelHit, createdItem, changeGroup).Start(designPanel, e);
							// CreateComponentMouseGesture now is responsible for the changeGroup created by CreateItem()
							changeGroup = null;
						}
					}
				}
			}
		}
コード例 #52
0
		void drag_Completed(DragListener drag)
		{
			if (operation != null) {
				if (drag.IsCanceled) operation.Abort();
				else operation.Commit();
				operation = null;
			} else {
				if (drag.IsCanceled) changeGroup.Abort();
				else changeGroup.Commit();
				changeGroup = null;
			}
			_isResizing=false;
			HideSizeAndShowHandles();
		}
コード例 #53
0
		public CreateComponentMouseGesture(DesignItem clickedOn, DesignItem createdItem, ChangeGroup changeGroup)
		{
			this.container = clickedOn;
			this.createdItem = createdItem;
			this.positionRelativeTo = clickedOn.View;
			this.changeGroup = changeGroup;
		}
コード例 #54
0
        protected override void OnMouseUp(object sender, MouseButtonEventArgs e)
        {
            if (hasDragStarted) {
                if (operation != null) {
                    operation.Commit();
                    operation = null;
                }
            } else {
                CreateComponentTool.AddItemWithDefaultSize(container, createdItem, e.GetPosition(positionRelativeTo));
            }
            if (changeGroup != null) {
                changeGroup.Commit();
                changeGroup = null;
            }

            if (designPanel.Context.Services.Component is XamlComponentService)
            {
                ((XamlComponentService)designPanel.Context.Services.Component).RaiseComponentRegisteredAndAddedToContainer(createdItem);
            }

            base.OnMouseUp(sender, e);
        }
コード例 #55
0
		protected override void OnMouseUp(object sender, MouseButtonEventArgs e)
		{
			if (hasDragStarted) {
				if (operation != null) {
					operation.Commit();
					operation = null;
				}
			} else {
				CreateComponentTool.AddItemWithDefaultSize(container, createdItem, e.GetPosition(positionRelativeTo));
			}
			if (changeGroup != null) {
				changeGroup.Commit();
				changeGroup = null;
			}
			base.OnMouseUp(sender, e);
		}
コード例 #56
0
			public DrawPolylineMouseGesture(DesignItem newLine, IInputElement relativeTo, ChangeGroup changeGroup)
			{
				this.newLine = newLine;
				this.positionRelativeTo = relativeTo;
				this.changeGroup = changeGroup;
				
				startPoint = Mouse.GetPosition(null);
			}
コード例 #57
0
			protected override void OnStopped()
			{
				if (changeGroup != null) {
					changeGroup.Abort();
					changeGroup = null;
				}
				if (services.Tool.CurrentTool is CreateComponentTool) {
					services.Tool.CurrentTool = services.Tool.PointerTool;
				}

				newLine.ReapplyAllExtensions();

				base.OnStopped();
			}