Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 171584
Collapse All | Expand All

(-)Eclipse UI/org/eclipse/ui/internal/util/BundleUtility.java (-1 / +4 lines)
Lines 16-21 Link Here
16
import org.eclipse.core.runtime.Path;
16
import org.eclipse.core.runtime.Path;
17
import org.eclipse.core.runtime.Platform;
17
import org.eclipse.core.runtime.Platform;
18
import org.eclipse.core.runtime.Status;
18
import org.eclipse.core.runtime.Status;
19
import org.eclipse.ui.internal.WorkbenchPlugin;
19
import org.osgi.framework.Bundle;
20
import org.osgi.framework.Bundle;
20
21
21
/**
22
/**
Lines 31-37 Link Here
31
	}
32
	}
32
33
33
    public static boolean isActivated(Bundle bundle) {
34
    public static boolean isActivated(Bundle bundle) {
34
        return bundle != null && (bundle.getState() & (Bundle.STARTING | Bundle.ACTIVE | Bundle.STOPPING)) != 0;
35
    	if ((bundle.getState() & Bundle.STARTING) != 0)
36
    		return WorkbenchPlugin.getDefault().isStarting(bundle);
37
        return bundle != null && (bundle.getState() & (Bundle.ACTIVE | Bundle.STOPPING)) != 0;
35
    }
38
    }
36
39
37
    // TODO: needs a better name
40
    // TODO: needs a better name
(-)Eclipse UI/org/eclipse/ui/internal/WorkbenchPlugin.java (-7 / +32 lines)
Lines 12-18 Link Here
12
package org.eclipse.ui.internal;
12
package org.eclipse.ui.internal;
13
13
14
import java.io.OutputStream;
14
import java.io.OutputStream;
15
import java.util.Locale;
15
import java.util.*;
16
16
17
import org.eclipse.core.runtime.CoreException;
17
import org.eclipse.core.runtime.CoreException;
18
import org.eclipse.core.runtime.IConfigurationElement;
18
import org.eclipse.core.runtime.IConfigurationElement;
Lines 62-72 Link Here
62
import org.eclipse.ui.presentations.AbstractPresentationFactory;
62
import org.eclipse.ui.presentations.AbstractPresentationFactory;
63
import org.eclipse.ui.views.IViewRegistry;
63
import org.eclipse.ui.views.IViewRegistry;
64
import org.eclipse.ui.wizards.IWizardRegistry;
64
import org.eclipse.ui.wizards.IWizardRegistry;
65
import org.osgi.framework.Bundle;
65
import org.osgi.framework.*;
66
import org.osgi.framework.BundleContext;
67
import org.osgi.framework.BundleListener;
68
import org.osgi.framework.InvalidSyntaxException;
69
import org.osgi.framework.ServiceReference;
70
66
71
import com.ibm.icu.text.MessageFormat;
67
import com.ibm.icu.text.MessageFormat;
72
68
Lines 89-95 Link Here
89
 *      calls createExecutableExtension to create an executable
85
 *      calls createExecutableExtension to create an executable
90
 *      instance of our workbench class.
86
 *      instance of our workbench class.
91
 */
87
 */
92
public class WorkbenchPlugin extends AbstractUIPlugin {
88
public class WorkbenchPlugin extends AbstractUIPlugin implements SynchronousBundleListener{
93
	
89
	
94
	private static final String LEFT_TO_RIGHT = "ltr"; //$NON-NLS-1$
90
	private static final String LEFT_TO_RIGHT = "ltr"; //$NON-NLS-1$
95
	private static final String RIGHT_TO_LEFT = "rtl";//$NON-NLS-1$
91
	private static final String RIGHT_TO_LEFT = "rtl";//$NON-NLS-1$
Lines 119-124 Link Here
119
    // The context within which this plugin was started.
115
    // The context within which this plugin was started.
120
    private BundleContext bundleContext;
116
    private BundleContext bundleContext;
121
117
118
    // The set of currently starting bundles
119
    private Collection startingBundles = new HashSet();
120
122
    /**
121
    /**
123
     * Global workbench ui plugin flag. Only workbench implementation is allowed to use this flag
122
     * Global workbench ui plugin flag. Only workbench implementation is allowed to use this flag
124
     * All other plugins, examples, or test cases must *not* use this flag.
123
     * All other plugins, examples, or test cases must *not* use this flag.
Lines 844-849 Link Here
844
     * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
843
     * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
845
     */
844
     */
846
    public void start(BundleContext context) throws Exception {
845
    public void start(BundleContext context) throws Exception {
846
    	context.addBundleListener(this);
847
        super.start(context);
847
        super.start(context);
848
        bundleContext = context;
848
        bundleContext = context;
849
        
849
        
Lines 1153-1157 Link Here
1153
		}
1153
		}
1154
		return null;
1154
		return null;
1155
	}
1155
	}
1156
1157
	/* (non-Javadoc)
1158
	 * @see org.osgi.framework.BundleListener#bundleChanged(org.osgi.framework.BundleEvent)
1159
	 */
1160
	public void bundleChanged(BundleEvent event) {
1161
		synchronized (startingBundles) {
1162
			switch (event.getType()) {
1163
				case BundleEvent.STARTING :
1164
					startingBundles.add(event.getBundle());
1165
					break;
1166
				case BundleEvent.STARTED :
1167
				case BundleEvent.STOPPED :
1168
					startingBundles.remove(event.getBundle());
1169
					break;
1170
				default :
1171
					break;
1172
			}
1173
		}
1174
	}
1175
1176
	public boolean isStarting(Bundle bundle) {
1177
		synchronized (startingBundles) {
1178
			return startingBundles.contains(bundle);
1179
		}
1180
	}
1156
	
1181
	
1157
}
1182
}

Return to bug 171584