Commit 16ab91bf authored by Maxym Borodenko's avatar Maxym Borodenko

Reset mapping button

parent f0e8a04f
......@@ -220,6 +220,7 @@ public class AppWindow {
private static Image spreadsheetIcon;
private static Image openPackageIcon;
private static Image automapColumnsIcon;
private static Image unmapColumnsIcon;
private static Image spreadsheetIcon16;
static Image pushDataIcon;
private static Image loadWorkspaceIcon;
......@@ -241,6 +242,7 @@ public class AppWindow {
AppWindow.spreadsheetIcon = ImageDescriptor.createFromURL(AppWindow.class.getResource("/icon/spreadsheet.png")).createImage();
AppWindow.spreadsheetIcon16 = ImageDescriptor.createFromURL(AppWindow.class.getResource("/icon/spreadsheet16.png")).createImage();
AppWindow.automapColumnsIcon = ImageDescriptor.createFromURL(AppWindow.class.getResource("/icon/automap.png")).createImage();
AppWindow.unmapColumnsIcon = ImageDescriptor.createFromURL(AppWindow.class.getResource("/icon/unmap.png")).createImage();
AppWindow.pushDataIcon = ImageDescriptor.createFromURL(AppWindow.class.getResource("/icon/pushdata.png")).createImage();
AppWindow.loadWorkspaceIcon = ImageDescriptor.createFromURL(AppWindow.class.getResource("/icon/load.png")).createImage();
AppWindow.saveWorkspaceIcon = ImageDescriptor.createFromURL(AppWindow.class.getResource("/icon/save.png")).createImage();
......@@ -643,6 +645,16 @@ public class AppWindow {
tltmAutomap.setText("Automap");
tltmAutomap.setImage(automapColumnsIcon);
ToolItem tltmResetMapping = new ToolItem(toolBar, SWT.NONE);
tltmResetMapping.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
doUnmap();
}
});
tltmResetMapping.setText("Reset Mapping");
tltmResetMapping.setImage(unmapColumnsIcon);
ToolItem tltmPush = new ToolItem(toolBar, SWT.NONE);
tltmPush.addSelectionListener(new SelectionAdapter() {
@Override
......@@ -765,6 +777,23 @@ public class AppWindow {
});
}
protected void doUnmap() {
final IDataSourceSheet dss = getCurrentDataSourceSheet();
if (dss == null) {
return;
}
_log.info("Got data source sheet " + dss);
threadPool.execute(new Runnable() {
@Override
public void run() {
dss.unmap();
}
});
}
public IDataSourceSheet getCurrentDataSourceSheet() {
CTabItem currentTab = tabFolder.getSelection();
if (currentTab == null) {
......
......@@ -209,7 +209,18 @@ public class DataSourceSheet extends AbstractModelObject implements IDataSourceS
}
}
@Override
@Override
public void unmap() {
for (final Column column : columns) {
if (!StringUtils.isBlank(column.getRdfTerm())) {
// Change only if not blank
_log.debug("Unmap column " + column.getPreferredName());
column.setRdfTerm(null);
}
}
}
@Override
public String getQuery() {
// Auto-generated method stub
return null;
......
......@@ -53,4 +53,6 @@ public interface IDataSourceSheet {
public File getSourceFile();
public void automap(ColumnDefs columnDefs);
public void unmap();
}
......@@ -173,7 +173,17 @@ public class JdbcDataSourceSheet extends AbstractModelObject implements IDataSou
}
}
@Override
@Override
public void unmap() {
for (final Column column : columns) {
if (!StringUtils.isBlank(column.getRdfTerm())) {
// Change only if not blank
column.setRdfTerm(null);
}
}
}
@Override
public String toString() {
return this.sheetName;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment