Lines 10-25
Link Here
|
10 |
*******************************************************************************/ |
10 |
*******************************************************************************/ |
11 |
package org.eclipse.compare.internal; |
11 |
package org.eclipse.compare.internal; |
12 |
|
12 |
|
|
|
13 |
import java.io.ByteArrayInputStream; |
14 |
import java.io.FileOutputStream; |
15 |
import java.io.IOException; |
16 |
import java.io.InputStream; |
17 |
|
13 |
import org.eclipse.compare.CompareConfiguration; |
18 |
import org.eclipse.compare.CompareConfiguration; |
|
|
19 |
import org.eclipse.compare.CompareUI; |
20 |
import org.eclipse.core.resources.IFile; |
21 |
import org.eclipse.core.resources.IFolder; |
22 |
import org.eclipse.core.resources.IProject; |
23 |
import org.eclipse.core.resources.IProjectDescription; |
14 |
import org.eclipse.core.resources.IResource; |
24 |
import org.eclipse.core.resources.IResource; |
15 |
import org.eclipse.core.resources.IWorkspaceRoot; |
25 |
import org.eclipse.core.resources.IWorkspaceRoot; |
16 |
import org.eclipse.core.resources.ResourcesPlugin; |
26 |
import org.eclipse.core.resources.ResourcesPlugin; |
|
|
27 |
import org.eclipse.core.runtime.CoreException; |
28 |
import org.eclipse.core.runtime.IPath; |
17 |
import org.eclipse.jface.dialogs.IDialogConstants; |
29 |
import org.eclipse.jface.dialogs.IDialogConstants; |
18 |
import org.eclipse.jface.dialogs.IMessageProvider; |
30 |
import org.eclipse.jface.dialogs.IMessageProvider; |
|
|
31 |
import org.eclipse.jface.dialogs.MessageDialog; |
19 |
import org.eclipse.jface.dialogs.TitleAreaDialog; |
32 |
import org.eclipse.jface.dialogs.TitleAreaDialog; |
|
|
33 |
import org.eclipse.jface.text.Document; |
34 |
import org.eclipse.jface.text.IDocument; |
35 |
import org.eclipse.jface.text.source.SourceViewer; |
20 |
import org.eclipse.jface.viewers.ISelection; |
36 |
import org.eclipse.jface.viewers.ISelection; |
21 |
import org.eclipse.jface.viewers.StructuredSelection; |
37 |
import org.eclipse.jface.viewers.StructuredSelection; |
22 |
import org.eclipse.swt.SWT; |
38 |
import org.eclipse.swt.SWT; |
|
|
39 |
import org.eclipse.swt.dnd.Clipboard; |
23 |
import org.eclipse.swt.dnd.DND; |
40 |
import org.eclipse.swt.dnd.DND; |
24 |
import org.eclipse.swt.dnd.DragSource; |
41 |
import org.eclipse.swt.dnd.DragSource; |
25 |
import org.eclipse.swt.dnd.DragSourceEvent; |
42 |
import org.eclipse.swt.dnd.DragSourceEvent; |
Lines 38-43
Link Here
|
38 |
import org.eclipse.swt.widgets.Button; |
55 |
import org.eclipse.swt.widgets.Button; |
39 |
import org.eclipse.swt.widgets.Composite; |
56 |
import org.eclipse.swt.widgets.Composite; |
40 |
import org.eclipse.swt.widgets.Control; |
57 |
import org.eclipse.swt.widgets.Control; |
|
|
58 |
import org.eclipse.swt.widgets.Display; |
41 |
import org.eclipse.swt.widgets.Group; |
59 |
import org.eclipse.swt.widgets.Group; |
42 |
import org.eclipse.swt.widgets.Label; |
60 |
import org.eclipse.swt.widgets.Label; |
43 |
import org.eclipse.swt.widgets.Shell; |
61 |
import org.eclipse.swt.widgets.Shell; |
Lines 49-55
Link Here
|
49 |
|
67 |
|
50 |
/** |
68 |
/** |
51 |
* This is a dialog that can invoke the compare editor on chosen files. |
69 |
* This is a dialog that can invoke the compare editor on chosen files. |
52 |
* |
70 |
* |
53 |
* @since 3.4 |
71 |
* @since 3.4 |
54 |
*/ |
72 |
*/ |
55 |
public class CompareWithOtherResourceDialog extends TitleAreaDialog { |
73 |
public class CompareWithOtherResourceDialog extends TitleAreaDialog { |
Lines 57-62
Link Here
|
57 |
private int CLEAR_RETURN_CODE = 150; // any number != 0 |
75 |
private int CLEAR_RETURN_CODE = 150; // any number != 0 |
58 |
private int MIN_WIDTH = 300; |
76 |
private int MIN_WIDTH = 300; |
59 |
private int MIN_HEIGHT = 175; |
77 |
private int MIN_HEIGHT = 175; |
|
|
78 |
private int clipboardCounter = 0; |
79 |
public final static String TMP_PROJECT_NAME = ".org.eclipse.compare.tmp"; //$NON-NLS-1$ |
80 |
private final static String TMP_PROJECT_FILE = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" //$NON-NLS-1$ |
81 |
+ "<projectDescription>\n" //$NON-NLS-1$ |
82 |
+ "\t<name>" + TMP_PROJECT_NAME + "\t</name>\n" //$NON-NLS-1$ //$NON-NLS-2$ |
83 |
+ "\t<comment></comment>\n" //$NON-NLS-1$ |
84 |
+ "\t<projects>\n" //$NON-NLS-1$ |
85 |
+ "\t</projects>\n" //$NON-NLS-1$ |
86 |
+ "\t<buildSpec>\n" //$NON-NLS-1$ |
87 |
+ "\t</buildSpec>\n" //$NON-NLS-1$ |
88 |
+ "\t<natures>\n" + "\t</natures>\n" //$NON-NLS-1$//$NON-NLS-2$ |
89 |
+ "</projectDescription>"; //$NON-NLS-1$ |
60 |
|
90 |
|
61 |
private class FileTextDragListener implements DragSourceListener { |
91 |
private class FileTextDragListener implements DragSourceListener { |
62 |
|
92 |
|
Lines 156-166
Link Here
|
156 |
|
186 |
|
157 |
} |
187 |
} |
158 |
|
188 |
|
|
|
189 |
private class ClipboardDropListener implements DropTargetListener { |
190 |
|
191 |
ClipboardAbstractSection clipboardSection; |
192 |
|
193 |
public ClipboardDropListener(ClipboardAbstractSection clipboardSection) { |
194 |
this.clipboardSection = clipboardSection; |
195 |
} |
196 |
|
197 |
public void dragEnter(DropTargetEvent event) { |
198 |
if (event.detail == DND.DROP_DEFAULT) { |
199 |
if ((event.operations & DND.DROP_COPY) != 0) |
200 |
event.detail = DND.DROP_COPY; |
201 |
else |
202 |
event.detail = DND.DROP_NONE; |
203 |
} |
204 |
|
205 |
for (int i = 0; i < event.dataTypes.length; i++) { |
206 |
if (TextTransfer.getInstance().isSupportedType(event.dataTypes[i])) { |
207 |
event.currentDataType = event.dataTypes[i]; |
208 |
if (event.detail != DND.DROP_COPY) |
209 |
event.detail = DND.DROP_NONE; |
210 |
break; |
211 |
} |
212 |
} |
213 |
} |
214 |
|
215 |
public void dragLeave(DropTargetEvent event) { |
216 |
clipboardSection.clipboardExpandable.setExpanded(true); |
217 |
getShell().pack(); |
218 |
} |
219 |
|
220 |
public void dragOperationChanged(DropTargetEvent event) { |
221 |
// intentionally empty |
222 |
} |
223 |
|
224 |
public void dragOver(DropTargetEvent event) { |
225 |
clipboardSection.clipboardExpandable.setExpanded(true); |
226 |
getShell().pack(); |
227 |
} |
228 |
|
229 |
public void drop(DropTargetEvent event) { |
230 |
if (TextTransfer.getInstance().isSupportedType(event.currentDataType)) { |
231 |
String txt = (String) event.data; |
232 |
clipboardSection.viewer.setDocument(new Document(txt)); |
233 |
clipboardSection.getPanel().clearResource(); |
234 |
clipboardSection.updateErrorInfoForClipboard(); |
235 |
} |
236 |
} |
237 |
|
238 |
public void dropAccept(DropTargetEvent event) { |
239 |
// intentionally empty |
240 |
} |
241 |
|
242 |
} |
243 |
|
244 |
private abstract class ClipboardAbstractSection { |
245 |
|
246 |
protected ExpandableComposite clipboardExpandable; |
247 |
protected SourceViewer viewer; |
248 |
protected Button createButton; |
249 |
private InternalSection section; |
250 |
|
251 |
public ClipboardAbstractSection(InternalSection section) { |
252 |
this.section = section; |
253 |
} |
254 |
|
255 |
protected void createClipboardSection(Composite parent) { |
256 |
final Composite p = parent; |
257 |
clipboardExpandable = new ExpandableComposite(parent, SWT.NONE, |
258 |
ExpandableComposite.TWISTIE); |
259 |
clipboardExpandable |
260 |
.setText(CompareMessages.CompareWithOther_clipboardSection); |
261 |
Composite content = createContentsForClipboardSection(clipboardExpandable); |
262 |
clipboardExpandable.setClient(content); |
263 |
clipboardExpandable.addExpansionListener(new ExpansionAdapter() { |
264 |
public void expansionStateChanged(ExpansionEvent e) { |
265 |
p.layout(); |
266 |
getShell().pack(); |
267 |
if (e.getState()) { |
268 |
section.fileText.setEnabled(false); |
269 |
if (!section.resourceFromClipboard) |
270 |
section.clearResourceWithoutPath(); // clearResource() causes clearing contents of fileText |
271 |
} else { |
272 |
section.fileText.setEnabled(true); |
273 |
if (section.fileText.getText() != "") //$NON-NLS-1$ |
274 |
section.setResource(section.fileText.getText()); |
275 |
} |
276 |
updateErrorInfoForClipboard(); |
277 |
} |
278 |
}); |
279 |
|
280 |
GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true); |
281 |
gd.horizontalSpan = 2; |
282 |
clipboardExpandable.setLayoutData(gd); |
283 |
|
284 |
initDropForClipboard(); |
285 |
} |
286 |
|
287 |
private void initDropForClipboard() { |
288 |
DropTarget clipboardTarget = new DropTarget(clipboardExpandable, DND.DROP_COPY | DND.DROP_DEFAULT); |
289 |
Transfer[] types = new Transfer[] {TextTransfer.getInstance()}; |
290 |
clipboardTarget.setTransfer(types); |
291 |
clipboardTarget.addDropListener(new ClipboardDropListener(this)); |
292 |
} |
293 |
|
294 |
private Composite createContentsForClipboardSection(Composite parent) { |
295 |
|
296 |
Composite contents = new Composite(parent, SWT.NONE); |
297 |
contents.setLayout(new GridLayout(1, false)); |
298 |
|
299 |
viewer = new SourceViewer(contents, null, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL); |
300 |
viewer.setEditable(false); |
301 |
String content = (String) clipboard.getContents(TextTransfer.getInstance()); |
302 |
IDocument document = new Document(content); |
303 |
viewer.setDocument(document); |
304 |
|
305 |
GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true); |
306 |
gd.horizontalSpan = 2; |
307 |
gd.widthHint = 200; |
308 |
gd.heightHint = 150; |
309 |
viewer.getTextWidget().setLayoutData(gd); |
310 |
|
311 |
viewer.getTextWidget().addModifyListener(new ModifyListener() { |
312 |
public void modifyText(ModifyEvent e) { |
313 |
String txt = (String) clipboard.getContents(TextTransfer.getInstance()); |
314 |
viewer.setDocument(new Document(txt)); |
315 |
updateErrorInfoForClipboard(); |
316 |
} |
317 |
}); |
318 |
|
319 |
createButton = createButton(contents, CLEAR_RETURN_CODE, |
320 |
CompareMessages.CompareWithOther_clipboardButton, false); |
321 |
createButton.addSelectionListener(new SelectionListener() { |
322 |
public void widgetDefaultSelected(SelectionEvent e) { |
323 |
widgetSelected(e); |
324 |
} |
325 |
public void widgetSelected(SelectionEvent e) { |
326 |
section.setResourceFromClipboard(createTmpFile(viewer.getDocument().get())); |
327 |
updateErrorInfoForClipboard(); |
328 |
} |
329 |
}); |
330 |
|
331 |
return contents; |
332 |
} |
333 |
|
334 |
private IFile createTmpFile(String fileContent) { |
335 |
IFile file = null; |
336 |
try { |
337 |
IProject project = createTmpProject(); |
338 |
if (!project.isOpen()) |
339 |
project.open(null); |
340 |
IFolder folder = project.getFolder("ClipboardFolder"); //$NON-NLS-1$ |
341 |
if (!folder.exists()) |
342 |
folder.create(IResource.NONE, true, null); |
343 |
file = folder.getFile(CompareMessages.CompareWithOther_fileName |
344 |
+ clipboardCounter++); |
345 |
if (!file.exists()) { |
346 |
InputStream source = new ByteArrayInputStream(fileContent |
347 |
.getBytes()); |
348 |
file.create(source, IResource.NONE, null); |
349 |
} |
350 |
} catch (CoreException e) { |
351 |
CompareUIPlugin.log(e); |
352 |
MessageDialog.openError(getShell(), |
353 |
CompareMessages.CompareWithOther_createTmpFile_title, |
354 |
CompareMessages.CompareWithOther_createTmpFile_message); |
355 |
return file; |
356 |
} |
357 |
return file; |
358 |
} |
359 |
|
360 |
private IProject createTmpProject() throws CoreException { |
361 |
IProject tmpProject = getTmpProject(); |
362 |
if (!tmpProject.isAccessible()) { |
363 |
try { |
364 |
if (!tmpProject.exists()) { |
365 |
IProjectDescription desc = tmpProject.getWorkspace().newProjectDescription(tmpProject.getName()); |
366 |
IPath location = CompareUI.getPlugin().getStateLocation(); |
367 |
desc.setLocation(location.append(TMP_PROJECT_NAME)); |
368 |
tmpProject.create(desc, null); |
369 |
} |
370 |
try { |
371 |
tmpProject.open(null); |
372 |
} catch (CoreException e1) { // in case .project file or folder has been deleted |
373 |
IPath location1 = CompareUI.getPlugin().getStateLocation(); |
374 |
IPath projectPath1 = location1.append(TMP_PROJECT_NAME); |
375 |
projectPath1.toFile().mkdirs(); |
376 |
FileOutputStream output = new FileOutputStream( |
377 |
projectPath1.append(".project").toOSString()); //$NON-NLS-1$ |
378 |
try { |
379 |
output.write(TMP_PROJECT_FILE.getBytes()); |
380 |
} finally { |
381 |
output.close(); |
382 |
} |
383 |
tmpProject.open(null); |
384 |
} |
385 |
} catch (IOException ioe) { |
386 |
return tmpProject; |
387 |
} catch (CoreException ce) { |
388 |
throw new CoreException(ce.getStatus()); |
389 |
} |
390 |
} |
391 |
return tmpProject; |
392 |
} |
393 |
|
394 |
private IProject getTmpProject() { |
395 |
return ResourcesPlugin.getWorkspace().getRoot().getProject( |
396 |
TMP_PROJECT_NAME); |
397 |
} |
398 |
|
399 |
protected abstract void updateErrorInfoForClipboard(); |
400 |
|
401 |
protected boolean clipboardSectionExpanded() { |
402 |
return clipboardExpandable.isExpanded(); |
403 |
} |
404 |
|
405 |
protected boolean noResource() { |
406 |
return section.getResource() == null; |
407 |
} |
408 |
|
409 |
public InternalSection getPanel() { |
410 |
return section; |
411 |
} |
412 |
|
413 |
} |
414 |
|
415 |
private class ClipboardSection extends ClipboardAbstractSection { |
416 |
|
417 |
public ClipboardSection(InternalSection section) { |
418 |
super(section); |
419 |
} |
420 |
|
421 |
protected void updateErrorInfoForClipboard() { |
422 |
if (clipboardSectionExpanded() && noResource()) { |
423 |
setMessage(CompareMessages.CompareWithOther_noClipboardFile, IMessageProvider.ERROR); |
424 |
createButton.setEnabled(true); |
425 |
} else { |
426 |
updateErrorInfo(); |
427 |
createButton.setEnabled(false); |
428 |
} |
429 |
} |
430 |
} |
431 |
|
432 |
|
433 |
private class ClipboardAncestorSection extends ClipboardAbstractSection { |
434 |
|
435 |
public ClipboardAncestorSection(InternalSection section) { |
436 |
super(section); |
437 |
} |
438 |
|
439 |
protected void updateErrorInfoForClipboard() { |
440 |
if (clipboardSectionExpanded() && noResource()) { |
441 |
setMessage(CompareMessages.CompareWithOther_noClipboardFile_ancestor, IMessageProvider.WARNING); |
442 |
createButton.setEnabled(true); |
443 |
} else { |
444 |
updateErrorInfo(); |
445 |
createButton.setEnabled(false); |
446 |
} |
447 |
} |
448 |
} |
449 |
|
450 |
|
159 |
private abstract class InternalSection { |
451 |
private abstract class InternalSection { |
160 |
|
452 |
|
161 |
protected Group group; |
453 |
protected Group group; |
162 |
protected Text fileText; |
454 |
protected Text fileText; |
163 |
private IResource resource; |
455 |
private IResource resource; |
|
|
456 |
private boolean resourceFromClipboard = false; |
164 |
|
457 |
|
165 |
public InternalSection(Composite parent) { |
458 |
public InternalSection(Composite parent) { |
166 |
createContents(parent); |
459 |
createContents(parent); |
Lines 172-179
Link Here
|
172 |
|
465 |
|
173 |
public void createContents(Composite parent) { |
466 |
public void createContents(Composite parent) { |
174 |
createGroup(parent); |
467 |
createGroup(parent); |
175 |
createFileLabel(); |
|
|
176 |
createFileCombo(); |
177 |
initDrag(); |
468 |
initDrag(); |
178 |
initDrop(); |
469 |
initDrop(); |
179 |
} |
470 |
} |
Lines 183-201
Link Here
|
183 |
} |
474 |
} |
184 |
|
475 |
|
185 |
public void setResource(IResource resource) { |
476 |
public void setResource(IResource resource) { |
|
|
477 |
resourceFromClipboard = false; |
186 |
this.resource = resource; |
478 |
this.resource = resource; |
187 |
String txt = resource.getFullPath().toString(); |
479 |
String txt = resource.getFullPath().toString(); |
188 |
fileText.setText(txt); |
480 |
fileText.setText(txt); |
189 |
} |
481 |
} |
190 |
|
482 |
|
191 |
public void setResource(String s) { |
483 |
public void setResource(String s) { |
|
|
484 |
resourceFromClipboard = false; |
192 |
IResource tmp = ResourcesPlugin.getWorkspace().getRoot() |
485 |
IResource tmp = ResourcesPlugin.getWorkspace().getRoot() |
193 |
.findMember(s); |
486 |
.findMember(s); |
194 |
if (tmp instanceof IWorkspaceRoot) |
487 |
if (tmp instanceof IWorkspaceRoot) |
195 |
resource = null; |
488 |
resource = null; |
196 |
else |
489 |
else |
197 |
resource = tmp; |
490 |
resource = tmp; |
|
|
491 |
} |
198 |
|
492 |
|
|
|
493 |
public void setResourceFromClipboard(IResource resource) { |
494 |
resourceFromClipboard = true; |
495 |
this.resource = resource; |
199 |
} |
496 |
} |
200 |
|
497 |
|
201 |
protected void clearResource() { |
498 |
protected void clearResource() { |
Lines 204-209
Link Here
|
204 |
updateErrorInfo(); |
501 |
updateErrorInfo(); |
205 |
} |
502 |
} |
206 |
|
503 |
|
|
|
504 |
protected void clearResourceWithoutPath() { |
505 |
resource = null; |
506 |
updateErrorInfo(); |
507 |
} |
508 |
|
207 |
protected void initDrag() { |
509 |
protected void initDrag() { |
208 |
DragSource source = new DragSource(fileText, DND.DROP_MOVE |
510 |
DragSource source = new DragSource(fileText, DND.DROP_MOVE |
209 |
| DND.DROP_COPY | DND.DROP_DEFAULT); |
511 |
| DND.DROP_COPY | DND.DROP_DEFAULT); |
Lines 224-237
Link Here
|
224 |
|
526 |
|
225 |
protected void createGroup(Composite parent) { |
527 |
protected void createGroup(Composite parent) { |
226 |
group = new Group(parent, SWT.NONE); |
528 |
group = new Group(parent, SWT.NONE); |
227 |
group.setLayout(new GridLayout(3, false)); |
529 |
group.setLayout(new GridLayout(2, false)); |
228 |
group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); |
530 |
group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); |
|
|
531 |
createFileLabel(group); |
532 |
createFileCombo(group); |
229 |
} |
533 |
} |
230 |
|
534 |
|
231 |
protected void createFileCombo() { |
535 |
protected void createFileCombo(Composite parent) { |
232 |
fileText = new Text(group, SWT.BORDER); |
536 |
fileText = new Text(parent, SWT.BORDER); |
233 |
fileText |
537 |
fileText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); |
234 |
.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); |
|
|
235 |
|
538 |
|
236 |
fileText.addModifyListener(new ModifyListener() { |
539 |
fileText.addModifyListener(new ModifyListener() { |
237 |
public void modifyText(ModifyEvent e) { |
540 |
public void modifyText(ModifyEvent e) { |
Lines 254-271
Link Here
|
254 |
}); |
557 |
}); |
255 |
} |
558 |
} |
256 |
|
559 |
|
257 |
protected void createFileLabel() { |
560 |
protected void createFileLabel(Composite parent) { |
258 |
final Label fileLabel = new Label(group, SWT.NONE); |
561 |
final Label fileLabel = new Label(parent, SWT.NONE); |
259 |
fileLabel.setText(CompareMessages.CompareWithOther_fileLabel); |
562 |
fileLabel.setText(CompareMessages.CompareWithOther_fileLabel); |
260 |
} |
563 |
} |
261 |
} |
564 |
} |
262 |
|
565 |
|
263 |
private class InternalGroup extends InternalSection { |
566 |
private class InternalGroup extends InternalSection { |
264 |
|
567 |
|
|
|
568 |
private ClipboardSection clipboardSection; |
569 |
|
265 |
public InternalGroup(Composite parent) { |
570 |
public InternalGroup(Composite parent) { |
|
|
571 |
this.clipboardSection = new ClipboardSection(this); |
266 |
createContents(parent); |
572 |
createContents(parent); |
267 |
} |
573 |
} |
268 |
|
574 |
|
|
|
575 |
protected void createGroup(Composite parent) { |
576 |
super.createGroup(parent); |
577 |
clipboardSection.createClipboardSection(group); |
578 |
} |
579 |
|
269 |
public void setText(String text) { |
580 |
public void setText(String text) { |
270 |
group.setText(text); |
581 |
group.setText(text); |
271 |
} |
582 |
} |
Lines 278-294
Link Here
|
278 |
private class InternalExpandable extends InternalSection { |
589 |
private class InternalExpandable extends InternalSection { |
279 |
|
590 |
|
280 |
private ExpandableComposite expandable; |
591 |
private ExpandableComposite expandable; |
281 |
private Button clearButton; |
592 |
public Button clearButton; |
|
|
593 |
private ClipboardAncestorSection clipboardAncestorSection; |
282 |
|
594 |
|
283 |
public InternalExpandable(Composite parent) { |
595 |
public InternalExpandable(Composite parent) { |
|
|
596 |
this.clipboardAncestorSection = new ClipboardAncestorSection(this); |
284 |
createContents(parent); |
597 |
createContents(parent); |
285 |
} |
598 |
} |
286 |
|
599 |
|
287 |
public void createContents(Composite parent) { |
600 |
public void createContents(Composite parent) { |
288 |
createGroup(parent); |
601 |
createGroup(parent); |
289 |
createFileLabel(); |
|
|
290 |
createFileCombo(); |
291 |
createClearButton(group); |
292 |
initDrag(); |
602 |
initDrag(); |
293 |
initDrop(); |
603 |
initDrop(); |
294 |
} |
604 |
} |
Lines 302-309
Link Here
|
302 |
expandable.addExpansionListener(new ExpansionAdapter() { |
612 |
expandable.addExpansionListener(new ExpansionAdapter() { |
303 |
public void expansionStateChanged(ExpansionEvent e) { |
613 |
public void expansionStateChanged(ExpansionEvent e) { |
304 |
p.layout(); |
614 |
p.layout(); |
|
|
615 |
getShell().pack(); |
305 |
} |
616 |
} |
306 |
}); |
617 |
}); |
|
|
618 |
clipboardAncestorSection.createClipboardSection(group); |
307 |
} |
619 |
} |
308 |
|
620 |
|
309 |
protected void createClearButton(Composite parent) { |
621 |
protected void createClearButton(Composite parent) { |
Lines 334-343
Link Here
|
334 |
private InternalGroup rightPanel, leftPanel; |
646 |
private InternalGroup rightPanel, leftPanel; |
335 |
private InternalExpandable ancestorPanel; |
647 |
private InternalExpandable ancestorPanel; |
336 |
private ISelection fselection; |
648 |
private ISelection fselection; |
|
|
649 |
Clipboard clipboard; |
337 |
|
650 |
|
338 |
/** |
651 |
/** |
339 |
* Creates the dialog. |
652 |
* Creates the dialog. |
340 |
* |
653 |
* |
341 |
* @param shell |
654 |
* @param shell |
342 |
* a shell |
655 |
* a shell |
343 |
* @param selection |
656 |
* @param selection |
Lines 349-359
Link Here
|
349 |
super(shell); |
662 |
super(shell); |
350 |
setShellStyle(SWT.MODELESS | SWT.RESIZE | SWT.MAX); |
663 |
setShellStyle(SWT.MODELESS | SWT.RESIZE | SWT.MAX); |
351 |
fselection = selection; |
664 |
fselection = selection; |
|
|
665 |
clipboard = new Clipboard(Display.getDefault()); |
352 |
} |
666 |
} |
353 |
|
667 |
|
354 |
/* |
668 |
/* |
355 |
* (non-Javadoc) |
669 |
* (non-Javadoc) |
356 |
* |
670 |
* |
357 |
* @see |
671 |
* @see |
358 |
* org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets |
672 |
* org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets |
359 |
* .Composite) |
673 |
* .Composite) |
Lines 389-395
Link Here
|
389 |
|
703 |
|
390 |
/* |
704 |
/* |
391 |
* (non-Javadoc) |
705 |
* (non-Javadoc) |
392 |
* |
706 |
* |
393 |
* @see |
707 |
* @see |
394 |
* org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse |
708 |
* org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse |
395 |
* .swt.widgets.Composite) |
709 |
* .swt.widgets.Composite) |
Lines 463-469
Link Here
|
463 |
* the ancestor panel, table has only two elements -- resources chosen in |
777 |
* the ancestor panel, table has only two elements -- resources chosen in |
464 |
* left and right panel. In the other case table contains all three |
778 |
* left and right panel. In the other case table contains all three |
465 |
* resources. |
779 |
* resources. |
466 |
* |
780 |
* |
467 |
* @return table with selected resources |
781 |
* @return table with selected resources |
468 |
*/ |
782 |
*/ |
469 |
public IResource[] getResult() { |
783 |
public IResource[] getResult() { |