Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 2cd7ff05814a0a05db981817201a1840a3638b62 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*******************************************************************************
 * Copyright (c) 2000, 2015 IBM Corporation and others.
 *
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License 2.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.ui.progress;

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.ui.model.IWorkbenchAdapter;

/**
 * This adapter interface provides support for lazy initialization of UI workbench elements
 * that are displayed visually. This adapter is used with an associated deferred content provider.
 *
 * @see DeferredTreeContentManager
 * @since 3.0
 */
public interface IDeferredWorkbenchAdapter extends IWorkbenchAdapter {

    /**
	 * Called by a job run in a separate thread to fetch the children of this
	 * adapter. The adapter should in return notify of new children via the
	 * collector. This is generally used when a content provider is getting
	 * elements.
	 * <p>
	 * It is good practice to check the passed in monitor for cancellation. This
	 * will provide good responsiveness for cancellation requests made by the user.
	 * </p>
	 *
	 * @param object    the object to fetch the children for
	 * @param collector the collector to notify about new children. Should not be
	 *                  <code>null</code>.
	 * @param monitor   a progress monitor that will never be <code>null</code> to
	 *                  support reporting and cancellation.
	 */
    void fetchDeferredChildren(Object object,
            IElementCollector collector, IProgressMonitor monitor);

    /**
     * Returns whether this adapter may have children. This is an optimized method
     * used by content providers to allow showing the [+] expand icon without having
     * yet fetched the children for the element.
     * <p>
     * If <code>false</code> is returned, then the content provider may assume
     * that this adapter has no children. If <code>true</code> is returned,
     * then the job manager may assume that this adapter may have children.
     * <p>
     *
     * @return <code>true</code>if the adapter may have childen, and <code>false</code>
     * 	otherwise.
     */
    boolean isContainer();

    /**
     * Returns the rule used to schedule the deferred fetching of children for this adapter.
     *
     * @param object the object whose children are being fetched
     * @return the scheduling rule. May be <code>null</code>.
     * @see org.eclipse.core.runtime.jobs.Job#setRule(ISchedulingRule)
     */
    ISchedulingRule getRule(Object object);
}

Back to the top