improved syntax highlighting (php tag/return keyword/brackets and operators)
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.quantum.sql / src / com / quantum / wizards / DeleteRowPage.java
index dc90a00..e259f76 100644 (file)
@@ -1,11 +1,5 @@
 package com.quantum.wizards;
 
-import com.quantum.Messages;
-import com.quantum.adapters.AdapterFactory;
-import com.quantum.adapters.DatabaseAdapter;
-import com.quantum.model.Bookmark;
-import com.quantum.model.Entity;
-
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.ModifyEvent;
 import org.eclipse.swt.events.ModifyListener;
@@ -18,6 +12,12 @@ import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Text;
 
+import com.quantum.Messages;
+import com.quantum.adapters.DatabaseAdapter;
+import com.quantum.model.Bookmark;
+import com.quantum.model.Column;
+import com.quantum.model.Entity;
+
 public class DeleteRowPage extends BaseSQLPage implements SQLPage {
        String[] columnNames;
        Text[] values;
@@ -74,11 +74,8 @@ public class DeleteRowPage extends BaseSQLPage implements SQLPage {
                        whereValues[i] = new Button(container, SWT.CHECK);
                        whereValues[i].setText(Messages.getString("DeleteRowPage.WhereClause")); //$NON-NLS-1$
                        // we check if it's a primary key to select it in the WHERE clause
-                       if (entity != null && entity.getColumn(columnNames[i]).isPrimaryKey()) {
-                whereValues[i].setSelection(true);
-                       } else {
-                               whereValues[i].setSelection(false);
-            }
+                       Column column = getColumn(entity, columnNames[i]);
+            whereValues[i].setSelection(column == null ? false : column.isPrimaryKey());
                        whereValues[i].addSelectionListener(new SelectionListener() {
                                public void widgetDefaultSelected(SelectionEvent e) {
                                }
@@ -107,7 +104,7 @@ public class DeleteRowPage extends BaseSQLPage implements SQLPage {
                StringBuffer whereClause = new StringBuffer();
                Bookmark bookmark = row.getBookmark();
                Entity entity = row.getEntity();
-               DatabaseAdapter adapter = AdapterFactory.getInstance().getAdapter(bookmark.getType());
+               DatabaseAdapter adapter = bookmark.getAdapter();
                
                int numSelected = 0;
                for (int i = 0; i < columnNames.length; i++) {