Generate an a .adapter file [message #93435] |
Wed, 14 March 2007 04:31  |
Eclipse User |
|
|
|
Hi
I been trying to generate a .adapter file programmatically (for a
plugin-project extension) but both the
AdaptorModelWizard and AdaptorModelWizardNewFileCreationPage
are internal along with all the logic to create a adapter (foramtter,
extractor outputter etc). Is there any open API's for creating own .adapter
file ? Found the GLA API's but they assumes that you already have an adaper
configurations file, the one i would like compose and generate
programmatically (not thru the GUI).
Im using eclipse 3.2, TPTP 4.2.1
Brgds Johan
|
|
|
|
Re: Generate an a .adapter file [message #94280 is a reply to message #94040] |
Tue, 27 March 2007 10:47  |
Eclipse User |
|
|
|
Thank you Cindy.
My soulution to this was to use the OptionTemplateSection -Class
public class StaticAdapterTemplate extends OptionTemplateSection
In the updateModel method i used following code to generate my plugin.xml
protected void updateModel(IProgressMonitor monitor) throws CoreException {
IPluginBase plugin = model.getPluginBase();
IPluginModelFactory factory = model.getPluginFactory();
String staticParserFullName =
templateOptions.get(KEY_PACKAGE_NAME)+"."+templateOptions.get(Constants.KEY_PARSER_CLASS_NAME);
String staticParserWrapperFullName =
templateOptions.get(KEY_PACKAGE_NAME)+"." +templateOptions.get(Constants.KEY_PARSER_WRAPPER_CLASS_NAME );
String staticParserName = templateOptions.get(Constants.KEY_PARSER_NAME);
IPluginExtension extension =
createExtension("org.eclipse.hyades.logging.parsers.logParser ", true);
IPluginElement element = factory.createElement(extension);
element.setName("parser");
element.setAttribute("id", staticParserFullName);
element.setAttribute("name", "my.package..StaticParser");
element.setAttribute("icon", "icons/log_parser_obj.gif");
element.setAttribute("description", "Static Parser v1.0");
element.setAttribute("ui_name", staticParserName);
element.setAttribute("class", staticParserWrapperFullName);
IPluginElement fieldElement = factory.createElement(element);
fieldElement.setName("field"); //$NON-NLS-1$
fieldElement.setAttribute("useBrowse", "true");
fieldElement.setAttribute("defaultValue", "");
fieldElement.setAttribute("name", "Directory");
fieldElement.setAttribute("helpContextId", "");
fieldElement.setAttribute("tooltip", "Enter the location of the log file");
fieldElement.setAttribute("id", "file_path");
fieldElement.setAttribute("browseType", "*.log");
element.add(fieldElement);
IPluginElement fieldElement2 = factory.createElement(element);
fieldElement2.setName("parserParameter"); //$NON-NLS-1$
fieldElement2.setAttribute("name", "Default");
fieldElement2.setAttribute("value",
"./adapter/"+getStringOption(Constants.KEY_ADAPTER_NAME));
element.add(fieldElement2);
extension.add(element);
plugin.add(extension);
}
Together with a NewPluginTemplateWizard this works fine for creating an
plugin.xml.
// Johan
"Cindy Jin" <cindyjin@ca.ibm.com> wrote in message
news:eu0p35$31s$1@utils.eclipse.org...
> Hi Johan:
>
> You can use the GLA model which is an EMF model created in
> org.eclipse.tptp.platform.models plugin You can use
> org.eclipse.hyades.logging.adapter.model.internal.adapter.Ad apterFactory
> to create the .adapter file. Right now this model is defined as internal .
> I discussed with the owner of the model. He suggested that you can use
> this model,but there is no guaranteed backward compatibility in the
> future, since it is internal APIS. You can open a bugzilla against GLA
> component, request programmatically generate .adapter file. Also if you
> don't want to use the internal APIs you can write an xml parser to
> generate the file because the .adapter is XML file indeed.
>
> Hope this can help you.
>
> Thanks
> Cindy
>
>
> Johan Andersson wrote:
>> Hi
>>
>> I been trying to generate a .adapter file programmatically (for a
>> plugin-project extension) but both the
>>
>> AdaptorModelWizard and AdaptorModelWizardNewFileCreationPage
>>
>> are internal along with all the logic to create a adapter (foramtter,
>> extractor outputter etc). Is there any open API's for creating own
>> .adapter file ? Found the GLA API's but they assumes that you already
>> have an adaper configurations file, the one i would like compose and
>> generate programmatically (not thru the GUI).
>>
>> Im using eclipse 3.2, TPTP 4.2.1
>>
>> Brgds Johan
|
|
|
Powered by
FUDForum. Page generated in 0.03207 seconds