コード例 #1
0
 @Override
 public void init(ICommonActionExtensionSite site) {
   if (site.getViewSite() instanceof ICommonViewerWorkbenchSite) {
     StructuredSelection selection =
         (StructuredSelection) site.getStructuredViewer().getSelection();
     Object fe = selection.getFirstElement();
     if (fe instanceof IRepositoryNode) {
       IRepositoryViewObject object = ((IRepositoryNode) fe).getObject();
       if (object instanceof TdTableRepositoryObject) {
         TdTableRepositoryObject tableObject = (TdTableRepositoryObject) object;
         modelElement = tableObject.getTdTable();
       } else if (object instanceof TdViewRepositoryObject) {
         TdViewRepositoryObject viewObject = (TdViewRepositoryObject) object;
         modelElement = viewObject.getTdView();
       }
     }
   }
   super.init(site);
 }
コード例 #2
0
  /**
   * DOC klliu Comment method "createTableRepositoryNode".
   *
   * @param tables
   */
  private void createViewRepositoryNode(List<TdView> views, List<IRepositoryNode> node) {
    if (views != null) {
      for (TdView view : views) {
        // create view object
        TdViewRepositoryObject metadataView = new TdViewRepositoryObject(viewObject, view);
        metadataView.setTableName(view.getName());
        metadataView.setLabel(view.getName());
        metadataView.setId(view.getName());
        // create a node for ui
        DBViewRepNode viewNode =
            new DBViewRepNode(metadataView, this, ENodeType.TDQ_REPOSITORY_ELEMENT);
        viewNode.setProperties(EProperties.LABEL, ERepositoryObjectType.METADATA_CON_TABLE);
        viewNode.setProperties(EProperties.CONTENT_TYPE, ERepositoryObjectType.METADATA_CON_VIEW);

        metadataView.setRepositoryNode(viewNode);
        node.add(viewNode);
      }
    }
  }