From: <mcu...@us...> - 2009-10-23 17:36:00
|
Revision: 1415 http://orm.svn.sourceforge.net/orm/?rev=1415&view=rev Author: mcurland Date: 2009-10-23 17:35:51 +0000 (Fri, 23 Oct 2009) Log Message: ----------- Add 'Select In Model Browser' command to complement other selection commands. fixes #400 * Switched DiagramSurvey nodes to use ISurveyNodeReference instead of IRepresentModelElements, allowing model browser to track DiagramNode/Diagram relationships. * ModelBrowser jumps to a reference if a primary location is not available. Modified Paths: -------------- trunk/ORMModel/Framework/Shell/DiagramSurvey.cs trunk/ORMModel/Framework/Shell/DynamicSurveyTreeGrid/MainList.cs trunk/ORMModel/Resources/ResourceStringsGenerator.cs trunk/ORMModel/Resources/ResourceStringsGenerator.xml trunk/ORMModel/ShapeModel/ORMDiagram.resx trunk/ORMModel/Shell/ORMCommandSet.cs trunk/ORMModel/Shell/ORMDesignerCommandManager.cs trunk/ORMModel/Shell/ORMDocDataServices.cs trunk/ORMModel/Shell/ORMDocView.cs trunk/ORMModel/Shell/PackageResources/PkgCmd.vsct Modified: trunk/ORMModel/Framework/Shell/DiagramSurvey.cs =================================================================== --- trunk/ORMModel/Framework/Shell/DiagramSurvey.cs 2009-10-17 01:56:46 UTC (rev 1414) +++ trunk/ORMModel/Framework/Shell/DiagramSurvey.cs 2009-10-23 17:35:51 UTC (rev 1415) @@ -2,7 +2,7 @@ /**************************************************************************\ * Natural Object-Role Modeling Architect for Visual Studio * * * -* Copyright \xA9 ORM Solutions, LLC. All rights reserved. * +* Copyright \xA9 ORM Solutions, LLC. All rights reserved. * * * * The use and distribution terms for this software are covered by the * * Common Public License 1.0 (http://opensource.org/licenses/cpl) which * @@ -43,9 +43,6 @@ /// </summary> public static readonly global::System.Guid DomainModelId = new global::System.Guid(0x52222B4A, 0x8155, 0x43E9, 0x8e, 0xc9, 0x66, 0xeb, 0x05, 0x60, 0x09, 0xf3); #endregion // Public constants - #region Member Variables - private Dictionary<Diagram, DiagramNode> myDiagramToNodeMap; - #endregion // Member Variables #region Constructor /// <summary> /// Required constructor for a domain model @@ -75,7 +72,7 @@ /// knowing about it, so we cannot implement anything directly on diagram. Use /// a thin wrapper class to put the diagram in the tree. /// </summary> - private sealed class DiagramNode : ISurveyNode, IAnswerSurveyQuestion<DiagramSurveyType>, IAnswerSurveyDynamicQuestion<DiagramGlyphSurveyType>, IRepresentModelElements + private sealed class DiagramNode : ISurveyNode, IAnswerSurveyQuestion<DiagramSurveyType>, IAnswerSurveyDynamicQuestion<DiagramGlyphSurveyType>, ISurveyNodeReference { #region Member variables and constructors private readonly Diagram myDiagram; @@ -156,12 +153,33 @@ } } #endregion // ISurveyNode Implementation - #region IRepresentModelElements Implementation - ModelElement[] IRepresentModelElements.GetRepresentedElements() + #region ISurveyNodeReference Implementation + object ISurveyNodeReference.SurveyNodeReferenceReason { - return new ModelElement[] { myDiagram }; + get + { + return typeof(DiagramNode); + } } - #endregion // IRepresentModelElements Implementation + SurveyNodeReferenceOptions ISurveyNodeReference.SurveyNodeReferenceOptions + { + get + { + return SurveyNodeReferenceOptions.BlockLinkDisplay | SurveyNodeReferenceOptions.BlockTargetNavigation; + } + } + bool ISurveyNodeReference.UseSurveyNodeReferenceAnswer(Type questionType, ISurveyDynamicValues dynamicValues, int answer) + { + return false; + } + object IElementReference.ReferencedElement + { + get + { + return myDiagram; + } + } + #endregion // ISurveyNodeReference implementation } #endregion // DiagramNode class #region ISurveyNodeProvider Implementation @@ -173,16 +191,13 @@ { if (expansionKey == null) { - Dictionary<Diagram, DiagramNode> diagramToNodeMap = myDiagramToNodeMap ?? (myDiagramToNodeMap = new Dictionary<Diagram, DiagramNode>()); Store store = Store; Partition defaultPartition = store.DefaultPartition; foreach (Diagram diagram in Store.ElementDirectory.FindElements<Diagram>(true)) { if (diagram.Partition == defaultPartition) { - DiagramNode node = new DiagramNode(diagram); - diagramToNodeMap.Add(diagram, node); - yield return node; + yield return new DiagramNode(diagram); } } } @@ -215,10 +230,6 @@ eventManager.AddOrRemoveHandler(classInfo, new EventHandler<ElementDeletedEventArgs>(DiagramRemovedEvent), action); DomainPropertyInfo propertyInfo = dataDirectory.FindDomainProperty(Diagram.NameDomainPropertyId); eventManager.AddOrRemoveHandler(propertyInfo, new EventHandler<ElementPropertyChangedEventArgs>(DiagramRenamedEvent), action); - if (action == EventHandlerAction.Remove) - { - myDiagramToNodeMap = null; - } } } #endregion // IModelingEventSubscriber Implementation @@ -232,43 +243,30 @@ (store = element.Store).DefaultPartition == element.Partition && null != (eventNotify = (store as IFrameworkServices).NotifySurveyElementChanged)) { - Diagram diagram = (Diagram)element; - DiagramNode node = new DiagramNode(diagram); - (myDiagramToNodeMap ?? (myDiagramToNodeMap = new Dictionary<Diagram, DiagramNode>())).Add(diagram, node); - eventNotify.ElementAdded(node, null); + eventNotify.ElementAdded(new DiagramNode((Diagram)element), null); } } private void DiagramRemovedEvent(object sender, ElementDeletedEventArgs e) { INotifySurveyElementChanged eventNotify; ModelElement element = e.ModelElement; - Dictionary<Diagram, DiagramNode> nodeMap; - DiagramNode node; - Diagram diagram; Store store; - if (null != (nodeMap = myDiagramToNodeMap) && - (store = element.Store).DefaultPartition == element.Partition && - null != (eventNotify = (store as IFrameworkServices).NotifySurveyElementChanged) && - nodeMap.TryGetValue(diagram = (Diagram)element, out node)) + if ((store = element.Store).DefaultPartition == element.Partition && + null != (eventNotify = (store as IFrameworkServices).NotifySurveyElementChanged)) { - nodeMap.Remove(diagram); - eventNotify.ElementDeleted(node); + eventNotify.ElementReferenceDeleted(element, typeof(DiagramNode), null); } } private void DiagramRenamedEvent(object sender, ElementPropertyChangedEventArgs e) { INotifySurveyElementChanged eventNotify; ModelElement element = e.ModelElement; - Dictionary<Diagram, DiagramNode> nodeMap; - DiagramNode node; Store store; if (!element.IsDeleted && - null != (nodeMap = myDiagramToNodeMap) && (store = element.Store).DefaultPartition == element.Partition && - null != (eventNotify = (store as IFrameworkServices).NotifySurveyElementChanged) && - nodeMap.TryGetValue((Diagram)element, out node)) + null != (eventNotify = (store as IFrameworkServices).NotifySurveyElementChanged)) { - eventNotify.ElementRenamed(node); + eventNotify.ElementReferenceRenamed(element, typeof(DiagramNode), null); } } #endregion // Event handlers Modified: trunk/ORMModel/Framework/Shell/DynamicSurveyTreeGrid/MainList.cs =================================================================== --- trunk/ORMModel/Framework/Shell/DynamicSurveyTreeGrid/MainList.cs 2009-10-17 01:56:46 UTC (rev 1414) +++ trunk/ORMModel/Framework/Shell/DynamicSurveyTreeGrid/MainList.cs 2009-10-23 17:35:51 UTC (rev 1415) @@ -3,7 +3,7 @@ * Natural Object-Role Modeling Architect for Visual Studio * * * * Copyright \xA9 Neumont University. All rights reserved. * -* Copyright \xA9 ORM Solutions, LLC. All rights reserved. * +* Copyright \xA9 ORM Solutions, LLC. All rights reserved. * * * * The use and distribution terms for this software are covered by the * * Common Public License 1.0 (http://opensource.org/licenses/cpl) which * @@ -658,8 +658,9 @@ ISurveyNodeContext nodeContext; object contextElement = null; MainList locatedList; - if (mySurveyTree.myNodeDictionary.TryGetValue(obj, out location) && - null != (locatedList = location.MainList)) + SurveyTree<SurveyContextType> surveyTree = mySurveyTree; + bool haveLocation = surveyTree.myNodeDictionary.TryGetValue(obj, out location); + if (haveLocation && null != (locatedList = location.MainList)) { if (locatedList == this) { @@ -677,6 +678,27 @@ { contextElement = nodeContext.SurveyNodeContext; } + else if (haveLocation) + { + // A reference to the element has been recorded, jump to it instead + LinkedNode<SurveyNodeReference> referenceNodeLink; + if (surveyTree.myReferenceDictionary.TryGetValue(obj, out referenceNodeLink)) + { + SurveyNodeReference referenceNode = referenceNodeLink.Value; + object referenceContext = referenceNode.ContextElement; + if (referenceContext == myContextElement) + { + if (0 <= (nodeIndex = myNodes.BinarySearch(referenceNode.Node, myNodeComparer))) + { + return new LocateObjectData(nodeIndex, 0, (int)TrackingObjectAction.ThisLevel); + } + } + else + { + contextElement = referenceContext; + } + } + } if (contextElement != null) { // This item is in an expansion, see if we can find the context element at this level Modified: trunk/ORMModel/Resources/ResourceStringsGenerator.cs =================================================================== --- trunk/ORMModel/Resources/ResourceStringsGenerator.cs 2009-10-17 01:56:46 UTC (rev 1414) +++ trunk/ORMModel/Resources/ResourceStringsGenerator.cs 2009-10-23 17:35:51 UTC (rev 1415) @@ -2636,6 +2636,14 @@ return ResourceStrings.GetString(ResourceManagers.Model, "ModelError.FactType.ImpliedInternalUniquenessConstraintError.Text"); } } + /// <summary>The message displayed if a selected item cannot be located in the model browser.</summary> + public static string ElementNotInModelBrowserMessage + { + get + { + return ResourceStrings.GetString(ResourceManagers.Diagram, "MessageBox.ElementNotInModelBrowser.Message"); + } + } /// <summary>The message for the auto-fix implied internal uniqueness constraint message box.</summary> public static string ImpliedInternalConstraintFixMessage { Modified: trunk/ORMModel/Resources/ResourceStringsGenerator.xml =================================================================== --- trunk/ORMModel/Resources/ResourceStringsGenerator.xml 2009-10-17 01:56:46 UTC (rev 1414) +++ trunk/ORMModel/Resources/ResourceStringsGenerator.xml 2009-10-23 17:35:51 UTC (rev 1415) @@ -379,6 +379,7 @@ <ResourceString name="ModelErrorFrequencyConstraintExactlyOneError" model="Model" resourceName="ModelError.Constraint.FrequencyConstraintExactlyOneError.Text"/> <ResourceString name="ModelVerbalizationWindowTitle" model="Model" resourceName="ModelVerbalization.WindowTitle"/> <ResourceString name="ModelErrorImpliedInternalUniquenessConstraintError" model="Model" resourceName="ModelError.FactType.ImpliedInternalUniquenessConstraintError.Text"/> + <ResourceString name="ElementNotInModelBrowserMessage" model="Diagram" resourceName="MessageBox.ElementNotInModelBrowser.Message"/> <ResourceString name="ImpliedInternalConstraintFixMessage" model="Diagram" resourceName="MessageBox.ImpliedInternalUniquenessConstraint.Message"/> <ResourceString name="FinalShapeDeletionMessage" model="Diagram" resourceName="MessageBox.FinalShapeDeletion.Message"/> <ResourceString name="FileFormatUpgradeMessage" model="Diagram" resourceName="MessageBox.FileFormatUpgrade.Message"/> Modified: trunk/ORMModel/ShapeModel/ORMDiagram.resx =================================================================== --- trunk/ORMModel/ShapeModel/ORMDiagram.resx 2009-10-17 01:56:46 UTC (rev 1414) +++ trunk/ORMModel/ShapeModel/ORMDiagram.resx 2009-10-23 17:35:51 UTC (rev 1415) @@ -386,17 +386,17 @@ AYABAQYAAYABAQYAAYABAQIAAYABAwIAAYABAQYAAYABAQoAAYABAw0AAQEBAAEBAQABAQGAAQEBgAED AcQBRwGAAQMBwAEDBv8B/AF/Cw== </value> - </data> - <data name="FactEditor.MissingRolePlayerFormatString"> - <value xml:space="preserve">[Missing_{0}]</value> - <comment xml:space="preserve">The format string for a missing role player in the FactEditor. The format string should not use parentheses, which are parsed by the FactEditor as reference modes.</comment> - </data> - <data name="FactEditor.UnqualifiedRolePlayerFormatString"> - <value xml:space="preserve">{0}</value> - <comment xml:space="preserve">The format string for a role player with no () qualifier in the FactEditor. Languages which should not rely on capitalization to delimit ObjectType names should put square braces around this format string.</comment> - </data> - <data name="FactEditor.QualifiedRolePlayerFormatString"> - <value xml:space="preserve">{0}({1})</value> + </data> + <data name="FactEditor.MissingRolePlayerFormatString"> + <value xml:space="preserve">[Missing_{0}]</value> + <comment xml:space="preserve">The format string for a missing role player in the FactEditor. The format string should not use parentheses, which are parsed by the FactEditor as reference modes.</comment> + </data> + <data name="FactEditor.UnqualifiedRolePlayerFormatString"> + <value xml:space="preserve">{0}</value> + <comment xml:space="preserve">The format string for a role player with no () qualifier in the FactEditor. Languages which should not rely on capitalization to delimit ObjectType names should put square braces around this format string.</comment> + </data> + <data name="FactEditor.QualifiedRolePlayerFormatString"> + <value xml:space="preserve">{0}({1})</value> <comment xml:space="preserve">The format string for a role player with a () qualifier in the FactEditor. The qualifier represents either a value type or a reference mode. Languages which should not rely on capitalization to delimit ObjectType names should put square braces around this format string.</comment> </data> <data name="FactEditorColors.Delimiter"> @@ -515,6 +515,10 @@ <value xml:space="preserve">Interpret Fact Editor Line</value> <comment xml:space="preserve">The transaction name used for changes made in response to committing a modified line in the fact editor. The text appears in the undo dropdown in the VS IDE.</comment> </data> + <data name="MessageBox.ElementNotInModelBrowser.Message"> + <value xml:space="preserve">The selected item is not represented in the ORM Model Browser.</value> + <comment xml:space="preserve">The message displayed if a selected item cannot be located in the model browser.</comment> + </data> <data name="MessageBox.RevertExtensions.Message"> <value xml:space="preserve">Restoring previous model state, loading new extensions faileds with exception:
</value> <comment xml:space="preserve">The header for the message displayed if a set of extensions fails to correctly reload.</comment> @@ -531,11 +535,11 @@ <value xml:space="preserve">The final shape corresponding to this element is being deleted. Delete the underlying '{0}' element '{1}' as well?</value> <comment xml:space="preserve">The message for the prompt to delete an element from the model when the final shape representing it is delete. Replacement field 0 gets the class name and 1 the component name.</comment> </data> - <data name="MessageBox.UnrecognizedExtensionsStripped.Message"> - <value xml:space="preserve">The file format of '{0}' contains unsupported extensions.
Data associated with extension(s) '{1}' has been removed.
Should the 'Save' command be disabled to preserve the original file contents? The 'Save As' command will remain enabled.</value> - <comment xml:space="preserve">The message shown when extensions are automatically removed from a file. Replacements: {0}=file name, {1}=list of unrecognized extensions.</comment> - </data> - <data name="ModelErrorDisplayFilterChange.TransactionName"> + <data name="MessageBox.UnrecognizedExtensionsStripped.Message"> + <value xml:space="preserve">The file format of '{0}' contains unsupported extensions.
Data associated with extension(s) '{1}' has been removed.
Should the 'Save' command be disabled to preserve the original file contents? The 'Save As' command will remain enabled.</value> + <comment xml:space="preserve">The message shown when extensions are automatically removed from a file. Replacements: {0}=file name, {1}=list of unrecognized extensions.</comment> + </data> + <data name="ModelErrorDisplayFilterChange.TransactionName"> <value xml:space="preserve">Change Error Display</value> <comment xml:space="preserve">The transaction name used by the model error display filter dialog when a filter is changed. The text appears in the undo dropdown in the VS IDE.</comment> </data> Modified: trunk/ORMModel/Shell/ORMCommandSet.cs =================================================================== --- trunk/ORMModel/Shell/ORMCommandSet.cs 2009-10-17 01:56:46 UTC (rev 1414) +++ trunk/ORMModel/Shell/ORMCommandSet.cs 2009-10-23 17:35:51 UTC (rev 1415) @@ -285,6 +285,10 @@ new EventHandler(OnMenuSelectInDiagramSpy), ORMDesignerCommandIds.SelectInDiagramSpy) ,new DynamicStatusMenuCommand( + new EventHandler(OnStatusSelectInModelBrowser), + new EventHandler(OnMenuSelectInModelBrowser), + ORMDesignerCommandIds.SelectInModelBrowser) + ,new DynamicStatusMenuCommand( new EventHandler(OnStatusSelectInDocumentWindow), new EventHandler(OnMenuSelectInDocumentWindow), ORMDesignerCommandIds.SelectInDocumentWindow) @@ -1109,6 +1113,24 @@ /// <summary> /// Status callback /// </summary> + protected void OnStatusSelectInModelBrowser(object sender, EventArgs e) + { + ORMDesignerCommandManager.OnStatusCommand(sender, CurrentORMView, ORMDesignerCommands.SelectInModelBrowser); + } + /// <summary> + /// Menu handler + /// </summary> + protected void OnMenuSelectInModelBrowser(object sender, EventArgs e) + { + IORMDesignerView designerView = CurrentORMView; + if (designerView != null) + { + designerView.CommandManager.OnMenuSelectInModelBrowser(); + } + } + /// <summary> + /// Status callback + /// </summary> protected void OnStatusSelectInDocumentWindow(object sender, EventArgs e) { ORMDesignerCommandManager.OnStatusCommand(sender, CurrentORMView, ORMDesignerCommands.SelectInDocumentWindow); @@ -1771,6 +1793,10 @@ /// </summary> public static readonly CommandID SelectInDocumentWindow = new CommandID(guidORMDesignerCommandSet, cmdIdSelectInDocumentWindow); /// <summary> + /// Activate the selected display element in the model browser. + /// </summary> + public static readonly CommandID SelectInModelBrowser = new CommandID(guidORMDesignerCommandSet, cmdIdSelectInModelBrowser); + /// <summary> /// Available if free form context commands are supported for the current selection /// </summary> public static readonly CommandID FreeFormCommandList = new CommandID(guidORMDesignerCommandSet, cmdIdFreeFormCommandList); @@ -2058,6 +2084,10 @@ /// </summary> private const int cmdIdIncludeInNewGroup = 0x2931; /// <summary> + /// Activate the selected display element in the model browser. + /// </summary> + private const int cmdIdSelectInModelBrowser = 0x2932; + /// <summary> /// The context menu item for related diagrams, targeted to the diagram spy /// </summary> private const int cmdIdDiagramSpyDiagramList = 0x2d00; Modified: trunk/ORMModel/Shell/ORMDesignerCommandManager.cs =================================================================== --- trunk/ORMModel/Shell/ORMDesignerCommandManager.cs 2009-10-17 01:56:46 UTC (rev 1414) +++ trunk/ORMModel/Shell/ORMDesignerCommandManager.cs 2009-10-23 17:35:51 UTC (rev 1415) @@ -3,7 +3,7 @@ * Natural Object-Role Modeling Architect for Visual Studio * * * * Copyright \xA9 Neumont University. All rights reserved. * -* Copyright \xA9 ORM Solutions, LLC. All rights reserved. * +* Copyright \xA9 ORM Solutions, LLC. All rights reserved. * * * * The use and distribution terms for this software are covered by the * * Common Public License 1.0 (http://opensource.org/licenses/cpl) which * @@ -954,8 +954,8 @@ enabledCommands |= ORMDesignerCommands.IncludeInNewGroup | ORMDesignerCommands.IncludeInGroupList | ORMDesignerCommands.DeleteFromGroupList; } // Turn on standard commands for all selections - visibleCommands |= ORMDesignerCommands.DisplayStandardWindows | ORMDesignerCommands.CopyImage | ORMDesignerCommands.SelectAll | ORMDesignerCommands.ExtensionManager | ORMDesignerCommands.ErrorList | ORMDesignerCommands.ReportGeneratorList | ORMDesignerCommands.FreeFormCommandList; - enabledCommands |= ORMDesignerCommands.DisplayStandardWindows | ORMDesignerCommands.CopyImage | ORMDesignerCommands.SelectAll | ORMDesignerCommands.ExtensionManager | ORMDesignerCommands.ErrorList | ORMDesignerCommands.ReportGeneratorList | ORMDesignerCommands.FreeFormCommandList; + visibleCommands |= ORMDesignerCommands.DisplayStandardWindows | ORMDesignerCommands.CopyImage | ORMDesignerCommands.SelectAll | ORMDesignerCommands.ExtensionManager | ORMDesignerCommands.ErrorList | ORMDesignerCommands.ReportGeneratorList | ORMDesignerCommands.FreeFormCommandList | ORMDesignerCommands.SelectInModelBrowser; + enabledCommands |= ORMDesignerCommands.DisplayStandardWindows | ORMDesignerCommands.CopyImage | ORMDesignerCommands.SelectAll | ORMDesignerCommands.ExtensionManager | ORMDesignerCommands.ErrorList | ORMDesignerCommands.ReportGeneratorList | ORMDesignerCommands.FreeFormCommandList | ORMDesignerCommands.SelectInModelBrowser; } private static void UpdateMoveRoleCommandStatus(FactTypeShape factShape, Role role, ref ORMDesignerCommands visibleCommands, ref ORMDesignerCommands enabledCommands) { @@ -2582,6 +2582,41 @@ } } /// <summary> + /// Select the current item in the model browser window + /// </summary> + public virtual void OnMenuSelectInModelBrowser() + { + IORMToolServices toolServices; + DiagramView designer; + DiagramItem diagramItem; + if (null != (designer = myDesignerView.CurrentDesigner) && + null != (diagramItem = designer.DiagramClientView.Selection.PrimaryItem) && + null != (toolServices = myDesignerView.Store as IORMToolServices)) + { + object targetElement = null; + foreach (object element in diagramItem.RepresentedElements) + { + targetElement = element; + break; + } + if (targetElement != null) + { + if (!(targetElement is Diagram)) + { + targetElement = EditorUtility.ResolveContextInstance(targetElement, false); + } + if (!toolServices.NavigateTo(targetElement, NavigateToWindow.ModelBrowser)) + { + IServiceProvider provider; + if (null != (provider = toolServices.ServiceProvider)) + { + VsShellUtilities.ShowMessageBox(provider, ResourceStrings.ElementNotInModelBrowserMessage, ResourceStrings.PackageOfficialName, OLEMSGICON.OLEMSGICON_INFO, OLEMSGBUTTON.OLEMSGBUTTON_OK, OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST); + } + } + } + } + } + /// <summary> /// Select the current item in a view of the current document window /// </summary> public virtual void OnMenuSelectInDocumentWindow() Modified: trunk/ORMModel/Shell/ORMDocDataServices.cs =================================================================== --- trunk/ORMModel/Shell/ORMDocDataServices.cs 2009-10-17 01:56:46 UTC (rev 1414) +++ trunk/ORMModel/Shell/ORMDocDataServices.cs 2009-10-23 17:35:51 UTC (rev 1415) @@ -2186,52 +2186,48 @@ VirtualTreeControl treeControl = null; while (element != null) { - if (element is ISurveyNode) + if (treeControl == null) { - // Assume if we're a SurveyNode that it is possible to select the item in the survey tree - if (treeControl == null) + // Make sure a docview associated with the current model is + // active. Otherwise, the model browser will not contain the + // correct tree. + if (!haveCurrentDesigner) { - // Make sure a docview associated with the current model is - // active. Otherwise, the model browser will not contain the - // correct tree. - if (!haveCurrentDesigner) + haveCurrentDesigner = true; + GetCurrentDesigner(ref currentDocView, ref currentDesigner); + } + if (currentDocView == null || currentDocView.DocData != this) + { + if (null == ActivateView(null)) { - haveCurrentDesigner = true; - GetCurrentDesigner(ref currentDocView, ref currentDesigner); - } - if (currentDocView == null || currentDocView.DocData != this) - { - if (null == ActivateView(null)) - { - return false; - } - } - // UNDONE: See if we can get the tree control without forcing the window to show - // This is safe, but gives weird results if the initial item cannot be found. - ORMModelBrowserToolWindow browserWindow; - SurveyTreeContainer treeContainer; - if (null != (browserWindow = ORMDesignerPackage.ORMModelBrowserWindow)) - { - browserWindow.Show(); - if (null != (treeContainer = browserWindow.Window as SurveyTreeContainer)) - { - treeControl = treeContainer.TreeControl; - } - } - if (null == treeControl) - { return false; } } - if (treeControl.SelectObject(null, element, (int)ObjectStyle.TrackingObject, 0)) + // UNDONE: See if we can get the tree control without forcing the window to show + // This is safe, but gives weird results if the initial item cannot be found. + ORMModelBrowserToolWindow browserWindow; + SurveyTreeContainer treeContainer; + if (null != (browserWindow = ORMDesignerPackage.ORMModelBrowserWindow)) { - if (modelError != null) + browserWindow.Show(); + if (null != (treeContainer = browserWindow.Window as SurveyTreeContainer)) { - ModelErrorActivationService.ActivateError(element, modelError); + treeControl = treeContainer.TreeControl; } - return true; } + if (null == treeControl) + { + return false; + } } + if (treeControl.SelectObject(null, element, (int)ObjectStyle.TrackingObject, 0)) + { + if (modelError != null) + { + ModelErrorActivationService.ActivateError(element, modelError); + } + return true; + } ModelElement currentElement = element; element = null; // If we could not select the current element, then go up the aggregation chain Modified: trunk/ORMModel/Shell/ORMDocView.cs =================================================================== --- trunk/ORMModel/Shell/ORMDocView.cs 2009-10-17 01:56:46 UTC (rev 1414) +++ trunk/ORMModel/Shell/ORMDocView.cs 2009-10-23 17:35:51 UTC (rev 1415) @@ -268,6 +268,10 @@ /// </summary> DeleteFromGroupList = 1L << 52, /// <summary> + /// Activate the current selection in the model browser window + /// </summary> + SelectInModelBrowser = 1L << 53, + /// <summary> /// Mask field representing individual delete commands /// </summary> Delete = DeleteObjectType | DeleteFactType | DeleteConstraint | DeleteRole | DeleteModelNote | DeleteModelNoteReference | DeleteGroup | RemoveFromGroup, Modified: trunk/ORMModel/Shell/PackageResources/PkgCmd.vsct =================================================================== --- trunk/ORMModel/Shell/PackageResources/PkgCmd.vsct 2009-10-17 01:56:46 UTC (rev 1414) +++ trunk/ORMModel/Shell/PackageResources/PkgCmd.vsct 2009-10-23 17:35:51 UTC (rev 1415) @@ -590,6 +590,16 @@ </Strings> </Button> + <Button guid="guidORMDesignerCommandSet" id="cmdIdSelectInModelBrowser" priority="0x0500" type="Button"> + <Parent guid="guidORMDesignerCommandSet" id="groupIdSelectCommands"/> + <Icon guid="guidORMToolWindowIcons" id="bmpIdToolWindowModelBrowser"/> + <CommandFlag>DefaultInvisible</CommandFlag> + <CommandFlag>DynamicVisibility</CommandFlag> + <Strings> + <ButtonText>Select in M&odel Browser</ButtonText> + </Strings> + </Button> + <Button guid="guidORMDesignerCommandSet" id="cmdIdCopyImage" priority="0x0200" type="Button"> <Parent guid="guidORMDesignerCommandSet" id="groupIdModelCommands"/> <Icon guid="guidOfficeIcon" id="msotcidCamera"/> @@ -1013,6 +1023,7 @@ <IDSymbol value="0x292F" name="cmdIdSelectInDocumentWindow"/> <IDSymbol value="0x2930" name="cmdIdIncludeInGroup"/> <IDSymbol value="0x2931" name="cmdIdIncludeInNewGroup"/> + <IDSymbol value="0x2932" name="cmdIdSelectInModelBrowser"/> <!-- Large ranges for dynamic commands, keep single commands in the 0x29__ range --> <IDSymbol value="0x2A00" name="cmdIdErrorList"/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |