### Eclipse Workspace Patch 1.0 #P org.eclipse.compare Index: compare/org/eclipse/compare/CompareWithOtherResourceAction.java =================================================================== RCS file: compare/org/eclipse/compare/CompareWithOtherResourceAction.java diff -N compare/org/eclipse/compare/CompareWithOtherResourceAction.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ compare/org/eclipse/compare/CompareWithOtherResourceAction.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,34 @@ +package org.eclipse.compare; + +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IObjectActionDelegate; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.PlatformUI; + +public class CompareWithOtherResourceAction implements IObjectActionDelegate { + + Shell shell; + CompareWithOtherResourceDialog dialog; + + public CompareWithOtherResourceAction() { + shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); + } + + public void setActivePart(IAction action, IWorkbenchPart targetPart) { + // TODO Auto-generated method stub + + } + + public void run(IAction action) { + dialog = new CompareWithOtherResourceDialog(shell); + dialog.open(); + } + + public void selectionChanged(IAction action, ISelection selection) { + // TODO Auto-generated method stub + + } + +} Index: compare/org/eclipse/compare/CompareWithOtherResourceDialog.java =================================================================== RCS file: compare/org/eclipse/compare/CompareWithOtherResourceDialog.java diff -N compare/org/eclipse/compare/CompareWithOtherResourceDialog.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ compare/org/eclipse/compare/CompareWithOtherResourceDialog.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,128 @@ +package org.eclipse.compare; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.layout.FillLayout; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; + + +public class CompareWithOtherResourceDialog extends Dialog { + + private class InternalGroup { + + Group group; + Composite parent; + + public InternalGroup(Composite parent) { + createContents(parent); + } + + public void createContents(Composite parent) { + + GridLayout layout = new GridLayout(); + layout.numColumns = 3; + group = new Group(parent, SWT.NONE); + group.setLayout(layout); + GridData gridData = new GridData(); + gridData.grabExcessHorizontalSpace = true; + gridData.grabExcessVerticalSpace = true; + group.setLayoutData(gridData); + + Label fileLabel = new Label(group, SWT.NONE); + fileLabel.setText("File: "); + + Text ancestor = new Text(group, SWT.SINGLE | SWT.BORDER); + GridData textData = new GridData(); + //textData.horizontalSpan = 2; + textData.grabExcessHorizontalSpace = true; + textData.horizontalAlignment = SWT.FILL; + ancestor.setLayoutData(textData); + + createButtons(group); + } + + public Composite createButtons(Composite parent) { + + Composite buttons = new Composite(parent, SWT.FILL); + FillLayout buttonsLayout = new FillLayout(); + buttonsLayout.type = SWT.VERTICAL; + buttons.setLayout(buttonsLayout); + + Button openTypeButton = new Button(buttons, SWT.PUSH); + openTypeButton.setText("Open Type..."); + openTypeButton.addSelectionListener(new SelectionListener() { + + public void widgetDefaultSelected(SelectionEvent e) { + + } + + public void widgetSelected(SelectionEvent e) { + + } + + }); + + Button openFileButton = new Button(buttons, SWT.PUSH); + openFileButton.setText("Open File..."); + + Button openResourceButton = new Button(buttons, SWT.PUSH); + openResourceButton.setText("Open Resource..."); + + return buttons; + } + + public void setText(String text) { + group.setText(text); + } + + public void setLayoutData(GridData layoutData) { + group.setLayoutData(layoutData); + } + + } + + Button okButton, cancelButton; + + protected CompareWithOtherResourceDialog(Shell shell) { + super(shell); + setShellStyle(SWT.MODELESS | SWT.TITLE); + } + + protected Control createDialogArea(Composite parent) { + + Composite mainPanel = new Composite(parent, SWT.NULL); + GridLayout layout = new GridLayout(); + layout.numColumns = 2; + layout.makeColumnsEqualWidth = true; + mainPanel.setLayout(layout); + mainPanel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); + + InternalGroup ancestorPanel = new InternalGroup(mainPanel); + ancestorPanel.setText("Ancestor"); + GridData ancestorGD = new GridData(SWT.FILL, SWT.FILL, true, true); + ancestorGD.horizontalSpan = 2; + ancestorPanel.setLayoutData(ancestorGD); + + InternalGroup leftPanel = new InternalGroup(mainPanel); + leftPanel.setText("Left panel"); + GridData leftGD = new GridData(SWT.FILL, SWT.FILL, true, true); + leftPanel.setLayoutData(leftGD); + + InternalGroup rightPanel = new InternalGroup(mainPanel); + rightPanel.setText("Right panel"); + GridData rightGD = new GridData(SWT.FILL, SWT.FILL, true, true); + rightPanel.setLayoutData(rightGD); + + return mainPanel; + } +}