Ejemplo n.º 1
0
 public ResourceEditor edit(ResourceType type, long id) throws Exception {
   if (!resourceEditActions.containsKey(type)) {
     showUnhandledErrorDialog(
         "No editor",
         "There is no editor for resources of type: "
             + type.getDisplayString()); // actually should never happen
     return null;
   }
   ResourceEditor editor = resourceEditActions.get(type).run(ResourceInputMapper.map(id));
   return editor;
 }
Ejemplo n.º 2
0
 /**
  * @param editor
  * @throws MapperException
  */
 public IResource getResourceForEditor(ResourceEditor editor) throws MapperException {
   if (openEditors2.containsKey(editor)) {
     try {
       return ResourceInputMapper.map(openEditors2.get(editor));
     } catch (DomainObjectNotFoundException e) {
       // unexpected, but has been observed in error reports
       // in any case, callsites expect the null, and there's
       // not much useful we can do.
       Logger.getLogger(Application.class).error("", e);
     }
   }
   return null;
 }
Ejemplo n.º 3
0
  public void actionPerformed(ActionEvent event) {
    Application app = Application.getInstance();
    ResourceTreeTableModel model = resourceTreeTable.getTreeTableModel();

    Collection<? extends KNode> selectedNodes = resourceTreeTable.getSelectedNodes();
    for (KNode selectedNode : selectedNodes) {
      if (selectedNode == null) continue;
      if (selectedNode instanceof ResourceNode == false) continue;
      ResourceNode resourceNode = (ResourceNode) selectedNode;
      Long resourceId = resourceNode.getResourceId();
      if (resourceId == null) continue;
      try {
        IResource resource = ResourceInputMapper.map(resourceId);
        if (resource instanceof IMedia == false) continue;
        IMedia media = (IMedia) resource;

        doCreateSnuFromMedia(media);
      } catch (Exception e) {
        Application.getInstance()
            .showUnhandledErrorDialog(
                LanguageBundle.getString("general.errors.uncaughtexception.title"), e);
      }
    }
  }