public CreateFolderViewportAction(final TreePanel treePanel) {
   super("CreateViewport", AbstractImagePrototype.create(BasicWidgetResources.ICONS.viewport()));
   this.treePanel = treePanel;
   this.executor =
       new Listener() {
         @Override
         public void handleEvent(BaseEvent be) {
           execute(selectedElement.getChildren(), selectedElement.getLabel());
           treePanel.removeListener(GeoPlatformEvents.GP_NODE_EXPANDED, this);
         }
       };
   this.message =
       new Listener<MessageBoxEvent>() {
         @Override
         public void handleEvent(MessageBoxEvent be) {
           if (be.getButtonClicked().getItemId().equalsIgnoreCase(Dialog.YES)) {
             treePanel.addListener(GeoPlatformEvents.GP_NODE_EXPANDED, executor);
             treePanel.setExpanded(selectedElement, true);
             System.out.println("Selected element: " + selectedElement);
           } else {
             treePanel.removeListener(GeoPlatformEvents.GP_NODE_EXPANDED, executor);
           }
         }
       };
 }
  public static Menu getFolderContextMenu() {
    if (folderContextMenu == null) {
      folderContextMenu = new Menu();
      folderContextMenu.add(pasteMenuItem);

      MenuItem folderRename = new MenuItem();
      folderRename.setText("Rename Folder");
      folderRename.setIcon(LayerResources.ICONS.editFolder());
      folderRename.addSelectionListener(new ShowFolderRenameAction(treePanel));
      folderContextMenu.add(folderRename);

      MenuItem createViewportFolderMenu = new MenuItem();
      createViewportFolderMenu.setText("Create Viewport");
      createViewportFolderMenu.setIcon(BasicWidgetResources.ICONS.viewport());
      createViewportFolderMenu.addSelectionListener(new CreateFolderViewportAction(treePanel));
      folderContextMenu.add(createViewportFolderMenu);
    }
    return folderContextMenu;
  }
  public static Menu getLayerContextMenu() {
    if (layerContextMenu == null) {
      layerContextMenu = new Menu();
      // add zoom to max extent
      MenuItem zoomToMaxExtend = new MenuItem();
      zoomToMaxExtend.setText("Zoom to layer extend");
      zoomToMaxExtend.setIcon(LayerResources.ICONS.zoomToMaxExtend());
      zoomToMaxExtend.addSelectionListener(new ZoomToLayerExtentAction(treePanel));
      layerContextMenu.add(zoomToMaxExtend);

      MenuItem exportMenuItem = new MenuItem();
      exportMenuItem.setText("Export");
      exportMenuItem.setSubMenu(new GPExportMenu(treePanel));
      layerContextMenu.add(exportMenuItem);

      MenuItem cqlFilterMenuItem = new MenuItem();
      cqlFilterMenuItem.setText("CQL Filter");
      cqlFilterMenuItem.setSubMenu(new GPCQLFilterMenu(treePanel));
      layerContextMenu.add(cqlFilterMenuItem);

      MenuItem timeFilterMenuItem = new MenuItem();
      timeFilterMenuItem.setText("TIME Filter");
      timeFilterMenuItem.setSubMenu(new GPTimeFilterMenu(treePanel));
      layerContextMenu.add(timeFilterMenuItem);

      MenuItem layerProperties = new MenuItem();
      layerProperties.setText("Layer Properties");
      layerProperties.setIcon(LayerResources.ICONS.layerProperties());
      layerProperties.addSelectionListener(new ShowLayerPropertiesAction(treePanel));

      MenuItem copyMenuItem = new MenuItem("Copy Layer");
      copyMenuItem.setIcon(LayerResources.ICONS.copy());
      copyMenuItem.addSelectionListener(new CopyLayerAction(treePanel, pasteAction, pasteMenuItem));

      layerContextMenu.add(copyMenuItem);

      MenuItem createViewportLayerMenu = new MenuItem();
      createViewportLayerMenu.setText("Create Viewport");
      createViewportLayerMenu.setIcon(BasicWidgetResources.ICONS.viewport());
      createViewportLayerMenu.addSelectionListener(new CreateLayerViewportAction(treePanel));
      layerContextMenu.add(createViewportLayerMenu);

      // TODO ADD EditWFS dynamically
      EditWFSAction editFeatureAction = new EditWFSAction(treePanel);
      MenuItem editFeature = new MenuItem();
      editFeature.setText(editFeatureAction.getTitle());
      editFeature.setIcon(editFeatureAction.getImage());
      editFeature.addSelectionListener(editFeatureAction);
      layerContextMenu.add(editFeature);

      refreshTimeComboBox =
          new ComboBox() {
            @Override
            protected void onSelect(ModelData model, int index) {
              super.onSelect(model, index);
              refreshTimeComboBox.clearSelections();
              layerContextMenu.hide();
            }
          };
      refreshTimeComboBox.setEmptyText("Refresh Time");
      ListStore<LayerRefreshTimeValue> store = new ListStore<LayerRefreshTimeValue>();
      store.add(LayerRefreshTimeValue.getLayerRefreshTimeList());
      refreshTimeComboBox.setStore(store);
      refreshTimeComboBox.setEditable(Boolean.FALSE);
      refreshTimeComboBox.setForceSelection(Boolean.TRUE);
      refreshTimeComboBox.setTypeAhead(Boolean.FALSE);
      refreshTimeComboBox.setUseQueryCache(Boolean.FALSE);
      refreshTimeComboBox.setDisplayField(LayerRefreshTimeValue.REFRESH_TIME_KEY);
      //        refreshMenuItem.setIcon(LayerResources.ICONS.layerRefresh());
      refreshTimeComboBox.addSelectionChangedListener(new RefreshLayerAction(treePanel));
      layerContextMenu.add(refreshTimeComboBox);

      layerContextMenu.add(layerProperties);
    }
    return layerContextMenu;
  }