Author: dmaliarevich
Date: 2009-08-19 05:47:48 -0400 (Wed, 19 Aug 2009)
New Revision: 17152
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/CSSReferenceWizardPage.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4784, initial path for select css file dialog was
set to project root.
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/CSSReferenceWizardPage.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/CSSReferenceWizardPage.java 2009-08-19
09:22:46 UTC (rev 17151)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/CSSReferenceWizardPage.java 2009-08-19
09:47:48 UTC (rev 17152)
@@ -4,6 +4,8 @@
import java.util.HashMap;
import java.util.Map;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
@@ -27,12 +29,13 @@
public CSSReferenceWizardPage(String pageName, String title,
ImageDescriptor titleImage, Object fileLocation) {
super(pageName, title, titleImage, fileLocation);
+ if (fileLocation instanceof IFile) {
+ browseDialogFilterPath = ((IFile)fileLocation).getProject().getLocation().toString();
+ } else if (fileLocation instanceof IPath) {
+ browseDialogFilterPath = ((IPath)fileLocation).toString();
+ }
}
- public CSSReferenceWizardPage(String pageName) {
- super(pageName);
- }
-
public void createControl(Composite parent) {
Composite pageControl = new Composite(parent, SWT.NONE);
@@ -71,7 +74,7 @@
/*
* Add filter path
*/
- if ((null != browseDialogFilterPath) && (new
File(browseDialogFilterPath).exists()) ){
+ if (null != browseDialogFilterPath) {
dialog.setFilterPath(browseDialogFilterPath);
}
dialog.setFilterExtensions(FILTER_EXTENSIONS);
@@ -79,8 +82,10 @@
String newPath = dialog.open();
if (newPath != null) {
newPath = newPath.trim();
- browseDialogFilterPath = newPath;
- cssName.setText(browseDialogFilterPath);
+ cssName.setText(newPath);
+ if (new File(newPath).exists()) {
+ browseDialogFilterPath = newPath;
+ }
}
}
});