Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Faltermeier2017-10-12 09:31:37 -0400
committerJohannes Faltermeier2017-10-13 08:37:27 -0400
commit217eecaaf768b7d7ceafc4e3d79b25fb83bd1a9b (patch)
tree547078364899ced2216550f4cc089700976d94ae
parent58ce17e6eeae3d00674c7cb3367c70d196f2084d (diff)
downloadorg.eclipse.emf.edapt-217eecaaf768b7d7ceafc4e3d79b25fb83bd1a9b.tar.gz
org.eclipse.emf.edapt-217eecaaf768b7d7ceafc4e3d79b25fb83bd1a9b.tar.xz
org.eclipse.emf.edapt-217eecaaf768b7d7ceafc4e3d79b25fb83bd1a9b.zip
Bug 526001 - Tooling should give hints if a release is required
* Item provider for release should display a different icon and additional text if a release is required Change-Id: I30ea18d1239c70f4621f9dbf7ee91b94f718aa1b Signed-off-by: Johannes Faltermeier <jfaltermeier@eclipsesource.com>
-rw-r--r--plugins/org.eclipse.emf.edapt.history.edit/generated-src/org/eclipse/emf/edapt/spi/history/provider/ReleaseItemProvider.java56
-rw-r--r--plugins/org.eclipse.emf.edapt.history.edit/icons/full/obj16/ReleaseBreaking.gifbin0 -> 873 bytes
2 files changed, 47 insertions, 9 deletions
diff --git a/plugins/org.eclipse.emf.edapt.history.edit/generated-src/org/eclipse/emf/edapt/spi/history/provider/ReleaseItemProvider.java b/plugins/org.eclipse.emf.edapt.history.edit/generated-src/org/eclipse/emf/edapt/spi/history/provider/ReleaseItemProvider.java
index 2b96744..6cf10f9 100644
--- a/plugins/org.eclipse.emf.edapt.history.edit/generated-src/org/eclipse/emf/edapt/spi/history/provider/ReleaseItemProvider.java
+++ b/plugins/org.eclipse.emf.edapt.history.edit/generated-src/org/eclipse/emf/edapt/spi/history/provider/ReleaseItemProvider.java
@@ -12,6 +12,7 @@
package org.eclipse.emf.edapt.spi.history.provider;
import java.text.DateFormat;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.List;
@@ -22,7 +23,11 @@ import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.util.ResourceLocator;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.edapt.history.provider.util.RestrictingDragAndDropCommand;
+import org.eclipse.emf.edapt.spi.history.Change;
+import org.eclipse.emf.edapt.spi.history.CompositeChange;
+import org.eclipse.emf.edapt.spi.history.Create;
import org.eclipse.emf.edapt.spi.history.HistoryPackage;
+import org.eclipse.emf.edapt.spi.history.OperationChange;
import org.eclipse.emf.edapt.spi.history.Release;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
@@ -88,9 +93,8 @@ public class ReleaseItemProvider
* @generated
*/
protected void addDatePropertyDescriptor(Object object) {
- itemPropertyDescriptors.add
- (createItemPropertyDescriptor
- (((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
+ itemPropertyDescriptors
+ .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_Release_date_feature"), //$NON-NLS-1$
getString("_UI_PropertyDescriptor_description", "_UI_Release_date_feature", "_UI_Release_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
@@ -111,9 +115,8 @@ public class ReleaseItemProvider
* @generated
*/
protected void addLabelPropertyDescriptor(Object object) {
- itemPropertyDescriptors.add
- (createItemPropertyDescriptor
- (((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
+ itemPropertyDescriptors
+ .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_Release_label_feature"), //$NON-NLS-1$
getString("_UI_PropertyDescriptor_description", "_UI_Release_label_feature", "_UI_Release_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
@@ -158,15 +161,49 @@ public class ReleaseItemProvider
return super.getChildFeature(object, child);
}
+ private boolean shouldBeReleased(Release release) {
+ if (release == null) {
+ return false;
+ }
+ final Date date = release.getDate();
+ if (date != null) {
+ return false;
+ }
+ return checkForPotentialBreakingChanges(release.getChanges());
+ }
+
+ private boolean checkForPotentialBreakingChanges(List<Change> changes) {
+ for (final Change change : changes) {
+ if (OperationChange.class.isInstance(change)) {
+ if (OperationChange.class.cast(change).getOperation().getOperation().isBreaking()) {
+ return true;
+ }
+ } else if (CompositeChange.class.isInstance(change)) {
+ if (checkForPotentialBreakingChanges(
+ new ArrayList<Change>(CompositeChange.class.cast(change).getChanges()))) {
+ return true;
+ }
+ } else if (Create.class.isInstance(change)) {
+ continue;
+ } else {
+ return true;
+ }
+ }
+ return false;
+ }
+
/**
* This returns Release.gif.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
- * @generated
+ * @generated NOT
*/
@Override
public Object getImage(Object object) {
+ if (shouldBeReleased((Release) object)) {
+ return overlayImage(object, getResourceLocator().getImage("full/obj16/ReleaseBreaking")); //$NON-NLS-1$
+ }
return overlayImage(object, getResourceLocator().getImage("full/obj16/Release")); //$NON-NLS-1$
}
@@ -184,6 +221,7 @@ public class ReleaseItemProvider
final Date date = element.getDate();
final String dateSegment = " (" //$NON-NLS-1$
+ (date != null ? formatter.format(date) : "not yet released") //$NON-NLS-1$
+ + (shouldBeReleased(element) ? " and potentially contains breaking changes" : "") //$NON-NLS-1$//$NON-NLS-2$
+ ")"; //$NON-NLS-1$
final String labelSegment = element.getLabel() != null ? " " + element //$NON-NLS-1$
.getLabel() : ""; //$NON-NLS-1$
@@ -197,7 +235,7 @@ public class ReleaseItemProvider
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
- * @generated
+ * @generated NOT
*/
@Override
public void notifyChanged(Notification notification) {
@@ -209,7 +247,7 @@ public class ReleaseItemProvider
fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
return;
case HistoryPackage.RELEASE__CHANGES:
- fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
+ fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, true));
return;
}
super.notifyChanged(notification);
diff --git a/plugins/org.eclipse.emf.edapt.history.edit/icons/full/obj16/ReleaseBreaking.gif b/plugins/org.eclipse.emf.edapt.history.edit/icons/full/obj16/ReleaseBreaking.gif
new file mode 100644
index 0000000..8545106
--- /dev/null
+++ b/plugins/org.eclipse.emf.edapt.history.edit/icons/full/obj16/ReleaseBreaking.gif
Binary files differ

Back to the top