Package org.eclipse.core.resources

Examples of org.eclipse.core.resources.ResourceAttributes


      FileOutputStream wgaxmlstream = null;
      try {
          IFile wgaConfig = getWGABase().getFile(new Path("wgaconfig.xml"));
          if (wgaConfig.exists() && wgaConfig.isReadOnly()) {
                    ResourceAttributes attributes = wgaConfig.getResourceAttributes();
                    attributes.setReadOnly(false);
                    wgaConfig.setResourceAttributes(attributes);               
          }
        wgaxmlstream = new FileOutputStream(wgaConfig.getLocation().toFile());
        WGAConfiguration.write(config, wgaxmlstream);
        _wgaBase.refreshLocal(IResource.DEPTH_ONE, null);
View Full Code Here


  public void flushConfig() throws CoreException {
    FileOutputStream configFileStream = null;
    try {
      IFile configFile = getConfigFile();
      if (configFile.isReadOnly()) {
        ResourceAttributes attributes = configFile.getResourceAttributes(); // ResourceAttributes.fromFile(configFile.getLocation().toFile());
        attributes.setReadOnly(false);
        configFile.setResourceAttributes(attributes);
      }

      // we might have to update root url bc. of distribution changes
      if (getRootURL() != null) {
View Full Code Here

       final IProject fProject = project;
       final String fId = id;
       IWorkspaceRunnable operation = new IWorkspaceRunnable() {
          public void run(IProgressMonitor monitor) throws CoreException {                       
            if (fProject.isAccessible()) {
              ResourceAttributes attribs = fProject.getResourceAttributes();
              if (attribs != null && attribs.isReadOnly()) {
                attribs.setReadOnly(false);
                fProject.setResourceAttributes(attribs);
              }
             
              IProjectDescription desc = fProject.getDescription();
              ICommand[] commands = desc.getBuildSpec();           
View Full Code Here

       final IProject fProject = project;
       final String fId = id;
       IWorkspaceRunnable operation = new IWorkspaceRunnable() {
          public void run(IProgressMonitor monitor) throws CoreException {                       
            if (fProject.isAccessible()) {
              ResourceAttributes attribs = fProject.getResourceAttributes();
              if (attribs != null && attribs.isReadOnly()) {
                attribs.setReadOnly(false);
                fProject.setResourceAttributes(attribs);
              }
              IProjectDescription desc = fProject.getDescription();
              ICommand[] commands = desc.getBuildSpec();
              List<ICommand> newCommands = new ArrayList<ICommand>();
View Full Code Here

   * ensures that syncinfo and csconfig is writeable
   * @throws CoreException
   */
  public void makeDesignConfigWriteable() throws CoreException {
    if (getSyncInfo() != null && getSyncInfo().isReadOnly()) {
      ResourceAttributes attributes = getSyncInfo().getResourceAttributes();
      attributes.setReadOnly(false);
      getSyncInfo().setResourceAttributes(attributes);
    }
   
    if (getCsConfig() != null && getCsConfig().isReadOnly()) {
      ResourceAttributes attributes = getCsConfig().getResourceAttributes();
      attributes.setReadOnly(false);
      getCsConfig().setResourceAttributes(attributes);
    }
   
    if (getSchemaDefinition() != null && getSchemaDefinition().isReadOnly()) {
        ResourceAttributes attributes = getSchemaDefinition().getResourceAttributes();
            attributes.setReadOnly(false);
            getSchemaDefinition().setResourceAttributes(attributes);
    }
  }
View Full Code Here

   * @param jFile
   * @param b
   * @throws CoreException
   */
  private static void setReadOnly(IFile jFile, boolean b) throws CoreException {
    ResourceAttributes ra = new ResourceAttributes();
    ra.setReadOnly(b);
    jFile.setResourceAttributes(ra);
  }
View Full Code Here

            final String name = resource.getName();
            if (!allow_Hrl && name.toLowerCase().endsWith(".hrl")) {
                return false;
            }
            if (matches(name)) {
                final ResourceAttributes attrs = resource.getResourceAttributes();
                return attrs != null && !attrs.isSymbolicLink();
            }
            return false;
        }
View Full Code Here

    }
    return map;
  }

  private static boolean isReadOnly(IResource resource) {
    ResourceAttributes resourceAttributes = resource.getResourceAttributes();
    if (resourceAttributes == null)
      return false;
    return resourceAttributes.isReadOnly();
  }
View Full Code Here

     *            <code>false</code> to make writable
     * @return The state before setting read-only to the given value.
     */
    public static boolean setReadOnly(IResource file, boolean readOnly) {

        ResourceAttributes attributes = file.getResourceAttributes();

        if (attributes == null) {
            // TODO Throw an FileNotFoundException and deal with it everywhere!
            log.error("File does not exist for setting readOnly == " + readOnly
                + ": " + file, new StackTrace());
            return false;
        }
        boolean result = attributes.isReadOnly();

        // Already in desired state
        if (result == readOnly)
            return result;

        attributes.setReadOnly(readOnly);
        try {
            file.setResourceAttributes(attributes);
        } catch (CoreException e) {
            // failure is not an option
            log.warn("Failed to set resource readonly == " + readOnly + ": "
View Full Code Here

        if (requestedAttributes == null || requestedAttributes.contains(URIConverter.ATTRIBUTE_TIME_STAMP))
        {
          result.put(URIConverter.ATTRIBUTE_TIME_STAMP,  resource.getLocalTimeStamp());
        }
        ResourceAttributes resourceAttributes = null;
        if (requestedAttributes == null || requestedAttributes.contains(URIConverter.ATTRIBUTE_READ_ONLY))
        {
          resourceAttributes = resource.getResourceAttributes();
          result.put(URIConverter.ATTRIBUTE_READ_ONLY,  resourceAttributes.isReadOnly());
        }
        if (requestedAttributes == null || requestedAttributes.contains(URIConverter.ATTRIBUTE_ARCHIVE))
        {
          if (resourceAttributes == null)
          {
            resourceAttributes = resource.getResourceAttributes();
          }
          result.put(URIConverter.ATTRIBUTE_ARCHIVE,  resourceAttributes.isArchive());
        }
        if (requestedAttributes == null || requestedAttributes.contains(URIConverter.ATTRIBUTE_EXECUTABLE))
        {
          if (resourceAttributes == null)
          {
            resourceAttributes = resource.getResourceAttributes();
          }
          result.put(URIConverter.ATTRIBUTE_EXECUTABLE,  resourceAttributes.isExecutable());
        }
        if (requestedAttributes == null || requestedAttributes.contains(URIConverter.ATTRIBUTE_HIDDEN))
        {
          if (resourceAttributes == null)
          {
            resourceAttributes = resource.getResourceAttributes();
          }
          result.put(URIConverter.ATTRIBUTE_HIDDEN,  resourceAttributes.isHidden());
        }
        if (requestedAttributes == null || requestedAttributes.contains(URIConverter.ATTRIBUTE_DIRECTORY))
        {
          if (resourceAttributes == null)
          {
View Full Code Here

TOP

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

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.