Home » Eclipse Projects » Remote Application Platform (RAP) » ControlContribution in a view's menu bar(org.eclipse.jface.action.ControlContribution in a view's ToolBar)
|
Re: ControlContribution in a view's menu bar [message #1062749 is a reply to message #1062716] |
Mon, 10 June 2013 11:26   |
Eclipse User |
|
|
|
Hi Julia,
if the behavior duffers from RCP it's probably a bug. Please file a
bugzilla and we will investigate the issue.
Thanks,
Ivan
On 6/10/2013 4:26 PM, Julia Kurde wrote:
> Hi,
>
> I have a strange behavior of a ControlContribution in the ToolBar of a View: The Control (e.g. a Spinner) does not keep its focus.
>
> The attached figure shows the example "RAP Application with a View" generated by the New Plug-in Project wizard. I just modified the Perspective so that the view has a Title and in the method createPartControl(Composite) of the View I add a Label and the ControlContribution in the ToolBar:
>
> public void createPartControl(Composite parent) {
> int style = SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL;
> viewer = new TableViewer(parent, style);
> viewer.setContentProvider(new ViewContentProvider());
> viewer.setLabelProvider(new ViewLabelProvider());
> viewer.setInput(getViewSite());
>
> label = new Label(parent, SWT.BORDER);
> label.setText("label");
>
> IToolBarManager manager = getViewSite().getActionBars().getToolBarManager();
> manager.add(new MyControlItem(this));
> }
>
> MyControlItem looks like this:
>
> public class MyControlItem extends ControlContribution {
>
> View view;
> public MyControlItem (View view) {
> super("id");
> this.view = view;
> }
>
> @Override
> protected Control createControl(Composite parent) {
>
> final Spinner spinner = new Spinner(parent, SWT.BORDER);
> spinner.setMinimum( 25);
> spinner.setMaximum(400);
> spinner.setIncrement(25);
> spinner.setPageIncrement(100);
> spinner.setSelection(100);
>
> spinner.addListener(SWT.Traverse, new Listener() {
> public void handleEvent(Event event) {
> switch (event.detail) {
> case SWT.TRAVERSE_RETURN:
> view.setLabelText(String.valueOf(spinner.getSelection()));
> }
> }
> });
> spinner.addListener(SWT.FocusOut, new Listener() {
> public void handleEvent(Event event) {
> view.setLabelText(String.valueOf(spinner.getSelection()));
> }
> });
>
> return spinner;
> }
> }
>
> What it SHOULD do: Update the label in the view on SWT.FocusOut or on SWT.Traverse with event.detail == SWT.TRAVERSE_RETURN.
>
> What it ACTUALLY does: Update the label every time the value of the spinner is changed.
>
> The reason for that is that the spinner does not keep it's focus, so a focus out event occurs.
> In my real application it is not a label that should be updated but an image. To minimize the traffic it should really only be updated on focus out.
>
> In an RCP application the label/image is updated correctly.
>
> Is it possible get the correct behavior also in the RAP?
>
> Regards,
> Julia
--
Ivan Furnadjiev
Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/
Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
|
|
|
Re: ControlContribution in a view's menu bar [message #1062756 is a reply to message #1062716] |
Mon, 10 June 2013 11:49   |
Eclipse User |
|
|
|
Julia,
BTW I've tested your snippet with RAP 2.1 RC3 and it's working as you
expected. Which RAP version are you using? Which browser?
Best,
Ivan
On 6/10/2013 4:26 PM, Julia Kurde wrote:
> Hi,
>
> I have a strange behavior of a ControlContribution in the ToolBar of a View: The Control (e.g. a Spinner) does not keep its focus.
>
> The attached figure shows the example "RAP Application with a View" generated by the New Plug-in Project wizard. I just modified the Perspective so that the view has a Title and in the method createPartControl(Composite) of the View I add a Label and the ControlContribution in the ToolBar:
>
> public void createPartControl(Composite parent) {
> int style = SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL;
> viewer = new TableViewer(parent, style);
> viewer.setContentProvider(new ViewContentProvider());
> viewer.setLabelProvider(new ViewLabelProvider());
> viewer.setInput(getViewSite());
>
> label = new Label(parent, SWT.BORDER);
> label.setText("label");
>
> IToolBarManager manager = getViewSite().getActionBars().getToolBarManager();
> manager.add(new MyControlItem(this));
> }
>
> MyControlItem looks like this:
>
> public class MyControlItem extends ControlContribution {
>
> View view;
> public MyControlItem (View view) {
> super("id");
> this.view = view;
> }
>
> @Override
> protected Control createControl(Composite parent) {
>
> final Spinner spinner = new Spinner(parent, SWT.BORDER);
> spinner.setMinimum( 25);
> spinner.setMaximum(400);
> spinner.setIncrement(25);
> spinner.setPageIncrement(100);
> spinner.setSelection(100);
>
> spinner.addListener(SWT.Traverse, new Listener() {
> public void handleEvent(Event event) {
> switch (event.detail) {
> case SWT.TRAVERSE_RETURN:
> view.setLabelText(String.valueOf(spinner.getSelection()));
> }
> }
> });
> spinner.addListener(SWT.FocusOut, new Listener() {
> public void handleEvent(Event event) {
> view.setLabelText(String.valueOf(spinner.getSelection()));
> }
> });
>
> return spinner;
> }
> }
>
> What it SHOULD do: Update the label in the view on SWT.FocusOut or on SWT.Traverse with event.detail == SWT.TRAVERSE_RETURN.
>
> What it ACTUALLY does: Update the label every time the value of the spinner is changed.
>
> The reason for that is that the spinner does not keep it's focus, so a focus out event occurs.
> In my real application it is not a label that should be updated but an image. To minimize the traffic it should really only be updated on focus out.
>
> In an RCP application the label/image is updated correctly.
>
> Is it possible get the correct behavior also in the RAP?
>
> Regards,
> Julia
--
Ivan Furnadjiev
Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/
Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
|
|
| | | | | |
Re: ControlContribution in a view's menu bar [message #1063018 is a reply to message #1063001] |
Tue, 11 June 2013 15:19   |
Eclipse User |
|
|
|
Julia,
the extensionbundle has been removed in Equinox, it is not really
needed. The WAR products tool did not handle that correctly, but this
problem is fixed in Kepler [1]. If that was the only problem, it should
not keep you from upgrading.
As far as I understand it, the old plugin.xml should still work with RAP
2.1 / Kepler, but support will be removed after Kepler [2]. However,
changing your bundles should be simple: remove the <requires> elements
from the plugin.xml, and add those dependencies using the manifest editor.
Regards,
Ralf
[1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=398780
[2] https://bugs.eclipse.org/bugs/show_bug.cgi?id=407312
--
Ralf Sternberg
Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/
Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
|
|
| |
Re: ControlContribution in a view's menu bar [message #1063196 is a reply to message #1063191] |
Wed, 12 June 2013 11:17   |
Eclipse User |
|
|
|
Hi Julia,
we reverted the fix for bug 408656 last night. See:
408656: HttpOnly flag for settingStore cookie
https://bugs.eclipse.org/bugs/show_bug.cgi?id=408656
RAP 2.1RC4 should run again on servlet 2.5 without a problem.
Best,
Ivan
On 6/12/2013 6:11 PM, Julia Kurde wrote:
> Thanks, Ralf!
>
> I could update these old style plugins :). One has to increase the
> version number, too, else the whole workspace gets messed up!
> I also use now Kepler with RAP 2.1 and the war file is generated
> without problem (org.eclipse.equinox.servletbridge.extensionbundle is
> not included).
>
> But again I get this NoSuchMethodError when trying to start the
> application on tomcat6:
>
>
> HTTP Status 500 - Servlet execution threw an exception
>
> type Exception report
> message Servlet execution threw an exception
> description The server encountered an internal error that prevented it
> from fulfilling this request.
>
> exception
> javax.servlet.ServletException: Servlet execution threw an exception
> root cause
>
> java.lang.NoSuchMethodError: javax.servlet.http.Cookie.setHttpOnly(Z)V
> org.eclipse.rap.rwt.internal.service.SettingStoreManager.getStoreId(SettingStoreManager.java:91)
>
> org.eclipse.rap.rwt.internal.service.SettingStoreManager.getStore(SettingStoreManager.java:34)
>
> org.eclipse.rap.rwt.RWT.getSettingStore(RWT.java:484)
> org.eclipse.rap.ui.internal.preferences.SessionPreferencesNode.internalGet(SessionPreferencesNode.java:487)
>
> org.eclipse.rap.ui.internal.preferences.SessionPreferencesNode.get(SessionPreferencesNode.java:196)
>
> org.eclipse.core.internal.preferences.PreferencesService.get(PreferencesService.java:465)
>
> org.eclipse.ui.preferences.ScopedPreferenceStoreCore.internalGet(ScopedPreferenceStoreCore.java:457)
>
> org.eclipse.ui.preferences.ScopedPreferenceStoreCore.getBoolean(ScopedPreferenceStoreCore.java:370)
>
> org.eclipse.ui.preferences.ScopedPreferenceStore.getBoolean(ScopedPreferenceStore.java:447)
>
> org.eclipse.ui.internal.UISynchronizer.<init>(UISynchronizer.java:88)
> org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2548)
> org.eclipse.ui.internal.Workbench.access$5(Workbench.java:2530)
> org.eclipse.ui.internal.Workbench$5.run(Workbench.java:701)
> org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
>
> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:684)
>
> org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:157)
> eub.rapjlzhview.Application.start(Application.java:18)
> org.eclipse.rap.ui.internal.application.EntryPointApplicationWrapper.createUI(EntryPointApplicationWrapper.java:38)
>
> org.eclipse.rap.rwt.internal.lifecycle.RWTLifeCycle.createUI(RWTLifeCycle.java:186)
>
> org.eclipse.rap.rwt.internal.lifecycle.RWTLifeCycle$UIThreadController.run(RWTLifeCycle.java:298)
>
> java.lang.Thread.run(Unknown Source)
> org.eclipse.rap.rwt.internal.lifecycle.UIThread.run(UIThread.java:104)
>
> note The full stack trace of the root cause is available in the Apache
> Tomcat/6.0.37 logs.
>
> Apache Tomcat/6.0.37
>
> All plugins are in the status active except the
> org.eclipse.equinox.servletbridge.extensionbundle:
>
> osgi> ss
> "Framework is launched."
>
>
> id State Bundle
> 0 ACTIVE org.eclipse.osgi_3.9.0.v20130529-1710
> Fragments=23
> 1 ACTIVE com.ibm.icu.base_50.1.1.v201304230130
> 2 ACTIVE eub.jlzhinternal_1.0.0
> 3 ACTIVE eub.jlzhtools_1.0.0
> 4 ACTIVE eub.lib_2.0.0
> 5 ACTIVE eub.lzhview_2.0.0
> 6 ACTIVE eub.rapjlzhview_1.0.0.201306121638
> 7 ACTIVE eub.tableeditor_3.0.0
> 8 ACTIVE javax.xml_1.3.4.v201005080400
> 9 ACTIVE org.apache.felix.gogo.runtime_0.10.0.v201209301036
> 10 ACTIVE org.apache.felix.gogo.shell_0.10.0.v201212101605
> 11 ACTIVE org.eclipse.core.commands_3.6.100.v20130515-1857
> 12 ACTIVE org.eclipse.core.contenttype_3.4.200.v20130326-1255
> 13 ACTIVE org.eclipse.core.databinding_1.4.1.v20130515-1857
> 14 ACTIVE
> org.eclipse.core.databinding.observable_1.4.1.v20130515-1857
> 15 ACTIVE
> org.eclipse.core.databinding.property_1.4.200.v20130515-1857
> 16 ACTIVE org.eclipse.core.expressions_3.4.500.v20130515-1343
> 17 ACTIVE org.eclipse.core.jobs_3.5.300.v20130429-1813
> 18 ACTIVE org.eclipse.core.runtime_3.9.0.v20130326-1255
> 19 ACTIVE org.eclipse.equinox.app_1.3.100.v20130327-1442
> 20 ACTIVE org.eclipse.equinox.common_3.6.200.v20130402-1505
> 21 ACTIVE org.eclipse.equinox.console_1.0.100.v20130429-0953
> 22 ACTIVE org.eclipse.equinox.http.registry_1.1.300.v20130402-1529
> 23 RESOLVED org.eclipse.equinox.servletbridge.extensionbundle_1.3.0
> Master=0
> 24 ACTIVE org.eclipse.equinox.http.servlet_1.1.400.v20130418-1354
> 25 ACTIVE
> org.eclipse.equinox.http.servletbridge_1.0.300.v20130327-144
> 2
> 26 ACTIVE org.eclipse.equinox.preferences_3.5.100.v20130422-1538
> 27 ACTIVE org.eclipse.equinox.registry_3.5.300.v20130327-1442
> 28 ACTIVE org.eclipse.help_3.6.0.v20130326-1254
> 29 ACTIVE org.eclipse.osgi.services_3.3.100.v20130513-1956
> 30 ACTIVE org.eclipse.rap.design.example_2.1.0.20130524-0811
> 31 ACTIVE org.eclipse.rap.jface_2.1.0.20130506-1748
> 32 ACTIVE org.eclipse.rap.jface.databinding_2.1.0.20130506-1748
> 33 ACTIVE org.eclipse.rap.rwt_2.1.0.20130527-1011
> 34 ACTIVE org.eclipse.rap.rwt.osgi_2.1.0.20130506-1748
> 35 ACTIVE org.eclipse.rap.ui_2.1.0.20130528-1219
> 36 ACTIVE org.eclipse.rap.ui.workbench_2.1.0.20130506-1748
> osgi>
> NoSuchMethodError sounds like incompatible java versions, but all
> Plugins are compiled with jre6, which is also installed on the server
> (which is localhost).
>
> Any idea, what could be the problem?
>
> Besides that, the spinner in my toolbar still does not behave
> correctly, unfortunately...
>
>
--
Ivan Furnadjiev
Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/
Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
|
|
| | | |
Re: ControlContribution in a view's menu bar [message #1063497 is a reply to message #1063493] |
Thu, 13 June 2013 06:12  |
Eclipse User |
|
|
|
... I just found the source of the problem:
in the View's setFocus() method the focus is passed to the viewer's control. Commenting this out, i.e. leaving the setFocus() method empty let the spinner behave properly!
I have to check now what consequences this has in my real application an if I can use it like that.
Thanks again and regards,
Julia
|
|
|
Goto Forum:
Current Time: Tue Jul 22 18:21:38 EDT 2025
Powered by FUDForum. Page generated in 0.18705 seconds
|