[567991] Improved synchronzied access of typeLibList
Furthermore the additional logging was removed from the
NamedElementComperator.
Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=567991
Change-Id: I1b47b6980d772babb7f60d8b90b2fe6c1954b94f
diff --git a/plugins/org.eclipse.fordiac.ide.model/src-gen/org/eclipse/fordiac/ide/model/libraryElement/util/LibraryElementAdapterFactory.java b/plugins/org.eclipse.fordiac.ide.model/src-gen/org/eclipse/fordiac/ide/model/libraryElement/util/LibraryElementAdapterFactory.java
index 2384b4e..1b6f982 100644
--- a/plugins/org.eclipse.fordiac.ide.model/src-gen/org/eclipse/fordiac/ide/model/libraryElement/util/LibraryElementAdapterFactory.java
+++ b/plugins/org.eclipse.fordiac.ide.model/src-gen/org/eclipse/fordiac/ide/model/libraryElement/util/LibraryElementAdapterFactory.java
@@ -1,23 +1,29 @@
-/********************************************************************************
- * Copyright (c) 2008 - 2017 Profactor GmbH, TU Wien ACIN, fortiss GmbH
+/**
+ * *******************************************************************************
+ * Copyright (c) 2008 - 2018 Profactor GmbH, TU Wien ACIN, fortiss GmbH
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
- *
+ *
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
- * Gerhard Ebenhofer, Alois Zoitl, Ingo Hegny, Monika Wenger
- * - initial API and implementation and/or initial documentation
- ********************************************************************************/
+ * Gerhard Ebenhofer, Alois Zoitl, Ingo Hegny, Monika Wenger, Martin Jobst
+ * - initial API and implementation and/or initial documentation
+ * *******************************************************************************
+ */
package org.eclipse.fordiac.ide.model.libraryElement.util;
import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.Notifier;
+
import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
+
import org.eclipse.emf.ecore.EObject;
+
import org.eclipse.fordiac.ide.model.data.DataType;
+
import org.eclipse.fordiac.ide.model.libraryElement.AdapterConnection;
import org.eclipse.fordiac.ide.model.libraryElement.AdapterDeclaration;
import org.eclipse.fordiac.ide.model.libraryElement.AdapterEvent;
@@ -725,18 +731,6 @@
return null;
}
- /** Creates a new adapter for an object of class '{@link org.eclipse.fordiac.ide.model.libraryElement.FBNetwork
- * <em>FB Network</em>}'. <!-- begin-user-doc --> This default implementation returns null so that we can easily
- * ignore cases; it's useful to ignore a case when inheritance will catch all the cases anyway. <!-- end-user-doc
- * -->
- *
- * @return the new adapter.
- * @see org.eclipse.fordiac.ide.model.libraryElement.FBNetwork
- * @generated */
- public Adapter createFBNetworkAdapter() {
- return null;
- }
-
/** Creates a new adapter for an object of class '{@link org.eclipse.fordiac.ide.model.libraryElement.FB
* <em>FB</em>}'. <!-- begin-user-doc --> This default implementation returns null so that we can easily ignore
* cases; it's useful to ignore a case when inheritance will catch all the cases anyway. <!-- end-user-doc -->
@@ -760,6 +754,17 @@
return null;
}
+ /** Creates a new adapter for an object of class '{@link org.eclipse.fordiac.ide.model.libraryElement.SubApp <em>Sub
+ * App</em>}'. <!-- begin-user-doc --> This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway. <!-- end-user-doc -->
+ *
+ * @return the new adapter.
+ * @see org.eclipse.fordiac.ide.model.libraryElement.SubApp
+ * @generated */
+ public Adapter createSubAppAdapter() {
+ return null;
+ }
+
/** Creates a new adapter for an object of class '{@link org.eclipse.fordiac.ide.model.libraryElement.FBType <em>FB
* Type</em>}'. <!-- begin-user-doc --> This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway. <!-- end-user-doc -->
@@ -853,6 +858,18 @@
return null;
}
+ /** Creates a new adapter for an object of class '{@link org.eclipse.fordiac.ide.model.libraryElement.Attribute
+ * <em>Attribute</em>}'. <!-- begin-user-doc --> This default implementation returns null so that we can easily
+ * ignore cases; it's useful to ignore a case when inheritance will catch all the cases anyway. <!-- end-user-doc
+ * -->
+ *
+ * @return the new adapter.
+ * @see org.eclipse.fordiac.ide.model.libraryElement.Attribute
+ * @generated */
+ public Adapter createAttributeAdapter() {
+ return null;
+ }
+
/** Creates a new adapter for an object of class '{@link org.eclipse.fordiac.ide.model.libraryElement.Resource
* <em>Resource</em>}'. <!-- begin-user-doc --> This default implementation returns null so that we can easily
* ignore cases; it's useful to ignore a case when inheritance will catch all the cases anyway. <!-- end-user-doc
@@ -948,14 +965,15 @@
return null;
}
- /** Creates a new adapter for an object of class '{@link org.eclipse.fordiac.ide.model.libraryElement.SubApp <em>Sub
- * App</em>}'. <!-- begin-user-doc --> This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway. <!-- end-user-doc -->
+ /** Creates a new adapter for an object of class '{@link org.eclipse.fordiac.ide.model.libraryElement.FBNetwork
+ * <em>FB Network</em>}'. <!-- begin-user-doc --> This default implementation returns null so that we can easily
+ * ignore cases; it's useful to ignore a case when inheritance will catch all the cases anyway. <!-- end-user-doc
+ * -->
*
* @return the new adapter.
- * @see org.eclipse.fordiac.ide.model.libraryElement.SubApp
+ * @see org.eclipse.fordiac.ide.model.libraryElement.FBNetwork
* @generated */
- public Adapter createSubAppAdapter() {
+ public Adapter createFBNetworkAdapter() {
return null;
}
@@ -1423,18 +1441,6 @@
return null;
}
- /** Creates a new adapter for an object of class '{@link org.eclipse.fordiac.ide.model.libraryElement.Attribute
- * <em>Attribute</em>}'. <!-- begin-user-doc --> This default implementation returns null so that we can easily
- * ignore cases; it's useful to ignore a case when inheritance will catch all the cases anyway. <!-- end-user-doc
- * -->
- *
- * @return the new adapter.
- * @see org.eclipse.fordiac.ide.model.libraryElement.Attribute
- * @generated */
- public Adapter createAttributeAdapter() {
- return null;
- }
-
/** Creates a new adapter for an object of class '{@link org.eclipse.fordiac.ide.model.data.DataType
* <em>Type</em>}'. <!-- begin-user-doc --> This default implementation returns null so that we can easily ignore
* cases; it's useful to ignore a case when inheritance will catch all the cases anyway. <!-- end-user-doc -->
diff --git a/plugins/org.eclipse.fordiac.ide.model/src-gen/org/eclipse/fordiac/ide/model/libraryElement/util/LibraryElementSwitch.java b/plugins/org.eclipse.fordiac.ide.model/src-gen/org/eclipse/fordiac/ide/model/libraryElement/util/LibraryElementSwitch.java
index 757b2a7..c8241d2 100644
--- a/plugins/org.eclipse.fordiac.ide.model/src-gen/org/eclipse/fordiac/ide/model/libraryElement/util/LibraryElementSwitch.java
+++ b/plugins/org.eclipse.fordiac.ide.model/src-gen/org/eclipse/fordiac/ide/model/libraryElement/util/LibraryElementSwitch.java
@@ -1,22 +1,27 @@
-/********************************************************************************
- * Copyright (c) 2008 - 2017 Profactor GmbH, TU Wien ACIN, fortiss GmbH
+/**
+ * *******************************************************************************
+ * Copyright (c) 2008 - 2018 Profactor GmbH, TU Wien ACIN, fortiss GmbH
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
- *
+ *
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
- * Gerhard Ebenhofer, Alois Zoitl, Ingo Hegny, Monika Wenger
- * - initial API and implementation and/or initial documentation
- ********************************************************************************/
+ * Gerhard Ebenhofer, Alois Zoitl, Ingo Hegny, Monika Wenger, Martin Jobst
+ * - initial API and implementation and/or initial documentation
+ * *******************************************************************************
+ */
package org.eclipse.fordiac.ide.model.libraryElement.util;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
+
import org.eclipse.emf.ecore.util.Switch;
+
import org.eclipse.fordiac.ide.model.data.DataType;
+
import org.eclipse.fordiac.ide.model.libraryElement.AdapterConnection;
import org.eclipse.fordiac.ide.model.libraryElement.AdapterDeclaration;
import org.eclipse.fordiac.ide.model.libraryElement.AdapterEvent;
@@ -1180,17 +1185,6 @@
return null;
}
- /** Returns the result of interpreting the object as an instance of '<em>FB Network</em>'. <!-- begin-user-doc -->
- * This implementation returns null; returning a non-null result will terminate the switch. <!-- end-user-doc -->
- *
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>FB Network</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated */
- public T caseFBNetwork(FBNetwork object) {
- return null;
- }
-
/** Returns the result of interpreting the object as an instance of '<em>FB</em>'. <!-- begin-user-doc --> This
* implementation returns null; returning a non-null result will terminate the switch. <!-- end-user-doc -->
*
@@ -1214,6 +1208,17 @@
return null;
}
+ /** Returns the result of interpreting the object as an instance of '<em>Sub App</em>'. <!-- begin-user-doc --> This
+ * implementation returns null; returning a non-null result will terminate the switch. <!-- end-user-doc -->
+ *
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Sub App</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated */
+ public T caseSubApp(SubApp object) {
+ return null;
+ }
+
/** Returns the result of interpreting the object as an instance of '<em>FB Type</em>'. <!-- begin-user-doc --> This
* implementation returns null; returning a non-null result will terminate the switch. <!-- end-user-doc -->
*
@@ -1307,6 +1312,17 @@
return null;
}
+ /** Returns the result of interpreting the object as an instance of '<em>Attribute</em>'. <!-- begin-user-doc -->
+ * This implementation returns null; returning a non-null result will terminate the switch. <!-- end-user-doc -->
+ *
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Attribute</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated */
+ public T caseAttribute(Attribute object) {
+ return null;
+ }
+
/** Returns the result of interpreting the object as an instance of '<em>Resource</em>'. <!-- begin-user-doc -->
* This implementation returns null; returning a non-null result will terminate the switch. <!-- end-user-doc -->
*
@@ -1400,14 +1416,14 @@
return null;
}
- /** Returns the result of interpreting the object as an instance of '<em>Sub App</em>'. <!-- begin-user-doc --> This
- * implementation returns null; returning a non-null result will terminate the switch. <!-- end-user-doc -->
+ /** Returns the result of interpreting the object as an instance of '<em>FB Network</em>'. <!-- begin-user-doc -->
+ * This implementation returns null; returning a non-null result will terminate the switch. <!-- end-user-doc -->
*
* @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Sub App</em>'.
+ * @return the result of interpreting the object as an instance of '<em>FB Network</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated */
- public T caseSubApp(SubApp object) {
+ public T caseFBNetwork(FBNetwork object) {
return null;
}
@@ -1866,17 +1882,6 @@
return null;
}
- /** Returns the result of interpreting the object as an instance of '<em>Attribute</em>'. <!-- begin-user-doc -->
- * This implementation returns null; returning a non-null result will terminate the switch. <!-- end-user-doc -->
- *
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Attribute</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated */
- public T caseAttribute(Attribute object) {
- return null;
- }
-
/** Returns the result of interpreting the object as an instance of '<em>Type</em>'. <!-- begin-user-doc --> This
* implementation returns null; returning a non-null result will terminate the switch. <!-- end-user-doc -->
*
diff --git a/plugins/org.eclipse.fordiac.ide.model/src/org/eclipse/fordiac/ide/model/NamedElementComparator.java b/plugins/org.eclipse.fordiac.ide.model/src/org/eclipse/fordiac/ide/model/NamedElementComparator.java
index 9c75c44..c803eea 100644
--- a/plugins/org.eclipse.fordiac.ide.model/src/org/eclipse/fordiac/ide/model/NamedElementComparator.java
+++ b/plugins/org.eclipse.fordiac.ide.model/src/org/eclipse/fordiac/ide/model/NamedElementComparator.java
@@ -26,17 +26,6 @@
@Override
public int compare(final INamedElement o1, final INamedElement o2) {
- if (o1 == null) {
- Activator.getDefault()
- .logError("o1 was null, o2 value: " + o2 + " name: " + ((null != o2) ? o2.getName() : "Also null")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
- if (o2 == null) {
- Activator.getDefault()
- .logError("o2 was null, o1 value: " + o1 + " name: " + ((null != o1) ? o1.getName() : "Also null")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
- if (col == null) {
- Activator.getDefault().logError("col2 was null"); //$NON-NLS-1$
- }
return col.compare(o1.getName(), o2.getName());
}
}
\ No newline at end of file
diff --git a/plugins/org.eclipse.fordiac.ide.model/src/org/eclipse/fordiac/ide/model/typelibrary/TypeLibrary.java b/plugins/org.eclipse.fordiac.ide.model/src/org/eclipse/fordiac/ide/model/typelibrary/TypeLibrary.java
index 850b4b6..c2499c5 100644
--- a/plugins/org.eclipse.fordiac.ide.model/src/org/eclipse/fordiac/ide/model/typelibrary/TypeLibrary.java
+++ b/plugins/org.eclipse.fordiac.ide.model/src/org/eclipse/fordiac/ide/model/typelibrary/TypeLibrary.java
@@ -49,12 +49,16 @@
// !> Holds type libraries of all open 4diac IDE projects
private static Map<IProject, TypeLibrary> typeLibraryList = new HashMap<>();
- public static synchronized TypeLibrary getTypeLibrary(final IProject proj) {
- return typeLibraryList.computeIfAbsent(proj, TypeLibrary::new);
+ public static TypeLibrary getTypeLibrary(final IProject proj) {
+ synchronized (typeLibraryList) {
+ return typeLibraryList.computeIfAbsent(proj, TypeLibrary::new);
+ }
}
public static void removeProject(final IProject project) {
- typeLibraryList.remove(project);
+ synchronized (typeLibraryList) {
+ typeLibraryList.remove(project);
+ }
}
private final Palette blockTypeLib = PaletteFactory.eINSTANCE.createPalette();
@@ -145,8 +149,10 @@
}
public static synchronized void loadToolLibrary() {
- final IProject toolLibProject = getToolLibProject();
- typeLibraryList.computeIfAbsent(toolLibProject, TypeLibrary::createToolLibrary);
+ synchronized (typeLibraryList) {
+ final IProject toolLibProject = getToolLibProject();
+ typeLibraryList.computeIfAbsent(toolLibProject, TypeLibrary::createToolLibrary);
+ }
}
private static TypeLibrary createToolLibrary(final IProject toolLibProject) {