diff options
Diffstat (limited to 'examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLCompareEditCopyIdMapDialog.java')
-rw-r--r-- | examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLCompareEditCopyIdMapDialog.java | 116 |
1 files changed, 0 insertions, 116 deletions
diff --git a/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLCompareEditCopyIdMapDialog.java b/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLCompareEditCopyIdMapDialog.java deleted file mode 100644 index 5e31919ec..000000000 --- a/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLCompareEditCopyIdMapDialog.java +++ /dev/null @@ -1,116 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.compare.examples.xml; - -import java.util.HashMap; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.*; - -import org.eclipse.compare.examples.xml.ui.StatusDialog; -import org.eclipse.compare.examples.xml.ui.StatusInfo; - -/** - * This class is used to create an editable ID Mapping Scheme from an internal ID Mappping Scheme - */ -public class XMLCompareEditCopyIdMapDialog extends StatusDialog { - - private HashMap fIdMaps; - private HashMap fIdMapsInternal; - - private Text fIdMapText; - private String fResult; - - /* - * Constructs a new edit copy mapping dialog. - */ - public XMLCompareEditCopyIdMapDialog(Shell parent, IdMap idmap, HashMap idmaps, HashMap idmapsInternal) { - super(parent); - - setTitle(XMLCompareMessages.getString("XMLCompareEditCopyIdMapDialog.title")); //$NON-NLS-1$ - - fIdMaps= idmaps; - fIdMapsInternal= idmapsInternal; - } - - public String getResult() { - return fResult; - } - - /** - * Creates and returns the contents of the upper part - * of the dialog (above the button bar). - * - * Subclasses should override. - * - * @param ancestor the parent composite to contain the dialog area - * @return the dialog area control - */ - protected Control createDialogArea(Composite ancestor) { - Composite composite= (Composite) super.createDialogArea(ancestor); - - Label comment= new Label(composite, SWT.NONE); - comment.setText(XMLCompareMessages.getString("XMLCompareEditCopyIdMapDialog.comment")); //$NON-NLS-1$ - GridData data= new GridData(); - data.horizontalAlignment= GridData.FILL; - data.verticalAlignment= GridData.BEGINNING; - comment.setLayoutData(data); - - Composite inner= new Composite(composite, SWT.NONE); - GridLayout layout= new GridLayout(); - layout.numColumns= 2; - inner.setLayout(layout); - inner.setLayoutData(new GridData(GridData.FILL_BOTH)); - - Label label= new Label(inner, SWT.NULL); - label.setText(XMLCompareMessages.getString("XMLCompareEditCopyIdMapDialog.label")); //$NON-NLS-1$ - label.setLayoutData(new GridData()); - - fIdMapText= new Text(inner, SWT.BORDER); - fIdMapText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - fIdMapText.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e){ - doValidation(); - } - }); - - fIdMapText.setFocus(); - - return composite; - } - - /** - * Validate user input - */ - private void doValidation() { - StatusInfo status= new StatusInfo(); - String newText= fIdMapText.getText(); - if (newText.length() == 0) - status.setError(XMLCompareMessages.getString("XMLCompareEditCopyIdMapDialog.error.noname")); //$NON-NLS-1$ - else if (XMLComparePreferencePage.containsInvalidCharacters(newText)) - status.setError(XMLCompareMessages.getString("XMLCompareEditCopyIdMapDialog.error.invalidname")); //$NON-NLS-1$ - else if (fIdMaps.containsKey(newText) || fIdMapsInternal.containsKey(newText)) - status.setError(XMLCompareMessages.getString("XMLCompareEditCopyIdMapDialog.error.nameExists")); //$NON-NLS-1$ - updateStatus(status); - } - - /** - * Notifies that the ok button of this dialog has been pressed. - */ - protected void okPressed() { - fResult= fIdMapText.getText(); - super.okPressed(); - } -}
\ No newline at end of file |