You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

AjBuildNotifier.java 2.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*******************************************************************************
  2. * Copyright (c) 2004 IBM Corporation and others.
  3. * All rights reserved. This program and the accompanying materials
  4. * are made available under the terms of the Eclipse Public License v 2.0
  5. * which accompanies this distribution, and is available at
  6. * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
  7. *
  8. * Contributors:
  9. * IBM Corporation - initial API and implementation
  10. *******************************************************************************/
  11. package org.aspectj.ajdt.internal.core.builder;
  12. import org.aspectj.bridge.IProgressListener;
  13. import org.eclipse.core.runtime.IProgressMonitor;
  14. import org.aspectj.org.eclipse.jdt.internal.core.builder.BuildNotifier;
  15. import java.util.function.BooleanSupplier;
  16. /**
  17. * @author colyer
  18. *
  19. * Build progress notification inside Eclipse
  20. */
  21. public class AjBuildNotifier extends BuildNotifier implements IProgressListener {
  22. /**
  23. * @param monitor
  24. * @param project
  25. */
  26. public AjBuildNotifier(IProgressMonitor monitor, int buildKind, BooleanSupplier interruptSupplier) {
  27. super(monitor, buildKind, interruptSupplier);
  28. }
  29. /* (non-Javadoc)
  30. * @see org.aspectj.bridge.IProgressListener#setText(java.lang.String)
  31. */
  32. public void setText(String text) {
  33. subTask(text);
  34. }
  35. /* (non-Javadoc)
  36. * @see org.aspectj.bridge.IProgressListener#setProgress(double)
  37. */
  38. public void setProgress(double percentDone) {
  39. updateProgress((float)(percentDone/100.0f));
  40. }
  41. /* (non-Javadoc)
  42. * @see org.aspectj.bridge.IProgressListener#setCancelledRequested(boolean)
  43. */
  44. public void setCancelledRequested(boolean cancelRequested) {
  45. // no-op
  46. }
  47. /* (non-Javadoc)
  48. * @see org.aspectj.bridge.IProgressListener#isCancelledRequested()
  49. */
  50. public boolean isCancelledRequested() {
  51. // can't delegate to super methods as they throw exception, which is not what we want inside weaver
  52. boolean cancelRequested = cancelling;
  53. if (monitor != null) {
  54. cancelRequested = cancelRequested || monitor.isCanceled();
  55. }
  56. return cancelRequested;
  57. }
  58. }