Package com.intellij.usages

Examples of com.intellij.usages.UsageInfo2UsageAdapter$MyUsagePresentation


        //todo: needs code review. There must be a better way to do this
        Runnable runnable = new Runnable() {
            public void run() {
                for (final Usage result : usages) {

                    final UsageInfo2UsageAdapter usage = (UsageInfo2UsageAdapter) result;
                    //avoid angular source files. Is there a better way to do this?
                    if (usage.getFile().getName().startsWith("angular")) continue;

                    usage.processRangeMarkers(new Processor<Segment>() {
                        @Override
                        public boolean process(Segment segment) {
                            try {
                                final int textOffset = segment.getStartOffset();

                                final int textEndOffset = segment.getEndOffset();
                                Document document = usage.getDocument();
                                CharSequence charsSequence = document.getCharsSequence();
                                final CharSequence foundString = charsSequence.subSequence(textOffset, textEndOffset);
                                String s = foundString.toString();
                                String regExMatch = FindManager.getInstance(project).getStringToReplace(s, findModel, textOffset, document.getText());
                                System.out.println(regExMatch);
View Full Code Here


        //todo: needs code review. There must be a better way to do this
        Runnable runnable = new Runnable() {
            public void run() {
                for (final Usage r : usages) {

                    final UsageInfo2UsageAdapter usage = (UsageInfo2UsageAdapter) r;
                    //avoid angular source files. Is there a better way to do this?
                    if (usage.getFile().getName().startsWith("angular")) continue;

                    usage.processRangeMarkers(new Processor<Segment>() {
                        @Override
                        public boolean process(Segment segment) {
                            try {
                                final int textOffset = segment.getStartOffset();

                                final int textEndOffset = segment.getEndOffset();
                                Document document = usage.getDocument();
                                CharSequence charsSequence = document.getCharsSequence();
                                final CharSequence foundString = charsSequence.subSequence(textOffset, textEndOffset);
                                String s = foundString.toString();
                                String regExMatch = FindManager.getInstance(project).getStringToReplace(s, findModel, textOffset, document.getText());
                                System.out.println(regExMatch);
View Full Code Here

                    Object columnItem = rowVector.get(column);
                    String itemName = "";

                    if (columnItem instanceof UsageInfo2UsageAdapter)
                    {
                        UsageInfo2UsageAdapter usageAdapter = (UsageInfo2UsageAdapter) columnItem;
                        itemName = usageAdapter.getElement().getContainingFile().getName();
                    }

                    if (columnItem instanceof PsiNamedElement)
                    {
                        PsiNamedElement psiElement = (PsiNamedElement) columnItem;
                        itemName = psiElement.getName();
                    }
                    else if (columnItem instanceof PsiElement)
                    {
                        PsiElement psiElement = (PsiElement) columnItem;
                        itemName = psiElement.getText();
                    }

                    if (itemName.equals(selectionName))
                    {
                        itemUnderMouse = columnItem;
                        break;
                    }
                }
            }

            if (SwingUtilities.isLeftMouseButton(e))
            {
                if (itemUnderMouse instanceof PsiElement)
                {
                    PsiElement psiElement = (PsiElement) itemUnderMouse;
                    VirtualFile virtualFile = psiElement.getContainingFile().getVirtualFile();
                    FileEditorManager.getInstance(project).openFile(virtualFile, true);
                    Editor selectedTextEditor = FileEditorManager.getInstance(project).getSelectedTextEditor();

                    selectedTextEditor.getCaretModel().moveToOffset(psiElement.getTextOffset());
                    selectedTextEditor.getScrollingModel().scrollToCaret(ScrollType.CENTER);
                }

                if (itemUnderMouse instanceof UsageInfo2UsageAdapter)
                {
                    UsageInfo2UsageAdapter usageAdapter = (UsageInfo2UsageAdapter) itemUnderMouse;
                    VirtualFile virtualFile = usageAdapter.getFile();
                    FileEditorManager.getInstance(project).openFile(virtualFile, true);
                    Editor selectedTextEditor = FileEditorManager.getInstance(project).getSelectedTextEditor();

                    selectedTextEditor.getCaretModel().moveToOffset(usageAdapter.getUsageInfo().getNavigationOffset());
                    selectedTextEditor.getScrollingModel().scrollToCaret(ScrollType.CENTER);
                }
            }

View Full Code Here

                    break;
                }

//                System.out.println("result: " + result.toString());

                UsageInfo2UsageAdapter usageAdapter = new UsageInfo2UsageAdapter(new UsageInfo(psiFile, result.getStartOffset(), result.getEndOffset()));
                Point point = editor.logicalPositionToXY(editor.offsetToLogicalPosition(usageAdapter.getUsageInfo().getNavigationOffset()));
                if (visibleArea.contains(point)) {
                    UsageInfo usageInfo = usageAdapter.getUsageInfo();
                    int navigationOffset = usageInfo.getNavigationOffset();
                    if (navigationOffset != caretModel.getOffset()) {
                        if (!results.contains(navigationOffset)) {
//                            System.out.println("Adding: " + navigationOffset + "-> " + usageAdapter.getPlainText());
                            offsets.add(navigationOffset);
View Full Code Here

TOP

Related Classes of com.intellij.usages.UsageInfo2UsageAdapter$MyUsagePresentation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.