Ejemplo n.º 1
0
        /// <summary>
        /// Finishes initializing component by setting up scripting service</summary>
        void IInitializable.Initialize()
        {
            if (m_scriptingService != null)
            {
                // load this assembly into script domain.
                m_scriptingService.LoadAssembly(GetType().Assembly);
                m_scriptingService.ImportAllTypes("StatechartEditorSample");
                m_scriptingService.ExecuteStatement("from Sce.Atf.Controls.Adaptable.Graphs import *");
                m_scriptingService.SetVariable("editor", this);

                m_contextRegistry.ActiveContextChanged += delegate
                {
                    EditingContext  editingContext = m_contextRegistry.GetActiveContext <EditingContext>();
                    ViewingContext  viewContext    = m_contextRegistry.GetActiveContext <ViewingContext>();
                    IHistoryContext hist           = m_contextRegistry.GetActiveContext <IHistoryContext>();
                    m_scriptingService.SetVariable("editingContext", editingContext);
                    m_scriptingService.SetVariable("stateChart", editingContext != null ? editingContext.Statechart : null);
                    m_scriptingService.SetVariable("view", viewContext);
                    m_scriptingService.SetVariable("hist", hist);
                };
            }

            if (m_singleInstanceService != null)
            {
                m_singleInstanceService.CommandLineChanged += m_singleInstanceService_CommandLineChanged;
            }
        }
 /// <summary>
 /// Checks whether the client can do the command, if it handles it</summary>
 /// <param name="tag">Command to be done</param>
 /// <returns>True iff client can do the command</returns>
 public bool CanDoCommand(object tag)
 {
     if (tag is Commands)
     {
         CharacterSettingsContext context = m_contextRegistry.GetActiveContext <CharacterSettingsContext>();
         return(context != null);
     }
     return(false);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Checks whether the client can do the command, if it handles it</summary>
 /// <param name="tag">Command to be done</param>
 /// <returns>True iff client can do the command</returns>
 public bool CanDoCommand(object tag)
 {
     if (tag is Commands)
     {
         var target = m_contextRegistry.GetCommandTarget <object>();
         if (target != null)
         {
             var labelEditingContext = m_contextRegistry.GetActiveContext <ILabelEditingContext>();
             return(labelEditingContext != null && labelEditingContext.CanEditLabel(target));
         }
     }
     return(false);
 }
Ejemplo n.º 4
0
Archivo: Editor.cs Proyecto: zparr/ATF
        void IInitializable.Initialize()
        {
            // Set the application icon. We need to convert the reource from
            // System.Drawing.Image to System.Windows.Media.ImageSource.
            System.Drawing.Image atfIcon = ResourceUtil.GetImage(Sce.Atf.Resources.AtfIconImage);
            MemoryStream         stream  = new MemoryStream();

            atfIcon.Save(stream, System.Drawing.Imaging.ImageFormat.Bmp);

            BitmapImage bitmapImage = new BitmapImage();

            bitmapImage.BeginInit();
            bitmapImage.StreamSource = new MemoryStream(stream.ToArray());
            bitmapImage.EndInit();

            System.Windows.Application.Current.MainWindow.Icon = bitmapImage;

            if (m_scriptingService != null)
            {
                // load this assembly into script domain.
                m_scriptingService.LoadAssembly(typeof(WinGuiCommon.EditorBase).Assembly);
                m_scriptingService.ImportAllTypes("WinGuiCommon");

                m_scriptingService.SetVariable("editor", this);

                m_contextRegistry.ActiveContextChanged += delegate
                {
                    EditingContext  editingContext = m_contextRegistry.GetActiveContext <EditingContext>();
                    IHistoryContext hist           = m_contextRegistry.GetActiveContext <IHistoryContext>();
                    m_scriptingService.SetVariable("editingContext", editingContext);
                    m_scriptingService.SetVariable("hist", hist);
                };
            }

            if (m_controlHostService != null)
            {
                m_eventView.DataContext = m_eventViewModel;
                m_controlHostService.RegisterControl(new ControlDef
                {
                    Name        = "Event Viewer".Localize(),
                    Description = "Viewer for event details".Localize(),
                    Id          = "wpfApp1",
                    Group       = StandardControlGroup.Bottom
                }, m_eventView, this);

                m_documentRegistry.ActiveDocumentChanged += ContextSelectionChanged;
            }
        }
        /// <summary>
        /// Constructor</summary>
        /// <param name="context">Property editor control context</param>
        public StringArrayEditingControl(PropertyEditorControlContext context)
        {
            m_context = context;
            m_initialSelectedObject = m_context.LastSelectedObject.As <DomNodeAdapter>().DomNode;
            m_initialSelectedObject.AttributeChanged += DomNode_AttributeChanged;
            m_toolStrip = new ToolStrip {
                Dock = DockStyle.Top
            };
            InitToolStrip();
            Controls.Add(m_toolStrip);
            Height = m_toolStrip.Height;
            m_toolStrip.SizeChanged += toolStrip_SizeChanged;

            // Get active contexts and subscribe to ContextChanged event
            IContextRegistry contextRegistry = m_context.ContextRegistry;

            if (contextRegistry != null)
            {
                contextRegistry.ActiveContextChanged += contextRegistry_ActiveContextChanged;
                TransactionContext = contextRegistry.GetActiveContext <ITransactionContext>();
            }
            else if (context.TransactionContext != null)
            {
                TransactionContext = context.TransactionContext;
            }
        }
Ejemplo n.º 6
0
        void IInitializable.Initialize()
        {
            if (m_scriptingService != null)
            {
                // load this assembly into script domain.
                m_scriptingService.LoadAssembly(GetType().Assembly);
                m_scriptingService.ImportAllTypes("CircuitEditorSample");
                m_scriptingService.ImportAllTypes("Sce.Atf.Controls.Adaptable.Graphs");

                m_scriptingService.SetVariable("editor", this);
                m_scriptingService.SetVariable("layerLister", m_layerLister);

                m_contextRegistry.ActiveContextChanged += delegate
                {
                    var             editingContext = m_contextRegistry.GetActiveContext <DiagramEditingContext>();
                    var             viewContext    = m_contextRegistry.GetActiveContext <Controls.ViewingContext>();
                    IHistoryContext hist           = m_contextRegistry.GetActiveContext <IHistoryContext>();
                    m_scriptingService.SetVariable("editingContext", editingContext);
                    m_scriptingService.SetVariable("view", viewContext);
                    m_scriptingService.SetVariable("hist", hist);
                };

                // attach tweakable bridge for accessing console variables
                m_scriptingService.SetVariable("cv", new GUILayer.TweakableBridge());
            }

            if (m_settingsService != null)
            {
                // var settings = new[]
                // {
                //   new BoundPropertyDescriptor(typeof (CircuitDefaultStyle),
                //         () => CircuitDefaultStyle.EdgeStyle,
                //         "Wire Style".Localize(), "Circuit Editor".Localize(),
                //         "Default Edge Style".Localize()),
                // };
                // m_settingsService.RegisterUserSettings("Circuit Editor", settings);
                // m_settingsService.RegisterSettings(this, settings);
            }

            // We need to make sure there is a material set to the active
            // material context... If there is none, we must create a new
            // untitled material, and set that...
            if (_activeMaterialContext.MaterialName == null)
            {
                _activeMaterialContext.MaterialName = GUILayer.RawMaterial.CreateUntitled().Initializer;
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Gets the command target for a menu command. First, if the active context has a
        /// selection, the last selected object of the requested type is adapted. If that is
        /// null, the context is adapted. Returns null if no target can be adapted.</summary>
        /// <typeparam name="T">Target object type</typeparam>
        /// <param name="contextRegistry">Context registry</param>
        /// <returns>The command target for a menu command</returns>
        public static T GetCommandTarget <T>(this IContextRegistry contextRegistry) where T : class
        {
            T target = null;

            var selectionContext = contextRegistry.GetActiveContext <ISelectionContext>();

            if (selectionContext != null)
            {
                target = selectionContext.GetLastSelected <T>();
            }

            if (target == null)
            {
                target = contextRegistry.GetActiveContext <T>();
            }

            return(target);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Finishes initializing component by setting up scripting service</summary>
        void IInitializable.Initialize()
        {
            if (m_scriptingService != null)
            {
                // load this assembly into script domain.
                m_scriptingService.LoadAssembly(GetType().Assembly);
                m_scriptingService.ImportAllTypes("WinGuiCommon");

                m_scriptingService.SetVariable("editor", this);

                m_contextRegistry.ActiveContextChanged += delegate
                {
                    EditingContext  editingContext = m_contextRegistry.GetActiveContext <EditingContext>();
                    IHistoryContext hist           = m_contextRegistry.GetActiveContext <IHistoryContext>();
                    m_scriptingService.SetVariable("editingContext", editingContext);
                    m_scriptingService.SetVariable("hist", hist);
                };
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Can the client do the command?</summary>
        /// <param name="commandTag">Command</param>
        /// <returns>True iff client can do the command</returns>
        public bool CanDoCommand(object commandTag)
        {
            bool enabled = false;
            var  context = m_contextRegistry.GetActiveContext <CircuitEditingContext>();

            if (context != null)
            {
                ISelectionContext selectionContext = context.As <ISelectionContext>();
                if (CommandTag.CreateMaster.Equals(commandTag))
                {
                    enabled = selectionContext.GetLastSelected <Element>() != null; // at least one module selected
                }
                else if (CommandTag.ExpandMaster.Equals(commandTag))
                {
                    enabled = selectionContext.GetLastSelected <SubCircuitInstance>() != null; // at least one mastered instance selected
                }
            }

            return(enabled);
        }
Ejemplo n.º 10
0
        public DomNodePropertySearchService(
            IContextRegistry contextRegistry,
            IControlHostService controlHostService)
        {
            m_contextRegistry    = contextRegistry;
            m_controlHostService = controlHostService;

            // define root control
            m_rootControl      = new UserControl();
            m_rootControl.Name = "Search and Replace";
            m_rootControl.SuspendLayout();
            m_rootControl.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;

            // Create and add the search input control
            var domNodeSearchToolStrip = new DomNodeSearchToolStrip();

            SearchUI = domNodeSearchToolStrip;
            SearchUI.Control.Dock = DockStyle.None;
            m_rootControl.Controls.Add(SearchUI.Control);
            SearchUI.UIChanged += UIElement_Changed;

            _clearButton = new Button()
            {
                Text = "Clear"
            };
            _clearButton.Click    += (object sender, EventArgs args) => { m_contextRegistry.GetActiveContext <IQueryableContext>().Query(null); };
            _clearButton.Dock      = DockStyle.None;
            _clearButton.AutoSize  = true;
            _clearButton.FlatStyle = FlatStyle.Flat;
            _clearButton.FlatAppearance.BorderSize = 0;
            m_rootControl.Controls.Add(_clearButton);

            // Create and add the replace input control
            var domNodeReplaceToolStrip = new DomNodeReplaceToolStrip();

            // hack --  we can't set this property, because it's marked as "internal" in the
            //          ATF library
            // domNodeReplaceToolStrip.DomNodeSearchToolStrip = domNodeSearchToolStrip;
            ReplaceUI = domNodeReplaceToolStrip;
            ReplaceUI.Control.Dock = DockStyle.None;
            m_rootControl.Controls.Add(ReplaceUI.Control);
            ReplaceUI.UIChanged += UIElement_Changed;


            // Create and add the results output control
            ResultsUI = new DomNodeSearchResultsListView(m_contextRegistry);
            ResultsUI.Control.Dock = DockStyle.None;
            m_rootControl.Controls.Add(ResultsUI.Control);
            ResultsUI.UIChanged += UIElement_Changed;

            m_rootControl.Layout += controls_Layout;
            m_rootControl.ResumeLayout();
        }
Ejemplo n.º 11
0
Archivo: Editor.cs Proyecto: zparr/ATF
        /// <summary>
        /// Finishes initializing component by setting up the scripting service</summary>
        void IInitializable.Initialize()
        {
            if (m_scriptingService != null)
            {
                // load this assembly into script domain.
                m_scriptingService.LoadAssembly(GetType().Assembly);
                m_scriptingService.ImportAllTypes("FsmEditorSample");
                m_scriptingService.ImportAllTypes("Sce.Atf.Controls.Adaptable.Graphs");

                m_scriptingService.SetVariable("editor", this);

                m_contextRegistry.ActiveContextChanged += delegate
                {
                    EditingContext  editingContext = m_contextRegistry.GetActiveContext <EditingContext>();
                    ViewingContext  viewContext    = m_contextRegistry.GetActiveContext <ViewingContext>();
                    IHistoryContext hist           = m_contextRegistry.GetActiveContext <IHistoryContext>();
                    m_scriptingService.SetVariable("editingContext", editingContext);
                    m_scriptingService.SetVariable("fsm", editingContext != null ? editingContext.Fsm : null);
                    m_scriptingService.SetVariable("view", viewContext);
                    m_scriptingService.SetVariable("hist", hist);
                };
            }
        }
Ejemplo n.º 12
0
        private void contextRegistry_ActiveContextChanged(object sender, EventArgs e)
        {
            // Note: obtain ITreeView from ILayeringContext not directly from GetActiveContext().
            var context  = m_contextRegistry.GetActiveContext <ILayeringContext>();
            var treeView = context.As <ITreeView>();

            // The TreeView property guards again setting same value
            // but it still reloads the context.
            // so this check is required to prevent the tree to unnecessarily reload
            // the context.
            if (TreeView != treeView)
            {
                TreeView = treeView;
            }
        }
Ejemplo n.º 13
0
        private void OnActiveContextChanged(object obj, EventArgs args)
        {
            IContextRegistry registry = obj as IContextRegistry;

            if (registry != null)
            {
                var gameExt = registry.GetActiveContext <Game.GameExtensions>();
                if (gameExt != null)
                {
                    Context = gameExt.TerrainManipulatorContext;
                    Terrain = gameExt.Terrain;
                    _attachedSceneManager = new WeakReference(gameExt.SceneManager);
                }
            }
        }
Ejemplo n.º 14
0
        private void OnActiveContextChanged(object obj, EventArgs args)
        {
            GUILayer.EditorSceneManager        sceneMan    = null;
            GUILayer.TerrainManipulatorContext maniContext = null;

            IContextRegistry registry = obj as IContextRegistry;

            if (registry != null)
            {
                var gameExt = registry.GetActiveContext <Game.GameExtensions>();
                if (gameExt != null)
                {
                    sceneMan    = gameExt.SceneManager;
                    maniContext = gameExt.TerrainManipulatorContext;
                }
            }

            if (sceneMan == null || maniContext == null)
            {
                if (_attachedTerrainManiContext != null)
                {
                    _attachedTerrainManiContext.OnActiveLayerChange -= OnActiveLayerChanged;
                }
                _manipContext.ManipulatorSet = null;
                _attachedSceneManager.Target = null;
                _attachedTerrainManiContext  = null;
                return;
            }

            if (sceneMan != _attachedSceneManager.Target || maniContext != _attachedTerrainManiContext)
            {
                if (_attachedTerrainManiContext != null)
                {
                    _attachedTerrainManiContext.OnActiveLayerChange -= OnActiveLayerChanged;
                }
                _manipContext.ManipulatorSet = sceneMan.CreateTerrainManipulators(maniContext);
                _attachedSceneManager.Target = sceneMan;
                _attachedTerrainManiContext  = maniContext;
                if (_attachedTerrainManiContext != null)
                {
                    _attachedTerrainManiContext.OnActiveLayerChange += OnActiveLayerChanged;
                }
            }
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Since this application is really just a wrapper around 3 other editors, the scripting service
        /// needs to do some special handling for commonly named variables. </summary>
        /// <param name="container"></param>
        private static void InitializeScriptingVariables(CompositionContainer container)
        {
            try
            {
                ScriptingService scriptingService = container.GetExportedValue <ScriptingService>();
                if (scriptingService != null)
                {
                    scriptingService.RemoveVariable("editor");
                    StatechartEditorSample.Editor stateChartEditor = container.GetExportedValue <StatechartEditorSample.Editor>();
                    if (stateChartEditor != null)
                    {
                        scriptingService.SetVariable("stateChartEditor", stateChartEditor);
                    }
                    CircuitEditorSample.Editor circuitEditor = container.GetExportedValue <CircuitEditorSample.Editor>();
                    if (circuitEditor != null)
                    {
                        scriptingService.SetVariable("circuitEditor", circuitEditor);
                    }
                    FsmEditorSample.Editor fsmEditor = container.GetExportedValue <FsmEditorSample.Editor>();
                    if (fsmEditor != null)
                    {
                        scriptingService.SetVariable("fsmEditor", fsmEditor);
                    }

                    IContextRegistry contextRegistry = container.GetExportedValue <IContextRegistry>();
                    if (contextRegistry != null)
                    {
                        contextRegistry.ActiveContextChanged += delegate
                        {
                            //Note this assumes this is the last ActiveContextChanged listener to be called.
                            //Each of the Circuit/Fsm/StatechartEditors also set these variables
                            //(2 out of 3 will set them to null), so it is important this is the last listener invoked.
                            EditingContext editingContext = contextRegistry.ActiveContext.As <EditingContext>();
                            scriptingService.SetVariable("editingContext", editingContext);
                            IViewingContext viewContext = contextRegistry.GetActiveContext <IViewingContext>();
                            scriptingService.SetVariable("view", viewContext);
                        };
                    }
                }
            }
            catch { }
        }
Ejemplo n.º 16
0
        private void OnActiveContextChanged(object obj, EventArgs args)
        {
            GUILayer.EditorSceneManager sceneMan = null;

            IContextRegistry registry = obj as IContextRegistry;

            if (registry != null)
            {
                var gameExt = registry.GetActiveContext <Game.GameExtensions>();
                if (gameExt != null)
                {
                    sceneMan = gameExt.SceneManager;
                }
            }

            if (sceneMan != null)
            {
                _manipContext.ManipulatorSet = sceneMan.CreateTerrainManipulators();
            }
            else
            {
                _manipContext.ManipulatorSet = null;
            }
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Finishes initializing component by setting up scripting service and setting service</summary>
        void IInitializable.Initialize()
        {
            if (m_scriptingService != null)
            {
                // load this assembly into script domain.
                m_scriptingService.LoadAssembly(GetType().Assembly);
                m_scriptingService.ImportAllTypes("CircuitEditorSample");
                m_scriptingService.ImportAllTypes("Sce.Atf.Controls.Adaptable.Graphs");

                m_scriptingService.SetVariable("editor", this);
                m_scriptingService.SetVariable("schemaLoader", m_schemaLoader);
                m_scriptingService.SetVariable("layerLister", m_layerLister);

                m_contextRegistry.ActiveContextChanged += delegate
                {
                    var             editingContext = m_contextRegistry.GetActiveContext <CircuitEditingContext>();
                    ViewingContext  viewContext    = m_contextRegistry.GetActiveContext <ViewingContext>();
                    IHistoryContext hist           = m_contextRegistry.GetActiveContext <IHistoryContext>();
                    m_scriptingService.SetVariable("editingContext", editingContext);
                    m_scriptingService.SetVariable("circuitContainer", editingContext != null ? editingContext.CircuitContainer : null);
                    m_scriptingService.SetVariable("view", viewContext);
                    m_scriptingService.SetVariable("hist", hist);
                };
            }

            if (m_settingsService != null)
            {
                var settings = new[]
                {
                    new BoundPropertyDescriptor(this, () => SnapToGridEnabled,
                                                "Snap to grid".Localize(), "Circuit Editor".Localize(),
                                                "Snaps circuit element to grid when dragging".Localize(),
                                                new BoolEditor(), null),


                    new BoundPropertyDescriptor(typeof(CircuitDefaultStyle),
                                                () => CircuitDefaultStyle.EdgeStyle,
                                                "Wire Style".Localize(), "Circuit Editor".Localize(),
                                                "Default Edge Style".Localize()),
                    new BoundPropertyDescriptor(typeof(CircuitDefaultStyle),
                                                () => CircuitDefaultStyle.ShowExpandedGroupPins,
                                                "Show Expanded Group Pins".Localize(), "Circuit Editor".Localize(),
                                                "Show group pins when a group is expanded".Localize()),
                    new BoundPropertyDescriptor(typeof(CircuitDefaultStyle),
                                                () => CircuitDefaultStyle.ShowVirtualLinks,
                                                "Show Virtual links".Localize(), "Circuit Editor".Localize(),
                                                "Show virtual links between group pin and its associated subnodes when a group is expanded".Localize()),
                    new BoundPropertyDescriptor(this, () => InitialDirectory,
                                                "Initial Directory".Localize(), "Circuit Editor".Localize(),
                                                "The initial directory for documents".Localize(),
                                                new System.Windows.Forms.Design.FolderNameEditor(), null),
                };
                m_settingsService.RegisterUserSettings("Circuit Editor", settings);
                m_settingsService.RegisterSettings(this, settings);
            }

            if (m_modulePlugin != null)
            {
                // define pin/connection pens
                var pen = D2dFactory.CreateSolidBrush(Color.LightSeaGreen);
                Theme.RegisterCustomBrush(m_modulePlugin.BooleanPinTypeName, pen);
                pen = D2dFactory.CreateSolidBrush(Color.LightSeaGreen);
                Theme.RegisterCustomBrush(m_modulePlugin.FloatPinTypeName, pen);
            }

            D2dGradientStop[] gradstops =
            {
                new D2dGradientStop(Color.White,              0),
                new D2dGradientStop(Color.MediumVioletRed, 1.0f),
            };
            Theme.RegisterCustomBrush(MissingModule.MissingTypeName, D2dFactory.CreateLinearGradientBrush(gradstops));

            CircuitEditingContext.CircuitFormat = CircuitFormat;
        }
Ejemplo n.º 18
0
        /// <summary>
        /// Can the client do the command?</summary>
        /// <param name="commandTag">Command</param>
        /// <returns>True iff client can do the command</returns>
        public virtual bool CanDoCommand(object commandTag)
        {
            bool enabled = false;
            var  context = m_contextRegistry.GetActiveContext <CircuitEditingContext>();

            if (context != null)
            {
                var selectionContext = m_contextRegistry.GetActiveContext <ISelectionContext>();
                if (commandTag is StandardCommand)
                {
                    if (StandardCommand.EditGroup.Equals(commandTag))
                    {
                        var lastSelected = selectionContext.GetLastSelected <Element>();
                        enabled = (lastSelected != null) &&       // at least one Module selected
                                  selectionContext.Selection.All( // selected elements should have a common parent(i.e. belong to the same container)
                            x => x.Is <Element>() && x.Cast <DomNode>().Parent == lastSelected.DomNode.Parent);
                        if (enabled)
                        {
                            enabled = selectionContext.Selection.All(x => !CircuitUtil.IsTemplateTargetMissing(x));
                        }
                        if (enabled && (!context.SupportsNestedGroup))
                        {
                            // if nested group is not supported, then neither any selected item can be a group,
                            // nor any of their ancestry
                            enabled = selectionContext.Selection.All(x => !x.Is <Group>());
                            if (enabled)
                            {
                                enabled = lastSelected.DomNode.Ancestry.All(x => !x.Is <Group>());
                            }
                        }
                    }
                    else if (StandardCommand.EditUngroup.Equals(commandTag))
                    {
                        enabled = selectionContext.Selection.Any() &&
                                  selectionContext.Selection.All(x => x.Is <Group>() &&            // selected are all are group instances
                                                                 !(x.Is <IReference <DomNode> >()) // disallow template instances as they suppose acting atomically
                                                                 );
                    }
                }
                else if (commandTag is CommandTag)
                {
                    if (CommandTag.ShowExpandedGroupPins.Equals(commandTag))
                    {
                        enabled = m_targetRef != null && m_targetRef.Target.Is <Group>() &&
                                  m_targetRef.Target.Cast <Group>().Expanded;
                    }
                    else if (CommandTag.ResetGroupPinNames.Equals(commandTag))
                    {
                        enabled = m_targetRef != null && m_targetRef.Target.Is <Group>() && (m_targetRef.Target is IReference <DomNode>);
                        if (enabled)
                        {
                            enabled = !CircuitUtil.IsTemplateTargetMissing(m_targetRef.Target);
                        }
                    }
                    else if (CommandTag.HideUnconnectedPins.Equals(commandTag))
                    {
                        enabled = m_targetRef != null && m_targetRef.Target.Is <Group>();
                        if (enabled)
                        {
                            enabled = !CircuitUtil.IsTemplateTargetMissing(m_targetRef.Target);
                        }
                    }
                    else if (CommandTag.TogglePinVisibility.Equals(commandTag))
                    {
                        enabled = m_targetRef != null && CanDoTogglePinVisibility(context, m_targetRef.Target);
                    }
                    else if (CommandTag.EdgeStyleDefault.Equals(commandTag))
                    {
                        enabled = true;
                    }
                    else if (CommandTag.EdgeStyleDirectCurve.Equals(commandTag))
                    {
                        enabled = true;
                    }
                }
            }

            return(enabled);
        }