diff options
Diffstat (limited to 'plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/providers/ElementTypesConfigurationsEventContentProvider.java')
1 files changed, 0 insertions, 161 deletions
diff --git a/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/providers/ElementTypesConfigurationsEventContentProvider.java b/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/providers/ElementTypesConfigurationsEventContentProvider.java deleted file mode 100644 index 54b2d0c9a4e..00000000000 --- a/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/providers/ElementTypesConfigurationsEventContentProvider.java +++ /dev/null @@ -1,161 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2016 CEA LIST and others. - * - * 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: - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ - -package org.eclipse.papyrus.elementtypesconfigurations.developer.providers; - -import java.util.AbstractMap; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Comparator; -import java.util.List; -import java.util.Map; - -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.papyrus.infra.elementtypesconfigurations.notification.ElementTypesConfigurationsEventsChain; -import org.eclipse.papyrus.infra.elementtypesconfigurations.notification.events.AbstractElementTypesConfigurationsEvent; - - -public class ElementTypesConfigurationsEventContentProvider implements ITreeContentProvider { - - /** - * @see org.eclipse.jface.viewers.IContentProvider#dispose() - * - */ - @Override - public void dispose() { - // TODO Auto-generated method stub - - } - - /** - * @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) { - // TODO Auto-generated method stub - - } - - /** - * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object) - * - * @param inputElement - * @return - */ - @Override - public Object[] getElements(Object inputElement) { - List<ElementTypesConfigurationsEventsChain> result = new ArrayList<ElementTypesConfigurationsEventsChain>(); - if (inputElement instanceof List<?>) { - List<?> inputSet = (List<?>) inputElement; - for (Object element : inputSet) { - if (element instanceof ElementTypesConfigurationsEventsChain) { - result.add((ElementTypesConfigurationsEventsChain) element); - } - } - } - - Collections.sort(result, new Comparator<ElementTypesConfigurationsEventsChain>() { - - @Override - public int compare(ElementTypesConfigurationsEventsChain o1, ElementTypesConfigurationsEventsChain o2) { - if (o1.getTimestamp() > o2.getTimestamp()) { - return -1; - } - return 1; - } - }); - - - return result.toArray(); - } - - /** - * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object) - * - * @param parentElement - * @return - */ - @Override - public Object[] getChildren(Object parentElement) { - - - List<Object> result = new ArrayList<Object>(); - if (parentElement instanceof ElementTypesConfigurationsEventsChain) { - ElementTypesConfigurationsEventsChain elementTypesConfigurationsEventsChain = (ElementTypesConfigurationsEventsChain) parentElement; - - List<AbstractElementTypesConfigurationsEvent> adviceRequestConfigurationEvents = elementTypesConfigurationsEventsChain.getAdviceRequestConfigurationEvents(); - if (!adviceRequestConfigurationEvents.isEmpty()) { - result.add(new AbstractMap.SimpleEntry<String, Object>("AdviceRequestConfigurationEvents", adviceRequestConfigurationEvents)); - } - AbstractElementTypesConfigurationsEvent editHelperRequestConfigurationEvent = elementTypesConfigurationsEventsChain.getEditHelperRequestConfigurationEvent(); - if (editHelperRequestConfigurationEvent != null) { - result.add(editHelperRequestConfigurationEvent); - } - List<AbstractElementTypesConfigurationsEvent> adviceApprovalEvents = elementTypesConfigurationsEventsChain.getAdviceApprovalEvents(); - if (!adviceApprovalEvents.isEmpty()) { - result.add(new AbstractMap.SimpleEntry<String, Object>("AdviceApprovalEvents", adviceApprovalEvents)); - } - AbstractElementTypesConfigurationsEvent editHelperApprovalEvent = elementTypesConfigurationsEventsChain.getEditHelperApprovalEvent(); - if (editHelperApprovalEvent != null) { - result.add(editHelperApprovalEvent); - } - List<AbstractElementTypesConfigurationsEvent> beforeAdvicesCommandsEvents = elementTypesConfigurationsEventsChain.getBeforeAdvicesCommandsEvents(); - if (!beforeAdvicesCommandsEvents.isEmpty()) { - result.add(new AbstractMap.SimpleEntry<String, Object>("BeforeAdvicesCommandsEvents", beforeAdvicesCommandsEvents)); - } - AbstractElementTypesConfigurationsEvent editHelperCommandEvent = elementTypesConfigurationsEventsChain.getEditHelperCommandEvent(); - if (editHelperCommandEvent != null) { - result.add(editHelperCommandEvent); - } - List<AbstractElementTypesConfigurationsEvent> afterAdvicesCommandsEvents = elementTypesConfigurationsEventsChain.getAfterAdvicesCommandsEvents(); - if (!afterAdvicesCommandsEvents.isEmpty()) { - result.add(new AbstractMap.SimpleEntry<String, Object>("AfterAdvicesCommandsEvents", afterAdvicesCommandsEvents)); - } - } else if (parentElement instanceof Map.Entry) { - Object value = ((Map.Entry<?, ?>) parentElement).getValue(); - if (value instanceof Collection) { - result.addAll((Collection<?>) value); - } - } - return result.toArray(); - } - - /** - * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object) - * - * @param element - * @return - */ - @Override - public Object getParent(Object element) { - return null; - } - - /** - * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object) - * - * @param element - * @return - */ - @Override - public boolean hasChildren(Object element) { - return getChildren(element).length == 0 ? false : true; - } - -} |