*/
package com.quantum.actions;
+import java.sql.SQLException;
import java.util.Iterator;
+import com.quantum.Messages;
import com.quantum.QuantumPlugin;
import com.quantum.model.Column;
import com.quantum.model.EntityHolder;
+import com.quantum.model.NotConnectedException;
import com.quantum.util.NthLevelConverter;
import com.quantum.util.QuantumUtil;
import com.quantum.util.StringUtil;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.swt.dnd.TextTransfer;
import org.eclipse.swt.dnd.Transfer;
-import org.eclipse.ui.IViewPart;
import org.eclipse.ui.actions.SelectionListenerAction;
public class CustomCopyAction extends SelectionListenerAction {
- private final IViewPart view;
private final int ind;
- /**
- * @param BookmarkView
- */
- public CustomCopyAction(IViewPart view, int ind) {
- super(null);
- this.view = view;
+ public CustomCopyAction( int ind ) {
+ super(Messages.getString(CustomCopyAction.class.getName() + ".text"));
this.ind = ind;
}
public void run() {
String copyText = "";
- Iterator iter = getSelectedNonResources().iterator();
+ Iterator iter = getSelectedNonResources().iterator();
NthLevelConverter converter = new NthLevelConverter();
// Fill up the converter. We iterate the selection items
while (iter.hasNext()) {
ColumnNode column = (ColumnNode) current;
if (column != null) {
converter.add(column.getColumn().getName(),
- column.getColumn().getParentEntity().getCondQualifiedName(), 0);
+ column.getColumn().getParentEntity().getQualifiedName(), 0);
}
} else if (current instanceof EntityHolder) {
EntityHolder currentSelec = (EntityHolder) current;
- converter.add(currentSelec.getEntity().getCondQualifiedName(), null, 1);
- Column[] columns = currentSelec.getEntity().getColumns();
- for (int i = 0, length = (columns == null) ? 0 : columns.length;
- i < length;
- i++) {
- converter.add(columns[i].getName(),
- currentSelec.getEntity().getCondQualifiedName(), 0);
- }
+ converter.add(currentSelec.getEntity().getQualifiedName(), null, 1);
+ try {
+ Column[] columns = currentSelec.getEntity().getColumns();
+ for (int i = 0, length = (columns == null) ? 0 : columns.length;
+ i < length;
+ i++) {
+ converter.add(columns[i].getName(),
+ currentSelec.getEntity().getQualifiedName(), 0);
+ }
+ } catch (NotConnectedException e) {
+ } catch (SQLException e) {
+ }
}
}
IPreferenceStore store = QuantumPlugin.getDefault().getPreferenceStore();
new Object[] { copyText },
new Transfer[] { TextTransfer.getInstance()});
}
+
}