如何在现有网页编辑器调色板中提供自定义组件 [英] How to provide a custom component in the existing Web page Editor Palette

查看:120
本文介绍了如何在现有网页编辑器调色板中提供自定义组件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在网页编辑器Palete中添加一个新的自定义组件,名为myHTMLComponent。
所以,一旦用户用WPE打开任何html页面,我的HTMLComponentM应该出现在那里。
我如何做到有需要,而且这个组件还需要相应地生成代码的更改。如何实现所需的结果。



有没有可以获得的输入。
我已经创建了标准的元数据标签,但是下一步呢!

解决方案

最后,我发现问题的解决方案。 / p>

要在调色板中添加新类别,我们需要在plugin.xml中使用pagedesignerextension,如下所示 -

 < extension 
point =org.eclipse.jst.pagedesigner.pageDesignerExtension>
< paletteFactory
class =com.comp.myeditor.palette.CustomEditorPaletteFactory>
< / paletteFactory>
< / extension>

CustomEditorPaletteFactory将如何扩展AbstractPaletteFactory。在createPaletteRoot()中,我们可以添加我们的类别。

  public PaletteRoot createPaletteRoot(IEditorInput editorInput){
PaletteRoot paletteRoot = new PaletteRoot();
paletteRoot.add(createStandardComponents());
return paletteRoot;
//返回null;
}


private static PaletteContainer createStandardComponents(){
PaletteDrawer componentsDrawer = new PaletteDrawer(CustomHTMLComponent);

TagToolPaletteEntry paletteEntry = new TagToolPaletteEntry(
new FormPaletteComponent(.....);
componentsDrawer.add(paletteEntry);

return componentsDrawer ;
}

这将在调色板中创建组件类别,我们可以添加多个使用组件导航器需要使用组件。



在现有的添加新类别 -
在构造函数中添加这个 -

  super(); 
this._paletteContext = PaletteItemManager.createPaletteContext(file);
this._manager = PaletteItemManager.getInstance(_paletteContext);

然后使用Palette Grouping这样 -

  PaletteGroup controls = new PaletteGroup(CUST HTML); 
super.add(controls);

ToolEntry tool = new SelectionToolEntry(CUST Cursor ,
Cursor DESCRIPTION);

controls.add(tool);
setDefaultEntry(tool);
//自定义选框
controls.add(new MarqueeToolEntry(Marquee,Marquee Desc));

controls.add(new PaletteSeparator());
//此类维护或加载所有类别功能
controls.add(new CustomComponentToolEntry(Custom Component,Custom Component Descrition,


I want to add a new custom component in the Web page Editor Palete named "myHTMLComponent". So, as soon as user opens any html page with WPE, myHTMLComponentM should be present there. How can I do the needful, moreover this component will as well need to generate the code changes accordingly. How to achieve the desired result.

Is there any input I can get for this. I already created standardmetadata tag, but what next!

解决方案

Finally, I found the solution of the problem.

For adding new categories in the palette, we need to use pagedesignerextension in plugin.xml as following -

<extension
point="org.eclipse.jst.pagedesigner.pageDesignerExtension">
<paletteFactory
class="com.comp.myeditor.palette.CustomEditorPaletteFactory">
</paletteFactory>
</extension>

Where CustomEditorPaletteFactory will be extending AbstractPaletteFactory. Here in createPaletteRoot(), we can add our category.

public PaletteRoot createPaletteRoot(IEditorInput editorInput){
PaletteRoot paletteRoot = new PaletteRoot();
paletteRoot.add(createStandardComponents());
return paletteRoot;
//return null;
}


private static PaletteContainer createStandardComponents() {
PaletteDrawer componentsDrawer = new PaletteDrawer("CustomHTMLComponent");

TagToolPaletteEntry paletteEntry = new TagToolPaletteEntry(
new FormPaletteComponent(".....);
componentsDrawer.add(paletteEntry);

return componentsDrawer;
}

This will create the component category in the palette and we can add as many components as needed using the componentsdrawer.

For adding a new category in the existing one - Add this in the constructor -

super();
        this._paletteContext = PaletteItemManager.createPaletteContext(file);
        this._manager = PaletteItemManager.getInstance(_paletteContext);

Then use Palette Grouping like this -

PaletteGroup controls = new PaletteGroup("CUST HTML");
        super.add(controls);

        ToolEntry tool = new SelectionToolEntry("CUST Cursor",
                "Cursor DESCRIPTION");

        controls.add(tool);
        setDefaultEntry(tool);
//Custom Marquee
        controls.add(new MarqueeToolEntry("Marquee", "Marquee Desc"));

        controls.add(new PaletteSeparator());
//This class maintins or load all categories features
        controls.add(new CustomComponentToolEntry("Custom Component", "Custom Component Descrition", 

这篇关于如何在现有网页编辑器调色板中提供自定义组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆