use of org.eclipse.xsd.XSDConcreteComponent in project webtools.sourceediting by eclipse.
the class XSDAttributeGroupDefinitionAdapter method getTopContainer.
public IADTObject getTopContainer() {
XSDAttributeGroupDefinition attrGroupDef = getXSDAttributeGroupDefinition();
XSDConcreteComponent container = attrGroupDef.getContainer();
if (container instanceof XSDSchema || container instanceof XSDRedefine)
return this;
else
return getGlobalXSDContainer(attrGroupDef);
}
use of org.eclipse.xsd.XSDConcreteComponent in project webtools.sourceediting by eclipse.
the class XSDBaseAdapter method populateAdapterList.
public void populateAdapterList(List notifierList, List adapterList) {
for (Iterator i = notifierList.iterator(); i.hasNext(); ) {
Object obj = i.next();
if (obj instanceof XSDConcreteComponent) {
XSDConcreteComponent component = (XSDConcreteComponent) obj;
adapterList.add(XSDAdapterFactory.getInstance().adapt(component));
} else {
adapterList.add(obj);
}
}
}
use of org.eclipse.xsd.XSDConcreteComponent in project webtools.sourceediting by eclipse.
the class XSDBaseAdapter method getGlobalXSDContainer.
protected IADTObject getGlobalXSDContainer(XSDConcreteComponent component) {
XSDConcreteComponent c = component.getContainer();
// We want the top most structural component
while (c != null && !(c.getContainer() instanceof XSDSchema) && !(c instanceof XSDComplexTypeDefinition) && !(c instanceof XSDSimpleTypeDefinition) && !(c instanceof XSDModelGroupDefinition) && !(c instanceof XSDAttributeGroupDefinition)) {
c = c.getContainer();
}
Adapter adapter = XSDAdapterFactory.getInstance().adapt(c);
if (adapter instanceof IADTObject)
return (IADTObject) adapter;
return null;
}
use of org.eclipse.xsd.XSDConcreteComponent in project webtools.sourceediting by eclipse.
the class XSDBaseAdapter method getContainerType.
/**
* Implements IField getContainerType. Get parent Complex Type containing the field
* @return IComplexType
*/
public IComplexType getContainerType() {
XSDConcreteComponent xsdConcreteComponent = (XSDConcreteComponent) target;
XSDConcreteComponent parent = null;
XSDComplexTypeDefinition ct = null;
for (parent = xsdConcreteComponent.getContainer(); parent != null; ) {
if (parent instanceof XSDComplexTypeDefinition) {
ct = (XSDComplexTypeDefinition) parent;
break;
}
parent = parent.getContainer();
}
if (ct != null) {
return (IComplexType) XSDAdapterFactory.getInstance().adapt(ct);
}
return null;
}
use of org.eclipse.xsd.XSDConcreteComponent in project webtools.sourceediting by eclipse.
the class XSDBaseAdapter method isReadOnly.
public boolean isReadOnly() {
XSDSchema xsdSchema = null;
try {
IEditorPart editorPart = null;
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window != null) {
IWorkbenchPage page = window.getActivePage();
if (page != null) {
editorPart = page.getActiveEditor();
}
}
if (target instanceof XSDConcreteComponent) {
xsdSchema = ((XSDConcreteComponent) target).getSchema();
}
if (editorPart == null) {
return fallBackCheckIsReadOnly();
}
XSDSchema editorSchema = (XSDSchema) editorPart.getAdapter(XSDSchema.class);
if (xsdSchema != null && xsdSchema == editorSchema) {
return false;
} else {
return fallBackCheckIsReadOnly();
}
} catch (Exception e) {
}
return true;
}
Aggregations