Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Noyrit2016-08-09 10:25:50 +0000
committerGerrit Code Review @ Eclipse.org2016-08-28 15:46:41 +0000
commit7310db0b3b2e8ee805fedf4bfd16baf438c89332 (patch)
tree3dadff6a067e8d8bcbf837d8277dfac7749aef27 /plugins/infra/core
parent7851474fe5f33de156c797942945a3e9c97cb0a8 (diff)
downloadorg.eclipse.papyrus-7310db0b3b2e8ee805fedf4bfd16baf438c89332.tar.gz
org.eclipse.papyrus-7310db0b3b2e8ee805fedf4bfd16baf438c89332.tar.xz
org.eclipse.papyrus-7310db0b3b2e8ee805fedf4bfd16baf438c89332.zip
Bug 443799 - Fix potential bugs identified by FindBugs in oep.infra.*
Bug 499554 - Oxygen release version number moved to 3.0.0. Change-Id: I8e112db7175a5b89eb9b37973639627a6c29e007
Diffstat (limited to 'plugins/infra/core')
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/SashWindowsContainer.java134
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/eclipsecopy/MultiPageEditorSite.java1
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/internal/language/DefaultLanguageProvider.java15
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/modelsetquery/impl/ModelSetQueryAdapterSizeMatters.java31
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/modelsetquery/impl/ModelSetQueryAdapterTimeMatters.java10
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/ModelSet.java21
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/sasheditor/SashModel.java11
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/services/internal/ErrorServiceTypeEntry.java212
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.tools/.settings/.api_filters35
9 files changed, 217 insertions, 253 deletions
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/SashWindowsContainer.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/SashWindowsContainer.java
index 5290f34e95a..90156f0fa21 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/SashWindowsContainer.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/SashWindowsContainer.java
@@ -918,90 +918,90 @@ public class SashWindowsContainer implements ISashWindowsContainer {
*/
@Override
public IDropTarget drag(Control currentControl, Object draggedObject, Point position, Rectangle dragRectangle) {
- // TODO remove the cast by changing the method. Only folder can be source and target
- final TabFolderPart sourcePart = (TabFolderPart) rootPart.findPart(draggedObject); // (ITilePart) draggedObject;
- // Compute src tab index
- // TODO move that and previous in the sender of drag event. Use a class containing both as draggedObject.
- final int srcTabIndex = PTabFolder.getDraggedObjectTabIndex(draggedObject);
+ if (rootPart != null) {
+ // TODO remove the cast by changing the method. Only folder can be source and target
+ final TabFolderPart sourcePart = (TabFolderPart) rootPart.findPart(draggedObject); // (ITilePart) draggedObject;
+ // Compute src tab index
+ // TODO move that and previous in the sender of drag event. Use a class containing both as draggedObject.
+ final int srcTabIndex = PTabFolder.getDraggedObjectTabIndex(draggedObject);
- // System.out.println("drag to position=" + position);
- Rectangle containerDisplayBounds = DragUtil.getDisplayBounds(container);
- AbstractPanelPart targetPart = null;
+ // System.out.println("drag to position=" + position);
+ Rectangle containerDisplayBounds = DragUtil.getDisplayBounds(container);
+ AbstractPanelPart targetPart = null;
- // Check if the cursor is inside the container
- if (containerDisplayBounds.contains(position)) {
+ // Check if the cursor is inside the container
+ if (containerDisplayBounds.contains(position)) {
- if (rootPart != null) {
targetPart = (AbstractPanelPart) rootPart.findPart(position);
// System.out.println("targetPart=" + targetPart
// + ", position=" + position
// + "container.toControl(position)=" + container.toControl(position));
- }
-
- if (targetPart != null) {
- final Control targetControl = targetPart.getControl();
-
- final Rectangle targetBounds = DragUtil.getDisplayBounds(targetControl);
- int side = Geometry.getClosestSide(targetBounds, position);
- int distance = Geometry.getDistanceFromEdge(targetBounds, position, side);
-
- // Reserve the 5 pixels around the edge of the part for the drop-on-edge cursor
- // Check if the target can handle the drop.
- if (distance >= 5) {
- // Otherwise, ask the part if it has any special meaning for this drop location
- // TODO remove cast; change return type of findPart()
- IDropTarget target = targetPart.getDropTarget(draggedObject, sourcePart, position);
- if (target != null) {
- return target;
+ if (targetPart != null) {
+ final Control targetControl = targetPart.getControl();
+
+ final Rectangle targetBounds = DragUtil.getDisplayBounds(targetControl);
+
+ int side = Geometry.getClosestSide(targetBounds, position);
+ int distance = Geometry.getDistanceFromEdge(targetBounds, position, side);
+
+ // Reserve the 5 pixels around the edge of the part for the drop-on-edge cursor
+ // Check if the target can handle the drop.
+ if (distance >= 5) {
+ // Otherwise, ask the part if it has any special meaning for this drop location
+ // TODO remove cast; change return type of findPart()
+ IDropTarget target = targetPart.getDropTarget(draggedObject, sourcePart, position);
+ if (target != null) {
+ return target;
+ }
+ } else {
+ // We are on the boarder, try to drop on the parent
+ // Warning : the parent could be the rootPart
+ // System.out.println("DropTarget near the border");
+ }
+ //
+ if (distance > 30) {
+ side = SWT.CENTER;
+ }
+ //
+ // // If the part doesn't want to override this drop location then drop on the edge
+ //
+ // // A "pointless drop" would be one that will put the dragged object back where it started.
+ // // Note that it should be perfectly valid to drag an object back to where it came from -- however,
+ // // the drop should be ignored.
+ //
+ @SuppressWarnings("unused")
+ boolean pointlessDrop = false;
+
+ if (sourcePart == targetPart) {
+ pointlessDrop = true;
}
- } else {
- // We are on the boarder, try to drop on the parent
- // Warning : the parent could be the rootPart
- // System.out.println("DropTarget near the border");
- }
- //
- if (distance > 30) {
- side = SWT.CENTER;
- }
- //
- // // If the part doesn't want to override this drop location then drop on the edge
- //
- // // A "pointless drop" would be one that will put the dragged object back where it started.
- // // Note that it should be perfectly valid to drag an object back to where it came from -- however,
- // // the drop should be ignored.
- //
- @SuppressWarnings("unused")
- boolean pointlessDrop = false;
- if (sourcePart == targetPart) {
- pointlessDrop = true;
+ return createDropTarget(sourcePart, srcTabIndex, side, side, targetPart);
}
+ } else {
+ // Cursor is outside the container
+ // System.out.println("Outside container bounds");
+ // This will be used to create a new Window.
+ // We only allow dropping into a stack, not creating one
+ // if (differentWindows)
+ // return null;
- return createDropTarget(sourcePart, srcTabIndex, side, side, targetPart);
- }
- } else {
- // Cursor is outside the container
- // System.out.println("Outside container bounds");
- // This will be used to create a new Window.
- // We only allow dropping into a stack, not creating one
- // if (differentWindows)
- // return null;
+ int side = Geometry.getClosestSide(containerDisplayBounds, position);
- int side = Geometry.getClosestSide(containerDisplayBounds, position);
+ boolean pointlessDrop = false;
+ int cursor = Geometry.getOppositeSide(side);
- boolean pointlessDrop = false;
- int cursor = Geometry.getOppositeSide(side);
+ if (pointlessDrop) {
+ side = SWT.NONE;
+ }
- if (pointlessDrop) {
- side = SWT.NONE;
+ return createDropTarget(sourcePart, srcTabIndex, side, cursor, null);
}
-
- return createDropTarget(sourcePart, srcTabIndex, side, cursor, null);
}
return null;
- }
+ }
};
@@ -1307,9 +1307,9 @@ public class SashWindowsContainer implements ISashWindowsContainer {
*/
@Override
public boolean accept(TabFolderPart part) {
-
- IPage page = part.getVisiblePagePart();
if (part != null) {
+ IPage page = part.getVisiblePagePart();
+
if (expectedClass != null && expectedClass.isInstance(page)) {
visiblePages.add(page);
} else {
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/eclipsecopy/MultiPageEditorSite.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/eclipsecopy/MultiPageEditorSite.java
index c6ab4411c87..d9b0806ded4 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/eclipsecopy/MultiPageEditorSite.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/eclipsecopy/MultiPageEditorSite.java
@@ -146,6 +146,7 @@ public class MultiPageEditorSite implements IMultiPageEditorSite, INestable {
public MultiPageEditorSite(IEditorSite mainEditorSite, IEditorPart editor, EditorActionBarContributor actionBarContributor) {
Assert.isNotNull(mainEditorSite);
Assert.isNotNull(editor);
+ Assert.isLegal(mainEditorSite instanceof PartSite);
this.mainEditorSite = mainEditorSite;
this.editor = editor;
this.actionBarContributor = actionBarContributor;
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/internal/language/DefaultLanguageProvider.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/internal/language/DefaultLanguageProvider.java
index eb3924c8b84..0d4378cc001 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/internal/language/DefaultLanguageProvider.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/internal/language/DefaultLanguageProvider.java
@@ -163,12 +163,15 @@ public class DefaultLanguageProvider implements ILanguageProvider {
} else if (modelURI.isFile()) {
String baseName = modelURI.lastSegment();
File directory = new File(modelURI.trimSegments(1).toFileString());
- for (File next : directory.listFiles()) {
- if (next.isFile()) {
- IPath nextPath = new Path(directory.getPath()).append(next.getName());
- String name = nextPath.removeFileExtension().lastSegment();
- if (name.equals(baseName)) {
- result.add(URI.createPlatformResourceURI(nextPath.toString(), true));
+ File[] listFiles = directory.listFiles();
+ if (listFiles != null) {
+ for (File next : listFiles) {
+ if (next.isFile()) {
+ IPath nextPath = new Path(directory.getPath()).append(next.getName());
+ String name = nextPath.removeFileExtension().lastSegment();
+ if (name.equals(baseName)) {
+ result.add(URI.createPlatformResourceURI(nextPath.toString(), true));
+ }
}
}
}
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/modelsetquery/impl/ModelSetQueryAdapterSizeMatters.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/modelsetquery/impl/ModelSetQueryAdapterSizeMatters.java
index addd286eed6..1eec11a2f7c 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/modelsetquery/impl/ModelSetQueryAdapterSizeMatters.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/modelsetquery/impl/ModelSetQueryAdapterSizeMatters.java
@@ -76,8 +76,7 @@ public class ModelSetQueryAdapterSizeMatters extends EContentAdapter implements
}
private void addSubTypes(EClass eClassifier) {
- for (EClass superType : eClassifier.getESuperTypes())
- {
+ for (EClass superType : eClassifier.getESuperTypes()) {
addSubType(superType, eClassifier);
addSubTypes(superType);
}
@@ -85,19 +84,16 @@ public class ModelSetQueryAdapterSizeMatters extends EContentAdapter implements
protected void addSubType(EClass superType, EClassifier eClassifier) {
Collection<EClassifier> result = subTypes.get(superType);
- if (result == null)
- {
+ if (result == null) {
result = new HashSet<EClassifier>();
subTypes.put(superType, result);
}
result.add(eClassifier);
}
- private void putObjectInMap(EClassifier eClassifier, EObject obj)
- {
+ private void putObjectInMap(EClassifier eClassifier, EObject obj) {
Collection<EObject> result = cache.get(eClassifier);
- if (result == null)
- {
+ if (result == null) {
result = new HashSet<EObject>();
cache.put(eClassifier, result);
}
@@ -125,22 +121,24 @@ public class ModelSetQueryAdapterSizeMatters extends EContentAdapter implements
Set<EClassifier> alreadyComputed = new HashSet<EClassifier>();
Stack<EClassifier> types = new Stack<EClassifier>();
types.push(type);
- while (!types.isEmpty())
- {
+ while (!types.isEmpty()) {
EClassifier top = types.pop();
alreadyComputed.add(top);
// add instances to the buffer
Collection<EObject> c = cache.get(top);
- if (c != null)
- {
+ if (c != null) {
buffer.addAll(c);
}
// compute sub types
Collection<EClassifier> c2 = subTypes.get(top);
- if (c2 != null && !alreadyComputed.contains(c2))
- {
- types.addAll(c2);
+ if (c2 != null) {
+ for (EClassifier eClassifier : c2) {
+ if (eClassifier != null && !alreadyComputed.contains(eClassifier)) {
+ types.add(eClassifier);
+ }
+ }
}
+
}
return buffer;
}
@@ -161,8 +159,7 @@ public class ModelSetQueryAdapterSizeMatters extends EContentAdapter implements
*/
@Override
public void addEntriesInCache(EClassifier type, HashSet<EObject> list) {
- for (EObject e : list)
- {
+ for (EObject e : list) {
addObjectInCache(e);
}
}
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/modelsetquery/impl/ModelSetQueryAdapterTimeMatters.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/modelsetquery/impl/ModelSetQueryAdapterTimeMatters.java
index 064291c59a1..53e20365439 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/modelsetquery/impl/ModelSetQueryAdapterTimeMatters.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/modelsetquery/impl/ModelSetQueryAdapterTimeMatters.java
@@ -73,8 +73,7 @@ public class ModelSetQueryAdapterTimeMatters extends EContentAdapter implements
private void putObjectInCache(EClassifier eClassifier, EObject newObj) {
Collection<EObject> listOfClassifiers = cache.get(eClassifier);
- if (listOfClassifiers == null)
- {
+ if (listOfClassifiers == null) {
listOfClassifiers = new HashSet<EObject>();
cache.put(eClassifier, listOfClassifiers);
}
@@ -96,10 +95,6 @@ public class ModelSetQueryAdapterTimeMatters extends EContentAdapter implements
if (listOfClassifiers != null) {
listOfClassifiers.remove(newObj);
}
- if (listOfClassifiers.isEmpty())
- {
- cache.remove(eClassifier);
- }
}
@Override
@@ -124,8 +119,7 @@ public class ModelSetQueryAdapterTimeMatters extends EContentAdapter implements
*/
@Override
public void addEntriesInCache(EClassifier type, HashSet<EObject> list) {
- for (EObject e : list)
- {
+ for (EObject e : list) {
addObjectInCache(e);
}
}
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/ModelSet.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/ModelSet.java
index bb7c9abc4b3..85a7c146bca 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/ModelSet.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/ModelSet.java
@@ -634,23 +634,26 @@ public class ModelSet extends ResourceSetImpl {
*
* @param modelIdentifiers
* The model to import from the specified IFile.
- * @param file
- * The IFile used to import the model.
+ * @param uri
+ * The URI used to import the model.
* @throws ModelException
* If an error occur during import.
*/
public void importModels(ModelIdentifiers modelIdentifiers, URI uri) throws ModelException {
- URI toImport = uri.trimFileExtension();
- // Walk all registered models
- for (String modelId : modelIdentifiers) {
- IModel model = getModel(modelId);
+ if (uri != null) {
+ URI toImport = uri.trimFileExtension();
+ // Walk all registered models
+ for (String modelId : modelIdentifiers) {
+ IModel model = getModel(modelId);
+
+ // Load models using the default path
+ model.importModel(toImport);
- // Load models using the default path
- model.importModel(toImport);
- if (uri != null) {
model.setModelURI(uriWithoutExtension);
}
+ } else {
+ throw new ModelException("URI used to import the model is null");
}
}
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/sasheditor/SashModel.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/sasheditor/SashModel.java
index 82483db1073..d513de07d25 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/sasheditor/SashModel.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/sasheditor/SashModel.java
@@ -248,7 +248,7 @@ public class SashModel extends EMFLogicalModel implements IModel {
}
/**
- * Intantiates the sash resource template on the given URI.
+ * Instantiates the sash resource template on the given URI.
*
* @param sashResourceURI
* the new sash resource URI
@@ -258,8 +258,13 @@ public class SashModel extends EMFLogicalModel implements IModel {
*/
void intantiateTemplate(URI sashResourceURI) throws IOException {
try (OutputStream output = getModelManager().getURIConverter().createOutputStream(sashResourceURI)) {
- URL template = Activator.getDefault().getBundle().getEntry("templates/model.sash"); //$NON-NLS-1$
- Resources.copy(template, output);
+ String path = "templates/model.sash"; //$NON-NLS-1$
+ URL template = Activator.getDefault().getBundle().getEntry(path);
+ if (template != null) {
+ Resources.copy(template, output);
+ } else {
+ throw new IOException("Sash template URL is null for: " + path);
+ }
}
}
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/services/internal/ErrorServiceTypeEntry.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/services/internal/ErrorServiceTypeEntry.java
index b2973a87196..99e10e95d6a 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/services/internal/ErrorServiceTypeEntry.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/services/internal/ErrorServiceTypeEntry.java
@@ -1,108 +1,104 @@
-/*****************************************************************************
- * Copyright (c) CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.core.services.internal;
-
-import org.eclipse.papyrus.infra.core.services.BadStateException;
-import org.eclipse.papyrus.infra.core.services.ServiceDescriptor;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.core.services.ServiceState;
-import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
-
-/**
- * A service entry used for faulty services. In this implementation, methods do
- * nothings or throw an error.
- *
- *
- * @author cedric dumoulin
- *
- */
-public class ErrorServiceTypeEntry extends ServiceTypeEntry {
-
- /**
- * The original service descriptor.
- */
- private ServiceDescriptor descriptor;
-
- /**
- *
- * Constructor.
- *
- * @param descriptor
- */
- public ErrorServiceTypeEntry(ServiceDescriptor descriptor) {
- super(descriptor);
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.core.services.internal.ServiceTypeEntry#getServiceInstance()
- *
- * @return
- * @throws ServiceException
- */
- @Override
- public Object getServiceInstance() throws ServiceException {
- throw new BadStateException("Service has not started.", ServiceState.error, descriptor); //$NON-NLS-1$
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.core.services.internal.ServiceTypeEntry#createService()
- *
- * @throws ServiceException
- */
- @Override
- public void createService() throws ServiceException {
- // do nothing
-
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.core.services.internal.ServiceTypeEntry#initService(ServicesRegistry)
- *
- * @param servicesRegistry
- * @throws ServiceException
- */
- @Override
- public void initService(ServicesRegistry servicesRegistry) throws ServiceException {
- // do nothing
-
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.core.services.internal.ServiceTypeEntry#startService()
- *
- * @throws ServiceException
- */
- @Override
- public void startService() throws ServiceException {
- // do nothing
-
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.core.services.internal.ServiceTypeEntry#disposeService()
- *
- * @throws ServiceException
- */
- @Override
- public void disposeService() throws ServiceException {
- // do nothing
-
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.core.services.internal;
+
+import org.eclipse.papyrus.infra.core.services.BadStateException;
+import org.eclipse.papyrus.infra.core.services.ServiceDescriptor;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServiceState;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+
+/**
+ * A service entry used for faulty services. In this implementation, methods do
+ * nothings or throw an error.
+ *
+ *
+ * @author cedric dumoulin
+ *
+ */
+public class ErrorServiceTypeEntry extends ServiceTypeEntry {
+
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param descriptor
+ */
+ public ErrorServiceTypeEntry(ServiceDescriptor descriptor) {
+ super(descriptor);
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.core.services.internal.ServiceTypeEntry#getServiceInstance()
+ *
+ * @return
+ * @throws ServiceException
+ */
+ @Override
+ public Object getServiceInstance() throws ServiceException {
+ throw new BadStateException("Service has not started.", ServiceState.error, serviceDescriptor); //$NON-NLS-1$
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.core.services.internal.ServiceTypeEntry#createService()
+ *
+ * @throws ServiceException
+ */
+ @Override
+ public void createService() throws ServiceException {
+ // do nothing
+
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.core.services.internal.ServiceTypeEntry#initService(ServicesRegistry)
+ *
+ * @param servicesRegistry
+ * @throws ServiceException
+ */
+ @Override
+ public void initService(ServicesRegistry servicesRegistry) throws ServiceException {
+ // do nothing
+
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.core.services.internal.ServiceTypeEntry#startService()
+ *
+ * @throws ServiceException
+ */
+ @Override
+ public void startService() throws ServiceException {
+ // do nothing
+
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.core.services.internal.ServiceTypeEntry#disposeService()
+ *
+ * @throws ServiceException
+ */
+ @Override
+ public void disposeService() throws ServiceException {
+ // do nothing
+
+ }
+
+}
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.tools/.settings/.api_filters b/plugins/infra/core/org.eclipse.papyrus.infra.tools/.settings/.api_filters
deleted file mode 100644
index 793433951ae..00000000000
--- a/plugins/infra/core/org.eclipse.papyrus.infra.tools/.settings/.api_filters
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<component id="org.eclipse.papyrus.infra.tools" version="2">
- <resource path="src/org/eclipse/papyrus/infra/tools/databinding/DelegatingObservableCollection.java" type="org.eclipse.papyrus.infra.tools.databinding.DelegatingObservableCollection">
- <filter comment="Cannot extend the core platform observable class so the interface must be implemented" id="574619656">
- <message_arguments>
- <message_argument value="IObservableCollection&lt;E&gt;"/>
- <message_argument value="DelegatingObservableCollection&lt;T&gt;"/>
- </message_arguments>
- </filter>
- </resource>
- <resource path="src/org/eclipse/papyrus/infra/tools/databinding/DelegatingObservableList.java" type="org.eclipse.papyrus.infra.tools.databinding.DelegatingObservableList">
- <filter comment="Cannot extend the core platform observable class so the interface must be implemented" id="574619656">
- <message_arguments>
- <message_argument value="IObservableList&lt;E&gt;"/>
- <message_argument value="DelegatingObservableList"/>
- </message_arguments>
- </filter>
- </resource>
- <resource path="src/org/eclipse/papyrus/infra/tools/databinding/DelegatingObservableSet.java" type="org.eclipse.papyrus.infra.tools.databinding.DelegatingObservableSet">
- <filter comment="Cannot extend the core platform observable class so the interface must be implemented" id="574619656">
- <message_arguments>
- <message_argument value="IObservableSet&lt;E&gt;"/>
- <message_argument value="DelegatingObservableSet"/>
- </message_arguments>
- </filter>
- </resource>
- <resource path="src/org/eclipse/papyrus/infra/tools/databinding/DelegatingObservableValue.java" type="org.eclipse.papyrus.infra.tools.databinding.DelegatingObservableValue">
- <filter comment="Cannot extend the core platform observable class so the interface must be implemented" id="574619656">
- <message_arguments>
- <message_argument value="IObservableValue&lt;T&gt;"/>
- <message_argument value="DelegatingObservableValue"/>
- </message_arguments>
- </filter>
- </resource>
-</component>

Back to the top