Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/**
* Copyright (c) 2002-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 v2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v20.html
*
* Contributors:
* IBM - Initial API and implementation
*/
package org.eclipse.xsd.provider;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.edit.command.CopyCommand;
import org.eclipse.emf.edit.command.InitializeCopyCommand;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
import org.eclipse.xsd.XSDInclude;
import org.eclipse.xsd.XSDRedefine;
import org.eclipse.xsd.XSDSchema;
/**
* This is the item provider adpater for a {@link org.eclipse.xsd.XSDSchema} object.
*/
public class XSDSchemaItemProvider
extends XSDComponentItemProvider
{
/**
* This constructs an instance from a factory and a notifier.
*/
public XSDSchemaItemProvider(AdapterFactory adapterFactory)
{
super(adapterFactory);
}
/**
* This returns the property descriptors for the adapted class.
*/
@Override
public List getPropertyDescriptors(Object object)
{
if (itemPropertyDescriptors == null)
{
super.getPropertyDescriptors(object);
createSchemaLocationPropertyDescriptor(object);
createTargetNamespacePropertyDescriptor(object);
createFinalDefaultPropertyDescriptor(object);
createBlockDefaultPropertyDescriptor(object);
createAttributeFormDefaultPropertyDescriptor(object);
createElementFormDefaultPropertyDescriptor(object);
}
return itemPropertyDescriptors;
}
protected void createSchemaLocationPropertyDescriptor(Object object)
{
// This is for the schemaLocation feature.
//
itemPropertyDescriptors.add
(new ItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
XSDEditPlugin.INSTANCE.getString("_UI_SchemaLocation_label"),
XSDEditPlugin.INSTANCE.getString("_UI_SchemaLocationOfSchema_description"),
xsdPackage.getXSDSchema_SchemaLocation(),
false,
ItemPropertyDescriptor.TEXT_VALUE_IMAGE));
}
protected void createTargetNamespacePropertyDescriptor(Object object)
{
// This is for the targetNamespace feature.
//
itemPropertyDescriptors.add
(new ItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
XSDEditPlugin.INSTANCE.getString("_UI_TargetNamespace_label"),
XSDEditPlugin.INSTANCE.getString("_UI_TargetNamespaceOfSchema_description"),
xsdPackage.getXSDSchema_TargetNamespace(),
true,
ItemPropertyDescriptor.TEXT_VALUE_IMAGE)
{
@Override
public void setPropertyValue(Object o, Object value)
{
if ("".equals(value))
{
super.setPropertyValue(o, null);
}
else
{
super.setPropertyValue(o, value);
}
}
});
}
protected void createFinalDefaultPropertyDescriptor(Object object)
{
// This is for the finalDefault feature.
//
itemPropertyDescriptors.add
(new ItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
XSDEditPlugin.INSTANCE.getString("_UI_FinalDefault_label"),
XSDEditPlugin.INSTANCE.getString("_UI_FinalDefault_description"),
xsdPackage.getXSDSchema_FinalDefault(),
true,
ItemPropertyDescriptor.TEXT_VALUE_IMAGE)
{
@Override
public Object getPropertyValue(Object o)
{
return ((XSDSchema)o).getStringFinalDefault();
}
@Override
public void setPropertyValue(Object o, Object value)
{
((XSDSchema)o).setStringFinalDefault((String)value);
}
@Override
public Collection> getChoiceOfValues(Object o)
{
Collection