Examples of IFile


Examples of org.eclipse.core.resources.IFile

  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

Examples of org.eclipse.core.resources.IFile

  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

Examples of org.eclipse.core.resources.IFile

 
  @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

Examples of org.eclipse.core.resources.IFile

    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

Examples of org.eclipse.core.resources.IFile

 
  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

Examples of org.eclipse.core.resources.IFile

   * @return true/false
   */

 
  public static boolean isDirlinkFolder(IFolder container){
    IFile dirlink = container.getFile(new Path(WGUtils.DIRLINK_FILE))
    return dirlink.exists();
  }
View Full Code Here

Examples of org.eclipse.core.resources.IFile

  }

  private static IFile lookupFileReference(String referencePath, IFolder folder) {
    if (referencePath != null) {
      // first try - use unmodified referencePath
      IFile referenceFile = folder.getFile(new Path(referencePath));
      if (referenceFile.exists()) {
        return referenceFile;
      }

      // second try - lowercase referencePath
      referenceFile = folder.getFile(new Path(referencePath.toLowerCase()));
      if (referenceFile.exists()) {
        return referenceFile;
      }

      // third try - case insensitiv match on all files in folder
      CaseInsensitivReferenceSearcher searcher = new CaseInsensitivReferenceSearcher(referencePath, folder);
View Full Code Here

Examples of org.eclipse.core.resources.IFile

  public String determineDesignEncoding() {
    return determineDesignEncoding(System.getProperty("file.encoding", "UTF-8"));
  }

  private String determineDesignEncoding(String fallBackEncoding) {
    IFile syncInfo = _syncInfo;
    if (syncInfo != null) {
      try {
        WGADesignConfigurationModel model = new WGADesignConfigurationModel(syncInfo.getLocation().toFile());
        Encoding encoding = model.getDesignEncoding();
        if (encoding != null && !encoding.getKey().equals(WGADesignConfigurationModel.STRING_NOT_SET)) {
          return encoding.getKey();
        } else {
          Activator.getDefault().getLog().log(
              new Status(Status.WARNING, Activator.PLUGIN_ID, "Design encoding not set for design '" + syncInfo.getParent().getLocation().toString() + "'. Using platform encoding '"
                  + fallBackEncoding + "'."));
          return fallBackEncoding;
        }
      } catch (IOException e) {
        Activator.getDefault().getLog().log(
            new Status(Status.ERROR, Activator.PLUGIN_ID, "Unable to determine design encoding for design '" + syncInfo.getParent().getLocation().toString()
                + "'. Using platform encoding '" + fallBackEncoding + "'."));
        return fallBackEncoding;
      }
    } else {
      Activator.getDefault().getLog().log(new Status(Status.WARNING, Activator.PLUGIN_ID, "TMLFile is not member of an WGADesign. Using platform encoding '" + fallBackEncoding + "'."));
View Full Code Here

Examples of org.eclipse.core.resources.IFile

  public Set<IFile> getLabelFiles(IFolder labelContainer) throws CoreException {

    Set<IFile> files = new HashSet<IFile>();
    for (IResource innercurrent : labelContainer.members()) {
      if (innercurrent instanceof IFile) {
        IFile currentFile = (IFile) innercurrent;
        if (currentFile.getFileExtension().equals("properties")) {
          files.add(currentFile);
        }

      }
    }
View Full Code Here

Examples of org.eclipse.core.resources.IFile

  public IFile getLabelFile(String labelFileName) throws CoreException {
    IFolder labelContainer = getLabelContainer(getDevelopmentLanguage());
    if (labelContainer != null) {
      String completeFilename = labelFileName + ".properties";
      IFile labelFile = labelContainer.getFile(completeFilename);
      if (labelFile.exists()) {
        return labelFile;
      } else {
        // try case insensitiv search
        CaseInsensitivSearcher searcher = new CaseInsensitivSearcher(completeFilename);
        labelContainer.accept(searcher, IResource.DEPTH_ONE, IResource.FILE);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.