/* (non-Javadoc)
   * @see com.hundsun.ares.studio.jres.metadata.ui.editors.AbstractMetadataFormPage#createMetadataComposite(org.eclipse.swt.widgets.Composite, org.eclipse.ui.forms.widgets.FormToolkit)
   */
  @Override
  protected void createMetadataComposite(Composite body, FormToolkit toolkit) {
    EPackage epackage = null;
    try {
      epackage = BasicDataEpackageFactory.eINSTANCE.createEPackage(getEditor().getARESResource());
    } catch (Exception e) {
      logger.error("编辑基础数据时,读取EPackage失败", e);
      return;
    }

    SashForm sashForm = new SashForm(body, SWT.VERTICAL);

    masterListViewerBlock =
        new SingleTableListViewerBlock(
            this,
            getEditingDomain(),
            getSite(),
            getEditor().getARESResource(),
            getProblemPool(),
            epackage,
            IBasicDataEpacakgeConstant.MasterItem);
    masterListViewerBlock.setEditableControl(getEditableControl());
    masterListViewerBlock.createControl(sashForm, toolkit);
    getEditor().getActionBarContributor().addGlobalActionHandlerProvider(masterListViewerBlock);

    slaveDetailViewerBlock =
        new MasterSlaveDetailViewerBlock(
            getEditingDomain(), getEditor().getARESResource(), getProblemPool(), epackage);
    slaveDetailViewerBlock.setEditableControl(getEditableControl());
    slaveDetailViewerBlock.createControl(sashForm, toolkit);
    getEditor().getActionBarContributor().addGlobalActionHandlerProvider(slaveDetailViewerBlock);

    sashForm.setWeights(new int[] {6, 4});

    masterListViewerBlock.addSelectionChangedListener(
        new ISelectionChangedListener() {

          @Override
          public void selectionChanged(SelectionChangedEvent event) {

            ISelection selection = event.getSelection();
            if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
              Object element = ((IStructuredSelection) selection).getFirstElement();
              if (!(element instanceof MetadataCategory)) {
                slaveDetailViewerBlock.setInput(element);
              }
            }
          }
        });

    addPropertyListener(masterListViewerBlock);
    getEditingDomain().getCommandStack().addCommandStackListener(masterListViewerBlock);

    addPropertyListener(slaveDetailViewerBlock);
    getEditingDomain().getCommandStack().addCommandStackListener(slaveDetailViewerBlock);
  }
 @Override
 public void infoChange() {
   masterListViewerBlock.setInput(getInfo());
   super.infoChange();
   //		masterListViewerBlock.getOperationControl().setData(getInfo());
   //		masterListViewerBlock.getOperationControl().setContext(createScriptContext());
 }