mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
214596: apply fix
This commit is contained in:
parent
5ecca831d9
commit
fd23b527a9
6 changed files with 39 additions and 9 deletions
|
@ -17,6 +17,8 @@ int main() {
|
|||
cout << "$(TestWidget12)" << endl;
|
||||
cout << "$(TestWidget13)" << endl;
|
||||
cout << "$(TestWidget14)" << endl;
|
||||
cout << "$(TestWidget15)" << endl;
|
||||
cout << "$(TestWidget16)" << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -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)" />
|
||||
|
|
|
@ -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$
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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;
|
||||
|
@ -38,15 +39,21 @@ 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.
|
||||
|
|
|
@ -289,8 +289,12 @@ add and delete items to it.
|
|||
</p>
|
||||
<li>
|
||||
<p>
|
||||
<code>browse</code>: If you want a browse field to choose a file
|
||||
or directory using the File Open dialog.
|
||||
<code>browse</code>: If you want a browse button which opens a file (not directory) selection dialog
|
||||
</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>
|
||||
<code>browsedir</code>: If you want a browse button which opens a directory selection dialog
|
||||
</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
Loading…
Add table
Reference in a new issue