Package org.eclipse.core.resources

Examples of org.eclipse.core.resources.IFile


          charStart = partition.getOffset() + tmlInfo.getContent().indexOf("ref")+"ref='".length();
          charEnd = charStart + tmlInfo.getAttributeValue("ref").length();
        }           
        if (tmlInfo.hasAttribute("ref")) {
          String ref = tmlInfo.getAttributeValue("ref")
          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")) {
View Full Code Here


  private void handleActionReference(IFile file, ITypedRegion partition, TMLRegion tmlInfo, String attributeName) {
    int charStart = partition.getOffset();
    int charEnd = charStart + partition.getLength();
    String ref = tmlInfo.getAttributeValue(attributeName);
    if (ref != null && ref.contains(":")) {
      IFile referencedFile = null;
      String referenceType = null;
      String referencePath = null;
             
      referencedFile = WGADesignStructureHelper.findReferencedScript(file, ref, WGADesignStructureHelper.SCRIPT_TYPE_TMLSCRIPT);
      referenceType = REFERENCE_TYPE_SCRIPT;
View Full Code Here

  private void handleURLLayoutReference(IFile file, ITypedRegion partition, TMLRegion tmlInfo) {
    int charStart = partition.getOffset() + tmlInfo.getContent().indexOf("layout")+"layout='".length();
    int charEnd = charStart + tmlInfo.getAttributeValue("layout").length();
   
    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("")) {
View Full Code Here

    int charEnd = charStart + partition.getLength();
   
    String type = tmlInfo.getAttributeValue("type");
    if ( type != null ) {
      String ref = tmlInfo.getAttributeValue("name");
      IFile referencedFile = null;
      String referenceType = null;
      String referencePath = null;
      if (type.equals(WGADesignStructureHelper.SCRIPT_TYPE_CSS) || type.equals(WGADesignStructureHelper.SCRIPT_TYPE_JS))  {           
        referencedFile = WGADesignStructureHelper.findReferencedScript(file, ref, type);
        referenceType = REFERENCE_TYPE_SCRIPT;
View Full Code Here

            TMLRegion tmlInfo = TMLRegion.parse(region, document, offset);
            if (tmlInfo.isCursorInTagName()) {
              return alphaNumericControlsNoEnter;
            } else if (tmlInfo.isCursorInAttributeValue()) {
               // check if attribute is tmlscript expression
                IFile activeFile = Plugin.getDefault().getActiveFile();
                String tagName = tmlInfo.getTagName();
                if (activeFile != null && tagName != null) {
                    VersionCompliance versionCompliance = WGADesignStructureHelper.getWGAVersionCompliance(activeFile);
                    if (versionCompliance != null) {
                        TMLTag tag = TMLTagDefinitions.getInstance(versionCompliance).getTagByName(tagName);
View Full Code Here

  public String getTypeLabel() {
    return null;
  }

  public void open() {
    IFile file = Plugin.getDefault().getActiveFile();
    if (file != null) {
      IFile referenceFile = WGADesignStructureHelper.findReferencedScript(file, _reference, _scriptType);
      if (referenceFile != null) {
        if (Plugin.getDefault().isDebugging()) {
          System.out.println(referenceFile.getProjectRelativePath());
        }
        try {
          WorkbenchUtils.openEditor(Plugin.getDefault().getWorkbench(), referenceFile);
        } catch (PartInitException e) {
          Plugin.getDefault().logError("Unable to open editor for reference '" + _reference + "'.", e);
View Full Code Here

  public String getTypeLabel() {
    return null;
  }

  public void open() {
    IFile file = Plugin.getDefault().getActiveFile();
    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) {
        if (Plugin.getDefault().isDebugging()) {
          System.out.println(referenceFile.getProjectRelativePath());
        }
        Plugin.getDefault().openLabelEditor(referenceFile, _reference);
      }
    }
  }
View Full Code Here

 
  @Override
  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);
        if (wrappedTitle.startsWith(":")) {
View Full Code Here

    Iterator<IEditorPart> editors = findOpenEditors(workbench, id).iterator();
    List<IEditorPart> filteredEditors = new ArrayList<IEditorPart>();
    while (editors.hasNext()) {
      IEditorPart editorPart = editors.next();
      if (editorPart.getEditorInput() instanceof FileEditorInput && editorPart.getEditorInput() != null) {
        IFile inputFile = ((FileEditorInput) editorPart.getEditorInput()).getFile();
        if (container.getLocation().isPrefixOf(inputFile.getLocation())) {
          filteredEditors.add(editorPart);
        }
      }
    }
    return filteredEditors;
View Full Code Here

 
  public static IFile determineSyncInfo(IContainer container) {   
    IContainer parent = container;
    while (parent instanceof IFolder) {
      parent = parent.getParent();
      IFile syncInfo = parent.getFile(new Path(DesignDirectory.DESIGN_DEFINITION_FILE));
      if (syncInfo.exists()) {
        return syncInfo;
      }
      syncInfo = parent.getFile(new Path(DesignDirectory.SYNCINFO_FILE));
      if (syncInfo.exists()) {
        return syncInfo;
      }
    }
    return null;
  }
View Full Code Here

TOP

Related Classes of org.eclipse.core.resources.IFile

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.