Added
Link Here
|
1 |
package org.eclipse.compare; |
2 |
|
3 |
import org.eclipse.jface.dialogs.Dialog; |
4 |
import org.eclipse.swt.SWT; |
5 |
import org.eclipse.swt.events.SelectionEvent; |
6 |
import org.eclipse.swt.events.SelectionListener; |
7 |
import org.eclipse.swt.layout.FillLayout; |
8 |
import org.eclipse.swt.layout.GridData; |
9 |
import org.eclipse.swt.layout.GridLayout; |
10 |
import org.eclipse.swt.widgets.Button; |
11 |
import org.eclipse.swt.widgets.Composite; |
12 |
import org.eclipse.swt.widgets.Control; |
13 |
import org.eclipse.swt.widgets.Group; |
14 |
import org.eclipse.swt.widgets.Label; |
15 |
import org.eclipse.swt.widgets.Shell; |
16 |
import org.eclipse.swt.widgets.Text; |
17 |
|
18 |
|
19 |
public class CompareWithOtherResourceDialog extends Dialog { |
20 |
|
21 |
private class InternalGroup { |
22 |
|
23 |
Group group; |
24 |
Composite parent; |
25 |
|
26 |
public InternalGroup(Composite parent) { |
27 |
createContents(parent); |
28 |
} |
29 |
|
30 |
public void createContents(Composite parent) { |
31 |
|
32 |
GridLayout layout = new GridLayout(); |
33 |
layout.numColumns = 3; |
34 |
group = new Group(parent, SWT.NONE); |
35 |
group.setLayout(layout); |
36 |
GridData gridData = new GridData(); |
37 |
gridData.grabExcessHorizontalSpace = true; |
38 |
gridData.grabExcessVerticalSpace = true; |
39 |
group.setLayoutData(gridData); |
40 |
|
41 |
Label fileLabel = new Label(group, SWT.NONE); |
42 |
fileLabel.setText("File: "); |
43 |
|
44 |
Text ancestor = new Text(group, SWT.SINGLE | SWT.BORDER); |
45 |
GridData textData = new GridData(); |
46 |
//textData.horizontalSpan = 2; |
47 |
textData.grabExcessHorizontalSpace = true; |
48 |
textData.horizontalAlignment = SWT.FILL; |
49 |
ancestor.setLayoutData(textData); |
50 |
|
51 |
createButtons(group); |
52 |
} |
53 |
|
54 |
public Composite createButtons(Composite parent) { |
55 |
|
56 |
Composite buttons = new Composite(parent, SWT.FILL); |
57 |
FillLayout buttonsLayout = new FillLayout(); |
58 |
buttonsLayout.type = SWT.VERTICAL; |
59 |
buttons.setLayout(buttonsLayout); |
60 |
|
61 |
Button openTypeButton = new Button(buttons, SWT.PUSH); |
62 |
openTypeButton.setText("Open Type..."); |
63 |
openTypeButton.addSelectionListener(new SelectionListener() { |
64 |
|
65 |
public void widgetDefaultSelected(SelectionEvent e) { |
66 |
|
67 |
} |
68 |
|
69 |
public void widgetSelected(SelectionEvent e) { |
70 |
|
71 |
} |
72 |
|
73 |
}); |
74 |
|
75 |
Button openFileButton = new Button(buttons, SWT.PUSH); |
76 |
openFileButton.setText("Open File..."); |
77 |
|
78 |
Button openResourceButton = new Button(buttons, SWT.PUSH); |
79 |
openResourceButton.setText("Open Resource..."); |
80 |
|
81 |
return buttons; |
82 |
} |
83 |
|
84 |
public void setText(String text) { |
85 |
group.setText(text); |
86 |
} |
87 |
|
88 |
public void setLayoutData(GridData layoutData) { |
89 |
group.setLayoutData(layoutData); |
90 |
} |
91 |
|
92 |
} |
93 |
|
94 |
Button okButton, cancelButton; |
95 |
|
96 |
protected CompareWithOtherResourceDialog(Shell shell) { |
97 |
super(shell); |
98 |
setShellStyle(SWT.MODELESS | SWT.TITLE); |
99 |
} |
100 |
|
101 |
protected Control createDialogArea(Composite parent) { |
102 |
|
103 |
Composite mainPanel = new Composite(parent, SWT.NULL); |
104 |
GridLayout layout = new GridLayout(); |
105 |
layout.numColumns = 2; |
106 |
layout.makeColumnsEqualWidth = true; |
107 |
mainPanel.setLayout(layout); |
108 |
mainPanel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); |
109 |
|
110 |
InternalGroup ancestorPanel = new InternalGroup(mainPanel); |
111 |
ancestorPanel.setText("Ancestor"); |
112 |
GridData ancestorGD = new GridData(SWT.FILL, SWT.FILL, true, true); |
113 |
ancestorGD.horizontalSpan = 2; |
114 |
ancestorPanel.setLayoutData(ancestorGD); |
115 |
|
116 |
InternalGroup leftPanel = new InternalGroup(mainPanel); |
117 |
leftPanel.setText("Left panel"); |
118 |
GridData leftGD = new GridData(SWT.FILL, SWT.FILL, true, true); |
119 |
leftPanel.setLayoutData(leftGD); |
120 |
|
121 |
InternalGroup rightPanel = new InternalGroup(mainPanel); |
122 |
rightPanel.setText("Right panel"); |
123 |
GridData rightGD = new GridData(SWT.FILL, SWT.FILL, true, true); |
124 |
rightPanel.setLayoutData(rightGD); |
125 |
|
126 |
return mainPanel; |
127 |
} |
128 |
} |