void OnSelectionChanged(Selection selection)
 {
     if (selection.PrimarySelection != this.lastNavigatedItem)
     {
         this.isModelTreeChanged = true;
     }
 }
        private static bool AreSelectionsEquivalent(View.Selection a, View.Selection b)
        {
            if (a == null && b == null)
            {
                return(true);
            }
            if (a == null || b == null)
            {
                return(false);
            }
            if (a.SelectionCount != b.SelectionCount)
            {
                return(false);
            }

            // POSSIBLE OPTIMIZATION: be smarter about same selection in a different order
            IEnumerator <ModelItem> ea = a.SelectedObjects.GetEnumerator();
            IEnumerator <ModelItem> eb = b.SelectedObjects.GetEnumerator();

            while (ea.MoveNext() && eb.MoveNext())
            {
                if (!object.Equals(ea.Current, eb.Current))
                {
                    return(false);
                }
            }

            return(true);
        }
        // IPropertyInspectorState

        internal void Dispose()
        {
            _disposed = true;
            DisassociateAllProperties();
            UpdateSelectionPropertyChangedEventHooks(_displayedSelection, null);
            _displayedSelection = null;
            _defaultCommandHandler.Dispose();
            _defaultCommandHandler = null;
        }
        // Removes / adds a PropertyChanged listener from / to the previous / current selection
        private void UpdateSelectionPropertyChangedEventHooks(View.Selection previousSelection, View.Selection currentSelection)
        {
            if (previousSelection != null && previousSelection.PrimarySelection != null)
            {
                previousSelection.PrimarySelection.PropertyChanged -= OnSelectedItemPropertyChanged;
            }

            if (currentSelection != null && currentSelection.PrimarySelection != null)
            {
                currentSelection.PrimarySelection.PropertyChanged += OnSelectedItemPropertyChanged;
            }
        }
        // Looks for common parent ModelItem among all the items in the selection
        private static ModelItem GetCommonParent(View.Selection selection)
        {
            if (selection == null || selection.SelectionCount < 1)
            {
                return(null);
            }

            ModelItem parent = null;

            foreach (ModelItem item in selection.SelectedObjects)
            {
                if (parent == null)
                {
                    parent = item.Parent;
                }
                else if (parent != item.Parent)
                {
                    return(null);
                }
            }

            return(parent);
        }
        // Tries to figure out what property to select and selects is
        private void UpdateSelectedProperty(View.Selection selection)
        {
            // If we are not loaded, skip any and all selection magic
            if (!this.IsLoaded)
            {
                return;
            }

            if (selection != null)
            {
                // See what the view would like us to select if we run out of things
                // we can think of selecting
                //
                SelectionPath fallbackSelection = null;
                if (_propertyToolBar.CurrentViewManager != null)
                {
                    fallbackSelection = _propertyToolBar.CurrentViewManager.GetDefaultSelectionPath(_categoryList);
                }

                // Select the first thing we request that exists, using the following
                // precedence order:
                //
                //  * LastSelectionPath
                //  * DefaultProperty
                //  * Whatever the view wants to show (first category, first property, ...)
                //
                _categoryList.UpdateSelectedProperty(
                    this.LastSelectionPath,
                    ModelPropertyMerger.GetMergedDefaultProperty(selection.SelectedObjects),
                    fallbackSelection);
            }

            if (DesignerPerfEventProvider != null)
            {
                DesignerPerfEventProvider.PropertyInspectorUpdatePropertyListEnd();
            }
        }
示例#7
0
        /// <summary>
        /// Selection helper method.  This sets itemToSelect into the selection.
        /// Any existing items are deselected.
        /// </summary>
        /// <param name="context">The editing context to apply this selection change to.</param>
        /// <param name="itemToSelect">The item to select.</param>
        /// <returns>A Selection object that contains the new selection.</returns>
        /// <exception cref="ArgumentNullException">If context or itemToSelect is null.</exception>
        public static Selection SelectOnly(EditingContext context, ModelItem itemToSelect) {

            if (context == null) throw FxTrace.Exception.ArgumentNull("context");
            if (itemToSelect == null) throw FxTrace.Exception.ArgumentNull("itemToSelect");

            // Check to see if only this object is selected.  If so, bail.
            Selection existing = context.Items.GetValue<Selection>();
            if (existing.PrimarySelection == itemToSelect) {
                IEnumerator<ModelItem> en = existing.SelectedObjects.GetEnumerator();
                en.MoveNext();
                if (!en.MoveNext()) {
                    return existing;
                }
            }

            DesignerPerfEventProvider designerPerfEventProvider = context.Services.GetService<DesignerPerfEventProvider>();
            if (designerPerfEventProvider != null)
            {
                designerPerfEventProvider.SelectionChangedStart();
            }

            Selection selection = new Selection(itemToSelect);
            context.Items.SetValue(selection);
            return selection;
        }
示例#8
0
        /// <summary>
        /// Selection helper method.  This takes the existing selection in the
        /// context and creates a new selection that contains the toggled
        /// state of the item.  If the item is to be
        /// added to the selection, it is added as the primary selection.
        /// </summary>
        /// <param name="context">The editing context to apply this selection change to.</param>
        /// <param name="itemToToggle">The item to toggle selection for.</param>
        /// <returns>A Selection object that contains the new selection.</returns>
        /// <exception cref="ArgumentNullException">If context or itemToToggle is null.</exception>
        public static Selection Toggle(EditingContext context, ModelItem itemToToggle) {
            
            if (context == null) throw FxTrace.Exception.ArgumentNull("context");
            if (itemToToggle == null) throw FxTrace.Exception.ArgumentNull("itemToToggle");

            Selection existing = context.Items.GetValue<Selection>();

            // Is the item already in the selection?  If so, remove it.
            // If not, add it to the beginning.

            List<ModelItem> list = new List<ModelItem>(existing.SelectedObjects);
            if (list.Contains(itemToToggle)) {
                list.Remove(itemToToggle);
            }
            else {
                list.Insert(0, itemToToggle);
            }

            Selection selection = new Selection(list);
            context.Items.SetValue(selection);
            return selection;
        }
 void SelectionChanged(Selection selection)
 {
     this.selectedModelItem = selection.PrimarySelection;
 }
示例#10
0
        /// <summary>
        /// Selection helper method.  This takes the existing selection in the
        /// context and selects an item into it.  If the item is already in the
        /// selection the selection is preserved and the item is promoted
        /// to the primary selection.
        /// </summary>
        /// <param name="context">The editing context to apply this selection change to.</param>
        /// <param name="itemToSelect">The item to select.</param>
        /// <returns>A Selection object that contains the new selection.</returns>
        /// <exception cref="ArgumentNullException">If context or itemToSelect is null.</exception>
        public static Selection Select(EditingContext context, ModelItem itemToSelect) {

            if (context == null) throw FxTrace.Exception.ArgumentNull("context");
            if (itemToSelect == null) throw FxTrace.Exception.ArgumentNull("itemToSelect");

            Selection existing = context.Items.GetValue<Selection>();

            // short cut if we're already in the right state.
            if (existing.PrimarySelection == itemToSelect) {
                return existing;
            }

            Selection selection = null;

            foreach (ModelItem obj in existing.SelectedObjects) {
                if (obj == itemToSelect) {
                    List<ModelItem> list = new List<ModelItem>(existing.SelectedObjects);
                    list.Remove(itemToSelect);
                    list.Insert(0, itemToSelect);
                    selection = new Selection(list);
                }
            }

            if (selection == null) {
                selection = new Selection(itemToSelect);
            }
            
            context.Items.SetValue(selection);
            return selection;
        }
        private void SelectionChanged(Selection selection)
        {
            var httpRequestSequenceFilesViewModel = ServiceLocator.Current.GetInstance<HttpRequestSequenceFilesViewModel>();
            if (httpRequestSequenceFilesViewModel.IsLoadingSequence)
            {
                return;
            }

            eventAggregator.GetEvent<IsDirtyEvent>().Publish(new IsDirtyData(httpRequestSequenceViewModel, true));

            var modelItem = selection.PrimarySelection;

            if (modelItem == null)
            {
                return;
            }

            if (modelItem.ItemType == typeof(HttpRequestIfElseActivityModel) || modelItem.ItemType == typeof(RetryUntilActivityModel))
            {
                if (modelItem.Properties["Operators"].Collection.Count > 4)
                {
                    for (var i = modelItem.Properties["Operators"].Collection.Count - 1; i >= 4; i--)
                    {
                        modelItem.Properties["Operators"].Collection.RemoveAt(i);
                    }
                }

                if (modelItem.Properties["ResponseSections"].Collection.Count > 3)
                {
                    for (var i = modelItem.Properties["ResponseSections"].Collection.Count - 1; i >= 3; i--)
                    {
                        modelItem.Properties["ResponseSections"].Collection.RemoveAt(i);
                    }
                }
            }

            var httpRequests = modelItem.Properties["HttpRequests"];
            if (modelItem.Properties["HttpRequests"] != null)
            {
                // remove deleted
                var deleted = httpRequests.Collection.Where(x => !Solution.Current.HttpRequestFiles.Any(s => s.Id == x.Properties["Id"].Value.ToString()));

                for (var i = httpRequests.Collection.Count - 1; i >= 0; i--)
                {
                    var deletedItems = deleted as IList<ModelItem> ?? deleted.ToList();
                    if (deletedItems.Any(x => x.Properties["Id"].Value.ToString() == httpRequests.Collection[i].Properties["Id"].Value.ToString()))
                    {
                        httpRequests.Collection.RemoveAt(i);
                    }
                }

                // add new
                foreach (var httpRequestFile in Solution.Current.HttpRequestFiles)
                {
                    if (!httpRequests.Collection.Any(x => x.Properties["Id"].Value.ToString() == httpRequestFile.Id))
                    {
                        httpRequests.Collection.Add(httpRequestFile);
                    }
                }
            }
        }
 private ModelItem GetTopmostSelectedArgument(Selection selection, ModelItemCollection arguments)
 {
     foreach (ModelItem argument in arguments)
     {
         foreach (ModelItem candidateArgument in selection.SelectedObjects)
         {
             if (candidateArgument.ItemType == typeof(DesignTimeArgument))
             {
                 // since for arguments, the selection is not the modelitem, it is the fakemodelitem, we cannot do a
                 // simple reference comparing to find the selected argument.
                 DesignTimeArgument designTimeArgument = candidateArgument.GetCurrentValue() as DesignTimeArgument;
                 if (designTimeArgument.ReflectedObject == argument)
                 {
                     return argument;
                 }
             }
         }
     }
     return null;
 }
        void OnConnectorGotFocus(object sender, RoutedEventArgs e)
        {
            Connector connector = e.Source as Connector;

            if (this.panel.connectorEditor == null || !connector.Equals(this.panel.connectorEditor.Connector))
            {
                this.panel.RemoveConnectorEditor();
                this.panel.connectorEditor = new ConnectorEditor(this.panel, connector);
            }

            if (this.panel.Children.Contains(connector))
            {
                this.updatingSelectedConnector = true;
                ModelItem connectorModelItem = StateContainerEditor.GetConnectorModelItem(connector);
                Selection newSelection = new Selection();
                if (connectorModelItem != null && connectorModelItem.ItemType == typeof(Transition))
                {
                    newSelection = new Selection(connectorModelItem);
                }
                this.Context.Items.SetValue(newSelection);
                this.selectedConnector = connector;
                this.updatingSelectedConnector = false;

                if (connectorModelItem.ItemType == typeof(Transition))
                {
                    // Populate the source and destination States's View if it is still in Virtualized mode.
                    ModelItem destinationState = connectorModelItem.Properties[TransitionDesigner.ToPropertyName].Value;
                    PopulateVirtualizingContainer(destinationState);
                    ModelItem sourceState = StateContainerEditor.GetParentStateModelItemForTransition(connectorModelItem);
                    PopulateVirtualizingContainer(sourceState);

                    // Assign its destination State's View on the connector model item for copy/paste function.
                    ((IModelTreeItem)connectorModelItem).SetCurrentView(destinationState.View);
                }

                e.Handled = true;
            }
        }
        void SelectionChanged(Selection item)
        {
            _workflowDesignerSelection = item;

            if(_workflowDesignerSelection != null)
            {
                if(_workflowDesignerSelection.PrimarySelection == ModelItem)
                {
                    IsSelected = true;
                    BringToFront();
                    ShowAllAdorners();
                }
                else
                {
                    IsSelected = false;
                    HideAdorners();
                }
            }
        }
        // Selection Logic

        // SelectionPathStateContainer

        // <summary>
        // Called externally whenever selection changes
        // </summary>
        // <param name="selection">New selection</param>
        public void OnSelectionChanged(View.Selection selection)
        {
            _lastNotifiedSelection = selection;
            RefreshSelection();
        }
示例#16
0
        /// <summary>
        /// Selection helper method.  This takes the existing selection in the
        /// context and creates a new selection that contains the original
        /// selection and the itemToAdd.  If itemToAdd is already in the 
        /// original selection it is promoted to the primary selection.
        /// </summary>
        /// <param name="context">The editing context to apply this selection change to.</param>
        /// <param name="itemToAdd">The item to add to the selection.</param>
        /// <returns>A Selection object that contains the new selection.</returns>
        /// <exception cref="ArgumentNullException">If context or itemToAdd is null.</exception>
        public static Selection Union(EditingContext context, ModelItem itemToAdd) {

            if (context == null) throw FxTrace.Exception.ArgumentNull("context");
            if (itemToAdd == null) throw FxTrace.Exception.ArgumentNull("itemToAdd");

            Selection existing = context.Items.GetValue<Selection>();

            // short cut if we're already in the right state.
            if (existing.PrimarySelection == itemToAdd) {
                return existing;
            }

            // Is the item already in the selection?  If not, add it.
            List<ModelItem> list = new List<ModelItem>(existing.SelectedObjects);
            if (list.Contains(itemToAdd)) {
                list.Remove(itemToAdd);
            }

            list.Insert(0, itemToAdd);
            Selection selection = new Selection(list);
            context.Items.SetValue(selection);
            return selection;
        }
示例#17
0
 // The user can only specify the name for the selected objects iff exactly one
 // object is selected.
 private static bool CanSetSelectionName(View.Selection selection)
 {
     return(selection != null && selection.SelectionCount == 1);
 }
示例#18
0
        // Selection Logic

        // SelectionPathStateContainer

        // <summary>
        // Called externally whenever selection changes
        // </summary>
        // <param name="selection">New selection</param>
        public void OnSelectionChanged(View.Selection selection)
        {
            _lastNotifiedSelection = selection;
            RefreshSelection();
        }
示例#19
0
        // Updates PI when the application becomes Idle (perf optimization)
        private void OnSelectionChangedIdle()
        {
            if (DesignerPerfEventProvider != null)
            {
                DesignerPerfEventProvider.PropertyInspectorUpdatePropertyListStart();
            }

            if (AreSelectionsEquivalent(_lastNotifiedSelection, _displayedSelection))
            {
                return;
            }

            if (!VisualTreeUtils.IsVisible(this))
            {
                return;
            }

            // Change the SelectedControlFlowDirectionRTL resource property
            // This will allow the 3rd party editors to look at this property
            // and change to RTL for controls that support RTL.
            // We set the resource to the primary selections RTL property.
            FlowDirection commmonFD = this.FlowDirection;

            if (_lastNotifiedSelection != null && _lastNotifiedSelection.PrimarySelection != null)
            {
                FrameworkElement selectedElement = _lastNotifiedSelection.PrimarySelection.View as FrameworkElement;
                if (selectedElement != null)
                {
                    commmonFD = selectedElement.FlowDirection;
                }

                // In case of mulitislection,
                // if the FlowDirection is different then always set it to LTR.
                // else set it to common FD.
                if (_lastNotifiedSelection.SelectionCount > 1)
                {
                    foreach (ModelItem item in _lastNotifiedSelection.SelectedObjects)
                    {
                        FrameworkElement curElm = item.View as FrameworkElement;
                        if (curElm != null && curElm.FlowDirection != commmonFD)
                        {
                            //reset to LTR (since the FD's are different within multiselect)
                            commmonFD = FlowDirection.LeftToRight;
                            break;
                        }
                    }
                }
            }

            PropertyInspectorResources.GetResources()["SelectedControlFlowDirectionRTL"] = commmonFD;

            RefreshPropertyList(false);

            UpdateSelectionPropertyChangedEventHooks(_displayedSelection, _lastNotifiedSelection);
            _displayedSelection = _lastNotifiedSelection;
            _lastParent         = GetCommonParent(_lastNotifiedSelection);

            // Handle dangling transactions
            _defaultCommandHandler.CommitOpenTransactions();

            OnPropertyChanged("IsInfoBarNameReadOnly");
            OnPropertyChanged("SelectionName");
            OnPropertyChanged("SelectionIcon");
            OnPropertyChanged("SelectionTypeName");
        }
        // IPropertyInspectorState

        internal void Dispose()
        {
            _disposed = true;
            DisassociateAllProperties();
            UpdateSelectionPropertyChangedEventHooks(_displayedSelection, null);
            _displayedSelection = null;
            _defaultCommandHandler.Dispose();
            _defaultCommandHandler = null;
        }
示例#21
0
        // This is the work-horse that refreshes the list of properties and categories within a PropertyInspector
        // window, including refreshing of CategoryEditors, based on the specified selection
        private void UpdateCategories(View.Selection selection, bool attachedOnly)
        {
            // Optimization stolen from Sparkle:
            // re-rendering the categories is the number one perf issue. Clearing
            // the databound collection results in massive Avalon code execution, and
            // then re-adding everything causes another huge shuffle. What is more,
            // even when changing the selection between different objects, most properties
            // do not change. Therefore we are going to take the new list of properties
            // and we are going to merge them into the existing stuff, using an
            // approach I call Mark, Match, and Cull.
            //
            // First we mark all the properties in the current collection. Those which
            // are still marked at the end will be culled out
            foreach (ModelCategoryEntry category in _categoryList)
            {
                if (attachedOnly)
                {
                    category.MarkAttachedPropertiesDisassociated();
                }
                else
                {
                    category.MarkAllPropertiesDisassociated();
                }
            }

            // Second we try to match each property in the list of properties for the newly selected objects
            // against something that we already have. If we have a match, then we reset the existing
            // ModelPropertyEntry and clear the mark
            //
            foreach (IEnumerable <ModelProperty> propertySet in
                     ModelPropertyMerger.GetMergedProperties(
                         selection == null ? null : selection.SelectedObjects,
                         selection == null ? 0 : selection.SelectionCount))
            {
                string propertyName = GetPropertyName(propertySet);

                // Specifically filter out the Name property
                // PS 40699 - Name is not a special property for WF
                //if ("Name".Equals(propertyName))
                //{
                //    continue;
                //}

                if (attachedOnly && propertyName.IndexOf('.') < 0)
                {
                    continue;
                }

                ModelPropertyEntry wrappedProperty = _propertyToolBar.CurrentViewManager.AddProperty(propertySet, propertyName, _categoryList);

                // Make sure no valid properties get culled out
                wrappedProperty.Disassociated = false;
            }

            // Third, we walk the properties and categories, and we cull out all of the
            // marked properties. Empty categories are removed.
            //
            for (int i = _categoryList.Count - 1; i >= 0; i--)
            {
                ModelCategoryEntry category = (ModelCategoryEntry)_categoryList[i];
                category.CullDisassociatedProperties();
                if (category.IsEmpty)
                {
                    _categoryList.RemoveAt(i);
                }
            }

            _categoryList.RefreshFilter();
        }
        // Updates PI when the application becomes Idle (perf optimization)
        private void OnSelectionChangedIdle()
        {
            if (DesignerPerfEventProvider != null)
            {
                DesignerPerfEventProvider.PropertyInspectorUpdatePropertyListStart();
            }

            if (AreSelectionsEquivalent(_lastNotifiedSelection, _displayedSelection))
            {
                return;
            }

            if (!VisualTreeUtils.IsVisible(this))
            {
                return;
            }

            // Change the SelectedControlFlowDirectionRTL resource property
            // This will allow the 3rd party editors to look at this property
            // and change to RTL for controls that support RTL. 
            // We set the resource to the primary selections RTL property. 
            FlowDirection commmonFD = this.FlowDirection;
            if (_lastNotifiedSelection != null && _lastNotifiedSelection.PrimarySelection != null)
            {

                FrameworkElement selectedElement = _lastNotifiedSelection.PrimarySelection.View as FrameworkElement;
                if (selectedElement != null)
                {
                    commmonFD = selectedElement.FlowDirection;
                }

                // In case of mulitislection, 
                // if the FlowDirection is different then always set it to LTR.
                // else set it to common FD.
                if (_lastNotifiedSelection.SelectionCount > 1)
                {
                    foreach (ModelItem item in _lastNotifiedSelection.SelectedObjects)
                    {
                        FrameworkElement curElm = item.View as FrameworkElement;
                        if (curElm != null && curElm.FlowDirection != commmonFD)
                        {
                            //reset to LTR (since the FD's are different within multiselect)
                            commmonFD = FlowDirection.LeftToRight;
                            break;
                        }
                    }
                }
            }

            PropertyInspectorResources.GetResources()["SelectedControlFlowDirectionRTL"] = commmonFD;

            RefreshPropertyList(false);

            UpdateSelectionPropertyChangedEventHooks(_displayedSelection, _lastNotifiedSelection);
            _displayedSelection = _lastNotifiedSelection;
            _lastParent = GetCommonParent(_lastNotifiedSelection);

            // Handle dangling transactions
            _defaultCommandHandler.CommitOpenTransactions();

            OnPropertyChanged("IsInfoBarNameReadOnly");
            OnPropertyChanged("SelectionName");
            OnPropertyChanged("SelectionIcon");
            OnPropertyChanged("SelectionTypeName");
        }
示例#23
0
        // Helper method that adjusts the visible set of CategoryEditors based on the specified selection
        private void UpdateCategoryEditors(View.Selection selection)
        {
            // Figure out which category editors to show
            Dictionary <Type, object> newCategoryEditorTypes = _propertyToolBar.CurrentViewManager.GetCategoryEditors(
                FindCommonType(selection == null ? null : selection.SelectedObjects),
                _categoryList);

            // Figure out which CategoryEditors are no longer needed and remove them
            List <Type> editorTypesToRemove = null;

            foreach (KeyValuePair <Type, string> item in _activeCategoryEditors)
            {
                if (!newCategoryEditorTypes.ContainsKey(item.Key) || !IsCategoryShown(item.Key))
                {
                    // New selection does not include this existing category editor
                    // or the category that contains this editor
                    // so remove the editor.
                    if (editorTypesToRemove == null)
                    {
                        editorTypesToRemove = new List <Type>();
                    }

                    editorTypesToRemove.Add(item.Key);
                }
                else
                {
                    // This category editor already exists, so don't re-add it
                    newCategoryEditorTypes.Remove(item.Key);
                }
            }

            if (editorTypesToRemove != null)
            {
                foreach (Type editorTypeToRemove in editorTypesToRemove)
                {
                    ModelCategoryEntry affectedCategory = _categoryList.FindCategory(_activeCategoryEditors[editorTypeToRemove]) as ModelCategoryEntry;
                    if (affectedCategory != null)
                    {
                        affectedCategory.RemoveCategoryEditor(editorTypeToRemove);
                    }

                    _activeCategoryEditors.Remove(editorTypeToRemove);
                }
            }

            // Figure out which CategoryEditors are now required and add them
            foreach (Type editorTypeToAdd in newCategoryEditorTypes.Keys)
            {
                CategoryEditor editor = (CategoryEditor)ExtensibilityAccessor.SafeCreateInstance(editorTypeToAdd);
                if (editor == null)
                {
                    continue;
                }

                ModelCategoryEntry affectedCategory = _categoryList.FindCategory(editor.TargetCategory) as ModelCategoryEntry;
                if (affectedCategory == null)
                {
                    continue;
                }

                affectedCategory.AddCategoryEditor(editor);
                _activeCategoryEditors[editorTypeToAdd] = editor.TargetCategory;
            }
        }
 private void OnSelectionChanged(Selection selection)
 {
     // If selection changed, remove ConnectorEditor if existed.
     // Only if the selection changed is caused by adding ConnectorEditor when OnConnectorGotFocus.
     if (!this.updatingSelectedConnector && this.panel != null && this.panel.connectorEditor != null)
     {
         this.panel.RemoveConnectorEditor();
     }
 }
        void AddEntriesForArguments(Selection selection, ref int startIndex)
        {
            ModelProperty argumentsProperty = this.modelService.Root.Properties["Properties"];
            if (argumentsProperty == null)
            {
                return;
            }
            ModelItemCollection arguments = argumentsProperty.Collection;
            if (arguments != null)
            {
                ModelItem selectedArgument = this.GetTopmostSelectedArgument(selection, arguments);
                foreach (ModelItem argument in arguments)
                {
                    // Do this check to make sure we start from the topmost selected item.
                    if (startIndex == StartIndexUnchangeMark && argument == selectedArgument && argument != lastNavigatedItem)
                    {
                        startIndex = index;
                    }
                    entries.Add(CreateSearchableEntry(SearchableEntryOption.Argument, argument, null,
                        TypeNameHelper.GetDisplayName(argument.Properties["Type"].ComputedValue as Type, false), null));

                    entries.Add(CreateSearchableEntry(SearchableEntryOption.Argument, argument, null,
                        argument.Properties[DesignTimeArgument.ArgumentNameProperty].ComputedValue.ToString(), null));

                    IList<string> argumentValues = GetSearchableStrings(argument.Properties[DesignTimeArgument.ArgumentDefaultValueProperty].ComputedValue);
                    if (argumentValues.Count == 1)
                    {
                        AddEntriesForPropertyValue(argumentValues[0],
                            argument, null, SearchableEntryOption.Argument, null);
                    }

                    if (this.editingContext.Services.GetService<DesignerConfigurationService>().AnnotationEnabled)
                    {
                        string annotationText = (string)argument.Properties[Annotation.AnnotationTextPropertyName].ComputedValue;
                        if (!string.IsNullOrEmpty(annotationText))
                        {
                            entries.Add(CreateSearchableEntry(SearchableEntryOption.Argument, argument, null, annotationText, null));
                        }
                    }
                }
            }
        }
        private void OnItemSelected(Selection item)
        {
            ModelItem mi = item.PrimarySelection;
            if (mi != null)
            {
                if (flowchartCategory != null && wd.ContextMenu != null)
                {
                    if (mi.ItemType == typeof(Flowchart))
                    {
                        //add the flowchart-only activities
                        foreach (var tool in flowchartActivities)
                        {
                            if (!flowchartCategory.Tools.Contains(tool))
                            {
                                flowchartCategory.Tools.Add(tool);
                            }
                        }
                        if (!wd.ContextMenu.Items.Contains(miAddFlowDecision))
                        {
                            wd.ContextMenu.Items.Add(miAddFlowDecision);
                        }

                    }
                    else
                    {
                        //remove the flowchart-only activities
                        foreach (var tool in flowchartActivities)
                        {
                            flowchartCategory.Tools.Remove(tool);
                        }
                        wd.ContextMenu.Items.Remove(miAddFlowDecision);

                    }
                }
            }
        }
        void OnConnectorGotFocus(object sender, RoutedEventArgs e)
        {
            Connector connector = e.Source as Connector;

            if (this.panel.connectorEditor == null || !connector.Equals(this.panel.connectorEditor.Connector))
            {
                this.panel.RemoveConnectorEditor();
                this.panel.connectorEditor = new ConnectorEditor(this.panel, connector);
            }

            if (this.panel.Children.Contains(connector))
            {
                ModelItem connectorModelItem = StateContainerEditor.GetConnectorModelItem(connector);
                Selection newSelection = new Selection();
                if (connectorModelItem != null && connectorModelItem.ItemType == typeof(Transition))
                {
                    newSelection = new Selection(connectorModelItem);
                }
                this.Context.Items.SetValue(newSelection);
                this.selectedConnector = connector;
                e.Handled = true;
            }
        }