Skip to main content
summaryrefslogtreecommitdiffstats
blob: dc7aad26e15299e6af28636c72cc616952353ec7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package org.eclipse.swt.widgets;

/*
 * Licensed Materials - Property of IBM,
 * (c) Copyright IBM Corp. 1998, 2001  All Rights Reserved
 */

import org.eclipse.swt.internal.*;
import org.eclipse.swt.internal.photon.*;
import org.eclipse.swt.*;
import org.eclipse.swt.widgets.*;

public /*final*/ class DirectoryDialog extends Dialog {
	String message = "", filterPath = "";
	
public DirectoryDialog (Shell parent) {
	this (parent, SWT.PRIMARY_MODAL);
}

public DirectoryDialog (Shell parent, int style) {
	super (parent, style);
}

public String getFilterPath () {
	return filterPath;
}

public String getMessage () {
	return message;
}

public String open () {
	int parentHandle = 0;
	if (parent != null) parentHandle = parent.shellHandle;
	byte [] title = null;
	if (this.title != null) title = Converter.wcsToMbcs (null, this.title, true);
	byte [] root_dir = null;
	if (filterPath != null) {
		root_dir = Converter.wcsToMbcs (null, filterPath, true);
	}
	byte [] file_spec = null;
	int flags = OS.Pt_FSR_NO_FCHECK | OS.Pt_FSR_NO_SELECT_FILES | OS.Pt_FSR_SELECT_DIRS;
	PtFileSelectionInfo_t info = new PtFileSelectionInfo_t ();
	OS.PtFileSelection (parentHandle, null, title, root_dir, file_spec, null, null, null, info, flags);
	if (info.ret == OS.Pt_FSDIALOG_BTN2) return null;
	int length = 0;
	while (length < info.path.length && info.path [length] != 0) length++;
	byte [] path = new byte [length];
	System.arraycopy (info.path, 0, path, 0, length);
	return new String (Converter.mbcsToWcs (null, path));
}

public void setFilterPath (String string) {
	filterPath = string;
}

public void setMessage (String string) {
	message = string;
}

}

Back to the top