Esempio n. 1
0
        protected ObjectListItem(
            ProjectId projectId,
            StandardGlyphGroup glyphGroup,
            StandardGlyphItem glyphItem = StandardGlyphItem.GlyphItemPublic,
            bool isHidden = false)
        {
            _projectId = projectId;

            _glyphIndex = glyphGroup < StandardGlyphGroup.GlyphGroupError
                ? (ushort)((int)glyphGroup + (int)glyphItem)
                : (ushort)glyphGroup;

            _isHidden = isHidden;
        }
 public ImageSource GetGlyph(StandardGlyphGroup group, StandardGlyphItem item)
 {
     uint key = ((uint)group << 16) + (uint)item;
     return _glyphCache.GetOrAdd(key, CreateGlyph);
 }
Esempio n. 3
0
 private void SetupVerifiableGlyph(StandardGlyphGroup standardGlyphGroup, StandardGlyphItem standardGlyphItem)
 {
     _glyphServiceMock.Setup(service => service.GetGlyph(standardGlyphGroup, standardGlyphItem))
                     .Returns(CreateIconBitmapSource())
                     .Verifiable();
 }
Esempio n. 4
0
 public static ImageSource GetGlyphThreadSafe(this IGlyphService glyphService, StandardGlyphGroup @group, StandardGlyphItem item) {
     lock (_lock) {
         return glyphService.GetGlyph(group, item);
     }
 }
Esempio n. 5
0
 public ImageSource GetGlyph(StandardGlyphGroup group, StandardGlyphItem item) {
     return null;
 }
 public Icon GetIcon(StandardGlyphGroup group, StandardGlyphItem item)
 {
     var key = ((uint)group << 16) + (uint)item;
     return _iconCache.GetOrAdd(key, CreateIcon);
 }
Esempio n. 7
0
 public ImageSource GetGlyph(StandardGlyphGroup group, StandardGlyphItem item) {
     return new DrawingImage();
 }
Esempio n. 8
0
 private System.Windows.Media.ImageSource GetGlyph(StandardGlyphGroup group, StandardGlyphItem item)
 {
     return(this.sourceProvider.GlyphService.GetGlyph(group, item));
 }
Esempio n. 9
0
 public ImageSource GetGlyph(StandardGlyphGroup group, StandardGlyphItem item)
 {
     return(null);
 }
Esempio n. 10
0
        internal static System.Windows.Media.ImageSource GetGlyph(StandardGlyphGroup group, StandardGlyphItem item)
        {
            IGlyphService service = GetService <IGlyphService>();

            return(service.GetGlyph(group, item));
        }
 private void SetupVerifiableGlyph(StandardGlyphGroup standardGlyphGroup, StandardGlyphItem standardGlyphItem)
 {
     _glyphServiceMock.Setup(service => service.GetGlyph(standardGlyphGroup, standardGlyphItem))
     .Returns(CreateIconBitmapSource())
     .Verifiable();
 }
Esempio n. 12
0
    public int GetImageIndex(StandardGlyphGroup standardGlyphGroup, StandardGlyphItem standardGlyphItem) {
      if (standardGlyphGroup >= StandardGlyphGroup.GlyphGroupError)
        return (int)standardGlyphGroup;
      return (int)standardGlyphGroup + (int)standardGlyphItem;

    }
        public ImageSource GetGlyph(StandardGlyphGroup group, StandardGlyphItem item)
        {
            uint key = ((uint)group << 16) + (uint)item;

            return(_glyphCache.GetOrAdd(key, CreateGlyph));
        }
 public ImageSource GetGlyph(StandardGlyphGroup group, StandardGlyphItem item)
 {
     return(new DrawingImage());
 }
        private void UpdateTags(AntlrParseResultEventArgs antlrParseResultArgs)
        {
            List <IEditorNavigationTarget> navigationTargets = new List <IEditorNavigationTarget>();

            IAstRuleReturnScope resultArgs = antlrParseResultArgs.Result as IAstRuleReturnScope;
            var result = resultArgs != null ? resultArgs.Tree as CommonTree : null;

            if (result != null)
            {
                ITextSnapshot snapshot = antlrParseResultArgs.Snapshot;

                string package = string.Empty;

                /* ^('package' qualifiedName)
                 *
                 * ^(CLASS_TYPE_IDENTIFIER modifiers .* ^(TYPE_BODY .* '}'))
                 *
                 * ^(INTERFACE_TYPE_IDENTIFIER modifiers .* ^(TYPE_BODY .* '}'))
                 *
                 * ^(ANNOTATION_TYPE_IDENTIFIER modifiers .* ^(TYPE_BODY .* '}'))
                 *
                 * ^(FIELD_DECLARATION modifiers (.* ^(VARIABLE_IDENTIFIER .*))*)
                 *
                 * ^(METHOD_IDENTIFIER modifiers .* ^(FORMAL_PARAMETERS .* ')') .* ^(METHOD_BODY .* '}'))
                 */

                /* STATEMENT COMPLETION (description unrelated to this file)
                 *
                 * IDENTIFIER ('.' IDENTIFIER)*
                 *
                 * ^(CALL IDENTIFIER .*)
                 *
                 * ^('(' ^('==' .*) ')')
                 *
                 */

                for (CommonTreeNodeStream treeNodeStream = new CommonTreeNodeStream(result);
                     treeNodeStream.LA(1) != CharStreamConstants.EndOfFile;
                     treeNodeStream.Consume())
                {
                    switch (treeNodeStream.LA(1))
                    {
                    case Java2Lexer.PACKAGE:
                        // ^('package' qualifiedName)
                    {
                        CommonTree child = treeNodeStream.LT(1) as CommonTree;
                        if (child != null && child.ChildCount > 0)
                        {
                            package = GetQualifiedIdentifier(child.GetChild(0));
                        }
                    }

                    break;

                    case Java2Lexer.VARIABLE_IDENTIFIER:
                        // ^(FIELD_DECLARATION (.* ^(VARIABLE_IDENTIFIER))*)
                    {
                        CommonTree child = treeNodeStream.LT(1) as CommonTree;
                        if (child != null && child.HasAncestor(Java2Lexer.FIELD_DECLARATION))
                        {
                            string name = child.Token.Text;
                            IEditorNavigationType navigationType = EditorNavigationTypeRegistryService.GetEditorNavigationType(PredefinedEditorNavigationTypes.Members);
                            var                   startToken     = antlrParseResultArgs.Tokens[child.TokenStartIndex];
                            var                   stopToken      = antlrParseResultArgs.Tokens[child.TokenStopIndex];
                            SnapshotSpan          span           = new SnapshotSpan(snapshot, new Span(startToken.StartIndex, stopToken.StopIndex - startToken.StartIndex + 1));
                            SnapshotSpan          seek           = new SnapshotSpan(snapshot, new Span(child.Token.StartIndex, 0));
                            StandardGlyphGroup    glyphGroup     = StandardGlyphGroup.GlyphGroupJSharpField;
                            StandardGlyphItem     glyphItem      = GetGlyphItemFromChildModifier((CommonTree)child.GetAncestor(Java2Lexer.FIELD_DECLARATION));
                            ImageSource           glyph          = _provider.GlyphService.GetGlyph(glyphGroup, glyphItem);
                            NavigationTargetStyle style          = NavigationTargetStyle.None;
                            navigationTargets.Add(new EditorNavigationTarget(name, navigationType, span, seek, glyph, style));
                        }
                    }

                    break;

                    case Java2Lexer.METHOD_IDENTIFIER:
                        // ^(METHOD_IDENTIFIER ^(FORMAL_PARAMETERS formalParameterDecls?) ^(METHOD_BODY .* END_METHOD_BODY))
                    {
                        CommonTree child = treeNodeStream.LT(1) as CommonTree;
                        if (child != null)
                        {
                            string name = child.Token.Text;
                            IEnumerable <string> args = ProcessArguments((CommonTree)child.GetFirstChildWithType(Java2Lexer.FORMAL_PARAMETERS));
                            string sig = string.Format("{0}({1})", name, string.Join(", ", args));
                            IEditorNavigationType navigationType = EditorNavigationTypeRegistryService.GetEditorNavigationType(PredefinedEditorNavigationTypes.Members);
                            var                   startToken     = antlrParseResultArgs.Tokens[child.TokenStartIndex];
                            var                   stopToken      = antlrParseResultArgs.Tokens[child.TokenStopIndex];
                            SnapshotSpan          span           = new SnapshotSpan(snapshot, new Span(startToken.StartIndex, stopToken.StopIndex - startToken.StartIndex + 1));
                            SnapshotSpan          seek           = new SnapshotSpan(snapshot, new Span(child.Token.StartIndex, 0));
                            StandardGlyphGroup    glyphGroup     = StandardGlyphGroup.GlyphGroupJSharpMethod;
                            StandardGlyphItem     glyphItem      = GetGlyphItemFromChildModifier(child);
                            ImageSource           glyph          = _provider.GlyphService.GetGlyph(glyphGroup, glyphItem);
                            NavigationTargetStyle style          = NavigationTargetStyle.None;
                            navigationTargets.Add(new EditorNavigationTarget(sig, navigationType, span, seek, glyph, style));
                        }
                    }

                    break;

                    case Java2Lexer.ENUM_TYPE_IDENTIFIER:
                    case Java2Lexer.ANNOTATION_TYPE_IDENTIFIER:
                    case Java2Lexer.INTERFACE_TYPE_IDENTIFIER:
                    case Java2Lexer.CLASS_TYPE_IDENTIFIER:
                    {
                        CommonTree child = treeNodeStream.LT(1) as CommonTree;
                        if (child != null)
                        {
                            string name = child.Token.Text;
                            for (ITree parent = child.Parent; parent != null; parent = parent.Parent)
                            {
                                switch (parent.Type)
                                {
                                case Java2Lexer.ENUM_TYPE_IDENTIFIER:
                                case Java2Lexer.ANNOTATION_TYPE_IDENTIFIER:
                                case Java2Lexer.INTERFACE_TYPE_IDENTIFIER:
                                case Java2Lexer.CLASS_TYPE_IDENTIFIER:
                                    name = parent.Text + "." + name;
                                    continue;

                                default:
                                    continue;
                                }
                            }

                            if (!string.IsNullOrEmpty(package))
                            {
                                name = package + "." + name;
                            }

                            IEditorNavigationType navigationType = EditorNavigationTypeRegistryService.GetEditorNavigationType(PredefinedEditorNavigationTypes.Types);
                            var          startToken = antlrParseResultArgs.Tokens[child.TokenStartIndex];
                            var          stopToken  = antlrParseResultArgs.Tokens[child.TokenStopIndex];
                            SnapshotSpan span       = new SnapshotSpan(snapshot, new Span(startToken.StartIndex, stopToken.StopIndex - startToken.StartIndex + 1));
                            SnapshotSpan seek       = new SnapshotSpan(snapshot, new Span(child.Token.StartIndex, 0));

                            StandardGlyphGroup glyphGroup;
                            switch (child.Type)
                            {
                            case Java2Lexer.ENUM_TYPE_IDENTIFIER:
                                glyphGroup = StandardGlyphGroup.GlyphGroupEnum;
                                break;

                            case Java2Lexer.ANNOTATION_TYPE_IDENTIFIER:
                            case Java2Lexer.INTERFACE_TYPE_IDENTIFIER:
                                glyphGroup = StandardGlyphGroup.GlyphGroupJSharpInterface;
                                break;

                            case Java2Lexer.CLASS_TYPE_IDENTIFIER:
                            default:
                                glyphGroup = StandardGlyphGroup.GlyphGroupJSharpClass;
                                break;
                            }

                            StandardGlyphItem     glyphItem = GetGlyphItemFromChildModifier(child);
                            ImageSource           glyph     = _provider.GlyphService.GetGlyph(glyphGroup, glyphItem);
                            NavigationTargetStyle style     = NavigationTargetStyle.None;
                            navigationTargets.Add(new EditorNavigationTarget(name, navigationType, span, seek, glyph, style));
                        }
                    }

                    break;

                    default:
                        continue;
                    }
                }
            }

            this._navigationTargets = navigationTargets;
            OnNavigationTargetsChanged(EventArgs.Empty);
        }