Extending Sapphire Wizards [message #721415] |
Thu, 01 September 2011 17:33 |
Kamesh Sampath Messages: 213 Registered: July 2009 |
Senior Member |
|
|
I am trying to extend the Sapphire Wizards, the idea is that I need to add few pages from the JDT.ui plugin e.g. NewInterfaceWizardPage and then allow Sapphire to pick the pages from the sdef.
I also need to do declarative def of the wizard in the plugin.xml .
When I do it i see the Wizard in the respective category but when start the wizard i get the folling error
Quote:The selected wizard could not be started.
Plug-in "com.sk.contentassist.demo" was unable to instantiate class "org.eclipse.sapphire.ui.wizards.NewSapphireModelCreationWizard".
org.eclipse.sapphire.ui.wizards.NewSapphireModelCreationWizard
I dont see any .log files to see the detailed traces or my console showing the errors
Base model class:
@GenerateImpl
@XmlRootBinding(elementName = "sapphire-model")
public interface ISapphireModelDef extends IExecutableModelElement {
ModelElementType TYPE = new ModelElementType(ISapphireModelDef.class);
// *** ValueProperties ***
@Type(base = ISModelValueProperty.class)
@Label(standard = "Value Properties")
@XmlListBinding(mappings = { @XmlListBinding.Mapping(element = "", type = ISModelTypedValueProperty.class) })
ListProperty PROP_VALUE_PROPERTIES = new ListProperty(TYPE,
"ValueProperties");
ModelElementList<ISModelValueProperty> getValueProperties();
// *** Method: execute ***
@DelegateImplementation(ISapphireModelDefOpMethods.class)
Status execute(ProgressMonitor monitor);
}
Wizard Classes
public abstract class NewElementWizard<M extends IExecutableModelElement>
extends SapphireWizard<M> {
public NewElementWizard(M modelElement, String wizardDefPath) {
super(modelElement, wizardDefPath);
setNeedsProgressMonitor(true);
}
public abstract void addCustomPages();
}
public class NewSapphireModelCreationWizard extends
NewElementWizard<ISapphireModelDef> {
public final static String ID = "org.eclipse.sapphire.ui.wizards.NewSapphireModelCreationWizard";
private final static String WIZARD_DEF_PATH = "com.sk.contentassist.demo/org/eclipse/sapphire/ui/wizards/sapphire-model-wizards.sdef!new.sapphire.model.creation.wizard";
private NewInterfaceWizardPage modelElementClass;
/**
* @param modelElement
* @param wizardDefPath
*/
public NewSapphireModelCreationWizard(ISapphireModelDef modelElement,
String wizardDefPath) {
super(modelElement, NewSapphireModelCreationWizard.WIZARD_DEF_PATH);
addCustomPages();
}
/*
* (non-Javadoc)
*
* @see org.eclipse.sapphire.ui.wizards.NewElementWizard#addCustomPages()
*/
@Override
public void addCustomPages() {
if (this.modelElementClass == null) {
this.modelElementClass = new NewInterfaceWizardPage();
super.addPage(modelElementClass);
}
}
}
sdef
<definition>
<import>
<package>org.eclipse.sapphire.model</package>
</import>
<wizard>
<id>new.sapphire.model.creation.wizard</id>
<label>New Sapphire Model</label>
<description>This wizard will allow the creation of New Sapphire Models</description>
<image>icons/sapphire-32.png</image>
<page>
<id>new-sapphire-model.valueproperties.page</id>
<label>Value Properties</label>
<description>Define all value properties for the model</description>
<content>
<property-editor>ValueProperties</property-editor>
</content>
</page>
</wizard>
</definition>
finally my plugin.xml
<plugin>
<extension
point="org.eclipse.ui.newWizards">
<category
id="org.eclipse.sapphire.newWizards"
name="%category.name.0">
</category>
<wizard
id="org.eclipse.sapphire.ui.wizards.NewSapphireModelCreationWizard"
category="org.eclipse.sapphire.newWizards"
name="New Sapphire Model"
icon="icons/sapphire-32.png"
class="org.eclipse.sapphire.ui.wizards.NewSapphireModelCreationWizard">
<description>
Creates new Sapphire Model Element (IModelElement)
</description>
</wizard>
</extension>
</plugin>
Not sure I am missing something here, also am not sure of the order pages, ideally i feel that Super classes addPages will be called first and then it will lead to sub class addPage - if that is the scenario then any way we could control the order ?
~Kamesh
|
|
|
|
Re: Extending Sapphire Wizards [message #721429 is a reply to message #721425] |
Thu, 01 September 2011 18:16 |
Kamesh Sampath Messages: 213 Registered: July 2009 |
Senior Member |
|
|
so you feel its ideal to build the wizard from the scratch and finally build the Interface out of it using the Template plugins ?
1. Even if we build a completly new Wizard using SDEF is there a way by which I can add that wizard to the plugin.xml and there by categorize and make it available via the Work bench Wizards Dialog
2. I also observed the same classes or wizard definition is working fine when i handle it with WizardDialog which is invoked via the Handlers, but its not working when I define my own CustomWizard class as shown below and adding it via the plugin.xml,
lets leave JDT interface wizard page, and use same sdef for both cases #1 and #2 mentioned above. Not sure why its failing to be invoked from Workbench New Wizard Dialog
~Kamesh
[Updated on: Thu, 01 September 2011 18:49] Report message to a moderator
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05119 seconds