Olá pessoal,
Sou novo com SWT, pra ser mais especifico tenho algumas horas de google rsrs
Estou desenvolvendo um plugin pro eclipse utilizando-o, e queria uma ajudinha com o componente Button.
Eu preciso ao clicar nele abrir a visão de pastas, aquela que permite a gente criar uma pasta, ver hierarquia de pastas e tals.
Atualimente estou fazendo como descrito abaixo, ele abre uma visão que permite eu entrar na pasta e procurar o arquivo, mas não era essa que eu queria agora quero pegar só as pastas não mais o conteudo como pegava abaixo.
/** Componente Botão. */
private Button btn;
private Text txt;
txt = new Text(gpDestinationFolder, SWT.BORDER);
txt.setText(serviceExample);
Font outFontDF = txt.getFont();
txt.setFont(new Font(outFontDF.getDevice(), "Courier New", 8, SWT.NORMAL));
txt.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
txt.setEditable(false);
txt.addFocusListener(new FocusAdapter() {
public void focusGained(FocusEvent e) {
txt.setSelection(0, txt.getText().length());
}
});
txt.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
conteudo= txt.getText();
}
});
btn = new Button(group, SWT.PUSH);
btn.setText("Browse...");
btn.setLayoutData(new GridData(SWT.CENTER, SWT.BEGINNING, false, false));
btn.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
FileDialog dialog = new FileDialog(btn.getShell(), SWT.OPEN);
dialog.setFilterExtensions(new String[]{"*.xml", "*.*"});
String OutputPath = dialog.open();
if (OutputPath != null) {
try {
BufferedReader br = new BufferedReader(new FileReader(OutputPath));
StringBuffer sbf = new StringBuffer();
String line = null;
while ((line = br.readLine()) != null) {
sbf.append(line);
sbf.append("\n");
}
conteudo = sbf.toString();
txt.setText(conteudo);
txt.setEditable(true);
} catch (IOException ioEx) {
ErrorDialog errorDialog = new ErrorDialog(ioEx);
errorDialog.open();
} catch (Exception ex) {
ErrorDialog errorDialog = new ErrorDialog(ex);
errorDialog.open();
}
}
}
});
Bom não sei por onde começar caso tenha um post desses por aqui ou alguém possa me ajudar, seria de grande valia;
Abraços