NetBeans Forums
| View previous topic :: View next topic |
| Author |
Message |
tcolar
Joined: 09 May 2009 Posts: 38
|
Posted: Wed Jan 26, 2011 4:41 pm Post subject: [platform-dev] Re: Generated-layer.xml does not get OptionsPanelController.SubRegistration-ID |
|
|
From what I see the layer.xml uses org.netbeans.spi.options.AdvancedOption.createSubCategory and that doesn't support the ID property.
So because of that it's just not possible to actually use OptionsDisplayer.getDefault().open to open a specific SUBpanel (despites what the doc says).
Anyway, I decided to just make my plugin setting it's own category rather than subcategory of misc, this way it works fine.
On 11-01-25 12:47 PM, Thibaut Colar wrote: | Quote: | I have a settings panel (called Fantom, under Miscenalleous), it works fine but now I'd like top open it automatically during the IDE startup if it's not configured yet.
To open it, I do this (which according to the doc should open my settings panel):
OptionsDisplayer.getDefault().open(OptionsDisplayer.ADVANCED+"/"+FanGlobalSettingsController.ID);
Problem is that it does go to Miscellaneous but not to my specific Fantom panel.
I have annotated My Settings panel with an ID as explained in http://bits.nbextras.org/dev/javadoc/org-netbeans-modules-options-api/org/netbeans/api/options/OptionsDisplayer.html
----------------
@OptionsPanelController.SubRegistration(location="Advanced", id=FanGlobalSettingsController.ID, displayName="Fantom")
public class FanGlobalSettingsController extends OptionsPanelController
{
public static final String ID = "Fantom";
----------------
I've found that the issue is that when the generated-layer.xml gets built, the ID tag does not get added to the XML ('ve tried deleting generated-layer.xml and doing a full clean/build)
---
.......
<!--net.colar.netbeans.fan.wizard.FanGlobalSettingsController-->
<attr
methodvalue="org.netbeans.spi.options.AdvancedOption.createSubCategory" name="instanceCreate"/>
<attr name="controller" newvalue="net.colar.netbeans.fan.wizard.FanGlobalSettingsController"/>
<attr name="displayName" stringvalue="Fantom"/>
......
---
|
|
|
| Back to top |
|
 |
Jesse Glick Posted via mailing list.
|
Posted: Fri Jan 28, 2011 6:17 pm Post subject: [platform-dev] Re: Generated-layer.xml does not get OptionsPanelController.SubRegistration-ID |
|
|
On 01/25/2011 03:47 PM, Thibaut Colar wrote:
| Quote: | I've found that the issue is that when the generated-layer.xml gets built, the ID tag does not get added to the XML
|
It controls the instance file name, which is normally used. Anyway the use case you describe works for me, in 7.0 at least:
package m;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.beans.PropertyChangeListener;
import javax.swing.JComponent;
import javax.swing.JLabel;
import org.netbeans.api.options.OptionsDisplayer;
import org.netbeans.spi.options.OptionsPanelController;
import org.openide.awt.ActionID;
import org.openide.awt.ActionReference;
import org.openide.awt.ActionRegistration;
import org.openide.util.HelpCtx;
import org.openide.util.Lookup;
public class C {
@OptionsPanelController.SubRegistration(displayName="Testing", id="test")
public static class Impl extends OptionsPanelController {
public @Override void update() {}
public @Override void applyChanges() {}
public @Override void cancel() {}
public @Override boolean isValid() {
return true;
}
public @Override boolean isChanged() {
return false;
}
public @Override JComponent getComponent(Lookup masterLookup) {
return new JLabel("hello world");
}
public @Override HelpCtx getHelpCtx() {
return null;
}
public @Override void addPropertyChangeListener(PropertyChangeListener l) {}
public @Override void removePropertyChangeListener(PropertyChangeListener l) {}
}
@ActionID(category="System", id="whatever")
@ActionRegistration(displayName="Open Testing Panel", iconInMenu=false)
@ActionReference(path="Menu/Tools")
public static class Act implements ActionListener {
public @Override void actionPerformed(ActionEvent e) {
OptionsDisplayer.getDefault().open(OptionsDisplayer.ADVANCED + "/test");
}
}
} |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|