Registering of a new ContextGlobalProvider implementation
Casqueiro Gilles <[email protected]>
| Newsgroups | gmane.comp.java.netbeans.modules.openide.devel |
|---|---|
| Message-ID | <46731A37FFC5D047B3FAAD3558D349B7587E7766@BMI-2K8-MS03.emea.bracco.priv> |
Hi Tim,
I tried to follow your tutorial in order to change the selection model. As it is not currently online I used this version: https://web.archive.org/web/20101023185130/http://weblogs.java.net/blog/2007/01/23/how-replace-selection-model-netbeans-platform<https://web.archive.org/web/20101023185130/http:/weblogs.java.net/blog/2007/01/23/how-replace-selection-model-netbeans-platform>
It looks like the service isn’t correctly registered, here is what I did:
First I have the custom implementation of the ContextGlobalProvider:
package com.bracco.qihc.selectionModel;
import com.bracco.qihc.combinedResult.CombinedResultTopComponent;
import org.openide.util.ContextGlobalProvider;
import org.openide.util.Lookup;
import org.openide.util.lookup.AbstractLookup;
import org.openide.util.lookup.InstanceContent;
public final class QihcContextProvider implements ContextGlobalProvider {
private final InstanceContent ic = new InstanceContent();
private final Lookup lkp = new AbstractLookup(ic);
public Lookup getLookup() {
return lkp;
}
@Override
public Lookup createGlobalContext() {
return lkp;
}
public void setCombinedResultTopComponent (CombinedResultTopComponent combinedResultTopComponent) {
CombinedResultTopComponent old = lkp.lookup(CombinedResultTopComponent.class);
if (combinedResultTopComponent != null) {
if (old != null) {
ic.remove(old);
}
ic.add(combinedResultTopComponent);
}
}
}
And then I have the service provider configuration file called org.openide.util.ContextGlobalProvider and placed at the root of the src folder (<default package>), it contains this:
#-org.netbeans.modules.openide.windows.GlobalActionContextImpl
com.bracco.qihc.selectionModel.QihcContextProvider
Do you see something wrong?
Gilles
-----------------------------------------------------------------------
Le informazioni contenute in questo messaggio di posta elettronica e relativi allegati sono riservate e confidenziali e ne è vietata la diffusione in qualunque modo eseguita. Qualora Lei non fosse la persona a cui il presente messaggio è destinato, La invitiamo ad eliminarlo e a darcene gentile comunicazione.
The information contained in this e-mail and any attachments is confidential and may also be privileged. If you are not the named recipient please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium.
-----------------------------------------------------------------------
Capture.PNG
(image/png, 9.2 KB) - not displayed