Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.uml.properties.tabbed.profile/src')
-rw-r--r--deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.uml.properties.tabbed.profile/src/org/eclipse/papyrus/uml/properties/tabbed/profile/AbstractViewSection.java109
-rw-r--r--deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.uml.properties.tabbed.profile/src/org/eclipse/papyrus/uml/properties/tabbed/profile/Activator.java71
-rw-r--r--deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.uml.properties.tabbed.profile/src/org/eclipse/papyrus/uml/properties/tabbed/profile/composite/ExprTextComposite.java100
-rw-r--r--deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.uml.properties.tabbed.profile/src/org/eclipse/papyrus/uml/properties/tabbed/profile/composite/ISectionComposite.java45
-rw-r--r--deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.uml.properties.tabbed.profile/src/org/eclipse/papyrus/uml/properties/tabbed/profile/composite/SimpleTextComposite.java233
-rw-r--r--deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.uml.properties.tabbed.profile/src/org/eclipse/papyrus/uml/properties/tabbed/profile/composite/StringModelAccessor.java42
-rw-r--r--deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.uml.properties.tabbed.profile/src/org/eclipse/papyrus/uml/properties/tabbed/profile/composite/StringPropertyModelAccessor.java66
-rw-r--r--deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.uml.properties.tabbed.profile/src/org/eclipse/papyrus/uml/properties/tabbed/profile/composite/TextCompositeWithModelAccessor.java66
-rw-r--r--deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.uml.properties.tabbed.profile/src/org/eclipse/papyrus/uml/properties/tabbed/profile/imagesection/ImageContentSection.java242
-rw-r--r--deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.uml.properties.tabbed.profile/src/org/eclipse/papyrus/uml/properties/tabbed/profile/imagesection/ImageExpressionSection.java82
-rw-r--r--deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.uml.properties.tabbed.profile/src/org/eclipse/papyrus/uml/properties/tabbed/profile/imagesection/ImageFormatSection.java84
-rw-r--r--deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.uml.properties.tabbed.profile/src/org/eclipse/papyrus/uml/properties/tabbed/profile/imagesection/ImageIndexSection.java202
-rw-r--r--deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.uml.properties.tabbed.profile/src/org/eclipse/papyrus/uml/properties/tabbed/profile/imagesection/ImageKindSection.java176
-rw-r--r--deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.uml.properties.tabbed.profile/src/org/eclipse/papyrus/uml/properties/tabbed/profile/imagesection/ImageLocationSection.java84
-rw-r--r--deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.uml.properties.tabbed.profile/src/org/eclipse/papyrus/uml/properties/tabbed/profile/imagesection/ImageSectionFilter.java41
15 files changed, 0 insertions, 1643 deletions
diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.uml.properties.tabbed.profile/src/org/eclipse/papyrus/uml/properties/tabbed/profile/AbstractViewSection.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.uml.properties.tabbed.profile/src/org/eclipse/papyrus/uml/properties/tabbed/profile/AbstractViewSection.java
deleted file mode 100644
index faa58e2eb00..00000000000
--- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.uml.properties.tabbed.profile/src/org/eclipse/papyrus/uml/properties/tabbed/profile/AbstractViewSection.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 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:
- * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.properties.tabbed.profile;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.edit.domain.IEditingDomainProvider;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.views.properties.tabbed.AbstractPropertySection;
-import org.eclipse.uml2.uml.Element;
-
-
-/**
- * Basic Papyrus implementation for property view section. Each section in papyrus should override
- * this section, not {@link AbstractViewSection}.
- */
-public class AbstractViewSection extends AbstractPropertySection {
-
-
- protected org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart editPart;
-
- protected IMultiDiagramEditor editor;
-
- protected TransactionalEditingDomain editingDomain;
-
- protected EObject eObject;
-
- /**
- * {@inheritDoc}
- */
- public void setInput(IWorkbenchPart part, ISelection selection) {
- super.setInput(part, selection);
- Object input = ((IStructuredSelection)selection).getFirstElement();
- // look for modelManager
- if(input instanceof org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart) {
- editPart = ((org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart)input);
- eObject=editPart.resolveSemanticElement();
- }
- else{
- eObject= resolveSemanticObject(input);
-
- }
- if(part instanceof IEditingDomainProvider) {
- editingDomain = (TransactionalEditingDomain)((IEditingDomainProvider)part).getEditingDomain();
-
- }
-
- }
- /**
- * Get the {@link TransactionalEditingDomain} from the {@link IMultiDiagramEditor}.
- * @param editor
- * @return
- */
- protected TransactionalEditingDomain getTransactionalEditingDomain(IMultiDiagramEditor editor) {
- try {
- return editor.getServicesRegistry().getService(TransactionalEditingDomain.class);
- } catch (ServiceException e) {
- // TODO Log instead of showing the trace.
- e.printStackTrace();
- return null;
- }
- }
- /**
- *
- * @return the select uml element of null if not
- */
- protected Element getElement(){
- if(eObject instanceof Element){
- return ((Element)eObject);
- }
- return null;
-
- }
-
- /**
- * Resolve semantic element
- *
- * @param object
- * the object to resolve
- * @return <code>null</code> or the semantic element associated to the specified object
- */
- private EObject resolveSemanticObject(Object object) {
- if (object instanceof EObject) {
- return (EObject) object;
- } else if (object instanceof IAdaptable) {
- IAdaptable adaptable = (IAdaptable) object;
- if (adaptable.getAdapter(EObject.class) != null) {
- return (EObject) adaptable.getAdapter(EObject.class);
- }
- }
- return null;
- }
-}
diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.uml.properties.tabbed.profile/src/org/eclipse/papyrus/uml/properties/tabbed/profile/Activator.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.uml.properties.tabbed.profile/src/org/eclipse/papyrus/uml/properties/tabbed/profile/Activator.java
deleted file mode 100644
index e1abb884b22..00000000000
--- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.uml.properties.tabbed.profile/src/org/eclipse/papyrus/uml/properties/tabbed/profile/Activator.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 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:
- * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.properties.tabbed.profile;
-
-import org.eclipse.papyrus.infra.core.log.LogHelper;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class Activator extends AbstractUIPlugin {
-
- /** The plug-in ID **/
- public static final String PLUGIN_ID = "org.eclipse.papyrus.uml.properties.tabbed.profile"; //$NON-NLS-1$
-
- // The shared instance
- private static Activator plugin;
-
- /** Logging helper */
- public static LogHelper log;
-
- /**
- * The constructor
- */
- public Activator() {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- log = new LogHelper(plugin);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- log = null;
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
- }
-
-}
diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.uml.properties.tabbed.profile/src/org/eclipse/papyrus/uml/properties/tabbed/profile/composite/ExprTextComposite.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.uml.properties.tabbed.profile/src/org/eclipse/papyrus/uml/properties/tabbed/profile/composite/ExprTextComposite.java
deleted file mode 100644
index 09f35f527aa..00000000000
--- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.uml.properties.tabbed.profile/src/org/eclipse/papyrus/uml/properties/tabbed/profile/composite/ExprTextComposite.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 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:
- * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.uml.properties.tabbed.profile.composite;
-
-import org.eclipse.emf.common.command.Command;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
-import org.eclipse.papyrus.uml.tools.utils.ImageUtil;
-import org.eclipse.uml2.common.edit.command.ChangeCommand;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.Image;
-
-
-/**
- * Composite that displays a label and a text area (ex: modification of the name of an element)
- **/
-public class ExprTextComposite extends SimpleTextComposite {
-
-
- protected static final String COMMAND_LABEL = "Edit ";
- protected static final String NOT_COMMIT = "could not commit changes to the model";
-
- /**
- *
- * Constructor.
- *
- * @param label to display in the property view
- */
- public ExprTextComposite(String label) {
- super(label);
- }
-
- /**
- * {@inheritDoc}
- */
- public void refresh() {
- if (isValid(text)) {
- text.setText(getTextFromModel(getElement()));
- }
- }
-
- /**
- * this method should take the text in the text area and modify the model using this information
- */
- public String getTextFromModel(Element element) {
- String txt = "";
- if (element instanceof Image) {
- String expr = ImageUtil.getExpression((Image) element);
- if (expr != null) {
- txt += expr;
- }
- }
-
- return txt;
- }
-
- /**
- * This method should restore the value of the text area for the specified element
- */
- public void setModelFromText(Element element, String newValue) {
- if (element instanceof Image) {
- ImageUtil.setExpression((Image) element, newValue);
- }
- }
-
- /**
- * Apply the new value using the
- */
- public void applyNewValue() {
- final TransactionalEditingDomain domain= EditorUtils.getTransactionalEditingDomain();
- if (domain!=null && isValid(text)) {
- final Runnable runnable = new Runnable() {
-
- /**
- * {@inheritDoc}
- */
- public void run() {
- setModelFromText(getElement(), text.getText().trim());
- }
- };
- Command emfCommand = new ChangeCommand(domain, runnable, COMMAND_LABEL + label);
- domain.getCommandStack().execute(emfCommand);
- EditorUtils.getMultiDiagramEditor().setFocus();
- } else {
- System.err.println( NOT_COMMIT);
- }
- }
-}
diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.uml.properties.tabbed.profile/src/org/eclipse/papyrus/uml/properties/tabbed/profile/composite/ISectionComposite.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.uml.properties.tabbed.profile/src/org/eclipse/papyrus/uml/properties/tabbed/profile/composite/ISectionComposite.java
deleted file mode 100644
index de65b6b99a6..00000000000
--- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.uml.properties.tabbed.profile/src/org/eclipse/papyrus/uml/properties/tabbed/profile/composite/ISectionComposite.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 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:
- * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.properties.tabbed.profile.composite;
-
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-/**
- * this is the interface from composite
- */
-public interface ISectionComposite {
-
- /**
- * Creates the content of the Section.
- *
- * @param factory
- * the factory used to create the widgets for the section
- * @param parent
- * the parent of the composite for this section
- *
- * @return the top level Composite of this section
- */
- public Composite createContent(Composite parent, TabbedPropertySheetWidgetFactory factory);
-
- /**
- * Refresh the contents of the controls displayed in this section.
- */
- public void refresh();
-
- /**
- * Dispose all or part of resources.
- */
- public void dispose();
-}
diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.uml.properties.tabbed.profile/src/org/eclipse/papyrus/uml/properties/tabbed/profile/composite/SimpleTextComposite.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.uml.properties.tabbed.profile/src/org/eclipse/papyrus/uml/properties/tabbed/profile/composite/SimpleTextComposite.java
deleted file mode 100644
index 3e5accbe888..00000000000
--- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.uml.properties.tabbed.profile/src/org/eclipse/papyrus/uml/properties/tabbed/profile/composite/SimpleTextComposite.java
+++ /dev/null
@@ -1,233 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 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:
- * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.uml.properties.tabbed.profile.composite;
-
-import org.eclipse.emf.common.command.Command;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CLabel;
-import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.events.KeyAdapter;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.swt.widgets.Widget;
-import org.eclipse.ui.views.properties.tabbed.AbstractPropertySection;
-import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-import org.eclipse.uml2.common.edit.command.ChangeCommand;
-import org.eclipse.uml2.uml.Element;
-
-
-/**
- * Composite that displays a label and a text area (ex: modification of the name of an element)
- */
-public abstract class SimpleTextComposite implements ISectionComposite {
-
- /** Text Area that displays a property for the current element */
- protected Text text;
-
- /** label to display before the text area */
- protected String label;
-
- /** Label widget to display the label before the text area */
- protected CLabel cLabel;
-
- /** key adapter to listen for CR key or ESC key when editing text */
- final protected KeyAdapter keyAdapter = new EditKeyAdapter();
-
- /** focus listener to detect when the changes need to be stored in the model **/
- final protected FocusListener focusListener = new FocusListener();
-
- /** Element selected in the Papyrus modeler */
- protected Element element;
-
-
- /**
- * Creates a new SimpleTextComposite.
- * @param label the label to display in the property view
- */
- public SimpleTextComposite(String label) {
- // avoid SWT error in case of null label, using the empty string
- this.label = (label != null) ? label : "";
- }
-
- /**
- * returns the element that is selected in Papyrus tool, for which properties are displayed in
- * the property section.
- *
- * @return the element currently selected in Papyrus
- */
- public Element getElement() {
- return element;
- }
-
- /**
- * Sets the element that holds property displayed in property section.
- *
- * @param element
- * the element to set
- */
- public void setElement(Element element) {
- this.element = element;
- }
-
- /**
- * {@inheritDoc}
- */
- public Composite createContent(Composite parent, TabbedPropertySheetWidgetFactory factory) {
- Composite composite = factory.createFlatFormComposite(parent);
-
- text = factory.createText(composite, ""); //$NON-NLS-1$
- FormData data = new FormData();
- data.width = 150;
- data.left = new FormAttachment(0, AbstractPropertySection.STANDARD_LABEL_WIDTH);
- data.right = new FormAttachment(100, -ITabbedPropertyConstants.HSPACE);
- data.top = new FormAttachment(0, 0);
- text.setLayoutData(data);
- text.addKeyListener(keyAdapter);
- text.addFocusListener(focusListener);
-
- cLabel = factory.createCLabel(composite, label); //$NON-NLS-1$
- data = new FormData();
- data.left = new FormAttachment(0, 0);
- data.right = new FormAttachment(text, -ITabbedPropertyConstants.HSPACE);
- data.top = new FormAttachment(text, 0, SWT.CENTER);
- cLabel.setLayoutData(data);
-
- return composite;
- }
-
- /**
- * {@inheritDoc}
- */
- public void refresh() {
- if (isValid(text)) {
- // checkListener ?!
- text.setText(getTextFromModel(getElement()));
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public void dispose() {
- if (isValid(text)) {
- text.removeKeyListener(keyAdapter);
- text.removeFocusListener(focusListener);
- text.dispose();
- }
- if (isValid(cLabel)) {
- cLabel.dispose();
- }
- }
-
- /**
- * this method should take the text in the text area and modify the model using this information
- *@param element the UML element that will be modify
- *@return a string from the model information
- */
- public abstract String getTextFromModel(Element element);
-
- /**
- * This method should restore the value of the text area for the specified element
- * @param element the UML element that will be modified
- * @param newValue the value that will be affected to this element
- */
- public abstract void setModelFromText(Element element, String newValue);
-
- /**
- * checks that a widget is always available and not already disposed
- *
- * @param widget
- * the widget to check
- * @return <code>true</code> if the widget is available
- */
- protected boolean isValid(Widget widget) {
- return (widget != null && !widget.isDisposed());
- }
-
- /**
- * Apply the new value using the
- */
- public void applyNewValue() {
- final TransactionalEditingDomain domain= EditorUtils.getTransactionalEditingDomain();
- if (domain!=null && isValid(text)) {
- final Runnable runnable = new Runnable() {
-
- /**
- * {@inheritDoc}
- */
- public void run() {
- setModelFromText(getElement(), text.getText().trim());
- }
- };
- Command emfCommand = new ChangeCommand(domain, runnable, "Edit " + label);
- domain.getCommandStack().execute(emfCommand);
- EditorUtils.getMultiDiagramEditor().setFocus();
- } else {
- System.err.println( "could not commit changes to the model");
- }
- }
-
- /**
- * Key adapter to listen for enter and esc key
- */
- private class EditKeyAdapter extends KeyAdapter {
-
- /**
- * {@inheritDoc}
- */
- public void keyPressed(KeyEvent e) {
- // close the text editor and copy the data over
- // when the user hits "ENTER"
- switch (e.character) {
- case SWT.CR:
- applyNewValue();
- refresh();
- break;
- case SWT.ESC:
- refresh();
- break;
- default:
- // do nothing
- }
- }
- }
-
- /**
- * Listener for a direct edit manager.
- *
- */
- protected class FocusListener implements org.eclipse.swt.events.FocusListener {
-
- /**
- * @param e
- */
- public void focusGained(FocusEvent e) {
- }
-
- /**
- * @param e
- */
- public void focusLost(FocusEvent e) {
- applyNewValue();
- }
- };
-
-}
diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.uml.properties.tabbed.profile/src/org/eclipse/papyrus/uml/properties/tabbed/profile/composite/StringModelAccessor.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.uml.properties.tabbed.profile/src/org/eclipse/papyrus/uml/properties/tabbed/profile/composite/StringModelAccessor.java
deleted file mode 100644
index 932c1e7090c..00000000000
--- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.uml.properties.tabbed.profile/src/org/eclipse/papyrus/uml/properties/tabbed/profile/composite/StringModelAccessor.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 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:
- * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.uml.properties.tabbed.profile.composite;
-
-import org.eclipse.uml2.uml.Element;
-
-/**
- * Accessor to model elements
- */
-public abstract class StringModelAccessor {
-
- /**
- * This method should restore the value of the text area for the specified element
- *
- * @param element
- * the element to read
- * @return the string corresponding to the value to edit
- */
- public abstract String getTextFromModel(Element element);
-
- /**
- * this method should take the text in the text area and modify the model using this information
- *
- * @param element
- * the element to modify
- * @param newValue
- * the text corresponding to the new value to edit
- */
- public abstract void setModelFromText(Element element, String newValue);
-}
diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.uml.properties.tabbed.profile/src/org/eclipse/papyrus/uml/properties/tabbed/profile/composite/StringPropertyModelAccessor.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.uml.properties.tabbed.profile/src/org/eclipse/papyrus/uml/properties/tabbed/profile/composite/StringPropertyModelAccessor.java
deleted file mode 100644
index 55eb670cb40..00000000000
--- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.uml.properties.tabbed.profile/src/org/eclipse/papyrus/uml/properties/tabbed/profile/composite/StringPropertyModelAccessor.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 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:
- * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.uml.properties.tabbed.profile.composite;
-
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.uml2.uml.Element;
-
-/**
- * Model accessor to modify a property of an element, using its feature id
- */
-public class StringPropertyModelAccessor extends StringModelAccessor {
-
- /** Feature ID */
- final private int featureID;
-
- /**
- * Creates a new StringPropertyModelAccessor.
- *
- * @param featureID
- * the id of the feature to modify
- */
- public StringPropertyModelAccessor(int featureID) {
- this.featureID = featureID;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getTextFromModel(Element element) {
- if (element != null) {
- final EStructuralFeature featureToEdit = element.eClass().getEStructuralFeature(featureID);
- Object o = element.eGet(featureToEdit);
- if (o != null) {
- return o.toString();
- }
- }
- return "";
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void setModelFromText(Element element, String newValue) {
- if (element != null) {
- final EStructuralFeature featureToEdit = element.eClass().getEStructuralFeature(featureID);
- if (featureToEdit != null) {
- element.eSet(featureToEdit, newValue);
- }
- }
- }
-
-}
diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.uml.properties.tabbed.profile/src/org/eclipse/papyrus/uml/properties/tabbed/profile/composite/TextCompositeWithModelAccessor.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.uml.properties.tabbed.profile/src/org/eclipse/papyrus/uml/properties/tabbed/profile/composite/TextCompositeWithModelAccessor.java
deleted file mode 100644
index 4fe01c292be..00000000000
--- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.uml.properties.tabbed.profile/src/org/eclipse/papyrus/uml/properties/tabbed/profile/composite/TextCompositeWithModelAccessor.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 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:
- * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.uml.properties.tabbed.profile.composite;
-
-import org.eclipse.uml2.uml.Element;
-
-/**
- * Simple implementation of the {@link SimpleTextComposite} class, using a specified model accessor
- * to read and modify the model
- */
-public class TextCompositeWithModelAccessor extends SimpleTextComposite {
-
- /** model accessor to use with this composite */
- private StringModelAccessor accessor;
-
- /**
- * Creates a new TextCompositeWithModelAccessor.
- *
- * @param label
- * the label to display before the text
- * @param accessor
- * the model accessor to use with this composite
- */
- public TextCompositeWithModelAccessor(String label, StringModelAccessor accessor) {
- super(label);
- assert (accessor != null) : "Accessor should not be null for this composite";
- this.accessor = accessor;
- }
-
- /**
- * Creates a new TextCompositeWithModelAccessor.
- *
- * @param label
- * the label to display before the text
- * @param featureID
- * the id of the feature to modify
- */
- public TextCompositeWithModelAccessor(String label, int featureID) {
- super(label);
- this.accessor = new StringPropertyModelAccessor(featureID);
- assert (accessor != null) : "Accessor should not be null for this composite";
- }
-
- @Override
- public String getTextFromModel(Element element) {
- return accessor.getTextFromModel(element);
- }
-
- @Override
- public void setModelFromText(Element element, String newValue) {
- accessor.setModelFromText(element, newValue);
- }
-
-}
diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.uml.properties.tabbed.profile/src/org/eclipse/papyrus/uml/properties/tabbed/profile/imagesection/ImageContentSection.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.uml.properties.tabbed.profile/src/org/eclipse/papyrus/uml/properties/tabbed/profile/imagesection/ImageContentSection.java
deleted file mode 100644
index 7ef5a4378b4..00000000000
--- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.uml.properties.tabbed.profile/src/org/eclipse/papyrus/uml/properties/tabbed/profile/imagesection/ImageContentSection.java
+++ /dev/null
@@ -1,242 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 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:
- * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.properties.tabbed.profile.imagesection;
-
-import java.io.File;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
-import org.eclipse.papyrus.uml.properties.tabbed.profile.AbstractViewSection;
-import org.eclipse.papyrus.uml.properties.tabbed.profile.Activator;
-import org.eclipse.papyrus.uml.tools.utils.ImageUtil;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CLabel;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
-import org.eclipse.uml2.uml.Image;
-
-
-/**
- * this class display section to display serialize in XML the image
- */
-public class ImageContentSection extends AbstractViewSection {
-
- /**
- *
- */
- private Button browseButton, removeButton;
-
- /**
- *
- */
- private MouseListener browseButtonListener, removeButtonListener;
-
- /**
- *
- */
- private String sectionLabel = "Content:";
-
- /**
- *
- */
- private final org.eclipse.swt.graphics.Image remove_img = Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/delete.gif").createImage();
-
- /**
- *
- */
- private final org.eclipse.swt.graphics.Image add_img_32 = Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/Add_32x32.gif").createImage();
-
- /**
- *
- *
- * @param tabbedPropertySheetPage
- * @param parent
- */
- @Override
- public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) {
-
- super.createControls(parent, tabbedPropertySheetPage);
- final Composite composite = getWidgetFactory().createFlatFormComposite(parent);
- FormData data;
-
- browseButton = getWidgetFactory().createButton(composite, "", SWT.PUSH);
- browseButton.setImage(add_img_32);
- removeButton = getWidgetFactory().createButton(composite, "", SWT.PUSH);
- removeButton.setImage(remove_img);
- CLabel iconLabel = getWidgetFactory().createCLabel(composite, sectionLabel);
-
- // browseButton layout
- data = new FormData();
- data.left = new FormAttachment(0, 85);
- data.top = new FormAttachment(0, ITabbedPropertyConstants.HSPACE);
- browseButton.setLayoutData(data);
-
- // removeButton layout
- data = new FormData();
- data.left = new FormAttachment(browseButton, ITabbedPropertyConstants.HSPACE);
- data.top = new FormAttachment(browseButton, 0, SWT.CENTER);
- removeButton.setLayoutData(data);
-
- // iconLabel layout
- data = new FormData();
- data.left = new FormAttachment(0, 0);
- data.top = new FormAttachment(browseButton, 0, SWT.CENTER);
- iconLabel.setLayoutData(data);
-
- browseButton.addMouseListener(browseButtonListener = new MouseListener() {
-
- public void mouseDoubleClick(MouseEvent e) {
- }
-
- public void mouseDown(MouseEvent e) {
- }
-
- public void mouseUp(MouseEvent e) {
- FileDialog fd = new FileDialog(composite.getShell());
- String extensions[] = { "*.jpg;*.bmp;*.ico;*.gif;*.png;*.wmf;*.emf" };
- fd.setFilterExtensions(extensions);
- String iconSelected = fd.open();
-
- // No image selected
- if(iconSelected == null) {
- return;
- }
-
- if(getElement() instanceof Image) {
-
- final File imgFile = new File(iconSelected);
-
- TransactionalEditingDomain dom = EditorUtils.getTransactionalEditingDomain();
- AbstractTransactionalCommand operation = new AbstractTransactionalCommand(dom, "Set Image content", null) {
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- try {
- ImageUtil.setContent((Image)getElement(), imgFile);
- } catch (Exception ex) {
- return CommandResult.newErrorCommandResult(ex);
- }
- return CommandResult.newOKCommandResult();
- }
- };
-
- dom.getCommandStack().execute(new GMFtoEMFCommandWrapper(operation));
-
- refresh();
- }
- }
- });
-
- removeButton.addMouseListener(removeButtonListener = new MouseListener() {
-
- public void mouseDoubleClick(MouseEvent e) {
- }
-
- public void mouseDown(MouseEvent e) {
- }
-
- public void mouseUp(MouseEvent e) {
- // Erase image content
- if(getElement() instanceof Image) {
-
- TransactionalEditingDomain dom = EditorUtils.getTransactionalEditingDomain();
- AbstractTransactionalCommand operation = new AbstractTransactionalCommand(dom, "Remove Image content", null) {
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- try {
- ImageUtil.setContent((Image)getElement(), null);
- } catch (Exception ex) {
- return CommandResult.newErrorCommandResult(ex);
- }
- return CommandResult.newOKCommandResult();
- }
- };
- dom.getCommandStack().execute(new GMFtoEMFCommandWrapper(operation));
-
- refresh();
- }
- }
- });
- }
-
- /**
- *
- * @see org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#refresh()
- *
- */
- public void refresh() {
- if(!browseButton.isDisposed()) {
-
- /* initialization of buttons enabling */
- if(!(getElement() instanceof Image)) {
- return;
- }
-
- // Get Image content
- org.eclipse.swt.graphics.Image image = null;
-
- try {
- image = ImageUtil.getContent((Image)getElement());
- } catch (Exception e) {
- Activator.log.error(e);
- }
-
- // Refresh text
- if(image != null) {
- // Resize icon to 32x32
- org.eclipse.swt.graphics.Image resizedIcon = new org.eclipse.swt.graphics.Image(image.getDevice(), image.getImageData().scaledTo(32, 32));
- browseButton.setImage(resizedIcon);
- removeButton.setEnabled(true);
-
- } else {
- browseButton.setImage(add_img_32);
- removeButton.setEnabled(false);
- }
- }
- }
-
- /**
- *
- * @see org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#dispose()
- *
- */
- public void dispose() {
- super.dispose();
- if(browseButton != null && !browseButton.isDisposed())
- browseButton.removeMouseListener(browseButtonListener);
- if(removeButton != null && !removeButton.isDisposed())
- removeButton.removeMouseListener(removeButtonListener);
- }
-
-}
diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.uml.properties.tabbed.profile/src/org/eclipse/papyrus/uml/properties/tabbed/profile/imagesection/ImageExpressionSection.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.uml.properties.tabbed.profile/src/org/eclipse/papyrus/uml/properties/tabbed/profile/imagesection/ImageExpressionSection.java
deleted file mode 100644
index 4ac4b096208..00000000000
--- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.uml.properties.tabbed.profile/src/org/eclipse/papyrus/uml/properties/tabbed/profile/imagesection/ImageExpressionSection.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 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:
- * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.properties.tabbed.profile.imagesection;
-
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.papyrus.uml.properties.tabbed.profile.AbstractViewSection;
-import org.eclipse.papyrus.uml.properties.tabbed.profile.composite.ExprTextComposite;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
-
-
-/**
- * The Image Location section on the element tab.
- */
-public class ImageExpressionSection extends AbstractViewSection {
-
- /**
- *
- */
- private ExprTextComposite exprComposite;
-
- /**
- *
- * @see org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#createControls(org.eclipse.swt.widgets.Composite, org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage)
- *
- * @param parent
- * @param tabbedPropertySheetPage
- */
- @Override
- public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) {
-
- super.createControls(parent, tabbedPropertySheetPage);
- exprComposite = new ExprTextComposite("Expr:");
- exprComposite.createContent(parent, tabbedPropertySheetPage.getWidgetFactory());
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void refresh() {
- exprComposite.refresh();
- }
-
- /**
- *
- * @see org.eclipse.papyrus.uml.properties.tabbed.profile.AbstractViewSection#setInput(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
- *
- * @param part
- * @param selection
- */
- @Override
- public void setInput(IWorkbenchPart part, ISelection selection) {
- super.setInput(part, selection);
-
- if (getElement()!=null) {
- exprComposite.setElement(getElement());
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public void dispose() {
- super.dispose();
- if (exprComposite != null) {
- exprComposite.dispose();
- }
- }
-} \ No newline at end of file
diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.uml.properties.tabbed.profile/src/org/eclipse/papyrus/uml/properties/tabbed/profile/imagesection/ImageFormatSection.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.uml.properties.tabbed.profile/src/org/eclipse/papyrus/uml/properties/tabbed/profile/imagesection/ImageFormatSection.java
deleted file mode 100644
index 9b04e7ed84a..00000000000
--- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.uml.properties.tabbed.profile/src/org/eclipse/papyrus/uml/properties/tabbed/profile/imagesection/ImageFormatSection.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 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:
- * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.properties.tabbed.profile.imagesection;
-
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.papyrus.uml.properties.tabbed.profile.AbstractViewSection;
-import org.eclipse.papyrus.uml.properties.tabbed.profile.composite.TextCompositeWithModelAccessor;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
-import org.eclipse.uml2.uml.UMLPackage;
-
-
-/**
- * The Image Format section on the element tab.
- */
-public class ImageFormatSection extends AbstractViewSection {
-
- /**
- *
- */
- private TextCompositeWithModelAccessor formatComposite;
-
- /**
- *
- * @see org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#createControls(org.eclipse.swt.widgets.Composite, org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage)
- *
- * @param parent
- * @param tabbedPropertySheetPage
- */
- public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) {
-
- super.createControls(parent, tabbedPropertySheetPage);
- formatComposite = new TextCompositeWithModelAccessor("Format:", UMLPackage.IMAGE__FORMAT);
- formatComposite.createContent(parent, tabbedPropertySheetPage.getWidgetFactory());
- }
-
- /**
- *
- * @see org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#refresh()
- *
- */
- public void refresh() {
- formatComposite.refresh();
- }
-
- /**
- *
- * @see org.eclipse.papyrus.uml.properties.tabbed.profile.AbstractViewSection#setInput(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
- *
- * @param part
- * @param selection
- */
- public void setInput(IWorkbenchPart part, ISelection selection) {
- super.setInput(part, selection);
- if (getElement()!=null) {
- formatComposite.setElement(getElement());
- }
- }
-
- /**
- *
- * @see org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#dispose()
- *
- */
-
- public void dispose() {
- super.dispose();
- if (formatComposite != null) {
- formatComposite.dispose();
- }
- }
-} \ No newline at end of file
diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.uml.properties.tabbed.profile/src/org/eclipse/papyrus/uml/properties/tabbed/profile/imagesection/ImageIndexSection.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.uml.properties.tabbed.profile/src/org/eclipse/papyrus/uml/properties/tabbed/profile/imagesection/ImageIndexSection.java
deleted file mode 100644
index 947d1f522f4..00000000000
--- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.uml.properties.tabbed.profile/src/org/eclipse/papyrus/uml/properties/tabbed/profile/imagesection/ImageIndexSection.java
+++ /dev/null
@@ -1,202 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 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:
- * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.properties.tabbed.profile.imagesection;
-
-import org.eclipse.emf.common.command.Command;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
-import org.eclipse.papyrus.uml.properties.tabbed.profile.AbstractViewSection;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.custom.CLabel;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
-import org.eclipse.uml2.common.edit.command.ChangeCommand;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.Image;
-import org.eclipse.uml2.uml.Stereotype;
-
-
-/**
- * The Class QualifiedNameAppearanceSection allow users to customize the display of qualified name.
- *
- */
-public class ImageIndexSection extends AbstractViewSection {
-
- /**
- * The index of the image in the Stereotype
- */
- private CCombo comboIndex;
-
- /**
- * Section Label
- */
- private CLabel label;
-
- /**
- * The combo listener.
- */
- private final SelectionListener indexSelectionListener = new IndexSelectionListener();
-
- /**
- * Creates the controls.
- *
- * @param tabbedPropertySheetPage
- * the tabbed property sheet page
- * @param parent
- * the parent
- */
- @Override
- public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) {
-
- super.createControls(parent, tabbedPropertySheetPage);
- Composite composite = getWidgetFactory().createFlatFormComposite(parent);
- FormData data;
-
- // // Combo creation
- comboIndex = getWidgetFactory().createCCombo(composite);
- refreshComboValues();
- data = new FormData();
- data.left = new FormAttachment(0, 85);
- data.top = new FormAttachment(0, 0);
- comboIndex.setLayoutData(data);
- comboIndex.addSelectionListener(indexSelectionListener);
-
- // Label creation
- label = getWidgetFactory().createCLabel(composite, "Index:");
- data = new FormData();
- data.left = new FormAttachment(0, ITabbedPropertyConstants.HSPACE);
- data.top = new FormAttachment(comboIndex, 0, SWT.CENTER);
- label.setLayoutData(data);
- }
-
- /**
- * Refresh the possible values of the combo box
- */
- private void refreshComboValues() {
- comboIndex.removeAll();
-
- if ((getElement() != null) && (getElement() instanceof Image)) {
-
- Image image = (Image) getElement();
-
- // Retrieve parent Stereotype
- Element owner = image.getOwner();
- if ((owner != null) && (owner instanceof Stereotype)) {
- Stereotype stOwner = ((Stereotype) owner);
-
- for (int i = 0; i < stOwner.getIcons().size(); i++) {
- comboIndex.add("" + i);
- }
- }
- }
- }
-
- /**
- *
- * @see org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#refresh()
- *
- */
- @Override
- public void refresh() {
- if ((!comboIndex.isDisposed())) {
-
- comboIndex.removeSelectionListener(indexSelectionListener);
-
- refreshComboValues();
-
- // setSelection
- if ((getElement() != null) && (getElement() instanceof Image)) {
-
- Image image = (Image) getElement();
-
- // Retrieve parent Stereotype
- Element owner = image.getOwner();
- if ((owner != null) && (owner instanceof Stereotype)) {
- Stereotype stOwner = ((Stereotype) owner);
-
- int currentIndex = stOwner.getIcons().indexOf(image);
- comboIndex.select(currentIndex);
- }
- }
-
- // Add the listener back
- comboIndex.addSelectionListener(indexSelectionListener);
- }
- }
-
- /**
- *
- * @see org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#dispose()
- *
- */
- public void dispose() {
- super.dispose();
- if (comboIndex != null && !comboIndex.isDisposed())
- comboIndex.removeSelectionListener(indexSelectionListener);
- }
-
- protected class IndexSelectionListener implements SelectionListener {
-
- public void widgetSelected(SelectionEvent e) {
-
-
-
-
-
-
-
- final TransactionalEditingDomain domain= EditorUtils.getTransactionalEditingDomain();
- if (domain!=null ) {
- final Runnable runnable = new Runnable() {
-
- /**
- * {@inheritDoc}
- */
- public void run() {
- if ((getElement() != null) && (getElement() instanceof Image)) {
-
- Image image = (Image) getElement();
-
- // Retrieve parent Stereotype
- Element owner = image.getOwner();
- if ((owner != null) && (owner instanceof Stereotype)) {
- Stereotype stOwner = ((Stereotype) owner);
- int currentIndex = stOwner.getIcons().indexOf(image);
- int newIndex = comboIndex.getSelectionIndex();
- if (currentIndex != newIndex) {
- stOwner.getIcons().move(newIndex, image);
- }
- }
- }}};
- Command emfCommand = new ChangeCommand(domain, runnable, "Edit " + label);
- domain.getCommandStack().execute(emfCommand);
- EditorUtils.getMultiDiagramEditor().setFocus();
- }
-
- else {
- System.err.println( "could not commit changes to the model");
- }
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
-
- }
- }
-}
diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.uml.properties.tabbed.profile/src/org/eclipse/papyrus/uml/properties/tabbed/profile/imagesection/ImageKindSection.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.uml.properties.tabbed.profile/src/org/eclipse/papyrus/uml/properties/tabbed/profile/imagesection/ImageKindSection.java
deleted file mode 100644
index caf7ee584b7..00000000000
--- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.uml.properties.tabbed.profile/src/org/eclipse/papyrus/uml/properties/tabbed/profile/imagesection/ImageKindSection.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 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:
- * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.properties.tabbed.profile.imagesection;
-
-import org.eclipse.emf.common.command.Command;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
-import org.eclipse.papyrus.uml.properties.tabbed.profile.AbstractViewSection;
-import org.eclipse.papyrus.uml.tools.utils.ImageUtil;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.custom.CLabel;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
-import org.eclipse.uml2.common.edit.command.ChangeCommand;
-import org.eclipse.uml2.uml.Image;
-
-
-/**
- * The Class QualifiedNameAppearanceSection allow users to customize the display of qualified name.
- *
- */
-public class ImageKindSection extends AbstractViewSection {
-
- /**
- * The index of the image in the Stereotype
- */
- private CCombo comboKind;
-
- /**
- * Section Label
- */
- private CLabel label;
-
- /**
- * The combo listener.
- */
- private final SelectionListener selectionListener = new KindSelectionListener();
-
- /**
- * Creates the controls.
- *
- * @param tabbedPropertySheetPage
- * the tabbed property sheet page
- * @param parent
- * the parent
- */
- @Override
- public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) {
-
- super.createControls(parent, tabbedPropertySheetPage);
- Composite composite = getWidgetFactory().createFlatFormComposite(parent);
- FormData data;
-
- // // Combo creation
- comboKind = getWidgetFactory().createCCombo(composite);
- addComboValues();
- data = new FormData();
- data.left = new FormAttachment(0, 85);
- data.top = new FormAttachment(0, 0);
- comboKind.setLayoutData(data);
- comboKind.addSelectionListener(selectionListener);
-
- // Label creation
- label = getWidgetFactory().createCLabel(composite, "Kind:");
- data = new FormData();
- data.left = new FormAttachment(0, ITabbedPropertyConstants.HSPACE);
- data.top = new FormAttachment(comboKind, 0, SWT.CENTER);
- label.setLayoutData(data);
- }
-
- /**
- * Add the possible values of the combo box
- */
- private void addComboValues() {
- comboKind.add("undefined");
- comboKind.add("icon");
- comboKind.add("shape");
- }
-
- /**
- *
- * @see org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#refresh()
- *
- */
- @Override
- public void refresh() {
- if ((!comboKind.isDisposed())) {
-
- // setSelection
- if ((getElement() != null) && (getElement() instanceof Image)) {
-
- Image image = (Image) getElement();
- String kind = ImageUtil.getKind(image);
-
- if ("icon".equals(kind)) {
- comboKind.select(1);
- } else if ("shape".equals(kind)) {
- comboKind.select(2);
- } else { // undefined
- comboKind.select(0);
- }
- }
- }
- }
-
- /**
- *
- * @see org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#dispose()
- *
- */
- public void dispose() {
- super.dispose();
- if (comboKind != null && !comboKind.isDisposed())
- comboKind.removeSelectionListener(selectionListener);
- }
-
- protected class KindSelectionListener implements SelectionListener {
-
- public void widgetSelected(SelectionEvent e) {
-
- if ((getElement() != null) && (getElement() instanceof Image)) {
-
- final TransactionalEditingDomain domain= EditorUtils.getTransactionalEditingDomain();
- if (domain!=null ) {
- final Runnable runnable = new Runnable() {
-
- /**
- * {@inheritDoc}
- */
- public void run() {
- Image image = (Image) getElement();
- String kind = ImageUtil.getKind(image);
- int newIndex = comboKind.getSelectionIndex();
- if ((newIndex == 1) && !("icon".equals(kind))) {
- ImageUtil.setKind(image, "icon");
- } else if ((newIndex == 2) && !("shape".equals(kind))) {
- ImageUtil.setKind(image, "shape");
- } else {
- ImageUtil.setKind(image, "");
- }
- }
- };
- Command emfCommand = new ChangeCommand(domain, runnable, "Edit " + label);
- domain.getCommandStack().execute(emfCommand);
- EditorUtils.getMultiDiagramEditor().setFocus();
- } else {
- System.err.println( "could not commit changes to the model");
- }
-
-
-
- }
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
-
- }
- }
-}
diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.uml.properties.tabbed.profile/src/org/eclipse/papyrus/uml/properties/tabbed/profile/imagesection/ImageLocationSection.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.uml.properties.tabbed.profile/src/org/eclipse/papyrus/uml/properties/tabbed/profile/imagesection/ImageLocationSection.java
deleted file mode 100644
index 4133187c4e9..00000000000
--- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.uml.properties.tabbed.profile/src/org/eclipse/papyrus/uml/properties/tabbed/profile/imagesection/ImageLocationSection.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 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:
- * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.properties.tabbed.profile.imagesection;
-
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.papyrus.uml.properties.tabbed.profile.AbstractViewSection;
-import org.eclipse.papyrus.uml.properties.tabbed.profile.composite.TextCompositeWithModelAccessor;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
-import org.eclipse.uml2.uml.UMLPackage;
-
-
-/**
- * The Image Location section on the element tab.
- */
-public class ImageLocationSection extends AbstractViewSection {
-
- /**
- *
- */
- private TextCompositeWithModelAccessor locationComposite;
-
- /**
- *
- * @see org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#createControls(org.eclipse.swt.widgets.Composite, org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage)
- *
- * @param parent
- * @param tabbedPropertySheetPage
- */
- public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) {
-
- super.createControls(parent, tabbedPropertySheetPage);
- locationComposite = new TextCompositeWithModelAccessor("Location:", UMLPackage.IMAGE__LOCATION);
- locationComposite.createContent(parent, tabbedPropertySheetPage.getWidgetFactory());
- }
-
- /**
- *
- * @see org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#refresh()
- *
- */
- public void refresh() {
- locationComposite.refresh();
- }
-
- /**
- *
- * @see org.eclipse.papyrus.uml.properties.tabbed.profile.AbstractViewSection#setInput(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
- *
- * @param part
- * @param selection
- */
- public void setInput(IWorkbenchPart part, ISelection selection) {
- super.setInput(part, selection);
-
- if (getElement()!=null) {
- locationComposite.setElement(getElement());
- }
- }
-
- /**
- *
- * @see org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#dispose()
- *
- */
- public void dispose() {
- super.dispose();
- if (locationComposite != null) {
- locationComposite.dispose();
- }
- }
-} \ No newline at end of file
diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.uml.properties.tabbed.profile/src/org/eclipse/papyrus/uml/properties/tabbed/profile/imagesection/ImageSectionFilter.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.uml.properties.tabbed.profile/src/org/eclipse/papyrus/uml/properties/tabbed/profile/imagesection/ImageSectionFilter.java
deleted file mode 100644
index 38d86a0850f..00000000000
--- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.uml.properties.tabbed.profile/src/org/eclipse/papyrus/uml/properties/tabbed/profile/imagesection/ImageSectionFilter.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 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:
- * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.properties.tabbed.profile.imagesection;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
-import org.eclipse.jface.viewers.IFilter;
-import org.eclipse.uml2.uml.Image;
-
-
-/**
- * filter in order to display property view only for the element IMAGE of UML
- */
-public class ImageSectionFilter implements IFilter {
-
- /**
- * {@inheritDoc}
- */
- public boolean select(Object object) {
- if(object instanceof GraphicalEditPart && ((GraphicalEditPart)object).getNotationView().getElement() instanceof Image) {
- return true;
- }
-
- if(object instanceof IAdaptable && ((IAdaptable)object).getAdapter(EObject.class) instanceof Image) {
- return true;
- }
- return false;
- }
-}

Back to the top