From d1c81163bab257e0b4588dcff66a7c8f593735e8 Mon Sep 17 00:00:00 2001 From: Markus Schorn Date: Thu, 9 Aug 2007 11:09:35 +0000 Subject: [PATCH] Fix for 197495, remove earlyStartup from make.ui plugin. --- build/org.eclipse.cdt.make.ui/plugin.xml | 7 ----- .../cdt/make/internal/ui/MakeStartup.java | 25 ++++++++++------- .../cdt/make/internal/ui/MakeUIPlugin.java | 9 +++++- .../src/org/eclipse/cdt/ui/CUIPlugin.java | 28 ++++++++++++++++++- .../src/org/eclipse/cdt/ui/Messages.java | 4 ++- .../org/eclipse/cdt/ui/messages.properties | 4 ++- 6 files changed, 56 insertions(+), 21 deletions(-) diff --git a/build/org.eclipse.cdt.make.ui/plugin.xml b/build/org.eclipse.cdt.make.ui/plugin.xml index 2baeac9a1e5..0fda4f74001 100644 --- a/build/org.eclipse.cdt.make.ui/plugin.xml +++ b/build/org.eclipse.cdt.make.ui/plugin.xml @@ -384,13 +384,6 @@ - - - - - 0) { Display.getDefault().asyncExec(new Runnable() { @@ -41,6 +46,6 @@ public class MakeStartup implements IStartup { } }); } + return Status.OK_STATUS; } - } diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeUIPlugin.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeUIPlugin.java index f0df8fe9e27..fbd9bce6e5c 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeUIPlugin.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeUIPlugin.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. + * Copyright (c) 2000, 2007 QNX Software Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,6 +7,7 @@ * * Contributors: * QNX Software Systems - Initial API and implementation + * Markus Schorn (Wind River Systems) *******************************************************************************/ package org.eclipse.cdt.make.internal.ui; @@ -251,6 +252,12 @@ public class MakeUIPlugin extends AbstractUIPlugin { } + + public void start(BundleContext context) throws Exception { + super.start(context); + new MakeStartup().schedule(); + } + /* (non-Javadoc) * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) */ diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CUIPlugin.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CUIPlugin.java index c91b4ab7c9b..b1b2c1ab70b 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CUIPlugin.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CUIPlugin.java @@ -31,9 +31,11 @@ import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IAdapterManager; import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.jobs.Job; import org.eclipse.jface.action.GroupMarker; import org.eclipse.jface.action.IMenuManager; import org.eclipse.jface.action.Separator; @@ -56,7 +58,9 @@ import org.eclipse.ui.editors.text.templates.ContributionTemplateStore; import org.eclipse.ui.plugin.AbstractUIPlugin; import org.eclipse.ui.texteditor.ChainedPreferenceStore; import org.eclipse.ui.texteditor.ConfigurationElementSorter; +import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; +import org.osgi.framework.BundleException; import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.model.CoreModel; @@ -426,7 +430,7 @@ public class CUIPlugin extends AbstractUIPlugin { */ public IBuildConsoleManager getConsoleManager() { return getConsoleManager(getResourceString("BuildConsole.name"), BuildConsoleManager.DEFAULT_CONTEXT_MENU_ID); //$NON-NLS-1$ - } + } /** * Return a console manager specified by id. @@ -464,6 +468,28 @@ public class CUIPlugin extends AbstractUIPlugin { // init ast provider getASTProvider(); CDTContextActivator.getInstance().install(); + + // start make-ui plugin, such that it can check for project conversions. + Job job= new Job(Messages.CUIPlugin_jobStartMakeUI) { + protected IStatus run(IProgressMonitor monitor) { + Bundle bundle= Platform.getBundle("org.eclipse.cdt.make.ui"); //$NON-NLS-1$ + try { + if (bundle != null) { + switch (bundle.getState()) { + case Bundle.RESOLVED: + case Bundle.STARTING: // because make.ui uses lazy activation, we need to start it. + bundle.start(Bundle.START_TRANSIENT); + break; + } + } + } catch (BundleException e) { + return new Status(IStatus.WARNING, PLUGIN_ID, e.getMessage(), e); + } + return Status.OK_STATUS; + } + }; + job.setSystem(true); + job.schedule(); } /* (non-Javadoc) diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/Messages.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/Messages.java index 28d76d0bcef..eb4f0838b9d 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/Messages.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/Messages.java @@ -6,7 +6,8 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * IBM - Initial API and implementation + * IBM - Initial API and implementation + * Markus Schorn (Wind River Systems) *******************************************************************************/ package org.eclipse.cdt.ui; @@ -16,6 +17,7 @@ import org.eclipse.osgi.util.NLS; public class Messages extends NLS { private static final String BUNDLE_NAME = "org.eclipse.cdt.ui.messages"; //$NON-NLS-1$ public static String CElementGrouping_includeGroupingLabel; + public static String CUIPlugin_jobStartMakeUI; static { // initialize resource bundle NLS.initializeMessages(BUNDLE_NAME, Messages.class); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/messages.properties b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/messages.properties index 35ff916aaaf..dc49459c7e5 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/messages.properties +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/messages.properties @@ -6,9 +6,11 @@ # http://www.eclipse.org/legal/epl-v10.html # # Contributors: -# IBM - Initial API and implementation +# IBM - Initial API and implementation +# Markus Schorn (Wind River Systems) ############################################################################### #Note to translators: "include" is a code word and should not be translated. Thanks. CElementGrouping_includeGroupingLabel=include directives +CUIPlugin_jobStartMakeUI=Starting plugin org.eclipse.cdt.make.ui