diff options
author | Stéphane Bégaudeau | 2017-07-06 08:46:48 +0000 |
---|---|---|
committer | Stéphane Bégaudeau | 2017-07-06 08:46:48 +0000 |
commit | e7673ae6b20ece8e3426c12bd1d7398966bf7d0e (patch) | |
tree | 046bc8551a001a5c394ec07f12f3a655afdbccd9 | |
parent | c8f1d859c986e21bfd5a66fb79957aad76bb137a (diff) | |
download | org.eclipse.eef-e7673ae6b20ece8e3426c12bd1d7398966bf7d0e.tar.gz org.eclipse.eef-e7673ae6b20ece8e3426c12bd1d7398966bf7d0e.tar.xz org.eclipse.eef-e7673ae6b20ece8e3426c12bd1d7398966bf7d0e.zip |
[519240] Fix an issue with olf property sections from EEF 1.5.x
Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=519240
Change-Id: I2d0f6fd143892d85a4e3c7174b00f66e77b13aee
Signed-off-by: Stéphane Bégaudeau <stephane.begaudeau@obeo.fr>
-rw-r--r-- | plugins/org.eclipse.emf.eef.runtime/src/org/eclipse/emf/eef/runtime/part/impl/SectionPropertiesEditingPart.java | 49 |
1 files changed, 28 insertions, 21 deletions
diff --git a/plugins/org.eclipse.emf.eef.runtime/src/org/eclipse/emf/eef/runtime/part/impl/SectionPropertiesEditingPart.java b/plugins/org.eclipse.emf.eef.runtime/src/org/eclipse/emf/eef/runtime/part/impl/SectionPropertiesEditingPart.java index 2631e0142..ce42f9fa8 100644 --- a/plugins/org.eclipse.emf.eef.runtime/src/org/eclipse/emf/eef/runtime/part/impl/SectionPropertiesEditingPart.java +++ b/plugins/org.eclipse.emf.eef.runtime/src/org/eclipse/emf/eef/runtime/part/impl/SectionPropertiesEditingPart.java @@ -165,6 +165,7 @@ public abstract class SectionPropertiesEditingPart extends CompositePropertiesEd * * @see org.eclipse.emf.eef.runtime.impl.parts.CompositePropertiesEditionPart#refresh() */ + @Override public void refresh() { if (usedAsPropertySection) { initSemanticContents(); @@ -301,30 +302,36 @@ public abstract class SectionPropertiesEditingPart extends CompositePropertiesEd if (result != null) { boolean oldLegacySectionAccessible = false; Field legacySectionField = null; + Class<?> cls = result.getClass(); + try { - Class<?> cls = result.getClass(); legacySectionField = cls.getDeclaredField("legacySection"); //$NON-NLS-1$ - oldLegacySectionAccessible = legacySectionField.isAccessible(); - legacySectionField.setAccessible(true); - result = legacySectionField.get(result); - if (result == this) { - Method getId = getMethod(key, "getId"); //$NON-NLS-1$ - if (getId != null) { - String id = (String) callMethod(key, getId); - return id; - } - } } catch (NoSuchFieldException e) { - EEFRuntimePlugin.getDefault().logError(EEFRuntimeUIMessages.PropertiesEditionSection_legacySection_not_found, e); - } catch (SecurityException e) { - EEFRuntimePlugin.getDefault().logError(EEFRuntimeUIMessages.PropertiesEditionSection_legacySection_not_found, e); - } catch (IllegalArgumentException e) { - EEFRuntimePlugin.getDefault().logError(EEFRuntimeUIMessages.PropertiesEditionSection_legacySection_not_found, e); - } catch (IllegalAccessException e) { - EEFRuntimePlugin.getDefault().logError(EEFRuntimeUIMessages.PropertiesEditionSection_legacySection_not_found, e); - } finally { - if (legacySectionField != null) { - legacySectionField.setAccessible(oldLegacySectionAccessible); + // Do nothing, we are testing if the field exist + } + + if (legacySectionField != null) { + try { + oldLegacySectionAccessible = legacySectionField.isAccessible(); + legacySectionField.setAccessible(true); + result = legacySectionField.get(result); + if (result == this) { + Method getId = getMethod(key, "getId"); //$NON-NLS-1$ + if (getId != null) { + String id = (String) callMethod(key, getId); + return id; + } + } + } catch (SecurityException e) { + EEFRuntimePlugin.getDefault().logError(EEFRuntimeUIMessages.PropertiesEditionSection_legacySection_not_found, e); + } catch (IllegalArgumentException e) { + EEFRuntimePlugin.getDefault().logError(EEFRuntimeUIMessages.PropertiesEditionSection_legacySection_not_found, e); + } catch (IllegalAccessException e) { + EEFRuntimePlugin.getDefault().logError(EEFRuntimeUIMessages.PropertiesEditionSection_legacySection_not_found, e); + } finally { + if (legacySectionField != null) { + legacySectionField.setAccessible(oldLegacySectionAccessible); + } } } } |