Examples of ISchedulingRule


Examples of org.eclipse.core.runtime.jobs.ISchedulingRule

    monitor = Policy.monitorFor(monitor);
    try {
      String message = NLS.bind(Messages.resources_creating, getFullPath());
      monitor.beginTask(message, Policy.totalWork);
      checkValidPath(path, FOLDER, true);
      final ISchedulingRule rule = workspace.getRuleFactory().createRule(this);
      try {
        workspace.prepareOperation(rule, monitor);
        IFileStore store = getStore();
        IFileInfo localInfo = store.fetchInfo();
        assertCreateRequirements(store, localInfo, updateFlags);
View Full Code Here

Examples of org.eclipse.core.runtime.jobs.ISchedulingRule

    return getFileTable().getFiles();
  }

  public void processResourceChangeEvents(IResourceChangeListener listener) {
    try {
      final ISchedulingRule rule = workspace.getRoot();
      try {
        workspace.prepareOperation(rule, null);
        if (oldTree == null || newTree == null)
          return;
        workspace.beginOperation(true);
View Full Code Here

Examples of org.eclipse.core.runtime.jobs.ISchedulingRule

  private void doBuild(IProgressMonitor monitor) throws CoreException, OperationCanceledException {
    monitor = Policy.monitorFor(monitor);
    try {
      monitor.beginTask("", Policy.opWork); //$NON-NLS-1$
      final ISchedulingRule rule = workspace.getRuleFactory().buildRule();
      try {
        workspace.prepareOperation(rule, monitor);
        workspace.beginOperation(true);
        final int trigger = IncrementalProjectBuilder.AUTO_BUILD;
        workspace.broadcastBuildEvent(workspace, IResourceChangeEvent.PRE_BUILD, trigger);
View Full Code Here

Examples of org.eclipse.core.runtime.jobs.ISchedulingRule

      isSaving = true;
      String message = Messages.resources_saving_0;
      monitor.beginTask(message, 7);
      message = Messages.resources_saveWarnings;
      MultiStatus warnings = new MultiStatus(ResourcesPlugin.PI_RESOURCES, IStatus.WARNING, message, null);
      ISchedulingRule rule = project != null ? (IResource) project : workspace.getRoot();
      try {
        workspace.prepareOperation(rule, monitor);
        workspace.beginOperation(false);
        hookStartSave(kind, project);
        long start = System.currentTimeMillis();
View Full Code Here

Examples of org.eclipse.core.runtime.jobs.ISchedulingRule

    IResource[] oneResource = new IResource[1];
    for (int i = 0; i < resources.length; i++) {
      if (resources[i].getType() == IResource.ROOT)
        return root;
      oneResource[0] = resources[i];
      ISchedulingRule rule = factoryFor(resources[i]).validateEditRule(oneResource);
      if (rule != null)
        rules.add(rule);
    }
    if (rules.isEmpty())
      return null;
View Full Code Here

Examples of org.eclipse.core.runtime.jobs.ISchedulingRule

                log(new Status(IStatus.WARNING, ResourcesPlugin.PI_RESOURCES, IStatus.WARNING, message, null));
              }
            }
          }
        };
        ISchedulingRule rule = factory.deleteRule(fileInWorkspace);
        try {
          ResourcesPlugin.getWorkspace().run(operation, rule, IResource.NONE, null);
        } catch (OperationCanceledException e) {
          throw new BackingStoreException(Messages.preferences_operationCanceled);
        }
        return;
      }
      table.put(VERSION_KEY, VERSION_VALUE);
      ByteArrayOutputStream output = new ByteArrayOutputStream();
      try {
        table.store(output, null);
      } catch (IOException e) {
        String message = NLS.bind(Messages.preferences_saveProblems, absolutePath());
        log(new Status(IStatus.ERROR, Platform.PI_RUNTIME, IStatus.ERROR, message, e));
        throw new BackingStoreException(message);
      } finally {
        try {
          output.close();
        } catch (IOException e) {
          // ignore
        }
      }
      final InputStream input = new BufferedInputStream(new ByteArrayInputStream(output.toByteArray()));
      IWorkspaceRunnable operation = new IWorkspaceRunnable() {
        public void run(IProgressMonitor monitor) throws CoreException {
          if (fileInWorkspace.exists()) {
            if (Policy.DEBUG_PREFERENCES)
              Policy.debug("Setting preference file contents for: " + fileInWorkspace.getFullPath()); //$NON-NLS-1$
            if (fileInWorkspace.isReadOnly()) {
              IStatus status = fileInWorkspace.getWorkspace().validateEdit(new IFile[] {fileInWorkspace}, IWorkspace.VALIDATE_PROMPT);
              if (!status.isOK())
                throw new CoreException(status);
            }
            // set the contents
            fileInWorkspace.setContents(input, IResource.KEEP_HISTORY, null);
          } else {
            // create the file
            IFolder folder = (IFolder) fileInWorkspace.getParent();
            if (!folder.exists()) {
              if (Policy.DEBUG_PREFERENCES)
                Policy.debug("Creating parent preference directory: " + folder.getFullPath()); //$NON-NLS-1$
              folder.create(IResource.NONE, true, null);
            }
            if (Policy.DEBUG_PREFERENCES)
              Policy.debug("Creating preference file: " + fileInWorkspace.getLocation()); //$NON-NLS-1$
            fileInWorkspace.create(input, IResource.NONE, null);
          }
        }
      };
      //don't bother with scheduling rules if we are already inside an operation
      try {
        if (((Workspace) workspace).getWorkManager().isLockAlreadyAcquired()) {
          operation.run(null);
        } else {
          // we might: create the .settings folder, create the file, or modify the file.
          ISchedulingRule rule = MultiRule.combine(factory.createRule(fileInWorkspace.getParent()), factory.modifyRule(fileInWorkspace));
          workspace.run(operation, rule, IResource.NONE, null);
        }
      } catch (OperationCanceledException e) {
        throw new BackingStoreException(Messages.preferences_operationCanceled);
      }
View Full Code Here

Examples of org.eclipse.core.runtime.jobs.ISchedulingRule

      monitor.beginTask(message, Policy.totalWork);
      Policy.checkCanceled(monitor);
      destination = makePathAbsolute(destination);
      checkValidPath(destination, getType(), false);
      Resource destResource = workspace.newResource(destination, getType());
      final ISchedulingRule rule = workspace.getRuleFactory().copyRule(this, destResource);
      try {
        workspace.prepareOperation(rule, monitor);
        // The following assert method throws CoreExceptions as stated in the IResource.copy API
        // and assert for programming errors. See checkCopyRequirements for more information.
        assertCopyRequirements(destination, getType(), updateFlags);
View Full Code Here

Examples of org.eclipse.core.runtime.jobs.ISchedulingRule

    try {
      String message = NLS.bind(Messages.links_creating, getFullPath());
      monitor.beginTask(message, Policy.totalWork);
      Policy.checkCanceled(monitor);
      checkValidPath(path, FOLDER, true);
      final ISchedulingRule rule = workspace.getRuleFactory().createRule(this);
      try {
        workspace.prepareOperation(rule, monitor);
        IFileInfo fileInfo = assertLinkRequirements(localLocation, updateFlags);
        workspace.broadcastEvent(LifecycleEvent.newEvent(LifecycleEvent.PRE_LINK_CREATE, this));
        workspace.beginOperation(true);
View Full Code Here

Examples of org.eclipse.core.runtime.jobs.ISchedulingRule

  /* (non-Javadoc)
   * @see IResource#createMarker(String)
   */
  public IMarker createMarker(String type) throws CoreException {
    Assert.isNotNull(type);
    final ISchedulingRule rule = workspace.getRuleFactory().markerRule(this);
    try {
      workspace.prepareOperation(rule, null);
      checkAccessible(getFlags(getResourceInfo(false, false)));
      workspace.beginOperation(true);
      MarkerInfo info = new MarkerInfo();
View Full Code Here

Examples of org.eclipse.core.runtime.jobs.ISchedulingRule

    monitor = Policy.monitorFor(monitor);
    try {
      String message = NLS.bind(Messages.resources_deleting, getFullPath());
      monitor.beginTask("", Policy.totalWork * 1000); //$NON-NLS-1$
      monitor.subTask(message);
      final ISchedulingRule rule = workspace.getRuleFactory().deleteRule(this);
      try {
        workspace.prepareOperation(rule, monitor);
        // if there is no resource then there is nothing to delete so just return
        if (!exists())
          return;
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.