package org.reldb.dbrowser.ui.content.rel.query;

import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.custom.CTabItem;
import org.reldb.dbrowser.ui.content.rel.DbTreeAction;
import org.reldb.dbrowser.ui.content.rel.DbTreeItem;
import org.reldb.dbrowser.ui.content.rel.RelPanel;
import org.reldb.dbrowser.ui.content.rev.DatabaseAbstractionLayer;

public class QueryDropper extends DbTreeAction {

	public QueryDropper(RelPanel relPanel) {
		super(relPanel);
	}

	@Override
	public void go(DbTreeItem item) {
		CTabItem tab = relPanel.getTab(item.getTabName());
		if (tab != null) {
			relPanel.getTabFolder().setSelection(tab);
			MessageDialog.openInformation(relPanel.getShell(), "Note", "You must close the '" + item.getTabName() + "' tab first.");
		} else {
			if (!MessageDialog.openConfirm(relPanel.getShell(), "Confirm DROP", "Are you sure you wish to drop " + item.getName() + "?"))
				return;
			DatabaseAbstractionLayer dal = new DatabaseAbstractionLayer(relPanel.getConnection());
			if (!dal.modelDelete(item.getName()))
				MessageDialog.openError(relPanel.getShell(), "Error", "Unable to delete query " + item.getName() + ". Check the system log for details.");
			else
				relPanel.redisplayed();
		}
	}

}

@@ -876,16 +876,22 @@
 to drop 
+query 
 %22 + item

Improve prompt.