Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorAndrew Ferguson2008-03-18 18:01:29 +0000
committerAndrew Ferguson2008-03-18 18:01:29 +0000
commitfd23b527a9c84b99732a671406fc79ae08c3509c (patch)
tree37b8ffbfbae4c44796c5afbdb8d7334b40093105 /core
parent5ecca831d98e5aa2b040c65b409a92e5deae8a25 (diff)
downloadorg.eclipse.cdt-fd23b527a9c84b99732a671406fc79ae08c3509c.tar.gz
org.eclipse.cdt-fd23b527a9c84b99732a671406fc79ae08c3509c.tar.xz
org.eclipse.cdt-fd23b527a9c84b99732a671406fc79ae08c3509c.zip
214596: apply fix
Diffstat (limited to 'core')
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/projectTemplates/testWidgets/hello.cpp2
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/projectTemplates/testWidgets/template.xml5
-rw-r--r--core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/uitree/InputUIElement.java1
-rw-r--r--core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/uitree/UIElementTreeBuilderHelper.java4
-rw-r--r--core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/uitree/uiwidgets/UIBrowseWidget.java28
5 files changed, 33 insertions, 7 deletions
diff --git a/core/org.eclipse.cdt.ui.tests/resources/projectTemplates/testWidgets/hello.cpp b/core/org.eclipse.cdt.ui.tests/resources/projectTemplates/testWidgets/hello.cpp
index 7658866233b..eefb315607b 100644
--- a/core/org.eclipse.cdt.ui.tests/resources/projectTemplates/testWidgets/hello.cpp
+++ b/core/org.eclipse.cdt.ui.tests/resources/projectTemplates/testWidgets/hello.cpp
@@ -17,6 +17,8 @@ int main() {
cout << "$(TestWidget12)" << endl;
cout << "$(TestWidget13)" << endl;
cout << "$(TestWidget14)" << endl;
+ cout << "$(TestWidget15)" << endl;
+ cout << "$(TestWidget16)" << endl;
return 0;
}
diff --git a/core/org.eclipse.cdt.ui.tests/resources/projectTemplates/testWidgets/template.xml b/core/org.eclipse.cdt.ui.tests/resources/projectTemplates/testWidgets/template.xml
index c4262ca6c06..5abe9f8956d 100644
--- a/core/org.eclipse.cdt.ui.tests/resources/projectTemplates/testWidgets/template.xml
+++ b/core/org.eclipse.cdt.ui.tests/resources/projectTemplates/testWidgets/template.xml
@@ -36,6 +36,11 @@
<property id="TestWidget13" label="BrowseWidget1" description="BrowseWidget1Description" type="browse" default="Browse1Default" mandatory="true" pattern=".+"/>
<property id="TestWidget14" label="BrowseWidget2" description="BrowseWidget2Description" type="browse" default="Browse2Default" mandatory="false"/>
</property-group>
+
+ <property-group id="basics3" label="basicsLabel3" description="basicsDescription3" type="PAGES-ONLY" help="help.html">
+ <property id="TestWidget15" label="BrowseDirWidget1" description="BrowseDirWidget1Description" type="browsedir" default="BrowseDir1Default" mandatory="true" pattern=".+"/>
+ <property id="TestWidget16" label="BrowseDirWidget2" description="BrowseDirWidget2Description" type="browsedir" default="BrowseDir2Default" mandatory="false"/>
+ </property-group>
<process type="org.eclipse.cdt.managedbuilder.core.NewManagedProject">
<simple name="name" value="$(projectName)" />
diff --git a/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/uitree/InputUIElement.java b/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/uitree/InputUIElement.java
index 8d73fdbb979..b2f4b2a23ac 100644
--- a/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/uitree/InputUIElement.java
+++ b/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/uitree/InputUIElement.java
@@ -25,6 +25,7 @@ public abstract class InputUIElement extends UIElement {
public static final String SELECTTYPE= "select"; //$NON-NLS-1$
public static final String BOOLEANTYPE= "boolean"; //$NON-NLS-1$
public static final String BROWSETYPE= "browse"; //$NON-NLS-1$
+ public static final String BROWSEDIRTYPE= "browsedir"; //$NON-NLS-1$
public static final String STRINGLISTTYPE= "stringlist"; //$NON-NLS-1$
public static final String SPECIALLISTTYPE= "speciallist"; //$NON-NLS-1$
public static final String MANDATORY= "mandatory"; //$NON-NLS-1$
diff --git a/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/uitree/UIElementTreeBuilderHelper.java b/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/uitree/UIElementTreeBuilderHelper.java
index 393b7e3fae2..6078005f69f 100644
--- a/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/uitree/UIElementTreeBuilderHelper.java
+++ b/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/uitree/UIElementTreeBuilderHelper.java
@@ -133,7 +133,9 @@ public class UIElementTreeBuilderHelper implements IUIElementTreeBuilderHelper {
boolean b= Boolean.parseBoolean(defaultValue);
widgetElement = new UIBooleanWidget(uiAttributes, b);
} else if (type.equalsIgnoreCase(InputUIElement.BROWSETYPE)) {
- widgetElement = new UIBrowseWidget(uiAttributes);
+ widgetElement = new UIBrowseWidget(uiAttributes, false);
+ } else if (type.equalsIgnoreCase(InputUIElement.BROWSEDIRTYPE)) {
+ widgetElement = new UIBrowseWidget(uiAttributes, true);
} else if (type.equalsIgnoreCase(InputUIElement.STRINGLISTTYPE)) {
widgetElement = new UIStringListWidget(uiAttributes);
} else if (type.equalsIgnoreCase(InputUIElement.SPECIALLISTTYPE)) {
diff --git a/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/uitree/uiwidgets/UIBrowseWidget.java b/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/uitree/uiwidgets/UIBrowseWidget.java
index b57db84d3f8..7ba900a1f6c 100644
--- a/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/uitree/uiwidgets/UIBrowseWidget.java
+++ b/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/uitree/uiwidgets/UIBrowseWidget.java
@@ -18,6 +18,7 @@ import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
@@ -39,14 +40,20 @@ public class UIBrowseWidget extends UITextWidget implements ModifyListener {
protected Button button;
/**
+ * If set to true, open a DirectoryDialog otherwise FileDialog
+ */
+ protected boolean isDirectoryBrowser;
+
+ /**
* Constructor.
*
* @param uiAttribute
* attribute associated with this widget.
*/
- public UIBrowseWidget(UIAttributes uiAttribute) {
+ public UIBrowseWidget(UIAttributes uiAttribute, boolean isDirectoryBrowser) {
super(uiAttribute);
this.textValue = uiAttribute.get(InputUIElement.DEFAULT);
+ this.isDirectoryBrowser= isDirectoryBrowser;
}
/**
@@ -86,15 +93,24 @@ public class UIBrowseWidget extends UITextWidget implements ModifyListener {
button.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
- String fileName = new FileDialog(uiComposite.getShell()).open();
- if (fileName != null) {
- textValue = fileName.toString();
- text.setText(textValue);
- }
+ onBrowsePushed();
}
});
}
+ protected void onBrowsePushed() {
+ String fileName;
+ if(isDirectoryBrowser) {
+ fileName= new DirectoryDialog(uiComposite.getShell()).open();
+ } else {
+ fileName= new FileDialog(uiComposite.getShell()).open();
+ }
+ if (fileName != null) {
+ textValue = fileName.toString();
+ text.setText(textValue);
+ }
+ }
+
/**
* call the dispose method on the widgets. This is to ensure that the
* widgets are properly disposed.

Back to the top