diff options
Diffstat (limited to 'plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter/src')
5 files changed, 255 insertions, 221 deletions
diff --git a/plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter/src/org/eclipse/papyrus/uml/profile/drafter/ProfileFunctions.java b/plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter/src/org/eclipse/papyrus/uml/profile/drafter/ProfileFunctions.java index d8e1c7e1d30..6cad7e38a12 100644 --- a/plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter/src/org/eclipse/papyrus/uml/profile/drafter/ProfileFunctions.java +++ b/plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter/src/org/eclipse/papyrus/uml/profile/drafter/ProfileFunctions.java @@ -1,93 +1,95 @@ -/*****************************************************************************
- * Copyright (c) 2014 Cedric Dumoulin.
- *
- *
- * 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:
- * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.uml.profile.drafter;
-
-import org.eclipse.uml2.uml.Profile;
-import org.eclipse.uml2.uml.ProfileApplication;
-import org.eclipse.uml2.uml.Stereotype;
-
-import com.google.common.base.Function;
-
-
-/**
- * Set of utilities {@link Function} for collections of {@link Profile}.
- *
- * @author cedric dumoulin
- *
- */
-public class ProfileFunctions {
-
- public static ProfileFunctions INSTANCE = new ProfileFunctions();
-
- public static Function<ProfileApplication, Profile> PROFILE_APPLICATION_GETAPPLIEDPROFILE = INSTANCE.new ProfileApplicationProfile();
- public static Function<ProfileApplication, String> PROFILE_APPLICATION_PROFILE_NAME = INSTANCE.new ProfileApplicationProfileName();
- public static Function<ProfileApplication, String> PROFILE_APPLICATION_PROFILE_QUALIFIEDNAME = INSTANCE.new ProfileApplicationProfileQualifiedName();
- public static Function<Stereotype, String> STEROTYPE_NAME = INSTANCE.new StereotypeName();
- public static Function<Stereotype, String> STEROTYPE_QUALIFIEDNAME = INSTANCE.new StereotypeQualifiedName();
-
- /**
- * function {@link ProfileApplication#getAppliedProfile()}
- *
- */
- public class ProfileApplicationProfile implements Function<ProfileApplication, Profile> {
-
- public Profile apply(ProfileApplication input) {
- return input.getAppliedProfile();
- };
- }
-
- /**
- * function {@link ProfileApplication#getAppliedProfile()}
- *
- */
- public class ProfileApplicationProfileName implements Function<ProfileApplication, String> {
-
- public String apply(ProfileApplication input) {
- return input.getAppliedProfile().getName();
- };
- }
-
- /**
- * function {@link ProfileApplication#getAppliedProfile()}
- *
- */
- public class ProfileApplicationProfileQualifiedName implements Function<ProfileApplication, String> {
-
- public String apply(ProfileApplication input) {
- return input.getAppliedProfile().getQualifiedName();
- };
- }
-
- /**
- * function {@link ProfileApplication#getAppliedProfile()}
- *
- */
- public class StereotypeName implements Function<Stereotype, String> {
-
- public String apply(Stereotype input) {
- return input.getName();
- };
- }
- /**
- * function {@link ProfileApplication#getAppliedProfile()}
- *
- */
- public class StereotypeQualifiedName implements Function<Stereotype, String> {
-
- public String apply(Stereotype input) {
- return input.getQualifiedName();
- };
- }
-}
+/***************************************************************************** + * Copyright (c) 2014 Cedric Dumoulin. + * + * + * 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: + * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.profile.drafter; + +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.uml2.uml.Profile; +import org.eclipse.uml2.uml.ProfileApplication; +import org.eclipse.uml2.uml.Stereotype; + +import com.google.common.base.Function; + + +/** + * Set of utilities {@link Function} for collections of {@link Profile}. + * + * @author cedric dumoulin + * + */ +public class ProfileFunctions { + + public static ProfileFunctions INSTANCE = new ProfileFunctions(); + + public static Function<ProfileApplication, Profile> PROFILE_APPLICATION_GETAPPLIEDPROFILE = INSTANCE.new ProfileApplicationProfile(); + public static Function<ProfileApplication, String> PROFILE_APPLICATION_PROFILE_NAME = INSTANCE.new ProfileApplicationProfileName(); + public static Function<ProfileApplication, String> PROFILE_APPLICATION_PROFILE_QUALIFIEDNAME = INSTANCE.new ProfileApplicationProfileQualifiedName(); + public static Function<Stereotype, String> STEROTYPE_NAME = INSTANCE.new StereotypeName(); + public static Function<Stereotype, String> STEROTYPE_QUALIFIEDNAME = INSTANCE.new StereotypeQualifiedName(); + + /** + * function {@link ProfileApplication#getAppliedProfile()} + * + */ + public class ProfileApplicationProfile implements Function<ProfileApplication, Profile> { + + public Profile apply(ProfileApplication input) { + return input.getAppliedProfile(); + }; + } + + /** + * function {@link ProfileApplication#getAppliedProfile()} + * + */ + public class ProfileApplicationProfileName implements Function<ProfileApplication, String> { + + public String apply(ProfileApplication input) { + return UMLLabelInternationalization.getInstance().getLabel(input.getAppliedProfile()); + }; + } + + /** + * function {@link ProfileApplication#getAppliedProfile()} + * + */ + public class ProfileApplicationProfileQualifiedName implements Function<ProfileApplication, String> { + + public String apply(ProfileApplication input) { + return input.getAppliedProfile().getQualifiedName(); + }; + } + + /** + * function {@link ProfileApplication#getAppliedProfile()} + * + */ + public class StereotypeName implements Function<Stereotype, String> { + + public String apply(Stereotype input) { + return UMLLabelInternationalization.getInstance().getKeyword(input); + }; + } + /** + * function {@link ProfileApplication#getAppliedProfile()} + * + */ + public class StereotypeQualifiedName implements Function<Stereotype, String> { + + public String apply(Stereotype input) { + return input.getQualifiedName(); + }; + } +} diff --git a/plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter/src/org/eclipse/papyrus/uml/profile/drafter/ui/contentassist/StereotypeContentProvider.java b/plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter/src/org/eclipse/papyrus/uml/profile/drafter/ui/contentassist/StereotypeContentProvider.java index 2a17a76f44b..6dd567e9843 100644 --- a/plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter/src/org/eclipse/papyrus/uml/profile/drafter/ui/contentassist/StereotypeContentProvider.java +++ b/plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter/src/org/eclipse/papyrus/uml/profile/drafter/ui/contentassist/StereotypeContentProvider.java @@ -1,86 +1,88 @@ -/*****************************************************************************
- * Copyright (c) 2014 Cedric Dumoulin.
- *
- *
- * 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:
- * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.uml.profile.drafter.ui.contentassist;
-
-import org.eclipse.jface.fieldassist.IContentProposal;
-import org.eclipse.uml2.uml.Stereotype;
-
-
-/**
- * Field assist {@link IContentProposal} .
- * This implementation is used to render one proposal of a {@link Stereotype}
- *
- * @author cedric dumoulin
- *
- */
-public class StereotypeContentProvider implements IContentProposal, Comparable<StereotypeContentProvider> {
-
- /**
- * The stereotype that is render.
- */
- private Stereotype stereotype;
-
-
- /**
- * Constructor.
- *
- * @param stereotype
- */
- public StereotypeContentProvider(Stereotype stereotype) {
- this.stereotype = stereotype;
- }
-
- /**
- * @see org.eclipse.jface.fieldassist.IContentProposal#getContent()
- *
- * @return
- */
- public String getContent() {
- return stereotype.getName();
- }
-
- /**
- * @see org.eclipse.jface.fieldassist.IContentProposal#getCursorPosition()
- *
- * @return
- */
- public int getCursorPosition() {
- return getLabel().length();
- }
-
- /**
- * @see org.eclipse.jface.fieldassist.IContentProposal#getLabel()
- *
- * @return
- */
- public String getLabel() {
- return stereotype.getName();
- }
-
- /**
- * @see org.eclipse.jface.fieldassist.IContentProposal#getDescription()
- *
- * @return
- */
- public String getDescription() {
- // TODO Auto-generated method stub
- return stereotype.getKeyword();
- }
-
- public int compareTo(StereotypeContentProvider o) {
- return this.getLabel().compareTo(o.getLabel());
- }
-
-}
+/***************************************************************************** + * Copyright (c) 2014 Cedric Dumoulin. + * + * + * 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: + * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.profile.drafter.ui.contentassist; + +import org.eclipse.jface.fieldassist.IContentProposal; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.uml2.uml.Stereotype; + + +/** + * Field assist {@link IContentProposal} . + * This implementation is used to render one proposal of a {@link Stereotype} + * + * @author cedric dumoulin + * + */ +public class StereotypeContentProvider implements IContentProposal, Comparable<StereotypeContentProvider> { + + /** + * The stereotype that is render. + */ + private Stereotype stereotype; + + + /** + * Constructor. + * + * @param stereotype + */ + public StereotypeContentProvider(Stereotype stereotype) { + this.stereotype = stereotype; + } + + /** + * @see org.eclipse.jface.fieldassist.IContentProposal#getContent() + * + * @return + */ + public String getContent() { + return UMLLabelInternationalization.getInstance().getKeyword(stereotype); + } + + /** + * @see org.eclipse.jface.fieldassist.IContentProposal#getCursorPosition() + * + * @return + */ + public int getCursorPosition() { + return getLabel().length(); + } + + /** + * @see org.eclipse.jface.fieldassist.IContentProposal#getLabel() + * + * @return + */ + public String getLabel() { + return UMLLabelInternationalization.getInstance().getKeyword(stereotype); + } + + /** + * @see org.eclipse.jface.fieldassist.IContentProposal#getDescription() + * + * @return + */ + public String getDescription() { + // TODO Auto-generated method stub + return stereotype.getKeyword(); + } + + public int compareTo(StereotypeContentProvider o) { + return this.getLabel().compareTo(o.getLabel()); + } + +} diff --git a/plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter/src/org/eclipse/papyrus/uml/profile/drafter/ui/dialog/PropertiesEditorWidget.java b/plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter/src/org/eclipse/papyrus/uml/profile/drafter/ui/dialog/PropertiesEditorWidget.java index 762c1bbce9d..e02ae90964c 100644 --- a/plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter/src/org/eclipse/papyrus/uml/profile/drafter/ui/dialog/PropertiesEditorWidget.java +++ b/plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter/src/org/eclipse/papyrus/uml/profile/drafter/ui/dialog/PropertiesEditorWidget.java @@ -1,3 +1,16 @@ +/***************************************************************************** + * 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 + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ package org.eclipse.papyrus.uml.profile.drafter.ui.dialog; import java.util.List; @@ -31,6 +44,7 @@ import org.eclipse.jface.viewers.TableViewerColumn; import org.eclipse.jface.viewers.TextCellEditor; import org.eclipse.jface.viewers.Viewer; import org.eclipse.jface.viewers.ViewerCell; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.papyrus.uml.profile.drafter.ui.model.AccessibleTypeCatalog; import org.eclipse.papyrus.uml.profile.drafter.ui.model.ITypeCatalog; import org.eclipse.papyrus.uml.profile.drafter.ui.model.MemberKind; @@ -327,7 +341,7 @@ public class PropertiesEditorWidget { public String getText(Object element) { Property property = (Property)element; - return property.getName(); + return UMLLabelInternationalization.getInstance().getLabel(property); } } @@ -344,7 +358,7 @@ public class PropertiesEditorWidget { Object value = selectedElement.getValue((Stereotype)property.getOwner(), property.getName()); if(value instanceof NamedElement) { - return ((NamedElement)value).getName(); + return UMLLabelInternationalization.getInstance().getLabel(((NamedElement)value)); } // TODO // collections and arrays diff --git a/plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter/src/org/eclipse/papyrus/uml/profile/drafter/ui/dialog/TaggedValuesEditorWidget.java b/plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter/src/org/eclipse/papyrus/uml/profile/drafter/ui/dialog/TaggedValuesEditorWidget.java index 45d2db0b338..6d9a13103e3 100644 --- a/plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter/src/org/eclipse/papyrus/uml/profile/drafter/ui/dialog/TaggedValuesEditorWidget.java +++ b/plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter/src/org/eclipse/papyrus/uml/profile/drafter/ui/dialog/TaggedValuesEditorWidget.java @@ -1,3 +1,16 @@ +/***************************************************************************** + * 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 + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ package org.eclipse.papyrus.uml.profile.drafter.ui.dialog; import org.eclipse.jface.viewers.ColumnLabelProvider; @@ -5,6 +18,7 @@ import org.eclipse.jface.viewers.ITreeContentProvider; import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.jface.viewers.TreeViewerColumn; import org.eclipse.jface.viewers.Viewer; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; @@ -146,7 +160,7 @@ public class TaggedValuesEditorWidget { public String getText(Object element) { Property property = (Property)element; - return property.getName(); + return UMLLabelInternationalization.getInstance().getLabel(property); } } @@ -163,7 +177,7 @@ public class TaggedValuesEditorWidget { Object value = selectedElement.getValue((Stereotype)property.getOwner(), property.getName()); if(value instanceof NamedElement) { - return ((NamedElement)value).getName(); + return UMLLabelInternationalization.getInstance().getLabel(((NamedElement)value)); } // TODO // collections and arrays diff --git a/plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter/src/org/eclipse/papyrus/uml/profile/drafter/ui/providers/TypeLabelProvider.java b/plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter/src/org/eclipse/papyrus/uml/profile/drafter/ui/providers/TypeLabelProvider.java index db8350cb357..2d2066b37c0 100644 --- a/plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter/src/org/eclipse/papyrus/uml/profile/drafter/ui/providers/TypeLabelProvider.java +++ b/plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter/src/org/eclipse/papyrus/uml/profile/drafter/ui/providers/TypeLabelProvider.java @@ -1,38 +1,40 @@ -/*****************************************************************************
- * Copyright (c) 2014 Cedric Dumoulin.
- *
- *
- * 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:
- * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.uml.profile.drafter.ui.providers;
-
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.uml2.uml.Type;
-
-
-/**
- * A {@link ILabelProvider} for uml {@link Type}
- * @author cedric dumoulin
- *
- */
-public class TypeLabelProvider extends LabelProvider {
-
-
- @Override
- public String getText(Object element) {
- if(element instanceof Type) {
- return ((Type)element).getName();
- }
-
- return super.getText(element);
- }
-}
+/***************************************************************************** + * Copyright (c) 2014 Cedric Dumoulin. + * + * + * 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: + * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.profile.drafter.ui.providers; + +import org.eclipse.jface.viewers.ILabelProvider; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.uml2.uml.Type; + + +/** + * A {@link ILabelProvider} for uml {@link Type} + * @author cedric dumoulin + * + */ +public class TypeLabelProvider extends LabelProvider { + + + @Override + public String getText(Object element) { + if(element instanceof Type) { + return UMLLabelInternationalization.getInstance().getLabel((Type)element); + } + + return super.getText(element); + } +} |