Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas FAUVERGUE2016-12-05 16:33:23 +0000
committerGerrit Code Review @ Eclipse.org2016-12-06 09:03:58 +0000
commite3820d2ee8a48f601723b437bb4f07f282846d0e (patch)
tree1ddb0cf5c8d913dcc161c3bb6a402c2365443ef6 /plugins/infra
parent940a7f67863ce737f19f15c02a2c282fab80d7fe (diff)
downloadorg.eclipse.papyrus-e3820d2ee8a48f601723b437bb4f07f282846d0e.tar.gz
org.eclipse.papyrus-e3820d2ee8a48f601723b437bb4f07f282846d0e.tar.xz
org.eclipse.papyrus-e3820d2ee8a48f601723b437bb4f07f282846d0e.zip
Bug 506067: NullPointerException in
AbstractPostActionIdsProvider.getElements https://bugs.eclipse.org/bugs/show_bug.cgi?id=506067 - Fix a NPE Change-Id: Iabe7346da22ac7631db2587cce9f3e97fe620882 Signed-off-by: Nicolas FAUVERGUE <nicolasfauvergue@gmail.com>
Diffstat (limited to 'plugins/infra')
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/src/org/eclipse/papyrus/infra/nattable/properties/provider/AbstractPostActionIdsProvider.java214
1 files changed, 109 insertions, 105 deletions
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/src/org/eclipse/papyrus/infra/nattable/properties/provider/AbstractPostActionIdsProvider.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/src/org/eclipse/papyrus/infra/nattable/properties/provider/AbstractPostActionIdsProvider.java
index ea45d4a54fe..7305b9f36d4 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/src/org/eclipse/papyrus/infra/nattable/properties/provider/AbstractPostActionIdsProvider.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/src/org/eclipse/papyrus/infra/nattable/properties/provider/AbstractPostActionIdsProvider.java
@@ -1,105 +1,109 @@
-/*****************************************************************************
- * Copyright (c) 2013 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:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.properties.provider;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.NattableaxisconfigurationPackage;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.PasteEObjectConfiguration;
-import org.eclipse.papyrus.infra.nattable.paste.PastePostActionRegistry;
-import org.eclipse.papyrus.infra.nattable.utils.AxisConfigurationUtils;
-import org.eclipse.papyrus.infra.widgets.providers.IStaticContentProvider;
-
-
-public abstract class AbstractPostActionIdsProvider implements IStaticContentProvider {
-
- /**
- * <code>true</code> if we are editing column
- */
- private final boolean isEditingColumn;
-
- /**
- * the table manager
- */
- private INattableModelManager tableManager;
-
- /**
- *
- * Constructor.
- *
- * @param tableManager
- * the table manager
- * @param isEditingColumn
- * <code>true</code> if we are editing columns
- */
- public AbstractPostActionIdsProvider(final INattableModelManager tableManager, final boolean isEditingColumn) {
- this.tableManager = tableManager;
- this.isEditingColumn = isEditingColumn;
- }
-
- /**
- *
- * @see org.eclipse.jface.viewers.IContentProvider#dispose()
- *
- */
- @Override
- public void dispose() {
- this.tableManager = null;
- }
-
- /**
- *
- * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
- *
- * @param inputElement
- * @return
- */
- @Override
- public Object[] getElements(Object inputElement) {
- final PasteEObjectConfiguration conf = (PasteEObjectConfiguration) AxisConfigurationUtils.getIAxisConfigurationUsedInTable(this.tableManager.getTable(), NattableaxisconfigurationPackage.eINSTANCE.getPasteEObjectConfiguration(), isEditingColumn);
- if (conf != null && conf.getPastedElementId() != null) {
- final EClass eClass = ElementTypeRegistry.getInstance().getType(conf.getPastedElementId()).getEClass();
- return PastePostActionRegistry.INSTANCE.getAvailablePostActionIds(this.tableManager, eClass).toArray();
- }
- return new Object[0];
- }
-
-
- /**
- *
- * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
- *
- * @param viewer
- * @param oldInput
- * @param newInput
- */
- @Override
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- // nothing to do
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.widgets.providers.IStaticContentProvider#getElements()
- *
- * @return
- */
- @Override
- public Object[] getElements() {
- return getElements(null);
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2013 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.properties.provider;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.NattableaxisconfigurationPackage;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.PasteEObjectConfiguration;
+import org.eclipse.papyrus.infra.nattable.paste.PastePostActionRegistry;
+import org.eclipse.papyrus.infra.nattable.utils.AxisConfigurationUtils;
+import org.eclipse.papyrus.infra.widgets.providers.IStaticContentProvider;
+
+
+public abstract class AbstractPostActionIdsProvider implements IStaticContentProvider {
+
+ /**
+ * <code>true</code> if we are editing column
+ */
+ private final boolean isEditingColumn;
+
+ /**
+ * the table manager
+ */
+ private INattableModelManager tableManager;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param tableManager
+ * the table manager
+ * @param isEditingColumn
+ * <code>true</code> if we are editing columns
+ */
+ public AbstractPostActionIdsProvider(final INattableModelManager tableManager, final boolean isEditingColumn) {
+ this.tableManager = tableManager;
+ this.isEditingColumn = isEditingColumn;
+ }
+
+ /**
+ *
+ * @see org.eclipse.jface.viewers.IContentProvider#dispose()
+ *
+ */
+ @Override
+ public void dispose() {
+ this.tableManager = null;
+ }
+
+ /**
+ *
+ * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
+ *
+ * @param inputElement
+ * @return
+ */
+ @Override
+ public Object[] getElements(Object inputElement) {
+ final PasteEObjectConfiguration conf = (PasteEObjectConfiguration) AxisConfigurationUtils.getIAxisConfigurationUsedInTable(this.tableManager.getTable(), NattableaxisconfigurationPackage.eINSTANCE.getPasteEObjectConfiguration(), isEditingColumn);
+ if (conf != null && conf.getPastedElementId() != null) {
+ final IElementType elementType = ElementTypeRegistry.getInstance().getType(conf.getPastedElementId());
+ if(null != elementType){
+ final EClass eClass = elementType.getEClass();
+ return PastePostActionRegistry.INSTANCE.getAvailablePostActionIds(this.tableManager, eClass).toArray();
+ }
+ }
+ return new Object[0];
+ }
+
+
+ /**
+ *
+ * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
+ *
+ * @param viewer
+ * @param oldInput
+ * @param newInput
+ */
+ @Override
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ // nothing to do
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.widgets.providers.IStaticContentProvider#getElements()
+ *
+ * @return
+ */
+ @Override
+ public Object[] getElements() {
+ return getElements(null);
+ }
+
+}

Back to the top