List of usage examples for org.eclipse.jface.dialogs IDialogConstants ENTRY_FIELD_WIDTH
int ENTRY_FIELD_WIDTH
To view the source code for org.eclipse.jface.dialogs IDialogConstants ENTRY_FIELD_WIDTH.
Click Source Link
From source file:org.eclipse.team.svn.ui.composite.CommentComposite.java
License:Open Source License
private void createControls() { GridData data = null;//from w w w. j a v a 2s.c om GridLayout layout = new GridLayout(); layout.marginHeight = 0; layout.marginWidth = 0; this.setLayout(layout); final Text[] tBugIdTextA = new Text[1]; if (this.bugtraqModel != null && (this.bugtraqModel.getMessage() != null || this.bugtraqModel.getLogregex() != null)) { Composite bugtraqComposite = new Composite(this, SWT.NONE); layout = new GridLayout(); layout.numColumns = 2; layout.marginHeight = layout.marginWidth = 0; bugtraqComposite.setLayout(layout); bugtraqComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Label label = new Label(bugtraqComposite, SWT.NONE); label.setLayoutData(new GridData(GridData.BEGINNING)); label.setText(this.bugtraqModel.getLabel()); if (this.bugtraqModel.getLogregex() == null) { this.bugIdText = new Text(bugtraqComposite, SWT.FILL | SWT.BORDER); this.bugIdText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); this.bugIdText.setFocus(); this.validationManager.attachTo(this.bugIdText, new AbstractVerifier() { protected String getErrorMessage(Control input) { String bugId = this.getText(input); if (bugId.length() > 0 && CommentComposite.this.bugtraqModel.isNumber() && !bugId.matches("[0-9]+(\\s*,\\s*?[0-9]+)*")) { return SVNUIMessages.format(SVNUIMessages.CommentComposite_BugID_Verifier_Error_Number, new String[] { CommentComposite.this.bugtraqModel.getLabel() }); } return null; } protected String getWarningMessage(Control input) { if (CommentComposite.this.bugtraqModel.isWarnIfNoIssue() && this.getText(input).length() == 0) { return SVNUIMessages.CommentComposite_BugID_Verifier_Warning; } return null; } }); } else { final Text tBugIdText = new Text(bugtraqComposite, SWT.FILL | SWT.BORDER | SWT.READ_ONLY); tBugIdText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); tBugIdTextA[0] = tBugIdText; } } data = new GridData(GridData.FILL_BOTH); data.heightHint = 80; this.text = SpellcheckedTextProvider.getTextWidget(this, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.WRAP, data, this.maxLogWidth); this.text.addTraverseListener(new TraverseListener() { public void keyTraversed(TraverseEvent e) { if (!SVNTeamPreferences.getCommentTemplatesBoolean(SVNTeamUIPlugin.instance().getPreferenceStore(), SVNTeamPreferences.COMMENT_USE_SHIFT_ENTER_NAME) && (e.stateMask & SWT.SHIFT) != 0 && e.detail == SWT.TRAVERSE_RETURN) { e.doit = false; } else if (e.character == SWT.TAB) { // no TABs are accepted as a text part e.doit = true; } } }); this.text.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { CommentComposite.this.message = CommentComposite.this.text.getText(); } }); CompositeVerifier verifier = new CompositeVerifier(); verifier.add(new CommentVerifier(SVNUIMessages.CommentComposite_Comment_Verifier, this.minLogSize)); if (this.bugtraqModel != null && this.bugtraqModel.getLogregex() != null) { this.text.setFocus(); String[] logregex = this.bugtraqModel.getLogregex(); final Pattern mainRegex = Pattern.compile(logregex[0]); final Pattern numberRegex = logregex.length > 1 ? Pattern.compile(logregex[1]) : (this.bugtraqModel.isNumber() ? Pattern.compile("[0-9]+(\\s*,\\s*?[0-9]+)*") : null); verifier.add(new AbstractVerifier() { protected String getErrorMessage(Control input) { return null; } protected String getWarningMessage(Control input) { if (CommentComposite.this.bugtraqModel.isWarnIfNoIssue()) { String text = this.getText(input); Matcher matcher = mainRegex.matcher(text); if (matcher.find()) { String bugIdEntry = matcher.group(); if (numberRegex != null) { matcher = numberRegex.matcher(bugIdEntry); String entryList = null; while (matcher.find()) { entryList = entryList == null ? matcher.group() : (entryList + ", " + matcher.group()); } if (entryList != null) { tBugIdTextA[0].setText(entryList); return null; } tBugIdTextA[0].setText(""); return SVNUIMessages.format( SVNUIMessages.CommentComposite_BugID_Verifier_Error_Text, new String[] { CommentComposite.this.bugtraqModel.getLabel(), numberRegex.pattern() }); } tBugIdTextA[0].setText(bugIdEntry); return null; } tBugIdTextA[0].setText(""); return SVNUIMessages.CommentComposite_BugID_Verifier_Warning; } return null; } }); } this.validationManager.attachTo(this.text, verifier); Label label = new Label(this, SWT.NULL); label.setLayoutData(new GridData()); label.setText(SVNUIMessages.CommentComposite_ChooseComment); this.history = new UserInputHistory(CommentComposite.COMMENT_HISTORY_NAME, SVNTeamPreferences.getCommentTemplatesInt(SVNTeamUIPlugin.instance().getPreferenceStore(), SVNTeamPreferences.COMMENT_SAVED_COMMENTS_COUNT_NAME)); final Combo previousCommentsCombo = new Combo(this, SWT.READ_ONLY); data = new GridData(GridData.FILL_HORIZONTAL); data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH; previousCommentsCombo.setLayoutData(data); String logTemplateMessage = this.initCommentsMap(); final List commentsList = this.getCommentsList(); if (this.message != null && this.message.length() > 0) { this.text.setText(this.message); } else if (CommentComposite.TEMPORARY_COMMENT != null) { this.text.setText(CommentComposite.TEMPORARY_COMMENT); } else if (logTemplateMessage != null) { this.text.setText(logTemplateMessage); } this.text.selectAll(); List flattenCommentsList = new ArrayList(); for (Iterator iter = commentsList.iterator(); iter.hasNext();) { flattenCommentsList.add(FileUtility.flattenText((String) iter.next())); } previousCommentsCombo.setVisibleItemCount(flattenCommentsList.size()); previousCommentsCombo .setItems((String[]) flattenCommentsList.toArray(new String[flattenCommentsList.size()])); previousCommentsCombo.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { int idx = previousCommentsCombo.getSelectionIndex(); if (idx != -1) { String comboText = (String) commentsList.get(idx); CommentComposite.this.text.setText(CommentComposite.this.ignoredStrings.contains(comboText) ? CommentComposite.this.text.getText() : comboText); } } public void widgetDefaultSelected(SelectionEvent e) { } }); }
From source file:org.eclipse.team.svn.ui.composite.CredentialsComposite.java
License:Open Source License
private void createControls() { GridLayout layout = new GridLayout(); layout.marginHeight = layout.marginWidth = 0; this.setLayout(layout); GridData data = new GridData(GridData.FILL_BOTH); this.setLayoutData(data); Group authGroup = new Group(this, SWT.NONE); layout = new GridLayout(); layout.verticalSpacing = 12;/*from w w w.j a v a2 s . c om*/ authGroup.setLayout(layout); data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING); data.horizontalSpan = 2; authGroup.setLayoutData(data); authGroup.setText(SVNUIMessages.CredentialsComposite_Authentication); Composite inner = new Composite(authGroup, SWT.FILL); layout = new GridLayout(); layout.numColumns = 2; layout.marginHeight = layout.marginWidth = 0; inner.setLayout(layout); data = new GridData(GridData.FILL_HORIZONTAL); data.horizontalSpan = 2; inner.setLayoutData(data); Label description = new Label(inner, SWT.NONE); data = new GridData(GridData.FILL_HORIZONTAL); data.grabExcessHorizontalSpace = false; data.horizontalIndent = 0; description.setLayoutData(data); description.setText(SVNUIMessages.CredentialsComposite_User); this.userHistory = new UserInputHistory(CredentialsComposite.USER_HISTORY_NAME); this.userName = new Combo(inner, SWT.DROP_DOWN); data = new GridData(GridData.FILL_HORIZONTAL); data.grabExcessHorizontalSpace = true; data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH; this.userName.setLayoutData(data); this.userName.setVisibleItemCount(this.userHistory.getDepth()); this.userName.setItems(this.userHistory.getHistory()); description = new Label(inner, SWT.NONE); data = new GridData(GridData.FILL_HORIZONTAL); data.grabExcessHorizontalSpace = false; data.horizontalIndent = 0; description.setLayoutData(data); description.setText(SVNUIMessages.CredentialsComposite_Password); this.password = new Text(inner, SWT.SINGLE | SWT.BORDER | SWT.PASSWORD); data = new GridData(GridData.FILL_HORIZONTAL); data.grabExcessHorizontalSpace = true; data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH; this.password.setLayoutData(data); inner = new Composite(authGroup, SWT.FILL); layout = new GridLayout(); layout.marginHeight = layout.marginWidth = 0; inner.setLayout(layout); data = new GridData(GridData.FILL_HORIZONTAL); data.horizontalSpan = 2; inner.setLayoutData(data); this.savePassword = new Button(inner, SWT.CHECK); data = new GridData(); this.savePassword.setLayoutData(data); this.savePassword.setText(SVNUIMessages.CredentialsComposite_SavePassword); new SecurityWarningComposite(inner); }
From source file:org.eclipse.team.svn.ui.composite.ProxyComposite.java
License:Open Source License
public void initialize() { GridLayout layout = null;//w w w .j a v a2 s . c om GridData data = null; layout = new GridLayout(); layout.verticalSpacing = 12; layout.marginHeight = 7; this.setLayout(layout); data = new GridData(GridData.FILL_BOTH); this.setLayoutData(data); Label description = new Label(this, SWT.WRAP); data = new GridData(GridData.FILL_HORIZONTAL); description.setLayoutData(data); description.setText( SVNUIMessages.format(SVNUIMessages.ProxyComposite_Description, new String[] { this.host })); //Authentication group Group authGroup = new Group(this, SWT.NULL); data = new GridData(GridData.FILL_HORIZONTAL); data.horizontalSpan = 2; authGroup.setLayoutData(data); layout = new GridLayout(); layout.numColumns = 2; layout.verticalSpacing = 12; authGroup.setLayout(layout); authGroup.setText(SVNUIMessages.ProxyComposite_Authentication); //Username and password inner group Composite inner = new Composite(authGroup, SWT.FILL); layout = new GridLayout(); layout.numColumns = 2; layout.marginHeight = layout.marginWidth = 0; inner.setLayout(layout); data = new GridData(GridData.FILL_HORIZONTAL); data.horizontalSpan = 2; inner.setLayoutData(data); description = new Label(inner, SWT.NULL); data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); description.setLayoutData(data); description.setText(SVNUIMessages.ProxyComposite_Username); this.userHistory = new UserInputHistory(ProxyComposite.USER_HISTORY_NAME); this.usernameText = new Combo(inner, SWT.DROP_DOWN); data = new GridData(GridData.FILL_HORIZONTAL); data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH; this.usernameText.setLayoutData(data); this.usernameText.setVisibleItemCount(this.userHistory.getDepth()); this.usernameText.setItems(this.userHistory.getHistory()); this.usernameText.setText(this.getUsername()); description = new Label(inner, SWT.NULL); description.setText(SVNUIMessages.ProxyComposite_Password); data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); description.setLayoutData(data); this.passwordText = new Text(inner, SWT.PASSWORD | SWT.BORDER); data = new GridData(GridData.FILL_HORIZONTAL); data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH; this.passwordText.setLayoutData(data); }
From source file:org.eclipse.team.svn.ui.composite.ReportingComposite.java
License:Open Source License
private void createControls(String optionName, IValidationManager manager, boolean doNotValidateComment) { GridLayout layout = null;//ww w. jav a2 s . c o m GridData data = null; layout = new GridLayout(); layout.marginWidth = layout.marginHeight = 0; layout.numColumns = 2; this.setLayout(layout); if (this.providers.length > 1 || this.reporter == null) { Label description1 = new Label(this, SWT.NONE); data = new GridData(); description1.setLayoutData(data); description1.setText(SVNUIMessages.ReportingComposite_Product); this.providersCombo = new Combo(this, SWT.BORDER | SWT.READ_ONLY); data = new GridData(GridData.FILL_HORIZONTAL); this.providersCombo.setLayoutData(data); Arrays.sort(this.providers, new Comparator() { public int compare(Object arg0, Object arg1) { IReportingDescriptor first = (IReportingDescriptor) arg0; IReportingDescriptor second = (IReportingDescriptor) arg1; return first.getProductName().compareTo(second.getProductName()); } }); String[] names = new String[this.providers.length]; for (int i = 0; i < this.providers.length; i++) { names[i] = this.providers[i].getProductName(); } this.providersCombo.setItems(names); this.providersCombo.select(0); this.providersCombo.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { int selectedProviderIdx = ReportingComposite.this.providersCombo.getSelectionIndex(); ReportingComposite.this.setReporter(selectedProviderIdx); } }); } this.mailHistory = new UserInputHistory(ReportingComposite.MAIL_HISTORY, 1); this.userNameHistory = new UserInputHistory(ReportingComposite.USER_NAME_HISTORY, 1); String[] mailName = this.mailHistory.getHistory(); if (this.providers.length > 1 || this.reporter != null && !this.reporter.isCustomEditorSupported() || this.reporter == null) { Label description = new Label(this, SWT.WRAP); data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER); data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH; data.heightHint = DefaultDialog.convertHeightInCharsToPixels(this, this.isError ? 4 : 3); data.horizontalSpan = 2; description.setLayoutData(data); description.setText(this.isError ? SVNUIMessages.ReportingComposite_ErrorHint : SVNUIMessages.ReportingComposite_Hint); Label description2 = new Label(this, SWT.NONE); data = new GridData(); description2.setLayoutData(data); description2.setText(SVNUIMessages.ReportingComposite_EMail); this.emailText = new Text(this, SWT.BORDER); data = new GridData(GridData.FILL_HORIZONTAL); this.emailText.setLayoutData(data); this.emailText.setFocus(); if (mailName != null && mailName.length > 0) { this.emailText.setText(mailName[0]); } Label description3 = new Label(this, SWT.NONE); data = new GridData(); description3.setLayoutData(data); description3.setText(SVNUIMessages.ReportingComposite_Name); this.nameText = new Text(this, SWT.BORDER); data = new GridData(GridData.FILL_HORIZONTAL); this.nameText.setLayoutData(data); String[] userName = this.userNameHistory.getHistory(); if (userName != null && userName.length > 0) { this.nameText.setText(userName[0]); } Label commentLabel = new Label(this, SWT.LEFT); data = new GridData(); data.horizontalSpan = 2; commentLabel.setLayoutData(data); commentLabel.setText(SVNUIMessages.ReportingComposite_Comment); this.commentText = new Text(this, SWT.MULTI | SWT.V_SCROLL | SWT.BORDER | SWT.WRAP); data = new GridData(GridData.FILL_BOTH); data.heightHint = 100; data.horizontalSpan = 2; this.commentText.setLayoutData(data); if (mailName != null && mailName.length > 0) { this.commentText.setFocus(); } if (manager != null) { manager.attachTo(this.commentText, new AbstractVerifier() { protected String getWarningMessage(Control input) { return null; } protected String getErrorMessage(Control input) { if (ReportingComposite.this.getReporter() == null) { return SVNUIMessages.ReportingComposite_Product_Verifier; } return null; } }); if (!doNotValidateComment) { manager.attachTo(this.commentText, new NonEmptyFieldVerifier(SVNUIMessages.ReportingComposite_Comment_Verifier)); } } } Composite buttonsComposite = new Composite(this, SWT.NONE); layout = new GridLayout(); layout.marginWidth = layout.marginHeight = 0; layout.verticalSpacing = 0; layout.numColumns = 2; buttonsComposite.setLayout(layout); data = new GridData(GridData.FILL_HORIZONTAL); data.horizontalSpan = 2; buttonsComposite.setLayoutData(data); this.doNotShowAgainButton = new Button(buttonsComposite, SWT.CHECK); data = new GridData(GridData.FILL_HORIZONTAL); this.doNotShowAgainButton.setLayoutData(data); this.doNotShowAgainButton.setSelection(false); if (optionName != null) { this.doNotShowAgainButton.setText(optionName); } else { this.doNotShowAgainButton.setVisible(false); } if (this.providers.length > 1 || this.reporter != null && !this.reporter.isCustomEditorSupported() || this.reporter == null) { this.previewButton = new Button(buttonsComposite, SWT.PUSH); data = new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.FILL_HORIZONTAL); this.previewButton.setText(SVNUIMessages.ReportingComposite_Preview); data.widthHint = DefaultDialog.computeButtonWidth(this.previewButton); this.previewButton.setLayoutData(data); this.previewButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { String name = ReportingComposite.this.nameText.getText().trim(); String email = ReportingComposite.this.emailText.getText().trim(); ReportingComposite.this.reporter.setUserName(name); ReportingComposite.this.reporter.setUserEMail(email); ReportingComposite.this.reporter .setUserComment(ReportingComposite.this.commentText.getText().trim()); ReportingComposite.this.reporter.buildReport(); PreviewReportPanel panel = null; if (ReportingComposite.this.isError) { panel = new PreviewErrorReportPanel(ReportingComposite.this.reporter.buildReport()); } else { String msg = SVNUIMessages.format(SVNUIMessages.ReportingComposite_Preview_Title, new String[] { ReportingComposite.this.reportType }); panel = new PreviewReportPanel(msg, ReportingComposite.this.reporter.buildReport()); } DefaultDialog dialog = new DefaultDialog(UIMonitorUtility.getDisplay().getActiveShell(), panel); dialog.open(); } }); } this.setEnablement(); }
From source file:org.eclipse.team.svn.ui.composite.RepositoryPropertiesComposite.java
License:Open Source License
public void initialize() { GridLayout layout = null;//from w ww . j a va2 s . com GridData data = null; layout = new GridLayout(); layout.marginHeight = 7; layout.verticalSpacing = 3; this.setLayout(layout); data = new GridData(GridData.FILL_BOTH); this.setLayoutData(data); Composite rootURLGroup = new Composite(this, SWT.NULL); layout = new GridLayout(); layout.numColumns = 3; layout.marginHeight = 0; layout.marginWidth = 0; rootURLGroup.setLayout(layout); data = new GridData(GridData.FILL_HORIZONTAL); data.grabExcessHorizontalSpace = true; rootURLGroup.setLayoutData(data); Label description = new Label(rootURLGroup, SWT.NULL); data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); description.setLayoutData(data); description.setText(SVNUIMessages.RepositoryPropertiesComposite_URL); this.urlHistory = new UserInputHistory(RepositoryPropertiesComposite.URL_HISTORY_NAME); this.url = new Combo(rootURLGroup, SWT.DROP_DOWN); data = new GridData(GridData.FILL_HORIZONTAL); data.grabExcessHorizontalSpace = true; data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH; this.url.setLayoutData(data); this.url.setVisibleItemCount(this.urlHistory.getDepth()); this.url.setItems(this.urlHistory.getHistory()); this.urlVerifier = new CompositeVerifier() { public boolean verify(Control input) { boolean retVal = super.verify(input); RepositoryPropertiesComposite.this.browse.setEnabled(retVal); return retVal; } }; this.defineUrlVerifier(null); this.validationManager.attachTo(this.url, this.urlVerifier); this.browse = new Button(rootURLGroup, SWT.PUSH); this.browse.setText(SVNUIMessages.Button_Browse); data = new GridData(GridData.HORIZONTAL_ALIGN_END); data.widthHint = DefaultDialog.computeButtonWidth(this.browse); this.browse.setLayoutData(data); this.browse.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { SVNRemoteStorage storage = SVNRemoteStorage.instance(); IRepositoryLocation location = storage.newRepositoryLocation(); location.setUrl(RepositoryPropertiesComposite.this.getLocationUrl()); location.setLabel(RepositoryPropertiesComposite.this.getLocationUrl()); location.setPassword(RepositoryPropertiesComposite.this.provider.getPassword()); location.setUsername(RepositoryPropertiesComposite.this.provider.getUsername()); location.setPasswordSaved(RepositoryPropertiesComposite.this.provider.isPasswordSaved()); SSHSettings sshNew = location.getSSHSettings(); SSHSettings sshOriginal = RepositoryPropertiesComposite.this.provider.getSSHSettings(); sshNew.setPassPhrase(sshOriginal.getPassPhrase()); sshNew.setPassPhraseSaved(sshOriginal.isPassPhraseSaved()); sshNew.setPort(sshOriginal.getPort()); sshNew.setPrivateKeyPath(sshOriginal.getPrivateKeyPath()); sshNew.setUseKeyFile(sshOriginal.isUseKeyFile()); SSLSettings sslOriginal = location.getSSLSettings(); SSLSettings sslNew = RepositoryPropertiesComposite.this.provider.getSSLSettings(); sslNew.setAuthenticationEnabled(sslOriginal.isAuthenticationEnabled()); sslNew.setCertificatePath(sslOriginal.getCertificatePath()); sslNew.setPassPhrase(sslOriginal.getPassPhrase()); sslNew.setPassPhraseSaved(sslOriginal.isPassPhraseSaved()); RepositoryTreePanel panel = new RepositoryTreePanel( SVNUIMessages.RepositoryPropertiesComposite_SelectNewURL, SVNUIMessages.RepositoryBrowsingPanel_Description, SVNUIMessages.RepositoryBrowsingPanel_Message, null, true, location, false); panel.setAutoExpandFirstLevel(true); DefaultDialog browser = new DefaultDialog(RepositoryPropertiesComposite.this.getShell(), panel); if (browser.open() == 0) { if (panel.getSelectedResource() != null) { String newUrl = panel.getSelectedResource().getUrl(); RepositoryPropertiesComposite.this.url.setText(newUrl); } RepositoryPropertiesComposite.this.provider.setUsername(location.getUsername()); RepositoryPropertiesComposite.this.provider.setPassword(location.getPassword()); RepositoryPropertiesComposite.this.provider.setPasswordSaved(location.isPasswordSaved()); sshNew = RepositoryPropertiesComposite.this.provider.getSSHSettings(); sshOriginal = location.getSSHSettings(); sshNew.setPassPhrase(sshOriginal.getPassPhrase()); sshNew.setPassPhraseSaved(sshOriginal.isPassPhraseSaved()); sshNew.setPort(sshOriginal.getPort()); sshNew.setPrivateKeyPath(sshOriginal.getPrivateKeyPath()); sshNew.setUseKeyFile(sshOriginal.isUseKeyFile()); sslOriginal = RepositoryPropertiesComposite.this.provider.getSSLSettings(); sslNew = location.getSSLSettings(); sslNew.setAuthenticationEnabled(sslOriginal.isAuthenticationEnabled()); sslNew.setCertificatePath(sslOriginal.getCertificatePath()); sslNew.setPassPhrase(sslOriginal.getPassPhrase()); sslNew.setPassPhraseSaved(sslOriginal.isPassPhraseSaved()); RepositoryPropertiesComposite.this.provider.commit(); } } }); Group labelGroup = new Group(this, SWT.NONE); data = new GridData(GridData.FILL_HORIZONTAL); data.grabExcessHorizontalSpace = true; data.horizontalSpan = 2; layout = new GridLayout(); labelGroup.setLayout(layout); labelGroup.setLayoutData(data); labelGroup.setText(SVNUIMessages.RepositoryPropertiesComposite_Label); this.useLocationButton = new Button(labelGroup, SWT.RADIO); this.useLocationButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); this.useLocationButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { RepositoryPropertiesComposite.this.validationManager.validateContent(); Button button = (Button) e.widget; RepositoryPropertiesComposite.this.repositoryLabel.setEnabled(!button.getSelection()); if (!button.getSelection()) { RepositoryPropertiesComposite.this.repositoryLabel.selectAll(); } else { RepositoryPropertiesComposite.this.repositoryLabel.setText(""); //$NON-NLS-1$ } } }); this.useLocationButton.setText(SVNUIMessages.RepositoryPropertiesComposite_UseURL); this.newLabelButton = new Button(labelGroup, SWT.RADIO); this.newLabelButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); this.newLabelButton.setText(SVNUIMessages.RepositoryPropertiesComposite_UseCustom); this.repositoryLabel = new Text(labelGroup, SWT.SINGLE | SWT.BORDER); data = new GridData(GridData.FILL_HORIZONTAL); data.grabExcessHorizontalSpace = true; data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH; this.repositoryLabel.setLayoutData(data); this.validationManager.attachTo(this.repositoryLabel, new AbstractVerifierProxy( new NonEmptyFieldVerifier(SVNUIMessages.RepositoryPropertiesComposite_UseCustom_Verifier)) { protected boolean isVerificationEnabled(Control input) { return RepositoryPropertiesComposite.this.newLabelButton.getSelection(); } }); this.repositoryLabel.setEnabled(false); this.credentialsComposite = new CredentialsComposite(this, SWT.NONE); this.credentialsComposite.initialize(); this.url.setFocus(); this.resetChanges(); }
From source file:org.eclipse.team.svn.ui.composite.RepositoryResourceOnlySelectionComposite.java
License:Open Source License
private void createControls() { GridLayout layout = null;/*www . ja va2 s . c o m*/ GridData data = null; layout = new GridLayout(); layout.numColumns = 2; layout.marginHeight = layout.marginWidth = 0; this.setLayout(layout); Label urlLabel = new Label(this, SWT.NONE); urlLabel.setLayoutData(new GridData()); urlLabel.setText(SVNUIMessages.getString(this.comboId)); Composite select = new Composite(this, SWT.NONE); layout = new GridLayout(); layout.numColumns = 2; layout.marginHeight = 0; layout.marginWidth = 0; select.setLayout(layout); data = new GridData(GridData.FILL_HORIZONTAL); select.setLayoutData(data); this.urlText = new Combo(select, SWT.NULL); data = new GridData(GridData.FILL_HORIZONTAL); data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH; this.urlText.setLayoutData(data); this.urlText.setVisibleItemCount(this.urlHistory.getDepth()); this.urlText.setItems(this.urlHistory.getHistory()); if (this.baseResource != null) { this.urlText.setText(this.baseResource.getUrl()); } this.url = this.urlText.getText(); Listener urlTextListener = new Listener() { public void handleEvent(Event e) { RepositoryResourceOnlySelectionComposite.this.url = ((Combo) e.widget).getText(); } }; this.urlText.addListener(SWT.Selection, urlTextListener); this.urlText.addListener(SWT.Modify, urlTextListener); this.verifier = new CompositeVerifier(); this.verifier.add(new NonEmptyFieldVerifier(SVNUIMessages.getString(this.comboId + "_Verifier"))); //$NON-NLS-1$ this.verifier.add(new URLVerifier(SVNUIMessages.getString(this.comboId + "_Verifier")) { //$NON-NLS-1$ protected String getErrorMessage(Control input) { String error = super.getErrorMessage(input); if (RepositoryResourceOnlySelectionComposite.this.baseResource != null && error == null) { String url = this.getText(input); if (RepositoryResourceOnlySelectionComposite.this .getDestination(SVNUtility.asEntryReference(url), true) == null) { error = SVNUIMessages.format( SVNUIMessages.RepositoryResourceOnlySelectionComposite_URL_Verifier_Error, new String[] { url, RepositoryResourceOnlySelectionComposite.this.baseResource .getRepositoryLocation().getUrl() }); } //check that resource starts with location if (error == null && RepositoryResourceOnlySelectionComposite.this.isMatchToBaseResource) { String baseResourceUrl = RepositoryResourceOnlySelectionComposite.this.baseResource .getUrl(); if (!url.startsWith(baseResourceUrl)) { error = SVNUIMessages.format( SVNUIMessages.RepositoryResourceOnlySelectionComposite_URL_Verifier_Error, new String[] { url, baseResourceUrl }); } } } return error; } }); this.verifier.add(new AbsolutePathVerifier(this.comboId)); this.validationManager.attachTo(this.urlText, this.verifier); this.browse = new Button(select, SWT.PUSH); this.browse.setText(SVNUIMessages.Button_Browse); data = new GridData(); data.widthHint = DefaultDialog.computeButtonWidth(this.browse); this.browse.setLayoutData(data); this.browse.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { RepositoryTreePanel panel = new RepositoryTreePanel( SVNUIMessages.RepositoryResourceOnlySelectionComposite_Select_Title, RepositoryResourceOnlySelectionComposite.this.selectionTitle, RepositoryResourceOnlySelectionComposite.this.selectionDescription, null, true, RepositoryResourceOnlySelectionComposite.this.baseResource, false); panel.setAllowFiles(!RepositoryResourceOnlySelectionComposite.this.foldersOnly); DefaultDialog browser = new DefaultDialog(RepositoryResourceOnlySelectionComposite.this.getShell(), panel); if (browser.open() == 0) { IRepositoryResource selectedResource = panel.getSelectedResource(); boolean samePeg = RepositoryResourceOnlySelectionComposite.this.baseResource != null && selectedResource.getPegRevision().equals( RepositoryResourceOnlySelectionComposite.this.baseResource.getPegRevision()); RepositoryResourceOnlySelectionComposite.this.urlText .setText(samePeg ? selectedResource.getUrl() : SVNUtility.getEntryReference(selectedResource).toString()); RepositoryResourceOnlySelectionComposite.this.validationManager.validateContent(); } } }); }
From source file:org.eclipse.team.svn.ui.composite.RepositoryResourceSelectionComposite.java
License:Open Source License
private void createControls(int defaultTextType) { GridLayout layout = null;//from www. j av a 2 s.c om GridData data = null; layout = new GridLayout(); layout.numColumns = 2; layout.marginHeight = layout.marginWidth = 0; this.setLayout(layout); Label urlLabel = new Label(this, SWT.NONE); urlLabel.setLayoutData(new GridData()); urlLabel.setText(SVNUIMessages.getString(this.comboId)); Composite select = new Composite(this, SWT.NONE); layout = new GridLayout(); layout.numColumns = 2; layout.marginHeight = 0; layout.marginWidth = 0; select.setLayout(layout); data = new GridData(GridData.FILL_HORIZONTAL); select.setLayoutData(data); this.urlText = new Combo(select, SWT.NULL); data = new GridData(GridData.FILL_HORIZONTAL); data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH; this.urlText.setLayoutData(data); this.urlText.setVisibleItemCount(this.urlHistory.getDepth()); this.urlText.setItems(this.urlHistory.getHistory()); if (defaultTextType == RepositoryResourceSelectionComposite.TEXT_BASE && this.baseResource != null) { this.urlText.setText(this.baseResource.getUrl()); } else if (defaultTextType == RepositoryResourceSelectionComposite.TEXT_LAST && this.urlText.getItemCount() > 0) { this.urlText.select(0); } this.url = this.urlText.getText(); Listener urlTextListener = new Listener() { public void handleEvent(Event e) { RepositoryResourceSelectionComposite.this.url = ((Combo) e.widget).getText(); if (RepositoryResourceSelectionComposite.this.isSelectionAvailable()) { RepositoryResourceSelectionComposite.this.revisionComposite .setSelectedResource(RepositoryResourceSelectionComposite.this.getSelectedResource()); boolean toFilter = RepositoryResourceSelectionComposite.this.toFilterCurrent && RepositoryResourceSelectionComposite.this.baseResource != null && (RepositoryResourceSelectionComposite.this.getSelectedResource().getUrl() .equals(RepositoryResourceSelectionComposite.this.baseResource.getUrl()) || RepositoryResourceSelectionComposite.this.getSelectedResource().getUrl() .equals(RepositoryResourceSelectionComposite.this.baseResource.getUrl() + "/")); //$NON-NLS-1$ RepositoryResourceSelectionComposite.this.revisionComposite.setFilterCurrent(toFilter); if (RepositoryResourceSelectionComposite.this.secondRevisionComposite != null) { RepositoryResourceSelectionComposite.this.secondRevisionComposite.setSelectedResource( RepositoryResourceSelectionComposite.this.getSecondSelectedResource()); RepositoryResourceSelectionComposite.this.secondRevisionComposite .setFilterCurrent(toFilter); } } } }; this.urlText.addListener(SWT.Modify, urlTextListener); this.urlText.addListener(SWT.Selection, urlTextListener); this.verifier = new CompositeVerifier() { protected void fireError(String errorReason) { RepositoryResourceSelectionComposite.this.revisionComposite.setEnabled(false); if (RepositoryResourceSelectionComposite.this.secondRevisionComposite != null) { RepositoryResourceSelectionComposite.this.secondRevisionComposite.setEnabled(false); } super.fireError(errorReason); } protected void fireOk() { RepositoryResourceSelectionComposite.this.revisionComposite.setEnabled(true); if (RepositoryResourceSelectionComposite.this.secondRevisionComposite != null) { RepositoryResourceSelectionComposite.this.secondRevisionComposite.setEnabled(true); } super.fireOk(); } }; this.verifier.add(new NonEmptyFieldVerifier(SVNUIMessages.getString(this.comboId + "_Verifier"))); //$NON-NLS-1$ this.verifier.add(new URLVerifier(SVNUIMessages.getString(this.comboId + "_Verifier")) { //$NON-NLS-1$ protected String getErrorMessage(Control input) { String error = super.getErrorMessage(input); if (RepositoryResourceSelectionComposite.this.baseResource != null && error == null) { String url = this.getText(input); if (RepositoryResourceSelectionComposite.this.getDestination(SVNUtility.asEntryReference(url), true) == null) { error = SVNUIMessages.format( SVNUIMessages.RepositoryResourceSelectionComposite_URL_Verifier_Error, new String[] { url, RepositoryResourceSelectionComposite.this.baseResource .getRepositoryLocation().getUrl() }); } } return error; } }); this.verifier.add(new AbsolutePathVerifier(this.comboId)); this.validationManager.attachTo(this.urlText, this.verifier); this.browse = new Button(select, SWT.PUSH); this.browse.setText(SVNUIMessages.Button_Browse); data = new GridData(); data.widthHint = DefaultDialog.computeButtonWidth(this.browse); this.browse.setLayoutData(data); this.browse.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { RepositoryTreePanel panel = new RepositoryTreePanel( SVNUIMessages.RepositoryResourceSelectionComposite_Select_Title, RepositoryResourceSelectionComposite.this.selectionTitle, RepositoryResourceSelectionComposite.this.selectionDescription, RepositoryResourceSelectionComposite.this.baseResource == null ? new IRepositoryResource[0] : new IRepositoryResource[] { RepositoryResourceSelectionComposite.this.getSelectedResource() }, true, true); panel.setAllowFiles(!RepositoryResourceSelectionComposite.this.foldersOnly); DefaultDialog browser = new DefaultDialog(RepositoryResourceSelectionComposite.this.getShell(), panel); if (browser.open() == 0) { IRepositoryResource selectedResource = panel.getSelectedResource(); boolean samePeg = RepositoryResourceSelectionComposite.this.baseResource != null && selectedResource.getPegRevision().equals( RepositoryResourceSelectionComposite.this.baseResource.getPegRevision()); RepositoryResourceSelectionComposite.this.urlText.setText(samePeg ? selectedResource.getUrl() : SVNUtility.getEntryReference(selectedResource).toString()); RepositoryResourceSelectionComposite.this.revisionComposite .setSelectedResource(selectedResource); if (RepositoryResourceSelectionComposite.this.secondRevisionComposite != null) { RepositoryResourceSelectionComposite.this.secondRevisionComposite .setSelectedResource(selectedResource); } RepositoryResourceSelectionComposite.this.validationManager.validateContent(); } } }); Composite revisions = new Composite(this, SWT.NONE); layout = new GridLayout(); layout.marginHeight = layout.marginWidth = 0; layout.numColumns = 2; revisions.setLayout(layout); data = new GridData(GridData.FILL_HORIZONTAL); data.horizontalSpan = 2; revisions.setLayoutData(data); String revTitle = SVNUIMessages.RevisionComposite_Revision; if (this.mode == MODE_TWO) { revTitle = SVNUIMessages.RepositoryResourceSelectionComposite_StartRevision; } else if (this.mode == MODE_CHECK) { revTitle = SVNUIMessages.RevisionComposite_Revisions; } String revHeadName = this.mode == MODE_CHECK ? SVNUIMessages.RevisionComposite_All : SVNUIMessages.RevisionComposite_HeadRevision; this.revisionComposite = new RevisionComposite(revisions, this.validationManager, this.stopOnCopy, new String[] { revTitle, revHeadName }, SVNRevision.HEAD, this.mode == MODE_CHECK) { public void additionalValidation() { RepositoryResourceSelectionComposite.this.validateRevisions(); } }; data = new GridData(GridData.FILL_HORIZONTAL); data.horizontalSpan = this.mode == MODE_TWO ? 1 : 2; this.revisionComposite.setLayoutData(data); this.revisionComposite.setBaseResource(this.baseResource); if (this.baseResource != null) { this.revisionComposite.setSelectedResource(this.getSelectedResource()); } if (this.mode == MODE_TWO) { this.secondRevisionComposite = new RevisionComposite(revisions, this.validationManager, this.stopOnCopy, new String[] { SVNUIMessages.RepositoryResourceSelectionComposite_StopRevision, SVNUIMessages.RepositoryResourceSelectionComposite_HeadRevision }, SVNRevision.HEAD, false) { public void additionalValidation() { RepositoryResourceSelectionComposite.this.validateRevisions(); } }; data = new GridData(GridData.FILL_HORIZONTAL); this.secondRevisionComposite.setLayoutData(data); this.secondRevisionComposite.setBaseResource(this.baseResource); this.secondRevisionComposite.setSelectedResource(this.getSelectedResource()); } }
From source file:org.eclipse.team.svn.ui.composite.RepositoryRootsComposite.java
License:Open Source License
protected Text createControl(Composite standardLocations, String id) { Label label = new Label(standardLocations, SWT.NONE); GridData data = new GridData(); label.setLayoutData(data);// w w w .j a v a2 s . co m label.setText(SVNUIMessages.getString(id)); Text field = new Text(standardLocations, SWT.SINGLE | SWT.BORDER); data = new GridData(GridData.FILL_HORIZONTAL); data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH; field.setLayoutData(data); String name = SVNUIMessages.getString(id + "_Verifier"); //$NON-NLS-1$ CompositeVerifier verifier = new CompositeVerifier(); verifier.add(new ResourceNameVerifier(name, false)); verifier.add(new NonEmptyFieldVerifier(name)); verifier.add(new AbsolutePathVerifier(name)); this.validationManager.attachTo(field, new AbstractVerifierProxy(verifier) { protected boolean isVerificationEnabled(Control input) { return RepositoryRootsComposite.this.structureCheckBox.getSelection(); } }); return field; }
From source file:org.eclipse.team.svn.ui.composite.SecurityWarningComposite.java
License:Open Source License
protected void init() { GridLayout layout = new GridLayout(); layout.numColumns = 1;/*from w w w . j a v a2 s . c om*/ layout.marginHeight = layout.marginWidth = 0; this.setLayout(layout); this.setLayoutData(new GridData(GridData.FILL_BOTH)); Link link = new Link(this, SWT.WRAP); link.setText(SVNUIMessages.SecurityWarningComposite_Message); link.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { String pageId = "org.eclipse.equinox.security.ui.storage"; //$NON-NLS-1$ PreferencesUtil.createPreferenceDialogOn(null, pageId, new String[] { pageId }, null).open(); } }); GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER); data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH; Dialog.applyDialogFont(link); data.heightHint = DefaultDialog.convertHeightInCharsToPixels(link, 2); link.setLayoutData(data); }
From source file:org.eclipse.team.svn.ui.composite.SSHComposite.java
License:Open Source License
public void initialize() { GridLayout layout = null;/*from ww w. ja va 2 s. com*/ GridData data = null; layout = new GridLayout(); layout.marginHeight = 7; layout.verticalSpacing = 3; this.setLayout(layout); data = new GridData(GridData.FILL_BOTH); this.setLayoutData(data); Composite sshGroup = new Composite(this, SWT.NONE); data = new GridData(GridData.FILL_HORIZONTAL); layout = new GridLayout(); layout.numColumns = 2; layout.makeColumnsEqualWidth = false; layout.marginWidth = 0; layout.marginHeight = 0; sshGroup.setLayout(layout); sshGroup.setLayoutData(data); Label lblPort = new Label(sshGroup, SWT.NONE); lblPort.setText(SVNUIMessages.SSHComposite_Port); this.portText = new Text(sshGroup, SWT.BORDER); data = new GridData(GridData.FILL_HORIZONTAL); this.portText.setLayoutData(data); CompositeVerifier verifier = new CompositeVerifier(); String name = SVNUIMessages.SSHComposite_Port_Verifier; verifier.add(new NonEmptyFieldVerifier(name)); verifier.add(new ProxyPortVerifier(name)); this.portText.setText(String.valueOf(SSHSettings.SSH_PORT_DEFAULT)); this.validationManager.attachTo(this.portText, new AbstractVerifierProxy(verifier) { protected boolean isVerificationEnabled(Control input) { return SSHComposite.this.isVisible(); } }); Group passGroup = new Group(this, SWT.NONE); data = new GridData(GridData.FILL_HORIZONTAL); layout = new GridLayout(); layout.verticalSpacing = 12; passGroup.setLayout(layout); passGroup.setLayoutData(data); passGroup.setText(SVNUIMessages.SSHComposite_Authentication); Composite inner = new Composite(passGroup, SWT.NONE); layout = new GridLayout(); layout.marginHeight = layout.marginWidth = 0; inner.setLayout(layout); data = new GridData(GridData.FILL_HORIZONTAL); data.horizontalSpan = 2; inner.setLayoutData(data); this.passwordRadioButton = new Button(inner, SWT.RADIO); data = new GridData(GridData.BEGINNING); this.passwordRadioButton.setLayoutData(data); this.passwordRadioButton.setText(SVNUIMessages.SSHComposite_Password); this.passwordRadioButton.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { SSHComposite.this.refreshControlsEnablement(); } public void widgetDefaultSelected(SelectionEvent e) { } }); this.privateKeyRadioButton = new Button(inner, SWT.RADIO); data = new GridData(); this.privateKeyRadioButton.setLayoutData(data); this.privateKeyRadioButton.setText(SVNUIMessages.SSHComposite_PrivateKey); this.privateKeyRadioButton.setSelection(false); Composite groupInner = new Composite(inner, SWT.FILL); layout = new GridLayout(); layout.numColumns = 2; layout.marginHeight = layout.marginWidth = 0; groupInner.setLayout(layout); data = new GridData(GridData.FILL_HORIZONTAL); groupInner.setLayoutData(data); Label description = new Label(groupInner, SWT.NULL); description.setText(SVNUIMessages.SSHComposite_File); data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); description.setLayoutData(data); Composite privateKeyFileComposite = new Composite(groupInner, SWT.NONE); data = new GridData(GridData.FILL_HORIZONTAL); layout = new GridLayout(); layout.marginHeight = layout.marginWidth = 0; layout.numColumns = 2; privateKeyFileComposite.setLayout(layout); privateKeyFileComposite.setLayoutData(data); this.privateKeyFileText = new Text(privateKeyFileComposite, SWT.BORDER); data = new GridData(GridData.FILL_HORIZONTAL); data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH; this.privateKeyFileText.setLayoutData(data); this.validationManager.attachTo(this.privateKeyFileText, new AbstractVerifierProxy( new ExistingResourceVerifier(SVNUIMessages.SSHComposite_File_Verifier, true)) { protected boolean isVerificationEnabled(Control input) { return SSHComposite.this.privateKeyRadioButton.getSelection() && SSHComposite.this.isVisible(); } }); this.browseButton = new Button(privateKeyFileComposite, SWT.PUSH); this.browseButton.setText(SVNUIMessages.Button_Browse); data = new GridData(GridData.HORIZONTAL_ALIGN_END); data.widthHint = DefaultDialog.computeButtonWidth(this.browseButton); this.browseButton.setLayoutData(data); this.browseButton.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { FileDialog fileDialog = new FileDialog(SSHComposite.this.getShell(), SWT.OPEN); String res = fileDialog.open(); if (res != null) { SSHComposite.this.privateKeyFileText.setText(res); SSHComposite.this.validationManager.validateContent(); } } }); description = new Label(groupInner, SWT.NULL); description.setText(SVNUIMessages.SSHComposite_Passphrase); data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); description.setLayoutData(data); this.passphraseText = new Text(groupInner, SWT.BORDER | SWT.PASSWORD); data = new GridData(GridData.FILL_HORIZONTAL); data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH; this.passphraseText.setLayoutData(data); Composite savePassphrase = new Composite(passGroup, SWT.FILL); layout = new GridLayout(); layout.marginHeight = layout.marginWidth = 0; savePassphrase.setLayout(layout); data = new GridData(GridData.FILL_HORIZONTAL); data.horizontalSpan = 2; savePassphrase.setLayoutData(data); this.savePassphraseCheckBox = new Button(savePassphrase, SWT.CHECK); this.savePassphraseCheckBox.setText(SVNUIMessages.SSHComposite_SavePassphrase); new SecurityWarningComposite(savePassphrase); }