PreferencePage - StringFieldEditor - Tooltip problems

SWT Designer allows you to create the views, editors, perspectives, pref pages, composites, etc. that comprise Eclipse SWT & RCP applications and plug-ins.

Moderators: Konstantin.Scheglov, gnebling, Alexander.Mitin, jwren, Eric Clayberg

PreferencePage - StringFieldEditor - Tooltip problems

Postby egentz » Sat Jan 29, 2005 4:30 am

hi,
I wanted to add a tooltip to a StringFieldEditor and so I typed my ToolTip into properties of the StringEditorField.
Designer generates code:

...
final Text meinText = meinTextStringFieldEditor.getTextControl(getFieldEditorParent());
meinText.setToolTipText("mein Tip");
add......

now my PreferencePage will not open. an error was displayed:
Could not Accept Changes
"The currently displayed page contains invalid values"
hitting OK shows the page but without the default value from PreferenceStore, without the ToolTip and without the buttons
"Accept" and "Get Defaults".

without getting TextControl and setting ToolTip it works ok.

the Designer shows me the Tooltip correctly in preview,
but running the application doesnt.

any ideas whats wrong ?

regards

ekkehard
egentz
 
Posts: 6
Joined: Sat Jan 29, 2005 4:20 am
Location: germany

Re: PreferencePage - StringFieldEditor - Tooltip problems

Postby Eric Clayberg » Sat Jan 29, 2005 7:39 am

egentz wrote:now my PreferencePage will not open. an error was displayed

Any exceptions recorded to your Eclipse ".log" file?
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA

error log

Postby egentz » Sun Jan 30, 2005 3:32 am

hi eric,
sorry - forgot to send the .log
here it is
regards
ekkehard
---------------------------------
!SESSION 2005-01-30 12:23:35.567 -----------------------------------------------
eclipse.buildId=unknown
java.version=1.5.0_01
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en
Framework arguments: -product de.ekke.google.GoogleProduct -pdelaunch
Command-line arguments: -product de.ekke.google.GoogleProduct -data D:\Projekte\java\RUN_WORKSPACES\google -dev file:D:/Projekte/java/test_31M4/.metadata/.plugins/org.eclipse.pde.core/Ekke Product/dev.properties -pdelaunch -nl en -os win32 -ws win32 -arch x86

!ENTRY org.eclipse.core.runtime 4 2 2005-01-30 12:23:35.582
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.core.runtime".
!STACK 0
org.eclipse.jface.util.Assert$AssertionFailedException: Assertion failed: Different parents
at org.eclipse.jface.util.Assert.isTrue(Assert.java:180)
at org.eclipse.jface.preference.FieldEditor.checkParent(FieldEditor.java:170)
at org.eclipse.jface.preference.StringFieldEditor.getTextControl(StringFieldEditor.java:371)
at de.ekke.google.internal.ui.prefs.GooglePref.createFieldEditors(GooglePref.java:36)
at org.eclipse.jface.preference.FieldEditorPreferencePage.createContents(FieldEditorPreferencePage.java:219)
at org.eclipse.jface.preference.PreferencePage.createControl(PreferencePage.java:417)
at org.eclipse.jface.preference.PreferencePage.createControl(PreferencePage.java:382)
at org.eclipse.ui.internal.dialogs.WorkbenchPreferenceDialog.createPageControl(WorkbenchPreferenceDialog.java:945)
at org.eclipse.jface.preference.PreferenceDialog$13.run(PreferenceDialog.java:1125)
at org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java:1044)
at org.eclipse.core.runtime.Platform.run(Platform.java:747)
at org.eclipse.jface.preference.PreferenceDialog.showPage(PreferenceDialog.java:1119)
at org.eclipse.ui.internal.dialogs.WorkbenchPreferenceDialog.showPage(WorkbenchPreferenceDialog.java:733)
at org.eclipse.jface.preference.PreferenceDialog$9.selectionChanged(PreferenceDialog.java:628)
at org.eclipse.jface.viewers.StructuredViewer$3.run(StructuredViewer.java:681)
at org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java:1044)
at org.eclipse.core.runtime.Platform.run(Platform.java:747)
at org.eclipse.jface.viewers.StructuredViewer.firePostSelectionChanged(StructuredViewer.java:679)
at org.eclipse.jface.viewers.StructuredViewer.setSelection(StructuredViewer.java:1350)
at org.eclipse.jface.preference.PreferenceDialog.selectSavedItem(PreferenceDialog.java:912)
at org.eclipse.ui.internal.dialogs.WorkbenchPreferenceDialog.selectSavedItem(WorkbenchPreferenceDialog.java:578)
at org.eclipse.jface.preference.PreferenceDialog$3.run(PreferenceDialog.java:335)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69)
at org.eclipse.jface.preference.PreferenceDialog.createContents(PreferenceDialog.java:331)
at org.eclipse.jface.window.Window.create(Window.java:375)
at org.eclipse.jface.dialogs.Dialog.create(Dialog.java:983)
at org.eclipse.ui.internal.dialogs.WorkbenchPreferenceDialog.createDialogOn(WorkbenchPreferenceDialog.java:200)
at org.eclipse.ui.internal.OpenPreferencesAction.run(OpenPreferencesAction.java:64)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:989)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:555)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:505)
at org.eclipse.jface.action.ActionContributionItem$6.handleEvent(ActionContributionItem.java:419)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:833)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2803)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2448)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1569)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1540)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:285)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:144)
at de.ekke.google.bundle.GoogleApplication.run(GoogleApplication.java:19)
at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:220)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:273)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:129)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.eclipse.core.launcher.Main.basicRun(Main.java:185)
at org.eclipse.core.launcher.Main.run(Main.java:710)
at org.eclipse.core.launcher.Main.main(Main.java:694)
egentz
 
Posts: 6
Joined: Sat Jan 29, 2005 4:20 am
Location: germany

Re: error log

Postby Eric Clayberg » Sun Jan 30, 2005 7:15 am

We aren't able to reproduce the problem. Can you send us a test case?
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA

Postby egentz » Sun Jan 30, 2005 7:23 am

of course.
later this evening or tomorrow I'll make a small example.
(hope, it happens there, too ;-)
regards
ekkehard
egentz
 
Posts: 6
Joined: Sat Jan 29, 2005 4:20 am
Location: germany

Postby egentz » Sun Jan 30, 2005 10:02 am

just sent it out
regards
ekkehard
egentz
 
Posts: 6
Joined: Sat Jan 29, 2005 4:20 am
Location: germany

Postby Eric Clayberg » Wed Feb 02, 2005 5:01 am

Try changing the style of the preference page from "flat" to "grid".

Take a look at the FieldEditorPreferencePage getFieldEditorParent() method...

Code: Select all
    protected Composite getFieldEditorParent() {
        if (style == FLAT) {
            // Create a new parent for each field editor
            Composite parent = new Composite(fieldEditorParent, SWT.NULL);
            parent.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
            return parent;
        }
        // Just return the parent
        return fieldEditorParent;
    }

If the style is FLAT (like your example), it creates a new parent widget. That probably isn't what we want.

In order to fix this, rather than...

    final StringFieldEditor stringFieldEditor = new StringFieldEditor("", "My Pref:", getFieldEditorParent());
    final Label label = stringFieldEditor.getLabelControl(getFieldEditorParent());
    label.setToolTipText("abc");
    addField(stringFieldEditor);
...we will need to generate something like this...

    Composite fieldEditorParent = getFieldEditorParent();
    final StringFieldEditor stringFieldEditor = new StringFieldEditor("", "My Pref:", fieldEditorParent);
    final Label label = stringFieldEditor.getLabelControl(fieldEditorParent);
    label.setToolTipText("abc");
    addField(stringFieldEditor);
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA

Postby egentz » Wed Feb 02, 2005 6:19 am

thanks - as always: great support.
regards
ekkehard
egentz
 
Posts: 6
Joined: Sat Jan 29, 2005 4:20 am
Location: germany


Return to SWT Designer

Who is online

Users browsing this forum: No registered users and 1 guest