diff options
Diffstat (limited to 'bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/dialogs/SelectXMLCatalogIdDialog.java')
-rw-r--r-- | bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/dialogs/SelectXMLCatalogIdDialog.java | 111 |
1 files changed, 0 insertions, 111 deletions
diff --git a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/dialogs/SelectXMLCatalogIdDialog.java b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/dialogs/SelectXMLCatalogIdDialog.java deleted file mode 100644 index 65cb8bd065..0000000000 --- a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/dialogs/SelectXMLCatalogIdDialog.java +++ /dev/null @@ -1,111 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ - - -package org.eclipse.wst.xml.ui.dialogs; - -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.wst.xml.uriresolver.XMLCatalog; -import org.eclipse.wst.xml.uriresolver.XMLCatalogEntry; -import org.eclipse.wst.xml.uriresolver.XMLCatalogPlugin; - - - -public class SelectXMLCatalogIdDialog extends Dialog { - protected String[] extensions; - protected Button okButton; - protected SelectXMLCatalogIdPanel panel; - protected String publicId; - protected String systemId; - - public SelectXMLCatalogIdDialog(Shell parentShell, String[] extensions) { - super(parentShell); - setShellStyle(getShellStyle() | SWT.RESIZE); - this.extensions = extensions; - } - - - protected void buttonPressed(int buttonId) { - if (buttonId == IDialogConstants.OK_ID) { - ISelection selection = panel.getTableViewer().getSelection(); - Object selectedObject = (selection instanceof IStructuredSelection) ? ((IStructuredSelection) selection).getFirstElement() : null; - - if (selectedObject instanceof XMLCatalogEntry) { - XMLCatalogEntry mappingInfo = (XMLCatalogEntry) selectedObject; - publicId = mappingInfo.getKey(); - systemId = computeDefaultSystemId(mappingInfo); - } - } - super.buttonPressed(buttonId); - } - - protected String computeDefaultSystemId(XMLCatalogEntry mappingInfo) { - String result = mappingInfo.getWebAddress(); - if (result == null && mappingInfo.getURI() != null) { - int index = mappingInfo.getURI().lastIndexOf("/"); //$NON-NLS-1$ - String lastSegment = index != -1 ? mappingInfo.getURI().substring(index + 1) : mappingInfo.getURI(); - result = lastSegment; - } - return result; - } - - protected void createButtonsForButtonBar(Composite parent) { - okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); - okButton.setEnabled(false); - createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); - } - - protected Control createDialogArea(Composite parent) { - Composite dialogArea = (Composite) super.createDialogArea(parent); - // TODO... SSE port - //WorkbenchHelp.setHelp(dialogArea, - // XMLCommonUIContextIds.XCUI_CATALOG_DIALOG); - - XMLCatalog xmlCatalog = XMLCatalogPlugin.getInstance().getDefaultXMLCatalog(); - panel = new SelectXMLCatalogIdPanel(dialogArea, xmlCatalog); - - ISelectionChangedListener listener = new ISelectionChangedListener() { - public void selectionChanged(SelectionChangedEvent event) { - updateButtonState(); - } - }; - panel.getTableViewer().setFilterExtensions(extensions); - panel.getTableViewer().addSelectionChangedListener(listener); - return dialogArea; - } - - - - public String getId() { - return publicId; - } - - public String getSystemId() { - return systemId; - } - - protected void updateButtonState() { - ISelection selection = panel.getTableViewer().getSelection(); - okButton.setEnabled(!selection.isEmpty()); - } -} |