Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 60279 Details for
Bug 152015
Two mutually exclusive properties for AssociatedEvent can be created with Adapter Editor
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
patch
bugzilla_152015_patch.txt (text/plain), 8.47 KB, created by
Cindy Jin
on 2007-03-05 14:15:31 EST
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Cindy Jin
Created:
2007-03-05 14:15:31 EST
Size:
8.47 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.hyades.logging.adapter.ui >Index: src/org/eclipse/hyades/logging/adapter/ui/internal/presentation/AdaptorActionBarContributor.java >=================================================================== >RCS file: /cvsroot/tptp/monitoring/org.eclipse.hyades.logging.adapter.ui/src/org/eclipse/hyades/logging/adapter/ui/internal/presentation/AdaptorActionBarContributor.java,v >retrieving revision 1.6 >diff -u -r1.6 AdaptorActionBarContributor.java >--- src/org/eclipse/hyades/logging/adapter/ui/internal/presentation/AdaptorActionBarContributor.java 21 Apr 2006 15:52:13 -0000 1.6 >+++ src/org/eclipse/hyades/logging/adapter/ui/internal/presentation/AdaptorActionBarContributor.java 5 Mar 2007 19:07:22 -0000 >@@ -12,9 +12,11 @@ > package org.eclipse.hyades.logging.adapter.ui.internal.presentation; > > >+import java.util.ArrayList; > import java.util.Collection; > import java.util.Iterator; > import java.util.LinkedList; >+import java.util.List; > > import org.eclipse.emf.common.util.EList; > import org.eclipse.emf.edit.command.CommandParameter; >@@ -43,8 +45,12 @@ > import org.eclipse.jface.viewers.SelectionChangedEvent; > import org.eclipse.ui.IEditorPart; > import org.eclipse.xsd.XSDComplexTypeDefinition; >+import org.eclipse.xsd.XSDCompositor; > import org.eclipse.xsd.XSDElementDeclaration; >+import org.eclipse.xsd.XSDModelGroup; >+import org.eclipse.xsd.XSDParticle; > import org.eclipse.xsd.XSDSimpleTypeDefinition; >+import org.eclipse.xsd.XSDTerm; > import org.eclipse.xsd.XSDTypeDefinition; > > >@@ -182,25 +188,25 @@ > if (createChildMenuManager != null) { > depopulateManager(createChildMenuManager, createChildActions); > } >- >+ > // Query the new selection for appropriate new child/sibling descriptors > // > Collection newChildDescriptors = null; >- >+ > ISelection selection = event.getSelection(); > if (selection instanceof IStructuredSelection && ((IStructuredSelection)selection).size() == 1) { > Object object = ((IStructuredSelection)selection).getFirstElement(); >- >+ > EditingDomain domain = > ((IEditingDomainProvider) activeEditorPart).getEditingDomain(); >- >+ > newChildDescriptors = domain.getNewChildDescriptors(object, null); > } >- >+ > // Generate actions for selection; populate and redraw the menus. > // > createChildActions = generateCreateChildActions(newChildDescriptors, selection); >- >+ > if (createChildMenuManager != null) { > populateManager(createChildMenuManager, createChildActions, null); > createChildMenuManager.update(true); >@@ -217,8 +223,16 @@ > protected Collection generateCreateChildActions(Collection descriptors, ISelection selection) { > Collection actions = new LinkedList(); > Object object = ((IStructuredSelection)selection).getFirstElement(); >- >+ > if (descriptors != null) { >+ List execlusiveElementsList = null; >+ /** >+ * Bugzilla 152015, It first gets the element/atrribute names for the execlusive elements/atrributes >+ */ >+ if(object instanceof RuleElementType) >+ { >+ execlusiveElementsList = getExclusiveElementList(object); >+ } > for (Iterator i = descriptors.iterator(); i.hasNext(); ) { > > CommandParameter command = (CommandParameter)i.next(); >@@ -244,16 +258,43 @@ > } > else if(object instanceof RuleElementType) > { >+ > Object value = command.getValue(); >+ > if(value != null && value instanceof RuleAttributeType) > { > action.setText(((RuleAttributeType)value).getName()); >- enableAttributeAction(action, (RuleElementType)object); >+ /** >+ * Bugzilla 152015, then it checks if the action is in the exclusvie list >+ * and wheather the selected object already has another element which belongs to >+ * exclusive list. If yes, disable this action. >+ */ >+ if(execlusiveElementsList != null) >+ { >+ boolean disabledAction = disableExclusiveAction(action, (RuleElementType)object, execlusiveElementsList); >+ if(!disabledAction) >+ enableAttributeAction(action, (RuleElementType)object); >+ } >+ else >+ { >+ enableAttributeAction(action, (RuleElementType)object); >+ } >+ > } > if(value != null && value instanceof RuleElementType) > { > action.setText(((RuleElementType)value).getName()); >- enableElementAction(action, (RuleElementType)object); >+ if(execlusiveElementsList != null) >+ { >+ boolean disabledAction = disableExclusiveAction(action, (RuleElementType)object, execlusiveElementsList); >+ if(!disabledAction) >+ enableElementAction(action, (RuleElementType)object); >+ } >+ else >+ { >+ enableElementAction(action, (RuleElementType)object); >+ } >+ > } > } > } >@@ -388,6 +429,7 @@ > } > return; > } >+ > if (name.equals("hexValue")) > { > EList attributes = object.getRuleAttribute(); >@@ -420,7 +462,7 @@ > protected void enableElementAction(Action action, RuleElementType object) > { > String name = action.getText(); >- >+ > Object cbeObject = AcadEditorPlugin.INSTANCE.getElementDefinitionForType(object); > if(cbeObject != null && cbeObject instanceof XSDElementDeclaration) > { >@@ -498,6 +540,50 @@ > } > > >+ protected boolean disableExclusiveAction(Action action, RuleElementType object, List execlusiveElementsList) >+ { >+ for(int i=0; i<execlusiveElementsList.size();i++) >+ { >+ ArrayList nameList = (ArrayList)execlusiveElementsList.get(i); >+ for(int j=0; j<nameList.size();j++) >+ { >+ String actionName = action.getText(); >+ if(nameList.contains(action.getText())) >+ { >+ >+ EList ruleElements = object.getRuleElement(); >+ EList atrributeElements = object.getRuleAttribute(); >+ for(int idx=0; idx<ruleElements.size(); idx++) >+ { >+ String elementName = null; >+ elementName = ((RuleElementType)ruleElements.get(idx)).getName(); >+ >+ if(!actionName.equals(elementName)&&nameList.contains(elementName)) >+ { >+ action.setEnabled(false); >+ >+ return true; >+ } >+ >+ } >+ for(int attr_idx=0; attr_idx<atrributeElements.size(); attr_idx++) >+ { >+ String attributeElement = null; >+ attributeElement = ((RuleAttributeType)atrributeElements.get(attr_idx)).getName(); >+ >+ if(!actionName.equals(attributeElement)&&nameList.contains(attributeElement)) >+ { >+ action.setEnabled(false); >+ return true; >+ } >+ >+ } >+ } >+ } >+ } >+ return false; >+ } >+ > protected void enableComplexType(Action action, XSDComplexTypeDefinition tdef, RuleElementType object) > { > String name = action.getText(); >@@ -518,4 +604,65 @@ > > action.setEnabled(true); > } >+ >+ private List getExclusiveElementList(Object value) >+ { >+ >+ >+ if(value instanceof RuleElementType) >+ { >+ >+ List list = new ArrayList(); >+ Object type = AcadEditorPlugin.INSTANCE.getElementDefinitionForType((RuleElementType)value); >+ if(type != null) >+ { >+ if(type instanceof XSDElementDeclaration) >+ { >+ EList contents=((XSDElementDeclaration)type).getType().eContents(); >+ for(int l=0;l<contents.size();l++) >+ { >+ Object content = contents.get(l); >+ if( content instanceof XSDParticle ) >+ { >+ EList particles = ((XSDParticle)content).eContents(); >+ for(int k=0; k<particles.size();k++) >+ { >+ Object particleConent =particles.get(k); >+ if(particleConent instanceof XSDModelGroup) >+ { >+ XSDModelGroup xsdModelGroup = (XSDModelGroup)particleConent; >+ if( xsdModelGroup.getCompositor()==XSDCompositor.CHOICE_LITERAL) >+ { >+ //This is a choice group. Get elements included in this group. >+ ArrayList nameList = new ArrayList(); >+ for (Iterator i = xsdModelGroup.getParticles().iterator(); i.hasNext(); ) >+ { >+ XSDTerm tmpTerm = ((XSDParticle)i.next()).getTerm(); >+ if( tmpTerm instanceof XSDElementDeclaration) >+ { >+ XSDElementDeclaration tmpElement = (XSDElementDeclaration)tmpTerm; >+ nameList.add(tmpElement.getName()); >+ } >+ >+ >+ } >+ list.add(nameList); >+ } >+ } >+ } >+ } >+ >+ } >+ } >+ if(list.size() == 0) >+ { >+ return null; >+ } >+ return list; >+ } >+ } >+ return null; >+ } >+ >+ > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 152015
: 60279