Skip to main content

This CGIT instance is deprecated, and repositories have been moved to Gitlab or Github. See the repository descriptions for specific locations.

summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo')
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/AddExtensionsComponentDialog.java785
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/AddNewCategoryDialog.java385
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/CategoryProvider.java81
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/DOMExtensionDetailsContentProvider.java211
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/DOMExtensionItem.java226
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/DOMExtensionItemEditManager.java50
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/DOMExtensionItemMenuListener.java127
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/DOMExtensionTreeContentProvider.java83
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/DOMExtensionTreeLabelProvider.java88
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/ExtensionDetailsContentProvider.java19
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/ExtensionDetailsViewer.java334
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/ExtensionItem.java31
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/ExtensionItemEditManager.java32
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/ExtensionItemFilter.java28
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/ExtensionsSchemasRegistry.java330
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/SelectFromCatalogDialog.java212
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/SpecificationForExtensionsSchema.java219
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/XSDExtensionTreeContentProvider.java119
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/DefaultListNodeEditorConfiguration.java27
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/DialogNodeEditorConfiguration.java33
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/ListNodeEditorConfiguration.java35
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/NodeCustomizationRegistry.java157
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/NodeEditorConfiguration.java43
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/NodeEditorProvider.java18
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/NodeFilter.java21
25 files changed, 0 insertions, 3694 deletions
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/AddExtensionsComponentDialog.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/AddExtensionsComponentDialog.java
deleted file mode 100644
index 3b309bf7ee..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/AddExtensionsComponentDialog.java
+++ /dev/null
@@ -1,785 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.StringTokenizer;
-
-import org.apache.xerces.dom.DocumentImpl;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Cursor;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-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.Label;
-import org.eclipse.swt.widgets.MessageBox;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.SelectionDialog;
-import org.eclipse.wst.xsd.contentmodel.internal.XSDImpl;
-import org.eclipse.wst.xsd.ui.internal.common.util.Messages;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorCSHelpIds;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-import org.eclipse.xsd.XSDAttributeDeclaration;
-import org.eclipse.xsd.XSDElementDeclaration;
-import org.eclipse.xsd.XSDSchema;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-public class AddExtensionsComponentDialog extends SelectionDialog implements ISelectionChangedListener, SelectionListener
-{
- protected static final Image DEFAULT_ELEMENT_ICON = XSDEditorPlugin.getXSDImage("icons/XSDElement.gif"); //$NON-NLS-1$
- protected static final Image DEFAULT_ATTRIBUTE_ICON = XSDEditorPlugin.getXSDImage("icons/XSDAttribute.gif"); //$NON-NLS-1$
-
- /** A temporary Document in which we create temporary DOM element for each element in the
- * Element view. (required by LabelProvider) */
- protected static Document tempDoc = new DocumentImpl();
-
- Button addButton, removeButton, editButton;
-
- public AddExtensionsComponentDialog(Shell parent, ExtensionsSchemasRegistry schemaRegistry)
- {
- super(parent);
- setTitle(Messages._UI_ACTION_ADD_EXTENSION_COMPONENTS);
- setShellStyle(SWT.APPLICATION_MODAL | SWT.RESIZE | SWT.CLOSE);
- }
-
- private List fInput;
-
- private TableViewer categoryTableViewer, elementTableViewer;
- private ArrayList existingNames;
-
- private ViewerFilter elementTableViewerFilter;
- private SpecificationForExtensionsSchema currentExtCategory;
- private HashMap specToComponentsList = new HashMap();
- private IPreferenceStore prefStore;
-
- public void setInput(List input)
- {
- this.fInput = input;
- }
-
- public SpecificationForExtensionsSchema getSelectedCategory(){
- return currentExtCategory;
- }
-
- public void setInitialCategorySelection(SpecificationForExtensionsSchema spec){
- currentExtCategory = spec;
- }
-
- protected IStructuredContentProvider getCategoryContentProvider()
- {
- return new CategoryContentProvider();
- }
-
- protected Control createDialogArea(Composite container)
- {
- Composite parent = (Composite) super.createDialogArea(container);
-
- Composite categoryComposite = new Composite(parent, SWT.NONE);
- GridLayout gl = new GridLayout();
- gl.numColumns = 2;
- gl.marginHeight = 0;
- gl.marginWidth = 0;
- GridData data = new GridData(GridData.FILL_BOTH);
- categoryComposite.setLayoutData(data);
- categoryComposite.setLayout(gl);
-
- Label label = new Label(categoryComposite, SWT.LEFT);
- label.setText(Messages._UI_LABEL_EXTENSION_CATEGORIES);
-
- new Label(categoryComposite, SWT.NONE);
-
- categoryTableViewer = new TableViewer(categoryComposite, getTableStyle());
- categoryTableViewer.setContentProvider(getCategoryContentProvider());
- categoryTableViewer.setLabelProvider(new CategoryLabelProvider());
- categoryTableViewer.setInput(fInput);
- categoryTableViewer.addSelectionChangedListener(this);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(categoryTableViewer.getControl(), XSDEditorCSHelpIds.ADD_EXTENSIONS_COMPONENTS__EXTENSION_CATEGORIES);
-
- GridData gd = new GridData(GridData.FILL_BOTH);
- Table table = categoryTableViewer.getTable();
- table.setLayoutData(gd);
- table.setFont(container.getFont());
-
- Composite buttonComposite = new Composite(categoryComposite, SWT.NONE);
- gl = new GridLayout();
- gl.makeColumnsEqualWidth = true;
- gl.numColumns = 1;
- data = new GridData();
- data.horizontalAlignment = SWT.FILL;
- buttonComposite.setLayoutData(data);
- buttonComposite.setLayout(gl);
-
- addButton = new Button(buttonComposite, SWT.PUSH);
- addButton.setText(Messages._UI_LABEL_ADD_WITH_DOTS);
- addButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- addButton.addSelectionListener(this);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(addButton,
- XSDEditorCSHelpIds.ADD_EXTENSIONS_COMPONENTS__ADD);
-
- removeButton = new Button(buttonComposite, SWT.PUSH);
- removeButton.setText(Messages._UI_LABEL_DELETE);
- removeButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- removeButton.addSelectionListener(this);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(removeButton,
- XSDEditorCSHelpIds.ADD_EXTENSIONS_COMPONENTS__DELETE);
-
-
- editButton = new Button(buttonComposite, SWT.PUSH);
- editButton.setText(Messages._UI_LABEL_EDIT);
- editButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- editButton.addSelectionListener(this);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(editButton,
- XSDEditorCSHelpIds.ADD_EXTENSIONS_COMPONENTS__EDIT);
-
-
- List initialSelection = getInitialElementSelections();
- if (initialSelection != null)
- categoryTableViewer.setSelection(new StructuredSelection(initialSelection));
-
- Label elementLabel = new Label(categoryComposite, SWT.LEFT);
- elementLabel.setText(Messages._UI_LABEL_AVAILABLE_COMPONENTS_TO_ADD);
-
- new Label(categoryComposite, SWT.NONE);
-
- elementTableViewer = new TableViewer(categoryComposite, getTableStyle());
- elementTableViewer.setContentProvider(new ElementContentProvider());
- elementTableViewer.setLabelProvider(new ElementLabelProvider());
- elementTableViewer.setInput(null);
- elementTableViewer.addDoubleClickListener(new IDoubleClickListener()
- {
- public void doubleClick(DoubleClickEvent event)
- {
- okPressed();
- }
- });
- if ( elementTableViewerFilter != null){
- elementTableViewer.addFilter(elementTableViewerFilter);
- }
-
- gd = new GridData(GridData.FILL_BOTH);
- table = elementTableViewer.getTable();
- table.setLayoutData(gd);
- table.setFont(container.getFont());
-
- elementTableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- getButton(IDialogConstants.OK_ID).setEnabled(true);
- }
- });
- PlatformUI.getWorkbench().getHelpSystem().setHelp(elementTableViewer.getControl(), XSDEditorCSHelpIds.ADD_EXTENSIONS_COMPONENTS__AVAILABLE_COMPONENTS_TO_ADD);
-
- return parent;
- }
-
- public void create()
- {
- super.create();
- if (categoryTableViewer.getTable().getItemCount() > 0)
- {
- categoryTableViewer.getTable().select(0);
-
- StructuredSelection structuredSelection;
- if (currentExtCategory != null){
- structuredSelection = new StructuredSelection(currentExtCategory);
- }
- else{
- structuredSelection =
- new StructuredSelection(categoryTableViewer.getElementAt(0));
- }
-
- categoryTableViewer.setSelection(structuredSelection);
- }
-
- // Setup the list of category names that already exist
- // and contructs the XSDSchema for each category
- existingNames = new ArrayList();
- TableItem[] categories = categoryTableViewer.getTable().getItems();
- for (int i = 0; i < categories.length; i++ ){
- existingNames.add(categories[i].getText());
-
- SpecificationForExtensionsSchema spec =
- (SpecificationForExtensionsSchema) categories[i].getData();
- XSDSchema schema = getASISchemaModel(spec);
-
- if (schema == null)
- {
- continue;
- }
-
- List components = buildInput(schema);
- specToComponentsList.put(spec, components);
-
- // mark category as gray/empty if applicable
- Object[] remains = components.toArray();
- if ( elementTableViewerFilter != null)
- remains = elementTableViewerFilter.filter(elementTableViewer,
- elementTableViewer.getTable(), remains);
- if ( remains.length == 0)
- {
- categories[i].setForeground(
- getShell().getDisplay().getSystemColor(SWT.COLOR_GRAY));
- }
- }
-
- getButton(IDialogConstants.OK_ID).setEnabled(false);
- }
-
- public void addElementsTableFilter(ViewerFilter filter){
- elementTableViewerFilter = filter;
- }
-
- public void setPrefStore(IPreferenceStore prefStore)
- {
- this.prefStore = prefStore;
- }
-
- protected Point getInitialSize()
- {
- return getShell().computeSize(400, 300);
- }
-
- /**
- * Return the style flags for the table viewer.
- *
- * @return int
- */
- protected int getTableStyle()
- {
- return SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER;
- }
-
- /*
- * Overrides method from Dialog
- */
- protected void okPressed()
- {
- // Build a list of selected children.
- getShell().setCursor(new Cursor(getShell().getDisplay(), SWT.CURSOR_WAIT));
- IStructuredSelection elementSelection = (IStructuredSelection) elementTableViewer.getSelection();
- IStructuredSelection categorySelection = (IStructuredSelection) categoryTableViewer.getSelection();
- List result = new ArrayList();
- result.add(elementSelection.getFirstElement());
- result.add(categorySelection.getFirstElement());
- if (elementSelection.getFirstElement() != null)
- {
- setResult(result);
- }
- else
- {
- setResult(null);
- }
- super.okPressed();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
- */
- public void widgetSelected(SelectionEvent e)
- {
- if (e.widget == addButton)
- {
- AddNewCategoryDialog addNewCategoryDialog
- = new AddNewCategoryDialog(getShell());
-
- addNewCategoryDialog.setUnavailableCategoryNames(existingNames);
-
- if ( addNewCategoryDialog.open() == Window.OK ){
- SpecificationForExtensionsSchema schemaSpec =
- new SpecificationForExtensionsSchema();
- schemaSpec.setDisplayName(addNewCategoryDialog.getNewCategoryName() );
- schemaSpec.setLocation(addNewCategoryDialog.getCategoryLocation() );
- schemaSpec.setSourceHint(addNewCategoryDialog.getSource());
- schemaSpec.setFromCatalog(addNewCategoryDialog.getFromCatalog() );
-
- fInput.add(schemaSpec);
- existingNames.add(schemaSpec.getDisplayName());
-
- // refresh without updating labels of existing TableItems
- categoryTableViewer.refresh(false);
-
- categoryTableViewer.setSelection(new StructuredSelection(schemaSpec));
- getButton(IDialogConstants.OK_ID).setEnabled(false);
-
- storeSpecInPref(schemaSpec); // must store after selection changed is called ie. 2 lines above (trung)
- }
- }
- else if (e.widget == removeButton)
- {
- TableItem[] selections = categoryTableViewer.getTable().getSelection();
- for (int i =0; i < selections.length; i++){
- SpecificationForExtensionsSchema spec =
- (SpecificationForExtensionsSchema) selections[i].getData();
-
- fInput.remove(spec );
- existingNames.remove(spec.getDisplayName());
- specToComponentsList.remove(spec);
-
- removeFromPref(spec);
- }
- categoryTableViewer.refresh(false);
-
- elementTableViewer.setInput(null);
- elementTableViewer.refresh();
-
- // TODO auto select either the prev category, the next category or the first category in the Table
- getButton(IDialogConstants.OK_ID).setEnabled(false);
- }
- else if (e.widget == editButton)
- {
- // use this dialog not for adding but for editing purpose.
- AddNewCategoryDialog dialog = new AddNewCategoryDialog(getShell(), Messages._UI_LABEL_EDIT_CATEGORY);
-
- TableItem[] selections = categoryTableViewer.getTable().getSelection();
- if (selections.length == 0)
- return;
-
- SpecificationForExtensionsSchema spec = (SpecificationForExtensionsSchema) selections[0].getData();
-
- String displayName = spec.getDisplayName();
-
- dialog.setCategoryName(displayName );
- dialog.setFromCatalog(spec.isFromCatalog() );
- dialog.setSource(spec.getSourceHint() );
- dialog.setCategoryLocation(spec.getLocation() );
-
- specToComponentsList.remove(spec);
- dialog.setUnavailableCategoryNames(existingNames);
-
- if ( dialog.open() == Window.OK){
- existingNames.remove(displayName);
- String newDisplayName = dialog.getNewCategoryName();
-
- spec.setDisplayName(newDisplayName);
- spec.setLocation(dialog.getCategoryLocation());
- spec.setSourceHint(dialog.getSource());
- spec.setFromCatalog(dialog.getFromCatalog());
- spec.setNamespaceURI(null);
-
- existingNames.add(newDisplayName);
-
- categoryTableViewer.update(spec, null);
- refreshElementsViewer(spec);
-
- editSpecInPref(displayName, spec);
- }
- }
- }
-
-/*
- * (non-Javadoc)
- *
- * @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent)
- */
- public void widgetDefaultSelected(SelectionEvent event)
- {
-
- }
-
- public void selectionChanged(SelectionChangedEvent event)
- {
- if (event.getSource() == categoryTableViewer)
- {
- ISelection selection = event.getSelection();
- if (selection instanceof StructuredSelection)
- {
- Object obj = ((StructuredSelection) selection).getFirstElement();
- if (obj instanceof SpecificationForExtensionsSchema)
- {
- SpecificationForExtensionsSchema spec = (SpecificationForExtensionsSchema) obj;
- currentExtCategory = spec;
- refreshElementsViewer(spec);
-
- if ( spec.isDefautSchema() ){
- editButton.setEnabled(false);
- removeButton.setEnabled(false);
- }
- else{
- editButton.setEnabled(true);
- removeButton.setEnabled(true);
- }
-
- getButton(IDialogConstants.OK_ID).setEnabled(false);
- }
- }
- }
- }
-
- private void refreshElementsViewer(SpecificationForExtensionsSchema spec) {
- List components = (List) specToComponentsList.get(spec);
- if ( components != null){
- elementTableViewer.setInput(components);
- return;
- }
-
- XSDSchema xsdSchema = getASISchemaModel(spec);
-
- if (xsdSchema == null){
- MessageBox errDialog = new MessageBox(getShell(), SWT.ICON_ERROR);
- errDialog.setText(Messages._UI_ERROR_INVALID_CATEGORY);
- // TODO (trung) I was forced to use a String in Messages to make the error clearer
- // When we are back to development phase, use another string: "Extension Category: "
- // not "Extension Categories:" + " " like we are using here
- errDialog.setMessage(Messages._UI_LABEL_EXTENSION_CATEGORIES + " " + spec.getDisplayName() //$NON-NLS-1$
- + "\n" //$NON-NLS-1$
- + Messages._UI_ERROR_FILE_CANNOT_BE_PARSED
- + "\n" + Messages._UI_ERROR_VALIDATE_THE_FILE); //$NON-NLS-1$
- errDialog.open();
-
- elementTableViewer.setInput(new ArrayList(0));
- return;
- }
-
- components = buildInput(xsdSchema);
- specToComponentsList.put(spec, components);
-
- List allItems = buildInput(xsdSchema);
- if ( allItems == null )
- return;
- elementTableViewer.setInput(allItems);
- }
-
- private static List buildInput(XSDSchema xsdSchema)
- {
- if ( xsdSchema ==null )
- return null;
-
- List elements = xsdSchema.getElementDeclarations();
- List attributes = xsdSchema.getAttributeDeclarations();
- String targetNamespace = xsdSchema.getTargetNamespace();
-
- // For safety purpose: We don't append 'attributes' to 'elements'
- // ArrayStoreException(or similar one) may occur
- List allItems = new ArrayList(attributes.size() + elements.size());
-
- {
- // getElementDeclarations returns a lot of elements from import
- // statement, we
- // only add non-imported elements here. (trung)
- for (int i = 0; i < elements.size(); i++)
- {
- XSDElementDeclaration currentElement = (XSDElementDeclaration) elements.get(i);
- if (currentElement.getTargetNamespace() != null)
- {
- if (currentElement.getTargetNamespace().equals(targetNamespace))
- allItems.add(currentElement);
- }
- else
- {
- if (targetNamespace == null)
- allItems.add(currentElement);
- }
- }
- // getAttributeDeclarations also returns a lot of elements from
- // import statement, we
- // only add non-imported elements here. (trung)
- for (int i = 0; i < attributes.size(); i++)
- {
- XSDAttributeDeclaration currentAttribute = (XSDAttributeDeclaration) attributes.get(i);
- if (currentAttribute.getTargetNamespace() != null)
- {
- if (currentAttribute.isGlobal() && currentAttribute.getTargetNamespace().equals(targetNamespace))
- allItems.add(currentAttribute);
- }
- else
- {
- if (targetNamespace == null)
- allItems.add(currentAttribute);
- }
- }
- }
- return allItems;
- }
-
-
- private static XSDSchema getASISchemaModel(SpecificationForExtensionsSchema extensionsSchemaSpec)
- {
- String location = extensionsSchemaSpec.getLocation();
- if ( location == null)
- return null;
- XSDSchema xsdSchema = XSDImpl.buildXSDModel(location);
-
- // now that the .xsd file is read, we can retrieve the namespace of this xsd file
- // and set the namespace for 'properties'
- if ( extensionsSchemaSpec.getNamespaceURI() == null){
- extensionsSchemaSpec.setNamespaceURI( xsdSchema.getTargetNamespace());
- }
-
- return xsdSchema;
- }
-
- private void storeSpecInPref(SpecificationForExtensionsSchema schemaSpec) {
- if (prefStore == null)
- return;
-
- String currentValue = prefStore.getString(ExtensionsSchemasRegistry.USER_ADDED_EXT_SCHEMAS);
- String specDesc = " " + "\t" + schemaSpec.getDisplayName() + "\t"+
- schemaSpec.getNamespaceURI() + "\t" + schemaSpec.getLocation() + "\t" +
- schemaSpec.isDefautSchema() + "\t" + schemaSpec.getSourceHint() + "\t" +
- schemaSpec.isFromCatalog();
- currentValue += specDesc + "\n";
-
- prefStore.setValue(ExtensionsSchemasRegistry.USER_ADDED_EXT_SCHEMAS,
- currentValue);
- }
-
- private void editSpecInPref(String displayName, SpecificationForExtensionsSchema newSpec) {
- if (prefStore == null)
- return;
-
- String newValue = "";
- String currentValue = prefStore.getString(ExtensionsSchemasRegistry.USER_ADDED_EXT_SCHEMAS);
- StringTokenizer tokenizer = new StringTokenizer(currentValue, "\n");
-
- while (tokenizer.hasMoreTokens())
- {
- String oneSpecDesc = tokenizer.nextToken();
- // get the Display name
- StringTokenizer _tokenizer_2 = new StringTokenizer(oneSpecDesc, "\t");
- _tokenizer_2.nextToken();
- String dName = _tokenizer_2.nextToken();
-
- if ( dName.equals(displayName ) )
- {
- oneSpecDesc = " " + "\t" + newSpec.getDisplayName() + "\t"+
- newSpec.getNamespaceURI() + "\t" + newSpec.getLocation() + "\t" +
- newSpec.isDefautSchema() + "\t" + newSpec.getSourceHint() + "\t" +
- newSpec.isFromCatalog();
- }
-
- newValue += oneSpecDesc + "\n";
- }
- prefStore.setValue(ExtensionsSchemasRegistry.USER_ADDED_EXT_SCHEMAS, newValue);
-
- }
-
- private void removeFromPref(SpecificationForExtensionsSchema spec) {
- if (prefStore == null)
- return;
-
- String newValue = "";
- String currentValue = prefStore.getString(ExtensionsSchemasRegistry.USER_ADDED_EXT_SCHEMAS);
- StringTokenizer tokenizer = new StringTokenizer(currentValue, "\n");
-
- while (tokenizer.hasMoreTokens())
- {
- String oneSpecDesc = tokenizer.nextToken();
- // get the Display name
- StringTokenizer _tokenizer_2 = new StringTokenizer(oneSpecDesc, "\t");
- _tokenizer_2.nextToken();
- String dName = _tokenizer_2.nextToken();
-
- if ( dName.equals(spec.getDisplayName() ) )
- continue;
- newValue += oneSpecDesc + "\n";
- }
- prefStore.setValue(ExtensionsSchemasRegistry.USER_ADDED_EXT_SCHEMAS, newValue);
- }
-
-static class CategoryContentProvider implements IStructuredContentProvider
- {
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
- */
- public Object[] getElements(Object inputElement)
- {
- SpecificationForExtensionsSchema[] extensionsSchemaSpecs = null;
- try
- {
- List inputList = (List) inputElement;
- extensionsSchemaSpecs = (SpecificationForExtensionsSchema[]) inputList.toArray(new SpecificationForExtensionsSchema[0]);
- }
- catch (Exception e)
- {
- }
- return extensionsSchemaSpecs;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.IContentProvider#dispose()
- */
- public void dispose()
- {
- // Do nothing
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer,
- * java.lang.Object, java.lang.Object)
- */
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput)
- {
- // Do nothing
-
- }
- }
-
- static class CategoryLabelProvider extends LabelProvider
- {
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)
- */
- public Image getImage(Object element)
- {
- return XSDEditorPlugin.getXSDImage("icons/appinfo_category.gif"); //$NON-NLS-1$
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
- */
- public String getText(Object element)
- {
- if (element instanceof SpecificationForExtensionsSchema)
- return ((SpecificationForExtensionsSchema) element).getDisplayName();
-
- return super.getText(element);
- }
- }
-
- static class ElementContentProvider implements IStructuredContentProvider
- {
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
- */
- public Object[] getElements(Object inputElement)
- {
- if (inputElement instanceof List)
- {
- return ((List) inputElement).toArray();
- }
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.IContentProvider#dispose()
- */
- public void dispose()
- {
- // Do nothing
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer,
- * java.lang.Object, java.lang.Object)
- */
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput)
- {
- // Do nothing
-
- }
- }
-
- class ElementLabelProvider extends LabelProvider
- {
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)
- */
- public Image getImage(Object element)
- {
- if ( element instanceof XSDElementDeclaration){
-
- // Workaround trick: (trung) we create a temporary Dom element and put it in the label provider
- // to get the image.
- String namespace = ((XSDElementDeclaration) element).getSchema().getTargetNamespace();
- String name = ((XSDElementDeclaration) element).getName();
- Element tempElement = tempDoc.createElementNS(namespace, name);
- ILabelProvider lp = XSDEditorPlugin.getDefault().getNodeCustomizationRegistry().getLabelProvider(namespace);
- if (lp != null){
- Image img = lp.getImage(tempElement);
-
- if (img != null){
- return img;
- }
- }
- return DEFAULT_ELEMENT_ICON;
- }
- else if ( element instanceof XSDAttributeDeclaration){
- return DEFAULT_ATTRIBUTE_ICON;
- }
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
- */
- public String getText(Object element)
- {
- if (element instanceof XSDElementDeclaration)
- return ((XSDElementDeclaration) element).getName();
- if (element instanceof XSDAttributeDeclaration )
- return ((XSDAttributeDeclaration) element).getName();
- return super.getText(element);
- }
- }
-
- public boolean close()
- {
- return super.close();
- }
-
- protected void enableButtons(boolean value)
- {
- editButton.setEnabled(value);
- addButton.setEnabled(value);
- removeButton.setEnabled(value);
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/AddNewCategoryDialog.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/AddNewCategoryDialog.java
deleted file mode 100644
index 8c5d3aa781..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/AddNewCategoryDialog.java
+++ /dev/null
@@ -1,385 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo;
-
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CLabel;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-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.Label;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.swt.widgets.ToolBar;
-import org.eclipse.swt.widgets.ToolItem;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.wst.common.ui.internal.dialogs.SelectSingleFileDialog;
-import org.eclipse.wst.xsd.ui.internal.common.util.Messages;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorCSHelpIds;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-
-public class AddNewCategoryDialog extends Dialog
-{
-
- private static final String SCHEMA_LABEL = Messages._UI_LABEL_SCHEMA;
- private static final String NAME_LABEL = Messages._UI_LABEL_NAME;
- private String dialogTitle = Messages._UI_LABEL_ADD_CATEGORY;
-
- protected MenuManager browseMenu;
- protected Label name;
- protected Text nameText;
- protected Label schema;
- protected CLabel schemaDisplayer;
- protected ToolBar browseToolBar;
- protected ToolItem browseItem;
-
- protected List invalidNames;
-
- // TODO (cs) rename this field to extensionSchemaLocation in WTP 2.0
- protected String appInfoSchemaLocation;
- protected String categoryName;
- protected CLabel errDisplayer;
- protected boolean isCategoryNameValid;
- protected boolean fromCatalog;
-
- private boolean canOK =false;
-
- /** Either the location if come from workspace or namespace if come from
- * XML Catalog */
- protected String source;
-
- public AddNewCategoryDialog(Shell parentShell)
- {
- super(parentShell);
- }
-
- public AddNewCategoryDialog(Shell parentShell, String dialogTitle)
- {
- super(parentShell);
- this.dialogTitle = dialogTitle;
- }
-
- /**
- * receive a List of names which have already been added to the category list
- *
- * @param unavailNames
- * Array of unvailable names
- */
- public void setUnavailableCategoryNames(List unavailNames)
- {
- invalidNames = unavailNames;
- }
-
- public String getNewCategoryName()
- {
- return categoryName.trim();
- }
-
- public String getCategoryLocation()
- {
- return appInfoSchemaLocation;
- }
-
- public void setCategoryLocation(String s){
- appInfoSchemaLocation = s;
- }
-
- /** @deprecated */
- public SpecificationForExtensionsSchema getExtensionsSchemaSpec(){
- SpecificationForExtensionsSchema schemaSpec = new SpecificationForExtensionsSchema();
- schemaSpec.setDisplayName(getNewCategoryName());
- schemaSpec.setLocation(getCategoryLocation());
-
- return schemaSpec;
- }
-
- public void setCategoryName(String categoryName) {
- this.categoryName = categoryName;
- }
-
- public boolean getFromCatalog() {
- return fromCatalog;
- }
-
- public void setFromCatalog(boolean b){
- fromCatalog = b;
- }
-
- public String getSource()
- {
- return source;
- }
-
- public void setSource(String source) {
- this.source = source;
- }
-
- protected Control createButtonBar(Composite parent)
- {
- Control result = super.createButtonBar(parent);
- getButton(IDialogConstants.OK_ID).setEnabled(canOK);
- return result;
- }
-
- // redudant method to improve speed (according to the compiler)
- protected Button getButton(int id) {
- return super.getButton(id);
- }
-
- protected Control createDialogArea(Composite parent)
- {
- getShell().setText(dialogTitle);
-
- Composite mainComposite = (Composite) super.createDialogArea(parent);
- GridLayout layout = new GridLayout(3, false);
- layout.marginTop = 10;
- mainComposite.setLayout(layout);
- mainComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
- GridData data = new GridData();
- data.widthHint = 400;
-
- mainComposite.setLayoutData(data);
-
- // Line 1, name
- name = new Label(mainComposite, SWT.NONE);
- name.setText(NAME_LABEL);
-
- nameText = new Text(mainComposite, SWT.BORDER | SWT.SINGLE);
- nameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- if (categoryName != null)
- nameText.setText(categoryName);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(nameText,
- XSDEditorCSHelpIds.ADD_CATEGORY__NAME);
-
- Button hidden = new Button(mainComposite, SWT.NONE);
- hidden.setVisible(false);
-
- // Line 2, schema
- schema = new Label(mainComposite, SWT.NONE);
- schema.setText(SCHEMA_LABEL);
-
- schemaDisplayer = new CLabel(mainComposite, SWT.BORDER | SWT.SINGLE);
- schemaDisplayer.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- if (source != null)
- {
- if (fromCatalog)
- schemaDisplayer.setImage(
- XSDEditorPlugin.getXSDImage("icons/xmlcatalog_obj.gif")); //$NON-NLS-1$
- else
- schemaDisplayer.setImage(
- XSDEditorPlugin.getXSDImage("icons/XSDFile.gif")); //$NON-NLS-1$
- schemaDisplayer.setText(source);
-
- }
- PlatformUI.getWorkbench().getHelpSystem().setHelp(schemaDisplayer,
- XSDEditorCSHelpIds.ADD_CATEGORY__SCHEMA);
-
- if (categoryName != null && source != null)
- canOK = true;
-
- browseToolBar = new ToolBar(mainComposite, SWT.FLAT);
- browseItem = new ToolItem(browseToolBar, SWT.NONE);
- // TODO: Should be able to get the image from the XML plugin. Don't need
- // to copy to XSDEditor icons folder like this.
- browseItem.setImage(XSDEditorPlugin.getXSDImage("icons/appinfo_browse.gif")); //$NON-NLS-1$
-
- browseMenu = new MenuManager();
-
- BrowseInWorkspaceAction browseInWorkspace = new BrowseInWorkspaceAction();
- browseMenu.add(browseInWorkspace);
-
- BrowseCatalogAction browseCatalog = new BrowseCatalogAction();
- browseMenu.add(browseCatalog);
-
- browseItem.addSelectionListener(new SelectionAdapter()
- {
- public void widgetSelected(SelectionEvent e)
- {
- Menu menu = browseMenu.createContextMenu(getShell());
- Rectangle bounds = browseItem.getBounds();
- Point topLeft = new Point(bounds.x, bounds.y + bounds.height);
- topLeft = browseToolBar.toDisplay(topLeft);
- menu.setLocation(topLeft.x, topLeft.y);
- menu.setVisible(true);
- }
- });
-
- // Composite errComp = new Composite(mainComposite, SWT.NONE);
- // errComp.setBackground(org.eclipse.draw2d.ColorConstants.white);
- // errComp.setLayout(new GridLayout());
- errDisplayer = new CLabel(mainComposite, SWT.FLAT);
- // errDisplayer.setText("abd");
- GridData gd = new GridData(GridData.FILL_BOTH);
- gd.grabExcessHorizontalSpace = true;
- gd.horizontalSpan = 3;
- errDisplayer.setLayoutData(gd);
-
- // errComp.setLayoutData(gd);
- // errDisplayer.setLayoutData(gd);
- // errMsgContainer.setContent(errDisplayer);
-
- nameText.addModifyListener(new ModifyListener()
- {
- // track the nameText and enable/disable the OK button accordingly
- public void modifyText(ModifyEvent e)
- {
- categoryName = nameText.getText();
-
- // name is in the invalid List
- if (invalidNames != null)
- {
- if (invalidNames.contains(categoryName.trim()))
- {
- isCategoryNameValid = false;
-
- getButton(IDialogConstants.OK_ID).setEnabled(false);
- errDisplayer.setText(Messages._UI_ERROR_NAME_ALREADY_USED);
- errDisplayer.setImage(XSDEditorPlugin.getXSDImage("icons/error_st_obj.gif")); //$NON-NLS-1$
- return;
- }
- }
- // name is empty string
- if (categoryName.equals("")) //$NON-NLS-1$
- {
- isCategoryNameValid = false;
-
- getButton(IDialogConstants.OK_ID).setEnabled(false);
- errDisplayer.setText(""); //$NON-NLS-1$
- errDisplayer.setImage(null);
- return;
- }
-
- /*
- * Enable the Ok button if the location field AND the name field are not
- * empty
- */
- if (!categoryName.equals("")) //$NON-NLS-1$
- {
- isCategoryNameValid = true;
- errDisplayer.setText(""); //$NON-NLS-1$
- errDisplayer.setImage(null);
- }
- if (appInfoSchemaLocation != null && !appInfoSchemaLocation.equals("")) //$NON-NLS-1$
- {
- getButton(IDialogConstants.OK_ID).setEnabled(true);
- }
- }
- });
-
- return parent;
- }
-
- protected void okPressed()
- {
- super.okPressed();
- }
-
- protected class BrowseInWorkspaceAction extends Action
- {
- private static final String XSD_FILE_EXTENSION = ".xsd"; //$NON-NLS-1$
-
- public BrowseInWorkspaceAction()
- {
- super(Messages._UI_ACTION_BROWSE_WORKSPACE);
- }
-
- public void run()
- {
- SelectSingleFileDialog dialog = new SelectSingleFileDialog(getShell(), null, true);
- dialog.addFilterExtensions(new String[] { XSD_FILE_EXTENSION });
- dialog.create();
- dialog.setTitle(Messages._UI_LABEL_SELECT_XSD_FILE);
- dialog.setMessage(Messages._UI_DESCRIPTION_CHOOSE_XSD_FILE);
-
- if (dialog.open() == Window.OK)
- {
- IFile appInfoSchemaFile = dialog.getFile();
- if (appInfoSchemaFile != null)
- {
- // remove leading slash from the value to avoid the
- // whole leading slash ambiguity problem
- String uri = appInfoSchemaFile.getFullPath().toString();
- while (uri.startsWith("/") || uri.startsWith("\\")) { //$NON-NLS-1$ //$NON-NLS-2$
- uri = uri.substring(1);
- }
- appInfoSchemaLocation = uri.toString();
- source = uri;
- fromCatalog = false;
-
- appInfoSchemaLocation = "file://" + Platform.getLocation().toString() + "/" + appInfoSchemaLocation; //$NON-NLS-1$ //$NON-NLS-2$
- // TODO... be careful how we construct the location
- // UNIX related issues here
-
- schemaDisplayer.setImage(XSDEditorPlugin.getXSDImage("icons/XSDFile.gif")); //$NON-NLS-1$
- schemaDisplayer.setText(uri);
-
- // Enable the OK button if we should..
- if (isCategoryNameValid)
- {
- getButton(IDialogConstants.OK_ID).setEnabled(true);
- errDisplayer.setText(""); //$NON-NLS-1$
- errDisplayer.setImage(null);
- }
- }
- }
- }
- }
-
- protected class BrowseCatalogAction extends Action
- {
- public BrowseCatalogAction()
- {
- super(Messages._UI_ACTION_BROWSE_CATALOG);
- }
-
- public void run()
- {
- SelectFromCatalogDialog dialog = new SelectFromCatalogDialog(getShell());
- // dialog.open();
- if (dialog.open() == Window.OK)
- {
- appInfoSchemaLocation = dialog.getCurrentSelectionLocation();
- source = dialog.getCurrentSelectionNamespace();
- fromCatalog = true;
-
- schemaDisplayer.setImage(XSDEditorPlugin.getXSDImage("icons/xmlcatalog_obj.gif")); //$NON-NLS-1$
- schemaDisplayer.setText(dialog.getCurrentSelectionNamespace());
-
- // Enable the OK button if we should..
- if (isCategoryNameValid && !appInfoSchemaLocation.equals("")) //$NON-NLS-1$
- {
- getButton(IDialogConstants.OK_ID).setEnabled(true);
- errDisplayer.setText(""); //$NON-NLS-1$
- errDisplayer.setImage(null);
- }
- }
- }
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/CategoryProvider.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/CategoryProvider.java
deleted file mode 100644
index a3eb64a376..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/CategoryProvider.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.wst.xml.core.internal.XMLCorePlugin;
-import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalog;
-import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalogEntry;
-import org.eclipse.wst.xml.core.internal.catalog.provisional.INextCatalog;
-
-public class CategoryProvider
-{
- private ICatalog systemCatalog;
-
- public CategoryProvider()
- {
-
- }
-
- /**
- * Extenders should implement and return a list of
- * SpecificationForExtensionsSchema
- * @return
- */
- public List getCategories()
- {
- return new ArrayList();
- }
-
- /**
- * Helper method to find the physical location of the schema
- * in the XML Catalog
- * @param namespaceURI
- * @return physical location of the schema
- */
- public String locateFileUsingCatalog(String namespaceURI)
- {
- retrieveCatalog();
-
- ICatalogEntry[] entries = systemCatalog.getCatalogEntries();
- for (int i = 0; i < entries.length; i++)
- {
- if (entries[i].getKey().equals(namespaceURI))
- return entries[i].getURI();
- }
-
- return null;
- }
-
- private void retrieveCatalog()
- {
- if (systemCatalog != null)
- return;
-
- ICatalog defaultCatalog = XMLCorePlugin.getDefault().getDefaultXMLCatalog();
- INextCatalog[] nextCatalogs = defaultCatalog.getNextCatalogs();
- for (int i = 0; i < nextCatalogs.length; i++)
- {
- INextCatalog catalog = nextCatalogs[i];
- ICatalog referencedCatalog = catalog.getReferencedCatalog();
- if (referencedCatalog != null)
- {
- if (XMLCorePlugin.SYSTEM_CATALOG_ID.equals(referencedCatalog.getId()))
- {
- systemCatalog = referencedCatalog;
- }
- }
- }
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/DOMExtensionDetailsContentProvider.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/DOMExtensionDetailsContentProvider.java
deleted file mode 100644
index f28e18acbe..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/DOMExtensionDetailsContentProvider.java
+++ /dev/null
@@ -1,211 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2006 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
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo;
-
-import java.text.Collator;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.wst.xml.core.internal.contentmodel.CMAttributeDeclaration;
-import org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration;
-import org.eclipse.wst.xml.core.internal.contentmodel.modelquery.ModelQuery;
-import org.eclipse.wst.xml.core.internal.modelquery.ModelQueryUtil;
-import org.eclipse.wst.xml.ui.internal.tabletree.TreeContentHelper;
-import org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.custom.DefaultListNodeEditorConfiguration;
-import org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.custom.NodeCustomizationRegistry;
-import org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.custom.NodeEditorConfiguration;
-import org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.custom.NodeEditorProvider;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-
-public class DOMExtensionDetailsContentProvider implements ExtensionDetailsContentProvider
-{
- private static final Object[] EMPTY_ARRAY = {};
- private static final String[] EMPTY_STRING_ARRAY = {};
- private static final String XMLNS = "xmlns"; //$NON-NLS
- private static final String TEXT_NODE_KEY = "text()"; //$NON-NLS
-
- public Object[] getItems(Object input)
- {
- HashMap resultMap = new HashMap();
- if (input instanceof Element)
- {
- Element element = (Element) input;
-
- // here we compute items for the attributes that physically in the document
- //
- NamedNodeMap attributes = element.getAttributes();
- for (int i = 0; i < attributes.getLength(); i++)
- {
- Attr attr = (Attr) attributes.item(i);
- if (!XMLNS.equals(attr.getName()) && !XMLNS.equals(attr.getPrefix())) //$NON-NLS-1$ //$NON-NLS-2$
- {
- resultMap.put(attr.getName(), DOMExtensionItem.createItemForElementAttribute(element, attr));
- }
- }
-
- // here we compute an item for the text node that is physically in the document
- //
- String textNodeValue = new TreeContentHelper().getNodeValue(element);
- if (textNodeValue != null)
- {
- resultMap.put(TEXT_NODE_KEY, DOMExtensionItem.createItemForElementText(element));
- }
-
- ModelQuery modelQuery = ModelQueryUtil.getModelQuery(element.getOwnerDocument());
- if (modelQuery != null)
- {
- CMElementDeclaration ed = modelQuery.getCMElementDeclaration(element);
- if (ed != null)
- {
- // here we compute items for the attributes that may be added to the document according to the grammar
- //
- List list = modelQuery.getAvailableContent(element, ed, ModelQuery.INCLUDE_ATTRIBUTES);
- for (Iterator i = list.iterator(); i.hasNext(); )
- {
- CMAttributeDeclaration ad = (CMAttributeDeclaration)i.next();
- if (ad != null && resultMap.get(ad.getNodeName()) == null)
- {
- resultMap.put(ad.getNodeName(), DOMExtensionItem.createItemForElementAttribute(element, ad));
- }
- }
- if (resultMap.get(TEXT_NODE_KEY) == null)
- {
- // here we compute an item for the text node that may be added to the document according to the grammar
- //
- int contentType = ed.getContentType();
- if (contentType == CMElementDeclaration.PCDATA || contentType == CMElementDeclaration.MIXED)
- {
- resultMap.put(TEXT_NODE_KEY, DOMExtensionItem.createItemForElementText(element));
- }
- }
- }
- }
- Collection collection = resultMap.values();
- // initialize the editor information for each item
- //
- for (Iterator i = collection.iterator(); i.hasNext();)
- {
- initPropertyEditorConfiguration((DOMExtensionItem) i.next());
- }
- DOMExtensionItem[] items = new DOMExtensionItem[collection.size()];
- resultMap.values().toArray(items);
-
- // here we sort the list alphabetically
- //
- if (items.length > 0)
- {
- Comparator comparator = new Comparator()
- {
- public int compare(Object arg0, Object arg1)
- {
- DOMExtensionItem a = (DOMExtensionItem)arg0;
- DOMExtensionItem b = (DOMExtensionItem)arg1;
-
- // begin special case to ensure 'text nodes' come last
- if (a.isTextValue() && !b.isTextValue())
- {
- return 1;
- }
- else if (b.isTextValue() && !a.isTextValue())
- {
- return -1;
- }
- // end special case
- else
- {
- return Collator.getInstance().compare(a.getName(), b.getName());
- }
- }
- };
- Arrays.sort(items, comparator);
- }
- return items;
- }
- else if (input instanceof Attr)
- {
- Attr attr = (Attr) input;
- DOMExtensionItem item = DOMExtensionItem.createItemForAttributeText(attr.getOwnerElement(), attr);
- DOMExtensionItem[] items = {item};
- return items;
- }
- return EMPTY_ARRAY;
- }
-
- public String getName(Object item)
- {
- if (item instanceof DOMExtensionItem)
- {
- return ((DOMExtensionItem) item).getName();
- }
- return ""; //$NON-NLS-1$
- }
-
- public String getValue(Object item)
- {
- if (item instanceof DOMExtensionItem)
- {
- return ((DOMExtensionItem) item).getValue();
- }
- return ""; //$NON-NLS-1$
- }
-
- public String[] getPossibleValues(Object item)
- {
- if (item instanceof DOMExtensionItem)
- {
- return ((DOMExtensionItem) item).getPossibleValues();
- }
- return EMPTY_STRING_ARRAY;
- }
-
- protected void initPropertyEditorConfiguration(DOMExtensionItem item)
- {
- String namespace = item.getNamespace();
- String name = item.getName();
- String parentName = item.getParentName();
- NodeEditorConfiguration configuration = null;
- if (namespace != null)
- {
- // TODO (cs) remove reference to XSDEditorPlugin... make generic
- // perhaps push down the xml.ui ?
- //
- NodeCustomizationRegistry registry = XSDEditorPlugin.getDefault().getNodeCustomizationRegistry();
- NodeEditorProvider provider= registry.getNodeEditorProvider(namespace);
- if (provider != null)
- {
- configuration = provider.getNodeEditorConfiguration(parentName, name);
- if (configuration != null)
- {
- configuration.setParentNode(item.getParentNode());
- if (item.getNode() != null)
- {
- configuration.setNode(item.getNode());
- }
- }
- }
- }
- String[] values = item.getPossibleValues();
- if (values != null && values.length > 1)
- {
- configuration = new DefaultListNodeEditorConfiguration(values);
- }
-
- // Note that it IS expected that the configaration may be null
- //
- item.setPropertyEditorConfiguration(configuration);
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/DOMExtensionItem.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/DOMExtensionItem.java
deleted file mode 100644
index 52505251b2..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/DOMExtensionItem.java
+++ /dev/null
@@ -1,226 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2006 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
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.wst.xml.core.internal.contentmodel.CMAttributeDeclaration;
-import org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration;
-import org.eclipse.wst.xml.core.internal.contentmodel.CMNode;
-import org.eclipse.wst.xml.core.internal.contentmodel.modelquery.ModelQuery;
-import org.eclipse.wst.xml.core.internal.modelquery.ModelQueryUtil;
-import org.eclipse.wst.xml.ui.internal.tabletree.TreeContentHelper;
-import org.eclipse.wst.xsd.ui.internal.common.commands.UpdateAttributeValueCommand;
-import org.eclipse.wst.xsd.ui.internal.common.commands.UpdateTextValueCommand;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-class DOMExtensionItem extends ExtensionItem
-{
- private final static int KIND_ELEMENT_ATTR = 1;
- private final static int KIND_ELEMENT_TEXT = 2;
- private final static int KIND_ELEMENT_CMATTRIBUTE = 3;
- private final static int KIND_ATTR_TEXT = 4;
- int kind;
- Attr attribute;
- Element parent;
- CMNode cmNode;
-
- private DOMExtensionItem(int kind, Element parent, Attr node, CMNode cmNode)
- {
- this.kind = kind;
- this.parent = parent;
- this.attribute = node;
- this.cmNode = cmNode;
- }
-
- public boolean isTextValue()
- {
- return kind == KIND_ELEMENT_TEXT || kind == KIND_ATTR_TEXT;
- }
-
- static DOMExtensionItem createItemForElementText(Element parent)
- {
- return new DOMExtensionItem(KIND_ELEMENT_TEXT, parent, null, null);
- }
-
- static DOMExtensionItem createItemForElementAttribute(Element parent, Attr attribute)
- {
- return new DOMExtensionItem(KIND_ELEMENT_ATTR, parent, attribute, null);
- }
-
- static DOMExtensionItem createItemForElementAttribute(Element parent, CMAttributeDeclaration ad)
- {
- if (ad == null)
- {
- System.out.println("null!");
- }
- return new DOMExtensionItem(KIND_ELEMENT_CMATTRIBUTE, parent, null, ad);
- }
-
- static DOMExtensionItem createItemForAttributeText(Element parent, Attr attribute)
- {
- return new DOMExtensionItem(KIND_ATTR_TEXT, parent, attribute, null);
- }
-
- public String getName()
- {
- String result = null;
- switch (kind)
- {
- case KIND_ATTR_TEXT : {
- result = "value";
- break;
- }
- case KIND_ELEMENT_ATTR : {
- result = attribute.getName();
- break;
- }
- case KIND_ELEMENT_CMATTRIBUTE : {
- CMAttributeDeclaration ad = (CMAttributeDeclaration) cmNode;
- result = ad.getNodeName();
- break;
- }
- case KIND_ELEMENT_TEXT : {
- result = "text value";
- break;
- }
- }
- return result != null ? result : "";
- }
-
- public String getValue()
- {
- switch (kind)
- {
- case KIND_ATTR_TEXT :
- case KIND_ELEMENT_ATTR : {
- // note intentional fall-thru!!
- return attribute.getNodeValue();
- }
- case KIND_ELEMENT_CMATTRIBUTE : {
- // CS : one would think that we'd just need to return "" here
- // but after editing a item of this kind and giving it value
- // the list of item's doesn't get recomputed.. so we need to trick
- // one of these items to behave like the KIND_ELEMENT_ATTR case
- //
- String value = parent.getAttribute(cmNode.getNodeName());
- return (value != null) ? value : "";
- }
- case KIND_ELEMENT_TEXT : {
- return new TreeContentHelper().getElementTextValue(parent);
- }
- }
- return "";
- }
-
-
- public String[] getPossibleValues()
- {
- String[] result = {};
-
- switch (kind)
- {
- case KIND_ATTR_TEXT :
- case KIND_ELEMENT_ATTR : {
- // note intentional fall-thru!!
- ModelQuery modelQuery = ModelQueryUtil.getModelQuery(parent.getOwnerDocument());
- if (modelQuery != null)
- {
- CMAttributeDeclaration ad = modelQuery.getCMAttributeDeclaration(attribute);
- if (ad != null)
- {
- result = modelQuery.getPossibleDataTypeValues(parent, ad);
- }
- }
- break;
- }
- case KIND_ELEMENT_CMATTRIBUTE : {
- ModelQuery modelQuery = ModelQueryUtil.getModelQuery(parent.getOwnerDocument());
- if (modelQuery != null && cmNode != null)
- {
- result = modelQuery.getPossibleDataTypeValues(parent, cmNode);
- }
- break;
- }
- case KIND_ELEMENT_TEXT : {
- ModelQuery modelQuery = ModelQueryUtil.getModelQuery(parent.getOwnerDocument());
- if (modelQuery != null)
- {
- CMElementDeclaration ed = modelQuery.getCMElementDeclaration(parent);
- if (ed != null)
- {
- result = modelQuery.getPossibleDataTypeValues(parent, ed);
- }
- }
- break;
- }
- }
- return result;
- }
-
- public Command getUpdateValueCommand(String newValue)
- {
- switch (kind)
- {
- case KIND_ATTR_TEXT :
- case KIND_ELEMENT_ATTR : {
- // note intentional fall-thru!!
- return new UpdateAttributeValueCommand(parent, attribute.getNodeName(), newValue, true);
- }
- case KIND_ELEMENT_CMATTRIBUTE : {
- final CMAttributeDeclaration ad = (CMAttributeDeclaration) cmNode;
- return new UpdateAttributeValueCommand(parent, ad.getAttrName(), newValue, true);
- }
- case KIND_ELEMENT_TEXT : {
- return new UpdateTextValueCommand(parent, newValue);
- }
- }
- return null;
- }
-
- public String getNamespace()
- {
- String namespace = null;
- if (kind == KIND_ATTR_TEXT)
- {
- namespace = attribute.getNamespaceURI();
- }
- else if (parent != null)
- {
- namespace = parent.getNamespaceURI();
- }
- return namespace;
- }
-
- public Node getParentNode()
- {
- Node parentNode = null;
- if (attribute != null)
- {
- parentNode = attribute.getOwnerElement();
- }
- else if (parent != null)
- {
- parentNode = parent;
- }
- return parentNode;
- }
-
- public String getParentName()
- {
- Node parentNode = getParentNode();
- return parentNode != null ? parentNode.getLocalName() : "";
- }
-
- public Node getNode()
- {
- return attribute;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/DOMExtensionItemEditManager.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/DOMExtensionItemEditManager.java
deleted file mode 100644
index aac70ea719..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/DOMExtensionItemEditManager.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2006 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
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo;
-
-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.Widget;
-
-
-/**
- * @deprecated
- */
-public class DOMExtensionItemEditManager implements ExtensionItemEditManager
-{
- public void handleEdit(Object item, Widget widget)
- {
- }
-
- public Control createCustomButtonControl(Composite composite, Object item)
- {
- Button button = new Button(composite, SWT.NONE);
- button.setText("..."); //$NON-NLS-1$
- return button;
- }
-
- public Control createCustomTextControl(Composite composite, Object item)
- {
- return null;
- }
-
- public String getButtonControlStyle(Object object)
- {
- return ExtensionItemEditManager.STYLE_NONE;
- }
-
- public String getTextControlStyle(Object object)
- {
- return ExtensionItemEditManager.STYLE_NONE;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/DOMExtensionItemMenuListener.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/DOMExtensionItemMenuListener.java
deleted file mode 100644
index fc30c94d0e..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/DOMExtensionItemMenuListener.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2006 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
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-import org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration;
-import org.eclipse.wst.xml.core.internal.contentmodel.modelquery.ModelQuery;
-import org.eclipse.wst.xml.core.internal.document.ElementImpl;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
-import org.eclipse.wst.xml.ui.internal.contentoutline.XMLNodeActionManager;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-public class DOMExtensionItemMenuListener implements IMenuListener
-{
- TreeViewer treeViewer;
-
- public DOMExtensionItemMenuListener(TreeViewer treeViewer)
- {
- this.treeViewer = treeViewer;
- }
-
- public void menuAboutToShow(IMenuManager manager)
- {
- manager.removeAll();
- ISelection selection = treeViewer.getSelection();
- if (selection instanceof IStructuredSelection)
- {
- IStructuredSelection structuredSelection = (IStructuredSelection) selection;
- if (structuredSelection.getFirstElement() instanceof ElementImpl)
- {
- ElementImpl elementImpl = (ElementImpl) structuredSelection.getFirstElement();
- IDOMDocument domDocument = (IDOMDocument) elementImpl.getOwnerDocument();
- InternalNodeActionManager actionManager = new InternalNodeActionManager(domDocument.getModel(), treeViewer);
- actionManager.fillContextMenu(manager, structuredSelection);
- }
- }
- }
-
-
- class InternalNodeActionManager extends XMLNodeActionManager
- {
- public InternalNodeActionManager(IStructuredModel model, Viewer viewer)
- {
- super(model, viewer);
- }
-
- public void contributeActions(IMenuManager menu, List selection)
- {
- //menu.add(new Action("there"){});
- try
- {
- int editMode = modelQuery.getEditMode();
- int ic = ModelQuery.INCLUDE_CHILD_NODES;
- int vc = (editMode == ModelQuery.EDIT_MODE_CONSTRAINED_STRICT) ? ModelQuery.VALIDITY_STRICT : ModelQuery.VALIDITY_NONE;
- List implicitlySelectedNodeList = null;
-
- if (selection.size() == 1)
- {
- Node node = (Node) selection.get(0);
- // contribute add child actions
- contributeAddChildActions(menu, node, ic, vc);
- }
- if (selection.size() > 0)
- {
- implicitlySelectedNodeList = getSelectedNodes(selection, true);
- // contribute delete actions
- contributeDeleteActions(menu, implicitlySelectedNodeList, ic, vc);
- }
- }
- catch(Exception e)
- {
- menu.add(new Action(e.getMessage()){});
- }
- /*
- if (selection.size() > 0)
- {
- // contribute replace actions
- contributeReplaceActions(menu, implicitlySelectedNodeList, ic, vc);
- }*/
- }
-
- protected void contributeAddChildActions(IMenuManager menu, Node node, int ic, int vc)
- {
- int nodeType = node.getNodeType();
- if (nodeType == Node.ELEMENT_NODE)
- {
- // 'Add Child...' and 'Add Attribute...' actions
- //
- Element element = (Element) node;
- MyMenuManager newMenu = new MyMenuManager("New"){
- public boolean isVisible() { return true; }
- };//$NON-NLS-1$
- newMenu.setVisible(true);
- menu.add(newMenu);
-
- CMElementDeclaration ed = modelQuery.getCMElementDeclaration(element);
- if (ed != null)
- {
- List modelQueryActionList = new ArrayList();
- // add insert child node actions
- //
- modelQueryActionList = new ArrayList();
- modelQuery.getInsertActions(element, ed, -1, ic, vc, modelQueryActionList);
- addActionHelper(newMenu, modelQueryActionList);
- }
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/DOMExtensionTreeContentProvider.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/DOMExtensionTreeContentProvider.java
deleted file mode 100644
index bc90293694..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/DOMExtensionTreeContentProvider.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2006 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
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.wst.sse.core.internal.provisional.INodeAdapter;
-import org.eclipse.wst.sse.core.internal.provisional.INodeNotifier;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-public class DOMExtensionTreeContentProvider implements ITreeContentProvider, INodeAdapter
-{
- protected String facet;
- protected Viewer viewer;
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput)
- {
- this.viewer = viewer;
- }
-
- public Object[] getChildren(Object parentElement)
- {
- if (parentElement instanceof Element)
- {
- Element element = (Element)parentElement;
- ArrayList list = new ArrayList();
- for (Node node = element.getFirstChild(); node != null; node = node.getNextSibling())
- {
- if (node.getNodeType() == Node.ELEMENT_NODE)
- {
- list.add(node);
- }
- }
- return list.toArray();
- }
- return Collections.EMPTY_LIST.toArray();
- }
-
- public boolean hasChildren(Object element)
- {
- Object[] children = getChildren(element);
- return children.length > 0;
- }
-
- public Object getParent(Object element)
- {
- return null;
- }
-
- public java.lang.Object[] getElements(java.lang.Object inputElement)
- {
- return getChildren(inputElement);
- }
-
- public void dispose()
- {
- }
-
- public void notifyChanged(INodeNotifier notifier, int eventType, Object changedFeature, Object oldValue, Object newValue, int pos)
- {
- if (viewer != null)
- {
- viewer.refresh();
- }
- }
-
- public boolean isAdapterForType(Object type)
- {
- // this method is not used
- return false;
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/DOMExtensionTreeLabelProvider.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/DOMExtensionTreeLabelProvider.java
deleted file mode 100644
index d173548205..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/DOMExtensionTreeLabelProvider.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 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
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo;
-
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.custom.NodeCustomizationRegistry;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-import org.w3c.dom.Attr;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.Text;
-
-public class DOMExtensionTreeLabelProvider extends LabelProvider
-{
- protected static final Image DEFAULT_ELEMENT_ICON = XSDEditorPlugin.getXSDImage("icons/XSDElement.gif"); //$NON-NLS-1$
- protected static final Image DEFAULT_ATTR_ICON = XSDEditorPlugin.getXSDImage("icons/XSDAttribute.gif"); //$NON-NLS-1$
-
- public DOMExtensionTreeLabelProvider()
- {
- }
-
- public Image getImage(Object element)
- {
- NodeCustomizationRegistry registry = XSDEditorPlugin.getDefault().getNodeCustomizationRegistry();
- if (element instanceof Element)
- {
- Element domElement = (Element) element;
- String namespace = domElement.getNamespaceURI();
- if (namespace != null)
- {
- ILabelProvider lp = registry.getLabelProvider(namespace);
- if (lp != null)
- {
- Image img = lp.getImage(domElement);
- if (img != null)
- return img;
- }
- }
- return DEFAULT_ELEMENT_ICON;
- }
- if (element instanceof Attr)
- return DEFAULT_ATTR_ICON;
- return null;
- }
-
- public String getText(Object input)
- {
- if (input instanceof Element)
- {
- Element domElement = (Element) input;
- String textVal = "";
-
- if (domElement.hasChildNodes())
- {
- Node node = domElement.getChildNodes().item(0);
- if (node instanceof Text)
- {
- Text textNode = (Text) node;
- try
- {
- if (!textNode.getNodeValue().contains("\n"))
- textVal = " [" + textNode.getNodeValue() + "]";
- }
- catch (DOMException e)
- {
- textVal = "";
- }
- }
- }
- return domElement.getLocalName() + textVal;
- }
- if ( input instanceof Attr){
- return ((Attr) input).getLocalName();
- }
- return ""; //$NON-NLS-1$
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/ExtensionDetailsContentProvider.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/ExtensionDetailsContentProvider.java
deleted file mode 100644
index 6cfaac1e48..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/ExtensionDetailsContentProvider.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2006 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
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo;
-
-public interface ExtensionDetailsContentProvider
-{
- Object[] getItems(Object input);
- String getName(Object item);
- String getValue(Object item);
- String[] getPossibleValues(Object item);
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/ExtensionDetailsViewer.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/ExtensionDetailsViewer.java
deleted file mode 100644
index c3641c57de..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/ExtensionDetailsViewer.java
+++ /dev/null
@@ -1,334 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 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
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo;
-
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.CommandStack;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.events.FocusListener;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.KeyListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-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.Label;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.swt.widgets.Widget;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-import org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.custom.DialogNodeEditorConfiguration;
-import org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.custom.ListNodeEditorConfiguration;
-import org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.custom.NodeEditorConfiguration;
-
-public class ExtensionDetailsViewer extends Viewer
-{
- private final static String ITEM_DATA = "ITEM_DATA"; //$NON-NLS-1$
- private final static String EDITOR_CONFIGURATION_DATA = "EDITOR_CONFIGURATION_DATA"; //$NON-NLS-1$
-
- Composite control;
- Composite composite;
- ExtensionDetailsContentProvider contentProvider;
- TabbedPropertySheetWidgetFactory widgetFactory;
- InternalControlListener internalControlListener;
- CommandStack commandStack;
-
- public ExtensionDetailsViewer(Composite parent, TabbedPropertySheetWidgetFactory widgetFactory)
- {
- this.widgetFactory = widgetFactory;
- control = widgetFactory.createComposite(parent);
- internalControlListener = new InternalControlListener();
- control.setLayout(new GridLayout());
- }
- public Control getControl()
- {
- return control;
- }
-
- public void setCommandStack(CommandStack commandStack)
- {
- this.commandStack = commandStack;
- }
-
- public Object getInput()
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public ISelection getSelection()
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public void refresh()
- {
- Control[] children = composite.getChildren();
- for (int i = 0; i < children.length; i++)
- {
- Control control = children[i];
- if (control instanceof Text)
- {
- ExtensionItem item = (ExtensionItem)control.getData(ITEM_DATA);
- String value = contentProvider.getValue(item);
- ((Text)control).setText(value);
- }
- }
- }
-
- private void createTextOrComboControl(ExtensionItem item, Composite composite)
- {
- Control control = null;
- String value = contentProvider.getValue(item);
- NodeEditorConfiguration editorConfiguration = item.getPropertyEditorConfiguration();
-
- if (editorConfiguration != null && hasStyle(editorConfiguration, NodeEditorConfiguration.STYLE_COMBO))
- {
- ListNodeEditorConfiguration configuration = (ListNodeEditorConfiguration)editorConfiguration;
- CCombo combo = widgetFactory.createCCombo(composite);
- combo.setText(value);
- Object[] values = configuration.getValues(item);
- LabelProvider labelProvider = configuration.getLabelProvider();
- for (int j = 0; j < values.length; j++)
- {
- Object o = values[j];
- String displayName = labelProvider != null ?
- labelProvider.getText(o) :
- o.toString();
- combo.add(displayName);
- }
- combo.addSelectionListener(internalControlListener);
- control = combo;
- }
- if (control == null)
- {
- Text text = widgetFactory.createText(composite,value);
- text.addKeyListener(internalControlListener);
- control = text;
- }
- control.setData(ITEM_DATA, item);
- control.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- control.addFocusListener(internalControlListener);
- }
-
- private void createButtonControl(ExtensionItem item, Composite composite)
- {
- NodeEditorConfiguration editorConfiguration = item.getPropertyEditorConfiguration();
- if (editorConfiguration != null && hasStyle(editorConfiguration, NodeEditorConfiguration.STYLE_DIALOG))
- {
- DialogNodeEditorConfiguration configuration = (DialogNodeEditorConfiguration)editorConfiguration;
- Button button = new Button(composite, SWT.NONE);
- GridData gridData = new GridData();
- gridData.heightHint = 17;
- button.setLayoutData(gridData);
- button.addSelectionListener(internalControlListener);
- button.setData(ITEM_DATA, item);
- button.setData(EDITOR_CONFIGURATION_DATA, configuration);
- String text = configuration.getButonText();
- if (text != null)
- {
- button.setText(text); //$NON-NLS-1$
- }
- button.setImage(configuration.getButtonImage());
- }
- else
- {
- Control placeHolder = new Label(composite, SWT.NONE);
- placeHolder.setVisible(false);
- placeHolder.setEnabled(false);
- placeHolder.setLayoutData(new GridData());
- }
- }
-
- public void setInput(Object input)
- {
- // TODO (cs) add assertions
- //
- if (contentProvider == null)
- return;
-
- if (composite != null)
- {/*
- for (Iterator i = controlsThatWeAreListeningTo.iterator(); i.hasNext(); )
- {
- Control control = (Control)i.next();
- if (control != null)
- {
- control.removeFocusListener(internalFocusListener);
- }
- } */
- removeListeners();
- composite.dispose();
- }
-
- composite = widgetFactory.createComposite(control);
- composite.setBackground(ColorConstants.white);
- GridLayout gridLayout = new GridLayout();
- gridLayout.numColumns = 3;
- composite.setLayout(gridLayout);
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- Object[] items = contentProvider.getItems(input);
-
- for (int i = 0; i < items.length; i++)
- {
- ExtensionItem item = (ExtensionItem)items[i];
- String name = contentProvider.getName(item);
- Label label = widgetFactory.createLabel(composite, name + ":"); //$NON-NLS-1$
- label.setLayoutData(new GridData());
- createTextOrComboControl(item, composite);
- createButtonControl(item, composite);
- }
- control.layout(true);
- }
-
- private boolean hasStyle(NodeEditorConfiguration configuration, int style)
- {
- return (configuration.getStyle() & style) != 0;
- }
-
-
- public void setSelection(ISelection selection, boolean reveal)
- {
- // TODO Auto-generated method stub
-
- }
- public ExtensionDetailsContentProvider getContentProvider()
- {
- return contentProvider;
- }
- public void setContentProvider(ExtensionDetailsContentProvider contentProvider)
- {
- this.contentProvider = contentProvider;
- }
-
- private void applyEdit(ExtensionItem item, Widget widget)
- {
- if (item != null)
- {
- String value = null;
- if (widget instanceof Text)
- {
- Text text = (Text)widget;
- value = text.getText();
- }
- else if (widget instanceof CCombo)
- {
- CCombo combo = (CCombo)widget;
- int index = combo.getSelectionIndex();
- if (index != -1)
- {
- value = combo.getItem(index);
- }
- }
- if (value != null)
- {
- Command command = item.getUpdateValueCommand(value);
- if (command != null)
- {
- if (commandStack != null)
- commandStack.execute(command);
- else
- command.execute();
- }
- }
- }
- }
-
- class InternalControlListener implements FocusListener, SelectionListener, KeyListener
- {
- public void widgetSelected(SelectionEvent e)
- {
- // for button controls we handle selection events
- //
- Object item = e.widget.getData(EDITOR_CONFIGURATION_DATA);
- if (item == null)
- item = e.widget.getData(ITEM_DATA);
- if (item instanceof DialogNodeEditorConfiguration)
- {
- DialogNodeEditorConfiguration dialogNodeEditorConfiguration = (DialogNodeEditorConfiguration)item;
- dialogNodeEditorConfiguration.invokeDialog();
- }
- else if (item instanceof ExtensionItem)
- {
- applyEdit((ExtensionItem)item, e.widget);
- }
- }
-
- public void widgetDefaultSelected(SelectionEvent e)
- {
- // do nothing
- }
-
- public void focusGained(FocusEvent e)
- {
- }
-
- public void focusLost(FocusEvent e)
- {
- // apply edits for text and combo box controls
- // via the focusLost event
- Object item = e.widget.getData(ITEM_DATA);
- if (item instanceof ExtensionItem)
- {
- applyEdit((ExtensionItem)item, e.widget);
- }
- }
-
- public void keyPressed(KeyEvent e)
- {
- // handle explict ENTER key
- Object item = e.widget.getData(ITEM_DATA);
- if (item instanceof ExtensionItem)
- {
- if (e.character == SWT.CR)
- applyEdit((ExtensionItem)item, e.widget);
- }
- }
-
- public void keyReleased(KeyEvent e)
- {
- // Ignore these events
- }
- }
-
- public void removeListeners()
- {
- if (composite != null && !composite.isDisposed())
- {
- Control [] children = composite.getChildren();
- int length = children.length;
- for (int i = 0; i < length; i++)
- {
- Control o = children[i];
- if (o instanceof CCombo)
- {
- ((CCombo)o).removeSelectionListener(internalControlListener);
- o.removeFocusListener(internalControlListener);
- }
- else if (o instanceof Text)
- {
- ((Text)o).removeKeyListener(internalControlListener);
- o.removeFocusListener(internalControlListener);
- }
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/ExtensionItem.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/ExtensionItem.java
deleted file mode 100644
index 4b67808305..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/ExtensionItem.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2006 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
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo;
-
-import org.eclipse.gef.commands.Command;
-import org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.custom.NodeEditorConfiguration;
-
-public abstract class ExtensionItem
-{
- NodeEditorConfiguration propertyEditorConfiguration;
-
- public NodeEditorConfiguration getPropertyEditorConfiguration()
- {
- return propertyEditorConfiguration;
- }
-
- public void setPropertyEditorConfiguration(NodeEditorConfiguration propertyEditorConfiguration)
- {
- this.propertyEditorConfiguration = propertyEditorConfiguration;
- }
-
- public abstract Command getUpdateValueCommand(String newValue);
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/ExtensionItemEditManager.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/ExtensionItemEditManager.java
deleted file mode 100644
index b84ad1c2ea..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/ExtensionItemEditManager.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2006 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
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo;
-
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Widget;
-
-/**
- * @deprecated
- */
-public interface ExtensionItemEditManager
-{
- public final static String STYLE_NONE = "none"; //$NON-NLS-1$
- public final static String STYLE_TEXT = "text"; //$NON-NLS-1$
- public final static String STYLE_COMBO = "combo"; //$NON-NLS-1$
- public final static String STYLE_CUSTOM = "custom"; //$NON-NLS-1$
-
- void handleEdit(Object item, Widget widget);
- String getTextControlStyle(Object item);
- String getButtonControlStyle(Object item);
- Control createCustomTextControl(Composite composite, Object item);
- Control createCustomButtonControl(Composite composite, Object item);
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/ExtensionItemFilter.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/ExtensionItemFilter.java
deleted file mode 100644
index b199c37c60..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/ExtensionItemFilter.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 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
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo;
-
-import org.eclipse.xsd.XSDConcreteComponent;
-
-// cs: This interface is intended to suppliment the NodeFilter class
-// that can be specified via the customization extensions point.
-// When the initial list of a category's objects is displayed
-// we'll use a NodeFilter to prune the list. If the NodeFilter
-// implements this interface we'll call this interface's isApplicableContext
-// method instead of the NodeFilter's DOM node based method. This provides
-// are a more convenient interface for clients who are only interested in
-// filter the list presented via the AddExtensionComponentDialog.
-// See the class ExtensionsSection for more details.
-//
-public interface ExtensionItemFilter
-{
- public boolean isApplicableContext(XSDConcreteComponent parent, XSDConcreteComponent candidate);
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/ExtensionsSchemasRegistry.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/ExtensionsSchemasRegistry.java
deleted file mode 100644
index 8fc3af68bc..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/ExtensionsSchemasRegistry.java
+++ /dev/null
@@ -1,330 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.StringTokenizer;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.wst.common.uriresolver.internal.provisional.URIResolver;
-import org.eclipse.wst.common.uriresolver.internal.provisional.URIResolverPlugin;
-import org.eclipse.wst.xsd.ui.internal.common.commands.ExtensibleAddExtensionCommand;
-import org.eclipse.wst.xsd.ui.internal.common.commands.ExtensibleRemoveExtensionNodeCommand;
-import org.w3c.dom.Element;
-
-public class ExtensionsSchemasRegistry
-{
- public static final String USER_ADDED_EXT_SCHEMAS = "USER-ADDED-EXT-SCHEMAS"; // TODO externalize
- private static final String LOCATION_PREFIX = "platform:/plugin/"; //$NON-NLS-1$
- public static final String DESCRIPTION = "description"; //$NON-NLS-1$
- public static final String DISPLAYNAME = "displayName"; //$NON-NLS-1$
- public static final String NAMESPACEURI = "namespaceURI"; //$NON-NLS-1$
- public static final String XSDFILEURL = "xsdFileURL"; //$NON-NLS-1$
- public static final String LABELPROVIDER = "labelProviderClass"; //$NON-NLS-1$
- public static final String ADD_COMMAND_CLASS = "addCommandClass"; //$NON-NLS-1$
- public static final String DELETE_COMMAND_CLASS = "deleteCommandClass"; //$NON-NLS-1$
- public static final String CATEGORY_PROVIDER_CLASS = "class"; //$NON-NLS-1$
-
- protected IPreferenceStore prefStore;
- protected String extensionId;
-
- protected ArrayList nsURIProperties, categoryProviderList;
- private String deprecatedExtensionId;
-
- public ExtensionsSchemasRegistry(String appinfo_extensionid)
- {
- extensionId = appinfo_extensionid;
- }
-
- public void __internalSetDeprecatedExtensionId(String deprecatedId)
- {
- deprecatedExtensionId = deprecatedId;
- }
-
- public void setPrefStore(IPreferenceStore store)
- {
- prefStore = store;
- }
-
- public List getAllExtensionsSchemasContribution()
- {
- // If we read the registry, then let's not do it again.
- if (nsURIProperties != null)
- {
- return nsURIProperties;
- }
-
- nsURIProperties = new ArrayList();
- categoryProviderList = new ArrayList();
-
- getAllExtensionsSchemasContribution(extensionId);
- if (deprecatedExtensionId != null)
- {
- getAllExtensionsSchemasContribution(deprecatedExtensionId);
- }
-
- // get user-added schemas stored in preference
- if (prefStore != null)
- {
- String value = prefStore.getString(USER_ADDED_EXT_SCHEMAS);
- StringTokenizer tokenizer = new StringTokenizer(value, "\n");
-
- while ( tokenizer.hasMoreTokens() )
- {
- nsURIProperties.add( new SpecificationForExtensionsSchema( tokenizer.nextToken() ) );
- }
- }
-
- return nsURIProperties;
- }
-
- private List getAllExtensionsSchemasContribution(String id)
- {
- IConfigurationElement[] asiPropertiesList = Platform.getExtensionRegistry().getConfigurationElementsFor(id);
-
- boolean hasASIProperties = (asiPropertiesList != null) && (asiPropertiesList.length > 0);
-
- if (hasASIProperties)
- {
- for (int i = 0; i < asiPropertiesList.length; i++)
- {
- IConfigurationElement asiPropertiesElement = asiPropertiesList[i];
- String elementName = asiPropertiesElement.getName();
-
- if ("category".equals(elementName))
- {
- String description = asiPropertiesElement.getAttribute(DESCRIPTION);
- String displayName = asiPropertiesElement.getAttribute(DISPLAYNAME);
- String namespaceURI = asiPropertiesElement.getAttribute(NAMESPACEURI);
- String xsdFileURL = asiPropertiesElement.getAttribute(XSDFILEURL);
- String labelProviderClass = asiPropertiesElement.getAttribute(LABELPROVIDER);
- String addCommandClass = asiPropertiesElement.getAttribute(ADD_COMMAND_CLASS);
- String deleteCommandClass = asiPropertiesElement.getAttribute(DELETE_COMMAND_CLASS);
-
- if (displayName == null)
- {
- // If there is no display name, force the user
- // to manually create a name. Therefore, we ignore entry without
- // a display name.
- continue;
- }
-
- if (xsdFileURL == null)
- {
- xsdFileURL = locateFileUsingCatalog(namespaceURI);
- }
-
- SpecificationForExtensionsSchema extensionsSchemaSpec = createEntry();
- extensionsSchemaSpec.setDescription(description);
- extensionsSchemaSpec.setDisplayName(displayName);
- extensionsSchemaSpec.setNamespaceURI(namespaceURI);
- extensionsSchemaSpec.setDefautSchema();
-
- String pluginId = asiPropertiesElement.getDeclaringExtension().getContributor().getName();
-
- if (labelProviderClass != null)
- {
- ILabelProvider labelProvider = null;
- try
- {
- Class theClass = Platform.getBundle(pluginId).loadClass(labelProviderClass);
- if (theClass != null)
- {
- labelProvider = (ILabelProvider) theClass.newInstance();
- if (labelProvider != null)
- {
- extensionsSchemaSpec.setLabelProvider(labelProvider);
- }
- }
- }
- catch (Exception e)
- {
-
- }
- }
-
- if (addCommandClass != null)
- {
- try
- {
- ExtensibleAddExtensionCommand addCommand = (ExtensibleAddExtensionCommand)asiPropertiesElement.createExecutableExtension(ADD_COMMAND_CLASS);
- if (addCommand != null)
- {
- extensionsSchemaSpec.setExtensibleAddExtensionCommand(addCommand);
- }
- }
- catch (Exception e)
- {
- }
- }
-
- if (deleteCommandClass != null)
- {
- try
- {
- ExtensibleRemoveExtensionNodeCommand deleteCommand = (ExtensibleRemoveExtensionNodeCommand)asiPropertiesElement.createExecutableExtension(DELETE_COMMAND_CLASS);
- if (deleteCommand != null)
- {
- extensionsSchemaSpec.setExtensibleRemoveExtensionNodeCommand(deleteCommand);
- }
- }
- catch (Exception e)
- {
- }
- }
-
- extensionsSchemaSpec.setLocation(LOCATION_PREFIX + pluginId + "/" + xsdFileURL); //$NON-NLS-1$
-
- nsURIProperties.add(extensionsSchemaSpec);
-
- }
- else if ("categoryProvider".equals(elementName))
- {
- String categoryProviderClass = asiPropertiesElement.getAttribute(CATEGORY_PROVIDER_CLASS);
-
- if (categoryProviderClass != null)
- {
- try
- {
- CategoryProvider categoryProvider = (CategoryProvider)asiPropertiesElement.createExecutableExtension(CATEGORY_PROVIDER_CLASS);
- if (categoryProvider != null)
- {
- categoryProviderList.add(categoryProvider);
- }
- }
- catch (Exception e)
- {
- }
- }
-
- }
-
- }
-
- }
-
- return nsURIProperties;
- }
-
- public ExtensibleAddExtensionCommand getAddExtensionCommand(String namespace)
- {
- // Didn't retrieve the config elements yet.
- if (nsURIProperties == null)
- {
- getAllExtensionsSchemasContribution();
- }
-
- for (Iterator i = nsURIProperties.iterator(); i.hasNext(); )
- {
- SpecificationForExtensionsSchema spec = (SpecificationForExtensionsSchema)i.next();
- String nsURI = spec.getNamespaceURI();
- if (nsURI != null && nsURI.equals(namespace))
- {
- return spec.getExtensibleAddExtensionCommand();
- }
- }
-
- for (Iterator i = categoryProviderList.iterator(); i.hasNext(); )
- {
- CategoryProvider categoryProvider = (CategoryProvider)i.next();
- for (Iterator j = categoryProvider.getCategories().iterator(); j.hasNext(); )
- {
- SpecificationForExtensionsSchema spec = (SpecificationForExtensionsSchema) j.next();
- String namespaceURI = spec.getNamespaceURI();
- if (namespaceURI != null && namespaceURI.equals(namespace))
- {
- return spec.getExtensibleAddExtensionCommand();
- }
- }
- }
-
- return null;
- }
-
- public ExtensibleRemoveExtensionNodeCommand getRemoveExtensionNodeCommand(String namespace)
- {
- // Didn't retrieve the config elements yet.
- if (nsURIProperties == null)
- {
- getAllExtensionsSchemasContribution();
- }
-
- for (Iterator i = nsURIProperties.iterator(); i.hasNext(); )
- {
- SpecificationForExtensionsSchema spec = (SpecificationForExtensionsSchema)i.next();
- String nsURI = spec.getNamespaceURI();
- if (nsURI != null && nsURI.equals(namespace))
- {
- return spec.getExtensibleRemoveExtensionNodeCommand();
- }
- }
-
- for (Iterator i = categoryProviderList.iterator(); i.hasNext(); )
- {
- CategoryProvider categoryProvider = (CategoryProvider)i.next();
- for (Iterator j = categoryProvider.getCategories().iterator(); j.hasNext(); )
- {
- SpecificationForExtensionsSchema spec = (SpecificationForExtensionsSchema) j.next();
- String namespaceURI = spec.getNamespaceURI();
- if (namespaceURI != null && namespaceURI.equals(namespace))
- {
- return spec.getExtensibleRemoveExtensionNodeCommand();
- }
- }
- }
-
- return null;
- }
-
- public List getCategoryProviders()
- {
- if (nsURIProperties == null)
- {
- getAllExtensionsSchemasContribution();
- }
-
- return categoryProviderList;
- }
-
- /**
- * @deprecated
- */
- public ILabelProvider getLabelProvider(Element element)
- {
- return null;
- }
-
- public SpecificationForExtensionsSchema createEntry()
- {
- return new SpecificationForExtensionsSchema();
- }
-
- /**
- * Returns the String location for the schema with the given namespaceURI by
- * looking at the XML catalog. We look only in the plugin specified entries of
- * the catalog.
- *
- * @param namespaceURI
- * @return String representing the location of the schema.
- */
- private String locateFileUsingCatalog(String namespaceURI)
- {
- URIResolver resolver = URIResolverPlugin.createResolver();
- String result = resolver.resolve("", namespaceURI, "");
- return resolver.resolvePhysicalLocation("", namespaceURI, result);
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/SelectFromCatalogDialog.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/SelectFromCatalogDialog.java
deleted file mode 100644
index 1f2737a523..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/SelectFromCatalogDialog.java
+++ /dev/null
@@ -1,212 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 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
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo;
-
-import org.eclipse.jface.dialogs.Dialog;
-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.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.wst.xml.core.internal.XMLCorePlugin;
-import org.eclipse.wst.xml.core.internal.catalog.CatalogSet;
-import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalog;
-import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalogEntry;
-import org.eclipse.wst.xml.core.internal.catalog.provisional.INextCatalog;
-import org.eclipse.wst.xml.ui.internal.catalog.XMLCatalogEntriesView;
-import org.eclipse.wst.xml.ui.internal.catalog.XMLCatalogEntryDetailsView;
-import org.eclipse.wst.xml.ui.internal.catalog.XMLCatalogMessages;
-import org.eclipse.wst.xml.ui.internal.catalog.XMLCatalogTreeViewer;
-
-public class SelectFromCatalogDialog extends Dialog
-{
-
- private ICatalog workingUserCatalog;
- private ICatalog userCatalog;
- private ICatalog defaultCatalog;
- private XMLCatalogEntriesView catalogEntriesView;
- private ICatalog systemCatalog;
-
- private String currentSelectionLocation;
- private String currentSelectionNamespace;
-
- public SelectFromCatalogDialog(Shell parentShell)
- {
- super(parentShell);
-
- defaultCatalog = XMLCorePlugin.getDefault().getDefaultXMLCatalog();
- INextCatalog[] nextCatalogs = defaultCatalog.getNextCatalogs();
- for (int i = 0; i < nextCatalogs.length; i++)
- {
- INextCatalog catalog = nextCatalogs[i];
- ICatalog referencedCatalog = catalog.getReferencedCatalog();
- if (referencedCatalog != null)
- {
- if (XMLCorePlugin.SYSTEM_CATALOG_ID.equals(referencedCatalog.getId()))
- {
- systemCatalog = referencedCatalog;
- }
- else if (XMLCorePlugin.USER_CATALOG_ID.equals(referencedCatalog.getId()))
- {
- userCatalog = referencedCatalog;
- }
- }
- }
- }
-
- protected Control createDialogArea(Composite parent)
- {
- // we create a working copy of the 'User Settings' for the Catalog
- // that we can modify
- CatalogSet tempCatalogSet = new CatalogSet();
- workingUserCatalog = tempCatalogSet.lookupOrCreateCatalog("working", ""); //$NON-NLS-1$ //$NON-NLS-2$
-
- // TODO: add entries from the nested catalogs as well
- workingUserCatalog.addEntriesFromCatalog(userCatalog);
-
- Composite composite = new Composite(parent, SWT.NULL);
- composite.setLayout(new GridLayout());
- GridData gridData = new GridData(GridData.FILL_BOTH);
- gridData.heightHint = 500;
- composite.setLayoutData(gridData);
- createCatalogEntriesView(composite);
- createCatalogDetailsView(composite);
-
- return composite;
- }
-
- protected void createCatalogEntriesView(Composite parent)
- {
- Group group = new Group(parent, SWT.NONE);
- group.setLayout(new GridLayout());
- GridData gridData = new GridData(GridData.FILL_BOTH);
- gridData.widthHint = 370;
- group.setLayoutData(gridData);
- group.setText(XMLCatalogMessages.UI_LABEL_USER_ENTRIES);
- group.setToolTipText(XMLCatalogMessages.UI_LABEL_USER_ENTRIES_TOOL_TIP);
-
- /*
- * create a subclass of XMLCatalogEntriesView which suppresses - the
- * creation of 'Add', 'Edit', 'Delete' buttons - any method involving the
- * above buttons
- */
- catalogEntriesView = new XMLCatalogEntriesView(group, workingUserCatalog, systemCatalog)
- {
- protected void createButtons(Composite parent)
- {
- }
-
- protected void updateWidgetEnabledState()
- {
- }
-
- };
-
- // Only XML Schema entry is selectable
- catalogEntriesView.setLayoutData(gridData);
- XMLCatalogTreeViewer catalogTreeViewer = ((XMLCatalogTreeViewer) catalogEntriesView.getViewer());
- catalogTreeViewer.resetFilters();
-
- catalogTreeViewer.addFilter(new XMLCatalogTableViewerFilter(new String[] { ".xsd" }));
- }
-
- // Bug in the filter of the XML plugin, have to give a correct version here
- // TODO: Waiting for the fix to be commited to XML plugin and
- // be used by constellation
- private class XMLCatalogTableViewerFilter extends ViewerFilter
- {
- private static final String W3_XMLSCHEMA_NAMESPACE = "http://www.w3.org/2001/";
- protected String[] extensions;
-
- public XMLCatalogTableViewerFilter(String[] extensions1)
- {
- this.extensions = extensions1;
- }
-
- public boolean isFilterProperty(Object element, Object property)
- {
- return false;
- }
-
- public boolean select(Viewer viewer, Object parent, Object element)
- {
- boolean result = false;
- if (element instanceof ICatalogEntry)
- {
- ICatalogEntry catalogEntry = (ICatalogEntry) element;
- for (int i = 0; i < extensions.length; i++)
- {
- // if the extension is correct and the namespace indicates
- // that this entry is not the W3 XML Schema
- if (catalogEntry.getURI().endsWith(extensions[i]) && !catalogEntry.getKey().startsWith(W3_XMLSCHEMA_NAMESPACE))
- {
- result = true;
- break;
- }
- }
- }
- else if (element.equals(XMLCatalogTreeViewer.PLUGIN_SPECIFIED_ENTRIES_OBJECT) || element.equals(XMLCatalogTreeViewer.USER_SPECIFIED_ENTRIES_OBJECT))
- {
- return true;
- }
- return result;
- }
- }
-
- protected void createCatalogDetailsView(Composite parent)
- {
- Group detailsGroup = new Group(parent, SWT.NONE);
- detailsGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- detailsGroup.setLayout(new GridLayout());
- detailsGroup.setText(XMLCatalogMessages.UI_LABEL_DETAILS);
- final XMLCatalogEntryDetailsView detailsView = new XMLCatalogEntryDetailsView(detailsGroup);
- ISelectionChangedListener listener = new ISelectionChangedListener()
- {
- public void selectionChanged(SelectionChangedEvent event)
- {
- ISelection selection = event.getSelection();
- Object selectedObject = (selection instanceof IStructuredSelection) ? ((IStructuredSelection) selection).getFirstElement() : null;
- if (selectedObject instanceof ICatalogEntry)
- {
- ICatalogEntry entry = (ICatalogEntry) selectedObject;
- detailsView.setCatalogElement(entry);
- currentSelectionLocation = entry.getURI();
- currentSelectionNamespace = entry.getKey();
- }
- else
- {
- detailsView.setCatalogElement((ICatalogEntry) null);
- currentSelectionLocation = "";
- currentSelectionNamespace = "";
- }
- }
- };
- catalogEntriesView.getViewer().addSelectionChangedListener(listener);
- }
-
- public String getCurrentSelectionLocation()
- {
- return currentSelectionLocation;
- }
-
- public String getCurrentSelectionNamespace()
- {
- return currentSelectionNamespace;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/SpecificationForExtensionsSchema.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/SpecificationForExtensionsSchema.java
deleted file mode 100644
index 8b4a9a5518..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/SpecificationForExtensionsSchema.java
+++ /dev/null
@@ -1,219 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo;
-
-import java.util.StringTokenizer;
-
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.wst.xsd.ui.internal.common.commands.ExtensibleAddExtensionCommand;
-import org.eclipse.wst.xsd.ui.internal.common.commands.ExtensibleRemoveExtensionNodeCommand;
-import org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.custom.NodeFilter;
-
-public class SpecificationForExtensionsSchema
-{
- private String description;
- private String displayName;
- private String namespaceURI;
- private String location;
- private ILabelProvider labelProvider;
- private boolean isDefaultSchema = false;
- private ExtensibleAddExtensionCommand addCommand;
- private ExtensibleRemoveExtensionNodeCommand removeCommand;
- private NodeFilter nodeFilter;
- private String classification;
-
- /**
- * Either the workspace-relative path of the xsd file or the namespace
- * of the xsd file (if it come from the Catalog)
- */
- private String sourceHint;
- private boolean fromCatalog;
-
- public SpecificationForExtensionsSchema()
- {
- super();
- }
-
- public SpecificationForExtensionsSchema(String desc) {
- StringTokenizer tokenizer = new StringTokenizer(desc, "\t");
-
- // we must be sure that each 'desc' contains info in correct format
- // no error checking here
- description = tokenizer.nextToken();
- displayName = tokenizer.nextToken();
- namespaceURI = tokenizer.nextToken();
- location = tokenizer.nextToken();
- isDefaultSchema = tokenizer.nextToken().equals("true");
- sourceHint = tokenizer.nextToken();
- fromCatalog = tokenizer.nextToken().equals("true");
- }
-
-/**
- * @return Returns the description.
- */
- public String getDescription()
- {
- return description;
- }
-
- /**
- * @param description
- * The description to set.
- */
- public void setDescription(String description)
- {
- this.description = description;
- }
-
- /**
- * @return Returns the displayName.
- */
- public String getDisplayName()
- {
- return displayName;
- }
-
- /**
- * @param name
- * The displayName to set.
- */
- public void setDisplayName(String displayName)
- {
- this.displayName = displayName;
- }
-
- /**
- * @return Returns the namespaceURI.
- */
- public String getNamespaceURI()
- {
- return namespaceURI;
- }
-
- /**
- * @param namespaceURI
- * The namespaceURI to set.
- */
- public void setNamespaceURI(String namespaceURI)
- {
- this.namespaceURI = namespaceURI;
- }
-
- /**
- * @return Returns the location of the xsd file.
- */
- public String getLocation()
- {
- return location;
- }
-
- /**
- * @param location
- * The location to be set
- */
- public void setLocation(String location)
- {
- this.location = location;
- }
-
- public ILabelProvider getLabelProvider()
- {
- return labelProvider;
- }
-
- public void setLabelProvider(ILabelProvider labelProvider)
- {
- this.labelProvider = labelProvider;
- }
-
- public ExtensibleAddExtensionCommand getExtensibleAddExtensionCommand()
- {
- return addCommand;
- }
-
- public void setExtensibleAddExtensionCommand(ExtensibleAddExtensionCommand addCommand)
- {
- this.addCommand = addCommand;
- }
-
- public ExtensibleRemoveExtensionNodeCommand getExtensibleRemoveExtensionNodeCommand()
- {
- return removeCommand;
- }
-
- public void setExtensibleRemoveExtensionNodeCommand(ExtensibleRemoveExtensionNodeCommand removeCommand)
- {
- this.removeCommand = removeCommand;
- }
-
- public boolean isDefautSchema(){
- return isDefaultSchema ;
- }
-
- public void setDefautSchema(){
- isDefaultSchema = true;
- }
-
- public void setSourceHint(String s){
- sourceHint = s;
- }
-
- public String getSourceHint(){
- return sourceHint;
- }
-
- public boolean isFromCatalog() {
- return fromCatalog;
- }
-
- public void setFromCatalog(boolean fromCatalog) {
- this.fromCatalog = fromCatalog;
- }
-
- /**
- * There is no support for setting this via the extension point defined in the plugin.xml
- * This allows extenders to provide a filter for a category that has been added
- * dynamically (programmatically)
- * @param nodeFilter
- */
- public void setNodeFilter(NodeFilter nodeFilter)
- {
- this.nodeFilter = nodeFilter;
- }
-
- /**
- * Get the node filter
- * @return NodeFilter
- */
- public NodeFilter getNodeFilter()
- {
- return nodeFilter;
- }
-
- /**
- * There is no support for setting this via the extension point defined in the plugin.xml
- * This allows extenders to group categories into groups or classificationss
- * @param classification
- */
- public void setClassification(String classification)
- {
- this.classification = classification;
- }
-
- /**
- * Get the classification
- * @return String
- */
- public String getClassification()
- {
- return classification;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/XSDExtensionTreeContentProvider.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/XSDExtensionTreeContentProvider.java
deleted file mode 100644
index d0e4255561..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/XSDExtensionTreeContentProvider.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 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
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.wst.xsd.ui.internal.common.util.XSDCommonUIUtils;
-import org.eclipse.xsd.XSDAnnotation;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.util.XSDConstants;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-public class XSDExtensionTreeContentProvider extends DOMExtensionTreeContentProvider
-{
- public Object[] getElements(Object inputElement)
- {
- if (inputElement instanceof XSDConcreteComponent)
- {
- XSDConcreteComponent component = (XSDConcreteComponent) inputElement;
- List elementsAndAttributes = new ArrayList();
- XSDAnnotation xsdAnnotation = XSDCommonUIUtils.getInputXSDAnnotation(component, false);
- if (xsdAnnotation != null)
- {
- // Bug 137856 - Extension page of properties shouldn't display imported elements
- // Added this if statement
- if (xsdAnnotation.getSchema() == component.getSchema())
- {
- List appInfoList = xsdAnnotation.getApplicationInformation();
- Element appInfoElement = null;
- if (appInfoList.size() > 0)
- {
- appInfoElement = (Element) appInfoList.get(0);
- }
- if (appInfoElement != null)
- {
- for (Iterator it = appInfoList.iterator(); it.hasNext();)
- {
- Object obj = it.next();
- if (obj instanceof Element)
- {
- Element appInfo = (Element) obj;
- NodeList nodeList = appInfo.getChildNodes();
- int length = nodeList.getLength();
- for (int i = 0; i < length; i++)
- {
- Node node = nodeList.item(i);
- if (node instanceof Element)
- {
- elementsAndAttributes.add(node);
- }
- }
- }
- }
-
- /** Construct attributes list */
- NamedNodeMap attributes = appInfoElement.getAttributes();
- if (attributes != null)
- {
- // String defaultNamespace =
- // (String)component.getSchema().getQNamePrefixToNamespaceMap().get("");
- int length = attributes.getLength();
- for (int i = 0; i < length; i++)
- {
- Node oneAttribute = attributes.item(i);
- if (!isXmlnsAttribute(oneAttribute))
- {
- String namespace = oneAttribute.getNamespaceURI();
- boolean isExtension = true;
- if (namespace == null && oneAttribute.getPrefix() == null)
- {
- isExtension = false;
- }
- else if (!XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001.equals(namespace))
- {
- isExtension = true;
- }
- if (isExtension)
- {
- elementsAndAttributes.add(oneAttribute);
- }
- }
- }
- }
- }
- }
- }
- return elementsAndAttributes.toArray();
- }
- return Collections.EMPTY_LIST.toArray();
- }
-
- private static boolean isXmlnsAttribute(Node attribute)
- {
- String prefix = attribute.getPrefix();
- if (prefix != null)
- {
- // this handle the xmlns:foo="blah" case
- return "xmlns".equals(prefix); //$NON-NLS-1$
- }
- else
- {
- // this handles the xmlns="blah" case
- return "xmlns".equals(attribute.getNodeName()); //$NON-NLS-1$
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/DefaultListNodeEditorConfiguration.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/DefaultListNodeEditorConfiguration.java
deleted file mode 100644
index 584ad71494..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/DefaultListNodeEditorConfiguration.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2006 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
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.custom;
-
-
-public class DefaultListNodeEditorConfiguration extends ListNodeEditorConfiguration
-{
- private String[] values;
-
- public DefaultListNodeEditorConfiguration(String[] values)
- {
- this.values = values;
- }
-
- public Object[] getValues(Object propertyObject)
- {
- return values;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/DialogNodeEditorConfiguration.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/DialogNodeEditorConfiguration.java
deleted file mode 100644
index ead530daf5..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/DialogNodeEditorConfiguration.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2006 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
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.custom;
-
-import org.eclipse.swt.graphics.Image;
-
-public abstract class DialogNodeEditorConfiguration extends NodeEditorConfiguration
-{
- public int getStyle()
- {
- return STYLE_DIALOG;
- }
-
- public String getButonText()
- {
- return null;
- }
-
- public Image getButtonImage()
- {
- return null;
- }
-
- public abstract void invokeDialog();
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/ListNodeEditorConfiguration.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/ListNodeEditorConfiguration.java
deleted file mode 100644
index fdfbce6822..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/ListNodeEditorConfiguration.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2006 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
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.custom;
-
-import org.eclipse.jface.viewers.LabelProvider;
-
-public abstract class ListNodeEditorConfiguration extends NodeEditorConfiguration
-{
- private LabelProvider labelProvider;
-
- public LabelProvider getLabelProvider()
- {
- return labelProvider;
- }
-
- public int getStyle()
- {
- return STYLE_COMBO;
- }
-
- public void setLabelProvider(LabelProvider labelProvider)
- {
- this.labelProvider = labelProvider;
- }
-
- public abstract Object[] getValues(Object propertyObject);
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/NodeCustomizationRegistry.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/NodeCustomizationRegistry.java
deleted file mode 100644
index a71b2f1163..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/NodeCustomizationRegistry.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.custom;
-
-import java.util.HashMap;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.viewers.ILabelProvider;
-
-public class NodeCustomizationRegistry
-{
- private static final String NAMESPACE = "namespace"; //$NON-NLS-1$
- private static final String LABEL_PROVIDER_CLASS_ATTRIBUTE_NAME = "labelProviderClass";
- private static final String NODE_EDITOR_PROVIDER_CLASS_ATTRIBUTE_NAME = "nodeEditorProviderClass"; //$NON-NLS-1$
- private static final String FILTER_CLASS_ATTRIBUTE_NAME = "filterClass";
-
-
- protected String extensionId;
- protected HashMap map;
-
- public NodeCustomizationRegistry(String propertyEditorExtensionId)
- {
- extensionId = "org.eclipse.wst.xsd.ui.extensibilityNodeCustomizations";//propertyEditorExtensionId;
- }
-
- private class Descriptor
- {
- IConfigurationElement configurationElement;
- NodeEditorProvider nodeEditorProvider;
- NodeFilter nodeFilter;
- boolean nodeEditorProviderFailedToLoad = false;
- boolean labelProviderFailedToLoad = false;
- boolean nodeFilterFailedToLoad = false;
-
- Descriptor(IConfigurationElement element)
- {
- this.configurationElement = element;
- }
-
- NodeEditorProvider lookupOrCreateNodeEditorProvider()
- {
- if (nodeEditorProvider == null && !nodeEditorProviderFailedToLoad)
- {
- try
- {
- nodeEditorProvider = (NodeEditorProvider)configurationElement.createExecutableExtension(NODE_EDITOR_PROVIDER_CLASS_ATTRIBUTE_NAME);
- }
- catch (Exception e)
- {
- nodeEditorProviderFailedToLoad = true;
- }
- }
- return nodeEditorProvider;
- }
-
- ILabelProvider createLabelProvider()
- {
- if (!labelProviderFailedToLoad)
- {
- try
- {
- return (ILabelProvider)configurationElement.createExecutableExtension(LABEL_PROVIDER_CLASS_ATTRIBUTE_NAME);
- }
- catch (Exception e)
- {
- labelProviderFailedToLoad = true;
- }
- }
- return null;
- }
-
- public NodeFilter getNodeFilter()
- {
- if (!nodeEditorProviderFailedToLoad)
- {
- try
- {
- nodeFilter = (NodeFilter)configurationElement.createExecutableExtension(FILTER_CLASS_ATTRIBUTE_NAME);
- }
- catch (Exception e)
- {
- nodeEditorProviderFailedToLoad = true;
- }
- }
- return nodeFilter;
- }
- }
-
-
- private HashMap initMap()
- {
- HashMap theMap = new HashMap();
- IConfigurationElement[] extensions = Platform.getExtensionRegistry().getConfigurationElementsFor("org.eclipse.wst.xsd.ui.extensibilityNodeCustomizations");
- for (int i = 0; i < extensions.length; i++)
- {
- IConfigurationElement configurationElement = extensions[i];
- String namespace = configurationElement.getAttribute(NAMESPACE);
- if (namespace != null)
- {
- theMap.put(namespace, new Descriptor(configurationElement));
- }
- }
- return theMap;
- }
-
- private Descriptor getDescriptor(String namespace)
- {
- map = null;
- if (namespace != null)
- {
- if (map == null)
- {
- map = initMap();
- }
- return (Descriptor)map.get(namespace);
- }
- return null;
- }
-
- public NodeEditorProvider getNodeEditorProvider(String namespace)
- {
- Descriptor descriptor = getDescriptor(namespace);
- if (descriptor != null)
- {
- return descriptor.lookupOrCreateNodeEditorProvider();
- }
- return null;
- }
-
- public ILabelProvider getLabelProvider(String namespace)
- {
- Descriptor descriptor = getDescriptor(namespace);
- if (descriptor != null)
- {
- return descriptor.createLabelProvider();
- }
- return null;
- }
-
- public NodeFilter getNodeFilter(String namespace)
- {
- Descriptor descriptor = getDescriptor(namespace);
- if (descriptor != null)
- {
- return descriptor.getNodeFilter();
- }
- return null;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/NodeEditorConfiguration.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/NodeEditorConfiguration.java
deleted file mode 100644
index 1506ad222f..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/NodeEditorConfiguration.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2006 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
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.custom;
-
-import org.w3c.dom.Node;
-
-public abstract class NodeEditorConfiguration
-{
- public final static int STYLE_NONE = 0;
- public final static int STYLE_TEXT = 1;
- public final static int STYLE_COMBO = 2;
- public final static int STYLE_DIALOG = 4;
-
- public abstract int getStyle();
-
- private Node node;
- private Node parentNode;
-
- public Node getNode()
- {
- return node;
- }
- public void setNode(Node node)
- {
- this.node = node;
- }
- public Node getParentNode()
- {
- return parentNode;
- }
- public void setParentNode(Node parentNode)
- {
- this.parentNode = parentNode;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/NodeEditorProvider.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/NodeEditorProvider.java
deleted file mode 100644
index 07d1c63909..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/NodeEditorProvider.java
+++ /dev/null
@@ -1,18 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2006 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
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.custom;
-
-
-public abstract class NodeEditorProvider
-{
- public abstract NodeEditorConfiguration getNodeEditorConfiguration(String parentName, String nodeName);
- //public abstract NodeEditorConfiguration getNodeEditorConfiguration(Node node);
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/NodeFilter.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/NodeFilter.java
deleted file mode 100644
index 5cabbc7622..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/NodeFilter.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 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
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.custom;
-
-import org.w3c.dom.Node;
-
-public class NodeFilter
-{
- public boolean isApplicableContext(Node parentNode, int nodeType, String namespace, String name)
- {
- return true;
- }
-}

Back to the top