use of net.sourceforge.sqlexplorer.dialogs.FilterStructureDialog in project tdq-studio-se by Talend.
the class FilterStructureAction method run.
public void run() {
try {
DatabaseStructureView view = SQLExplorerPlugin.getDefault().getDatabaseStructureView();
FilterStructureDialog dialog = new FilterStructureDialog();
Session session = view.getSession();
if (session == null)
return;
Alias alias = session.getUser().getAlias();
if (alias.getSchemaFilterExpression() != null && alias.getSchemaFilterExpression().length() != 0) {
dialog.setSchemaFilter(alias.getSchemaFilterExpression().split(","));
}
if (alias.getFolderFilterExpression() != null && alias.getFolderFilterExpression().length() != 0) {
dialog.setFolderFilter(alias.getFolderFilterExpression().split(","));
}
if (alias.getNameFilterExpression() != null && alias.getNameFilterExpression().length() != 0) {
dialog.setNameFilter(alias.getNameFilterExpression());
}
if (dialog.open() != Window.OK) {
return;
}
String[] schemaFilter = dialog.getSchemaFilter();
StringBuffer schemaFilterString = new StringBuffer("");
String sep = "";
if (schemaFilter != null) {
for (int i = 0; i < schemaFilter.length; i++) {
schemaFilterString.append(sep);
schemaFilterString.append(schemaFilter[i]);
sep = ",";
}
}
alias.setSchemaFilterExpression(schemaFilterString.toString());
String[] folderFilter = dialog.getFolderFilter();
StringBuffer folderFilterString = new StringBuffer("");
sep = "";
if (folderFilter != null) {
for (int i = 0; i < folderFilter.length; i++) {
folderFilterString.append(sep);
folderFilterString.append(folderFilter[i]);
sep = ",";
}
}
alias.setFolderFilterExpression(folderFilterString.toString());
alias.setNameFilterExpression(dialog.getNameFilter());
view.refreshSessionTrees(view.getSession());
} catch (Exception e) {
SQLExplorerPlugin.error("Error creating dialog", e);
}
}
Aggregations