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 203625 Details for
Bug 357765
Editor need way to hide certain attributes/references from standard editor page
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]
proposed patch
org.eclipse.emf.ecp.editor.patch (text/plain), 3.38 KB, created by
Nikolay Kasyanov
on 2011-09-19 16:19:18 EDT
(
hide
)
Description:
proposed patch
Filename:
MIME Type:
Creator:
Nikolay Kasyanov
Created:
2011-09-19 16:19:18 EDT
Size:
3.38 KB
patch
obsolete
>Index: src/org/eclipse/emf/ecp/editor/AnnotationHiddenDescriptor.java >=================================================================== >--- src/org/eclipse/emf/ecp/editor/AnnotationHiddenDescriptor.java (revision 0) >+++ src/org/eclipse/emf/ecp/editor/AnnotationHiddenDescriptor.java (revision 0) >@@ -0,0 +1,29 @@ >+package org.eclipse.emf.ecp.editor; >+ >+import org.eclipse.emf.ecore.EAnnotation; >+import org.eclipse.emf.ecore.EObject; >+import org.eclipse.emf.ecore.EStructuralFeature; >+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; >+ >+public class AnnotationHiddenDescriptor implements >+ IAttributeDescriptor<Boolean> { >+ >+ private final static Boolean defaultValue = new Boolean(false); >+ >+ /** >+ * Returns true, if feature associated with given >+ * {@link IItemPropertyDescriptor} marked with hidden=true annotation >+ * >+ * @see org.eclipse.emf.ecp.editor.IAttributeDescriptor#getValue(org.eclipse.emf.edit.provider.IItemPropertyDescriptor, >+ * org.eclipse.emf.ecore.EObject) >+ */ >+ public Boolean getValue(IItemPropertyDescriptor propertyDescriptor, >+ EObject modelElement) { >+ EAnnotation priority = ((EStructuralFeature) propertyDescriptor.getFeature(modelElement)) >+ .getEAnnotation("org.eclipse.emf.ecp.editor"); >+ if (priority == null || priority.getDetails() == null || priority.getDetails().get("hidden") == null) { >+ return defaultValue; >+ } >+ return Boolean.parseBoolean(priority.getDetails().get("hidden")); >+ } >+} >Index: src/org/eclipse/emf/ecp/editor/MEEditorPage.java >=================================================================== >--- src/org/eclipse/emf/ecp/editor/MEEditorPage.java (revision 12274) >+++ src/org/eclipse/emf/ecp/editor/MEEditorPage.java (working copy) >@@ -7,9 +7,11 @@ > package org.eclipse.emf.ecp.editor; > > import java.util.ArrayList; >+import java.util.Collection; > import java.util.Collections; > import java.util.Comparator; > import java.util.HashMap; >+import java.util.Iterator; > import java.util.List; > import java.util.Map; > >@@ -223,14 +225,36 @@ > "toolbar:org.eclipse.emf.ecp.editor.MEEditorPage"); > form.getToolBarManager().update(true); > } >+ >+ /** >+ * Filters attributes marked with "hidden=true" annotation >+ * >+ * @param propertyDescriptors property descriptors to filter >+ */ >+ private void filterHiddenAttributes(Collection<IItemPropertyDescriptor> propertyDescriptors) { >+ Iterator<IItemPropertyDescriptor> iterator = propertyDescriptors.iterator(); >+ >+ AnnotationHiddenDescriptor visibilityDescriptor = new AnnotationHiddenDescriptor(); >+ >+ while (iterator.hasNext()) { >+ IItemPropertyDescriptor descriptor = iterator.next(); >+ >+ if (visibilityDescriptor.getValue(descriptor, modelElement)) { >+ iterator.remove(); >+ } >+ } >+ } > > private void sortAndOrderAttributes() { > > AdapterFactoryItemDelegator adapterFactoryItemDelegator = new AdapterFactoryItemDelegator( > new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE)); > >- List<IItemPropertyDescriptor> propertyDescriptors = adapterFactoryItemDelegator >+ Collection<IItemPropertyDescriptor> propertyDescriptors = adapterFactoryItemDelegator > .getPropertyDescriptors(modelElement); >+ >+ filterHiddenAttributes(propertyDescriptors); >+ > if (propertyDescriptors != null) { > AnnotationPositionDescriptor positionDescriptor = new AnnotationPositionDescriptor(); > for (IItemPropertyDescriptor itemPropertyDescriptor : propertyDescriptors) {
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
Flags:
eclipse
:
iplog+
Actions:
View
|
Diff
Attachments on
bug 357765
: 203625