Package com.dubture.getcomposer.core.objects

Examples of com.dubture.getcomposer.core.objects.Namespace


  }

  protected void addComposerJson(IProgressMonitor monitor) throws CoreException {

    IFile file = getProject().getFile(com.dubture.getcomposer.core.ComposerConstants.COMPOSER_JSON);
    Namespace ns = firstPage.getPackage().getAutoload().getPsr4().getFirst();

    if (ns != null) {
//      if (ns.getNamespace().contains("\\")) {
//        String[] split = ns.getNamespace().split("\\\\");
//        IPath path = new Path(com.dubture.composer.core.ComposerPluginConstants.DEFAULT_SRC_FOLDER);
View Full Code Here


    String text = getText(obj);

    StyledString styledString = new StyledString(text);

    if (obj instanceof Namespace) {
      Namespace namespace = (Namespace) obj;
      styledString.append(" (" + namespace.size() + ")", StyledString.COUNTER_STYLER);
      cell.setImage(namespaceImage);
    } else {
      cell.setImage(pathImage);
    }
View Full Code Here

  public Object[] getChildren(Object parentElement) {
    if (parentElement instanceof Psr) {
      Psr psr0 = (Psr) parentElement;
      return psr0.getNamespaces().toArray();
    } else if (parentElement instanceof Namespace) {
      Namespace model = (Namespace) parentElement;
      return model.getPaths().toArray();
    }

    return new Object[] {};
  }
View Full Code Here

    updateNamespace(autoloadGroup.getNamespace());
  }
 
  protected void updateNamespace(String namespace) {

    Namespace ns = new Namespace();
    ns.setNamespace(namespace);
    ns.add(ComposerPluginConstants.DEFAULT_SRC_FOLDER);
   
    firstPage.getPackage().getAutoload().getPsr4().clear();
    firstPage.getPackage().getAutoload().getPsr4().add(ns);
  }
View Full Code Here

    manager.add(removeAction);
  }

  private void handleAdd() {
    PsrDialog dialog = new PsrDialog(psrViewer.getTree().getShell(),
        new Namespace(),
        getPage().getComposerEditor().getProject());

    if (dialog.open() == Dialog.OK) {
      psr.add(dialog.getNamespace());
    }
View Full Code Here

    }
  }

  private void handleEdit() {
   
    Namespace namespace = null;
    Object element = ((StructuredSelection) psrViewer.getSelection()).getFirstElement();
   
    // get parent if element is string
    if (element instanceof String) {
      element = ((PsrController)psrViewer.getContentProvider()).getParent(element);
    }
   
    if (element instanceof Namespace) {
      namespace = ((Namespace) element).clone();
    }
        
    if (namespace != null) {
      PsrDialog diag = new PsrDialog(psrViewer.getTree().getShell(),
          namespace.clone(),
          getPage().getComposerEditor().getProject());
     
      if (diag.open() == Dialog.OK) {
        Namespace nmspc = psr.get(namespace.getNamespace());
        nmspc.clear();
        nmspc.setNamespace(diag.getNamespace().getNamespace());
        nmspc.addPaths(diag.getNamespace().getPaths());
      }
    }
  }
View Full Code Here

    Object element = ((StructuredSelection) psrViewer.getSelection()).getFirstElement();
   
    if (element instanceof Namespace) {
      psr.remove((Namespace) element);
    } else if (element instanceof String) {
      Namespace namespace = (Namespace)((PsrController)psrViewer.getContentProvider()).getParent(element);
      namespace.remove((String)element);
    }
  }
View Full Code Here

  }
 
  private String getPsrNamespace(IPath path, Psr psr) {
    IPath appendix = new Path("");
    while (!path.isEmpty()) {
      Namespace namespace = psr.getNamespaceForPath(path.addTrailingSeparator().toString());
      if (namespace == null) {
        namespace = psr.getNamespaceForPath(path.removeTrailingSeparator().toString());
      }
     
      if (namespace != null) {
        String nmspc = namespace.getNamespace();
        IPath nmspcPath = new Path(nmspc.replace("\\", "/"));
       
        int match = nmspcPath.matchingFirstSegments(appendix);
        appendix = appendix.removeFirstSegments(match);
View Full Code Here

            if (resourcePath.startsWith("/")) {
                resourcePath = resourcePath.replaceFirst("/", "");
            }
           
            String ns = namespace.getValue().replace("'", "").replace("\\\\", "\\");
            psr0.add(new Namespace(ns, resourcePath));
        }
View Full Code Here

    clear();
    if (obj instanceof JSONObject) {
      JSONObject json = (JSONObject) obj;
     
      for (Entry<String, Object> entry : ((Map<String, Object>)json).entrySet()) {
        Namespace nmspc = new Namespace();
        nmspc.setNamespace(entry.getKey());
       
        if (entry.getValue() instanceof JSONArray) {
          for (Object path : (JSONArray)entry.getValue()) {
            nmspc.add((String)path);
          }
        } else {
          nmspc.add((String)entry.getValue());
        }
        add(nmspc);
      }
    }
  }
View Full Code Here

TOP

Related Classes of com.dubture.getcomposer.core.objects.Namespace

Copyright © 2018 www.massapicom. 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.