Revert "Bug 444137 - [target] Plug-in model initialization from p2 based target can block Eclipse startup"
This reverts commit 438c0b2298388fc01096d0afefa2f4a79b1fb803.
diff --git a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/PDECoreMessages.java b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/PDECoreMessages.java
index f85d4a5..b17577d 100644
--- a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/PDECoreMessages.java
+++ b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/PDECoreMessages.java
@@ -67,8 +67,6 @@
public static String PropertiesTextChangeListener_editNames_remove;
public static String RequiredPluginsClasspathContainer_description;
- public static String RequiredPluginsInitializer_CreatingRequiredContainerForProject;
- public static String RequiredPluginsInitializer_ExceptionWhileCreatingClasspathContainer;
public static String ExternalJavaSearchClasspathContainer_description;
public static String SchemaElementReference_refElementMissing;
diff --git a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/PluginModelManager.java b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/PluginModelManager.java
index daac95d..a74f801 100644
--- a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/PluginModelManager.java
+++ b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/PluginModelManager.java
@@ -453,13 +453,6 @@
}
/**
- * Starts the model initialize process if the table has not been initialized
- */
- public void initialize(IProgressMonitor monitor) {
- initializeTable(monitor);
- }
-
- /**
* Returns whether the model initialization was cancelled by the user.
* Other initializations, such as FeatureModelManager should use this
* setting to avoid resolving the target platform when the user has chosen
diff --git a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/RequiredPluginsInitializer.java b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/RequiredPluginsInitializer.java
index eae2bc6..ff4e2af 100644
--- a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/RequiredPluginsInitializer.java
+++ b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/RequiredPluginsInitializer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2013 IBM Corporation 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
@@ -14,7 +14,6 @@
import org.eclipse.core.runtime.*;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jdt.core.*;
-import org.eclipse.osgi.util.NLS;
import org.eclipse.pde.core.plugin.IPluginModelBase;
public class RequiredPluginsInitializer extends ClasspathContainerInitializer {
@@ -24,20 +23,16 @@
* @see org.eclipse.jdt.core.ClasspathContainerInitializer#initialize(org.eclipse.core.runtime.IPath, org.eclipse.jdt.core.IJavaProject)
*/
@Override
- public void initialize(IPath containerPath, final IJavaProject javaProject) throws CoreException {
- final IProject project = javaProject.getProject();
+ public void initialize(IPath containerPath, IJavaProject javaProject) throws CoreException {
+ IProject project = javaProject.getProject();
// The first project to be built may initialize the PDE models, potentially long running, so allow cancellation
PluginModelManager manager = PDECore.getDefault().getModelManager();
if (!manager.isInitialized()) {
- Job initPDEJob = new Job(NLS.bind(PDECoreMessages.RequiredPluginsInitializer_CreatingRequiredContainerForProject, project.getName())) {
+ Job initPDEJob = new Job(PDECoreMessages.PluginModelManager_InitializingPluginModels) {
@Override
protected IStatus run(IProgressMonitor monitor) {
- PDECore.getDefault().getModelManager().initialize(monitor);
- IPluginModelBase model = PDECore.getDefault().getModelManager().findModel(project);
- try {
- JavaCore.setClasspathContainer(PDECore.REQUIRED_PLUGINS_CONTAINER_PATH, new IJavaProject[] {javaProject}, new IClasspathContainer[] {new RequiredPluginsClasspathContainer(model)}, null);
- } catch (JavaModelException e) {
- return new Status(IStatus.ERROR, PDECore.PLUGIN_ID, PDECoreMessages.RequiredPluginsInitializer_ExceptionWhileCreatingClasspathContainer, e);
+ if (!PDECore.getDefault().getModelManager().isInitialized()) {
+ PDECore.getDefault().getModelManager().targetReloaded(monitor);
}
if (monitor.isCanceled())
return Status.CANCEL_STATUS;
@@ -45,11 +40,13 @@
}
};
initPDEJob.schedule();
- } else {
- IPluginModelBase model = PDECore.getDefault().getModelManager().findModel(project);
- JavaCore.setClasspathContainer(PDECore.REQUIRED_PLUGINS_CONTAINER_PATH, new IJavaProject[] {javaProject}, new IClasspathContainer[] {new RequiredPluginsClasspathContainer(model)}, null);
+ try {
+ initPDEJob.join();
+ } catch (InterruptedException e) {
+ }
}
-
+ IPluginModelBase model = manager.findModel(project);
+ JavaCore.setClasspathContainer(PDECore.REQUIRED_PLUGINS_CONTAINER_PATH, new IJavaProject[] {javaProject}, new IClasspathContainer[] {new RequiredPluginsClasspathContainer(model)}, null);
}
/*
diff --git a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/pderesources.properties b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/pderesources.properties
index 11fd411..6882542 100644
--- a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/pderesources.properties
+++ b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/pderesources.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2000, 2015 IBM Corporation and others.
+# Copyright (c) 2000, 2013 IBM Corporation 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
@@ -17,8 +17,6 @@
binary project resources, re-import it by copying the content \
into the workspace.
RequiredPluginsClasspathContainer_description=Plug-in Dependencies
-RequiredPluginsInitializer_CreatingRequiredContainerForProject=Creating required plug-ins classpath container for {0}
-RequiredPluginsInitializer_ExceptionWhileCreatingClasspathContainer=Exception occurred while creating the PDE required plug-ins classpath container.
ExecutionEnvironmentProfileManager_0=Failed to generate custom profile: {0}
ExternalJavaSearchClasspathContainer_description= External Plug-ins
TargetPlatform_exceptionThrown=Exception caught while creating platform configuration.