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 12342 Details for
Bug 63235
[KeyBindings] Cut/Copy/Paste/SelectAll don't work in Swing widgets in dialogs
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]
Patch to WidgetMethodHandler
Bug63235-WidgetMethodHandler.patch (text/plain), 3.98 KB, created by
Douglas Pollock
on 2004-06-16 19:30:51 EDT
(
hide
)
Description:
Patch to WidgetMethodHandler
Filename:
MIME Type:
Creator:
Douglas Pollock
Created:
2004-06-16 19:30:51 EDT
Size:
3.98 KB
patch
obsolete
>Index: WidgetMethodHandler.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/ws/WidgetMethodHandler.java,v >retrieving revision 1.5 >diff -u -r1.5 WidgetMethodHandler.java >--- WidgetMethodHandler.java 19 May 2004 23:46:18 -0000 1.5 >+++ WidgetMethodHandler.java 16 Jun 2004 23:20:31 -0000 >@@ -10,14 +10,19 @@ > ******************************************************************************/ > package org.eclipse.ui.internal.commands.ws; > >+import java.awt.Component; > import java.lang.reflect.InvocationTargetException; > import java.lang.reflect.Method; > import java.util.Collections; > import java.util.HashMap; > import java.util.Map; > >+import javax.swing.FocusManager; >+ > import org.eclipse.core.runtime.IConfigurationElement; > import org.eclipse.core.runtime.IExecutableExtension; >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.widgets.Composite; > import org.eclipse.swt.widgets.Control; > import org.eclipse.swt.widgets.Display; > import org.eclipse.ui.commands.AbstractHandler; >@@ -65,7 +70,14 @@ > try { > final Control focusControl = Display.getCurrent() > .getFocusControl(); >- methodToExecute.invoke(focusControl, null); >+ if ((focusControl instanceof Composite) >+ && ((((Composite) focusControl).getStyle() & SWT.EMBEDDED) != 0)) { >+ final FocusManager focusManager = FocusManager.getCurrentManager(); >+ final Component focusComponent = focusManager.getFocusOwner(); >+ methodToExecute.invoke(focusComponent, null); >+ } else { >+ methodToExecute.invoke(focusControl, null); >+ } > } catch (IllegalAccessException e) { > // The method is protected, so do nothing. > } catch (InvocationTargetException e) { >@@ -93,15 +105,46 @@ > */ > protected Method getMethodToExecute() { > final Control focusControl = Display.getCurrent().getFocusControl(); >- try { >- if (focusControl != null) { >- return focusControl.getClass().getMethod(methodName, NO_PARAMETERS); >+ Method method = null; >+ >+ if (focusControl != null) { >+ Class clazz = focusControl.getClass(); >+ while (clazz != null) { >+ try { >+ System.out.println("clazz = " + clazz.getName()); >+ method = clazz.getMethod(methodName, NO_PARAMETERS); >+ } catch (NoSuchMethodException e) { >+ clazz = clazz.getSuperclass(); >+ } > } >- } catch (NoSuchMethodException e) { >- // Fall through.... > } >- >- return null; >+ >+ if ((method == null) >+ && (focusControl instanceof Composite) >+ && ((((Composite) focusControl).getStyle() & SWT.EMBEDDED) != 0)) { >+ /* >+ * We couldn't find the appropriate method on the current focus >+ * control. It is possible that the current focus control is an >+ * embedded SWT composite, which could be containing some Swing >+ * components. If this is the case, then we should try to pass >+ * through to the underlying Swing component hierarchy. Insha'allah, >+ * this will work. >+ */ >+ final FocusManager focusManager = FocusManager.getCurrentManager(); >+ final Component focusComponent = focusManager.getFocusOwner(); >+ Class clazz = focusComponent.getClass(); >+ >+ while (clazz != null) { >+ try { >+ method = clazz.getMethod(methodName, NO_PARAMETERS); >+ } catch (NoSuchMethodException e) { >+ clazz = clazz.getSuperclass(); >+ } >+ } >+ } >+ System.out.println("method = " + method); >+ >+ return method; > } > > /*
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 63235
: 12342 |
12344
|
13123
|
13124