diff --git a/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/dialog/MessageUtilsExtended.java b/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/dialog/MessageUtilsExtended.java index 394847a1b65a5d5ac75f993121bd88c3ccad3c91..eb550dc5536272006e024e848bf3b1c0d604e435 100644 --- a/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/dialog/MessageUtilsExtended.java +++ b/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/dialog/MessageUtilsExtended.java @@ -26,7 +26,7 @@ import org.eclipse.swt.widgets.Display; * @author bugariu * @author $Author$ * @version $Rev$ - * @ConQAT.Rating YELLOW Hash: CD929ED7F7EE80401952345E7B58AFAF + * @ConQAT.Rating YELLOW Hash: 58F9BC75D3970A66B043CD3DA792023C */ public class MessageUtilsExtended { diff --git a/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/editor/DiagramEditorBase.java b/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/editor/DiagramEditorBase.java index d0d78aa9dc7fa26dac299e6bfc18de12508bd212..fe2a1ad5c85254e7a7bda57028843246c51f0f84 100644 --- a/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/editor/DiagramEditorBase.java +++ b/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/editor/DiagramEditorBase.java @@ -105,7 +105,7 @@ import org.fortiss.tooling.kernel.ui.service.IEditPartFactoryService; * @author hoelzl * @author $Author$ * @version $Rev$ - * @ConQAT.Rating YELLOW Hash: 34AD598E80FD2507CF8EF5AD46AC9A9E + * @ConQAT.Rating YELLOW Hash: 22C5625307CE6747950D88EF54A986C4 */ public class DiagramEditorBase<T extends EObject> extends GEFEditorBase<T> implements IPostSelectionProvider, ContextMenuContextProvider { @@ -220,7 +220,7 @@ public class DiagramEditorBase<T extends EObject> extends GEFEditorBase<T> imple } }); - if(ILibraryService.INSTANCE.isShadowElement(editedObject)) { + if(ILibraryService.INSTANCE.isLibraryElementShadow(editedObject)) { ((ScalableRootEditPart)viewer.getRootEditPart()).deactivate(); } } diff --git a/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/decompose/HierarchicElementCompositorBase.java b/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/decompose/HierarchicElementCompositorBase.java index 25719a7a29447d60158976de8673877ad96c8b12..f827d30bafe73fb5177e6c48a536c4dd454872d9 100644 --- a/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/decompose/HierarchicElementCompositorBase.java +++ b/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/decompose/HierarchicElementCompositorBase.java @@ -40,7 +40,7 @@ import org.fortiss.tooling.kernel.service.IElementCompositorService; * @author doebber * @author $Author: hoelzl $ * @version $Rev: 18709 $ - * @ConQAT.Rating GREEN Hash: 88EAEE8F01C0BDB67D8205D322A68EAF + * @ConQAT.Rating YELLOW Hash: D584C94ED76CF31AF12AEF6B041E7AE5 */ public abstract class HierarchicElementCompositorBase<HE extends IHierarchicElementContainer> implements IElementCompositor<HE> { diff --git a/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/library/ModelElementLibraryService.java b/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/library/ModelElementLibraryService.java index b8b847a500c3f3fdca2a9afe9173f8df2694067b..a146d7d61fd999a77c0b186886389ac2bb1bf285 100644 --- a/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/library/ModelElementLibraryService.java +++ b/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/library/ModelElementLibraryService.java @@ -42,7 +42,7 @@ import org.fortiss.tooling.kernel.service.IPersistencyService; * @author ratiu * @author $Author: hoelzl $ * @version $Rev: 18709 $ - * @ConQAT.Rating RED Hash: + * @ConQAT.Rating YELLOW Hash: 904A5F32D40EB9E2C7FA5ABC1CC53DC7 */ public class ModelElementLibraryService implements ILibraryService { @@ -56,8 +56,8 @@ public class ModelElementLibraryService implements ILibraryService { /** {@inheritDoc} */ @Override - public boolean isShadowElement(EObject anObject) { - return ILibraryService.INSTANCE.isShadowElement(anObject); + public boolean isLibraryElementShadow(EObject anObject) { + return ILibraryService.INSTANCE.isLibraryElementShadow(anObject); } /** {@inheritDoc} */ @@ -90,24 +90,12 @@ public class ModelElementLibraryService implements ILibraryService { return ILibraryService.INSTANCE.getLibrariesFromWorkspace(); } - /** {@inheritDoc} */ - @Override - public ILibrary findLibrary(String libraryName) { - return ILibraryService.INSTANCE.findLibrary(libraryName); - } - /** {@inheritDoc} */ @Override public List<ILibraryPackage> getAllLibraryPackages(ILibrary lib) { return ILibraryService.INSTANCE.getAllLibraryPackages(lib); } - /** {@inheritDoc} */ - @Override - public ILibraryPackage findLibraryPackage(ILibrary lib, String packName) { - return ILibraryService.INSTANCE.findLibraryPackage(lib, packName); - } - /** {@inheritDoc} */ @Override public void ensureWrappedElementIsUpToDate(ILibraryElementReference ref) { @@ -125,7 +113,7 @@ public class ModelElementLibraryService implements ILibraryService { */ public void convertLibraryElementRefToHierarchicalElement( final ILibraryElementReference elementRef) { - final IHierarchicElement wrapped = (IHierarchicElement)elementRef.getWrappedElement(); + final IHierarchicElement wrapped = (IHierarchicElement)elementRef.getLibraryElementShadow(); final ITopLevelElement topLevel = IPersistencyService.INSTANCE.getTopLevelElementFor(elementRef); diff --git a/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/library/package.html b/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/library/package.html new file mode 100644 index 0000000000000000000000000000000000000000..58edeaa461e6a7df07721fe047da1debdf7735cd --- /dev/null +++ b/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/library/package.html @@ -0,0 +1,8 @@ +<!-- + $Id: package.html 2692 2012-01-09 13:17:37Z doebber $ + @version $Rev: 2692 $ + @ConQAT.Rating YELLOW Hash: CB54349FD0B599BBB230EC4C8EBCF13C +--> +<body> +Package for library-related classes. +</body> diff --git a/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/utils/SystemUtils.java b/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/utils/SystemUtils.java index 753b3e9e5f130f569b85a1b8a39d5c95673cc4f8..8bde67df7a0dfe02c265a434a31c1d0b1accd73f 100644 --- a/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/utils/SystemUtils.java +++ b/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/utils/SystemUtils.java @@ -23,7 +23,7 @@ package org.fortiss.tooling.base.utils; * @author ratiu * @author $Author: hoelzl $ * @version $Rev: 18709 $ - * @ConQAT.Rating RED Hash: + * @ConQAT.Rating YELLOW Hash: 7448E2AD6172E33CAFD104539B8F1CFC */ public class SystemUtils { diff --git a/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/utils/package.html b/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/utils/package.html index acafb2d7fc76efe2a3dde419ba86eb5e284ee286..f408b8b2c833a6a433dd9b139545feaa50d2f3da 100644 --- a/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/utils/package.html +++ b/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/utils/package.html @@ -1,8 +1,8 @@ <!-- $Id: package.html 2692 2012-01-09 13:17:37Z doebber $ @version $Rev: 2692 $ - @ConQAT.Rating GREEN Hash: E53885172F4F681680F32C45155B50DA + @ConQAT.Rating YELLOW Hash: 108A68DED78054C8E7D49910865799E5 --> <body> -Package for layout related utility classes. +Package for generic utility classes. </body> diff --git a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/extension/base/PropertySectionBase.java b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/extension/base/PropertySectionBase.java index a8f77ed426c45e72c36eae09afa124945ded06fa..439e4befba6549656aa0dc68a753c575046a7962 100644 --- a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/extension/base/PropertySectionBase.java +++ b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/extension/base/PropertySectionBase.java @@ -56,7 +56,7 @@ import org.fortiss.tooling.kernel.service.ILibraryService; * @author hoelzl * @author $Author$ * @version $Rev$ - * @ConQAT.Rating YELLOW Hash: 7FD1F920BC8FC05E5ACF93DDE0A87F61 + * @ConQAT.Rating YELLOW Hash: E483EDED2DF40237F8CAED4DCEAAE751 */ public abstract class PropertySectionBase extends AbstractPropertySection { @@ -108,7 +108,7 @@ public abstract class PropertySectionBase extends AbstractPropertySection { if(object instanceof EObject) { EObject eobj = (EObject)object; - if(ILibraryService.INSTANCE.isShadowElement(eobj)) { + if(ILibraryService.INSTANCE.isLibraryElementShadow(eobj)) { disableControls(); } } diff --git a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/properties/ElementWithURIPropertySection.java b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/properties/ElementWithURIPropertySection.java index 1d66c789afcacaadd88fc8066f8d3f4dc637849e..1c6a6a9fa70b7d5798fccf14c679a54f8285a431 100644 --- a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/properties/ElementWithURIPropertySection.java +++ b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/properties/ElementWithURIPropertySection.java @@ -17,15 +17,9 @@ $Id: IdLabeledPropertySection.java 5274 2012-08-02 07:54:11Z mou $ +--------------------------------------------------------------------------*/ package org.fortiss.tooling.kernel.ui.internal.properties; -import static org.eclipse.jface.databinding.swt.SWTObservables.observeText; -import static org.fortiss.tooling.kernel.ui.util.ObservableUtils.observeValue; - -import org.eclipse.core.databinding.observable.value.IObservableValue; -import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Text; import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage; -import org.fortiss.tooling.kernel.model.FortissToolingKernelPackage; import org.fortiss.tooling.kernel.model.IElementWithURI; import org.fortiss.tooling.kernel.ui.extension.base.PropertySectionBase; @@ -35,7 +29,7 @@ import org.fortiss.tooling.kernel.ui.extension.base.PropertySectionBase; * @author ratiu * @author $Author: ratiu $ * @version $Rev: 5274 $ - * @ConQAT.Rating YELLOW Hash: 7A6E548157B1AFE6873C0FDA47A8C475 + * @ConQAT.Rating YELLOW Hash: 7734F29714D1D41459281311C6C82BDB */ public final class ElementWithURIPropertySection extends PropertySectionBase { @@ -66,9 +60,6 @@ public final class ElementWithURIPropertySection extends PropertySectionBase { public void refresh() { super.refresh(); - IObservableValue modelObservable = - observeValue(elementWithURI, - FortissToolingKernelPackage.Literals.IELEMENT_WITH_URI__URI); - dbc.bindValue(observeText(uriText, SWT.FocusOut), modelObservable, null, null); + uriText.setText(elementWithURI.getURI()); } } diff --git a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/views/LibraryView.java b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/views/LibraryView.java index a13eb20b9bbc762e7237c06e941ab00e8c0c8c1c..543e45747ea05874551b4ccc189cfbb043602e57 100644 --- a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/views/LibraryView.java +++ b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/views/LibraryView.java @@ -38,7 +38,7 @@ import org.eclipse.ui.dialogs.FilteredTree; import org.eclipse.ui.dialogs.PatternFilter; import org.eclipse.ui.part.ViewPart; import org.fortiss.tooling.kernel.extension.data.Prototype; -import org.fortiss.tooling.kernel.extension.data.ProtoypeCategory; +import org.fortiss.tooling.kernel.extension.data.PrototypeCategory; import org.fortiss.tooling.kernel.service.IPrototypeService; import org.fortiss.tooling.kernel.ui.extension.IModelElementHandler; import org.fortiss.tooling.kernel.ui.extension.base.EditorBase; @@ -100,7 +100,7 @@ public class LibraryView extends ViewPart { viewer.addDragSupport(dndAdapter.getSupportedDNDOperations(), new Transfer[] {dndAdapter.getPreferredTransfer()}, dndAdapter); - viewer.setInput(IPrototypeService.INSTANCE.getAllPrototypesByCategory()); + viewer.setInput(IPrototypeService.INSTANCE.getAllTopLevelPrototypesCategories()); viewer.addFilter(new LibraryViewerFilter()); @@ -162,8 +162,8 @@ public class LibraryView extends ViewPart { Prototype prototype = (Prototype)element; return prototype.getName(); } - if(element instanceof ProtoypeCategory) { - return ((ProtoypeCategory)element).getName(); + if(element instanceof PrototypeCategory) { + return ((PrototypeCategory)element).getName(); } return super.getText(element); @@ -183,9 +183,9 @@ public class LibraryView extends ViewPart { return handler.getIcon(); } } - if(element instanceof ProtoypeCategory && - ((ProtoypeCategory)element).getChildren().length > 0) { - return getImage(((ProtoypeCategory)element).getChildren()[0]); + if(element instanceof PrototypeCategory && + ((PrototypeCategory)element).getChildren().length > 0) { + return getImage(((PrototypeCategory)element).getChildren()[0]); } return super.getImage(element); @@ -211,8 +211,8 @@ public class LibraryView extends ViewPart { /** {@inheritDoc} */ @Override public Object[] getChildren(Object parentElement) { - if(parentElement instanceof ProtoypeCategory) { - return ((ProtoypeCategory)parentElement).getChildren(); + if(parentElement instanceof PrototypeCategory) { + return ((PrototypeCategory)parentElement).getChildren(); } return new Object[0]; } @@ -227,8 +227,8 @@ public class LibraryView extends ViewPart { if(containerObject == null || supportedBaseClasses.isEmpty()) { return false; } - if(element instanceof ProtoypeCategory) { - ProtoypeCategory pc = (ProtoypeCategory)element; + if(element instanceof PrototypeCategory) { + PrototypeCategory pc = (PrototypeCategory)element; for(Object child : pc.getChildren()) { if(select(viewer, pc, child)) { return true; @@ -252,7 +252,7 @@ public class LibraryView extends ViewPart { } IEditorPart part = (IEditorPart)workbenchPart; - viewer.setInput(IPrototypeService.INSTANCE.getAllPrototypesByCategory()); + viewer.setInput(IPrototypeService.INSTANCE.getAllTopLevelPrototypesCategories()); switchWorkbenchEditor(part); } } diff --git a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/views/LibraryViewDragSourceAdapter.java b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/views/LibraryViewDragSourceAdapter.java index 3dc17942a3e8f1130b0ffc77f9f2c00d2a52ddce..3b0b7c31c5384db77c0a8f9e7b3e43be8473222e 100644 --- a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/views/LibraryViewDragSourceAdapter.java +++ b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/views/LibraryViewDragSourceAdapter.java @@ -22,7 +22,7 @@ import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.swt.dnd.DragSourceEvent; import org.fortiss.tooling.kernel.extension.data.Prototype; -import org.fortiss.tooling.kernel.extension.data.ProtoypeCategory; +import org.fortiss.tooling.kernel.extension.data.PrototypeCategory; import org.fortiss.tooling.kernel.ui.dnd.ElementCompositionDragSourceAdapter; /** @@ -54,7 +54,7 @@ public class LibraryViewDragSourceAdapter extends ElementCompositionDragSourceAd @Override public void dragStart(DragSourceEvent event) { IStructuredSelection sel = (IStructuredSelection)libraryViewer.getSelection(); - if(sel.getFirstElement() instanceof ProtoypeCategory) { + if(sel.getFirstElement() instanceof PrototypeCategory) { event.doit = false; event.data = null; } else { diff --git a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/views/NavigatorTreeContentProvider.java b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/views/NavigatorTreeContentProvider.java index a87d9122a6b9967186cf333200f895d315fdb4ba..1e7e5399e596d0d17dbe5d1025c0674dc9e33fe2 100644 --- a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/views/NavigatorTreeContentProvider.java +++ b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/views/NavigatorTreeContentProvider.java @@ -35,7 +35,7 @@ import org.fortiss.tooling.kernel.ui.service.IModelElementHandlerService; * @author hoelzlf * @author $Author$ * @version $Rev$ - * @ConQAT.Rating GREEN Hash: BD0969E378DE501806A960BCC34F5E6F + * @ConQAT.Rating YELLOW Hash: 0F56932328808C32627F2F1F751B5BC0 */ public class NavigatorTreeContentProvider extends TreeContentProviderBase { diff --git a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/views/NavigatorViewPart.java b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/views/NavigatorViewPart.java index a8c030e0e2b7ae1f1256d0e4c9dffef777b523e8..5c708aea87497ac30311d8aa78678a8e1113ac20 100644 --- a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/views/NavigatorViewPart.java +++ b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/views/NavigatorViewPart.java @@ -69,7 +69,7 @@ import org.fortiss.tooling.kernel.ui.util.PropertiesConstantUtils; * @author hoelzl * @author $Author$ * @version $Rev$ - * @ConQAT.Rating GREEN Hash: 1AD4953A111971EA289A08AC6BA95EE4 + * @ConQAT.Rating YELLOW Hash: 02F7F5A3149B6FF45D0020E6D31E9091 */ public final class NavigatorViewPart extends ViewPart implements ISelectionListener, ISelectionChangedListener, ITabbedPropertySheetPageContributor, ContextMenuContextProvider, diff --git a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/util/EObjectSelectionUtils.java b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/util/EObjectSelectionUtils.java index d7c2e770c9da88c5b6dd7056796e919f074d1c93..e1cae7818a6107134b1c8dbb55605c881015910d 100644 --- a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/util/EObjectSelectionUtils.java +++ b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/util/EObjectSelectionUtils.java @@ -35,7 +35,7 @@ import org.eclipse.ui.PlatformUI; * @author hoelzl * @author $Author$ * @version $Rev$ - * @ConQAT.Rating GREEN Hash: 5E416E2DE253148BB65FF09E09760B23 + * @ConQAT.Rating YELLOW Hash: F6214C0C8EDDB298FF25D1283AD573C6 */ public final class EObjectSelectionUtils { diff --git a/org.fortiss.tooling.kernel/trunk/model/kernel.ecore b/org.fortiss.tooling.kernel/trunk/model/kernel.ecore index 84baf679b852b206a1fe271dd3fea991f9f81c27..19a893ec5a6ff5723d5c73c231c44e328233ce8b 100644 --- a/org.fortiss.tooling.kernel/trunk/model/kernel.ecore +++ b/org.fortiss.tooling.kernel/trunk/model/kernel.ecore @@ -65,10 +65,11 @@ <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel"> <details key="documentation" value="ILibraryElementReference is the super class of all references to elements contained in a library."/> </eAnnotations> - <eStructuralFeatures xsi:type="ecore:EReference" name="wrappedElement" eType="ecore:EClass http://www.eclipse.org/emf/2002/Ecore#//EObject" + <eStructuralFeatures xsi:type="ecore:EReference" name="libraryElementShadow" eType="ecore:EClass http://www.eclipse.org/emf/2002/Ecore#//EObject" containment="true"/> </eClassifiers> - <eClassifiers xsi:type="ecore:EClass" name="ILibraryRootElement" eSuperTypes="#//INamedCommentedElement"/> + <eClassifiers xsi:type="ecore:EClass" name="ILibraryRootElement" abstract="true" + interface="true" eSuperTypes="#//INamedCommentedElement"/> <eClassifiers xsi:type="ecore:EClass" name="ILibrary" abstract="true" interface="true" eSuperTypes="#//INamedCommentedElement"> <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel"> @@ -81,9 +82,10 @@ <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel"> <details key="documentation" value="ILibraryElement is the super class of all elements contained in a library."/> </eAnnotations> - <eStructuralFeatures xsi:type="ecore:EAttribute" name="uri" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eOperations name="getURI" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> </eClassifiers> - <eClassifiers xsi:type="ecore:EClass" name="ILibraryPackage" eSuperTypes="#//IElementWithURI #//INamedCommentedElement"> + <eClassifiers xsi:type="ecore:EClass" name="ILibraryPackage" abstract="true" interface="true" + eSuperTypes="#//IElementWithURI #//INamedCommentedElement"> <eStructuralFeatures xsi:type="ecore:EReference" name="subPackages" upperBound="-1" eType="#//ILibraryPackage" containment="true"/> <eStructuralFeatures xsi:type="ecore:EReference" name="libraryElements" upperBound="-1" diff --git a/org.fortiss.tooling.kernel/trunk/model/kernel.genmodel b/org.fortiss.tooling.kernel/trunk/model/kernel.genmodel index 608860d5f761eb89adc2ee4af332e214941e640b..736fe9c4828c689ab9b8302155c53e0ee6c4b432 100644 --- a/org.fortiss.tooling.kernel/trunk/model/kernel.genmodel +++ b/org.fortiss.tooling.kernel/trunk/model/kernel.genmodel @@ -28,14 +28,14 @@ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference kernel.ecore#//ILibraryElement/wrappedElement"/> </genClasses> <genClasses image="false" ecoreClass="kernel.ecore#//ILibraryElementReference"> - <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference kernel.ecore#//ILibraryElementReference/wrappedElement"/> + <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference kernel.ecore#//ILibraryElementReference/libraryElementShadow"/> </genClasses> <genClasses ecoreClass="kernel.ecore#//ILibraryRootElement"/> <genClasses image="false" ecoreClass="kernel.ecore#//ILibrary"> <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference kernel.ecore#//ILibrary/rootElements"/> </genClasses> <genClasses image="false" ecoreClass="kernel.ecore#//IElementWithURI"> - <genFeatures createChild="false" ecoreFeature="ecore:EAttribute kernel.ecore#//IElementWithURI/uri"/> + <genOperations ecoreOperation="kernel.ecore#//IElementWithURI/getURI"/> </genClasses> <genClasses ecoreClass="kernel.ecore#//ILibraryPackage"> <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference kernel.ecore#//ILibraryPackage/subPackages"/> diff --git a/org.fortiss.tooling.kernel/trunk/plugin.xml b/org.fortiss.tooling.kernel/trunk/plugin.xml index c49c48e39ef956c4e56f5866708b4128e7aa29b7..ba252f3bfda7460585c3a31f6346387b4234db34 100644 --- a/org.fortiss.tooling.kernel/trunk/plugin.xml +++ b/org.fortiss.tooling.kernel/trunk/plugin.xml @@ -23,4 +23,10 @@ provider="org.fortiss.tooling.kernel.internal.storage.eclipse.EclipseResourceStorageProvider"> </modelStorageProvider> </extension> + <extension + point="org.fortiss.tooling.kernel.modelPrototypeProvider"> + <modelPrototypeProvider + provider="org.fortiss.tooling.kernel.internal.LibraryPrototypeProvider"> + </modelPrototypeProvider> + </extension> </plugin> diff --git a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/extension/ILibraryElementHandler.java b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/extension/ILibraryElementHandler.java index 189d5dbccb4fd88611d5b1da10c6dbe826716b06..5085ca6a84a793dc3aa0d4c26050a920b6261b7a 100644 --- a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/extension/ILibraryElementHandler.java +++ b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/extension/ILibraryElementHandler.java @@ -18,6 +18,7 @@ $Id: codetemplates.xml 1 2011-01-01 00:00:01Z hoelzl $ package org.fortiss.tooling.kernel.extension; import org.eclipse.emf.ecore.EObject; +import org.fortiss.tooling.kernel.extension.data.Prototype; import org.fortiss.tooling.kernel.model.ILibraryElement; import org.fortiss.tooling.kernel.service.base.IEObjectAware; @@ -27,11 +28,14 @@ import org.fortiss.tooling.kernel.service.base.IEObjectAware; * @author ratiu * @author $Author: hoelzl $ * @version $Rev: 18709 $ - * @ConQAT.Rating RED Hash: + * @ConQAT.Rating YELLOW Hash: 01CB820A86E9F959CCFDD397A772335E */ public interface ILibraryElementHandler<T extends EObject> extends IEObjectAware<T> { /** Creates a {@link ILibraryElement} from a model element. */ public ILibraryElement createLibraryElement(T modelElement); + /** Creates a {@link Prototype} from a library model element. */ + public Prototype createLibraryElementReferencePrototype(ILibraryElement libraryElement); + } diff --git a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/extension/IPrototypeProvider.java b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/extension/IPrototypeProvider.java index 176edcac349211e9eac1175dc0bb1b6bded0e779..1fa9200801a165949f7d25d1607d1c4900ee7842 100644 --- a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/extension/IPrototypeProvider.java +++ b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/extension/IPrototypeProvider.java @@ -18,10 +18,10 @@ $Id$ package org.fortiss.tooling.kernel.extension; import java.util.List; -import java.util.Map; import org.eclipse.emf.ecore.EObject; import org.fortiss.tooling.kernel.extension.data.Prototype; +import org.fortiss.tooling.kernel.extension.data.PrototypeCategory; import org.fortiss.tooling.kernel.service.IPrototypeService; /** @@ -42,6 +42,6 @@ public interface IPrototypeProvider { /** Returns the prototypes provided by this provider. */ List<Prototype> getPrototypes(); - /** Returns the optional category affiliation for the prototypes. */ - Map<Class<? extends EObject>, String> getCategories(); + /** Returns the categories of prototypes. */ + List<PrototypeCategory> getCategories(); } diff --git a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/extension/base/PrototypeProviderBase.java b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/extension/base/PrototypeProviderBase.java index c64f5cbeba93b7506172024e600143972f02482e..622608431e3dae4617ea44b67d0442ef7b53d410 100644 --- a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/extension/base/PrototypeProviderBase.java +++ b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/extension/base/PrototypeProviderBase.java @@ -20,34 +20,35 @@ package org.fortiss.tooling.kernel.extension.base; import java.util.ArrayList; import java.util.HashMap; import java.util.List; +import java.util.Map; import org.conqat.lib.commons.collections.CollectionUtils; -import org.conqat.lib.commons.collections.UnmodifiableMap; import org.eclipse.emf.ecore.EObject; import org.fortiss.tooling.kernel.extension.IPrototypeProvider; import org.fortiss.tooling.kernel.extension.data.Prototype; +import org.fortiss.tooling.kernel.extension.data.PrototypeCategory; /** * Base implementation for {@link IPrototypeProvider}s. * * <p> * Sub-classes must implement {@link #registerPrototypes()} to register specific prototypes using - * {@link #registerPrototype(String, EObject)} and - * {@link #registerPrimaryPrototype(String, EObject)}. + * {@link #registerPrototype(String, EObject, String)} and + * {@link #registerPrimaryPrototype(String, EObject, String)}. * * @author hoelzl * @author $Author$ * @version $Rev$ - * @ConQAT.Rating GREEN Hash: F43BE2C17C80D801F906DF80DB48206A + * @ConQAT.Rating YELLOW Hash: 266A6634327794A801F21F8E9018C35B */ public abstract class PrototypeProviderBase implements IPrototypeProvider { /** Stores the registered prototypes. */ protected final List<Prototype> prototypes = new ArrayList<Prototype>(); - /** Stores the optional category affiliation for the prototype. */ - private final HashMap<Class<? extends EObject>, String> map = - new HashMap<Class<? extends EObject>, String>(); + /** Stores the prototypes categories. */ + private final Map<String, PrototypeCategory> categories = + new HashMap<String, PrototypeCategory>(); /** Constructor. */ public PrototypeProviderBase() { @@ -58,31 +59,21 @@ public abstract class PrototypeProviderBase implements IPrototypeProvider { protected abstract void registerPrototypes(); /** Registers the given {@link EObject} with the given name and category. */ - protected final void registerPrototype(String name, EObject prototype, String category) { - registerPrototype(name, prototype); - registerCategory(prototype, category); - } - - /** Registers the given {@link EObject} with the given name. */ - protected final void registerPrototype(String name, EObject prototype) { - prototypes.add(new Prototype(name, prototype, false)); + protected final void registerPrototype(String name, EObject prototype, String categoryName) { + Prototype prototypeObject = new Prototype(name, prototype, false); + prototypes.add(prototypeObject); + registerElementInCategory(prototypeObject, categoryName); } /** * Registers the given {@link EObject} with the given name as primary * prototype with the given category. */ - protected final void registerPrimaryPrototype(String name, EObject prototype, String category) { - registerPrimaryPrototype(name, prototype); - registerCategory(prototype, category); - } - - /** - * Registers the given {@link EObject} with the given name as primary - * prototype. - */ - protected final void registerPrimaryPrototype(String name, EObject prototype) { - prototypes.add(new Prototype(name, prototype, true)); + protected final void registerPrimaryPrototype(String name, EObject prototype, + String categoryName) { + Prototype prototypeObject = new Prototype(name, prototype, true); + prototypes.add(prototypeObject); + registerElementInCategory(prototypeObject, categoryName); } /** {@inheritDoc} */ @@ -92,13 +83,34 @@ public abstract class PrototypeProviderBase implements IPrototypeProvider { } /** Registers the element with the given category. */ - public void registerCategory(EObject element, String category) { - map.put(element.getClass(), category); + private void registerElementInCategory(Prototype element, String category) { + PrototypeCategory cat = registerPrototypeCategory(category); + cat.add(element); + } + + /** Registers an existing prototype category. */ + protected PrototypeCategory registerPrototypeCategory(String category) { + PrototypeCategory cat = categories.get(category); + if(cat == null) { + cat = new PrototypeCategory(category); + categories.put(category, cat); + } + return cat; + } + + /** Registers an existing prototype category as child of a parent category. */ + protected PrototypeCategory + registerPrototypeCategory(PrototypeCategory parent, String category) { + PrototypeCategory cat = registerPrototypeCategory(category); + parent.add(cat); + return cat; } /** {@inheritDoc} */ @Override - public UnmodifiableMap<Class<? extends EObject>, String> getCategories() { - return CollectionUtils.asUnmodifiable(map); + public List<PrototypeCategory> getCategories() { + List<PrototypeCategory> result = new ArrayList<PrototypeCategory>(); + result.addAll(categories.values()); + return result; } } diff --git a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/extension/data/LibraryPrototype.java b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/extension/data/LibraryPrototype.java index 7a24996068b44ece781ce080037134bfd8cee705..30839272bdf8a6372e9cca474c13ba3b48845402 100644 --- a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/extension/data/LibraryPrototype.java +++ b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/extension/data/LibraryPrototype.java @@ -25,7 +25,7 @@ import org.fortiss.tooling.kernel.model.ILibraryElementReference; * @author ratiu * @author $Author: hoelzl $ * @version $Rev: 18709 $ - * @ConQAT.Rating RED Hash: + * @ConQAT.Rating YELLOW Hash: DC1BBA0C4DEA68D7B0F23CB1C4320C5C */ public abstract class LibraryPrototype extends Prototype { diff --git a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/extension/data/Prototype.java b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/extension/data/Prototype.java index 2dff101cf909bb31dbd43c142be55cae71fb7e8a..5622789228a39bc005675e6f59397bdb6d9a2c93 100644 --- a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/extension/data/Prototype.java +++ b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/extension/data/Prototype.java @@ -26,7 +26,7 @@ import org.eclipse.emf.ecore.util.EcoreUtil; * @author hoelzl * @author $Author$ * @version $Rev$ - * @ConQAT.Rating GREEN Hash: D5F7FE80539882533974AD12EEE0E643 + * @ConQAT.Rating YELLOW Hash: BDA6EE7DCDC55104694FD786CA06ECBE */ public class Prototype { diff --git a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/extension/data/ProtoypeCategory.java b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/extension/data/PrototypeCategory.java similarity index 78% rename from org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/extension/data/ProtoypeCategory.java rename to org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/extension/data/PrototypeCategory.java index 9d92eec418d4349403822e8987edf5b5486e0e97..ef4c1920f38c5cfa9f1954d530d65d48fbb0ae07 100644 --- a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/extension/data/ProtoypeCategory.java +++ b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/extension/data/PrototypeCategory.java @@ -18,6 +18,7 @@ $Id$ package org.fortiss.tooling.kernel.extension.data; import java.util.ArrayList; +import java.util.List; /** * Container object for prototypes of a certain category. @@ -27,10 +28,10 @@ import java.util.ArrayList; * @version $Rev$ * @ConQAT.Rating GREEN Hash: E51B16B14246DBE6D73D62B1424E852F */ -public class ProtoypeCategory { +public class PrototypeCategory { /** Constructor. */ - public ProtoypeCategory(String category) { + public PrototypeCategory(String category) { categoryName = category; } @@ -38,16 +39,27 @@ public class ProtoypeCategory { private final String categoryName; /** Stores the prototypes affiliated with this category. */ - private ArrayList<Prototype> children = new ArrayList<Prototype>(); + private List<Prototype> children = new ArrayList<Prototype>(); + + /** Stores the sub-categories of this category. */ + private List<PrototypeCategory> subCategories = new ArrayList<PrototypeCategory>(); /** Adds the prototype. */ public void add(Prototype prototype) { children.add(prototype); } + /** Adds sub-category. */ + public void add(PrototypeCategory subCat) { + subCategories.add(subCat); + } + /** Returns the members of this category. */ public Object[] getChildren() { - return children.toArray(); + List<Object> result = new ArrayList<Object>(); + result.addAll(children); + result.addAll(subCategories); + return result.toArray(); } /** Returns the name of the category. */ diff --git a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/extension/base/LibraryPrototypeProviderBase.java b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/LibraryPrototypeProvider.java similarity index 53% rename from org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/extension/base/LibraryPrototypeProviderBase.java rename to org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/LibraryPrototypeProvider.java index e25a0b23ab211bb63859b4d0c53782e251dee4e9..9a71eeaa3a8b20bf1ded3e3b0d05129317a9d66b 100644 --- a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/extension/base/LibraryPrototypeProviderBase.java +++ b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/LibraryPrototypeProvider.java @@ -15,9 +15,18 @@ $Id: codetemplates.xml 1 2011-01-01 00:00:01Z hoelzl $ | See the License for the specific language governing permissions and | | limitations under the License. | +--------------------------------------------------------------------------*/ -package org.fortiss.tooling.kernel.extension.base; +package org.fortiss.tooling.kernel.internal; +import java.util.List; + +import org.eclipse.emf.ecore.EObject; +import org.fortiss.tooling.kernel.extension.ILibraryElementHandler; +import org.fortiss.tooling.kernel.extension.base.PrototypeProviderBase; +import org.fortiss.tooling.kernel.extension.data.Prototype; +import org.fortiss.tooling.kernel.extension.data.PrototypeCategory; import org.fortiss.tooling.kernel.model.ILibraryElement; +import org.fortiss.tooling.kernel.model.ILibraryElementReference; +import org.fortiss.tooling.kernel.service.ILibraryService; /** * The base class for prototype providers for library elements. @@ -25,9 +34,9 @@ import org.fortiss.tooling.kernel.model.ILibraryElement; * @author ratiu * @author $Author: hoelzl $ * @version $Rev: 18709 $ - * @ConQAT.Rating RED Hash: + * @ConQAT.Rating YELLOW Hash: A8413CD1A37B7C56922144AB4641F72D */ -public abstract class LibraryPrototypeProviderBase extends PrototypeProviderBase { +public class LibraryPrototypeProvider extends PrototypeProviderBase { /** * Refreshes the list of prototypes to synchronize them with the current state @@ -38,6 +47,25 @@ public abstract class LibraryPrototypeProviderBase extends PrototypeProviderBase registerPrototypes(); } - /** Returns the kind of the library element for which this class provides prototypes. */ - public abstract <T extends ILibraryElement> Class<T> getPrototypeKind(); + /** {@inheritDoc} */ + @Override + protected void registerPrototypes() { + PrototypeCategory libraryCategory = registerPrototypeCategory("Library"); + for(ILibraryElement libElem : ILibraryService.INSTANCE + .getLibraryElementsFromAllWorkspaceLibraries()) { + List<ILibraryElementHandler<EObject>> handlers = + ((LibraryService)ILibraryService.INSTANCE).getRegisteredHandlers(libElem + .getWrappedElement().getClass()); + + ILibraryElementHandler<EObject> firstHandler = handlers.get(0); + + Prototype prot = firstHandler.createLibraryElementReferencePrototype(libElem); + + prototypes.add(prot); + + String categoryName = ((ILibraryElementReference)prot.getPrototype()).getURI(); + PrototypeCategory current = registerPrototypeCategory(libraryCategory, categoryName); + current.add(prot); + } + } } diff --git a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/LibraryService.java b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/LibraryService.java index 58e996303ae1770dfce7b355a0ad60e7600eccd0..02d3dc55073eae20d975cdade1938e75c8bc7df1 100644 --- a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/LibraryService.java +++ b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/LibraryService.java @@ -20,6 +20,7 @@ package org.fortiss.tooling.kernel.internal; import static org.fortiss.tooling.kernel.utils.EcoreUtils.pickInstanceOf; import static org.fortiss.tooling.kernel.utils.KernelModelElementUtils.getParentElement; +import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; @@ -33,7 +34,6 @@ import org.eclipse.emf.ecore.util.EContentAdapter; import org.eclipse.emf.ecore.util.EcoreUtil; import org.fortiss.tooling.kernel.extension.ILibraryElementHandler; import org.fortiss.tooling.kernel.extension.IPrototypeProvider; -import org.fortiss.tooling.kernel.extension.base.LibraryPrototypeProviderBase; import org.fortiss.tooling.kernel.extension.data.ITopLevelElement; import org.fortiss.tooling.kernel.model.ILibrary; import org.fortiss.tooling.kernel.model.ILibraryElement; @@ -51,7 +51,7 @@ import org.fortiss.tooling.kernel.service.base.EObjectAwareServiceBase; * @author ratiu * @author $Author: ratiu $ * @version $Rev: 5274 $ - * @ConQAT.Rating YELLOW Hash: 4117552CB9BEEB37BBA33FF9982D5337 + * @ConQAT.Rating YELLOW Hash: C87F42DC737D4C418608861E2B0C7586 */ public class LibraryService extends EObjectAwareServiceBase<ILibraryElementHandler<EObject>> implements ILibraryService { @@ -68,12 +68,12 @@ public class LibraryService extends EObjectAwareServiceBase<ILibraryElementHandl /** {@inheritDoc} */ @Override - public boolean isShadowElement(EObject eobj) { + public boolean isLibraryElementShadow(EObject eobj) { ILibraryElementReference parent = getParentElement(eobj, ILibraryElementReference.class); // with "eobj.eContainer() != parent" we assume that the model elements are not directly // contained in the reference - if(parent != null && parent != eobj && eobj.eContainer() != parent) { + if(parent != null && parent != eobj) { // && eobj.eContainer() != parent) { return true; } @@ -117,7 +117,7 @@ public class LibraryService extends EObjectAwareServiceBase<ILibraryElementHandl @Override public ILibraryElement findLibraryElementByURI(String uri) { for(ILibraryElement libElem : getLibraryElementsFromAllWorkspaceLibraries()) { - if(libElem.getUri().equals(uri)) { + if(libElem.getURI().equals(uri)) { return libElem; } } @@ -156,29 +156,27 @@ public class LibraryService extends EObjectAwareServiceBase<ILibraryElementHandl /** {@inheritDoc} */ @Override public List<ILibraryPackage> getAllLibraryPackages(ILibrary lib) { - return pickInstanceOf(ILibraryPackage.class, lib.getRootElementsList()); - } + List<ILibraryPackage> result = new ArrayList<ILibraryPackage>(); - /** {@inheritDoc} */ - @Override - public ILibraryPackage findLibraryPackage(ILibrary lib, String packName) { - for(ILibraryPackage pack : getAllLibraryPackages(lib)) { - if(pack.getName().equals(packName)) { - return pack; - } + for(ILibraryPackage topLevelPack : pickInstanceOf(ILibraryPackage.class, + lib.getRootElementsList())) { + result.add(topLevelPack); + result.addAll(getAllSubPackages(topLevelPack)); } - return null; + + return result; } - /** {@inheritDoc} */ - @Override - public ILibrary findLibrary(String libraryName) { - for(ILibrary lib : ILibraryService.INSTANCE.getLibrariesFromWorkspace()) { - if(lib.getName().equals(libraryName)) { - return lib; - } + /** All sub-packages. */ + public List<ILibraryPackage> getAllSubPackages(ILibraryPackage pack) { + List<ILibraryPackage> result = new ArrayList<ILibraryPackage>(); + + for(ILibraryPackage subPack : pack.getSubPackagesList()) { + result.add(subPack); + result.addAll(getAllSubPackages(subPack)); } - return null; + + return result; } /** @@ -197,7 +195,7 @@ public class LibraryService extends EObjectAwareServiceBase<ILibraryElementHandl setDirty(ref, false); - final ILibraryElement lc = findLibraryElementByURI(ref.getUri()); + final ILibraryElement lc = findLibraryElementByURI(ref.getURI()); if(lc == null) { return; } @@ -209,7 +207,7 @@ public class LibraryService extends EObjectAwareServiceBase<ILibraryElementHandl public void run() { ILibraryService.INSTANCE.setDirty(ref, false); EObject copy = EcoreUtil.copy(lc.getWrappedElement()); - ref.setWrappedElement(copy); + ref.setLibraryElementShadow(copy); } }); @@ -234,16 +232,11 @@ public class LibraryService extends EObjectAwareServiceBase<ILibraryElementHandl ILibraryElementHandler<EObject> handler = handlers.get(0); ILibraryElement libElem = handler.createLibraryElement(copy); - libElem.setUri(pack.getUri() + "/" + namedElement.getName()); pack.getLibraryElementsList().add(libElem); for(IPrototypeProvider pp : IPrototypeService.INSTANCE.getPrototypeProviders()) { - if(pp instanceof LibraryPrototypeProviderBase) { - LibraryPrototypeProviderBase lpp = (LibraryPrototypeProviderBase)pp; - Class<ILibraryElement> cls = lpp.getPrototypeKind(); - if(cls.isAssignableFrom(libElem.getClass())) { - lpp.refreshPrototypes(); - } + if(pp instanceof LibraryPrototypeProvider) { + ((LibraryPrototypeProvider)pp).refreshPrototypes(); } } } diff --git a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/PrototypeService.java b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/PrototypeService.java index c7222d0430c77e33a209d07f72607663a0873d8d..a3b5cada3e15ec981e824f1476cf3451737654f1 100644 --- a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/PrototypeService.java +++ b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/PrototypeService.java @@ -23,10 +23,8 @@ import static org.fortiss.tooling.kernel.utils.ExtensionPointUtils.loadClass; import static org.fortiss.tooling.kernel.utils.LoggingUtils.error; import java.util.ArrayList; -import java.util.HashMap; import java.util.LinkedList; import java.util.List; -import java.util.Map.Entry; import org.conqat.lib.commons.collections.CollectionUtils; import org.conqat.lib.commons.collections.UnmodifiableList; @@ -35,7 +33,7 @@ import org.eclipse.emf.ecore.EObject; import org.fortiss.tooling.kernel.ToolingKernelActivator; import org.fortiss.tooling.kernel.extension.IPrototypeProvider; import org.fortiss.tooling.kernel.extension.data.Prototype; -import org.fortiss.tooling.kernel.extension.data.ProtoypeCategory; +import org.fortiss.tooling.kernel.extension.data.PrototypeCategory; import org.fortiss.tooling.kernel.service.IElementCompositorService; import org.fortiss.tooling.kernel.service.IPrototypeService; import org.osgi.framework.Bundle; @@ -61,16 +59,6 @@ public class PrototypeService implements IPrototypeService { private final List<IPrototypeProvider> prototypeProviderList = new ArrayList<IPrototypeProvider>(); - /** Stores the optional category affiliation for the prototype. */ - private final HashMap<Class<? extends EObject>, String> map = - new HashMap<Class<? extends EObject>, String>(); - - /** {@inheritDoc} */ - @Override - public String getCategory(EObject element) { - return map.get(element.getClass()); - } - /** Constructor. */ public PrototypeService() { setupPrototypes(); @@ -137,39 +125,15 @@ public class PrototypeService implements IPrototypeService { /** {@inheritDoc} */ @Override - public List<Object> getAllPrototypesByCategory() { - init(); - ArrayList<Object> result = new ArrayList<Object>(); - ArrayList<Object> uncategorized = new ArrayList<Object>(); - HashMap<String, ProtoypeCategory> categories = new HashMap<String, ProtoypeCategory>(); - - for(Prototype p : getAllPrototypes()) { - String categoryName = map.get(p.getPrototype().getClass()); - if(categoryName != null) { - if(!categories.containsKey(categoryName)) { - categories.put(categoryName, new ProtoypeCategory(categoryName)); - } - categories.get(categoryName).add(p); - } else { - uncategorized.add(p); - } - } - for(ProtoypeCategory pc : categories.values()) { - result.add(pc); - } - result.addAll(uncategorized); - return result; - } + public List<PrototypeCategory> getAllTopLevelPrototypesCategories() { + List<PrototypeCategory> result = new ArrayList<PrototypeCategory>(); - /** Initially fills the map with categorized elements. */ - private void init() { - if(!map.isEmpty()) { - return; - } for(IPrototypeProvider provider : prototypeProviderList) { - for(Entry<Class<? extends EObject>, String> entry : provider.getCategories().entrySet()) { - map.put(entry.getKey(), entry.getValue()); + for(PrototypeCategory currentCategory : provider.getCategories()) { + result.add(currentCategory); } } + + return result; } } diff --git a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/service/ILibraryService.java b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/service/ILibraryService.java index 95045066192373e428000374e75a5f363dc9209f..e4890bd0ff73471f0c9bd40d2d55ece7d1b4689f 100644 --- a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/service/ILibraryService.java +++ b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/service/ILibraryService.java @@ -33,7 +33,7 @@ import org.fortiss.tooling.kernel.model.INamedElement; * @author ratiu * @author $Author: hoelzl $ * @version $Rev: 18709 $ - * @ConQAT.Rating YELLOW Hash: 5341C5373D0AC230E766D56C82E331C4 + * @ConQAT.Rating YELLOW Hash: A83C32BD90DFEB75026B99C1756A06AE */ public interface ILibraryService { @@ -45,9 +45,12 @@ public interface ILibraryService { * A shadow is a temporary copy of an element, contained inside an * {@link ILibraryElementReference}. */ - public boolean isShadowElement(EObject anObject); + public boolean isLibraryElementShadow(EObject anObject); - /** Returns true if the library reference is dirty. */ + /** + * Returns true if the library reference is dirty. A library reference is dirty when the + * shadowed library element from inside is inconsistent with the library. + */ public boolean isDirty(ILibraryElementReference libRef); /** Sets the dirty flag for a library reference. */ @@ -62,15 +65,9 @@ public interface ILibraryService { /** Returns the list of {@link ILibrary} objects loaded in the workspace. */ public List<ILibrary> getLibrariesFromWorkspace(); - /** Returns a {@link ILibrary} with a given name or null if it does not exist. */ - public ILibrary findLibrary(String libraryName); - /** Returns all {@link ILibraryPackage} objects from library. */ public List<ILibraryPackage> getAllLibraryPackages(ILibrary lib); - /** Returns a {@link ILibraryPackage} with a given name or null if it does not exist. */ - public ILibraryPackage findLibraryPackage(ILibrary lib, String packName); - /** Ensures that the wrapped model element behind this reference is up to date. */ public void ensureWrappedElementIsUpToDate(final ILibraryElementReference ref); diff --git a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/service/IPrototypeService.java b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/service/IPrototypeService.java index dbc38edb1fd5d5064deba0c856b92f745dc8f687..9ceee41e88a814053bc90253ee556ec6436bdaf0 100644 --- a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/service/IPrototypeService.java +++ b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/service/IPrototypeService.java @@ -23,6 +23,7 @@ import org.conqat.lib.commons.collections.UnmodifiableList; import org.eclipse.emf.ecore.EObject; import org.fortiss.tooling.kernel.extension.IPrototypeProvider; import org.fortiss.tooling.kernel.extension.data.Prototype; +import org.fortiss.tooling.kernel.extension.data.PrototypeCategory; import org.fortiss.tooling.kernel.internal.PrototypeService; /** @@ -60,9 +61,6 @@ public interface IPrototypeService { */ List<Prototype> getComposablePrototypes(Class<? extends EObject> modelElementType); - /** Returns the category of the given element. */ - public String getCategory(EObject element); - - /** Returns all prototypes in a tree sorted by category with uncategorized appended. */ - List<Object> getAllPrototypesByCategory(); + /** Returns all top-level prototypes categories. */ + List<PrototypeCategory> getAllTopLevelPrototypesCategories(); }