Lines 1-5
Link Here
|
1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
2 |
* Copyright (c) 2000, 2007 IBM Corporation and others. |
2 |
* Copyright (c) 2000, 2009 IBM Corporation and others. |
3 |
* All rights reserved. This program and the accompanying materials |
3 |
* All rights reserved. This program and the accompanying materials |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
Lines 80-115
Link Here
|
80 |
return; |
80 |
return; |
81 |
Object[] elements = selection.toArray(); |
81 |
Object[] elements = selection.toArray(); |
82 |
IResource resources[] = Utils.getResources(elements); |
82 |
IResource resources[] = Utils.getResources(elements); |
83 |
if(resources.length == 0 && openInCompareAction != null) { |
83 |
if (resources.length == 0) { |
84 |
// We can still show the compare editor open if the element has a compare input |
84 |
if (openInCompareAction != null) { |
85 |
if (elements.length > 0) { |
85 |
// We can still show the compare editor open if the element has |
86 |
ISynchronizeParticipant participant = getParticipant(); |
86 |
// a compare input |
87 |
if (participant instanceof ModelSynchronizeParticipant) { |
87 |
if (elements.length > 0) { |
88 |
ModelSynchronizeParticipant msp = (ModelSynchronizeParticipant) participant; |
88 |
ISynchronizeParticipant participant = getParticipant(); |
89 |
boolean allElementsHaveCompareInput = true; |
89 |
if (participant instanceof ModelSynchronizeParticipant) { |
90 |
for (int i = 0; i < elements.length; i++) { |
90 |
ModelSynchronizeParticipant msp = (ModelSynchronizeParticipant) participant; |
91 |
if (!msp.hasCompareInputFor(elements[i])) { |
91 |
boolean allElementsHaveCompareInput = true; |
92 |
allElementsHaveCompareInput = false; |
92 |
for (int i = 0; i < elements.length; i++) { |
93 |
break; |
93 |
if (!msp.hasCompareInputFor(elements[i])) { |
|
|
94 |
allElementsHaveCompareInput = false; |
95 |
break; |
96 |
} |
97 |
} |
98 |
if (allElementsHaveCompareInput) { |
99 |
menu.appendToGroup(groupId, openInCompareAction); |
94 |
} |
100 |
} |
95 |
} |
101 |
} |
96 |
if (allElementsHaveCompareInput) { |
|
|
97 |
menu.appendToGroup(groupId, openInCompareAction); |
98 |
} |
99 |
} |
102 |
} |
100 |
} |
103 |
} |
101 |
return; |
104 |
return; |
|
|
105 |
} |
106 |
|
107 |
if (elements.length != resources.length){ |
108 |
// Only supported if all the items are resources. |
109 |
return; |
102 |
} |
110 |
} |
103 |
|
111 |
|
104 |
for (int i = 0; i < resources.length; i++) { |
112 |
for (int i = 0; i < resources.length; i++) { |
105 |
if (resources[i].getType() != IResource.FILE) { |
113 |
if (resources[i].getType() != IResource.FILE) { |
106 |
// Only supported if all the items are files. |
114 |
// Only supported if all the items are files. |
107 |
return; |
115 |
return; |
108 |
} |
116 |
} |
109 |
} |
117 |
} |
110 |
|
118 |
|
111 |
if (resources.length > 0 && openInCompareAction != null) { |
119 |
if (openInCompareAction != null) { |
112 |
// Support multiple files selected |
|
|
113 |
menu.appendToGroup(groupId, openInCompareAction); |
120 |
menu.appendToGroup(groupId, openInCompareAction); |
114 |
} |
121 |
} |
115 |
|
122 |
|
Lines 120-129
Link Here
|
120 |
} |
127 |
} |
121 |
} |
128 |
} |
122 |
|
129 |
|
123 |
if (openFileAction != null) { |
130 |
if (openFileAction != null) { |
124 |
openFileAction.selectionChanged(selection); |
131 |
openFileAction.selectionChanged(selection); |
125 |
menu.appendToGroup(groupId, openFileAction); |
132 |
menu.appendToGroup(groupId, openFileAction); |
126 |
} |
133 |
} |
127 |
|
134 |
|
128 |
if (resources.length == 1) { |
135 |
if (resources.length == 1) { |
129 |
// Only support the "Open With..." submenu if exactly one file is selected. |
136 |
// Only support the "Open With..." submenu if exactly one file is selected. |