Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 125413 Details for
Bug 218605
[search] SearchPattern: provide way to get the matching regions
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Hacky patch against JDT UI to show matches in the Open Type dialog
patch.txt (text/plain), 3.69 KB, created by
Dani Megert
on 2009-02-11 12:05:27 EST
(
hide
)
Description:
Hacky patch against JDT UI to show matches in the Open Type dialog
Filename:
MIME Type:
Creator:
Dani Megert
Created:
2009-02-11 12:05:27 EST
Size:
3.69 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.ui >Index: ui/org/eclipse/jdt/internal/ui/dialogs/FilteredTypesSelectionDialog.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/dialogs/FilteredTypesSelectionDialog.java,v >retrieving revision 1.42 >diff -u -r1.42 FilteredTypesSelectionDialog.java >--- ui/org/eclipse/jdt/internal/ui/dialogs/FilteredTypesSelectionDialog.java 31 Oct 2008 12:20:42 -0000 1.42 >+++ ui/org/eclipse/jdt/internal/ui/dialogs/FilteredTypesSelectionDialog.java 11 Feb 2009 17:03:12 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2008 IBM Corporation and others. >+ * Copyright (c) 2000, 2009 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -21,9 +21,13 @@ > import java.util.List; > import java.util.Map; > >+import org.eclipse.swt.SWT; > import org.eclipse.swt.events.DisposeEvent; > import org.eclipse.swt.events.DisposeListener; >+import org.eclipse.swt.graphics.Font; >+import org.eclipse.swt.graphics.FontData; > import org.eclipse.swt.graphics.Image; >+import org.eclipse.swt.graphics.TextStyle; > import org.eclipse.swt.layout.GridData; > import org.eclipse.swt.widgets.Composite; > import org.eclipse.swt.widgets.Control; >@@ -58,6 +62,7 @@ > import org.eclipse.jface.viewers.LabelProviderChangedEvent; > import org.eclipse.jface.viewers.StyledString; > import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider; >+import org.eclipse.jface.viewers.StyledString.Styler; > > import org.eclipse.jface.text.ITextSelection; > >@@ -172,6 +177,8 @@ > > private int fTypeFilterVersion= 0; > >+ private TypeItemsFilter fFilter; >+ > /** > * Creates new FilteredTypesSelectionDialog instance > * >@@ -249,7 +256,7 @@ > fTypeInfoUtil= new TypeInfoUtil(extension != null ? extension.getImageProvider() : null); > > fTypeInfoLabelProvider= new TypeItemLabelProvider(); >- >+ > setListLabelProvider(fTypeInfoLabelProvider); > setListSelectionLabelDecorator(fTypeInfoLabelProvider); > shell.addDisposeListener(new DisposeListener() { >@@ -513,7 +520,8 @@ > * @see org.eclipse.ui.dialogs.FilteredItemsSelectionDialog#createFilter() > */ > protected ItemsFilter createFilter() { >- return new TypeItemsFilter(fSearchScope, fElementKinds, fFilterExtension); >+ fFilter= new TypeItemsFilter(fSearchScope, fElementKinds, fFilterExtension); >+ return fFilter; > } > > /* >@@ -837,6 +845,26 @@ > public StyledString getStyledText(Object element) { > String text= getText(element); > StyledString string= new StyledString(text); >+ >+ int[] matchingRegions= SearchPattern.getMatchingRegions(fFilter.getNamePattern(), text, fFilter.getMatchRule()); >+ if (matchingRegions == null) { >+ System.out.println(text); >+ } else { >+ >+ Styler styler= new Styler() { >+ public void applyStyles(TextStyle textStyle) { >+ Font font= getDialogArea().getFont(); >+ FontData[] data= font.getFontData(); >+ for (int i= 0; i < data.length; i++) { >+ data[i].setStyle(SWT.BOLD); >+ } >+ textStyle.font= new Font(font.getDevice(), data); >+ } >+ }; >+ for (int i= 0; i < matchingRegions.length / 2 + 1; i= i + 2) >+ string.setStyle(matchingRegions[i], matchingRegions[i + 1], styler); >+ } >+ > int index= text.indexOf(JavaElementLabels.CONCAT_STRING); > if (index != -1) { > string.setStyle(index, text.length() - index, StyledString.QUALIFIER_STYLER);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 218605
:
124528
|
124529
|
125260
| 125413 |
125502
|
125503
|
125504
|
125530