From efb96d1056c8bf8b99199573222b506307c40761 Mon Sep 17 00:00:00 2001 From: Florian Hoelzl <hoelzl@fortiss.org> Date: Fri, 24 Jun 2011 10:03:22 +0000 Subject: [PATCH] added extension point for eclipse resource storage location providers clean up => YELLOW --- .../base/ui/ToolingBaseUIActivator.java | 7 +- .../tooling/base/ToolingBaseActivator.java | 7 +- .../kernel/ui/ToolingKernelUIActivator.java | 7 +- .../tooling/kernel/ui/base/EditorBase.java | 4 +- .../ui/base/ModelElementHandlerBase.java | 2 +- ...NamedCommentedModelElementHandlerBase.java | 2 +- .../databinding/EObjectObservableValue.java | 2 +- .../kernel/ui/databinding/Observables.java | 4 +- .../interfaces/IActionContributingEditor.java | 2 +- .../IBindingEditorPageChangeListener.java | 2 +- .../ui/interfaces/ICustomMenuContributor.java | 2 +- .../ui/interfaces/IEditPartFactory.java | 4 +- .../kernel/ui/interfaces/IEditorBinding.java | 2 +- .../ui/interfaces/IModelElementHandler.java | 2 +- .../ui/internal/EditPartFactoryService.java | 2 +- .../kernel/ui/internal/MarkerService.java | 2 +- .../internal/editor/BindingContributor.java | 2 +- .../editor/ModelElementEditorInput.java | 2 +- .../properties/IdLabeledPropertySection.java | 2 +- .../NamedCommentedPropertySection.java | 11 +- .../properties/PropertiesAdapterFactory.java | 3 +- .../views/EObjectDragSourceListener.java | 6 +- .../kernel/ui/internal/views/LibraryView.java | 2 +- .../views/NavigatorTreeContentProvider.java | 2 +- .../views/NavigatorTreeLabelProvider.java | 2 +- .../kernel/ui/internal/views/NewMenu.java | 1 - .../kernel/ui/util/DataBindingUtils.java | 4 +- .../kernel/ui/util/DragAndDropUtils.java | 4 +- org.fortiss.tooling.kernel/trunk/plugin.xml | 1 + ...clipseResourceStorageLocationProvider.exsd | 102 ++++++++++++++++++ .../kernel/ToolingKernelActivator.java | 7 +- ...clipseResourceStorageLocationProvider.java | 38 +++++++ .../kernel/internal/PersistencyService.java | 55 +++++++--- .../EclipseResourceStorageProvider.java | 68 +++++++----- .../storage/eclipse/ModelContext.java | 2 +- 35 files changed, 260 insertions(+), 107 deletions(-) create mode 100644 org.fortiss.tooling.kernel/trunk/schema/eclipseResourceStorageLocationProvider.exsd create mode 100644 org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/interfaces/IEclipseResourceStorageLocationProvider.java diff --git a/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/ToolingBaseUIActivator.java b/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/ToolingBaseUIActivator.java index 89d506ce6..99ad548f5 100644 --- a/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/ToolingBaseUIActivator.java +++ b/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/ToolingBaseUIActivator.java @@ -27,7 +27,7 @@ import org.osgi.framework.BundleContext; * @author hoelzl * @author $Author$ * @version $Rev$ - * @ConQAT.Rating YELLOW Hash: 1D717C45E4E5E6DB57569062F7E741A1 + * @ConQAT.Rating YELLOW Hash: C2C3F8B958211307EAE1AC2650F921EC */ public class ToolingBaseUIActivator extends AbstractUIPlugin { @@ -37,11 +37,6 @@ public class ToolingBaseUIActivator extends AbstractUIPlugin { /** The shared instance. */ private static ToolingBaseUIActivator plugin; - /** Constructor. */ - public ToolingBaseUIActivator() { - // do nothing - } - /** {@inheritDoc} */ @Override public void start(BundleContext context) throws Exception { diff --git a/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/ToolingBaseActivator.java b/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/ToolingBaseActivator.java index af05f0673..7b6defbf0 100644 --- a/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/ToolingBaseActivator.java +++ b/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/ToolingBaseActivator.java @@ -26,7 +26,7 @@ import org.osgi.framework.BundleContext; * @author hoelzl * @author $Author$ * @version $Rev$ - * @ConQAT.Rating RED Hash: D6B33EFB704B0CA151E1C945B5BC48C6 + * @ConQAT.Rating YELLOW Hash: 5C875862B62D7463965C14A53088735B */ public class ToolingBaseActivator extends Plugin { @@ -36,11 +36,6 @@ public class ToolingBaseActivator extends Plugin { /** The shared instance. */ private static ToolingBaseActivator plugin; - /** Constructor. */ - public ToolingBaseActivator() { - // do nothing - } - /** {@inheritDoc} */ @Override public void start(BundleContext context) throws Exception { diff --git a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/ToolingKernelUIActivator.java b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/ToolingKernelUIActivator.java index 0e7c0b745..fe25e4a2f 100644 --- a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/ToolingKernelUIActivator.java +++ b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/ToolingKernelUIActivator.java @@ -27,7 +27,7 @@ import org.osgi.framework.BundleContext; * @author hoelzl * @author $Author$ * @version $Rev$ - * @ConQAT.Rating YELLOW Hash: 1D717C45E4E5E6DB57569062F7E741A1 + * @ConQAT.Rating YELLOW Hash: 1BDD065B5C8C0E977D45B5BB2D6AD704 */ public class ToolingKernelUIActivator extends AbstractUIPlugin { @@ -37,11 +37,6 @@ public class ToolingKernelUIActivator extends AbstractUIPlugin { /** The shared instance. */ private static ToolingKernelUIActivator plugin; - /** Constructor. */ - public ToolingKernelUIActivator() { - // do nothing - } - /** {@inheritDoc} */ @Override public void start(BundleContext context) throws Exception { diff --git a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/base/EditorBase.java b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/base/EditorBase.java index c92d15a66..333c3993a 100644 --- a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/base/EditorBase.java +++ b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/base/EditorBase.java @@ -38,7 +38,7 @@ import org.fortiss.tooling.kernel.ui.internal.editor.ModelElementEditorInput; * @author hoelzlf * @author $Author$ * @version $Rev$ - * @ConQAT.Rating YELLOW Hash: FAA96049E4259A80E6F68B3CB804C2DB + * @ConQAT.Rating YELLOW Hash: 468A589E32DF24EEF966B06649887E03 */ public abstract class EditorBase<T extends EObject> extends EditorPart implements IActionContributingEditor { @@ -125,7 +125,7 @@ public abstract class EditorBase<T extends EObject> extends EditorPart /** {@inheritDoc} */ @Override public final void doSaveAs() { - // Saving is handled automatically by emfStore + // Saving is handled automatically by persistency service } /** {@inheritDoc} */ diff --git a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/base/ModelElementHandlerBase.java b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/base/ModelElementHandlerBase.java index d7c1dfbbb..99f8df5ee 100644 --- a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/base/ModelElementHandlerBase.java +++ b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/base/ModelElementHandlerBase.java @@ -31,7 +31,7 @@ import org.fortiss.tooling.kernel.ui.interfaces.IModelElementHandler; * @author hoelzlf * @author $Author$ * @version $Rev$ - * @ConQAT.Rating YELLOW Hash: D35DD317B0C9AB5C153A5FEB5BC870EE + * @ConQAT.Rating YELLOW Hash: 917041660DD89A42589D65ED4EDF5CF2 */ public abstract class ModelElementHandlerBase<T extends EObject> implements IModelElementHandler<T> { diff --git a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/base/NamedCommentedModelElementHandlerBase.java b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/base/NamedCommentedModelElementHandlerBase.java index 5f2e112aa..05bc93716 100644 --- a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/base/NamedCommentedModelElementHandlerBase.java +++ b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/base/NamedCommentedModelElementHandlerBase.java @@ -27,7 +27,7 @@ import org.fortiss.tooling.kernel.ui.interfaces.IModelElementHandler; * @author hoelzlf * @author $Author$ * @version $Rev$ - * @ConQAT.Rating YELLOW Hash: 4322A4966A33DE648942D7D50E923FCF + * @ConQAT.Rating YELLOW Hash: 55120D889569756A57306BB1E5624DA8 */ public abstract class NamedCommentedModelElementHandlerBase<T extends INamedCommentedElement> extends ModelElementHandlerBase<T> { diff --git a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/databinding/EObjectObservableValue.java b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/databinding/EObjectObservableValue.java index 026942f43..6906a3d78 100644 --- a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/databinding/EObjectObservableValue.java +++ b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/databinding/EObjectObservableValue.java @@ -38,7 +38,7 @@ import org.fortiss.tooling.kernel.services.ICommandStackService; * @author hummel * @author $Author$ * @version $Rev$ - * @ConQAT.Rating RED Hash: 15CFC8E0F8C76EB39F1E306637EC6436 + * @ConQAT.Rating YELLOW Hash: FF1D7244CAF1F42A0CDCD95FA05EF519 */ public class EObjectObservableValue extends AbstractObservableValue { diff --git a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/databinding/Observables.java b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/databinding/Observables.java index 80c2da76b..230bae259 100644 --- a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/databinding/Observables.java +++ b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/databinding/Observables.java @@ -24,12 +24,12 @@ import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EStructuralFeature; /** - * Observerables for EObject models. + * Observerables for {@link EObject} models. * * @author hummel * @author $Author$ * @version $Rev$ - * @ConQAT.Rating RED Hash: D2469271EB80E5AA630EB34902E89A52 + * @ConQAT.Rating YELLOW Hash: 1F057C79CD5F9FFAC36A9B899B5D5FA6 */ public class Observables { diff --git a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/interfaces/IActionContributingEditor.java b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/interfaces/IActionContributingEditor.java index 7bca16aae..719b306fc 100644 --- a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/interfaces/IActionContributingEditor.java +++ b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/interfaces/IActionContributingEditor.java @@ -27,7 +27,7 @@ import org.fortiss.tooling.kernel.ui.internal.editor.BindingContributor; * @author hoelzl * @author $Author$ * @version $Rev$ - * @ConQAT.Rating RED Hash: + * @ConQAT.Rating YELLOW Hash: F21F807F121EFD17352A1BBDEA5609B8 */ public interface IActionContributingEditor { /** diff --git a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/interfaces/IBindingEditorPageChangeListener.java b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/interfaces/IBindingEditorPageChangeListener.java index 2d826a9e7..41062a938 100644 --- a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/interfaces/IBindingEditorPageChangeListener.java +++ b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/interfaces/IBindingEditorPageChangeListener.java @@ -25,7 +25,7 @@ import org.fortiss.tooling.kernel.ui.internal.editor.BindingEditor; * @author hoelzl * @author $Author: hoelzl $ * @version $Rev: 18709 $ - * @ConQAT.Rating YELLOW Hash: 6A3E42B1BE8519EA4B528FBF2E8D3F0A + * @ConQAT.Rating YELLOW Hash: 31B6B4FCCD19160ADF8A9ACBD31B3E9B */ public interface IBindingEditorPageChangeListener { diff --git a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/interfaces/ICustomMenuContributor.java b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/interfaces/ICustomMenuContributor.java index dd3a07746..873d480d9 100644 --- a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/interfaces/ICustomMenuContributor.java +++ b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/interfaces/ICustomMenuContributor.java @@ -29,7 +29,7 @@ import org.fortiss.tooling.kernel.ui.services.IContextMenuService; * @author hoelzlf * @author $Author$ * @version $Rev$ - * @ConQAT.Rating RED Hash: 2EACD5609822D5747074DB89E6956349 + * @ConQAT.Rating YELLOW Hash: 08A60D2BBA490E7EBB63F2F6B02983C9 */ public interface ICustomMenuContributor { diff --git a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/interfaces/IEditPartFactory.java b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/interfaces/IEditPartFactory.java index fa16040fd..29d67e88e 100644 --- a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/interfaces/IEditPartFactory.java +++ b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/interfaces/IEditPartFactory.java @@ -28,9 +28,9 @@ import org.fortiss.tooling.kernel.interfaces.IEObjectAware; * @author hoelzlf * @author $Author$ * @version $Rev$ - * @ConQAT.Rating RED Hash: + * @ConQAT.Rating YELLOW Hash: FCE65AE37C2C903EEDB13E0B39F3B55D */ public interface IEditPartFactory<T extends EObject> extends IEObjectAware<T>, EditPartFactory { - // no special content, inheritance only + // no special content, inheritance of IEObjectAware and EditPartFactory only } diff --git a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/interfaces/IEditorBinding.java b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/interfaces/IEditorBinding.java index 0660e2ecb..c6d6699c5 100644 --- a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/interfaces/IEditorBinding.java +++ b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/interfaces/IEditorBinding.java @@ -27,7 +27,7 @@ import org.fortiss.tooling.kernel.interfaces.IEObjectAware; * @author hoelzl * @author $Author$ * @version $Rev$ - * @ConQAT.Rating YELLOW Hash: 4AC49B113174D91D434A480C3456423F + * @ConQAT.Rating YELLOW Hash: 7E389CB6937BF93467517F49FEC75BCA */ public interface IEditorBinding<T extends EObject> extends IEObjectAware<EObject> { diff --git a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/interfaces/IModelElementHandler.java b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/interfaces/IModelElementHandler.java index 296376a72..7ca478ad7 100644 --- a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/interfaces/IModelElementHandler.java +++ b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/interfaces/IModelElementHandler.java @@ -31,7 +31,7 @@ import org.fortiss.tooling.kernel.interfaces.IEObjectAware; * @author hoelzl * @author $Author$ * @version $Rev$ - * @ConQAT.Rating YELLOW Hash: 7961ACC39EA9897DE867D119EE5DAFE2 + * @ConQAT.Rating YELLOW Hash: 02238EA9A8F42D8C9C21B463606C8A2D */ public interface IModelElementHandler<T extends EObject> extends IEObjectAware<T> { diff --git a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/EditPartFactoryService.java b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/EditPartFactoryService.java index 0dfd8b8b7..88f5ac52c 100644 --- a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/EditPartFactoryService.java +++ b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/EditPartFactoryService.java @@ -34,7 +34,7 @@ import org.fortiss.tooling.kernel.util.LoggingUtils; * @author hoelzl * @author $Author$ * @version $Rev$ - * @ConQAT.Rating YELLOW Hash: 31E49A6AD1B4A03E4CFEC3BB584284B5 + * @ConQAT.Rating YELLOW Hash: F3AF21797C779669598761DD4854D145 */ public class EditPartFactoryService extends EObjectAwareServiceBase<IEditPartFactory<EObject>> implements diff --git a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/MarkerService.java b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/MarkerService.java index b93e8d4a9..00d45546c 100644 --- a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/MarkerService.java +++ b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/MarkerService.java @@ -28,5 +28,5 @@ import org.fortiss.tooling.kernel.ui.services.IMarkerService; * @ConQAT.Rating RED Hash: 48FCF6B19C8D07FBEAD8EC8AD2BAA5EF */ public class MarkerService implements IMarkerService { - + // TODO (FH) implement } diff --git a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/editor/BindingContributor.java b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/editor/BindingContributor.java index effb2e0b3..643933338 100644 --- a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/editor/BindingContributor.java +++ b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/editor/BindingContributor.java @@ -31,7 +31,7 @@ import org.fortiss.tooling.kernel.ui.services.IActionService; * @author hoelzl * @author $Author$ * @version $Rev$ - * @ConQAT.Rating RED Hash: + * @ConQAT.Rating YELLOW Hash: C7051BC810281AFB5BA9B19154724151 */ public final class BindingContributor extends MultiPageEditorActionBarContributor { diff --git a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/editor/ModelElementEditorInput.java b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/editor/ModelElementEditorInput.java index 81c8f8846..3d2fe1f97 100644 --- a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/editor/ModelElementEditorInput.java +++ b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/editor/ModelElementEditorInput.java @@ -30,7 +30,7 @@ import org.fortiss.tooling.kernel.ui.services.IModelElementService; * @author hoelzlf * @author $Author$ * @version $Rev$ - * @ConQAT.Rating YELLOW Hash: 263039D4B69848F372B6ED729970B629 + * @ConQAT.Rating YELLOW Hash: 97D91D2A7C2890305CC4A990F1A5FBC1 */ public final class ModelElementEditorInput implements IEditorInput { diff --git a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/properties/IdLabeledPropertySection.java b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/properties/IdLabeledPropertySection.java index a077c79e4..c81631d28 100644 --- a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/properties/IdLabeledPropertySection.java +++ b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/properties/IdLabeledPropertySection.java @@ -34,7 +34,7 @@ import org.fortiss.tooling.kernel.ui.databinding.Observables; * @author hoelzl * @author $Author$ * @version $Rev$ - * @ConQAT.Rating YELLOW Hash: EE2461D408E5DF9E78A690CB2EA9612E + * @ConQAT.Rating YELLOW Hash: AAF40E2ED1B53B1E58814F6BB5A710D4 */ public class IdLabeledPropertySection extends PropertySectionBase { diff --git a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/properties/NamedCommentedPropertySection.java b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/properties/NamedCommentedPropertySection.java index 9f168198b..7b96eb915 100644 --- a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/properties/NamedCommentedPropertySection.java +++ b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/properties/NamedCommentedPropertySection.java @@ -34,7 +34,7 @@ import org.fortiss.tooling.kernel.ui.databinding.Observables; * @author ratiu * @author $Author$ * @version $Rev$ - * @ConQAT.Rating YELLOW Hash: D5A013EBF5437A031DDC569E2A7A108F + * @ConQAT.Rating YELLOW Hash: 94D36327BAB4EA717EA2163D820B9194 */ public class NamedCommentedPropertySection extends PropertySectionBase { @@ -52,9 +52,7 @@ public class NamedCommentedPropertySection extends PropertySectionBase { super(); } - /** - * {@inheritDoc} - */ + /** {@inheritDoc} */ @Override public void createControls(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage) { @@ -64,9 +62,7 @@ public class NamedCommentedPropertySection extends PropertySectionBase { commentText = createFormText("Comment"); } - /** - * {@inheritDoc} - */ + /** {@inheritDoc} */ @Override protected void setSectionInput(Object input) { namedCommented = (INamedCommentedElement) input; @@ -89,5 +85,4 @@ public class NamedCommentedPropertySection extends PropertySectionBase { dbc.bindValue(SWTObservables.observeText(commentText, SWT.FocusOut), modelObservable, null, null); } - } \ No newline at end of file diff --git a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/properties/PropertiesAdapterFactory.java b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/properties/PropertiesAdapterFactory.java index e511e7fde..78bc8c041 100644 --- a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/properties/PropertiesAdapterFactory.java +++ b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/properties/PropertiesAdapterFactory.java @@ -29,7 +29,7 @@ import org.fortiss.tooling.kernel.ui.services.IPropertiesService; * @author hoelzl * @author $Author$ * @version $Rev$ - * @ConQAT.Rating YELLOW Hash: 7AEC5A301361A2C14067F38D4AC5C7FE + * @ConQAT.Rating YELLOW Hash: 0CB9AF7EAB134DF256A41CEDF2C4FE44 */ @SuppressWarnings("rawtypes") public final class PropertiesAdapterFactory implements IAdapterFactory { @@ -59,5 +59,4 @@ public final class PropertiesAdapterFactory implements IAdapterFactory { public Class[] getAdapterList() { return new Class[] { ITabbedPropertySheetPageContributor.class }; } - } diff --git a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/views/EObjectDragSourceListener.java b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/views/EObjectDragSourceListener.java index 38bb3293b..2f343ebb9 100644 --- a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/views/EObjectDragSourceListener.java +++ b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/views/EObjectDragSourceListener.java @@ -24,11 +24,12 @@ import org.eclipse.swt.dnd.DragSourceAdapter; import org.eclipse.swt.dnd.DragSourceEvent; /** + * Drag and drop support for {@link LibraryView}. * - * @author Eder + * @author eder * @author $Author: hoelzl $ * @version $Rev: 18709 $ - * @ConQAT.Rating RED Hash: 249A02E8613055D236661A34D74A461C + * @ConQAT.Rating YELLOW Hash: 7274445CF4D8976F98D2261373206375 */ public class EObjectDragSourceListener extends DragSourceAdapter { @@ -65,5 +66,4 @@ public class EObjectDragSourceListener extends DragSourceAdapter { event.data = ((IStructuredSelection) libraryViewer.getSelection()) .getFirstElement(); } - } 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 a0da50398..9abb49749 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 @@ -53,7 +53,7 @@ import org.fortiss.tooling.kernel.ui.services.IModelElementService; * @author eder * @author $Author: hoelzl $ * @version $Rev: 18709 $ - * @ConQAT.Rating RED Hash: A43DAF31B100FF92B123EA6A31C86CBA + * @ConQAT.Rating YELLOW Hash: D385105D51E1CFDED0B8FF4E855A2B94 */ public class LibraryView extends ViewPart { 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 1f955c28e..68dca8dff 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 @@ -34,7 +34,7 @@ import org.fortiss.tooling.kernel.ui.services.IModelElementService; * @author hoelzlf * @author $Author$ * @version $Rev$ - * @ConQAT.Rating YELLOW Hash: DBA3E3CC4704ECB40F35CF9D36BFE89A + * @ConQAT.Rating YELLOW Hash: B99F9C3252CFF2333B31E7075D035057 */ public class NavigatorTreeContentProvider implements ITreeContentProvider { diff --git a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/views/NavigatorTreeLabelProvider.java b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/views/NavigatorTreeLabelProvider.java index 5ebab7759..0fbbed6b2 100644 --- a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/views/NavigatorTreeLabelProvider.java +++ b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/views/NavigatorTreeLabelProvider.java @@ -30,7 +30,7 @@ import org.fortiss.tooling.kernel.ui.services.IModelElementService; * @author hoelzlf * @author $Author$ * @version $Rev$ - * @ConQAT.Rating YELLOW Hash: E1D373938BE78CBD44141D12444BE654 + * @ConQAT.Rating YELLOW Hash: 576FB18EB32B79705C9E03CB910F68CB */ public final class NavigatorTreeLabelProvider extends BaseLabelProvider implements ILabelProvider { diff --git a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/views/NewMenu.java b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/views/NewMenu.java index 0cae44aca..44615b738 100644 --- a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/views/NewMenu.java +++ b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/views/NewMenu.java @@ -124,5 +124,4 @@ public class NewMenu extends CompoundContributionItem { } } - } diff --git a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/util/DataBindingUtils.java b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/util/DataBindingUtils.java index e28881672..a02ae72f9 100644 --- a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/util/DataBindingUtils.java +++ b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/util/DataBindingUtils.java @@ -32,10 +32,10 @@ import org.eclipse.swt.widgets.Control; /** * Utility methods for data binding support. * - * @author hoelzlf + * @author hoelzl * @author $Author$ * @version $Rev$ - * @ConQAT.Rating RED Hash: 95D1650431DCD178D61C00A971F6810C + * @ConQAT.Rating YELLOW Hash: 646DA3B438CB4A6FCF6D7740388C0373 */ public final class DataBindingUtils { diff --git a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/util/DragAndDropUtils.java b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/util/DragAndDropUtils.java index 465ff228e..2678dcc63 100644 --- a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/util/DragAndDropUtils.java +++ b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/util/DragAndDropUtils.java @@ -24,10 +24,10 @@ import org.fortiss.tooling.kernel.services.IPrototypeService.Prototype; /** * Utility methods for drag and drop support. * - * @author hoelzlf + * @author hoelzl * @author $Author$ * @version $Rev$ - * @ConQAT.Rating RED Hash: 7ABCFF777BE5B8EA5A7F4F65D264072E + * @ConQAT.Rating YELLOW Hash: 338194B154464E27FA65CDCD72CE7439 */ public final class DragAndDropUtils { diff --git a/org.fortiss.tooling.kernel/trunk/plugin.xml b/org.fortiss.tooling.kernel/trunk/plugin.xml index 2bd864864..9dd64404d 100644 --- a/org.fortiss.tooling.kernel/trunk/plugin.xml +++ b/org.fortiss.tooling.kernel/trunk/plugin.xml @@ -6,6 +6,7 @@ <extension-point id="modelElementConnector" name="Model Element Connector" schema="schema/modelElementConnector.exsd"/> <extension-point id="modelStorageProvider" name="Model Storage Provider" schema="schema/modelStorageProvider.exsd"/> <extension-point id="modelConstraintChecker" name="Model Constraint Checker" schema="schema/modelConstraintChecker.exsd"/> + <extension-point id="eclipseResourceStorageLocationProvider" name="Eclipse Resource Storage Location Provider" schema="schema/eclipseResourceStorageLocationProvider.exsd"/> <extension point="org.eclipse.emf.ecore.generated_package"> <package diff --git a/org.fortiss.tooling.kernel/trunk/schema/eclipseResourceStorageLocationProvider.exsd b/org.fortiss.tooling.kernel/trunk/schema/eclipseResourceStorageLocationProvider.exsd new file mode 100644 index 000000000..2abbc1088 --- /dev/null +++ b/org.fortiss.tooling.kernel/trunk/schema/eclipseResourceStorageLocationProvider.exsd @@ -0,0 +1,102 @@ +<?xml version='1.0' encoding='UTF-8'?> +<!-- Schema file written by PDE --> +<schema targetNamespace="org.fortiss.tooling.kernel" xmlns="http://www.w3.org/2001/XMLSchema"> +<annotation> + <appinfo> + <meta.schema plugin="org.fortiss.tooling.kernel" id="eclipseResourceStorageLocationProvider" name="Eclipse Resource Storage Location Provider"/> + </appinfo> + <documentation> + Registers a location provider for Eclipse resource based storage. + </documentation> + </annotation> + + <element name="extension"> + <annotation> + <appinfo> + <meta.element /> + </appinfo> + </annotation> + <complexType> + <sequence> + <element ref="storageLocationProvider" minOccurs="1" maxOccurs="unbounded"/> + </sequence> + <attribute name="point" type="string" use="required"> + <annotation> + <documentation> + + </documentation> + </annotation> + </attribute> + <attribute name="id" type="string"> + <annotation> + <documentation> + + </documentation> + </annotation> + </attribute> + <attribute name="name" type="string"> + <annotation> + <documentation> + + </documentation> + <appinfo> + <meta.attribute translatable="true"/> + </appinfo> + </annotation> + </attribute> + </complexType> + </element> + + <element name="storageLocationProvider"> + <complexType> + <attribute name="provider" type="string" use="required"> + <annotation> + <documentation> + + </documentation> + <appinfo> + <meta.attribute kind="java" basedOn=":org.fortiss.tooling.kernel.interfaces.IEclipseResourceStorageLocationProvider"/> + </appinfo> + </annotation> + </attribute> + </complexType> + </element> + + <annotation> + <appinfo> + <meta.section type="since"/> + </appinfo> + <documentation> + [Enter the first release in which this extension point appears.] + </documentation> + </annotation> + + <annotation> + <appinfo> + <meta.section type="examples"/> + </appinfo> + <documentation> + [Enter extension point usage example here.] + </documentation> + </annotation> + + <annotation> + <appinfo> + <meta.section type="apiinfo"/> + </appinfo> + <documentation> + [Enter API information here.] + </documentation> + </annotation> + + <annotation> + <appinfo> + <meta.section type="implementation"/> + </appinfo> + <documentation> + [Enter information about supplied implementation of this extension point.] + </documentation> + </annotation> + + +</schema> diff --git a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/ToolingKernelActivator.java b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/ToolingKernelActivator.java index 865a47f0c..659629e39 100644 --- a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/ToolingKernelActivator.java +++ b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/ToolingKernelActivator.java @@ -27,7 +27,7 @@ import org.osgi.framework.BundleContext; * @author hoelzl * @author $Author$ * @version $Rev$ - * @ConQAT.Rating YELLOW Hash: 157BFA58493859794739A4C9E55B0EFF + * @ConQAT.Rating YELLOW Hash: DB241126336AD7DDFEF835CC72703F1E */ public class ToolingKernelActivator extends Plugin { @@ -37,11 +37,6 @@ public class ToolingKernelActivator extends Plugin { /** The shared instance. */ private static ToolingKernelActivator plugin; - /** Constructor. */ - public ToolingKernelActivator() { - // do nothing - } - /** {@inheritDoc} */ @Override public void start(BundleContext context) throws Exception { diff --git a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/interfaces/IEclipseResourceStorageLocationProvider.java b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/interfaces/IEclipseResourceStorageLocationProvider.java new file mode 100644 index 000000000..80a8d0283 --- /dev/null +++ b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/interfaces/IEclipseResourceStorageLocationProvider.java @@ -0,0 +1,38 @@ +/*--------------------------------------------------------------------------+ +$Id$ +| | +| Copyright 2011 ForTISS GmbH | +| | +| Licensed under the Apache License, Version 2.0 (the "License"); | +| you may not use this file except in compliance with the License. | +| You may obtain a copy of the License at | +| | +| http://www.apache.org/licenses/LICENSE-2.0 | +| | +| Unless required by applicable law or agreed to in writing, software | +| distributed under the License is distributed on an "AS IS" BASIS, | +| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | +| See the License for the specific language governing permissions and | +| limitations under the License. | ++--------------------------------------------------------------------------*/ +package org.fortiss.tooling.kernel.interfaces; + +import org.eclipse.core.resources.IFile; +import org.fortiss.tooling.kernel.internal.storage.eclipse.EclipseResourceStorageProvider; + +/** + * Extension interface for the {@link EclipseResourceStorageProvider} mechanism. + * + * @author hoelzlf + * @author $Author$ + * @version $Rev$ + * @ConQAT.Rating YELLOW Hash: F2CBF6F78C114C5AE2676C85403E4488 + */ +public interface IEclipseResourceStorageLocationProvider { + + /** + * Returns whether the given {@link IFile} should be considered as a model + * file. + */ + boolean isStorageLocation(IFile file); +} diff --git a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/PersistencyService.java b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/PersistencyService.java index 16e336a79..35017f482 100644 --- a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/PersistencyService.java +++ b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/PersistencyService.java @@ -17,6 +17,7 @@ $Id$ +--------------------------------------------------------------------------*/ package org.fortiss.tooling.kernel.internal; +import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedList; @@ -25,6 +26,7 @@ import java.util.Map; import org.conqat.lib.commons.collections.CollectionUtils; import org.conqat.lib.commons.collections.UnmodifiableList; +import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.emf.ecore.EObject; @@ -38,20 +40,21 @@ import org.fortiss.tooling.kernel.util.LoggingUtils; import org.osgi.framework.Bundle; /** - * This class implements the {@link IPersistencyService} interface. + * This class implements the {@link IPersistencyService} interface. All of its + * public methods are synchronized. * * @author hoelzl * @author $Author$ * @version $Rev$ - * @ConQAT.Rating YELLOW Hash: 152A73FE81A28D789914ECBD143F1DFF + * @ConQAT.Rating YELLOW Hash: D6F9583647E210E21463E15ECC7E6334 */ public class PersistencyService implements IPersistencyService { /** The prototype provider extension point ID. */ - private static final String EXTENSION_POINT_NAME = "org.fortiss.tooling.kernel.modelPrototypeProvider"; + private static final String EXTENSION_POINT_NAME = "org.fortiss.tooling.kernel.modelStorageProvider"; /** The prototype provider configuration element name. */ - private static final String CONFIGURATION_ELEMENT_NAME = "modelPrototypeProvider"; + private static final String CONFIGURATION_ELEMENT_NAME = "modelStorageProvider"; /** Stores the registered storage providers. */ private final List<IStorageProvider> storageProviderList = new ArrayList<IStorageProvider>(); @@ -68,17 +71,18 @@ public class PersistencyService implements IPersistencyService { /** Constructor. */ public PersistencyService() { setupStorageProviders(); + initializeTopLevelElementContexts(); } /** {@inheritDoc} */ @Override - public UnmodifiableList<ITopLevelElementContext> getTopLevelElementContexts() { + public synchronized UnmodifiableList<ITopLevelElementContext> getTopLevelElementContexts() { return CollectionUtils.asUnmodifiable(contextCache); } /** {@inheritDoc} */ @Override - public boolean isTopLevelElement(EObject element) { + public synchronized boolean isTopLevelElement(EObject element) { for (ITopLevelElementContext context : contextCache) { if (context.getTopLevelElement() == element) { return true; @@ -89,7 +93,7 @@ public class PersistencyService implements IPersistencyService { /** {@inheritDoc} */ @Override - public boolean isDirty() { + public synchronized boolean isDirty() { for (ITopLevelElementContext context : contextCache) { if (context.isDirty()) { return true; @@ -100,14 +104,25 @@ public class PersistencyService implements IPersistencyService { /** {@inheritDoc} */ @Override - public void doSave(IProgressMonitor monitor) { - // TODO Auto-generated method stub - + public synchronized void doSave(IProgressMonitor monitor) { + for (ITopLevelElementContext context : contextCache) { + if (context.isDirty()) { + try { + context.doSave(monitor); + } catch (CoreException e) { + LoggingUtils.error(ToolingKernelActivator.getDefault(), + "Error during save operation.", e); + } catch (IOException e) { + LoggingUtils.error(ToolingKernelActivator.getDefault(), + "Error during save operation.", e); + } + } + } } /** {@inheritDoc} */ @Override - public void refreshTopLevelElements(IStorageProvider provider) { + public synchronized void refreshTopLevelElements(IStorageProvider provider) { if (provider == null) { return; } @@ -137,7 +152,7 @@ public class PersistencyService implements IPersistencyService { /** {@inheritDoc} */ @Override - public void addTopLevelElementListener( + public synchronized void addTopLevelElementListener( ITopLevelElementChangeListener listener) { if (!listeners.contains(listener)) { listeners.add(listener); @@ -159,7 +174,8 @@ public class PersistencyService implements IPersistencyService { } /** Notifies listener about top-level element removal. */ - private void notifyListenersAboutRemove(ITopLevelElementContext top) { + private synchronized void notifyListenersAboutRemove( + ITopLevelElementContext top) { for (ITopLevelElementChangeListener listener : listeners) { listener.topLevelElementRemoved(top); } @@ -167,7 +183,7 @@ public class PersistencyService implements IPersistencyService { /** {@inheritDoc} */ @Override - public ITopLevelElementContext getTopLevelElementContextFor( + public synchronized ITopLevelElementContext getTopLevelElementContextFor( EObject modelElement) { while (modelElement != null) { for (ITopLevelElementContext context : contextCache) { @@ -198,4 +214,15 @@ public class PersistencyService implements IPersistencyService { } } } + + /** Initializes the top-level element contexts. */ + private void initializeTopLevelElementContexts() { + for (IStorageProvider provider : storageProviderList) { + for (ITopLevelElementContext context : provider + .getTopLevelElementContexts()) { + contextCache.add(context); + storageProviderCache.put(context, provider); + } + } + } } diff --git a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/storage/eclipse/EclipseResourceStorageProvider.java b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/storage/eclipse/EclipseResourceStorageProvider.java index ae01f4856..0668d0c89 100644 --- a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/storage/eclipse/EclipseResourceStorageProvider.java +++ b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/storage/eclipse/EclipseResourceStorageProvider.java @@ -33,12 +33,16 @@ import org.eclipse.core.resources.IResourceDelta; import org.eclipse.core.resources.IResourceDeltaVisitor; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.emf.ecore.EObject; import org.fortiss.tooling.kernel.ToolingKernelActivator; +import org.fortiss.tooling.kernel.interfaces.IEclipseResourceStorageLocationProvider; import org.fortiss.tooling.kernel.interfaces.IStorageProvider; import org.fortiss.tooling.kernel.interfaces.ITopLevelElementContext; import org.fortiss.tooling.kernel.services.IPersistencyService; +import org.fortiss.tooling.kernel.util.ExtensionPointUtils; import org.fortiss.tooling.kernel.util.LoggingUtils; +import org.osgi.framework.Bundle; /** * This class implements the persistency service behavior for Eclipse file @@ -47,10 +51,20 @@ import org.fortiss.tooling.kernel.util.LoggingUtils; * @author hoelzlf * @author $Author$ * @version $Rev$ - * @ConQAT.Rating YELLOW Hash: E8F12BF14037AEDE9A02AE20B99271A6 + * @ConQAT.Rating YELLOW Hash: FBF0D92A524C593E2AC98117B492168A */ public class EclipseResourceStorageProvider implements IResourceChangeListener, IResourceDeltaVisitor, IStorageProvider { + + /** The prototype provider extension point ID. */ + private static final String EXTENSION_POINT_NAME = "org.fortiss.tooling.kernel.eclipseResourceStorageLocationProvider"; + + /** The prototype provider configuration element name. */ + private static final String CONFIGURATION_ELEMENT_NAME = "storageLocationProvider"; + + /** Stores the registered storage providers. */ + private final List<IEclipseResourceStorageLocationProvider> storageProviderList = new ArrayList<IEclipseResourceStorageLocationProvider>(); + /** Cache of models loaded so far. */ private final Map<IFile, ModelContext> loadedContexts = new HashMap<IFile, ModelContext>(); @@ -59,6 +73,7 @@ public class EclipseResourceStorageProvider implements IResourceChangeListener, /** Constructor. */ public EclipseResourceStorageProvider() { + setupLocationProviders(); ResourcesPlugin.getWorkspace().addResourceChangeListener(this); searchWorkspaceForModels(); } @@ -74,9 +89,11 @@ public class EclipseResourceStorageProvider implements IResourceChangeListener, for (IResource res : project.members()) { if (res instanceof IFile) { IFile file = (IFile) res; - // TODO (FH): use an extension mechanism for this check - if (file.getFileExtension().equals("af3_20")) { - loadContext(file); + for (IEclipseResourceStorageLocationProvider provider : storageProviderList) { + if (provider.isStorageLocation(file)) { + loadContext(file); + break; + } } } } @@ -136,30 +153,6 @@ public class EclipseResourceStorageProvider implements IResourceChangeListener, private void handleChange(final IFile file) { final ModelContext context = loadedContexts.get(file); if (!context.getLastChangeWasIntended()) { - // TODO (FH): find a solution for this ui code - // Display.getDefault().asyncExec(new Runnable() { - // @Override - // public void run() { - // final boolean reload = true; - // // MessageUtils.askQuestion( - // // "Reload changed file?", - // // "The file " - // // + file.getName() - // // + " changed on disk. " - // // + "Load these changes? " - // // + - // // "Note that loading the changes will discard all editors, " - // // + - // // "so all unsaved changes and the undo history will be lost. " - // // + "However if you do not reload now, " - // // + "the contents of the file will be overwritten " - // // + "the next time you perform a save."); - // - // if (reload) { - // } - // - // } - // }); unloadContext(file); try { loadContext(file).setLastChangeWasIntended(); @@ -203,4 +196,23 @@ public class EclipseResourceStorageProvider implements IResourceChangeListener, result.addAll(rootElementContexts.values()); return result; } + + /** Initializes the storage provider list from plugin extensions. */ + private void setupLocationProviders() { + for (IConfigurationElement ce : ExtensionPointUtils + .getConfigurationElements(EXTENSION_POINT_NAME, + CONFIGURATION_ELEMENT_NAME)) { + Bundle bundle = ExtensionPointUtils.getBundle(ce); + try { + Class<?> handlerClass = ExtensionPointUtils.loadClass( + ce.getAttribute("provider"), bundle); + IEclipseResourceStorageLocationProvider provider = (IEclipseResourceStorageLocationProvider) handlerClass + .getConstructor().newInstance(); + storageProviderList.add(provider); + } catch (Exception ex) { + LoggingUtils.error(ToolingKernelActivator.getDefault(), + ex.getMessage(), ex); + } + } + } } diff --git a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/storage/eclipse/ModelContext.java b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/storage/eclipse/ModelContext.java index 87260939a..37c17ff6c 100644 --- a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/storage/eclipse/ModelContext.java +++ b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/storage/eclipse/ModelContext.java @@ -57,7 +57,7 @@ import org.fortiss.tooling.kernel.util.LoggingUtils; * @author hummel * @author $Author$ * @version $Rev$ - * @ConQAT.Rating YELLOW Hash: 8EED08FDCAC443A797F6BE7F17F747B1 + * @ConQAT.Rating RED Hash: 6C872459359461C3FF854B5CC6E99FF5 */ class ModelContext implements ITopLevelElementContext { -- GitLab