Can Oomph import code templates? [message #1843264] |
Wed, 21 July 2021 15:08  |
Eclipse User |
|
|
|
Hi
Can I import code templates with an Oomph SetupTask?
As those code templates are all stored into a single preference, i want to avoid to overwrite existing templates.
Hence I ask for import.
More precisely I mean those in the Preferences > Java > Editor > Templates
Frank
|
|
|
|
|
|
|
Re: Can Oomph import code templates? [message #1843339 is a reply to message #1843280] |
Sat, 24 July 2021 01:02   |
Eclipse User |
|
|
|
https://git.eclipse.org/c/oomph/org.eclipse.oomph.git/tree/plugins/org.eclipse.oomph.setup/src/org/eclipse/oomph/setup/impl/PreferenceTaskImpl.java#n977
Line 977
I think the problem is the configured attribute name, is should not be "id", but instead "name".
registry.put(URI.createURI("//instance/org.eclipse.jdt.ui/org.eclipse.jdt.ui.text.custom_templates"), new Factory() //$NON-NLS-1$
{
public PreferenceHandler create(URI key)
{
//return new XMLPreferenceHandler(key, "template", new String[] { "id" }, null); //$NON-NLS-1$ //$NON-NLS-2$
return new XMLPreferenceHandler(key, "template", new String[] { "name" }, null); //$NON-NLS-1$ //$NON-NLS-2$
}
});
An entry looks like this:
<template autoinsert="true" context="java" deleted="false" description="D..." enabled="true" name="doc">...</template>
|
|
|
Re: Can Oomph import code templates? [message #1843340 is a reply to message #1843280] |
Sat, 24 July 2021 01:02   |
Eclipse User |
|
|
|
https://git.eclipse.org/c/oomph/org.eclipse.oomph.git/tree/plugins/org.eclipse.oomph.setup/src/org/eclipse/oomph/setup/impl/PreferenceTaskImpl.java#n977
Line 977
I think the problem is the configured attribute name, is should not be "id", but instead "name".
registry.put(URI.createURI("//instance/org.eclipse.jdt.ui/org.eclipse.jdt.ui.text.custom_templates"), new Factory() //$NON-NLS-1$
{
public PreferenceHandler create(URI key)
{
//return new XMLPreferenceHandler(key, "template", new String[] { "id" }, null); //$NON-NLS-1$ //$NON-NLS-2$
return new XMLPreferenceHandler(key, "template", new String[] { "name" }, null); //$NON-NLS-1$ //$NON-NLS-2$
}
});
An entry looks like this:
<template autoinsert="true" context="java" deleted="false" description="D..." enabled="true" name="doc">...</template>
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.11453 seconds