Package org.sylfra.idea.plugins.xstructure.config

Examples of org.sylfra.idea.plugins.xstructure.config.IXMappingSet


   * {@inheritDoc}
   */
  @NotNull
  public StructureViewModel createStructureViewModel()
  {
    IXMappingSet xMappingSet = XStructurePlugin.getInstance().getXMappingSetRegistry().getSelectedXMappingSet(file);
    if ((xMappingSet == null) && (nestedViewBuilder != null))
    {
      return nestedViewBuilder.createStructureViewModel();
    }
   
View Full Code Here


   * {@inheritDoc}
   */
  public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context)
  {
    IXMappingResolver xMappingResolver = (IXMappingResolver) context.get("xMappingResolver");
    IXMappingSet xMappingSet = (IXMappingSet) context.get("xMappingSet");
    IXMapping xMapping = xMappingResolver.createMapping();

    xMapping.setMappingSet(xMappingSet);

    xMapping.initLabelExp(reader.getAttribute("label"));
View Full Code Here

    }

    // Will be needed by XMappingConverter
    context.put("xMappingResolver", xMappingResolver);

    IXMappingSet xMappingSet = xMappingResolver.createMappingSet();
    xMappingSet.setName(reader.getAttribute("name"));
    xMappingSet.setFile(LocalFileSystem.getInstance().refreshAndFindFileByIoFile(srcFile));
    xMappingSet.setVersion(reader.getAttribute("version"));

    String priorityValue = reader.getAttribute("priority");
    if (priorityValue != null)
    {
      try
      {
        xMappingSet.setPriority(Integer.parseInt(priorityValue));
      }
      catch (NumberFormatException e)
      {
        LOGGER.warn("Priority value should be an integer : <" + priorityValue + ">, in "
          + srcFile.getName());
      }
    }

    context.put("xMappingSet", xMappingSet);

    while (reader.hasMoreChildren())
    {
      reader.moveDown();
      if ("supported-schemas".equals(reader.getNodeName()))
      {
        List supportedSchemas = (List) context.convertAnother(xMappingSet, List.class);
        xMappingSet.setSupportedSchemas(supportedSchemas);
      }
      else if ("mappings".equals(reader.getNodeName()))
      {
        String skipValue = reader.getAttribute("defaultSkip");
        xMappingSet.setDefaultSkipMode(XMappingFactoryXmlImpl.readSkipMode(skipValue));

        List<IXMapping> mappings =
          (List<IXMapping>) context.convertAnother(xMappingSet, List.class);
        xMappingSet.setMappings(mappings);
      }
      reader.moveUp();
    }
    return xMappingSet;
  }
View Full Code Here

   *
   * @param file a mapping definition file
   */
  public void reload(@NotNull VirtualFile file)
  {
    IXMappingSet xMappingSet = bySourceFileRegistry.get(file);
    if (xMappingSet == null)
    {
      return;
    }

    IXMappingSet newXMappingSet = factory.reload(xMappingSet);
    if (newXMappingSet == null)
    {
      return;
    }

View Full Code Here

   *
   * @return the selected mapping set for the specified XML file
   */
  public IXMappingSet getSelectedXMappingSet(XmlFile xmlFile)
  {
    IXMappingSet result = byOpenFileRegistry.get(xmlFile);

    // /!\ The xml file may be registered with a null IXMappingSet !
    if ((result == null) && (!byOpenFileRegistry.containsKey(xmlFile)))
    {
      // Use first eligible mapping set
View Full Code Here

    {
      return;
    }

    XmlFile xmlFile = (XmlFile) psiFile;
    IXMappingSet xMappingSet =
      XStructurePlugin.getInstance().getXMappingSetRegistry().getSelectedXMappingSet(xmlFile);
    if (xMappingSet == null)
    {
      return;
    }

    FileEditorManager.getInstance(project).openFile(xMappingSet.getFile(), true);
  }
View Full Code Here

    {
      return actionGroup;
    }

    Set<IXMappingSet> xMappingSets = mappingSetRegistry.getAvailableXMappingSets(xmlFile);
    IXMappingSet selectedXMappingSet = mappingSetRegistry.getSelectedXMappingSet(xmlFile);

    // An item to select no mapping set
    actionGroup.add(new XMappingSetChoiceAction(xmlFile, null,
      (selectedXMappingSet == null)));
View Full Code Here

TOP

Related Classes of org.sylfra.idea.plugins.xstructure.config.IXMappingSet

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.