public void dropActionChanged(DropTargetDragEvent event) { } /** * a drag gesture has been initiated * */ public void dragGestureRecognized(DragGestureEvent event) { if (dndAction == false) { /* * HeaderItem[] items = new HeaderItem[selection1.length]; items = * selection1; * HeaderItemDNDManager.getInstance().setHeaderItemList(items); */ if (selection1 == null) { IBasicModelPartial[] items = new IBasicModelPartial[1]; items[0] = (IBasicModelPartial) getSelectedValue(); HeaderItemDNDManager.getInstance().setHeaderItemList(items); } else if (selection1.length != 0) { IBasicModelPartial[] items = new IBasicModelPartial[selection1.length]; items = selection1; HeaderItemDNDManager.getInstance().setHeaderItemList(items); } /* * else { * * HeaderItem[] items = new HeaderItem[1]; items[0] = (HeaderItem) * getSelectedValue(); * HeaderItemDNDManager.getInstance().setHeaderItemList(items); } */ } else { /* * HeaderItem[] items = new HeaderItem[selection2.length]; items = * selection2; * HeaderItemDNDManager.getInstance().setHeaderItemList(items); */ if (selection2.length != 0) { IBasicModelPartial[] items = new IBasicModelPartial[selection2.length]; items = selection2; HeaderItemDNDManager.getInstance().setHeaderItemList(items); } else { IBasicModelPartial[] items = new IBasicModelPartial[1]; items[0] = (IBasicModelPartial) getSelectedValue(); HeaderItemDNDManager.getInstance().setHeaderItemList(items); } } /* * dragSource.startDrag( event, new Cursor(Cursor.DEFAULT_CURSOR), * ImageLoader.getImageIcon("contact_small","Add16").getImage(), new * Point(5, 5), new StringSelection("contact"), this); */ StringSelection text = new StringSelection("contact"); dragSource.startDrag(event, DragSource.DefaultMoveDrop, text, this); clearSelection(); } /** * this message goes to DragSourceListener, informing it that the dragging * has ended * */ public void dragDropEnd(DragSourceDropEvent event) { if (event.getDropSuccess()) { if (acceptDrop == true) { IBasicModelPartial[] items = HeaderItemDNDManager.getInstance() .getHeaderItemList(); for (int i = 0; i < items.length; i++) { ((AddressbookListModel) getModel()).removeElement(items[i]); } // removeElement(); } } } /** * this message goes to DragSourceListener, informing it that the dragging * has entered the DropSite * */ public void dragEnter(DragSourceDragEvent event) { } /** * this message goes to DragSourceListener, informing it that the dragging * has exited the DropSite * */ public void dragExit(DragSourceEvent event) { } /** * this message goes to DragSourceListener, informing it that the dragging * is currently ocurring over the DropSite * */ public void dragOver(DragSourceDragEvent event) { } /** * is invoked when the user changes the dropAction * */ public void dropActionChanged(DragSourceDragEvent event) { } /** * adds elements to itself * */ /** * removes an element from itself */ public void removeElement() { ((AddressbookListModel) getModel()) .removeElement((IBasicModelPartial) getSelectedValue()); } public void valueChanged(ListSelectionEvent e) { if (dndAction == true) { Object[] list = getSelectedValues(); selection1 = new IBasicModelPartial[list.length]; for (int i = 0; i < list.length; i++) { selection1[i] = (IBasicModelPartial) list[i]; } dndAction = false; } else { Object[] list = getSelectedValues(); selection2 = new IBasicModelPartial[list.length]; for (int i = 0; i < list.length; i++) { selection2[i] = (IBasicModelPartial) list[i]; } dndAction = true;
public void dropActionChanged(DropTargetDragEvent event) { } /** * a drag gesture has been initiated * */ public void dragGestureRecognized(DragGestureEvent event) { if (dndAction == false) { /* * HeaderItem[] items = new HeaderItem[selection1.length]; items = * selection1; * HeaderItemDNDManager.getInstance().setHeaderItemList(items); */ if (selection1 == null) { IHeaderItem[] items = new IHeaderItem[1]; items[0] = (IHeaderItem) getSelectedValue(); HeaderItemDNDManager.getInstance().setHeaderItemList(items); } else if (selection1.length != 0) { IHeaderItem[] items = new IHeaderItem[selection1.length]; items = selection1; HeaderItemDNDManager.getInstance().setHeaderItemList(items); } /* * else { * * HeaderItem[] items = new HeaderItem[1]; items[0] = (HeaderItem) * getSelectedValue(); * HeaderItemDNDManager.getInstance().setHeaderItemList(items); } */ } else { /* * HeaderItem[] items = new HeaderItem[selection2.length]; items = * selection2; * HeaderItemDNDManager.getInstance().setHeaderItemList(items); */ if (selection2.length != 0) { IHeaderItem[] items = new IHeaderItem[selection2.length]; items = selection2; HeaderItemDNDManager.getInstance().setHeaderItemList(items); } else { IHeaderItem[] items = new IHeaderItem[1]; items[0] = (IHeaderItem) getSelectedValue(); HeaderItemDNDManager.getInstance().setHeaderItemList(items); } } /* * dragSource.startDrag( event, new Cursor(Cursor.DEFAULT_CURSOR), * ImageLoader.getImageIcon("contact_small","Add16").getImage(), new * Point(5, 5), new StringSelection("contact"), this); */ StringSelection text = new StringSelection("contact"); dragSource.startDrag(event, DragSource.DefaultMoveDrop, text, this); clearSelection(); } /** * this message goes to DragSourceListener, informing it that the dragging * has ended * */ public void dragDropEnd(DragSourceDropEvent event) { if (event.getDropSuccess()) { if (acceptDrop == true) { IHeaderItem[] items = HeaderItemDNDManager.getInstance() .getHeaderItemList(); for (int i = 0; i < items.length; i++) { ((ContactListModel) getModel()).removeElement(items[i]); } // removeElement(); } } } /** * this message goes to DragSourceListener, informing it that the dragging * has entered the DropSite * */ public void dragEnter(DragSourceDragEvent event) { } /** * this message goes to DragSourceListener, informing it that the dragging * has exited the DropSite * */ public void dragExit(DragSourceEvent event) { } /** * this message goes to DragSourceListener, informing it that the dragging * is currently ocurring over the DropSite * */ public void dragOver(DragSourceDragEvent event) { } /** * is invoked when the user changes the dropAction * */ public void dropActionChanged(DragSourceDragEvent event) { } /** * adds elements to itself * */ /** * removes an element from itself */ public void removeElement() { ((ContactListModel) getModel()) .removeElement((IHeaderItem) getSelectedValue()); } public void valueChanged(ListSelectionEvent e) { if (dndAction == true) { Object[] list = getSelectedValues(); selection1 = new IHeaderItem[list.length]; for (int i = 0; i < list.length; i++) { selection1[i] = (IHeaderItem) list[i]; } dndAction = false; } else { Object[] list = getSelectedValues(); selection2 = new IHeaderItem[list.length]; for (int i = 0; i < list.length; i++) { selection2[i] = (IHeaderItem) list[i]; } dndAction = true;
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/contact/src/main/java/org/columba/addressbook/gui/list/AddressbookDNDListView.java File path: /columba-1.4-src/mail/src/main/java/org/columba/mail/gui/contact/list/ContactDNDListView.java
Method name: Method name:
Number of AST nodes: 0 Number of AST nodes: 0
1
public void dropActionChanged(DropTargetDragEvent event) {
1
public void dropActionChanged(DropTargetDragEvent event) {
2
	}
2
	}
3
	/**
3
	/**
4
	 * a drag gesture has been initiated
4
	 * a drag gesture has been initiated
5
	 * 
5
	 * 
6
	 */
6
	 */
7
	public void dragGestureRecognized(DragGestureEvent event) {
7
	public void dragGestureRecognized(DragGestureEvent event) {
8
		if (dndAction == false) {
8
		if (dndAction == false) {
9
			/*
9
			/*
10
			 * HeaderItem[] items = new HeaderItem[selection1.length]; items =
10
			 * HeaderItem[] items = new HeaderItem[selection1.length]; items =
11
			 * selection1;
11
			 * selection1;
12
			 * HeaderItemDNDManager.getInstance().setHeaderItemList(items);
12
			 * HeaderItemDNDManager.getInstance().setHeaderItemList(items);
13
			 */
13
			 */
14
			if (selection1 == null) {
14
			if (selection1 == null) {
15
				IBasicModelPartial[] items = new IBasicModelPartial[1];
15
				IHeaderItem[] items = new IHeaderItem[1];
16
				items[0] = (IBasicModelPartial) getSelectedValue();
16
				items[0] = (IHeaderItem) getSelectedValue();
17
				HeaderItemDNDManager.getInstance().setHeaderItemList(items);
17
				HeaderItemDNDManager.getInstance().setHeaderItemList(items);
18
			} else if (selection1.length != 0) {
18
			} else if (selection1.length != 0) {
19
				IBasicModelPartial[] items = new IBasicModelPartial[selection1.length];
19
				IHeaderItem[] items = new IHeaderItem[selection1.length];
20
				items = selection1;
20
				items = selection1;
21
				HeaderItemDNDManager.getInstance().setHeaderItemList(items);
21
				HeaderItemDNDManager.getInstance().setHeaderItemList(items);
22
			}
22
			}
23
			/*
23
			/*
24
			 * else {
24
			 * else {
25
			 * 
25
			 * 
26
			 * HeaderItem[] items = new HeaderItem[1]; items[0] = (HeaderItem)
26
			 * HeaderItem[] items = new HeaderItem[1]; items[0] = (HeaderItem)
27
			 * getSelectedValue();
27
			 * getSelectedValue();
28
			 * HeaderItemDNDManager.getInstance().setHeaderItemList(items); }
28
			 * HeaderItemDNDManager.getInstance().setHeaderItemList(items); }
29
			 */
29
			 */
30
		} else {
30
		} else {
31
			/*
31
			/*
32
			 * HeaderItem[] items = new HeaderItem[selection2.length]; items =
32
			 * HeaderItem[] items = new HeaderItem[selection2.length]; items =
33
			 * selection2;
33
			 * selection2;
34
			 * HeaderItemDNDManager.getInstance().setHeaderItemList(items);
34
			 * HeaderItemDNDManager.getInstance().setHeaderItemList(items);
35
			 */
35
			 */
36
			if (selection2.length != 0) {
36
			if (selection2.length != 0) {
37
				IBasicModelPartial[] items = new IBasicModelPartial[selection2.length];
37
				IHeaderItem[] items = new IHeaderItem[selection2.length];
38
				items = selection2;
38
				items = selection2;
39
				HeaderItemDNDManager.getInstance().setHeaderItemList(items);
39
				HeaderItemDNDManager.getInstance().setHeaderItemList(items);
40
			} else {
40
			} else {
41
				IBasicModelPartial[] items = new IBasicModelPartial[1];
41
				IHeaderItem[] items = new IHeaderItem[1];
42
				items[0] = (IBasicModelPartial) getSelectedValue();
42
				items[0] = (IHeaderItem) getSelectedValue();
43
				HeaderItemDNDManager.getInstance().setHeaderItemList(items);
43
				HeaderItemDNDManager.getInstance().setHeaderItemList(items);
44
			}
44
			}
45
		}
45
		}
46
		/*
46
		/*
47
		 * dragSource.startDrag( event, new Cursor(Cursor.DEFAULT_CURSOR),
47
		 * dragSource.startDrag( event, new Cursor(Cursor.DEFAULT_CURSOR),
48
		 * ImageLoader.getImageIcon("contact_small","Add16").getImage(), new
48
		 * ImageLoader.getImageIcon("contact_small","Add16").getImage(), new
49
		 * Point(5, 5), new StringSelection("contact"), this);
49
		 * Point(5, 5), new StringSelection("contact"), this);
50
		 */
50
		 */
51
		StringSelection text = new StringSelection("contact");
51
		StringSelection text = new StringSelection("contact");
52
		dragSource.startDrag(event, DragSource.DefaultMoveDrop, text, this);
52
		dragSource.startDrag(event, DragSource.DefaultMoveDrop, text, this);
53
		clearSelection();
53
		clearSelection();
54
	}
54
	}
55
	/**
55
	/**
56
	 * this message goes to DragSourceListener, informing it that the dragging
56
	 * this message goes to DragSourceListener, informing it that the dragging
57
	 * has ended
57
	 * has ended
58
	 * 
58
	 * 
59
	 */
59
	 */
60
	public void dragDropEnd(DragSourceDropEvent event) {
60
	public void dragDropEnd(DragSourceDropEvent event) {
61
		if (event.getDropSuccess()) {
61
		if (event.getDropSuccess()) {
62
			if (acceptDrop == true) {
62
			if (acceptDrop == true) {
63
				IBasicModelPartial[] items = HeaderItemDNDManager.getInstance()
63
				IHeaderItem[] items = HeaderItemDNDManager.getInstance()
64
						.getHeaderItemList();
64
						.getHeaderItemList();
65
				for (int i = 0; i < items.length; i++) {
65
				for (int i = 0; i < items.length; i++) {
66
					((AddressbookListModel) getModel()).removeElement(items[i]);
66
					((ContactListModel) getModel()).removeElement(items[i]);
67
				}
67
				}
68
				// removeElement();
68
				// removeElement();
69
			}
69
			}
70
		}
70
		}
71
	}
71
	}
72
	/**
72
	/**
73
	 * this message goes to DragSourceListener, informing it that the dragging
73
	 * this message goes to DragSourceListener, informing it that the dragging
74
	 * has entered the DropSite
74
	 * has entered the DropSite
75
	 * 
75
	 * 
76
	 */
76
	 */
77
	public void dragEnter(DragSourceDragEvent event) {
77
	public void dragEnter(DragSourceDragEvent event) {
78
	}
78
	}
79
	/**
79
	/**
80
	 * this message goes to DragSourceListener, informing it that the dragging
80
	 * this message goes to DragSourceListener, informing it that the dragging
81
	 * has exited the DropSite
81
	 * has exited the DropSite
82
	 * 
82
	 * 
83
	 */
83
	 */
84
	public void dragExit(DragSourceEvent event) {
84
	public void dragExit(DragSourceEvent event) {
85
	}
85
	}
86
	/**
86
	/**
87
	 * this message goes to DragSourceListener, informing it that the dragging
87
	 * this message goes to DragSourceListener, informing it that the dragging
88
	 * is currently ocurring over the DropSite
88
	 * is currently ocurring over the DropSite
89
	 * 
89
	 * 
90
	 */
90
	 */
91
	public void dragOver(DragSourceDragEvent event) {
91
	public void dragOver(DragSourceDragEvent event) {
92
	}
92
	}
93
	/**
93
	/**
94
	 * is invoked when the user changes the dropAction
94
	 * is invoked when the user changes the dropAction
95
	 * 
95
	 * 
96
	 */
96
	 */
97
	public void dropActionChanged(DragSourceDragEvent event) {
97
	public void dropActionChanged(DragSourceDragEvent event) {
98
	}
98
	}
99
	/**
99
	/**
100
	 * adds elements to itself
100
	 * adds elements to itself
101
	 * 
101
	 * 
102
	 */
102
	 */
103
	/**
103
	/**
104
	 * removes an element from itself
104
	 * removes an element from itself
105
	 */
105
	 */
106
	public void removeElement() {
106
	public void removeElement() {
107
		((AddressbookListModel) getModel())
107
		((ContactListModel) getModel())
108
				.removeElement((IBasicModelPartial) getSelectedValue());
108
				.removeElement((IHeaderItem) getSelectedValue());
109
	}
109
	}
110
	public void valueChanged(ListSelectionEvent e) {
110
	public void valueChanged(ListSelectionEvent e) {
111
		if (dndAction == true) {
111
		if (dndAction == true) {
112
			Object[] list = getSelectedValues();
112
			Object[] list = getSelectedValues();
113
			selection1 = new IBasicModelPartial[list.length];
113
			selection1 = new IHeaderItem[list.length];
114
			for (int i = 0; i < list.length; i++) {
114
			for (int i = 0; i < list.length; i++) {
115
				selection1[i] = (IBasicModelPartial) list[i];
115
				selection1[i] = (IHeaderItem) list[i];
116
			}
116
			}
117
			dndAction = false;
117
			dndAction = false;
118
		} else {
118
		} else {
119
			Object[] list = getSelectedValues();
119
			Object[] list = getSelectedValues();
120
			selection2 = new IBasicModelPartial[list.length];
120
			selection2 = new IHeaderItem[list.length];
121
			for (int i = 0; i < list.length; i++) {
121
			for (int i = 0; i < list.length; i++) {
122
				selection2[i] = (IBasicModelPartial) list[i];
122
				selection2[i] = (IHeaderItem) list[i];
123
			}
123
			}
124
			dndAction = true;
124
			dndAction = true;
Summary
Number of common nesting structure subtrees0
Number of refactorable cases0
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones location
Number of node comparisons0