use of org.tigris.subversion.subclipse.ui.util.UrlCombo in project subclipse by subclipse.
the class SvnWizardSwitchPage method createControls.
public void createControls(Composite parent) {
Composite composite = new Composite(parent, SWT.NULL);
GridLayout layout = new GridLayout();
layout.numColumns = 3;
layout.marginHeight = 0;
layout.marginWidth = 0;
composite.setLayout(layout);
GridData data = new GridData(GridData.FILL_BOTH);
composite.setLayoutData(data);
if (showUrl) {
Label urlLabel = new Label(composite, SWT.NONE);
// $NON-NLS-1$
urlLabel.setText(Policy.bind("SwitchDialog.url"));
urlCombo = new UrlCombo(composite, SWT.NONE);
urlCombo.init(resources[0].getProject().getName());
urlCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
commonRoot = getCommonRoot();
if (commonRoot != null)
urlCombo.setText(commonRoot);
urlCombo.getCombo().addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
setPageComplete(canFinish());
}
});
Button browseButton = new Button(composite, SWT.PUSH);
// $NON-NLS-1$
browseButton.setText(Policy.bind("SwitchDialog.browse"));
browseButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
ChooseUrlDialog dialog = new ChooseUrlDialog(getShell(), resources[0]);
dialog.setIncludeBranchesAndTags(resources.length == 1);
if ((dialog.open() == ChooseUrlDialog.OK) && (dialog.getUrl() != null)) {
urlCombo.setText(dialog.getUrl());
setPageComplete(canFinish());
}
}
});
revisionGroup = new Composite(composite, SWT.NULL);
GridLayout revisionLayout = new GridLayout();
revisionLayout.numColumns = 3;
revisionLayout.marginWidth = 0;
revisionLayout.marginHeight = 0;
revisionGroup.setLayout(revisionLayout);
data = new GridData(GridData.FILL_HORIZONTAL);
data.horizontalSpan = 3;
revisionGroup.setLayoutData(data);
headButton = new Button(revisionGroup, SWT.CHECK);
// $NON-NLS-1$
headButton.setText(Policy.bind("SvnWizardSwitchPage.head"));
data = new GridData();
data.horizontalSpan = 3;
headButton.setLayoutData(data);
Label revisionLabel = new Label(revisionGroup, SWT.NONE);
// $NON-NLS-1$
revisionLabel.setText(Policy.bind("SvnWizardSwitchPage.revision"));
revisionText = new Text(revisionGroup, SWT.BORDER);
data = new GridData();
data.widthHint = REVISION_WIDTH_HINT;
revisionText.setLayoutData(data);
if (revisionNumber == 0) {
headButton.setSelection(true);
revisionText.setEnabled(false);
} else {
// $NON-NLS-1$
revisionText.setText("" + revisionNumber);
}
revisionText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
setPageComplete(canFinish());
}
});
FocusListener focusListener = new FocusAdapter() {
public void focusGained(FocusEvent e) {
((Text) e.getSource()).selectAll();
}
public void focusLost(FocusEvent e) {
((Text) e.getSource()).setText(((Text) e.getSource()).getText());
}
};
revisionText.addFocusListener(focusListener);
logButton = new Button(revisionGroup, SWT.PUSH);
// $NON-NLS-1$
logButton.setText(Policy.bind("MergeDialog.showLog"));
logButton.setEnabled(false);
logButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
showLog();
}
});
SelectionListener listener = new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
revisionText.setEnabled(!headButton.getSelection());
logButton.setEnabled(!headButton.getSelection());
setPageComplete(canFinish());
if (!headButton.getSelection()) {
revisionText.selectAll();
revisionText.setFocus();
}
}
};
headButton.addSelectionListener(listener);
}
if (resources.length > 1) {
table = new Table(composite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
table.setLinesVisible(false);
table.setHeaderVisible(true);
data = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL);
data.horizontalSpan = 3;
table.setLayoutData(data);
TableLayout tableLayout = new TableLayout();
table.setLayout(tableLayout);
viewer = new TableViewer(table);
viewer.setContentProvider(new SwitchContentProvider());
ILabelDecorator decorator = PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator();
viewer.setLabelProvider(new TableDecoratingLabelProvider(new SwitchLabelProvider(), decorator));
for (int i = 0; i < columnHeaders.length; i++) {
tableLayout.addColumnData(columnLayouts[i]);
TableColumn tc = new TableColumn(table, SWT.NONE, i);
tc.setResizable(columnLayouts[i].resizable);
tc.setText(columnHeaders[i]);
}
viewer.setInput(this);
urlCombo.getCombo().addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
viewer.refresh();
}
});
}
Group parameterGroup = new Group(composite, SWT.NULL);
GridLayout parameterLayout = new GridLayout();
parameterLayout.numColumns = 2;
parameterGroup.setLayout(parameterLayout);
data = new GridData(GridData.FILL_HORIZONTAL);
data.horizontalSpan = 3;
parameterGroup.setLayoutData(data);
Label depthLabel = new Label(parameterGroup, SWT.NONE);
// $NON-NLS-1$
depthLabel.setText(Policy.bind("SvnDialog.depth"));
depthCombo = new Combo(parameterGroup, SWT.READ_ONLY);
DepthComboHelper.addDepths(depthCombo, true, true, ISVNUIConstants.DEPTH_UNKNOWN);
depthCombo.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent evt) {
if (depthCombo.getText().equals(ISVNUIConstants.DEPTH_EXCLUDE)) {
setDepthButton.setSelection(true);
setDepthButton.setEnabled(false);
ignoreExternalsButton.setVisible(false);
forceButton.setVisible(false);
ignoreAncestryButton.setVisible(false);
if (revisionGroup != null) {
revisionGroup.setVisible(false);
}
} else {
setDepthButton.setEnabled(true);
ignoreExternalsButton.setVisible(true);
forceButton.setVisible(true);
ignoreAncestryButton.setVisible(true);
if (revisionGroup != null) {
revisionGroup.setVisible(true);
}
}
setPageComplete(canFinish());
}
});
setDepthButton = new Button(parameterGroup, SWT.CHECK);
// $NON-NLS-1$
setDepthButton.setText(Policy.bind("SvnDialog.setDepth"));
data = new GridData();
data.horizontalSpan = 2;
setDepthButton.setLayoutData(data);
ignoreExternalsButton = new Button(parameterGroup, SWT.CHECK);
// $NON-NLS-1$
ignoreExternalsButton.setText(Policy.bind("SvnDialog.ignoreExternals"));
data = new GridData();
data.horizontalSpan = 2;
ignoreExternalsButton.setLayoutData(data);
forceButton = new Button(parameterGroup, SWT.CHECK);
// $NON-NLS-1$
forceButton.setText(Policy.bind("SvnDialog.force"));
data = new GridData();
data.horizontalSpan = 2;
forceButton.setLayoutData(data);
forceButton.setSelection(true);
ignoreAncestryButton = new Button(parameterGroup, SWT.CHECK);
// $NON-NLS-1$
ignoreAncestryButton.setText(Policy.bind("SvnWizardSwitchPage.0"));
data = new GridData();
data.horizontalSpan = 2;
ignoreAncestryButton.setLayoutData(data);
ignoreAncestryButton.setSelection(false);
Group conflictGroup = new Group(composite, SWT.NONE);
// $NON-NLS-1$
conflictGroup.setText(Policy.bind("SvnWizardUpdatePage.0"));
GridLayout conflictLayout = new GridLayout();
conflictLayout.numColumns = 1;
conflictGroup.setLayout(conflictLayout);
data = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
data.horizontalSpan = 2;
conflictGroup.setLayoutData(data);
Group textGroup = new Group(conflictGroup, SWT.NONE);
// $NON-NLS-1$
textGroup.setText(Policy.bind("SvnWizardUpdatePage.1"));
GridLayout textLayout = new GridLayout();
textLayout.numColumns = 1;
textGroup.setLayout(textLayout);
textGroup.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
textConflictPromptButton = new Button(textGroup, SWT.RADIO);
// $NON-NLS-1$
textConflictPromptButton.setText(Policy.bind("SvnWizardUpdatePage.2"));
textConflictMarkButton = new Button(textGroup, SWT.RADIO);
// $NON-NLS-1$
textConflictMarkButton.setText(Policy.bind("SvnWizardUpdatePage.3"));
Group binaryGroup = new Group(conflictGroup, SWT.NONE);
// $NON-NLS-1$
binaryGroup.setText(Policy.bind("SvnWizardUpdatePage.4"));
GridLayout binaryLayout = new GridLayout();
binaryLayout.numColumns = 1;
binaryGroup.setLayout(binaryLayout);
binaryGroup.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
binaryConflictPromptButton = new Button(binaryGroup, SWT.RADIO);
// $NON-NLS-1$
binaryConflictPromptButton.setText(Policy.bind("SvnWizardUpdatePage.5"));
binaryConflictMarkButton = new Button(binaryGroup, SWT.RADIO);
// $NON-NLS-1$
binaryConflictMarkButton.setText(Policy.bind("SvnWizardUpdatePage.6"));
binaryConflictUserButton = new Button(binaryGroup, SWT.RADIO);
// $NON-NLS-1$
binaryConflictUserButton.setText(Policy.bind("SvnWizardUpdatePage.7"));
binaryConflictIncomingButton = new Button(binaryGroup, SWT.RADIO);
// $NON-NLS-1$
binaryConflictIncomingButton.setText(Policy.bind("SvnWizardUpdatePage.8"));
Group propertyGroup = new Group(conflictGroup, SWT.NONE);
// $NON-NLS-1$
propertyGroup.setText(Policy.bind("SvnWizardUpdatePage.9"));
GridLayout propertyLayout = new GridLayout();
propertyLayout.numColumns = 1;
propertyGroup.setLayout(propertyLayout);
propertyGroup.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
propertyConflictPromptButton = new Button(propertyGroup, SWT.RADIO);
// $NON-NLS-1$
propertyConflictPromptButton.setText(Policy.bind("SvnWizardUpdatePage.10"));
propertyConflictMarkButton = new Button(propertyGroup, SWT.RADIO);
// $NON-NLS-1$
propertyConflictMarkButton.setText(Policy.bind("SvnWizardUpdatePage.11"));
Group treeConflictGroup = new Group(conflictGroup, SWT.NONE);
// $NON-NLS-1$
treeConflictGroup.setText(Policy.bind("SvnWizardUpdatePage.12"));
GridLayout treeConflictLayout = new GridLayout();
treeConflictLayout.numColumns = 1;
treeConflictGroup.setLayout(treeConflictLayout);
treeConflictGroup.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
treeConflictPromptButton = new Button(treeConflictGroup, SWT.RADIO);
// $NON-NLS-1$
treeConflictPromptButton.setText(Policy.bind("SvnWizardUpdatePage.10"));
treeConflictMarkButton = new Button(treeConflictGroup, SWT.RADIO);
// $NON-NLS-1$
treeConflictMarkButton.setText(Policy.bind("SvnWizardUpdatePage.11"));
treeConflictUserButton = new Button(treeConflictGroup, SWT.RADIO);
// $NON-NLS-1$
treeConflictUserButton.setText(Policy.bind("SvnWizardUpdatePage.13"));
treeConflictResolveButton = new Button(treeConflictGroup, SWT.RADIO);
// $NON-NLS-1$
treeConflictResolveButton.setText(Policy.bind("SvnWizardUpdatePage.14"));
textConflictMarkButton.setSelection(true);
binaryConflictMarkButton.setSelection(true);
propertyConflictMarkButton.setSelection(true);
treeConflictMarkButton.setSelection(true);
setPageComplete(canFinish());
// Add F1 help
PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IHelpContextIds.SWITCH_DIALOG);
}
use of org.tigris.subversion.subclipse.ui.util.UrlCombo in project subclipse by subclipse.
the class ShowDifferencesAsUnifiedDiffDialogWC method createDialogArea.
protected Control createDialogArea(Composite parent) {
// $NON-NLS-1$
getShell().setText(Policy.bind("ShowDifferencesAsUnifiedDiffDialog.branchTag"));
Composite composite = new Composite(parent, SWT.NULL);
composite.setLayout(new GridLayout());
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
Group fromGroup = new Group(composite, SWT.NULL);
// $NON-NLS-1$
fromGroup.setText(Policy.bind("ShowDifferencesAsUnifiedDiffDialog.compareFrom"));
GridLayout fromLayout = new GridLayout();
fromLayout.numColumns = 2;
fromGroup.setLayout(fromLayout);
GridData data = new GridData(SWT.FILL, SWT.FILL, true, false);
fromGroup.setLayoutData(data);
Label pathLabel = new Label(fromGroup, SWT.NONE);
// $NON-NLS-1$
pathLabel.setText(Policy.bind("ShowDifferencesAsUnifiedDiffDialog.path"));
Text pathText = new Text(fromGroup, SWT.BORDER);
data = new GridData(GridData.FILL_HORIZONTAL);
pathText.setLayoutData(data);
pathText.setEditable(false);
pathText.setText(resource.getFullPath().toString());
Group toGroup = new Group(composite, SWT.NULL);
// $NON-NLS-1$
toGroup.setText(Policy.bind("ShowDifferencesAsUnifiedDiffDialog.compareTo"));
GridLayout toLayout = new GridLayout();
toLayout.numColumns = 3;
toGroup.setLayout(toLayout);
data = new GridData(SWT.FILL, SWT.FILL, true, false);
toGroup.setLayoutData(data);
Label toUrlLabel = new Label(toGroup, SWT.NONE);
// $NON-NLS-1$
toUrlLabel.setText(Policy.bind("ShowDifferencesAsUnifiedDiffDialog.url"));
toUrlText = new UrlCombo(toGroup, SWT.NONE);
toUrlText.init(resource.getProject().getName());
toUrlText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
ISVNLocalResource localResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
if (localResource != null && localResource.getUrl() != null) {
selectedResourceUrl = localResource.getUrl().toString();
toUrlText.setText(selectedResourceUrl);
}
Button urlBrowseButton = new Button(toGroup, SWT.PUSH);
urlBrowseButton.setText(// $NON-NLS-1$
Policy.bind("ShowDifferencesAsUnifiedDiffDialog.browse"));
urlBrowseButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
ChooseUrlDialog dialog = new ChooseUrlDialog(getShell(), resource);
if (resource instanceof IContainer)
dialog.setFoldersOnly(true);
if (dialog.open() == ChooseUrlDialog.CANCEL)
return;
String url = dialog.getUrl();
if (url != null)
toUrlText.setText(url);
setOkButtonStatus();
}
});
Composite toRevisionGroup = new Composite(toGroup, SWT.NULL);
GridLayout toRevisionLayout = new GridLayout();
toRevisionLayout.numColumns = 3;
toRevisionLayout.marginWidth = 0;
toRevisionLayout.marginHeight = 0;
toRevisionGroup.setLayout(toRevisionLayout);
data = new GridData(GridData.FILL_BOTH);
data.horizontalSpan = 3;
toRevisionGroup.setLayoutData(data);
toHeadButton = new Button(toRevisionGroup, SWT.CHECK);
// $NON-NLS-1$
toHeadButton.setText(Policy.bind("ShowDifferencesAsUnifiedDiffDialog.head"));
data = new GridData();
data.horizontalSpan = 3;
toHeadButton.setLayoutData(data);
toHeadButton.setSelection(true);
Label revisionLabel = new Label(toRevisionGroup, SWT.NONE);
revisionLabel.setText(// $NON-NLS-1$
Policy.bind("ShowDifferencesAsUnifiedDiffDialog.revision"));
toRevisionText = new Text(toRevisionGroup, SWT.BORDER);
data = new GridData();
data.widthHint = 40;
toRevisionText.setLayoutData(data);
toRevisionText.setEnabled(false);
toLogButton = new Button(toRevisionGroup, SWT.PUSH);
// $NON-NLS-1$
toLogButton.setText(Policy.bind("ShowDifferencesAsUnifiedDiffDialog.showLog"));
toLogButton.setEnabled(false);
toLogButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
showLog(e.getSource());
}
});
Group fileGroup = new Group(composite, SWT.NULL);
// $NON-NLS-1$
fileGroup.setText(Policy.bind("ShowDifferencesAsUnifiedDiffDialog.compareType"));
GridLayout fileLayout = new GridLayout();
fileLayout.numColumns = 3;
fileGroup.setLayout(fileLayout);
data = new GridData(SWT.FILL, SWT.FILL, true, false);
fileGroup.setLayoutData(data);
compareButton = new Button(fileGroup, SWT.RADIO);
compareButton.setText(// $NON-NLS-1$
Policy.bind("ShowDifferencesAsUnifiedDiffDialog.graphical"));
data = new GridData();
data.horizontalSpan = 3;
compareButton.setLayoutData(data);
diffButton = new Button(fileGroup, SWT.RADIO);
// $NON-NLS-1$
diffButton.setText(Policy.bind("ShowDifferencesAsUnifiedDiffDialog.diff"));
compareButton.setSelection(true);
fileText = new Text(fileGroup, SWT.BORDER);
data = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
fileText.setLayoutData(data);
fileText.setEnabled(false);
browseButton = new Button(fileGroup, SWT.PUSH);
browseButton.setText(// $NON-NLS-1$
Policy.bind("ShowDifferencesAsUnifiedDiffDialog.fileBrowse"));
browseButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
FileDialog dialog = new FileDialog(getShell(), SWT.SAVE);
dialog.setText(// $NON-NLS-1$
Policy.bind("ShowDifferencesAsUnifiedDiffDialog.fileDialogText"));
// $NON-NLS-1$
dialog.setFileName("revision.diff");
String outFile = dialog.open();
if (outFile != null)
fileText.setText(outFile);
}
});
toUrlText.setFocus();
ModifyListener modifyListener = new ModifyListener() {
public void modifyText(ModifyEvent e) {
setOkButtonStatus();
}
};
SelectionListener selectionListener = new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
toRevisionText.setEnabled(!toHeadButton.getSelection());
toLogButton.setEnabled(!toHeadButton.getSelection() && toUrlText.getText().trim().length() > 0);
setOkButtonStatus();
if (e.getSource() == toHeadButton && !toHeadButton.getSelection()) {
toRevisionText.selectAll();
toRevisionText.setFocus();
}
}
};
SelectionListener compareTypeListener = new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
if (diffButton.getSelection()) {
fileText.setEnabled(true);
browseButton.setEnabled(true);
fileText.selectAll();
fileText.setFocus();
} else {
fileText.setEnabled(false);
browseButton.setEnabled(false);
}
setOkButtonStatus();
}
};
fileText.addModifyListener(modifyListener);
toUrlText.getCombo().addModifyListener(modifyListener);
toRevisionText.addModifyListener(modifyListener);
toHeadButton.addSelectionListener(selectionListener);
compareButton.addSelectionListener(compareTypeListener);
diffButton.addSelectionListener(compareTypeListener);
FocusListener focusListener = new FocusAdapter() {
public void focusGained(FocusEvent e) {
((Text) e.getSource()).selectAll();
}
public void focusLost(FocusEvent e) {
((Text) e.getSource()).setText(((Text) e.getSource()).getText());
}
};
toRevisionText.addFocusListener(focusListener);
fileText.addFocusListener(focusListener);
return composite;
}
Aggregations