Package org.eclipse.core.internal.resources

Examples of org.eclipse.core.internal.resources.ResourceException


      return false;
    return true;
  }

  protected void fail(String reason) throws CoreException {
    throw new ResourceException(new Status(IStatus.ERROR, ResourcesPlugin.PI_RESOURCES, 1, reason, null));
  }
View Full Code Here


        } finally {
          //always send POST_BUILD if there has been a PRE_BUILD
          workspace.broadcastBuildEvent(workspace, IResourceChangeEvent.POST_BUILD, trigger);
        }
        if (!result.isOK())
          throw new ResourceException(result);
        buildNeeded = false;
      } finally {
        //building may close the tree, but we are still inside an
        // operation so open it
        if (workspace.getElementTree().isImmutable())
View Full Code Here

          break;
        default :
          //if we get here the properties file is corrupt
          IPath resourcePath = projectName == null ? Path.ROOT : Path.ROOT.append(projectName);
          String msg = NLS.bind(Messages.properties_readProperties, resourcePath.toString());
          throw new ResourceException(IResourceStatus.FAILED_READ_METADATA, null, msg, null);
      }
      // localName
      properties[j][1] = source.readUTF();
      // propertyValue
      properties[j][2] = source.readUTF();
View Full Code Here

          int bytesRead = -1;
          try {
            bytesRead = source.read(buffer);
          } catch (IOException e) {
            String msg = NLS.bind(Messages.localstore_failedReadDuringWrite, path);
            throw new ResourceException(IResourceStatus.FAILED_READ_LOCAL, new Path(path), msg, e);
          }
          if (bytesRead == -1)
            break;
          try {
            destination.write(buffer, 0, bytesRead);
          } catch (IOException e) {
            String msg = NLS.bind(Messages.localstore_couldNotWrite, path);
            throw new ResourceException(IResourceStatus.FAILED_WRITE_LOCAL, new Path(path), msg, e);
          }
          monitor.worked(1);
        }
      }
    } finally {
View Full Code Here

      stream = new FileOutputStream(versionFile);
      stream.write(current.getVersion());
    } catch (IOException e) {
      failed = true;
      String message = NLS.bind(Messages.resources_writeWorkspaceMeta, versionFile.getAbsolutePath());
      throw new ResourceException(IResourceStatus.FAILED_WRITE_METADATA, null, message, e);
    } finally {
      try {
        if (stream != null)
          stream.close();
      } catch (IOException e) {
        if (!failed) {
          String message = NLS.bind(Messages.resources_writeWorkspaceMeta, versionFile.getAbsolutePath());
          throw new ResourceException(IResourceStatus.FAILED_WRITE_METADATA, null, message, e);
        }
      }
    }
  }
View Full Code Here

        int version = source.readByte();
        if (version != getVersion()) {
          // unknown version
          String message = NLS.bind(Messages.resources_readMetaWrongVersion, location.getAbsolutePath(), Integer.toString(version));
          ResourceStatus status = new ResourceStatus(IResourceStatus.FAILED_READ_METADATA, message);
          throw new ResourceException(status);
        }
        int entryCount = source.readInt();
        for (int i = 0; i < entryCount; i++)
          this.entries.put(readEntryKey(source), readEntryValue(source));
      } finally {
        source.close();
      }
    } catch (IOException ioe) {
      String message = NLS.bind(Messages.resources_readMeta, location.getAbsolutePath());
      ResourceStatus status = new ResourceStatus(IResourceStatus.FAILED_READ_METADATA, null, message, ioe);
      throw new ResourceException(status);
    }
  }
View Full Code Here

      }
      needSaving = false;
    } catch (IOException ioe) {
      String message = NLS.bind(Messages.resources_writeMeta, location.getAbsolutePath());
      ResourceStatus status = new ResourceStatus(IResourceStatus.FAILED_WRITE_METADATA, null, message, ioe);
      throw new ResourceException(status);
    }
  }
View Full Code Here

TOP

Related Classes of org.eclipse.core.internal.resources.ResourceException

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.