Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add buttons for adding workspace filesystem files #16

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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