Hi, Friends:
I have following code it imports myEclipse’s packages, but when I tried to write it in myEclipse IDE, it shows red,
import org.eclipse.swt.dnd.*;
// Enable a label as a Drag Source
final Label dragLabel = new Label(shell, SWT.BORDER);
dragLabel.setText("text to be transferred");
// Allow data to be copied or moved from the drag source
int operations = DND.DROP_MOVE | DND.DROP_COPY;
DragSource source = new DragSource(dragLabel, operations);
// Provide data in Text format
Transfer[] types = new Transfer[] {TextTransfer.getInstance()};
source.setTransfer(types);
source.addDragListener(new DragSourceListener() {
public void dragStart(DragSourceEvent event) {
// Only start the drag if there is actually text in the
// label - this text will be what is dropped on the target.
if (dragLabel.getText().length() == 0) {
event.doit = false;
}
}
public void dragSetData(DragSourceEvent event) {
// Provide the data of the requested type.
if (TextTransfer.getInstance().isSupportedType(event.dataType)) {
event.data = dragLabel.getText();
}
}
public void dragFinished(DragSourceEvent event) {
// If a move operation has been performed, remove the data
// from the source
if (event.detail == DND.DROP_MOVE)
dragLabel.setText("");
}
}
});
here
[1]. there is no constructor like DragSource source = new DragSource(dragLabel, operations);
and constructor for:
final Label dragLabel = new Label(shell, SWT.BORDER);
only DragSource source = new DragSource();
and final Label dragLabel = new Label();
why??
where can I get them??
[2]. also, method source.setTransfer(types);
is not available.
how can I get this method when I import this package import org.eclipse.swt.dnd.*; ??
[3]. whole method
source.addDragListener(new DragSourceListener() { …}
is not available, how can I get it??
Thanks a lot
sunny- System Setup ——————————-
Operating System and version:
Eclipse version:
Eclipse build id:
Fresh Eclipse install (y/n):
If not, was it upgraded to its current version using the update manager?
Other installed external plugins:
Number of plugins in the <eclipse>/plugins directory that begin with org.eclipse.pde.*:
MyEclipse version:
Eclipse JDK version:
Application Server JDK version:
Are there any exceptions in the Eclipse log file?
If this is a DB related question please answer the following:
RDBMS vendor and version:
JDBC driver vendor and version, and access type (thin, type-2, etc):
Connection URL:
Eclipse error logs related to com.genuitec.eclipse.sqlexplorer packages:
– Message Body ——————————-