Author: rombert Date: Tue Jun 24 14:00:08 2014 New Revision: 1605086 URL: http://svn.apache.org/r1605086 Log: SLING-3693 - Repository import wizard blocks UI thread and is not cancellable
Added ProgressUtils to ease work with cancellable progress monitors. Added: sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/progress/ sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/progress/ProgressUtils.java (with props) Modified: sling/trunk/tooling/ide/eclipse-core/META-INF/MANIFEST.MF Modified: sling/trunk/tooling/ide/eclipse-core/META-INF/MANIFEST.MF URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-core/META-INF/MANIFEST.MF?rev=1605086&r1=1605085&r2=1605086&view=diff ============================================================================== --- sling/trunk/tooling/ide/eclipse-core/META-INF/MANIFEST.MF (original) +++ sling/trunk/tooling/ide/eclipse-core/META-INF/MANIFEST.MF Tue Jun 24 14:00:08 2014 @@ -42,6 +42,7 @@ Import-Package: org.apache.commons.httpc org.json, org.osgi.service.component;version="1.1.0" Export-Package: org.apache.sling.ide.eclipse.core, - org.apache.sling.ide.eclipse.core.internal, org.apache.sling.ide.eclipse.core.debug, - org.apache.sling.ide.eclipse.internal.validation;x-friends:=org.apache.sling.ide.eclipse-test + org.apache.sling.ide.eclipse.core.internal, + org.apache.sling.ide.eclipse.core.progress, + org.apache.sling.ide.eclipse.internal.validation;x-friends:="org.apache.sling.ide.eclipse-test" Added: sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/progress/ProgressUtils.java URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/progress/ProgressUtils.java?rev=1605086&view=auto ============================================================================== --- sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/progress/ProgressUtils.java (added) +++ sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/progress/ProgressUtils.java Tue Jun 24 14:00:08 2014 @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.sling.ide.eclipse.core.progress; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; + +/** + * The <tt>ProgressUtils</tt> provides convenience methods for working with {@link IProgressMonitor} instances. + * + */ +public abstract class ProgressUtils { + + public static void advance(IProgressMonitor monitor, int ticks) { + monitor.worked(ticks); + if (monitor.isCanceled()) { + throw new OperationCanceledException(); + } + } + + private ProgressUtils() { + + } +} Propchange: sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/progress/ProgressUtils.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/progress/ProgressUtils.java ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision Rev URL