/**
   * ********************************************************************************* REQUIRED
   * METHODS FOR INTERFACES
   * ********************************************************************************
   */
  public void handleAction(WorkspaceActionEvent event) {
    if (event.getType() == WorkspaceActionEvent.MOUSE_LEFT_DBLCLICK) {
      try {
        AWorkspaceProject project = WorkspaceController.getSelectedProject(this);
        File f = URIUtils.getAbsoluteFile(getLinkURI());
        if (f == null) {
          return;
        }
        if (!f.exists()) {
          if (WorkspaceNewMapAction.createNewMap(project, f.toURI(), getName(), true) == null) {
            LogUtils.warn("could not create " + getLinkURI());
          }
        }

        Controller.getCurrentController().selectMode(MModeController.MODENAME);
        final MapIO mapIO = (MapIO) MModeController.getMModeController().getExtension(MapIO.class);

        try {
          if (mapIO.newMap(f.toURI().toURL())) {
            DocearEvent evnt =
                new DocearEvent(
                    this,
                    (DocearWorkspaceProject) project,
                    DocearEventType.NEW_MY_PUBLICATIONS,
                    Controller.getCurrentController().getMap());
            DocearController.getController().getEventQueue().dispatchEvent(evnt);
          }
        } catch (Exception e) {
          LogUtils.severe(e);
          return;
        }
      } catch (Exception e) {
        LogUtils.warn("could not open document (" + getLinkURI() + ")", e);
      }
    } else if (event.getType() == WorkspaceActionEvent.MOUSE_RIGHT_CLICK) {
      showPopup((Component) event.getBaggage(), event.getX(), event.getY());
    } else {
      // do nth for now
    }
  }
Ejemplo n.º 2
0
 /**
  * ********************************************************************************* REQUIRED
  * METHODS FOR INTERFACES
  * ********************************************************************************
  */
 public void handleAction(WorkspaceActionEvent event) {
   if (event.getType() == WorkspaceActionEvent.MOUSE_RIGHT_CLICK) {
     showPopup((Component) event.getBaggage(), event.getX(), event.getY());
   }
 }