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 119206 Details for
Bug 141690
[Graphics] Improve Look and Feel of FilteredTree
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
updated patch
patch-141690.txt (text/plain), 12.03 KB, created by
Boris Bokowski
on 2008-12-01 16:30:11 EST
(
hide
)
Description:
updated patch
Filename:
MIME Type:
Creator:
Boris Bokowski
Created:
2008-12-01 16:30:11 EST
Size:
12.03 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.ui.workbench >Index: Eclipse UI/org/eclipse/ui/internal/dialogs/FilteredPreferenceDialog.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FilteredPreferenceDialog.java,v >retrieving revision 1.88 >diff -u -r1.88 FilteredPreferenceDialog.java >--- Eclipse UI/org/eclipse/ui/internal/dialogs/FilteredPreferenceDialog.java 9 May 2008 14:13:11 -0000 1.88 >+++ Eclipse UI/org/eclipse/ui/internal/dialogs/FilteredPreferenceDialog.java 1 Dec 2008 21:28:01 -0000 >@@ -134,10 +134,7 @@ > * @see org.eclipse.ui.dialogs.FilteredTree#updateToolbar(boolean) > */ > protected void updateToolbar(boolean visible) { >- if (filterToolBar != null) { >- filterToolBar.getControl().setVisible( >- viewerFilter != null || visible); >- } >+ super.updateToolbar(viewerFilter != null || visible); > } > > /* >@@ -320,8 +317,7 @@ > leftLayout.numColumns = 1; > leftLayout.marginHeight = 0; > leftLayout.marginTop = IDialogConstants.VERTICAL_MARGIN; >- leftLayout.marginWidth = 0; >- leftLayout.marginLeft = IDialogConstants.HORIZONTAL_MARGIN; >+ leftLayout.marginWidth = IDialogConstants.HORIZONTAL_MARGIN; > leftLayout.horizontalSpacing = 0; > leftLayout.verticalSpacing = 0; > leftArea.setLayout(leftLayout); >Index: Eclipse UI/org/eclipse/ui/dialogs/FilteredTree.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/FilteredTree.java,v >retrieving revision 1.32 >diff -u -r1.32 FilteredTree.java >--- Eclipse UI/org/eclipse/ui/dialogs/FilteredTree.java 27 Nov 2008 01:21:15 -0000 1.32 >+++ Eclipse UI/org/eclipse/ui/dialogs/FilteredTree.java 1 Dec 2008 21:28:00 -0000 >@@ -15,8 +15,6 @@ > import org.eclipse.core.runtime.IStatus; > import org.eclipse.core.runtime.Status; > import org.eclipse.core.runtime.jobs.Job; >-import org.eclipse.jface.action.Action; >-import org.eclipse.jface.action.IAction; > import org.eclipse.jface.action.ToolBarManager; > import org.eclipse.jface.resource.ImageDescriptor; > import org.eclipse.jface.resource.JFaceResources; >@@ -25,7 +23,10 @@ > import org.eclipse.jface.viewers.TreeViewer; > import org.eclipse.osgi.util.NLS; > import org.eclipse.swt.SWT; >+import org.eclipse.swt.accessibility.ACC; > import org.eclipse.swt.accessibility.AccessibleAdapter; >+import org.eclipse.swt.accessibility.AccessibleControlAdapter; >+import org.eclipse.swt.accessibility.AccessibleControlEvent; > import org.eclipse.swt.accessibility.AccessibleEvent; > import org.eclipse.swt.events.DisposeEvent; > import org.eclipse.swt.events.DisposeListener; >@@ -35,17 +36,22 @@ > import org.eclipse.swt.events.KeyEvent; > import org.eclipse.swt.events.ModifyEvent; > import org.eclipse.swt.events.ModifyListener; >+import org.eclipse.swt.events.MouseEvent; >+import org.eclipse.swt.events.MouseListener; >+import org.eclipse.swt.events.MouseTrackListener; > import org.eclipse.swt.events.SelectionAdapter; > import org.eclipse.swt.events.SelectionEvent; > import org.eclipse.swt.events.TraverseEvent; > import org.eclipse.swt.events.TraverseListener; > import org.eclipse.swt.graphics.Color; > import org.eclipse.swt.graphics.Font; >+import org.eclipse.swt.graphics.Image; > import org.eclipse.swt.layout.GridData; > import org.eclipse.swt.layout.GridLayout; > import org.eclipse.swt.widgets.Composite; > import org.eclipse.swt.widgets.Control; > import org.eclipse.swt.widgets.Display; >+import org.eclipse.swt.widgets.Label; > import org.eclipse.swt.widgets.Text; > import org.eclipse.swt.widgets.TreeItem; > import org.eclipse.ui.IWorkbenchPreferenceConstants; >@@ -74,10 +80,21 @@ > * The control representing the clear button for the filter text entry. This > * value may be <code>null</code> if no such button exists, or if the > * controls have not yet been created. >+ * @deprecated Not used anymore. Use {@link #clearButtonControl} instead. > */ > protected ToolBarManager filterToolBar; > > /** >+ * The control representing the clear button for the filter text entry. This >+ * value may be <code>null</code> if no such button exists, or if the >+ * controls have not yet been created. >+ * >+ * @since 3.5 >+ */ >+ protected Control clearButtonControl; >+ >+ >+ /** > * The viewer for the filtered tree. This value should never be > * <code>null</code> after the widget creation methods are complete. > */ >@@ -228,7 +245,12 @@ > setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); > > if (showFilterControls) { >- filterComposite = new Composite(this, SWT.NONE); >+ if (useNativeSearchField(parent)) { >+ filterComposite = new Composite(this, SWT.NONE); >+ } else { >+ filterComposite= new Composite(this, SWT.BORDER); >+ filterComposite.setBackground(getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND)); >+ } > GridLayout filterLayout = new GridLayout(2, false); > filterLayout.marginHeight = 0; > filterLayout.marginWidth = 0; >@@ -249,6 +271,26 @@ > treeComposite.setLayoutData(data); > createTreeControl(treeComposite, treeStyle); > } >+ >+ private static Boolean useNativeSearchField; >+ >+ private static boolean useNativeSearchField(Composite composite) { >+ if (useNativeSearchField == null) { >+ useNativeSearchField = Boolean.FALSE; >+ Text testText = null; >+ try { >+ testText = new Text(composite, SWT.SEARCH | SWT.CANCEL); >+ useNativeSearchField = new Boolean((testText.getStyle() & SWT.CANCEL) != 0); >+ } finally { >+ if (testText != null) { >+ testText.dispose(); >+ } >+ } >+ >+ } >+ return useNativeSearchField.booleanValue(); >+ } >+ > > /** > * Create the filter controls. By default, a text and corresponding tool bar >@@ -262,10 +304,9 @@ > protected Composite createFilterControls(Composite parent) { > createFilterText(parent); > createClearText(parent); >- if (filterToolBar != null) { >- filterToolBar.update(false); >+ if (clearButtonControl != null) { > // initially there is no text to clear >- filterToolBar.getControl().setVisible(false); >+ clearButtonControl.setVisible(false); > } > return parent; > } >@@ -481,8 +522,8 @@ > } > > protected void updateToolbar(boolean visible) { >- if (filterToolBar != null) { >- filterToolBar.getControl().setVisible(visible); >+ if (clearButtonControl != null) { >+ clearButtonControl.setVisible(visible); > } > } > >@@ -649,7 +690,7 @@ > }); > } > >- GridData gridData = new GridData(SWT.FILL, SWT.BEGINNING, true, false); >+ GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, false); > // if the text widget supported cancel then it will have it's own > // integrated button. We can take all of the space. > if ((filterText.getStyle() & SWT.CANCEL) != 0) >@@ -668,8 +709,11 @@ > * @since 3.3 > */ > protected Text doCreateFilterText(Composite parent) { >- return new Text(parent, SWT.SINGLE | SWT.BORDER | SWT.SEARCH >- | SWT.CANCEL); >+ if (useNativeSearchField(parent)) { >+ return new Text(parent, SWT.SINGLE | SWT.BORDER | SWT.SEARCH >+ | SWT.CANCEL); >+ } >+ return new Text(parent, SWT.SINGLE); > } > > private String previousFilterText; >@@ -708,12 +752,9 @@ > */ > public void setBackground(Color background) { > super.setBackground(background); >- if (filterComposite != null) { >+ if (filterComposite != null && useNativeSearchField(filterComposite)) { > filterComposite.setBackground(background); > } >- if (filterToolBar != null && filterToolBar.getControl() != null) { >- filterToolBar.getControl().setBackground(background); >- } > } > > /** >@@ -726,28 +767,56 @@ > // only create the button if the text widget doesn't support one > // natively > if ((filterText.getStyle() & SWT.CANCEL) == 0) { >- filterToolBar = new ToolBarManager(SWT.FLAT | SWT.HORIZONTAL); >- filterToolBar.createControl(parent); >+ final Image inactiveImage= JFaceResources.getImageRegistry().getDescriptor(DCLEAR_ICON).createImage(); >+ final Image activeImage= JFaceResources.getImageRegistry().getDescriptor(CLEAR_ICON).createImage(); >+ >+ final Label clearButton= new Label(parent, SWT.NONE); >+ clearButton.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false)); >+ clearButton.setImage(inactiveImage); >+ clearButton.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND)); >+ clearButton.setToolTipText(WorkbenchMessages.FilteredTree_ClearToolTip); >+ clearButton.addMouseListener(new MouseListener() { >+ public void mouseDoubleClick(MouseEvent e) { >+ } > >- IAction clearTextAction = new Action("", IAction.AS_PUSH_BUTTON) {//$NON-NLS-1$ >- /* >- * (non-Javadoc) >- * >- * @see org.eclipse.jface.action.Action#run() >- */ >- public void run() { >+ public void mouseDown(MouseEvent e) { > clearText(); > } >- }; > >- clearTextAction >- .setToolTipText(WorkbenchMessages.FilteredTree_ClearToolTip); >- clearTextAction.setImageDescriptor(JFaceResources >- .getImageRegistry().getDescriptor(CLEAR_ICON)); >- clearTextAction.setDisabledImageDescriptor(JFaceResources >- .getImageRegistry().getDescriptor(DCLEAR_ICON)); >+ public void mouseUp(MouseEvent e) { >+ } >+ }); >+ clearButton.addMouseTrackListener(new MouseTrackListener() { >+ public void mouseEnter(MouseEvent e) { >+ clearButton.setImage(activeImage); >+ } > >- filterToolBar.add(clearTextAction); >+ public void mouseExit(MouseEvent e) { >+ clearButton.setImage(inactiveImage); >+ } >+ >+ public void mouseHover(MouseEvent e) { >+ } >+ }); >+ clearButton.addDisposeListener(new DisposeListener() { >+ public void widgetDisposed(DisposeEvent e) { >+ inactiveImage.dispose(); >+ activeImage.dispose(); >+ } >+ }); >+ clearButton.getAccessible().addAccessibleListener( >+ new AccessibleAdapter() { >+ public void getName(AccessibleEvent e) { >+ e.result= WorkbenchMessages.FilteredTree_AccessibleListenerClearButton; >+ } >+ }); >+ clearButton.getAccessible().addAccessibleControlListener( >+ new AccessibleControlAdapter() { >+ public void getRole(AccessibleControlEvent e) { >+ e.detail= ACC.ROLE_PUSHBUTTON; >+ } >+ }); >+ this.clearButtonControl= clearButton; > } > } > >Index: Eclipse UI/org/eclipse/ui/internal/messages.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/messages.properties,v >retrieving revision 1.385 >diff -u -r1.385 messages.properties >--- Eclipse UI/org/eclipse/ui/internal/messages.properties 1 Dec 2008 15:20:36 -0000 1.385 >+++ Eclipse UI/org/eclipse/ui/internal/messages.properties 1 Dec 2008 21:28:01 -0000 >@@ -883,6 +883,7 @@ > FilteredTree_ClearToolTip=Clear > FilteredTree_FilterMessage=type filter text > FilteredTree_FilteredDialogTitle={0} (Filtered) >+FilteredTree_AccessibleListenerClearButton=Clear filter field > FilteredTree_AccessibleListenerFiltered={0} {1} matches. > Workbench_restoreDisabled=This application does not save and restore previously saved state. > Workbench_noStateToRestore=No previously saved state to restore. >Index: Eclipse UI/org/eclipse/ui/internal/WorkbenchMessages.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchMessages.java,v >retrieving revision 1.108 >diff -u -r1.108 WorkbenchMessages.java >--- Eclipse UI/org/eclipse/ui/internal/WorkbenchMessages.java 1 Dec 2008 15:20:36 -0000 1.108 >+++ Eclipse UI/org/eclipse/ui/internal/WorkbenchMessages.java 1 Dec 2008 21:28:00 -0000 >@@ -902,6 +902,7 @@ > public static String FilteredTree_ClearToolTip; > public static String FilteredTree_FilterMessage; > public static String FilteredTree_FilteredDialogTitle; >+ public static String FilteredTree_AccessibleListenerClearButton; > public static String FilteredTree_AccessibleListenerFiltered; > public static String Workbench_restoreDisabled; > public static String Workbench_noStateToRestore;
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 141690
:
41411
|
41412
|
41413
|
45443
|
45444
|
45445
|
45446
|
45447
|
104873
|
104876
| 119206