效果:

扩展
在插件org.talend.designer.core中对扩展点:org.eclipse.ui.editors进行扩展。

打开编辑器的Action
对扩展点:org.talend.repository.actions进行扩展的CreateProcess.java和EditProcess.java两个类。
CreateProcess.java
负责创建该Process(job)对应的ProcessItem模型文件,交给RepositoryFactory.create(Item, IPath)进行保存;并创建了该MultiPageTalendEditor对应的EditorInput:ProcessEditorInput.java;将EditorInput和MultiPageTalendEditor关联。
            ProcessEditorInput fileEditorInput;
                fileEditorInput = new ProcessEditorInput(processWizard.getProcess(), false);
                fileEditorInput.setView(getViewPart());
                fileEditorInput.setNode(node);
                IWorkbenchPage page = getActivePage();
                page.openEditor(fileEditorInput, MultiPageTalendEditor.ID, true);
MultiPageTalendEditor
有两个页面:
1)图形界面:TalendEditor
2)Perl代码界面:TalendPerlEditor
图形界面
EditorInput:
ProcessEditorInput
1) 负责数据保存到文件temp/tempProcess_id中以及从该文件加载数据。
2) 根据ProcessItem的Property实例化org.talend.designer.core.ui.editor.process.Process,调用Process.loadXmlFile(ProcessType process)对该Process里面的组件(Node),连线等进行实例化。
TalendEditor
Jobdesigner的图形编辑区。典型的GEF实现方式,可参照:GEF_Tutorial_2up.pdf
configureGraphicalViewer
1)ZoomIn&ZoomOut&Scroll。
2)directAction&CopyAction&PasteAction,其中Copy&PasteAction由Talend自己实现。
3)网状界面在TalendScalableFreeformRootEditPart.createGridLayer()实现。
4)getGraphicalViewer().setEditPartFactory(new PartFactory());
5)配置该Editor的context menu,即Editor上面的右键菜单。
        ContextMenuProvider cmProvider = new TalendEditorContextMenuProvider(this, viewer, getActionRegistry());
        viewer.setContextMenu(cmProvider);
protected void initializeGraphicalViewer()
1)设置当前GraphicalViewer的模型
2)支持从palette上面D&D一个组件到该Editor
ProcessTemplateTransferDropTargetListener.getFactory(Object template)会负责创建一个具体的组件。
    protected void initializeGraphicalViewer() {
        // this uses the PartFactory set in configureGraphicalViewer
        // to create an EditPart for the diagram and sets it as the
        // content for the viewer
        getGraphicalViewer().setContents(this.process);
        getGraphicalViewer().addDropTargetListener(new ProcessTemplateTransferDropTargetListener(getGraphicalViewer()));
    }
public Object getAdapter(final Class type)
配置与该Editor相关的Outline,Property views 以及ZoomManager.
    public Object getAdapter(final Class type) {
        // this will select the TabbedPropertyPage instead of the classic property view
        // available in Eclipse 3.2
        if (type == IPropertySheetPage.class) {
            return new TalendTabbedPropertySheetPage(this);
        }
        if (type == IContentOutlinePage.class) {
            outlinePage = new OutlinePage(new TreeViewer());
            return outlinePage;
        }
        if (type == ZoomManager.class) {
            return getGraphicalViewer().getProperty(ZoomManager.class.toString());
        }
        return super.getAdapter(type);
    }
protected PaletteRoot getPaletteRoot()
负责Palette上各个组件的初始化
        if (paletteRoot == null) {
            /** * Components Factory ** */
            components = ComponentsFactoryProvider.getInstance();
            paletteRoot = TalendEditorPaletteFactory.createPalette(components);
        }
        return paletteRoot;
    }
关于类:OutlinePage
Outline的实现部分
Editor的Contributor:MultiPageEditorContributor
声明

前提
ApplicationWorkbenchWindowAdvisor.preWindowOpen() 中显示coolbar
        IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
        configurer.setShowCoolBar(true);
功能
1)负责toplevel的菜单栏的Action显示
MultiPageEditorContributor.contributeToMenu(final IMenuManager menubar)
2)负责Toolbar上面功能按钮的显示
MultiPageEditorContributor.contributeToToolBar(final IToolBarManager toolBarManager)