--- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/AddEditSisFileToBuildDialog.java Thu Dec 10 14:57:48 2009 -0600
+++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/AddEditSisFileToBuildDialog.java Fri Dec 11 09:47:44 2009 -0600
@@ -385,7 +385,7 @@
DirectoryDialog dialog = new DirectoryDialog(getShell(), SWT.OPEN);
dialog.setText("Choose a folder...");
- BrowseDialogUtils.initializeFrom(dialog, contentSearchLocationEdit);
+ BrowseDialogUtils.initializeFrom(dialog, contentSearchLocationEdit, project.getLocation());
String selectedDir = dialog.open();
if (selectedDir != null && selectedDir.length() > 0) {
--- a/connectivity/com.nokia.carbide.remoteConnections/META-INF/MANIFEST.MF Thu Dec 10 14:57:48 2009 -0600
+++ b/connectivity/com.nokia.carbide.remoteConnections/META-INF/MANIFEST.MF Fri Dec 11 09:47:44 2009 -0600
@@ -12,7 +12,7 @@
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",
- com.nokia.cpp.utils.ui;bundle-version="1.0.0"
+ com.nokia.cpp.utils.ui
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ActivationPolicy: lazy
Export-Package: com.nokia.carbide.installpackages,
--- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/settings/ui/ConnectionSettingsPage.java Thu Dec 10 14:57:48 2009 -0600
+++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/settings/ui/ConnectionSettingsPage.java Fri Dec 11 09:47:44 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;
@@ -652,8 +653,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 +758,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);
}
--- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/wizard/ExportPage.java Thu Dec 10 14:57:48 2009 -0600
+++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/wizard/ExportPage.java Fri Dec 11 09:47:44 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) {
--- a/core/com.nokia.carbide.bugreport/META-INF/MANIFEST.MF Thu Dec 10 14:57:48 2009 -0600
+++ b/core/com.nokia.carbide.bugreport/META-INF/MANIFEST.MF Fri Dec 11 09:47:44 2009 -0600
@@ -12,7 +12,7 @@
org.eclipse.jface.text,
org.eclipse.core.net,
com.nokia.cpp.utils.core,
- com.nokia.cpp.utils.ui;bundle-version="1.0.0"
+ com.nokia.cpp.utils.ui
Bundle-ActivationPolicy: lazy
Export-Package: com.nokia.carbide.internal.bugreport.export
Bundle-ClassPath: lib/commons-httpclient-3.1.jar,
--- a/core/com.nokia.carbide.cpp.codescanner/META-INF/MANIFEST.MF Thu Dec 10 14:57:48 2009 -0600
+++ b/core/com.nokia.carbide.cpp.codescanner/META-INF/MANIFEST.MF Fri Dec 11 09:47:44 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",
--- a/core/com.nokia.carbide.cpp.codescanner/src/com/nokia/carbide/cpp/internal/codescanner/ui/CSGeneralTabPage.java Thu Dec 10 14:57:48 2009 -0600
+++ b/core/com.nokia.carbide.cpp.codescanner/src/com/nokia/carbide/cpp/internal/codescanner/ui/CSGeneralTabPage.java Fri Dec 11 09:47:44 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();
}
--- a/core/com.nokia.carbide.cpp.codescanner/src/com/nokia/carbide/cpp/internal/codescanner/ui/CSPreferencePage.java Thu Dec 10 14:57:48 2009 -0600
+++ b/core/com.nokia.carbide.cpp.codescanner/src/com/nokia/carbide/cpp/internal/codescanner/ui/CSPreferencePage.java Fri Dec 11 09:47:44 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;
--- a/core/com.nokia.carbide.cpp.codescanner/src/com/nokia/carbide/cpp/internal/codescanner/ui/CSPropertyPage.java Thu Dec 10 14:57:48 2009 -0600
+++ b/core/com.nokia.carbide.cpp.codescanner/src/com/nokia/carbide/cpp/internal/codescanner/ui/CSPropertyPage.java Fri Dec 11 09:47:44 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;
--- a/core/com.nokia.carbide.cpp.leavescan/META-INF/MANIFEST.MF Thu Dec 10 14:57:48 2009 -0600
+++ b/core/com.nokia.carbide.cpp.leavescan/META-INF/MANIFEST.MF Fri Dec 11 09:47:44 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
--- a/core/com.nokia.carbide.cpp.leavescan/src/com/nokia/carbide/cpp/internal/leavescan/ui/LeavescanPreferences.java Thu Dec 10 14:57:48 2009 -0600
+++ b/core/com.nokia.carbide.cpp.leavescan/src/com/nokia/carbide/cpp/internal/leavescan/ui/LeavescanPreferences.java Fri Dec 11 09:47:44 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();
}
--- a/core/com.nokia.carbide.cpp.sdk.core/META-INF/MANIFEST.MF Thu Dec 10 14:57:48 2009 -0600
+++ b/core/com.nokia.carbide.cpp.sdk.core/META-INF/MANIFEST.MF Fri Dec 11 09:47:44 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",
--- a/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/sdk/ui/shared/AddSDKDialog.java Thu Dec 10 14:57:48 2009 -0600
+++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/sdk/ui/shared/AddSDKDialog.java Fri Dec 11 09:47:44 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);
--- a/core/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/BrowseDialogUtils.java Thu Dec 10 14:57:48 2009 -0600
+++ b/core/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/BrowseDialogUtils.java Fri Dec 11 09:47:44 2009 -0600
@@ -25,25 +25,53 @@
import org.eclipse.swt.widgets.Text;
/**
- * Utilities to make it easier to use file dialogs.
+ * 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 existing path in that text field.
+ * 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();
+ String existing = textEntry.getText().trim();
initializeFrom(dialog, existing);
}
/**
- * When issuing a "Browse..." command with an expected path, initialize
- * the dialog with the existing path.
+ * When issuing a "Browse..." command with an expected file, initialize
+ * the dialog with the nearest existing file or directory.
* @param dialog
* @param path
*/
@@ -54,19 +82,26 @@
}
/**
- * When issuing a "Browse..." command with an expected path, initialize
- * the dialog with the existing path.
+ * 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);
- if (file.exists()) {
+ boolean exists = file.exists();
+ if (exists) {
+ isDirectory = file.isDirectory();
+ }
+ if (!isDirectory) {
+ dialog.setFileName(file.getName());
+ }
+ if (exists) {
if (file.isAbsolute()) {
- dialog.setFilterPath(file.getParent());
+ dialog.setFilterPath(isDirectory ? file.getAbsolutePath() : file.getParent());
}
- dialog.setFileName(file.getName());
} else {
if (!file.isAbsolute())
return;
@@ -83,20 +118,40 @@
/**
* When issuing a "Browse..." command next to a text entry field, initialize
- * the dialog with the existing path in that text field.
+ * 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();
+ String existing = textEntry.getText().trim();
initializeFrom(dialog, existing);
}
/**
- * When issuing a "Browse..." command with an expected path, initialize
- * the dialog with the existing path.
+ * When issuing a "Browse..." command with an expected directory, initialize
+ * the dialog with the nearest existing path.
* @param dialog
* @param path
*/
@@ -107,8 +162,8 @@
}
/**
- * When issuing a "Browse..." command with an expected path, initialize
- * the dialog with the existing path.
+ * When issuing a "Browse..." command with an expected directory, initialize
+ * the dialog with the nearest existing path.
* @param dialog
* @param path
*/
--- a/debuggercdi/com.nokia.cdt.debug.launch/META-INF/MANIFEST.MF Thu Dec 10 14:57:48 2009 -0600
+++ b/debuggercdi/com.nokia.cdt.debug.launch/META-INF/MANIFEST.MF Fri Dec 11 09:47:44 2009 -0600
@@ -28,7 +28,7 @@
com.nokia.cpp.utils.core,
com.freescale.cdt.debug.cw.core.ui,
com.nokia.carbide.remoteConnections,
- com.nokia.cpp.utils.ui;bundle-version="1.0.0"
+ com.nokia.cpp.utils.ui
Bundle-ActivationPolicy: lazy
Export-Package: com.nokia.cdt.internal.debug.launch,
com.nokia.cdt.internal.debug.launch.ui,
--- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/editors/inf/ExportFileDialog.java Thu Dec 10 14:57:48 2009 -0600
+++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/editors/inf/ExportFileDialog.java Fri Dec 11 09:47:44 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();
--- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/editors/inf/MMPFileDialog.java Thu Dec 10 14:57:48 2009 -0600
+++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/editors/inf/MMPFileDialog.java Fri Dec 11 09:47:44 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) {
--- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/editors/inf/MakeFileDialog.java Thu Dec 10 14:57:48 2009 -0600
+++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/editors/inf/MakeFileDialog.java Fri Dec 11 09:47:44 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) {
--- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/BldInfSelectionPage.java Thu Dec 10 14:57:48 2009 -0600
+++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/BldInfSelectionPage.java Fri Dec 11 09:47:44 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();
}
--- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/mmpEditor/LinkerSectionPart.java Thu Dec 10 14:57:48 2009 -0600
+++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/mmpEditor/LinkerSectionPart.java Fri Dec 11 09:47:44 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});
--- a/qt/com.nokia.carbide.cpp.qt.ui/META-INF/MANIFEST.MF Thu Dec 10 14:57:48 2009 -0600
+++ b/qt/com.nokia.carbide.cpp.qt.ui/META-INF/MANIFEST.MF Fri Dec 11 09:47:44 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,
--- a/qt/com.nokia.carbide.cpp.qt.ui/src/com/nokia/carbide/cpp/internal/qt/ui/wizard/QtProFileSelectionPage.java Thu Dec 10 14:57:48 2009 -0600
+++ b/qt/com.nokia.carbide.cpp.qt.ui/src/com/nokia/carbide/cpp/internal/qt/ui/wizard/QtProFileSelectionPage.java Fri Dec 11 09:47:44 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();
}
--- a/uidesigner/com.nokia.sdt.component.symbian/src/com/nokia/sdt/component/symbian/actions/AddComponentLibraryAction.java Thu Dec 10 14:57:48 2009 -0600
+++ b/uidesigner/com.nokia.sdt.component.symbian/src/com/nokia/sdt/component/symbian/actions/AddComponentLibraryAction.java Fri Dec 11 09:47:44 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) {
--- a/uidesigner/com.nokia.sdt.component.symbian/src/com/nokia/sdt/component/symbian/actions/EnableSourceGenDebugAction.java Thu Dec 10 14:57:48 2009 -0600
+++ b/uidesigner/com.nokia.sdt.component.symbian/src/com/nokia/sdt/component/symbian/actions/EnableSourceGenDebugAction.java Fri Dec 11 09:47:44 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();