View | Details | Raw Unified | Return to bug 224562 | Differences between
and this patch

Collapse All | Expand All

(-)plugin.xml (+8 lines)
Lines 201-206 Link Here
201
               enablesFor="2+"
201
               enablesFor="2+"
202
               id="compareWithEachOther">
202
               id="compareWithEachOther">
203
         </action>
203
         </action>
204
         <action
205
               class="org.eclipse.compare.CompareWithOtherResourceAction"
206
               enablesFor="1"
207
               id="compareWithOtherResource"
208
               label="%CompareWithOtherResource.label"
209
               menubarPath="compareWithMenu/compareWithGroup"
210
               tooltip="%CompareWithOtherResourceAction.tooltip">
211
         </action>
204
      </objectContribution>
212
      </objectContribution>
205
      <objectContribution
213
      <objectContribution
206
            objectClass="org.eclipse.core.resources.IFile"
214
            objectClass="org.eclipse.core.resources.IFile"
(-)plugin.properties (+3 lines)
Lines 83-88 Link Here
83
CompareWithEachOtherAction.label= &Each Other
83
CompareWithEachOtherAction.label= &Each Other
84
CompareWithEachOtherAction.tooltip= Compare the Selected Resources
84
CompareWithEachOtherAction.tooltip= Compare the Selected Resources
85
85
86
CompareWithOtherResource.label= &Other Resource
87
CompareWithOtherResource.tooltip= Open the 'Compare With' Dialog
88
86
CompareWithHistoryAction.label= &Local History...
89
CompareWithHistoryAction.label= &Local History...
87
CompareWithHistoryAction.tooltip= Compare the Selected Resource with Local History
90
CompareWithHistoryAction.tooltip= Compare the Selected Resource with Local History
88
91
(-)compare/org/eclipse/compare/CompareWithOtherResourceAction.java (+34 lines)
Added Link Here
1
package org.eclipse.compare;
2
3
import org.eclipse.jface.action.IAction;
4
import org.eclipse.jface.viewers.ISelection;
5
import org.eclipse.swt.widgets.Shell;
6
import org.eclipse.ui.IObjectActionDelegate;
7
import org.eclipse.ui.IWorkbenchPart;
8
import org.eclipse.ui.PlatformUI;
9
10
public class CompareWithOtherResourceAction implements IObjectActionDelegate {
11
12
	Shell shell;
13
	CompareWithOtherResourceDialog dialog;
14
	
15
	public CompareWithOtherResourceAction() {
16
		shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
17
	}
18
19
	public void setActivePart(IAction action, IWorkbenchPart targetPart) {
20
		// TODO Auto-generated method stub
21
22
	}
23
24
	public void run(IAction action) {
25
		dialog = new CompareWithOtherResourceDialog(shell);
26
		dialog.open();
27
	}
28
29
	public void selectionChanged(IAction action, ISelection selection) {
30
		// TODO Auto-generated method stub
31
32
	}
33
34
}
(-)compare/org/eclipse/compare/CompareWithOtherResourceDialog.java (+128 lines)
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
}

Return to bug 224562