# HG changeset patch # User timkelly # Date 1281393171 18000 # Node ID 2e59aa939b8f8da247c5a09042a5efe673b3ffa4 # Parent f9d171c71f7ee6b8e46980026c30ff4ffed97e34 some prototyping for linked project root diff -r f9d171c71f7e -r 2e59aa939b8f builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/EpocEngineHelper.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/EpocEngineHelper.java Fri Aug 06 12:17:31 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/EpocEngineHelper.java Mon Aug 09 17:32:51 2010 -0500 @@ -1912,8 +1912,15 @@ public Object run(IBldInfData infView) { for (final IMMPReference mmp : infView.getAllMMPReferences()) { - final IPath workspaceRelativeMMPPath = new Path(info.getProject().getName()).append(mmp.getPath()); + + IPath workspaceRelativeMMPPath1 = null; + if (info.getProjectRelativeBldInfPath().isAbsolute()){ + workspaceRelativeMMPPath1 = mmp.getPath(); + } else { + workspaceRelativeMMPPath1 = new Path(info.getProject().getName()).append(mmp.getPath()); + } + final IPath workspaceRelativeMMPPath = workspaceRelativeMMPPath1; EpocEnginePlugin.runWithMMPData(workspaceRelativeMMPPath, new DefaultMMPViewConfiguration(info.getProject(), buildConfig.getBuildContext(), new AcceptedNodesViewFilter()), new MMPDataRunnableAdapter() { diff -r f9d171c71f7e -r 2e59aa939b8f builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/project/ICarbideProjectInfo.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/project/ICarbideProjectInfo.java Fri Aug 06 12:17:31 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/project/ICarbideProjectInfo.java Mon Aug 09 17:32:51 2010 -0500 @@ -52,6 +52,7 @@ public static final int ACTION_LINK_ONLY = 1; public static final int ACTION_COMPILE_AND_LINK = 2; + /** * Load all the configurations associated with this project. If this is a new project, * then a dummy .settings file will be created which can be used to generate new build diff -r f9d171c71f7e -r 2e59aa939b8f builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideProjectInfo.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideProjectInfo.java Fri Aug 06 12:17:31 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideProjectInfo.java Mon Aug 09 17:32:51 2010 -0500 @@ -327,6 +327,9 @@ } public IPath getAbsoluteBldInfPath(){ + if (projectRelativeBldInfPath.isAbsolute()){ + return projectRelativeBldInfPath; + } return CarbideBuilderPlugin.getProjectRoot(projectTracker.getProject()).append(projectRelativeBldInfPath); } @@ -335,6 +338,9 @@ } public IPath getWorkspaceRelativeBldInfPath(){ + if (projectRelativeBldInfPath.isAbsolute()){ + return projectRelativeBldInfPath; + } return new Path(projectTracker.getProject().getName()).append(projectRelativeBldInfPath); } diff -r f9d171c71f7e -r 2e59aa939b8f project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/ProjectUIPlugin.java --- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/ProjectUIPlugin.java Fri Aug 06 12:17:31 2010 -0500 +++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/ProjectUIPlugin.java Mon Aug 09 17:32:51 2010 -0500 @@ -276,6 +276,16 @@ store.setValue(PreferenceConstants.PREF_KEEP_PROJECTS_IN_SYNC, keepInSync); } + public static boolean supportLinkedResources() { + IPreferenceStore store = ProjectUIPlugin.getDefault().getPreferenceStore(); + return store.getBoolean(PreferenceConstants.PREF_SUPPORT_LINKED_RESOURCES); + } + + public static void setSupportLinkedResources(boolean supported) { + IPreferenceStore store = ProjectUIPlugin.getDefault().getPreferenceStore(); + store.setValue(PreferenceConstants.PREF_SUPPORT_LINKED_RESOURCES, supported); + } + public static int getAddFilesToProjectOption() { IPreferenceStore store = ProjectUIPlugin.getDefault().getPreferenceStore(); return store.getInt(PreferenceConstants.PREF_ADDED_FILES_OPTION); diff -r f9d171c71f7e -r 2e59aa939b8f project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/BldInfImportWizard.java --- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/BldInfImportWizard.java Fri Aug 06 12:17:31 2010 -0500 +++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/BldInfImportWizard.java Mon Aug 09 17:32:51 2010 -0500 @@ -20,12 +20,14 @@ import java.util.List; import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.resources.WorkspaceJob; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Status; import org.eclipse.jface.dialogs.IDialogSettings; @@ -82,11 +84,13 @@ final String projectName = projectPropertiesPage.getProjectName(); final IPath rootDirectory = projectPropertiesPage.getRootDirectory(); + final boolean isLinkedProject = projectPropertiesPage.linkedResourcesEnabled(); // calculate the project relative path to the bld.inf file. IPath absoluteBldInfPath = new Path(getBldInfFile()); assert(rootDirectory.isPrefixOf(absoluteBldInfPath)); final String projectRelativePath = absoluteBldInfPath.removeFirstSegments(rootDirectory.segmentCount()).setDevice(null).toOSString(); + final String absoluteInfPath = absoluteBldInfPath.toOSString(); // if all mmps are checked then don't pass any to createProject. that // way the project setting will be set to build bld.inf. @@ -122,13 +126,21 @@ } // for IProject newProject = null; - newProject = ProjectCorePlugin.createProject(projectName, rootDirectory.toOSString()); + if (isLinkedProject){ + newProject = ProjectCorePlugin.createProject(projectName, null); + newProject.getFolder(rootDirectory.lastSegment()).createLink(rootDirectory.toFile().toURI(), IResource.BACKGROUND_REFRESH, new NullProgressMonitor()); + } else { + newProject = ProjectCorePlugin.createProject(projectName, rootDirectory.toOSString()); + } monitor.worked(1); - + newProject.setSessionProperty(CarbideBuilderPlugin.SBSV2_PROJECT, Boolean.valueOf(useSBSv2Builder())); - // TODO pass PKG file path to postProjectCreatedActions, currently passing null - ProjectCorePlugin.postProjectCreatedActions(newProject, projectRelativePath, selectedConfigs, components, debugMMP, null, monitor); + if (isLinkedProject){ + ProjectCorePlugin.postProjectCreatedActions(newProject, absoluteInfPath, selectedConfigs, components, debugMMP, null, monitor); + } else { + ProjectCorePlugin.postProjectCreatedActions(newProject, projectRelativePath, selectedConfigs, components, debugMMP, null, monitor); + } if (monitor.isCanceled()) { // the user canceled the import so delete the project diff -r f9d171c71f7e -r 2e59aa939b8f project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/Messages.java --- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/Messages.java Fri Aug 06 12:17:31 2010 -0500 +++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/Messages.java Mon Aug 09 17:32:51 2010 -0500 @@ -112,6 +112,10 @@ public static String ProjectPropertiesPage_directoryTooLong; public static String ProjectPropertiesPage_directoryIsRoot; + + public static String ProjectPropertiesPage_linkedProject; + + public static String ProjectPropertiesPage_linkedProjectTooltip; static { // initialize resource bundle diff -r f9d171c71f7e -r 2e59aa939b8f project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/ProjectPropertiesPage.java --- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/ProjectPropertiesPage.java Fri Aug 06 12:17:31 2010 -0500 +++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/ProjectPropertiesPage.java Mon Aug 09 17:32:51 2010 -0500 @@ -45,6 +45,7 @@ import com.nokia.carbide.cdt.builder.EpocEngineHelper; import com.nokia.carbide.cpp.internal.project.ui.ProjectUIHelpIds; +import com.nokia.carbide.cpp.internal.project.ui.ProjectUIPlugin; import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; import com.nokia.cpp.internal.api.utils.ui.BrowseDialogUtils; @@ -53,6 +54,7 @@ private Text projectName; private Text rootDirectory; private Button browseButton; + private Button linkedResourcesCheck; String projectNameText = ""; //$NON-NLS-1$ IPath rootDirectoryPath = null; @@ -143,6 +145,14 @@ gd.horizontalSpan = 3; helpText.setLayoutData(gd); + if (ProjectUIPlugin.supportLinkedResources()){ + linkedResourcesCheck = new Button(parent, SWT.CHECK); + linkedResourcesCheck.setFont(font); + linkedResourcesCheck.setText(Messages.ProjectPropertiesPage_linkedProject); + linkedResourcesCheck.setToolTipText(Messages.ProjectPropertiesPage_linkedProjectTooltip); + linkedResourcesCheck.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); + } + setButtonLayoutData(browseButton); } @@ -280,6 +290,10 @@ return rootDirectoryPath; } + public boolean linkedResourcesEnabled(){ + return linkedResourcesCheck.getSelection(); + } + @Override public void setVisible(boolean visible) { // this gets called just before the page goes in or out of view. if it's diff -r f9d171c71f7e -r 2e59aa939b8f project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/messages.properties --- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/messages.properties Fri Aug 06 12:17:31 2010 -0500 +++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/messages.properties Mon Aug 09 17:32:51 2010 -0500 @@ -18,6 +18,8 @@ ProjectPropertiesPage_directoryDoesNotContainSourceFiles=The root directory specified does not contain all the source and resource files referenced in the project. This may make navigation and editing more difficult. ProjectPropertiesPage_directoryTooLong=The root directory specified is too long. It cannot exceed 215 characters so that project settings files do not exceed the 256 character path limit. ProjectPropertiesPage_directoryIsRoot=A project path near the root SDK directory can lead to slow import times. Please select another project path or import a subset of included bld.inf files (if possible). +ProjectPropertiesPage_linkedProject=Create project with linked resources +ProjectPropertiesPage_linkedProjectToolTip=When enabled, the eclipse project files are created in the workspace and all project content is formed with linked resources. MMPSelectionPage_title=MMP Selection MMPSelectionPage_description=Select the mmp and extension make files to work with. You will be able to edit this after the project has been created. MMPSelectionPage_selectAllAButtonLabel=Select All diff -r f9d171c71f7e -r 2e59aa939b8f project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/preferences/PreferenceConstants.java --- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/preferences/PreferenceConstants.java Fri Aug 06 12:17:31 2010 -0500 +++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/preferences/PreferenceConstants.java Mon Aug 09 17:32:51 2010 -0500 @@ -28,4 +28,6 @@ public final static String PREF_CHANGED_FILES_OPTION = "changedFilesOption"; //$NON-NLS-1$ public static final String PREF_INDEX_ALL = "indexAll"; //$NON-NLS-1$ + + public static final String PREF_SUPPORT_LINKED_RESOURCES = "supportsLinkedRsrcs"; //$NON-NLS-1$ } diff -r f9d171c71f7e -r 2e59aa939b8f project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/preferences/PreferenceInitializer.java --- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/preferences/PreferenceInitializer.java Fri Aug 06 12:17:31 2010 -0500 +++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/preferences/PreferenceInitializer.java Mon Aug 09 17:32:51 2010 -0500 @@ -16,6 +16,7 @@ */ package com.nokia.carbide.cpp.internal.project.ui.preferences; +import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; import org.eclipse.jface.preference.IPreferenceStore; @@ -35,6 +36,21 @@ IPreferenceStore store = ProjectUIPlugin.getDefault().getPreferenceStore(); store.setDefault(PreferenceConstants.PREF_KEEP_PROJECTS_IN_SYNC, true); store.setDefault(PreferenceConstants.PREF_INDEX_ALL, false); + + if (cmdLineArgsSupportsLinkedResources()){ + store.setDefault(PreferenceConstants.PREF_SUPPORT_LINKED_RESOURCES, true); + } else { + store.setDefault(PreferenceConstants.PREF_SUPPORT_LINKED_RESOURCES, false); + } + } + + private boolean cmdLineArgsSupportsLinkedResources(){ + String[] args = Platform.getCommandLineArgs(); + for (String arg : args){ + if (arg.equals("supportsLinkedRsrcs=true")) + return true; + } + return false; } } diff -r f9d171c71f7e -r 2e59aa939b8f project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/views/SPNViewContentProvider.java --- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/views/SPNViewContentProvider.java Fri Aug 06 12:17:31 2010 -0500 +++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/views/SPNViewContentProvider.java Mon Aug 09 17:32:51 2010 -0500 @@ -43,6 +43,7 @@ import org.eclipse.core.resources.IFolder; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IWorkspace; import org.eclipse.core.resources.IWorkspaceRoot; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; @@ -70,6 +71,7 @@ import org.eclipse.ui.PlatformUI; import org.eclipse.ui.model.BaseWorkbenchContentProvider; import org.eclipse.ui.model.IWorkbenchAdapter; +import org.eclipse.ui.model.WorkbenchAdapter; import com.nokia.carbide.cdt.builder.BldInfViewPathHelper; import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin; @@ -106,15 +108,13 @@ import com.nokia.carbide.cpp.epoc.engine.preprocessor.DefaultModelDocumentProvider; import com.nokia.carbide.cpp.epoc.engine.preprocessor.DefaultTranslationUnitProvider; import com.nokia.carbide.cpp.epoc.engine.preprocessor.IIncludeFileLocator; -import com.nokia.carbide.cpp.internal.api.sdk.ISBSv1BuildInfo; -import com.nokia.carbide.cpp.internal.api.sdk.ISBSv2BuildInfo; import com.nokia.carbide.cpp.internal.project.ui.ProjectUIPlugin; import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; -import com.nokia.carbide.cpp.sdk.core.ISymbianBuilderID; import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; import com.nokia.carbide.cpp.ui.CarbideUIPlugin; import com.nokia.carbide.cpp.ui.ICarbideSharedImages; import com.nokia.carbide.internal.api.cpp.epoc.engine.preprocessor.DependencyScanner; +import com.nokia.cpp.internal.api.utils.ui.WorkbenchUtils; /** * Content provider for the SymbianProjectNavigatorView @@ -2329,7 +2329,20 @@ if (info != null) { IPath infPath = info.getProjectRelativeBldInfPath(); if (infPath != null) { - IFile file = getIFileFromBldInfViewPath(project, infPath); + IFile file = null; + if (infPath.isAbsolute()){ + // Make sure to get the project relative location if the inf path is absolute. + // This means the project has linked resources + // TODO: Just using for prototyping with using linked resources.... + // XXX: This is still not working, as the path is relative to the workspace and + // hence it's wrong. Seems we need to change the container for the SPN to take + // a bld.inf as an absolute path??? + IFile infFile = ResourcesPlugin.getWorkspace().getRoot().getFile(infPath); + children.add(infFile); + return children.toArray(); + } else { + file = getIFileFromBldInfViewPath(project, infPath); + } if (file != null) { children.add(containerFactory.getBldInfContainer(file, true)); @@ -2516,6 +2529,11 @@ } protected IFile getIFileFromBldInfViewPath(IProject project, IPath pathFromBldInfView) { + + if (pathFromBldInfView.isAbsolute()){ + IWorkspace workspace= ResourcesPlugin.getWorkspace(); + return workspace.getRoot().getFile(pathFromBldInfView); + } EpocEnginePathHelper helper = new EpocEnginePathHelper(project); IPath resolvedProjectRelativePath = helper.convertToProject(pathFromBldInfView); if (resolvedProjectRelativePath != null)