Examples of JackElement


Examples of de.mhus.hair.jack.JackElement

   
    if (! (element instanceof JackElement) ) return null;
    String uri = getUri();
    if (uri == null) return null;
   
    JackElement jack = (JackElement)element;
    String path;
    try {
      path = jack.getNode().getPath();
    } catch (RepositoryException e) {
      e.printStackTrace();
      return null;
    }
   
View Full Code Here

Examples of de.mhus.hair.jack.JackElement

   
    final IWorkbenchPage page = window.getActivePage();
   
    for (CaoElement item : sources.getElements()) {
     
      JackElement jack = (JackElement) item;
      if (jack.hasContent()) {
       
        File tmpFile;
        try {
          tmpFile = File.createTempFile("hair", ".txt");
        } catch (IOException e1) {
          e1.printStackTrace();
          throw new CaoException(e1);
        }
        final JackEditorInput editorInput = new JackEditorInput(jack.getNode(),new Path(tmpFile.getAbsolutePath()));
       
//        IEditorReference[] editorRefs = page.findEditors(editorInput,null,IWorkbenchPage.MATCH_INPUT);
        IEditorDescriptor desc = window.getWorkbench().getEditorRegistry().getDefaultEditor(editorInput.getName());
        if (desc == null) {
          System.out.println("User default txt editor");
View Full Code Here

Examples of de.mhus.hair.jack.JackElement

   
    if (primaryType.equals("---")) return;
   
    Session session = ((JackConnection)sources.getConnection()).getSession();
   
    JackElement parent = (JackElement) sources.getElements().next();
   
    try {
      monitor.beginTask("create", 1);
      monitor.log().d("create",name,primaryType);
     
      IConfigurationElement config = services.get(primaryType);
      if (config != null) {
        CreateNodeSubOperation subOperation = (CreateNodeSubOperation)config.createExecutableExtension("class");
        nextOperation = subOperation.create(parent, name, !useTransaction);
       
      } else {
        Node newNode = parent.getNode().addNode(name,primaryType);
        if (!useTransaction) session.save();
        if (newNode != null) {
          sources.getConnection().fireElementCreated(newNode.getIdentifier());
          sources.getConnection().fireElementLink(parent.getId(), newNode.getIdentifier());
        }
      }
      monitor.worked(1);
    } catch (Throwable e) {
      monitor.log().i(e);
View Full Code Here

Examples of de.mhus.hair.jack.JackElement

   
    try {
      LinkedList<String> names = new LinkedList<String>();
      LinkedList<String> uniq = new LinkedList<String>();
     
      JackElement first = (JackElement) sources.getElements().next();
      CaoApplication app = first.getApplication();

      services.clear();
      IConfigurationElement[] config = Platform.getExtensionRegistry().getConfigurationElementsFor(SERVICE_CREATE_NODE);
      for (IConfigurationElement e : config) {
        String title = e.getAttribute("title");
        String appClass = e.getAttribute("application_class");
        boolean ok = true;
        if (!MString.isEmptyTrim(appClass)) {
          ok = false;
//          if (!ok) {
            for (Class<?> c = app.getClass(); c != null; c = c.getSuperclass())
              if (c.getName().equals(appClass)) {
                ok = true;
                break;
              }

//          }
         
          if (!ok) {
            for (Class<?> i : app.getClass().getInterfaces()) {
              if (i.getName().equals(appClass)) {
                ok = true;
                break;
              }
            }
          }
         
        }
       
        if (ok) {
          //String clazz = e.getAttribute("class");
          String id = UUID.randomUUID().toString();
          //factory.registerDriver(id,title,new Activator(e));
          names.add(title);
          uniq.add(id);
          services.put(id, e);
        }
      }
     
      names.add("---");
      uniq.add("---");
     
      for  ( NodeTypeIterator typeIter = first.getNode().getSession().getWorkspace().getNodeTypeManager().getPrimaryNodeTypes();typeIter.hasNext(); ) {
        NodeType type = typeIter.nextNodeType();
        names.add(type.getName());
        uniq.add(type.getName());
      }
      return new SimpleDynOptionsProvider(uniq.toArray(new String[uniq.size()]),names.toArray(new String[names.size()]));
View Full Code Here

Examples of de.mhus.hair.jack.JackElement

  @Override
  public boolean canExecute(CaoList list, Object... initConfig) {
    try {
   
      CaoListIterator elements = list.getElements();
      JackElement parent = (JackElement) elements.next();
      if (elements.hasNext()) return false;
      return true;
     
    } catch (Throwable t) {
     
View Full Code Here

Examples of de.mhus.hair.jack.JackElement

      throws CaoException {
   
    CaoActionList actionList = new CaoActionList();
//TODO    CapCore.getInstance().getFactory().fillWithActions(null,list, actionList);
   
    JackElement element = (JackElement)list.getElements().next();
    CaoAction action = null;
    try {
      if (element.getNode().getPrimaryNodeType().getPrimaryItemName().equals("jcr:content")) {
        action = actionList.getAction("select.open");
      }
    } catch (Exception e) {
      //e.printStackTrace();
    }
   
    if (action == null) {
      try {
        if (element.getNode().getNodes().hasNext()) {
          action = actionList.getAction("select.open.list");
        } else {
          action = actionList.getAction("select.open.attributes");         
        }
      } catch (Exception e) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.