Skip to content

Commit

Permalink
Merge pull request #16 from epsilonlabs/7-ui-add-buttons-for-adding-w…
Browse files Browse the repository at this point in the history
…orkspace-filesystem-files

Add buttons for adding workspace filesystem files
  • Loading branch information
agarciadom authored Dec 11, 2024
2 parents 4157cb0 + f80cd39 commit 5f18345
Showing 1 changed file with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.FileDialog;

public class RDFModelConfigurationDialog extends AbstractModelConfigurationDialog {

Expand Down Expand Up @@ -261,6 +262,7 @@ public void widgetSelected(SelectionEvent e) {
return groupContent;
}

private String lastPath = null;
private Composite createRDFUrlsGroup(Composite parent) {
final Composite groupContent = DialogUtil.createGroupContainer(parent, "URLs to load", 2);

Expand Down Expand Up @@ -312,7 +314,27 @@ public void widgetSelected(SelectionEvent e) {
}
}
});


final Button addFromFileSystemButton = new Button(urlButtons, SWT.NONE);
addFromFileSystemButton.setText("Browse Filesystem...");
addFromFileSystemButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
FileDialog fileDialog = new FileDialog(getShell(), SWT.OPEN);
fileDialog.setText("Select an RDF file to add");
fileDialog.setFilterExtensions(new String[] { ".rdf", ".ttl", ".nt", ".nq", ".trig", ".owl", ".jsonld", ".trdf", ".rt", ".rpb", ".pbrdf", ".rj", ".trix", ".*" });
if (lastPath != null)
fileDialog.setFilterPath(lastPath);

String selectedFile = fileDialog.open();
if (selectedFile != null) {
urls.add(new URLTableEntry("file:" + selectedFile));
urlList.refresh();
}
lastPath = fileDialog.getFilterPath();
}
});

final Button removeUrlButton = new Button(urlButtons, SWT.NONE);
removeUrlButton.setText("Remove");
removeUrlButton.addSelectionListener(new SelectionAdapter() {
Expand Down

0 comments on commit 5f18345

Please sign in to comment.