Package de.innovationgate.eclipse.utils.wga

Examples of de.innovationgate.eclipse.utils.wga.WGADesignStructureHelper


    public void apply(IDocument document) {
      IResource resource = _markerAnnotation.getMarker().getResource();
      if (resource instanceof IFile) {
        IFile referer = (IFile) resource;
        WGADesignStructureHelper helper = new WGADesignStructureHelper(referer);
       
        try {
          helper.createLabel(_labelFilename, _labelKey, "");                 
          // revalidate tmlfile and open editor
          WGADesignResourceValidator.validate(referer);
          Plugin.getDefault().openLabelEditor(helper.getLabelFile(_labelFilename), _labelKey);         
        } catch (CoreException e) {
        }
       
      }
     
View Full Code Here


        Map<String,Object> markerAttributes = new HashMap<String,Object>();
        markerAttributes.put(ATTRIBUTE_LABELFILENAME, labelFilename);
        markerAttributes.put(ATTRIBUTE_LABELKEY, labelKey);
       

        WGADesignStructureHelper designHelper= new WGADesignStructureHelper(file);
       
     
        if (!labelFilename.equalsIgnoreCase("general")) {
          // check if labelfile exists
          try {
            IFile labelFile = designHelper.getLabelFile(labelFilename);
            if (labelFile == null || !labelFile.exists()) {
              try {             
                IRegion attributeRegion = tmlInfo.getAttributeValueRegion("file");
                if (attributeRegion != null) {
                  charStart = attributeRegion.getOffset();
                  charEnd = charStart + attributeRegion.getLength();
                }
              } catch (BadLocationException e) {
              }
             
              MarkerFactory.createErrorMarker(getMarkerID(), file, charStart, charEnd, "Labelfile '" + labelFilename + "' does not exist.", markerAttributes);
            }
          } catch (CoreException e1) {
          }
        }
       
        Set<String> labelKeys = designHelper.getLabelKeys(labelFilename);
   
        if (!labelKeys.contains(labelKey)) {
          try {
            IRegion attributeRegion = tmlInfo.getAttributeValueRegion("key");
            if (attributeRegion != null) {
View Full Code Here

          IFile referencedFile = WGADesignStructureHelper.findReferencedTMLModule(file, ref, tmlInfo.getAttributeValue("medium"));
     
          if (referencedFile == null) {
             
             
            String referencePath = new WGADesignStructureHelper(file).computeTMLModuleReferencePath(file, ref, tmlInfo.getAttributeValue("medium"));
            Map<String, Object> attributes = new HashMap<String, Object>();
            if (ref != null && !ref.trim().equals("")) {
                if (wgaVersionIsAtLeast(5, 4) && ref.startsWith("::") && ref.toLowerCase().endsWith("@base")) {
                    MarkerFactory.createErrorMarker(getMarkerID(), file, charStart, charEnd, "Illegal reference '" + tmlInfo.getAttributeValue("ref") + "'.", attributes);
                    return;
                } else {
                  attributes.put(ATTRIBUTE_REFERENCE_TYPE, REFERENCE_TYPE_TML);
                  attributes.put(ATTRIBUTE_MISSING_REFERENCE_PATH, referencePath);
                  if (tmlInfo.getTagName().equals("portlet") || (tmlInfo.getTagName().equals("include") && tmlInfo.hasAttribute("type", "portlet"))) {
                    attributes.put(ATTRIBUTE_IS_PORTLET_REFERENCE, true);
                  } else {
                    attributes.put(ATTRIBUTE_IS_PORTLET_REFERENCE, false);
                  }
                }
            }
            if (wgaVersionIsAtLeast(5, 4)) {
                if (!referencePath.contains("@base")) {
                    MarkerFactory.createErrorMarker(getMarkerID(), file, charStart, charEnd, "Unsatisfied reference '" + tmlInfo.getAttributeValue("ref") + "'.", attributes);
                }
            } else {
                MarkerFactory.createErrorMarker(getMarkerID(), file, charStart, charEnd, "Unsatisfied reference '" + tmlInfo.getAttributeValue("ref") + "'.", attributes);
            }
          }
        }   
      }
    }
   
    // validate short tml module include syntax <tml:[modulename]>
    if (wgaVersionIsAtLeast(4, 1) && tmlInfo.getTagName().matches("\\[.*\\]") && !tmlInfo.getTagName().contains("/")) {
      if (!tmlInfo.hasAttribute("designdb") && !tmlInfo.isDynamicAttributeValue("medium")) {
       
        charStart = partition.getOffset() + tmlInfo.getContent().indexOf(tmlInfo.getTagName()) + 1;
        charEnd = charStart + tmlInfo.getTagName().length() - 2;
       
       
        String ref = tmlInfo.getTagName().replaceAll("\\[", "");
        ref = ref.replaceAll("\\]", "");
        IFile referencedFile = WGADesignStructureHelper.findReferencedTMLModule(file, ref, tmlInfo.getAttributeValue("medium"));   
        if (referencedFile == null) {
          String referencePath = new WGADesignStructureHelper(file).computeTMLModuleReferencePath(file, ref, tmlInfo.getAttributeValue("medium"));
          Map<String, Object> attributes = new HashMap<String, Object>();
          if (ref != null && !ref.trim().equals("")) {
              if (wgaVersionIsAtLeast(5, 4) && ref.startsWith("::") && ref.toLowerCase().endsWith("@base")) {
                            MarkerFactory.createErrorMarker(getMarkerID(), file, charStart, charEnd, "Illegal reference '" + ref + "'.", attributes);
                            return;
View Full Code Here

   
    String ref = tmlInfo.getAttributeValue("layout")
    IFile referencedFile = WGADesignStructureHelper.findReferencedTMLModule(file, ref, tmlInfo.getAttributeValue("medium"));

    if (referencedFile == null) {
      String referencePath = new WGADesignStructureHelper(file).computeTMLModuleReferencePath(file, ref, tmlInfo.getAttributeValue("medium"));
      Map<String, Object> attributes = new HashMap<String, Object>();
      if (ref != null && !ref.trim().equals("")) {
          if (wgaVersionIsAtLeast(5, 4) && ref.startsWith("::") && ref.toLowerCase().endsWith("@base")) {
              MarkerFactory.createErrorMarker(getMarkerID(), file, charStart, charEnd, "Illegal reference '" + tmlInfo.getAttributeValue("layout") + "'.", attributes);
              return;
View Full Code Here

        referencePath = WGADesignStructureHelper.computeScriptReferencePath(file, ref, type);
      } else if (type.equals("tml") && !tmlInfo.isDynamicAttributeValue("medium")) {
        String medium = tmlInfo.getAttributeValue("medium");
        referencedFile = WGADesignStructureHelper.findReferencedTMLModule(file, ref, medium);
        referenceType = REFERENCE_TYPE_TML;           
        referencePath = new WGADesignStructureHelper(file).computeTMLModuleReferencePath(file, ref, medium);
      }
      if (referencedFile == null && referenceType != null) {
        IRegion region;
        try {             
          region = tmlInfo.getAttributeValueRegion("name");
View Full Code Here

    if (file != null) {
      String labelFilename = LabelFileLookup.determineLabelFileName(_tmlRegion);
      IFile referenceFile = null;
      try {
        if (labelFilename != null) {
          referenceFile = new WGADesignStructureHelper(file).getLabelFile(labelFilename);
        }
      } catch (CoreException e) {
        Plugin.getDefault().logError("Unable to lookup reference label file '" + labelFilename + "'.", e);
      }
      if (referenceFile != null) {
View Full Code Here

  protected void doSetInput(IEditorInput newInput) throws CoreException {
    super.doSetInput(newInput);
    // set title
    IFile input = getInputFile();
    if (input != null) {
      WGADesignStructureHelper helper = new WGADesignStructureHelper(input);
      String mediaKey = WGADesignStructureHelper.determineMediaKey(input);
      if (mediaKey == null) {
        mediaKey = "html";
      }
      int segmentsMatch = helper.getTmlRoot().getFolder(mediaKey).getFullPath().matchingFirstSegments(input.getFullPath());
      String tmlFileReference = input.getFullPath().removeFirstSegments(segmentsMatch).removeFileExtension().toString();
      tmlFileReference = tmlFileReference.replaceAll("/", ":");
     
      if (tmlFileReference.length() > 20) {
        String wrappedTitle = tmlFileReference.substring(tmlFileReference.length() - 16);
View Full Code Here

  public static Set<String> lookupValues(TMLRegion region, IFile activeFile) {
    Set<String> tmlfilerefs = new HashSet<String>();
    Set<String> nontmlspecificrefs = null;
    String medium;

    WGADesignStructureHelper designHelper = new WGADesignStructureHelper(activeFile);
    VersionCompliance versionCompliance = WGADesignStructureHelper.getWGAVersionCompliance(activeFile);

    String mymedium = WGADesignStructureHelper.determineMediaKey(activeFile);

    String tagName = region.getTagName();
    if (tagName != null && tagName.equals("url")) {
      if (region.hasAttribute("db")) {
        // cannot lookup references in foreign db
        return Collections.emptySet();
      }
    } else if (region.hasAttribute("designdb")) {
      // cannot lookup references in foreign db
      return Collections.emptySet();
    }

    if (region.getAttributeValue("type") != null) {
      if (!region.getAttributeValue("type").equals("portlet") && !region.getAttributeValue("type").equals("tml")) {
        return Collections.emptySet();
      }
    }

    if (region.getAttributeNames().contains("medium")) {
      medium = region.getAttributeValue("medium");
    } else {
      medium = mymedium;
    }

    // the path of the selected medium
    IPath mediumPath = designHelper.getTmlRoot().getFolder(new Path(medium)).getProjectRelativePath();

    // the path to the file which we are currently editing
    IPath pathOfEditedFile = activeFile.getParent().getProjectRelativePath();
    pathOfEditedFile = pathOfEditedFile.removeFirstSegments(mediumPath.segmentCount());
View Full Code Here

  public Set<String> lookupValues(TMLRegion region, IDocument document, ITextViewer viewer, IFile activeFile) {
    Set<String> labelFilenames = new HashSet<String>();
   
    try {
      WGADesignStructureHelper designHelper = new WGADesignStructureHelper(activeFile);
      String language = designHelper.getDevelopmentLanguage();
     
      IFolder labelContainer = designHelper.getLabelContainer(language);
       
      if (labelContainer != null && labelContainer.exists()) {
        Iterator<IFile> labelFiles = designHelper.getLabelFiles(labelContainer).iterator();
        while (labelFiles.hasNext()) {
          IFile labelFile = labelFiles.next();
          labelFilenames.add(labelFile.getName().substring(0, labelFile.getName().length() - (labelFile.getFileExtension().length() + 1)));
        }
      }
View Full Code Here

public class DesignDBLookup implements AttributeValueLookup {

  public Set<String> lookupValues(TMLRegion region, IDocument document, ITextViewer viewer, IFile activeFile) {
    Set<String> values = new HashSet<String>();
   
    WGADesignStructureHelper helper = new WGADesignStructureHelper(activeFile);   
    try {
      WGADesignConfigurationModel model  = helper.createModel();
      if (model.isFeatureSupported(WGADesignConfigurationModel.FEATURE_SHORTCUTS)) {
        for (Shortcut shortCut : model.getShortcuts()) {
          if (shortCut.getType() == Shortcut.TYPE_PLUGIN) {
            values.add("@" + shortCut.getShortcut());
          }
View Full Code Here

TOP

Related Classes of de.innovationgate.eclipse.utils.wga.WGADesignStructureHelper

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.