Esempio n. 1
0
 /**
  * Returns the currently open editors for the given type in order of most recently focused
  *
  * @throws MapperException
  */
 public Collection<ResourceEditor> getOpenEditors(ResourceType type) throws MapperException {
   Collection<ResourceEditor> editors = new ArrayList<ResourceEditor>();
   for (ResourceEditor editor : openEditors.values()) {
     if (type == ResourceType.forId(getResourceForEditor(editor).getType())) editors.add(editor);
   }
   return editors;
 }
Esempio n. 2
0
 /**
  * Returns the currently open editors for the given type in order of most recently focused
  *
  * @throws MapperException
  */
 public Collection<IResource> getOpenResources(ResourceType type) throws MapperException {
   Collection<IResource> resources = new ArrayList<>();
   for (ResourceEditor editor : openEditors.values()) {
     if (type == ResourceType.forId(getResourceForEditor(editor).getType()))
       resources.add(getResourceForEditor(editor));
   }
   return resources;
 }
Esempio n. 3
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;
 }
Esempio n. 4
0
 public ResourceEditor editNew(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(null);
   if (id != null) openEditors2.put(editor, id);
   return editor;
 }