Subversion Repositories XServices

Compare Revisions

Regard whitespace Rev 39 → Rev 30

/sbm4mylyn/trunk/src/net/brutex/mylyn/sbmconnector/ui/SBMRepositoryQueryPage.java
19,11 → 19,7
*/
package net.brutex.mylyn.sbmconnector.ui;
 
import java.awt.Color;
 
import net.brutex.mylyn.sbmconnector.core.SBMRepositoryConnector;
import net.brutex.mylyn.sbmconnector.core.model.SBMField;
import net.brutex.mylyn.sbmconnector.core.model.SBMSystemFields;
 
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.layout.GridDataFactory;
31,25 → 27,16
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.ui.wizards.AbstractRepositoryQueryPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.List;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.Widget;
 
public class SBMRepositoryQueryPage extends AbstractRepositoryQueryPage {
 
private Combo table = null;
private Text sql_where_clause = null;
private Text query_title = null;
 
65,14 → 52,15
if (getQueryTitle() != null) {
query.setSummary(getQueryTitle());
}
query.setAttribute("table", table.getText());
query.setAttribute("sql_where", sql_where_clause.getText());
query.setAttribute("name", query_title.getText());
}
 
@Override
public String getQueryTitle() {
if (query_title != null && !query_title.getText().isEmpty())
return query_title.getText();
if(query_title!=null && !query_title.getText().isEmpty()) return query_title.getText();
return "new query";
}
 
83,24 → 71,35
Label query_label = new Label(control, SWT.NONE);
query_label.setText("Query Name:");
query_title = new Text(control, SWT.BORDER);
if (getQuery() != null)
query_title.setText(getQuery().getAttribute("name"));
if(getQuery()!=null) query_title.setText(getQuery().getAttribute("name"));
 
GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
data.heightHint = 200;
Label label = new Label(control, SWT.NONE);
label.setText("Table:");
Label label_sql = new Label(control, SWT.NONE);
label_sql.setText("SQL where:");
table = new Combo(control, SWT.SINGLE | SWT.BORDER);
for(String table_name : SBMRepositoryConnector.getClient(getTaskRepository()).getPrimaryTables()) {
table.add(table_name);
if(getQuery()!=null && getQuery().getAttribute("table").equals(table_name)) {
table.setText(table_name);
}
}
 
sql_where_clause = new Text(control, SWT.MULTI | SWT.WRAP | SWT.V_SCROLL | SWT.BORDER);
GridData gd = new GridData(300, 150);
gd.horizontalSpan = 2;
sql_where_clause.setLayoutData(gd);
if (getQuery() != null)
sql_where_clause.setText(getQuery().getAttribute("sql_where"));
if(getQuery()!=null) sql_where_clause.setText(getQuery().getAttribute("sql_where"));
 
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP).applyTo(
query_title);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP).applyTo(table);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP).applyTo(query_title);
Dialog.applyDialogFont(control);
setControl(control);
}
 
 
}