Note that there are some explanatory texts on larger screens.

plurals
  1. POEclipse: Trying to convert CCombo "display" value to "storage" value
    text
    copied!<p>I'm building my plugin in Helios SR2. It'd be Nice to support Galileo, but I'm not overly worried about it at this point. Windows 7: 64 bit, 64-bit JVM (1.6_21 IIRC).</p> <hr> <p>I have an <code>swt.custom.CCombo</code> box filled with the display values of a list of entries. I have a map of "display value" -> "storage value".</p> <p>I want to store the storage value, and display the display value. Go figure.</p> <p>I'm using databinding with BeanObservables, IObservables, a DataBindingContext, all that jazz.</p> <p>My current approach (that isn't working or I wouldn't be asking) is to create my own <code>UpdateValueStrategy</code> with a custom <code>IConverter</code> that'll internally map between the two.</p> <p>I'm currently trying to extend <code>org.eclipse.core.databinding.conversion.Converter</code>, because IConverter is marked with <code>@noimplement</code> and <code>@noextend</code>. The <code>@noimplement</code> states that clients should extend <code>Converter</code>rather than implementing IConverter directly (even though Converter is fairly trivial).</p> <p>Sadly, Eclipse's Java compiler is telling me that's a no-no: </p> <blockquote> <p>Access restriction: The type Converter is not accessible due to restriction on required library {install}\plugins\org.eclipse.core.databinding_1.3.100.I20100601-0800.jar</p> </blockquote> <p>In the relevant ".api_description", I see the following XML:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8" standalone="no"?&gt; &lt;component name="org.eclipse.core.databinding_1.3.100.I20100601-0800" version="1.2"&gt; &lt;plugin id="org.eclipse.core.databinding_1.3.100.I20100601-0800"/&gt; &lt;package name="org.eclipse.core.databinding" visibility="1"&gt; &lt;type name="ObservablesManager" restrictions="2"/&gt; &lt;type name="UpdateListStrategy" restrictions="0"&gt; &lt;method name="useMoveAndReplace" restrictions="8" signature="()Z"/&gt; &lt;/type&gt; &lt;/package&gt; &lt;package name="org.eclipse.core.databinding.conversion" visibility="1"&gt; &lt;type name="IConverter" restrictions="3"/&gt; &lt;/package&gt; &lt;/component&gt; </code></pre> <p>Rooting around thanks to Google Code, I see that <code>visibility="1"</code> means a public API. Okay, great.</p> <p><code>restrictions="3"</code> on the other hand, means @noextend @noimplement. Sound familiar? Okay, great.</p> <p>But it seems the restrictions on IConverter are rubbing off on Converter, making it impossible to use. I cannot extend Converter, nor may I call <code>super(blah, blah)</code> from my constructor. Interestingly enough, the compiler is <em>not</em> complaining about my implementation of <code>public Object convert(Object fromObject)</code> even though Converter doesn't have one of its own so one might think the <code>IConverter</code> restrictions would apply.</p> <p>Clearly not.</p> <p>Does anyone have</p> <ul> <li>An entirely different approach? </li> <li>Some means to beat this access restriction stuff into submission, preferably in a local kind of way so I don't do something dumb elsewhere.</li> </ul> <p>I found the "restricted access" setting for the compiler and have switched it to "warn" rather than "error". However, I'm hoping there's something a bit less global I could do. I'll proceed with this in the mean time, but an alternative would be nice.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload