diff options
author | Michael Jastram | 2012-07-17 13:22:11 +0000 |
---|---|---|
committer | Michael Jastram | 2012-07-17 13:22:11 +0000 |
commit | 8b1d92fa79fe0ac7bd2bc4e18e901c7ab3a48ecf (patch) | |
tree | ce33b2498aae47cfac65b01a0cbcab5fe21eb46b | |
parent | 7101cf683b3f3d5d895e77666cf56b1c5946adf8 (diff) | |
download | org.eclipse.rmf-8b1d92fa79fe0ac7bd2bc4e18e901c7ab3a48ecf.tar.gz org.eclipse.rmf-8b1d92fa79fe0ac7bd2bc4e18e901c7ab3a48ecf.tar.xz org.eclipse.rmf-8b1d92fa79fe0ac7bd2bc4e18e901c7ab3a48ecf.zip |
Refactoring Presentation Management
28 files changed, 136 insertions, 147 deletions
diff --git a/org.eclipse.rmf.pror.reqif10.edit/src/org/eclipse/rmf/pror/reqif10/configuration/provider/ProrPresentationConfigurationItemProvider.java b/org.eclipse.rmf.pror.reqif10.edit/src/org/eclipse/rmf/pror/reqif10/configuration/provider/ProrPresentationConfigurationItemProvider.java index 263e59d8..0c4c5fdc 100644 --- a/org.eclipse.rmf.pror.reqif10.edit/src/org/eclipse/rmf/pror/reqif10/configuration/provider/ProrPresentationConfigurationItemProvider.java +++ b/org.eclipse.rmf.pror.reqif10.edit/src/org/eclipse/rmf/pror/reqif10/configuration/provider/ProrPresentationConfigurationItemProvider.java @@ -18,7 +18,6 @@ import java.util.List; import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.util.ResourceLocator;
-import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
import org.eclipse.emf.edit.provider.IItemLabelProvider;
@@ -29,8 +28,6 @@ import org.eclipse.emf.edit.provider.ITreeItemContentProvider; import org.eclipse.emf.edit.provider.ItemProviderAdapter;
import org.eclipse.rmf.pror.reqif10.configuration.ConfigurationPackage;
import org.eclipse.rmf.pror.reqif10.provider.Reqif10EditPlugin;
-import org.eclipse.rmf.reqif10.DatatypeDefinition;
-import org.eclipse.rmf.reqif10.ReqIF;
/**
@@ -146,23 +143,5 @@ public abstract class ProrPresentationConfigurationItemProvider public ResourceLocator getResourceLocator() {
return Reqif10EditPlugin.INSTANCE;
}
-
- /**
- * This method is triggered when a this configuration element is added to a
- * {@link ReqIF} model, either because it is created and added, or because
- * the {@link ReqIF} was opened. This gives the Presentation a chance to
- * interact, e.g. by registering adapters, etc.
- */
- public abstract void registerReqIF(ReqIF reqif, EditingDomain domain);
-
- /**
- * This method is triggered when a this configuration element is removed from a
- * {@link ReqIF} model, either because it is got removed, or because
- * the {@link ReqIF} was closed. This gives the Presentation a chance to
- * interact, e.g. by unregistering adapters, etc.
- */
- public abstract void unregisterReqIF(ReqIF reqif, EditingDomain domain);
-
-
}
diff --git a/org.eclipse.rmf.pror.reqif10.edit/src/org/eclipse/rmf/pror/reqif10/configuration/provider/ProrPresentationConfigurationsItemProvider.java b/org.eclipse.rmf.pror.reqif10.edit/src/org/eclipse/rmf/pror/reqif10/configuration/provider/ProrPresentationConfigurationsItemProvider.java index ca81c697..023045ef 100644 --- a/org.eclipse.rmf.pror.reqif10.edit/src/org/eclipse/rmf/pror/reqif10/configuration/provider/ProrPresentationConfigurationsItemProvider.java +++ b/org.eclipse.rmf.pror.reqif10.edit/src/org/eclipse/rmf/pror/reqif10/configuration/provider/ProrPresentationConfigurationsItemProvider.java @@ -28,6 +28,7 @@ import org.eclipse.emf.edit.provider.ITreeItemContentProvider; import org.eclipse.emf.edit.provider.ItemProviderAdapter;
import org.eclipse.emf.edit.provider.ViewerNotification;
import org.eclipse.rmf.pror.reqif10.configuration.ConfigurationPackage;
+import org.eclipse.rmf.pror.reqif10.configuration.ProrPresentationConfiguration;
import org.eclipse.rmf.pror.reqif10.configuration.ProrPresentationConfigurations;
import org.eclipse.rmf.pror.reqif10.provider.Reqif10EditPlugin;
@@ -121,8 +122,9 @@ public class ProrPresentationConfigurationsItemProvider * This handles model notifications by calling {@link #updateChildren} to update any cached
* children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
* <!-- begin-user-doc -->
+ * Handles calls to PresentationServiceManager
* <!-- end-user-doc -->
- * @generated
+ * @generated NOT
*/
@Override
public void notifyChanged(Notification notification) {
@@ -131,11 +133,26 @@ public class ProrPresentationConfigurationsItemProvider switch (notification.getFeatureID(ProrPresentationConfigurations.class)) {
case ConfigurationPackage.PROR_PRESENTATION_CONFIGURATIONS__PRESENTATION_CONFIGURATIONS:
fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
+ handlePresentationRegistration(notification);
return;
}
super.notifyChanged(notification);
}
+ private void handlePresentationRegistration(Notification notification) {
+ if (notification.getEventType() == Notification.ADD) {
+ ProrPresentationConfiguration config = (ProrPresentationConfiguration) notification
+ .getNewValue();
+ System.out.println("Registering: " + config);
+ config.registerReqIF();
+ } else if (notification.getEventType() == Notification.REMOVE) {
+ ProrPresentationConfiguration config = (ProrPresentationConfiguration) notification
+ .getOldValue();
+ System.out.println("Unregistering: " + config);
+ config.unregisterReqIF();
+ }
+ }
+
/**
* This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
* that can be created under this object.
diff --git a/org.eclipse.rmf.pror.reqif10.edit/src/org/eclipse/rmf/pror/reqif10/edit/presentation/service/PresentationEditService.java b/org.eclipse.rmf.pror.reqif10.edit/src/org/eclipse/rmf/pror/reqif10/edit/presentation/service/PresentationEditInterface.java index a41a2842..bdf7a9ce 100644 --- a/org.eclipse.rmf.pror.reqif10.edit/src/org/eclipse/rmf/pror/reqif10/edit/presentation/service/PresentationEditService.java +++ b/org.eclipse.rmf.pror.reqif10.edit/src/org/eclipse/rmf/pror/reqif10/edit/presentation/service/PresentationEditInterface.java @@ -7,7 +7,7 @@ import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.rmf.reqif10.AttributeValue;
import org.eclipse.rmf.reqif10.SpecHierarchy;
-public interface PresentationEditService {
+public interface PresentationEditInterface {
/**
* Will be called when the system can't handle a drag and drop operation by
diff --git a/org.eclipse.rmf.pror.reqif10.edit/src/org/eclipse/rmf/pror/reqif10/edit/presentation/service/PresentationEditManager.java b/org.eclipse.rmf.pror.reqif10.edit/src/org/eclipse/rmf/pror/reqif10/edit/presentation/service/PresentationEditManager.java index 49815d2c..c7e7fcbd 100644 --- a/org.eclipse.rmf.pror.reqif10.edit/src/org/eclipse/rmf/pror/reqif10/edit/presentation/service/PresentationEditManager.java +++ b/org.eclipse.rmf.pror.reqif10.edit/src/org/eclipse/rmf/pror/reqif10/edit/presentation/service/PresentationEditManager.java @@ -11,7 +11,7 @@ import org.eclipse.rmf.reqif10.common.util.ReqIF10Util; public class PresentationEditManager {
- private static Map<Class<? extends ProrPresentationConfiguration>, PresentationEditService> presentationEditServiceRegistry;
+ private static Map<Class<? extends ProrPresentationConfiguration>, PresentationEditInterface> presentationEditServiceRegistry;
/**
* Returns the cached {@link PresentationService} representing all installed
@@ -21,14 +21,13 @@ public class PresentationEditManager { *
* FIXME: the map may not yet be populated
*/
- public static Map<Class<? extends ProrPresentationConfiguration>, PresentationEditService> getPresentationEditServiceMap() {
+ public static Map<Class<? extends ProrPresentationConfiguration>, PresentationEditInterface> getPresentationEditServiceMap() {
if (presentationEditServiceRegistry == null)
- presentationEditServiceRegistry = new HashMap<Class<? extends ProrPresentationConfiguration>, PresentationEditService>();
+ presentationEditServiceRegistry = new HashMap<Class<? extends ProrPresentationConfiguration>, PresentationEditInterface>();
return presentationEditServiceRegistry;
}
/**
- *
* This method is meant for exclusive use by the PresentationEditorManager
* (editor plugin). Do not use otherwise!
*
@@ -37,11 +36,11 @@ public class PresentationEditManager { */
public static void addService(
Class<? extends ProrPresentationConfiguration> configurationInterface,
- PresentationEditService service) {
+ PresentationEditInterface service) {
getPresentationEditServiceMap().put(configurationInterface, service);
}
- public static PresentationEditService getPresentationEditService(
+ public static PresentationEditInterface getPresentationEditService(
ProrPresentationConfiguration configuration) {
for (Class<? extends ProrPresentationConfiguration> clazz : getPresentationEditServiceMap()
.keySet()) {
@@ -58,7 +57,7 @@ public class PresentationEditManager { ProrPresentationConfiguration presentationConfiguration = ConfigurationUtil
.getConfiguration(dd);
if (presentationConfiguration != null) {
- PresentationEditService service = PresentationEditManager
+ PresentationEditInterface service = PresentationEditManager
.getPresentationEditService(presentationConfiguration);
if (service != null) {
String customLabel = service.getLabel(value);
diff --git a/org.eclipse.rmf.pror.reqif10.edit/src/org/eclipse/rmf/pror/reqif10/util/ProrUtil.java b/org.eclipse.rmf.pror.reqif10.edit/src/org/eclipse/rmf/pror/reqif10/util/ProrUtil.java index 73555237..7801ca46 100644 --- a/org.eclipse.rmf.pror.reqif10.edit/src/org/eclipse/rmf/pror/reqif10/util/ProrUtil.java +++ b/org.eclipse.rmf.pror.reqif10.edit/src/org/eclipse/rmf/pror/reqif10/util/ProrUtil.java @@ -43,7 +43,7 @@ import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; import org.eclipse.emf.edit.provider.ItemPropertyDescriptorDecorator;
import org.eclipse.emf.edit.provider.ItemProviderAdapter;
import org.eclipse.rmf.pror.reqif10.edit.presentation.service.PresentationEditManager;
-import org.eclipse.rmf.pror.reqif10.edit.presentation.service.PresentationEditService;
+import org.eclipse.rmf.pror.reqif10.edit.presentation.service.PresentationEditInterface;
import org.eclipse.rmf.pror.reqif10.provider.SpecElementWithAttributesItemProvider;
import org.eclipse.rmf.reqif10.AttributeDefinition;
import org.eclipse.rmf.reqif10.AttributeDefinitionBoolean;
@@ -386,9 +386,9 @@ public final class ProrUtil { EditingDomain domain, Object owner, float location, int operations,
int operation, java.util.Collection<?> collection) {
// See whether a Presentation feels responsible.
- Collection<PresentationEditService> services = PresentationEditManager
+ Collection<PresentationEditInterface> services = PresentationEditManager
.getPresentationEditServiceMap().values();
- for (PresentationEditService service : services) {
+ for (PresentationEditInterface service : services) {
Command cmd = service.handleDragAndDrop(collection, owner, domain,
operation);
if (cmd != null) {
diff --git a/org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/actions/PresentationConfigurationActionDelegate.java b/org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/actions/PresentationConfigurationActionDelegate.java index 84cbd678..21c2d0ca 100644 --- a/org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/actions/PresentationConfigurationActionDelegate.java +++ b/org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/actions/PresentationConfigurationActionDelegate.java @@ -27,7 +27,7 @@ import org.eclipse.rmf.pror.reqif10.configuration.ProrToolExtension; import org.eclipse.rmf.pror.reqif10.editor.presentation.Reqif10Editor;
import org.eclipse.rmf.pror.reqif10.editor.presentation.SpecificationEditor;
import org.eclipse.rmf.pror.reqif10.editor.presentation.service.PresentationServiceManager;
-import org.eclipse.rmf.pror.reqif10.editor.presentation.service.PresentationService;
+import org.eclipse.rmf.pror.reqif10.editor.presentation.service.PresentationInterface;
import org.eclipse.rmf.pror.reqif10.util.ConfigurationUtil;
import org.eclipse.rmf.pror.reqif10.util.ProrUtil;
import org.eclipse.rmf.reqif10.ReqIFToolExtension;
@@ -68,7 +68,7 @@ public class PresentationConfigurationActionDelegate implements private IAction[] buildAddPresentationActions() {
Set<Class<? extends ProrPresentationConfiguration>> configs = PresentationServiceManager
- .getPresentationServiceMap().keySet();
+ .getPresentationInterfaceMap().keySet();
IAction[] actions = new IAction[configs.size()];
int i = 0;
@@ -77,8 +77,8 @@ public class PresentationConfigurationActionDelegate implements actions[i++] = new Action(ProrUtil.substractPrefixPostfix(config, "","ConfigurationImpl")) {
@Override
public void run() {
- PresentationService service = PresentationServiceManager
- .getPresentationServiceMap().get(config);
+ PresentationInterface service = PresentationServiceManager
+ .getPresentationInterfaceMap().get(config);
ProrPresentationConfiguration config = service
.getConfigurationInstance();
Command command = AddCommand
diff --git a/org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/agilegrid/ProrCellEditorProvider.java b/org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/agilegrid/ProrCellEditorProvider.java index 8793c7c1..ee23e524 100644 --- a/org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/agilegrid/ProrCellEditorProvider.java +++ b/org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/agilegrid/ProrCellEditorProvider.java @@ -15,7 +15,7 @@ import org.agilemore.agilegrid.CellEditor; import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.rmf.pror.reqif10.editor.presentation.service.PresentationServiceManager;
-import org.eclipse.rmf.pror.reqif10.editor.presentation.service.PresentationService;
+import org.eclipse.rmf.pror.reqif10.editor.presentation.service.PresentationInterface;
import org.eclipse.rmf.reqif10.AttributeValue;
import org.eclipse.rmf.reqif10.Identifiable;
@@ -52,7 +52,7 @@ public class ProrCellEditorProvider extends AbstractProrCellEditorProvider { cellEditor = getDefaultCellEditor(attrValue, getAffectedElement(row, col));
- PresentationService service = PresentationServiceManager
+ PresentationInterface service = PresentationServiceManager
.getPresentationService(attrValue, editingDomain);
if (service != null) {
CellEditor serviceCellEditor = service.getCellEditor(agileGrid,editingDomain, attrValue, getAffectedElement(row, col));
@@ -72,7 +72,7 @@ public class ProrCellEditorProvider extends AbstractProrCellEditorProvider { if (attrValue == null) {
return false;
}
- PresentationService service = PresentationServiceManager
+ PresentationInterface service = PresentationServiceManager
.getPresentationService(attrValue, editingDomain);
return service == null ? true : service.canEdit();
}
diff --git a/org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/agilegrid/ProrCellRenderer.java b/org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/agilegrid/ProrCellRenderer.java index 099f07c3..3480f389 100644 --- a/org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/agilegrid/ProrCellRenderer.java +++ b/org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/agilegrid/ProrCellRenderer.java @@ -16,7 +16,7 @@ import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry;
import org.eclipse.rmf.pror.reqif10.editor.agilegrid.ProrAgileGridContentProvider.ProrRow;
import org.eclipse.rmf.pror.reqif10.editor.presentation.service.IProrCellRenderer;
-import org.eclipse.rmf.pror.reqif10.editor.presentation.service.PresentationService;
+import org.eclipse.rmf.pror.reqif10.editor.presentation.service.PresentationInterface;
import org.eclipse.rmf.pror.reqif10.editor.presentation.service.PresentationServiceManager;
import org.eclipse.rmf.pror.reqif10.provider.Reqif10EditPlugin;
import org.eclipse.rmf.reqif10.AttributeValue;
@@ -77,7 +77,7 @@ public class ProrCellRenderer extends AbstractProrCellRenderer { AttributeValue attrValue = contentProvider.getValueForColumn(
contentProvider.getProrRow(row).getSpecElement(), col);
- PresentationService service = PresentationServiceManager
+ PresentationInterface service = PresentationServiceManager
.getPresentationService(attrValue, editingDomain);
if (service != null)
renderer = service.getCellRenderer(attrValue);
diff --git a/org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/presentation/Reqif10Editor.java b/org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/presentation/Reqif10Editor.java index 55c8a891..9c671ac6 100644 --- a/org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/presentation/Reqif10Editor.java +++ b/org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/presentation/Reqif10Editor.java @@ -1129,7 +1129,8 @@ public class Reqif10Editor extends MultiPageEditorPart implements }
// TODO there must be a better place?
- PresentationServiceManager.notifiyOpenReqif(reqif, this);
+ PresentationServiceManager.notifiyOpenReqif(reqif, getAdapterFactory(),
+ getEditingDomain());
return reqif;
}
@@ -1797,7 +1798,8 @@ public class Reqif10Editor extends MultiPageEditorPart implements }
// TODO there must be a better place?
- PresentationServiceManager.notifiyCloseReqif(reqif, this);
+ PresentationServiceManager.notifiyCloseReqif(reqif,
+ getAdapterFactory(), getEditingDomain());
super.dispose();
diff --git a/org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/presentation/service/AbstractPresentationService.java b/org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/presentation/service/AbstractPresentationService.java index 7f07cc6b..421adfe2 100644 --- a/org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/presentation/service/AbstractPresentationService.java +++ b/org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/presentation/service/AbstractPresentationService.java @@ -30,7 +30,7 @@ import org.eclipse.rmf.reqif10.ReqIF; * @author jastram
*
*/
-public abstract class AbstractPresentationService extends AdapterImpl implements PresentationService {
+public abstract class AbstractPresentationService extends AdapterImpl implements PresentationInterface {
/**
* This map contains all open ReqIF models and their corresponding editing
diff --git a/org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/presentation/service/PresentationEditorService.java b/org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/presentation/service/PresentationEditorInterface.java index c6e333d6..13d2de78 100644 --- a/org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/presentation/service/PresentationEditorService.java +++ b/org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/presentation/service/PresentationEditorInterface.java @@ -9,12 +9,12 @@ import org.eclipse.rmf.reqif10.AttributeValue; import org.eclipse.rmf.reqif10.DatatypeDefinition;
/**
- * This interface encapsulates those aspects of a {@link PresentationService} that have
+ * This interface encapsulates those aspects of a {@link PresentationInterface} that have
* a GUI component.
*
* @author jastram
*/
-public interface PresentationEditorService {
+public interface PresentationEditorInterface {
/**
* Returns the {@link Class} for the subclass of
diff --git a/org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/presentation/service/PresentationService.java b/org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/presentation/service/PresentationInterface.java index 040bfa16..68586b26 100644 --- a/org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/presentation/service/PresentationService.java +++ b/org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/presentation/service/PresentationInterface.java @@ -13,7 +13,7 @@ package org.eclipse.rmf.pror.reqif10.editor.presentation.service; import java.util.Collection;
import org.eclipse.emf.edit.domain.EditingDomain;
-import org.eclipse.rmf.pror.reqif10.edit.presentation.service.PresentationEditService;
+import org.eclipse.rmf.pror.reqif10.edit.presentation.service.PresentationEditInterface;
import org.eclipse.rmf.reqif10.DatatypeDefinition;
import org.eclipse.rmf.reqif10.ReqIF;
@@ -52,14 +52,14 @@ import org.eclipse.rmf.reqif10.ReqIF; * </ul>
* <p>
*
- * Note that this interface simply aggregates {@link PresentationEditService}
- * and {@link PresentationEditorService}, which are separated as the reside in
+ * Note that this interface simply aggregates {@link PresentationEditInterface}
+ * and {@link PresentationEditorInterface}, which are separated as the reside in
* two different plugins (the former does not require andy GUI libraries, the
* later does).
*
* @author jastram
*
*/
-public interface PresentationService extends PresentationEditorService,
- PresentationEditService {
+public interface PresentationInterface extends PresentationEditorInterface,
+ PresentationEditInterface {
}
diff --git a/org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/presentation/service/PresentationServiceManager.java b/org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/presentation/service/PresentationServiceManager.java index 10eb822b..a0233c2f 100644 --- a/org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/presentation/service/PresentationServiceManager.java +++ b/org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/presentation/service/PresentationServiceManager.java @@ -20,15 +20,14 @@ import org.eclipse.core.runtime.IExtension; import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.Platform;
+import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.rmf.pror.reqif10.configuration.ProrPresentationConfiguration;
import org.eclipse.rmf.pror.reqif10.configuration.ProrPresentationConfigurations;
import org.eclipse.rmf.pror.reqif10.configuration.provider.ProrPresentationConfigurationItemProvider;
import org.eclipse.rmf.pror.reqif10.edit.presentation.service.PresentationEditManager;
-import org.eclipse.rmf.pror.reqif10.editor.presentation.Reqif10Editor;
import org.eclipse.rmf.pror.reqif10.util.ConfigurationUtil;
-import org.eclipse.rmf.pror.reqif10.util.ProrUtil;
import org.eclipse.rmf.reqif10.AttributeValue;
import org.eclipse.rmf.reqif10.ReqIF;
@@ -41,7 +40,7 @@ public class PresentationServiceManager { public static final String PRESENTATION_EXTENSION_POINT_NAME = "org.eclipse.rmf.pror.reqif10.editor.presentation";
- private static Map<Class<? extends ProrPresentationConfiguration>, PresentationService> presentationServiceRegistry;
+ private static Map<Class<? extends ProrPresentationConfiguration>, PresentationInterface> presentationServiceRegistry;
/*
* Private default constructor, to ensure that this class is never
@@ -56,19 +55,19 @@ public class PresentationServiceManager { // private static Set<PresentationData> presentationTypeRegistry;
/**
- * Returns the cached {@link PresentationService} representing all installed
+ * Returns the cached {@link PresentationInterface} representing all installed
* Presentation Extensions.
*
* We use this method to initialize the presentation service map in the item
* provider plugin.
*
* @return A an unmodifyable map of {@link ProrPresentationConfiguration}
- * classes and {@link PresentationService}s.
+ * classes and {@link PresentationInterface}s.
*/
- public static Map<Class<? extends ProrPresentationConfiguration>, PresentationService> getPresentationServiceMap() {
+ public static Map<Class<? extends ProrPresentationConfiguration>, PresentationInterface> getPresentationInterfaceMap() {
if (presentationServiceRegistry == null) {
- HashMap<Class<? extends ProrPresentationConfiguration>, PresentationService> tmpRegistry = new HashMap<Class<? extends ProrPresentationConfiguration>, PresentationService>();
+ HashMap<Class<? extends ProrPresentationConfiguration>, PresentationInterface> tmpRegistry = new HashMap<Class<? extends ProrPresentationConfiguration>, PresentationInterface>();
IExtensionRegistry registry = Platform.getExtensionRegistry();
IExtensionPoint extensionPoint = registry
@@ -79,7 +78,7 @@ public class PresentationServiceManager { .getConfigurationElements();
for (IConfigurationElement configElement : configElements) {
try {
- PresentationService service = (PresentationService) configElement
+ PresentationInterface service = (PresentationInterface) configElement
.createExecutableExtension("service");
tmpRegistry.put(service.getConfigurationInterface(),
service);
@@ -104,15 +103,15 @@ public class PresentationServiceManager { }
/**
- * Returns the {@link PresentationService} for the given
+ * Returns the {@link PresentationInterface} for the given
* {@link ProrPresentationConfiguration} instance, or null if none found.
*/
- public static PresentationService getPresentationService(
+ public static PresentationInterface getPresentationService(
ProrPresentationConfiguration configuration) {
- for (Class<? extends ProrPresentationConfiguration> clazz : getPresentationServiceMap()
+ for (Class<? extends ProrPresentationConfiguration> clazz : getPresentationInterfaceMap()
.keySet()) {
if (clazz.isInstance(configuration)) {
- return getPresentationServiceMap().get(clazz);
+ return getPresentationInterfaceMap().get(clazz);
}
}
return null;
@@ -122,7 +121,8 @@ public class PresentationServiceManager { * Upon opening a ReqIF File, this method notifies each
* {@link ProrPresentationConfigurationItemProvider#registerReqIF(ReqIF, EditingDomain)}
*/
- public static void notifiyOpenReqif(ReqIF reqif, Reqif10Editor editor) {
+ public static void notifiyOpenReqif(ReqIF reqif,
+ AdapterFactory adapterFactory, EditingDomain editingDomain) {
ProrPresentationConfigurations configs = ConfigurationUtil
.getPresentationConfigurations(reqif);
@@ -131,9 +131,8 @@ public class PresentationServiceManager { for (ProrPresentationConfiguration config : configs
.getPresentationConfigurations()) {
- ProrPresentationConfigurationItemProvider itemProvider = (ProrPresentationConfigurationItemProvider) ProrUtil
- .getItemProvider(editor.getAdapterFactory(), config);
- itemProvider.registerReqIF(reqif, editor.getEditingDomain());
+ System.out.println("Registering: " + config);
+ config.registerReqIF();
}
}
@@ -141,7 +140,8 @@ public class PresentationServiceManager { * Upon closing a ReqIF File, this method notifies each
* {@link ProrPresentationConfigurationItemProvider#unregisterReqIF(ReqIF, EditingDomain)}
*/
- public static void notifiyCloseReqif(ReqIF reqif, Reqif10Editor editor) {
+ public static void notifiyCloseReqif(ReqIF reqif,
+ AdapterFactory adapterFactory, EditingDomain editingDomain) {
ProrPresentationConfigurations configs = ConfigurationUtil
.getPresentationConfigurations(reqif);
if (configs == null)
@@ -149,15 +149,14 @@ public class PresentationServiceManager { for (ProrPresentationConfiguration config : configs
.getPresentationConfigurations()) {
- ProrPresentationConfigurationItemProvider itemProvider = (ProrPresentationConfigurationItemProvider) ProrUtil
- .getItemProvider(editor.getAdapterFactory(), config);
- itemProvider.unregisterReqIF(reqif, editor.getEditingDomain());
+ System.out.println("Unregistering: " + config);
+ config.unregisterReqIF();
}
}
- public static PresentationService getPresentationService(
+ public static PresentationInterface getPresentationService(
AttributeValue value, EditingDomain editingDomain) {
- PresentationService service = null;
+ PresentationInterface service = null;
ProrPresentationConfiguration config = ConfigurationUtil
.getPresentationConfig(value);
if (config != null) {
diff --git a/org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/propertiesview/ProrPropertyCellEditorProvider.java b/org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/propertiesview/ProrPropertyCellEditorProvider.java index c0573524..0e122159 100644 --- a/org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/propertiesview/ProrPropertyCellEditorProvider.java +++ b/org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/propertiesview/ProrPropertyCellEditorProvider.java @@ -40,7 +40,7 @@ import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.window.Window;
import org.eclipse.rmf.pror.reqif10.configuration.ProrPresentationConfiguration;
import org.eclipse.rmf.pror.reqif10.editor.agilegrid.AbstractProrCellEditorProvider;
-import org.eclipse.rmf.pror.reqif10.editor.presentation.service.PresentationService;
+import org.eclipse.rmf.pror.reqif10.editor.presentation.service.PresentationInterface;
import org.eclipse.rmf.pror.reqif10.editor.presentation.service.PresentationServiceManager;
import org.eclipse.rmf.pror.reqif10.editor.propertiesview.ProrPropertyContentProvider.SortedItemPropertyDescriptor;
import org.eclipse.rmf.pror.reqif10.util.ConfigurationUtil;
@@ -82,7 +82,7 @@ public class ProrPropertyCellEditorProvider extends AbstractProrCellEditorProvid AttributeValue attrValue = getAttributeValue(row, col);
if (attrValue != null) {
- PresentationService service = PresentationServiceManager
+ PresentationInterface service = PresentationServiceManager
.getPresentationService(attrValue, editingDomain);
return service == null ? true : service.canEdit();
} else {
@@ -116,7 +116,7 @@ public class ProrPropertyCellEditorProvider extends AbstractProrCellEditorProvid ProrPresentationConfiguration config = ConfigurationUtil
.getPresentationConfig(attrValue);
if (config != null) {
- PresentationService service = PresentationServiceManager.getPresentationService(config);
+ PresentationInterface service = PresentationServiceManager.getPresentationService(config);
if (service != null)
cellEditor = service.getCellEditor(agileGrid,
editingDomain, attrValue, getAffectedElement(row, col));
diff --git a/org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/propertiesview/ProrPropertyCellRenderer.java b/org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/propertiesview/ProrPropertyCellRenderer.java index 288053a9..b5aa53ec 100644 --- a/org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/propertiesview/ProrPropertyCellRenderer.java +++ b/org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/propertiesview/ProrPropertyCellRenderer.java @@ -19,7 +19,7 @@ import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry; import org.eclipse.rmf.pror.reqif10.configuration.ProrPresentationConfiguration;
import org.eclipse.rmf.pror.reqif10.editor.agilegrid.AbstractProrCellRenderer;
import org.eclipse.rmf.pror.reqif10.editor.presentation.service.IProrCellRenderer;
-import org.eclipse.rmf.pror.reqif10.editor.presentation.service.PresentationService;
+import org.eclipse.rmf.pror.reqif10.editor.presentation.service.PresentationInterface;
import org.eclipse.rmf.pror.reqif10.editor.presentation.service.PresentationServiceManager;
import org.eclipse.rmf.pror.reqif10.util.ConfigurationUtil;
import org.eclipse.rmf.reqif10.AttributeValue;
@@ -59,7 +59,7 @@ public class ProrPropertyCellRenderer extends AbstractProrCellRenderer { ProrPresentationConfiguration config = ConfigurationUtil
.getPresentationConfig(atrVal);
if (config != null) {
- PresentationService service = PresentationServiceManager
+ PresentationInterface service = PresentationServiceManager
.getPresentationService(config);
if (service != null)
renderer = service.getCellRenderer(atrVal);
diff --git a/org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/util/ProrEditorUtil.java b/org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/util/ProrEditorUtil.java index a6488b1e..72ba39ea 100644 --- a/org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/util/ProrEditorUtil.java +++ b/org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/util/ProrEditorUtil.java @@ -21,7 +21,7 @@ import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.rmf.pror.reqif10.configuration.Column;
import org.eclipse.rmf.pror.reqif10.configuration.ProrPresentationConfiguration;
import org.eclipse.rmf.pror.reqif10.configuration.ProrSpecViewConfiguration;
-import org.eclipse.rmf.pror.reqif10.editor.presentation.service.PresentationService;
+import org.eclipse.rmf.pror.reqif10.editor.presentation.service.PresentationInterface;
import org.eclipse.rmf.pror.reqif10.editor.presentation.service.PresentationServiceManager;
import org.eclipse.rmf.pror.reqif10.util.ConfigurationUtil;
import org.eclipse.rmf.reqif10.AttributeValue;
@@ -82,7 +82,7 @@ public class ProrEditorUtil { private static void printRecursive(StringBuilder html,
ProrSpecViewConfiguration config, int indent,
EList<SpecHierarchy> children, EditingDomain domain,
- List<PresentationService> presentations) {
+ List<PresentationInterface> presentations) {
for (SpecHierarchy child : children) {
if (child.getObject() != null) {
SpecObject specObject = child.getObject();
@@ -105,10 +105,10 @@ public class ProrEditorUtil { if (configuration != null) {
- PresentationService service = null;
+ PresentationInterface service = null;
if (presentations != null) {
- for (PresentationService serv : presentations) {
+ for (PresentationInterface serv : presentations) {
if (serv.getConfigurationInterface()
.isInstance(configuration))
service = serv;
@@ -145,7 +145,7 @@ public class ProrEditorUtil { }
public static String createHtmlContent(Specification spec,
- EditingDomain domain, List<PresentationService> presentations) {
+ EditingDomain domain, List<PresentationInterface> presentations) {
ProrSpecViewConfiguration config = ConfigurationUtil
.getSpecViewConfiguration(spec, domain);
diff --git a/org.eclipse.rmf.pror.reqif10.genhtml/src/org/eclipse/rmf/pror/reqif10/genhtml/GenerateHtml.java b/org.eclipse.rmf.pror.reqif10.genhtml/src/org/eclipse/rmf/pror/reqif10/genhtml/GenerateHtml.java index ebc614a8..3c082744 100644 --- a/org.eclipse.rmf.pror.reqif10.genhtml/src/org/eclipse/rmf/pror/reqif10/genhtml/GenerateHtml.java +++ b/org.eclipse.rmf.pror.reqif10.genhtml/src/org/eclipse/rmf/pror/reqif10/genhtml/GenerateHtml.java @@ -33,7 +33,7 @@ import org.eclipse.rmf.pror.presentation.headline.util.HeadlineAdapterFactory; import org.eclipse.rmf.pror.presentation.linewrap.util.LinewrapAdapterFactory;
import org.eclipse.rmf.pror.presentation.ui.LinewrapPresentationService;
import org.eclipse.rmf.pror.reqif10.configuration.util.ConfigurationAdapterFactory;
-import org.eclipse.rmf.pror.reqif10.editor.presentation.service.PresentationService;
+import org.eclipse.rmf.pror.reqif10.editor.presentation.service.PresentationInterface;
import org.eclipse.rmf.pror.reqif10.editor.util.ProrEditorUtil;
import org.eclipse.rmf.pror.reqif10.presentation.id.util.IdAdapterFactory;
import org.eclipse.rmf.pror.reqif10.presentation.ui.IDPresentationService;
@@ -97,7 +97,7 @@ public class GenerateHtml { int mid = fileName.lastIndexOf(".");
String fname = fileName.substring(0, mid);
- List<PresentationService> presentations = new ArrayList<PresentationService>();
+ List<PresentationInterface> presentations = new ArrayList<PresentationInterface>();
presentations
.add(new LinewrapPresentationService());
presentations
diff --git a/org.eclipse.rmf.pror.reqif10.presentation.headline/src/org/eclipse/rmf/pror/presentation/headline/impl/HeadlineConfigurationImpl.java b/org.eclipse.rmf.pror.reqif10.presentation.headline/src/org/eclipse/rmf/pror/presentation/headline/impl/HeadlineConfigurationImpl.java index fb62e36d..26bd52cf 100644 --- a/org.eclipse.rmf.pror.reqif10.presentation.headline/src/org/eclipse/rmf/pror/presentation/headline/impl/HeadlineConfigurationImpl.java +++ b/org.eclipse.rmf.pror.reqif10.presentation.headline/src/org/eclipse/rmf/pror/presentation/headline/impl/HeadlineConfigurationImpl.java @@ -166,4 +166,16 @@ public class HeadlineConfigurationImpl extends ProrPresentationConfigurationImpl return result.toString();
}
+ /**
+ * Nothing to do upon opening
+ */
+ public void registerReqIF() {
+ }
+
+ /**
+ * Nothing to do upon closing
+ */
+ public void unregisterReqIF() {
+ }
+
} //HeadlineConfigurationImpl
diff --git a/org.eclipse.rmf.pror.reqif10.presentation.headline/src/org/eclipse/rmf/pror/presentation/headline/provider/HeadlineConfigurationItemProvider.java b/org.eclipse.rmf.pror.reqif10.presentation.headline/src/org/eclipse/rmf/pror/presentation/headline/provider/HeadlineConfigurationItemProvider.java index 841f24ef..a31a637f 100644 --- a/org.eclipse.rmf.pror.reqif10.presentation.headline/src/org/eclipse/rmf/pror/presentation/headline/provider/HeadlineConfigurationItemProvider.java +++ b/org.eclipse.rmf.pror.reqif10.presentation.headline/src/org/eclipse/rmf/pror/presentation/headline/provider/HeadlineConfigurationItemProvider.java @@ -18,7 +18,6 @@ import java.util.List; import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.util.ResourceLocator;
-import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
import org.eclipse.emf.edit.provider.IItemLabelProvider;
@@ -31,7 +30,6 @@ import org.eclipse.emf.edit.provider.ViewerNotification; import org.eclipse.rmf.pror.presentation.headline.HeadlineConfiguration;
import org.eclipse.rmf.pror.presentation.headline.HeadlinePackage;
import org.eclipse.rmf.pror.reqif10.configuration.provider.ProrPresentationConfigurationItemProvider;
-import org.eclipse.rmf.reqif10.ReqIF;
/**
* This is the item provider adapter for a {@link org.eclipse.rmf.pror.presentation.headline.HeadlineConfiguration} object.
@@ -164,18 +162,4 @@ public class HeadlineConfigurationItemProvider return HeadlineEditPlugin.INSTANCE;
}
- /**
- * Nothing to do upon opening
- */
- @Override
- public void registerReqIF(ReqIF reqif, EditingDomain domain) {
- }
-
- @Override
- public void unregisterReqIF(ReqIF reqif, EditingDomain domain) {
- /**
- * Nothing to do upon closing
- */
- }
-
}
diff --git a/org.eclipse.rmf.pror.reqif10.presentation.headline/src/org/eclipse/rmf/pror/presentation/headline/ui/HeadlinePresentationService.java b/org.eclipse.rmf.pror.reqif10.presentation.headline/src/org/eclipse/rmf/pror/presentation/headline/ui/HeadlinePresentationService.java index 516aab91..60fb43a6 100644 --- a/org.eclipse.rmf.pror.reqif10.presentation.headline/src/org/eclipse/rmf/pror/presentation/headline/ui/HeadlinePresentationService.java +++ b/org.eclipse.rmf.pror.reqif10.presentation.headline/src/org/eclipse/rmf/pror/presentation/headline/ui/HeadlinePresentationService.java @@ -25,7 +25,7 @@ import org.eclipse.rmf.pror.presentation.headline.HeadlinePackage; import org.eclipse.rmf.pror.reqif10.configuration.ProrPresentationConfiguration;
import org.eclipse.rmf.pror.reqif10.editor.presentation.service.AbstractPresentationService;
import org.eclipse.rmf.pror.reqif10.editor.presentation.service.IProrCellRenderer;
-import org.eclipse.rmf.pror.reqif10.editor.presentation.service.PresentationService;
+import org.eclipse.rmf.pror.reqif10.editor.presentation.service.PresentationInterface;
import org.eclipse.rmf.pror.reqif10.util.ConfigurationUtil;
import org.eclipse.rmf.reqif10.AttributeValue;
import org.eclipse.rmf.reqif10.DatatypeDefinition;
@@ -35,7 +35,7 @@ import org.eclipse.rmf.reqif10.common.util.ReqIF10Util; import org.eclipse.rmf.reqif10.util.ReqIF10Switch;
public class HeadlinePresentationService extends AbstractPresentationService
- implements PresentationService {
+ implements PresentationInterface {
private HeadlineCellRenderer headlineCellRenderer;
diff --git a/org.eclipse.rmf.pror.reqif10.presentation.id/src/org/eclipse/rmf/pror/reqif10/presentation/id/impl/IdConfigurationImpl.java b/org.eclipse.rmf.pror.reqif10.presentation.id/src/org/eclipse/rmf/pror/reqif10/presentation/id/impl/IdConfigurationImpl.java index 2534bb28..6f7d5ee5 100644 --- a/org.eclipse.rmf.pror.reqif10.presentation.id/src/org/eclipse/rmf/pror/reqif10/presentation/id/impl/IdConfigurationImpl.java +++ b/org.eclipse.rmf.pror.reqif10.presentation.id/src/org/eclipse/rmf/pror/reqif10/presentation/id/impl/IdConfigurationImpl.java @@ -276,4 +276,10 @@ public class IdConfigurationImpl extends ProrPresentationConfigurationImpl imple return result.toString();
}
+ public void registerReqIF() {
+ }
+
+ public void unregisterReqIF() {
+ }
+
} //IdConfigurationImpl
diff --git a/org.eclipse.rmf.pror.reqif10.presentation.id/src/org/eclipse/rmf/pror/reqif10/presentation/id/provider/IdConfigurationItemProvider.java b/org.eclipse.rmf.pror.reqif10.presentation.id/src/org/eclipse/rmf/pror/reqif10/presentation/id/provider/IdConfigurationItemProvider.java index e0cad535..2b884820 100644 --- a/org.eclipse.rmf.pror.reqif10.presentation.id/src/org/eclipse/rmf/pror/reqif10/presentation/id/provider/IdConfigurationItemProvider.java +++ b/org.eclipse.rmf.pror.reqif10.presentation.id/src/org/eclipse/rmf/pror/reqif10/presentation/id/provider/IdConfigurationItemProvider.java @@ -19,7 +19,6 @@ import java.util.List; import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.util.ResourceLocator;
-import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
import org.eclipse.emf.edit.provider.IItemLabelProvider;
@@ -32,7 +31,6 @@ import org.eclipse.emf.edit.provider.ViewerNotification; import org.eclipse.rmf.pror.reqif10.configuration.provider.ProrPresentationConfigurationItemProvider;
import org.eclipse.rmf.pror.reqif10.presentation.id.IdConfiguration;
import org.eclipse.rmf.pror.reqif10.presentation.id.IdPackage;
-import org.eclipse.rmf.reqif10.ReqIF;
/**
* This is the item provider adapter for a {@link org.eclipse.rmf.pror.reqif10.presentation.id.IdConfiguration} object.
@@ -213,18 +211,4 @@ public class IdConfigurationItemProvider return IDEditPlugin.INSTANCE;
}
- /**
- * TODO register to set IDs
- */
- @Override
- public void registerReqIF(ReqIF reqif, EditingDomain domain) {
- }
-
- /**
- * TODO unregister to set IDs
- */
- @Override
- public void unregisterReqIF(ReqIF reqif, EditingDomain domain) {
- }
-
}
diff --git a/org.eclipse.rmf.pror.reqif10.presentation.id/src/org/eclipse/rmf/pror/reqif10/presentation/ui/IDPresentationService.java b/org.eclipse.rmf.pror.reqif10.presentation.id/src/org/eclipse/rmf/pror/reqif10/presentation/ui/IDPresentationService.java index 68b6985d..8685be79 100644 --- a/org.eclipse.rmf.pror.reqif10.presentation.id/src/org/eclipse/rmf/pror/reqif10/presentation/ui/IDPresentationService.java +++ b/org.eclipse.rmf.pror.reqif10.presentation.id/src/org/eclipse/rmf/pror/reqif10/presentation/ui/IDPresentationService.java @@ -27,7 +27,7 @@ import org.eclipse.rmf.pror.reqif10.configuration.ProrPresentationConfigurations import org.eclipse.rmf.pror.reqif10.configuration.ProrToolExtension;
import org.eclipse.rmf.pror.reqif10.editor.presentation.service.AbstractPresentationService;
import org.eclipse.rmf.pror.reqif10.editor.presentation.service.IProrCellRenderer;
-import org.eclipse.rmf.pror.reqif10.editor.presentation.service.PresentationService;
+import org.eclipse.rmf.pror.reqif10.editor.presentation.service.PresentationInterface;
import org.eclipse.rmf.pror.reqif10.presentation.id.IdConfiguration;
import org.eclipse.rmf.pror.reqif10.presentation.id.IdFactory;
import org.eclipse.rmf.pror.reqif10.util.ConfigurationUtil;
@@ -37,7 +37,7 @@ import org.eclipse.rmf.reqif10.ReqIF; import org.eclipse.rmf.reqif10.common.util.ReqIF10Util;
public class IDPresentationService extends AbstractPresentationService
- implements PresentationService {
+ implements PresentationInterface {
private final IProrCellRenderer idLabelCellRenderer;
private final HashMap<IdConfiguration, EContentAdapter> adapters = new HashMap<IdConfiguration, EContentAdapter>();
diff --git a/org.eclipse.rmf.pror.reqif10.presentation.linewrap/src/org/eclipse/rmf/pror/presentation/linewrap/impl/LinewrapConfigurationImpl.java b/org.eclipse.rmf.pror.reqif10.presentation.linewrap/src/org/eclipse/rmf/pror/presentation/linewrap/impl/LinewrapConfigurationImpl.java index b7531d70..7d141fad 100644 --- a/org.eclipse.rmf.pror.reqif10.presentation.linewrap/src/org/eclipse/rmf/pror/presentation/linewrap/impl/LinewrapConfigurationImpl.java +++ b/org.eclipse.rmf.pror.reqif10.presentation.linewrap/src/org/eclipse/rmf/pror/presentation/linewrap/impl/LinewrapConfigurationImpl.java @@ -45,4 +45,10 @@ public class LinewrapConfigurationImpl extends ProrPresentationConfigurationImpl return LinewrapPackage.Literals.LINEWRAP_CONFIGURATION;
}
+ public void registerReqIF() {
+ }
+
+ public void unregisterReqIF() {
+ }
+
} //LinewrapConfigurationImpl
diff --git a/org.eclipse.rmf.pror.reqif10.presentation.linewrap/src/org/eclipse/rmf/pror/presentation/linewrap/provider/LinewrapConfigurationItemProvider.java b/org.eclipse.rmf.pror.reqif10.presentation.linewrap/src/org/eclipse/rmf/pror/presentation/linewrap/provider/LinewrapConfigurationItemProvider.java index cacc89a1..dc787330 100644 --- a/org.eclipse.rmf.pror.reqif10.presentation.linewrap/src/org/eclipse/rmf/pror/presentation/linewrap/provider/LinewrapConfigurationItemProvider.java +++ b/org.eclipse.rmf.pror.reqif10.presentation.linewrap/src/org/eclipse/rmf/pror/presentation/linewrap/provider/LinewrapConfigurationItemProvider.java @@ -18,7 +18,6 @@ import java.util.List; import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.util.ResourceLocator;
-import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
import org.eclipse.emf.edit.provider.IItemLabelProvider;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
@@ -29,7 +28,6 @@ import org.eclipse.rmf.pror.presentation.LinewrapEditPlugin; import org.eclipse.rmf.pror.presentation.linewrap.LinewrapConfiguration;
import org.eclipse.rmf.pror.reqif10.configuration.provider.ProrPresentationConfigurationItemProvider;
import org.eclipse.rmf.reqif10.DatatypeDefinitionSimple;
-import org.eclipse.rmf.reqif10.ReqIF;
/**
* This is the item provider adapter for a {@link org.eclipse.rmf.pror.presentation.linewrap.LinewrapConfiguration} object.
@@ -136,18 +134,4 @@ public class LinewrapConfigurationItemProvider return LinewrapEditPlugin.INSTANCE;
}
- /**
- * TODO register to set IDs
- */
- @Override
- public void registerReqIF(ReqIF reqif, EditingDomain domain) {
- }
-
- /**
- * TODO unregister to set IDs
- */
- @Override
- public void unregisterReqIF(ReqIF reqif, EditingDomain domain) {
- }
-
}
diff --git a/org.eclipse.rmf.pror.reqif10.presentation.linewrap/src/org/eclipse/rmf/pror/presentation/ui/LinewrapPresentationService.java b/org.eclipse.rmf.pror.reqif10.presentation.linewrap/src/org/eclipse/rmf/pror/presentation/ui/LinewrapPresentationService.java index 950a1929..cc328dce 100644 --- a/org.eclipse.rmf.pror.reqif10.presentation.linewrap/src/org/eclipse/rmf/pror/presentation/ui/LinewrapPresentationService.java +++ b/org.eclipse.rmf.pror.reqif10.presentation.linewrap/src/org/eclipse/rmf/pror/presentation/ui/LinewrapPresentationService.java @@ -17,7 +17,7 @@ import org.eclipse.rmf.pror.presentation.linewrap.LinewrapFactory; import org.eclipse.rmf.pror.reqif10.configuration.ProrPresentationConfiguration;
import org.eclipse.rmf.pror.reqif10.editor.presentation.service.AbstractPresentationService;
import org.eclipse.rmf.pror.reqif10.editor.presentation.service.IProrCellRenderer;
-import org.eclipse.rmf.pror.reqif10.editor.presentation.service.PresentationService;
+import org.eclipse.rmf.pror.reqif10.editor.presentation.service.PresentationInterface;
import org.eclipse.rmf.reqif10.AttributeValue;
import org.eclipse.rmf.reqif10.DatatypeDefinitionString;
import org.eclipse.rmf.reqif10.common.util.ReqIF10Util;
@@ -29,7 +29,7 @@ import org.eclipse.rmf.reqif10.common.util.ReqIF10Util; * @author jastram
*
*/
-public class LinewrapPresentationService extends AbstractPresentationService implements PresentationService {
+public class LinewrapPresentationService extends AbstractPresentationService implements PresentationInterface {
private final LinewrapCellRenderer linewrapCellRenderer;
diff --git a/org.eclipse.rmf.pror.reqif10.tests/tests/org/eclipse/rmf/pror/reqif10/editor/presentation/service/PresentationServiceManagerTest.java b/org.eclipse.rmf.pror.reqif10.tests/tests/org/eclipse/rmf/pror/reqif10/editor/presentation/service/PresentationServiceManagerTest.java index b881873e..8990fa43 100644 --- a/org.eclipse.rmf.pror.reqif10.tests/tests/org/eclipse/rmf/pror/reqif10/editor/presentation/service/PresentationServiceManagerTest.java +++ b/org.eclipse.rmf.pror.reqif10.tests/tests/org/eclipse/rmf/pror/reqif10/editor/presentation/service/PresentationServiceManagerTest.java @@ -24,21 +24,21 @@ public class PresentationServiceManagerTest { */ @Test public void testGetPresentationServiceMapContent() { - Map<Class<? extends ProrPresentationConfiguration>, PresentationService> map = PresentationServiceManager - .getPresentationServiceMap(); + Map<Class<? extends ProrPresentationConfiguration>, PresentationInterface> map = PresentationServiceManager + .getPresentationInterfaceMap(); Assert.assertEquals(3, map.size()); } @Test(expected = UnsupportedOperationException.class) public void testPresentationMapNotModifyable() { - PresentationServiceManager.getPresentationServiceMap().clear(); + PresentationServiceManager.getPresentationInterfaceMap().clear(); } @Test public void testHeadlinePresentationService() { HeadlineConfiguration config = HeadlineFactory.eINSTANCE .createHeadlineConfiguration(); - PresentationService service = PresentationServiceManager + PresentationInterface service = PresentationServiceManager .getPresentationService(config); Assert.assertTrue(service instanceof HeadlinePresentationService); } @@ -46,7 +46,7 @@ public class PresentationServiceManagerTest { @Test public void testIdPresentationService() { IdConfiguration config = IdFactory.eINSTANCE.createIdConfiguration(); - PresentationService service = PresentationServiceManager + PresentationInterface service = PresentationServiceManager .getPresentationService(config); Assert.assertTrue(service instanceof IDPresentationService); } @@ -55,7 +55,7 @@ public class PresentationServiceManagerTest { public void testLinewrapPresentationService() { LinewrapConfiguration config = LinewrapFactory.eINSTANCE .createLinewrapConfiguration(); - PresentationService service = PresentationServiceManager + PresentationInterface service = PresentationServiceManager .getPresentationService(config); Assert.assertTrue(service instanceof LinewrapPresentationService); } @@ -65,7 +65,7 @@ public class PresentationServiceManagerTest { ProrPresentationConfiguration config = new ProrPresentationConfigurationImpl() { }; - PresentationService service = PresentationServiceManager + PresentationInterface service = PresentationServiceManager .getPresentationService(config); Assert.assertNull(service); } diff --git a/org.eclipse.rmf.pror.reqif10/src/org/eclipse/rmf/pror/reqif10/configuration/ProrPresentationConfiguration.java b/org.eclipse.rmf.pror.reqif10/src/org/eclipse/rmf/pror/reqif10/configuration/ProrPresentationConfiguration.java index ea85d436..fe7267de 100644 --- a/org.eclipse.rmf.pror.reqif10/src/org/eclipse/rmf/pror/reqif10/configuration/ProrPresentationConfiguration.java +++ b/org.eclipse.rmf.pror.reqif10/src/org/eclipse/rmf/pror/reqif10/configuration/ProrPresentationConfiguration.java @@ -13,6 +13,7 @@ package org.eclipse.rmf.pror.reqif10.configuration; import org.eclipse.emf.ecore.EObject;
import org.eclipse.rmf.reqif10.DatatypeDefinition;
+import org.eclipse.rmf.reqif10.ReqIF;
/**
* <!-- begin-user-doc -->
@@ -57,4 +58,20 @@ public interface ProrPresentationConfiguration extends EObject { */
void setDatatype(DatatypeDefinition value);
+ /**
+ * This method is triggered when a this configuration element is added to a
+ * {@link ReqIF} model, either because it is created and added, or because
+ * the {@link ReqIF} was opened. This gives the Presentation a chance to
+ * interact, e.g. by registering adapters, etc.
+ */
+ public abstract void registerReqIF();
+
+ /**
+ * This method is triggered when a this configuration element is removed
+ * from a {@link ReqIF} model, either because it is got removed, or because
+ * the {@link ReqIF} was closed. This gives the Presentation a chance to
+ * interact, e.g. by unregistering adapters, etc.
+ */
+ public abstract void unregisterReqIF();
+
} // ProrPresentationConfiguration
|