diff options
Diffstat (limited to 'plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/providers')
6 files changed, 345 insertions, 345 deletions
diff --git a/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/providers/FilterTypeLabelProvider.java b/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/providers/FilterTypeLabelProvider.java index 9ba1b206932..c391447774d 100644 --- a/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/providers/FilterTypeLabelProvider.java +++ b/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/providers/FilterTypeLabelProvider.java @@ -1,65 +1,65 @@ -/*****************************************************************************
- * 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:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.search.ui.providers;
-
-import org.eclipse.emf.ecore.ENamedElement;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService;
-import org.eclipse.papyrus.infra.services.labelprovider.service.impl.LabelProviderServiceImpl;
-import org.eclipse.papyrus.uml.search.ui.Activator;
-import org.eclipse.papyrus.uml.search.ui.Messages;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.uml2.uml.Stereotype;
-
-import com.swtdesigner.ResourceManager;
-
-/**
- *
- * Label provider used by the filter dialog to list available types in a search result
- *
- */
-public class FilterTypeLabelProvider extends LabelProvider {
-
- @Override
- public Image getImage(Object object) {
- if (object instanceof ENamedElement) {
- String imagePath = "/icons/full/obj16/" + ((ENamedElement) object).getName() + ".gif"; //$NON-NLS-1$ //$NON-NLS-2$
- return ResourceManager.getPluginImage("org.eclipse.uml2.uml.edit", imagePath); //$NON-NLS-1$
- } else if (object instanceof Stereotype) {
- LabelProviderService service = new LabelProviderServiceImpl();
- try {
- service.startService();
- return service.getLabelProvider().getImage(object);
- } catch (ServiceException e) {
- Activator.log.warn(Messages.FilterTypeLabelProvider_0 + object);
- return null;
- }
- } else {
- return null;
- }
-
- }
-
- @Override
- public String getText(Object object) {
- if (object instanceof ENamedElement) {
- return ((ENamedElement) object).getName();
- } else if (object instanceof Stereotype) {
- return ((Stereotype) object).getName();
- } else {
- return ""; //$NON-NLS-1$
- }
- }
-}
+/***************************************************************************** + * 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: + * CEA LIST - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.search.ui.providers; + +import org.eclipse.emf.ecore.ENamedElement; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.papyrus.infra.core.services.ServiceException; +import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService; +import org.eclipse.papyrus.infra.services.labelprovider.service.impl.LabelProviderServiceImpl; +import org.eclipse.papyrus.uml.search.ui.Activator; +import org.eclipse.papyrus.uml.search.ui.Messages; +import org.eclipse.swt.graphics.Image; +import org.eclipse.uml2.uml.Stereotype; + +import com.swtdesigner.ResourceManager; + +/** + * + * Label provider used by the filter dialog to list available types in a search result + * + */ +public class FilterTypeLabelProvider extends LabelProvider { + + @Override + public Image getImage(Object object) { + if (object instanceof ENamedElement) { + String imagePath = "/icons/full/obj16/" + ((ENamedElement) object).getName() + ".gif"; //$NON-NLS-1$ //$NON-NLS-2$ + return ResourceManager.getPluginImage("org.eclipse.uml2.uml.edit", imagePath); //$NON-NLS-1$ + } else if (object instanceof Stereotype) { + LabelProviderService service = new LabelProviderServiceImpl(); + try { + service.startService(); + return service.getLabelProvider().getImage(object); + } catch (ServiceException e) { + Activator.log.warn(Messages.FilterTypeLabelProvider_0 + object); + return null; + } + } else { + return null; + } + + } + + @Override + public String getText(Object object) { + if (object instanceof ENamedElement) { + return ((ENamedElement) object).getName(); + } else if (object instanceof Stereotype) { + return ((Stereotype) object).getName(); + } else { + return ""; //$NON-NLS-1$ + } + } +} diff --git a/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/providers/IResultContentProvider.java b/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/providers/IResultContentProvider.java index dc9c05d04b6..4d507e98b9c 100644 --- a/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/providers/IResultContentProvider.java +++ b/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/providers/IResultContentProvider.java @@ -1,47 +1,47 @@ -/*****************************************************************************
- * 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:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.search.ui.providers;
-
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.jface.viewers.AbstractTreeViewer;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.papyrus.views.search.results.AbstractResultEntry;
-import org.eclipse.search.ui.text.AbstractTextSearchResult;
-
-/**
- *
- * Interface of the ResultContentProvider extension point that contributors must implement
- *
- */
-public interface IResultContentProvider {
-
- /**
- * Based on inputElement, add content to the resultHierarchy. Contributors must read the results to identify the elements they can process and add
- * the corresponding content to the hierarchy
- *
- * @param inputElement
- * the results
- *
- * @param resultHierarchy
- * the hierarchy to contribute to
- */
- public void getHierarchy(AbstractTextSearchResult inputElement, Set<AbstractResultEntry> resultHierarchy);
-
- public void initialize(AbstractTextSearchResult inputElement, Map<Object, Set<Object>> fChildrenMap, ITreeContentProvider treeContentProvider, AbstractTreeViewer viewer);
-
- public void elementsChanged(Object[] updatedElements, AbstractTextSearchResult inputElement, Map<Object, Set<Object>> fChildrenMap, ITreeContentProvider treeContentProvider, AbstractTreeViewer viewer);
-
-}
+/***************************************************************************** + * 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: + * CEA LIST - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.search.ui.providers; + +import java.util.Map; +import java.util.Set; + +import org.eclipse.jface.viewers.AbstractTreeViewer; +import org.eclipse.jface.viewers.ITreeContentProvider; +import org.eclipse.papyrus.views.search.results.AbstractResultEntry; +import org.eclipse.search.ui.text.AbstractTextSearchResult; + +/** + * + * Interface of the ResultContentProvider extension point that contributors must implement + * + */ +public interface IResultContentProvider { + + /** + * Based on inputElement, add content to the resultHierarchy. Contributors must read the results to identify the elements they can process and add + * the corresponding content to the hierarchy + * + * @param inputElement + * the results + * + * @param resultHierarchy + * the hierarchy to contribute to + */ + public void getHierarchy(AbstractTextSearchResult inputElement, Set<AbstractResultEntry> resultHierarchy); + + public void initialize(AbstractTextSearchResult inputElement, Map<Object, Set<Object>> fChildrenMap, ITreeContentProvider treeContentProvider, AbstractTreeViewer viewer); + + public void elementsChanged(Object[] updatedElements, AbstractTextSearchResult inputElement, Map<Object, Set<Object>> fChildrenMap, ITreeContentProvider treeContentProvider, AbstractTreeViewer viewer); + +} diff --git a/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/providers/OCLContextContentProvider.java b/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/providers/OCLContextContentProvider.java index 44cd9a9876e..72d5831424f 100644 --- a/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/providers/OCLContextContentProvider.java +++ b/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/providers/OCLContextContentProvider.java @@ -1,58 +1,58 @@ -package org.eclipse.papyrus.uml.search.ui.providers;
-
-import java.util.ArrayList;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.papyrus.infra.core.resource.ModelSet;
-import org.eclipse.papyrus.infra.core.resource.NotFoundException;
-import org.eclipse.papyrus.uml.tools.model.UmlModel;
-
-
-public class OCLContextContentProvider implements ITreeContentProvider {
-
- public void dispose() {
-
-
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
-
-
- }
-
- public Object[] getElements(Object inputElement) {
- ArrayList<EObject> result = new ArrayList<EObject>();
- if (inputElement instanceof ModelSet) {
- UmlModel root = (UmlModel) ((ModelSet) inputElement).getModel(UmlModel.MODEL_ID);
- try {
- result.add(root.lookupRoot());
- } catch (NotFoundException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- return result.toArray();
- }
-
- public Object[] getChildren(Object parentElement) {
- ArrayList<EObject> result = new ArrayList<EObject>();
- if (parentElement instanceof EObject) {
- result.addAll(((EObject) parentElement).eContents());
- }
-
- return result.toArray();
- }
-
- public Object getParent(Object element) {
-
- return null;
- }
-
- public boolean hasChildren(Object element) {
- return getChildren(element).length == 0 ? false : true;
-
- }
-
-}
+package org.eclipse.papyrus.uml.search.ui.providers; + +import java.util.ArrayList; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.jface.viewers.ITreeContentProvider; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.papyrus.infra.core.resource.ModelSet; +import org.eclipse.papyrus.infra.core.resource.NotFoundException; +import org.eclipse.papyrus.uml.tools.model.UmlModel; + + +public class OCLContextContentProvider implements ITreeContentProvider { + + public void dispose() { + + + } + + public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { + + + } + + public Object[] getElements(Object inputElement) { + ArrayList<EObject> result = new ArrayList<EObject>(); + if (inputElement instanceof ModelSet) { + UmlModel root = (UmlModel) ((ModelSet) inputElement).getModel(UmlModel.MODEL_ID); + try { + result.add(root.lookupRoot()); + } catch (NotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + return result.toArray(); + } + + public Object[] getChildren(Object parentElement) { + ArrayList<EObject> result = new ArrayList<EObject>(); + if (parentElement instanceof EObject) { + result.addAll(((EObject) parentElement).eContents()); + } + + return result.toArray(); + } + + public Object getParent(Object element) { + + return null; + } + + public boolean hasChildren(Object element) { + return getChildren(element).length == 0 ? false : true; + + } + +} diff --git a/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/providers/ParticipantTypeAttribute.java b/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/providers/ParticipantTypeAttribute.java index e787c4948f2..7e61b50a255 100644 --- a/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/providers/ParticipantTypeAttribute.java +++ b/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/providers/ParticipantTypeAttribute.java @@ -1,30 +1,30 @@ -package org.eclipse.papyrus.uml.search.ui.providers;
-
-import org.eclipse.emf.ecore.EObject;
-
-
-public class ParticipantTypeAttribute extends ParticipantTypeElement {
-
- ParticipantTypeElement parent;
-
- public ParticipantTypeAttribute(EObject element, ParticipantTypeElement type) {
- super(element);
- this.parent = type;
- }
-
-
- public ParticipantTypeElement getParent() {
- return parent;
- }
-
-
- public void setType(ParticipantTypeElement parent) {
- this.parent = parent;
- }
-
- @Override
- public String getText() {
-
- return super.getText();
- }
-}
+package org.eclipse.papyrus.uml.search.ui.providers; + +import org.eclipse.emf.ecore.EObject; + + +public class ParticipantTypeAttribute extends ParticipantTypeElement { + + ParticipantTypeElement parent; + + public ParticipantTypeAttribute(EObject element, ParticipantTypeElement type) { + super(element); + this.parent = type; + } + + + public ParticipantTypeElement getParent() { + return parent; + } + + + public void setType(ParticipantTypeElement parent) { + this.parent = parent; + } + + @Override + public String getText() { + + return super.getText(); + } +} diff --git a/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/providers/ParticipantTypeContentProvider.java b/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/providers/ParticipantTypeContentProvider.java index ae72eb05a66..c244c7d11e0 100644 --- a/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/providers/ParticipantTypeContentProvider.java +++ b/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/providers/ParticipantTypeContentProvider.java @@ -1,92 +1,92 @@ -/*****************************************************************************
- * 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:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.search.ui.providers;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-
-/**
- *
- * A content provider for a ePackage
- *
- */
-public class ParticipantTypeContentProvider implements ITreeContentProvider {
-
-
-
-
- private HashMap<ParticipantTypeElement, List<ParticipantTypeAttribute>> participantsList = new HashMap<ParticipantTypeElement, List<ParticipantTypeAttribute>>();
-
-
-
-
- public ParticipantTypeContentProvider() {
- }
-
- public void dispose() {
-
- }
-
- @SuppressWarnings("unchecked")
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- participantsList = (HashMap<ParticipantTypeElement, List<ParticipantTypeAttribute>>) newInput;
- }
-
- public Object[] getElements(Object inputElement) {
-
-
- List<Object> result = new ArrayList<Object>();
-
- if (inputElement instanceof HashMap) {
- return ((HashMap<?,?>) inputElement).keySet().toArray();
- }
-
-
- return result.toArray();
- }
-
- public Object[] getChildren(Object parentElement) {
- if (parentElement instanceof ParticipantTypeElement) {
- if (!(parentElement instanceof ParticipantTypeAttribute)) {
- return participantsList.get(parentElement).toArray();
- }
- }
- return null;
-
- }
-
- public Object getParent(Object element) {
-
-
- return null;
-
- }
-
- public boolean hasChildren(Object element) {
- if (element instanceof ParticipantTypeAttribute) {
- return false;
- } else {
- if (getChildren(element).length > 0) {
- return true;
- } else {
- return false;
- }
- }
-
- }
-}
+/***************************************************************************** + * 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: + * CEA LIST - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.search.ui.providers; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import org.eclipse.jface.viewers.ITreeContentProvider; +import org.eclipse.jface.viewers.Viewer; + +/** + * + * A content provider for a ePackage + * + */ +public class ParticipantTypeContentProvider implements ITreeContentProvider { + + + + + private HashMap<ParticipantTypeElement, List<ParticipantTypeAttribute>> participantsList = new HashMap<ParticipantTypeElement, List<ParticipantTypeAttribute>>(); + + + + + public ParticipantTypeContentProvider() { + } + + public void dispose() { + + } + + @SuppressWarnings("unchecked") + public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { + participantsList = (HashMap<ParticipantTypeElement, List<ParticipantTypeAttribute>>) newInput; + } + + public Object[] getElements(Object inputElement) { + + + List<Object> result = new ArrayList<Object>(); + + if (inputElement instanceof HashMap) { + return ((HashMap<?,?>) inputElement).keySet().toArray(); + } + + + return result.toArray(); + } + + public Object[] getChildren(Object parentElement) { + if (parentElement instanceof ParticipantTypeElement) { + if (!(parentElement instanceof ParticipantTypeAttribute)) { + return participantsList.get(parentElement).toArray(); + } + } + return null; + + } + + public Object getParent(Object element) { + + + return null; + + } + + public boolean hasChildren(Object element) { + if (element instanceof ParticipantTypeAttribute) { + return false; + } else { + if (getChildren(element).length > 0) { + return true; + } else { + return false; + } + } + + } +} diff --git a/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/providers/ParticipantTypeElement.java b/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/providers/ParticipantTypeElement.java index 7243c76304a..a93094a9ebb 100644 --- a/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/providers/ParticipantTypeElement.java +++ b/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/providers/ParticipantTypeElement.java @@ -1,53 +1,53 @@ -package org.eclipse.papyrus.uml.search.ui.providers;
-
-import org.eclipse.emf.ecore.ENamedElement;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.uml2.uml.NamedElement;
-
-
-public class ParticipantTypeElement {
-
- boolean isChecked;
-
- EObject element;
-
-
-
- public EObject getElement() {
- return element;
- }
-
-
-
- public void setElement(EObject element) {
- this.element = element;
- }
-
-
- public ParticipantTypeElement(EObject element) {
- super();
- this.element = element;
- isChecked = false;
- }
-
-
- public boolean isChecked() {
- return isChecked;
- }
-
-
- public void setChecked(boolean isChecked) {
- this.isChecked = isChecked;
- }
-
-
- public String getText() {
- if (element instanceof NamedElement) {
- return ((NamedElement) element).getName();
- } else if (element instanceof ENamedElement) {
- return ((ENamedElement) element).getName();
- }
- return null;
- }
-
-}
+package org.eclipse.papyrus.uml.search.ui.providers; + +import org.eclipse.emf.ecore.ENamedElement; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.uml2.uml.NamedElement; + + +public class ParticipantTypeElement { + + boolean isChecked; + + EObject element; + + + + public EObject getElement() { + return element; + } + + + + public void setElement(EObject element) { + this.element = element; + } + + + public ParticipantTypeElement(EObject element) { + super(); + this.element = element; + isChecked = false; + } + + + public boolean isChecked() { + return isChecked; + } + + + public void setChecked(boolean isChecked) { + this.isChecked = isChecked; + } + + + public String getText() { + if (element instanceof NamedElement) { + return ((NamedElement) element).getName(); + } else if (element instanceof ENamedElement) { + return ((ENamedElement) element).getName(); + } + return null; + } + +} |