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; } }
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
void dragGestureRecognized(DragGestureEvent event) {
1
void dragGestureRecognized(DragGestureEvent event) {
2
		if (dndAction == false) {
2
		if (dndAction == false) {
3
			/*
3
			/*
4
			 * HeaderItem[] items = new HeaderItem[selection1.length]; items =
4
			 * HeaderItem[] items = new HeaderItem[selection1.length]; items =
5
			 * selection1;
5
			 * selection1;
6
			 * HeaderItemDNDManager.getInstance().setHeaderItemList(items);
6
			 * HeaderItemDNDManager.getInstance().setHeaderItemList(items);
7
			 */
7
			 */
8
			if (selection1 == null) {
8
			if (selection1 == null) {
9
				IBasicModelPartial[] items = new IBasicModelPartial[1];
9
				IHeaderItem[] items = new IHeaderItem[1];
10
				items[0] = (IBasicModelPartial) getSelectedValue();
10
				items[0] = (IHeaderItem) getSelectedValue();
11
				HeaderItemDNDManager.getInstance().setHeaderItemList(items);
11
				HeaderItemDNDManager.getInstance().setHeaderItemList(items);
12
			} else if (selection1.length != 0) {
12
			} else if (selection1.length != 0) {
13
				IBasicModelPartial[] items = new IBasicModelPartial[selection1.length];
13
				IHeaderItem[] items = new IHeaderItem[selection1.length];
14
				items = selection1;
14
				items = selection1;
15
				HeaderItemDNDManager.getInstance().setHeaderItemList(items);
15
				HeaderItemDNDManager.getInstance().setHeaderItemList(items);
16
			}
16
			}
17
			/*
17
			/*
18
			 * else {
18
			 * else {
19
			 * 
19
			 * 
20
			 * HeaderItem[] items = new HeaderItem[1]; items[0] = (HeaderItem)
20
			 * HeaderItem[] items = new HeaderItem[1]; items[0] = (HeaderItem)
21
			 * getSelectedValue();
21
			 * getSelectedValue();
22
			 * HeaderItemDNDManager.getInstance().setHeaderItemList(items); }
22
			 * HeaderItemDNDManager.getInstance().setHeaderItemList(items); }
23
			 */
23
			 */
24
		} else {
24
		} else {
25
			/*
25
			/*
26
			 * HeaderItem[] items = new HeaderItem[selection2.length]; items =
26
			 * HeaderItem[] items = new HeaderItem[selection2.length]; items =
27
			 * selection2;
27
			 * selection2;
28
			 * HeaderItemDNDManager.getInstance().setHeaderItemList(items);
28
			 * HeaderItemDNDManager.getInstance().setHeaderItemList(items);
29
			 */
29
			 */
30
			if (selection2.length != 0) {
30
			if (selection2.length != 0) {
31
				IBasicModelPartial[] items = new IBasicModelPartial[selection2.length];
31
				IHeaderItem[] items = new IHeaderItem[selection2.length];
32
				items = selection2;
32
				items = selection2;
33
				HeaderItemDNDManager.getInstance().setHeaderItemList(items);
33
				HeaderItemDNDManager.getInstance().setHeaderItemList(items);
34
			} else {
34
			} else {
35
				IBasicModelPartial[] items = new IBasicModelPartial[1];
35
				IHeaderItem[] items = new IHeaderItem[1];
36
				items[0] = (IBasicModelPartial) getSelectedValue();
36
				items[0] = (IHeaderItem) getSelectedValue();
37
				HeaderItemDNDManager.getInstance().setHeaderItemList(items);
37
				HeaderItemDNDManager.getInstance().setHeaderItemList(items);
38
			}
38
			}
39
		}
39
		}
40
		/*
40
		/*
41
		 * dragSource.startDrag( event, new Cursor(Cursor.DEFAULT_CURSOR),
41
		 * dragSource.startDrag( event, new Cursor(Cursor.DEFAULT_CURSOR),
42
		 * ImageLoader.getImageIcon("contact_small","Add16").getImage(), new
42
		 * ImageLoader.getImageIcon("contact_small","Add16").getImage(), new
43
		 * Point(5, 5), new StringSelection("contact"), this);
43
		 * Point(5, 5), new StringSelection("contact"), this);
44
		 */
44
		 */
45
		StringSelection text = new StringSelection("contact");
45
		StringSelection text = new StringSelection("contact");
46
		dragSource.startDrag(event, DragSource.DefaultMoveDrop, text, this);
46
		dragSource.startDrag(event, DragSource.DefaultMoveDrop, text, this);
47
		clearSelection();
47
		clearSelection();
48
	}
48
	}
49
	/**
49
	/**
50
	 * this message goes to DragSourceListener, informing it that the dragging
50
	 * this message goes to DragSourceListener, informing it that the dragging
51
	 * has ended
51
	 * has ended
52
	 * 
52
	 * 
53
	 */
53
	 */
54
	public void dragDropEnd(DragSourceDropEvent event) {
54
	public void dragDropEnd(DragSourceDropEvent event) {
55
		if (event.getDropSuccess()) {
55
		if (event.getDropSuccess()) {
56
			if (acceptDrop == true) {
56
			if (acceptDrop == true) {
57
				IBasicModelPartial[] items = HeaderItemDNDManager.getInstance()
57
				IHeaderItem[] items = HeaderItemDNDManager.getInstance()
58
						.getHeaderItemList();
58
						.getHeaderItemList();
59
				for (int i = 0; i < items.length; i++) {
59
				for (int i = 0; i < items.length; i++) {
60
					((AddressbookListModel) getModel()).removeElement(items[i]);
60
					((ContactListModel) getModel()).removeElement(items[i]);
61
				}
61
				}
62
				// removeElement();
62
				// removeElement();
63
			}
63
			}
64
		}
64
		}
65
	}
65
	}
66
	/**
66
	/**
67
	 * this message goes to DragSourceListener, informing it that the dragging
67
	 * this message goes to DragSourceListener, informing it that the dragging
68
	 * has entered the DropSite
68
	 * has entered the DropSite
69
	 * 
69
	 * 
70
	 */
70
	 */
71
	public void dragEnter(DragSourceDragEvent event) {
71
	public void dragEnter(DragSourceDragEvent event) {
72
	}
72
	}
73
	/**
73
	/**
74
	 * this message goes to DragSourceListener, informing it that the dragging
74
	 * this message goes to DragSourceListener, informing it that the dragging
75
	 * has exited the DropSite
75
	 * has exited the DropSite
76
	 * 
76
	 * 
77
	 */
77
	 */
78
	public void dragExit(DragSourceEvent event) {
78
	public void dragExit(DragSourceEvent event) {
79
	}
79
	}
80
	/**
80
	/**
81
	 * this message goes to DragSourceListener, informing it that the dragging
81
	 * this message goes to DragSourceListener, informing it that the dragging
82
	 * is currently ocurring over the DropSite
82
	 * is currently ocurring over the DropSite
83
	 * 
83
	 * 
84
	 */
84
	 */
85
	public void dragOver(DragSourceDragEvent event) {
85
	public void dragOver(DragSourceDragEvent event) {
86
	}
86
	}
87
	/**
87
	/**
88
	 * is invoked when the user changes the dropAction
88
	 * is invoked when the user changes the dropAction
89
	 * 
89
	 * 
90
	 */
90
	 */
91
	public void dropActionChanged(DragSourceDragEvent event) {
91
	public void dropActionChanged(DragSourceDragEvent event) {
92
	}
92
	}
93
	/**
93
	/**
94
	 * adds elements to itself
94
	 * adds elements to itself
95
	 * 
95
	 * 
96
	 */
96
	 */
97
	/**
97
	/**
98
	 * removes an element from itself
98
	 * removes an element from itself
99
	 */
99
	 */
100
	public void removeElement() {
100
	public void removeElement() {
101
		((AddressbookListModel) getModel())
101
		((ContactListModel) getModel())
102
				.removeElement((IBasicModelPartial) getSelectedValue());
102
				.removeElement((IHeaderItem) getSelectedValue());
103
	}
103
	}
104
	public void valueChanged(ListSelectionEvent e) {
104
	public void valueChanged(ListSelectionEvent e) {
105
		if (dndAction == true) {
105
		if (dndAction == true) {
106
			Object[] list = getSelectedValues();
106
			Object[] list = getSelectedValues();
107
			selection1 = new IBasicModelPartial[list.length];
107
			selection1 = new IHeaderItem[list.length];
108
			for (int i = 0; i < list.length; i++) {
108
			for (int i = 0; i < list.length; i++) {
109
				selection1[i] = (IBasicModelPartial) list[i];
109
				selection1[i] = (IHeaderItem) list[i];
110
			}
110
			}
111
			dndAction = false;
111
			dndAction = false;
112
		} else {
112
		} else {
113
			Object[] list = getSelectedValues();
113
			Object[] list = getSelectedValues();
114
			selection2 = new IBasicModelPartial[list.length];
114
			selection2 = new IHeaderItem[list.length];
115
			for (int i = 0; i < list.length; i++) {
115
			for (int i = 0; i < list.length; i++) {
116
				selection2[i] = (IBasicModelPartial) list[i];
116
				selection2[i] = (IHeaderItem) list[i];
117
			}
117
			}
118
			dndAction = true;
118
			dndAction = true;
119
		}
119
		}
120
	}
120
	}
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