35 import org.eclipse.jface.wizard.Wizard; |
35 import org.eclipse.jface.wizard.Wizard; |
36 import org.eclipse.ui.IImportWizard; |
36 import org.eclipse.ui.IImportWizard; |
37 import org.eclipse.ui.IWorkbench; |
37 import org.eclipse.ui.IWorkbench; |
38 |
38 |
39 import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin; |
39 import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin; |
40 import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo; |
|
41 import com.nokia.carbide.cpp.internal.api.sdk.ISDKManagerInternal; |
40 import com.nokia.carbide.cpp.internal.api.sdk.ISDKManagerInternal; |
42 import com.nokia.carbide.cpp.internal.featureTracker.FeatureUseTrackerPlugin; |
41 import com.nokia.carbide.cpp.internal.featureTracker.FeatureUseTrackerPlugin; |
43 import com.nokia.carbide.cpp.internal.project.ui.ProjectUIPlugin; |
42 import com.nokia.carbide.cpp.internal.project.ui.ProjectUIPlugin; |
44 import com.nokia.carbide.cpp.internal.sdk.core.model.SDKManager; |
43 import com.nokia.carbide.cpp.internal.sdk.core.model.SDKManager; |
45 import com.nokia.carbide.cpp.project.core.ProjectCorePlugin; |
44 import com.nokia.carbide.cpp.project.core.ProjectCorePlugin; |
100 |
99 |
101 // if all mmps are checked then don't pass any to createProject. that |
100 // if all mmps are checked then don't pass any to createProject. that |
102 // way the project setting will be set to build bld.inf. |
101 // way the project setting will be set to build bld.inf. |
103 final List<String> components = mmpSelectionPage.areAllMakMakeReferencesChecked() ? new ArrayList<String>(0) : mmpSelectionPage.getSelectedMakMakeReferences(); |
102 final List<String> components = mmpSelectionPage.areAllMakMakeReferencesChecked() ? new ArrayList<String>(0) : mmpSelectionPage.getSelectedMakMakeReferences(); |
104 |
103 |
105 final List<String> refs = getSelectedMakMakeReferences(); |
|
106 |
|
107 final List<ISymbianBuildContext> selectedConfigs = getSelectedConfigs(); |
104 final List<ISymbianBuildContext> selectedConfigs = getSelectedConfigs(); |
108 |
105 |
109 // run this in a workspace job |
106 // run this in a workspace job |
110 WorkspaceJob job = new WorkspaceJob(Messages.BldInfImportWizard_CreatingProjectJobName) { |
107 WorkspaceJob job = new WorkspaceJob(Messages.BldInfImportWizard_CreatingProjectJobName) { |
111 @Override |
108 @Override |
112 public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException { |
109 public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException { |
113 monitor.beginTask(Messages.BldInfImportWizard_CreatingProjectJobName, IProgressMonitor.UNKNOWN); |
110 monitor.beginTask(Messages.BldInfImportWizard_CreatingProjectJobName, IProgressMonitor.UNKNOWN); |
114 |
|
115 // write the debug target mmp setting - use the last mmp in |
|
116 // the list of selected mak make files. |
|
117 // We also need to check for project test mmpfiles and add that only if the project is only comprised of test mmp files |
|
118 String debugMMP = ""; //$NON-NLS-1$ |
|
119 boolean hasOneNormalMMP = false; // Don't add test mmp if there's a regular MMP |
|
120 for (String ref : refs) { |
|
121 if (ref.toLowerCase().endsWith(".mmp")){ |
|
122 hasOneNormalMMP = true; |
|
123 debugMMP = ref; |
|
124 } |
|
125 |
|
126 if (hasOneNormalMMP == false){ |
|
127 if (ref.toLowerCase().endsWith(".mmp " + ICarbideProjectInfo.TEST_COMPONENT_LABEL)) { //$NON-NLS-1$ |
|
128 debugMMP = ref; |
|
129 debugMMP = debugMMP.substring(0, debugMMP.indexOf( " " + ICarbideProjectInfo.TEST_COMPONENT_LABEL)); |
|
130 } |
|
131 } |
|
132 } // for |
|
133 |
111 |
134 IProject newProject = null; |
112 IProject newProject = null; |
135 if (isLinkedProject){ |
113 if (isLinkedProject){ |
136 newProject = ProjectCorePlugin.createProject(projectName, null); |
114 newProject = ProjectCorePlugin.createProject(projectName, null); |
137 newProject.getFolder(rootDirectory.lastSegment()).createLink(rootDirectory.toFile().toURI(), IResource.BACKGROUND_REFRESH, new NullProgressMonitor()); |
115 newProject.getFolder(rootDirectory.lastSegment()).createLink(rootDirectory.toFile().toURI(), IResource.BACKGROUND_REFRESH, new NullProgressMonitor()); |
141 monitor.worked(1); |
119 monitor.worked(1); |
142 |
120 |
143 newProject.setSessionProperty(CarbideBuilderPlugin.SBSV2_PROJECT, Boolean.valueOf(useSBSv2Builder())); |
121 newProject.setSessionProperty(CarbideBuilderPlugin.SBSV2_PROJECT, Boolean.valueOf(useSBSv2Builder())); |
144 |
122 |
145 if (isLinkedProject){ |
123 if (isLinkedProject){ |
146 ProjectCorePlugin.postProjectCreatedActions(newProject, absoluteInfPath, selectedConfigs, components, debugMMP, null, monitor); |
124 ProjectCorePlugin.postProjectCreatedActions(newProject, absoluteInfPath, selectedConfigs, components, null, null, monitor); |
147 } else { |
125 } else { |
148 ProjectCorePlugin.postProjectCreatedActions(newProject, projectRelativePath, selectedConfigs, components, debugMMP, null, monitor); |
126 ProjectCorePlugin.postProjectCreatedActions(newProject, projectRelativePath, selectedConfigs, components, null, null, monitor); |
149 } |
127 } |
150 |
128 |
151 if (monitor.isCanceled()) { |
129 if (monitor.isCanceled()) { |
152 // the user canceled the import so delete the project |
130 // the user canceled the import so delete the project |
153 newProject.delete(false, true, null); |
131 newProject.delete(false, true, null); |