Package com.google.gdt.eclipse.designer.model.web

Examples of com.google.gdt.eclipse.designer.model.web.WebDocumentEditContext


  private static Change modifyWeb(IType type, DocumentModelVisitor visitor) throws Exception {
    IProject project = type.getCompilationUnit().getUnderlyingResource().getProject();
    String webFolderName = WebUtils.getWebFolderName(project);
    IFile webFile = project.getFile(webFolderName + "/WEB-INF/web.xml");
    if (webFile.exists()) {
      WebDocumentEditContext context = new WebDocumentEditContext(webFile);
      return modifyXML(webFile, visitor, context);
    }
    return null;
  }
View Full Code Here


      return null;
    }
    // search for "welcome-file"
    List<String> welcomeFileNames = Lists.newArrayList();
    try {
      WebDocumentEditContext context = new WebDocumentEditContext(webFile);
      try {
        WebAppElement webApp = context.getWebAppElement();
        for (WelcomeFileListElement welcomeFileList : webApp.getWelcomeFileListElements()) {
          for (WelcomeFileElement welcomeFile : welcomeFileList.getWelcomeFiles()) {
            String welcomeFileName = welcomeFile.getName();
            welcomeFileNames.add(welcomeFileName);
          }
        }
      } finally {
        context.disconnect();
      }
    } catch (Throwable e) {
      throw new DesignerException(IExceptionConstants.INVALID_WEB_XML,
          e,
          webFile.getFullPath().toPortableString(),
View Full Code Here

    ModuleDescription moduleDescription = Utils.getSingleModule(packageFragment);
    ModuleElement module = Utils.readModule(moduleDescription);
    // update web.xml
    String webFolderName = WebUtils.getWebFolderName(project);
    IFile webFile = project.getFile(new Path(webFolderName + "/WEB-INF/web.xml"));
    WebDocumentEditContext context = new WebDocumentEditContext(webFile);
    try {
      WebAppElement moduleElement = context.getWebAppElement();
      // add new servlet definition
      {
        String servletClassName = serverPackageName + "." + serviceName + "Impl";
        String pattern = "/" + module.getName() + "/" + serviceName;
        // servlet
        com.google.gdt.eclipse.designer.model.web.ServletElement servletElement =
            new com.google.gdt.eclipse.designer.model.web.ServletElement();
        moduleElement.addChild(servletElement);
        servletElement.setName(serviceName);
        servletElement.setClassName(servletClassName);
        // servlet-mapping
        com.google.gdt.eclipse.designer.model.web.ServletMappingElement servletMappingElement =
            new com.google.gdt.eclipse.designer.model.web.ServletMappingElement();
        moduleElement.addChild(servletMappingElement);
        servletMappingElement.setName(serviceName);
        servletMappingElement.setPattern(pattern);
      }
      // commit modifications
      context.commit();
    } finally {
      context.disconnect();
    }
  }
View Full Code Here

      m_webContent = getSource(lines);
      ByteArrayInputStream input = new ByteArrayInputStream(m_webContent.getBytes());
      m_webFile.setContents(input, true, false, null);
    }
    // prepare new edit context
    m_editContext = new WebDocumentEditContext(m_webFile);
    // prepare web-app element
    m_webElement = m_editContext.getWebAppElement();
  }
View Full Code Here

TOP

Related Classes of com.google.gdt.eclipse.designer.model.web.WebDocumentEditContext

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.