Example #1
0
        public Control()
        {
            InitializeComponent();

            selectionContainer = new Microsoft.VisualStudio.Shell.SelectionContainer();

            nextGraph = null;
            hasNextGraph = false;
            VSGraphVizPackage.expressionGraph.graphUpdated += graphUpdatedHandler;

            bc = new BrushConverter();

            showCompleted = true;
            animationCounter = 0;
            animationLock = new object();

            cur_alg = 1;

            grap_layout_algo = new List<GraphLayout>();
            grap_layout_algo.Add(new FRLayout());
            grap_layout_algo.Add(new RadialLayout());
            grap_layout_algo.Add(new RightHeavyHVLayout());

            graph_layout_algo_name = new List<string>();
            graph_layout_algo_name.Add("Fruchterman-Reingold");
            graph_layout_algo_name.Add("Radial");
            graph_layout_algo_name.Add("Right-Heavy HV");

            gen_menu();
        }
Example #2
0
 /// <summary>
 // Update the selection container.
 /// </summary>
 /// <param name="list">list of objects to be selected and selectable</param>
 public void SelectList(ArrayList list)
 {
     selectionContainer = new MsVsShell.SelectionContainer(true, false);
     selectionContainer.SelectableObjects = list;
     selectionContainer.SelectedObjects   = list;
     UpdateSelection();
 }
        public override void OnToolWindowCreated()
        {
            base.OnToolWindowCreated();

            this.selectionContainer = new SelectionContainer();
            this.viewModel.CurrentNodeChanged += this.OnCurrentNodeChanged;
        }
Example #4
0
 public void SelectList(ArrayList list)
 {
     selectionContainer = new Microsoft.VisualStudio.Shell.SelectionContainer(true, false);
     selectionContainer.SelectableObjects = list;
     selectionContainer.SelectedObjects   = list;
     UpdateSelection();
 }
        /// <summary>
        /// Clears the selection, making the property window empty.
        /// </summary>
        /// <param name="provider">The <seealso cref="IServiceProvider"/> to use to get services.</param>
        public void ClearSelection()
        {
            var selectionContainer = new SelectionContainer();
            selectionContainer.SelectedObjects = new List<object>();
            _selectionTracker.Value?.OnSelectChange(selectionContainer);

            TicklePropertiesWindow();
        }
Example #6
0
    protected override void OnCreate()
    {
      base.OnCreate();

      // set up our property window tracking
      SelectionContainer selContainer = new SelectionContainer();
      selContainer.SelectableObjects = objectsForInspection;
      selContainer.SelectedObjects = objectsForInspection;
      ITrackSelection trackSelectionRef = GetService(typeof(STrackSelection)) as ITrackSelection;
      trackSelectionRef.OnSelectChange(selContainer);
    }
        /// <summary>
        /// Selects the given item, showing it in the properties window.
        /// </summary>
        /// <param name="provider">The <seealso cref="IServiceProvider"/> to use to get services.</param>
        /// <param name="item">The item to be selected.</param>
        public void SelectItem(object item)
        {
            var selectionContainer = new SelectionContainer(true, false);
            var list = new List<object> { item };
            selectionContainer.SelectedObjects = list;
            selectionContainer.SelectableObjects = list;

            Debug.WriteLine($"Update/d selected object: {item}");
            _selectionTracker.Value?.OnSelectChange(selectionContainer);

            TicklePropertiesWindow();
        }
        public static void UpdateSubAspectProperties(PointOfInterest point, TreeNode node, ITrackSelection trackSel)
        {
            VSSubAspectProperties prop = new VSSubAspectProperties(point, node);

            ArrayList listObjects = new ArrayList();
            listObjects.Add(prop);

            selContainer = new SelectionContainer(true, false);
            selContainer.SelectableObjects = listObjects;
            selContainer.SelectedObjects = listObjects;

            trackSel.OnSelectChange((ISelectionContainer)selContainer);
        }
        public void OnSelectChanged(object p)
        {
            selContainer = new Microsoft.VisualStudio.Shell.SelectionContainer(true, false);
            ArrayList items = new ArrayList();

            items.Add(p);
            selContainer.SelectableObjects = items;
            selContainer.SelectedObjects   = items;

            ITrackSelection track = TrackSelection;

            if (track != null)
            {
                track.OnSelectChange((ISelectionContainer)selContainer);
            }
        }
Example #10
0
        private void TrackSelection(UIControlBase control)
        {
            if (frame == null)
            {
                IVsUIShell shell = GetService(typeof(SVsUIShell)) as IVsUIShell;
                if (shell != null)
                {
                    Guid guidPropertyBrowser = new
                                               Guid(ToolWindowGuids.PropertyBrowser);
                    shell.FindToolWindow((uint)__VSFINDTOOLWIN.FTW_fForceCreate,
                                         ref guidPropertyBrowser, out frame);
                }
            }
            if (frame != null)
            {
                frame.Show();
            }
            if (mySelContainer == null)
            {
                mySelContainer = new Microsoft.VisualStudio.Shell.SelectionContainer();
            }

            mySelItems = new System.Collections.ArrayList();

            if (control != null)
            {
                mySelItems.Add(control);
            }

            mySelContainer.SelectedObjects = mySelItems;

            ITrackSelection track = GetService(typeof(STrackSelection))
                                    as ITrackSelection;

            if (track != null)
            {
                track.OnSelectChange(mySelContainer);
            }
        }
Example #11
0
        public Control()
        {
            InitializeComponent();

            selectionContainer = new Microsoft.VisualStudio.Shell.SelectionContainer();

            nextGraph    = null;
            hasNextGraph = false;
            VSGraphVizPackage.expressionGraph.graphUpdated += graphUpdatedHandler;

            bc = new BrushConverter();

            showCompleted    = true;
            animationCounter = 0;
            animationLock    = new object();

            cur_alg = 1;

            grap_layout_algo = new List <GraphLayout>();
            grap_layout_algo.Add(new FRLayout());
            grap_layout_algo.Add(new RadialLayout());
            grap_layout_algo.Add(new RightHeavyHVLayout());
        }
 /// <summary>
 // Update the selection container.
 /// </summary>
 /// <param name="list">list of objects to be selected and selectable</param>
 public void SelectList(ArrayList list)
 {
     selectionContainer = new MsVsShell.SelectionContainer(true, false);
     selectionContainer.SelectableObjects = list;
     selectionContainer.SelectedObjects = list;
     UpdateSelection();
 }
 public SelectionService(IServiceProvider serviceProvider)
 {
     this.trackSelection = serviceProvider.GetService<ITrackSelection>();
     this.selectionContainer = new SelectionContainer();
 }
        /// <summary>
        /// Initialization routine for the Editor. Loads the list of properties for the dal document 
        /// which will show up in the properties window 
        /// </summary>
        /// <param name="package"></param>
        private void PrivateInit(SimpleDataAccessLayerPackage package)
        {
            _myPackage = package;
            _loading = false;
            _gettingCheckoutStatus = false;
            _trackSel = null;

            Control.CheckForIllegalCrossThreadCalls = false;
            // Create an ArrayList to store the objects that can be selected
            var listObjects = new ArrayList();

            // Create the object that will show the document's properties
            // on the properties window.
            var prop = new EditorProperties(this);
            listObjects.Add(prop);

            // Create the SelectionContainer object.
            _selContainer = new SelectionContainer(true, false)
            {
                SelectableObjects = listObjects,
                SelectedObjects = listObjects
            };

            // Create and initialize the editor

            var resources = new ComponentResourceManager(typeof(EditorPane));
            _editorControl = new MainEditorWindow();

            //resources.ApplyResources(_editorControl, "editorControl", CultureInfo.CurrentUICulture);

            // Handle Focus event
            // I should override this one
            //this.editorControl.RichTextBoxControl.GotFocus += new EventHandler(this.OnGotFocus);

            // Call the helper function that will do all of the command setup work
            // -- no commands here // setupCommands();
        }
Example #15
0
        public void OnSelectChanged(object p)
        {
            selContainer = new Microsoft.VisualStudio.Shell.SelectionContainer(true, false);
            ArrayList items = new ArrayList();
            items.Add(p);
            selContainer.SelectableObjects = items;
            selContainer.SelectedObjects = items;

            ITrackSelection track = TrackSelection;
            if (track != null)
                track.OnSelectChange((ISelectionContainer)selContainer);
        }
Example #16
0
        /// <summary>
        /// Initialization routine for the Editor. Loads the list of properties for the document 
        /// which will show up in the properties window 
        /// </summary>
        /// <param name="package"></param>
        private void PrivateInit(XSharpProjectPackage package)
        {
            myPackage = package;
            loading = false;
            gettingCheckoutStatus = false;
            trackSel = null;

            Control.CheckForIllegalCrossThreadCalls = false;
            // Create an ArrayList to store the objects that can be selected
            ArrayList listObjects = new ArrayList();

            // Create the object that will show the document's properties
            // on the properties window.
            VOEditorProperties prop = new VOEditorProperties(this);
            listObjects.Add(prop);

            // Create the SelectionContainer object.
            selContainer = new Microsoft.VisualStudio.Shell.SelectionContainer(true, false);
            selContainer.SelectableObjects = listObjects;
            selContainer.SelectedObjects = listObjects;

            // Create and initialize the editor

            this.editorControl = new VOWEDControl();
            this.editorControl.IsDirtyChanged = new EventHandler(IsDirtyChangedHandler);
            this.editorControl.TriggerSave = new EventHandler(TriggerSaveHandler);

            setupCommands();
            this.editorControl.StatusBarMessage = new StatusBarMessageDelegate(StatusBarMessageHandler);
        }
            private void OnContextDisposing(object sender, EventArgs e)
            {
                var context = (EditingContext)sender;

                if (_selectionContainer != null)
                {
                    _selectionContainer.Dispose();
                    _selectionContainer = null;
                }

                if (_explorerFrame != null)
                {
                    _explorerFrame.Dispose();
                    _explorerFrame = null;
                }

                context.Items.SetValue(new ExplorerInfo());
                context.Disposing -= OnContextDisposing;
            }
            internal void SetExplorerInfo(ExplorerFrame explorerFrame, SelectionContainer<ExplorerSelection> selectionContainer)
            {
                _explorerFrame = explorerFrame;
                _selectionContainer = selectionContainer;

                var context = explorerFrame.Context;
                context.Disposing += OnContextDisposing;
                context.Items.SetValue(this);
            }
        private void TrackSelection(string nodeType, int id)
        {
            ShowPropertiesFrame();

            if (_mySelContainer == null)
            {
                _mySelContainer = new SelectionContainer();
            }

            _mySelItems = new ArrayList();

            if (string.IsNullOrEmpty(nodeType) == false && id != default(int))
            {
                var model = UmbracoApplicationContext.Current.GetPropertiesModel(nodeType, id);
                _mySelItems.Add(model);
            }

            _mySelContainer.SelectedObjects = _mySelItems;

            //Must use the GetService of the Window to get the ITrackSelection reference
            var track = _parentWindow.GetServiceHelper(typeof(STrackSelection)) as ITrackSelection;
            if (track != null)
            {
                track.OnSelectChange(_mySelContainer);
            }
        }
        private void treeView_AfterSelect(object sender, TreeViewEventArgs e)
        {
            ArrayList properties = new ArrayList();

            if (e.Node.Tag is DocumentPart)
            {
                // get the part
                DocumentPart docPart = (DocumentPart)e.Node.Tag;

                properties.Add(docPart);

                if (curHistory == null)
                {
                    // no history yet
                    curHistory = history.AddLast(docPart);
                }
                else
                {
                    // history exists
                    if (curHistory.Value != docPart)
                    {
                        // new part is *not* the current history position
                        LinkedListNode<DocumentPart> last = history.Last;
                        if (curHistory != last)
                        {
                            // remove items from here to the end
                            while (curHistory != last)
                            {
                                history.RemoveLast();
                                last = history.Last;
                            }
                        }
                        curHistory = history.AddLast(docPart);
                    }
                }
                if (history.Count > maxHistory)
                    history.RemoveFirst();

                // update command state
                this.buttonBack.Enabled = (curHistory != history.First);
                this.buttonForward.Enabled = (curHistory != history.Last);
                this.buttonHistory.Enabled = true;

                this.buttonNewFolder.Enabled = false;
                this.buttonAddXmlPart.Enabled = false;
                this.buttonAddImagePart.Enabled = false;
                this.buttonAddInternalRel.Enabled = true;
                this.buttonAddExternalRel.Enabled = true;
                this.buttonProps.Enabled = true;
                this.buttonImport.Enabled = true;
                this.buttonExport.Enabled = true;
                this.buttonEditPart.Enabled = true;
                this.buttonDeletePart.Enabled = true;

                this.treeView.ContextMenuStrip = this.contextMenuPart;
            }
            else if (e.Node.Tag is PackageRelationship)
            {
                PackageRelationship rel = e.Node.Tag as PackageRelationship;
                DocumentRelationship docRel = new DocumentRelationship(rel);
                properties.Add(docRel);

                // update command state
                this.buttonNewFolder.Enabled = false;
                this.buttonAddXmlPart.Enabled = false;
                this.buttonAddImagePart.Enabled = false;
                this.buttonAddInternalRel.Enabled = false;
                this.buttonAddExternalRel.Enabled = false;
                this.buttonProps.Enabled = true;
                this.buttonImport.Enabled = false;
                this.buttonExport.Enabled = false;
                this.buttonEditPart.Enabled = false;
                this.buttonDeletePart.Enabled = true;

                this.treeView.ContextMenuStrip = this.contextMenuRel;
            }
            else if (e.Node.Tag is DocumentPackage)
            {
                DocumentPackage doc = e.Node.Tag as DocumentPackage;
                properties.Add(doc);

                // update command state
                this.buttonNewFolder.Enabled = true;
                this.buttonAddXmlPart.Enabled = true;
                this.buttonAddImagePart.Enabled = true;
                this.buttonAddInternalRel.Enabled = true;
                this.buttonAddExternalRel.Enabled = true;
                this.buttonProps.Enabled = true;
                this.buttonImport.Enabled = false;
                this.buttonExport.Enabled = false;
                this.buttonEditPart.Enabled = false;
                this.buttonDeletePart.Enabled = false;

                this.treeView.ContextMenuStrip = this.contextMenuDoc;
            }
            else // folder
            {
                // update command state
                this.buttonNewFolder.Enabled = true;
                this.buttonAddXmlPart.Enabled = true;
                this.buttonAddImagePart.Enabled = true;
                this.buttonAddInternalRel.Enabled = false;
                this.buttonAddExternalRel.Enabled = false;
                this.buttonProps.Enabled = false;
                this.buttonImport.Enabled = false;
                this.buttonExport.Enabled = false;
                this.buttonEditPart.Enabled = false;
                this.buttonDeletePart.Enabled = true;

                this.treeView.ContextMenuStrip = this.contextMenuFolder;
            }

            // update the Properties Window
            selContainer = new SelectionContainer(false, false);
            selContainer.SelectableObjects = properties;
            selContainer.SelectedObjects = properties;

            ITrackSelection track = TrackSelection;
            if (track != null)
                track.OnSelectChange((ISelectionContainer)selContainer);
        }
        /// <summary>
        /// The event explorer user control constructor.
        /// </summary>
        public RdtEventControl()
        {
            InitializeComponent();

            // Create a selection container for tracking selected RDT events.
            selectionContainer = new MsVsShell.SelectionContainer();

            // Advise the RDT of this event sink.
            IOleServiceProvider sp =
                Package.GetGlobalService(typeof(IOleServiceProvider)) as IOleServiceProvider;
            if (sp == null) return;

            rdt = new RunningDocumentTable(new ServiceProvider(sp));
            if (rdt == null) return;

            rdtCookie = rdt.Advise(this);

            // Obtain the single instance of the options via automation.
            try
            {
                DTE dte = (DTE)Package.GetGlobalService(typeof(DTE));

                EnvDTE.Properties props =
                   dte.get_Properties("RDT Event Explorer", "Explorer Options");

                IOptions o = props.Item("ContainedOptions").Object as IOptions;
                options = (Options)o;
            }
            catch
            {
                IVsActivityLog log = Package.GetGlobalService(
                    typeof(SVsActivityLog)) as IVsActivityLog;
                if (log != null)
                {

                    log.LogEntry(
                        (UInt32)__ACTIVITYLOG_ENTRYTYPE.ALE_INFORMATION,
                        this.ToString(),
                        string.Format(CultureInfo.CurrentCulture,
                            "RdtEventExplorer could not obtain properties via automation: {0}",
                            this.ToString())
                    );
                }
                options = new Options();
            }
            // Prepare the event grid.
            eventGrid.AutoGenerateColumns = false;
            eventGrid.AllowUserToAddRows = false;
            eventGrid.SelectionMode = DataGridViewSelectionMode.FullRowSelect;

            eventGrid.Columns.Add("Event", Resources.EventHeader);
            eventGrid.Columns.Add("Moniker", Resources.MonikerHeader);
            eventGrid.Columns["Event"].ReadOnly = true;
            eventGrid.Columns["Moniker"].ReadOnly = true;

            eventGrid.AllowUserToResizeRows = false;
            eventGrid.AllowUserToResizeColumns = true;
            eventGrid.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;

            int x = Screen.PrimaryScreen.Bounds.Size.Width;
            int y = Screen.PrimaryScreen.Bounds.Size.Height;
            Size = new Size(x / 3, y / 3);
        }
Example #22
0
 /// <summary>
 /// Replaces the collection of objects who's values are displayed in the Properties window.
 /// </summary>
 /// <param name="items"></param>
 public void UpdateSelectionList(params Object[] items)
 {
     _selectionContainer = new SelectionContainer(true, false);
     _selectionContainer.SelectableObjects = items;
     _selectionContainer.SelectedObjects = items;
     ApplySelection();
 }
        /// <summary>
        /// Initialization of the package; this method is called right after the package is sited, so this is the place
        /// where you can put all the initialization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override void Initialize()
        {
            Debug.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString()));
            base.Initialize();

            // Add our command handlers for menu (commands must exist in the .vsct file)
            OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;
            if (null != mcs)
            {
                // Create the Refresh Command and its handler
                CommandID refreshCommandID = new CommandID(GuidList.guidVSPackageGDBACmdSet, (int)PkgCmdIDList.cmdidRefreshContextMenu);
                MenuCommand menuRefresh = new MenuCommand(RefreshCommandCallBack, refreshCommandID);
                mcs.AddCommand(menuRefresh);

                // Create the command for the tool window for the RDT Event List
                CommandID toolwndCommandID = new CommandID(GuidList.guidRdtEventExplorerCmdSet, (int)PkgCmdIDList.cmdidMyTool);
                MenuCommand menuToolWin = new MenuCommand(new EventHandler(ShowToolWindow), toolwndCommandID);
                mcs.AddCommand(menuToolWin);
            }

            //Alternative method
            //uint dwCookie = 0;
            //IVsRunningDocumentTable rdt2 = (IVsRunningDocumentTable)Package.GetGlobalService(typeof(SVsRunningDocumentTable));
            //rdt2.AdviseRunningDocTableEvents(this, out dwCookie);

            // Create a selection container for tracking selected RDT events.
            selectionContainer = new Microsoft.VisualStudio.Shell.SelectionContainer();

            // Advise the RDT of this event sink.
            Microsoft.VisualStudio.OLE.Interop.IServiceProvider sp = Package.GetGlobalService(typeof(Microsoft.VisualStudio.OLE.Interop.IServiceProvider)) as Microsoft.VisualStudio.OLE.Interop.IServiceProvider;
            if (sp == null) return;

            rdt = new RunningDocumentTable(new ServiceProvider(sp));
            if (rdt == null) return;

            rdtCookie = rdt.Advise(this);
        }
Example #24
0
        private void InitSelection()
        {
            // Create the object that will show the document's properties
            // on the properties window.
            _editorProperties = new EditorProperties(this);
            _selectableObjects.Add(_editorProperties);
            _selectedObjects.Add(_editorProperties);

            // Create the SelectionContainer object.
            _selContainer = new Microsoft.VisualStudio.Shell.SelectionContainer(true, false);
            _selContainer.SelectableObjects = _selectableObjects;
            _selContainer.SelectedObjects = _selectedObjects;

            Designer.Blocks.CollectionChanged += Blocks_CollectionChanged;
            Designer.Relations.CollectionChanged += Relations_CollectionChanged;
            Designer.SelectionChanged += Designer_SelectionChanged;
        }
Example #25
0
        /// <summary>
        /// Initialization routine for the Editor. Loads the list of properties for the resx-aggregator document 
        /// which will show up in the properties window 
        /// </summary>
        /// <param name="package"></param>
        private void PrivateInit(ResX_AggregatorPackage package)
        {
            myPackage = package;
            loading = false;
            gettingCheckoutStatus = false;
            trackSel = null;

            Control.CheckForIllegalCrossThreadCalls = false;
            // Create an ArrayList to store the objects that can be selected
            ArrayList listObjects = new ArrayList();

            // Create the object that will show the document's properties
            // on the properties window.
            EditorProperties prop = new EditorProperties(this);
            listObjects.Add(prop);

            // Create the SelectionContainer object.
            selContainer = new Microsoft.VisualStudio.Shell.SelectionContainer(true, false);
            selContainer.SelectableObjects = listObjects;
            selContainer.SelectedObjects = listObjects;

            // Create and initialize the editor

            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(EditorPane));
            this.editorControl = new MyEditor();

            resources.ApplyResources(this.editorControl, "editorControl", CultureInfo.CurrentUICulture);
            // Event handlers for macro recording.
            this.editorControl.RichTextBoxControl.TextChanged += new System.EventHandler(this.OnTextChange);
            this.editorControl.RichTextBoxControl.MouseDown += new MouseEventHandler(this.OnMouseClick);
            this.editorControl.RichTextBoxControl.SelectionChanged += new EventHandler(this.OnSelectionChanged);
            this.editorControl.RichTextBoxControl.KeyDown += new KeyEventHandler(this.OnKeyDown);
            
            // Handle Focus event
            this.editorControl.RichTextBoxControl.GotFocus += new EventHandler(this.OnGotFocus);
            
            // Call the helper function that will do all of the command setup work
            setupCommands();
        }
Example #26
0
        /// <summary>
        /// Initialization routine for the Editor. Loads the list of properties for the pnml document 
        /// which will show up in the properties window 
        /// </summary>
        /// <param name="package"></param>
        private void PrivateInit(PetrifierPackage package)
        {
            this.package = package;
            loading = false;
            gettingCheckoutStatus = false;
            trackSel = null;

            Control.CheckForIllegalCrossThreadCalls = false;
            // Create an ArrayList to store the objects that can be selected
            ArrayList listObjects = new ArrayList();

            // Create the object that will show the document's properties
            // on the properties window.
            EditorProperties prop = new EditorProperties(this);
            listObjects.Add(prop);

            // Create the SelectionContainer object.
            selContainer = new Microsoft.VisualStudio.Shell.SelectionContainer(true, false);
            selContainer.SelectableObjects = listObjects;
            selContainer.SelectedObjects = listObjects;

            // Create and initialize the editor

            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PetriNetEditorPane));
            editorControl = new PetriNetDesigner();
            editorControl.SelectionChanged += (sender, args) => { isDirty = true; RefreshObjectSelection(); };

            resources.ApplyResources(this.editorControl, "editorControl", CultureInfo.CurrentUICulture);

            // Call the helper function that will do all of the command setup work
            setupCommands();
        }
Example #27
0
 public void SelectList(ArrayList list)
 {
     selectionContainer = new Microsoft.VisualStudio.Shell.SelectionContainer(true, false);
     selectionContainer.SelectableObjects = list;
     selectionContainer.SelectedObjects = list;
     UpdateSelection();
 }
        // http://msdn.microsoft.com/en-us/library/cc138529.aspx
        private void TrackSelection(object info)
        {
            ShowPropertiesFrame();

            if (mySelContainer == null)
            {
                mySelContainer = new SelectionContainer();
            }

            mySelItems = new System.Collections.ArrayList();

            if (info != null)
            {
                mySelItems.Add(info);
            }

            mySelContainer.SelectedObjects = mySelItems;

            //Must use the GetService of the Window to get the ITrackSelection reference
            var track = _parentWindow.GetServiceHelper(typeof(STrackSelection)) as ITrackSelection;
            if (track != null)
            {
                track.OnSelectChange(mySelContainer);
            }
        }
        private void SetSelectionContainer()
        {
            // Create an ArrayList to store the objects that can be selected
            ArrayList listObjects = new ArrayList();

            //Add a custom type provider to filter the properties
            TypeDescriptor.AddProvider(new SelectedTextSymbolTypeDescriptorProvider(typeof(SelectedTextSymbol)), typeof(SelectedTextSymbol));

            // Create the object that will show the document's properties
            // on the properties window.
            listObjects.Add(textInformationManager.SelectedSymbol);

            // Create the SelectionContainer object.
            selContainer = new SelectionContainer(true, false);
            selContainer.SelectableObjects = listObjects;
            selContainer.SelectedObjects = listObjects;
        }
Example #30
0
        /// <summary>
        /// Initialization routine for the Editor. Loads the list of properties for the xml document 
        /// which will show up in the properties window 
        /// </summary>
        /// <param name="package"></param>
        private void PrivateInit(PowerShellToolsPackage package, string fileName)
        {
            myPackage = package;
            loading = false;
            gettingCheckoutStatus = false;
            trackSel = null;

            Control.CheckForIllegalCrossThreadCalls = false;
            // Create an ArrayList to store the objects that can be selected
            ArrayList listObjects = new ArrayList();

            // Create the object that will show the document's properties
            // on the properties window.
            EditorProperties prop = new EditorProperties(this);
            listObjects.Add(prop);

            // Create the SelectionContainer object.
            selContainer = new Microsoft.VisualStudio.Shell.SelectionContainer(true, false);
            selContainer.SelectableObjects = listObjects;
            selContainer.SelectedObjects = listObjects;

            // Create and initialize the editor

            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(EditorPane));
            this.editorControl = new EditorControl(fileName);

            resources.ApplyResources(this.editorControl, "editorControl", CultureInfo.CurrentUICulture);
        }
Example #31
0
        /// <summary>
        /// The event explorer user control constructor.
        /// </summary>
        public RdtEventControl()
        {
            InitializeComponent();

            // Create a selection container for tracking selected RDT events.
            selectionContainer = new MsVsShell.SelectionContainer();

            // Advise the RDT of this event sink.
            IOleServiceProvider sp =
                Package.GetGlobalService(typeof(IOleServiceProvider)) as IOleServiceProvider;

            if (sp == null)
            {
                return;
            }

            rdt = new RunningDocumentTable(new ServiceProvider(sp));
            if (rdt == null)
            {
                return;
            }

            rdtCookie = rdt.Advise(this);

            // Obtain the single instance of the options via automation.
            try
            {
                DTE dte = (DTE)Package.GetGlobalService(typeof(DTE));

                EnvDTE.Properties props =
                    dte.get_Properties("RDT Event Explorer", "Explorer Options");

                IOptions o = props.Item("ContainedOptions").Object as IOptions;
                options = (Options)o;
            }
            catch
            {
                IVsActivityLog log = Package.GetGlobalService(
                    typeof(SVsActivityLog)) as IVsActivityLog;
                if (log != null)
                {
                    log.LogEntry(
                        (UInt32)__ACTIVITYLOG_ENTRYTYPE.ALE_INFORMATION,
                        this.ToString(),
                        string.Format(CultureInfo.CurrentCulture,
                                      "RdtEventExplorer could not obtain properties via automation: {0}",
                                      this.ToString())
                        );
                }
                options = new Options();
            }
            // Prepare the event grid.
            eventGrid.AutoGenerateColumns = false;
            eventGrid.AllowUserToAddRows  = false;
            eventGrid.SelectionMode       = DataGridViewSelectionMode.FullRowSelect;

            eventGrid.Columns.Add("Event", Resources.EventHeader);
            eventGrid.Columns.Add("Moniker", Resources.MonikerHeader);
            eventGrid.Columns["Event"].ReadOnly   = true;
            eventGrid.Columns["Moniker"].ReadOnly = true;

            eventGrid.AllowUserToResizeRows    = false;
            eventGrid.AllowUserToResizeColumns = true;
            eventGrid.AutoSizeColumnsMode      = DataGridViewAutoSizeColumnsMode.Fill;

            int x = Screen.PrimaryScreen.Bounds.Size.Width;
            int y = Screen.PrimaryScreen.Bounds.Size.Height;

            Size = new Size(x / 3, y / 3);
        }
Example #32
0
        /// <summary>
        /// Initialization routine for the editor. Loads the list of properties for the nuset document
        ///     which will show up in the properties window
        /// </summary>
        /// <param name="package">
        /// The package
        /// </param>
        private void PrivateInit(NuSetPackage package)
        {
            this.myPackage = package;
            this.editorIsLoading = false;
            this.editorIsGettingCheckoutStatus = false;
            this.trackSelection = null;

            Control.CheckForIllegalCrossThreadCalls = false;

            // Create an ArrayList to store the objects that can be selected
            var listObjects = new ArrayList();

            // Create the object that will show the document's properties
            // on the properties window.
            var prop = new EditorProperties(this);
            listObjects.Add(prop);

            // Create the SelectionContainer object.
            this.selectionContainer = new SelectionContainer(true, false)
                                          {
                                              SelectableObjects = listObjects, 
                                              SelectedObjects = listObjects
                                          };

            // Create and initialize the editor
            var resources = new ComponentResourceManager(typeof(EditorPane));
            this.EditorControl = new MyEditor();

            resources.ApplyResources(this.EditorControl, "EditorControl", CultureInfo.CurrentUICulture);

            // Event handlers for macro recording.
            this.EditorControl.RichTextBoxControl.TextChanged += this.OnTextChange;
            this.EditorControl.RichTextBoxControl.MouseDown += this.OnMouseClick;
            this.EditorControl.RichTextBoxControl.SelectionChanged += this.OnSelectionChanged;
            this.EditorControl.RichTextBoxControl.KeyDown += this.OnKeyDown;

            // Handle Focus event
            this.EditorControl.RichTextBoxControl.GotFocus += this.OnGotFocus;

            // Call the helper function that will do all of the command setup work
            this.SetupCommands();
        }
Example #33
0
        /// <summary>
        /// Initialize the propery window by createing the codeWindowHost properties class and a selection container
        /// </summary>
        private void InitializePropertiesWindow()
        {
            trackSel = null;
            // Create an ArrayList to store the objects that can be selected
            ArrayList listObjects = new ArrayList();


            //Add a custom type provider to filter the properties
            TypeDescriptor.AddProvider(new FilteredPropertiesTypeDescriptorProvider(typeof (EditorProperties)), typeof (EditorProperties));

            // Create the object that will show the document's properties
            // on the properties window.
            EditorProperties prop = new EditorProperties(this);
            listObjects.Add(prop);

            // Create the SelectionContainer object.
            selContainer = new SelectionContainer(true, false);
            selContainer.SelectableObjects = listObjects;
            selContainer.SelectedObjects = listObjects;
        }
Example #34
0
        private void RefreshObjectSelection()
        {
            if (frame == null)
            {
                var shell = GetService(typeof(SVsUIShell)) as IVsUIShell;
                if (shell != null)
                {
                    var guidPropertyBrowser = new Guid(ToolWindowGuids.PropertyBrowser);
                    shell.FindToolWindow((uint)__VSFINDTOOLWIN.FTW_fForceCreate, ref guidPropertyBrowser, out frame);
                }
            }
            if (frame != null)
            {
                frame.Show();
            }
            if (selContainer == null)
            {
                selContainer = new Microsoft.VisualStudio.Shell.SelectionContainer();
            }

            var mySelItems = new ArrayList();

            var selected = editorControl.Editor.SelectedWidgets;
            if (selected != null && selected.Count > 0)
            {
                mySelItems.Add(selected[0].Element);
            }

            selContainer.SelectableObjects = selContainer.SelectedObjects = mySelItems;

            ITrackSelection track = TrackSelection;
            if (null != track)
            {
                track.OnSelectChange((ISelectionContainer)selContainer);
            }
        }