# HG changeset patch # User timkelly # Date 1260807984 21600 # Node ID 0ca8a6b568b163d1d502598773f4f20b1dfe66e1 # Parent 4224161eb5db5088aa1b4149dde4c09785bdf92d# Parent 557efa279676c19caafe928746de43296829f079 merge commit diff -r 4224161eb5db -r 0ca8a6b568b1 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 Mon Dec 14 10:24:12 2009 -0600 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/EpocEngineHelper.java Mon Dec 14 10:26:24 2009 -0600 @@ -35,6 +35,8 @@ import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.*; +import org.eclipse.core.runtime.preferences.IEclipsePreferences; +import org.eclipse.core.runtime.preferences.InstanceScope; import java.io.*; import java.util.*; @@ -892,7 +894,7 @@ * @param targetPath full path to device-side .rsc directory */ private static void addResourceLanguageTargets(Map<String, String> resources, IMMPData data, IMMPResource resource, - String baseGeneratedPath, String targetPath) { + IPath baseGeneratedPath, IPath targetPath) { List<EMMPLanguage> languages = null; // block resource can override languages (entirely) if (resource != null) { @@ -909,7 +911,8 @@ } for (EMMPLanguage language : languages) { String extension = ".R" + language.getCodeString(); //$NON-NLS-1$ - resources.put(HostOS.convertPathToNative(baseGeneratedPath + extension), HostOS.convertPathToWindows(targetPath)); + resources.put(baseGeneratedPath.toOSString() + extension.toLowerCase(), + HostOS.convertPathToWindows(targetPath)); } } @@ -944,84 +947,7 @@ new MMPDataRunnableAdapter() { public Object run(IMMPData mmpData) { - // read the project-wide target path - String targetPath = mmpData.getSingleArgumentSettings().get(EMMPStatement.TARGETPATH); - if (targetPath != null) { - // make sure it doesn't start with a "\" but ends with one - IPath targetP = new Path(targetPath).makeRelative().addTrailingSeparator(); - targetPath = targetP.toOSString(); - } else { - // for EKA1 just leave empty. for EKA2 use sys\bin\ - if (buildConfig.getSDK().getOSVersion().getMajor() > 8) { - targetPath = "sys/bin/"; //$NON-NLS-1$ - } else { - targetPath = ""; //$NON-NLS-1$ - } - } - - String dataZDir = buildConfig.getSDK().getReleaseRoot().removeLastSegments(1).toPortableString() + "/data/z/"; //$NON-NLS-1$ - // get the aifs - List<IMMPAIFInfo> aifs = mmpData.getAifs(); - for (IMMPAIFInfo aif : aifs) { - IPath aifPath = aif.getTarget().makeAbsolute(); - resources.put(HostOS.convertPathToNative(dataZDir + targetPath + aifPath.lastSegment().toLowerCase()), - HostOS.convertPathToWindows("C:\\" + targetPath)); //$NON-NLS-1$ - } - - // get the bitmaps - List<IMMPBitmap> bmps = mmpData.getBitmaps(); - for (IMMPBitmap bmp : bmps) { - IPath mbmPath = bmp.getTargetFilePath().makeRelative(); - resources.put(HostOS.convertPathToNative(dataZDir + mbmPath.toOSString().toLowerCase()), - HostOS.convertPathToWindows("C:\\" + mbmPath.removeLastSegments(1).addTrailingSeparator().toOSString())); //$NON-NLS-1$ - } - - // get the user resources - List<IPath> userResources = mmpData.getUserResources(); - for (IPath userRes : userResources) { - addResourceLanguageTargets(resources, mmpData, null, - HostOS.convertPathToNative(dataZDir + targetPath + userRes.removeFileExtension().lastSegment().toLowerCase()), - HostOS.convertPathToWindows("C:\\" + targetPath)); //$NON-NLS-1$ - } - - // get the system resources - List<IPath> systemResources = mmpData.getSystemResources(); - for (IPath systemRes : systemResources) { - addResourceLanguageTargets(resources, mmpData, null, - HostOS.convertPathToNative(dataZDir + targetPath + systemRes.removeFileExtension().lastSegment().toLowerCase()), - HostOS.convertPathToWindows("C:\\" + targetPath)); //$NON-NLS-1$ - } - - // get the resource blocks - List<IMMPResource> resourceBlocks = mmpData.getResourceBlocks(); - for (IMMPResource resourceBlock : resourceBlocks) { - IPath resPath = resourceBlock.getTargetPath(); - if (resPath == null) { - // if not specified in the resource block then get the global - // target path - String targetP = mmpData.getSingleArgumentSettings().get(EMMPStatement.TARGETPATH); - if (targetP != null) { - resPath = new Path(targetP); - } - } - if (resPath != null) { - resPath = resPath.makeRelative().addTrailingSeparator(); - String filename = resourceBlock.getTargetFile(); - if (filename == null) { - filename = resourceBlock.getSource().removeFileExtension().lastSegment().toLowerCase(); - } else { - filename = HostOS.createPathFromString(filename).removeFileExtension().toPortableString().toLowerCase(); - } - // adjust the path if necessary as it's different on the phone for the *_.reg file - IPath adjustedTargetPath = resPath; - if (adjustedTargetPath.toPortableString().equalsIgnoreCase("private/10003a3f/apps/")) { //$NON-NLS-1$ - adjustedTargetPath = new Path("private/10003a3f/import/apps/"); //$NON-NLS-1$ - } - addResourceLanguageTargets(resources, mmpData, resourceBlock, - HostOS.convertPathToNative(dataZDir + resPath.toOSString() + filename), - HostOS.convertPathToWindows("C:\\" + HostOS.convertPathToWindows(adjustedTargetPath))); //$NON-NLS-1$ - } - } + gatherMMPResourceMappings(buildConfig, resources, mmpData); return null; } }); @@ -1048,103 +974,7 @@ new MMPDataRunnableAdapter() { public Object run(IMMPData mmpData) { - // read the project-wide target path - String targetPath = mmpData.getSingleArgumentSettings().get(EMMPStatement.TARGETPATH); - if (targetPath != null) { - // make sure it doesn't start with a "\" but ends with one - IPath targetP = new Path(targetPath).makeRelative().addTrailingSeparator(); - targetPath = targetP.toOSString(); - } else { - // for EKA1 just leave empty. for EKA2 use sys\bin\ - if (buildConfig.getSDK().getOSVersion().getMajor() > 8) { - targetPath = "sys\\bin\\"; //$NON-NLS-1$ - } else { - targetPath = ""; //$NON-NLS-1$ - } - } - - String dataZDir = buildConfig.getSDK().getReleaseRoot().removeLastSegments(1).toPortableString() + "/data/z/"; //$NON-NLS-1$ - - // get the aifs - List<IMMPAIFInfo> aifs = mmpData.getAifs(); - for (IMMPAIFInfo aif : aifs) { - IPath aifPath = aif.getTarget().makeAbsolute(); - resources.put(HostOS.convertPathToNative(dataZDir + targetPath + aifPath.lastSegment()), - HostOS.convertPathToWindows("C:\\" + targetPath)); //$NON-NLS-1$ - } - - // for resources and bitmaps, the target path may be based on the target type if not explicitly - // set for the resource or bitmap. - String targetType = mmpData.getSingleArgumentSettings().get(EMMPStatement.TARGETTYPE); - if (targetType != null) { - // could be PLUGIN or PLUGIN3 - if (targetType.toUpperCase().startsWith("PLUGIN")) { //$NON-NLS-1$ - targetPath = "resource/plugins/"; //$NON-NLS-1$ - } else if (targetType.compareToIgnoreCase("PDL") == 0) { //$NON-NLS-1$ - targetPath = "resource/printers/"; //$NON-NLS-1$ - } - } - - // get the bitmaps - List<IMMPBitmap> bmps = mmpData.getBitmaps(); - for (IMMPBitmap bmp : bmps) { - IPath mbmPath = bmp.getTargetFilePath().makeRelative(); - // if there's no target path then use the main target path - if (mbmPath.segmentCount() == 1) { - mbmPath = new Path(targetPath).append(mbmPath); - } - resources.put(HostOS.convertPathToNative(dataZDir + mbmPath.toOSString()), - HostOS.convertPathToWindows("C:\\" + mbmPath.removeLastSegments(1).addTrailingSeparator().toOSString())); //$NON-NLS-1$ - } - - // get the user resources - List<IPath> userResources = mmpData.getUserResources(); - for (IPath userRes : userResources) { - addResourceLanguageTargets(resources, mmpData, null, - HostOS.convertPathToNative(dataZDir + targetPath + userRes.removeFileExtension().lastSegment()), - HostOS.convertPathToWindows("C:\\" + targetPath)); //$NON-NLS-1$ //$NON-NLS-2$ - } - - // get the system resources - List<IPath> systemResources = mmpData.getSystemResources(); - for (IPath systemRes : systemResources) { - addResourceLanguageTargets(resources, mmpData, null, - HostOS.convertPathToNative(dataZDir + targetPath + systemRes.removeFileExtension().lastSegment()), - HostOS.convertPathToWindows("C:\\" + targetPath)); //$NON-NLS-1$ //$NON-NLS-2$ - } - - // get the resource blocks - List<IMMPResource> resourceBlocks = mmpData.getResourceBlocks(); - for (IMMPResource resourceBlock : resourceBlocks) { - IPath resPath = resourceBlock.getTargetPath(); - if (resPath == null) { - // not specified in the resource block so use existing - resPath = new Path(targetPath); - } - - String filename = resourceBlock.getTargetFile(); - if (filename == null) { - filename = resourceBlock.getSource().removeFileExtension().lastSegment(); - } else { - filename = HostOS.createPathFromString(filename).removeFileExtension().toOSString(); - } - - if (resPath != null) { - resPath = resPath.makeRelative().addTrailingSeparator(); - // adjust the path if necessary as it's different on the phone for the *_.reg file - IPath adjustedTargetPath = resPath; - if ((adjustedTargetPath.toPortableString()).equalsIgnoreCase("private/10003a3f/apps/")) { //$NON-NLS-1$ - adjustedTargetPath = new Path("private/10003a3f/import/apps/"); //$NON-NLS-1$ - } - addResourceLanguageTargets(resources, mmpData, resourceBlock, - HostOS.convertPathToNative(dataZDir + resPath.toOSString() + filename), - HostOS.convertPathToWindows("C:\\" + adjustedTargetPath)); //$NON-NLS-1$ - } else { - CarbideBuilderPlugin.log(Logging.newStatus(CarbideBuilderPlugin.getDefault(), - IStatus.WARNING, - "No TARGETPATH specified for resource " + filename + ". Skipping...")); - } - } + gatherMMPResourceMappings(buildConfig, resources, mmpData); return null; } }); @@ -1152,6 +982,114 @@ return resources; } + private static void gatherMMPResourceMappings( + final ICarbideBuildConfiguration buildConfig, + final HashMap<String, String> resources, IMMPData mmpData) { + // read the project-wide target path + String targetPathStr = mmpData.getSingleArgumentSettings().get(EMMPStatement.TARGETPATH); + + // the target path, should always be absolute and deviceless + IPath targetPath; + + if (targetPathStr != null) { + targetPath = new Path(targetPathStr).makeAbsolute(); + } else { + // for EKA1 just leave empty. for EKA2 use sys\bin\ + if (buildConfig.getSDK().getOSVersion().getMajor() > 8) { + targetPath = new Path("/sys/bin/"); //$NON-NLS-1$ + } else { + targetPath = Path.ROOT; //$NON-NLS-1$ + } + } + + IPath dataZDir = buildConfig.getSDK().getReleaseRoot().removeLastSegments(1).append("/data/z/"); //$NON-NLS-1$ + + // get the aifs + List<IMMPAIFInfo> aifs = mmpData.getAifs(); + for (IMMPAIFInfo aif : aifs) { + IPath aifPath = aif.getTarget().makeAbsolute(); + resources.put(dataZDir.append(targetPath).append(aifPath.lastSegment()).toOSString(), + HostOS.convertPathToWindows(targetPath.setDevice("C:"))); //$NON-NLS-1$ + } + + /////////// + + // for resources and bitmaps, the target path may be based on the target type if not explicitly + // set for the resource or bitmap. + String targetType = mmpData.getSingleArgumentSettings().get(EMMPStatement.TARGETTYPE); + if (targetType != null) { + // could be PLUGIN or PLUGIN3 + if (targetType.toUpperCase().startsWith("PLUGIN")) { //$NON-NLS-1$ + targetPath = new Path("/resource/plugins"); //$NON-NLS-1$ + } else if (targetType.compareToIgnoreCase("PDL") == 0) { //$NON-NLS-1$ + targetPath = new Path("/resource/printers"); //$NON-NLS-1$ + } + } + + // get the bitmaps + List<IMMPBitmap> bmps = mmpData.getBitmaps(); + for (IMMPBitmap bmp : bmps) { + IPath mbmPath = bmp.getTargetFilePath().makeRelative(); + // if there's no target path then use the main target path + if (mbmPath.segmentCount() == 1) { + mbmPath = targetPath.append(mbmPath); + } + IPath mbmDir = mbmPath.removeLastSegments(1).addTrailingSeparator().setDevice("C:"); //$NON-NLS-1$ + resources.put(dataZDir.append(mbmPath).toOSString(), + HostOS.convertPathToWindows(mbmDir.toOSString())); + } + + // get the user resources + List<IPath> userResources = mmpData.getUserResources(); + for (IPath userRes : userResources) { + addResourceLanguageTargets(resources, mmpData, null, + dataZDir.append(targetPath).append(userRes.removeFileExtension().lastSegment().toLowerCase()), + targetPath.setDevice("C:")); //$NON-NLS-1$ + } + + // get the system resources + List<IPath> systemResources = mmpData.getSystemResources(); + for (IPath systemRes : systemResources) { + addResourceLanguageTargets(resources, mmpData, null, + dataZDir.append(targetPath).append(systemRes.removeFileExtension().lastSegment().toLowerCase()), + targetPath.setDevice("C:")); //$NON-NLS-1$ + } + + // get the resource blocks + List<IMMPResource> resourceBlocks = mmpData.getResourceBlocks(); + for (IMMPResource resourceBlock : resourceBlocks) { + IPath resPath = resourceBlock.getTargetPath(); + if (resPath == null) { + // not specified in the resource block so use existing + resPath = targetPath; + } + + String filename = resourceBlock.getTargetFile(); + if (filename == null) { + filename = resourceBlock.getSource().removeFileExtension().lastSegment(); + } else { + filename = HostOS.createPathFromString(filename).removeFileExtension().toOSString(); + } + filename = filename.toLowerCase(); + + if (resPath != null) { + resPath = resPath.makeAbsolute().addTrailingSeparator(); + // adjust the path if necessary as it's different on the phone for the *_.reg file + IPath adjustedTargetPath = resPath; + if ((adjustedTargetPath.toPortableString()).equalsIgnoreCase("/private/10003a3f/apps/")) { //$NON-NLS-1$ + adjustedTargetPath = new Path("/private/10003a3f/import/apps/"); //$NON-NLS-1$ + } + addResourceLanguageTargets(resources, mmpData, resourceBlock, + dataZDir.append(resPath).append(filename), + adjustedTargetPath.setDevice("C:")); //$NON-NLS-1$ + } else { + CarbideBuilderPlugin.log(Logging.newStatus(CarbideBuilderPlugin.getDefault(), + IStatus.WARNING, + "No TARGETPATH specified for resource " + filename + ". Skipping...")); + } + } + } + /** * Get a map of the generated images from image makefiles for the project. * @param buildConfig the build configuration @@ -1592,13 +1530,13 @@ public static boolean getIndexAllPreference() { // Can't access this pref from the project ui plugin because it would cause a circular dependency - Plugin plugin = Platform.getPlugin("com.nokia.carbide.cpp.project.ui"); //$NON-NLS-1$ - if (plugin == null) { + IEclipsePreferences prefs = new InstanceScope().getNode("com.nokia.carbide.cpp.project.ui"); + if (prefs == null) { CarbideBuilderPlugin.log(Logging.newStatus(CarbideBuilderPlugin.getDefault(), IStatus.WARNING, "Could not find project UI plugin!")); return true; } - return plugin.getPluginPreferences().getBoolean("indexAll"); //$NON-NLS-1$ + return prefs.getBoolean("indexAll", false); //$NON-NLS-1$ } /** @@ -2159,26 +2097,6 @@ } /** - * Get the target name with a variant suffix inserted. - * @param mmpData - * @param target - * @return updated target name - * - * @deprecated Deprecated in 2.1. Use {@link #getBinaryVariantTargetName(IMMPData mmpData, IPath target, IProject project)} instead. - */ - private static IPath getVariantTargetName(IMMPData mmpData, IPath target) { - if (target == null) - return null; - - String suffix = mmpData.getSingleArgumentSettings().get(EMMPStatement.VAR); - if (suffix != null) { - target = target.removeFileExtension().addFileExtension(suffix + "." + FileUtils.getSafeFileExtension(target)); //$NON-NLS-1$ - } - - return target; - } - - /** * Get the target name with a variant suffix inserted. Since 2.1 this includes support for Symbian Binary Variation builds * that have the FEATUREVARIANT keyword in their MMP file. * @param mmpData diff -r 4224161eb5db -r 0ca8a6b568b1 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/AddEditSisFileToBuildDialog.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/AddEditSisFileToBuildDialog.java Mon Dec 14 10:24:12 2009 -0600 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/AddEditSisFileToBuildDialog.java Mon Dec 14 10:26:24 2009 -0600 @@ -47,6 +47,7 @@ import com.nokia.carbide.cdt.builder.project.ISISBuilderInfo; import com.nokia.carbide.cdt.internal.api.builder.SISBuilderInfo2; +import com.nokia.cpp.internal.api.utils.ui.BrowseDialogUtils; import com.nokia.sdt.utils.ProjectFileResourceProxyVisitor; public class AddEditSisFileToBuildDialog extends StatusDialog { @@ -384,7 +385,7 @@ DirectoryDialog dialog = new DirectoryDialog(getShell(), SWT.OPEN); dialog.setText("Choose a folder..."); - dialog.setFilterPath(contentSearchLocationEdit.getText()); + BrowseDialogUtils.initializeFrom(dialog, contentSearchLocationEdit, project.getLocation()); String selectedDir = dialog.open(); if (selectedDir != null && selectedDir.length() > 0) { @@ -530,11 +531,11 @@ FileDialog fileDialog = new FileDialog(getShell(), SWT.OPEN); fileDialog.setFilterExtensions(extFilter); fileDialog.setText(title); - - int lastSeparatorIndex = startDir.lastIndexOf(File.separator); - if (lastSeparatorIndex != -1) { - fileDialog.setFilterPath(startDir.substring(0, lastSeparatorIndex)); - } + + IPath startPath = new Path(startDir); + if (!startPath.isAbsolute() && project != null) + startPath = project.getLocation().append(startPath); + BrowseDialogUtils.initializeFrom(fileDialog, startPath); return fileDialog.open(); } diff -r 4224161eb5db -r 0ca8a6b568b1 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/CarbideMacroSettingsPage.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/CarbideMacroSettingsPage.java Mon Dec 14 10:24:12 2009 -0600 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/CarbideMacroSettingsPage.java Mon Dec 14 10:26:24 2009 -0600 @@ -41,6 +41,7 @@ import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin; import com.nokia.carbide.cdt.internal.builder.CarbideProjectInfo; import com.nokia.carbide.cdt.internal.builder.CarbideProjectModifier; +import com.nokia.cpp.internal.api.utils.ui.BrowseDialogUtils; public class CarbideMacroSettingsPage extends PropertyPage { @@ -77,6 +78,8 @@ fileDialog.setFilterExtensions(new String[] {"*.*"}); fileDialog.setText(Messages.getString("CarbideMacroSettingsPage.BrowseDialogTitle")); //$NON-NLS-1$ + BrowseDialogUtils.initializeFrom(fileDialog, fMacroFileEdit); + String path = fileDialog.open(); if (path != null) { fMacroFileEdit.setText(path); diff -r 4224161eb5db -r 0ca8a6b568b1 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/ROMBuilderTabComposite.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/ROMBuilderTabComposite.java Mon Dec 14 10:24:12 2009 -0600 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/ROMBuilderTabComposite.java Mon Dec 14 10:26:24 2009 -0600 @@ -34,6 +34,7 @@ import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration; import com.nokia.carbide.cdt.builder.project.IROMBuilderInfo; import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; +import com.nokia.cpp.internal.api.utils.ui.BrowseDialogUtils; /** * Arguments tab for the Carbide Build Configurations page @@ -73,6 +74,7 @@ workingDirBrowse.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent evt) { DirectoryDialog dialog = new DirectoryDialog(getShell(), SWT.NONE); + BrowseDialogUtils.initializeFrom(dialog, workingDirEdit); dialog.setText(Messages.getString("CarbideRomBuilderTab.Rom_Dir_Dialog_Title")); //$NON-NLS-1$ String result = dialog.open(); diff -r 4224161eb5db -r 0ca8a6b568b1 connectivity/com.nokia.carbide.remoteConnections/META-INF/MANIFEST.MF --- a/connectivity/com.nokia.carbide.remoteConnections/META-INF/MANIFEST.MF Mon Dec 14 10:24:12 2009 -0600 +++ b/connectivity/com.nokia.carbide.remoteConnections/META-INF/MANIFEST.MF Mon Dec 14 10:26:24 2009 -0600 @@ -11,7 +11,8 @@ com.nokia.cpp.utils.core, org.eclipse.emf.ecore.xmi;bundle-version="2.4.0", org.eclipse.core.net;bundle-version="1.1.0", - org.eclipse.help;bundle-version="3.4.0" + org.eclipse.help;bundle-version="3.4.0", + com.nokia.cpp.utils.ui Bundle-RequiredExecutionEnvironment: J2SE-1.5 Bundle-ActivationPolicy: lazy Export-Package: com.nokia.carbide.installpackages, diff -r 4224161eb5db -r 0ca8a6b568b1 connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/messages.properties --- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/messages.properties Mon Dec 14 10:24:12 2009 -0600 +++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/messages.properties Mon Dec 14 10:26:24 2009 -0600 @@ -17,6 +17,7 @@ ConnectionSettingsPage.InstallTabLabel=Install remote agents ConnectionSettingsPage.NoInstallerDataInfoString=No installer data available. ConnectionSettingsPage.NoInstallerDataInfoString2=Server may be down. +ConnectionSettingsPage.NoInstallerSupport=Installers are currently not supported on this operating system. ConnectionSettingsPage.NoSettingsString={0} has no connection settings ConnectionSettingsPage.NotTestedStatusString=Status not tested ConnectionSettingsPage.PageTitleFmt={0} Settings diff -r 4224161eb5db -r 0ca8a6b568b1 connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/settings/ui/ConnectionSettingsPage.java --- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/settings/ui/ConnectionSettingsPage.java Mon Dec 14 10:24:12 2009 -0600 +++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/settings/ui/ConnectionSettingsPage.java Mon Dec 14 10:26:24 2009 -0600 @@ -28,6 +28,7 @@ import com.nokia.carbide.remoteconnections.interfaces.IRemoteAgentInstallerProvider.IRemoteAgentInstaller; import com.nokia.carbide.remoteconnections.interfaces.IRemoteAgentInstallerProvider.IRemoteAgentInstaller.IPackageContents; import com.nokia.cpp.internal.api.utils.core.*; +import com.nokia.cpp.internal.api.utils.ui.BrowseDialogUtils; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; @@ -165,6 +166,7 @@ gd_sdkcombo.widthHint = 150; deviceOSComboViewer.getCombo().setLayoutData(gd_sdkcombo); deviceOSComboViewer.addSelectionChangedListener(new ISelectionChangedListener() { + @SuppressWarnings("unchecked") public void selectionChanged(SelectionChangedEvent event) { IStructuredSelection selection = (IStructuredSelection) deviceOSComboViewer.getSelection(); Pair<String, Version> pair = (Pair<String, Version>) selection.getFirstElement(); @@ -518,8 +520,14 @@ installerTreeViewer.expandAll(); if (treeNodes.length == 0) { - String errorText = Messages.getString("ConnectionSettingsPage.NoInstallerDataInfoString"); //$NON-NLS-1$ - errorText += "\n" + Messages.getString("ConnectionSettingsPage.NoInstallerDataInfoString2"); //$NON-NLS-1$ //$NON-NLS-2$ + String errorText; + // TODO: the actual error condition needs to be recorded... + if (HostOS.IS_UNIX) { + errorText = Messages.getString("ConnectionSettingsPage.NoInstallerSupport"); //$NON-NLS-1$ + } else { + errorText = Messages.getString("ConnectionSettingsPage.NoInstallerDataInfoString"); //$NON-NLS-1$ + errorText += "\n" + Messages.getString("ConnectionSettingsPage.NoInstallerDataInfoString2"); //$NON-NLS-1$ //$NON-NLS-2$ + } installerInfoText.setText(errorText); } @@ -556,6 +564,7 @@ } } + @SuppressWarnings("unchecked") private TreeNode findTreeNodeForPair(TreeNode[] treeNodes, Pair<String, Version> pair) { for (TreeNode treeNode : treeNodes) { Object value = treeNode.getValue(); @@ -575,6 +584,7 @@ return null; } + @SuppressWarnings("unchecked") protected void testService() { Map<String, String> settings = connectionFactory.getSettingsFromUI(); boolean newConnection = connection == null || !connectionType.equals(connection.getConnectionType()); @@ -652,8 +662,7 @@ dialog.setText(Messages.getString("ConnectionSettingsPage.SaveAsDialogTitle")); //$NON-NLS-1$ if (saveAsParent == null) saveAsParent = System.getProperty("user.home"); //$NON-NLS-1$ - dialog.setFilterPath(saveAsParent); - dialog.setFileName(packageContents.getDefaultNameFileName()); + BrowseDialogUtils.initializeFrom(dialog, new Path(saveAsParent).append(packageContents.getDefaultNameFileName())); dialog.setOverwrite(true); // prompt for overwrite String path = dialog.open(); if (path != null) { @@ -758,7 +767,7 @@ for (String familyName : familyNames) { List<Version> versions = installerProvider.getVersions(familyName); for (Version version : versions) { - Pair<String, Version> pair = new Pair(familyName, version); + Pair<String, Version> pair = new Pair<String, Version>(familyName, version); if (!deviceOSPairs.contains(pair)) deviceOSPairs.add(pair); } diff -r 4224161eb5db -r 0ca8a6b568b1 connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/wizard/ExportPage.java --- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/wizard/ExportPage.java Mon Dec 14 10:24:12 2009 -0600 +++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/wizard/ExportPage.java Mon Dec 14 10:26:24 2009 -0600 @@ -21,6 +21,7 @@ import com.nokia.carbide.remoteconnections.Messages; import com.nokia.carbide.remoteconnections.RemoteConnectionsActivator; import com.nokia.carbide.remoteconnections.interfaces.IConnection; +import com.nokia.cpp.internal.api.utils.ui.BrowseDialogUtils; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; @@ -72,7 +73,7 @@ tableColumn.pack(); } viewer.setAllChecked(true); - connections = new ArrayList(RemoteConnectionsActivator.getConnectionsManager().getConnections()); + connections = new ArrayList<IConnection>(RemoteConnectionsActivator.getConnectionsManager().getConnections()); createBrowseGroup(composite, Messages.getString("ExportPage.BrowseGroupLabel")); //$NON-NLS-1$ browseButton.addSelectionListener(new SelectionAdapter() { @@ -82,8 +83,7 @@ dialog.setText(Messages.getString("ExportPage.FileDialogTitle")); //$NON-NLS-1$ if (saveAsParent == null) saveAsParent = System.getProperty("user.home"); //$NON-NLS-1$ - dialog.setFilterPath(saveAsParent); - dialog.setFileName("exportedConnections.xml"); //$NON-NLS-1$ + BrowseDialogUtils.initializeFrom(dialog, new Path(saveAsParent).append("exportedConnections.xml")); //$NON-NLS-1$ dialog.setOverwrite(true); // prompt for overwrite String path = dialog.open(); if (path != null) { diff -r 4224161eb5db -r 0ca8a6b568b1 connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/wizard/ImportPage.java --- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/wizard/ImportPage.java Mon Dec 14 10:24:12 2009 -0600 +++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/wizard/ImportPage.java Mon Dec 14 10:26:24 2009 -0600 @@ -22,6 +22,7 @@ import com.nokia.carbide.remoteconnections.Messages; import com.nokia.carbide.remoteconnections.RemoteConnectionsActivator; import com.nokia.carbide.remoteconnections.internal.registry.Reader; +import com.nokia.cpp.internal.api.utils.ui.BrowseDialogUtils; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; @@ -68,6 +69,7 @@ fileDialog.setText(Messages.getString("ImportPage.FileDialogTitle")); //$NON-NLS-1$ fileDialog.setFilterExtensions(FILTER_EXTS); fileDialog.setFilterNames(FILTER_EXT_NAMES); + BrowseDialogUtils.initializeFrom(fileDialog, pathText); String pathstr = fileDialog.open(); if (pathstr != null) { pathText.setText(pathstr); diff -r 4224161eb5db -r 0ca8a6b568b1 core/com.nokia.carbide.bugreport/META-INF/MANIFEST.MF --- a/core/com.nokia.carbide.bugreport/META-INF/MANIFEST.MF Mon Dec 14 10:24:12 2009 -0600 +++ b/core/com.nokia.carbide.bugreport/META-INF/MANIFEST.MF Mon Dec 14 10:26:24 2009 -0600 @@ -11,7 +11,8 @@ org.eclipse.ui.console, org.eclipse.jface.text, org.eclipse.core.net, - com.nokia.cpp.utils.core + com.nokia.cpp.utils.core, + com.nokia.cpp.utils.ui Bundle-ActivationPolicy: lazy Export-Package: com.nokia.carbide.internal.bugreport.export Bundle-ClassPath: lib/commons-httpclient-3.1.jar, diff -r 4224161eb5db -r 0ca8a6b568b1 core/com.nokia.carbide.bugreport/src/com/nokia/carbide/internal/bugreport/ui/wizards/BugDescriptionPage.java --- a/core/com.nokia.carbide.bugreport/src/com/nokia/carbide/internal/bugreport/ui/wizards/BugDescriptionPage.java Mon Dec 14 10:24:12 2009 -0600 +++ b/core/com.nokia.carbide.bugreport/src/com/nokia/carbide/internal/bugreport/ui/wizards/BugDescriptionPage.java Mon Dec 14 10:26:24 2009 -0600 @@ -40,6 +40,7 @@ import com.nokia.carbide.internal.bugreport.model.*; import com.nokia.carbide.internal.bugreport.resources.HelpContextIDs; import com.nokia.carbide.internal.bugreport.resources.Messages; +import com.nokia.cpp.internal.api.utils.ui.BrowseDialogUtils; /** @@ -196,6 +197,7 @@ if (event.widget == browseButton) { FileDialog dialog = new FileDialog(this.getShell(), SWT.OPEN); dialog.setText(Messages.getString("BugDescriptionPage.SelectAttachmentFile")); //$NON-NLS-1$ + BrowseDialogUtils.initializeFrom(dialog, attachmentText); String result = dialog.open(); attachmentText.setText(result); } else if (event.widget == uiServiceLink) { diff -r 4224161eb5db -r 0ca8a6b568b1 core/com.nokia.carbide.cpp.codescanner/META-INF/MANIFEST.MF --- a/core/com.nokia.carbide.cpp.codescanner/META-INF/MANIFEST.MF Mon Dec 14 10:24:12 2009 -0600 +++ b/core/com.nokia.carbide.cpp.codescanner/META-INF/MANIFEST.MF Mon Dec 14 10:26:24 2009 -0600 @@ -19,7 +19,8 @@ com.nokia.carbide.cpp.sdk.core, com.nokia.carbide.cpp.epoc.engine, com.nokia.cpp.utils.core, - com.nokia.carbide.cpp.featureTracker + com.nokia.carbide.cpp.featureTracker, + com.nokia.cpp.utils.ui Bundle-ActivationPolicy: lazy Export-Package: com.nokia.carbide.cpp.internal.codescanner;x-friends:="com.nokia.carbide.cpp.codescanner.tests", com.nokia.carbide.cpp.internal.codescanner.config;x-friends:="com.nokia.carbide.cpp.codescanner.tests", diff -r 4224161eb5db -r 0ca8a6b568b1 core/com.nokia.carbide.cpp.codescanner/src/com/nokia/carbide/cpp/internal/codescanner/ui/CSGeneralTabPage.java --- a/core/com.nokia.carbide.cpp.codescanner/src/com/nokia/carbide/cpp/internal/codescanner/ui/CSGeneralTabPage.java Mon Dec 14 10:24:12 2009 -0600 +++ b/core/com.nokia.carbide.cpp.codescanner/src/com/nokia/carbide/cpp/internal/codescanner/ui/CSGeneralTabPage.java Mon Dec 14 10:26:24 2009 -0600 @@ -37,6 +37,7 @@ import com.nokia.carbide.cpp.internal.codescanner.CSPlugin; import com.nokia.carbide.cpp.internal.codescanner.Messages; +import com.nokia.cpp.internal.api.utils.ui.BrowseDialogUtils; /** * A class to create and control the CodeScanner General Options tab page. @@ -421,7 +422,7 @@ DirectoryDialog dialog = new DirectoryDialog(csDirEditText.getShell(), SWT.OPEN); dialog.setText(Messages.getString("CSGeneralTabPage.SelectDirTitle")); dialog.setMessage(Messages.getString("CSGeneralTabPage.SelectCSDirMessage")); - dialog.setFilterPath(csDirEditText.getText()); + BrowseDialogUtils.initializeFrom(dialog, csDirEditText); return dialog.open(); } @@ -433,7 +434,7 @@ DirectoryDialog dialog = new DirectoryDialog(resultsDirEditText.getShell(), SWT.OPEN); dialog.setText(Messages.getString("CSGeneralTabPage.SelectDirTitle")); dialog.setMessage(Messages.getString("CSGeneralTabPage.SelectResultsDirMessage")); - dialog.setFilterPath(resultsDirEditText.getText()); + BrowseDialogUtils.initializeFrom(dialog, resultsDirEditText); return dialog.open(); } diff -r 4224161eb5db -r 0ca8a6b568b1 core/com.nokia.carbide.cpp.codescanner/src/com/nokia/carbide/cpp/internal/codescanner/ui/CSPreferencePage.java --- a/core/com.nokia.carbide.cpp.codescanner/src/com/nokia/carbide/cpp/internal/codescanner/ui/CSPreferencePage.java Mon Dec 14 10:24:12 2009 -0600 +++ b/core/com.nokia.carbide.cpp.codescanner/src/com/nokia/carbide/cpp/internal/codescanner/ui/CSPreferencePage.java Mon Dec 14 10:26:24 2009 -0600 @@ -47,6 +47,7 @@ import com.nokia.carbide.cpp.internal.codescanner.CSPlugin; import com.nokia.carbide.cpp.internal.codescanner.Messages; +import com.nokia.cpp.internal.api.utils.ui.BrowseDialogUtils; /** * A class to create and control the CodeScanner preference page. @@ -326,7 +327,7 @@ } String[] extensions = new String[] {"*.xml"}; dialog.setFilterExtensions(extensions); - dialog.setFilterPath(dialogFilterPath); + BrowseDialogUtils.initializeFrom(dialog, dialogFilterPath != null ? dialogFilterPath + File.separator : null); String configFilePath = dialog.open(); dialogFilterPath = dialog.getFilterPath(); return configFilePath; diff -r 4224161eb5db -r 0ca8a6b568b1 core/com.nokia.carbide.cpp.codescanner/src/com/nokia/carbide/cpp/internal/codescanner/ui/CSPropertyPage.java --- a/core/com.nokia.carbide.cpp.codescanner/src/com/nokia/carbide/cpp/internal/codescanner/ui/CSPropertyPage.java Mon Dec 14 10:24:12 2009 -0600 +++ b/core/com.nokia.carbide.cpp.codescanner/src/com/nokia/carbide/cpp/internal/codescanner/ui/CSPropertyPage.java Mon Dec 14 10:26:24 2009 -0600 @@ -47,6 +47,7 @@ import com.nokia.carbide.cpp.internal.codescanner.CSPlugin; import com.nokia.carbide.cpp.internal.codescanner.Messages; import com.nokia.carbide.cpp.internal.codescanner.config.CSProjectSettings; +import com.nokia.cpp.internal.api.utils.ui.BrowseDialogUtils; /** @@ -406,7 +407,7 @@ } String[] extensions = new String[] {"*.xml"}; dialog.setFilterExtensions(extensions); - dialog.setFilterPath(dialogFilterPath); + BrowseDialogUtils.initializeFrom(dialog, dialogFilterPath != null ? dialogFilterPath + File.separator : null); String configFilePath = dialog.open(); dialogFilterPath = dialog.getFilterPath(); return configFilePath; diff -r 4224161eb5db -r 0ca8a6b568b1 core/com.nokia.carbide.cpp.leavescan/META-INF/MANIFEST.MF --- a/core/com.nokia.carbide.cpp.leavescan/META-INF/MANIFEST.MF Mon Dec 14 10:24:12 2009 -0600 +++ b/core/com.nokia.carbide.cpp.leavescan/META-INF/MANIFEST.MF Mon Dec 14 10:26:24 2009 -0600 @@ -12,5 +12,6 @@ org.eclipse.cdt.core, com.nokia.carbide.cdt.builder, com.nokia.carbide.cpp.sdk.core, - com.nokia.cpp.utils.core + com.nokia.cpp.utils.core, + com.nokia.cpp.utils.ui Bundle-ActivationPolicy: lazy diff -r 4224161eb5db -r 0ca8a6b568b1 core/com.nokia.carbide.cpp.leavescan/src/com/nokia/carbide/cpp/internal/leavescan/ui/LeavescanPreferences.java --- a/core/com.nokia.carbide.cpp.leavescan/src/com/nokia/carbide/cpp/internal/leavescan/ui/LeavescanPreferences.java Mon Dec 14 10:24:12 2009 -0600 +++ b/core/com.nokia.carbide.cpp.leavescan/src/com/nokia/carbide/cpp/internal/leavescan/ui/LeavescanPreferences.java Mon Dec 14 10:26:24 2009 -0600 @@ -33,6 +33,7 @@ import org.eclipse.ui.PlatformUI; import com.nokia.carbide.cpp.internal.leavescan.LeavescanPlugin; +import com.nokia.cpp.internal.api.utils.ui.BrowseDialogUtils; public class LeavescanPreferences extends PreferencePage implements IWorkbenchPreferencePage,Listener { @@ -153,7 +154,7 @@ private String showBrowseDialog() { DirectoryDialog dialog = new DirectoryDialog(leaveScanDirEditText.getShell(), SWT.OPEN); dialog.setText("Choose a folder..."); - dialog.setFilterPath(leaveScanDirEditText.getText()); + BrowseDialogUtils.initializeFrom(dialog, leaveScanDirEditText); return dialog.open(); } diff -r 4224161eb5db -r 0ca8a6b568b1 core/com.nokia.carbide.cpp.sdk.core/META-INF/MANIFEST.MF --- a/core/com.nokia.carbide.cpp.sdk.core/META-INF/MANIFEST.MF Mon Dec 14 10:24:12 2009 -0600 +++ b/core/com.nokia.carbide.cpp.sdk.core/META-INF/MANIFEST.MF Mon Dec 14 10:26:24 2009 -0600 @@ -16,7 +16,7 @@ org.eclipse.update.core, com.nokia.carbide.templatewizard, org.eclipse.core.filesystem, - com.nokia.cpp.utils.ui;bundle-version="1.0.0" + com.nokia.cpp.utils.ui Bundle-ActivationPolicy: lazy Export-Package: com.nokia.carbide.cpp.internal.api.sdk, com.nokia.carbide.cpp.internal.sdk.core.model;x-friends:="com.nokia.carbide.cpp.sdk.core.test", diff -r 4224161eb5db -r 0ca8a6b568b1 core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/sdk/ui/shared/AddSDKDialog.java --- a/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/sdk/ui/shared/AddSDKDialog.java Mon Dec 14 10:24:12 2009 -0600 +++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/sdk/ui/shared/AddSDKDialog.java Mon Dec 14 10:26:24 2009 -0600 @@ -48,6 +48,7 @@ import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin; import com.nokia.carbide.cpp.sdk.core.SymbianSDKFactory; +import com.nokia.cpp.internal.api.utils.ui.BrowseDialogUtils; /** * Dialog that allows the user to add a new Symbian OS SDK or custkit @@ -360,11 +361,7 @@ private void browseEPOCROOT(){ DirectoryDialog browseDir = new DirectoryDialog(getShell(), SWT.OPEN); browseDir.setMessage(Messages.getString("AddSDKDialog.Choose_location_for_EPOCROOT")); //$NON-NLS-1$ - File symbianFolder = new File("C:/Symbian/"); //$NON-NLS-1$ - if (symbianFolder.exists()){ - browseDir.setFilterPath(symbianFolder.toString()); - } - + BrowseDialogUtils.initializeFrom(browseDir, "C:/Symbian/"); //$NON-NLS-1$ String dirText = browseDir.open(); if (dirText != null){ epocRootText.setText(dirText); diff -r 4224161eb5db -r 0ca8a6b568b1 core/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/BrowseDialogUtils.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/core/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/BrowseDialogUtils.java Mon Dec 14 10:26:24 2009 -0600 @@ -0,0 +1,183 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +package com.nokia.cpp.internal.api.utils.ui; + +import java.io.File; + +import org.eclipse.core.runtime.IPath; +import org.eclipse.swt.widgets.DirectoryDialog; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Text; + +/** + * Utilities to make it easier to use file and directory dialogs which are associated + * with text entry fields. + * <p> + * First, promote UI where Browse... starts from the current textual entry rather than + * some random place. + * <p> + * Second, overcome terrible SWT behavior: even if you do set the filter path, then if it + * is not 100% correct, it will again revert to the home directory. So, find the nearest + * directory that <i>does</i> exist. + */ +public class BrowseDialogUtils { + /** + * When issuing a "Browse..." command next to a text entry field, initialize + * the dialog with the nearest existing file or directory in that text field. + * @param dialog + * @param textEntry + * @pathm defaultPath the path to use when the text entry is empty + */ + public static void initializeFrom(FileDialog dialog, Text textEntry, IPath defaultPath) { + if (textEntry != null) { + String existing = textEntry.getText().trim(); + if (existing.length() > 0) { + initializeFrom(dialog, existing); + return; + } + } + if (defaultPath != null) { + initializeFrom(dialog, defaultPath); + } + } + + /** + * When issuing a "Browse..." command next to a text entry field, initialize + * the dialog with the nearest existing file or directory in that text field. + * @param dialog + * @param textEntry + */ + public static void initializeFrom(FileDialog dialog, Text textEntry) { + if (textEntry == null) + return; + String existing = textEntry.getText().trim(); + initializeFrom(dialog, existing); + } + + /** + * When issuing a "Browse..." command with an expected file, initialize + * the dialog with the nearest existing file or directory. + * @param dialog + * @param path + */ + public static void initializeFrom(FileDialog dialog, IPath path) { + if (path != null) { + initializeFrom(dialog, path.toOSString()); + } + } + + /** + * When issuing a "Browse..." command with an expected file, initialize + * the dialog with the nearest existing file or directory. + * @param dialog + * @param path + */ + public static void initializeFrom(FileDialog dialog, String path) { + if (path != null && path.length() > 0) { + boolean isDirectory = path.endsWith("/") || path.endsWith("\\"); + File file = new File(path); + boolean exists = file.exists(); + if (exists) { + isDirectory = file.isDirectory(); + } + if (!isDirectory) { + dialog.setFileName(file.getName()); + } + if (exists) { + if (file.isAbsolute()) { + dialog.setFilterPath(isDirectory ? file.getAbsolutePath() : file.getParent()); + } + } else { + if (!file.isAbsolute()) + return; + File dir = file.getParentFile(); + while (dir != null && !dir.exists()) { + dir = dir.getParentFile(); + } + if (dir != null) { + dialog.setFilterPath(dir.getAbsolutePath()); + } + } + } + } + + /** + * When issuing a "Browse..." command next to a text entry field, initialize + * the dialog with the nearest existing directory in that text field. + * @param dialog + * @param textEntry + * @param defaultPath the default path if the text entry is empty + */ + public static void initializeFrom(DirectoryDialog dialog, Text textEntry, IPath defaultPath) { + if (textEntry != null) { + String existing = textEntry.getText().trim(); + if (existing.length() > 0) { + initializeFrom(dialog, existing); + return; + } + } + if (defaultPath != null) { + initializeFrom(dialog, defaultPath); + } + } + + /** + * When issuing a "Browse..." command next to a text entry field, initialize + * the dialog with the nearest existing directory in that text field. + * @param dialog + * @param textEntry + */ + public static void initializeFrom(DirectoryDialog dialog, Text textEntry) { + if (textEntry == null) + return; + String existing = textEntry.getText().trim(); + initializeFrom(dialog, existing); + } + + /** + * When issuing a "Browse..." command with an expected directory, initialize + * the dialog with the nearest existing path. + * @param dialog + * @param path + */ + public static void initializeFrom(DirectoryDialog dialog, IPath path) { + if (path != null) { + initializeFrom(dialog, path.toOSString()); + } + } + + /** + * When issuing a "Browse..." command with an expected directory, initialize + * the dialog with the nearest existing path. + * @param dialog + * @param path + */ + public static void initializeFrom(DirectoryDialog dialog, String path) { + if (path != null && path.length() > 0) { + File file = new File(path); + if (!file.isAbsolute()) + return; + while (file != null && !file.exists()) { + file = file.getParentFile(); + } + if (file != null) { + dialog.setFilterPath(file.getAbsolutePath()); + } + } + } +} diff -r 4224161eb5db -r 0ca8a6b568b1 core/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/DirectorySelectorWithHistory.java --- a/core/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/DirectorySelectorWithHistory.java Mon Dec 14 10:24:12 2009 -0600 +++ b/core/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/DirectorySelectorWithHistory.java Mon Dec 14 10:26:24 2009 -0600 @@ -96,11 +96,7 @@ public void widgetSelected(SelectionEvent e) { DirectoryDialog dlg = new DirectoryDialog(parent.getShell()); - String curPath = directoryCombo.getText(); - if (curPath.length() > 0) - dlg.setFilterPath(curPath); - else - dlg.setFilterPath("."); //$NON-NLS-1$ + BrowseDialogUtils.initializeFrom(dlg, directoryCombo.getText()); String dir = dlg.open(); if (dir != null) { directoryCombo.setText(dir); diff -r 4224161eb5db -r 0ca8a6b568b1 debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/service/ConnectedServiceFactory.java --- a/debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/service/ConnectedServiceFactory.java Mon Dec 14 10:24:12 2009 -0600 +++ b/debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/service/ConnectedServiceFactory.java Mon Dec 14 10:26:24 2009 -0600 @@ -36,13 +36,13 @@ if (service instanceof TracingService && isCompatibleConnection(getCompatibleTracingConnectionTypeIds(), connection)) { if (HostOS.IS_UNIX) - return null; // TODO: not ported + return new RemoteConnectedService(service); // TODO: not ported return new TracingConnectedService(service, (AbstractSynchronizedConnection) connection); } else if (service instanceof TRKService && isCompatibleConnection(getCompatibleTRKConnectionTypeIds(), connection)) { if (HostOS.IS_UNIX) - return null; // TODO: not ported + return new RemoteConnectedService(service); // TODO: not ported return new TRKConnectedService(service, (AbstractSynchronizedConnection) connection); } diff -r 4224161eb5db -r 0ca8a6b568b1 debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/service/RemoteConnectedService.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/service/RemoteConnectedService.java Mon Dec 14 10:26:24 2009 -0600 @@ -0,0 +1,136 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +package com.nokia.carbide.trk.support.service; + +import org.osgi.framework.Version; + +import com.nokia.carbide.remoteconnections.Messages; +import com.nokia.carbide.remoteconnections.interfaces.IConnectedService; +import com.nokia.carbide.remoteconnections.interfaces.IService; +import com.nokia.cpp.internal.api.utils.core.IListenerFiring; +import com.nokia.cpp.internal.api.utils.core.ListenerList; + +/** + * This is a stub for the TRK and Trace connected services used when the host + * does not support Chad's TCF. This reconciles the fact that a TRK connection publishes + * these services, but we cannot actually instantiate them. + * <p> + * In the future this should find a way to talk to the device over Eclipse TCF or something. + */ +public class RemoteConnectedService implements IConnectedService { + + private boolean enabled = true; + private final IService service; + private IStatus unknownStatus = new IStatus() { + + public IConnectedService getConnectedService() { + return RemoteConnectedService.this; + } + + public EStatus getEStatus() { + return EStatus.UNKNOWN; + } + + public String getLongDescription() { + return "The device is connected remotely; testing not yet implemented."; + } + + public String getShortDescription() { + return "Unknown"; + } + + }; + + private IStatus noStatus = new IStatus() { + + public IConnectedService getConnectedService() { + return RemoteConnectedService.this; + } + + public EStatus getEStatus() { + return EStatus.UNKNOWN; + } + + public String getLongDescription() { + return Messages.getString("AbstractConnectedService.UserDisabledMessage"); + } + + public String getShortDescription() { + return Messages.getString("AbstractConnectedService.NoTestingLabel"); + } + + }; + private ListenerList<IStatusChangedListener> listeners; + private IStatus currentStatus; + /** + * + */ + public RemoteConnectedService(IService service) { + this.service = service; + listeners = new ListenerList<IStatusChangedListener>(); + currentStatus = noStatus; + } + public void addStatusChangedListener(IStatusChangedListener listener) { + listeners.add(listener); + } + + public void dispose() { + } + + public IService getService() { + return service; + } + + public IStatus getStatus() { + return currentStatus; + } + + public void removeStatusChangedListener(IStatusChangedListener listener) { + listeners.remove(listener); + } + + public void testStatus() { + } + + public void setDeviceOS(String familyName, Version version) { + } + + public boolean isEnabled() { + return enabled; + } + + public void setEnabled(boolean enabled) { + this.enabled = enabled; + + currentStatus = enabled ? unknownStatus : noStatus; + + fireListeners(); + } + /** + * + */ + private void fireListeners() { + listeners.fireListeners(new IListenerFiring<IStatusChangedListener>() { + + public void fire(IStatusChangedListener listener) { + listener.statusChanged(getStatus()); + } + }); + } +} diff -r 4224161eb5db -r 0ca8a6b568b1 debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/service/TRKService.java --- a/debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/service/TRKService.java Mon Dec 14 10:24:12 2009 -0600 +++ b/debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/service/TRKService.java Mon Dec 14 10:26:24 2009 -0600 @@ -22,6 +22,7 @@ import com.nokia.carbide.trk.support.Messages; import com.nokia.carbide.trk.support.connection.*; import com.nokia.cpp.internal.api.utils.core.Check; +import com.nokia.cpp.internal.api.utils.core.HostOS; import java.util.*; @@ -56,6 +57,9 @@ } public IRemoteAgentInstallerProvider getInstallerProvider() { + if (HostOS.IS_UNIX) + return null; // TODO: implement + return new TRKInstallerProvider(this); } diff -r 4224161eb5db -r 0ca8a6b568b1 debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/service/TracingService.java --- a/debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/service/TracingService.java Mon Dec 14 10:24:12 2009 -0600 +++ b/debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/service/TracingService.java Mon Dec 14 10:26:24 2009 -0600 @@ -23,6 +23,7 @@ import com.nokia.carbide.trk.support.connection.TCPIPConnectionType; import com.nokia.carbide.trk.support.connection.USBConnectionType; import com.nokia.cpp.internal.api.utils.core.Check; +import com.nokia.cpp.internal.api.utils.core.HostOS; import java.util.Arrays; @@ -58,6 +59,8 @@ } public IRemoteAgentInstallerProvider getInstallerProvider() { + if (HostOS.IS_UNIX) + return null; // TODO: implement return new TracingInstallerProvider(this); } diff -r 4224161eb5db -r 0ca8a6b568b1 debuggercdi/com.nokia.cdt.debug.launch/META-INF/MANIFEST.MF --- a/debuggercdi/com.nokia.cdt.debug.launch/META-INF/MANIFEST.MF Mon Dec 14 10:24:12 2009 -0600 +++ b/debuggercdi/com.nokia.cdt.debug.launch/META-INF/MANIFEST.MF Mon Dec 14 10:26:24 2009 -0600 @@ -27,7 +27,8 @@ com.nokia.carbide.cpp.ui, com.nokia.cpp.utils.core, com.freescale.cdt.debug.cw.core.ui, - com.nokia.carbide.remoteConnections + com.nokia.carbide.remoteConnections, + com.nokia.cpp.utils.ui Bundle-ActivationPolicy: lazy Export-Package: com.nokia.cdt.internal.debug.launch, com.nokia.cdt.internal.debug.launch.ui, diff -r 4224161eb5db -r 0ca8a6b568b1 debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/ui/AddEditFileToTransferDialog.java --- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/ui/AddEditFileToTransferDialog.java Mon Dec 14 10:24:12 2009 -0600 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/ui/AddEditFileToTransferDialog.java Mon Dec 14 10:26:24 2009 -0600 @@ -38,7 +38,7 @@ import org.eclipse.swt.widgets.Text; import org.eclipse.ui.PlatformUI; -import com.nokia.cpp.internal.api.utils.core.HostOS; +import com.nokia.cpp.internal.api.utils.ui.BrowseDialogUtils; public class AddEditFileToTransferDialog extends StatusDialog { @@ -107,7 +107,9 @@ dialog.setText(Messages.getString("AddEditFileToTransferDialog.4")); //$NON-NLS-1$ dialog.setFilterExtensions(new String[] {"*"}); //$NON-NLS-1$ dialog.setFilterNames(new String[] {Messages.getString("AddEditFileToTransferDialog.11")}); //$NON-NLS-1$ - + + BrowseDialogUtils.initializeFrom(dialog, hostPath); + String result = dialog.open(); if (result != null) { IPath path = new Path(result); diff -r 4224161eb5db -r 0ca8a6b568b1 debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/ui/EmulationMainTab.java --- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/ui/EmulationMainTab.java Mon Dec 14 10:24:12 2009 -0600 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/ui/EmulationMainTab.java Mon Dec 14 10:26:24 2009 -0600 @@ -18,6 +18,7 @@ import com.freescale.cdt.debug.cw.core.settings.DebuggerCommonData; import com.nokia.cdt.internal.debug.launch.LaunchPlugin; +import com.nokia.cpp.internal.api.utils.ui.BrowseDialogUtils; import org.eclipse.core.resources.*; import org.eclipse.core.runtime.CoreException; @@ -128,7 +129,9 @@ hostBrowse.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent evt) { FileDialog dialog = new FileDialog(getShell(), SWT.NONE); - + + BrowseDialogUtils.initializeFrom(dialog, hostText); + dialog.setText(Messages.getString("EmulationMainTab.5")); //$NON-NLS-1$ String result = dialog.open(); if (result != null && new File(result).exists()) { diff -r 4224161eb5db -r 0ca8a6b568b1 debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/ui/ExecutablesTab.java --- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/ui/ExecutablesTab.java Mon Dec 14 10:24:12 2009 -0600 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/ui/ExecutablesTab.java Mon Dec 14 10:26:24 2009 -0600 @@ -63,6 +63,7 @@ import com.nokia.cdt.debug.cw.symbian.SettingsData; import com.nokia.cdt.internal.debug.launch.LaunchPlugin; import com.nokia.cdt.internal.debug.launch.NokiaAbstractLaunchDelegate; +import com.nokia.cpp.internal.api.utils.ui.BrowseDialogUtils; import cwdbg.PreferenceConstants; @@ -162,6 +163,9 @@ public void widgetSelected(SelectionEvent e) { FileDialog dialog = new FileDialog(getShell(), SWT.NONE); dialog.setText(Messages.getString("ExecutablesTab.7")); //$NON-NLS-1$ + if (executablesToTarget != null && executablesToTarget.size() > 0) { + BrowseDialogUtils.initializeFrom(dialog, executablesToTarget.get(executablesToTarget.size() - 1).getExePath()); + } final String res = dialog.open(); if (res != null) { Job importJob = new Job(Messages.getString("ExecutablesTab.8")) { //$NON-NLS-1$ diff -r 4224161eb5db -r 0ca8a6b568b1 debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/ui/FileTransferTab.java --- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/ui/FileTransferTab.java Mon Dec 14 10:24:12 2009 -0600 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/ui/FileTransferTab.java Mon Dec 14 10:26:24 2009 -0600 @@ -97,7 +97,7 @@ tp = tp.append(hp.lastSegment()); } String enabled = tokenizer.nextToken(); - files.add(new FileToTransfer(hp.toOSString(), tp.toOSString(), enabled.compareTo("1") == 0)); //$NON-NLS-1$ + files.add(new FileToTransfer(hp.toOSString(), HostOS.convertPathToWindows(tp), enabled.compareTo("1") == 0)); //$NON-NLS-1$ } } } else { diff -r 4224161eb5db -r 0ca8a6b568b1 debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/ui/InstallationTab.java --- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/ui/InstallationTab.java Mon Dec 14 10:24:12 2009 -0600 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/ui/InstallationTab.java Mon Dec 14 10:26:24 2009 -0600 @@ -55,6 +55,7 @@ import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration; import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo; import com.nokia.cdt.internal.debug.launch.LaunchPlugin; +import com.nokia.cpp.internal.api.utils.ui.BrowseDialogUtils; import cwdbg.PreferenceConstants; @@ -143,9 +144,8 @@ dialog.setText(Messages.getString("InstallationTab.4")); //$NON-NLS-1$ dialog.setFilterExtensions(new String[] {"*.sis*", "*.*"}); //$NON-NLS-1$ //$NON-NLS-2$ dialog.setFilterNames(new String[] {Messages.getString("InstallationTab.27"), Messages.getString("InstallationTab.28")}); //$NON-NLS-1$ //$NON-NLS-2$ - - dialog.setFilterPath(new File(hostPath.getText()).getParent()); - dialog.setFileName(new File(hostPath.getText()).getName()); + + BrowseDialogUtils.initializeFrom(dialog, hostPath); String result = dialog.open(); if (result != null && new File(result).exists()) { diff -r 4224161eb5db -r 0ca8a6b568b1 debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/ui/RomImageTab.java --- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/ui/RomImageTab.java Mon Dec 14 10:24:12 2009 -0600 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/ui/RomImageTab.java Mon Dec 14 10:26:24 2009 -0600 @@ -40,6 +40,7 @@ import org.eclipse.ui.PlatformUI; import com.freescale.swt.widgets.CheckboxGroup; import com.nokia.cdt.internal.debug.launch.LaunchPlugin; +import com.nokia.cpp.internal.api.utils.ui.BrowseDialogUtils; import cwdbg.PreferenceConstants; @@ -138,7 +139,9 @@ dialog.setText(Messages.getString("RomImageTab.14")); //$NON-NLS-1$ dialog.setFilterExtensions(new String[] {"*.img*", "*.*"}); //$NON-NLS-1$ //$NON-NLS-2$ dialog.setFilterNames(new String[] {Messages.getString("RomImageTab.15"), Messages.getString("RomImageTab.16")}); //$NON-NLS-1$ //$NON-NLS-2$ - + + BrowseDialogUtils.initializeFrom(dialog, osImagePath); + String result = dialog.open(); if (result != null && new File(result).exists()) { osImagePath.setText(result); @@ -232,7 +235,9 @@ dialog.setText(Messages.getString("RomLogFileTab.6")); //$NON-NLS-1$ dialog.setFilterExtensions(new String[] {"*.log*", "*.*"}); //$NON-NLS-1$ //$NON-NLS-2$ dialog.setFilterNames(new String[] {Messages.getString("RomLogFileTab.7"), Messages.getString("RomLogFileTab.8")}); //$NON-NLS-1$ //$NON-NLS-2$ - + + BrowseDialogUtils.initializeFrom(dialog, romLogFilePath); + String result = dialog.open(); if (result != null && new File(result).exists()) { romLogFilePath.setText(result); @@ -263,6 +268,7 @@ public void widgetSelected(SelectionEvent evt) { DirectoryDialog dialog = new DirectoryDialog(getShell(), SWT.NONE); + BrowseDialogUtils.initializeFrom(dialog, epoc32DirPath); dialog.setText(Messages.getString("RomLogFileTab.11")); //$NON-NLS-1$ String result = dialog.open(); diff -r 4224161eb5db -r 0ca8a6b568b1 debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/ui/RomLogFileTab.java --- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/ui/RomLogFileTab.java Mon Dec 14 10:24:12 2009 -0600 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/ui/RomLogFileTab.java Mon Dec 14 10:26:24 2009 -0600 @@ -40,6 +40,7 @@ import org.eclipse.ui.PlatformUI; import com.freescale.swt.widgets.CheckboxGroup; import com.nokia.cdt.internal.debug.launch.LaunchPlugin; +import com.nokia.cpp.internal.api.utils.ui.BrowseDialogUtils; import cwdbg.PreferenceConstants; @@ -138,6 +139,8 @@ dialog.setFilterExtensions(new String[] {"*.log*", "*.*"}); //$NON-NLS-1$ //$NON-NLS-2$ dialog.setFilterNames(new String[] {Messages.getString("RomLogFileTab.7"), Messages.getString("RomLogFileTab.8")}); //$NON-NLS-1$ //$NON-NLS-2$ + BrowseDialogUtils.initializeFrom(dialog, romLogFilePath); + String result = dialog.open(); if (result != null && new File(result).exists()) { romLogFilePath.setText(result); @@ -171,6 +174,7 @@ public void widgetSelected(SelectionEvent evt) { DirectoryDialog dialog = new DirectoryDialog(getShell(), SWT.NONE); + BrowseDialogUtils.initializeFrom(dialog, epoc32DirPath); dialog.setText(Messages.getString("RomLogFileTab.11")); //$NON-NLS-1$ String result = dialog.open(); diff -r 4224161eb5db -r 0ca8a6b568b1 debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/wizard/MainExecutableSelectionWizardPage.java --- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/wizard/MainExecutableSelectionWizardPage.java Mon Dec 14 10:24:12 2009 -0600 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/wizard/MainExecutableSelectionWizardPage.java Mon Dec 14 10:26:24 2009 -0600 @@ -17,6 +17,7 @@ package com.nokia.cdt.internal.debug.launch.wizard; import com.nokia.cpp.internal.api.utils.core.*; +import com.nokia.cpp.internal.api.utils.ui.BrowseDialogUtils; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; @@ -237,7 +238,7 @@ if (item.equals(BROWSE_ITEM)) { FileDialog fileDialog = new FileDialog(getShell(), SWT.OPEN); fileDialog.setText(Messages.getString("MainExecutableSelectionWizardPage.SelectExectuableTitle")); //$NON-NLS-1$ - fileDialog.setFilterPath(emulatorPath.removeLastSegments(1).toOSString()); + BrowseDialogUtils.initializeFrom(fileDialog, emulatorPath); fileDialog.setFilterExtensions(FILTER_EXTS); fileDialog.setFilterNames(FILTER_EXT_NAMES); String pathstr = fileDialog.open(); diff -r 4224161eb5db -r 0ca8a6b568b1 debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/wizard/SophiaWizardPage.java --- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/wizard/SophiaWizardPage.java Mon Dec 14 10:24:12 2009 -0600 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/wizard/SophiaWizardPage.java Mon Dec 14 10:26:24 2009 -0600 @@ -38,6 +38,7 @@ import com.nokia.cdt.debug.cw.symbian.SettingsData; import com.nokia.cpp.internal.api.utils.core.Check; +import com.nokia.cpp.internal.api.utils.ui.BrowseDialogUtils; import cwdbg.PreferenceConstants; @@ -113,6 +114,8 @@ dialog.setFilterExtensions(new String[] {"*.dll*", "*.*"}); //$NON-NLS-1$ //$NON-NLS-2$ dialog.setFilterNames(new String[] {Messages.getString("SophiaWizardPage.5"), Messages.getString("SophiaWizardPage.6")}); //$NON-NLS-1$ //$NON-NLS-2$ + BrowseDialogUtils.initializeFrom(dialog, sophiaSTIDLLPath); + String result = dialog.open(); if (result != null && new File(result).exists()) { sophiaSTIDLLPath.setText(result); @@ -145,6 +148,8 @@ dialog.setFilterExtensions(new String[] {"*.cfg*", "*.*"}); //$NON-NLS-1$ //$NON-NLS-2$ dialog.setFilterNames(new String[] {Messages.getString("SophiaWizardPage.10"), Messages.getString("SophiaWizardPage.6")}); //$NON-NLS-1$ //$NON-NLS-2$ + BrowseDialogUtils.initializeFrom(dialog, targetInitFilePath); + String result = dialog.open(); if (result != null && new File(result).exists()) { targetInitFilePath.setText(result); diff -r 4224161eb5db -r 0ca8a6b568b1 debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/wizard/StopModeRomImageWizardPage.java --- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/wizard/StopModeRomImageWizardPage.java Mon Dec 14 10:24:12 2009 -0600 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/wizard/StopModeRomImageWizardPage.java Mon Dec 14 10:26:24 2009 -0600 @@ -17,6 +17,7 @@ package com.nokia.cdt.internal.debug.launch.wizard; import com.nokia.cpp.internal.api.utils.core.Check; +import com.nokia.cpp.internal.api.utils.ui.BrowseDialogUtils; import cwdbg.PreferenceConstants; @@ -167,6 +168,8 @@ dialog.setFilterExtensions(new String[] {"*.img*", "*.*"}); //$NON-NLS-1$ //$NON-NLS-2$ dialog.setFilterNames(new String[] {Messages.getString("StopModeRomImageWizardPage.14"), Messages.getString("StopModeRomImageWizardPage.10")}); //$NON-NLS-1$ //$NON-NLS-2$ + BrowseDialogUtils.initializeFrom(dialog, romImagePath); + String result = dialog.open(); if (result != null && new File(result).exists()) { romImagePath.setText(result); @@ -199,6 +202,8 @@ dialog.setFilterExtensions(new String[] {"*.log*", "*.*"}); //$NON-NLS-1$ //$NON-NLS-2$ dialog.setFilterNames(new String[] {Messages.getString("StopModeRomImageWizardPage.9"), Messages.getString("StopModeRomImageWizardPage.10")}); //$NON-NLS-1$ //$NON-NLS-2$ + BrowseDialogUtils.initializeFrom(dialog, romLogFilePath); + String result = dialog.open(); if (result != null && new File(result).exists()) { romLogFilePath.setText(result); diff -r 4224161eb5db -r 0ca8a6b568b1 debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/wizard/TRKSISSelectionWizardPage.java --- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/wizard/TRKSISSelectionWizardPage.java Mon Dec 14 10:24:12 2009 -0600 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/wizard/TRKSISSelectionWizardPage.java Mon Dec 14 10:26:24 2009 -0600 @@ -19,6 +19,7 @@ import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin; import com.nokia.carbide.cdt.builder.project.*; import com.nokia.cpp.internal.api.utils.core.Check; +import com.nokia.cpp.internal.api.utils.ui.BrowseDialogUtils; import cwdbg.PreferenceConstants; @@ -158,6 +159,8 @@ dialog.setFilterExtensions(new String[] {"*.sis*", "*.*"}); //$NON-NLS-1$ //$NON-NLS-2$ dialog.setFilterNames(new String[] {Messages.getString("TRKSISSelectionWizardPage.7"), Messages.getString("TRKSISSelectionWizardPage.8")}); //$NON-NLS-1$ //$NON-NLS-2$ + BrowseDialogUtils.initializeFrom(dialog, sisEdit); + String result = dialog.open(); if (result != null && new File(result).exists()) { sisEdit.setText(result); diff -r 4224161eb5db -r 0ca8a6b568b1 debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/wizard/Trace32WizardPage.java --- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/wizard/Trace32WizardPage.java Mon Dec 14 10:24:12 2009 -0600 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/wizard/Trace32WizardPage.java Mon Dec 14 10:26:24 2009 -0600 @@ -38,6 +38,7 @@ import com.nokia.cdt.debug.cw.symbian.SettingsData; import com.nokia.cpp.internal.api.utils.core.Check; +import com.nokia.cpp.internal.api.utils.ui.BrowseDialogUtils; import cwdbg.PreferenceConstants; @@ -107,6 +108,8 @@ dialog.setFilterExtensions(new String[] {"*.cmm*", "*.*"}); //$NON-NLS-1$ //$NON-NLS-2$ dialog.setFilterNames(new String[] {Messages.getString("Trace32WizardPage.5"), Messages.getString("Trace32WizardPage.6")}); //$NON-NLS-1$ //$NON-NLS-2$ + BrowseDialogUtils.initializeFrom(dialog, t32BootConfigFilePath); + String result = dialog.open(); if (result != null && new File(result).exists()) { t32BootConfigFilePath.setText(result); diff -r 4224161eb5db -r 0ca8a6b568b1 project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/editors/inf/ExportFileDialog.java --- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/editors/inf/ExportFileDialog.java Mon Dec 14 10:24:12 2009 -0600 +++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/editors/inf/ExportFileDialog.java Mon Dec 14 10:26:24 2009 -0600 @@ -19,6 +19,7 @@ import com.nokia.carbide.cdt.builder.EpocEnginePathHelper; import com.nokia.carbide.cpp.epoc.engine.model.bldinf.IExport; import com.nokia.carbide.cpp.internal.project.ui.editors.common.StatusInfo; +import com.nokia.cpp.internal.api.utils.ui.BrowseDialogUtils; import com.nokia.cpp.internal.api.utils.ui.WorkbenchUtils; import org.eclipse.core.resources.IProject; @@ -137,9 +138,9 @@ // set the initial directory String currentFile = sourcePath.getText().trim(); if (currentFile.length() == 0) { - dialog.setFilterPath(project.getLocation().toOSString()); + BrowseDialogUtils.initializeFrom(dialog, project.getLocation()); } else { - dialog.setFileName(currentFile); + BrowseDialogUtils.initializeFrom(dialog, currentFile); } String result = dialog.open(); diff -r 4224161eb5db -r 0ca8a6b568b1 project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/editors/inf/MMPFileDialog.java --- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/editors/inf/MMPFileDialog.java Mon Dec 14 10:24:12 2009 -0600 +++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/editors/inf/MMPFileDialog.java Mon Dec 14 10:26:24 2009 -0600 @@ -20,6 +20,7 @@ import com.nokia.carbide.cpp.epoc.engine.model.bldinf.IMMPReference; import com.nokia.carbide.cpp.epoc.engine.model.bldinf.IMakMakeReference; import com.nokia.carbide.cpp.internal.project.ui.editors.common.StatusInfo; +import com.nokia.cpp.internal.api.utils.ui.BrowseDialogUtils; import com.nokia.cpp.internal.api.utils.ui.WorkbenchUtils; import org.eclipse.core.runtime.IPath; @@ -146,12 +147,7 @@ dialog.setFilterNames(new String[] {Messages.MMPFileDialog_MMPFiles, Messages.MMPFileDialog_AllFiles}); // set the initial directory - String currentFile = filePath.getText().trim(); - if (currentFile.length() == 0) { - dialog.setFilterPath(editorContext.project.getLocation().toOSString()); - } else { - dialog.setFileName(currentFile); - } + BrowseDialogUtils.initializeFrom(dialog, filePath, editorContext.project.getLocation()); String result = dialog.open(); if (result != null) { diff -r 4224161eb5db -r 0ca8a6b568b1 project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/editors/inf/MakeFileDialog.java --- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/editors/inf/MakeFileDialog.java Mon Dec 14 10:24:12 2009 -0600 +++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/editors/inf/MakeFileDialog.java Mon Dec 14 10:26:24 2009 -0600 @@ -21,6 +21,7 @@ import com.nokia.carbide.cpp.epoc.engine.model.bldinf.IMakefileReference; import com.nokia.carbide.cpp.epoc.engine.model.bldinf.IMakefileReference.EMakeEngine; import com.nokia.carbide.cpp.internal.project.ui.editors.common.StatusInfo; +import com.nokia.cpp.internal.api.utils.ui.BrowseDialogUtils; import com.nokia.cpp.internal.api.utils.ui.WorkbenchUtils; import org.eclipse.core.runtime.IPath; @@ -167,12 +168,7 @@ dialog.setFilterNames(new String[] {Messages.MakeFileDialog_MakeFiles, Messages.MakeFileDialog_AllFiles}); // set the initial directory - String currentFile = filePath.getText().trim(); - if (currentFile.length() == 0) { - dialog.setFilterPath(editorContext.project.getLocation().toOSString()); - } else { - dialog.setFileName(currentFile); - } + BrowseDialogUtils.initializeFrom(dialog, filePath, editorContext.project.getLocation()); String result = dialog.open(); if (result != null) { diff -r 4224161eb5db -r 0ca8a6b568b1 project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/BldInfSelectionPage.java --- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/BldInfSelectionPage.java Mon Dec 14 10:24:12 2009 -0600 +++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/BldInfSelectionPage.java Mon Dec 14 10:26:24 2009 -0600 @@ -42,6 +42,7 @@ import com.nokia.carbide.cpp.internal.api.sdk.SBSv2Utils; import com.nokia.carbide.cpp.internal.project.ui.ProjectUIHelpIds; import com.nokia.carbide.cpp.internal.project.ui.sharedui.BuilderSelectionComposite; +import com.nokia.cpp.internal.api.utils.ui.BrowseDialogUtils; public class BldInfSelectionPage extends WizardPage implements Listener { @@ -141,11 +142,7 @@ fileDialog.setFileName("bld.inf"); //$NON-NLS-1$ fileDialog.setText(Messages.BldInfSelectionPage_browseDialogTitle); - String currentSourceString = bldInfCombo.getText(); - int lastSeparatorIndex = currentSourceString.lastIndexOf(File.separator); - if (lastSeparatorIndex != -1) { - fileDialog.setFilterPath(currentSourceString.substring(0, lastSeparatorIndex)); - } + BrowseDialogUtils.initializeFrom(fileDialog, bldInfCombo.getText()); return fileDialog.open(); } diff -r 4224161eb5db -r 0ca8a6b568b1 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 Mon Dec 14 10:24:12 2009 -0600 +++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/ProjectPropertiesPage.java Mon Dec 14 10:26:24 2009 -0600 @@ -46,6 +46,7 @@ import com.nokia.carbide.cdt.builder.EpocEngineHelper; import com.nokia.carbide.cpp.internal.project.ui.ProjectUIHelpIds; import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; +import com.nokia.cpp.internal.api.utils.ui.BrowseDialogUtils; public class ProjectPropertiesPage extends WizardPage implements Listener { @@ -167,8 +168,7 @@ private String showBrowseDialog() { DirectoryDialog dialog = new DirectoryDialog(rootDirectory.getShell(), SWT.OPEN); dialog.setText(Messages.ProjectPropertiesPage_browseDialogTitle); - - dialog.setFilterPath(rootDirectory.getText()); + BrowseDialogUtils.initializeFrom(dialog, rootDirectory); return dialog.open(); } diff -r 4224161eb5db -r 0ca8a6b568b1 project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/mmpEditor/LinkerSectionPart.java --- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/mmpEditor/LinkerSectionPart.java Mon Dec 14 10:24:12 2009 -0600 +++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/mmpEditor/LinkerSectionPart.java Mon Dec 14 10:26:24 2009 -0600 @@ -59,6 +59,7 @@ import com.nokia.carbide.cpp.epoc.engine.model.mmp.EMMPStatement; import com.nokia.sdt.utils.ProjectFileResourceProxyVisitor; import com.nokia.cpp.internal.api.utils.core.TextUtils; +import com.nokia.cpp.internal.api.utils.ui.BrowseDialogUtils; import com.nokia.cpp.internal.api.utils.ui.editor.FormEditorEditingContext; public class LinkerSectionPart extends SectionPart { @@ -221,13 +222,7 @@ IPath curDefFile = editorContext.mmpView.getDefFile(); if (curDefFile != null) { curDefFile = editorContext.pathHelper.convertMMPToFilesystem(EMMPPathContext.DEFFILE, curDefFile); - if (!curDefFile.hasTrailingSeparator()) { - dialog.setFileName(curDefFile.lastSegment()); - } - while (curDefFile.segmentCount() > 0 && !curDefFile.toFile().exists()) { - curDefFile = curDefFile.removeLastSegments(1); - } - dialog.setFilterPath(curDefFile.toOSString()); + BrowseDialogUtils.initializeFrom(dialog, curDefFile); } dialog.setFilterNames(new String[] {Messages.LinkerSectionPart_defFileBrowseFilterName}); diff -r 4224161eb5db -r 0ca8a6b568b1 project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/mmpEditor/dialogs/ChooseDirectoryComposite.java --- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/mmpEditor/dialogs/ChooseDirectoryComposite.java Mon Dec 14 10:24:12 2009 -0600 +++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/mmpEditor/dialogs/ChooseDirectoryComposite.java Mon Dec 14 10:26:24 2009 -0600 @@ -20,6 +20,7 @@ import com.nokia.carbide.cdt.builder.MMPViewPathHelper; import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration; import com.nokia.carbide.cpp.internal.project.ui.ProjectUIPlugin; +import com.nokia.cpp.internal.api.utils.ui.BrowseDialogUtils; import org.eclipse.core.resources.*; import org.eclipse.core.runtime.*; @@ -157,6 +158,17 @@ private void doBrowse() { DirectoryDialog dialog = new DirectoryDialog(getShell()); dialog.setMessage(Messages.getString("IncludeDirectoryDialog.browseForDirectoryPrompt")); //$NON-NLS-1$ + + IPath currentPath = new Path(pathViewer.getCombo().getText()); + if (!currentPath.isEmpty()) { + currentPath = pathHelper.convertMMPToFilesystem(pathContext, currentPath); + } else if (pathContext == EMMPPathContext.SYSTEMINCLUDE + || pathContext == EMMPPathContext.SYSTEMRESOURCE + || pathContext == EMMPPathContext.TARGETPATH) { + currentPath = new Path(buildConfiguration.getSDK().getEPOCROOT()); + } + BrowseDialogUtils.initializeFrom(dialog, currentPath); + String fullPath = dialog.open(); if (fullPath != null) { setViewerPath(new Path(fullPath)); diff -r 4224161eb5db -r 0ca8a6b568b1 qt/com.nokia.carbide.cpp.qt.ui/META-INF/MANIFEST.MF --- a/qt/com.nokia.carbide.cpp.qt.ui/META-INF/MANIFEST.MF Mon Dec 14 10:24:12 2009 -0600 +++ b/qt/com.nokia.carbide.cpp.qt.ui/META-INF/MANIFEST.MF Mon Dec 14 10:26:24 2009 -0600 @@ -22,7 +22,8 @@ com.nokia.carbide.cdt.builder, org.eclipse.cdt.core, org.eclipse.ui.ide, - com.trolltech.qtcppproject;bundle-version="1.6.0";resolution:=optional + com.trolltech.qtcppproject;bundle-version="1.6.0";resolution:=optional, + com.nokia.cpp.utils.ui Bundle-RequiredExecutionEnvironment: J2SE-1.5 Bundle-ActivationPolicy: lazy Import-Package: com.trolltech.qtcppproject, diff -r 4224161eb5db -r 0ca8a6b568b1 qt/com.nokia.carbide.cpp.qt.ui/src/com/nokia/carbide/cpp/internal/qt/ui/wizard/QtProFileSelectionPage.java --- a/qt/com.nokia.carbide.cpp.qt.ui/src/com/nokia/carbide/cpp/internal/qt/ui/wizard/QtProFileSelectionPage.java Mon Dec 14 10:24:12 2009 -0600 +++ b/qt/com.nokia.carbide.cpp.qt.ui/src/com/nokia/carbide/cpp/internal/qt/ui/wizard/QtProFileSelectionPage.java Mon Dec 14 10:26:24 2009 -0600 @@ -46,6 +46,7 @@ import com.nokia.carbide.cpp.internal.api.sdk.SBSv2Utils; import com.nokia.carbide.cpp.internal.project.ui.sharedui.BuilderSelectionComposite; import com.nokia.carbide.cpp.internal.qt.ui.QtUIHelpIds; +import com.nokia.cpp.internal.api.utils.ui.BrowseDialogUtils; public class QtProFileSelectionPage extends WizardPage implements Listener { @@ -143,11 +144,7 @@ fileDialog.setFilterExtensions(new String[] {"*.pro", "*.*"}); //$NON-NLS-1$ //$NON-NLS-2$ fileDialog.setText(Messages.QtProFileSelectionPage_browseDialogTitle); - String currentSourceString = proFileCombo.getText(); - int lastSeparatorIndex = currentSourceString.lastIndexOf(File.separator); - if (lastSeparatorIndex != -1) { - fileDialog.setFilterPath(currentSourceString.substring(0, lastSeparatorIndex)); - } + BrowseDialogUtils.initializeFrom(fileDialog, proFileCombo.getText()); return fileDialog.open(); } diff -r 4224161eb5db -r 0ca8a6b568b1 uidesigner/com.nokia.sdt.component.symbian/src/com/nokia/sdt/component/symbian/actions/AddComponentLibraryAction.java --- a/uidesigner/com.nokia.sdt.component.symbian/src/com/nokia/sdt/component/symbian/actions/AddComponentLibraryAction.java Mon Dec 14 10:24:12 2009 -0600 +++ b/uidesigner/com.nokia.sdt.component.symbian/src/com/nokia/sdt/component/symbian/actions/AddComponentLibraryAction.java Mon Dec 14 10:26:24 2009 -0600 @@ -19,6 +19,7 @@ */ package com.nokia.sdt.component.symbian.actions; +import com.nokia.cpp.internal.api.utils.ui.BrowseDialogUtils; import com.nokia.sdt.component.ComponentSystemException; import com.nokia.sdt.component.symbian.ComponentSystemPlugin; @@ -68,7 +69,7 @@ try { DirectoryDialog dlg = new DirectoryDialog(window.getShell()); dlg.setMessage("Add a component library plugin"); //$NON-NLS-1$ - dlg.setFilterPath("c:/work/dynamicplugins/com.nokia.uidesigner.user0.componentlibrary"); //$NON-NLS-1$ + BrowseDialogUtils.initializeFrom(dlg, "c:/work/dynamicplugins/com.nokia.uidesigner.user0.componentlibrary"); //$NON-NLS-1$ dlg.open(); String dir = dlg.open(); if (dir == null) { diff -r 4224161eb5db -r 0ca8a6b568b1 uidesigner/com.nokia.sdt.component.symbian/src/com/nokia/sdt/component/symbian/actions/EnableSourceGenDebugAction.java --- a/uidesigner/com.nokia.sdt.component.symbian/src/com/nokia/sdt/component/symbian/actions/EnableSourceGenDebugAction.java Mon Dec 14 10:24:12 2009 -0600 +++ b/uidesigner/com.nokia.sdt.component.symbian/src/com/nokia/sdt/component/symbian/actions/EnableSourceGenDebugAction.java Mon Dec 14 10:26:24 2009 -0600 @@ -21,6 +21,7 @@ import com.nokia.sdt.component.symbian.ComponentSystemPlugin; import com.nokia.sdt.component.symbian.sourcegen.SourceGenAdapterFactory; import com.nokia.cpp.internal.api.utils.core.Check; +import com.nokia.cpp.internal.api.utils.ui.BrowseDialogUtils; import org.eclipse.core.runtime.*; import org.eclipse.jface.action.IAction; @@ -168,7 +169,7 @@ @Override public void widgetSelected(SelectionEvent arg0) { DirectoryDialog dlg = new DirectoryDialog(getShell()); - dlg.setFilterPath(text.getText()); + BrowseDialogUtils.initializeFrom(dlg, text); dlg.setText("Select Output Directory"); dlg.setMessage("Select output directory"); String newDir = dlg.open();