Example #1
0
  public void deleteNode() {
    String projectPath = LFWPersTool.getProjectWithBcpPath();
    String projectModuleName = LFWPersTool.getCurrentProjectModuleName();
    PortletApplicationDefinition portletApp =
        PortalConnector.getPortletApp(projectPath, projectModuleName);
    PortletDefinition portletDefinition = (PortletDefinition) this.getData();
    if (portletApp.getPortlet(portletDefinition.getPortletName()) != null) {
      portletApp.getPortlets().remove(portletApp.getPortlet(portletDefinition.getPortletName()));
      PortalConnector.savePortletAppToXml(projectPath, projectModuleName, portletApp);
    }

    /** 删除 portlet分类中的配置 */
    if (this.getParentItem() instanceof CategoryTreeItem) {
      Display display = PortalConnector.getDisplay(projectPath, projectModuleName);
      PortletDisplayCategory portletDisplayCategory =
          (PortletDisplayCategory) this.getParentItem().getData();
      for (PortletDisplayCategory pdc : display.getCategory()) {
        if (pdc.getId().equals(portletDisplayCategory.getId())) {
          removeDisplay(pdc, portletDefinition);
          break;
        }
      }
      PortalConnector.saveDisplayToXml(projectPath, projectModuleName, display);
    }
    dispose();
  }
Example #2
0
 private void removeDisplay(PortletDisplayCategory pdc, PortletDefinition portletDefinition) {
   for (PortletDisplay pd : pdc.getPortletDisplayList()) {
     if (pd.getId().equals(portletDefinition.getPortletName())) {
       pdc.getPortletDisplayList().remove(pd);
       break;
     }
   }
 }
Example #3
0
 /**
  * 增加右键菜单
  *
  * @param manager
  */
 public void addMenuListener(IMenuManager manager) {
   DeletePortletAction deletePortletAction = new DeletePortletAction();
   manager.add(deletePortletAction);
   if (getParentItem() instanceof CategoryTreeItem) {
     PortletDisplayCategory portletDisplayCategory =
         (PortletDisplayCategory) getParentItem().getData();
     PortletDefinition portlet = (PortletDefinition) getData();
     for (PortletDisplay pd : portletDisplayCategory.getPortletDisplayList()) {
       if (pd.getId().equals(portlet.getPortletName())) {
         if (pd.getDynamic()) {
           manager.add(new DynamicAction(true, "checked.gif"));
         } else {
           manager.add(new DynamicAction(false, "un_checked.gif"));
         }
         break;
       }
     }
   }
 }