diff options
Diffstat (limited to 'extraplugins/cdo')
236 files changed, 3799 insertions, 3003 deletions
diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src-gen/org/eclipse/papyrus/cdo/internal/core/repositories/RepositoriesFactory.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src-gen/org/eclipse/papyrus/cdo/internal/core/repositories/RepositoriesFactory.java index 95b088898bb..7a8126085a7 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src-gen/org/eclipse/papyrus/cdo/internal/core/repositories/RepositoriesFactory.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src-gen/org/eclipse/papyrus/cdo/internal/core/repositories/RepositoriesFactory.java @@ -1,14 +1,14 @@ /** * 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.cdo.internal.core.repositories; @@ -19,6 +19,7 @@ import org.eclipse.emf.ecore.EFactory; * The <b>Factory</b> for the model. * It provides a create method for each non-abstract class of the model. * <!-- end-user-doc --> + * * @see org.eclipse.papyrus.cdo.internal.core.repositories.RepositoriesPackage * @generated */ @@ -27,6 +28,7 @@ public interface RepositoriesFactory extends EFactory { * The singleton instance of the factory. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ RepositoriesFactory eINSTANCE = org.eclipse.papyrus.cdo.internal.core.repositories.impl.RepositoriesFactoryImpl.init(); @@ -35,6 +37,7 @@ public interface RepositoriesFactory extends EFactory { * Returns a new object of class '<em>Repository Registry</em>'. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @return a new object of class '<em>Repository Registry</em>'. * @generated */ @@ -44,6 +47,7 @@ public interface RepositoriesFactory extends EFactory { * Returns a new object of class '<em>Repository</em>'. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @return a new object of class '<em>Repository</em>'. * @generated */ @@ -53,9 +57,10 @@ public interface RepositoriesFactory extends EFactory { * Returns the package supported by this factory. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @return the package supported by this factory. * @generated */ RepositoriesPackage getRepositoriesPackage(); -} //RepositoriesFactory +} // RepositoriesFactory diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src-gen/org/eclipse/papyrus/cdo/internal/core/repositories/RepositoriesPackage.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src-gen/org/eclipse/papyrus/cdo/internal/core/repositories/RepositoriesPackage.java index f4a4423e9ec..e28c048800b 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src-gen/org/eclipse/papyrus/cdo/internal/core/repositories/RepositoriesPackage.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src-gen/org/eclipse/papyrus/cdo/internal/core/repositories/RepositoriesPackage.java @@ -1,14 +1,14 @@ /** * 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.cdo.internal.core.repositories; @@ -22,13 +22,14 @@ import org.eclipse.emf.ecore.EReference; * The <b>Package</b> for the model. * It contains accessors for the meta objects to represent * <ul> - * <li>each class,</li> - * <li>each feature of each class,</li> - * <li>each operation of each class,</li> - * <li>each enum,</li> - * <li>and each data type</li> + * <li>each class,</li> + * <li>each feature of each class,</li> + * <li>each operation of each class,</li> + * <li>each enum,</li> + * <li>and each data type</li> * </ul> * <!-- end-user-doc --> + * * @see org.eclipse.papyrus.cdo.internal.core.repositories.RepositoriesFactory * @model kind="package" * @generated @@ -38,6 +39,7 @@ public interface RepositoriesPackage extends EPackage { * The package name. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ String eNAME = "repositories"; //$NON-NLS-1$ @@ -46,6 +48,7 @@ public interface RepositoriesPackage extends EPackage { * The package namespace URI. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ String eNS_URI = "http://www.eclipse.org/papyrus/repositories/0.10.0"; //$NON-NLS-1$ @@ -54,6 +57,7 @@ public interface RepositoriesPackage extends EPackage { * The package namespace name. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ String eNS_PREFIX = "repositories"; //$NON-NLS-1$ @@ -62,6 +66,7 @@ public interface RepositoriesPackage extends EPackage { * The singleton instance of the package. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ RepositoriesPackage eINSTANCE = org.eclipse.papyrus.cdo.internal.core.repositories.impl.RepositoriesPackageImpl.init(); @@ -70,6 +75,7 @@ public interface RepositoriesPackage extends EPackage { * The meta object id for the '{@link org.eclipse.papyrus.cdo.internal.core.repositories.impl.RepositoryRegistryImpl <em>Repository Registry</em>}' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @see org.eclipse.papyrus.cdo.internal.core.repositories.impl.RepositoryRegistryImpl * @see org.eclipse.papyrus.cdo.internal.core.repositories.impl.RepositoriesPackageImpl#getRepositoryRegistry() * @generated @@ -80,6 +86,7 @@ public interface RepositoriesPackage extends EPackage { * The feature id for the '<em><b>Repositories</b></em>' containment reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated * @ordered */ @@ -89,6 +96,7 @@ public interface RepositoriesPackage extends EPackage { * The number of structural features of the '<em>Repository Registry</em>' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated * @ordered */ @@ -98,6 +106,7 @@ public interface RepositoriesPackage extends EPackage { * The number of operations of the '<em>Repository Registry</em>' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated * @ordered */ @@ -107,6 +116,7 @@ public interface RepositoriesPackage extends EPackage { * The meta object id for the '{@link org.eclipse.papyrus.cdo.internal.core.repositories.impl.RepositoryImpl <em>Repository</em>}' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @see org.eclipse.papyrus.cdo.internal.core.repositories.impl.RepositoryImpl * @see org.eclipse.papyrus.cdo.internal.core.repositories.impl.RepositoriesPackageImpl#getRepository() * @generated @@ -117,6 +127,7 @@ public interface RepositoriesPackage extends EPackage { * The feature id for the '<em><b>Name</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated * @ordered */ @@ -126,6 +137,7 @@ public interface RepositoriesPackage extends EPackage { * The feature id for the '<em><b>URL</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated * @ordered */ @@ -135,6 +147,7 @@ public interface RepositoriesPackage extends EPackage { * The feature id for the '<em><b>Description</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated * @ordered */ @@ -144,6 +157,7 @@ public interface RepositoriesPackage extends EPackage { * The feature id for the '<em><b>UUID</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated * @ordered */ @@ -153,6 +167,7 @@ public interface RepositoriesPackage extends EPackage { * The number of structural features of the '<em>Repository</em>' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated * @ordered */ @@ -162,6 +177,7 @@ public interface RepositoriesPackage extends EPackage { * The number of operations of the '<em>Repository</em>' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated * @ordered */ @@ -172,6 +188,7 @@ public interface RepositoriesPackage extends EPackage { * Returns the meta object for class '{@link org.eclipse.papyrus.cdo.internal.core.repositories.RepositoryRegistry <em>Repository Registry</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @return the meta object for class '<em>Repository Registry</em>'. * @see org.eclipse.papyrus.cdo.internal.core.repositories.RepositoryRegistry * @generated @@ -182,6 +199,7 @@ public interface RepositoriesPackage extends EPackage { * Returns the meta object for the containment reference list '{@link org.eclipse.papyrus.cdo.internal.core.repositories.RepositoryRegistry#getRepositories <em>Repositories</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @return the meta object for the containment reference list '<em>Repositories</em>'. * @see org.eclipse.papyrus.cdo.internal.core.repositories.RepositoryRegistry#getRepositories() * @see #getRepositoryRegistry() @@ -193,6 +211,7 @@ public interface RepositoriesPackage extends EPackage { * Returns the meta object for class '{@link org.eclipse.papyrus.cdo.internal.core.repositories.Repository <em>Repository</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @return the meta object for class '<em>Repository</em>'. * @see org.eclipse.papyrus.cdo.internal.core.repositories.Repository * @generated @@ -203,6 +222,7 @@ public interface RepositoriesPackage extends EPackage { * Returns the meta object for the attribute '{@link org.eclipse.papyrus.cdo.internal.core.repositories.Repository#getName <em>Name</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @return the meta object for the attribute '<em>Name</em>'. * @see org.eclipse.papyrus.cdo.internal.core.repositories.Repository#getName() * @see #getRepository() @@ -214,6 +234,7 @@ public interface RepositoriesPackage extends EPackage { * Returns the meta object for the attribute '{@link org.eclipse.papyrus.cdo.internal.core.repositories.Repository#getURL <em>URL</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @return the meta object for the attribute '<em>URL</em>'. * @see org.eclipse.papyrus.cdo.internal.core.repositories.Repository#getURL() * @see #getRepository() @@ -225,6 +246,7 @@ public interface RepositoriesPackage extends EPackage { * Returns the meta object for the attribute '{@link org.eclipse.papyrus.cdo.internal.core.repositories.Repository#getDescription <em>Description</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @return the meta object for the attribute '<em>Description</em>'. * @see org.eclipse.papyrus.cdo.internal.core.repositories.Repository#getDescription() * @see #getRepository() @@ -236,6 +258,7 @@ public interface RepositoriesPackage extends EPackage { * Returns the meta object for the attribute '{@link org.eclipse.papyrus.cdo.internal.core.repositories.Repository#getUUID <em>UUID</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @return the meta object for the attribute '<em>UUID</em>'. * @see org.eclipse.papyrus.cdo.internal.core.repositories.Repository#getUUID() * @see #getRepository() @@ -247,6 +270,7 @@ public interface RepositoriesPackage extends EPackage { * Returns the factory that creates the instances of the model. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @return the factory that creates the instances of the model. * @generated */ @@ -256,13 +280,14 @@ public interface RepositoriesPackage extends EPackage { * <!-- begin-user-doc --> * Defines literals for the meta objects that represent * <ul> - * <li>each class,</li> - * <li>each feature of each class,</li> - * <li>each operation of each class,</li> - * <li>each enum,</li> - * <li>and each data type</li> + * <li>each class,</li> + * <li>each feature of each class,</li> + * <li>each operation of each class,</li> + * <li>each enum,</li> + * <li>and each data type</li> * </ul> * <!-- end-user-doc --> + * * @generated */ interface Literals { @@ -270,6 +295,7 @@ public interface RepositoriesPackage extends EPackage { * The meta object literal for the '{@link org.eclipse.papyrus.cdo.internal.core.repositories.impl.RepositoryRegistryImpl <em>Repository Registry</em>}' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @see org.eclipse.papyrus.cdo.internal.core.repositories.impl.RepositoryRegistryImpl * @see org.eclipse.papyrus.cdo.internal.core.repositories.impl.RepositoriesPackageImpl#getRepositoryRegistry() * @generated @@ -280,6 +306,7 @@ public interface RepositoriesPackage extends EPackage { * The meta object literal for the '<em><b>Repositories</b></em>' containment reference list feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ EReference REPOSITORY_REGISTRY__REPOSITORIES = eINSTANCE.getRepositoryRegistry_Repositories(); @@ -288,6 +315,7 @@ public interface RepositoriesPackage extends EPackage { * The meta object literal for the '{@link org.eclipse.papyrus.cdo.internal.core.repositories.impl.RepositoryImpl <em>Repository</em>}' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @see org.eclipse.papyrus.cdo.internal.core.repositories.impl.RepositoryImpl * @see org.eclipse.papyrus.cdo.internal.core.repositories.impl.RepositoriesPackageImpl#getRepository() * @generated @@ -298,6 +326,7 @@ public interface RepositoriesPackage extends EPackage { * The meta object literal for the '<em><b>Name</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ EAttribute REPOSITORY__NAME = eINSTANCE.getRepository_Name(); @@ -306,6 +335,7 @@ public interface RepositoriesPackage extends EPackage { * The meta object literal for the '<em><b>URL</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ EAttribute REPOSITORY__URL = eINSTANCE.getRepository_URL(); @@ -314,6 +344,7 @@ public interface RepositoriesPackage extends EPackage { * The meta object literal for the '<em><b>Description</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ EAttribute REPOSITORY__DESCRIPTION = eINSTANCE.getRepository_Description(); @@ -322,10 +353,11 @@ public interface RepositoriesPackage extends EPackage { * The meta object literal for the '<em><b>UUID</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ EAttribute REPOSITORY__UUID = eINSTANCE.getRepository_UUID(); } -} //RepositoriesPackage +} // RepositoriesPackage diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src-gen/org/eclipse/papyrus/cdo/internal/core/repositories/Repository.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src-gen/org/eclipse/papyrus/cdo/internal/core/repositories/Repository.java index 06754111071..6110c2a6825 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src-gen/org/eclipse/papyrus/cdo/internal/core/repositories/Repository.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src-gen/org/eclipse/papyrus/cdo/internal/core/repositories/Repository.java @@ -1,14 +1,14 @@ /** * 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.cdo.internal.core.repositories; @@ -22,10 +22,10 @@ import org.eclipse.emf.ecore.EObject; * <p> * The following features are supported: * <ul> - * <li>{@link org.eclipse.papyrus.cdo.internal.core.repositories.Repository#getName <em>Name</em>}</li> - * <li>{@link org.eclipse.papyrus.cdo.internal.core.repositories.Repository#getURL <em>URL</em>}</li> - * <li>{@link org.eclipse.papyrus.cdo.internal.core.repositories.Repository#getDescription <em>Description</em>}</li> - * <li>{@link org.eclipse.papyrus.cdo.internal.core.repositories.Repository#getUUID <em>UUID</em>}</li> + * <li>{@link org.eclipse.papyrus.cdo.internal.core.repositories.Repository#getName <em>Name</em>}</li> + * <li>{@link org.eclipse.papyrus.cdo.internal.core.repositories.Repository#getURL <em>URL</em>}</li> + * <li>{@link org.eclipse.papyrus.cdo.internal.core.repositories.Repository#getDescription <em>Description</em>}</li> + * <li>{@link org.eclipse.papyrus.cdo.internal.core.repositories.Repository#getUUID <em>UUID</em>}</li> * </ul> * </p> * @@ -38,10 +38,10 @@ public interface Repository extends EObject { * Returns the value of the '<em><b>Name</b></em>' attribute. * <!-- begin-user-doc --> * <p> - * If the meaning of the '<em>Name</em>' attribute isn't clear, - * there really should be more of a description here... + * If the meaning of the '<em>Name</em>' attribute isn't clear, there really should be more of a description here... * </p> * <!-- end-user-doc --> + * * @return the value of the '<em>Name</em>' attribute. * @see #setName(String) * @see org.eclipse.papyrus.cdo.internal.core.repositories.RepositoriesPackage#getRepository_Name() @@ -54,7 +54,9 @@ public interface Repository extends EObject { * Sets the value of the '{@link org.eclipse.papyrus.cdo.internal.core.repositories.Repository#getName <em>Name</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> - * @param value the new value of the '<em>Name</em>' attribute. + * + * @param value + * the new value of the '<em>Name</em>' attribute. * @see #getName() * @generated */ @@ -64,10 +66,10 @@ public interface Repository extends EObject { * Returns the value of the '<em><b>URL</b></em>' attribute. * <!-- begin-user-doc --> * <p> - * If the meaning of the '<em>URL</em>' attribute isn't clear, - * there really should be more of a description here... + * If the meaning of the '<em>URL</em>' attribute isn't clear, there really should be more of a description here... * </p> * <!-- end-user-doc --> + * * @return the value of the '<em>URL</em>' attribute. * @see #setURL(String) * @see org.eclipse.papyrus.cdo.internal.core.repositories.RepositoriesPackage#getRepository_URL() @@ -81,7 +83,9 @@ public interface Repository extends EObject { * Sets the value of the '{@link org.eclipse.papyrus.cdo.internal.core.repositories.Repository#getURL <em>URL</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> - * @param value the new value of the '<em>URL</em>' attribute. + * + * @param value + * the new value of the '<em>URL</em>' attribute. * @see #getURL() * @generated */ @@ -91,10 +95,10 @@ public interface Repository extends EObject { * Returns the value of the '<em><b>Description</b></em>' attribute. * <!-- begin-user-doc --> * <p> - * If the meaning of the '<em>Description</em>' attribute isn't clear, - * there really should be more of a description here... + * If the meaning of the '<em>Description</em>' attribute isn't clear, there really should be more of a description here... * </p> * <!-- end-user-doc --> + * * @return the value of the '<em>Description</em>' attribute. * @see #setDescription(String) * @see org.eclipse.papyrus.cdo.internal.core.repositories.RepositoriesPackage#getRepository_Description() @@ -107,7 +111,9 @@ public interface Repository extends EObject { * Sets the value of the '{@link org.eclipse.papyrus.cdo.internal.core.repositories.Repository#getDescription <em>Description</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> - * @param value the new value of the '<em>Description</em>' attribute. + * + * @param value + * the new value of the '<em>Description</em>' attribute. * @see #getDescription() * @generated */ @@ -117,10 +123,10 @@ public interface Repository extends EObject { * Returns the value of the '<em><b>UUID</b></em>' attribute. * <!-- begin-user-doc --> * <p> - * If the meaning of the '<em>UUID</em>' attribute isn't clear, - * there really should be more of a description here... + * If the meaning of the '<em>UUID</em>' attribute isn't clear, there really should be more of a description here... * </p> * <!-- end-user-doc --> + * * @return the value of the '<em>UUID</em>' attribute. * @see #setUUID(String) * @see org.eclipse.papyrus.cdo.internal.core.repositories.RepositoriesPackage#getRepository_UUID() @@ -133,7 +139,9 @@ public interface Repository extends EObject { * Sets the value of the '{@link org.eclipse.papyrus.cdo.internal.core.repositories.Repository#getUUID <em>UUID</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> - * @param value the new value of the '<em>UUID</em>' attribute. + * + * @param value + * the new value of the '<em>UUID</em>' attribute. * @see #getUUID() * @generated */ diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src-gen/org/eclipse/papyrus/cdo/internal/core/repositories/RepositoryRegistry.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src-gen/org/eclipse/papyrus/cdo/internal/core/repositories/RepositoryRegistry.java index 12749d288d4..9723f9b384e 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src-gen/org/eclipse/papyrus/cdo/internal/core/repositories/RepositoryRegistry.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src-gen/org/eclipse/papyrus/cdo/internal/core/repositories/RepositoryRegistry.java @@ -1,14 +1,14 @@ /** * 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.cdo.internal.core.repositories; @@ -24,7 +24,7 @@ import org.eclipse.emf.ecore.EObject; * <p> * The following features are supported: * <ul> - * <li>{@link org.eclipse.papyrus.cdo.internal.core.repositories.RepositoryRegistry#getRepositories <em>Repositories</em>}</li> + * <li>{@link org.eclipse.papyrus.cdo.internal.core.repositories.RepositoryRegistry#getRepositories <em>Repositories</em>}</li> * </ul> * </p> * @@ -38,10 +38,10 @@ public interface RepositoryRegistry extends EObject { * The list contents are of type {@link org.eclipse.papyrus.cdo.internal.core.repositories.Repository}. * <!-- begin-user-doc --> * <p> - * If the meaning of the '<em>Repositories</em>' containment reference list isn't clear, - * there really should be more of a description here... + * If the meaning of the '<em>Repositories</em>' containment reference list isn't clear, there really should be more of a description here... * </p> * <!-- end-user-doc --> + * * @return the value of the '<em>Repositories</em>' containment reference list. * @see org.eclipse.papyrus.cdo.internal.core.repositories.RepositoriesPackage#getRepositoryRegistry_Repositories() * @model containment="true" diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src-gen/org/eclipse/papyrus/cdo/internal/core/repositories/impl/RepositoriesFactoryImpl.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src-gen/org/eclipse/papyrus/cdo/internal/core/repositories/impl/RepositoriesFactoryImpl.java index 57be4cb0346..b282a90a1c8 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src-gen/org/eclipse/papyrus/cdo/internal/core/repositories/impl/RepositoriesFactoryImpl.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src-gen/org/eclipse/papyrus/cdo/internal/core/repositories/impl/RepositoriesFactoryImpl.java @@ -1,14 +1,14 @@ /** * 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.cdo.internal.core.repositories.impl; @@ -26,6 +26,7 @@ import org.eclipse.papyrus.cdo.internal.core.repositories.*; * <!-- begin-user-doc --> * An implementation of the model <b>Factory</b>. * <!-- end-user-doc --> + * * @generated */ public class RepositoriesFactoryImpl extends EFactoryImpl implements RepositoriesFactory { @@ -33,16 +34,16 @@ public class RepositoriesFactoryImpl extends EFactoryImpl implements Repositorie * Creates the default factory implementation. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ public static RepositoriesFactory init() { try { - RepositoriesFactory theRepositoriesFactory = (RepositoriesFactory)EPackage.Registry.INSTANCE.getEFactory(RepositoriesPackage.eNS_URI); + RepositoriesFactory theRepositoriesFactory = (RepositoriesFactory) EPackage.Registry.INSTANCE.getEFactory(RepositoriesPackage.eNS_URI); if (theRepositoriesFactory != null) { return theRepositoriesFactory; } - } - catch (Exception exception) { + } catch (Exception exception) { EcorePlugin.INSTANCE.log(exception); } return new RepositoriesFactoryImpl(); @@ -52,6 +53,7 @@ public class RepositoriesFactoryImpl extends EFactoryImpl implements Repositorie * Creates an instance of the factory. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ public RepositoriesFactoryImpl() { @@ -61,23 +63,28 @@ public class RepositoriesFactoryImpl extends EFactoryImpl implements Repositorie /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ @Override public EObject create(EClass eClass) { switch (eClass.getClassifierID()) { - case RepositoriesPackage.REPOSITORY_REGISTRY: return createRepositoryRegistry(); - case RepositoriesPackage.REPOSITORY: return createRepository(); - default: - throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$ + case RepositoriesPackage.REPOSITORY_REGISTRY: + return createRepositoryRegistry(); + case RepositoriesPackage.REPOSITORY: + return createRepository(); + default: + throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$ } } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ + @Override public RepositoryRegistry createRepositoryRegistry() { RepositoryRegistryImpl repositoryRegistry = new RepositoryRegistryImpl(); return repositoryRegistry; @@ -86,8 +93,10 @@ public class RepositoriesFactoryImpl extends EFactoryImpl implements Repositorie /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ + @Override public Repository createRepository() { RepositoryImpl repository = new RepositoryImpl(); return repository; @@ -96,15 +105,18 @@ public class RepositoriesFactoryImpl extends EFactoryImpl implements Repositorie /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ + @Override public RepositoriesPackage getRepositoriesPackage() { - return (RepositoriesPackage)getEPackage(); + return (RepositoriesPackage) getEPackage(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @deprecated * @generated */ @@ -113,4 +125,4 @@ public class RepositoriesFactoryImpl extends EFactoryImpl implements Repositorie return RepositoriesPackage.eINSTANCE; } -} //RepositoriesFactoryImpl +} // RepositoriesFactoryImpl diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src-gen/org/eclipse/papyrus/cdo/internal/core/repositories/impl/RepositoriesPackageImpl.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src-gen/org/eclipse/papyrus/cdo/internal/core/repositories/impl/RepositoriesPackageImpl.java index b863ded1c06..12100538a2b 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src-gen/org/eclipse/papyrus/cdo/internal/core/repositories/impl/RepositoriesPackageImpl.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src-gen/org/eclipse/papyrus/cdo/internal/core/repositories/impl/RepositoriesPackageImpl.java @@ -1,14 +1,14 @@ /** * 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.cdo.internal.core.repositories.impl; @@ -28,12 +28,14 @@ import org.eclipse.papyrus.cdo.internal.core.repositories.RepositoryRegistry; * <!-- begin-user-doc --> * An implementation of the model <b>Package</b>. * <!-- end-user-doc --> + * * @generated */ public class RepositoriesPackageImpl extends EPackageImpl implements RepositoriesPackage { /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ private EClass repositoryRegistryEClass = null; @@ -41,20 +43,17 @@ public class RepositoriesPackageImpl extends EPackageImpl implements Repositorie /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ private EClass repositoryEClass = null; /** - * Creates an instance of the model <b>Package</b>, registered with - * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package + * Creates an instance of the model <b>Package</b>, registered with {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package * package URI value. - * <p>Note: the correct way to create the package is via the static - * factory method {@link #init init()}, which also performs - * initialization of the package, or returns the registered package, - * if one already exists. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * <p> + * Note: the correct way to create the package is via the static factory method {@link #init init()}, which also performs initialization of the package, or returns the registered package, if one already exists. <!-- begin-user-doc --> <!-- end-user-doc --> + * * @see org.eclipse.emf.ecore.EPackage.Registry * @see org.eclipse.papyrus.cdo.internal.core.repositories.RepositoriesPackage#eNS_URI * @see #init() @@ -67,27 +66,30 @@ public class RepositoriesPackageImpl extends EPackageImpl implements Repositorie /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ private static boolean isInited = false; /** * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends. + * + * <p> + * This method is used to initialize {@link RepositoriesPackage#eINSTANCE} when that field is accessed. Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. <!-- begin-user-doc --> <!-- end-user-doc + * --> * - * <p>This method is used to initialize {@link RepositoriesPackage#eINSTANCE} when that field is accessed. - * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> * @see #eNS_URI * @see #createPackageContents() * @see #initializePackageContents() * @generated */ public static RepositoriesPackage init() { - if (isInited) return (RepositoriesPackage)EPackage.Registry.INSTANCE.getEPackage(RepositoriesPackage.eNS_URI); + if (isInited) { + return (RepositoriesPackage) EPackage.Registry.INSTANCE.getEPackage(RepositoriesPackage.eNS_URI); + } // Obtain or create and register package - RepositoriesPackageImpl theRepositoriesPackage = (RepositoriesPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof RepositoriesPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new RepositoriesPackageImpl()); + RepositoriesPackageImpl theRepositoriesPackage = (RepositoriesPackageImpl) (EPackage.Registry.INSTANCE.get(eNS_URI) instanceof RepositoriesPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new RepositoriesPackageImpl()); isInited = true; @@ -100,7 +102,7 @@ public class RepositoriesPackageImpl extends EPackageImpl implements Repositorie // Mark meta-data to indicate it can't be changed theRepositoriesPackage.freeze(); - + // Update the registry and return the package EPackage.Registry.INSTANCE.put(RepositoriesPackage.eNS_URI, theRepositoriesPackage); return theRepositoriesPackage; @@ -109,8 +111,10 @@ public class RepositoriesPackageImpl extends EPackageImpl implements Repositorie /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ + @Override public EClass getRepositoryRegistry() { return repositoryRegistryEClass; } @@ -118,17 +122,21 @@ public class RepositoriesPackageImpl extends EPackageImpl implements Repositorie /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ + @Override public EReference getRepositoryRegistry_Repositories() { - return (EReference)repositoryRegistryEClass.getEStructuralFeatures().get(0); + return (EReference) repositoryRegistryEClass.getEStructuralFeatures().get(0); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ + @Override public EClass getRepository() { return repositoryEClass; } @@ -136,64 +144,78 @@ public class RepositoriesPackageImpl extends EPackageImpl implements Repositorie /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ + @Override public EAttribute getRepository_Name() { - return (EAttribute)repositoryEClass.getEStructuralFeatures().get(0); + return (EAttribute) repositoryEClass.getEStructuralFeatures().get(0); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ + @Override public EAttribute getRepository_URL() { - return (EAttribute)repositoryEClass.getEStructuralFeatures().get(1); + return (EAttribute) repositoryEClass.getEStructuralFeatures().get(1); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ + @Override public EAttribute getRepository_Description() { - return (EAttribute)repositoryEClass.getEStructuralFeatures().get(2); + return (EAttribute) repositoryEClass.getEStructuralFeatures().get(2); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ + @Override public EAttribute getRepository_UUID() { - return (EAttribute)repositoryEClass.getEStructuralFeatures().get(3); + return (EAttribute) repositoryEClass.getEStructuralFeatures().get(3); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ + @Override public RepositoriesFactory getRepositoriesFactory() { - return (RepositoriesFactory)getEFactoryInstance(); + return (RepositoriesFactory) getEFactoryInstance(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ private boolean isCreated = false; /** - * Creates the meta-model objects for the package. This method is + * Creates the meta-model objects for the package. This method is * guarded to have no affect on any invocation but its first. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ public void createPackageContents() { - if (isCreated) return; + if (isCreated) { + return; + } isCreated = true; // Create classes and their features @@ -210,19 +232,23 @@ public class RepositoriesPackageImpl extends EPackageImpl implements Repositorie /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ private boolean isInitialized = false; /** - * Complete the initialization of the package and its meta-model. This + * Complete the initialization of the package and its meta-model. This * method is guarded to have no affect on any invocation but its first. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ public void initializePackageContents() { - if (isInitialized) return; + if (isInitialized) { + return; + } isInitialized = true; // Initialize package @@ -238,7 +264,8 @@ public class RepositoriesPackageImpl extends EPackageImpl implements Repositorie // Initialize classes, features, and operations; add parameters initEClass(repositoryRegistryEClass, RepositoryRegistry.class, "RepositoryRegistry", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEReference(getRepositoryRegistry_Repositories(), this.getRepository(), null, "repositories", null, 0, -1, RepositoryRegistry.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + initEReference(getRepositoryRegistry_Repositories(), this.getRepository(), null, + "repositories", null, 0, -1, RepositoryRegistry.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ initEClass(repositoryEClass, Repository.class, "Repository", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ initEAttribute(getRepository_Name(), ecorePackage.getEString(), "name", null, 1, 1, Repository.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ @@ -258,16 +285,15 @@ public class RepositoriesPackageImpl extends EPackageImpl implements Repositorie * Initializes the annotations for <b>http:///org/eclipse/emf/ecore/util/ExtendedMetaData</b>. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ protected void createExtendedMetaDataAnnotations() { - String source = "http:///org/eclipse/emf/ecore/util/ExtendedMetaData"; //$NON-NLS-1$ - addAnnotation - (getRepository_URL(), - source, - new String[] { - "name", "url" //$NON-NLS-1$ //$NON-NLS-2$ - }); + String source = "http:///org/eclipse/emf/ecore/util/ExtendedMetaData"; //$NON-NLS-1$ + addAnnotation(getRepository_URL(), + source, + new String[] { "name", "url" //$NON-NLS-1$ //$NON-NLS-2$ + }); } -} //RepositoriesPackageImpl +} // RepositoriesPackageImpl diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src-gen/org/eclipse/papyrus/cdo/internal/core/repositories/impl/RepositoryImpl.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src-gen/org/eclipse/papyrus/cdo/internal/core/repositories/impl/RepositoryImpl.java index 2c30f85f077..5c1d8e9e06e 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src-gen/org/eclipse/papyrus/cdo/internal/core/repositories/impl/RepositoryImpl.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src-gen/org/eclipse/papyrus/cdo/internal/core/repositories/impl/RepositoryImpl.java @@ -1,14 +1,14 @@ /** * 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.cdo.internal.core.repositories.impl; @@ -29,10 +29,10 @@ import org.eclipse.papyrus.cdo.internal.core.repositories.Repository; * <p> * The following features are implemented: * <ul> - * <li>{@link org.eclipse.papyrus.cdo.internal.core.repositories.impl.RepositoryImpl#getName <em>Name</em>}</li> - * <li>{@link org.eclipse.papyrus.cdo.internal.core.repositories.impl.RepositoryImpl#getURL <em>URL</em>}</li> - * <li>{@link org.eclipse.papyrus.cdo.internal.core.repositories.impl.RepositoryImpl#getDescription <em>Description</em>}</li> - * <li>{@link org.eclipse.papyrus.cdo.internal.core.repositories.impl.RepositoryImpl#getUUID <em>UUID</em>}</li> + * <li>{@link org.eclipse.papyrus.cdo.internal.core.repositories.impl.RepositoryImpl#getName <em>Name</em>}</li> + * <li>{@link org.eclipse.papyrus.cdo.internal.core.repositories.impl.RepositoryImpl#getURL <em>URL</em>}</li> + * <li>{@link org.eclipse.papyrus.cdo.internal.core.repositories.impl.RepositoryImpl#getDescription <em>Description</em>}</li> + * <li>{@link org.eclipse.papyrus.cdo.internal.core.repositories.impl.RepositoryImpl#getUUID <em>UUID</em>}</li> * </ul> * </p> * @@ -43,6 +43,7 @@ public class RepositoryImpl extends MinimalEObjectImpl.Container implements Repo * The default value of the '{@link #getName() <em>Name</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @see #getName() * @generated * @ordered @@ -53,6 +54,7 @@ public class RepositoryImpl extends MinimalEObjectImpl.Container implements Repo * The cached value of the '{@link #getName() <em>Name</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @see #getName() * @generated * @ordered @@ -63,6 +65,7 @@ public class RepositoryImpl extends MinimalEObjectImpl.Container implements Repo * The default value of the '{@link #getURL() <em>URL</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @see #getURL() * @generated * @ordered @@ -73,6 +76,7 @@ public class RepositoryImpl extends MinimalEObjectImpl.Container implements Repo * The cached value of the '{@link #getURL() <em>URL</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @see #getURL() * @generated * @ordered @@ -83,6 +87,7 @@ public class RepositoryImpl extends MinimalEObjectImpl.Container implements Repo * The default value of the '{@link #getDescription() <em>Description</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @see #getDescription() * @generated * @ordered @@ -93,6 +98,7 @@ public class RepositoryImpl extends MinimalEObjectImpl.Container implements Repo * The cached value of the '{@link #getDescription() <em>Description</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @see #getDescription() * @generated * @ordered @@ -103,6 +109,7 @@ public class RepositoryImpl extends MinimalEObjectImpl.Container implements Repo * The default value of the '{@link #getUUID() <em>UUID</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @see #getUUID() * @generated * @ordered @@ -113,6 +120,7 @@ public class RepositoryImpl extends MinimalEObjectImpl.Container implements Repo * The cached value of the '{@link #getUUID() <em>UUID</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @see #getUUID() * @generated * @ordered @@ -122,6 +130,7 @@ public class RepositoryImpl extends MinimalEObjectImpl.Container implements Repo /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ protected RepositoryImpl() { @@ -131,6 +140,7 @@ public class RepositoryImpl extends MinimalEObjectImpl.Container implements Repo /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ @Override @@ -141,8 +151,10 @@ public class RepositoryImpl extends MinimalEObjectImpl.Container implements Repo /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ + @Override public String getName() { return name; } @@ -150,20 +162,25 @@ public class RepositoryImpl extends MinimalEObjectImpl.Container implements Repo /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ + @Override public void setName(String newName) { String oldName = name; name = newName; - if (eNotificationRequired()) + if (eNotificationRequired()) { eNotify(new ENotificationImpl(this, Notification.SET, RepositoriesPackage.REPOSITORY__NAME, oldName, name)); + } } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ + @Override public String getURL() { return uRL; } @@ -171,20 +188,25 @@ public class RepositoryImpl extends MinimalEObjectImpl.Container implements Repo /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ + @Override public void setURL(String newURL) { String oldURL = uRL; uRL = newURL; - if (eNotificationRequired()) + if (eNotificationRequired()) { eNotify(new ENotificationImpl(this, Notification.SET, RepositoriesPackage.REPOSITORY__URL, oldURL, uRL)); + } } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ + @Override public String getDescription() { return description; } @@ -192,20 +214,25 @@ public class RepositoryImpl extends MinimalEObjectImpl.Container implements Repo /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ + @Override public void setDescription(String newDescription) { String oldDescription = description; description = newDescription; - if (eNotificationRequired()) + if (eNotificationRequired()) { eNotify(new ENotificationImpl(this, Notification.SET, RepositoriesPackage.REPOSITORY__DESCRIPTION, oldDescription, description)); + } } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ + @Override public String getUUID() { return uUID; } @@ -213,31 +240,35 @@ public class RepositoryImpl extends MinimalEObjectImpl.Container implements Repo /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ + @Override public void setUUID(String newUUID) { String oldUUID = uUID; uUID = newUUID; - if (eNotificationRequired()) + if (eNotificationRequired()) { eNotify(new ENotificationImpl(this, Notification.SET, RepositoriesPackage.REPOSITORY__UUID, oldUUID, uUID)); + } } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { - case RepositoriesPackage.REPOSITORY__NAME: - return getName(); - case RepositoriesPackage.REPOSITORY__URL: - return getURL(); - case RepositoriesPackage.REPOSITORY__DESCRIPTION: - return getDescription(); - case RepositoriesPackage.REPOSITORY__UUID: - return getUUID(); + case RepositoriesPackage.REPOSITORY__NAME: + return getName(); + case RepositoriesPackage.REPOSITORY__URL: + return getURL(); + case RepositoriesPackage.REPOSITORY__DESCRIPTION: + return getDescription(); + case RepositoriesPackage.REPOSITORY__UUID: + return getUUID(); } return super.eGet(featureID, resolve, coreType); } @@ -245,23 +276,24 @@ public class RepositoryImpl extends MinimalEObjectImpl.Container implements Repo /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { - case RepositoriesPackage.REPOSITORY__NAME: - setName((String)newValue); - return; - case RepositoriesPackage.REPOSITORY__URL: - setURL((String)newValue); - return; - case RepositoriesPackage.REPOSITORY__DESCRIPTION: - setDescription((String)newValue); - return; - case RepositoriesPackage.REPOSITORY__UUID: - setUUID((String)newValue); - return; + case RepositoriesPackage.REPOSITORY__NAME: + setName((String) newValue); + return; + case RepositoriesPackage.REPOSITORY__URL: + setURL((String) newValue); + return; + case RepositoriesPackage.REPOSITORY__DESCRIPTION: + setDescription((String) newValue); + return; + case RepositoriesPackage.REPOSITORY__UUID: + setUUID((String) newValue); + return; } super.eSet(featureID, newValue); } @@ -269,23 +301,24 @@ public class RepositoryImpl extends MinimalEObjectImpl.Container implements Repo /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { - case RepositoriesPackage.REPOSITORY__NAME: - setName(NAME_EDEFAULT); - return; - case RepositoriesPackage.REPOSITORY__URL: - setURL(URL_EDEFAULT); - return; - case RepositoriesPackage.REPOSITORY__DESCRIPTION: - setDescription(DESCRIPTION_EDEFAULT); - return; - case RepositoriesPackage.REPOSITORY__UUID: - setUUID(UUID_EDEFAULT); - return; + case RepositoriesPackage.REPOSITORY__NAME: + setName(NAME_EDEFAULT); + return; + case RepositoriesPackage.REPOSITORY__URL: + setURL(URL_EDEFAULT); + return; + case RepositoriesPackage.REPOSITORY__DESCRIPTION: + setDescription(DESCRIPTION_EDEFAULT); + return; + case RepositoriesPackage.REPOSITORY__UUID: + setUUID(UUID_EDEFAULT); + return; } super.eUnset(featureID); } @@ -293,19 +326,20 @@ public class RepositoryImpl extends MinimalEObjectImpl.Container implements Repo /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { - case RepositoriesPackage.REPOSITORY__NAME: - return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); - case RepositoriesPackage.REPOSITORY__URL: - return URL_EDEFAULT == null ? uRL != null : !URL_EDEFAULT.equals(uRL); - case RepositoriesPackage.REPOSITORY__DESCRIPTION: - return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description); - case RepositoriesPackage.REPOSITORY__UUID: - return UUID_EDEFAULT == null ? uUID != null : !UUID_EDEFAULT.equals(uUID); + case RepositoriesPackage.REPOSITORY__NAME: + return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); + case RepositoriesPackage.REPOSITORY__URL: + return URL_EDEFAULT == null ? uRL != null : !URL_EDEFAULT.equals(uRL); + case RepositoriesPackage.REPOSITORY__DESCRIPTION: + return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description); + case RepositoriesPackage.REPOSITORY__UUID: + return UUID_EDEFAULT == null ? uUID != null : !UUID_EDEFAULT.equals(uUID); } return super.eIsSet(featureID); } @@ -313,11 +347,14 @@ public class RepositoryImpl extends MinimalEObjectImpl.Container implements Repo /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ @Override public String toString() { - if (eIsProxy()) return super.toString(); + if (eIsProxy()) { + return super.toString(); + } StringBuffer result = new StringBuffer(super.toString()); result.append(" (name: "); //$NON-NLS-1$ @@ -332,4 +369,4 @@ public class RepositoryImpl extends MinimalEObjectImpl.Container implements Repo return result.toString(); } -} //RepositoryImpl +} // RepositoryImpl diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src-gen/org/eclipse/papyrus/cdo/internal/core/repositories/impl/RepositoryRegistryImpl.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src-gen/org/eclipse/papyrus/cdo/internal/core/repositories/impl/RepositoryRegistryImpl.java index f987b707b83..b274692db9a 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src-gen/org/eclipse/papyrus/cdo/internal/core/repositories/impl/RepositoryRegistryImpl.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src-gen/org/eclipse/papyrus/cdo/internal/core/repositories/impl/RepositoryRegistryImpl.java @@ -1,14 +1,14 @@ /** * 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.cdo.internal.core.repositories.impl; @@ -37,7 +37,7 @@ import org.eclipse.papyrus.cdo.internal.core.repositories.RepositoryRegistry; * <p> * The following features are implemented: * <ul> - * <li>{@link org.eclipse.papyrus.cdo.internal.core.repositories.impl.RepositoryRegistryImpl#getRepositories <em>Repositories</em>}</li> + * <li>{@link org.eclipse.papyrus.cdo.internal.core.repositories.impl.RepositoryRegistryImpl#getRepositories <em>Repositories</em>}</li> * </ul> * </p> * @@ -48,6 +48,7 @@ public class RepositoryRegistryImpl extends MinimalEObjectImpl.Container impleme * The cached value of the '{@link #getRepositories() <em>Repositories</em>}' containment reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @see #getRepositories() * @generated * @ordered @@ -57,6 +58,7 @@ public class RepositoryRegistryImpl extends MinimalEObjectImpl.Container impleme /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ protected RepositoryRegistryImpl() { @@ -66,6 +68,7 @@ public class RepositoryRegistryImpl extends MinimalEObjectImpl.Container impleme /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ @Override @@ -76,8 +79,10 @@ public class RepositoryRegistryImpl extends MinimalEObjectImpl.Container impleme /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ + @Override public EList<Repository> getRepositories() { if (repositories == null) { repositories = new EObjectContainmentEList<Repository>(Repository.class, this, RepositoriesPackage.REPOSITORY_REGISTRY__REPOSITORIES); @@ -88,13 +93,14 @@ public class RepositoryRegistryImpl extends MinimalEObjectImpl.Container impleme /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { - case RepositoriesPackage.REPOSITORY_REGISTRY__REPOSITORIES: - return ((InternalEList<?>)getRepositories()).basicRemove(otherEnd, msgs); + case RepositoriesPackage.REPOSITORY_REGISTRY__REPOSITORIES: + return ((InternalEList<?>) getRepositories()).basicRemove(otherEnd, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } @@ -102,13 +108,14 @@ public class RepositoryRegistryImpl extends MinimalEObjectImpl.Container impleme /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { - case RepositoriesPackage.REPOSITORY_REGISTRY__REPOSITORIES: - return getRepositories(); + case RepositoriesPackage.REPOSITORY_REGISTRY__REPOSITORIES: + return getRepositories(); } return super.eGet(featureID, resolve, coreType); } @@ -116,16 +123,17 @@ public class RepositoryRegistryImpl extends MinimalEObjectImpl.Container impleme /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ @SuppressWarnings("unchecked") @Override public void eSet(int featureID, Object newValue) { switch (featureID) { - case RepositoriesPackage.REPOSITORY_REGISTRY__REPOSITORIES: - getRepositories().clear(); - getRepositories().addAll((Collection<? extends Repository>)newValue); - return; + case RepositoriesPackage.REPOSITORY_REGISTRY__REPOSITORIES: + getRepositories().clear(); + getRepositories().addAll((Collection<? extends Repository>) newValue); + return; } super.eSet(featureID, newValue); } @@ -133,14 +141,15 @@ public class RepositoryRegistryImpl extends MinimalEObjectImpl.Container impleme /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { - case RepositoriesPackage.REPOSITORY_REGISTRY__REPOSITORIES: - getRepositories().clear(); - return; + case RepositoriesPackage.REPOSITORY_REGISTRY__REPOSITORIES: + getRepositories().clear(); + return; } super.eUnset(featureID); } @@ -148,15 +157,16 @@ public class RepositoryRegistryImpl extends MinimalEObjectImpl.Container impleme /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { - case RepositoriesPackage.REPOSITORY_REGISTRY__REPOSITORIES: - return repositories != null && !repositories.isEmpty(); + case RepositoriesPackage.REPOSITORY_REGISTRY__REPOSITORIES: + return repositories != null && !repositories.isEmpty(); } return super.eIsSet(featureID); } -} //RepositoryRegistryImpl +} // RepositoryRegistryImpl diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src-gen/org/eclipse/papyrus/cdo/internal/core/repositories/util/RepositoriesAdapterFactory.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src-gen/org/eclipse/papyrus/cdo/internal/core/repositories/util/RepositoriesAdapterFactory.java index 52a57e8157b..a4db5ec6449 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src-gen/org/eclipse/papyrus/cdo/internal/core/repositories/util/RepositoriesAdapterFactory.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src-gen/org/eclipse/papyrus/cdo/internal/core/repositories/util/RepositoriesAdapterFactory.java @@ -1,14 +1,14 @@ /** * 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.cdo.internal.core.repositories.util; @@ -26,6 +26,7 @@ import org.eclipse.papyrus.cdo.internal.core.repositories.*; * The <b>Adapter Factory</b> for the model. * It provides an adapter <code>createXXX</code> method for each class of the model. * <!-- end-user-doc --> + * * @see org.eclipse.papyrus.cdo.internal.core.repositories.RepositoriesPackage * @generated */ @@ -34,6 +35,7 @@ public class RepositoriesAdapterFactory extends AdapterFactoryImpl { * The cached model package. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ protected static RepositoriesPackage modelPackage; @@ -42,6 +44,7 @@ public class RepositoriesAdapterFactory extends AdapterFactoryImpl { * Creates an instance of the adapter factory. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ public RepositoriesAdapterFactory() { @@ -55,6 +58,7 @@ public class RepositoriesAdapterFactory extends AdapterFactoryImpl { * <!-- begin-user-doc --> * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model. * <!-- end-user-doc --> + * * @return whether this factory is applicable for the type of the object. * @generated */ @@ -64,7 +68,7 @@ public class RepositoriesAdapterFactory extends AdapterFactoryImpl { return true; } if (object instanceof EObject) { - return ((EObject)object).eClass().getEPackage() == modelPackage; + return ((EObject) object).eClass().getEPackage() == modelPackage; } return false; } @@ -73,35 +77,40 @@ public class RepositoriesAdapterFactory extends AdapterFactoryImpl { * The switch that delegates to the <code>createXXX</code> methods. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ protected RepositoriesSwitch<Adapter> modelSwitch = - new RepositoriesSwitch<Adapter>() { - @Override - public Adapter caseRepositoryRegistry(RepositoryRegistry object) { - return createRepositoryRegistryAdapter(); - } - @Override - public Adapter caseRepository(Repository object) { - return createRepositoryAdapter(); - } - @Override - public Adapter defaultCase(EObject object) { - return createEObjectAdapter(); - } - }; + new RepositoriesSwitch<Adapter>() { + @Override + public Adapter caseRepositoryRegistry(RepositoryRegistry object) { + return createRepositoryRegistryAdapter(); + } + + @Override + public Adapter caseRepository(Repository object) { + return createRepositoryAdapter(); + } + + @Override + public Adapter defaultCase(EObject object) { + return createEObjectAdapter(); + } + }; /** * Creates an adapter for the <code>target</code>. * <!-- begin-user-doc --> * <!-- end-user-doc --> - * @param target the object to adapt. + * + * @param target + * the object to adapt. * @return the adapter for the <code>target</code>. * @generated */ @Override public Adapter createAdapter(Notifier target) { - return modelSwitch.doSwitch((EObject)target); + return modelSwitch.doSwitch((EObject) target); } @@ -111,6 +120,7 @@ public class RepositoriesAdapterFactory extends AdapterFactoryImpl { * This default implementation returns null so that we can easily ignore cases; * it's useful to ignore a case when inheritance will catch all the cases anyway. * <!-- end-user-doc --> + * * @return the new adapter. * @see org.eclipse.papyrus.cdo.internal.core.repositories.RepositoryRegistry * @generated @@ -125,6 +135,7 @@ public class RepositoriesAdapterFactory extends AdapterFactoryImpl { * This default implementation returns null so that we can easily ignore cases; * it's useful to ignore a case when inheritance will catch all the cases anyway. * <!-- end-user-doc --> + * * @return the new adapter. * @see org.eclipse.papyrus.cdo.internal.core.repositories.Repository * @generated @@ -138,6 +149,7 @@ public class RepositoriesAdapterFactory extends AdapterFactoryImpl { * <!-- begin-user-doc --> * This default implementation returns null. * <!-- end-user-doc --> + * * @return the new adapter. * @generated */ @@ -145,4 +157,4 @@ public class RepositoriesAdapterFactory extends AdapterFactoryImpl { return null; } -} //RepositoriesAdapterFactory +} // RepositoriesAdapterFactory diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src-gen/org/eclipse/papyrus/cdo/internal/core/repositories/util/RepositoriesResourceFactoryImpl.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src-gen/org/eclipse/papyrus/cdo/internal/core/repositories/util/RepositoriesResourceFactoryImpl.java index dedda946d7f..02ba7e8db07 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src-gen/org/eclipse/papyrus/cdo/internal/core/repositories/util/RepositoriesResourceFactoryImpl.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src-gen/org/eclipse/papyrus/cdo/internal/core/repositories/util/RepositoriesResourceFactoryImpl.java @@ -1,14 +1,14 @@ /** * 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.cdo.internal.core.repositories.util; @@ -23,6 +23,7 @@ import org.eclipse.emf.ecore.xmi.XMLResource; * <!-- begin-user-doc --> * The <b>Resource Factory</b> associated with the package. * <!-- end-user-doc --> + * * @see org.eclipse.papyrus.cdo.internal.core.repositories.util.RepositoriesResourceImpl * @generated */ @@ -31,6 +32,7 @@ public class RepositoriesResourceFactoryImpl extends ResourceFactoryImpl { * Creates an instance of the resource factory. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ public RepositoriesResourceFactoryImpl() { @@ -41,6 +43,7 @@ public class RepositoriesResourceFactoryImpl extends ResourceFactoryImpl { * Creates an instance of the resource. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ @Override @@ -58,4 +61,4 @@ public class RepositoriesResourceFactoryImpl extends ResourceFactoryImpl { return result; } -} //RepositoriesResourceFactoryImpl +} // RepositoriesResourceFactoryImpl diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src-gen/org/eclipse/papyrus/cdo/internal/core/repositories/util/RepositoriesResourceImpl.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src-gen/org/eclipse/papyrus/cdo/internal/core/repositories/util/RepositoriesResourceImpl.java index 71ce0a89bf8..f8fbd5a2b16 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src-gen/org/eclipse/papyrus/cdo/internal/core/repositories/util/RepositoriesResourceImpl.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src-gen/org/eclipse/papyrus/cdo/internal/core/repositories/util/RepositoriesResourceImpl.java @@ -1,14 +1,14 @@ /** * 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.cdo.internal.core.repositories.util; @@ -20,6 +20,7 @@ import org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl; * <!-- begin-user-doc --> * The <b>Resource </b> associated with the package. * <!-- end-user-doc --> + * * @see org.eclipse.papyrus.cdo.internal.core.repositories.util.RepositoriesResourceFactoryImpl * @generated */ @@ -28,11 +29,13 @@ public class RepositoriesResourceImpl extends XMLResourceImpl { * Creates an instance of the resource. * <!-- begin-user-doc --> * <!-- end-user-doc --> - * @param uri the URI of the new resource. + * + * @param uri + * the URI of the new resource. * @generated */ public RepositoriesResourceImpl(URI uri) { super(uri); } -} //RepositoriesResourceImpl +} // RepositoriesResourceImpl diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src-gen/org/eclipse/papyrus/cdo/internal/core/repositories/util/RepositoriesSwitch.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src-gen/org/eclipse/papyrus/cdo/internal/core/repositories/util/RepositoriesSwitch.java index 5e3aa2354e4..3698cc97255 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src-gen/org/eclipse/papyrus/cdo/internal/core/repositories/util/RepositoriesSwitch.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src-gen/org/eclipse/papyrus/cdo/internal/core/repositories/util/RepositoriesSwitch.java @@ -1,14 +1,14 @@ /** * 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.cdo.internal.core.repositories.util; @@ -22,13 +22,13 @@ import org.eclipse.papyrus.cdo.internal.core.repositories.*; /** * <!-- begin-user-doc --> * The <b>Switch</b> for the model's inheritance hierarchy. - * It supports the call {@link #doSwitch(EObject) doSwitch(object)} - * to invoke the <code>caseXXX</code> method for each class of the model, + * It supports the call {@link #doSwitch(EObject) doSwitch(object)} to invoke the <code>caseXXX</code> method for each class of the model, * starting with the actual class of the object * and proceeding up the inheritance hierarchy * until a non-null result is returned, * which is the result of the switch. * <!-- end-user-doc --> + * * @see org.eclipse.papyrus.cdo.internal.core.repositories.RepositoriesPackage * @generated */ @@ -37,6 +37,7 @@ public class RepositoriesSwitch<T> extends Switch<T> { * The cached model package * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ protected static RepositoriesPackage modelPackage; @@ -45,6 +46,7 @@ public class RepositoriesSwitch<T> extends Switch<T> { * Creates an instance of the switch. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ public RepositoriesSwitch() { @@ -57,6 +59,7 @@ public class RepositoriesSwitch<T> extends Switch<T> { * Checks whether this is a switch for the given package. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @parameter ePackage the package in question. * @return whether this is a switch for the given package. * @generated @@ -70,25 +73,31 @@ public class RepositoriesSwitch<T> extends Switch<T> { * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @return the first non-null result returned by a <code>caseXXX</code> call. * @generated */ @Override protected T doSwitch(int classifierID, EObject theEObject) { switch (classifierID) { - case RepositoriesPackage.REPOSITORY_REGISTRY: { - RepositoryRegistry repositoryRegistry = (RepositoryRegistry)theEObject; - T result = caseRepositoryRegistry(repositoryRegistry); - if (result == null) result = defaultCase(theEObject); - return result; + case RepositoriesPackage.REPOSITORY_REGISTRY: { + RepositoryRegistry repositoryRegistry = (RepositoryRegistry) theEObject; + T result = caseRepositoryRegistry(repositoryRegistry); + if (result == null) { + result = defaultCase(theEObject); } - case RepositoriesPackage.REPOSITORY: { - Repository repository = (Repository)theEObject; - T result = caseRepository(repository); - if (result == null) result = defaultCase(theEObject); - return result; + return result; + } + case RepositoriesPackage.REPOSITORY: { + Repository repository = (Repository) theEObject; + T result = caseRepository(repository); + if (result == null) { + result = defaultCase(theEObject); } - default: return defaultCase(theEObject); + return result; + } + default: + return defaultCase(theEObject); } } @@ -98,7 +107,9 @@ public class RepositoriesSwitch<T> extends Switch<T> { * This implementation returns null; * returning a non-null result will terminate the switch. * <!-- end-user-doc --> - * @param object the target of the switch. + * + * @param object + * the target of the switch. * @return the result of interpreting the object as an instance of '<em>Repository Registry</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated @@ -113,7 +124,9 @@ public class RepositoriesSwitch<T> extends Switch<T> { * This implementation returns null; * returning a non-null result will terminate the switch. * <!-- end-user-doc --> - * @param object the target of the switch. + * + * @param object + * the target of the switch. * @return the result of interpreting the object as an instance of '<em>Repository</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated @@ -128,7 +141,9 @@ public class RepositoriesSwitch<T> extends Switch<T> { * This implementation returns null; * returning a non-null result will terminate the switch, but this is the last case anyway. * <!-- end-user-doc --> - * @param object the target of the switch. + * + * @param object + * the target of the switch. * @return the result of interpreting the object as an instance of '<em>EObject</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) * @generated @@ -138,4 +153,4 @@ public class RepositoriesSwitch<T> extends Switch<T> { return null; } -} //RepositoriesSwitch +} // RepositoriesSwitch diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src-gen/org/eclipse/papyrus/cdo/internal/core/repositories/util/RepositoriesXMLProcessor.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src-gen/org/eclipse/papyrus/cdo/internal/core/repositories/util/RepositoriesXMLProcessor.java index 1896f06638b..a9d925227da 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src-gen/org/eclipse/papyrus/cdo/internal/core/repositories/util/RepositoriesXMLProcessor.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src-gen/org/eclipse/papyrus/cdo/internal/core/repositories/util/RepositoriesXMLProcessor.java @@ -1,14 +1,14 @@ /** * 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.cdo.internal.core.repositories.util; @@ -26,6 +26,7 @@ import org.eclipse.papyrus.cdo.internal.core.repositories.RepositoriesPackage; * This class contains helper methods to serialize and deserialize XML documents * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ public class RepositoriesXMLProcessor extends XMLProcessor { @@ -34,17 +35,19 @@ public class RepositoriesXMLProcessor extends XMLProcessor { * Public constructor to instantiate the helper. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ public RepositoriesXMLProcessor() { super((EPackage.Registry.INSTANCE)); RepositoriesPackage.eINSTANCE.eClass(); } - + /** * Register for "*" and "xml" file extensions the RepositoriesResourceFactoryImpl factory. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ @Override @@ -57,4 +60,4 @@ public class RepositoriesXMLProcessor extends XMLProcessor { return registrations; } -} //RepositoriesXMLProcessor +} // RepositoriesXMLProcessor diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/CommitException.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/CommitException.java index f17578f147f..2b3ad115020 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/CommitException.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/CommitException.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -19,7 +19,7 @@ import org.eclipse.papyrus.cdo.internal.core.l10n.Messages; /** - * This is the CommitException type. Enjoy. + * This is the CommitException type. Enjoy. */ public class CommitException extends CoreException { diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/IPapyrusRepository.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/IPapyrusRepository.java index 01432064602..37db9502730 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/IPapyrusRepository.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/IPapyrusRepository.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/IPapyrusRepositoryListener.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/IPapyrusRepositoryListener.java index 9d605bfbeca..14c36f1e406 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/IPapyrusRepositoryListener.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/IPapyrusRepositoryListener.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/IPapyrusRepositoryManager.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/IPapyrusRepositoryManager.java index 3834c666219..d25d3a1f59b 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/IPapyrusRepositoryManager.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/IPapyrusRepositoryManager.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -29,6 +29,6 @@ public interface IPapyrusRepositoryManager { IPapyrusRepository getRepository(String url); IPapyrusRepository getRepositoryForURI(URI uri); - + void saveRepositories(); } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/IResourceSetDisposalApprover.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/IResourceSetDisposalApprover.java index 2bf1dfb60f1..f900b726754 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/IResourceSetDisposalApprover.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/IResourceSetDisposalApprover.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/PapyrusRepositoryEvent.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/PapyrusRepositoryEvent.java index 1d62d240fbd..a08ef173dca 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/PapyrusRepositoryEvent.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/PapyrusRepositoryEvent.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -35,7 +35,7 @@ public class PapyrusRepositoryEvent extends EventObject { @Override public IPapyrusRepository getSource() { - return (IPapyrusRepository)super.getSource(); + return (IPapyrusRepository) super.getSource(); } public int getEventType() { diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/RepositoryManagerEventAdapter.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/RepositoryManagerEventAdapter.java index f00ccac61d5..db2bc4e345c 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/RepositoryManagerEventAdapter.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/RepositoryManagerEventAdapter.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -36,14 +36,12 @@ import org.eclipse.papyrus.cdo.internal.core.PapyrusRepositoryManager; * <li>a repository is {@linkplain #onRemoved(IPapyrusRepositoryManager, IPapyrusRepository) removed}</li> * <li>a repository is {@linkplain #onConnected(IPapyrusRepository) connected}</li> * <li>a repository is {@linkplain #onDisconnected(IPapyrusRepository) disconnected}</li> - * <li>(optionally) the view attached to some {link ResourceSet} receives an - * {@linkplain #onInvalidation(IPapyrusRepository, CDOView, CDOViewInvalidationEvent) invalidation event}</li> + * <li>(optionally) the view attached to some {link ResourceSet} receives an {@linkplain #onInvalidation(IPapyrusRepository, CDOView, CDOViewInvalidationEvent) invalidation event}</li> * </ul> * <p> - * To add the listener to a repository manager, use the {@link #install(IPapyrusRepositoryManager)} method. To remove it, use - * {@link #uninstall(IPapyrusRepositoryManager)}. + * To add the listener to a repository manager, use the {@link #install(IPapyrusRepositoryManager)} method. To remove it, use {@link #uninstall(IPapyrusRepositoryManager)}. * </p> - * + * * @see #install(IPapyrusRepositoryManager) * @see #uninstall(IPapyrusRepositoryManager) */ @@ -71,25 +69,24 @@ public class RepositoryManagerEventAdapter { } /** - * Install me on a repository manager. This iterates all repositories that already exist, to call the - * {@link #onAdded(IPapyrusRepositoryManager, IPapyrusRepository)} call-back + * Install me on a repository manager. This iterates all repositories that already exist, to call the {@link #onAdded(IPapyrusRepositoryManager, IPapyrusRepository)} call-back * on each, for convenience. For any existing repositories that are already connected, the {@link #onConnected(IPapyrusRepository)} call-back is * also invoked. - * + * * @param repositoryManager - * a repository manager to install me on - * + * a repository manager to install me on + * * @return myself, for convenience of call chaining */ public RepositoryManagerEventAdapter install(IPapyrusRepositoryManager repositoryManager) { @SuppressWarnings("unchecked") - IContainer<IPapyrusRepository> container = (IContainer<IPapyrusRepository>)repositoryManager; + IContainer<IPapyrusRepository> container = (IContainer<IPapyrusRepository>) repositoryManager; target = repositoryManager; container.addListener(managerListener); - for(IPapyrusRepository next : repositoryManager.getRepositories()) { + for (IPapyrusRepository next : repositoryManager.getRepositories()) { try { managerListener.onAdded(container, next); } catch (Exception e) { @@ -101,20 +98,19 @@ public class RepositoryManagerEventAdapter { } /** - * Remove me from a repository manager. This iterates all repositories that currently exist, to call the - * {@link #onRemoved(IPapyrusRepositoryManager, IPapyrusRepository)} call-back on each, for convenience. - * + * Remove me from a repository manager. This iterates all repositories that currently exist, to call the {@link #onRemoved(IPapyrusRepositoryManager, IPapyrusRepository)} call-back on each, for convenience. + * * @param repositoryManager - * a repository manager to remove me from - * + * a repository manager to remove me from + * * @return myself, for convenience of call chaining */ public RepositoryManagerEventAdapter uninstall(IPapyrusRepositoryManager repositoryManager) { - if((target != null) && (target == repositoryManager)) { + if ((target != null) && (target == repositoryManager)) { @SuppressWarnings("unchecked") - IContainer<IPapyrusRepository> container = (IContainer<IPapyrusRepository>)repositoryManager; + IContainer<IPapyrusRepository> container = (IContainer<IPapyrusRepository>) repositoryManager; - for(IPapyrusRepository next : repositoryManager.getRepositories()) { + for (IPapyrusRepository next : repositoryManager.getRepositories()) { try { onRemoved(repositoryManager, next); } catch (Exception e) { @@ -131,12 +127,12 @@ public class RepositoryManagerEventAdapter { } void handleConnection(IInternalPapyrusRepository repository) { - if(viewInvalidationListener != null) { + if (viewInvalidationListener != null) { repository.getCDOSession().addListener(viewInvalidationListener); // look for existing view - for(CDOView next : repository.getCDOSession().getViews()) { - if(next.getResourceSet() == target) { + for (CDOView next : repository.getCDOSession().getViews()) { + if (next.getResourceSet() == target) { next.addListener(viewInvalidationListener); } } @@ -180,10 +176,10 @@ public class RepositoryManagerEventAdapter { protected void onAdded(IContainer<IPapyrusRepository> container, IPapyrusRepository element) { element.addPapyrusRepositoryListener(repositoryListener); - RepositoryManagerEventAdapter.this.onAdded((IPapyrusRepositoryManager)container, element); + RepositoryManagerEventAdapter.this.onAdded((IPapyrusRepositoryManager) container, element); - if(element.isConnected()) { - handleConnection((IInternalPapyrusRepository)element); + if (element.isConnected()) { + handleConnection((IInternalPapyrusRepository) element); } } @@ -191,20 +187,21 @@ public class RepositoryManagerEventAdapter { protected void onRemoved(IContainer<IPapyrusRepository> container, IPapyrusRepository element) { element.removePapyrusRepositoryListener(repositoryListener); - RepositoryManagerEventAdapter.this.onRemoved((IPapyrusRepositoryManager)container, element); + RepositoryManagerEventAdapter.this.onRemoved((IPapyrusRepositoryManager) container, element); } } private class RepositoryListener implements IPapyrusRepositoryListener { + @Override public void papyrusRepositoryChanged(PapyrusRepositoryEvent event) { - switch(event.getEventType()) { + switch (event.getEventType()) { case PapyrusRepositoryEvent.CONNECTED: - handleConnection((IInternalPapyrusRepository)event.getSource()); + handleConnection((IInternalPapyrusRepository) event.getSource()); break; case PapyrusRepositoryEvent.DISCONNECTED: - handleDisconnection((IInternalPapyrusRepository)event.getSource()); + handleDisconnection((IInternalPapyrusRepository) event.getSource()); break; default: throw new IllegalArgumentException("Invalid repository event type: " + event.getEventType()); //$NON-NLS-1$ @@ -222,13 +219,13 @@ public class RepositoryManagerEventAdapter { @Override protected void notifyOtherEvent(IEvent event) { - if(event instanceof CDOViewInvalidationEvent) { - CDOViewInvalidationEvent invalidation = (CDOViewInvalidationEvent)event; - IPapyrusRepository repo = ((IInternalPapyrusRepositoryManager)target).getRepository(invalidation.getSource()); + if (event instanceof CDOViewInvalidationEvent) { + CDOViewInvalidationEvent invalidation = (CDOViewInvalidationEvent) event; + IPapyrusRepository repo = ((IInternalPapyrusRepositoryManager) target).getRepository(invalidation.getSource()); onInvalidation(repo, invalidation.getSource(), invalidation); - } else if(event instanceof IContainerEvent<?>) { + } else if (event instanceof IContainerEvent<?>) { @SuppressWarnings("unchecked") - IContainerEvent<CDOView> containerEvent = (IContainerEvent<CDOView>)event; + IContainerEvent<CDOView> containerEvent = (IContainerEvent<CDOView>) event; onContainerEvent(containerEvent); } } @@ -239,9 +236,9 @@ public class RepositoryManagerEventAdapter { } protected void onContainerEvent(IContainerEvent<CDOView> event) { - for(IContainerDelta<CDOView> next : event.getDeltas()) { - if(next.getKind() == Kind.ADDED) { - if(next.getElement().getResourceSet() == resourceSet) { + for (IContainerDelta<CDOView> next : event.getDeltas()) { + if (next.getKind() == Kind.ADDED) { + if (next.getElement().getResourceSet() == resourceSet) { next.getElement().addListener(this); } } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/admin/IPapyrusRepositoryAdminListener.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/admin/IPapyrusRepositoryAdminListener.java index 982d631519f..854a3e599d6 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/admin/IPapyrusRepositoryAdminListener.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/admin/IPapyrusRepositoryAdminListener.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/admin/PapyrusRepositoryAdminEvent.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/admin/PapyrusRepositoryAdminEvent.java index 8ee374930fa..2fd411342f9 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/admin/PapyrusRepositoryAdminEvent.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/admin/PapyrusRepositoryAdminEvent.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -41,7 +41,7 @@ public class PapyrusRepositoryAdminEvent extends EventObject { @Override public PapyrusRepositoryAdminManager getSource() { - return (PapyrusRepositoryAdminManager)super.getSource(); + return (PapyrusRepositoryAdminManager) super.getSource(); } public int getEventType() { diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/admin/PapyrusRepositoryAdminManager.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/admin/PapyrusRepositoryAdminManager.java index f858b5b5d79..11649c4ea93 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/admin/PapyrusRepositoryAdminManager.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/admin/PapyrusRepositoryAdminManager.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -41,7 +41,7 @@ public class PapyrusRepositoryAdminManager extends ContainerEventAdapter<CDOAdmi public void install(IContainer<? extends CDOAdminClient> container) { container.addListener(this); - for(CDOAdminClient next : container.getElements()) { + for (CDOAdminClient next : container.getElements()) { next.addListener(repositoryListener); } } @@ -65,11 +65,11 @@ public class PapyrusRepositoryAdminManager extends ContainerEventAdapter<CDOAdmi } protected void fireRepositoryAdminEvent(int eventType, String url, String name) { - if(!listeners.isEmpty()) { + if (!listeners.isEmpty()) { PapyrusRepositoryAdminEvent event = new PapyrusRepositoryAdminEvent(this, eventType, url, name); - for(IPapyrusRepositoryAdminListener next : listeners) { + for (IPapyrusRepositoryAdminListener next : listeners) { try { - switch(eventType) { + switch (eventType) { case PapyrusRepositoryAdminEvent.REPOSITORY_ADDED: next.repositoryAdded(event); break; @@ -92,12 +92,12 @@ public class PapyrusRepositoryAdminManager extends ContainerEventAdapter<CDOAdmi @Override protected void onAdded(IContainer<CDOAdminRepository> container, CDOAdminRepository element) { - if(container instanceof CDOAdminClient) { - CDOAdminClient client = (CDOAdminClient)container; + if (container instanceof CDOAdminClient) { + CDOAdminClient client = (CDOAdminClient) container; String url = String.format("%s?repositoryName=%s", client.getURL(), element.getName()); //$NON-NLS-1$ repositories.put(element, url); - if(client.isConnected()) { + if (client.isConnected()) { // Only notify for repositories added while connected, which ensures that we don't // get a cascade of events on initial connection and discovery of existing repositories fireRepositoryAdminEvent(PapyrusRepositoryAdminEvent.REPOSITORY_ADDED, url, element.getName()); @@ -107,11 +107,11 @@ public class PapyrusRepositoryAdminManager extends ContainerEventAdapter<CDOAdmi @Override protected void onRemoved(IContainer<CDOAdminRepository> container, CDOAdminRepository element) { - if(container instanceof CDOAdminClient) { - CDOAdminClient client = (CDOAdminClient)container; + if (container instanceof CDOAdminClient) { + CDOAdminClient client = (CDOAdminClient) container; String url = repositories.remove(element); - if((url != null) && client.isConnected()) { + if ((url != null) && client.isConnected()) { // Only notify for repositories removed while connected, which ensures that we don't // get a cascade of events on disconnection from the server fireRepositoryAdminEvent(PapyrusRepositoryAdminEvent.REPOSITORY_REMOVED, url, element.getName()); diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/exporter/IModelExportMapping.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/exporter/IModelExportMapping.java index 9a737bdb731..b5e99e3316a 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/exporter/IModelExportMapping.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/exporter/IModelExportMapping.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/exporter/IModelExporter.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/exporter/IModelExporter.java index ac2a63efbb0..940bf32b680 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/exporter/IModelExporter.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/exporter/IModelExporter.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/importer/IModelDependentsProvider.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/importer/IModelDependentsProvider.java index 0c234c714e9..e5a736e0f31 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/importer/IModelDependentsProvider.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/importer/IModelDependentsProvider.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/importer/IModelImportMapping.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/importer/IModelImportMapping.java index 30947f387a7..95a6e8dbc77 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/importer/IModelImportMapping.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/importer/IModelImportMapping.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/importer/IModelImporter.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/importer/IModelImporter.java index 7b374b57c74..def2dda68b5 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/importer/IModelImporter.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/importer/IModelImporter.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/importer/IModelTransferConfiguration.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/importer/IModelTransferConfiguration.java index 2d67e844f06..6ee680d6c86 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/importer/IModelTransferConfiguration.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/importer/IModelTransferConfiguration.java @@ -1,6 +1,6 @@ /***************************************************************************** * Copyright (c) 2013, 2014 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 @@ -9,7 +9,7 @@ * Contributors: * CEA LIST - Initial API and implementation * Christian W. Damus (CEA) - bug 429242 - * + * *****************************************************************************/ package org.eclipse.papyrus.cdo.core.importer; @@ -63,12 +63,12 @@ public interface IModelTransferConfiguration { * then the configuration will use it to load resources for dependency analysis. It will * then be the caller's responsibility to clean up that resource set, if necessary, * after completion of the transfer process. - * + * * @param operationContext - * a context in which to run model transfer operations + * a context in which to run model transfer operations * @param resourceSet - * an optional resource set for the configuration to use for dependency analysis; may be {@code null} - * + * an optional resource set for the configuration to use for dependency analysis; may be {@code null} + * * @return the model transfer configuration */ IModelTransferConfiguration create(IModelTransferOperation.Context operationContext, ResourceSet resourceSet); diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/importer/IModelTransferListener.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/importer/IModelTransferListener.java index 6ef3f37fec1..80050f196ac 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/importer/IModelTransferListener.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/importer/IModelTransferListener.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/importer/IModelTransferMapping.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/importer/IModelTransferMapping.java index 661bbf422ed..b2042268912 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/importer/IModelTransferMapping.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/importer/IModelTransferMapping.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/importer/IModelTransferMappingListener.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/importer/IModelTransferMappingListener.java index c3e3677f31d..d7abcc9dc7b 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/importer/IModelTransferMappingListener.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/importer/IModelTransferMappingListener.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/importer/IModelTransferNode.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/importer/IModelTransferNode.java index 1fa1f6ebd34..0a1b1c14e5c 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/importer/IModelTransferNode.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/importer/IModelTransferNode.java @@ -1,6 +1,6 @@ /***************************************************************************** * Copyright (c) 2013, 2014 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 @@ -9,7 +9,7 @@ * Contributors: * CEA LIST - Initial API and implementation * Christian W. Damus (CEA) - bug 429242 - * + * *****************************************************************************/ package org.eclipse.papyrus.cdo.core.importer; @@ -36,20 +36,20 @@ public interface IModelTransferNode { /** * Queries whether an{@code other} node represents a model sub-unit of me. - * + * * @param other - * another model unit - * + * another model unit + * * @return whether the {@code other} it is a logical model sub-unit of me */ boolean isModelSubUnit(IModelTransferNode other); /** * Queries whether an{@code other} node represents my model super-unit. - * + * * @param other - * another model unit - * + * another model unit + * * @return whether the {@code other} it is the logical model super-unit of me */ boolean isModelParentUnit(IModelTransferNode other); diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/importer/IModelTransferOperation.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/importer/IModelTransferOperation.java index 468cd5b0df9..9864794617c 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/importer/IModelTransferOperation.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/importer/IModelTransferOperation.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/importer/ModelTransferListenerAdapter.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/importer/ModelTransferListenerAdapter.java index d8847300639..5fdb5ae92c3 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/importer/ModelTransferListenerAdapter.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/importer/ModelTransferListenerAdapter.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -23,14 +23,17 @@ public class ModelTransferListenerAdapter super(); } + @Override public void modelsToTransferChanged(IModelTransferConfiguration configuration) { // pass } + @Override public void modelDependentsChanged(IModelTransferNode node) { // pass } + @Override public void modelTransferProblemsOccurred(Diagnostic problems) { // pass } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/importer/ModelTransferMappingListenerAdapter.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/importer/ModelTransferMappingListenerAdapter.java index 89bd65eb002..34ecd804b4b 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/importer/ModelTransferMappingListenerAdapter.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/importer/ModelTransferMappingListenerAdapter.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -22,14 +22,17 @@ public class ModelTransferMappingListenerAdapter implements IModelTransferMappin super(); } + @Override public void modelTransferRepositoryChanged(IModelTransferMapping mapping) { // pass } + @Override public void modelTransferMappingChanged(IModelTransferNode node) { // pass } + @Override public void modelTransferMappingProblemsOccurred(Diagnostic problems) { // pass } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOAwareCommandStack.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOAwareCommandStack.java index 188581b1c41..943636040d9 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOAwareCommandStack.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOAwareCommandStack.java @@ -1,6 +1,6 @@ /***************************************************************************** * Copyright (c) 2013, 2014 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 @@ -10,7 +10,7 @@ * CEA LIST - Initial API and implementation * Christian W. Damus (CEA) - bug 402525 * Christian W. Damus (CEA) - bug 432813 - * + * *****************************************************************************/ package org.eclipse.papyrus.cdo.core.resource; @@ -44,7 +44,7 @@ public class CDOAwareCommandStack extends NestingNotifyingWorkspaceCommandStack @Override public void dispose() { IOperationHistory history = getOperationHistory(); - if(history != null) { + if (history != null) { CDOUndoContext.flushAll(history); } @@ -61,22 +61,22 @@ public class CDOAwareCommandStack extends NestingNotifyingWorkspaceCommandStack super.hookUndoContexts(operation, event); Set<EObject> affectedObjects = Sets.newHashSet(); - for(Notification next : event.getNotifications()) { + for (Notification next : event.getNotifications()) { Object notifier = next.getNotifier(); // don't exclude CDOResources, which are EObjects as well as Resources, unless the change // is in some other property than the contents - if(notifier instanceof EObject) { - EObject object = (EObject)notifier; - if(object.eClass() != EresourcePackage.Literals.CDO_RESOURCE) { + if (notifier instanceof EObject) { + EObject object = (EObject) notifier; + if (object.eClass() != EresourcePackage.Literals.CDO_RESOURCE) { affectedObjects.add(object); - } else if(next.getFeature() == EresourcePackage.Literals.CDO_RESOURCE__CONTENTS) { + } else if (next.getFeature() == EresourcePackage.Literals.CDO_RESOURCE__CONTENTS) { affectedObjects.add(object); } } } - if(!affectedObjects.isEmpty()) { + if (!affectedObjects.isEmpty()) { operation.addContext(new CDOUndoContext(affectedObjects)); } } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOAwareModelSet.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOAwareModelSet.java index cfc43f96173..2eb16a61734 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOAwareModelSet.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOAwareModelSet.java @@ -1,6 +1,6 @@ /***************************************************************************** * Copyright (c) 2013, 2014 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 @@ -11,7 +11,7 @@ * Christian W. Damus (CEA) - bug 429242 * Christian W. Damus (CEA) - bug 422257 * Christian W. Damus (CEA) - bug 437052 - * + * *****************************************************************************/ package org.eclipse.papyrus.cdo.core.resource; @@ -94,7 +94,7 @@ public class CDOAwareModelSet extends OnDemandLoadingModelSet { protected EObject getCDOObject(URI uri, boolean loadOnDemand) { EObject result = null; - if(CDOProxyManager.isCDOProxyURI(uri)) { + if (CDOProxyManager.isCDOProxyURI(uri)) { // get a real proxy object, out of thin air, to give CDO the non-null // instance that it needs (otherwise the 'non-null constraint' of // all kinds of reference lists will be violated) @@ -131,7 +131,7 @@ public class CDOAwareModelSet extends OnDemandLoadingModelSet { @Override protected void demandLoad(Resource resource) throws IOException { - if(CDOUtils.isCDOURI(resource.getURI())) { + if (CDOUtils.isCDOURI(resource.getURI())) { // XML options not applicable to CDO resources resource.load(null); @@ -142,7 +142,7 @@ public class CDOAwareModelSet extends OnDemandLoadingModelSet { } protected void resourceLoadedHook(Resource resource) { - for(Diagram next : Iterables.filter(resource.getContents(), Diagram.class)) { + for (Diagram next : Iterables.filter(resource.getContents(), Diagram.class)) { DawnDiagramUpdater.initializeElement(next); } @@ -169,12 +169,12 @@ public class CDOAwareModelSet extends OnDemandLoadingModelSet { // Did any of the models create a new resource? (the DiModel and/or HistoryModel may have done) // If so, commit them now so that they don't dangle if we later close the editor without saving. - out: for(CDOResource next : Iterables.filter(getResources(), CDOResource.class)) { - switch(next.cdoState()) { + out: for (CDOResource next : Iterables.filter(getResources(), CDOResource.class)) { + switch (next.cdoState()) { case NEW: case DIRTY: try { - ((CDOTransaction)getCDOView()).commit(new NullProgressMonitor()); + ((CDOTransaction) getCDOView()).commit(new NullProgressMonitor()); } catch (CommitException e) { Activator.log.error("Commit implicitly created resources failed.", e); //$NON-NLS-1$ } @@ -187,17 +187,17 @@ public class CDOAwareModelSet extends OnDemandLoadingModelSet { } protected void initTransaction(URI uri) { - if(getCDOView() == null) { + if (getCDOView() == null) { // get the repository and start a transaction on it - if(repository == null) { + if (repository == null) { repository = repositoryManager.getRepositoryForURI(uri); } - if(repository != null) { + if (repository != null) { repository.createTransaction(this); CDOView view = getCDOView(); - if(view != null) { + if (view != null) { view.addListener(getInvalidationListener()); } } @@ -214,9 +214,9 @@ public class CDOAwareModelSet extends OnDemandLoadingModelSet { try { super.unload(); } finally { - if((repository != null) && (getCDOView() != null)) { + if ((repository != null) && (getCDOView() != null)) { CDOView view = getCDOView(); - if(view != null) { + if (view != null) { view.removeListener(getInvalidationListener()); } invalidationListener = null; @@ -234,7 +234,7 @@ public class CDOAwareModelSet extends OnDemandLoadingModelSet { } protected final IListener getInvalidationListener() { - if(invalidationListener == null) { + if (invalidationListener == null) { invalidationListener = createInvalidationListener(); } return invalidationListener; @@ -245,10 +245,10 @@ public class CDOAwareModelSet extends OnDemandLoadingModelSet { @Override public void notifyEvent(IEvent event) { - if(event instanceof CDOViewInvalidationEvent) { + if (event instanceof CDOViewInvalidationEvent) { TransactionalEditingDomain domain = getTransactionalEditingDomain(); - if(domain instanceof CDOAwareTransactionalEditingDomain) { - ((CDOAwareTransactionalEditingDomain)domain).fireResourceSetChanged((CDOViewInvalidationEvent)event); + if (domain instanceof CDOAwareTransactionalEditingDomain) { + ((CDOAwareTransactionalEditingDomain) domain).fireResourceSetChanged((CDOViewInvalidationEvent) event); } } } @@ -262,7 +262,7 @@ public class CDOAwareModelSet extends OnDemandLoadingModelSet { @Override public EList<Adapter> eAdapters() { - if(eAdapters == null) { + if (eAdapters == null) { eAdapters = new EAdapterList<Adapter>(this) { private static final long serialVersionUID = 1L; @@ -270,7 +270,7 @@ public class CDOAwareModelSet extends OnDemandLoadingModelSet { @Override public Adapter remove(int index) { Adapter toRemove = primitiveGet(index); - if((toRemove instanceof CDOViewSet) && !canDisconnectCDOViewSet()) { + if ((toRemove instanceof CDOViewSet) && !canDisconnectCDOViewSet()) { // don't allow its removal if my view is still open! // (Papyrus attempts to clear the resource set's adapters when disposing a ModelSet) return null; @@ -281,10 +281,10 @@ public class CDOAwareModelSet extends OnDemandLoadingModelSet { @Override public void clear() { - if(!canDisconnectCDOViewSet()) { + if (!canDisconnectCDOViewSet()) { // we can remove everything but the view-set adapter Adapter viewSetAdapter = getViewSetAdapter(); - if(viewSetAdapter != null) { + if (viewSetAdapter != null) { retainAll(Collections.singleton(viewSetAdapter)); } else { super.clear(); @@ -309,7 +309,7 @@ public class CDOAwareModelSet extends OnDemandLoadingModelSet { } boolean isDirty(Resource resource) { - return (resource instanceof CDOResource) && DIRTY_STATES.contains(((CDOResource)resource).cdoState()); + return (resource instanceof CDOResource) && DIRTY_STATES.contains(((CDOResource) resource).cdoState()); } @Override @@ -320,9 +320,9 @@ public class CDOAwareModelSet extends OnDemandLoadingModelSet { // any changes made by resource deletions? CDOView view = getCDOView(); - if((view instanceof CDOTransaction) && (getResourcesToDeleteOnSave().size() < initialCount)) { + if ((view instanceof CDOTransaction) && (getResourcesToDeleteOnSave().size() < initialCount)) { try { - ((CDOTransaction)view).commit(); + ((CDOTransaction) view).commit(); } catch (CommitException e) { Activator.log.error("Failed to commit resource deletions.", e); //$NON-NLS-1$ } @@ -335,10 +335,10 @@ public class CDOAwareModelSet extends OnDemandLoadingModelSet { Resource resource = getResource(uri, false); - // if it was meant to be deleted, an attempt would have been made to remove it. That may - // have been prevented if it was dirty. If it isn't now, then delete it. Otherwise, + // if it was meant to be deleted, an attempt would have been made to remove it. That may + // have been prevented if it was dirty. If it isn't now, then delete it. Otherwise, // block again - if((resource != null) && isDirty(resource)) { + if ((resource != null) && isDirty(resource)) { result = false; Activator.log.warn("Attempt to delete a dirty CDO resource: " + uri); //$NON-NLS-1$ } @@ -351,13 +351,13 @@ public class CDOAwareModelSet extends OnDemandLoadingModelSet { Resource res = getResource(uri, false); boolean result = res instanceof CDOResource; - if(!result) { - // not a CDO resource. Default behaviour + if (!result) { + // not a CDO resource. Default behaviour result = super.deleteResource(uri); } else { try { res.delete(null); - if(res.getResourceSet() != null) { + if (res.getResourceSet() != null) { res.unload(); res.getResourceSet().getResources().remove(res); } @@ -375,13 +375,13 @@ public class CDOAwareModelSet extends OnDemandLoadingModelSet { CDOTransaction transaction = null; Collection<CDOObject> updates; - if((view instanceof CDOTransaction) && view.isDirty()) { + if ((view instanceof CDOTransaction) && view.isDirty()) { // collect updated objects to post-process for cross-unit references - transaction = (CDOTransaction)view; + transaction = (CDOTransaction) view; updates = ImmutableList.<CDOObject> builder() // - .addAll(transaction.getNewObjects().values()) // - .addAll(transaction.getDirtyObjects().values()) // - .build(); + .addAll(transaction.getNewObjects().values()) // + .addAll(transaction.getDirtyObjects().values()) // + .build(); } else { updates = Collections.emptyList(); } @@ -390,24 +390,24 @@ public class CDOAwareModelSet extends OnDemandLoadingModelSet { super.save(sub.newChild(1)); - if(!updates.isEmpty()) { + if (!updates.isEmpty()) { CDOControlModeParticipant control = new CDOControlModeParticipant(); CDOControlModeParticipant.IUpdate run = CDOControlModeParticipant.IUpdate.EMPTY; - for(CDOObject next : updates) { + for (CDOObject next : updates) { EObject object = CDOUtil.getEObject(next); - if(object != null) { - for(EReference xref : object.eClass().getEAllReferences()) { + if (object != null) { + for (EReference xref : object.eClass().getEAllReferences()) { // do include containment references because we may have added a model // element and controlled it in the same transaction - if(xref.isChangeable() && !xref.isDerived() && !xref.isTransient()) { + if (xref.isChangeable() && !xref.isDerived() && !xref.isTransient()) { run = run.chain(control.getProxyCrossReferencesUpdate(object, xref)); } } } } - if(!run.isEmpty()) { + if (!run.isEmpty()) { run.apply(); try { @@ -435,9 +435,9 @@ public class CDOAwareModelSet extends OnDemandLoadingModelSet { @Override public boolean remove(Object object) { - boolean result = !(object instanceof CDOResource) || !isDirty((CDOResource)object); + boolean result = !(object instanceof CDOResource) || !isDirty((CDOResource) object); - if(result) { + if (result) { result = super.remove(object); } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOAwareModelSetServiceFactory.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOAwareModelSetServiceFactory.java index cb7e95ccce5..c70b12832ff 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOAwareModelSetServiceFactory.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOAwareModelSetServiceFactory.java @@ -1,6 +1,6 @@ /***************************************************************************** * Copyright (c) 2013, 2014 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 @@ -9,7 +9,7 @@ * Contributors: * CEA LIST - Initial API and implementation * Christian W. Damus (CEA) - bug 431953 (pre-requisite refactoring of ModelSet service start-up) - * + * *****************************************************************************/ package org.eclipse.papyrus.cdo.core.resource; diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOAwareProxyModificationTrackingAdapter.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOAwareProxyModificationTrackingAdapter.java index 2f449b3403b..12b0b7076e0 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOAwareProxyModificationTrackingAdapter.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOAwareProxyModificationTrackingAdapter.java @@ -1,6 +1,6 @@ /***************************************************************************** * Copyright (c) 2014 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 @@ -34,11 +34,11 @@ public class CDOAwareProxyModificationTrackingAdapter extends ProxyModificationT public boolean shouldSave(Resource resource) { boolean result; - if(resource instanceof CDOResource) { - CDOView view = ((CDOResource)resource).cdoView(); - if(view instanceof CDOTransaction) { + if (resource instanceof CDOResource) { + CDOView view = ((CDOResource) resource).cdoView(); + if (view instanceof CDOTransaction) { // Saving CDO resources is done by committing the transaction - result = ((CDOTransaction)view).isDirty(); + result = ((CDOTransaction) view).isDirty(); } else { // If there's no view or it's not a transaction, then saving is a non-starter result = false; @@ -56,7 +56,7 @@ public class CDOAwareProxyModificationTrackingAdapter extends ProxyModificationT // Only for non-CDO resources do we care if the URI has changed or contents been added, because // references within the repository use OIDs and are, therefore, not susceptible to URI changes - if(!(notifier instanceof CDOResource)) { + if (!(notifier instanceof CDOResource)) { super.notifyChanged(msg); } } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOAwareTransactionalEditingDomain.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOAwareTransactionalEditingDomain.java index 926c6c3079a..cd63d361ca6 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOAwareTransactionalEditingDomain.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOAwareTransactionalEditingDomain.java @@ -1,6 +1,6 @@ /***************************************************************************** * Copyright (c) 2013, 2014 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 @@ -10,7 +10,7 @@ * CEA LIST - Initial API and implementation * Christian W. Damus (CEA) - bug 323802 * Christian W. Damus (CEA) - bug 415639 - * + * *****************************************************************************/ package org.eclipse.papyrus.cdo.core.resource; @@ -51,7 +51,7 @@ public class CDOAwareTransactionalEditingDomain extends PapyrusROTransactionalEd // Append to the transaction first super.appendNotification(notification); - if(!NotificationFilter.READ.matches(notification)) { + if (!NotificationFilter.READ.matches(notification)) { // Check whether we are modifying a read-only object assertNotReadOnly(notification.getNotifier()); } else { @@ -74,12 +74,12 @@ public class CDOAwareTransactionalEditingDomain extends PapyrusROTransactionalEd @Override public void run() { - for(ResourceSetListener element : listeners) { + for (ResourceSetListener element : listeners) { try { element.resourceSetChanged(new ResourceSetChangeEvent(CDOAwareTransactionalEditingDomain.this, transaction, notifications)); } catch (Exception e) { Activator.log.error("Uncaught exception in resource set change listener.", //$NON-NLS-1$ - e); + e); } } } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOAwareTransactionalEditingDomainProvider.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOAwareTransactionalEditingDomainProvider.java index 35ec73a4727..9d649583fe0 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOAwareTransactionalEditingDomainProvider.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOAwareTransactionalEditingDomainProvider.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOReadOnlyHandler.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOReadOnlyHandler.java index 08886591c1a..a1e35b2d7cf 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOReadOnlyHandler.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOReadOnlyHandler.java @@ -1,6 +1,6 @@ /***************************************************************************** * Copyright (c) 2013, 2014 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 @@ -9,7 +9,7 @@ * Contributors: * CEA LIST - Initial API and implementation * Christian W. Damus (CEA) - bug 429826 - * + * *****************************************************************************/ package org.eclipse.papyrus.cdo.core.resource; @@ -39,10 +39,10 @@ public class CDOReadOnlyHandler extends AbstractReadOnlyHandler { public Optional<Boolean> anyReadOnly(Set<ReadOnlyAxis> axes, URI[] uris) { Optional<Boolean> result = Optional.absent(); - if(axes.contains(ReadOnlyAxis.PERMISSION) && (uris.length > 0) && CDOUtils.isCDOEditingDomain(getEditingDomain())) { - for(int i = 0; !result.or(Boolean.FALSE) && (i < uris.length); i++) { + if (axes.contains(ReadOnlyAxis.PERMISSION) && (uris.length > 0) && CDOUtils.isCDOEditingDomain(getEditingDomain())) { + for (int i = 0; !result.or(Boolean.FALSE) && (i < uris.length); i++) { // if it's a cdo:// URI, then I have a definitive answer - if(CDOUtils.isCDOURI(uris[i])) { + if (CDOUtils.isCDOURI(uris[i])) { result = Optional.of(isReadOnly(uris[i])); } } @@ -55,8 +55,8 @@ public class CDOReadOnlyHandler extends AbstractReadOnlyHandler { boolean result = false; Resource resource = getEditingDomain().getResourceSet().getResource(uri, false); - if(resource instanceof CDOObject) { - result = CDOUtils.isReadOnly((CDOObject)resource); + if (resource instanceof CDOObject) { + result = CDOUtils.isReadOnly((CDOObject) resource); } return result; @@ -66,11 +66,11 @@ public class CDOReadOnlyHandler extends AbstractReadOnlyHandler { public Optional<Boolean> isReadOnly(Set<ReadOnlyAxis> axes, EObject eObject) { Optional<Boolean> result = Optional.absent(); - if(axes.contains(ReadOnlyAxis.PERMISSION)) { + if (axes.contains(ReadOnlyAxis.PERMISSION)) { Resource resource = eObject.eResource(); - if((resource == null) || CDOUtils.isCDOURI(resource.getURI())) { + if ((resource == null) || CDOUtils.isCDOURI(resource.getURI())) { CDOObject cdo = CDOUtils.getCDOObject(eObject); - if(cdo != null) { + if (cdo != null) { // I have a definitive answer for CDO objects result = Optional.of(CDOUtils.isReadOnly(cdo)); } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOUndoContext.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOUndoContext.java index 840428a31c2..901b184070e 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOUndoContext.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOUndoContext.java @@ -1,6 +1,6 @@ /***************************************************************************** * Copyright (c) 2013, 2014 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 @@ -9,7 +9,7 @@ * Contributors: * CEA LIST - Initial API and implementation * Christian W. Damus (CEA) - bug 432813 - * + * *****************************************************************************/ package org.eclipse.papyrus.cdo.core.resource; @@ -41,17 +41,17 @@ public final class CDOUndoContext implements IUndoContext { /** * Initializes me with a non-empty aggregate of affected objects. - * + * * @param affectedObjects - * the affected objects to record - * + * the affected objects to record + * * @throws IllegalArgumentException - * if the {@code affectedObjects} is empty + * if the {@code affectedObjects} is empty */ public CDOUndoContext(Iterable<? extends EObject> affectedObjects) { super(); - if(Iterables.isEmpty(affectedObjects)) { + if (Iterables.isEmpty(affectedObjects)) { throw new IllegalArgumentException("affectedObjects is empty"); //$NON-NLS-1$ } @@ -66,9 +66,9 @@ public final class CDOUndoContext implements IUndoContext { /** * Flushes all {@code CDOUndoContext}s from the specified operation {@code history}. - * + * * @param history - * a history to flush + * a history to flush */ public static void flushAll(IOperationHistory history) { history.dispose(ALL_CDO, true, true, true); @@ -76,7 +76,7 @@ public final class CDOUndoContext implements IUndoContext { /** * Obtains an immutable set of the objects affected by the operation. - * + * * @return my affected objects. This set is immutable */ public Set<EObject> getAffectedObjects() { @@ -85,15 +85,15 @@ public final class CDOUndoContext implements IUndoContext { @Override public boolean matches(IUndoContext context) { - return (context == ALL_CDO) || (context instanceof CDOUndoContext) && !Sets.intersection(getAffectedObjects(), ((CDOUndoContext)context).getAffectedObjects()).isEmpty(); + return (context == ALL_CDO) || (context instanceof CDOUndoContext) && !Sets.intersection(getAffectedObjects(), ((CDOUndoContext) context).getAffectedObjects()).isEmpty(); } @Override public String getLabel() { - if(cachedLabel == null) { + if (cachedLabel == null) { StringBuilder buf = new StringBuilder(); Joiner.on(", ").appendTo(buf, Iterables.limit(affectedObjects, 3)); //$NON-NLS-1$ - if(affectedObjects.size() > 3) { + if (affectedObjects.size() > 3) { buf.append(", ..."); //$NON-NLS-1$ } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/PapyrusCDOResourceFactory.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/PapyrusCDOResourceFactory.java index 95871cf546f..dad6cfcb5a3 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/PapyrusCDOResourceFactory.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/PapyrusCDOResourceFactory.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -29,10 +29,11 @@ public class PapyrusCDOResourceFactory this.modelSet = modelSet; } + @Override protected CDOResourceImpl createCDOResource(URI uri) { return new PapyrusDawnResourceImpl(uri); } - + @Override protected boolean isGetResource() { return modelSet.isInGetResource() || super.isGetResource(); diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/PapyrusDawnResourceImpl.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/PapyrusDawnResourceImpl.java index 74caa5e54de..08644ba57f7 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/PapyrusDawnResourceImpl.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/PapyrusDawnResourceImpl.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -57,11 +57,11 @@ public class PapyrusDawnResourceImpl extends DawnWrapperResourceImpl { @Override public void setTrackingModification(boolean newTrackingModification) { // don't support tracking modification in read-only views because CDO - // throws a ReadOnlyException. But, it should be harmless to attempt to + // throws a ReadOnlyException. But, it should be harmless to attempt to // set it because it couldn't possibly be needed, anyways - if(!cdoView().isReadOnly()) { + if (!cdoView().isReadOnly()) { // XXX: actually, we can't set modification tracking because it is completely - // broken in CDO. See http://www.eclipse.org/forums/index.php/t/457863/ + // broken in CDO. See http://www.eclipse.org/forums/index.php/t/457863/ // super.setTrackingModification(newTrackingModification); } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/util/CDOFunctions.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/util/CDOFunctions.java index 9591b07b14f..07b05cc8a8f 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/util/CDOFunctions.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/util/CDOFunctions.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -68,6 +68,7 @@ public class CDOFunctions { this.adapterType = adapterType; } + @Override public T apply(F input) { return CDOUtils.adapt(input, adapterType); } @@ -84,7 +85,7 @@ public class CDOFunctions { @Override public boolean equals(Object other) { - return (other instanceof AdaptFunction<?, ?>) && (((AdaptFunction<?, ?>)other).adapterType == adapterType); + return (other instanceof AdaptFunction<?, ?>) && (((AdaptFunction<?, ?>) other).adapterType == adapterType); } } @@ -96,8 +97,9 @@ public class CDOFunctions { this.rootElementType = rootElementType; } + @Override public T apply(Resource input) { - if(!input.isLoaded()) { + if (!input.isLoaded()) { try { input.load(null); } catch (Exception e) { @@ -120,7 +122,7 @@ public class CDOFunctions { @Override public boolean equals(Object other) { - return (other instanceof ResourceRootFunction<?>) && (((ResourceRootFunction<?>)other).rootElementType == rootElementType); + return (other instanceof ResourceRootFunction<?>) && (((ResourceRootFunction<?>) other).rootElementType == rootElementType); } } @@ -132,13 +134,14 @@ public class CDOFunctions { this.nodeType = nodeType; } + @Override public Iterable<T> apply(CDOResourceNode input) { Iterable<T> result; - if(input instanceof CDOResourceFolder) { - result = Iterables.filter(((CDOResourceFolder)input).getNodes(), nodeType); - } else if(input.isRoot()) { - result = Iterables.filter(((CDOResource)input).getContents(), nodeType); + if (input instanceof CDOResourceFolder) { + result = Iterables.filter(((CDOResourceFolder) input).getNodes(), nodeType); + } else if (input.isRoot()) { + result = Iterables.filter(((CDOResource) input).getContents(), nodeType); } else { result = Collections.emptyList(); } @@ -158,7 +161,7 @@ public class CDOFunctions { @Override public boolean equals(Object other) { - return (other instanceof FolderContentsFunction<?>) && (((FolderContentsFunction<?>)other).nodeType == nodeType); + return (other instanceof FolderContentsFunction<?>) && (((FolderContentsFunction<?>) other).nodeType == nodeType); } } @@ -170,6 +173,7 @@ public class CDOFunctions { super(); } + @Override public EObject apply(CDOObject input) { return CDOUtil.getEObject(input); } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/util/CDOPredicates.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/util/CDOPredicates.java index 03c93eab060..1bd6ce968d6 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/util/CDOPredicates.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/util/CDOPredicates.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -36,7 +36,7 @@ public class CDOPredicates { } public static Predicate<CDOResourceNode> hasURIPrefix(URI prefix) { - if(!prefix.isPrefix()) { + if (!prefix.isPrefix()) { throw new IllegalArgumentException("not a URI prefix"); //$NON-NLS-1$ } @@ -55,6 +55,7 @@ public class CDOPredicates { this.fileExtension = fileExtension; } + @Override public boolean apply(CDOResourceNode input) { return fileExtension.equals(input.getURI().fileExtension()); } @@ -71,7 +72,7 @@ public class CDOPredicates { @Override public boolean equals(Object other) { - return (other instanceof HasExtension) && ((HasExtension)other).fileExtension.equals(fileExtension); + return (other instanceof HasExtension) && ((HasExtension) other).fileExtension.equals(fileExtension); } } @@ -81,6 +82,7 @@ public class CDOPredicates { super(); } + @Override public boolean apply(CDOResourceNode input) { return input.getURI().fileExtension() == null; } @@ -109,6 +111,7 @@ public class CDOPredicates { this.prefix = prefix; } + @Override public boolean apply(CDOResourceNode input) { return input.getURI().toString().startsWith(prefix.toString()); } @@ -125,7 +128,7 @@ public class CDOPredicates { @Override public boolean equals(Object other) { - return (other instanceof HasURIPrefix) && ((HasURIPrefix)other).prefix.equals(prefix); + return (other instanceof HasURIPrefix) && ((HasURIPrefix) other).prefix.equals(prefix); } } } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/util/JobWaiter.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/util/JobWaiter.java index cdce25a45b4..7883139a626 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/util/JobWaiter.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/util/JobWaiter.java @@ -1,6 +1,6 @@ /***************************************************************************** * Copyright (c) 2013, 2014 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 @@ -9,7 +9,7 @@ * Contributors: * CEA LIST - Initial API and implementation * Christian W. Damus (CEA) - bug 439725 - * + * *****************************************************************************/ package org.eclipse.papyrus.cdo.core.util; @@ -49,18 +49,18 @@ public class JobWaiter { /** * Wait for all jobs (if any) in the given {@code family} to finish. - * + * * @param family - * a job family to wait for + * a job family to wait for * @param timeout - * a positive timeout + * a positive timeout * @param unit - * the time unit for the {@code timeout} - * + * the time unit for the {@code timeout} + * * @return {@code true} on successful wait (if required); {@code false} on time-out - * + * * @throws InterruptedException - * if the wait is interrupted + * if the wait is interrupted */ public static boolean waitFor(Object family, long timeout, TimeUnit unit) throws InterruptedException { return new JobWaiter(null, family).doWait(timeout, unit); @@ -68,25 +68,25 @@ public class JobWaiter { /** * Wait for a specific {@code job} to finish. - * + * * @param job - * a job to wait for + * a job to wait for * @param timeout - * a positive timeout + * a positive timeout * @param unit - * the time unit for the {@code timeout} - * + * the time unit for the {@code timeout} + * * @return {@code true} on successful wait (if required); {@code false} on time-out - * + * * @throws InterruptedException - * if the wait is interrupted + * if the wait is interrupted */ public static boolean waitFor(Job job, long timeout, TimeUnit unit) throws InterruptedException { return new JobWaiter(job, null).doWait(timeout, unit); } protected boolean doWait(long timeout, TimeUnit unit) throws InterruptedException { - if(timeout <= 0) { + if (timeout <= 0) { throw new IllegalArgumentException("Non-positive timeout"); //$NON-NLS-1$ } @@ -98,7 +98,7 @@ public class JobWaiter { timeoutService.schedule(timeoutTask, timeout, unit); try { - if(targetJob != null) { + if (targetJob != null) { // the Job::join() API documents that it is interruptible, but the // actual implementation in the JobManager is not new JobFinishListener(targetJob).await(); @@ -110,11 +110,11 @@ public class JobWaiter { result = true; timeoutTask.cancel(); - if(Thread.interrupted()) { + if (Thread.interrupted()) { throw new InterruptedException(); } } catch (InterruptedException e) { - if(timeoutTask.timedOut()) { + if (timeoutTask.timedOut()) { // normal condition: time-out task interrupted us } else { // "real" interruption @@ -139,7 +139,7 @@ public class JobWaiter { @Override public void run() { - if(!cancelled.get()) { + if (!cancelled.get()) { timedOut.set(true); toInterrupt.interrupt(); } @@ -170,9 +170,9 @@ public class JobWaiter { synchronized void await() throws InterruptedException { try { - for(;;) { + for (;;) { // Check done condition because our job/family may have finished already before we got here - if(done || checkDone()) { + if (done || checkDone()) { break; } @@ -186,7 +186,7 @@ public class JobWaiter { @Override public synchronized void done(IJobChangeEvent event) { - if(checkDone()) { + if (checkDone()) { try { done = true; dispose(); diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/Activator.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/Activator.java index 9bd92de30e2..78034ff32dc 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/Activator.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/Activator.java @@ -25,7 +25,7 @@ public class Activator extends Plugin { public void start(BundleContext context) throws Exception { super.start(context); plugin = this; - + // register the log helper log.setPlugin(plugin); } @@ -39,7 +39,7 @@ public class Activator extends Plugin { /** * Returns the shared instance - * + * * @return the shared instance */ public static Activator getDefault() { diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/CDOProxyResolvingResourceSet.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/CDOProxyResolvingResourceSet.java index 0409c4e4dc2..f79d3ff1047 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/CDOProxyResolvingResourceSet.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/CDOProxyResolvingResourceSet.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -36,7 +36,7 @@ public class CDOProxyResolvingResourceSet extends ResourceSetImpl { public EObject getEObject(URI uri, boolean loadOnDemand) { EObject result; - if(CDOProxyManager.isCDOProxyURI(uri)) { + if (CDOProxyManager.isCDOProxyURI(uri)) { // force loading (ignore 'loadOnDemand') because export requires a complete model Resource res = getResource(uri.trimFragment(), true); result = (res == null) ? null : res.getEObject(CDOProxyManager.extractOIDFragment(uri)); diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/CDOUtils.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/CDOUtils.java index f0d11c8a3c2..b508b55ae09 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/CDOUtils.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/CDOUtils.java @@ -1,6 +1,6 @@ /***************************************************************************** * Copyright (c) 2013, 2014 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 @@ -9,7 +9,7 @@ * Contributors: * CEA LIST - Initial API and implementation * Christian W. Damus (CEA) - bug 422257 - * + * *****************************************************************************/ package org.eclipse.papyrus.cdo.internal.core; @@ -84,20 +84,20 @@ public class CDOUtils { public static <T> T adapt(Object object, Class<? extends T> type) { T result = tryCast(object, type); - if(result == null) { - if(object instanceof IAdaptable) { - result = type.cast(((IAdaptable)object).getAdapter(type)); + if (result == null) { + if (object instanceof IAdaptable) { + result = type.cast(((IAdaptable) object).getAdapter(type)); } - if((result == null) && (type == CDOObject.class)) { + if ((result == null) && (type == CDOObject.class)) { EObject eObject = adapt(object, EObject.class); - if(eObject != null) { + if (eObject != null) { result = type.cast(getCDOObject(eObject)); } } - if((result == null) && (object instanceof Notifier)) { - result = getFirst(filter(((Notifier)object).eAdapters(), type), null); + if ((result == null) && (object instanceof Notifier)) { + result = getFirst(filter(((Notifier) object).eAdapters(), type), null); } } @@ -107,7 +107,7 @@ public class CDOUtils { public static <T> T tryCast(Object object, Class<? extends T> type) { T result = null; - if(type.isInstance(object)) { + if (type.isInstance(object)) { result = type.cast(object); } @@ -125,21 +125,21 @@ public class CDOUtils { public static ResourceSet getResourceSet(Notifier notifier) { ResourceSet result = null; - if(notifier instanceof CDOViewSet) { - result = ((CDOViewSet)notifier).getResourceSet(); - } else if(notifier instanceof ResourceSet) { - result = (ResourceSet)notifier; - } else if(notifier instanceof Resource) { - result = ((Resource)notifier).getResourceSet(); - } else if(notifier instanceof CDOResourceNode) { + if (notifier instanceof CDOViewSet) { + result = ((CDOViewSet) notifier).getResourceSet(); + } else if (notifier instanceof ResourceSet) { + result = (ResourceSet) notifier; + } else if (notifier instanceof Resource) { + result = ((Resource) notifier).getResourceSet(); + } else if (notifier instanceof CDOResourceNode) { // folders (resource nodes that aren't resources) are not in a // resource set, so get the associated view's resource set - CDOView view = ((CDOResourceNode)notifier).cdoView(); - if(view != null) { + CDOView view = ((CDOResourceNode) notifier).cdoView(); + if (view != null) { result = view.getResourceSet(); } - } else if(notifier instanceof EObject) { - result = getResourceSet(((EObject)notifier).eResource()); + } else if (notifier instanceof EObject) { + result = getResourceSet(((EObject) notifier).eResource()); } return result; @@ -154,7 +154,7 @@ public class CDOUtils { public static CDOObject getCDOObject(EObject object) { CDOObject result = null; - if(isCDOObject(object)) { + if (isCDOObject(object)) { result = CDOUtil.getCDOObject(object); } @@ -170,9 +170,9 @@ public class CDOUtils { CDOView result = null; CDOViewSet viewSet = CDOUtil.getViewSet(resourceSet); - if(viewSet != null) { + if (viewSet != null) { CDOView[] views = viewSet.getViews(); - if(views.length > 0) { + if (views.length > 0) { result = views[0]; } } @@ -210,12 +210,12 @@ public class CDOUtils { DawnState result = DawnState.CLEAN; CDOObject cdo = getCDOObject(object); - if(cdo != null) { - if(cdo.cdoConflict()) { + if (cdo != null) { + if (cdo.cdoConflict()) { result = DawnState.CONFLICT; - } else if(isLocked(cdo, true)) { + } else if (isLocked(cdo, true)) { result = DawnState.LOCKED_REMOTELY; - } else if(isLocked(cdo, false)) { + } else if (isLocked(cdo, false)) { result = DawnState.LOCKED_LOCALLY; } } @@ -228,7 +228,7 @@ public class CDOUtils { boolean result = CDOUtils.isLocked(object, true); // or if the current user doesn't have permission to write it - if(!result) { + if (!result) { result = !object.cdoPermission().isWritable(); } @@ -243,16 +243,16 @@ public class CDOUtils { Iterable<EStructuralFeature.Setting> result; ECrossReferenceAdapter adapter = adapt(object, ECrossReferenceAdapter.class); - if(adapter != null) { + if (adapter != null) { result = adapter.getInverseReferences(object); } else { EObject tree = EcoreUtil.getRootContainer(object); Resource resource = tree.eResource(); ResourceSet rset = (resource == null) ? null : resource.getResourceSet(); - if(rset != null) { + if (rset != null) { result = EcoreUtil.UsageCrossReferencer.find(object, rset); - } else if(resource != null) { + } else if (resource != null) { result = EcoreUtil.UsageCrossReferencer.find(object, resource); } else { result = EcoreUtil.UsageCrossReferencer.find(object, tree); @@ -266,23 +266,23 @@ public class CDOUtils { * Obtains an unmodifiable iterator over the values in the specified {@code feature} of an {@code object}. The resulting iterator supplies zero * or one element for scalar features, according to whether the feature's value is {@code null} or not. In the case of a scalar feature, * the index of the element as reported by {@link ListIterator#nextIndex()} and {@link ListIterator#previousIndex()} is {@code -1}. - * + * * @param object - * an object + * an object * @param feature - * a feature of the {@code object} + * a feature of the {@code object} * @param resolve - * whether to resolve proxies (in the case of an {@link EReference} - * + * whether to resolve proxies (in the case of an {@link EReference} + * * @return the unmodifiable feature list iterator */ public static <E> FeatureListIterator<E> iterator(EObject object, final EStructuralFeature feature, boolean resolve) { FeatureListIterator<E> result; Object value = object.eGet(feature, resolve); - if(value instanceof InternalEList<?>) { + if (value instanceof InternalEList<?>) { @SuppressWarnings("unchecked") - InternalEList<E> list = (InternalEList<E>)value; + InternalEList<E> list = (InternalEList<E>) value; final ListIterator<E> delegate = (resolve) ? list.listIterator() : list.basicListIterator(); class NonEmpty extends UnmodifiableListIterator<E> implements FeatureListIterator<E> { @@ -321,10 +321,11 @@ public class CDOUtils { public int previousIndex() { return delegate.previousIndex(); } - }; + } + ; result = new NonEmpty(); - } else if(value == null) { + } else if (value == null) { class Empty extends UnmodifiableListIterator<E> implements FeatureListIterator<E> { @Override @@ -361,12 +362,13 @@ public class CDOUtils { public int previousIndex() { return -2; } - }; + } + ; result = new Empty(); } else { @SuppressWarnings("unchecked") - final E onlyValue = (E)value; + final E onlyValue = (E) value; class Singleton extends UnmodifiableListIterator<E> implements FeatureListIterator<E> { @@ -384,7 +386,7 @@ public class CDOUtils { @Override public E next() { - if(!hasNext()) { + if (!hasNext()) { throw new NoSuchElementException(); } index++; @@ -403,7 +405,7 @@ public class CDOUtils { @Override public E previous() { - if(!hasPrevious()) { + if (!hasPrevious()) { throw new NoSuchElementException(); } index--; @@ -414,7 +416,8 @@ public class CDOUtils { public int previousIndex() { return index - 1; } - }; + } + ; result = new Singleton(); } @@ -424,15 +427,15 @@ public class CDOUtils { /** * <p> - * Runs a code block that broadcasts notification of {@link ResourceSetChangeEvent}s, {@link CDOViewInvalidationEvent}s, etc. to listeners using - * the most appropriate {@linkplain #setBroadcastExecutor() executor} available. This allows a UI-safe execution to be injected if necessary. + * Runs a code block that broadcasts notification of {@link ResourceSetChangeEvent}s, {@link CDOViewInvalidationEvent}s, etc. to listeners using the most appropriate {@linkplain #setBroadcastExecutor() executor} available. This allows a UI-safe execution + * to be injected if necessary. * </p> * <p> * <strong>Note</strong> that there is no assurance that this block will be executed either synchronously or asynchronously. * </p> - * + * * @param broadcastCommand - * the notification command to execute + * the notification command to execute */ public static void notify(Runnable broadcastCommand) { broadcastExecutor.execute(broadcastCommand); @@ -459,19 +462,19 @@ public class CDOUtils { /** * Remove the given {@code listener} if the event it received is a lifecycle deactivation event. - * + * * @param listener - * a listener that received a possible deactivation event + * a listener that received a possible deactivation event * @param possibleDeactivation - * the event that may be a lifecycle deactivation - * + * the event that may be a lifecycle deactivation + * * @return whether the listener was removed because the event was a deactivation */ public static boolean removeListenerFromDeactivatedLifecycle(IListener listener, IEvent possibleDeactivation) { boolean result = false; - if(possibleDeactivation instanceof LifecycleEvent) { - switch(((LifecycleEvent)possibleDeactivation).getKind()) { + if (possibleDeactivation instanceof LifecycleEvent) { + switch (((LifecycleEvent) possibleDeactivation).getKind()) { case DEACTIVATED: possibleDeactivation.getSource().removeListener(listener); result = true; @@ -487,24 +490,24 @@ public class CDOUtils { /** * Unloads a {@code cdoObject} (because {@link CDOResource}s don't implement unloading) by clearing its adapters. - * + * * @param cdoObject - * a CDO object to unload - * + * a CDO object to unload + * * @see #unload(CDOView) */ public static void unload(CDOObject cdoObject) { EObject eObject = CDOUtil.getEObject(cdoObject); - if(eObject != null) { + if (eObject != null) { // Remove all adapters *except* the all-important legacy wrapper! EList<Adapter> adapters = eObject.eAdapters(); - if(!adapters.isEmpty()) { + if (!adapters.isEmpty()) { Adapter legacyWrapper = Iterables.find(eObject.eAdapters(), IS_LEGACY_WRAPPER, null); // Don't do anything if the only adapter is the legacy wrapper - if((legacyWrapper == null) || (adapters.size() > 1)) { + if ((legacyWrapper == null) || (adapters.size() > 1)) { adapters.clear(); - if(legacyWrapper != null) { + if (legacyWrapper != null) { // Restore it, otherwise references to this CDOObject will break adapters.add(0, legacyWrapper); } @@ -515,17 +518,17 @@ public class CDOUtils { /** * Unloads aall of the objects in a {@code cdoView} (because {@link CDOResource}s don't implement unloading) by clearing thriw adapters. - * + * * @param cdoView - * a view to unload - * + * a view to unload + * * @see #unload(CDOObject) */ public static void unload(CDOView cdoView) { - if(cdoView instanceof InternalCDOView) { - for(CDOObject next : ((InternalCDOView)cdoView).getObjectsList()) { + if (cdoView instanceof InternalCDOView) { + for (CDOObject next : ((InternalCDOView) cdoView).getObjectsList()) { // Don't clear adapters of the resource because ECrossReferenceAdapters would try to crawl the contents - if(!(next instanceof CDOResourceNode)) { + if (!(next instanceof CDOResourceNode)) { CDOUtils.unload(next); } } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/CompositeResourceSetDisposalApprover.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/CompositeResourceSetDisposalApprover.java index 0ecbfbf9c4c..6c616efd6e4 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/CompositeResourceSetDisposalApprover.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/CompositeResourceSetDisposalApprover.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -27,25 +27,26 @@ class CompositeResourceSetDisposalApprover implements IResourceSetDisposalApprover { private final List<IResourceSetDisposalApprover> approvers = Lists - .newArrayListWithExpectedSize(1); + .newArrayListWithExpectedSize(1); CompositeResourceSetDisposalApprover() { super(); } + @Override public DisposeAction disposalRequested(IPapyrusRepository repository, Collection<ResourceSet> resourceSets) { - + DisposeAction result = DisposeAction.CLOSE; if (!resourceSets.isEmpty() && !approvers.isEmpty()) { for (IResourceSetDisposalApprover next : approvers) { DisposeAction action = wrapNull(next - .disposalRequested(repository, resourceSets)); + .disposalRequested(repository, resourceSets)); result = result.compareTo(action) > 0 - ? action - : result; + ? action + : result; if (result == DisposeAction.NONE) { // no need to consult anyone else @@ -59,8 +60,8 @@ class CompositeResourceSetDisposalApprover private DisposeAction wrapNull(DisposeAction action) { return (action == null) - ? DisposeAction.NONE - : action; + ? DisposeAction.NONE + : action; } void addApprover(IResourceSetDisposalApprover approver) { diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/GMFSafePackageProcessor.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/GMFSafePackageProcessor.java index 7fd55b7ad5c..fc3118e89d0 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/GMFSafePackageProcessor.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/GMFSafePackageProcessor.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -38,14 +38,15 @@ class GMFSafePackageProcessor implements PackageProcessor { this.delegate = processor; } + @Override public Object processPackage(Object value) { Object result = NOT_PROCESSED_TOKEN; - if(EMFUtil.isDynamicEPackage(value)) { - EPackage ePackage = (EPackage)value; + if (EMFUtil.isDynamicEPackage(value)) { + EPackage ePackage = (EPackage) value; TransactionalEditingDomain domain = TransactionUtil.getEditingDomain(ePackage); - if(domain != null) { - InternalTransactionalEditingDomain internalDomain = (InternalTransactionalEditingDomain)domain; + if (domain != null) { + InternalTransactionalEditingDomain internalDomain = (InternalTransactionalEditingDomain) domain; Transaction transaction = null; try { @@ -61,7 +62,7 @@ class GMFSafePackageProcessor implements PackageProcessor { } } - if(result == NOT_PROCESSED_TOKEN) { + if (result == NOT_PROCESSED_TOKEN) { // just delegate result = delegate.processPackage(value); } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/ICredentialsProviderFactory.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/ICredentialsProviderFactory.java index 0f8599f41b0..423ea09ad09 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/ICredentialsProviderFactory.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/ICredentialsProviderFactory.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/IInteractiveCredentialsProvider.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/IInteractiveCredentialsProvider.java index 842328d5823..c7d959a2b1f 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/IInteractiveCredentialsProvider.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/IInteractiveCredentialsProvider.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -15,7 +15,7 @@ import org.eclipse.net4j.util.security.IPasswordCredentialsProvider2; /** - * This is the IInteractiveCredentialsProvider type. Enjoy. + * This is the IInteractiveCredentialsProvider type. Enjoy. */ public interface IInteractiveCredentialsProvider extends IPasswordCredentialsProvider2 { diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/IInternalPapyrusRepository.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/IInternalPapyrusRepository.java index bbb406d10d0..af36d58f7db 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/IInternalPapyrusRepository.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/IInternalPapyrusRepository.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -18,14 +18,14 @@ import org.eclipse.papyrus.cdo.core.IPapyrusRepository; /** - * This is the IInternalPapyrusRepository type. Enjoy. + * This is the IInternalPapyrusRepository type. Enjoy. */ public interface IInternalPapyrusRepository extends IPapyrusRepository { CDOSession getCDOSession(); - + CDOView getMasterView(); - + CDOView getCDOView(ResourceSet resourceSet); } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/IInternalPapyrusRepositoryManager.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/IInternalPapyrusRepositoryManager.java index ce5101b4f8e..c9bd731ff47 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/IInternalPapyrusRepositoryManager.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/IInternalPapyrusRepositoryManager.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/IRepositoryModelStorage.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/IRepositoryModelStorage.java index 4b4e847fb84..0193c4bb9d0 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/IRepositoryModelStorage.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/IRepositoryModelStorage.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -22,10 +22,10 @@ public interface IRepositoryModelStorage { /** * Obtains an input stream on the repository model storage, if any. - * + * * @return an input stream, or {@code null} if there is no repository model * currently stored - * + * * @throws IOException * on any failure to get an input stream that is not simply that * the storage doesn't yet exist @@ -35,9 +35,9 @@ public interface IRepositoryModelStorage { /** * Obtains an output stream on the repository model storage. - * + * * @return an output stream (may not be {@code null}) - * + * * @throws IOException * on any failure to get an output stream */ diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/PapyrusRepository.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/PapyrusRepository.java index 5cdfa656215..8b6c0bb7549 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/PapyrusRepository.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/PapyrusRepository.java @@ -1,6 +1,6 @@ /***************************************************************************** * Copyright (c) 2013, 2014 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 @@ -9,7 +9,7 @@ * Contributors: * CEA LIST - Initial API and implementation * Christian W. Damus (CEA) - bug 422257 - * + * *****************************************************************************/ package org.eclipse.papyrus.cdo.internal.core; @@ -85,7 +85,7 @@ import com.google.common.collect.Sets; public class PapyrusRepository extends Container<CDOResourceNode> implements IInternalPapyrusRepository, IAdaptable { private static final String SECURE_STORE_PATH = "/" + Activator.PLUGIN_ID //$NON-NLS-1$ - + "/repositories"; //$NON-NLS-1$ + + "/repositories"; //$NON-NLS-1$ private static final CDOResourceNode[] NO_RESOURCE_NODES = new CDOResourceNode[0]; @@ -125,7 +125,7 @@ public class PapyrusRepository extends Container<CDOResourceNode> implements IIn @Override public void setName(String name) { - if(Strings.isNullOrEmpty(name)) { + if (Strings.isNullOrEmpty(name)) { throw new IllegalArgumentException("null or empty name"); //$NON-NLS-1$ } @@ -144,9 +144,9 @@ public class PapyrusRepository extends Container<CDOResourceNode> implements IIn @Override public void setUsername(String username) { - if(username != null) { + if (username != null) { username = username.trim(); - if(username.length() == 0) { + if (username.length() == 0) { username = null; } } @@ -164,14 +164,14 @@ public class PapyrusRepository extends Container<CDOResourceNode> implements IIn ISecurePreferences store = SecurePreferencesFactory.getDefault(); String path = getSecureStorePath(); - if(store.nodeExists(path)) { + if (store.nodeExists(path)) { store = store.node(path); try { result = store.get(key, null); } catch (StorageException e) { Activator.log.error(String.format("Failed to load repository %s from secure storage.", key), //$NON-NLS-1$ - e); + e); } } @@ -180,7 +180,7 @@ public class PapyrusRepository extends Container<CDOResourceNode> implements IIn private String getSecureStorePath() { return String.format("%s/%s", SECURE_STORE_PATH, //$NON-NLS-1$ - EncodingUtils.encodeSlashes(getURL())); + EncodingUtils.encodeSlashes(getURL())); } @Override @@ -191,7 +191,7 @@ public class PapyrusRepository extends Container<CDOResourceNode> implements IIn private void setSecureStorageValue(String key, String value, boolean encrypt) { ISecurePreferences store = SecurePreferencesFactory.getDefault().node(getSecureStorePath()); try { - if(value == null) { + if (value == null) { store.remove(key); } else { store.put(key, value, encrypt); @@ -205,7 +205,7 @@ public class PapyrusRepository extends Container<CDOResourceNode> implements IIn public void clearCredentials() { ISecurePreferences store = SecurePreferencesFactory.getDefault(); String path = getSecureStorePath(); - if(store.nodeExists(path)) { + if (store.nodeExists(path)) { store.node(path).removeNode(); } } @@ -219,18 +219,18 @@ public class PapyrusRepository extends Container<CDOResourceNode> implements IIn public IStatus connect() { IStatus result = Status.OK_STATUS; - if(!isConnected()) { + if (!isConnected()) { ICredentialsProvider2 creds = getCredentialsProvider(); Object oldCreds = null; - if(creds != null) { + if (creds != null) { oldCreds = container.putElement(CredentialsProviderFactory.PRODUCT_GROUP, "interactive", //$NON-NLS-1$ - null, creds); + null, creds); } try { - for(;;) { + for (;;) { try { - session = (CDOSession)container.getElement("org.eclipse.emf.cdo.sessions", "cdo", getURL()); //$NON-NLS-1$ //$NON-NLS-2$ + session = (CDOSession) container.getElement("org.eclipse.emf.cdo.sessions", "cdo", getURL()); //$NON-NLS-1$ //$NON-NLS-2$ } catch (LifecycleException e) { // most probably we simply failed to connect to the repository result = new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.PapyrusRepository_connectFailed, e); @@ -246,8 +246,8 @@ public class PapyrusRepository extends Container<CDOResourceNode> implements IIn // try again clearCredentials(); - if(creds instanceof IInteractiveCredentialsProvider) { - ((IInteractiveCredentialsProvider)creds).reportCredentialsFailure(e); + if (creds instanceof IInteractiveCredentialsProvider) { + ((IInteractiveCredentialsProvider) creds).reportCredentialsFailure(e); } continue; @@ -255,7 +255,7 @@ public class PapyrusRepository extends Container<CDOResourceNode> implements IIn break; } - if(session != null) { + if (session != null) { configure(session); // open the master view for the UI @@ -265,14 +265,14 @@ public class PapyrusRepository extends Container<CDOResourceNode> implements IIn // update the last known UUID in the model String uuid = session.getRepositoryInfo().getUUID(); - if(!Objects.equal(uuid, model.getUUID())) { + if (!Objects.equal(uuid, model.getUUID())) { model.setUUID(uuid); getManager().saveRepositories(); } } } finally { - if(creds != null) { - if(oldCreds != null) { + if (creds != null) { + if (oldCreds != null) { container.putElement(CredentialsProviderFactory.PRODUCT_GROUP, "interactive", null, oldCreds); //$NON-NLS-1$ } else { container.removeElement(CredentialsProviderFactory.PRODUCT_GROUP, "interactive", null); //$NON-NLS-1$ @@ -285,7 +285,7 @@ public class PapyrusRepository extends Container<CDOResourceNode> implements IIn } protected final IInternalPapyrusRepositoryManager getManager() { - return (IInternalPapyrusRepositoryManager)container.getElement(IInternalPapyrusRepositoryManager.PRODUCT_GROUP, IInternalPapyrusRepositoryManager.MANAGER_FACTORY, null); + return (IInternalPapyrusRepositoryManager) container.getElement(IInternalPapyrusRepositoryManager.PRODUCT_GROUP, IInternalPapyrusRepositoryManager.MANAGER_FACTORY, null); } private ICredentialsProvider2 getCredentialsProvider() { @@ -293,7 +293,7 @@ public class PapyrusRepository extends Container<CDOResourceNode> implements IIn ICredentialsProviderFactory factory = getManager().getCredentialsProviderFactory(); - if(factory != null) { + if (factory != null) { result = factory.createCredentialsProvider(this); } @@ -302,7 +302,7 @@ public class PapyrusRepository extends Container<CDOResourceNode> implements IIn @Override public void disconnect() throws CommitException { - if(isConnected()) { + if (isConnected()) { ImmutableList<ResourceSet> dirty = ImmutableList.copyOf(Iterables.filter(transactions.keySet(), new Predicate<ResourceSet>() { @Override @@ -311,19 +311,19 @@ public class PapyrusRepository extends Container<CDOResourceNode> implements IIn } })); - switch(approvers.disposalRequested(this, dirty)) { + switch (approvers.disposalRequested(this, dirty)) { case SAVE: - for(ResourceSet next : dirty) { + for (ResourceSet next : dirty) { commit(next); } // intentional fall-through (save then close) case CLOSE: - for(CDOView next : ImmutableList.copyOf(transactions.values())) { + for (CDOView next : ImmutableList.copyOf(transactions.values())) { doClose(next); } - for(CDOView next : ImmutableList.copyOf(readOnlyViews.values())) { + for (CDOView next : ImmutableList.copyOf(readOnlyViews.values())) { doClose(next); } @@ -340,7 +340,7 @@ public class PapyrusRepository extends Container<CDOResourceNode> implements IIn } protected void checkConnected() { - if(!isConnected()) { + if (!isConnected()) { throw new IllegalStateException("not connected"); //$NON-NLS-1$ } } @@ -359,12 +359,12 @@ public class PapyrusRepository extends Container<CDOResourceNode> implements IIn ResourceSet result = view.getResourceSet(); readOnlyViews.put(result, view); - if(masterView == null) { + if (masterView == null) { masterView = view; topResourceNodes = getElements(); adaptMasterView(view); - if(topResourceNodes.length > 0) { + if (topResourceNodes.length > 0) { fireElementsAddedEvent(topResourceNodes); } else { fireEvent(); // just refresh my presentation @@ -405,7 +405,7 @@ public class PapyrusRepository extends Container<CDOResourceNode> implements IIn public CDOView getCDOView(ResourceSet resourceSet) { CDOView result = readOnlyViews.get(resourceSet); - if(result == null) { + if (result == null) { result = transactions.get(resourceSet); } @@ -418,11 +418,11 @@ public class PapyrusRepository extends Container<CDOResourceNode> implements IIn } CDOTransaction checkTransaction(CDOView view) { - if(!(view instanceof CDOTransaction)) { + if (!(view instanceof CDOTransaction)) { throw new IllegalArgumentException("not a transaction"); //$NON-NLS-1$ } - return (CDOTransaction)view; + return (CDOTransaction) view; } @Override @@ -446,19 +446,19 @@ public class PapyrusRepository extends Container<CDOResourceNode> implements IIn public void close(ResourceSet view) { CDOView cdoView = getCDOView(view); - if(cdoView != null) { + if (cdoView != null) { doClose(cdoView); } } protected void doClose(CDOView view) { try { - if(view == masterView) { + if (view == masterView) { unadaptMasterView(view); masterView = null; CDOResourceNode[] removedNodes = topResourceNodes; topResourceNodes = null; - if((removedNodes != null) && (removedNodes.length > 0)) { + if ((removedNodes != null) && (removedNodes.length > 0)) { fireElementsRemovedEvent(removedNodes); } else { fireEvent(); // just refresh my presentation @@ -482,8 +482,8 @@ public class PapyrusRepository extends Container<CDOResourceNode> implements IIn CDOPackageRegistry registry = newSession.getPackageRegistry(); CDOPackageRegistryPopulator.populate(registry); - if(registry instanceof InternalCDOPackageRegistry) { - InternalCDOPackageRegistry internalRegistry = (InternalCDOPackageRegistry)registry; + if (registry instanceof InternalCDOPackageRegistry) { + InternalCDOPackageRegistry internalRegistry = (InternalCDOPackageRegistry) registry; internalRegistry.setPackageProcessor(new GMFSafePackageProcessor(internalRegistry.getPackageProcessor())); } } @@ -503,8 +503,8 @@ public class PapyrusRepository extends Container<CDOResourceNode> implements IIn // ResourceSet implementation that CDO doesn't know about, so we need // our own factory ResourceSet rset = newView.getResourceSet(); - if(rset instanceof CDOAwareModelSet) { - rset.getResourceFactoryRegistry().getProtocolToFactoryMap().put(CDOProtocolConstants.PROTOCOL_NAME, new PapyrusCDOResourceFactory((CDOAwareModelSet)rset)); + if (rset instanceof CDOAwareModelSet) { + rset.getResourceFactoryRegistry().getProtocolToFactoryMap().put(CDOProtocolConstants.PROTOCOL_NAME, new PapyrusCDOResourceFactory((CDOAwareModelSet) rset)); } } @@ -518,7 +518,7 @@ public class PapyrusRepository extends Container<CDOResourceNode> implements IIn } private IListener getViewListener() { - if(viewListener == null) { + if (viewListener == null) { viewListener = new LifecycleEventAdapter() { @Override @@ -541,13 +541,13 @@ public class PapyrusRepository extends Container<CDOResourceNode> implements IIn } private IListener getMasterViewListener() { - if(masterViewListener == null) { + if (masterViewListener == null) { masterViewListener = new IListener() { @Override public void notifyEvent(IEvent event) { - if(event instanceof CDOViewInvalidationEvent) { - CDOViewInvalidationEvent inval = (CDOViewInvalidationEvent)event; + if (event instanceof CDOViewInvalidationEvent) { + CDOViewInvalidationEvent inval = (CDOViewInvalidationEvent) event; translateMasterViewInvalidationEvent(inval); } } @@ -586,9 +586,9 @@ public class PapyrusRepository extends Container<CDOResourceNode> implements IIn } protected void fireRepositoryEvent(int eventType) { - if(!listeners.isEmpty()) { + if (!listeners.isEmpty()) { PapyrusRepositoryEvent event = new PapyrusRepositoryEvent(this, eventType); - for(IPapyrusRepositoryListener next : listeners) { + for (IPapyrusRepositoryListener next : listeners) { try { next.papyrusRepositoryChanged(event); } catch (Exception e) { @@ -611,8 +611,8 @@ public class PapyrusRepository extends Container<CDOResourceNode> implements IIn public CDOResourceNode[] getElements() { CDOResourceNode[] result = NO_RESOURCE_NODES; - if(masterView != null) { - if(topResourceNodes == null) { + if (masterView != null) { + if (topResourceNodes == null) { topResourceNodes = masterView.getElements(); } result = topResourceNodes; @@ -642,7 +642,7 @@ public class PapyrusRepository extends Container<CDOResourceNode> implements IIn @Override protected void doBeforeDeactivate() throws Exception { Adapter adapter = EcoreUtil.getExistingAdapter(model, PapyrusRepository.class); - if(adapter != null) { + if (adapter != null) { model.eAdapters().remove(adapter); } @@ -650,26 +650,26 @@ public class PapyrusRepository extends Container<CDOResourceNode> implements IIn } private void translateMasterViewInvalidationEvent(CDOViewInvalidationEvent event) { - for(Map.Entry<CDOObject, CDORevisionDelta> next : event.getRevisionDeltas().entrySet()) { + for (Map.Entry<CDOObject, CDORevisionDelta> next : event.getRevisionDeltas().entrySet()) { - if(next.getKey() instanceof CDOResourceNode) { - CDOResourceNode resNode = (CDOResourceNode)next.getKey(); + if (next.getKey() instanceof CDOResourceNode) { + CDOResourceNode resNode = (CDOResourceNode) next.getKey(); - if(resNode.isRoot()) { + if (resNode.isRoot()) { // the event doesn't provide a revision delta, so calculate // a delta Set<CDOResourceNode> currentNodes = Sets.newLinkedHashSet(Arrays.asList(getElements())); - Set<CDOResourceNode> newNodes = Sets.newLinkedHashSet(Iterables.filter(((CDOResource)resNode).getContents(), CDOResourceNode.class)); + Set<CDOResourceNode> newNodes = Sets.newLinkedHashSet(Iterables.filter(((CDOResource) resNode).getContents(), CDOResourceNode.class)); Set<CDOResourceNode> removed = Sets.difference(currentNodes, newNodes); Set<CDOResourceNode> added = Sets.difference(newNodes, currentNodes); ContainerEvent<CDOResourceNode> cEvent = new ContainerEvent<CDOResourceNode>(this); - for(CDOResourceNode r : removed) { + for (CDOResourceNode r : removed) { cEvent.addDelta(r, IContainerDelta.Kind.REMOVED); } - for(CDOResourceNode a : added) { + for (CDOResourceNode a : added) { cEvent.addDelta(a, IContainerDelta.Kind.ADDED); } @@ -692,12 +692,12 @@ public class PapyrusRepository extends Container<CDOResourceNode> implements IIn public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) { Object result = null; - if((adapter == CDOResourceNode.class) || (adapter == CDOResource.class)) { + if ((adapter == CDOResourceNode.class) || (adapter == CDOResource.class)) { CDOView view = getMasterView(); - if((view != null) && !view.isClosed()) { + if ((view != null) && !view.isClosed()) { result = view.getRootResource(); } - } else if(adapter == CDOSession.class) { + } else if (adapter == CDOSession.class) { result = getCDOSession(); } else { result = Platform.getAdapterManager().getAdapter(this, adapter); diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/PapyrusRepositoryManager.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/PapyrusRepositoryManager.java index 81c429c784f..157e96d719f 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/PapyrusRepositoryManager.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/PapyrusRepositoryManager.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -99,7 +99,7 @@ public class PapyrusRepositoryManager extends Container<IPapyrusRepository> impl @Override public IInternalPapyrusRepository createRepository(String url) { - if(getRepository(url) != null) { + if (getRepository(url) != null) { throw new IllegalArgumentException("repository already exists"); //$NON-NLS-1$ } @@ -117,16 +117,16 @@ public class PapyrusRepositoryManager extends Container<IPapyrusRepository> impl @Override public void setURL(IPapyrusRepository repository, String url) { - if(!Objects.equal(repository.getURL(), url)) { - if(getRepository(url) != null) { + if (!Objects.equal(repository.getURL(), url)) { + if (getRepository(url) != null) { throw new IllegalArgumentException("repository already exists"); //$NON-NLS-1$ } - if(repository.isConnected()) { + if (repository.isConnected()) { throw new IllegalStateException("repository is connected"); //$NON-NLS-1$ } - PapyrusRepository internalRepository = (PapyrusRepository)repository; + PapyrusRepository internalRepository = (PapyrusRepository) repository; repositories.remove(internalRepository.getURL()); internalRepository.getModel().setURL(url); repositories.put(url, internalRepository); @@ -135,12 +135,12 @@ public class PapyrusRepositoryManager extends Container<IPapyrusRepository> impl @Override public void removeRepository(IPapyrusRepository repository) { - if(repository.isConnected()) { + if (repository.isConnected()) { throw new IllegalArgumentException("repository is still connected"); //$NON-NLS-1$ } repositories.remove(repository.getURL()); - EcoreUtil.delete(((PapyrusRepository)repository).getModel()); + EcoreUtil.delete(((PapyrusRepository) repository).getModel()); fireElementRemovedEvent(repository); } @@ -159,22 +159,22 @@ public class PapyrusRepositoryManager extends Container<IPapyrusRepository> impl public IInternalPapyrusRepository getRepositoryForURI(URI uri, boolean connectedOnly) { IInternalPapyrusRepository result = null; - if(CDOUtils.isCDOURI(uri)) { + if (CDOUtils.isCDOURI(uri)) { String uuid = CDOURIUtil.extractRepositoryUUID(uri); - for(IInternalPapyrusRepository next : repositories.values()) { + for (IInternalPapyrusRepository next : repositories.values()) { CDOSession session = next.getCDOSession(); - if((session != null) && Objects.equal(uuid, session.getRepositoryInfo().getUUID())) { + if ((session != null) && Objects.equal(uuid, session.getRepositoryInfo().getUUID())) { result = next; break; } } - if((result == null) && !connectedOnly) { + if ((result == null) && !connectedOnly) { // guess based on the last known UUIDs - for(IInternalPapyrusRepository next : repositories.values()) { + for (IInternalPapyrusRepository next : repositories.values()) { PapyrusRepository repo = CDOUtils.tryCast(next, PapyrusRepository.class); - if((repo != null) && Objects.equal(uuid, repo.getModel().getUUID())) { + if ((repo != null) && Objects.equal(uuid, repo.getModel().getUUID())) { result = next; break; } @@ -187,13 +187,13 @@ public class PapyrusRepositoryManager extends Container<IPapyrusRepository> impl @Override public void saveRepositories() { - if(storage != null) { + if (storage != null) { try { OutputStream output = storage.createOutputStream(); try { repositoryRegistry.eResource().save(output, null); } finally { - if(output != null) { + if (output != null) { IOUtil.closeSilent(output); } } @@ -224,10 +224,10 @@ public class PapyrusRepositoryManager extends Container<IPapyrusRepository> impl URI uri = URI.createFileURI(repositoriesFile.getAbsolutePath()); Resource resource = rset.createResource(uri); - if(storage != null) { + if (storage != null) { try { InputStream input = storage.createInputStream(); - if(input != null) { + if (input != null) { try { resource.load(input, null); } finally { @@ -236,15 +236,15 @@ public class PapyrusRepositoryManager extends Container<IPapyrusRepository> impl } } catch (Exception e) { Activator.log.error("Failed to load repository registry from custom storage.", //$NON-NLS-1$ - e); + e); } } else { - if(repositoriesFile.exists()) { + if (repositoriesFile.exists()) { try { resource.load(null); } catch (Exception e) { Activator.log.error("Failed to load repository registry.", //$NON-NLS-1$ - e); + e); // if there's any junk, clear it out resource.getContents().clear(); } @@ -253,9 +253,9 @@ public class PapyrusRepositoryManager extends Container<IPapyrusRepository> impl } } - RepositoryRegistry result = (RepositoryRegistry)EcoreUtil.getObjectByType(resource.getContents(), RepositoriesPackage.Literals.REPOSITORY_REGISTRY); + RepositoryRegistry result = (RepositoryRegistry) EcoreUtil.getObjectByType(resource.getContents(), RepositoriesPackage.Literals.REPOSITORY_REGISTRY); - if(result == null) { + if (result == null) { result = RepositoriesFactory.eINSTANCE.createRepositoryRegistry(); resource.getContents().add(result); } @@ -266,7 +266,7 @@ public class PapyrusRepositoryManager extends Container<IPapyrusRepository> impl private Map<String, IInternalPapyrusRepository> initializeRepositories() { Map<String, IInternalPapyrusRepository> result = Maps.newHashMap(); - for(Repository next : repositoryRegistry.getRepositories()) { + for (Repository next : repositoryRegistry.getRepositories()) { result.put(next.getURL(), new PapyrusRepository(container, next)); } @@ -290,10 +290,10 @@ public class PapyrusRepositoryManager extends Container<IPapyrusRepository> impl int sessionID = view.getSessionID(); - for(IInternalPapyrusRepository next : repositories.values()) { + for (IInternalPapyrusRepository next : repositories.values()) { // if it's not connected, it can't be responsible for this view - if(next.isConnected()) { - if(next.getCDOSession().getSessionID() == sessionID) { + if (next.isConnected()) { + if (next.getCDOSession().getSessionID() == sessionID) { result = next; break; } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/PapyrusRepositoryManagerServiceFactory.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/PapyrusRepositoryManagerServiceFactory.java index b574127a41d..4b5c3374b01 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/PapyrusRepositoryManagerServiceFactory.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/PapyrusRepositoryManagerServiceFactory.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -24,32 +24,36 @@ public class PapyrusRepositoryManagerServiceFactory implements IServiceFactory { private IPapyrusRepositoryManager service; - + public PapyrusRepositoryManagerServiceFactory() { super(); } + @Override public void init(ServicesRegistry servicesRegistry) throws ServiceException { - + // pass } + @Override public void startService() throws ServiceException { - + // pass } + @Override public void disposeService() throws ServiceException { - + // nothing to dispose (the repository manager is a shared instance) } + @Override public Object createServiceInstance() throws ServiceException { - + service = PapyrusRepositoryManager.INSTANCE; return service; } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/controlmode/CDOControlModeParticipant.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/controlmode/CDOControlModeParticipant.java index 89e50d022a2..5b22480320a 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/controlmode/CDOControlModeParticipant.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/controlmode/CDOControlModeParticipant.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -41,6 +41,7 @@ import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EReference; import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.InternalEObject.EStore; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.resource.ResourceSet; import org.eclipse.emf.ecore.util.EcoreUtil; @@ -80,14 +81,17 @@ public class CDOControlModeParticipant implements IControlCommandParticipant, IU super(); } + @Override public String getID() { return CDOControlModeParticipant.class.getName(); } + @Override public int getPriority() { return 255; } + @Override public boolean provideControlCommand(ControlModeRequest request) { return isCDOResource(request); } @@ -96,14 +100,17 @@ public class CDOControlModeParticipant implements IControlCommandParticipant, IU return CDOUtils.isCDOURI(request.getSourceURI()); } + @Override public boolean provideUnControlCommand(ControlModeRequest request) { return isCDOResource(request); } + @Override public ICommand getPreControlCommand(ControlModeRequest request) { return IdentityCommand.INSTANCE; } + @Override public ICommand getPostControlCommand(ControlModeRequest request) { return new AbstractCDOControlCommand(request) { @@ -117,10 +124,10 @@ public class CDOControlModeParticipant implements IControlCommandParticipant, IU /** * Obtains an {@linkplain IUpdate update} operation that converts external cross-references to the elements * in a logical model unit indicated by the given representative {@code resource} to proxies. - * + * * @param resource - * a resource that is a component of a logical model unit - * + * a resource that is a component of a logical model unit + * * @return an operation that, when {@linkplain IUpdate#apply() applied}, will convert incoming cross-references to proxies */ public IUpdate getProxyCrossReferencesUpdate(Resource resource) { @@ -132,11 +139,11 @@ public class CDOControlModeParticipant implements IControlCommandParticipant, IU } private void collectProxyCrossReferenceUpdates(IUpdate.Collector updates, ResourceSet resourceSet, URI unitURI) { - for(final EObject object : getAllPersistentSubunitContents(resourceSet, unitURI)) { + for (final EObject object : getAllPersistentSubunitContents(resourceSet, unitURI)) { // replace references to the element by a proxy CDOID proxy = null; - for(EStructuralFeature.Setting next : getExternalCrossReferences(object)) { - if(proxy == null) { + for (EStructuralFeature.Setting next : getExternalCrossReferences(object)) { + if (proxy == null) { proxy = CDOIDUtil.createExternal(CDOProxyManager.createPapyrusCDOURI(object)); } updates.add(new ControlUpdate(next, object, proxy)); @@ -148,19 +155,20 @@ public class CDOControlModeParticipant implements IControlCommandParticipant, IU IUpdate result = IUpdate.EMPTY; final CDOStore[] store = { null }; - for(ListIterator<? extends EObject> xrefs = CDOUtils.iterator(owner, crossReference, false); xrefs.hasNext();) { + for (ListIterator<? extends EObject> xrefs = CDOUtils.iterator(owner, crossReference, false); xrefs.hasNext();) { final int index = xrefs.nextIndex(); final EObject referent = xrefs.next(); - if(!referent.eIsProxy() && !inSameUnit(owner, referent) && inSameModel(owner, referent)) { - if(store[0] == null) { - store[0] = ((InternalCDOView)CDOUtils.getCDOObject(owner).cdoView()).getStore(); + if (!referent.eIsProxy() && !inSameUnit(owner, referent) && inSameModel(owner, referent)) { + if (store[0] == null) { + store[0] = ((InternalCDOView) CDOUtils.getCDOObject(owner).cdoView()).getStore(); } result = result.chain(new OneWayUpdate() { + @Override public void apply() { - store[0].set((InternalEObject)owner, crossReference, index, CDOIDUtil.createExternal(createPapyrusCDOURI(referent))); + store[0].set((InternalEObject) owner, crossReference, index, CDOIDUtil.createExternal(createPapyrusCDOURI(referent))); } }); } @@ -169,6 +177,7 @@ public class CDOControlModeParticipant implements IControlCommandParticipant, IU return result; } + @Override public ICommand getPreUncontrolCommand(ControlModeRequest request) { return new AbstractCDOControlCommand(request) { @@ -186,7 +195,7 @@ public class CDOControlModeParticipant implements IControlCommandParticipant, IU IUpdate resolveProxies = IUpdate.EMPTY; // update references from other units to the unit being re-integrated - for(final EObject object : getAllPersistentSubunitContents(getRequest().getModelSet(), sourceURI)) { + for (final EObject object : getAllPersistentSubunitContents(getRequest().getModelSet(), sourceURI)) { // replace proxy references to the element by the element or an updated proxy // which will be located in the destination resource CDOID sourceProxy = null; @@ -194,21 +203,22 @@ public class CDOControlModeParticipant implements IControlCommandParticipant, IU CDOID proxy = null; // internal cross-references within the unit won't be affected, as they are all moving - for(final EStructuralFeature.Setting next : getExternalCrossReferences(object)) { - if(next.getEObject().eIsProxy()) { + for (final EStructuralFeature.Setting next : getExternalCrossReferences(object)) { + if (next.getEObject().eIsProxy()) { // the cross-reference will be from a proxy only when it is a proxy owned by the cross-referenced object, - // by virtue of an opposite reference. In this case, it's only interesting if the proxy targets the + // by virtue of an opposite reference. In this case, it's only interesting if the proxy targets the // parent (re-integrated-into) resource. So, resolve this proxy because we need to update the // reference, below resolveProxies = resolveProxies.chain(new OneWayUpdate() { + @Override public void apply() { - resolve(object, (EReference)next.getEStructuralFeature(), next.getEObject()); + resolve(object, (EReference) next.getEStructuralFeature(), next.getEObject()); } }); } else { - if(sourceProxy == null) { + if (sourceProxy == null) { // create the source proxy sourceProxy = CDOIDUtil.createExternal(CDOProxyManager.createPapyrusCDOURI(object)); @@ -222,9 +232,9 @@ public class CDOControlModeParticipant implements IControlCommandParticipant, IU } // upon removal from their resources, root elements will nonetheless retain a - // reference to the resource that formerly contained them. We need to force + // reference to the resource that formerly contained them. We need to force // clearing of this reference in the CDO store - if(((InternalEObject)object).eDirectResource() != null) { + if (((InternalEObject) object).eDirectResource() != null) { objectsToClearResource.add(object); } } @@ -233,16 +243,16 @@ public class CDOControlModeParticipant implements IControlCommandParticipant, IU resolveProxies.apply(); // update references from the unit being re-integrated to the unit it is re-integrating into - for(final EObject object : getAllPersistentSubunitContents(getRequest().getModelSet(), getRequest().getNewURI())) { + for (final EObject object : getAllPersistentSubunitContents(getRequest().getModelSet(), getRequest().getNewURI())) { // replace proxy references to the element by the element or an updated proxy // which will be located in the destination resource CDOID targetProxy = null; - for(EStructuralFeature.Setting next : getExternalCrossReferences(object)) { - if(inUnit(next.getEObject(), sourceURI)) { + for (EStructuralFeature.Setting next : getExternalCrossReferences(object)) { + if (inUnit(next.getEObject(), sourceURI)) { // replace proxy references from the sub-unit into the parent with a direct reference, as this will // no longer be a cross-unit reference - if(targetProxy == null) { + if (targetProxy == null) { targetProxy = CDOIDUtil.createExternal(CDOProxyManager.createPapyrusCDOURI(object)); } updates.add(new UncontrolUpdate(next, object, targetProxy)); @@ -255,11 +265,11 @@ public class CDOControlModeParticipant implements IControlCommandParticipant, IU void resolve(EObject object, EReference reference, EObject proxy) { EReference opposite = reference.getEOpposite(); - if(opposite != null) { - if(opposite.isMany()) { - InternalEList<?> list = (InternalEList<?>)object.eGet(opposite, false); + if (opposite != null) { + if (opposite.isMany()) { + InternalEList<?> list = (InternalEList<?>) object.eGet(opposite, false); int index = list.basicIndexOf(proxy); - if(index >= 0) { + if (index >= 0) { list.get(index); // resolve just this index } } else { @@ -268,6 +278,7 @@ public class CDOControlModeParticipant implements IControlCommandParticipant, IU } } + @Override public ICommand getPostUncontrolCommand(ControlModeRequest request) { return new AbstractCDOControlCommand(request) { @@ -282,9 +293,9 @@ public class CDOControlModeParticipant implements IControlCommandParticipant, IU @Override protected void buildUpdates(ControlModeRequest request, IUpdate.Collector updates) { - for(EObject next : objectsToClearResource) { + for (EObject next : objectsToClearResource) { // some former resource roots may not be reattached (e.g., SashWindowsMgr) - if(CDOUtil.getCDOObject(next).cdoState() != CDOState.TRANSIENT) { + if (CDOUtil.getCDOObject(next).cdoState() != CDOState.TRANSIENT) { updates.add(new ClearResourceUpdate(next)); } } @@ -295,19 +306,20 @@ public class CDOControlModeParticipant implements IControlCommandParticipant, IU /** * Get all cross-references to an {@code object} from outside of its own controlled unit <em>within</em> the same model (cross-model references do * not count). - * + * * @param object - * an object being controlled + * an object being controlled * @return references to it from outside of its (new) controlled unit */ Iterable<EStructuralFeature.Setting> getExternalCrossReferences(final EObject object) { return Iterables.filter(CDOUtils.crossReference(object), new Predicate<EStructuralFeature.Setting>() { + @Override public boolean apply(EStructuralFeature.Setting input) { boolean result = false; EStructuralFeature ref = input.getEStructuralFeature(); - if((ref != EresourcePackage.Literals.CDO_RESOURCE__CONTENTS) && ref.isChangeable() && !ref.isDerived()) { + if ((ref != EresourcePackage.Literals.CDO_RESOURCE__CONTENTS) && ref.isChangeable() && !ref.isDerived()) { result = !inSameUnit(input.getEObject(), object) && inSameModel(input.getEObject(), object); } @@ -320,7 +332,7 @@ public class CDOControlModeParticipant implements IControlCommandParticipant, IU static boolean isPersistentObject(EObject object) { boolean result = !object.eIsProxy(); - if(result) { + if (result) { CDOObject cdo = CDOUtils.getCDOObject(object); result = (cdo != null) && !TEMPORARY_ID_STATES.contains(cdo.cdoState()); } @@ -339,8 +351,8 @@ public class CDOControlModeParticipant implements IControlCommandParticipant, IU private static URI getResourceURI(EObject object) { URI result; - if(object.eIsProxy()) { - result = ((InternalEObject)object).eProxyURI().trimFragment(); + if (object.eIsProxy()) { + result = ((InternalEObject) object).eProxyURI().trimFragment(); } else { Resource res = object.eResource(); result = (res == null) ? null : res.getURI(); @@ -358,13 +370,13 @@ public class CDOControlModeParticipant implements IControlCommandParticipant, IU private static boolean inUnit(EObject object, URI unit) { boolean result = false; - if(unit != null) { - // get the extension-less model URIs + if (unit != null) { + // get the extension-less model URIs URI uri = getResourceURI(object); - if(uri != null) { - uri = uri.trimFileExtension(); - URI otherURI = unit.trimFileExtension(); + if (uri != null) { + uri = uri.trimFileExtension(); + URI otherURI = unit.trimFileExtension(); result = uri.equals(otherURI); } @@ -376,18 +388,19 @@ public class CDOControlModeParticipant implements IControlCommandParticipant, IU /** * Iterates all of the proper contents of the resources comprising the logical model unit * indicated by the representative {@code unitURI}. - * + * * @param rset - * a resource set in which to load and/or iterate the resource contents + * a resource set in which to load and/or iterate the resource contents * @param unitURI - * the URI of one of the resources in the logical model unit, which therefore is representative of the unit - * + * the URI of one of the resources in the logical model unit, which therefore is representative of the unit + * * @return an iterator over the entire logical model unit's proper contents */ static Iterable<EObject> getAllPersistentSubunitContents(ResourceSet rset, URI unitURI) { final URI base = unitURI.trimFileExtension(); Iterable<Resource> resources = filter(rset.getResources(), new Predicate<Resource>() { + @Override public boolean apply(Resource input) { return input.getURI().trimFileExtension().equals(base); } @@ -395,9 +408,11 @@ public class CDOControlModeParticipant implements IControlCommandParticipant, IU Iterable<EObject> result = concat(transform(resources, new Function<Resource, Iterable<EObject>>() { + @Override public Iterable<EObject> apply(final Resource input) { return new Iterable<EObject>() { + @Override public Iterator<EObject> iterator() { return EcoreUtil.getAllProperContents(input, false); } @@ -407,6 +422,7 @@ public class CDOControlModeParticipant implements IControlCommandParticipant, IU result = filter(result, new Predicate<EObject>() { + @Override public boolean apply(EObject input) { return isPersistentObject(input); } @@ -426,18 +442,22 @@ public class CDOControlModeParticipant implements IControlCommandParticipant, IU */ IUpdate EMPTY = new IUpdate() { + @Override public boolean isEmpty() { return true; } + @Override public void apply() { // pass } + @Override public void revert() { // revert } + @Override public IUpdate chain(IUpdate update) { return (update == null) ? this : update; } @@ -446,7 +466,7 @@ public class CDOControlModeParticipant implements IControlCommandParticipant, IU /** * Queries whether I have nothing to do on {@link #apply() apply}. - * + * * @return whether I am empty */ boolean isEmpty(); @@ -472,30 +492,35 @@ public class CDOControlModeParticipant implements IControlCommandParticipant, IU private final List<IUpdate> updates = Lists.newArrayList(); + @Override public void add(IUpdate update) { updates.add(update); } + @Override public Compound chain(IUpdate update) { - if((update != null) && !update.isEmpty()) { + if ((update != null) && !update.isEmpty()) { add(update); } return this; } + @Override public boolean isEmpty() { return updates.isEmpty(); } + @Override public void apply() { - for(IUpdate next : updates) { + for (IUpdate next : updates) { next.apply(); } } + @Override public void revert() { - for(ListIterator<IUpdate> iter = updates.listIterator(updates.size()); iter.hasPrevious();) { + for (ListIterator<IUpdate> iter = updates.listIterator(updates.size()); iter.hasPrevious();) { iter.previous().revert(); } } @@ -503,9 +528,9 @@ public class CDOControlModeParticipant implements IControlCommandParticipant, IU static IUpdate compose(IUpdate first, IUpdate second) { IUpdate result; - if((second == null) || second.isEmpty()) { + if ((second == null) || second.isEmpty()) { result = (first == null) ? IUpdate.EMPTY : first; - } else if((first == null) || first.isEmpty()) { + } else if ((first == null) || first.isEmpty()) { // we already know it's not null or empty result = second; } else { @@ -521,14 +546,17 @@ public class CDOControlModeParticipant implements IControlCommandParticipant, IU private static abstract class OneWayUpdate implements IUpdate { + @Override public void revert() { throw new UnsupportedOperationException("OneWayUpdate cannot be reverted"); //$NON-NLS-1$ } + @Override public IUpdate chain(IUpdate update) { return CompoundUpdate.compose(this, update); } + @Override public boolean isEmpty() { return false; } @@ -543,10 +571,10 @@ public class CDOControlModeParticipant implements IControlCommandParticipant, IU Update(EStructuralFeature.Setting setting) { this.setting = setting; - InternalEObject owner = (InternalEObject)setting.getEObject(); + InternalEObject owner = (InternalEObject) setting.getEObject(); CDOObject cdoOwner = CDOUtil.getCDOObject(owner); - InternalCDOView view = (InternalCDOView)cdoOwner.cdoView(); + InternalCDOView view = (InternalCDOView) cdoOwner.cdoView(); store = view.getStore(); } @@ -555,13 +583,15 @@ public class CDOControlModeParticipant implements IControlCommandParticipant, IU CDOObject cdo = CDOUtil.getCDOObject(object); CDOView view = cdo.cdoView(); - this.store = (view instanceof InternalCDOView) ? ((InternalCDOView)view).getStore() : null; + this.store = (view instanceof InternalCDOView) ? ((InternalCDOView) view).getStore() : null; } + @Override public IUpdate chain(IUpdate update) { return CompoundUpdate.compose(this, update); } + @Override public boolean isEmpty() { // a leaf update is, by definition, not empty return false; @@ -582,34 +612,36 @@ public class CDOControlModeParticipant implements IControlCommandParticipant, IU this.proxy = proxy; EStructuralFeature feature = setting.getEStructuralFeature(); - InternalEObject owner = (InternalEObject)setting.getEObject(); + InternalEObject owner = (InternalEObject) setting.getEObject(); - if(!feature.isMany()) { - index = CDOStore.NO_INDEX; + if (!feature.isMany()) { + index = EStore.NO_INDEX; } else { // don't go directly to the store because it may have proxies. // Use the resolved view in the EObject, instead - index = ((EList<?>)owner.eGet(feature)).indexOf(originalObject); - if(index < 0) { + index = ((EList<?>) owner.eGet(feature)).indexOf(originalObject); + if (index < 0) { Activator.log.error("Setting does not include the object being replaced by a proxy.", null); //$NON-NLS-1$ } } } + @Override public void apply() { EStructuralFeature feature = setting.getEStructuralFeature(); - if((index >= 0) || !feature.isMany()) { - InternalEObject owner = (InternalEObject)setting.getEObject(); + if ((index >= 0) || !feature.isMany()) { + InternalEObject owner = (InternalEObject) setting.getEObject(); store.set(owner, feature, index, proxy); } } + @Override public void revert() { EStructuralFeature feature = setting.getEStructuralFeature(); - if(index >= 0 || !feature.isMany()) { - InternalEObject owner = (InternalEObject)setting.getEObject(); + if (index >= 0 || !feature.isMany()) { + InternalEObject owner = (InternalEObject) setting.getEObject(); store.set(owner, feature, index, CDOUtils.getCDOID(originalObject)); } } @@ -635,15 +667,15 @@ public class CDOControlModeParticipant implements IControlCommandParticipant, IU this.destinationProxy = destinationProxy; EStructuralFeature feature = setting.getEStructuralFeature(); - InternalEObject owner = (InternalEObject)setting.getEObject(); + InternalEObject owner = (InternalEObject) setting.getEObject(); - if(!feature.isMany()) { - index = CDOStore.NO_INDEX; + if (!feature.isMany()) { + index = EStore.NO_INDEX; } else { // don't go directly to the store because it may have proxies. // Use the resolved view in the EObject, instead - index = ((EList<?>)owner.eGet(feature)).indexOf(originalObject); - if(index < 0) { + index = ((EList<?>) owner.eGet(feature)).indexOf(originalObject); + if (index < 0) { Activator.log.error("Setting does not include the object being replaced by a proxy.", null); //$NON-NLS-1$ } } @@ -653,13 +685,14 @@ public class CDOControlModeParticipant implements IControlCommandParticipant, IU this(setting, originalObject, originalProxy, null, null); } + @Override public void apply() { EStructuralFeature feature = setting.getEStructuralFeature(); - if((index >= 0) || !feature.isMany()) { - InternalEObject owner = (InternalEObject)setting.getEObject(); + if ((index >= 0) || !feature.isMany()) { + InternalEObject owner = (InternalEObject) setting.getEObject(); - if((destinationURI == null) || inUnit(owner, destinationURI)) { + if ((destinationURI == null) || inUnit(owner, destinationURI)) { // direct reference store.set(owner, feature, index, CDOUtils.getCDOID(originalObject)); } else { @@ -669,11 +702,12 @@ public class CDOControlModeParticipant implements IControlCommandParticipant, IU } } + @Override public void revert() { EStructuralFeature feature = setting.getEStructuralFeature(); - if(index >= 0 || !feature.isMany()) { - InternalEObject owner = (InternalEObject)setting.getEObject(); + if (index >= 0 || !feature.isMany()) { + InternalEObject owner = (InternalEObject) setting.getEObject(); // on reversion, we are processing only references that were external // to the unit that was to be re-integrated, so necessarily all @@ -693,11 +727,13 @@ public class CDOControlModeParticipant implements IControlCommandParticipant, IU this.object = CDOUtil.getCDOObject(object); } + @Override public void apply() { - InternalEObject object = (InternalEObject)CDOUtil.getEObject(this.object); + InternalEObject object = (InternalEObject) CDOUtil.getEObject(this.object); store.setContainer(object, null, object.eInternalContainer(), object.eContainerFeatureID()); } + @Override public void revert() { // there is no need to revert clearing the resource reference; it will be // reestablished naturally by undo of the base command @@ -731,7 +767,7 @@ public class CDOControlModeParticipant implements IControlCommandParticipant, IU protected IStatus doUndo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { IStatus result = super.doUndo(monitor, info); - if(result.isOK()) { + if (result.isOK()) { // setting proxies in the way we did is not recorded by EMF, so we have to undo it ourselves revert(); } @@ -743,7 +779,7 @@ public class CDOControlModeParticipant implements IControlCommandParticipant, IU protected IStatus doRedo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { IStatus result = super.doRedo(monitor, info); - if(result.isOK()) { + if (result.isOK()) { // setting proxies in the way we did is not recorded by EMF, so we have to redo it ourselves apply(); } @@ -751,26 +787,31 @@ public class CDOControlModeParticipant implements IControlCommandParticipant, IU return result; } + @Override public boolean isEmpty() { return (updates == null) || updates.isEmpty(); } + @Override public void apply() { - for(IUpdate next : updates) { + for (IUpdate next : updates) { next.apply(); } } + @Override public void revert() { - for(ListIterator<IUpdate> iter = updates.listIterator(updates.size()); iter.hasPrevious();) { + for (ListIterator<IUpdate> iter = updates.listIterator(updates.size()); iter.hasPrevious();) { iter.previous().revert(); } } + @Override public void add(IUpdate update) { throw new UnsupportedOperationException("AbtsractCDOControlCommand is not externally modifiable"); //$NON-NLS-1$ } + @Override public Compound chain(IUpdate update) { throw new UnsupportedOperationException("AbtsractCDOControlCommand is not externally modifiable"); //$NON-NLS-1$ } @@ -780,6 +821,7 @@ public class CDOControlModeParticipant implements IControlCommandParticipant, IU private final ImmutableList.Builder<IUpdate> builder = ImmutableList.builder(); + @Override public void add(IUpdate update) { builder.add(update); } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/controlmode/CDOProxyManager.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/controlmode/CDOProxyManager.java index f7572664733..2b734e656eb 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/controlmode/CDOProxyManager.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/controlmode/CDOProxyManager.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -54,9 +54,9 @@ public class CDOProxyManager { EClassifier resolvedType = typeRef.resolve(resourceSet.getPackageRegistry()); - if(resolvedType instanceof EClass) { - EClass actualType = (EClass)resolvedType; - result = (InternalEObject)EcoreUtil.create(actualType); + if (resolvedType instanceof EClass) { + EClass actualType = (EClass) resolvedType; + result = (InternalEObject) EcoreUtil.create(actualType); StringBuilder fragment = new StringBuilder(); CDOIDUtil.write(fragment, CDOIDUtil.createLong(oid)); @@ -70,7 +70,7 @@ public class CDOProxyManager { public static boolean isCDOProxyURI(URI uri) { boolean result = uri.hasFragment() && URI_SCHEME.equals(uri.scheme()); - if(result) { + if (result) { CDOID oid = CDOIDUtil.read(uri.fragment()); result = oid instanceof CDOClassifierRef.Provider; } @@ -99,7 +99,7 @@ public class CDOProxyManager { String result = null; CDOID oid = CDOIDUtil.read(proxyURI.fragment()); - if(oid.isObject()) { + if (oid.isObject()) { StringBuilder buf = new StringBuilder(); CDOIDUtil.write(buf, CDOIDUtil.createLong(CDOIDUtil.getLong(oid))); result = buf.toString(); @@ -120,15 +120,15 @@ public class CDOProxyManager { long oid = CDOIDUtil.getLong(CDOIDUtil.read(proxyURI.fragment())); final int hashCode = hashCode(oid); - for(Entry<InternalEObject> entry = getEntry(hashCode); (entry != null) && (result == null); entry = entry.getNextEntry()) { + for (Entry<InternalEObject> entry = getEntry(hashCode); (entry != null) && (result == null); entry = entry.getNextEntry()) { result = entry.get(); - if((result != null) && getOID(result) != oid) { + if ((result != null) && getOID(result) != oid) { result = null; } } - if(result == null) { + if (result == null) { result = createProxy(proxyURI); addEntry(createEntry(result, hashCode)); } @@ -139,7 +139,7 @@ public class CDOProxyManager { private long getOID(InternalEObject object) { long result; - if(object.eIsProxy()) { + if (object.eIsProxy()) { result = CDOIDUtil.getLong(CDOIDUtil.read(object.eProxyURI().fragment())); } else { result = CDOIDUtil.getLong(CDOUtils.getCDOID(object)); @@ -154,7 +154,7 @@ public class CDOProxyManager { } int hashCode(long oid) { - return (int)(oid & 0xFFFFFFFF); + return (int) (oid & 0xFFFFFFFF); } } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/exporter/CDODIDependentsProvider.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/exporter/CDODIDependentsProvider.java index 856174db019..1ea8ee83716 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/exporter/CDODIDependentsProvider.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/exporter/CDODIDependentsProvider.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -46,10 +46,11 @@ public class CDODIDependentsProvider implements IModelDependentsProvider { super(); } + @Override public Collection<URI> getDependents(Resource resource, IProgressMonitor monitor) { - if(!completedScan) { - // TODO Find a more efficient way to determine cross-references than walking the repository. Don't walk, for now - //scanRepository(resource.getResourceSet()); + if (!completedScan) { + // TODO Find a more efficient way to determine cross-references than walking the repository. Don't walk, for now + // scanRepository(resource.getResourceSet()); } Set<URI> result = Sets.newHashSet(); @@ -57,14 +58,14 @@ public class CDODIDependentsProvider implements IModelDependentsProvider { // if it's a DI resource, get its dependencies' dependents and find // their dependents that are unique DIs Resource di = getDIResource(resource); - if(di != null) { + if (di != null) { // the DI's dependencies are the model components - for(Resource component : DependencyAdapter.getDependencies(di)) { + for (Resource component : DependencyAdapter.getDependencies(di)) { // the components' dependents in other models are what we are // interested in - for(Resource next : DependencyAdapter.getDependents(component)) { + for (Resource next : DependencyAdapter.getDependents(component)) { Resource dependentDI = getDIResource(next); - if((dependentDI != null) && (dependentDI != di)) { + if ((dependentDI != null) && (dependentDI != di)) { result.add(dependentDI.getURI()); } } @@ -74,23 +75,24 @@ public class CDODIDependentsProvider implements IModelDependentsProvider { return result; } + @Override public Collection<URI> getComponents(Resource diResource, IProgressMonitor monitor) { Collection<URI> result; - if(!(diResource instanceof CDOResource)) { + if (!(diResource instanceof CDOResource)) { result = Collections.emptyList(); } else { ImmutableList.Builder<URI> uris = ImmutableList.builder(); - CDOResource cdo = (CDOResource)diResource; + CDOResource cdo = (CDOResource) diResource; CDOView view = cdo.cdoView(); final URI baseURI = cdo.getURI().trimFileExtension(); final CDOResourceFolder folder = cdo.getFolder(); Iterable<CDOResource> inSameFolder = filter((folder == null) ? view.getRootResource().getContents() : folder.getNodes(), CDOResource.class); - for(CDOResource next : inSameFolder) { + for (CDOResource next : inSameFolder) { URI uri = next.getURI(); - if((next != cdo) && uri.trimFileExtension().equals(baseURI)) { + if ((next != cdo) && uri.trimFileExtension().equals(baseURI)) { uris.add(next.getURI()); } } @@ -106,16 +108,16 @@ public class CDODIDependentsProvider implements IModelDependentsProvider { completedScan = true; TreeIterator<?> repositoryIterator = CDOUtils.getView(resourceSet).getRootResource().eAllContents(); - while(repositoryIterator.hasNext()) { - CDOResourceNode next = (CDOResourceNode)repositoryIterator.next(); - if(next instanceof CDOResource) { - CDOResource resource = (CDOResource)next; - if(isDIResource(resource)) { + while (repositoryIterator.hasNext()) { + CDOResourceNode next = (CDOResourceNode) repositoryIterator.next(); + if (next instanceof CDOResource) { + CDOResource resource = (CDOResource) next; + if (isDIResource(resource)) { // it's a Papyrus model. Initialize the dependencies DependencyAdapter.getInstance(resource); } repositoryIterator.prune(); - } else if(!(next instanceof CDOResourceFolder)) { + } else if (!(next instanceof CDOResourceFolder)) { repositoryIterator.prune(); } } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/exporter/DefaultModelExportConfigurationFactory.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/exporter/DefaultModelExportConfigurationFactory.java index 19dc21c0f1b..1f79788bad3 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/exporter/DefaultModelExportConfigurationFactory.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/exporter/DefaultModelExportConfigurationFactory.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -27,6 +27,7 @@ public class DefaultModelExportConfigurationFactory implements Factory { super(); } + @Override public IModelTransferConfiguration create(IModelTransferOperation.Context operationContext, ResourceSet resourceSet) { ModelTransferConfiguration result = new ModelTransferConfiguration(operationContext, resourceSet, Direction.EXPORT); diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/exporter/DefaultModelExportMappingFactory.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/exporter/DefaultModelExportMappingFactory.java index 47279d1f31f..a57f9139dc6 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/exporter/DefaultModelExportMappingFactory.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/exporter/DefaultModelExportMappingFactory.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -23,6 +23,7 @@ public class DefaultModelExportMappingFactory implements IModelExportMapping.Fac super(); } + @Override public IModelExportMapping create(IModelTransferConfiguration configuration) { return new ModelExportMapping(configuration); } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/exporter/ModelExportMapping.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/exporter/ModelExportMapping.java index a3d2fc27bd8..4757d0516ba 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/exporter/ModelExportMapping.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/exporter/ModelExportMapping.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -46,40 +46,40 @@ public class ModelExportMapping extends AbstractModelTransferMapping implements boolean result = true; IPath mapping = getMapping(node); - if(mapping == null) { - diagnostics.add(new BasicDiagnostic(Diagnostic.ERROR, Activator.PLUGIN_ID, 0, NLS.bind(Messages.ModelExportMapping_0, node.getName()), new Object[]{ node })); + if (mapping == null) { + diagnostics.add(new BasicDiagnostic(Diagnostic.ERROR, Activator.PLUGIN_ID, 0, NLS.bind(Messages.ModelExportMapping_0, node.getName()), new Object[] { node })); result = false; } else { - for(URI next : node.getResourceURIs()) { + for (URI next : node.getResourceURIs()) { IPath resourcePath = mapping.removeFileExtension().addFileExtension(next.fileExtension()); IPath containerPath = mapping.removeLastSegments(1); IContainer container = (containerPath.segmentCount() == 1) ? wsRoot.getProject(containerPath.segment(0)) : wsRoot.getFolder(containerPath); - if(!container.getProject().exists()) { - diagnostics.add(new BasicDiagnostic(Diagnostic.ERROR, Activator.PLUGIN_ID, 0, NLS.bind(Messages.ModelExportMapping_1, mapping, node.getName()), new Object[]{ node })); + if (!container.getProject().exists()) { + diagnostics.add(new BasicDiagnostic(Diagnostic.ERROR, Activator.PLUGIN_ID, 0, NLS.bind(Messages.ModelExportMapping_1, mapping, node.getName()), new Object[] { node })); result = false; break; - } else if(!container.exists()) { + } else if (!container.exists()) { // does it not exist because there is a file of that name? IFile file = wsRoot.getFile(containerPath); - if(file.exists()) { - diagnostics.add(new BasicDiagnostic(Diagnostic.ERROR, Activator.PLUGIN_ID, 0, NLS.bind(Messages.ModelExportMapping_2, containerPath, node.getName()), new Object[]{ node })); + if (file.exists()) { + diagnostics.add(new BasicDiagnostic(Diagnostic.ERROR, Activator.PLUGIN_ID, 0, NLS.bind(Messages.ModelExportMapping_2, containerPath, node.getName()), new Object[] { node })); result = false; break; } } else { - // the container exists. Does the mapped file clash? + // the container exists. Does the mapped file clash? IFile file = wsRoot.getFile(resourcePath); - if(file.exists()) { - diagnostics.add(new BasicDiagnostic(Diagnostic.ERROR, Activator.PLUGIN_ID, 0, NLS.bind(Messages.ModelExportMapping_3, resourcePath, node.getName()), new Object[]{ node })); + if (file.exists()) { + diagnostics.add(new BasicDiagnostic(Diagnostic.ERROR, Activator.PLUGIN_ID, 0, NLS.bind(Messages.ModelExportMapping_3, resourcePath, node.getName()), new Object[] { node })); result = false; break; } else { // final check is whether the workspace will allow creation of this resource IStatus status = wsRoot.getWorkspace().validatePath(resourcePath.toString(), IResource.FILE); - if(!status.isOK()) { + if (!status.isOK()) { diagnostics.add(BasicDiagnostic.toDiagnostic(status)); - if(status.getSeverity() > IStatus.WARNING) { + if (status.getSeverity() > IStatus.WARNING) { result = false; break; } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/exporter/ModelExporter.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/exporter/ModelExporter.java index 1e4e951a001..1f30897fab4 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/exporter/ModelExporter.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/exporter/ModelExporter.java @@ -1,6 +1,6 @@ /***************************************************************************** * Copyright (c) 2013, 2014 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 @@ -9,7 +9,7 @@ * Contributors: * CEA LIST - Initial API and implementation * Christian W. Damus (CEA) - bug 422257 - * + * *****************************************************************************/ package org.eclipse.papyrus.cdo.internal.core.exporter; @@ -56,7 +56,7 @@ public class ModelExporter implements IModelExporter { add(result, mapping.getConfiguration().validate()); add(result, mapping.validate()); - if(result.getSeverity() < Diagnostic.ERROR) { + if (result.getSeverity() < Diagnostic.ERROR) { add(result, mapping.getConfiguration().getOperationContext().run(new IModelTransferOperation() { @Override @@ -77,7 +77,7 @@ public class ModelExporter implements IModelExporter { // 1 for proxy resolution, 1 for resource saving, and 1 for clean-up SubMonitor sub = SubMonitor.convert(monitor, Messages.ModelExporter_0, 2 * configuration.getModelsToTransfer().size() + 3); - IInternalPapyrusRepository repository = (IInternalPapyrusRepository)mapping.getRepository(); + IInternalPapyrusRepository repository = (IInternalPapyrusRepository) mapping.getRepository(); ResourceSet destination = new ResourceSetImpl(); ResourceSet source = repository.createTransaction(new CDOProxyResolvingResourceSet()); CDOView view = repository.getCDOView(source); @@ -85,17 +85,17 @@ public class ModelExporter implements IModelExporter { try { // load all models to be exported and resolve their cross-references so that CDO-style // cross-resource proxies will be resolved - for(IModelTransferNode model : configuration.getModelsToTransfer()) { + for (IModelTransferNode model : configuration.getModelsToTransfer()) { add(result, loadModel(model, view, sub.newChild(1))); } EcoreUtil.resolveAll(source); sub.worked(1); - for(IModelTransferNode model : configuration.getModelsToTransfer()) { + for (IModelTransferNode model : configuration.getModelsToTransfer()) { add(result, exportModel(model, view, mapping.getMapping(model), destination, sub.newChild(1))); } - for(IModelTransferNode model : configuration.getModelsToTransfer()) { + for (IModelTransferNode model : configuration.getModelsToTransfer()) { add(result, saveModel(model, view, mapping.getMapping(model), destination)); } sub.worked(1); @@ -118,9 +118,9 @@ public class ModelExporter implements IModelExporter { SubMonitor sub = SubMonitor.convert(monitor, model.getName(), model.getResourceURIs().size()); - for(URI next : model.getResourceURIs()) { + for (URI next : model.getResourceURIs()) { Resource source = view.getResourceSet().getResource(next, true); - for(Iterator<?> iter = source.getContents().iterator(); iter.hasNext(); iter.next()) { + for (Iterator<?> iter = source.getContents().iterator(); iter.hasNext(); iter.next()) { // just iterate them to load the contents; we will walk over the content trees later to resolve proxies } sub.worked(1); @@ -138,7 +138,7 @@ public class ModelExporter implements IModelExporter { SubMonitor sub = SubMonitor.convert(monitor, model.getName(), model.getResourceURIs().size()); - for(URI next : model.getResourceURIs()) { + for (URI next : model.getResourceURIs()) { Resource source = view.getResourceSet().getResource(next, true); Resource destination = rset.createResource(URI.createPlatformResourceURI(basePath.addFileExtension(next.fileExtension()).toString(), true)); add(result, exportResource(source, destination)); @@ -161,12 +161,12 @@ public class ModelExporter implements IModelExporter { IPath basePath = toPath.removeFileExtension(); - for(URI next : model.getResourceURIs()) { + for (URI next : model.getResourceURIs()) { Resource destination = rset.getResource(URI.createPlatformResourceURI(basePath.addFileExtension(next.fileExtension()).toString(), true), false); try { destination.save(null); } catch (Exception e) { - add(result, new BasicDiagnostic(IStatus.ERROR, Activator.PLUGIN_ID, 0, Messages.ModelExporter_1, new Object[]{ e })); + add(result, new BasicDiagnostic(IStatus.ERROR, Activator.PLUGIN_ID, 0, Messages.ModelExporter_1, new Object[] { e })); } } @@ -174,7 +174,7 @@ public class ModelExporter implements IModelExporter { } private static void add(DiagnosticChain diagnostics, Diagnostic diagnostic) { - if(diagnostic.getSeverity() > Diagnostic.OK) { + if (diagnostic.getSeverity() > Diagnostic.OK) { diagnostics.merge(diagnostic); } } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/exporter/ModelExporterFactory.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/exporter/ModelExporterFactory.java index c448f5646da..3ef241aa46e 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/exporter/ModelExporterFactory.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/exporter/ModelExporterFactory.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -22,6 +22,7 @@ public class ModelExporterFactory implements IModelExporter.Factory { super(); } + @Override public IModelExporter create() { return new ModelExporter(); } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/expressions/EObjectPropertyTester.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/expressions/EObjectPropertyTester.java index 683489852a7..a4ad6a17862 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/expressions/EObjectPropertyTester.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/expressions/EObjectPropertyTester.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -28,6 +28,7 @@ public class EObjectPropertyTester super(); } + @Override public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/AbstractModelImportMapping.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/AbstractModelImportMapping.java index b8f22848ec7..6346c4433e8 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/AbstractModelImportMapping.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/AbstractModelImportMapping.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -40,15 +40,15 @@ abstract class AbstractModelImportMapping extends AbstractModelTransferMapping i boolean result = true; IPath mapping = getMapping(node); - if(mapping == null) { - diagnostics.add(new BasicDiagnostic(Diagnostic.ERROR, Activator.PLUGIN_ID, 0, NLS.bind(Messages.AbstractModelImportMapping_0, node.getName()), new Object[]{ node })); + if (mapping == null) { + diagnostics.add(new BasicDiagnostic(Diagnostic.ERROR, Activator.PLUGIN_ID, 0, NLS.bind(Messages.AbstractModelImportMapping_0, node.getName()), new Object[] { node })); result = false; } else { - for(URI next : node.getResourceURIs()) { + for (URI next : node.getResourceURIs()) { String resourcePath = mapping.removeFileExtension().addFileExtension(next.fileExtension()).toString(); - if(getView().hasResource(resourcePath)) { - diagnostics.add(new BasicDiagnostic(Diagnostic.ERROR, Activator.PLUGIN_ID, 0, NLS.bind(Messages.AbstractModelImportMapping_1, mapping, node.getName()), new Object[]{ node })); + if (getView().hasResource(resourcePath)) { + diagnostics.add(new BasicDiagnostic(Diagnostic.ERROR, Activator.PLUGIN_ID, 0, NLS.bind(Messages.AbstractModelImportMapping_1, mapping, node.getName()), new Object[] { node })); result = false; break; } @@ -59,15 +59,15 @@ abstract class AbstractModelImportMapping extends AbstractModelTransferMapping i } protected CDOView getView() { - IInternalPapyrusRepository repo = (IInternalPapyrusRepository)getRepository(); + IInternalPapyrusRepository repo = (IInternalPapyrusRepository) getRepository(); return (repo == null) ? null : repo.getMasterView(); } @Override protected void computeDefaultMappings(IModelTransferConfiguration configuration) { - for(IModelTransferNode next : configuration.getModelsToTransfer()) { - if(getMapping(next) == null) { + for (IModelTransferNode next : configuration.getModelsToTransfer()) { + if (getMapping(next) == null) { mapTo(next, new Path(next.getName())); } } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/AbstractModelTransferMapping.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/AbstractModelTransferMapping.java index a8ba6e60c0e..8866b012748 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/AbstractModelTransferMapping.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/AbstractModelTransferMapping.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -55,39 +55,45 @@ public abstract class AbstractModelTransferMapping implements IModelTransferMapp config.addModelTransferListener(createConfigurationListener()); } + @Override public IModelTransferConfiguration getConfiguration() { return config; } + @Override public void mapTo(IModelTransferNode source, IPath path) { - if(!Objects.equal(getMapping(source), path)) { + if (!Objects.equal(getMapping(source), path)) { mappings.put(source, path); fireMappingChanged(source); } } + @Override public IPath getMapping(IModelTransferNode node) { return mappings.get(node); } + @Override public IPapyrusRepository getRepository() { return repository; } + @Override public void setRepository(IPapyrusRepository repository) { - if(repository != this.repository) { + if (repository != this.repository) { this.repository = repository; fireRepositoryChanged(); } } + @Override public Diagnostic validate() { BasicDiagnostic result = new BasicDiagnostic(); - if(validateRepository(result)) { - for(IModelTransferNode node : getConfiguration().getModelsToTransfer()) { + if (validateRepository(result)) { + for (IModelTransferNode node : getConfiguration().getModelsToTransfer()) { validateMapping(node, result); } @@ -104,11 +110,11 @@ public abstract class AbstractModelTransferMapping implements IModelTransferMapp protected void validateUniqueMappings(DiagnosticChain diagnostics) { Set<IPath> paths = Sets.newHashSet(); - for(IModelTransferNode next : getConfiguration().getModelsToTransfer()) { + for (IModelTransferNode next : getConfiguration().getModelsToTransfer()) { IPath mapping = getMapping(next); - if((mapping != null) && !paths.add(mapping)) { - diagnostics.add(new BasicDiagnostic(Diagnostic.ERROR, Activator.PLUGIN_ID, 0, NLS.bind(Messages.AbstractModelTransferMapping_0, mapping), new Object[]{ next })); + if ((mapping != null) && !paths.add(mapping)) { + diagnostics.add(new BasicDiagnostic(Diagnostic.ERROR, Activator.PLUGIN_ID, 0, NLS.bind(Messages.AbstractModelTransferMapping_0, mapping), new Object[] { next })); break; } } @@ -117,28 +123,30 @@ public abstract class AbstractModelTransferMapping implements IModelTransferMapp protected boolean validateRepository(DiagnosticChain diagnostics) { boolean result = true; - if(getRepository() == null) { + if (getRepository() == null) { diagnostics.add(new BasicDiagnostic(Diagnostic.ERROR, Activator.PLUGIN_ID, 0, Messages.AbstractModelTransferMapping_1, null)); result = false; - } else if(!getRepository().isConnected()) { - diagnostics.add(new BasicDiagnostic(Diagnostic.ERROR, Activator.PLUGIN_ID, 0, NLS.bind(Messages.AbstractModelTransferMapping_2, getRepository().getName()), new Object[]{ getRepository() })); + } else if (!getRepository().isConnected()) { + diagnostics.add(new BasicDiagnostic(Diagnostic.ERROR, Activator.PLUGIN_ID, 0, NLS.bind(Messages.AbstractModelTransferMapping_2, getRepository().getName()), new Object[] { getRepository() })); result = false; } return result; } + @Override public void addModelTransferMappingListener(IModelTransferMappingListener listener) { listeners.addIfAbsent(listener); } + @Override public void removeModelTransferMappingListener(IModelTransferMappingListener listener) { listeners.remove(listener); } protected void fireProblemsEvent(Diagnostic problems) { - if(problems.getSeverity() > Diagnostic.OK) { - for(IModelTransferMappingListener next : listeners) { + if (problems.getSeverity() > Diagnostic.OK) { + for (IModelTransferMappingListener next : listeners) { try { next.modelTransferMappingProblemsOccurred(problems); } catch (Exception e) { @@ -149,7 +157,7 @@ public abstract class AbstractModelTransferMapping implements IModelTransferMapp } protected void fireMappingChanged(IModelTransferNode node) { - for(IModelTransferMappingListener next : listeners) { + for (IModelTransferMappingListener next : listeners) { try { next.modelTransferMappingChanged(node); } catch (Exception e) { @@ -159,7 +167,7 @@ public abstract class AbstractModelTransferMapping implements IModelTransferMapp } protected void fireRepositoryChanged() { - for(IModelTransferMappingListener next : listeners) { + for (IModelTransferMappingListener next : listeners) { try { next.modelTransferRepositoryChanged(this); } catch (Exception e) { diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/DefaultModelImportConfigurationFactory.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/DefaultModelImportConfigurationFactory.java index d41191d4677..800fa3b3fe6 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/DefaultModelImportConfigurationFactory.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/DefaultModelImportConfigurationFactory.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -25,6 +25,7 @@ public class DefaultModelImportConfigurationFactory implements Factory { super(); } + @Override public IModelTransferConfiguration create(IModelTransferOperation.Context operationContext, ResourceSet resourceSet) { ModelTransferConfiguration result = new ModelTransferConfiguration(operationContext, resourceSet); diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/DependencyAdapter.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/DependencyAdapter.java index 5bc824712dd..27d95786a89 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/DependencyAdapter.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/DependencyAdapter.java @@ -1,6 +1,6 @@ /***************************************************************************** * Copyright (c) 2013, 2014 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 @@ -9,7 +9,7 @@ * Contributors: * CEA LIST - Initial API and implementation * Christian W. Damus (CEA) - bug 429242 - * + * *****************************************************************************/ package org.eclipse.papyrus.cdo.internal.core.importer; @@ -53,7 +53,7 @@ public class DependencyAdapter extends AdapterImpl { public static DependencyAdapter getInstance(Resource resource) { DependencyAdapter result = getExistingInstance(resource); - if(result == null) { + if (result == null) { result = new DependencyAdapter(); resource.eAdapters().add(Math.min(1, resource.eAdapters().size()), result); @@ -66,9 +66,9 @@ public class DependencyAdapter extends AdapterImpl { static DependencyAdapter getExistingInstance(Resource resource) { DependencyAdapter result = null; - for(Object next : resource.eAdapters()) { - if(next instanceof DependencyAdapter) { - result = (DependencyAdapter)next; + for (Object next : resource.eAdapters()) { + if (next instanceof DependencyAdapter) { + result = (DependencyAdapter) next; break; } } @@ -93,24 +93,24 @@ public class DependencyAdapter extends AdapterImpl { } private void analyze(Resource resource) { - if(resource.getContents().isEmpty() && isDIResource(resource)) { + if (resource.getContents().isEmpty() && isDIResource(resource)) { // similarly-named resources that are recognized by Papyrus are implicitly components - for(Resource next : getImplicitComponents(resource)) { - if(isUserModelResource(next.getURI())) { + for (Resource next : getImplicitComponents(resource)) { + if (isUserModelResource(next.getURI())) { addDependency(next); } } } else { - for(TreeIterator<EObject> iter = EcoreUtil.getAllProperContents(resource, false); iter.hasNext();) { + for (TreeIterator<EObject> iter = EcoreUtil.getAllProperContents(resource, false); iter.hasNext();) { EObject next = iter.next(); // ignore annotations, such as are used for hyperlinks - if(next instanceof EAnnotation) { + if (next instanceof EAnnotation) { iter.prune(); } else { - for(EObject xref : next.eCrossReferences()) { + for (EObject xref : next.eCrossReferences()) { Resource xrefRes = xref.eResource(); - if((xrefRes != null) && (isUserModelResource(xrefRes.getURI()))) { + if ((xrefRes != null) && (isUserModelResource(xrefRes.getURI()))) { addDependency(xrefRes); } } @@ -120,19 +120,19 @@ public class DependencyAdapter extends AdapterImpl { } private Resource getResource() { - return (Resource)getTarget(); + return (Resource) getTarget(); } void addDependency(Resource resource) { Resource self = getResource(); - if((resource != self) && dependencies.add(resource)) { + if ((resource != self) && dependencies.add(resource)) { getInstance(resource).addDependent(self); } } private void addDependent(Resource resource) { - if(resource != getResource()) { + if (resource != getResource()) { dependents.add(resource); } } @@ -140,8 +140,8 @@ public class DependencyAdapter extends AdapterImpl { boolean isUserModelResource(URI uri) { ModelSet modelSet = getModelSet(); boolean result = (modelSet != null) ? modelSet.isUserModelResource(uri) : - // config.hasResource(uri) && - uri.isPlatformResource() || uri.isFile() || CDOUtils.isCDOURI(uri); + // config.hasResource(uri) && + uri.isPlatformResource() || uri.isFile() || CDOUtils.isCDOURI(uri); return result && !uri.isArchive(); } @@ -151,14 +151,14 @@ public class DependencyAdapter extends AdapterImpl { } private Iterable<Resource> getImplicitComponents(Resource diResource) { - // usually only two components: diagrams and semantics + // usually only two components: diagrams and semantics Collection<Resource> result = Lists.newArrayListWithExpectedSize(2); ResourceSet rset = diResource.getResourceSet(); URIConverter converter = rset.getURIConverter(); - for(URI next : modelsMetadata.getKnownModelURIs(diResource.getURI())) { - if(!next.equals(diResource.getURI()) && converter.exists(next, null)) { + for (URI next : modelsMetadata.getKnownModelURIs(diResource.getURI())) { + if (!next.equals(diResource.getURI()) && converter.exists(next, null)) { try { result.add(rset.getResource(next, true)); } catch (Exception e) { @@ -173,7 +173,7 @@ public class DependencyAdapter extends AdapterImpl { public static boolean isDIResource(Resource resource) { boolean result = false; - if(resource.getContents().isEmpty()) { + if (resource.getContents().isEmpty()) { // DI resources are typically empty; just markers result = DiModel.DI_FILE_EXTENSION.equals(resource.getURI().fileExtension()); } else { @@ -187,16 +187,16 @@ public class DependencyAdapter extends AdapterImpl { public static Resource getDIResource(Resource resource) { Resource result = null; - if(isDIResource(resource)) { + if (isDIResource(resource)) { result = resource; } else { // find the the DI resource ResourceSet rset = resource.getResourceSet(); URI uri = resource.getURI().trimFileExtension().appendFileExtension(DiModel.DI_FILE_EXTENSION); - if(rset.getURIConverter().exists(uri, null)) { + if (rset.getURIConverter().exists(uri, null)) { Resource di = rset.getResource(uri, true); - if((di != null) && isDIResource(di)) { + if ((di != null) && isDIResource(di)) { result = di; } } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/ManyToOneModelImportMapping.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/ManyToOneModelImportMapping.java index 955d0174fe9..9ad9d03d7b3 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/ManyToOneModelImportMapping.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/ManyToOneModelImportMapping.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -33,10 +33,10 @@ public class ManyToOneModelImportMapping extends AbstractModelImportMapping { @Override public void mapTo(IModelTransferNode source, IPath path) { - if(!Objects.equal(this.mapping, path)) { + if (!Objects.equal(this.mapping, path)) { this.mapping = path; - for(IModelTransferNode next : getConfiguration().getModelsToTransfer()) { + for (IModelTransferNode next : getConfiguration().getModelsToTransfer()) { fireMappingChanged(next); } } @@ -49,7 +49,7 @@ public class ManyToOneModelImportMapping extends AbstractModelImportMapping { @Override protected void validateUniqueMappings(DiagnosticChain diagnostics) { - // pass. The whole point of this mapping is that all inputs map to one output + // pass. The whole point of this mapping is that all inputs map to one output } } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/ManyToOneModelImportMappingFactory.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/ManyToOneModelImportMappingFactory.java index 644e91cac19..03029ccad60 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/ManyToOneModelImportMappingFactory.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/ManyToOneModelImportMappingFactory.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -25,6 +25,7 @@ public class ManyToOneModelImportMappingFactory super(); } + @Override public IModelImportMapping create(IModelTransferConfiguration configuration) { return new ManyToOneModelImportMapping(configuration); } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/ModelImporter.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/ModelImporter.java index 637a875787b..7a991da8040 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/ModelImporter.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/ModelImporter.java @@ -1,6 +1,6 @@ /***************************************************************************** * Copyright (c) 2013, 2014 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 @@ -10,7 +10,7 @@ * CEA LIST - Initial API and implementation * Christian W. Damus (CEA) - bug 429242 * Christian W. Damus (CEA) - bug 422257 - * + * *****************************************************************************/ package org.eclipse.papyrus.cdo.internal.core.importer; @@ -77,7 +77,7 @@ public class ModelImporter implements IModelImporter { add(result, mapping.getConfiguration().validate()); add(result, mapping.validate()); - if(result.getSeverity() < Diagnostic.ERROR) { + if (result.getSeverity() < Diagnostic.ERROR) { add(result, mapping.getConfiguration().getOperationContext().run(new IModelTransferOperation() { @Override @@ -102,12 +102,12 @@ public class ModelImporter implements IModelImporter { // 1 for each transaction commit, 1 for saving affected non-imported models, and 1 for clean-up SubMonitor sub = SubMonitor.convert(monitor, Messages.ModelImporter_4, configuration.getModelsToTransfer().size() + 4); - IInternalPapyrusRepository repository = (IInternalPapyrusRepository)mapping.getRepository(); + IInternalPapyrusRepository repository = (IInternalPapyrusRepository) mapping.getRepository(); ResourceSet destination = repository.createTransaction(new ResourceSetImpl()); - CDOTransaction transaction = (CDOTransaction)repository.getCDOView(destination); + CDOTransaction transaction = (CDOTransaction) repository.getCDOView(destination); try { - for(IModelTransferNode model : configuration.getModelsToTransfer()) { + for (IModelTransferNode model : configuration.getModelsToTransfer()) { add(result, importModel(model, configuration.getResourceSet(), mapping.getMapping(model), transaction, sub.newChild(1))); } @@ -115,29 +115,29 @@ public class ModelImporter implements IModelImporter { transaction.commit(sub.newChild(1)); // save sash resources (if any) - for(Resource next : destination.getResources()) { + for (Resource next : destination.getResources()) { // sash resource would have been saved by commit if it were a CDO URI - if(DependencyAdapter.isDIResource(next) && !CDOUtils.isCDOURI(next.getURI())) { + if (DependencyAdapter.isDIResource(next) && !CDOUtils.isCDOURI(next.getURI())) { next.save(null); } } } catch (Exception e) { - result.add(new BasicDiagnostic(IStatus.ERROR, Activator.PLUGIN_ID, 0, Messages.ModelImporter_5, new Object[]{ e })); + result.add(new BasicDiagnostic(IStatus.ERROR, Activator.PLUGIN_ID, 0, Messages.ModelImporter_5, new Object[] { e })); } // can't create CDO-style proxies until the resources have been committed, because only then // will the objects be persisted and have OIDs to reference boolean hasSubUnits = false; - for(IModelTransferNode model : configuration.getModelsToTransfer()) { - if(createSubUnitProxies(model, mapping.getMapping(model), transaction, sub.newChild(1))) { + for (IModelTransferNode model : configuration.getModelsToTransfer()) { + if (createSubUnitProxies(model, mapping.getMapping(model), transaction, sub.newChild(1))) { hasSubUnits = true; } } - if(hasSubUnits) { + if (hasSubUnits) { try { transaction.commit(sub.newChild(1)); } catch (CommitException e) { - result.add(new BasicDiagnostic(IStatus.ERROR, Activator.PLUGIN_ID, 0, Messages.ModelImporter_5, new Object[]{ e })); + result.add(new BasicDiagnostic(IStatus.ERROR, Activator.PLUGIN_ID, 0, Messages.ModelImporter_5, new Object[] { e })); } } else { sub.worked(1); // nothing to commit but still count progress @@ -146,7 +146,7 @@ public class ModelImporter implements IModelImporter { try { saveNonimportedModels(mapping, transaction, sub.newChild(1)); } catch (Exception e) { - result.add(new BasicDiagnostic(IStatus.ERROR, Activator.PLUGIN_ID, 0, Messages.ModelImporter_6, new Object[]{ e })); + result.add(new BasicDiagnostic(IStatus.ERROR, Activator.PLUGIN_ID, 0, Messages.ModelImporter_6, new Object[] { e })); } } finally { EMFHelper.unload(configuration.getResourceSet()); @@ -168,16 +168,16 @@ public class ModelImporter implements IModelImporter { SubMonitor sub = SubMonitor.convert(monitor, model.getName(), model.getResourceURIs().size()); - for(URI next : model.getResourceURIs()) { + for (URI next : model.getResourceURIs()) { Resource destination = transaction.getOrCreateResource(basePath.addFileExtension(next.fileExtension()).toString()); Resource source = rset.getResource(next, true); - if(model.getConfiguration().isStripSashModelContent() && DependencyAdapter.isDIResource(source)) { + if (model.getConfiguration().isStripSashModelContent() && DependencyAdapter.isDIResource(source)) { // import *.di content into the *.sash URI sashURI = new CDOSashModelProvider().initialize(transaction).getSashModelURI(destination.getURI()); ResourceSet dset = destination.getResourceSet(); Resource sashResource = dset.getURIConverter().exists(sashURI, null) ? dset.getResource(sashURI, true) : null; - if(sashResource == null) { + if (sashResource == null) { sashResource = dset.createResource(sashURI); } destination = sashResource; @@ -212,9 +212,9 @@ public class ModelImporter implements IModelImporter { } protected Diagnostic importResource(Resource source, Resource destination) { - if(!destination.getContents().isEmpty()) { + if (!destination.getContents().isEmpty()) { ContentType contentType = getContentType(source); - if(contentType == DI_CONTENT) { + if (contentType == DI_CONTENT) { mergeDIContent(source, destination); } else { // just append the additional content @@ -230,26 +230,26 @@ public class ModelImporter implements IModelImporter { /** * Determines the content-type of a resource for the purpose of combining * content. - * + * * @param resource - * a resource to be combined with existing content - * + * a resource to be combined with existing content + * * @return the content type */ protected ContentType getContentType(Resource resource) { ContentType result = UNKNOWN_CONTENT; - for(EObject next : resource.getContents()) { + for (EObject next : resource.getContents()) { EPackage ePackage = next.eClass().getEPackage(); - if(ePackage == DiPackage.eINSTANCE) { + if (ePackage == DiPackage.eINSTANCE) { result = DI_CONTENT; break; } - if(ePackage.getName().equalsIgnoreCase("uml")) { //$NON-NLS-1$ + if (ePackage.getName().equalsIgnoreCase("uml")) { //$NON-NLS-1$ result = UML_CONTENT; break; } - if(ePackage.getName().equalsIgnoreCase("notation")) { //$NON-NLS-1$ + if (ePackage.getName().equalsIgnoreCase("notation")) { //$NON-NLS-1$ result = NOTATION_CONTENT; break; } @@ -265,17 +265,17 @@ public class ModelImporter implements IModelImporter { SashWindowsMngr dstMngr = DiUtils.lookupSashWindowsMngr(destination); // merge the window manager contents - if(dstMngr == null) { + if (dstMngr == null) { destination.getContents().add(0, srcMngr); } else { SashModel dstModel = dstMngr.getSashModel(); SashModel srcModel = srcMngr.getSashModel(); - if(dstModel == null) { + if (dstModel == null) { dstMngr.setSashModel(srcModel); } else { dstModel.getWindows().addAll(srcModel.getWindows()); - if(dstModel.getCurrentSelection() == null) { + if (dstModel.getCurrentSelection() == null) { dstModel.setCurrentSelection(srcModel.getCurrentSelection()); } } @@ -283,7 +283,7 @@ public class ModelImporter implements IModelImporter { PageList dstPages = dstMngr.getPageList(); PageList srcPages = srcMngr.getPageList(); - if(dstPages == null) { + if (dstPages == null) { dstMngr.setPageList(srcPages); } else { dstPages.getAvailablePage().addAll(srcPages.getAvailablePage()); @@ -302,31 +302,31 @@ public class ModelImporter implements IModelImporter { Collection<IModelTransferNode> imported = configuration.getModelsToTransfer(); Set<IModelTransferNode> nonImported = Sets.newHashSet(); - for(IModelTransferNode next : configuration.getModelsToTransfer()) { - for(IModelTransferNode dependent : next.getDependents()) { - if(!imported.contains(dependent)) { + for (IModelTransferNode next : configuration.getModelsToTransfer()) { + for (IModelTransferNode dependent : next.getDependents()) { + if (!imported.contains(dependent)) { nonImported.add(dependent); } } } - if(!nonImported.isEmpty()) { + if (!nonImported.isEmpty()) { SubMonitor sub = SubMonitor.convert(monitor, Messages.ModelImporter_9, nonImported.size()); ResourceSet rset = configuration.getResourceSet(); try { - for(IModelTransferNode next : nonImported) { - for(URI uri : next.getResourceURIs()) { + for (IModelTransferNode next : nonImported) { + for (URI uri : next.getResourceURIs()) { Resource resource = rset.getResource(uri, false); // if the resource is modified, then we imported it, so // don't save - if((resource != null) && !resource.isModified()) { + if ((resource != null) && !resource.isModified()) { try { resource.save(null); } catch (Exception e) { - add(result, new BasicDiagnostic(IStatus.ERROR, Activator.PLUGIN_ID, 0, Messages.ModelImporter_10, new Object[]{ e })); + add(result, new BasicDiagnostic(IStatus.ERROR, Activator.PLUGIN_ID, 0, Messages.ModelImporter_10, new Object[] { e })); } } } @@ -342,7 +342,7 @@ public class ModelImporter implements IModelImporter { } private static void add(DiagnosticChain diagnostics, Diagnostic diagnostic) { - if(diagnostic.getSeverity() > Diagnostic.OK) { + if (diagnostic.getSeverity() > Diagnostic.OK) { diagnostics.merge(diagnostic); } } @@ -370,7 +370,7 @@ public class ModelImporter implements IModelImporter { @Override public boolean equals(Object obj) { - return (obj instanceof ContentType) && ((ContentType)obj).getName().equals(getName()); + return (obj instanceof ContentType) && ((ContentType) obj).getName().equals(getName()); } @Override diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/ModelImporterFactory.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/ModelImporterFactory.java index b85865f27bd..3b4163f3696 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/ModelImporterFactory.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/ModelImporterFactory.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -24,6 +24,7 @@ public class ModelImporterFactory super(); } + @Override public IModelImporter create() { return new ModelImporter(); } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/ModelTransferConfiguration.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/ModelTransferConfiguration.java index abb3a6a2d4e..4bda379ff78 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/ModelTransferConfiguration.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/ModelTransferConfiguration.java @@ -1,6 +1,6 @@ /***************************************************************************** * Copyright (c) 2013, 2014 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 @@ -10,7 +10,7 @@ * CEA LIST - Initial API and implementation * Christian W. Damus (CEA) - bug 429242 * Christian W. Damus (CEA) - bug 422257 - * + * *****************************************************************************/ package org.eclipse.papyrus.cdo.internal.core.importer; @@ -81,12 +81,12 @@ public class ModelTransferConfiguration implements IModelTransferConfiguration { this.direction = direction; this.operationContext = new ReentrantOperationContext(operationContext); - if(resourceSet != null) { + if (resourceSet != null) { this.resourceSet = resourceSet; this.ownResourceSet = false; } else { this.resourceSet = new ResourceSetImpl(); - ((ResourceSetImpl)this.resourceSet).setURIResourceMap(resources); + ((ResourceSetImpl) this.resourceSet).setURIResourceMap(resources); this.ownResourceSet = true; } } @@ -97,13 +97,13 @@ public class ModelTransferConfiguration implements IModelTransferConfiguration { @Override public void dispose() { - if(resourceSet != null) { - if(ownResourceSet) { + if (resourceSet != null) { + if (ownResourceSet) { EMFHelper.unload(resourceSet); resourceSet = null; } else { // even if not owned, we should remove DependencyAdapters - for(Resource next : resourceSet.getResources()) { + for (Resource next : resourceSet.getResources()) { DependencyAdapter adapter = DependencyAdapter.getExistingInstance(next); next.eAdapters().remove(adapter); } @@ -135,7 +135,7 @@ public class ModelTransferConfiguration implements IModelTransferConfiguration { public IModelTransferNode addModelToTransfer(URI resourceURI) { IModelTransferNode result = getNode(resourceURI); - if(modelsToImport.add(result)) { + if (modelsToImport.add(result)) { fireModelsToImportChanged(); } @@ -146,9 +146,9 @@ public class ModelTransferConfiguration implements IModelTransferConfiguration { IModelTransferNode result = null; final Resource resource = resourceSet.getResource(resourceURI, true); - if(resource != null) { + if (resource != null) { result = importNodes.get(resource); - if(result == null) { + if (result == null) { final ModelTransferNode newNode = new ModelTransferNode(this, resource); importNodes.put(resource, newNode); @@ -160,29 +160,29 @@ public class ModelTransferConfiguration implements IModelTransferConfiguration { public Diagnostic run(IProgressMonitor monitor) { SubMonitor sub = SubMonitor.convert(monitor, Messages.ModelTransferConfiguration_0, dependentsProviders.size()); - for(IModelDependentsProvider next : dependentsProviders) { + for (IModelDependentsProvider next : dependentsProviders) { // first, if it's a DI resource, ensure that it gets its components - if(DependencyAdapter.isDIResource(resource)) { + if (DependencyAdapter.isDIResource(resource)) { DependencyAdapter adapter = DependencyAdapter.getInstance(resource); final int oldCount = adapter.getDependencies().size(); - for(URI uri : next.getComponents(resource, monitor)) { + for (URI uri : next.getComponents(resource, monitor)) { // this is an implicit dependency, even if there are no references // to it (which occurs, e.g., in model sub-units that have no diagrams) Resource implicitDependency = resource.getResourceSet().getResource(uri, true); - if(implicitDependency != null) { + if (implicitDependency != null) { adapter.addDependency(implicitDependency); } } - if(adapter.getDependencies().size() > oldCount) { + if (adapter.getDependencies().size() > oldCount) { // scan for components and dependencies again newNode.scanForComponents(); newNode.scanForDependencies(); } } - for(URI uri : next.getDependents(newNode.getPrimaryResource(), monitor)) { + for (URI uri : next.getDependents(newNode.getPrimaryResource(), monitor)) { newNode.addDependent(getNode(uri)); } @@ -206,14 +206,14 @@ public class ModelTransferConfiguration implements IModelTransferConfiguration { @Override public void removeModelToTransfer(IModelTransferNode node) { - if(modelsToImport.remove(node)) { + if (modelsToImport.remove(node)) { fireModelsToImportChanged(); } } @Override public void addModelDependentsProvider(IModelDependentsProvider provider) { - if(!dependentsProviders.contains(provider)) { + if (!dependentsProviders.contains(provider)) { dependentsProviders.add(provider); } } @@ -223,7 +223,7 @@ public class ModelTransferConfiguration implements IModelTransferConfiguration { BasicDiagnostic result = new BasicDiagnostic(); Set<IModelTransferNode> toImport = ImmutableSet.copyOf(getModelsToTransfer()); - for(IModelTransferNode node : toImport) { + for (IModelTransferNode node : toImport) { checkDependents(node, toImport, result); checkDependencies(node, toImport, result); } @@ -236,13 +236,13 @@ public class ModelTransferConfiguration implements IModelTransferConfiguration { protected void checkDependents(IModelTransferNode node, Set<IModelTransferNode> toImport, DiagnosticChain diagnostics) { Set<IModelTransferNode> dependents = ImmutableSet.copyOf(node.getDependents()); Set<IModelTransferNode> leftOut = Sets.difference(dependents, toImport); - if(!leftOut.isEmpty()) { + if (!leftOut.isEmpty()) { IModelTransferNode parentUnit = findParentUnit(node, leftOut); - if(parentUnit != null) { - diagnostics.add(new BasicDiagnostic(Diagnostic.ERROR, Activator.PLUGIN_ID, 0, NLS.bind(Messages.ModelTransferConfiguration_3, new Object[]{ node.getName(), direction, parentUnit.getName() }), new Object[]{ node, parentUnit })); + if (parentUnit != null) { + diagnostics.add(new BasicDiagnostic(Diagnostic.ERROR, Activator.PLUGIN_ID, 0, NLS.bind(Messages.ModelTransferConfiguration_3, new Object[] { node.getName(), direction, parentUnit.getName() }), new Object[] { node, parentUnit })); } else { int severity = direction.isImport() ? Diagnostic.WARNING : Diagnostic.INFO; - diagnostics.add(new BasicDiagnostic(severity, Activator.PLUGIN_ID, 0, NLS.bind(Messages.ModelTransferConfiguration_1, node.getName(), direction), new Object[]{ node, leftOut })); + diagnostics.add(new BasicDiagnostic(severity, Activator.PLUGIN_ID, 0, NLS.bind(Messages.ModelTransferConfiguration_1, node.getName(), direction), new Object[] { node, leftOut })); } } } @@ -250,13 +250,13 @@ public class ModelTransferConfiguration implements IModelTransferConfiguration { protected void checkDependencies(IModelTransferNode node, Set<IModelTransferNode> toImport, DiagnosticChain diagnostics) { Set<IModelTransferNode> dependencies = ImmutableSet.copyOf(node.getDependencies()); Set<IModelTransferNode> leftOut = Sets.difference(dependencies, toImport); - if(!leftOut.isEmpty()) { + if (!leftOut.isEmpty()) { Set<IModelTransferNode> subUnits = findSubUnits(node, leftOut); - if(!subUnits.isEmpty()) { - diagnostics.add(new BasicDiagnostic(Diagnostic.ERROR, Activator.PLUGIN_ID, 0, NLS.bind(Messages.ModelTransferConfiguration_4, new Object[]{ node.getName(), direction }), new Object[]{ node, subUnits })); + if (!subUnits.isEmpty()) { + diagnostics.add(new BasicDiagnostic(Diagnostic.ERROR, Activator.PLUGIN_ID, 0, NLS.bind(Messages.ModelTransferConfiguration_4, new Object[] { node.getName(), direction }), new Object[] { node, subUnits })); } else { int severity = direction.isImport() ? Diagnostic.INFO : Diagnostic.WARNING; - diagnostics.add(new BasicDiagnostic(severity, Activator.PLUGIN_ID, 0, NLS.bind(Messages.ModelTransferConfiguration_2, node.getName(), direction), new Object[]{ node, leftOut })); + diagnostics.add(new BasicDiagnostic(severity, Activator.PLUGIN_ID, 0, NLS.bind(Messages.ModelTransferConfiguration_2, node.getName(), direction), new Object[] { node, leftOut })); } } } @@ -264,8 +264,8 @@ public class ModelTransferConfiguration implements IModelTransferConfiguration { private IModelTransferNode findParentUnit(IModelTransferNode node, Collection<? extends IModelTransferNode> possibleParents) { IModelTransferNode result = null; - for(IModelTransferNode next : possibleParents) { - if(node.isModelParentUnit(next)) { + for (IModelTransferNode next : possibleParents) { + if (node.isModelParentUnit(next)) { result = next; break; } @@ -277,8 +277,8 @@ public class ModelTransferConfiguration implements IModelTransferConfiguration { private Set<IModelTransferNode> findSubUnits(IModelTransferNode node, Collection<? extends IModelTransferNode> possibleChildren) { ImmutableSet.Builder<IModelTransferNode> result = ImmutableSet.builder(); - for(IModelTransferNode next : possibleChildren) { - if(node.isModelSubUnit(next)) { + for (IModelTransferNode next : possibleChildren) { + if (node.isModelSubUnit(next)) { result.add(next); } } @@ -297,8 +297,8 @@ public class ModelTransferConfiguration implements IModelTransferConfiguration { } void fireProblemsEvent(Diagnostic problems) { - if(problems.getSeverity() > Diagnostic.OK) { - for(IModelTransferListener next : listeners) { + if (problems.getSeverity() > Diagnostic.OK) { + for (IModelTransferListener next : listeners) { try { next.modelTransferProblemsOccurred(problems); } catch (Exception e) { @@ -309,7 +309,7 @@ public class ModelTransferConfiguration implements IModelTransferConfiguration { } void fireModelsToImportChanged() { - for(IModelTransferListener next : listeners) { + for (IModelTransferListener next : listeners) { try { next.modelsToTransferChanged(this); } catch (Exception e) { @@ -319,7 +319,7 @@ public class ModelTransferConfiguration implements IModelTransferConfiguration { } void fireModelDependentsChanged(IModelTransferNode node) { - for(IModelTransferListener next : listeners) { + for (IModelTransferListener next : listeners) { try { next.modelDependentsChanged(node); } catch (Exception e) { @@ -337,10 +337,10 @@ public class ModelTransferConfiguration implements IModelTransferConfiguration { boolean result = false; ResourceSet rset = getResourceSet(); - if(rset != null) { - for(IModelTransferNode next : importNodes.values()) { + if (rset != null) { + for (IModelTransferNode next : importNodes.values()) { Resource primary = rset.getResource(next.getPrimaryResourceURI(), false); - if((primary != null) && (DiUtils.lookupSashWindowsMngr(primary) != null)) { + if ((primary != null) && (DiUtils.lookupSashWindowsMngr(primary) != null)) { result = true; break; } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/ModelTransferNode.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/ModelTransferNode.java index 5631834914e..39674d5ca94 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/ModelTransferNode.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/ModelTransferNode.java @@ -1,6 +1,6 @@ /***************************************************************************** * Copyright (c) 2013, 2014 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 @@ -9,7 +9,7 @@ * Contributors: * CEA LIST - Initial API and implementation * Christian W. Damus (CEA) - bug 429242 - * + * *****************************************************************************/ package org.eclipse.papyrus.cdo.internal.core.importer; @@ -82,11 +82,11 @@ public class ModelTransferNode implements IModelTransferNode { @Override public String getName() { - if(name == null) { + if (name == null) { URI uri = getPrimaryResourceURI(); String path = uri.path(); - if(uri.isPlatformResource()) { + if (uri.isPlatformResource()) { // trim the project segment path = path.substring(("/" + uri.segment(0)).length()); //$NON-NLS-1$ } // else a file: URI's path does not include the device, so it's OK @@ -115,7 +115,7 @@ public class ModelTransferNode implements IModelTransferNode { public Collection<URI> getResourceURIs() { ImmutableSet.Builder<URI> result = ImmutableSet.builder(); - for(Resource next : components) { + for (Resource next : components) { result.add(next.getURI()); } @@ -143,7 +143,7 @@ public class ModelTransferNode implements IModelTransferNode { @Override public boolean equals(Object obj) { - return (obj instanceof IModelTransferNode) && getPrimaryResourceURI().equals(((IModelTransferNode)obj).getPrimaryResourceURI()); + return (obj instanceof IModelTransferNode) && getPrimaryResourceURI().equals(((IModelTransferNode) obj).getPrimaryResourceURI()); } @Override @@ -153,8 +153,8 @@ public class ModelTransferNode implements IModelTransferNode { void scanForComponents() { Resource self = getPrimaryResource(); - for(Resource next : DependencyAdapter.getDependencies(self)) { - if(DependencyAdapter.getDIResource(next) == self) { + for (Resource next : DependencyAdapter.getDependencies(self)) { + if (DependencyAdapter.getDIResource(next) == self) { components.add(next); } } @@ -167,12 +167,12 @@ public class ModelTransferNode implements IModelTransferNode { URIConverter converter = resource.getResourceSet().getURIConverter(); - for(Resource component : components) { - for(Resource xref : DependencyAdapter.getDependencies(component)) { + for (Resource component : components) { + for (Resource xref : DependencyAdapter.getDependencies(component)) { URI primary = findPrimaryResource(xref.getURI(), converter); - if((primary != null) && converter.exists(primary, null)) { + if ((primary != null) && converter.exists(primary, null)) { IModelTransferNode node = config.getNode(primary); - if((node != null) && !node.equals(this)) { + if ((node != null) && !node.equals(this)) { dependencies.add(node); } } @@ -184,7 +184,7 @@ public class ModelTransferNode implements IModelTransferNode { URI result = null; URI candidate = componentURI.trimFileExtension().appendFileExtension(DiModel.DI_FILE_EXTENSION); - if(converter.exists(candidate, null)) { + if (converter.exists(candidate, null)) { result = candidate; } @@ -195,14 +195,14 @@ public class ModelTransferNode implements IModelTransferNode { public boolean isModelParentUnit(IModelTransferNode other) { boolean result = false; - out: for(URI childURI : getResourceURIs()) { + out: for (URI childURI : getResourceURIs()) { Resource child = config.getResourceSet().getResource(childURI, false); - if(child != null) { - for(EObject root : child.getContents()) { + if (child != null) { + for (EObject root : child.getContents()) { EObject container = root.eContainer(); - if(container != null) { + if (container != null) { URI uri = EcoreUtil.getURI(container).trimFragment(); - if(other.getResourceURIs().contains(uri)) { + if (other.getResourceURIs().contains(uri)) { // found the parent unit result = true; break out; @@ -219,14 +219,14 @@ public class ModelTransferNode implements IModelTransferNode { public boolean isModelSubUnit(IModelTransferNode other) { boolean result = false; - out: for(URI uri : other.getResourceURIs()) { + out: for (URI uri : other.getResourceURIs()) { Resource possibleChild = config.getResourceSet().getResource(uri, false); - if(possibleChild != null) { - for(EObject root : possibleChild.getContents()) { + if (possibleChild != null) { + for (EObject root : possibleChild.getContents()) { EObject container = root.eContainer(); - if(container != null) { + if (container != null) { URI parentURI = EcoreUtil.getURI(container).trimFragment(); - if(getResourceURIs().contains(parentURI)) { + if (getResourceURIs().contains(parentURI)) { // found a child unit result = true; break out; diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/OneToOneModelImportMapping.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/OneToOneModelImportMapping.java index 50c9e445684..4076e9ed9ce 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/OneToOneModelImportMapping.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/OneToOneModelImportMapping.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/OneToOneModelImportMappingFactory.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/OneToOneModelImportMappingFactory.java index 900a9c21d9f..c036afc7542 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/OneToOneModelImportMappingFactory.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/OneToOneModelImportMappingFactory.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -25,6 +25,7 @@ public class OneToOneModelImportMappingFactory super(); } + @Override public IModelImportMapping create(IModelTransferConfiguration configuration) { return new OneToOneModelImportMapping(configuration); } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/ReentrantOperationContext.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/ReentrantOperationContext.java index 41a257bb7eb..65edeb2407a 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/ReentrantOperationContext.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/ReentrantOperationContext.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -33,6 +33,7 @@ public class ReentrantOperationContext this.delegate = delegate; } + @Override public Diagnostic run(IModelTransferOperation operation) { Diagnostic result; @@ -48,7 +49,7 @@ public class ReentrantOperationContext } finally { depth.decrementAndGet(); } - + return result; } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/WorkspaceDIDependentsProvider.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/WorkspaceDIDependentsProvider.java index ec262a4c3dc..3afc3f91f83 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/WorkspaceDIDependentsProvider.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/WorkspaceDIDependentsProvider.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -49,9 +49,10 @@ public class WorkspaceDIDependentsProvider implements IModelDependentsProvider { super(); } + @Override public Collection<URI> getDependents(Resource resource, IProgressMonitor monitor) { - if(!completedScan) { + if (!completedScan) { scanWorkspace(resource.getResourceSet()); } @@ -60,14 +61,14 @@ public class WorkspaceDIDependentsProvider implements IModelDependentsProvider { // if it's a DI resource, get its dependencies' dependents and find // their dependents that are unique DIs Resource di = getDIResource(resource); - if(di != null) { + if (di != null) { // the DI's dependencies are the model components - for(Resource component : DependencyAdapter.getDependencies(di)) { + for (Resource component : DependencyAdapter.getDependencies(di)) { // the components' dependents in other models are what we are // interested in - for(Resource next : DependencyAdapter.getDependents(component)) { + for (Resource next : DependencyAdapter.getDependents(component)) { Resource dependentDI = getDIResource(next); - if((dependentDI != null) && (dependentDI != di)) { + if ((dependentDI != null) && (dependentDI != di)) { result.add(dependentDI.getURI()); } } @@ -77,10 +78,11 @@ public class WorkspaceDIDependentsProvider implements IModelDependentsProvider { return result; } + @Override public Collection<URI> getComponents(Resource diResource, IProgressMonitor monitor) { Collection<URI> result; - if(!diResource.getURI().isPlatformResource()) { + if (!diResource.getURI().isPlatformResource()) { result = Collections.emptyList(); } else { ImmutableList.Builder<URI> uris = ImmutableList.builder(); @@ -91,8 +93,8 @@ public class WorkspaceDIDependentsProvider implements IModelDependentsProvider { final IContainer container = file.getParent(); try { - for(IFile next : filter(Arrays.asList(container.members()), IFile.class)) { - if(!next.equals(file) && baseName.equals(next.getFullPath().removeFileExtension().lastSegment())) { + for (IFile next : filter(Arrays.asList(container.members()), IFile.class)) { + if (!next.equals(file) && baseName.equals(next.getFullPath().removeFileExtension().lastSegment())) { uris.add(baseURI.appendSegment(next.getName())); } } @@ -111,16 +113,17 @@ public class WorkspaceDIDependentsProvider implements IModelDependentsProvider { IResourceProxyVisitor visitor = new IResourceProxyVisitor() { + @Override public boolean visit(IResourceProxy proxy) throws CoreException { - if((proxy.getType() == IResource.FILE) && proxy.getName().endsWith(".di")) { //$NON-NLS-1$ + if ((proxy.getType() == IResource.FILE) && proxy.getName().endsWith(".di")) { //$NON-NLS-1$ String path = proxy.requestFullPath().toString(); try { Resource resource = resourceSet.getResource(URI.createPlatformResourceURI(path, true), true); - if((resource != null) && isDIResource(resource)) { + if ((resource != null) && isDIResource(resource)) { // it's a Papyrus model. Initialize the // dependencies DependencyAdapter.getInstance(resource); @@ -128,7 +131,7 @@ public class WorkspaceDIDependentsProvider implements IModelDependentsProvider { } catch (Exception e) { // not a valid model resource. That's OK. Resource resource = resourceSet.getResource(URI.createPlatformResourceURI(path, true), false); - if(resource != null) { + if (resource != null) { resource.unload(); resourceSet.getResources().remove(resource); resource.eAdapters().clear(); diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/l10n/Messages.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/l10n/Messages.java index b144f8e676d..d130fc8e699 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/l10n/Messages.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/l10n/Messages.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/resource/CDOSashModelProvider.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/resource/CDOSashModelProvider.java index 2db7a6eb997..2c98addf60f 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/resource/CDOSashModelProvider.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/resource/CDOSashModelProvider.java @@ -1,6 +1,6 @@ /***************************************************************************** * Copyright (c) 2014 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 @@ -40,7 +40,7 @@ public class CDOSashModelProvider extends AbstractSashModelProvider { super.initialize(modelSet); CDOView view = CDOUtils.getView(modelSet); - if(view != null) { // Model probably is in the workspace if null + if (view != null) { // Model probably is in the workspace if null initialize(view); } } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/services/localizer/CDOAwareObjectLocalizer.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/services/localizer/CDOAwareObjectLocalizer.java index 49557bd9610..cd6753439c5 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/services/localizer/CDOAwareObjectLocalizer.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/services/localizer/CDOAwareObjectLocalizer.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -38,17 +38,17 @@ public class CDOAwareObjectLocalizer extends DefaultObjectLocalizer { public EObject getLocalEObject(ResourceSet localSet, EObject remoteObject) { EObject result = null; - if(!(remoteObject instanceof CDOResourceNode)) { + if (!(remoteObject instanceof CDOResourceNode)) { result = super.getLocalEObject(localSet, remoteObject); - } else if(remoteObject instanceof CDOResource) { - result = (CDOResource)getLocalResource(localSet, (CDOResource)remoteObject); + } else if (remoteObject instanceof CDOResource) { + result = (CDOResource) getLocalResource(localSet, (CDOResource) remoteObject); } else { // these need special handling! - CDOResourceNode node = (CDOResourceNode)remoteObject; + CDOResourceNode node = (CDOResourceNode) remoteObject; String path = node.getPath(); CDOView view = CDOUtils.getView(localSet); - if(view != null) { + if (view != null) { try { result = view.getResourceNode(path); } catch (Exception e) { @@ -64,14 +64,14 @@ public class CDOAwareObjectLocalizer extends DefaultObjectLocalizer { public Resource getLocalResource(ResourceSet localSet, Resource remoteResource) { Resource result = null; - if(!(remoteResource instanceof CDOResource)) { + if (!(remoteResource instanceof CDOResource)) { result = super.getLocalResource(localSet, remoteResource); } else { - CDOResource cdo = (CDOResource)remoteResource; + CDOResource cdo = (CDOResource) remoteResource; String path = cdo.getPath(); CDOView view = CDOUtils.getView(localSet); - if(view != null) { + if (view != null) { try { result = view.getResource(path); } catch (Exception e) { @@ -97,17 +97,17 @@ public class CDOAwareObjectLocalizer extends DefaultObjectLocalizer { @Override public void init(ServicesRegistry servicesRegistry) throws ServiceException { - // pass. The localizer is stateless and requires no initialization + // pass. The localizer is stateless and requires no initialization } @Override public void startService() throws ServiceException { - // pass. The localizer is stateless and requires no starting + // pass. The localizer is stateless and requires no starting } @Override public void disposeService() throws ServiceException { - // pass. The localizer is stateless and requires no disposal + // pass. The localizer is stateless and requires no disposal } @Override diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.customization.properties/src/org/eclipse/papyrus/cdo/internal/ui/customization/properties/Activator.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.customization.properties/src/org/eclipse/papyrus/cdo/internal/ui/customization/properties/Activator.java index 421ad2842cb..39f7e226be4 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.customization.properties/src/org/eclipse/papyrus/cdo/internal/ui/customization/properties/Activator.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.customization.properties/src/org/eclipse/papyrus/cdo/internal/ui/customization/properties/Activator.java @@ -43,7 +43,7 @@ public class Activator extends AbstractUIPlugin { /** * Returns the shared instance - * + * * @return the shared instance */ public static Activator getDefault() { diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.customization.properties/src/org/eclipse/papyrus/cdo/internal/ui/customization/properties/messages/Messages.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.customization.properties/src/org/eclipse/papyrus/cdo/internal/ui/customization/properties/messages/Messages.java index 793a0184e3b..6f2786f81f3 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.customization.properties/src/org/eclipse/papyrus/cdo/internal/ui/customization/properties/messages/Messages.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.customization.properties/src/org/eclipse/papyrus/cdo/internal/ui/customization/properties/messages/Messages.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -14,7 +14,7 @@ package org.eclipse.papyrus.cdo.internal.ui.customization.properties.messages; import org.eclipse.osgi.util.NLS; /** - * This is the Messages type. Enjoy. + * This is the Messages type. Enjoy. */ public class Messages extends NLS { diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.customization.properties/src/org/eclipse/papyrus/cdo/internal/ui/customization/properties/storage/CDOContextStorageProvider.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.customization.properties/src/org/eclipse/papyrus/cdo/internal/ui/customization/properties/storage/CDOContextStorageProvider.java index baf0b678b6e..d8b6b841acc 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.customization.properties/src/org/eclipse/papyrus/cdo/internal/ui/customization/properties/storage/CDOContextStorageProvider.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.customization.properties/src/org/eclipse/papyrus/cdo/internal/ui/customization/properties/storage/CDOContextStorageProvider.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -80,7 +80,7 @@ public class CDOContextStorageProvider extends AbstractContextStorageProvider { @Override public void dispose() { - if(repositoryAdapter != null) { + if (repositoryAdapter != null) { repositoryAdapter.uninstall(repoMan); repositoryAdapter = null; @@ -93,11 +93,13 @@ public class CDOContextStorageProvider extends AbstractContextStorageProvider { super.dispose(); } + @Override public boolean providesFor(Context context) { URI uri = EcoreUtil.getURI(context); return (uri != null) && CDOUtils.isCDOURI(uri) || CDOTextURIHandler.SCHEME.equals(uri.scheme()); } + @Override public Collection<? extends Context> loadContexts() throws CoreException { return ImmutableList.copyOf(Iterables.concat(Iterables.transform(getRepositories(), getContexts()))); } @@ -109,6 +111,7 @@ public class CDOContextStorageProvider extends AbstractContextStorageProvider { Function<IInternalPapyrusRepository, Iterable<? extends Context>> getContexts() { return new Function<IInternalPapyrusRepository, Iterable<? extends Context>>() { + @Override public Iterable<? extends Context> apply(IInternalPapyrusRepository input) { return getContexts(input); } @@ -118,7 +121,7 @@ public class CDOContextStorageProvider extends AbstractContextStorageProvider { Iterable<? extends Context> getContexts(IInternalPapyrusRepository repository) { Iterable<? extends Context> result; - if(!repository.isConnected()) { + if (!repository.isConnected()) { result = Collections.emptyList(); } else { CDOResourceFolder folder = null; @@ -129,7 +132,7 @@ public class CDOContextStorageProvider extends AbstractContextStorageProvider { // normal consequence when the folder doesn't exist } - if(folder == null) { + if (folder == null) { result = Collections.emptyList(); } else { Iterable<CDOTextResource> textNodes = Iterables.concat(Iterables.transform(folder.getNodes(), CDOFunctions.getFolderContents(CDOTextResource.class))); @@ -145,18 +148,19 @@ public class CDOContextStorageProvider extends AbstractContextStorageProvider { Iterable<? extends Context> getContexts(Iterable<CDOTextResource> textResources) { return Iterables.filter( // null filter - Iterables.transform( // root transform - Iterables.transform( // resource transform - Iterables.filter( // .ctx extension filter - textResources, CDOPredicates.hasExtension(CONTEXT_EXTENSION)), // filter - getContextResource()), // transform - CDOFunctions.getRoot(Context.class)), // transform - Predicates.notNull()); // filter + Iterables.transform( // root transform + Iterables.transform( // resource transform + Iterables.filter( // .ctx extension filter + textResources, CDOPredicates.hasExtension(CONTEXT_EXTENSION)), // filter + getContextResource()), // transform + CDOFunctions.getRoot(Context.class)), // transform + Predicates.notNull()); // filter } private Function<CDOTextResource, Resource> getContextResource() { return new Function<CDOTextResource, Resource>() { + @Override public Resource apply(CDOTextResource input) { return resourceSet.getResource(CDOTextURIHandler.createURI(input.getURI()), true); } @@ -180,12 +184,12 @@ public class CDOContextStorageProvider extends AbstractContextStorageProvider { @Override protected void onConnected(IPapyrusRepository repository) { - if(repository instanceof IInternalPapyrusRepository) { + if (repository instanceof IInternalPapyrusRepository) { // attach a view on this repository to the resource set repository.createReadOnlyView(resourceSet); - Collection<? extends Context> added = ImmutableList.copyOf(getContexts((IInternalPapyrusRepository)repository)); - if(!added.isEmpty()) { + Collection<? extends Context> added = ImmutableList.copyOf(getContexts((IInternalPapyrusRepository) repository)); + if (!added.isEmpty()) { fireContextsAdded(added); } } @@ -194,7 +198,7 @@ public class CDOContextStorageProvider extends AbstractContextStorageProvider { @Override protected void onDisconnected(IPapyrusRepository repository) { Collection<? extends Context> removed = ImmutableList.copyOf(contexts.get(repository)); - if(!removed.isEmpty()) { + if (!removed.isEmpty()) { contexts.removeAll(repository); fireContextsRemoved(removed); } @@ -202,32 +206,32 @@ public class CDOContextStorageProvider extends AbstractContextStorageProvider { @Override protected void onInvalidation(IPapyrusRepository repository, CDOView view, CDOViewInvalidationEvent event) { - if(view.hasResource(CONTEXTS_PATH)) { + if (view.hasResource(CONTEXTS_PATH)) { CDOResourceFolder folder = view.getResourceFolder(CONTEXTS_PATH); URI prefix = folder.getURI(); - if(!prefix.isPrefix()) { + if (!prefix.isPrefix()) { prefix = prefix.appendSegment(""); // add a trailing slash } // usually, it is XWT resources that change, so we have to find the contexts that own them Collection<CDOTextResource> contextResources = Lists.newArrayList(); Iterable<CDOTextResource> textResources = Iterables.filter(Iterables.filter(event.getDirtyObjects(), CDOTextResource.class), CDOPredicates.hasURIPrefix(prefix)); - for(CDOTextResource next : textResources) { + for (CDOTextResource next : textResources) { // get the context resource URI relative = next.getURI().deresolve(prefix); URI contextURI = prefix.appendSegment(relative.segment(0)).appendSegment(relative.segment(0)).appendFileExtension(CONTEXT_EXTENSION); String path = CDOURIUtil.extractResourcePath(contextURI); - if(view.hasResource(path)) { + if (view.hasResource(path)) { try { contextResources.add(view.getTextResource(path)); } catch (Exception e) { - // it's not a text resource. OK, there's something going on that we don't understand + // it's not a text resource. OK, there's something going on that we don't understand } } } Collection<Context> changed = ImmutableList.copyOf(getContexts(contextResources)); - if(!changed.isEmpty()) { + if (!changed.isEmpty()) { fireContextsChanged(changed); } } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.customization.properties/src/org/eclipse/papyrus/cdo/internal/ui/customization/properties/storage/CDOTextDelegatingResourceFactory.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.customization.properties/src/org/eclipse/papyrus/cdo/internal/ui/customization/properties/storage/CDOTextDelegatingResourceFactory.java index 9e4542e6ff8..47799ea4186 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.customization.properties/src/org/eclipse/papyrus/cdo/internal/ui/customization/properties/storage/CDOTextDelegatingResourceFactory.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.customization.properties/src/org/eclipse/papyrus/cdo/internal/ui/customization/properties/storage/CDOTextDelegatingResourceFactory.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -31,6 +31,7 @@ public class CDOTextDelegatingResourceFactory implements Factory { this.registry = registry; } + @Override public Resource createResource(URI uri) { Resource.Factory delegate = ResourceFactoryRegistryImpl.convert(registry.getExtensionToFactoryMap().get(uri.fileExtension())); return (delegate != null) ? delegate.createResource(uri) : null; diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.customization.properties/src/org/eclipse/papyrus/cdo/internal/ui/customization/properties/storage/CDOTextURIHandler.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.customization.properties/src/org/eclipse/papyrus/cdo/internal/ui/customization/properties/storage/CDOTextURIHandler.java index b065818d956..efc1849d75c 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.customization.properties/src/org/eclipse/papyrus/cdo/internal/ui/customization/properties/storage/CDOTextURIHandler.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.customization.properties/src/org/eclipse/papyrus/cdo/internal/ui/customization/properties/storage/CDOTextURIHandler.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -53,8 +53,8 @@ public class CDOTextURIHandler extends URIHandlerImpl { } public static void uninstall(ResourceSet resourceSet) { - for(Iterator<URIHandler> iter = resourceSet.getURIConverter().getURIHandlers().iterator(); iter.hasNext();) { - if(iter.next() instanceof CDOTextURIHandler) { + for (Iterator<URIHandler> iter = resourceSet.getURIConverter().getURIHandlers().iterator(); iter.hasNext();) { + if (iter.next() instanceof CDOTextURIHandler) { iter.remove(); } } @@ -85,8 +85,8 @@ public class CDOTextURIHandler extends URIHandlerImpl { CDOView result = null; CDOViewSet viewSet = CDOUtil.getViewSet(resourceSet); - if(viewSet != null) { - if(SCHEME.equals(uri.scheme())) { + if (viewSet != null) { + if (SCHEME.equals(uri.scheme())) { uri = translate(uri); } @@ -104,7 +104,7 @@ public class CDOTextURIHandler extends URIHandlerImpl { public InputStream createInputStream(URI uri, Map<?, ?> options) throws IOException { URI translated = translate(uri); CDOView view = getView(translated); - if(view == null) { + if (view == null) { // try to delegate, but it probably won't work return getDelegateHandler(translated).createInputStream(translated, options); } else { @@ -123,7 +123,7 @@ public class CDOTextURIHandler extends URIHandlerImpl { public OutputStream createOutputStream(URI uri, Map<?, ?> options) throws IOException { URI translated = translate(uri); CDOView view = getView(translated); - if(view == null) { + if (view == null) { // try to delegate, but it probably won't work return getDelegateHandler(translated).createOutputStream(translated, options); } else { diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.customization.properties/src/org/eclipse/papyrus/cdo/internal/ui/customization/properties/storage/ClobInputStream.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.customization.properties/src/org/eclipse/papyrus/cdo/internal/ui/customization/properties/storage/ClobInputStream.java index 8042fec72ba..a642ef73f13 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.customization.properties/src/org/eclipse/papyrus/cdo/internal/ui/customization/properties/storage/ClobInputStream.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.customization.properties/src/org/eclipse/papyrus/cdo/internal/ui/customization/properties/storage/ClobInputStream.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -47,7 +47,7 @@ public class ClobInputStream extends InputStream { @Override public void close() throws IOException { - if(reader != null) { + if (reader != null) { reader.close(); reader = null; buffer = null; @@ -60,7 +60,7 @@ public class ClobInputStream extends InputStream { checkClosed(); checkBuffer(); - if(buffer != null) { + if (buffer != null) { return buffer.get() & MASK; } @@ -68,7 +68,7 @@ public class ClobInputStream extends InputStream { } private void checkBuffer() throws IOException { - if((buffer == null) || !buffer.hasRemaining()) { + if ((buffer == null) || !buffer.hasRemaining()) { buffer = null; createBuffer(); } @@ -78,13 +78,13 @@ public class ClobInputStream extends InputStream { public int read(byte[] b, int off, int len) throws IOException { checkClosed(); - if(len == 0) { + if (len == 0) { return 0; } checkBuffer(); - if(buffer == null) { + if (buffer == null) { return EOF; } @@ -92,7 +92,7 @@ public class ClobInputStream extends InputStream { do { checkBuffer(); - if(buffer == null) { + if (buffer == null) { // no more to read break; } @@ -100,7 +100,7 @@ public class ClobInputStream extends InputStream { int toRead = Math.min(buffer.remaining(), len - count); buffer.get(b, off + count, toRead); count = count + toRead; - } while(count < len); + } while (count < len); return count; } @@ -110,7 +110,7 @@ public class ClobInputStream extends InputStream { checkClosed(); checkBuffer(); - if(buffer != null) { + if (buffer != null) { return buffer.remaining(); } @@ -118,7 +118,7 @@ public class ClobInputStream extends InputStream { } protected final void checkClosed() throws IOException { - if(reader == null) { + if (reader == null) { throw new IOException("CLOB reader is closed"); //$NON-NLS-1$ } } @@ -128,7 +128,7 @@ public class ClobInputStream extends InputStream { chars.rewind(); int count = reader.read(chars); - if(count > 0) { + if (count > 0) { chars.flip(); buffer = charset.encode(chars); } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.customization.properties/src/org/eclipse/papyrus/cdo/internal/ui/customization/properties/storage/ClobOutputStream.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.customization.properties/src/org/eclipse/papyrus/cdo/internal/ui/customization/properties/storage/ClobOutputStream.java index a6faa0904dd..b5f6cf20679 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.customization.properties/src/org/eclipse/papyrus/cdo/internal/ui/customization/properties/storage/ClobOutputStream.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.customization.properties/src/org/eclipse/papyrus/cdo/internal/ui/customization/properties/storage/ClobOutputStream.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -39,7 +39,7 @@ public class ClobOutputStream extends ByteArrayOutputStream { public void close() throws IOException { super.close(); - if(resource != null) { + if (resource != null) { resource.setContents(createClob()); resource = null; } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.customization.properties/src/org/eclipse/papyrus/cdo/internal/ui/customization/properties/storage/action/AbstractCDOContextAction.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.customization.properties/src/org/eclipse/papyrus/cdo/internal/ui/customization/properties/storage/action/AbstractCDOContextAction.java index 8e332a05fc0..f31b6a927f6 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.customization.properties/src/org/eclipse/papyrus/cdo/internal/ui/customization/properties/storage/action/AbstractCDOContextAction.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.customization.properties/src/org/eclipse/papyrus/cdo/internal/ui/customization/properties/storage/action/AbstractCDOContextAction.java @@ -1,6 +1,6 @@ /*****************************************************************************
* 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
@@ -35,15 +35,15 @@ public class AbstractCDOContextAction { CDOView view = null;
Resource resource = object.eResource();
- if(resource instanceof CDOResource) {
- view = ((CDOResource)resource).cdoView();
+ if (resource instanceof CDOResource) {
+ view = ((CDOResource) resource).cdoView();
} else {
view = CDOTextURIHandler.getView(resource.getResourceSet(), resource.getURI());
}
CDOTransaction result = null;
- if(view != null) {
+ if (view != null) {
result = view.getSession().openTransaction();
CDOTextURIHandler.install(result.getResourceSet());
}
@@ -54,11 +54,11 @@ public class AbstractCDOContextAction { @SuppressWarnings("unchecked")
protected <T extends EObject> T getDoppelganger(T original, CDOView view) {
Resource resource = original.eResource();
- if(resource instanceof CDOResource) {
+ if (resource instanceof CDOResource) {
CDOID oid = CDOUtil.getCDOObject(original).cdoID();
- return (T)CDOUtil.getEObject(view.getObject(oid));
+ return (T) CDOUtil.getEObject(view.getObject(oid));
} else {
- return (T)view.getResourceSet().getEObject(EcoreUtil.getURI(original), true);
+ return (T) view.getResourceSet().getEObject(EcoreUtil.getURI(original), true);
}
}
@@ -67,13 +67,13 @@ public class AbstractCDOContextAction { Resource resource = context.eResource();
- if(resource instanceof CDOResource) {
- result = ((CDOResource)resource).getFolder();
+ if (resource instanceof CDOResource) {
+ result = ((CDOResource) resource).getFolder();
} else {
CDOView view = CDOTextURIHandler.getView(resource.getResourceSet(), resource.getURI());
- if(view != null) {
+ if (view != null) {
CDOResourceNode node = view.getResourceNode(URI.decode(CDOURIUtil.extractResourcePath(CDOTextURIHandler.translate(resource.getURI()))));
- if(node != null) {
+ if (node != null) {
result = node.getFolder();
}
}
diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.customization.properties/src/org/eclipse/papyrus/cdo/internal/ui/customization/properties/storage/action/CDOContextCopyAction.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.customization.properties/src/org/eclipse/papyrus/cdo/internal/ui/customization/properties/storage/action/CDOContextCopyAction.java index 94017d3b78a..a31fa8e08ba 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.customization.properties/src/org/eclipse/papyrus/cdo/internal/ui/customization/properties/storage/action/CDOContextCopyAction.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.customization.properties/src/org/eclipse/papyrus/cdo/internal/ui/customization/properties/storage/action/CDOContextCopyAction.java @@ -1,6 +1,6 @@ /*****************************************************************************
* Copyright (c) 2013, 2014 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
@@ -9,7 +9,7 @@ * Contributors:
* CEA LIST - Initial API and implementation
* Christian W. Damus (CEA) - bug 422257
- *
+ *
*****************************************************************************/
package org.eclipse.papyrus.cdo.internal.ui.customization.properties.storage.action;
@@ -85,12 +85,12 @@ public class CDOContextCopyAction extends AbstractCDOContextAction implements IC @Override
public Context copy(Context source, String targetName, IProgressMonitor monitor) throws CoreException {
IInternalPapyrusRepository repository = selectRepository(source);
- if(repository == null) {
+ if (repository == null) {
// user cancelled
return null;
}
- CDOTransaction transaction = (CDOTransaction)repository.getCDOView(repository.createTransaction(new ResourceSetImpl()));
+ CDOTransaction transaction = (CDOTransaction) repository.getCDOView(repository.createTransaction(new ResourceSetImpl()));
SubMonitor sub = SubMonitor.convert(monitor);
@@ -101,7 +101,7 @@ public class CDOContextCopyAction extends AbstractCDOContextAction implements IC String folderPath = new Path(contextsFolder.getPath()).append(targetName).toString();
String resourcePath = new Path(folderPath).append(targetName).addFileExtension(CONTEXT_EXTENSION).toString();
- if(transaction.hasResource(folderPath)) { // actually checks for any kind of resource node at that path
+ if (transaction.hasResource(folderPath)) { // actually checks for any kind of resource node at that path
throw new IOException(Messages.CDOContextCopyAction_2);
}
@@ -117,11 +117,11 @@ public class CDOContextCopyAction extends AbstractCDOContextAction implements IC CDOTextURIHandler.install(resourceSet);
// re-load the source context in the new resource set to scope the copy operation
- Context sourceContext = (Context)EMFHelper.loadEMFModel(resourceSet, source.eResource().getURI());
- IStatus copyResult = copyAll(sourceContext, targetResource, sub); //$NON-NLS-1$
+ Context sourceContext = (Context) EMFHelper.loadEMFModel(resourceSet, source.eResource().getURI());
+ IStatus copyResult = copyAll(sourceContext, targetResource, sub);
- if(copyResult.isOK()) {
- Context resultContext = (Context)EMFHelper.loadEMFModel(resourceSet, targetModelURI);
+ if (copyResult.isOK()) {
+ Context resultContext = (Context) EMFHelper.loadEMFModel(resourceSet, targetModelURI);
resultContext.setName(targetName);
resultContext.setPrototype(sourceContext);
resultContext.eResource().save(null);
@@ -133,8 +133,8 @@ public class CDOContextCopyAction extends AbstractCDOContextAction implements IC repository.getCDOView(mainResourceSet).waitForUpdate(commitTime, 30000L);
// load the new instance in the shared resource set
- result = (Context)EMFHelper.loadEMFModel(mainResourceSet, targetModelURI);
- } else if(copyResult.getSeverity() != IStatus.CANCEL) {
+ result = (Context) EMFHelper.loadEMFModel(mainResourceSet, targetModelURI);
+ } else if (copyResult.getSeverity() != IStatus.CANCEL) {
throw new CoreException(copyResult);
}
} catch (Exception e) {
@@ -157,14 +157,14 @@ public class CDOContextCopyAction extends AbstractCDOContextAction implements IC // if it is in a repository
IPapyrusRepository initialSelection = null;
URI uri = context.eResource().getURI();
- if(CDOUtils.isCDOURI(uri)) {
+ if (CDOUtils.isCDOURI(uri)) {
initialSelection = mgr.getRepositoryForURI(uri);
}
// otherwise, look for the first open repository
- if(initialSelection == null) {
- for(IPapyrusRepository next : mgr.getRepositories()) {
- if(next.isConnected()) {
+ if (initialSelection == null) {
+ for (IPapyrusRepository next : mgr.getRepositories()) {
+ if (next.isConnected()) {
initialSelection = next;
break;
}
@@ -173,7 +173,7 @@ public class CDOContextCopyAction extends AbstractCDOContextAction implements IC result = initialSelection;
- if(mgr.getRepositories().size() > 1) {
+ if (mgr.getRepositories().size() > 1) {
final IPapyrusRepository[] innerResult = { initialSelection };
Display.getDefault().syncExec(new Runnable() {
@@ -188,7 +188,7 @@ public class CDOContextCopyAction extends AbstractCDOContextAction implements IC }
});
- if(dlg.open() == Window.OK) {
+ if (dlg.open() == Window.OK) {
innerResult[0] = dlg.getSelectedRepository();
} else {
innerResult[0] = null;
@@ -199,7 +199,7 @@ public class CDOContextCopyAction extends AbstractCDOContextAction implements IC result = innerResult[0];
}
- return (IInternalPapyrusRepository)result;
+ return (IInternalPapyrusRepository) result;
}
private IStatus copyAll(Context source, CDOTextResource target, IProgressMonitor monitor) {
@@ -220,10 +220,10 @@ public class CDOContextCopyAction extends AbstractCDOContextAction implements IC Resource sourceResource = source.eResource();
int resourcesToCopy = sourceResource.getResourceSet().getResources().size();
List<Context> contexts = new LinkedList<Context>();
- for(Context context : PropertiesUtil.getDependencies(source)) {
- if(isRelative(sourceResource, context.eResource())) {
+ for (Context context : PropertiesUtil.getDependencies(source)) {
+ if (isRelative(sourceResource, context.eResource())) {
contexts.add(context);
- for(Tab tab : context.getTabs()) {
+ for (Tab tab : context.getTabs()) {
resourcesToCopy += tab.getSections().size();
}
}
@@ -236,21 +236,21 @@ public class CDOContextCopyAction extends AbstractCDOContextAction implements IC monitor.worked(1);
// copy the dependent resources which are located in the same folder or in subfolders
- for(Resource resource : sourceResource.getResourceSet().getResources()) {
- if(monitor.isCanceled()) {
+ for (Resource resource : sourceResource.getResourceSet().getResources()) {
+ if (monitor.isCanceled()) {
return Status.CANCEL_STATUS;
}
- if((resource != sourceResource) && isRelative(sourceResource, resource)) {
+ if ((resource != sourceResource) && isRelative(sourceResource, resource)) {
copy(resource, targetFolder, sourceResource, targetName);
}
monitor.worked(1);
}
// copy the XWT files (they haven't been loaded in the resource set)
- for(Context context : contexts) {
- for(Tab tab : context.getTabs()) {
- for(Section section : tab.getSections()) {
- if(monitor.isCanceled()) {
+ for (Context context : contexts) {
+ for (Tab tab : context.getTabs()) {
+ for (Section section : tab.getSections()) {
+ if (monitor.isCanceled()) {
return Status.CANCEL_STATUS;
}
copy(section.getSectionFile(), targetFolder, sourceResource);
@@ -270,14 +270,14 @@ public class CDOContextCopyAction extends AbstractCDOContextAction implements IC }
protected void copy(String xwtFileName, CDOResourceFolder targetFolder, Resource sourceResource) throws IOException {
- CDOTextResource target = ((CDOTransaction)targetFolder.cdoView()).createTextResource(new Path(targetFolder.getPath()).append(xwtFileName).toString());
+ CDOTextResource target = ((CDOTransaction) targetFolder.cdoView()).createTextResource(new Path(targetFolder.getPath()).append(xwtFileName).toString());
URI sourceURI = URI.createURI(xwtFileName).resolve(sourceResource.getURI());
copy(sourceResource.getResourceSet(), sourceURI, target);
}
protected void copy(ResourceSet sourceResourceSet, URI sourceURI, CDOTextResource target) throws IOException {
PropertiesURIHandler uriHandler = new PropertiesURIHandler();
- if(uriHandler.canHandle(sourceURI)) {
+ if (uriHandler.canHandle(sourceURI)) {
sourceURI = uriHandler.getConvertedURI(sourceURI);
}
@@ -285,13 +285,13 @@ public class CDOContextCopyAction extends AbstractCDOContextAction implements IC try {
input = sourceResourceSet.getURIConverter().createInputStream(sourceURI);
- String encoding = (input instanceof URIConverter.Readable) ? ((URIConverter.Readable)input).getEncoding() : "UTF-8"; //$NON-NLS-1$
+ String encoding = (input instanceof URIConverter.Readable) ? ((URIConverter.Readable) input).getEncoding() : "UTF-8"; //$NON-NLS-1$
Reader contents = new InputStreamReader(input, encoding);
target.setContents(new CDOClob(contents));
} catch (IOException ex) {
Activator.log.error(ex);
} finally {
- if(input != null) {
+ if (input != null) {
Closeables.closeQuietly(input);
}
}
@@ -299,14 +299,14 @@ public class CDOContextCopyAction extends AbstractCDOContextAction implements IC private void copy(Resource resource, CDOResourceFolder folder, Resource base, String targetName) throws IOException {
URI relativeURI = resource.getURI().deresolve(base.getURI());
- if(relativeURI.toString().equals("")) { //$NON-NLS-1$
+ if (relativeURI.toString().equals("")) { //$NON-NLS-1$
relativeURI = URI.createURI(targetName + ".ctx"); //$NON-NLS-1$
}
// append a dummy segment to ensure correct resolution (otherwise we will
// miss the last segment of the folder path)
URI uri = relativeURI.resolve(folder.getURI().appendSegment("dummy.ctx")); //$NON-NLS-1$
- CDOTextResource target = ((CDOTransaction)folder.cdoView()).createTextResource(CDOURIUtil.extractResourcePath(uri));
+ CDOTextResource target = ((CDOTransaction) folder.cdoView()).createTextResource(CDOURIUtil.extractResourcePath(uri));
copy(resource.getResourceSet(), resource.getURI(), target);
}
}
diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.customization.properties/src/org/eclipse/papyrus/cdo/internal/ui/customization/properties/storage/action/CDOContextDeleteAction.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.customization.properties/src/org/eclipse/papyrus/cdo/internal/ui/customization/properties/storage/action/CDOContextDeleteAction.java index 263e0e0909e..d1f5383ced0 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.customization.properties/src/org/eclipse/papyrus/cdo/internal/ui/customization/properties/storage/action/CDOContextDeleteAction.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.customization.properties/src/org/eclipse/papyrus/cdo/internal/ui/customization/properties/storage/action/CDOContextDeleteAction.java @@ -1,6 +1,6 @@ /*****************************************************************************
* 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
@@ -28,10 +28,12 @@ import org.eclipse.papyrus.views.properties.contexts.Context; */
public class CDOContextDeleteAction extends AbstractCDOContextAction implements IContextDeleteAction {
+ @Override
public String getToolTip() {
return Messages.CDOContextDeleteAction_0;
}
+ @Override
public void delete(Context context, IProgressMonitor monitor) throws CoreException {
SubMonitor sub = SubMonitor.convert(monitor, NLS.bind(Messages.CDOContextDeleteAction_1, context.getName()), IProgressMonitor.UNKNOWN);
diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.customization.properties/src/org/eclipse/papyrus/cdo/internal/ui/customization/properties/storage/action/CDOContextEditAction.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.customization.properties/src/org/eclipse/papyrus/cdo/internal/ui/customization/properties/storage/action/CDOContextEditAction.java index 3faf98dc189..08410f8b7c6 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.customization.properties/src/org/eclipse/papyrus/cdo/internal/ui/customization/properties/storage/action/CDOContextEditAction.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.customization.properties/src/org/eclipse/papyrus/cdo/internal/ui/customization/properties/storage/action/CDOContextEditAction.java @@ -1,6 +1,6 @@ /*****************************************************************************
* 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
@@ -40,21 +40,23 @@ import org.eclipse.ui.statushandlers.StatusManager; */
public class CDOContextEditAction extends AbstractCDOContextAction implements IContextEditAction {
+ @Override
public String getToolTip() {
return Messages.CDOContextEditAction_0;
}
+ @Override
public void openEditor(Context context, IProgressMonitor monitor) throws CoreException {
SubMonitor sub = SubMonitor.convert(monitor, NLS.bind(Messages.CDOContextEditAction_1, context.getName()), IProgressMonitor.UNKNOWN);
CDOTransaction transaction = createTransaction(context);
try {
IEditorPart editor = openEditor(getDoppelganger(context, transaction));
- if(editor != null) { // will be null if an editor was already open
+ if (editor != null) { // will be null if an editor was already open
hookCloseListener(editor, transaction);
hookSaveListener(editor, transaction);
} else {
- // we didn't open the editor? Then we don't need the transaction
+ // we didn't open the editor? Then we don't need the transaction
transaction.close();
}
} finally {
@@ -69,7 +71,7 @@ public class CDOContextEditAction extends AbstractCDOContextAction implements IC IEditorInput input = new CDOResourceEditorInput(context.eResource(), context.getName());
IEditorPart existing = page.findEditor(input);
- if(existing == null) { // don't return the editor if already open
+ if (existing == null) { // don't return the editor if already open
result = page.openEditor(input, "org.eclipse.papyrus.customization.properties.UIEditor", true); //$NON-NLS-1$;
}
@@ -81,8 +83,9 @@ public class CDOContextEditAction extends AbstractCDOContextAction implements IC page.addPartListener(new IPartListener() {
+ @Override
public void partClosed(IWorkbenchPart part) {
- if(part == editor) {
+ if (part == editor) {
try {
view.close();
} finally {
@@ -91,18 +94,22 @@ public class CDOContextEditAction extends AbstractCDOContextAction implements IC }
}
+ @Override
public void partOpened(IWorkbenchPart part) {
// pass
}
+ @Override
public void partDeactivated(IWorkbenchPart part) {
// pass
}
+ @Override
public void partBroughtToTop(IWorkbenchPart part) {
// pass
}
+ @Override
public void partActivated(IWorkbenchPart part) {
// pass
}
@@ -112,11 +119,12 @@ public class CDOContextEditAction extends AbstractCDOContextAction implements IC private void hookSaveListener(final IEditorPart editor, final CDOTransaction transaction) {
editor.addPropertyListener(new IPropertyListener() {
+ @Override
public void propertyChanged(Object source, int property) {
- if(property == IEditorPart.PROP_DIRTY) {
- if(!editor.isDirty()) {
+ if (property == IEditorPart.PROP_DIRTY) {
+ if (!editor.isDirty()) {
// it's not enough for the editor to save, because that only updates
- // the CLOB content of the CDOTextResources that are changed. We
+ // the CLOB content of the CDOTextResources that are changed. We
// need to commit the changes to the repository
try {
transaction.commit();
diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.customization.properties/src/org/eclipse/papyrus/cdo/internal/ui/customization/properties/storage/action/CDOContextStorageActionProvider.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.customization.properties/src/org/eclipse/papyrus/cdo/internal/ui/customization/properties/storage/action/CDOContextStorageActionProvider.java index 4dd2e0e5449..af2e7ccf2f1 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.customization.properties/src/org/eclipse/papyrus/cdo/internal/ui/customization/properties/storage/action/CDOContextStorageActionProvider.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.customization.properties/src/org/eclipse/papyrus/cdo/internal/ui/customization/properties/storage/action/CDOContextStorageActionProvider.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -31,6 +31,7 @@ public class CDOContextStorageActionProvider extends AbstractContextStorageActio super(); } + @Override public boolean providesFor(Context context) { URI uri = EcoreUtil.getURI(context); return (uri != null) && CDOUtils.isCDOURI(uri) || CDOTextURIHandler.SCHEME.equals(uri.scheme()); diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.customization.properties/src/org/eclipse/papyrus/cdo/internal/ui/customization/properties/storage/action/CDOResourceEditorInput.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.customization.properties/src/org/eclipse/papyrus/cdo/internal/ui/customization/properties/storage/action/CDOResourceEditorInput.java index e239411f7df..46ab6f1129e 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.customization.properties/src/org/eclipse/papyrus/cdo/internal/ui/customization/properties/storage/action/CDOResourceEditorInput.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.customization.properties/src/org/eclipse/papyrus/cdo/internal/ui/customization/properties/storage/action/CDOResourceEditorInput.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -33,9 +33,9 @@ public class CDOResourceEditorInput extends ResourceEditorInput { public String getToolTipText() { String result; - if(getResource() instanceof CDOResourceNode) { + if (getResource() instanceof CDOResourceNode) { // a more user-friendly representation than the URI - result = ((CDOResourceNode)getResource()).getPath(); + result = ((CDOResourceNode) getResource()).getPath(); } else { result = super.getToolTipText(); } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.hyperlink/src/org/eclipse/papyrus/cdo/internal/ui/hyperlink/Activator.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.hyperlink/src/org/eclipse/papyrus/cdo/internal/ui/hyperlink/Activator.java index ba8ad03c7a2..a193b7e39b8 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.hyperlink/src/org/eclipse/papyrus/cdo/internal/ui/hyperlink/Activator.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.hyperlink/src/org/eclipse/papyrus/cdo/internal/ui/hyperlink/Activator.java @@ -1,6 +1,6 @@ /***************************************************************************** * Copyright (c) 2013 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 @@ -56,7 +56,7 @@ public class Activator extends AbstractUIPlugin { /** * Returns the shared instance - * + * * @return the shared instance */ public static Activator getDefault() { diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.hyperlink/src/org/eclipse/papyrus/cdo/internal/ui/hyperlink/CDOHyperlinkConstants.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.hyperlink/src/org/eclipse/papyrus/cdo/internal/ui/hyperlink/CDOHyperlinkConstants.java index 1d1df6b937e..0fdd8c6c85e 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.hyperlink/src/org/eclipse/papyrus/cdo/internal/ui/hyperlink/CDOHyperlinkConstants.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.hyperlink/src/org/eclipse/papyrus/cdo/internal/ui/hyperlink/CDOHyperlinkConstants.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.hyperlink/src/org/eclipse/papyrus/cdo/internal/ui/hyperlink/CDOResourceHyperlink.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.hyperlink/src/org/eclipse/papyrus/cdo/internal/ui/hyperlink/CDOResourceHyperlink.java index 6bebe5aff00..f8755edf4e3 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.hyperlink/src/org/eclipse/papyrus/cdo/internal/ui/hyperlink/CDOResourceHyperlink.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.hyperlink/src/org/eclipse/papyrus/cdo/internal/ui/hyperlink/CDOResourceHyperlink.java @@ -1,7 +1,7 @@ /***************************************************************************** * Copyright (c) 2009, 2014 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 @@ -50,18 +50,18 @@ public class CDOResourceHyperlink extends HyperLinkObject { /** * Gets the hyperlinked resource URI. - * + * * @return the hyperlinked resource URI */ public URI getHyperlink() { - return (URI)super.getObject(); + return (URI) super.getObject(); } /** * Sets the hyperlinked resource URI. - * + * * @param uri - * the new hyperlinked resource URI + * the new hyperlinked resource URI */ public void setHyperlink(URI uri) { super.setObject(uri); @@ -74,21 +74,21 @@ public class CDOResourceHyperlink extends HyperLinkObject { URI uri = getHyperlink(); IInternalPapyrusRepository repo = PapyrusRepositoryManager.INSTANCE.getRepositoryForURI(uri, false); - if(repo == null) { + if (repo == null) { MessageDialog.openError(UIUtil.getActiveWorkbenchWindow().getShell(), Messages.CDOResourceHyperlink_openError, Messages.CDOResourceHyperlink_notConnected); - } else if(!repo.isConnected()) { + } else if (!repo.isConnected()) { repo.connect(); - if(!repo.isConnected()) { + if (!repo.isConnected()) { MessageDialog.openError(UIUtil.getActiveWorkbenchWindow().getShell(), Messages.CDOResourceHyperlink_openError, Messages.CDOResourceHyperlink_notConnected); } } // we may have connected a previously disconnected repo, above - if((repo != null) && repo.isConnected()) { + if ((repo != null) && repo.isConnected()) { CDOView master = repo.getMasterView(); String path = CDOURIUtil.extractResourcePath(uri); - if(!master.hasResource(path)) { + if (!master.hasResource(path)) { MessageDialog.openError(UIUtil.getActiveWorkbenchWindow().getShell(), Messages.CDOResourceHyperlink_openError, NLS.bind(Messages.CDOResourceHyperlink_noSuchResource, path)); } else { CDOResourceNode node = master.getResourceNode(path); @@ -115,15 +115,15 @@ public class CDOResourceHyperlink extends HyperLinkObject { @Override public Void caseCDOResource(CDOResource object) { try { - if(object.isRoot()) { + if (object.isRoot()) { // the root resource is a proxy for the repository IInternalPapyrusRepository repo = PapyrusRepositoryManager.INSTANCE.getRepositoryForURI(object.getURI()); - ModelRepositoriesView reposView = (ModelRepositoriesView)page.showView(ModelRepositoriesView.ID); + ModelRepositoriesView reposView = (ModelRepositoriesView) page.showView(ModelRepositoriesView.ID); reposView.selectReveal(new StructuredSelection(repo)); } else { CDOResource diResource = DIResourceQuery.getAffiliateResource(object); - if(diResource == null) { + if (diResource == null) { // open regular CDO model resource CDOEditorUtil.openEditor(page, object); } else { @@ -144,7 +144,7 @@ public class CDOResourceHyperlink extends HyperLinkObject { public void executeEditMousePressed(List<HyperLinkObject> list, EObject aModel) { CDOResourceHyperlinkEditorShell editor = new CDOResourceHyperlinkEditorShell(); editor.setHyperlink(this); - if(editor.open()) { + if (editor.open()) { int index = list.indexOf(this); list.set(index, editor.getHyperlink()); } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.hyperlink/src/org/eclipse/papyrus/cdo/internal/ui/hyperlink/CDOResourceHyperlinkEditorShell.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.hyperlink/src/org/eclipse/papyrus/cdo/internal/ui/hyperlink/CDOResourceHyperlinkEditorShell.java index 25e4b2b607a..f1288ba1799 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.hyperlink/src/org/eclipse/papyrus/cdo/internal/ui/hyperlink/CDOResourceHyperlinkEditorShell.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.hyperlink/src/org/eclipse/papyrus/cdo/internal/ui/hyperlink/CDOResourceHyperlinkEditorShell.java @@ -1,7 +1,7 @@ /***************************************************************************** * Copyright (c) 2009, 2013 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 @@ -63,8 +63,8 @@ public class CDOResourceHyperlinkEditorShell extends AbstractEditHyperlinkDocume // code use to wait for an action from the user getEditHyperlinkShell().pack(); getEditHyperlinkShell().open(); - while(!getEditHyperlinkShell().isDisposed()) { - if(!display.readAndDispatch()) { + while (!getEditHyperlinkShell().isDisposed()) { + if (!display.readAndDispatch()) { display.sleep(); } } @@ -83,7 +83,7 @@ public class CDOResourceHyperlinkEditorShell extends AbstractEditHyperlinkDocume // intialize "use default" check box getUseDefaultCheckBox().setSelection(usedefaultTooltip); getObjectLabeltext().setEditable(false); - if(usedefaultTooltip) { + if (usedefaultTooltip) { getTooltipInputText().setEditable(false); getTooltipInputText().setText(getObjectLabeltext().getText()); } @@ -93,7 +93,7 @@ public class CDOResourceHyperlinkEditorShell extends AbstractEditHyperlinkDocume @Override public void mouseUp(MouseEvent e) { usedefaultTooltip = getUseDefaultCheckBox().getSelection(); - if(usedefaultTooltip) { + if (usedefaultTooltip) { getTooltipInputText().setEditable(false); getTooltipInputText().setText(getObjectLabeltext().getText()); } else { @@ -110,20 +110,20 @@ public class CDOResourceHyperlinkEditorShell extends AbstractEditHyperlinkDocume browse.setBlockOnOpen(true); String initialURIString = getObjectLabeltext().getText().trim(); - if(!initialURIString.isEmpty()) { + if (!initialURIString.isEmpty()) { browse.setInitialURI(URI.createURI(initialURIString)); } // select resource nodes of file or model kind, not folders browse.setNodeTypeFilter(EresourcePackage.Literals.CDO_RESOURCE_LEAF); - if(browse.open() == Window.OK) { + if (browse.open() == Window.OK) { URI selected = browse.getSelectedURI(); - if(selected != null) { + if (selected != null) { getObjectLabeltext().setText(selected.toString()); } - if(usedefaultTooltip) { + if (usedefaultTooltip) { getTooltipInputText().setText(selected.toString()); } } @@ -144,7 +144,7 @@ public class CDOResourceHyperlinkEditorShell extends AbstractEditHyperlinkDocume @Override public void mouseDown(MouseEvent e) { - if(hyperlink == null) { + if (hyperlink == null) { hyperlink = new CDOResourceHyperlink(); } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.hyperlink/src/org/eclipse/papyrus/cdo/internal/ui/hyperlink/CDOResourceHyperlinkHelper.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.hyperlink/src/org/eclipse/papyrus/cdo/internal/ui/hyperlink/CDOResourceHyperlinkHelper.java index 8aedc8ddada..9a2372bbb21 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.hyperlink/src/org/eclipse/papyrus/cdo/internal/ui/hyperlink/CDOResourceHyperlinkHelper.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.hyperlink/src/org/eclipse/papyrus/cdo/internal/ui/hyperlink/CDOResourceHyperlinkHelper.java @@ -1,7 +1,7 @@ /***************************************************************************** * Copyright (c) 2011, 2013 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 @@ -10,7 +10,7 @@ * Contributors: * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation * Christian W. Damus (CEA LIST) - adapted for CDO repository resource hyperlinks - * + * *****************************************************************************/ package org.eclipse.papyrus.cdo.internal.ui.hyperlink; @@ -49,11 +49,11 @@ public class CDOResourceHyperlinkHelper extends AbstractHyperLinkHelper implemen public HyperLinkObject getHyperLinkObject(EAnnotation eAnnotation) { CDOResourceHyperlink result = null; - if(eAnnotation.getSource().equals(CDOHyperlinkConstants.HYPERLINK_ANNOTATION_SOURCE)) { + if (eAnnotation.getSource().equals(CDOHyperlinkConstants.HYPERLINK_ANNOTATION_SOURCE)) { result = new CDOResourceHyperlink(); result.setHyperlink(URI.createURI(eAnnotation.getDetails().get(CDOHyperlinkConstants.HYPERLINK_DETAIL_URI))); result.setTooltipText(eAnnotation.getDetails().get(HyperLinkConstants.HYPERLINK_TOOLTYPE_TEXT)); - if(eAnnotation.getDetails().get(HyperLinkConstants.HYPERLINK_IS_DEFAULT_NAVIGATION) != null) { + if (eAnnotation.getDetails().get(HyperLinkConstants.HYPERLINK_IS_DEFAULT_NAVIGATION) != null) { boolean isDefaultNaviagation = Boolean.parseBoolean(eAnnotation.getDetails().get(HyperLinkConstants.HYPERLINK_IS_DEFAULT_NAVIGATION)); result.setIsDefault(isDefaultNaviagation); } else { @@ -68,8 +68,8 @@ public class CDOResourceHyperlinkHelper extends AbstractHyperLinkHelper implemen public RecordingCommand getAddHyperLinkCommand(TransactionalEditingDomain domain, EModelElement object, HyperLinkObject hyperlinkObject) { RecordingCommand result = null; - if(hyperlinkObject instanceof CDOResourceHyperlink) { - CDOResourceHyperlink cdoHyperlink = (CDOResourceHyperlink)hyperlinkObject; + if (hyperlinkObject instanceof CDOResourceHyperlink) { + CDOResourceHyperlink cdoHyperlink = (CDOResourceHyperlink) hyperlinkObject; result = new CreateCDOResourceHyperlinkCommand(domain, object, cdoHyperlink.getTooltipText(), cdoHyperlink.getHyperlink(), cdoHyperlink.getIsDefault()); } @@ -84,7 +84,7 @@ public class CDOResourceHyperlinkHelper extends AbstractHyperLinkHelper implemen @Override public void executeNewMousePressed(List<HyperLinkObject> list, EObject aModel) { CDOResourceHyperlinkEditorShell editor = new CDOResourceHyperlinkEditorShell(); - if(editor.open()) { + if (editor.open()) { list.add(editor.getHyperlink()); } } @@ -99,14 +99,14 @@ public class CDOResourceHyperlinkHelper extends AbstractHyperLinkHelper implemen Command result = null; CDOResourceNode node = AdapterUtils.adapt(linkTarget, CDOResourceNode.class, null); - if(node instanceof CDOResourceLeaf) { + if (node instanceof CDOResourceLeaf) { URI uri = node.getURI(); String tip = uri.lastSegment(); - if(node instanceof CDOResource) { - DIModel di = DIModel.getInstance((CDOResource)node, false); - if(di != null) { - // it's a DI model. We don't use file extensions with their names + if (node instanceof CDOResource) { + DIModel di = DIModel.getInstance((CDOResource) node, false); + if (di != null) { + // it's a DI model. We don't use file extensions with their names tip = di.getName(); } } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.hyperlink/src/org/eclipse/papyrus/cdo/internal/ui/hyperlink/CDOResourceHyperlinkLabelProvider.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.hyperlink/src/org/eclipse/papyrus/cdo/internal/ui/hyperlink/CDOResourceHyperlinkLabelProvider.java index 17a7a47b464..8e3d8dea94a 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.hyperlink/src/org/eclipse/papyrus/cdo/internal/ui/hyperlink/CDOResourceHyperlinkLabelProvider.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.hyperlink/src/org/eclipse/papyrus/cdo/internal/ui/hyperlink/CDOResourceHyperlinkLabelProvider.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -29,7 +29,7 @@ public class CDOResourceHyperlinkLabelProvider extends HyperLinkFilteredLabelPro @Override public Image getImage(Object element) { - if(element instanceof CDOResourceHyperlink) { + if (element instanceof CDOResourceHyperlink) { return org.eclipse.papyrus.infra.widgets.Activator.getDefault().getImage(Activator.PLUGIN_ID, Activator.IMG_DOCUMENT); } @@ -38,8 +38,8 @@ public class CDOResourceHyperlinkLabelProvider extends HyperLinkFilteredLabelPro @Override public String getText(Object element) { - if(element instanceof CDOResourceHyperlink) { - CDOResourceHyperlink hyperlink = (CDOResourceHyperlink)element; + if (element instanceof CDOResourceHyperlink) { + CDOResourceHyperlink hyperlink = (CDOResourceHyperlink) element; String tip = hyperlink.getTooltipText(); String uri = String.valueOf(hyperlink.getHyperlink()); diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.hyperlink/src/org/eclipse/papyrus/cdo/internal/ui/hyperlink/CDOResourceURIDropStrategy.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.hyperlink/src/org/eclipse/papyrus/cdo/internal/ui/hyperlink/CDOResourceURIDropStrategy.java index 107487424d4..8f86bf5573f 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.hyperlink/src/org/eclipse/papyrus/cdo/internal/ui/hyperlink/CDOResourceURIDropStrategy.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.hyperlink/src/org/eclipse/papyrus/cdo/internal/ui/hyperlink/CDOResourceURIDropStrategy.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -70,31 +70,31 @@ public class CDOResourceURIDropStrategy extends TransactionalDropStrategy { @Override protected Command doGetCommand(Request request, EditPart targetEditPart) { - if(request instanceof DropObjectsRequest) { + if (request instanceof DropObjectsRequest) { View view = getTargetView(targetEditPart); - if(view == null) { + if (view == null) { return null; } final View mainView = SemanticElementHelper.findPrimaryView(view); - if(mainView instanceof Diagram) { + if (mainView instanceof Diagram) { // don't create hyperlinks on the diagram surface return null; } - final DropObjectsRequest dropRequest = (DropObjectsRequest)request; + final DropObjectsRequest dropRequest = (DropObjectsRequest) request; List<URI> hyperlinkURIs = null; - for(EObject next : Iterables.filter(dropRequest.getObjects(), EObject.class)) { - if(CDOResourceURITransferData.isCDOResourceURITransferData(next)) { - if(hyperlinkURIs == null) { + for (EObject next : Iterables.filter(dropRequest.getObjects(), EObject.class)) { + if (CDOResourceURITransferData.isCDOResourceURITransferData(next)) { + if (hyperlinkURIs == null) { hyperlinkURIs = Lists.newArrayListWithCapacity(dropRequest.getObjects().size()); } hyperlinkURIs.addAll(CDOResourceURITransferData.fromEObject(next).getURIs()); } } - if(hyperlinkURIs != null) { + if (hyperlinkURIs != null) { final TransactionalEditingDomain domain = getTransactionalEditingDomain(targetEditPart); final List<URI> _hyperlinkURIs = hyperlinkURIs; @@ -102,7 +102,7 @@ public class CDOResourceURIDropStrategy extends TransactionalDropStrategy { @Override public void execute() { - for(URI next : _hyperlinkURIs) { + for (URI next : _hyperlinkURIs) { new CreateCDOResourceHyperlinkCommand(domain, mainView, next.lastSegment(), next, false).execute(); } } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.hyperlink/src/org/eclipse/papyrus/cdo/internal/ui/hyperlink/CreateCDOResourceHyperlinkCommand.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.hyperlink/src/org/eclipse/papyrus/cdo/internal/ui/hyperlink/CreateCDOResourceHyperlinkCommand.java index 544da9ef6d8..77cf5417d6c 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.hyperlink/src/org/eclipse/papyrus/cdo/internal/ui/hyperlink/CreateCDOResourceHyperlinkCommand.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.hyperlink/src/org/eclipse/papyrus/cdo/internal/ui/hyperlink/CreateCDOResourceHyperlinkCommand.java @@ -1,7 +1,7 @@ /***************************************************************************** * Copyright (c) 2009, 2013 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 @@ -35,17 +35,17 @@ public class CreateCDOResourceHyperlinkCommand extends CreateEAnnotationCommand /** * Instantiates a new creates the hyper link command. - * + * * @param domain - * the editing domain in which to create the command + * the editing domain in which to create the command * @param object - * the object to which to attach the hyperlink + * the object to which to attach the hyperlink * @param tooltipText - * the hyperlink's user-friendly tooltip text + * the hyperlink's user-friendly tooltip text * @param resourceURI - * the URI of the resource that is the hyperlink target + * the URI of the resource that is the hyperlink target * @param isDefault - * to set this hyperlink as default + * to set this hyperlink as default */ public CreateCDOResourceHyperlinkCommand(TransactionalEditingDomain domain, EModelElement object, String tooltipText, URI resourceURI, boolean isDefault) { super(domain, object, CDOHyperlinkConstants.HYPERLINK_ANNOTATION_SOURCE); diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.hyperlink/src/org/eclipse/papyrus/cdo/internal/ui/hyperlink/Messages.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.hyperlink/src/org/eclipse/papyrus/cdo/internal/ui/hyperlink/Messages.java index 4f3352338a1..e11ce9b60eb 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.hyperlink/src/org/eclipse/papyrus/cdo/internal/ui/hyperlink/Messages.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.hyperlink/src/org/eclipse/papyrus/cdo/internal/ui/hyperlink/Messages.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -14,7 +14,7 @@ package org.eclipse.papyrus.cdo.internal.ui.hyperlink; import org.eclipse.osgi.util.NLS; /** - * This is the Messages type. Enjoy. + * This is the Messages type. Enjoy. */ public class Messages extends NLS { diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/Activator.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/Activator.java index a808651e446..6a2e4f76c87 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/Activator.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/Activator.java @@ -92,7 +92,7 @@ public class Activator extends AbstractUIPlugin { /** * Returns the shared instance - * + * * @return the shared instance */ public static Activator getDefault() { @@ -152,10 +152,10 @@ public class Activator extends AbstractUIPlugin { IDawnEditor result = null; IEditorPart editor = DawnEditorHelper.getActiveEditor(); - if(editor instanceof IDawnEditor) { - result = (IDawnEditor)editor; + if (editor instanceof IDawnEditor) { + result = (IDawnEditor) editor; } else { - result = (IDawnEditor)editor.getAdapter(IDawnEditor.class); + result = (IDawnEditor) editor.getAdapter(IDawnEditor.class); } return result; diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/SharedImages.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/SharedImages.java index ce15c14542e..4c0900f77b9 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/SharedImages.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/SharedImages.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -18,18 +18,18 @@ import org.eclipse.swt.widgets.Display; /** - * This is the SharedImages type. Enjoy. + * This is the SharedImages type. Enjoy. */ public class SharedImages { private static final ImageRegistry REGISTRY = new ImageRegistry(Display.getDefault()); - + private SharedImages() { super(); } public static Image getImage(String key) { Image result = REGISTRY.get(key); - + if (result == null) { ImageDescriptor desc = Activator.getIcon(key); if (desc != null) { @@ -37,7 +37,7 @@ public class SharedImages { result = REGISTRY.get(key); } } - + return result; } } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/actions/AbstractRepositoryAction.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/actions/AbstractRepositoryAction.java index a80189eaa07..d846a29404f 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/actions/AbstractRepositoryAction.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/actions/AbstractRepositoryAction.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -42,7 +42,7 @@ public abstract class AbstractRepositoryAction public AbstractRepositoryAction(String text, String sharedEnabledIcon, String sharedDisabledIcon, IWorkbenchPart part) { this(text, getSharedImage(part, sharedEnabledIcon), getSharedImage( - part, sharedDisabledIcon), part); + part, sharedDisabledIcon), part); } public AbstractRepositoryAction(String text, IWorkbenchPart part) { @@ -51,8 +51,8 @@ public abstract class AbstractRepositoryAction static ImageDescriptor getSharedImage(IWorkbenchPart part, String imageKey) { return ImageDescriptor.createFromImage(part.getSite() - .getWorkbenchWindow().getWorkbench().getSharedImages() - .getImage(imageKey)); + .getWorkbenchWindow().getWorkbench().getSharedImages() + .getImage(imageKey)); } @Override @@ -60,8 +60,8 @@ public abstract class AbstractRepositoryAction boolean result = super.updateSelection(selection); repository = Iterators.getNext( - Iterators.filter(selection.iterator(), IPapyrusRepository.class), - null); + Iterators.filter(selection.iterator(), IPapyrusRepository.class), + null); result = result && (repository != null) && isEnabledFor(repository); return result; diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/actions/AddRepositoryAction.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/actions/AddRepositoryAction.java index 7c73fe080fd..d0b7f3dbe81 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/actions/AddRepositoryAction.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/actions/AddRepositoryAction.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -35,7 +35,7 @@ public class AddRepositoryAction public AddRepositoryAction(IWorkbenchPart part) { super(Messages.AddRepositoryAction_0, Activator - .getIcon(Activator.ICON_ADD_REPOSITORY)); + .getIcon(Activator.ICON_ADD_REPOSITORY)); this.part = part; } @@ -43,7 +43,7 @@ public class AddRepositoryAction @Override public void run() { AddRepositoryDialog dlg = new AddRepositoryDialog(part.getSite() - .getShell()); + .getShell()); if (dlg.open() == Window.OK) { IPapyrusRepositoryManager mgr = PapyrusRepositoryManager.INSTANCE; String url = dlg.getURL(); @@ -61,19 +61,19 @@ public class AddRepositoryAction final IPapyrusRepository _repository = repository; try { part.getSite().getWorkbenchWindow() - .run(true, false, new IRunnableWithProgress() { + .run(true, false, new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) - throws InvocationTargetException, - InterruptedException { + @Override + public void run(IProgressMonitor monitor) + throws InvocationTargetException, + InterruptedException { - _repository.connect(); - } - }); + _repository.connect(); + } + }); } catch (Exception e) { - Activator.log.error( - "Unexpected exception in async repository connection.", //$NON-NLS-1$ - e); + Activator.log.error("Unexpected exception in async repository connection.", //$NON-NLS-1$ + e); } } } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/actions/AsyncAction.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/actions/AsyncAction.java index 5679f0a191b..3ca84e08d6e 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/actions/AsyncAction.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/actions/AsyncAction.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -63,10 +63,10 @@ public abstract class AsyncAction<T> extends BaseSelectionListenerAction { protected T coerce(Object selection) { T result = null; - if(type.isInstance(selection)) { + if (type.isInstance(selection)) { result = type.cast(selection); - } else if(selection instanceof IAdaptable) { - result = type.cast(((IAdaptable)selection).getAdapter(type)); + } else if (selection instanceof IAdaptable) { + result = type.cast(((IAdaptable) selection).getAdapter(type)); } return result; @@ -74,8 +74,8 @@ public abstract class AsyncAction<T> extends BaseSelectionListenerAction { @Override public void run() { - if(selection != null) { - if(gatherInput(selection)) { + if (selection != null) { + if (gatherInput(selection)) { new Job(getText()) { { @@ -107,7 +107,7 @@ public abstract class AsyncAction<T> extends BaseSelectionListenerAction { protected static IStatus wrap(Collection<? extends IStatus> statuses, String summary) { IStatus result; - if(statuses.size() == 1) { + if (statuses.size() == 1) { result = Iterables.getOnlyElement(statuses); } else { result = new MultiStatus(Activator.PLUGIN_ID, 0, Iterables.toArray(statuses, IStatus.class), summary, null); diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/actions/AsyncEditAction.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/actions/AsyncEditAction.java index fb707481b1a..23b47174769 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/actions/AsyncEditAction.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/actions/AsyncEditAction.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -32,10 +32,10 @@ public abstract class AsyncEditAction<T> extends AsyncTransactionAction<T> { protected boolean updateSelection(org.eclipse.jface.viewers.IStructuredSelection selection) { boolean result = super.updateSelection(selection); - if(result) { + if (result) { CDOObject cdoObject = getSelectedCDOObject(); - if((cdoObject == null) || CDOUtils.isReadOnly(cdoObject)) { + if ((cdoObject == null) || CDOUtils.isReadOnly(cdoObject)) { result = false; } } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/actions/AsyncTransactionAction.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/actions/AsyncTransactionAction.java index 130d5d03961..090557fb784 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/actions/AsyncTransactionAction.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/actions/AsyncTransactionAction.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -37,20 +37,20 @@ public abstract class AsyncTransactionAction<T> extends AsyncAction<T> { } protected CDOView getView(T selection) { - if(!(selection instanceof CDOObject)) { + if (!(selection instanceof CDOObject)) { throw new IllegalArgumentException("selection is not a CDOObject"); //$NON-NLS-1$ } - return ((CDOObject)selection).cdoView(); + return ((CDOObject) selection).cdoView(); } @Override protected void doRun(T selection, IProgressMonitor monitor) throws CoreException { CDOView view = getView(selection); - if(view instanceof CDOTransaction) { - doRun(selection, (CDOTransaction)view, monitor); + if (view instanceof CDOTransaction) { + doRun(selection, (CDOTransaction) view, monitor); } else { - final CDOID oid = (selection instanceof CDOObject) ? ((CDOObject)selection).cdoID() : null; + final CDOID oid = (selection instanceof CDOObject) ? ((CDOObject) selection).cdoID() : null; CDOTransaction transaction = view.getSession().openTransaction(); diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/actions/ChangePasswordAction.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/actions/ChangePasswordAction.java index c0f072b7d2a..3d9723ad5ff 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/actions/ChangePasswordAction.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/actions/ChangePasswordAction.java @@ -1,6 +1,6 @@ /***************************************************************************** * Copyright (c) 2013 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 @@ -30,16 +30,16 @@ public final class ChangePasswordAction extends AsyncAction<IInternalPapyrusRepo private static final String TOOL_TIP = Messages.ChangePasswordAction_1; public ChangePasswordAction(IWorkbenchPart part) { - super(IInternalPapyrusRepository.class, TITLE, (ImageDescriptor)null); + super(IInternalPapyrusRepository.class, TITLE, (ImageDescriptor) null); setToolTipText(TOOL_TIP); } @Override protected void doRun(IInternalPapyrusRepository selection, IProgressMonitor monitor) throws CoreException { - if(selection.isConnected()) { + if (selection.isConnected()) { CDOSession session = selection.getCDOSession(); - if((session != null) && !session.isClosed()) { + if ((session != null) && !session.isClosed()) { session.changeCredentials(); } } @@ -49,7 +49,7 @@ public final class ChangePasswordAction extends AsyncAction<IInternalPapyrusRepo protected boolean updateSelection(IStructuredSelection selection) { boolean result = super.updateSelection(selection); - if(result) { + if (result) { result = getSelection().isConnected(); } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/actions/ConnectRepositoryAction.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/actions/ConnectRepositoryAction.java index a33e102d8a6..35e69a1ae84 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/actions/ConnectRepositoryAction.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/actions/ConnectRepositoryAction.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -47,7 +47,7 @@ public class ConnectRepositoryAction extends AbstractRepositoryAction { public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { IStatus status = repository.connect(); - if(status.matches(IStatus.WARNING | IStatus.ERROR)) { + if (status.matches(IStatus.WARNING | IStatus.ERROR)) { StatusAdapter adapter = new StatusAdapter(status); adapter.setProperty(IStatusAdapterConstants.TIMESTAMP_PROPERTY, System.currentTimeMillis()); adapter.setProperty(IStatusAdapterConstants.TITLE_PROPERTY, Messages.ConnectRepositoryAction_errorTitle); diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/actions/CreateFolderAction.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/actions/CreateFolderAction.java index 89fab965161..a06f801c1e6 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/actions/CreateFolderAction.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/actions/CreateFolderAction.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -55,12 +55,12 @@ public class CreateFolderAction extends AsyncEditAction<CDOResourceNode> { protected CDOResourceNode coerce(Object selection) { CDOResourceNode result = super.coerce(selection); - if((result == null) && (selection instanceof IInternalPapyrusRepository)) { - IInternalPapyrusRepository repository = (IInternalPapyrusRepository)selection; + if ((result == null) && (selection instanceof IInternalPapyrusRepository)) { + IInternalPapyrusRepository repository = (IInternalPapyrusRepository) selection; - if(repository.isConnected()) { + if (repository.isConnected()) { CDOView view = repository.getMasterView(); - if(view != null) { + if (view != null) { result = view.getRootResource(); } } @@ -75,7 +75,7 @@ public class CreateFolderAction extends AsyncEditAction<CDOResourceNode> { InputDialog dialog = new InputDialog(shellProvider.getShell(), Messages.CreateFolderAction_1, Messages.CreateFolderAction_2, getDefaultFolderName(selection), createInputValidator(selection)); - if(dialog.open() == Window.OK) { + if (dialog.open() == Window.OK) { folderName = dialog.getValue().trim(); result = true; } @@ -86,10 +86,10 @@ public class CreateFolderAction extends AsyncEditAction<CDOResourceNode> { private Iterable<CDOResourceNode> getChildren(CDOResourceNode node) { Iterable<CDOResourceNode> result; - if(node instanceof CDOResourceFolder) { - result = ((CDOResourceFolder)node).getNodes(); - } else if((node instanceof CDOResource) && ((CDOResource)node).isRoot()) { - result = Iterables.filter(((CDOResource)node).getContents(), CDOResourceNode.class); + if (node instanceof CDOResourceFolder) { + result = ((CDOResourceFolder) node).getNodes(); + } else if ((node instanceof CDOResource) && ((CDOResource) node).isRoot()) { + result = Iterables.filter(((CDOResource) node).getContents(), CDOResourceNode.class); } else { result = Collections.emptyList(); } @@ -100,8 +100,8 @@ public class CreateFolderAction extends AsyncEditAction<CDOResourceNode> { boolean nameExists(Iterable<CDOResourceNode> existingNodes, String name) { boolean result = false; - for(CDOResourceNode next : existingNodes) { - if(name.equals(next.getName())) { + for (CDOResourceNode next : existingNodes) { + if (name.equals(next.getName())) { result = true; break; } @@ -114,10 +114,10 @@ public class CreateFolderAction extends AsyncEditAction<CDOResourceNode> { Iterable<CDOResourceNode> existing = getChildren(parent); String result = null; - for(int i = 1; result == null; i++) { + for (int i = 1; result == null; i++) { result = "folder" + i; //$NON-NLS-1$ - if(nameExists(existing, result)) { + if (nameExists(existing, result)) { result = null; } } @@ -134,11 +134,11 @@ public class CreateFolderAction extends AsyncEditAction<CDOResourceNode> { public String isValid(String newText) { String result; String name = (newText == null) ? "" //$NON-NLS-1$ - : newText.trim(); + : newText.trim(); - if(name.length() == 0) { + if (name.length() == 0) { result = Messages.CreateFolderAction_5; - } else if(nameExists(existing, name)) { + } else if (nameExists(existing, name)) { result = Messages.CreateFolderAction_6; } else { result = null; @@ -154,10 +154,10 @@ public class CreateFolderAction extends AsyncEditAction<CDOResourceNode> { CDOResourceFolder folder = EresourceFactory.eINSTANCE.createCDOResourceFolder(); folder.setName(folderName); - if(selection instanceof CDOResourceFolder) { - ((CDOResourceFolder)selection).getNodes().add(folder); - } else if(selection instanceof CDOResource) { - ((CDOResource)selection).getContents().add(folder); + if (selection instanceof CDOResourceFolder) { + ((CDOResourceFolder) selection).getNodes().add(folder); + } else if (selection instanceof CDOResource) { + ((CDOResource) selection).getContents().add(folder); } } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/actions/DeleteModelAction.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/actions/DeleteModelAction.java index 5324d24826f..4f08cf62b24 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/actions/DeleteModelAction.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/actions/DeleteModelAction.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -63,13 +63,13 @@ public class DeleteModelAction extends AsyncEditAction<DIModel> { protected boolean gatherInput(DIModel selection) { boolean result = false; - if(MessageDialog.openQuestion(part.getSite().getShell(), Messages.DeleteModelAction_1, NLS.bind(Messages.DeleteModelAction_2, selection.getName()))) { + if (MessageDialog.openQuestion(part.getSite().getShell(), Messages.DeleteModelAction_1, NLS.bind(Messages.DeleteModelAction_2, selection.getName()))) { IWorkbenchPage page = part.getSite().getPage(); URI uri = selection.getResource().getURI(); PapyrusCDOEditorInput input = new PapyrusCDOEditorInput(uri); IEditorPart openEditor = page.findEditor(input); - if(openEditor != null) { + if (openEditor != null) { page.closeEditor(openEditor, false); } @@ -83,13 +83,13 @@ public class DeleteModelAction extends AsyncEditAction<DIModel> { protected void doRun(DIModel selection, CDOTransaction transaction, IProgressMonitor monitor) throws CoreException { List<IStatus> failures = Lists.newArrayListWithExpectedSize(1); - for(Object next : selection.getChildren()) { - if(next instanceof CDOResource) { + for (Object next : selection.getChildren()) { + if (next instanceof CDOResource) { // get the resource local to this transaction - CDOID oid = ((CDOResource)next).cdoID(); - CDOResource toDelete = (CDOResource)transaction.getObject(oid); - if(toDelete != null) { + CDOID oid = ((CDOResource) next).cdoID(); + CDOResource toDelete = (CDOResource) transaction.getObject(oid); + if (toDelete != null) { try { toDelete.delete(null); } catch (Exception e) { @@ -99,7 +99,7 @@ public class DeleteModelAction extends AsyncEditAction<DIModel> { } } - if(!failures.isEmpty()) { + if (!failures.isEmpty()) { throw new CoreException(wrap(failures, "Errors occurred in deleting model.")); //$NON-NLS-1$ } } @@ -108,11 +108,11 @@ public class DeleteModelAction extends AsyncEditAction<DIModel> { protected boolean updateSelection(IStructuredSelection selection) { boolean result = super.updateSelection(selection); - if(result) { + if (result) { // must also be able to modify the containing folder/resource CDOObject toDelete = getSelectedCDOObject(); EObject container = toDelete.eContainer(); - if(container != null) { + if (container != null) { CDOObject cdoContainer = CDOUtils.getCDOObject(container); result = (cdoContainer == null) || cdoContainer.cdoPermission().isWritable(); } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/actions/DisconnectRepositoryAction.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/actions/DisconnectRepositoryAction.java index b50ec534307..85973bcf765 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/actions/DisconnectRepositoryAction.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/actions/DisconnectRepositoryAction.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -32,8 +32,8 @@ public class DisconnectRepositoryAction public DisconnectRepositoryAction(IWorkbenchPart part) { super(Messages.DisconnectRepositoryAction_0, Activator - .getIcon(Activator.ICON_DISCONNECT_REPOSITORY_ENABLED), Activator - .getIcon(Activator.ICON_DISCONNECT_REPOSITORY_DISABLED), part); + .getIcon(Activator.ICON_DISCONNECT_REPOSITORY_ENABLED), Activator + .getIcon(Activator.ICON_DISCONNECT_REPOSITORY_DISABLED), part); } @Override @@ -47,29 +47,29 @@ public class DisconnectRepositoryAction try { getPart().getSite().getWorkbenchWindow() - .run(true, false, new IRunnableWithProgress() { + .run(true, false, new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) - throws InvocationTargetException, - InterruptedException { + @Override + public void run(IProgressMonitor monitor) + throws InvocationTargetException, + InterruptedException { - try { - repository.disconnect(); - } catch (CommitException e) { - commitFailure[0] = e; + try { + repository.disconnect(); + } catch (CommitException e) { + commitFailure[0] = e; + } } - } - }); + }); } catch (Exception e) { - Activator.log.error( - "Unexpected exception in async repository connection.", e); //$NON-NLS-1$ + Activator.log.error("Unexpected exception in async repository connection.", e); //$NON-NLS-1$ } if (commitFailure[0] != null) { StatusAdapter adapter = new StatusAdapter( - commitFailure[0].getStatus()); + commitFailure[0].getStatus()); adapter.setProperty(IStatusAdapterConstants.TITLE_PROPERTY, - Messages.DisconnectRepositoryAction_2); + Messages.DisconnectRepositoryAction_2); StatusManager.getManager().handle(adapter, StatusManager.SHOW); } } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/actions/LinkWithEditorAction.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/actions/LinkWithEditorAction.java index e4b653fe8bf..880b6d99e34 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/actions/LinkWithEditorAction.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/actions/LinkWithEditorAction.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -32,17 +32,18 @@ public class LinkWithEditorAction this.part = part; part.addPropertyListener(new IPropertyListener() { + @Override public void propertyChanged(Object source, int propId) { switch (propId) { - case ModelRepositoriesView.LINK_WITH_EDITOR_PROPERTY : - updateToggleState(); - break; + case ModelRepositoriesView.LINK_WITH_EDITOR_PROPERTY: + updateToggleState(); + break; } } }); setImageDescriptor(Activator.getIcon(Activator.ICON_LINK_WITH_EDITOR)); - + setChecked(part.isLinkWithEditor()); } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/actions/OpenPapyrusModelAction.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/actions/OpenPapyrusModelAction.java index 99b1b6888b8..d8de26bcf8c 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/actions/OpenPapyrusModelAction.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/actions/OpenPapyrusModelAction.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -49,10 +49,10 @@ public class OpenPapyrusModelAction String name = uri.trimFileExtension().lastSegment(); PapyrusCDOEditorManager.INSTANCE.openEditor(part.getSite() - .getPage(), uri, name); + .getPage(), uri, name); } catch (PartInitException e) { StatusManager.getManager().handle(e.getStatus(), - StatusManager.SHOW); + StatusManager.SHOW); } } } @@ -65,7 +65,7 @@ public class OpenPapyrusModelAction result = (CDOResource) object; } else if (object instanceof IAdaptable) { result = (CDOResource) ((IAdaptable) object) - .getAdapter(CDOResource.class); + .getAdapter(CDOResource.class); } return result; diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/actions/RemoveRepositoryAction.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/actions/RemoveRepositoryAction.java index 6adc6211844..70e39ab497e 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/actions/RemoveRepositoryAction.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/actions/RemoveRepositoryAction.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -33,8 +33,8 @@ public class RemoveRepositoryAction public RemoveRepositoryAction(IWorkbenchPart part) { super(Messages.RemoveRepositoryAction_0, ISharedImages.IMG_TOOL_DELETE, - ISharedImages.IMG_TOOL_DELETE_DISABLED, part); - + ISharedImages.IMG_TOOL_DELETE_DISABLED, part); + setActionDefinitionId(IWorkbenchCommandConstants.EDIT_DELETE); } @@ -48,11 +48,11 @@ public class RemoveRepositoryAction boolean connected = repository.isConnected(); String message = connected - ? Messages.RemoveRepositoryAction_1 - : Messages.RemoveRepositoryAction_2; + ? Messages.RemoveRepositoryAction_1 + : Messages.RemoveRepositoryAction_2; if (MessageDialog.openQuestion(getPart().getSite().getShell(), - Messages.RemoveRepositoryAction_3, NLS.bind(message, repository.getName()))) { + Messages.RemoveRepositoryAction_3, NLS.bind(message, repository.getName()))) { IPapyrusRepositoryManager mgr = PapyrusRepositoryManager.INSTANCE; if (!connected) { @@ -70,9 +70,9 @@ public class RemoveRepositoryAction } catch (CommitException e) { StatusAdapter adapter = new StatusAdapter(e.getStatus()); adapter.setProperty(IStatusAdapterConstants.TITLE_PROPERTY, - Messages.RemoveRepositoryAction_4); + Messages.RemoveRepositoryAction_4); StatusManager.getManager().handle(adapter, - StatusManager.SHOW); + StatusManager.SHOW); } } } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/actions/RenameModelAction.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/actions/RenameModelAction.java index 08d7f095bf9..ac0380faca7 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/actions/RenameModelAction.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/actions/RenameModelAction.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -27,6 +27,7 @@ import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.dialogs.IInputValidator; import org.eclipse.jface.dialogs.InputDialog; import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.window.Window; import org.eclipse.osgi.util.NLS; import org.eclipse.papyrus.cdo.internal.ui.l10n.Messages; import org.eclipse.papyrus.cdo.internal.ui.views.DIModel; @@ -48,7 +49,7 @@ public class RenameModelAction extends AsyncEditAction<DIModel> { private String newName; public RenameModelAction(IWorkbenchPart part) { - super(DIModel.class, Messages.RenameModelAction_0, (ImageDescriptor)null); + super(DIModel.class, Messages.RenameModelAction_0, (ImageDescriptor) null); this.part = part; @@ -65,7 +66,7 @@ public class RenameModelAction extends AsyncEditAction<DIModel> { boolean result = false; InputDialog dialog = new InputDialog(part.getSite().getShell(), Messages.RenameModelAction_1, Messages.RenameModelAction_2, getModelName(selection.getName()), createInputValidator(selection)); - if(dialog.open() == Dialog.OK) { + if (dialog.open() == Window.OK) { newName = getModelName(dialog.getValue().trim()); result = true; @@ -78,7 +79,7 @@ public class RenameModelAction extends AsyncEditAction<DIModel> { String suffix = "." + DiModel.DI_FILE_EXTENSION.toLowerCase(); //$NON-NLS-1$ String result = filename; - if(filename.toLowerCase().endsWith(suffix)) { + if (filename.toLowerCase().endsWith(suffix)) { result = filename.substring(0, filename.length() - suffix.length()); } @@ -93,7 +94,7 @@ public class RenameModelAction extends AsyncEditAction<DIModel> { IPath path = new Path(filename); IPath result = new Path(newName); - if(path.getFileExtension() != null) { + if (path.getFileExtension() != null) { result = result.addFileExtension(path.getFileExtension()); } @@ -103,13 +104,13 @@ public class RenameModelAction extends AsyncEditAction<DIModel> { @Override protected void doRun(DIModel selection, CDOTransaction transaction, IProgressMonitor monitor) throws CoreException { List<IStatus> failures = Lists.newArrayListWithExpectedSize(1); - for(Object next : selection.getChildren()) { - if(next instanceof CDOResource) { + for (Object next : selection.getChildren()) { + if (next instanceof CDOResource) { // get the resource local to this transaction - CDOID oid = ((CDOResource)next).cdoID(); - CDOResource toRename = (CDOResource)transaction.getObject(oid); - if(toRename != null) { + CDOID oid = ((CDOResource) next).cdoID(); + CDOResource toRename = (CDOResource) transaction.getObject(oid); + if (toRename != null) { try { toRename.setName(getNewName(toRename.getName())); } catch (Exception e) { @@ -119,7 +120,7 @@ public class RenameModelAction extends AsyncEditAction<DIModel> { } } - if(!failures.isEmpty()) { + if (!failures.isEmpty()) { throw new CoreException(wrap(failures, "Errors occurred in renaming model.")); //$NON-NLS-1$ } } @@ -128,8 +129,8 @@ public class RenameModelAction extends AsyncEditAction<DIModel> { final CDOResource primaryResource = model.getResource(); CDOResourceNode parent = primaryResource.getFolder(); - if(parent == null) { - parent = (CDOResourceNode)primaryResource.eResource(); + if (parent == null) { + parent = (CDOResourceNode) primaryResource.eResource(); } final CDOResourceNode container = parent; @@ -140,17 +141,17 @@ public class RenameModelAction extends AsyncEditAction<DIModel> { String result = null; newText = Strings.nullToEmpty(newText).trim(); - if(newText.equals("")) { //$NON-NLS-1$ + if (newText.equals("")) { //$NON-NLS-1$ result = Messages.RenameModelAction_7; - } else if((newText.indexOf('/') >= 0) || (newText.indexOf('\\') >= 0)) { + } else if ((newText.indexOf('/') >= 0) || (newText.indexOf('\\') >= 0)) { result = Messages.RenameModelAction_8; - } else if(getModelName(newText).equals(getModelName(primaryResource.getName()))) { + } else if (getModelName(newText).equals(getModelName(primaryResource.getName()))) { // user didn't change the name result = ""; //$NON-NLS-1$ } else { String base = getBaseName(newText); - for(CDOResourceNode next : Iterables.filter(container.eContents(), CDOResourceNode.class)) { - if(base.equals(getBaseName(next.getName()))) { + for (CDOResourceNode next : Iterables.filter(container.eContents(), CDOResourceNode.class)) { + if (base.equals(getBaseName(next.getName()))) { result = NLS.bind(Messages.RenameModelAction_10, next.getName()); } } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/adapters/CDOAdapterFactory.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/adapters/CDOAdapterFactory.java index 02ba2529203..534e12bf4c8 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/adapters/CDOAdapterFactory.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/adapters/CDOAdapterFactory.java @@ -1,6 +1,6 @@ /***************************************************************************** * Copyright (c) 2013, 2014 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 @@ -9,7 +9,7 @@ * Contributors: * CEA LIST - Initial API and implementation * Christian W. Damus (CEA) - bug 386118 - * + * *****************************************************************************/ package org.eclipse.papyrus.cdo.internal.ui.adapters; @@ -36,21 +36,21 @@ public class CDOAdapterFactory implements IAdapterFactory { public Object getAdapter(Object adaptableObject, @SuppressWarnings("rawtypes") Class adapterType) { Object result = null; - if(adapterType == CDOObject.class) { + if (adapterType == CDOObject.class) { EObject eObject = null; - if(adaptableObject instanceof EditPart) { + if (adaptableObject instanceof EditPart) { // notation views are important as CDOObjects for locking and // conflict purposes, so do not defer to the semantic element - eObject = (EObject)((EditPart)adaptableObject).getModel(); - } else if(adaptableObject instanceof EObject) { - eObject = (EObject)adaptableObject; + eObject = (EObject) ((EditPart) adaptableObject).getModel(); + } else if (adaptableObject instanceof EObject) { + eObject = (EObject) adaptableObject; } else { // try really hard to get an EObject - if(adaptableObject instanceof IAdaptable) { - eObject = (EObject)((IAdaptable)adaptableObject).getAdapter(EObject.class); + if (adaptableObject instanceof IAdaptable) { + eObject = (EObject) ((IAdaptable) adaptableObject).getAdapter(EObject.class); } - if(eObject == null) { - eObject = (EObject)Platform.getAdapterManager().getAdapter(adaptableObject, EObject.class); + if (eObject == null) { + eObject = (EObject) Platform.getAdapterManager().getAdapter(adaptableObject, EObject.class); } } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/adapters/EditorAdapterFactory.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/adapters/EditorAdapterFactory.java index 6d353de823b..a51953acfa3 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/adapters/EditorAdapterFactory.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/adapters/EditorAdapterFactory.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -23,12 +23,13 @@ import org.eclipse.ui.IEditorPart; public class EditorAdapterFactory implements IAdapterFactory { - private final Class[] supported = {IDawnEditor.class}; + private final Class[] supported = { IDawnEditor.class }; public EditorAdapterFactory() { super(); } + @Override public Object getAdapter(Object adaptableObject, Class adapterType) { Object result = null; @@ -43,6 +44,7 @@ public class EditorAdapterFactory return result; } + @Override public Class[] getAdapterList() { return supported; } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/adapters/PapyrusRepositoryWorkbenchAdapter.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/adapters/PapyrusRepositoryWorkbenchAdapter.java index c6869ff0002..7ea6c0087b0 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/adapters/PapyrusRepositoryWorkbenchAdapter.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/adapters/PapyrusRepositoryWorkbenchAdapter.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -30,25 +30,28 @@ public class PapyrusRepositoryWorkbenchAdapter super(); } + @Override public Object[] getChildren(Object o) { return (o instanceof IContainer<?>) - ? ((IContainer<?>) o).getElements() - : NOTHING; + ? ((IContainer<?>) o).getElements() + : NOTHING; } + @Override public ImageDescriptor getImageDescriptor(Object object) { ImageDescriptor result = null; if (object instanceof IPapyrusRepository) { boolean open = ((IPapyrusRepository) object).isConnected(); result = Activator.getIcon(open - ? Activator.ICON_OPEN_REPOSITORY - : Activator.ICON_CLOSED_REPOSITORY); + ? Activator.ICON_OPEN_REPOSITORY + : Activator.ICON_CLOSED_REPOSITORY); } return result; } + @Override public String getLabel(Object o) { String result = null; @@ -59,6 +62,7 @@ public class PapyrusRepositoryWorkbenchAdapter return result; } + @Override public Object getParent(Object o) { return null; } @@ -66,13 +70,14 @@ public class PapyrusRepositoryWorkbenchAdapter // // Nested types // - + @SuppressWarnings("rawtypes") public static class Factory implements IAdapterFactory { - private final Class[] supported = {IWorkbenchAdapter.class}; + private final Class[] supported = { IWorkbenchAdapter.class }; + @Override public Object getAdapter(Object adaptableObject, Class adapterType) { Object result = null; @@ -83,6 +88,7 @@ public class PapyrusRepositoryWorkbenchAdapter return result; } + @Override public Class[] getAdapterList() { return supported; } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/admin/RepositoryAdminListener.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/admin/RepositoryAdminListener.java index b3df356a8ed..21d300d34cf 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/admin/RepositoryAdminListener.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/admin/RepositoryAdminListener.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -39,13 +39,13 @@ public class RepositoryAdminListener implements IPapyrusRepositoryAdminListener final String url = event.getRepositoryURL(); IPapyrusRepository existing = repositoryManager.getRepository(url); - if(existing == null) { + if (existing == null) { final String name = event.getRepositoryName(); UIUtil.getDisplay().asyncExec(new Runnable() { @Override public void run() { - if(MessageDialog.openQuestion(UIUtil.getActiveWorkbenchWindow().getShell(), Messages.RepositoryAdminListener_0, NLS.bind(Messages.RepositoryAdminListener_1, name))) { + if (MessageDialog.openQuestion(UIUtil.getActiveWorkbenchWindow().getShell(), Messages.RepositoryAdminListener_0, NLS.bind(Messages.RepositoryAdminListener_1, name))) { repositoryManager.createRepository(url).setName(uniqueName(name)); repositoryManager.saveRepositories(); } @@ -57,13 +57,13 @@ public class RepositoryAdminListener implements IPapyrusRepositoryAdminListener @Override public void repositoryRemoved(PapyrusRepositoryAdminEvent event) { final IPapyrusRepository existing = repositoryManager.getRepository(event.getRepositoryURL()); - if(existing != null) { + if (existing != null) { final String name = existing.getName(); UIUtil.getDisplay().asyncExec(new Runnable() { @Override public void run() { - if(MessageDialog.openQuestion(UIUtil.getActiveWorkbenchWindow().getShell(), Messages.RepositoryAdminListener_2, NLS.bind(Messages.RepositoryAdminListener_3, name))) { + if (MessageDialog.openQuestion(UIUtil.getActiveWorkbenchWindow().getShell(), Messages.RepositoryAdminListener_2, NLS.bind(Messages.RepositoryAdminListener_3, name))) { repositoryManager.removeRepository(existing); repositoryManager.saveRepositories(); } @@ -79,14 +79,14 @@ public class RepositoryAdminListener implements IPapyrusRepositoryAdminListener do { again = false; - for(IPapyrusRepository next : repositoryManager.getRepositories()) { - if(result.equals(next.getName())) { + for (IPapyrusRepository next : repositoryManager.getRepositories()) { + if (result.equals(next.getName())) { result = NLS.bind(Messages.RepositoryAdminListener_4, preferredName, counter++); again = true; break; } } - } while(again); + } while (again); return result; } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/decorators/CDOStateAdapter.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/decorators/CDOStateAdapter.java index 0715611b01e..47439b8508d 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/decorators/CDOStateAdapter.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/decorators/CDOStateAdapter.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -49,15 +49,15 @@ public class CDOStateAdapter public static CDOStateAdapter get(Notifier notifier) { return (CDOStateAdapter) EcoreUtil.getExistingAdapter(notifier, - DawnState.class); + DawnState.class); } public static DawnState getState(Notifier notifier) { CDOStateAdapter adapter = get(notifier); return (adapter == null) - ? DawnState.CLEAN - : adapter.getState(); + ? DawnState.CLEAN + : adapter.getState(); } public static void setState(Notifier notifier, DawnState state) { @@ -95,8 +95,8 @@ public class CDOStateAdapter public void setState(DawnState state) { this.state = (state == null) - ? DawnState.CLEAN - : state; + ? DawnState.CLEAN + : state; } @Override diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/decorators/CDOStateDiagramDecorator.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/decorators/CDOStateDiagramDecorator.java index a4db5789bf2..c562bf3eb75 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/decorators/CDOStateDiagramDecorator.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/decorators/CDOStateDiagramDecorator.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -43,23 +43,25 @@ public class CDOStateDiagramDecorator this.stylizer = stylizer; } + @Override public void activate() { // pass } + @Override public void refresh() { removeDecoration(); View view = (View) getDecoratorTarget().getAdapter(View.class); EObject element = ((view == null) || !view.isSetElement()) - ? null - : view.getElement(); + ? null + : view.getElement(); CDOObject cdo = (element == null) - ? null - : CDOUtils.getCDOObject(element); + ? null + : CDOUtils.getCDOObject(element); if (cdo != null) { EditPart editPart = (EditPart) getDecoratorTarget().getAdapter( - EditPart.class); + EditPart.class); // does the view, itself, have a conflict or lock state? DawnState state = CDOStateAdapter.getState(view); @@ -73,13 +75,13 @@ public class CDOStateDiagramDecorator if (image != null) { if (editPart instanceof ShapeEditPart) { int margin = MapModeUtil.getMapMode( - ((GraphicalEditPart) editPart).getFigure()).DPtoLP(-1); + ((GraphicalEditPart) editPart).getFigure()).DPtoLP(-1); setDecoration(getDecoratorTarget().addShapeDecoration( - image, Direction.SOUTH_EAST, margin, true)); + image, Direction.SOUTH_EAST, margin, true)); } else if (view instanceof Edge) { int percent = 50; setDecoration(getDecoratorTarget().addConnectionDecoration( - image, percent, true)); + image, percent, true)); } } } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/decorators/CDOStateLabelDecorator.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/decorators/CDOStateLabelDecorator.java index b53f4b094d9..00c611afbc5 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/decorators/CDOStateLabelDecorator.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/decorators/CDOStateLabelDecorator.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -47,7 +47,7 @@ public class CDOStateLabelDecorator private static Set<CDOStateLabelDecorator> instances = new CopyOnWriteArraySet<CDOStateLabelDecorator>(); private final ResourceManager manager = new LocalResourceManager( - JFaceResources.getResources()); + JFaceResources.getResources()); private final ListenerList listeners = new ListenerList(); @@ -59,12 +59,14 @@ public class CDOStateLabelDecorator instances.add(this); } + @Override public void dispose() { manager.dispose(); instances.remove(this); } + @Override public Image decorateImage(Image image, Object element) { EObject eObject = EMFHelper.getEObject(element); @@ -72,15 +74,15 @@ public class CDOStateLabelDecorator DawnState state = CDOStateAdapter.getState(eObject); if (state != DawnState.CLEAN) { DawnElementStylizer stylizer = DawnElementStylizerRegistry.instance - .getStylizer(eObject); + .getStylizer(eObject); if (stylizer != null) { ImageDescriptor decoration = ImageDescriptor - .createFromImage(stylizer.getImage(eObject, state)); + .createFromImage(stylizer.getImage(eObject, state)); if (decoration != null) { ImageDescriptor desc = new DecorationOverlayIcon(image, - decoration, IDecoration.BOTTOM_RIGHT); + decoration, IDecoration.BOTTOM_RIGHT); return (Image) manager.get(desc); } @@ -91,18 +93,22 @@ public class CDOStateLabelDecorator return image; } + @Override public String decorateText(String text, Object element) { return text; } + @Override public boolean isLabelProperty(Object element, String property) { return false; } + @Override public void addListener(ILabelProviderListener listener) { listeners.add(listener); } + @Override public void removeListener(ILabelProviderListener listener) { listeners.remove(listener); } @@ -116,15 +122,14 @@ public class CDOStateLabelDecorator if (listeners.length > 0) { LabelProviderChangedEvent event = new LabelProviderChangedEvent( - this); + this); for (int i = 0; i < listeners.length; i++) { try { ((ILabelProviderListener) listeners[i]) - .labelProviderChanged(event); + .labelProviderChanged(event); } catch (Exception e) { - Activator.log.error( - "Uncaught exception in label provider listener.", e); //$NON-NLS-1$ + Activator.log.error("Uncaught exception in label provider listener.", e); //$NON-NLS-1$ } } } @@ -164,7 +169,8 @@ public class CDOStateLabelDecorator break; } } - }; + } + ; return Status.OK_STATUS; } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/decorators/DiagramDecoratorProvider.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/decorators/DiagramDecoratorProvider.java index 63fc22e90f5..040ec74b816 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/decorators/DiagramDecoratorProvider.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/decorators/DiagramDecoratorProvider.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -32,26 +32,28 @@ public class DiagramDecoratorProvider super(); } + @Override public boolean provides(IOperation operation) { if (!(operation instanceof CreateDecoratorsOperation)) { return false; } IDecoratorTarget decoratorTarget = ((CreateDecoratorsOperation) operation) - .getDecoratorTarget(); + .getDecoratorTarget(); EditPart editPart = (EditPart) decoratorTarget - .getAdapter(EditPart.class); + .getAdapter(EditPart.class); return editPart instanceof IPapyrusEditPart; } + @Override public void createDecorators(IDecoratorTarget decoratorTarget) { EditPart editPart = (EditPart) decoratorTarget - .getAdapter(EditPart.class); + .getAdapter(EditPart.class); DawnElementStylizer stylizer = DawnElementStylizerRegistry.instance - .getStylizer(editPart); + .getStylizer(editPart); if (stylizer != null) { decoratorTarget.installDecorator("cdoState", new CDOStateDiagramDecorator( //$NON-NLS-1$ - decoratorTarget, stylizer)); + decoratorTarget, stylizer)); } } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/decorators/PapyrusConnectionEditPartStylizer.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/decorators/PapyrusConnectionEditPartStylizer.java index 7a6bb5a8610..044086e6faf 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/decorators/PapyrusConnectionEditPartStylizer.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/decorators/PapyrusConnectionEditPartStylizer.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/decorators/PapyrusEditPartStylizer.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/decorators/PapyrusEditPartStylizer.java index 3f4210289aa..12aaf98e7e6 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/decorators/PapyrusEditPartStylizer.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/decorators/PapyrusEditPartStylizer.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -36,21 +36,21 @@ abstract class PapyrusEditPartStylizer Image result; switch (state) { - case LOCKED_LOCALLY : - result = SharedImages + case LOCKED_LOCALLY: + result = SharedImages .getImage(Activator.ICON_SELF_LOCKED_OVERLAY24); - break; - case LOCKED_REMOTELY : - result = SharedImages + break; + case LOCKED_REMOTELY: + result = SharedImages .getImage(Activator.ICON_OTHER_LOCKED_OVERLAY24); - break; - case CONFLICT : - result = SharedImages + break; + case CONFLICT: + result = SharedImages .getImage(Activator.ICON_CONFLICTED_OVERLAY24); - break; - default : - result = super.getImage(element, state); - break; + break; + default: + result = super.getImage(element, state); + break; } return result; @@ -66,15 +66,15 @@ abstract class PapyrusEditPartStylizer DawnState state; switch (type) { - case DawnAppearancer.TYPE_LOCKED_GLOBALLY : - state = DawnState.LOCKED_REMOTELY; - break; - case DawnAppearancer.TYPE_LOCKED_LOCALLY : - state = DawnState.LOCKED_LOCALLY; - break; - default : - state = DawnState.LOCKED_REMOTELY; - break; + case DawnAppearancer.TYPE_LOCKED_GLOBALLY: + state = DawnState.LOCKED_REMOTELY; + break; + case DawnAppearancer.TYPE_LOCKED_LOCALLY: + state = DawnState.LOCKED_LOCALLY; + break; + default: + state = DawnState.LOCKED_REMOTELY; + break; } setState(editPart, state); @@ -93,6 +93,7 @@ abstract class PapyrusEditPartStylizer // post refresh of the edit-part later to let the decorator catch up DisplayUtils.getDisplay().asyncExec(new Runnable() { + @Override public void run() { editPart.refresh(); } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/decorators/PapyrusElementStylizer.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/decorators/PapyrusElementStylizer.java index 5d96bb95d40..817510af9d6 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/decorators/PapyrusElementStylizer.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/decorators/PapyrusElementStylizer.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -34,21 +34,21 @@ public class PapyrusElementStylizer Image result; switch (state) { - case LOCKED_LOCALLY : - result = SharedImages + case LOCKED_LOCALLY: + result = SharedImages .getImage(Activator.ICON_SELF_LOCKED_OVERLAY16); - break; - case LOCKED_REMOTELY : - result = SharedImages + break; + case LOCKED_REMOTELY: + result = SharedImages .getImage(Activator.ICON_OTHER_LOCKED_OVERLAY16); - break; - case CONFLICT : - result = SharedImages + break; + case CONFLICT: + result = SharedImages .getImage(Activator.ICON_CONFLICTED_OVERLAY16); - break; - default : - result = super.getImage(element, state); - break; + break; + default: + result = super.getImage(element, state); + break; } return result; @@ -77,15 +77,15 @@ public class PapyrusElementStylizer DawnState state; switch (type) { - case DawnAppearancer.TYPE_LOCKED_GLOBALLY : - state = DawnState.LOCKED_REMOTELY; - break; - case DawnAppearancer.TYPE_LOCKED_LOCALLY : - state = DawnState.LOCKED_LOCALLY; - break; - default : - state = DawnState.LOCKED_REMOTELY; - break; + case DawnAppearancer.TYPE_LOCKED_GLOBALLY: + state = DawnState.LOCKED_REMOTELY; + break; + case DawnAppearancer.TYPE_LOCKED_LOCALLY: + state = DawnState.LOCKED_LOCALLY; + break; + default: + state = DawnState.LOCKED_REMOTELY; + break; } setState(eObject, state); diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/decorators/PapyrusElementStylizerFactory.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/decorators/PapyrusElementStylizerFactory.java index c9f492221a8..be62c49fa93 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/decorators/PapyrusElementStylizerFactory.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/decorators/PapyrusElementStylizerFactory.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -30,6 +30,7 @@ public class PapyrusElementStylizerFactory super(); } + @Override public DawnElementStylizer getElementStylizer(Object object) { DawnElementStylizer result = null; diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/decorators/PapyrusNodeEditPartStylizer.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/decorators/PapyrusNodeEditPartStylizer.java index 6781827061a..3fa295c76c3 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/decorators/PapyrusNodeEditPartStylizer.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/decorators/PapyrusNodeEditPartStylizer.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/dialogs/AddRepositoryDialog.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/dialogs/AddRepositoryDialog.java index 48c98a5db9c..35d59ead756 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/dialogs/AddRepositoryDialog.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/dialogs/AddRepositoryDialog.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -29,7 +29,7 @@ public class AddRepositoryDialog extends TitleAreaDialog { private static final String TITLE = Messages.AddRepositoryDialog_0; - + private static final String MESSAGE = Messages.AddRepositoryDialog_1; private RepositoryPropertiesBlock block; @@ -37,7 +37,7 @@ public class AddRepositoryDialog public AddRepositoryDialog(Shell parentShell) { super(parentShell); setShellStyle(getShellStyle() | SWT.APPLICATION_MODAL | SWT.TITLE - | SWT.RESIZE); + | SWT.RESIZE); } @Override @@ -52,28 +52,28 @@ public class AddRepositoryDialog setMessage(MESSAGE); Composite result = (Composite) super.createDialogArea(parent); - + block = new RepositoryPropertiesBlock(); block.createControl(result); block - .addListener(new RepositoryPropertiesBlock.StatusChangedMessageProviderAdapter() { + .addListener(new RepositoryPropertiesBlock.StatusChangedMessageProviderAdapter() { - @Override - protected void handleMessageChange(String message, - int messageSeverity) { + @Override + protected void handleMessageChange(String message, + int messageSeverity) { - Button okButton = getButton(IDialogConstants.OK_ID); - okButton - .setEnabled(messageSeverity == IMessageProvider.NONE); + Button okButton = getButton(IDialogConstants.OK_ID); + okButton + .setEnabled(messageSeverity == IMessageProvider.NONE); - if (message == null) { - setMessage(MESSAGE); - } else { - setMessage(message, messageSeverity); + if (message == null) { + setMessage(MESSAGE); + } else { + setMessage(message, messageSeverity); + } } - } - }); + }); return result; } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/dialogs/BrowseRepositoryDialog.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/dialogs/BrowseRepositoryDialog.java index 93e039f5d79..2e9681c0f5a 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/dialogs/BrowseRepositoryDialog.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/dialogs/BrowseRepositoryDialog.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -93,7 +93,7 @@ public class BrowseRepositoryDialog extends TitleAreaDialog { /** * @param style - * one of {@link SWT#OPEN} or {@link SWT#SAVE} + * one of {@link SWT#OPEN} or {@link SWT#SAVE} */ public BrowseRepositoryDialog(Shell parentShell, String title, String message, CDOView view, int style) { this(parentShell, Messages.BrowseRepoDlg_windowTitle, title, message, view, style); @@ -101,7 +101,7 @@ public class BrowseRepositoryDialog extends TitleAreaDialog { /** * @param style - * one of {@link SWT#OPEN} or {@link SWT#SAVE} + * one of {@link SWT#OPEN} or {@link SWT#SAVE} */ public BrowseRepositoryDialog(Shell parentShell, String windowTitle, String title, String message, CDOView view, int style) { super(parentShell); @@ -138,9 +138,9 @@ public class BrowseRepositoryDialog extends TitleAreaDialog { } private void shellDisposed() { - if(viewerRefresh != null) { - for(IInternalPapyrusRepository next : PapyrusRepositoryManager.INSTANCE.getRepositories()) { - if(next.isConnected()) { + if (viewerRefresh != null) { + for (IInternalPapyrusRepository next : PapyrusRepositoryManager.INSTANCE.getRepositories()) { + if (next.isConnected()) { next.getMasterView().removeListener(viewerRefresh); } } @@ -179,12 +179,12 @@ public class BrowseRepositoryDialog extends TitleAreaDialog { private URI basicGetSelectedURI() { URI result = null; - if(selection != null) { + if (selection != null) { result = selection.getURI(); - if(name != null) { + if (name != null) { String resourceName = Strings.emptyToNull(name); - if(resourceName != null) { - if(!(selection instanceof CDOResourceFolder)) { + if (resourceName != null) { + if (!(selection instanceof CDOResourceFolder)) { // append the name to the parent folder result = result.trimSegments(1); } @@ -213,7 +213,7 @@ public class BrowseRepositoryDialog extends TitleAreaDialog { setTitle(title); setMessage(message); - Composite main = (Composite)super.createDialogArea(parent); + Composite main = (Composite) super.createDialogArea(parent); Composite result = new Composite(main, SWT.NONE); result.setLayout(new GridLayout(isSaveStyle() ? 3 : 1, false)); result.setLayoutData(new GridData(GridData.FILL_BOTH)); @@ -226,13 +226,13 @@ public class BrowseRepositoryDialog extends TitleAreaDialog { tree.setLabelProvider(new DecoratingLabelProvider(itemProvider, PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator())); tree.setSorter(itemProvider); tree.setInput(PapyrusRepositoryManager.INSTANCE); - for(IInternalPapyrusRepository next : PapyrusRepositoryManager.INSTANCE.getRepositories()) { - if(next.isConnected()) { + for (IInternalPapyrusRepository next : PapyrusRepositoryManager.INSTANCE.getRepositories()) { + if (next.isConnected()) { next.getMasterView().addListener(getViewerRefresh()); } } - if(isSaveStyle()) { + if (isSaveStyle()) { // don't need to create new folders when opening an existing resource Composite actionButtons = new Composite(result, SWT.NONE); actionButtons.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, false)); @@ -255,9 +255,9 @@ public class BrowseRepositoryDialog extends TitleAreaDialog { nameText.setLayoutData(gd); } - if(getInitialURI() != null) { + if (getInitialURI() != null) { initializeSelection(); - } else if(getRepository() != null) { + } else if (getRepository() != null) { selection = getRepository().getMasterView().getRootResource(); } @@ -265,9 +265,9 @@ public class BrowseRepositoryDialog extends TitleAreaDialog { @Override public void selectionChanged(SelectionChangedEvent event) { - IStructuredSelection sel = (IStructuredSelection)event.getSelection(); - if(sel.isEmpty()) { - if(getRepository() != null) { + IStructuredSelection sel = (IStructuredSelection) event.getSelection(); + if (sel.isEmpty()) { + if (getRepository() != null) { selection = getRepository().getMasterView().getRootResource(); } else { selection = null; @@ -280,7 +280,7 @@ public class BrowseRepositoryDialog extends TitleAreaDialog { } }); - if(nameText != null) { + if (nameText != null) { nameText.addModifyListener(new ModifyListener() { @Override @@ -301,8 +301,8 @@ public class BrowseRepositoryDialog extends TitleAreaDialog { public boolean filter(Object element) { boolean result = false; - if(element instanceof IPapyrusRepository) { - result = ((IPapyrusRepository)element).isConnected(); + if (element instanceof IPapyrusRepository) { + result = ((IPapyrusRepository) element).isConnected(); } return result; @@ -315,25 +315,25 @@ public class BrowseRepositoryDialog extends TitleAreaDialog { CDOView view = getRepository().getMasterView(); String path = CDOURIUtil.extractResourcePath(uri); - if(view.hasResource(path)) { + if (view.hasResource(path)) { selection = view.getResourceNode(path); tree.setSelection(new StructuredSelection(selection)); tree.expandToLevel(selection, 1); - if(nameText != null) { + if (nameText != null) { name = selection.getName(); nameText.setText(name); } - } else if(uri.segmentCount() > 0) { + } else if (uri.segmentCount() > 0) { // try the containing folder, then URI parent = uri.trimSegments(1); path = CDOURIUtil.extractResourcePath(parent); - if(view.hasResource(path)) { + if (view.hasResource(path)) { // if the root resource, it is represented by the repository selection = view.getResourceNode(path); Object treeSelection = selection.isRoot() ? getRepository() : selection; tree.setSelection(new StructuredSelection(treeSelection), true); tree.expandToLevel(treeSelection, 1); - if(nameText != null) { + if (nameText != null) { name = uri.lastSegment(); nameText.setText(name); } @@ -353,30 +353,30 @@ public class BrowseRepositoryDialog extends TitleAreaDialog { String info = null; boolean disable = false; - if(name != null) { - if(!URI.validSegment(name)) { + if (name != null) { + if (!URI.validSegment(name)) { error = Messages.BrowseRepoDlg_invalidURISeg; } } - if(error == null) { - if(selection == null) { + if (error == null) { + if (selection == null) { disable = true; } else { String path = CDOURIUtil.extractResourcePath(basicGetSelectedURI()); CDOView view = selection.cdoView(); - if(isOpenStyle() && !view.hasResource(path)) { + if (isOpenStyle() && !view.hasResource(path)) { error = Messages.BrowseRepoDlg_noSuchResource; - } else if(isOpenStyle()) { - // then the resource exists. Is it the kind we want? + } else if (isOpenStyle()) { + // then the resource exists. Is it the kind we want? CDOResourceNode node = view.getResourceNode(path); - if(!getNodeTypeFilter().isInstance(node)) { + if (!getNodeTypeFilter().isInstance(node)) { disable = true; info = NLS.bind(Messages.BrowseRepoDlg_wrongSelection, getNodeType(getNodeTypeFilter())); } - } else if(isSaveStyle() && view.hasResource(path)) { - if(isAllowOverwrite()) { + } else if (isSaveStyle() && view.hasResource(path)) { + if (isAllowOverwrite()) { warning = Messages.BrowseRepoDlg_existsWarning; } else { error = Messages.BrowseRepoDlg_existsError; @@ -386,11 +386,11 @@ public class BrowseRepositoryDialog extends TitleAreaDialog { } getButton(IDialogConstants.OK_ID).setEnabled(!disable && (error == null)); - if(error != null) { + if (error != null) { setMessage(error, IMessageProvider.ERROR); - } else if(warning != null) { + } else if (warning != null) { setMessage(warning, IMessageProvider.WARNING); - } else if(info != null) { + } else if (info != null) { setMessage(info, IMessageProvider.INFORMATION); } else { setMessage(message); @@ -400,8 +400,8 @@ public class BrowseRepositoryDialog extends TitleAreaDialog { private String getNodeType(EClass nodeClass) { String result = Messages.BrowseRepoDlg_anyNode; - if(nodeClass.getEPackage() == EresourcePackage.eINSTANCE) { - switch(nodeClass.getClassifierID()) { + if (nodeClass.getEPackage() == EresourcePackage.eINSTANCE) { + switch (nodeClass.getClassifierID()) { case EresourcePackage.CDO_RESOURCE: result = Messages.BrowseRepoDlg_modelKind; break; @@ -427,14 +427,14 @@ public class BrowseRepositoryDialog extends TitleAreaDialog { } private IListener getViewerRefresh() { - if(viewerRefresh == null) { + if (viewerRefresh == null) { viewerRefresh = new IListener() { @Override public void notifyEvent(IEvent event) { - if(event instanceof CDOViewInvalidationEvent) { - if((getContents() != null) && !getContents().isDisposed()) { - if(UIUtil.ensureUIThread(this, event)) { + if (event instanceof CDOViewInvalidationEvent) { + if ((getContents() != null) && !getContents().isDisposed()) { + if (UIUtil.ensureUIThread(this, event)) { tree.refresh(); } } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/dialogs/CreateCDOModelFragmentDialog.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/dialogs/CreateCDOModelFragmentDialog.java index 90dd0e8202c..19ad60f30c3 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/dialogs/CreateCDOModelFragmentDialog.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/dialogs/CreateCDOModelFragmentDialog.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -64,7 +64,7 @@ public class CreateCDOModelFragmentDialog extends Dialog { public CreateCDOModelFragmentDialog(Shell parentShell, Resource parentUnit, String defaultUnitName) { super(parentShell); - this.view = ((CDOResource)parentUnit).cdoView(); + this.view = ((CDOResource) parentUnit).cdoView(); this.uriConverter = parentUnit.getResourceSet().getURIConverter(); URI parentURI = parentUnit.getURI(); @@ -80,7 +80,7 @@ public class CreateCDOModelFragmentDialog extends Dialog { @Override protected Control createDialogArea(Composite parent) { - Composite result = (Composite)super.createDialogArea(parent); + Composite result = (Composite) super.createDialogArea(parent); result.setLayout(new GridLayout(2, false)); @@ -96,12 +96,13 @@ public class CreateCDOModelFragmentDialog extends Dialog { ld.widthHint = convertWidthInCharsToPixels(50); uriText.setLayoutData(ld); - if(selectedURI != null) { + if (selectedURI != null) { uriText.setText(selectedURI); } uriText.addModifyListener(new ModifyListener() { + @Override public void modifyText(ModifyEvent e) { validateURI(uriText.getText()); } @@ -118,7 +119,7 @@ public class CreateCDOModelFragmentDialog extends Dialog { super.createButtonsForButtonBar(parent); // now that the OK button exists, determine initial enablement - if(selectedURI == null) { + if (selectedURI == null) { getButton(IDialogConstants.OK_ID).setEnabled(false); } else { validateURI(selectedURI); @@ -149,24 +150,24 @@ public class CreateCDOModelFragmentDialog extends Dialog { dlg.setAllowOverwrite(false); String initialURI = uriText.getText().trim(); - if(!Strings.isNullOrEmpty(initialURI)) { + if (!Strings.isNullOrEmpty(initialURI)) { try { dlg.setInitialURI(URI.createURI(initialURI, true)); } catch (Exception e) { - // OK, it's not a valid input. That's fine. Use the last valid selection - if(selectedURI != null) { + // OK, it's not a valid input. That's fine. Use the last valid selection + if (selectedURI != null) { dlg.setInitialURI(URI.createURI(selectedURI, true)); } } } - if(dlg.open() == Window.OK) { + if (dlg.open() == Window.OK) { uriText.setText(dlg.getSelectedURI().toString()); } } private void setError(String error) { - if(error == null) { + if (error == null) { errorLabel.setText(""); //$NON-NLS-1$ } else { errorLabel.setText(error); @@ -177,24 +178,24 @@ public class CreateCDOModelFragmentDialog extends Dialog { private void validateURI(String uri) { uri = uri.trim(); - if(uri.length() == 0) { + if (uri.length() == 0) { getButton(IDialogConstants.OK_ID).setEnabled(false); } else { try { URI parsed = URI.createURI(uri, true); - if(parsed.hasFragment()) { + if (parsed.hasFragment()) { throw new IllegalArgumentException(Messages.CreateCDOFragDlg_hasFragmentError); - } else if(uriConverter.exists(parsed, null)) { + } else if (uriConverter.exists(parsed, null)) { throw new IllegalArgumentException(Messages.CreateCDOFragDlg_existsError); } else { // an empty folder name indicates a resource at the root; the root always exists String folder = CDOURIUtil.extractResourceFolderAndName(parsed)[0]; - if(!Strings.isNullOrEmpty(folder)) { - if(!view.hasResource(folder)) { + if (!Strings.isNullOrEmpty(folder)) { + if (!view.hasResource(folder)) { throw new IllegalArgumentException(NLS.bind(Messages.CreateCDOFragDlg_noSuchFolderError, folder)); } - if(!(view.getResourceNode(folder) instanceof CDOResourceFolder)) { + if (!(view.getResourceNode(folder) instanceof CDOResourceFolder)) { throw new IllegalArgumentException(NLS.bind(Messages.CreateCDOFragDlg_notFolderError, folder)); } } @@ -216,12 +217,14 @@ public class CreateCDOModelFragmentDialog extends Dialog { public static class Provider implements IControlModeFragmentDialogProvider { + @Override public Dialog createDialog(Shell shell, Resource parentUnit, String defaultUnitURI) { return (parentUnit instanceof CDOResource) ? new CreateCDOModelFragmentDialog(shell, parentUnit, defaultUnitURI) : DEFAULT.createDialog(shell, parentUnit, defaultUnitURI); } + @Override public URI getSelectedURI(Dialog dialog) { - return (dialog instanceof CreateCDOModelFragmentDialog) ? ((CreateCDOModelFragmentDialog)dialog).getSelectedURI() : DEFAULT.getSelectedURI(dialog); + return (dialog instanceof CreateCDOModelFragmentDialog) ? ((CreateCDOModelFragmentDialog) dialog).getSelectedURI() : DEFAULT.getSelectedURI(dialog); } } @@ -229,16 +232,18 @@ public class CreateCDOModelFragmentDialog extends Dialog { private static final Class<?>[] ADAPTERS = { IControlModeFragmentDialogProvider.class }; + @Override @SuppressWarnings("rawtypes") public Class[] getAdapterList() { return ADAPTERS; } + @Override public Object getAdapter(Object adaptableObject, @SuppressWarnings("rawtypes") Class adapterType) { Object result = null; - if(adapterType == IControlModeFragmentDialogProvider.class) { - if(adaptableObject instanceof CDOAwareModelSet) { + if (adapterType == IControlModeFragmentDialogProvider.class) { + if (adaptableObject instanceof CDOAwareModelSet) { result = new Provider(); } } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/dialogs/RepositoryCredentialsDialog.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/dialogs/RepositoryCredentialsDialog.java index 94106483ab1..28e2b3eb406 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/dialogs/RepositoryCredentialsDialog.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/dialogs/RepositoryCredentialsDialog.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -71,7 +71,7 @@ public class RepositoryCredentialsDialog extends TitleAreaDialog { setMessage(message); setTitleImage(SharedImages.getImage(Activator.ICON_PAPYRUS_CDO_WIZARD)); - Composite result = (Composite)super.createDialogArea(parent); + Composite result = (Composite) super.createDialogArea(parent); Composite main = new Composite(result, SWT.NONE); main.setLayout(new GridLayout(2, false)); @@ -89,11 +89,11 @@ public class RepositoryCredentialsDialog extends TitleAreaDialog { rememberCheckbox.setText(Messages.RepositoryCredentialsDialog_4); GridDataFactory.fillDefaults().span(2, 1).applyTo(rememberCheckbox); - if(repository.getUsername() != null) { + if (repository.getUsername() != null) { usernameText.setText(repository.getUsername()); } - if(repository.getPassword() != null) { + if (repository.getPassword() != null) { passwordText.setText(repository.getPassword()); } @@ -116,7 +116,7 @@ public class RepositoryCredentialsDialog extends TitleAreaDialog { String password = passwordText.getText().trim(); credentials = new PasswordCredentials(username, password.toCharArray()); - if(rememberCheckbox.getSelection()) { + if (rememberCheckbox.getSelection()) { repository.setUsername(username); repository.setPassword(password); PapyrusRepositoryManager.INSTANCE.saveRepositories(); diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/dialogs/RepositorySelectionDialog.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/dialogs/RepositorySelectionDialog.java index 7bb6439840d..d5d8da90737 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/dialogs/RepositorySelectionDialog.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/dialogs/RepositorySelectionDialog.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -50,7 +50,7 @@ public class RepositorySelectionDialog extends TitleAreaDialog { private RepositorySelectionBlock repoSelectionBlock; public RepositorySelectionDialog(Shell parentShell, IPapyrusRepositoryManager repoMan, // - IPapyrusRepository initialSelection, Supplier<? extends IRunnableContext> runnableContext) { + IPapyrusRepository initialSelection, Supplier<? extends IRunnableContext> runnableContext) { super(parentShell); @@ -72,7 +72,7 @@ public class RepositorySelectionDialog extends TitleAreaDialog { protected Control createDialogArea(Composite parent) { setTitle(TITLE); setMessage(Messages.RepositorySelectionDialog_1); - Composite result = (Composite)super.createDialogArea(parent); + Composite result = (Composite) super.createDialogArea(parent); Composite main = new Composite(result, SWT.NONE); main.setLayout(new GridLayout()); @@ -103,7 +103,7 @@ public class RepositorySelectionDialog extends TitleAreaDialog { public void setSelectedRepository(IPapyrusRepository repository) { Button ok = getButton(IDialogConstants.OK_ID); - if(ok != null) { + if (ok != null) { ok.setEnabled(repository != null); } } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/dnd/CDOResourceURITransferData.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/dnd/CDOResourceURITransferData.java index 57114c8a154..d9213a8ef47 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/dnd/CDOResourceURITransferData.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/dnd/CDOResourceURITransferData.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -37,9 +37,9 @@ public final class CDOResourceURITransferData { private static final String NS_URI = "http://www.eclipse.org/papyrus/1.0.0/cdo/private/dnd"; //$NON-NLS-1$ - private static final EClass ECLASS = (EClass)EPackage.Registry.INSTANCE.getEPackage(NS_URI).getEClassifier(CDOResourceURITransferData.class.getSimpleName()); + private static final EClass ECLASS = (EClass) EPackage.Registry.INSTANCE.getEPackage(NS_URI).getEClassifier(CDOResourceURITransferData.class.getSimpleName()); - private static final EAttribute URIS = (EAttribute)ECLASS.getEStructuralFeature("resourceURIs"); //$NON-NLS-1$ + private static final EAttribute URIS = (EAttribute) ECLASS.getEStructuralFeature("resourceURIs"); //$NON-NLS-1$ private final List<URI> uris; @@ -65,7 +65,7 @@ public final class CDOResourceURITransferData { ByteArrayDataOutput data = ByteStreams.newDataOutput(); data.writeInt(uris.size()); - for(URI next : uris) { + for (URI next : uris) { data.writeUTF(next.toString()); } @@ -77,7 +77,7 @@ public final class CDOResourceURITransferData { ByteArrayDataInput data = ByteStreams.newDataInput(serial); final int count = data.readInt(); - for(int i = 0; i < count; i++) { + for (int i = 0; i < count; i++) { uris.add(URI.createURI(data.readUTF())); } @@ -90,7 +90,7 @@ public final class CDOResourceURITransferData { public static CDOResourceURITransferData fromEObject(EObject object) { @SuppressWarnings("unchecked") - List<URI> uris = isCDOResourceURITransferData(object) ? (List<URI>)object.eGet(URIS) : Collections.<URI> emptyList(); + List<URI> uris = isCDOResourceURITransferData(object) ? (List<URI>) object.eGet(URIS) : Collections.<URI> emptyList(); return new CDOResourceURITransferData(uris); } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/dnd/ResourceDragAdapter.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/dnd/ResourceDragAdapter.java index 529b3b3bae0..4af381f2ab9 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/dnd/ResourceDragAdapter.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/dnd/ResourceDragAdapter.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -53,14 +53,14 @@ public class ResourceDragAdapter extends DragSourceAdapter { } protected IStructuredSelection getViewerSelection() { - return (IStructuredSelection)viewer.getSelection(); + return (IStructuredSelection) viewer.getSelection(); } @Override public void dragStart(DragSourceEvent event) { IStructuredSelection selection = getViewerSelection(); event.doit = acceptSelection(selection.toList()); - if(event.doit) { + if (event.doit) { lastDragTimestamp = System.currentTimeMillis(); LocalSelectionTransfer.getTransfer().setSelection(selection); LocalSelectionTransfer.getTransfer().setSelectionSetTime(lastDragTimestamp); @@ -69,7 +69,7 @@ public class ResourceDragAdapter extends DragSourceAdapter { @Override public void dragFinished(DragSourceEvent event) { - if(LocalSelectionTransfer.getTransfer().getSelectionSetTime() == lastDragTimestamp) { + if (LocalSelectionTransfer.getTransfer().getSelectionSetTime() == lastDragTimestamp) { // clear the selection LocalSelectionTransfer.getTransfer().setSelection(null); } @@ -81,12 +81,12 @@ public class ResourceDragAdapter extends DragSourceAdapter { @Override public void dragSetData(DragSourceEvent event) { - for(Transfer transfer : TRANSFERS) { - if(transfer.isSupportedType(event.dataType)) { - if(transfer instanceof LocalSelectionTransfer) { + for (Transfer transfer : TRANSFERS) { + if (transfer.isSupportedType(event.dataType)) { + if (transfer instanceof LocalSelectionTransfer) { // pass the selection along through the event event.data = getViewerSelection(); - } else if(transfer instanceof PluginTransfer) { + } else if (transfer instanceof PluginTransfer) { CDOResourceURITransferData data = getResourceURIs(getViewerSelection()); event.data = new PluginTransferData(ResourceDropActionDelegate.DROP_ACTION_ID, data.serialize()); } @@ -95,6 +95,6 @@ public class ResourceDragAdapter extends DragSourceAdapter { } protected CDOResourceURITransferData getResourceURIs(IStructuredSelection selection) { - return new CDOResourceURITransferData(Iterables.filter(Iterables.transform((List<?>)selection.toList(), CDOFunctions.adapt(CDOResourceNode.class)), Predicates.notNull())); + return new CDOResourceURITransferData(Iterables.filter(Iterables.transform((List<?>) selection.toList(), CDOFunctions.adapt(CDOResourceNode.class)), Predicates.notNull())); } } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/dnd/ResourceDropActionDelegate.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/dnd/ResourceDropActionDelegate.java index 7e476ce7252..03f2b1edcc8 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/dnd/ResourceDropActionDelegate.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/dnd/ResourceDropActionDelegate.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -28,19 +28,20 @@ public class ResourceDropActionDelegate implements IDropActionDelegate { super(); } + @Override public boolean run(Object source, Object target) { boolean result = false; byte[] serial = null; - if(source instanceof byte[]) { - serial = (byte[])source; + if (source instanceof byte[]) { + serial = (byte[]) source; } - if(serial != null) { + if (serial != null) { IContainer container = CDOUtils.adapt(target, IContainer.class); - if(container != null) { + if (container != null) { CDOResourceURITransferData data = CDOResourceURITransferData.deserialize(serial); - if(!data.getURIs().isEmpty()) { + if (!data.getURIs().isEmpty()) { result = true; ExportModelHandler.exportModels(container, data.getURIs()); } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/dnd/ResourceDropAdapter.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/dnd/ResourceDropAdapter.java index 6f30137c7ab..35ebdca549e 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/dnd/ResourceDropAdapter.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/dnd/ResourceDropAdapter.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -91,40 +91,40 @@ public class ResourceDropAdapter extends ViewerDropAdapter { public boolean performDrop(Object data) { boolean result = false; - if(data instanceof IResource[]) { - data = new StructuredSelection((IResource[])data); - } else if((data instanceof PluginTransferData) && "org.eclipse.ui.navigator.PluginDropAction".equals(((PluginTransferData)data).getExtensionId())) { //$NON-NLS-1$ - String viewerID = new String(((PluginTransferData)data).getData()); + if (data instanceof IResource[]) { + data = new StructuredSelection((IResource[]) data); + } else if ((data instanceof PluginTransferData) && "org.eclipse.ui.navigator.PluginDropAction".equals(((PluginTransferData) data).getExtensionId())) { //$NON-NLS-1$ + String viewerID = new String(((PluginTransferData) data).getData()); IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); IViewPart view = page.findView(viewerID); - if(view != null) { + if (view != null) { data = view.getSite().getSelectionProvider().getSelection(); } } CDOResourceNode dropTarget = adaptDropTarget(getCurrentTarget()); - if(dropTarget != null) { + if (dropTarget != null) { Iterable<?> toMove = Collections.emptyList(); // handle resources to move within the repositories view - if(data instanceof IStructuredSelection) { - IStructuredSelection selection = (IStructuredSelection)data; + if (data instanceof IStructuredSelection) { + IStructuredSelection selection = (IStructuredSelection) data; toMove = getResourceNodeAdaptables(selection); - } else if(data instanceof PluginTransferData) { - PluginTransferData ptData = (PluginTransferData)data; - if(ResourceDropActionDelegate.DROP_ACTION_ID.equals(ptData.getExtensionId())) { + } else if (data instanceof PluginTransferData) { + PluginTransferData ptData = (PluginTransferData) data; + if (ResourceDropActionDelegate.DROP_ACTION_ID.equals(ptData.getExtensionId())) { CDOResourceURITransferData uris = CDOResourceURITransferData.deserialize(ptData.getData()); toMove = getResourceNodeAdaptables(uris.getURIs()); } } - if(!Iterables.isEmpty(toMove)) { + if (!Iterables.isEmpty(toMove)) { result = moveResourceNodes(dropTarget, toMove); } else { // handle resources to import from the workspace - if(data instanceof IStructuredSelection) { - Iterable<IFile> diFiles = getDIFiles((IStructuredSelection)data); - if(!Iterables.isEmpty(diFiles)) { + if (data instanceof IStructuredSelection) { + Iterable<IFile> diFiles = getDIFiles((IStructuredSelection) data); + if (!Iterables.isEmpty(diFiles)) { result = importModels(dropTarget, diFiles); } } @@ -139,16 +139,16 @@ public class ResourceDropAdapter extends ViewerDropAdapter { // validate the move before we attempt to move anything Iterable<? extends CDOResourceNode> nodes = Iterables.transform(resourceNodes, CDOFunctions.adapt(CDOResourceNode.class)); - for(CDOResourceNode next : nodes) { + for (CDOResourceNode next : nodes) { result = true; - if(contains(dropTarget, next)) { + if (contains(dropTarget, next)) { result = false; break; } } - if(result) { + if (result) { new Job(Messages.ResourceDropAdapter_1) { { @@ -169,26 +169,26 @@ public class ResourceDropAdapter extends ViewerDropAdapter { boolean result = false; IWorkbenchWindow window = null; - for(IWorkbenchWindow next : PlatformUI.getWorkbench().getWorkbenchWindows()) { - if(next.getShell() == getViewer().getControl().getShell()) { + for (IWorkbenchWindow next : PlatformUI.getWorkbench().getWorkbenchWindows()) { + if (next.getShell() == getViewer().getControl().getShell()) { window = next; break; } } - if(window != null) { + if (window != null) { URI uri = dropTarget.getURI(); IPapyrusRepository repository = PapyrusRepositoryManager.INSTANCE.getRepositoryForURI(uri); - if(repository != null) { + if (repository != null) { List<IPapyrusFile> papyrusFiles = Lists.newArrayList(); - for(IFile next : diFiles) { + for (IFile next : diFiles) { IPapyrusFile papyrusFile = PapyrusModelHelper.getPapyrusModelFactory().createIPapyrusFile(next); - if(papyrusFile != null) { + if (papyrusFile != null) { papyrusFiles.add(papyrusFile); } } - if(!papyrusFiles.isEmpty()) { + if (!papyrusFiles.isEmpty()) { result = true; ImportModelsHandler.importModels(window, new StructuredSelection(papyrusFiles), repository); } @@ -204,9 +204,9 @@ public class ResourceDropAdapter extends ViewerDropAdapter { try { CDOResourceNode newParent = getCorrespondent(destination, transaction); - for(Object next : nodeAdaptables) { - if(next instanceof DIModel) { - for(CDOResourceNode component : getResourceNodes(Arrays.asList(((DIModel)next).getChildren()))) { + for (Object next : nodeAdaptables) { + if (next instanceof DIModel) { + for (CDOResourceNode component : getResourceNodes(Arrays.asList(((DIModel) next).getChildren()))) { moveTo(newParent, getCorrespondent(component, transaction)); } } else { @@ -231,11 +231,11 @@ public class ResourceDropAdapter extends ViewerDropAdapter { CDOResourceNode result; try { - if(node == null) { + if (node == null) { throw new CoreException(error(Messages.ResourceDropAdapter_2)); - } else if(node instanceof CDOResourceFolder) { + } else if (node instanceof CDOResourceFolder) { result = view.getResourceFolder(node.getPath()); - } else if(node instanceof CDOResource) { + } else if (node instanceof CDOResource) { result = view.getResource(node.getPath()); } else { throw new CoreException(error(NLS.bind(Messages.ResourceDropAdapter_4, node.getClass().getName()))); @@ -260,9 +260,9 @@ public class ResourceDropAdapter extends ViewerDropAdapter { protected void moveTo(CDOResourceNode newParent, CDOResourceNode node) throws CoreException { String newPath = (node == null) ? null : new Path(newParent.getPath()).append(node.getName()).toString(); - if(node == null) { + if (node == null) { throw new CoreException(error(Messages.ResourceDropAdapter_0)); - } else if(newParent.cdoView().hasResource(newPath)) { + } else if (newParent.cdoView().hasResource(newPath)) { throw new CoreException(error(NLS.bind(Messages.ResourceDropAdapter_6, newPath))); } else { // just set the path. The node moves itself @@ -275,20 +275,20 @@ public class ResourceDropAdapter extends ViewerDropAdapter { boolean result = false; LocalSelectionTransfer local = LocalSelectionTransfer.getTransfer(); - if(local.isSupportedType(transferType) && (local.getSelection() instanceof IStructuredSelection) && isValidResourceContainer(target)) { - IStructuredSelection selection = (IStructuredSelection)local.getSelection(); + if (local.isSupportedType(transferType) && (local.getSelection() instanceof IStructuredSelection) && isValidResourceContainer(target)) { + IStructuredSelection selection = (IStructuredSelection) local.getSelection(); CDOResourceNode dropTarget = adaptDropTarget(target); // handle drag of files from the Project Explorer. If there's any // DI file, that's good enough, because the import wizard handles // mapping to repository paths - if((dropTarget != null) && !Iterables.isEmpty(getDIFiles(selection))) { + if ((dropTarget != null) && !Iterables.isEmpty(getDIFiles(selection))) { result = true; } - } else if(PluginTransfer.getInstance().isSupportedType(transferType) && isValidResourceContainer(target)) { + } else if (PluginTransfer.getInstance().isSupportedType(transferType) && isValidResourceContainer(target)) { // assume that intra-repository drag of resource nodes will be OK result = true; - } else if(ResourceTransfer.getInstance().isSupportedType(transferType) && isValidResourceContainer(target)) { + } else if (ResourceTransfer.getInstance().isSupportedType(transferType) && isValidResourceContainer(target)) { // assume that dragging resources will be OK result = true; } @@ -303,10 +303,10 @@ public class ResourceDropAdapter extends ViewerDropAdapter { protected CDOResourceNode adaptDropTarget(Object dropTarget) { CDOResourceNode result = CDOFunctions.adapt(CDOResourceNode.class).apply(dropTarget); - if(result == null) { + if (result == null) { // must be a repository - CDOView view = ((IInternalPapyrusRepository)dropTarget).getMasterView(); - if(view != null) { + CDOView view = ((IInternalPapyrusRepository) dropTarget).getMasterView(); + if (view != null) { result = view.getRootResource(); } } @@ -317,12 +317,12 @@ public class ResourceDropAdapter extends ViewerDropAdapter { protected boolean contains(CDOResourceNode parent, CDOResourceNode child) { boolean result = false; - if(parent instanceof CDOResourceFolder) { - CDOResourceFolder folder = (CDOResourceFolder)parent; + if (parent instanceof CDOResourceFolder) { + CDOResourceFolder folder = (CDOResourceFolder) parent; result = folder.getNodes().contains(child); - } else if(parent instanceof CDOResource) { - CDOResource resource = (CDOResource)parent; - if(resource.isRoot()) { + } else if (parent instanceof CDOResource) { + CDOResource resource = (CDOResource) parent; + if (resource.isRoot()) { result = resource.getContents().contains(child); } } @@ -331,26 +331,26 @@ public class ResourceDropAdapter extends ViewerDropAdapter { } protected Iterable<?> getResourceNodeAdaptables(IStructuredSelection selection) { - return Iterables.filter((List<?>)selection.toList(), CDOPredicates.adaptsTo(CDOResourceNode.class)); + return Iterables.filter((List<?>) selection.toList(), CDOPredicates.adaptsTo(CDOResourceNode.class)); } protected Iterable<?> getResourceNodeAdaptables(Iterable<URI> uris) { List<Object> result = Lists.newArrayList(); - for(URI next : uris) { + for (URI next : uris) { IPapyrusRepository repo = PapyrusRepositoryManager.INSTANCE.getRepositoryForURI(next); - if(repo != null) { - CDOView view = ((IInternalPapyrusRepository)repo).getMasterView(); - if(view != null) { // the repository could be disconnected by now + if (repo != null) { + CDOView view = ((IInternalPapyrusRepository) repo).getMasterView(); + if (view != null) { // the repository could be disconnected by now String path = CDOURIUtil.extractResourcePath(next); try { CDOResourceNode node = view.getResourceNode(path); - if(node instanceof CDOResource) { - DIModel diModel = DIModel.getInstance((CDOResource)node, false); - if(diModel != null) { + if (node instanceof CDOResource) { + DIModel diModel = DIModel.getInstance((CDOResource) node, false); + if (diModel != null) { result.add(diModel); } - } else if(node instanceof CDOResourceNode) { + } else if (node instanceof CDOResourceNode) { result.add(node); } } catch (Exception e) { diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/dnd/ResourceDropAdapterAssistant.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/dnd/ResourceDropAdapterAssistant.java index 70165513888..713e40975af 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/dnd/ResourceDropAdapterAssistant.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/dnd/ResourceDropAdapterAssistant.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -62,9 +62,9 @@ public class ResourceDropAdapterAssistant extends CommonDropAdapterAssistant { IStatus result = INVALID_DROP; // we can drop a local-selection transfer consisting of DI models onto a workspace container (project or folder) - if(LocalSelectionTransfer.getTransfer().isSupportedType(transferType) && CDOPredicates.adaptsTo(IContainer.class).apply(target)) { + if (LocalSelectionTransfer.getTransfer().isSupportedType(transferType) && CDOPredicates.adaptsTo(IContainer.class).apply(target)) { IStructuredSelection sel = CDOUtils.tryCast(LocalSelectionTransfer.getTransfer().getSelection(), IStructuredSelection.class); - if((sel != null) && !sel.isEmpty() && Iterables.all((List<?>)sel.toList(), CDOPredicates.adaptsTo(DIModel.class))) { + if ((sel != null) && !sel.isEmpty() && Iterables.all((List<?>) sel.toList(), CDOPredicates.adaptsTo(DIModel.class))) { result = VALID_DROP; } } @@ -77,9 +77,9 @@ public class ResourceDropAdapterAssistant extends CommonDropAdapterAssistant { IStatus result = INVALID_DROP; IStructuredSelection sel = CDOUtils.tryCast(LocalSelectionTransfer.getTransfer().getSelection(), IStructuredSelection.class); - if((sel != null) && !sel.isEmpty()) { + if ((sel != null) && !sel.isEmpty()) { IContainer container = CDOUtils.adapt(aTarget, IContainer.class); - if(container != null) { + if (container != null) { Function<Object, URI> uriFunction = Functions.compose(new Function<DIModel, URI>() { @Override @@ -88,7 +88,7 @@ public class ResourceDropAdapterAssistant extends CommonDropAdapterAssistant { } }, CDOFunctions.adapt(DIModel.class)); - List<URI> uris = Lists.newArrayList(transform((List<?>)sel.toList(), uriFunction)); + List<URI> uris = Lists.newArrayList(transform((List<?>) sel.toList(), uriFunction)); ExportModelHandler.exportModels(container, uris); result = VALID_DROP; } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/editors/DawnEditorAdapter.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/editors/DawnEditorAdapter.java index 73640b1208b..11980e79aeb 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/editors/DawnEditorAdapter.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/editors/DawnEditorAdapter.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -70,6 +70,7 @@ public class DawnEditorAdapter ADAPTERS.remove(editor); } + @Override public CDOView getView() { return view; } @@ -78,6 +79,7 @@ public class DawnEditorAdapter this.view = view; } + @Override public String getContributorID() { if (contributorID == null) { contributorID = determineEditorID(diagramEditor); @@ -86,18 +88,19 @@ public class DawnEditorAdapter return contributorID; } + @Override public void setDirty() { IDocumentProvider documentProvider = diagramEditor - .getDocumentProvider(); + .getDocumentProvider(); if (documentProvider != null) { documentProvider.setCanSaveDocument(getEditorInput()); } } - public Object getAdapter(@SuppressWarnings("rawtypes") - Class adapter) { + @Override + public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) { if ((adapter == DiagramDocumentEditor.class) - || (adapter == DiagramEditor.class)) { + || (adapter == DiagramEditor.class)) { return diagramEditor; } @@ -109,15 +112,15 @@ public class DawnEditorAdapter // look for the generated ID constant for (Class<?> clazz = editor.getClass(); (clazz != null) - && (clazz != Object.class); clazz = clazz.getSuperclass()) { + && (clazz != Object.class); clazz = clazz.getSuperclass()) { try { Field idField = clazz.getField("ID"); //$NON-NLS-1$ int modifiers = idField.getModifiers(); if ((idField.getType() == String.class) - && Modifier.isStatic(modifiers) - && Modifier.isFinal(modifiers) - && Modifier.isPublic(modifiers)) { + && Modifier.isStatic(modifiers) + && Modifier.isFinal(modifiers) + && Modifier.isPublic(modifiers)) { result = (String) idField.get(null); } @@ -134,6 +137,7 @@ public class DawnEditorAdapter return result; } + @Override public void doSave(IProgressMonitor monitor) { CDOView view = getView(); @@ -143,8 +147,7 @@ public class DawnEditorAdapter try { ((CDOTransaction) view).commit(monitor); } catch (CommitException e) { - Activator.log.error( - "Failed to commit transaction to save editor.", e); //$NON-NLS-1$ + Activator.log.error("Failed to commit transaction to save editor.", e); //$NON-NLS-1$ } } else { diagramEditor.doSave(monitor); @@ -155,10 +158,12 @@ public class DawnEditorAdapter // Delegation methods // + @Override public boolean isDirty() { return diagramEditor.isDirty(); } + @Override public IDawnEditorSupport getDawnEditorSupport() { return editorSupport; } @@ -167,64 +172,79 @@ public class DawnEditorAdapter this.editorSupport = editorSupport; } + @Override public IEditorInput getEditorInput() { return diagramEditor.getEditorInput(); } + @Override public IEditorSite getEditorSite() { return diagramEditor.getEditorSite(); } + @Override public void init(IEditorSite site, IEditorInput input) throws PartInitException { diagramEditor.init(site, input); } + @Override public void addPropertyListener(IPropertyListener listener) { diagramEditor.addPropertyListener(listener); } + @Override public void createPartControl(Composite parent) { diagramEditor.createPartControl(parent); } + @Override public void dispose() { diagramEditor.dispose(); } + @Override public IWorkbenchPartSite getSite() { return diagramEditor.getSite(); } + @Override public String getTitle() { return diagramEditor.getTitle(); } + @Override public Image getTitleImage() { return diagramEditor.getTitleImage(); } + @Override public String getTitleToolTip() { return diagramEditor.getTitleToolTip(); } + @Override public void removePropertyListener(IPropertyListener listener) { diagramEditor.removePropertyListener(listener); } + @Override public void setFocus() { diagramEditor.setFocus(); } + @Override public void doSaveAs() { diagramEditor.doSaveAs(); } + @Override public boolean isSaveAsAllowed() { return diagramEditor.isSaveAsAllowed(); } + @Override public boolean isSaveOnCloseNeeded() { return diagramEditor.isSaveOnCloseNeeded(); } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/editors/DawnGraphicalEditorSupport.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/editors/DawnGraphicalEditorSupport.java index d848fd8083d..a89a17d562a 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/editors/DawnGraphicalEditorSupport.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/editors/DawnGraphicalEditorSupport.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -70,11 +70,11 @@ public class DawnGraphicalEditorSupport extends DefaultGraphicalEditorSupport { @Override public void initialize(GraphicalEditor editor) { - if(editor instanceof DiagramDocumentEditor) { - DiagramDocumentEditor diagramEditor = (DiagramDocumentEditor)editor; + if (editor instanceof DiagramDocumentEditor) { + DiagramDocumentEditor diagramEditor = (DiagramDocumentEditor) editor; CDOView view = getCDOView(); - if(view != null) { + if (view != null) { initialize(diagramEditor, view); } @@ -99,8 +99,8 @@ public class DawnGraphicalEditorSupport extends DefaultGraphicalEditorSupport { @Override public void run() { DiagramEditPart diagramEP = diagramEditor.getDiagramEditPart(); - if(diagramEP instanceof PapyrusDiagramEditPart) { - ((PapyrusDiagramEditPart)diagramEP).setConflictingEditPartFilter(createConflictingEditPartFilter()); + if (diagramEP instanceof PapyrusDiagramEditPart) { + ((PapyrusDiagramEditPart) diagramEP).setConflictingEditPartFilter(createConflictingEditPartFilter()); } } }); @@ -109,7 +109,7 @@ public class DawnGraphicalEditorSupport extends DefaultGraphicalEditorSupport { // find and process objects locked remotely final Map<Object, DawnState> remoteLocks = getRemoteLocks(diagramEditor); - if(!remoteLocks.isEmpty()) { + if (!remoteLocks.isEmpty()) { // post for later because the editor isn't yet connected to its // editor site in the workbench UIUtil.later(new Runnable() { @@ -118,8 +118,8 @@ public class DawnGraphicalEditorSupport extends DefaultGraphicalEditorSupport { public void run() { dawnSupport.handleRemoteLockChanges(remoteLocks); - for(Object next : remoteLocks.keySet()) { - final EObject element = CDOUtil.getEObject((CDOObject)next); + for (Object next : remoteLocks.keySet()) { + final EObject element = CDOUtil.getEObject((CDOObject) next); View view = DawnDiagramUpdater.findViewByContainer(element); CDOStateAdapter.setState(view, remoteLocks.get(next)); @@ -134,8 +134,8 @@ public class DawnGraphicalEditorSupport extends DefaultGraphicalEditorSupport { try { ModelSet modelSet = registry.getService(ModelSet.class); - if(modelSet instanceof CDOAwareModelSet) { - result = ((CDOAwareModelSet)modelSet).getCDOView(); + if (modelSet instanceof CDOAwareModelSet) { + result = ((CDOAwareModelSet) modelSet).getCDOView(); } } catch (ServiceException e) { Activator.log.error(e); @@ -149,12 +149,12 @@ public class DawnGraphicalEditorSupport extends DefaultGraphicalEditorSupport { Map<Object, DawnState> result = Maps.newHashMap(); Diagram diagram = diagramEditor.getDiagram(); - if(diagram != null) { + if (diagram != null) { Iterator<EObject> iter = EcoreUtil.getAllProperContents(Collections.singleton(diagram), false); - while(iter.hasNext()) { + while (iter.hasNext()) { CDOObject next = CDOUtils.getCDOObject(iter.next()); - if((next != null) && CDOUtils.isLocked(next, true)) { + if ((next != null) && CDOUtils.isLocked(next, true)) { result.put(next, DawnState.LOCKED_REMOTELY); } } @@ -169,7 +169,7 @@ public class DawnGraphicalEditorSupport extends DefaultGraphicalEditorSupport { @Override public boolean isConflicting(EditPart editPart) { Object model = editPart.getModel(); - return (model instanceof EObject) && DawnConflictHelper.isConflicted((EObject)model); + return (model instanceof EObject) && DawnConflictHelper.isConflicted((EObject) model); } }; } @@ -200,17 +200,17 @@ public class DawnGraphicalEditorSupport extends DefaultGraphicalEditorSupport { List<EObject> result = null; CDOResourceURITransferData uriData = null; - if(PluginTransfer.getInstance().isSupportedType(getCurrentEvent().currentDataType) && !localTransferHasObjectFromThisRepo()) { + if (PluginTransfer.getInstance().isSupportedType(getCurrentEvent().currentDataType) && !localTransferHasObjectFromThisRepo()) { Object data = getCurrentEvent().data; - if(data instanceof PluginTransferData) { - PluginTransferData ptData = (PluginTransferData)data; - if(ResourceDropActionDelegate.DROP_ACTION_ID.equals(ptData.getExtensionId())) { + if (data instanceof PluginTransferData) { + PluginTransferData ptData = (PluginTransferData) data; + if (ResourceDropActionDelegate.DROP_ACTION_ID.equals(ptData.getExtensionId())) { uriData = CDOResourceURITransferData.deserialize(ptData.getData()); } } } - if(uriData == null) { + if (uriData == null) { result = Collections.emptyList(); } else { // convert the URI transfer data to an EObject so that the drag-and-drop @@ -227,12 +227,12 @@ public class DawnGraphicalEditorSupport extends DefaultGraphicalEditorSupport { boolean result = false; CDOView view = getCDOView(); - if(view != null) { + if (view != null) { IStructuredSelection sel = CDOUtils.tryCast(LocalSelectionTransfer.getTransfer().getSelection(), IStructuredSelection.class); - if((sel != null) && !sel.isEmpty()) { - for(EObject next : Iterables.filter(sel.toList(), EObject.class)) { + if ((sel != null) && !sel.isEmpty()) { + for (EObject next : Iterables.filter(sel.toList(), EObject.class)) { CDOObject cdo = CDOUtils.getCDOObject(next); - if((cdo != null) && (cdo.cdoView().getSession() == view.getSession())) { + if ((cdo != null) && (cdo.cdoView().getSession() == view.getSession())) { result = true; break; } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/editors/DawnGraphicalEditorSupportServiceFactory.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/editors/DawnGraphicalEditorSupportServiceFactory.java index 929410149a8..925c306d302 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/editors/DawnGraphicalEditorSupportServiceFactory.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/editors/DawnGraphicalEditorSupportServiceFactory.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -17,42 +17,46 @@ import org.eclipse.papyrus.infra.core.services.ServicesRegistry; /** - * This is the DawnGraphicalEditorSupportServiceFactory type. Enjoy. + * This is the DawnGraphicalEditorSupportServiceFactory type. Enjoy. */ public class DawnGraphicalEditorSupportServiceFactory implements IServiceFactory { private ServicesRegistry registry; - + private DawnGraphicalEditorSupport service; - + public DawnGraphicalEditorSupportServiceFactory() { super(); } + @Override public void init(ServicesRegistry servicesRegistry) throws ServiceException { - + this.registry = servicesRegistry; } + @Override public void startService() throws ServiceException { - + // pass } + @Override public void disposeService() throws ServiceException { - + if (service == null) { // TODO clean up? } } + @Override public Object createServiceInstance() throws ServiceException { - + service = new DawnGraphicalEditorSupport(registry); return service; } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/editors/PapyrusCDOEditorInput.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/editors/PapyrusCDOEditorInput.java index e9751bf156f..36312c54b94 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/editors/PapyrusCDOEditorInput.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/editors/PapyrusCDOEditorInput.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -37,12 +37,12 @@ public class PapyrusCDOEditorInput extends URIEditorInput { public IPersistableElement getPersistable() { return null; } - + @Override public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) { Object result; - if(adapter == URI.class) { + if (adapter == URI.class) { result = getURI(); } else { result = super.getAdapter(adapter); @@ -74,10 +74,12 @@ public class PapyrusCDOEditorInput extends URIEditorInput { } + @Override public URI[] getPages() { return pageURIs; } + @Override public boolean closeOtherPages() { return closeOtherPages; } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/editors/PapyrusCDOEditorManager.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/editors/PapyrusCDOEditorManager.java index 224b7ce8d5c..526f96d69cd 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/editors/PapyrusCDOEditorManager.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/editors/PapyrusCDOEditorManager.java @@ -1,6 +1,6 @@ /***************************************************************************** * Copyright (c) 2013, 2014 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 @@ -9,7 +9,7 @@ * Contributors: * CEA LIST - Initial API and implementation * Christian W. Damus (CEA) - bug 422257 - * + * *****************************************************************************/ package org.eclipse.papyrus.cdo.internal.ui.editors; @@ -103,14 +103,14 @@ public class PapyrusCDOEditorManager { IEditorPart result = page.openEditor(input, PapyrusMultiDiagramEditor.EDITOR_ID); - EditingDomain domain = (EditingDomain)result.getAdapter(EditingDomain.class); + EditingDomain domain = (EditingDomain) result.getAdapter(EditingDomain.class); ResourceSet resourceSet = domain.getResourceSet(); CDOView view = repository.getCDOView(resourceSet); add(view, result); - if(view instanceof CDOTransaction) { - ServicesRegistry services = (ServicesRegistry)result.getAdapter(ServicesRegistry.class); + if (view instanceof CDOTransaction) { + ServicesRegistry services = (ServicesRegistry) result.getAdapter(ServicesRegistry.class); view.addListener(new PapyrusTransactionListener(services, resourceSet)); } @@ -118,7 +118,7 @@ public class PapyrusCDOEditorManager { } private IResourceSetDisposalApprover getDisposalApprover() { - if(disposalApprover == null) { + if (disposalApprover == null) { disposalApprover = new ResourceSetDisposalApprover(); } @@ -138,8 +138,8 @@ public class PapyrusCDOEditorManager { @Override public EditorListener call() throws Exception { - //Probably not necessary. But the previous API is deprecated. It is probably safer - //to return a non-null EditorListener, but we're not supposed to enter this method anyway + // Probably not necessary. But the previous API is deprecated. It is probably safer + // to return a non-null EditorListener, but we're not supposed to enter this method anyway EditorListener listener = new EditorListener(); editor.getSite().getPage().addPartListener(listener); return listener; @@ -174,7 +174,7 @@ public class PapyrusCDOEditorManager { @Override public void run() { - if(editors.containsKey(editor)) { + if (editors.containsKey(editor)) { editor.getSite().getPage().closeEditor(editor, false); } } @@ -192,20 +192,20 @@ public class PapyrusCDOEditorManager { editors.add(editor); Optional<ISashWindowsContainer> sashContainer = AdapterUtils.adapt(editor, ISashWindowsContainer.class); - if(sashContainer.isPresent()) { + if (sashContainer.isPresent()) { sashContainer.get().addPageLifeCycleListener(this); } } @Override public void partClosed(IWorkbenchPart part) { - if(editors.remove(part)) { - IEditorPart editor = (IEditorPart)part; + if (editors.remove(part)) { + IEditorPart editor = (IEditorPart) part; closed(editor); } Optional<ISashWindowsContainer> sashContainer = AdapterUtils.adapt(part, ISashWindowsContainer.class); - if(sashContainer.isPresent()) { + if (sashContainer.isPresent()) { sashContainer.get().removePageLifeCycleListener(this); sashContainer.get().visit(new IPageVisitor() { @@ -224,8 +224,8 @@ public class PapyrusCDOEditorManager { @Override public void pageClosed(IPage page) { - if(page instanceof IEditorPage) { - closed(((IEditorPage)page).getIEditorPart()); + if (page instanceof IEditorPage) { + closed(((IEditorPage) page).getIEditorPart()); } } @@ -286,32 +286,32 @@ public class PapyrusCDOEditorManager { public DisposeAction disposalRequested(IPapyrusRepository repository, Collection<ResourceSet> resourceSets) { DisposeAction result = DisposeAction.CLOSE; - IInternalPapyrusRepository internal = (IInternalPapyrusRepository)repository; + IInternalPapyrusRepository internal = (IInternalPapyrusRepository) repository; final List<IEditorPart> dirty = Lists.newArrayList(); - for(ResourceSet next : resourceSets) { + for (ResourceSet next : resourceSets) { CDOView view = internal.getCDOView(next); IEditorPart editor = editors.inverse().get(view); - if((editor != null) && editor.isDirty()) { + if ((editor != null) && editor.isDirty()) { dirty.add(editor); } } - if(!dirty.isEmpty()) { + if (!dirty.isEmpty()) { Future<Integer> dlgResult = UIUtil.call(new Callable<Integer>() { @Override public Integer call() { MessageDialog dlg = new MessageDialog(dirty.get(0).getSite().getShell(), Messages.PapyrusCDOEditorManager_1, null, Messages.PapyrusCDOEditorManager_2, MessageDialog.QUESTION_WITH_CANCEL, // - new String[]{ IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }, 2); + new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }, 2); return dlg.open(); } }); try { - switch(dlgResult.get()) { + switch (dlgResult.get()) { case 0: // Yes result = DisposeAction.SAVE; break; diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/editors/PapyrusGMFEditorSupport.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/editors/PapyrusGMFEditorSupport.java index ff46dfd5fbc..68a14d8127b 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/editors/PapyrusGMFEditorSupport.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/editors/PapyrusGMFEditorSupport.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -53,6 +53,7 @@ public class PapyrusGMFEditorSupport private static final Predicate<EStructuralFeature.Setting> IS_VIEW_REFERENCE = new Predicate<EStructuralFeature.Setting>() { + @Override public boolean apply(EStructuralFeature.Setting input) { return input.getEStructuralFeature() == NotationPackage.Literals.VIEW__ELEMENT; } @@ -60,6 +61,7 @@ public class PapyrusGMFEditorSupport private static final Function<EStructuralFeature.Setting, View> OWNER_VIEW = new Function<EStructuralFeature.Setting, View>() { + @Override public View apply(EStructuralFeature.Setting input) { return (View) input.getEObject(); } @@ -90,15 +92,15 @@ public class PapyrusGMFEditorSupport // the super implementation locked the semantic element, so update // its presentation CDOObject cdo = CDOUtils - .getCDOObject(getSemanticElement((EditPart) objectToBeLocked)); + .getCDOObject(getSemanticElement((EditPart) objectToBeLocked)); if (cdo != null) { updateAppearance(cdo); } } else { EObject element = EMFHelper.getEObject(objectToBeLocked); CDOObject cdo = (element == null) - ? null - : CDOUtils.getCDOObject(element); + ? null + : CDOUtils.getCDOObject(element); if (element != null) { CDOUtils.lock(cdo); @@ -122,18 +124,18 @@ public class PapyrusGMFEditorSupport private void updateAppearance(CDOObject cdoObject) { EObject element = CDOUtil.getEObject(cdoObject); DawnElementStylizer stylizer = DawnElementStylizerRegistry.instance - .getStylizer(element); + .getStylizer(element); if (stylizer != null) { if (cdoObject.cdoConflict()) { stylizer.setConflicted(element, - DawnAppearancer.TYPE_CONFLICT_REMOTELY_AND_LOCALLY_CHANGED); + DawnAppearancer.TYPE_CONFLICT_REMOTELY_AND_LOCALLY_CHANGED); } else if (CDOUtils.isLocked(cdoObject, true)) { stylizer.setLocked(element, - DawnAppearancer.TYPE_LOCKED_GLOBALLY); + DawnAppearancer.TYPE_LOCKED_GLOBALLY); } else if (CDOUtils.isLocked(cdoObject, false)) { stylizer - .setLocked(element, DawnAppearancer.TYPE_LOCKED_LOCALLY); + .setLocked(element, DawnAppearancer.TYPE_LOCKED_LOCALLY); } else { stylizer.setDefault(element); } @@ -148,15 +150,15 @@ public class PapyrusGMFEditorSupport // the super implementation unlocked the semantic element, so update // its presentation CDOObject cdo = CDOUtils - .getCDOObject(getSemanticElement((EditPart) objectToBeUnlocked)); + .getCDOObject(getSemanticElement((EditPart) objectToBeUnlocked)); if (cdo != null) { updateAppearance(cdo); } } else { EObject element = EMFHelper.getEObject(objectToBeUnlocked); CDOObject cdo = (element == null) - ? null - : CDOUtils.getCDOObject(element); + ? null + : CDOUtils.getCDOObject(element); if (element != null) { CDOUtils.unlock(cdo); @@ -232,12 +234,12 @@ public class PapyrusGMFEditorSupport Iterable<View> result = Collections.emptyList(); ECrossReferenceAdapter xrefs = ECrossReferenceAdapter - .getCrossReferenceAdapter(element); + .getCrossReferenceAdapter(element); if (xrefs != null) { Collection<EStructuralFeature.Setting> settings = xrefs - .getNonNavigableInverseReferences(element); + .getNonNavigableInverseReferences(element); result = Iterables.transform( - Iterables.filter(settings, IS_VIEW_REFERENCE), OWNER_VIEW); + Iterables.filter(settings, IS_VIEW_REFERENCE), OWNER_VIEW); } return result; diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/editors/PapyrusGMFHandler.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/editors/PapyrusGMFHandler.java index 2ffbebf2ad6..2aa7451d5f9 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/editors/PapyrusGMFHandler.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/editors/PapyrusGMFHandler.java @@ -1,6 +1,6 @@ /***************************************************************************** * Copyright (c) 2013, 2014 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 @@ -9,7 +9,7 @@ * Contributors: * CEA LIST - Initial API and implementation * Christian W. Damus (CEA) - bug 422257 - * + * *****************************************************************************/ package org.eclipse.papyrus.cdo.internal.ui.editors; @@ -59,16 +59,16 @@ public class PapyrusGMFHandler extends DawnGMFHandler { @Override public void attachingObject(CDOTransaction transaction, CDOObject object) { // bug 404077: we don't need to refresh edit-parts for objects attached to the transaction - // because GMF will take care of refreshing edit-parts. So, suppress the super behaviour + // because GMF will take care of refreshing edit-parts. So, suppress the super behaviour } @Override public void handleViewInvalidationEvent(CDOViewInvalidationEvent event) { - if(UIUtil.ensureUIThread(this, event)) { + if (UIUtil.ensureUIThread(this, event)) { // filter the event to cover only the objects that are views in or // have views in my diagram CDOViewInvalidationEvent filtered = filter(event); - if(filtered != null) { + if (filtered != null) { super.handleViewInvalidationEvent(filtered); } } @@ -76,11 +76,11 @@ public class PapyrusGMFHandler extends DawnGMFHandler { @Override public void handleTransactionConflictEvent(CDOTransactionConflictEvent event) { - if(UIUtil.ensureUIThread(this, event)) { + if (UIUtil.ensureUIThread(this, event)) { // filter the event to cover only the objects that are views in or // have views in my diagram CDOTransactionConflictEvent filtered = filter(event); - if(filtered != null) { + if (filtered != null) { super.handleTransactionConflictEvent(filtered); } } @@ -99,8 +99,8 @@ public class PapyrusGMFHandler extends DawnGMFHandler { filtered = filter(detached) || filtered; filtered = filter(deltas.keySet()) || filtered; - if(filtered) { - if(dirty.isEmpty() && detached.isEmpty() && deltas.isEmpty()) { + if (filtered) { + if (dirty.isEmpty() && detached.isEmpty() && deltas.isEmpty()) { result = null; } else { result = new CDOViewInvalidationEvent() { @@ -153,13 +153,13 @@ public class PapyrusGMFHandler extends DawnGMFHandler { @Override public void modifyingObject(CDOTransaction transaction, final CDOObject object, CDOFeatureDelta featureDelta) { - if(object instanceof Resource) { + if (object instanceof Resource) { // GMF doesn't need to refresh a resource return; } // bug 404077: we don't need to refresh edit-parts for objects attached to the transaction - // because GMF will take care of refreshing edit-parts. So, suppress the super behaviour + // because GMF will take care of refreshing edit-parts. So, suppress the super behaviour // vis-a-vis refreshing the object and setting the editor dirty RefreshAdapter.refreshLater(object, editor); @@ -170,9 +170,9 @@ public class PapyrusGMFHandler extends DawnGMFHandler { try { super.handleEvent(event); } finally { - if(CDOUtils.removeListenerFromDeactivatedLifecycle(this, event)) { - if(event.getSource() instanceof CDOTransaction) { - ((CDOTransaction)event.getSource()).removeTransactionHandler(this); + if (CDOUtils.removeListenerFromDeactivatedLifecycle(this, event)) { + if (event.getSource() instanceof CDOTransaction) { + ((CDOTransaction) event.getSource()).removeTransactionHandler(this); } } } @@ -198,7 +198,7 @@ public class PapyrusGMFHandler extends DawnGMFHandler { static void refreshLater(Notifier notifier, IDawnEditor editor) { // don't add another one to this object - if(EcoreUtil.getExistingAdapter(notifier, TYPE) == null) { + if (EcoreUtil.getExistingAdapter(notifier, TYPE) == null) { notifier.eAdapters().add(new RefreshAdapter(editor)); } } @@ -208,7 +208,7 @@ public class PapyrusGMFHandler extends DawnGMFHandler { // removal of adapters doesn't require refresh, especially if // the adapter that is removed is the CDO legacy adapter! (which // then results in issues) - if(notification.getEventType() != Notification.REMOVING_ADAPTER) { + if (notification.getEventType() != Notification.REMOVING_ADAPTER) { post(); getTarget().eAdapters().remove(this); } @@ -216,8 +216,8 @@ public class PapyrusGMFHandler extends DawnGMFHandler { private void post() { // don't schedule redundant refreshes for this editor - if(UIUtil.ensureUIThread(this)) { - if(pending.putIfAbsent(editor, this) == this) { + if (UIUtil.ensureUIThread(this)) { + if (pending.putIfAbsent(editor, this) == this) { run(); } } @@ -233,7 +233,7 @@ public class PapyrusGMFHandler extends DawnGMFHandler { pending.remove(editor, this); DiagramDocumentEditor diagramEditor = getDiagramEditor(editor); - if(diagramEditor != null) { + if (diagramEditor != null) { DawnDiagramUpdater.refreshEditPart(diagramEditor.getDiagramEditPart(), diagramEditor); } } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/editors/PapyrusGMFLockingHandler.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/editors/PapyrusGMFLockingHandler.java index ccf98ff5c58..59526b02134 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/editors/PapyrusGMFLockingHandler.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/editors/PapyrusGMFLockingHandler.java @@ -1,6 +1,6 @@ /***************************************************************************** * Copyright (c) 2013, 2014 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 @@ -9,7 +9,7 @@ * Contributors: * CEA LIST - Initial API and implementation * Christian W. Damus (CEA) - bug 422257 - * + * *****************************************************************************/ package org.eclipse.papyrus.cdo.internal.ui.editors; @@ -31,7 +31,7 @@ public class PapyrusGMFLockingHandler extends DawnGMFLockingHandler { @Override public void handleLocksChangedEvent(CDOViewLocksChangedEvent event) { - if(UIUtil.ensureUIThread(this, event)) { + if (UIUtil.ensureUIThread(this, event)) { super.handleLocksChangedEvent(event); } } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/editors/PapyrusTransactionListener.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/editors/PapyrusTransactionListener.java index 6c9eeb92390..c4277ae0b91 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/editors/PapyrusTransactionListener.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/editors/PapyrusTransactionListener.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -72,10 +72,11 @@ public class PapyrusTransactionListener implements IListener { private final Predicate<Adapter> shouldPropagate = new Predicate<Adapter>() { + @Override public boolean apply(Adapter input) { return (input instanceof ECrossReferenceAdapter) // - || (input instanceof EContentAdapter) // - || (input instanceof ChangeRecorder); + || (input instanceof EContentAdapter) // + || (input instanceof ChangeRecorder); } }; @@ -87,14 +88,16 @@ public class PapyrusTransactionListener implements IListener { this.services = services; contentAdapters = Sets.newHashSet(Iterables.filter(resourceSet.eAdapters(), shouldPropagate)); - ((EObservableAdapterList)resourceSet.eAdapters()).addListener(new EObservableAdapterList.Listener() { + ((EObservableAdapterList) resourceSet.eAdapters()).addListener(new EObservableAdapterList.Listener() { + @Override public void added(Notifier notifier, Adapter adapter) { - if(adapter instanceof EContentAdapter) { + if (adapter instanceof EContentAdapter) { contentAdapters.add(adapter); } } + @Override public void removed(Notifier notifier, Adapter adapter) { contentAdapters.remove(adapter); } @@ -102,30 +105,31 @@ public class PapyrusTransactionListener implements IListener { } + @Override public void notifyEvent(IEvent event) { - if(event instanceof CDOViewInvalidationEvent) { - handleViewInvalidationEvent((CDOViewInvalidationEvent)event); - } else if(event instanceof CDOTransactionConflictEvent) { - handleTransactionConflictEvent((CDOTransactionConflictEvent)event); - } else if(event instanceof CDOViewLocksChangedEvent) { - handleLocksChangedEvent((CDOViewLocksChangedEvent)event); - } else if(event instanceof CDOTransactionFinishedEvent) { - handleTransactionFinishedEvent((CDOTransactionFinishedEvent)event); + if (event instanceof CDOViewInvalidationEvent) { + handleViewInvalidationEvent((CDOViewInvalidationEvent) event); + } else if (event instanceof CDOTransactionConflictEvent) { + handleTransactionConflictEvent((CDOTransactionConflictEvent) event); + } else if (event instanceof CDOViewLocksChangedEvent) { + handleLocksChangedEvent((CDOViewLocksChangedEvent) event); + } else if (event instanceof CDOTransactionFinishedEvent) { + handleTransactionFinishedEvent((CDOTransactionFinishedEvent) event); } else { handleEvent(event); } } protected void handleTransactionConflictEvent(CDOTransactionConflictEvent event) { - if(UIUtil.ensureUIThread(this, event)) { + if (UIUtil.ensureUIThread(this, event)) { CDOObject cdoObject = event.getConflictingObject(); EObject element = CDOUtil.getEObject(cdoObject); View view = DawnDiagramUpdater.findViewByContainer(element); - if(view == null) { + if (view == null) { // it's not actually a view that is conflicted, but a model // element - if(cdoObject.cdoConflict()) { + if (cdoObject.cdoConflict()) { CDOStateAdapter.setState(element, DawnState.CONFLICT); CDOStateLabelDecorator.fireLabelUpdates(); @@ -135,36 +139,36 @@ public class PapyrusTransactionListener implements IListener { } protected void handleLocksChangedEvent(CDOViewLocksChangedEvent event) { - if(UIUtil.ensureUIThread(this, event)) { + if (UIUtil.ensureUIThread(this, event)) { Map<EObject, DawnState> changedObjects = new HashMap<EObject, DawnState>(); CDOView cdoView = event.getSource(); - for(CDOLockState state : event.getLockStates()) { + for (CDOLockState state : event.getLockStates()) { Object lockedObject = state.getLockedObject(); CDOID id; - if(lockedObject instanceof CDOID) { - id = (CDOID)lockedObject; - } else if(lockedObject instanceof CDOIDAndBranch) { - id = ((CDOIDAndBranch)lockedObject).getID(); + if (lockedObject instanceof CDOID) { + id = (CDOID) lockedObject; + } else if (lockedObject instanceof CDOIDAndBranch) { + id = ((CDOIDAndBranch) lockedObject).getID(); } else { throw new RuntimeException("Unexpected object type: " //$NON-NLS-1$ - + lockedObject); + + lockedObject); } - if(id != null) { + if (id != null) { CDOObject object = cdoView.getObject(id); EObject element = CDOUtil.getEObject(object); View view = DawnDiagramUpdater.findViewByContainer(element); - if(view == null) { + if (view == null) { // it's not actually a view that is locked, but a model // element - if(CDOUtils.isLocked(object, false)) { + if (CDOUtils.isLocked(object, false)) { throw new IllegalStateException("Locally locked objects should not occur."); //$NON-NLS-1$ - } else if(CDOUtils.isLocked(object, true)) { + } else if (CDOUtils.isLocked(object, true)) { changedObjects.put(element, DawnState.LOCKED_REMOTELY); } else { changedObjects.put(element, DawnState.CLEAN); @@ -181,8 +185,8 @@ public class PapyrusTransactionListener implements IListener { * @precondition The current thread is the UI thread */ void handleLocks(Map<EObject, DawnState> changedObjects) { - if(!changedObjects.isEmpty()) { - for(Map.Entry<EObject, DawnState> next : changedObjects.entrySet()) { + if (!changedObjects.isEmpty()) { + for (Map.Entry<EObject, DawnState> next : changedObjects.entrySet()) { EObject element = next.getKey(); DawnState state = next.getValue(); @@ -195,12 +199,12 @@ public class PapyrusTransactionListener implements IListener { } protected void handleViewInvalidationEvent(CDOViewInvalidationEvent event) { - if(UIUtil.ensureUIThread(this, event)) { + if (UIUtil.ensureUIThread(this, event)) { // process changed objects to ensure propagation of adapters to new objects. // CDO doesn't tell us about new objects, but it does tell us that their // containers changed, so we have to go fishing - for(EObject next : CDOUtils.getEObjects(event.getDirtyObjects())) { - for(EObject possiblyNew : next.eContents()) { + for (EObject next : CDOUtils.getEObjects(event.getDirtyObjects())) { + for (EObject possiblyNew : next.eContents()) { synchronizeAdapters(possiblyNew); } } @@ -217,24 +221,24 @@ public class PapyrusTransactionListener implements IListener { protected void handleOperationHistory(CDOViewInvalidationEvent event) { IOperationHistory history = getOperationHistory(); - if(history != null) { + if (history != null) { Iterable<EObject> affectedObjects = CDOUtils.getEObjects(Iterables.concat(event.getDirtyObjects(), event.getDetachedObjects())); - if(!Iterables.isEmpty(affectedObjects)) { + if (!Iterables.isEmpty(affectedObjects)) { IUndoContext context = new CDOUndoContext(affectedObjects); - if(context != null) { + if (context != null) { IUndoableOperation undoOperation = history.getUndoOperation(context); IUndoableOperation redoOperation = history.getRedoOperation(context); - if((undoOperation != null) || (redoOperation != null)) { - // notify listeners of the impending changes. We do this before flushing + if ((undoOperation != null) || (redoOperation != null)) { + // notify listeners of the impending changes. We do this before flushing // the undo context because we depend on the fact that the UndoActionHandler // and RedoActionHandler only react when the operation is their current // operation (which means it mustn't have the context removed yet) *and* the // update is posted asynchronously - if(undoOperation != null) { + if (undoOperation != null) { history.operationChanged(undoOperation); } - if(redoOperation != null) { + if (redoOperation != null) { history.operationChanged(redoOperation); } @@ -253,10 +257,10 @@ public class PapyrusTransactionListener implements IListener { try { EditingDomain domain = services.getService(TransactionalEditingDomain.class); - if(domain != null) { + if (domain != null) { CommandStack stack = domain.getCommandStack(); - if(stack instanceof IWorkspaceCommandStack) { - result = ((IWorkspaceCommandStack)stack).getOperationHistory(); + if (stack instanceof IWorkspaceCommandStack) { + result = ((IWorkspaceCommandStack) stack).getOperationHistory(); } } } catch (ServiceException e) { @@ -282,16 +286,16 @@ public class PapyrusTransactionListener implements IListener { // review all conflicts and locks Map<EObject, DawnState> stateUpdates = Maps.newHashMap(); - for(CDOStateAdapter next : CDOStateAdapter.getAll(event.getSource().getResourceSet())) { + for (CDOStateAdapter next : CDOStateAdapter.getAll(event.getSource().getResourceSet())) { Object target = next.getTarget(); - if(target instanceof EObject) { - EObject object = (EObject)target; + if (target instanceof EObject) { + EObject object = (EObject) target; stateUpdates.put(object, CDOUtils.computeState(object)); } } - for(Map.Entry<EObject, DawnState> next : stateUpdates.entrySet()) { + for (Map.Entry<EObject, DawnState> next : stateUpdates.entrySet()) { CDOStateAdapter.setState(next.getKey(), next.getValue()); } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/expressions/CDOObjectPropertyTester.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/expressions/CDOObjectPropertyTester.java index b307e5abeae..fc02cfc72e1 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/expressions/CDOObjectPropertyTester.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/expressions/CDOObjectPropertyTester.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -35,6 +35,7 @@ public class CDOObjectPropertyTester super(); } + @Override public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { @@ -62,7 +63,7 @@ public class CDOObjectPropertyTester if (result) { DawnState state = CDOStateAdapter.getState(object); result = (state != DawnState.LOCKED_LOCALLY) - && (state != DawnState.LOCKED_REMOTELY); + && (state != DawnState.LOCKED_REMOTELY); } return result; diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/handlers/ExportModelHandler.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/handlers/ExportModelHandler.java index da84b6d9b09..c7f454059d9 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/handlers/ExportModelHandler.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/handlers/ExportModelHandler.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -47,11 +47,11 @@ public class ExportModelHandler extends AbstractHandler { public Object execute(ExecutionEvent event) throws ExecutionException { ISelection selection = HandlerUtil.getCurrentSelection(event); - if(selection instanceof IStructuredSelection) { + if (selection instanceof IStructuredSelection) { IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event); - if(window != null) { - exportModels(window, null, (IStructuredSelection)selection); + if (window != null) { + exportModels(window, null, (IStructuredSelection) selection); } } @@ -70,17 +70,17 @@ public class ExportModelHandler extends AbstractHandler { IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); List<DIModel> models = Lists.newArrayList(); - for(URI next : resourceURIs) { + for (URI next : resourceURIs) { IPapyrusRepository repo = PapyrusRepositoryManager.INSTANCE.getRepositoryForURI(next); - if(repo != null) { - CDOView view = ((IInternalPapyrusRepository)repo).getMasterView(); - if(view != null) { // the repository could be disconnected by now + if (repo != null) { + CDOView view = ((IInternalPapyrusRepository) repo).getMasterView(); + if (view != null) { // the repository could be disconnected by now try { CDOResourceNode resource = view.getResourceNode(CDOURIUtil.extractResourcePath(next)); - if(resource instanceof CDOResource) { + if (resource instanceof CDOResource) { // only export DI models! - if(DIResourceQuery.getDIResources(view).contains(resource)) { - models.add(DIModel.getInstance((CDOResource)resource, true)); + if (DIResourceQuery.getDIResources(view).contains(resource)) { + models.add(DIModel.getInstance((CDOResource) resource, true)); } } } catch (Exception e) { @@ -90,7 +90,7 @@ public class ExportModelHandler extends AbstractHandler { } } - if((window != null) && !models.isEmpty()) { + if ((window != null) && !models.isEmpty()) { exportModels(window, destination, new StructuredSelection(models)); } } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/handlers/ImportModelsHandler.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/handlers/ImportModelsHandler.java index a4b9765dcc2..cc53b3d8ef1 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/handlers/ImportModelsHandler.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/handlers/ImportModelsHandler.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -27,14 +27,15 @@ import org.eclipse.ui.handlers.HandlerUtil; */ public class ImportModelsHandler extends AbstractHandler { + @Override public Object execute(ExecutionEvent event) throws ExecutionException { ISelection selection = HandlerUtil.getCurrentSelection(event); - if(selection instanceof IStructuredSelection) { + if (selection instanceof IStructuredSelection) { IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event); - if(window != null) { - importModels(window, (IStructuredSelection)selection, null); + if (window != null) { + importModels(window, (IStructuredSelection) selection, null); } } @@ -45,7 +46,7 @@ public class ImportModelsHandler extends AbstractHandler { ModelImportWizard wizard = new ModelImportWizard(); wizard.init(window.getWorkbench(), selection); - if(repository != null) { + if (repository != null) { wizard.setRepository(repository); } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/handlers/LockObjectsHandler.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/handlers/LockObjectsHandler.java index dea0d426f67..b43f38dd37e 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/handlers/LockObjectsHandler.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/handlers/LockObjectsHandler.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -24,12 +24,13 @@ import org.eclipse.papyrus.cdo.internal.ui.Activator; public class LockObjectsHandler extends AbstractHandler { + @Override public Object execute(ExecutionEvent event) throws ExecutionException { - + List<Object> selected = UIHandlerUtil.getSelection(event); Activator.getActiveDawnEditor().getDawnEditorSupport() - .lockObjects(selected); + .lockObjects(selected); return null; } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/handlers/OpenInModelRepositoriesViewHandler.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/handlers/OpenInModelRepositoriesViewHandler.java index 720dc5b4b1a..5a842723020 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/handlers/OpenInModelRepositoriesViewHandler.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/handlers/OpenInModelRepositoriesViewHandler.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -43,12 +43,12 @@ public class OpenInModelRepositoriesViewHandler extends AbstractHandler { ISelection selection = HandlerUtil.getCurrentSelection(event); CDOAdminClientRepository adminRepository = UIUtil.adaptElement(selection, CDOAdminClientRepository.class); - if(adminRepository != null) { + if (adminRepository != null) { CDOAdminClient client = adminRepository.getAdmin(); String url = String.format("%s?repositoryName=%s", client.getURL(), adminRepository.getName()); //$NON-NLS-1$ IPapyrusRepository repository = manager.getRepository(url); - if(repository == null) { + if (repository == null) { repository = manager.createRepository(url); repository.setName(adminRepository.getName()); manager.saveRepositories(); @@ -56,11 +56,11 @@ public class OpenInModelRepositoriesViewHandler extends AbstractHandler { IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event); - if(window != null) { + if (window != null) { selectReveal(window, repository); } - if(!repository.isConnected()) { + if (!repository.isConnected()) { new ConnectRepositoryAction(HandlerUtil.getActivePart(event)).run(repository); } } @@ -70,7 +70,7 @@ public class OpenInModelRepositoriesViewHandler extends AbstractHandler { protected void selectReveal(IWorkbenchWindow window, IPapyrusRepository repository) { IWorkbenchPage page = window.getActivePage(); - if(page != null) { + if (page != null) { try { IViewPart view = page.showView(ModelRepositoriesView.ID); view.getSite().getSelectionProvider().setSelection(new StructuredSelection(repository)); diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/handlers/ResolveConflictsHandler.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/handlers/ResolveConflictsHandler.java index 157092bdf77..dca421b55eb 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/handlers/ResolveConflictsHandler.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/handlers/ResolveConflictsHandler.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -26,6 +26,7 @@ import org.eclipse.ui.handlers.HandlerUtil; public class ResolveConflictsHandler extends AbstractHandler { + @Override public Object execute(ExecutionEvent event) throws ExecutionException { IDawnEditor activeEditor = Activator.getActiveDawnEditor(); @@ -34,13 +35,13 @@ public class ResolveConflictsHandler // TODO: Implement real conflict resolution if (MessageDialog - .openQuestion(HandlerUtil.getActiveShellChecked(event), - Messages.ResolveConflictsHandler_0, - Messages.ResolveConflictsHandler_1)) { + .openQuestion(HandlerUtil.getActiveShellChecked(event), + Messages.ResolveConflictsHandler_0, + Messages.ResolveConflictsHandler_1)) { activeEditor.getDawnEditorSupport().rollback(); } } - + return null; } } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/handlers/UIHandlerUtil.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/handlers/UIHandlerUtil.java index 728e0b6c0d5..25bd6333dbb 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/handlers/UIHandlerUtil.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/handlers/UIHandlerUtil.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -43,7 +43,7 @@ public class UIHandlerUtil { if (selection instanceof IStructuredSelection) { Collection<?> selected = ((IStructuredSelection) selection) - .toList(); + .toList(); result = ImmutableList.copyOf(Iterables.filter(selected, type)); } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/handlers/UnlockObjectsHandler.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/handlers/UnlockObjectsHandler.java index 3945eabbda0..3d57d309251 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/handlers/UnlockObjectsHandler.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/handlers/UnlockObjectsHandler.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -24,12 +24,13 @@ import org.eclipse.papyrus.cdo.internal.ui.Activator; public class UnlockObjectsHandler extends AbstractHandler { + @Override public Object execute(ExecutionEvent event) throws ExecutionException { List<Object> selected = UIHandlerUtil.getSelection(event); Activator.getActiveDawnEditor().getDawnEditorSupport() - .unlockObjects(selected); + .unlockObjects(selected); return null; } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/l10n/Messages.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/l10n/Messages.java index dc9f509abea..1b706268654 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/l10n/Messages.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/l10n/Messages.java @@ -1,6 +1,6 @@ /***************************************************************************** * Copyright (c) 2013, 2014 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 @@ -9,7 +9,7 @@ * Contributors: * CEA LIST - Initial API and implementation * Christian W. Damus (CEA) - bug 429242 - * + * *****************************************************************************/ package org.eclipse.papyrus.cdo.internal.ui.l10n; diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/markers/CDOMarkerMonitor.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/markers/CDOMarkerMonitor.java index a779269e3a8..d9abd62449f 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/markers/CDOMarkerMonitor.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/markers/CDOMarkerMonitor.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -36,33 +36,35 @@ public class CDOMarkerMonitor @Override public void initialize(ModelSet modelSet) { super.initialize(modelSet); - + this.util = new ProblemEditUtil( - ((AdapterFactoryEditingDomain) modelSet - .getTransactionalEditingDomain()).getAdapterFactory()); + ((AdapterFactoryEditingDomain) modelSet + .getTransactionalEditingDomain()).getAdapterFactory()); this.problemsListener = createProblemsListener(); ProblemsManager.getProblemsManager(modelSet).addProblemsListener( - problemsListener); + problemsListener); } @Override public void dispose() { if (problemsListener != null) { ProblemsManager.getProblemsManager(getModelSet()) - .removeProblemsListener(problemsListener); + .removeProblemsListener(problemsListener); problemsListener = null; } - + super.dispose(); } protected ProblemsListener createProblemsListener() { return new ProblemsListener() { + @Override public void problemAdded(ProblemsEvent event) { fireMarkerAdded(new CDOPapyrusMarker(event.getProblem(), util)); } + @Override public void problemRemoved(ProblemsEvent event) { fireMarkerRemoved(new CDOPapyrusMarker(event.getProblem(), util)); } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/markers/CDOMarkerProvider.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/markers/CDOMarkerProvider.java index ea4a6ed3cd1..9c276f25720 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/markers/CDOMarkerProvider.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/markers/CDOMarkerProvider.java @@ -1,6 +1,6 @@ /***************************************************************************** * Copyright (c) 2013, 2014 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 @@ -9,7 +9,7 @@ * Contributors: * CEA LIST - Initial API and implementation * Christian W. Damus (CEA) - bug 431618 - * + * *****************************************************************************/ package org.eclipse.papyrus.cdo.internal.ui.markers; @@ -75,8 +75,8 @@ public class CDOMarkerProvider extends AbstractMarkerProvider implements IMarker @Override public void run() { setResult(Lists.newArrayList(Iterators.transform( // - getProblems(resource, type, includeSubtypes), // - CDOPapyrusMarker.wrap(getProblemEditUtil(resource))))); + getProblems(resource, type, includeSubtypes), // + CDOPapyrusMarker.wrap(getProblemEditUtil(resource))))); } }); } @@ -84,9 +84,9 @@ public class CDOMarkerProvider extends AbstractMarkerProvider implements IMarker protected Iterator<? extends EProblem> getProblems(final Resource resource, final String type, boolean includeSubtypes) { final Predicate<EProblem> filter; - if(type == null) { + if (type == null) { filter = Predicates.alwaysTrue(); - } else if(includeSubtypes) { + } else if (includeSubtypes) { filter = new Predicate<EProblem>() { @Override @@ -134,7 +134,7 @@ public class CDOMarkerProvider extends AbstractMarkerProvider implements IMarker protected void doCreateMarker(Resource resource, Diagnostic diagnostic) throws CoreException { ProblemsManager mgr = getProblemsManager(resource); EProblem problem = mgr.createProblem(diagnostic); - if(problem != null) { + if (problem != null) { mgr.addProblem(problem); } } @@ -144,10 +144,10 @@ public class CDOMarkerProvider extends AbstractMarkerProvider implements IMarker super.batchCreated(resource); ResourceSet rset = resource.getResourceSet(); - if(rset instanceof ModelSet) { + if (rset instanceof ModelSet) { // yield the resource set to any other threads that might // be waiting to read it - ((ModelSet)rset).getTransactionalEditingDomain().yield(); + ((ModelSet) rset).getTransactionalEditingDomain().yield(); } } @@ -196,12 +196,12 @@ public class CDOMarkerProvider extends AbstractMarkerProvider implements IMarker @Override public void run() { ProblemsManager mgr = getProblemsManager(resource); - if(markerType == null) { + if (markerType == null) { // efficiently remove all markers for the resource mgr.purgeProblems(resource); } else { // tediously remove the matching markers - for(EProblem next : Lists.newArrayList(getProblems(resource, markerType, includeSubtypes))) { + for (EProblem next : Lists.newArrayList(getProblems(resource, markerType, includeSubtypes))) { ProblemsManager.delete(next); } } @@ -231,8 +231,8 @@ public class CDOMarkerProvider extends AbstractMarkerProvider implements IMarker ProblemEditUtil result = defaultUtil; ResourceSet rset = resource.getResourceSet(); - if(rset instanceof ModelSet) { - AdapterFactory factory = ((AdapterFactoryEditingDomain)((ModelSet)rset).getTransactionalEditingDomain()).getAdapterFactory(); + if (rset instanceof ModelSet) { + AdapterFactory factory = ((AdapterFactoryEditingDomain) ((ModelSet) rset).getTransactionalEditingDomain()).getAdapterFactory(); result = new ProblemEditUtil(factory); } @@ -245,9 +245,9 @@ public class CDOMarkerProvider extends AbstractMarkerProvider implements IMarker static <X extends Throwable> void run(Resource context, Class<X> exceptionType, Runnable runnable) throws X { ResourceSet rset = context.getResourceSet(); - if(rset instanceof ModelSet) { + if (rset instanceof ModelSet) { try { - ((ModelSet)rset).getTransactionalEditingDomain().runExclusive(runnable); + ((ModelSet) rset).getTransactionalEditingDomain().runExclusive(runnable); } catch (WrappedException e) { throw exceptionType.cast(e.exception()); } catch (InterruptedException e) { @@ -262,9 +262,9 @@ public class CDOMarkerProvider extends AbstractMarkerProvider implements IMarker T result; ResourceSet rset = context.getResourceSet(); - if(rset instanceof ModelSet) { + if (rset instanceof ModelSet) { try { - result = TransactionUtil.runExclusive(((ModelSet)rset).getTransactionalEditingDomain(), runnable); + result = TransactionUtil.runExclusive(((ModelSet) rset).getTransactionalEditingDomain(), runnable); } catch (WrappedException e) { throw exceptionType.cast(e.exception()); } catch (InterruptedException e) { @@ -311,12 +311,12 @@ public class CDOMarkerProvider extends AbstractMarkerProvider implements IMarker protected CommandResult doExecuteWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException { ProblemsManager manager = getProblemsManager(context); Collection<EProblem> problems = Lists.newArrayList(manager.getAllProblems(object)); - if(problems.isEmpty()) { + if (problems.isEmpty()) { // Nothing to do return CommandResult.newOKCommandResult(); } - for(EProblem problem : problems) { + for (EProblem problem : problems) { ProblemsManager.delete(problem); } @@ -328,7 +328,7 @@ public class CDOMarkerProvider extends AbstractMarkerProvider implements IMarker @Override protected CommandResult doUndoWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException { - if(problemsForUndo == null) { + if (problemsForUndo == null) { // Nothing to do return CommandResult.newOKCommandResult(); } @@ -338,10 +338,10 @@ public class CDOMarkerProvider extends AbstractMarkerProvider implements IMarker problemsForUndo = null; Resource resource = object.eResource(); - if(resource != null) { // Should have been reattached by now + if (resource != null) { // Should have been reattached by now context = resource; ProblemsManager manager = getProblemsManager(resource); - for(EProblem problem : problems) { + for (EProblem problem : problems) { problem.setElement(object); manager.addProblem(problem); } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/markers/CDOPapyrusMarker.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/markers/CDOPapyrusMarker.java index c212dba3325..64f5e0b4f3d 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/markers/CDOPapyrusMarker.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/markers/CDOPapyrusMarker.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -56,49 +56,57 @@ public class CDOPapyrusMarker implements IPapyrusMarker { return new Function<EProblem, CDOPapyrusMarker>() { + @Override public CDOPapyrusMarker apply(EProblem input) { return new CDOPapyrusMarker(input, util); } }; } + @Override public Resource getResource() { return resource; } + @Override public EObject getEObject() { return problem.getElement(); } + @Override public boolean exists() { EObject element = getEObject(); return (element != null) && (element.eResource() != null); } + @Override public String getType() { String result = problem.getType(); return (result != null) ? result : EValidator.MARKER; } + @Override public String getTypeLabel() throws CoreException { String result = MarkerListenerUtils.getMarkerTypeLabel(getType()); return ((result != null) && (result.length() > 0)) ? result : util.getProblemType(problem); } + @Override public void delete() { ProblemsManager.delete(problem); } + @Override public Object getAttribute(String name) throws CoreException { Object result = null; - if(name.equals(EValidator.URI_ATTRIBUTE)) { + if (name.equals(EValidator.URI_ATTRIBUTE)) { result = EcoreUtil.getURI(getEObject()).toString(); - } else if(name.equals(SEVERITY)) { + } else if (name.equals(SEVERITY)) { result = getMarkerSeverity(); - } else if(name.equals(MESSAGE)) { + } else if (name.equals(MESSAGE)) { result = problem.getMessage(); - } else if(problem.getAttributes().containsKey(name)) { + } else if (problem.getAttributes().containsKey(name)) { result = coerce(problem.getAttributes().get(name)); } else { throw new CoreException(error("No such marker attribute: " + name)); //$NON-NLS-1$ @@ -110,11 +118,11 @@ public class CDOPapyrusMarker implements IPapyrusMarker { protected Object coerce(String value) { Object result; - if(value == null) { + if (value == null) { result = value; - } else if(isBoolean(value)) { + } else if (isBoolean(value)) { result = Boolean.parseBoolean(value); - } else if(isInteger(value)) { + } else if (isInteger(value)) { result = Integer.parseInt(value); } else { result = value; @@ -130,7 +138,7 @@ public class CDOPapyrusMarker implements IPapyrusMarker { static boolean isInteger(String s) { boolean result = (s != null) && (s.length() > 0); - for(int i = 0; result && (i < s.length()); i++) { + for (int i = 0; result && (i < s.length()); i++) { result = Character.isDigit(s.charAt(i)); } @@ -144,7 +152,7 @@ public class CDOPapyrusMarker implements IPapyrusMarker { protected int getMarkerSeverity() { int result; - switch(problem.getSeverity()) { + switch (problem.getSeverity()) { case OK: case INFO: result = SEVERITY_INFO; @@ -160,14 +168,15 @@ public class CDOPapyrusMarker implements IPapyrusMarker { return result; } + @Override public String getAttribute(String name, String defaultValue) { String result = null; - if(name.equals(EValidator.URI_ATTRIBUTE)) { + if (name.equals(EValidator.URI_ATTRIBUTE)) { result = EcoreUtil.getURI(getEObject()).toString(); - } else if(name.equals(MESSAGE)) { + } else if (name.equals(MESSAGE)) { result = problem.getMessage(); - } else if(problem.getAttributes().containsKey(name)) { + } else if (problem.getAttributes().containsKey(name)) { result = coerce(problem.getAttributes().get(name), defaultValue); } else { result = defaultValue; @@ -179,9 +188,9 @@ public class CDOPapyrusMarker implements IPapyrusMarker { protected String coerce(String value, String defaultValue) { String result; - if(value == null) { + if (value == null) { result = defaultValue; - } else if(isBoolean(value) || isInteger(value)) { + } else if (isBoolean(value) || isInteger(value)) { throw new IllegalArgumentException("Not a string value: " + value); //$NON-NLS-1$ } else { result = value; @@ -190,10 +199,11 @@ public class CDOPapyrusMarker implements IPapyrusMarker { return result; } + @Override public boolean getAttribute(String name, boolean defaultValue) { boolean result; - if(problem.getAttributes().containsKey(name)) { + if (problem.getAttributes().containsKey(name)) { result = coerce(problem.getAttributes().get(name), defaultValue); } else { result = defaultValue; @@ -205,9 +215,9 @@ public class CDOPapyrusMarker implements IPapyrusMarker { protected boolean coerce(String value, boolean defaultValue) { boolean result; - if(value == null) { + if (value == null) { result = defaultValue; - } else if(!isBoolean(value)) { + } else if (!isBoolean(value)) { throw new IllegalArgumentException("Not a boolean value: " + value); //$NON-NLS-1$ } else { result = Boolean.parseBoolean(value); @@ -216,12 +226,13 @@ public class CDOPapyrusMarker implements IPapyrusMarker { return result; } + @Override public int getAttribute(String name, int defaultValue) { int result; - if(name.equals(SEVERITY)) { + if (name.equals(SEVERITY)) { result = getMarkerSeverity(); - } else if(problem.getAttributes().containsKey(name)) { + } else if (problem.getAttributes().containsKey(name)) { result = coerce(problem.getAttributes().get(name), defaultValue); } else { result = defaultValue; @@ -233,9 +244,9 @@ public class CDOPapyrusMarker implements IPapyrusMarker { protected int coerce(String value, int defaultValue) { int result; - if(value == null) { + if (value == null) { result = defaultValue; - } else if(!isInteger(value)) { + } else if (!isInteger(value)) { throw new IllegalArgumentException("Not an integer value: " + value); //$NON-NLS-1$ } else { result = Integer.parseInt(value); @@ -244,6 +255,7 @@ public class CDOPapyrusMarker implements IPapyrusMarker { return result; } + @Override public Map<String, ?> getAttributes() throws CoreException { Map<String, Object> result = coerce(problem.getAttributes()); @@ -257,21 +269,22 @@ public class CDOPapyrusMarker implements IPapyrusMarker { protected Map<String, Object> coerce(EMap<String, String> attributes) { Map<String, Object> result = Maps.newHashMap(); - for(Map.Entry<String, String> next : attributes) { + for (Map.Entry<String, String> next : attributes) { result.put(next.getKey(), coerce(next.getValue())); } return result; } + @Override public void setAttribute(String name, Object value) throws CoreException { - if(name.equals(EValidator.URI_ATTRIBUTE)) { + if (name.equals(EValidator.URI_ATTRIBUTE)) { throw new CoreException(error("Cannot set URI of a CDOPapyrusMarker.")); //$NON-NLS-1$ - } else if(name.equals(SEVERITY)) { - setMarkerSeverity(((Number)value).intValue()); - } else if(name.equals(MESSAGE)) { - problem.setMessage((String)value); - } else if(value == null) { + } else if (name.equals(SEVERITY)) { + setMarkerSeverity(((Number) value).intValue()); + } else if (name.equals(MESSAGE)) { + problem.setMessage((String) value); + } else if (value == null) { problem.getAttributes().removeKey(name); } else { problem.getAttributes().put(name, value.toString()); @@ -279,7 +292,7 @@ public class CDOPapyrusMarker implements IPapyrusMarker { } protected void setMarkerSeverity(int severity) throws CoreException { - switch(severity) { + switch (severity) { case SEVERITY_INFO: problem.setSeverity(ESeverity.INFO); break; @@ -291,60 +304,64 @@ public class CDOPapyrusMarker implements IPapyrusMarker { break; default: throw new CoreException(error("Invalid marker severity: " //$NON-NLS-1$ - + severity)); + + severity)); } } + @Override public void setAttribute(String name, String value) throws CoreException { - if(name.equals(EValidator.URI_ATTRIBUTE)) { + if (name.equals(EValidator.URI_ATTRIBUTE)) { throw new CoreException(error("Cannot set URI of a CDOPapyrusMarker.")); //$NON-NLS-1$ - } else if(name.equals(MESSAGE)) { + } else if (name.equals(MESSAGE)) { problem.setMessage(value); - } else if(name.equals(SEVERITY)) { + } else if (name.equals(SEVERITY)) { throw new CoreException(error("Severity of a CDOPapyrusMarker is not a string.")); //$NON-NLS-1$ - } else if(value == null) { + } else if (value == null) { problem.getAttributes().removeKey(name); } else { problem.getAttributes().put(name, value); } } + @Override public void setAttribute(String name, boolean value) throws CoreException { - if(name.equals(EValidator.URI_ATTRIBUTE)) { + if (name.equals(EValidator.URI_ATTRIBUTE)) { throw new CoreException(error("URI of a CDOPapyrusMarker is not a boolean.")); //$NON-NLS-1$ - } else if(name.equals(SEVERITY)) { + } else if (name.equals(SEVERITY)) { throw new CoreException(error("Severity of a CDOPapyrusMarker is not a boolean.")); //$NON-NLS-1$ - } else if(name.equals(MESSAGE)) { + } else if (name.equals(MESSAGE)) { throw new CoreException(error("Message of a CDOPapyrusMarker is not a boolean.")); //$NON-NLS-1$ } else { problem.getAttributes().put(name, Boolean.toString(value)); } } + @Override public void setAttribute(String name, int value) throws CoreException { - if(name.equals(SEVERITY)) { + if (name.equals(SEVERITY)) { setMarkerSeverity(value); - } else if(name.equals(EValidator.URI_ATTRIBUTE)) { + } else if (name.equals(EValidator.URI_ATTRIBUTE)) { throw new CoreException(error("URI of a CDOPapyrusMarker is not an integer.")); //$NON-NLS-1$ - } else if(name.equals(MESSAGE)) { + } else if (name.equals(MESSAGE)) { throw new CoreException(error("Message of a CDOPapyrusMarker is not an integer.")); //$NON-NLS-1$ } else { problem.getAttributes().put(name, Integer.toString(value)); } } + @Override public void setAttributes(Map<String, ?> attributes) throws CoreException { - for(Map.Entry<String, ?> next : attributes.entrySet()) { + for (Map.Entry<String, ?> next : attributes.entrySet()) { String name = next.getKey(); Object value = next.getValue(); - if(name.equals(EValidator.URI_ATTRIBUTE)) { + if (name.equals(EValidator.URI_ATTRIBUTE)) { throw new CoreException(error("Cannot set URI of a CDOPapyrusMarker.")); //$NON-NLS-1$ - } else if(name.equals(SEVERITY)) { - setMarkerSeverity(((Number)value).intValue()); - } else if(name.equals(MESSAGE)) { - problem.setMessage((String)value); - } else if(value != null) { + } else if (name.equals(SEVERITY)) { + setMarkerSeverity(((Number) value).intValue()); + } else if (name.equals(MESSAGE)) { + problem.setMessage((String) value); + } else if (value != null) { problem.getAttributes().put(name, value.toString()); } } @@ -352,7 +369,7 @@ public class CDOPapyrusMarker implements IPapyrusMarker { @Override public boolean equals(Object obj) { - return (obj instanceof CDOPapyrusMarker) && Objects.equal(((CDOPapyrusMarker)obj).problem, problem); + return (obj instanceof CDOPapyrusMarker) && Objects.equal(((CDOPapyrusMarker) obj).problem, problem); } @Override @@ -365,6 +382,7 @@ public class CDOPapyrusMarker implements IPapyrusMarker { return String.format("CDOPapyrusMarker:%s:%s", getResource(), hashCode()); //$NON-NLS-1$ } + @Override public boolean isSubtypeOf(String type) throws CoreException { return (type == null) || MarkerListenerUtils.isMarkerTypeSubtypeOf(getType(), type); } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/properties/RepositoryPropertiesBlock.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/properties/RepositoryPropertiesBlock.java index b591de06bf8..5713e3f43ba 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/properties/RepositoryPropertiesBlock.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/properties/RepositoryPropertiesBlock.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -136,18 +136,20 @@ public class RepositoryPropertiesBlock } }); protocolCombo - .addSelectionChangedListener(new ISelectionChangedListener() { - - public void selectionChanged(SelectionChangedEvent event) { - if (defaultPort.getSelection()) { - updatePortForProtocol(); - recalculateURL(); + .addSelectionChangedListener(new ISelectionChangedListener() { + + @Override + public void selectionChanged(SelectionChangedEvent event) { + if (defaultPort.getSelection()) { + updatePortForProtocol(); + recalculateURL(); + } } - } - }); + }); ModifyListener modifyListener = new ModifyListener() { + @Override public void modifyText(ModifyEvent e) { recalculateURL(); } @@ -161,7 +163,7 @@ public class RepositoryPropertiesBlock return result; } - + public void dispose() { // pass } @@ -172,24 +174,24 @@ public class RepositoryPropertiesBlock } String name = (repository == null) - ? (createMode - ? Messages.RepositoryPropertiesBlock_6 - : "") //$NON-NLS-1$ - : repository.getName(); + ? (createMode + ? Messages.RepositoryPropertiesBlock_6 + : "") //$NON-NLS-1$ + : repository.getName(); String url = (repository == null) - ? (createMode - ? "tcp://localhost?repositoryName=repo1" //$NON-NLS-1$ - : null) - : repository.getURL(); + ? (createMode + ? "tcp://localhost?repositoryName=repo1" //$NON-NLS-1$ + : null) + : repository.getURL(); URI uri = (url == null) - ? null - : URI.createURI(url); + ? null + : URI.createURI(url); String host = (uri == null) - ? "" //$NON-NLS-1$ - : parseHost(uri); + ? "" //$NON-NLS-1$ + : parseHost(uri); String repo = (uri == null) - ? "" //$NON-NLS-1$ - : parseRepositoryName(uri); + ? "" //$NON-NLS-1$ + : parseRepositoryName(uri); Protocol protocol = Protocol.TCP; String portString = ""; //$NON-NLS-1$ boolean isDefaultPort = true; @@ -233,7 +235,7 @@ public class RepositoryPropertiesBlock Protocol result = Protocol.TCP; IStructuredSelection sel = (IStructuredSelection) protocolCombo - .getSelection(); + .getSelection(); if (!sel.isEmpty()) { result = (Protocol) sel.getFirstElement(); } @@ -282,22 +284,22 @@ public class RepositoryPropertiesBlock url = computeURL(); IPapyrusRepository existing = PapyrusRepositoryManager.INSTANCE - .getRepository(url); + .getRepository(url); if ((existing != null) && (existing != repository)) { setStatus(error(NLS.bind( - Messages.RepositoryPropertiesBlock_16, - existing.getName()))); + Messages.RepositoryPropertiesBlock_16, + existing.getName()))); return; } for (IPapyrusRepository next : PapyrusRepositoryManager.INSTANCE - .getRepositories()) { + .getRepositories()) { if ((next != repository) && Objects.equal(next.getName(), name)) { setStatus(warning(NLS - .bind( - Messages.RepositoryPropertiesBlock_17, - next.getName()))); + .bind( + Messages.RepositoryPropertiesBlock_17, + next.getName()))); return; } } @@ -331,8 +333,8 @@ public class RepositoryPropertiesBlock private int parsePort(URI uri) { String result = uri.port(); return (result == null) - ? -1 - : Integer.parseInt(result); + ? -1 + : Integer.parseInt(result); } private String parseHost(URI uri) { @@ -367,6 +369,7 @@ public class RepositoryPropertiesBlock super(RepositoryPropertiesBlock.this); } + @Override public IStatus getStatus() { return status; } @@ -427,11 +430,12 @@ public class RepositoryPropertiesBlock public static class StatusChangedEventAdapter implements IListener { + @Override public void notifyEvent(IEvent event) { if (event instanceof IStatusChangedEvent) { handleStatusChanged( - (RepositoryPropertiesBlock) event.getSource(), - ((IStatusChangedEvent) event).getStatus()); + (RepositoryPropertiesBlock) event.getSource(), + ((IStatusChangedEvent) event).getStatus()); } else { handleOtherEvent(event); } @@ -458,23 +462,23 @@ public class RepositoryPropertiesBlock int messageSeverity; switch (newStatus.getSeverity()) { - case IStatus.OK : - messageSeverity = IMessageProvider.NONE; - break; - case IStatus.INFO : - messageSeverity = IMessageProvider.INFORMATION; - break; - case IStatus.WARNING : - messageSeverity = IMessageProvider.WARNING; - break; - default : - messageSeverity = IMessageProvider.ERROR; - break; + case IStatus.OK: + messageSeverity = IMessageProvider.NONE; + break; + case IStatus.INFO: + messageSeverity = IMessageProvider.INFORMATION; + break; + case IStatus.WARNING: + messageSeverity = IMessageProvider.WARNING; + break; + default: + messageSeverity = IMessageProvider.ERROR; + break; } handleMessageChange(newStatus.isOK() - ? null - : newStatus.getMessage(), messageSeverity); + ? null + : newStatus.getMessage(), messageSeverity); } protected void handleMessageChange(String message, int messageSeverity) { diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/properties/RepositoryPropertyPage.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/properties/RepositoryPropertyPage.java index 5de60f1feac..3f4a965ce49 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/properties/RepositoryPropertyPage.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/properties/RepositoryPropertyPage.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -42,7 +42,7 @@ public class RepositoryPropertyPage private static final String MESSAGE = Messages.RepositoryPropertyPage_0; private RepositoryPropertiesBlock block; - + private Button forgetCredsButton; @Override @@ -51,26 +51,26 @@ public class RepositoryPropertyPage Composite result = new Composite(parent, SWT.NONE); result.setLayout(new GridLayout(1, false)); - + block = new RepositoryPropertiesBlock(getRepository()); block.createControl(result); block - .addListener(new RepositoryPropertiesBlock.StatusChangedMessageProviderAdapter() { + .addListener(new RepositoryPropertiesBlock.StatusChangedMessageProviderAdapter() { - @Override - protected void handleMessageChange(String message, - int messageSeverity) { + @Override + protected void handleMessageChange(String message, + int messageSeverity) { - setValid(messageSeverity < IMessageProvider.ERROR); + setValid(messageSeverity < IMessageProvider.ERROR); - if (message == null) { - setMessage(MESSAGE); - } else { - setMessage(message, messageSeverity); + if (message == null) { + setMessage(MESSAGE); + } else { + setMessage(message, messageSeverity); + } } - } - }); - + }); + forgetCredsButton = new Button(result, SWT.PUSH); forgetCredsButton.setText(Messages.RepositoryPropertyPage_1); forgetCredsButton.addSelectionListener(new SelectionAdapter() { @@ -86,8 +86,8 @@ public class RepositoryPropertyPage protected IPapyrusRepository getRepository() { IAdaptable element = getElement(); IPapyrusRepository result = (element instanceof IPapyrusRepository) - ? (IPapyrusRepository) element - : (IPapyrusRepository) element.getAdapter(IPapyrusRepository.class); + ? (IPapyrusRepository) element + : (IPapyrusRepository) element.getAdapter(IPapyrusRepository.class); return result; } @@ -102,12 +102,12 @@ public class RepositoryPropertyPage IPapyrusRepository repository = getRepository(); if (!repository.isConnected() - || Objects.equal(repository.getURL(), block.getURL()) - || MessageDialog - .openQuestion( - getShell(), - Messages.RepositoryPropertyPage_2, - Messages.RepositoryPropertyPage_3)) { + || Objects.equal(repository.getURL(), block.getURL()) + || MessageDialog + .openQuestion( + getShell(), + Messages.RepositoryPropertyPage_2, + Messages.RepositoryPropertyPage_3)) { updateRepository(repository); @@ -125,7 +125,7 @@ public class RepositoryPropertyPage private void updateRepository(IPapyrusRepository repository) { boolean reconnect = repository.isConnected() - && !Objects.equal(repository.getURL(), block.getURL()); + && !Objects.equal(repository.getURL(), block.getURL()); IInternalPapyrusRepositoryManager mgr = PapyrusRepositoryManager.INSTANCE; String url = block.getURL(); @@ -147,7 +147,7 @@ public class RepositoryPropertyPage } catch (CommitException e) { StatusAdapter adapter = new StatusAdapter(e.getStatus()); adapter.setProperty(IStatusAdapterConstants.TITLE_PROPERTY, - Messages.RepositoryPropertyPage_4); + Messages.RepositoryPropertyPage_4); StatusManager.getManager().handle(adapter, StatusManager.SHOW); } } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/providers/CDOResourceLabelProvider.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/providers/CDOResourceLabelProvider.java index 98d193afd45..1a94d544ba7 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/providers/CDOResourceLabelProvider.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/providers/CDOResourceLabelProvider.java @@ -1,6 +1,6 @@ /***************************************************************************** * Copyright (c) 2013, 2014 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 @@ -9,7 +9,7 @@ * Contributors: * CEA LIST - Initial API and implementation * Christian W. Damus (CEA) - adapt to source-incompatible API change in CDO Luna M6 - * + * *****************************************************************************/ package org.eclipse.papyrus.cdo.internal.ui.providers; @@ -53,7 +53,7 @@ public class CDOResourceLabelProvider extends LabelProvider implements IFiltered @Override public boolean accept(Object element) { - return (element instanceof CDOResourceNode) || (element instanceof URI) && CDOUtils.isCDOURI((URI)element); + return (element instanceof CDOResourceNode) || (element instanceof URI) && CDOUtils.isCDOURI((URI) element); } @Override @@ -72,15 +72,15 @@ public class CDOResourceLabelProvider extends LabelProvider implements IFiltered public String getText(Object element) { String result = null; - URI uri = (element instanceof URI) ? (URI)element : ((CDOResourceNode)element).getURI(); + URI uri = (element instanceof URI) ? (URI) element : ((CDOResourceNode) element).getURI(); - if(uri != null) { - String nodeType = element instanceof CDOResourceNode ? nodeTypeSwitch.doSwitch((CDOResource)element) : Messages.CDOResLabels_node; + if (uri != null) { + String nodeType = element instanceof CDOResourceNode ? nodeTypeSwitch.doSwitch((CDOResource) element) : Messages.CDOResLabels_node; String path = CDOURIUtil.extractResourcePath(uri); IPapyrusRepository repo = PapyrusRepositoryManager.INSTANCE.getRepositoryForURI(uri); String repoName = (repo == null) ? Messages.CDOResLabels_unknown : repo.getName(); - result = NLS.bind(Messages.CDOResLabels_pattern, new Object[]{ nodeType, path, repoName }); + result = NLS.bind(Messages.CDOResLabels_pattern, new Object[] { nodeType, path, repoName }); } return result; diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/providers/ModelImportNodeLabelProvider.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/providers/ModelImportNodeLabelProvider.java index 1cfc33a2f90..a8ad07a9e24 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/providers/ModelImportNodeLabelProvider.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/providers/ModelImportNodeLabelProvider.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -36,11 +36,12 @@ public class ModelImportNodeLabelProvider implements ILabelProvider { super(); } + @Override public Image getImage(Object element) { Image result = null; IModelTransferNode model = getModelImportNode(element); - if(model != null) { + if (model != null) { result = delegate.getImage(getWorkbenchObject(model)); } @@ -48,17 +49,18 @@ public class ModelImportNodeLabelProvider implements ILabelProvider { } protected IModelTransferNode getModelImportNode(Object element) { - return (element instanceof IModelTransferNode) ? (IModelTransferNode)element : null; + return (element instanceof IModelTransferNode) ? (IModelTransferNode) element : null; } + @Override public String getText(Object element) { String result = null; IModelTransferNode model = getModelImportNode(element); - if(model != null) { + if (model != null) { result = delegate.getText(getWorkbenchObject(model)); - if(result == null) { + if (result == null) { result = model.getPrimaryResourceURI().trimFileExtension().lastSegment(); } } @@ -66,18 +68,22 @@ public class ModelImportNodeLabelProvider implements ILabelProvider { return result; } + @Override public boolean isLabelProperty(Object element, String property) { return false; } + @Override public void dispose() { delegate.dispose(); } + @Override public void addListener(ILabelProviderListener listener) { delegate.addListener(listener); } + @Override public void removeListener(ILabelProviderListener listener) { delegate.removeListener(listener); } @@ -87,15 +93,15 @@ public class ModelImportNodeLabelProvider implements ILabelProvider { URI uri = element.getPrimaryResourceURI(); - if(CDOUtils.isCDOURI(uri)) { + if (CDOUtils.isCDOURI(uri)) { // fake a platform resource URI so that we can create an IPapyrusFile uri = URI.createPlatformResourceURI(uri.authority() + uri.path(), true); } - if(uri.isPlatformResource()) { + if (uri.isPlatformResource()) { IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(uri.toPlatformString(true))); - if((file != null) && getPapyrusModelFactory().isDi(file)) { + if ((file != null) && getPapyrusModelFactory().isDi(file)) { result = getPapyrusModelFactory().createIPapyrusFile(file); } else { result = file; diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/providers/PapyrusElementLabelProvider.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/providers/PapyrusElementLabelProvider.java index ed5a34542df..548ecc72505 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/providers/PapyrusElementLabelProvider.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/providers/PapyrusElementLabelProvider.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -24,14 +24,14 @@ public class PapyrusElementLabelProvider @Override public Image getImage(Object element) { return (element instanceof IPapyrusElement) - ? ((IPapyrusElement) element).getImage() - : null; + ? ((IPapyrusElement) element).getImage() + : null; } @Override public String getText(Object element) { return (element instanceof IPapyrusElement) - ? ((IPapyrusElement) element).getText() - : null; + ? ((IPapyrusElement) element).getText() + : null; } }
\ No newline at end of file diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/util/CompositeLabelProvider.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/util/CompositeLabelProvider.java index a6fe97cb758..2347364fab1 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/util/CompositeLabelProvider.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/util/CompositeLabelProvider.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -43,18 +43,21 @@ public class CompositeLabelProvider Iterables.addAll(this.labelProviders, providers); } + @Override public void addListener(ILabelProviderListener listener) { for (ILabelProvider next : labelProviders) { next.addListener(listener); } } + @Override public void removeListener(ILabelProviderListener listener) { for (ILabelProvider next : labelProviders) { next.removeListener(listener); } } + @Override public void dispose() { for (ILabelProvider next : labelProviders) { next.dispose(); @@ -63,6 +66,7 @@ public class CompositeLabelProvider labelProviders.clear(); } + @Override public boolean isLabelProperty(Object element, String property) { for (ILabelProvider next : labelProviders) { if (next.isLabelProperty(element, property)) { @@ -73,6 +77,7 @@ public class CompositeLabelProvider return false; } + @Override public Image getImage(Object element) { Image result = null; @@ -87,6 +92,7 @@ public class CompositeLabelProvider return result; } + @Override public String getText(Object element) { String result = null; diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/util/DialogCredentialsProviderFactory.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/util/DialogCredentialsProviderFactory.java index d8f83e6c9de..21f634d3297 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/util/DialogCredentialsProviderFactory.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/util/DialogCredentialsProviderFactory.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -55,7 +55,7 @@ public class DialogCredentialsProviderFactory implements ICredentialsProviderFac @Override public void windowClosed(IWorkbenchWindow window) { - if(activeWindow == window) { + if (activeWindow == window) { activeWindow = null; } } @@ -112,7 +112,7 @@ public class DialogCredentialsProviderFactory implements ICredentialsProviderFac String username = repository.getUsername(); String password = repository.getPassword(); - if(!Strings.isNullOrEmpty(username) && !Strings.isNullOrEmpty(password)) { + if (!Strings.isNullOrEmpty(username) && !Strings.isNullOrEmpty(password)) { // use stored creds result = new PasswordCredentials(username, password.toCharArray()); } else { @@ -137,7 +137,7 @@ public class DialogCredentialsProviderFactory implements ICredentialsProviderFac IPasswordCredentials result = null; RepositoryCredentialsDialog dlg = new RepositoryCredentialsDialog(getCurrentShell(), repository); - if(dlg.open() == Window.OK) { + if (dlg.open() == Window.OK) { result = dlg.getCredentials(); } @@ -171,7 +171,7 @@ public class DialogCredentialsProviderFactory implements ICredentialsProviderFac final Shell parentShell = getCurrentShell(); - if(parentShell.getDisplay() == Display.getCurrent()) { + if (parentShell.getDisplay() == Display.getCurrent()) { try { result[0] = callable.call(); } catch (Exception e) { @@ -193,7 +193,7 @@ public class DialogCredentialsProviderFactory implements ICredentialsProviderFac // this is safe according to the 'callable' type @SuppressWarnings("unchecked") - T resultAsT = (T)result[0]; + T resultAsT = (T) result[0]; return resultAsT; } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/util/UISafeProgressMonitor.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/util/UISafeProgressMonitor.java index d3d0b2f5b2f..5ed285f9c26 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/util/UISafeProgressMonitor.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/util/UISafeProgressMonitor.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -29,36 +29,42 @@ public class UISafeProgressMonitor implements IProgressMonitor { } private void exec(Runnable runnable) { - if(Display.getCurrent() == display) { + if (Display.getCurrent() == display) { runnable.run(); } else { display.syncExec(runnable); } } + @Override public void beginTask(final String name, final int totalWork) { exec(new Runnable() { + @Override public void run() { delegate.beginTask(name, totalWork); } }); } + @Override public void internalWorked(final double work) { exec(new Runnable() { + @Override public void run() { delegate.internalWorked(work); } }); } + @Override public boolean isCanceled() { final boolean[] result = { false }; exec(new Runnable() { + @Override public void run() { result[0] = delegate.isCanceled(); } @@ -67,45 +73,55 @@ public class UISafeProgressMonitor implements IProgressMonitor { return result[0]; } + @Override public void setCanceled(final boolean value) { exec(new Runnable() { + @Override public void run() { delegate.setCanceled(value); } }); } + @Override public void setTaskName(final String name) { exec(new Runnable() { + @Override public void run() { delegate.setTaskName(name); } }); } + @Override public void subTask(final String name) { exec(new Runnable() { + @Override public void run() { delegate.subTask(name); } }); } + @Override public void worked(final int work) { exec(new Runnable() { + @Override public void run() { delegate.worked(work); } }); } + @Override public void done() { exec(new Runnable() { + @Override public void run() { done(); } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/util/UIUtil.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/util/UIUtil.java index 801dde42fd1..fac54efa34f 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/util/UIUtil.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/util/UIUtil.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -44,7 +44,7 @@ public class UIUtil { * this method is useful in code that is on the UI thread but needs to * ensure that some block runs later, after other events have been * processed. - * + * * @param runnable * a block of code to run later */ @@ -55,7 +55,7 @@ public class UIUtil { /** * Posts a callable that needs access to the UI to run asynchronously on the * specified {@code display} thread. - * + * * @param display * the display on which to post a computation asynchronously * @param callable @@ -73,7 +73,7 @@ public class UIUtil { * the current thread is the UI thread, then the result will be available * immediately. Otherwise, the {@code callable} will be invoked * asynchronously and the result will be available some time later. - * + * * @param callable * a computation to run on the UI thread * @return the future result of the {@code callable} @@ -93,14 +93,12 @@ public class UIUtil { /** * <p> - * Queries whether the current thread is the UI thread and, if not, posts an - * runnable to re-dispatch the calling method asynchronously on the UI - * thread. + * Queries whether the current thread is the UI thread and, if not, posts an runnable to re-dispatch the calling method asynchronously on the UI thread. * </p> * <p> * The intended usage pattern is thus: * </p> - * + * * <pre> * public void doSomethingToTheUI(Object arg1, String arg2) { * if (UIUtil.ensureUIThread(this, arg1, arg2) { @@ -109,15 +107,14 @@ public class UIUtil { * } * } * </pre> - * + * * @param receiver * the receiver of the method to be (potentially) re-dispatched. - * This is the object calling the {@code ensureUIThread()} - * utility + * This is the object calling the {@code ensureUIThread()} utility * @param arguments * the arguments passed in the method invocation to be * re-dispatched - * + * * @return {@code true} if the current thread is the UI thread and the * calling method may proceed; {@code false} if the method * invocation was re-dispatched asynchronously and the calling @@ -136,7 +133,7 @@ public class UIUtil { for (int i = 0; i < stack.length; i++) { StackTraceElement next = stack[i]; if (UIUtil.class.getName().equals(next.getClassName()) - && "ensureUIThread".equals(next.getMethodName())) { //$NON-NLS-1$ + && "ensureUIThread".equals(next.getMethodName())) { //$NON-NLS-1$ callingMethodName = stack[i + 1].getMethodName(); break; @@ -148,7 +145,7 @@ public class UIUtil { } final Method method = findMethod(receiver.getClass(), - callingMethodName, arguments); + callingMethodName, arguments); if (method == null) { throw new IllegalStateException("Could not find calling method"); //$NON-NLS-1$ } @@ -157,6 +154,7 @@ public class UIUtil { display.asyncExec(new Runnable() { + @Override public void run() { try { method.invoke(receiver, arguments); @@ -177,19 +175,19 @@ public class UIUtil { Class<?>[] actual = new Class<?>[arguments.length]; for (int i = 0; i < arguments.length; i++) { actual[i] = (arguments[i] == null) - ? null - : arguments[i].getClass(); + ? null + : arguments[i].getClass(); } Method[] declared = owner.getDeclaredMethods(); - out : for (int i = 0; i < declared.length; i++) { + out: for (int i = 0; i < declared.length; i++) { Method next = declared[i]; if (name.equals(next.getName())) { Class<?>[] parameters = next.getParameterTypes(); for (int j = 0; j < parameters.length; j++) { if ((actual[j] != null) - && !parameters[j].isAssignableFrom(actual[j])) { + && !parameters[j].isAssignableFrom(actual[j])) { continue out; } } @@ -211,6 +209,7 @@ public class UIUtil { static final UISafeExecutor INSTANCE = new UISafeExecutor(); + @Override public void execute(Runnable command) { Display workbenchDisplay = PlatformUI.getWorkbench().getDisplay(); if (Display.getCurrent() == workbenchDisplay) { diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/views/DIModel.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/views/DIModel.java index ad205cc4140..2098ba3ddbd 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/views/DIModel.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/views/DIModel.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -44,9 +44,9 @@ public class DIModel extends PlatformObject implements Adapter { this.resource = resource; // ensure that I am the only adapter - for(Iterator<Adapter> iter = resource.eAdapters().iterator(); iter.hasNext();) { + for (Iterator<Adapter> iter = resource.eAdapters().iterator(); iter.hasNext();) { - if(iter.next() instanceof DIModel) { + if (iter.next() instanceof DIModel) { iter.remove(); } } @@ -58,9 +58,9 @@ public class DIModel extends PlatformObject implements Adapter { } public static DIModel getInstance(CDOResource resource, boolean create) { - DIModel result = (DIModel)EcoreUtil.getExistingAdapter(resource, DIModel.class); + DIModel result = (DIModel) EcoreUtil.getExistingAdapter(resource, DIModel.class); - if((result == null) && create) { + if ((result == null) && create) { result = new DIModel(resource); } @@ -70,7 +70,7 @@ public class DIModel extends PlatformObject implements Adapter { @Override @SuppressWarnings("rawtypes") public Object getAdapter(Class adapter) { - if((adapter == CDOResourceNode.class) || (adapter == CDOResource.class) || (adapter == CDOObject.class) || (adapter == EObject.class)) { + if ((adapter == CDOResourceNode.class) || (adapter == CDOResource.class) || (adapter == CDOObject.class) || (adapter == EObject.class)) { return getResource(); } @@ -89,22 +89,22 @@ public class DIModel extends PlatformObject implements Adapter { List<CDOResource> result = Lists.newArrayListWithExpectedSize(3); String name = getName(); - if(name != null) { + if (name != null) { Collection<? extends EObject> nodes; CDOResourceFolder folder = getResource().getFolder(); - if(folder != null) { + if (folder != null) { nodes = folder.getNodes(); } else { CDOResource root = getResource().cdoResource(); - if((root != null) && root.isRoot()) { + if ((root != null) && root.isRoot()) { nodes = root.getContents(); } else { nodes = Collections.emptyList(); } } - for(CDOResource next : Iterables.filter(nodes, CDOResource.class)) { - if(name.equals(next.getURI().trimFileExtension().lastSegment())) { + for (CDOResource next : Iterables.filter(nodes, CDOResource.class)) { + if (name.equals(next.getURI().trimFileExtension().lastSegment())) { result.add(next); } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/views/DIResourceQuery.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/views/DIResourceQuery.java index 1564a708d52..142e71f2d7f 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/views/DIResourceQuery.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/views/DIResourceQuery.java @@ -1,6 +1,6 @@ /***************************************************************************** * Copyright (c) 2013, 2014 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 @@ -9,7 +9,7 @@ * Contributors: * CEA LIST - Initial API and implementation * Christian W. Damus (CEA) - bug 429242 - * + * *****************************************************************************/ package org.eclipse.papyrus.cdo.internal.ui.views; @@ -82,15 +82,15 @@ public class DIResourceQuery { // Query for all SashWindowsMngr instances (legacy DI models, definitely accurate) and // all resources named *.di that are empty (new-style DI models) this.legacyQuery = view.createQuery("ocl", //$NON-NLS-1$ - "SashWindowsMngr.allInstances()->collect(oclAsType(ecore::EObject).eResource()).oclAsType(eresource::CDOResource)->union(" + //$NON-NLS-1$ - "eresource::CDOResource.allInstances()->select(uRI.toString().endsWith('.di') and contents->isEmpty()))", //$NON-NLS-1$ - DiPackage.Literals.SASH_MODEL); + "SashWindowsMngr.allInstances()->collect(oclAsType(ecore::EObject).eResource()).oclAsType(eresource::CDOResource)->union(" + //$NON-NLS-1$ + "eresource::CDOResource.allInstances()->select(uRI.toString().endsWith('.di') and contents->isEmpty()))", //$NON-NLS-1$ + DiPackage.Literals.SASH_MODEL); // Query for new-style models only, used when the repository does not know the DiPackage // (because it contains no legacy models) this.query = view.createQuery("ocl", //$NON-NLS-1$ - "eresource::CDOResource.allInstances()->select(uRI.toString().endsWith('.di') and contents->isEmpty())", //$NON-NLS-1$ - EresourcePackage.Literals.CDO_RESOURCE); + "eresource::CDOResource.allInstances()->select(uRI.toString().endsWith('.di') and contents->isEmpty())", //$NON-NLS-1$ + EresourcePackage.Literals.CDO_RESOURCE); view.addListener(cdoViewListener); viewer.getControl().addDisposeListener(createViewerDisposeListener()); @@ -102,9 +102,9 @@ public class DIResourceQuery { DIResourceQuery result; - synchronized(instances) { + synchronized (instances) { result = instances.get(view); - if(result == null) { + if (result == null) { result = new DIResourceQuery(viewer, view); instances.put(view, result); } @@ -115,21 +115,21 @@ public class DIResourceQuery { /** * Wait for the current in-progress query on the specified {@code view} to finish, if any. - * + * * @param view - * a view which we are or may be querying for DI resources + * a view which we are or may be querying for DI resources * @param timeout - * a positive timeout + * a positive timeout * @param unit - * the time unit for the {@code timeout} - * + * the time unit for the {@code timeout} + * * @return {@code true} on successful wait (if required); {@code false} on time-out - * + * * @throws InterruptedException - * if the wait is interrupted + * if the wait is interrupted */ public static boolean waitFor(CDOView view, long timeout, TimeUnit unit) throws InterruptedException { - if(timeout <= 0) { + if (timeout <= 0) { throw new IllegalArgumentException("Non-positive timeout"); //$NON-NLS-1$ } @@ -137,11 +137,11 @@ public class DIResourceQuery { DIResourceQuery query; - synchronized(instances) { + synchronized (instances) { query = instances.get(view); } - if(query == null) { + if (query == null) { // have nothing to wait for result = true; } else { @@ -154,12 +154,12 @@ public class DIResourceQuery { public static Set<CDOResource> getDIResources(CDOView view) { DIResourceQuery query; - synchronized(instances) { + synchronized (instances) { query = instances.get(view); } Set<CDOResource> result; - if(query == null) { + if (query == null) { result = Collections.emptySet(); } else { result = query.getDIResources(); @@ -176,14 +176,14 @@ public class DIResourceQuery { CDOResource result = null; URI uri = resource.getURI(); - if(DI_FILE_EXTENSION.equals(uri.fileExtension())) { + if (DI_FILE_EXTENSION.equals(uri.fileExtension())) { // it *is* a DI resource result = resource; } else { uri = uri.trimFileExtension().appendFileExtension(DI_FILE_EXTENSION); - for(CDOResource next : getDIResources(resource.cdoView())) { - if(uri.equals(next.getURI())) { + for (CDOResource next : getDIResources(resource.cdoView())) { + if (uri.equals(next.getURI())) { result = next; break; } @@ -198,7 +198,7 @@ public class DIResourceQuery { } boolean hasLegacyModels() { - if(hasLegacyModels == null) { + if (hasLegacyModels == null) { hasLegacyModels = query.getView().getSession().getPackageRegistry().getPackageInfo(DiPackage.eINSTANCE) != null; } @@ -217,7 +217,7 @@ public class DIResourceQuery { } private void dispose() { - synchronized(instances) { + synchronized (instances) { CDOView view = query.getView(); view.removeListener(cdoViewListener); instances.remove(view); @@ -229,12 +229,12 @@ public class DIResourceQuery { @Override public void notifyEvent(IEvent event) { - if(event instanceof ILifecycleEvent) { - ILifecycleEvent lifecycleEvent = (ILifecycleEvent)event; - if(lifecycleEvent.getKind() == Kind.DEACTIVATED) { + if (event instanceof ILifecycleEvent) { + ILifecycleEvent lifecycleEvent = (ILifecycleEvent) event; + if (lifecycleEvent.getKind() == Kind.DEACTIVATED) { dispose(); } - } else if(event instanceof CDOViewInvalidationEvent) { + } else if (event instanceof CDOViewInvalidationEvent) { // if my view is invalidated, then some folder or resource // that I am showing has changed. Run the query again and // update asynchronously @@ -278,10 +278,10 @@ public class DIResourceQuery { // don't use an iterator because it won't be able to advance // past a resource proxy that cannot be resolved - for(int i = 0; i < rawResult.size(); i++) { + for (int i = 0; i < rawResult.size(); i++) { try { CDOResource next = rawResult.get(i); - if(isContained(next)) { + if (isContained(next)) { resultBuilder.add(next); } } catch (Exception e) { @@ -294,14 +294,14 @@ public class DIResourceQuery { diResources.set(ImmutableSet.copyOf(result)); - if((viewer != null) && (viewer.getControl() != null)) { + if ((viewer != null) && (viewer.getControl() != null)) { Display display = viewer.getControl().getDisplay(); - if(display != null) { + if (display != null) { display.asyncExec(new Runnable() { @Override public void run() { - if((viewer != null) && (viewer.getControl() != null) && !viewer.getControl().isDisposed()) { + if ((viewer != null) && (viewer.getControl() != null) && !viewer.getControl().isDisposed()) { refresh(); } } @@ -318,14 +318,14 @@ public class DIResourceQuery { boolean result = false; CDOResourceFolder folder = resource.getFolder(); - if(folder != null) { + if (folder != null) { // if we don't have read permission on the folder, then we shouldn't attempt to show any contents - if(folder.cdoPermission().isReadable()) { + if (folder.cdoPermission().isReadable()) { result = folder.getNodes().contains(resource); } } else { CDOResource root = resource.cdoResource(); - if((root != null) && root.isRoot()) { + if ((root != null) && root.isRoot()) { result = root.getContents().contains(resource); } } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/views/ItemProviderFilterRegistry.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/views/ItemProviderFilterRegistry.java index c8ec3c1ed12..83434f3b438 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/views/ItemProviderFilterRegistry.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/views/ItemProviderFilterRegistry.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -66,14 +66,15 @@ class ItemProviderFilterRegistry { this.labelProvider = labelProvider; } + @Override public boolean apply(Object input) { boolean result = true; - if(!filters.isEmpty()) { + if (!filters.isEmpty()) { labelWrapper.object = input; labelWrapper.label = labelProvider.getText(input); - for(Iterator<Filter> iter = filters.values().iterator(); result && iter.hasNext();) { + for (Iterator<Filter> iter = filters.values().iterator(); result && iter.hasNext();) { result = !iter.next().apply(labelWrapper); } } @@ -118,6 +119,7 @@ class ItemProviderFilterRegistry { this.pattern = Pattern.compile(pattern); } + @Override public boolean apply(LabelWrapper input) { return (input.label != null) && pattern.matcher(input.label).find(); } @@ -159,6 +161,7 @@ class ItemProviderFilterRegistry { this.filter = filter; } + @Override public boolean apply(LabelWrapper input) { try { return enabled && filter.get().filter(input.object); @@ -182,6 +185,7 @@ class ItemProviderFilterRegistry { this.predicate = predicate; } + @Override public boolean apply(LabelWrapper input) { try { return enabled && predicate.get().apply(input.object); @@ -231,31 +235,31 @@ class ItemProviderFilterRegistry { final String name = config.getName(); - if(E_ITEM_PROVIDER_FILTER.equals(name)) { + if (E_ITEM_PROVIDER_FILTER.equals(name)) { String id = config.getAttribute(A_ID); - if(id == null) { + if (id == null) { result = false; logMissingAttribute(config, A_ID); currentID = null; currentConfig = null; } else { - if(add) { - if(currentID != null) { + if (add) { + if (currentID != null) { // haven't created the previous filter logError(currentConfig, String.format("Missing specification of filter %s.", currentID)); //$NON-NLS-1$ } currentID = id; currentConfig = config; - } else if(id != null) { + } else if (id != null) { removeFilter(id); } } - } else if(add) { // don't need to process deletion of filter specifications, only filters - if(currentID == null) { + } else if (add) { // don't need to process deletion of filter specifications, only filters + if (currentID == null) { result = false; logError(config, String.format("Too many filter specifications.")); //$NON-NLS-1$ - } else if(filters.containsKey(currentID)) { + } else if (filters.containsKey(currentID)) { result = false; logError(config, String.format("Duplicate filter ID \"%s\". The duplicate is ignored.", currentID)); //$NON-NLS-1$ } else { @@ -275,11 +279,11 @@ class ItemProviderFilterRegistry { final String name = config.getName(); - if(E_LABEL_PATTERN.equals(name)) { + if (E_LABEL_PATTERN.equals(name)) { result = createLabelPatternFilter(config); - } else if(E_ELEMENT_FILTER.equals(name)) { + } else if (E_ELEMENT_FILTER.equals(name)) { result = createElementFilterFilter(config); - } else if(E_PREDICATE.equals(config)) { + } else if (E_PREDICATE.equals(config)) { result = createPredicateFilter(config); } @@ -296,14 +300,14 @@ class ItemProviderFilterRegistry { boolean result = true; String pattern = config.getAttribute(A_PATTERN); - if(pattern == null) { + if (pattern == null) { logMissingAttribute(config, A_PATTERN); result = false; } else { Class<?> objectClass = null; String className = config.getAttribute(A_OBJECT_CLASS); - if(className != null) { + if (className != null) { String bundleID = config.getContributor().getName(); try { @@ -315,14 +319,14 @@ class ItemProviderFilterRegistry { } } - if(result) { + if (result) { try { - if(objectClass == null) { + if (objectClass == null) { addFilter(new LabelPatternFilter(currentID, pattern)); } else { boolean adapt = false; String adaptAttr = config.getAttribute(A_ADAPT); - if(adaptAttr != null) { + if (adaptAttr != null) { adapt = Boolean.parseBoolean(adaptAttr); } @@ -345,18 +349,18 @@ class ItemProviderFilterRegistry { String className = config.getAttribute(A_CLASS); String supplierClassName = config.getAttribute(A_SUPPLIER_CLASS); - if((className == null) && (supplierClassName == null)) { + if ((className == null) && (supplierClassName == null)) { result = false; logMissingAttribute(config, A_CLASS); - } else if(className != null) { + } else if (className != null) { try { Object extension = config.createExecutableExtension(A_CLASS); - if(!(extension instanceof IElementFilter)) { + if (!(extension instanceof IElementFilter)) { result = false; logError(config, String.format("Extension is not an IElementFilter: %s", extension.getClass().getName())); //$NON-NLS-1$ } - addFilter(new ElementFilterFilter(currentID, Suppliers.ofInstance((IElementFilter)extension))); + addFilter(new ElementFilterFilter(currentID, Suppliers.ofInstance((IElementFilter) extension))); } catch (CoreException e) { result = false; Activator.log.error(e); @@ -364,13 +368,13 @@ class ItemProviderFilterRegistry { } else { try { Object extension = config.createExecutableExtension(A_CLASS); - if(!(extension instanceof Supplier<?>)) { + if (!(extension instanceof Supplier<?>)) { result = false; logError(config, String.format("Extension is not a Supplier<? extends IElementFilter>: %s", extension.getClass().getName())); //$NON-NLS-1$ } @SuppressWarnings("unchecked") - Supplier<? extends IElementFilter> supplier = (Supplier<? extends IElementFilter>)extension; + Supplier<? extends IElementFilter> supplier = (Supplier<? extends IElementFilter>) extension; addFilter(new ElementFilterFilter(currentID, Suppliers.memoize(supplier))); } catch (CoreException e) { result = false; @@ -387,19 +391,19 @@ class ItemProviderFilterRegistry { String className = config.getAttribute(A_CLASS); String supplierClassName = config.getAttribute(A_SUPPLIER_CLASS); - if((className == null) && (supplierClassName == null)) { + if ((className == null) && (supplierClassName == null)) { result = false; logMissingAttribute(config, A_CLASS); - } else if(className != null) { + } else if (className != null) { try { Object extension = config.createExecutableExtension(A_CLASS); - if(!(extension instanceof Predicate<?>)) { + if (!(extension instanceof Predicate<?>)) { result = false; logError(config, String.format("Extension is not a Predicate<Object>: %s", extension.getClass().getName())); //$NON-NLS-1$ } @SuppressWarnings("unchecked") - Predicate<Object> predicate = (Predicate<Object>)extension; + Predicate<Object> predicate = (Predicate<Object>) extension; addFilter(new PredicateFilter(currentID, Suppliers.ofInstance(predicate))); } catch (CoreException e) { result = false; @@ -408,13 +412,13 @@ class ItemProviderFilterRegistry { } else { try { Object extension = config.createExecutableExtension(A_CLASS); - if(!(extension instanceof Supplier<?>)) { + if (!(extension instanceof Supplier<?>)) { result = false; logError(config, String.format("Extension is not a Supplier<? extends Predicate<Object>>: %s", extension.getClass().getName())); //$NON-NLS-1$ } @SuppressWarnings("unchecked") - Supplier<? extends Predicate<Object>> supplier = (Supplier<? extends Predicate<Object>>)extension; + Supplier<? extends Predicate<Object>> supplier = (Supplier<? extends Predicate<Object>>) extension; addFilter(new PredicateFilter(currentID, Suppliers.memoize(supplier))); } catch (CoreException e) { result = false; diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/views/LinkingHelper.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/views/LinkingHelper.java index ff70207f70f..eec4a7bc073 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/views/LinkingHelper.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/views/LinkingHelper.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -67,10 +67,10 @@ class LinkingHelper { } public void dispose() { - if(linkingPartListener != null) { + if (linkingPartListener != null) { site.getPage().removePartListener(linkingPartListener); } - if(linkingSelectionListener != null) { + if (linkingSelectionListener != null) { viewer.removeSelectionChangedListener(linkingSelectionListener); } } @@ -80,12 +80,12 @@ class LinkingHelper { } public void setLinkWithEditor(boolean link) { - if(link != linkWithEditor) { + if (link != linkWithEditor) { this.linkWithEditor = link; - if(link) { + if (link) { IWorkbenchPart active = site.getPage().getActivePart(); - if((active != null) && (active.getSite() == site)) { + if ((active != null) && (active.getSite() == site)) { // select the current model editor (if any) selectEditor(); } else { @@ -105,27 +105,27 @@ class LinkingHelper { URI uri = null; DIModel model = getDIModelFromSelection(); - if(model != null) { + if (model != null) { uri = model.getResource().getURI(); } else { // just some other resource, then? CDOResourceLeaf resource = getCDOResourceFromSelection(); - if(resource != null) { + if (resource != null) { uri = resource.getURI(); } } - if(uri != null) { - for(IEditorReference next : site.getPage().getEditorReferences()) { + if (uri != null) { + for (IEditorReference next : site.getPage().getEditorReferences()) { try { IEditorInput input = next.getEditorInput(); URI editorURI = EditorUtils.getResourceURI(input); - if(editorURI == null) { + if (editorURI == null) { // could be a CDO-ish editor editorURI = getURIFromCDOInput(input); } - if(Objects.equal(uri, editorURI)) { + if (Objects.equal(uri, editorURI)) { site.getPage().activate(next.getPart(true)); break; } @@ -137,29 +137,29 @@ class LinkingHelper { } protected void handleEditor(IEditorPart activeEditor) { - if(activeEditor != null) { + if (activeEditor != null) { IEditorInput input = activeEditor.getEditorInput(); - if(input instanceof URIEditorInput) { - URI uri = ((URIEditorInput)input).getURI(); + if (input instanceof URIEditorInput) { + URI uri = ((URIEditorInput) input).getURI(); DIModel selected = getDIModelFromSelection(); - if((selected == null) || !selected.getResource().getURI().equals(uri)) { + if ((selected == null) || !selected.getResource().getURI().equals(uri)) { // change the selection DIModel model = findDIModel(uri); - if(model != null) { + if (model != null) { viewer.setSelection(new StructuredSelection(model), true); } } } else { URI uri = getURIFromCDOInput(input); - if(uri != null) { + if (uri != null) { CDOResourceLeaf selected = getCDOResourceFromSelection(); - if((selected == null || !selected.getURI().equals(uri))) { + if ((selected == null || !selected.getURI().equals(uri))) { // change the selected CDOResourceLeaf resource = findCDOResource(uri); - if(resource != null) { + if (resource != null) { viewer.setSelection(new StructuredSelection(resource), true); } } @@ -171,8 +171,8 @@ class LinkingHelper { private URI getURIFromCDOInput(IEditorInput input) { URI result = null; - if(input instanceof CDOEditorInput) { - CDOEditorInput cdoInput = (CDOEditorInput)input; + if (input instanceof CDOEditorInput) { + CDOEditorInput cdoInput = (CDOEditorInput) input; try { CDOResourceNode node = cdoInput.getView().getResourceNode(cdoInput.getResourcePath()); @@ -180,8 +180,8 @@ class LinkingHelper { } catch (Exception e) { // normal case of no such resource in this view } - } else if(input instanceof org.eclipse.emf.cdo.internal.ui.CDOLobEditorInput) { - org.eclipse.emf.cdo.internal.ui.CDOLobEditorInput cdoInput = (org.eclipse.emf.cdo.internal.ui.CDOLobEditorInput)input; + } else if (input instanceof org.eclipse.emf.cdo.internal.ui.CDOLobEditorInput) { + org.eclipse.emf.cdo.internal.ui.CDOLobEditorInput cdoInput = (org.eclipse.emf.cdo.internal.ui.CDOLobEditorInput) input; result = cdoInput.getResource().getURI(); } @@ -189,7 +189,7 @@ class LinkingHelper { } protected DIModel getDIModelFromSelection() { - IStructuredSelection sel = (viewer == null) ? StructuredSelection.EMPTY : (IStructuredSelection)viewer.getSelection(); + IStructuredSelection sel = (viewer == null) ? StructuredSelection.EMPTY : (IStructuredSelection) viewer.getSelection(); return sel.isEmpty() ? null : getDIModelFromSelection(sel.getFirstElement()); } @@ -197,12 +197,12 @@ class LinkingHelper { protected DIModel getDIModelFromSelection(Object selected) { DIModel result = null; - if(selected instanceof DIModel) { - result = (DIModel)selected; - } else if(selected instanceof CDOResource) { - Object parent = ((ITreeContentProvider)viewer.getContentProvider()).getParent(selected); - if(parent instanceof DIModel) { - result = (DIModel)parent; + if (selected instanceof DIModel) { + result = (DIModel) selected; + } else if (selected instanceof CDOResource) { + Object parent = ((ITreeContentProvider) viewer.getContentProvider()).getParent(selected); + if (parent instanceof DIModel) { + result = (DIModel) parent; } } @@ -213,7 +213,7 @@ class LinkingHelper { DIModel result = null; CDOResource res = CDOUtils.tryCast(findCDOResource(uri), CDOResource.class); - if((res != null) && res.isLoaded()) { + if ((res != null) && res.isLoaded()) { result = DIModel.getInstance(res, true); } @@ -221,7 +221,7 @@ class LinkingHelper { } protected CDOResourceLeaf getCDOResourceFromSelection() { - IStructuredSelection sel = (viewer == null) ? StructuredSelection.EMPTY : (IStructuredSelection)viewer.getSelection(); + IStructuredSelection sel = (viewer == null) ? StructuredSelection.EMPTY : (IStructuredSelection) viewer.getSelection(); return sel.isEmpty() ? null : getCDOResourceFromSelection(sel.getFirstElement()); } @@ -234,10 +234,10 @@ class LinkingHelper { protected CDOResourceLeaf findCDOResource(URI uri) { CDOResourceLeaf result = null; - IInternalPapyrusRepository repo = (IInternalPapyrusRepository)repositoryManager.getRepositoryForURI(uri); - if(repo != null) { + IInternalPapyrusRepository repo = (IInternalPapyrusRepository) repositoryManager.getRepositoryForURI(uri); + if (repo != null) { CDOView mainView = repo.getMasterView(); - if((mainView != null) && !mainView.isClosed()) { + if ((mainView != null) && !mainView.isClosed()) { try { result = CDOUtils.tryCast(mainView.getResourceNode(CDOURIUtil.extractResourcePath(uri)), CDOResourceLeaf.class); } catch (Exception e) { @@ -250,13 +250,13 @@ class LinkingHelper { } private IPartListener getLinkingPartListener() { - if(linkingPartListener == null) { + if (linkingPartListener == null) { linkingPartListener = new IPartListener() { @Override public void partActivated(IWorkbenchPart part) { - if(part instanceof IEditorPart) { - handleEditor((IEditorPart)part); + if (part instanceof IEditorPart) { + handleEditor((IEditorPart) part); } } @@ -286,7 +286,7 @@ class LinkingHelper { } private ISelectionChangedListener getLinkingSelectionListener() { - if(linkingSelectionListener == null) { + if (linkingSelectionListener == null) { linkingSelectionListener = new ISelectionChangedListener() { @Override diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/views/ModelRepositoriesView.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/views/ModelRepositoriesView.java index 3adab5ee349..4b06ac4e732 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/views/ModelRepositoriesView.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/views/ModelRepositoriesView.java @@ -1,6 +1,6 @@ /***************************************************************************** * Copyright (c) 2013, 2014 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 @@ -9,7 +9,7 @@ * Contributors: * CEA LIST - Initial API and implementation * Christian W. Damus (CEA) - bug 429242 - * + * *****************************************************************************/ package org.eclipse.papyrus.cdo.internal.ui.views; @@ -129,7 +129,7 @@ public class ModelRepositoriesView extends ContainerView { @Override protected IContainer<?> getContainer() { - return (IContainer<?>)repositoryManager; + return (IContainer<?>) repositoryManager; } @Override @@ -143,7 +143,7 @@ public class ModelRepositoriesView extends ContainerView { // attach the admin manager clientManager = Activator.getCDOAdminClientManager(); - if(clientManager != null) { + if (clientManager != null) { adminManager.install(clientManager); adminListener = new RepositoryAdminListener(repositoryManager); adminManager.addRepositoryAdminListener(adminListener); @@ -153,7 +153,7 @@ public class ModelRepositoriesView extends ContainerView { @Override public void dispose() { try { - if(clientManager != null) { + if (clientManager != null) { adminManager.removeRepositoryAdminListener(adminListener); clientManager.removeListener(adminManager); clientManager = null; @@ -174,10 +174,10 @@ public class ModelRepositoriesView extends ContainerView { } public void setLinkWithEditor(boolean link) { - if(isLinkWithEditor != link) { + if (isLinkWithEditor != link) { isLinkWithEditor = link; - if(linkingHelper != null) { + if (linkingHelper != null) { linkingHelper.setLinkWithEditor(link); } @@ -251,28 +251,28 @@ public class ModelRepositoriesView extends ContainerView { manager.add(new GroupMarker("createActions")); //$NON-NLS-1$ - if(!selection.isEmpty()) { + if (!selection.isEmpty()) { Object selected = selection.getFirstElement(); - if(selected instanceof DIModel) { + if (selected instanceof DIModel) { manager.add(openModelAction); manager.add(renameModelAction); manager.add(deleteModelAction); - } else if(selected instanceof CDOResource) { + } else if (selected instanceof CDOResource) { manager.add(openModelAction); } - if(selected instanceof IPapyrusRepository) { - if(((IPapyrusRepository)selected).isConnected()) { + if (selected instanceof IPapyrusRepository) { + if (((IPapyrusRepository) selected).isConnected()) { manager.add(createFolderAction); } manager.add(connectRepositoryAction); manager.add(disconnectRepositoryAction); - if(selected instanceof IInternalPapyrusRepository) { - CDOSession session = ((IInternalPapyrusRepository)selected).getCDOSession(); - if((session != null) && !Strings.isNullOrEmpty(session.getUserID())) { + if (selected instanceof IInternalPapyrusRepository) { + CDOSession session = ((IInternalPapyrusRepository) selected).getCDOSession(); + if ((session != null) && !Strings.isNullOrEmpty(session.getUserID())) { manager.add(changePasswordAction); } } @@ -287,13 +287,13 @@ public class ModelRepositoriesView extends ContainerView { @Override protected void doubleClicked(Object object) { - if(object instanceof DIModel) { + if (object instanceof DIModel) { invoke(openModelAction); - } else if(object instanceof IPapyrusRepository) { + } else if (object instanceof IPapyrusRepository) { invoke(connectRepositoryAction); - } else if(object instanceof CDOResourceLeaf) { - CDOResourceLeaf leaf = (CDOResourceLeaf)object; - if(isPapyrusResource(leaf)) { + } else if (object instanceof CDOResourceLeaf) { + CDOResourceLeaf leaf = (CDOResourceLeaf) object; + if (isPapyrusResource(leaf)) { invoke(openModelAction); } else { openCDOEditor(leaf); @@ -306,7 +306,7 @@ public class ModelRepositoriesView extends ContainerView { protected boolean isPapyrusResource(CDOResourceNode resourceNode) { boolean result = false; - if(resourceNode instanceof CDOResource) { + if (resourceNode instanceof CDOResource) { result = new ModelsReader().hasAssociatedModel(resourceNode.getURI()); } @@ -314,7 +314,7 @@ public class ModelRepositoriesView extends ContainerView { } protected void invoke(Action action) { - if(action.isEnabled()) { + if (action.isEnabled()) { action.run(); } } @@ -326,7 +326,7 @@ public class ModelRepositoriesView extends ContainerView { protected void openCDOEditor(CDOResourceLeaf res) { String editorID = CDOEditorUtil.getEffectiveEditorID(res); - if(editorID != null) { + if (editorID != null) { final CDOTransaction trans = res.cdoView().getSession().openTransaction(); res = trans.getObject(res); IEditorInput input = CDOEditorUtil.createEditorInput(editorID, res, false); @@ -336,8 +336,8 @@ public class ModelRepositoriesView extends ContainerView { @Override public void propertyChanged(Object source, int propId) { - if((propId == IEditorPart.PROP_DIRTY) && !editor.isDirty()) { - // editor was saved. Commit changes + if ((propId == IEditorPart.PROP_DIRTY) && !editor.isDirty()) { + // editor was saved. Commit changes try { trans.commit(); } catch (CommitException e) { @@ -353,7 +353,7 @@ public class ModelRepositoriesView extends ContainerView { @Override public void partClosed(IWorkbenchPart part) { - if(part == editor) { + if (part == editor) { trans.close(); } } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/views/ModelRepositoryItemProvider.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/views/ModelRepositoryItemProvider.java index 696a22fb75e..4640226f75f 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/views/ModelRepositoryItemProvider.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/views/ModelRepositoryItemProvider.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -43,7 +43,7 @@ public class ModelRepositoryItemProvider extends CDOItemProvider { @Override public boolean apply(Object input) { - return (input instanceof CDOResource) && DIResourceQuery.getDIResources(((CDOResource)input).cdoView()).contains(input); + return (input instanceof CDOResource) && DIResourceQuery.getDIResources(((CDOResource) input).cdoView()).contains(input); } }; @@ -51,7 +51,7 @@ public class ModelRepositoryItemProvider extends CDOItemProvider { @Override public boolean apply(Object input) { - return !(input instanceof CDOResource) || DIResourceQuery.isUnaffiliatedResource((CDOResource)input); + return !(input instanceof CDOResource) || DIResourceQuery.isUnaffiliatedResource((CDOResource) input); } }; @@ -62,8 +62,8 @@ public class ModelRepositoryItemProvider extends CDOItemProvider { @Override public Object apply(Object input) { - if(isDIResource.apply(input)) { - return DIModel.getInstance((CDOResource)input, true); + if (isDIResource.apply(input)) { + return DIModel.getInstance((CDOResource) input, true); } else { return input; } @@ -94,27 +94,27 @@ public class ModelRepositoryItemProvider extends CDOItemProvider { } public ModelRepositoryItemProvider(IWorkbenchPage page) { - this(page, (IElementFilter)null); + this(page, (IElementFilter) null); } @Override public Object[] getChildren(Object element) { - if(element instanceof IPapyrusRepository) { + if (element instanceof IPapyrusRepository) { // initialize query for DI resources - IInternalPapyrusRepository repo = (IInternalPapyrusRepository)element; - if(repo.isConnected()) { + IInternalPapyrusRepository repo = (IInternalPapyrusRepository) element; + if (repo.isConnected()) { DIResourceQuery.initialize(getViewer(), repo.getMasterView()); } } Iterable<?> result; - if(element instanceof DIModel) { - result = Arrays.asList(((DIModel)element).getChildren()); + if (element instanceof DIModel) { + result = Arrays.asList(((DIModel) element).getChildren()); } else { result = Arrays.asList(super.getChildren(element)); - if((element instanceof CDOResourceFolder) || (element instanceof IPapyrusRepository)) { + if ((element instanceof CDOResourceFolder) || (element instanceof IPapyrusRepository)) { result = filterDIResources(result); } } @@ -126,32 +126,32 @@ public class ModelRepositoryItemProvider extends CDOItemProvider { public Object getParent(Object element) { Object result; - if(element instanceof CDOResource) { - CDOResource di = DIResourceQuery.getAffiliateResource((CDOResource)element); + if (element instanceof CDOResource) { + CDOResource di = DIResourceQuery.getAffiliateResource((CDOResource) element); - if(di != null) { + if (di != null) { result = DIModel.getInstance(di, true); } else { result = super.getParent(element); } - } else if(element instanceof DIModel) { - CDOResource resource = ((DIModel)element).getResource(); + } else if (element instanceof DIModel) { + CDOResource resource = ((DIModel) element).getResource(); CDOView view = resource.cdoView(); // can't query the parent of an object in a closed view result = ((view != null) && view.isClosed()) ? null : super.getParent(resource); } else { CDOView view = null; - if(element instanceof CDOObject) { - view = ((CDOObject)element).cdoView(); + if (element instanceof CDOObject) { + view = ((CDOObject) element).cdoView(); } // can't query the parent of an object in a closed view result = ((view != null) && view.isClosed()) ? null : super.getParent(element); // we don't show the view - if(result instanceof CDOView) { - result = PapyrusRepositoryManager.INSTANCE.getRepository((CDOView)result); + if (result instanceof CDOView) { + result = PapyrusRepositoryManager.INSTANCE.getRepository((CDOView) result); } } @@ -170,11 +170,11 @@ public class ModelRepositoryItemProvider extends CDOItemProvider { public Image getImage(Object obj) { Image result; - if(obj instanceof IPapyrusRepository) { - boolean open = ((IPapyrusRepository)obj).isConnected(); + if (obj instanceof IPapyrusRepository) { + boolean open = ((IPapyrusRepository) obj).isConnected(); result = SharedImages.getImage(open ? Activator.ICON_OPEN_REPOSITORY : Activator.ICON_CLOSED_REPOSITORY); - } else if(obj instanceof DIModel) { - result = ((DIModel)obj).getImage(); + } else if (obj instanceof DIModel) { + result = ((DIModel) obj).getImage(); } else { result = super.getImage(obj); } @@ -186,10 +186,10 @@ public class ModelRepositoryItemProvider extends CDOItemProvider { public String getText(Object obj) { String result; - if(obj instanceof IInternalPapyrusRepository) { - result = ((IInternalPapyrusRepository)obj).getName(); - } else if(obj instanceof DIModel) { - result = ((DIModel)obj).getName(); + if (obj instanceof IInternalPapyrusRepository) { + result = ((IInternalPapyrusRepository) obj).getName(); + } else if (obj instanceof DIModel) { + result = ((DIModel) obj).getName(); } else { result = super.getText(obj); } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/widgets/ActionButton.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/widgets/ActionButton.java index f890c6b79ca..9d738f5b806 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/widgets/ActionButton.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/widgets/ActionButton.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -79,6 +79,7 @@ public class ActionButton { button.addDisposeListener(new DisposeListener() { + @Override public void widgetDisposed(DisposeEvent e) { dispose(); } @@ -88,20 +89,20 @@ public class ActionButton { } public void attach(StructuredViewer viewer) { - if(dependentViewers == null) { + if (dependentViewers == null) { dependentViewers = Lists.newArrayListWithExpectedSize(1); dependentViewers.add(viewer); viewer.addSelectionChangedListener(getSelectionListener()); - } else if(!dependentViewers.contains(viewer)) { + } else if (!dependentViewers.contains(viewer)) { dependentViewers.add(viewer); viewer.addSelectionChangedListener(getSelectionListener()); } } private void refreshViewers(IStructuredSelection objectsToUpdate) { - if(dependentViewers != null) { - for(StructuredViewer next : dependentViewers) { - for(Iterator<?> iter = objectsToUpdate.iterator(); iter.hasNext();) { + if (dependentViewers != null) { + for (StructuredViewer next : dependentViewers) { + for (Iterator<?> iter = objectsToUpdate.iterator(); iter.hasNext();) { next.refresh(iter.next()); } } @@ -109,12 +110,13 @@ public class ActionButton { } private ISelectionChangedListener getSelectionListener() { - if(selectionListener == null) { + if (selectionListener == null) { selectionListener = new ISelectionChangedListener() { + @Override public void selectionChanged(SelectionChangedEvent event) { - selection.selectionChanged((IStructuredSelection)event.getSelection()); - if(button != null) { + selection.selectionChanged((IStructuredSelection) event.getSelection()); + if (button != null) { button.setEnabled(action.isEnabled()); } } @@ -125,8 +127,8 @@ public class ActionButton { } private void dispose() { - if((dependentViewers != null) && (selectionListener != null)) { - for(StructuredViewer next : dependentViewers) { + if ((dependentViewers != null) && (selectionListener != null)) { + for (StructuredViewer next : dependentViewers) { next.removeSelectionChangedListener(selectionListener); } } @@ -152,6 +154,7 @@ public class ActionButton { this.action = action; } + @Override public void selectionChanged(IStructuredSelection selection) { action.selectionChanged(selection); } @@ -167,6 +170,7 @@ public class ActionButton { this.adapter = adapter; } + @Override public void selectionChanged(IStructuredSelection selection) { // stash the selection this.selection = selection; diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/LocalRepositoryView.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/LocalRepositoryView.java index 9864fa21a98..7a5efefed68 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/LocalRepositoryView.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/LocalRepositoryView.java @@ -1,6 +1,6 @@ /***************************************************************************** * Copyright (c) 2013, 2014 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 @@ -9,7 +9,7 @@ * Contributors: * CEA LIST - Initial API and implementation * Christian W. Damus (CEA) - bug 422257 - * + * *****************************************************************************/ package org.eclipse.papyrus.cdo.internal.ui.wizards; @@ -53,7 +53,7 @@ public class LocalRepositoryView { * Disposes of all of the local {@link CDOView}s that I have cached. */ public void dispose() { - for(Map.Entry<IPapyrusRepository, CDOView> next : localViews.entrySet()) { + for (Map.Entry<IPapyrusRepository, CDOView> next : localViews.entrySet()) { CDOView view = next.getValue(); try { CDOUtils.unload(view); @@ -66,7 +66,7 @@ public class LocalRepositoryView { localViews.clear(); - if(rset != null) { + if (rset != null) { try { EMFHelper.unload(rset); } catch (Exception e) { @@ -79,10 +79,10 @@ public class LocalRepositoryView { /** * Obtain a view of the specified {@code selection} in the context of a local cache of distinct {@link CDOView}s. - * + * * @param selection - * a selection of objects in a CDO view - * + * a selection of objects in a CDO view + * * @return a new selection consisting of the same objects as presented in my local CDO views */ public IStructuredSelection translate(IStructuredSelection selection) { @@ -91,20 +91,20 @@ public class LocalRepositoryView { /** * Obtain a view of the specified {@code objects} in the context of a local cache of distinct {@link CDOView}s. - * + * * @param objects - * a bunch of objects in a CDO view - * + * a bunch of objects in a CDO view + * * @return a new list consisting of the same objects as presented in my local CDO views */ public List<Object> translate(Collection<?> objects) { List<Object> result = Lists.newArrayListWithCapacity(objects.size()); - for(Object next : objects) { - if(next instanceof EObject) { - result.add(translate((EObject)next)); - } else if(next instanceof DIModel) { - DIModel di = (DIModel)next; + for (Object next : objects) { + if (next instanceof EObject) { + result.add(translate((EObject) next)); + } else if (next instanceof DIModel) { + DIModel di = (DIModel) next; result.add(DIModel.getInstance(translate(di.getResource()), true)); } @@ -115,24 +115,24 @@ public class LocalRepositoryView { /** * Obtain a view of the specified {@code object} in the context of a local cache of distinct {@link CDOView}s. - * + * * @param objects - * a modeled object in a CDO view - * + * a modeled object in a CDO view + * * @return the same object as presented in my local CDO views */ public <T extends EObject> T translate(T object) { T result; - if(object instanceof CDOObject) { - CDOObject cdo = (CDOObject)object; + if (object instanceof CDOObject) { + CDOObject cdo = (CDOObject) object; CDOView view = cdo.cdoView(); - if(view == null) { + if (view == null) { result = object; } else { IInternalPapyrusRepository repo = PapyrusRepositoryManager.INSTANCE.getRepository(view); CDOView localView = localViews.get(repo); - if(localView == null) { + if (localView == null) { localView = repo.getCDOView(repo.createReadOnlyView(getResourceSet())); localViews.put(repo, localView); } @@ -147,7 +147,7 @@ public class LocalRepositoryView { } protected ResourceSet getResourceSet() { - if(rset == null) { + if (rset == null) { rset = createResourceSet(); } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/ModelExportMappingsPage.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/ModelExportMappingsPage.java index d7ea0b6c406..eb16e314dec 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/ModelExportMappingsPage.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/ModelExportMappingsPage.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -70,6 +70,7 @@ public class ModelExportMappingsPage extends ModelImportWizardPage { super("mappings", Messages.ModelExportMappingsPage_2, null, bus, MESSAGE); //$NON-NLS-1$ } + @Override public void createControl(Composite parent) { initializeDialogUnits(parent); @@ -90,7 +91,7 @@ public class ModelExportMappingsPage extends ModelImportWizardPage { mappingTable.setContentProvider(new MappingContentProvider()); mappingTable.setLabelProvider(new MappingLabelProvider()); - if(exportConfig != null) { + if (exportConfig != null) { mappingTable.setInput(exportConfig); } @@ -101,7 +102,7 @@ public class ModelExportMappingsPage extends ModelImportWizardPage { @Override public void dispose() { - if(exportConfig != null) { + if (exportConfig != null) { exportConfig.removeModelTransferListener(getImportConfigListener()); } @@ -128,13 +129,13 @@ public class ModelExportMappingsPage extends ModelImportWizardPage { public void setConfiguration(IModelTransferConfiguration config) { this.exportConfig = config; - if(config != null) { + if (config != null) { config.addModelTransferListener(getImportConfigListener()); } setMapping(IModelExportMapping.Factory.DEFAULT.create(config)); - if(mappingTable != null) { + if (mappingTable != null) { mappingTable.setInput(config); } @@ -142,12 +143,12 @@ public class ModelExportMappingsPage extends ModelImportWizardPage { } private IModelTransferListener getImportConfigListener() { - if(exportConfigListener == null) { + if (exportConfigListener == null) { exportConfigListener = new ModelTransferListenerAdapter() { @Override public void modelsToTransferChanged(IModelTransferConfiguration configuration) { - if((mappingTable != null) && !mappingTable.getControl().isDisposed()) { + if ((mappingTable != null) && !mappingTable.getControl().isDisposed()) { mappingTable.refresh(); } @@ -160,13 +161,13 @@ public class ModelExportMappingsPage extends ModelImportWizardPage { } private void setMapping(IModelExportMapping mapping) { - if(this.mapping != null) { + if (this.mapping != null) { this.mapping.removeModelTransferMappingListener(getMappingListener()); } this.mapping = mapping; - if(this.mapping != null) { + if (this.mapping != null) { this.mapping.addModelTransferMappingListener(getMappingListener()); this.mapping.setRepository(repository); initializeMappings(); @@ -174,10 +175,10 @@ public class ModelExportMappingsPage extends ModelImportWizardPage { } private void initializeMappings() { - if((initialDestination != null) && (mapping != null)) { + if ((initialDestination != null) && (mapping != null)) { IPath basePath = initialDestination.getFullPath(); - for(IModelTransferNode next : exportConfig.getModelsToTransfer()) { - if(mapping.getMapping(next) == null) { + for (IModelTransferNode next : exportConfig.getModelsToTransfer()) { + if (mapping.getMapping(next) == null) { mapping.mapTo(next, basePath.append(next.getPrimaryResourceURI().lastSegment())); } } @@ -185,13 +186,13 @@ public class ModelExportMappingsPage extends ModelImportWizardPage { } private IModelTransferMappingListener getMappingListener() { - if(mappingListener == null) { + if (mappingListener == null) { mappingListener = new ModelTransferMappingListenerAdapter() { @Override public void modelTransferMappingChanged(IModelTransferNode node) { IPath mapping = ModelExportMappingsPage.this.mapping.getMapping(node); - if((mapping != null) && (mappingTable != null)) { + if ((mapping != null) && (mappingTable != null)) { mappingTable.refresh(); } } @@ -205,7 +206,7 @@ public class ModelExportMappingsPage extends ModelImportWizardPage { public void setRepository(IPapyrusRepository repository) { this.repository = repository; - if(mapping != null) { + if (mapping != null) { mapping.setRepository(repository); } @@ -213,7 +214,7 @@ public class ModelExportMappingsPage extends ModelImportWizardPage { } private boolean setMapping(IModelTransferNode node, IPath path) { - if((mapping != null) && (node != null)) { + if ((mapping != null) && (node != null)) { mapping.mapTo(node, path); } @@ -228,14 +229,17 @@ public class ModelExportMappingsPage extends ModelImportWizardPage { private static class MappingContentProvider implements IStructuredContentProvider { + @Override public Object[] getElements(Object inputElement) { - return ((IModelTransferConfiguration)inputElement).getModelsToTransfer().toArray(); + return ((IModelTransferConfiguration) inputElement).getModelsToTransfer().toArray(); } + @Override public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { // pass } + @Override public void dispose() { // pass } @@ -244,26 +248,28 @@ public class ModelExportMappingsPage extends ModelImportWizardPage { private class MappingLabelProvider extends ModelImportNodeLabelProvider implements ITableLabelProvider { + @Override public Image getColumnImage(Object element, int columnIndex) { return (columnIndex == 0) ? getImage(element) : null; } + @Override public String getColumnText(Object element, int columnIndex) { String result = null; - switch(columnIndex) { + switch (columnIndex) { case 0: // Model result = getText(element); break; case 1: // Path - if(mapping != null) { - IPath path = mapping.getMapping((IModelTransferNode)element); - if(path != null) { + if (mapping != null) { + IPath path = mapping.getMapping((IModelTransferNode) element); + if (path != null) { result = path.toString(); } } - if(result == null) { + if (result == null) { result = ""; //$NON-NLS-1$ } break; @@ -287,8 +293,8 @@ public class ModelExportMappingsPage extends ModelImportWizardPage { @Override protected CellEditor getCellEditor(Object element) { - if(editor == null) { - editor = new DialogCellEditor((Composite)getViewer().getControl()) { + if (editor == null) { + editor = new DialogCellEditor((Composite) getViewer().getControl()) { @Override protected Object openDialogBox(Control cellEditorWindow) { @@ -298,7 +304,7 @@ public class ModelExportMappingsPage extends ModelImportWizardPage { Object[] result = (dlg.open() == Window.OK) ? dlg.getResult() : null; - return ((result == null) || (result.length == 0)) ? null : (IPath)result[0]; + return ((result == null) || (result.length == 0)) ? null : (IPath) result[0]; } }; } @@ -312,23 +318,24 @@ public class ModelExportMappingsPage extends ModelImportWizardPage { @Override protected Object getValue(Object element) { - IPath path = mapping.getMapping((IModelTransferNode)element); + IPath path = mapping.getMapping((IModelTransferNode) element); return (path == null) ? "" : path.removeLastSegments(1).toString(); //$NON-NLS-1$ } @Override protected void setValue(final Object element, Object value) { // the 'value' will be a string if the user double-clicks without opening the dialog - IPath newPath = (value instanceof IPath) ? (IPath)value : null; + IPath newPath = (value instanceof IPath) ? (IPath) value : null; - if(newPath != null) { - String name = ((IModelTransferNode)element).getPrimaryResourceURI().lastSegment(); + if (newPath != null) { + String name = ((IModelTransferNode) element).getPrimaryResourceURI().lastSegment(); newPath = newPath.append(name); - if(!setMapping((IModelTransferNode)element, newPath)) { + if (!setMapping((IModelTransferNode) element, newPath)) { // continue editing getViewer().getControl().getDisplay().asyncExec(new Runnable() { + @Override public void run() { getViewer().editElement(element, columnIndex); } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/ModelExportWizard.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/ModelExportWizard.java index f3c6b42cfbe..2dbad64eafa 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/ModelExportWizard.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/ModelExportWizard.java @@ -1,6 +1,6 @@ /***************************************************************************** * Copyright (c) 2013, 2014 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 @@ -9,7 +9,7 @@ * Contributors: * CEA LIST - Initial API and implementation * Christian W. Damus (CEA) - bug 429242 - * + * *****************************************************************************/ package org.eclipse.papyrus.cdo.internal.ui.wizards; @@ -91,7 +91,7 @@ public class ModelExportWizard extends Wizard implements IWorkbenchWizard { mappingsPage = new ModelExportMappingsPage(bus); addPage(mappingsPage); - if(initialDestination != null) { + if (initialDestination != null) { mappingsPage.setInitialDestination(initialDestination); } @@ -101,7 +101,7 @@ public class ModelExportWizard extends Wizard implements IWorkbenchWizard { @Override public void run() { - for(DIModel next : getSelection()) { + for (DIModel next : getSelection()) { exportConfig.addModelToTransfer(next.getResource().getURI()); } @@ -114,25 +114,25 @@ public class ModelExportWizard extends Wizard implements IWorkbenchWizard { Iterable<DIModel> getSelection() { Multimap<IPapyrusRepository, DIModel> result = ArrayListMultimap.create(); - if(selection != null) { - for(Object next : selection.toList()) { + if (selection != null) { + for (Object next : selection.toList()) { DIModel model = CDOUtils.adapt(next, DIModel.class); - if(model != null) { + if (model != null) { URI uri = model.getResource().getURI(); IPapyrusRepository repo = PapyrusRepositoryManager.INSTANCE.getRepositoryForURI(uri); - if(repository == null) { + if (repository == null) { repository = repo; } - if(repo != null) { + if (repo != null) { result.put(repo, model); } } } } - if(result.keySet().size() > 1) { + if (result.keySet().size() > 1) { MessageDialog.openInformation(getShell(), Messages.ModelExportWizard_2, NLS.bind(Messages.ModelExportWizard_3, repository.getName())); } @@ -146,7 +146,7 @@ public class ModelExportWizard extends Wizard implements IWorkbenchWizard { IModelExporter exporter = IModelExporter.Factory.DEFAULT.create(); Diagnostic problems = exporter.exportModels(mappingsPage.getMapping()); - if(problems.getSeverity() > Diagnostic.INFO) { + if (problems.getSeverity() > Diagnostic.INFO) { StatusManager.getManager().handle(BasicDiagnostic.toIStatus(problems), StatusManager.BLOCK); } @@ -155,7 +155,7 @@ public class ModelExportWizard extends Wizard implements IWorkbenchWizard { @Override public void dispose() { - if(exportConfig != null) { + if (exportConfig != null) { // it actually takes a while to dispose this, unloading all of the // resources potentially covering all of the Papyrus models in the // workspace in order to clean up the UML CacheAdapter @@ -185,9 +185,9 @@ public class ModelExportWizard extends Wizard implements IWorkbenchWizard { ResourceSet getResourceSet(IStructuredSelection selection) { ResourceSet result = null; - for(Object next : selection.toList()) { + for (Object next : selection.toList()) { CDOResource resource = CDOUtils.adapt(next, CDOResource.class); - if(resource != null) { + if (resource != null) { result = resource.getResourceSet(); break; } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/ModelImportWizard.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/ModelImportWizard.java index a74f4dadd0e..866b8b4cfa0 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/ModelImportWizard.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/ModelImportWizard.java @@ -1,6 +1,6 @@ /***************************************************************************** * Copyright (c) 2013, 2014 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 @@ -9,7 +9,7 @@ * Contributors: * CEA LIST - Initial API and implementation * Christian W. Damus (CEA) - bug 429242 - * + * *****************************************************************************/ package org.eclipse.papyrus.cdo.internal.ui.wizards; @@ -96,13 +96,13 @@ public class ModelImportWizard extends Wizard implements IWorkbenchWizard { @Override public void run() { - for(IPapyrusFile next : getSelection()) { + for (IPapyrusFile next : getSelection()) { importConfig.addModelToTransfer(URI.createPlatformResourceURI(next.getMainFile().getFullPath().toString(), true)); } bus.post(importConfig); - if(repository != null) { + if (repository != null) { bus.post(repository); } } @@ -112,17 +112,17 @@ public class ModelImportWizard extends Wizard implements IWorkbenchWizard { Iterable<IPapyrusFile> getSelection() { List<IPapyrusFile> result = Lists.newArrayList(); - if(selection != null) { - for(Object next : selection.toList()) { + if (selection != null) { + for (Object next : selection.toList()) { IPapyrusFile file = null; - if(next instanceof IPapyrusFile) { - file = (IPapyrusFile)next; - } else if(next instanceof IAdaptable) { - file = (IPapyrusFile)((IAdaptable)next).getAdapter(IPapyrusFile.class); + if (next instanceof IPapyrusFile) { + file = (IPapyrusFile) next; + } else if (next instanceof IAdaptable) { + file = (IPapyrusFile) ((IAdaptable) next).getAdapter(IPapyrusFile.class); } - if(file != null) { + if (file != null) { result.add(file); } } @@ -138,7 +138,7 @@ public class ModelImportWizard extends Wizard implements IWorkbenchWizard { IModelImporter importer = IModelImporter.Factory.DEFAULT.create(); Diagnostic problems = importer.importModels(mappingsPage.getSelectedMapping()); - if(problems.getSeverity() > Diagnostic.INFO) { + if (problems.getSeverity() > Diagnostic.INFO) { StatusManager.getManager().handle(BasicDiagnostic.toIStatus(problems), StatusManager.BLOCK); } @@ -147,7 +147,7 @@ public class ModelImportWizard extends Wizard implements IWorkbenchWizard { @Override public void dispose() { - if(importConfig != null) { + if (importConfig != null) { // it actually takes a while to dispose this, unloading all of the // resources potentially covering all of the Papyrus models in the // workspace in order to clean up the UML CacheAdapter diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/ModelImportWizardPage.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/ModelImportWizardPage.java index 4f6cb7e23a2..4f6704d34ac 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/ModelImportWizardPage.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/ModelImportWizardPage.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -51,7 +51,7 @@ abstract class ModelImportWizardPage protected Diagnostic report(int severity, String message) { return new BasicDiagnostic(severity, Activator.PLUGIN_ID, 0, message, - null); + null); } Diagnostic mostSevere(Diagnostic diagnostic) { @@ -72,32 +72,32 @@ abstract class ModelImportWizardPage String message; switch (diagnostic.getSeverity()) { - case Diagnostic.OK : - messageType = IMessageProvider.NONE; - message = this.message; - break; - case Diagnostic.INFO : - messageType = IMessageProvider.INFORMATION; - message = diagnostic.getMessage(); - break; - case Diagnostic.WARNING : - messageType = IMessageProvider.WARNING; - message = diagnostic.getMessage(); - break; - case Diagnostic.CANCEL : - // an OK condition, but we can't finish the page even so - messageType = IMessageProvider.INFORMATION; - message = diagnostic.getMessage(); - break; - default : - messageType = IMessageProvider.ERROR; - message = diagnostic.getMessage(); - break; + case Diagnostic.OK: + messageType = IMessageProvider.NONE; + message = this.message; + break; + case Diagnostic.INFO: + messageType = IMessageProvider.INFORMATION; + message = diagnostic.getMessage(); + break; + case Diagnostic.WARNING: + messageType = IMessageProvider.WARNING; + message = diagnostic.getMessage(); + break; + case Diagnostic.CANCEL: + // an OK condition, but we can't finish the page even so + messageType = IMessageProvider.INFORMATION; + message = diagnostic.getMessage(); + break; + default: + messageType = IMessageProvider.ERROR; + message = diagnostic.getMessage(); + break; } // OK_INSTANCE and CANCEL_INSTANCE have useless messages if ((diagnostic == Diagnostic.OK_INSTANCE) - || (diagnostic == Diagnostic.CANCEL_INSTANCE)) { + || (diagnostic == Diagnostic.CANCEL_INSTANCE)) { message = this.message; } @@ -109,7 +109,7 @@ abstract class ModelImportWizardPage protected void post(Object event) { bus.post(event); } - + protected EventBus getEventBus() { return bus; } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/ModelMappingsPage.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/ModelMappingsPage.java index 4d3223f8d93..a7e878e06b7 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/ModelMappingsPage.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/ModelMappingsPage.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -87,6 +87,7 @@ public class ModelMappingsPage extends ModelImportWizardPage { super("mappings", Messages.ModelMappingsPage_2, null, bus, MESSAGE); //$NON-NLS-1$ } + @Override public void createControl(Composite parent) { initializeDialogUnits(parent); @@ -124,7 +125,7 @@ public class ModelMappingsPage extends ModelImportWizardPage { oneToOnePathsTable.setContentProvider(new OneToOneMappingContentProvider()); oneToOnePathsTable.setLabelProvider(new OneToOneMappingLabelProvider()); - if(importConfig != null) { + if (importConfig != null) { oneToOnePathsTable.setInput(importConfig); } @@ -132,8 +133,8 @@ public class ModelMappingsPage extends ModelImportWizardPage { @Override public void widgetSelected(SelectionEvent e) { - if(((Button)e.widget).getSelection()) { - if(e.widget == manyToOneRadio) { + if (((Button) e.widget).getSelection()) { + if (e.widget == manyToOneRadio) { oneToOneRadio.setSelection(false); oneToOnePathsTable.getControl().setEnabled(false); manyToOnePathText.setEnabled(true); @@ -143,8 +144,8 @@ public class ModelMappingsPage extends ModelImportWizardPage { oneToOnePathsTable.getControl().setEnabled(true); } - if(e.widget.getData() != null) { - selectedMapping((IModelImportMapping)e.widget.getData()); + if (e.widget.getData() != null) { + selectedMapping((IModelImportMapping) e.widget.getData()); } validatePage(); @@ -156,8 +157,9 @@ public class ModelMappingsPage extends ModelImportWizardPage { manyToOnePathText.addModifyListener(new ModifyListener() { + @Override public void modifyText(ModifyEvent e) { - manyToOnePathChanged(((Text)e.widget).getText().trim()); + manyToOnePathChanged(((Text) e.widget).getText().trim()); } }); @@ -168,7 +170,7 @@ public class ModelMappingsPage extends ModelImportWizardPage { @Override public void dispose() { - if(importConfig != null) { + if (importConfig != null) { importConfig.removeModelTransferListener(getImportConfigListener()); } @@ -187,7 +189,7 @@ public class ModelMappingsPage extends ModelImportWizardPage { protected Diagnostic doValidatePage() { Diagnostic result = Diagnostic.CANCEL_INSTANCE; - if(selectedMapping != null) { + if (selectedMapping != null) { result = selectedMapping.validate(); } @@ -202,14 +204,14 @@ public class ModelMappingsPage extends ModelImportWizardPage { public void setConfiguration(IModelTransferConfiguration config) { this.importConfig = config; - if(config != null) { + if (config != null) { config.addModelTransferListener(getImportConfigListener()); } setManyToOneMapping(IModelImportMapping.Factory.MANY_TO_ONE.create(config)); setOneToOneMapping(IModelImportMapping.Factory.ONE_TO_ONE.create(config)); - if(oneToOnePathsTable != null) { + if (oneToOnePathsTable != null) { oneToOnePathsTable.setInput(config); } @@ -217,13 +219,13 @@ public class ModelMappingsPage extends ModelImportWizardPage { } private IModelTransferListener getImportConfigListener() { - if(importConfigListener == null) { + if (importConfigListener == null) { importConfigListener = new ModelTransferListenerAdapter() { @Override public void modelsToTransferChanged(IModelTransferConfiguration configuration) { - if((oneToOnePathsTable != null) && !oneToOnePathsTable.getControl().isDisposed()) { + if ((oneToOnePathsTable != null) && !oneToOnePathsTable.getControl().isDisposed()) { oneToOnePathsTable.refresh(); } @@ -235,23 +237,23 @@ public class ModelMappingsPage extends ModelImportWizardPage { } private void setManyToOneMapping(IModelImportMapping mapping) { - if(manyToOne != null) { + if (manyToOne != null) { manyToOne.removeModelTransferMappingListener(getManyToOneListener()); } manyToOne = mapping; - if(manyToOne != null) { + if (manyToOne != null) { manyToOne.addModelTransferMappingListener(getManyToOneListener()); manyToOne.setRepository(repository); - if(manyToOneRadio != null) { + if (manyToOneRadio != null) { manyToOneRadio.setData(manyToOne); - if(manyToOneRadio.getSelection()) { + if (manyToOneRadio.getSelection()) { selectedMapping(manyToOne); } IModelTransferNode node = Iterables.getFirst(importConfig.getModelsToTransfer(), null); - if(node != null) { + if (node != null) { updateManyToOneMapping(node); } } @@ -259,7 +261,7 @@ public class ModelMappingsPage extends ModelImportWizardPage { } private IModelTransferMappingListener getManyToOneListener() { - if(manyToOneListener == null) { + if (manyToOneListener == null) { manyToOneListener = new ModelTransferMappingListenerAdapter() { @Override @@ -274,27 +276,27 @@ public class ModelMappingsPage extends ModelImportWizardPage { void updateManyToOneMapping(IModelTransferNode node) { IPath mapping = manyToOne.getMapping(node); - if((mapping != null) && (manyToOnePathText != null)) { + if ((mapping != null) && (manyToOnePathText != null)) { String path = mapping.toString(); - if(!manyToOnePathText.getText().equals(path)) { + if (!manyToOnePathText.getText().equals(path)) { manyToOnePathText.setText(path); } } } private void setOneToOneMapping(IModelImportMapping mapping) { - if(oneToOne != null) { + if (oneToOne != null) { oneToOne.removeModelTransferMappingListener(getOneToOneListener()); } oneToOne = mapping; - if(oneToOne != null) { + if (oneToOne != null) { oneToOne.addModelTransferMappingListener(getOneToOneListener()); oneToOne.setRepository(repository); - if(oneToOneRadio != null) { + if (oneToOneRadio != null) { oneToOneRadio.setData(oneToOne); - if(oneToOneRadio.getSelection()) { + if (oneToOneRadio.getSelection()) { selectedMapping(oneToOne); } } @@ -302,13 +304,13 @@ public class ModelMappingsPage extends ModelImportWizardPage { } private IModelTransferMappingListener getOneToOneListener() { - if(oneToOneListener == null) { + if (oneToOneListener == null) { oneToOneListener = new ModelTransferMappingListenerAdapter() { @Override public void modelTransferMappingChanged(IModelTransferNode node) { IPath mapping = oneToOne.getMapping(node); - if((mapping != null) && (oneToOnePathsTable != null)) { + if ((mapping != null) && (oneToOnePathsTable != null)) { oneToOnePathsTable.refresh(); } } @@ -322,10 +324,10 @@ public class ModelMappingsPage extends ModelImportWizardPage { public void setRepository(IPapyrusRepository repository) { this.repository = repository; - if(manyToOne != null) { + if (manyToOne != null) { manyToOne.setRepository(repository); } - if(oneToOne != null) { + if (oneToOne != null) { oneToOne.setRepository(repository); } @@ -345,16 +347,16 @@ public class ModelMappingsPage extends ModelImportWizardPage { boolean result = false; IPath path = new Path(newPath); - if(path.isEmpty()) { + if (path.isEmpty()) { setMessage(Messages.ModelMappingsPage_9, IMessageProvider.ERROR); setPageComplete(false); - } else if(path.hasTrailingSeparator()) { + } else if (path.hasTrailingSeparator()) { setMessage(Messages.ModelMappingsPage_10, IMessageProvider.ERROR); setPageComplete(false); } else { result = true; - if((selectedMapping != null) && (node != null)) { + if ((selectedMapping != null) && (node != null)) { selectedMapping.mapTo(node, path); } @@ -370,14 +372,17 @@ public class ModelMappingsPage extends ModelImportWizardPage { private static class OneToOneMappingContentProvider implements IStructuredContentProvider { + @Override public Object[] getElements(Object inputElement) { - return ((IModelTransferConfiguration)inputElement).getModelsToTransfer().toArray(); + return ((IModelTransferConfiguration) inputElement).getModelsToTransfer().toArray(); } + @Override public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { // pass } + @Override public void dispose() { // pass } @@ -386,26 +391,28 @@ public class ModelMappingsPage extends ModelImportWizardPage { private class OneToOneMappingLabelProvider extends ModelImportNodeLabelProvider implements ITableLabelProvider { + @Override public Image getColumnImage(Object element, int columnIndex) { return (columnIndex == 0) ? getImage(element) : null; } + @Override public String getColumnText(Object element, int columnIndex) { String result = null; - switch(columnIndex) { + switch (columnIndex) { case 0: // Model result = getText(element); break; case 1: // Path - if(oneToOne != null) { - IPath path = oneToOne.getMapping((IModelTransferNode)element); - if(path != null) { + if (oneToOne != null) { + IPath path = oneToOne.getMapping((IModelTransferNode) element); + if (path != null) { result = path.toString(); } } - if(result == null) { + if (result == null) { result = ""; //$NON-NLS-1$ } break; @@ -430,8 +437,8 @@ public class ModelMappingsPage extends ModelImportWizardPage { @Override protected CellEditor getCellEditor(Object element) { - if(editor == null) { - editor = new TextCellEditor((Composite)getViewer().getControl()); + if (editor == null) { + editor = new TextCellEditor((Composite) getViewer().getControl()); } return editor; } @@ -443,7 +450,7 @@ public class ModelMappingsPage extends ModelImportWizardPage { @Override protected Object getValue(Object element) { - IPath path = oneToOne.getMapping((IModelTransferNode)element); + IPath path = oneToOne.getMapping((IModelTransferNode) element); return (path == null) ? "" : path.toString(); //$NON-NLS-1$ } @@ -451,10 +458,11 @@ public class ModelMappingsPage extends ModelImportWizardPage { protected void setValue(final Object element, Object value) { String newPath = (value == null) ? "" : String.valueOf(value); //$NON-NLS-1$ - if(!setMapping((IModelTransferNode)element, newPath)) { + if (!setMapping((IModelTransferNode) element, newPath)) { // continue editing getViewer().getControl().getDisplay().asyncExec(new Runnable() { + @Override public void run() { getViewer().editElement(element, columnIndex); } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/ModelReferencesPage.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/ModelReferencesPage.java index a95a7157e3d..88902c160ee 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/ModelReferencesPage.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/ModelReferencesPage.java @@ -1,6 +1,6 @@ /***************************************************************************** * Copyright (c) 2013, 2014 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 @@ -9,7 +9,7 @@ * Contributors: * CEA LIST - Initial API and implementation * Christian W. Damus (CEA) - bug 429242 - * + * *****************************************************************************/ package org.eclipse.papyrus.cdo.internal.ui.wizards; @@ -106,7 +106,7 @@ public class ModelReferencesPage extends ModelImportWizardPage { pathText = new Text(result, SWT.BORDER | SWT.MULTI | SWT.WRAP | SWT.READ_ONLY); pathText.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).hint(SWT.DEFAULT, convertHeightInCharsToPixels(3)).create()); - if(isImport) { + if (isImport) { stripSashModelContent = new Button(result, SWT.CHECK); stripSashModelContent.setText(Messages.ModelReferencesPage_2); stripSashModelContent.setToolTipText(Messages.ModelReferencesPage_6); @@ -115,7 +115,7 @@ public class ModelReferencesPage extends ModelImportWizardPage { @Override public void widgetSelected(SelectionEvent e) { - if(getConfiguration() != null) { + if (getConfiguration() != null) { getConfiguration().setStripSashModelContent(stripSashModelContent.getSelection()); } } @@ -126,8 +126,8 @@ public class ModelReferencesPage extends ModelImportWizardPage { @Override public void selectionChanged(SelectionChangedEvent event) { - IStructuredSelection sel = (IStructuredSelection)event.getSelection(); - if(!sel.isEmpty()) { + IStructuredSelection sel = (IStructuredSelection) event.getSelection(); + if (!sel.isEmpty()) { selected(sel.getFirstElement()); } else { selected(null); @@ -135,8 +135,8 @@ public class ModelReferencesPage extends ModelImportWizardPage { } }); - ((ICheckable)modelsTree).addCheckStateListener(contents); - ((ICheckable)modelsTree).addCheckStateListener(new ICheckStateListener() { + ((ICheckable) modelsTree).addCheckStateListener(contents); + ((ICheckable) modelsTree).addCheckStateListener(new ICheckStateListener() { @Override public void checkStateChanged(CheckStateChangedEvent event) { @@ -161,8 +161,8 @@ public class ModelReferencesPage extends ModelImportWizardPage { @Subscribe public void setConfiguration(IModelTransferConfiguration configuration) { - if(configuration != this.importConfig) { - if(this.importConfig != null) { + if (configuration != this.importConfig) { + if (this.importConfig != null) { this.importConfig.dispose(); } @@ -171,18 +171,18 @@ public class ModelReferencesPage extends ModelImportWizardPage { modelsTree.setInput(configuration); - if(configuration != null) { + if (configuration != null) { // initialize the checkboxes initializeCheckedNodes(); // determine enablement of strip-sash-model option - if(stripSashModelContent != null) { + if (stripSashModelContent != null) { stripSashModelContent.setSelection(true); stripSashModelContent.setEnabled(configuration.hasSashModelContent()); this.importConfig.setStripSashModelContent(true); } - } else if(stripSashModelContent != null) { + } else if (stripSashModelContent != null) { stripSashModelContent.setSelection(true); stripSashModelContent.setEnabled(false); } @@ -200,28 +200,28 @@ public class ModelReferencesPage extends ModelImportWizardPage { private void initializeCheckedNodes() { final Collection<IModelTransferNode> initialSet = importConfig.getModelsToTransfer(); - final ITreeContentProvider contents = (ITreeContentProvider)modelsTree.getContentProvider(); - final ICheckable checkable = (ICheckable)modelsTree; + final ITreeContentProvider contents = (ITreeContentProvider) modelsTree.getContentProvider(); + final ICheckable checkable = (ICheckable) modelsTree; final Set<IModelTransferNode> visited = Sets.newHashSet(); final Queue<Object> queue = new java.util.ArrayDeque<Object>(Arrays.asList(contents.getElements(importConfig))); - for(Object next = queue.poll(); next != null; next = queue.poll()) { - ITreeNode parent = (ITreeNode)next; + for (Object next = queue.poll(); next != null; next = queue.poll()) { + ITreeNode parent = (ITreeNode) next; // we must check a parent if the user initially selected it on opening the wizard // or we are importing and it is a dependent of a checked node, // or we are exporting and it is a dependency of a checked node, // or it is a model sub-unit (required dependency) of a checked node boolean mustCheck = initialSet.contains(parent.getElement()); - if(mustCheck) { + if (mustCheck) { checkable.setChecked(next, true); } - if(visited.add(parent.getElement())) { + if (visited.add(parent.getElement())) { // recurse into the children - for(Object child : contents.getChildren(next)) { - ITreeNode treeNode = (ITreeNode)child; + for (Object child : contents.getChildren(next)) { + ITreeNode treeNode = (ITreeNode) child; queue.add(treeNode); // we must check a node if either the user initially selected it on opening the wizard, @@ -229,10 +229,10 @@ public class ModelReferencesPage extends ModelImportWizardPage { // or we are exporting and it is a dependency of a checked node, // or it is a model sub-unit (required dependency) of a checked node mustCheck = initialSet.contains(treeNode.getElement()) // - || (isImport ? treeNode.isDependent() : treeNode.isDependency()) // - || (checkable.getChecked(parent) && parent.getElement().isModelSubUnit(treeNode.getElement())); + || (isImport ? treeNode.isDependent() : treeNode.isDependency()) // + || (checkable.getChecked(parent) && parent.getElement().isModelSubUnit(treeNode.getElement())); - if(mustCheck) { + if (mustCheck) { checkable.setChecked(child, true); importConfig.addModelToTransfer(treeNode.getElement().getPrimaryResourceURI()); } @@ -243,10 +243,10 @@ public class ModelReferencesPage extends ModelImportWizardPage { } void selected(Object treeNode) { - if(treeNode == null) { + if (treeNode == null) { pathText.setText(""); //$NON-NLS-1$ } else { - IModelTransferNode node = ((ITreeNode)treeNode).getElement(); + IModelTransferNode node = ((ITreeNode) treeNode).getElement(); pathText.setText(node.getName()); } @@ -256,8 +256,8 @@ public class ModelReferencesPage extends ModelImportWizardPage { protected Diagnostic doValidatePage() { Diagnostic result = Diagnostic.CANCEL_INSTANCE; - if(importConfig != null) { - if(importConfig.getModelsToTransfer().isEmpty()) { + if (importConfig != null) { + if (importConfig.getModelsToTransfer().isEmpty()) { result = report(Diagnostic.CANCEL, NLS.bind(Messages.ModelReferencesPage_7, isImport ? Messages.ModelReferencesPage_8 : Messages.ModelReferencesPage_9)); } else { result = importConfig.validate(); @@ -295,7 +295,7 @@ public class ModelReferencesPage extends ModelImportWizardPage { nodes.clear(); elements = null; - config = (IModelTransferConfiguration)newInput; + config = (IModelTransferConfiguration) newInput; this.viewer = viewer; } @@ -304,17 +304,17 @@ public class ModelReferencesPage extends ModelImportWizardPage { public Object[] getElements(Object inputElement) { Object[] result = elements; - if((inputElement != config) || (result == null)) { - IModelTransferConfiguration config = (IModelTransferConfiguration)inputElement; + if ((inputElement != config) || (result == null)) { + IModelTransferConfiguration config = (IModelTransferConfiguration) inputElement; List<TreeNode> nodes = Lists.newArrayListWithCapacity(config.getModelsToTransfer().size()); - for(IModelTransferNode next : config.getModelsToTransfer()) { + for (IModelTransferNode next : config.getModelsToTransfer()) { nodes.add(new TreeNode(next)); } result = nodes.toArray(); - if(inputElement == config) { + if (inputElement == config) { // cache the result elements = result; } @@ -325,19 +325,19 @@ public class ModelReferencesPage extends ModelImportWizardPage { @Override public boolean hasChildren(Object element) { - IModelTransferNode importNode = ((TreeNode)element).getElement(); + IModelTransferNode importNode = ((TreeNode) element).getElement(); return !(importNode.getDependencies().isEmpty() && importNode.getDependents().isEmpty()); } @Override public Object getParent(Object element) { - return ((TreeNode)element).getParent(); + return ((TreeNode) element).getParent(); } @Override public Object[] getChildren(Object parentElement) { - return ((TreeNode)parentElement).getChildren(); + return ((TreeNode) parentElement).getChildren(); } @Override @@ -348,18 +348,18 @@ public class ModelReferencesPage extends ModelImportWizardPage { @Override public void checkStateChanged(CheckStateChangedEvent event) { - ITreeNode node = (ITreeNode)event.getElement(); + ITreeNode node = (ITreeNode) event.getElement(); IModelTransferNode model = node.getElement(); // apply the check state to the model - if(event.getChecked()) { + if (event.getChecked()) { config.addModelToTransfer(model.getPrimaryResourceURI()); } else { config.removeModelToTransfer(model); } // propagate the check state to other occurrences of the same model - for(ITreeNode next : nodes.get(model)) { + for (ITreeNode next : nodes.get(model)) { event.getCheckable().setChecked(next, event.getChecked()); } } @@ -410,7 +410,7 @@ public class ModelReferencesPage extends ModelImportWizardPage { } Object[] getChildren() { - if(children == null) { + if (children == null) { createChildren(); } @@ -421,22 +421,22 @@ public class ModelReferencesPage extends ModelImportWizardPage { Collection<IModelTransferNode> dependencies = element.getDependencies(); Collection<IModelTransferNode> dependents = element.getDependents(); - if(!dependencies.isEmpty() || !dependents.isEmpty()) { + if (!dependencies.isEmpty() || !dependents.isEmpty()) { children = Lists.newArrayListWithCapacity(dependencies.size() + dependents.size()); // the recommendation for importing dependencies vs. dependents is - // reversed for export as for import. We suggest to export dependencies + // reversed for export as for import. We suggest to export dependencies // of an exported model (those that it references) and import dependents // of an imported model (those that reference it) - for(IModelTransferNode next : isImport ? dependents : dependencies) { + for (IModelTransferNode next : isImport ? dependents : dependencies) { children.add(new TreeNode(this, next, isImport)); } - for(IModelTransferNode next : isImport ? dependencies : dependents) { + for (IModelTransferNode next : isImport ? dependencies : dependents) { // don't show a model as both a dependent and a // dependency if it both references and is // referenced by the other - if(isImport ? !dependents.contains(next) : !dependencies.contains(next)) { + if (isImport ? !dependents.contains(next) : !dependencies.contains(next)) { children.add(new TreeNode(this, next, false)); } } @@ -446,11 +446,11 @@ public class ModelReferencesPage extends ModelImportWizardPage { @Override public void run() { - if(config != null) { + if (config != null) { Collection<IModelTransferNode> imported = config.getModelsToTransfer(); - ICheckable checkable = (ICheckable)viewer; - for(ITreeNode next : children) { - if(imported.contains(next.getElement())) { + ICheckable checkable = (ICheckable) viewer; + for (ITreeNode next : children) { + if (imported.contains(next.getElement())) { checkable.setChecked(next, true); } } @@ -468,12 +468,12 @@ public class ModelReferencesPage extends ModelImportWizardPage { @Override public Image getImage(Object element) { - ITreeNode treeNode = (ITreeNode)element; + ITreeNode treeNode = (ITreeNode) element; Image result = super.getImage(element); - if((result != null) && treeNode.isDependent()) { + if ((result != null) && treeNode.isDependent()) { // decorate it - result = (Image)images.get(new DecorationOverlayIcon(result, Activator.getIcon(Activator.ICON_DEPENDENT_OVERLAY16), IDecoration.TOP_RIGHT)); + result = (Image) images.get(new DecorationOverlayIcon(result, Activator.getIcon(Activator.ICON_DEPENDENT_OVERLAY16), IDecoration.TOP_RIGHT)); } return result; @@ -486,7 +486,7 @@ public class ModelReferencesPage extends ModelImportWizardPage { @Override protected IModelTransferNode getModelImportNode(Object element) { - return ((ITreeNode)element).getElement(); + return ((ITreeNode) element).getElement(); } } } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/RepositorySelectionBlock.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/RepositorySelectionBlock.java index 675073e7132..7981b6be94c 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/RepositorySelectionBlock.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/RepositorySelectionBlock.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -71,31 +71,32 @@ public class RepositorySelectionBlock { repoList.setLabelProvider(new RepositoryLabelProvider()); repoList.setInput(repoMan); - if(selectedRepository != null) { + if (selectedRepository != null) { repoList.setSelection(new StructuredSelection(selectedRepository)); selected(selectedRepository); } repoList.addSelectionChangedListener(new ISelectionChangedListener() { + @Override public void selectionChanged(SelectionChangedEvent event) { - IStructuredSelection sel = (IStructuredSelection)event.getSelection(); + IStructuredSelection sel = (IStructuredSelection) event.getSelection(); - if(sel.isEmpty()) { - if(selectedRepository != null) { + if (sel.isEmpty()) { + if (selectedRepository != null) { // veto empty selection repoList.setSelection(new StructuredSelection(selectedRepository)); } } else { - selected((IPapyrusRepository)sel.getFirstElement()); + selected((IPapyrusRepository) sel.getFirstElement()); } } }); // initially select the first connected repo - for(IPapyrusRepository next : PapyrusRepositoryManager.INSTANCE.getRepositories()) { + for (IPapyrusRepository next : PapyrusRepositoryManager.INSTANCE.getRepositories()) { - if(next.isConnected()) { + if (next.isConnected()) { selected(next); repoList.setSelection(new StructuredSelection(next)); break; @@ -110,7 +111,7 @@ public class RepositorySelectionBlock { } public void setEnabled(boolean enabled) { - if(repoList != null) { + if (repoList != null) { repoList.getControl().setEnabled(enabled); } } @@ -122,10 +123,11 @@ public class RepositorySelectionBlock { void selected(final IPapyrusRepository repository) { selectedRepository = repository; - if(!repository.isConnected()) { + if (!repository.isConnected()) { try { runnableContext.get().run(true, false, new IRunnableWithProgress() { + @Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { SubMonitor sub = SubMonitor.convert(monitor, NLS.bind(Messages.RepositorySelectionBlock_0, repository.getName()), IProgressMonitor.UNKNOWN); @@ -136,17 +138,18 @@ public class RepositorySelectionBlock { // yes, it's a busy wait, but there's not much // to be done about that. final long deadline = System.currentTimeMillis() + 5000L; - while(!repository.isConnected()) { + while (!repository.isConnected()) { Thread.sleep(250L); - if(System.currentTimeMillis() >= deadline) { + if (System.currentTimeMillis() >= deadline) { break; } } repoList.getControl().getDisplay().asyncExec(new Runnable() { + @Override public void run() { - if(!repoList.getControl().isDisposed()) { + if (!repoList.getControl().isDisposed()) { repoList.update(repository, null); bus.post(repository); } @@ -168,7 +171,7 @@ public class RepositorySelectionBlock { public void setSelectedRepository(IPapyrusRepository repository) { this.selectedRepository = repository; - if(repoList != null) { + if (repoList != null) { repoList.setSelection(new StructuredSelection(selectedRepository)); selected(selectedRepository); } @@ -184,14 +187,17 @@ public class RepositorySelectionBlock { private static class RepositoryContentProvider implements IStructuredContentProvider { + @Override public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { viewer.refresh(); } + @Override public Object[] getElements(Object inputElement) { - return ((IPapyrusRepositoryManager)inputElement).getRepositories().toArray(); + return ((IPapyrusRepositoryManager) inputElement).getRepositories().toArray(); } + @Override public void dispose() { // pass } @@ -201,13 +207,13 @@ public class RepositorySelectionBlock { @Override public Image getImage(Object element) { - boolean open = ((IPapyrusRepository)element).isConnected(); + boolean open = ((IPapyrusRepository) element).isConnected(); return SharedImages.getImage(open ? Activator.ICON_OPEN_REPOSITORY : Activator.ICON_CLOSED_REPOSITORY); } @Override public String getText(Object element) { - return ((IPapyrusRepository)element).getName(); + return ((IPapyrusRepository) element).getName(); } } } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/RepositorySelectionPage.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/RepositorySelectionPage.java index 5e5993f487b..2ba00195d5d 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/RepositorySelectionPage.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/RepositorySelectionPage.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -44,6 +44,7 @@ public class RepositorySelectionPage extends ModelImportWizardPage { super("repository", Messages.RepositorySelectionPage_2, null, bus, MESSAGE); //$NON-NLS-1$ } + @Override public void createControl(Composite parent) { initializeDialogUnits(parent); @@ -63,7 +64,7 @@ public class RepositorySelectionPage extends ModelImportWizardPage { repoBlock.createControl(group); repoBlock.setEditable(false); - if(repository != null) { + if (repository != null) { repoSelectionBlock.setSelectedRepository(repository); repoBlock.setRepository(repository); } @@ -85,11 +86,11 @@ public class RepositorySelectionPage extends ModelImportWizardPage { public void selected(IPapyrusRepository repository) { this.repository = repository; - if((repoSelectionBlock != null) && (repoSelectionBlock.getSelectedRepository() != repository)) { + if ((repoSelectionBlock != null) && (repoSelectionBlock.getSelectedRepository() != repository)) { repoSelectionBlock.setSelectedRepository(repository); } - if(repoBlock != null) { + if (repoBlock != null) { repoBlock.setRepository(repository); validatePage(); } @@ -99,7 +100,7 @@ public class RepositorySelectionPage extends ModelImportWizardPage { protected Diagnostic doValidatePage() { Diagnostic result = Diagnostic.CANCEL_INSTANCE; - if(getSelectedRepository() != null) { + if (getSelectedRepository() != null) { result = Diagnostic.OK_INSTANCE; } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/WizardOperationContext.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/WizardOperationContext.java index ee60c7a8845..86694488ec0 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/WizardOperationContext.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/WizardOperationContext.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -39,18 +39,20 @@ public class WizardOperationContext implements IModelTransferOperation.Context { this.wizard = wizard; } + @Override public Diagnostic run(final IModelTransferOperation operation) { final Diagnostic[] result = { Diagnostic.OK_INSTANCE }; try { getContainer().run(true, false, new IRunnableWithProgress() { + @Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { result[0] = operation.run(new UISafeProgressMonitor(monitor, display)); } }); } catch (Exception e) { - result[0] = new BasicDiagnostic(Diagnostic.ERROR, Activator.PLUGIN_ID, 0, Messages.WizardOperationContext_0, new Object[]{ e }); + result[0] = new BasicDiagnostic(Diagnostic.ERROR, Activator.PLUGIN_ID, 0, Messages.WizardOperationContext_0, new Object[] { e }); StatusManager.getManager().handle(BasicDiagnostic.toIStatus(result[0]), StatusManager.SHOW); } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.diagram.ui/src/org/eclipse/papyrus/cdo/uml/diagram/internal/ui/Activator.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.diagram.ui/src/org/eclipse/papyrus/cdo/uml/diagram/internal/ui/Activator.java index 2d392b5bbb4..0b4a429d879 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.diagram.ui/src/org/eclipse/papyrus/cdo/uml/diagram/internal/ui/Activator.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.diagram.ui/src/org/eclipse/papyrus/cdo/uml/diagram/internal/ui/Activator.java @@ -14,7 +14,7 @@ public class Activator extends AbstractUIPlugin { // The shared instance private static Activator plugin; - + /** Logging helper */ public static LogHelper log = new LogHelper(); @@ -25,15 +25,17 @@ public class Activator extends AbstractUIPlugin { super(); } + @Override public void start(BundleContext context) throws Exception { super.start(context); plugin = this; - + // register the log helper log.setPlugin(plugin); } + @Override public void stop(BundleContext context) throws Exception { log = null; plugin = null; diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.diagram.ui/src/org/eclipse/papyrus/cdo/uml/diagram/internal/ui/handlers/NewModelHandler.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.diagram.ui/src/org/eclipse/papyrus/cdo/uml/diagram/internal/ui/handlers/NewModelHandler.java index e273f8994e9..8340bd1d81b 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.diagram.ui/src/org/eclipse/papyrus/cdo/uml/diagram/internal/ui/handlers/NewModelHandler.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.diagram.ui/src/org/eclipse/papyrus/cdo/uml/diagram/internal/ui/handlers/NewModelHandler.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -38,12 +38,12 @@ public class NewModelHandler extends AbstractHandler { public Object execute(ExecutionEvent event) throws ExecutionException { setEnabled(event.getApplicationContext()); - if(isEnabled()) { + if (isEnabled()) { ISelection selection = HandlerUtil.getCurrentSelection(event); - if(selection instanceof IStructuredSelection) { + if (selection instanceof IStructuredSelection) { InitModelWizard wizard = new InitModelWizard(); - wizard.init(HandlerUtil.getActiveWorkbenchWindow(event).getWorkbench(), (IStructuredSelection)selection); + wizard.init(HandlerUtil.getActiveWorkbenchWindow(event).getWorkbench(), (IStructuredSelection) selection); WizardDialog dlg = new WizardDialog(HandlerUtil.getActiveShell(event), wizard); dlg.open(); @@ -56,7 +56,7 @@ public class NewModelHandler extends AbstractHandler { @Override public void setEnabled(Object evaluationContext) { Object variable = HandlerUtil.getVariable(evaluationContext, ISources.ACTIVE_CURRENT_SELECTION_NAME); - ISelection selection = variable instanceof ISelection ? (ISelection)variable : StructuredSelection.EMPTY; + ISelection selection = variable instanceof ISelection ? (ISelection) variable : StructuredSelection.EMPTY; CDOObject cdoObject = CDOUtils.adapt(UIUtil.getElement(selection), CDOObject.class); setBaseEnabled((cdoObject == null) || !CDOUtils.isReadOnly(cdoObject)); diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.diagram.ui/src/org/eclipse/papyrus/cdo/uml/diagram/internal/ui/l10n/Messages.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.diagram.ui/src/org/eclipse/papyrus/cdo/uml/diagram/internal/ui/l10n/Messages.java index bb939f42485..2702f893969 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.diagram.ui/src/org/eclipse/papyrus/cdo/uml/diagram/internal/ui/l10n/Messages.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.diagram.ui/src/org/eclipse/papyrus/cdo/uml/diagram/internal/ui/l10n/Messages.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -14,7 +14,7 @@ package org.eclipse.papyrus.cdo.uml.diagram.internal.ui.l10n; import org.eclipse.osgi.util.NLS; /** - * This is the Messages type. Enjoy. + * This is the Messages type. Enjoy. */ public class Messages extends NLS { diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.diagram.ui/src/org/eclipse/papyrus/cdo/uml/diagram/internal/ui/wizards/CDONewModelStorageProvider.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.diagram.ui/src/org/eclipse/papyrus/cdo/uml/diagram/internal/ui/wizards/CDONewModelStorageProvider.java index 4b297d68b42..b125c500137 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.diagram.ui/src/org/eclipse/papyrus/cdo/uml/diagram/internal/ui/wizards/CDONewModelStorageProvider.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.diagram.ui/src/org/eclipse/papyrus/cdo/uml/diagram/internal/ui/wizards/CDONewModelStorageProvider.java @@ -1,6 +1,6 @@ /***************************************************************************** * Copyright (c) 2013, 2014 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 @@ -9,7 +9,7 @@ * Contributors: * CEA LIST - Initial API and implementation * Christian W. Damus (CEA) - bug 429242 - * + * *****************************************************************************/ package org.eclipse.papyrus.cdo.uml.diagram.internal.ui.wizards; @@ -28,6 +28,7 @@ import org.eclipse.emf.ecore.EObject; import org.eclipse.jface.operation.IRunnableContext; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.wizard.IWizardPage; +import org.eclipse.osgi.util.NLS; import org.eclipse.papyrus.cdo.core.IPapyrusRepository; import org.eclipse.papyrus.cdo.internal.core.CDOUtils; import org.eclipse.papyrus.cdo.internal.core.PapyrusRepositoryManager; @@ -60,8 +61,8 @@ public class CDONewModelStorageProvider extends AbstractNewModelStorageProvider public boolean canHandle(IStructuredSelection initialSelection) { boolean result = false; - for(Object next : initialSelection.toList()) { - if(CDOUtils.isCDOObject(adapt(next, EObject.class))) { + for (Object next : initialSelection.toList()) { + if (CDOUtils.isCDOObject(adapt(next, EObject.class))) { result = true; break; } @@ -79,37 +80,37 @@ public class CDONewModelStorageProvider extends AbstractNewModelStorageProvider createSelectProviderPart(); IPapyrusRepository repo = getRepository(selection); - if(repo != null) { + if (repo != null) { bus.post(repo); } } /** * Gets the contextual repository, if any, from a selection. - * + * * @param selection - * a selection - * + * a selection + * * @return the repository that is or contains the {@code selection} */ static IPapyrusRepository getRepository(IStructuredSelection selection) { IPapyrusRepository result = null; - if(!selection.isEmpty()) { + if (!selection.isEmpty()) { result = adapt(selection.getFirstElement(), IPapyrusRepository.class); - if(result == null) { + if (result == null) { CDOResourceNode node = adapt(selection.getFirstElement(), CDOResourceNode.class); - if(node == null) { + if (node == null) { EObject object = adapt(selection.getFirstElement(), EObject.class); - if(object != null) { + if (object != null) { CDOObject cdo = CDOUtils.getCDOObject(object); - if(cdo != null) { + if (cdo != null) { node = cdo.cdoResource(); } } } - if(node != null) { + if (node != null) { result = PapyrusRepositoryManager.INSTANCE.getRepositoryForURI(node.getURI()); } } @@ -120,7 +121,7 @@ public class CDONewModelStorageProvider extends AbstractNewModelStorageProvider @Override public List<? extends IWizardPage> createPages() { - if(newModelPage == null) { + if (newModelPage == null) { return Collections.emptyList(); } @@ -129,9 +130,9 @@ public class CDONewModelStorageProvider extends AbstractNewModelStorageProvider @Override public IStatus validateDiagramCategories(String... newCategories) { - if(newModelPage != null) { + if (newModelPage != null) { String firstCategory = newCategories.length > 0 ? newCategories[0] : null; - if(newCategories.length > 0) { + if (newCategories.length > 0) { // 316943 - [Wizard] Wrong suffix for file name when creating a // profile model return newModelPage.diagramExtensionChanged(wizard.getDiagramFileExtension(firstCategory)); @@ -143,21 +144,21 @@ public class CDONewModelStorageProvider extends AbstractNewModelStorageProvider /** * Creates the new model page, if required. - * + * * @param selection - * the selection - * + * the selection + * * @return the new model page, or {@code null} if none */ protected NewModelPage createNewModelPage(IStructuredSelection selection) { - if(wizard.isCreateProjectWizard() || wizard.isCreateMultipleModelsWizard()) { + if (wizard.isCreateProjectWizard() || wizard.isCreateMultipleModelsWizard()) { return null; } - if(isCreateFromExistingDomainModel()) { + if (isCreateFromExistingDomainModel()) { URI uri = getSelectedResourceURI(selection); - if(uri != null) { + if (uri != null) { uri = uri.trimFileExtension().appendFileExtension(wizard.getDiagramFileExtension(null)); return new NewDiagramForExistingModelPage(selection, wizard.getModelKindName(), bus, uri.lastSegment()); } @@ -167,7 +168,7 @@ public class CDONewModelStorageProvider extends AbstractNewModelStorageProvider } protected boolean isCreateFromExistingDomainModel() { - return wizard.isInitModelWizard() && ((InitModelWizard)wizard).isCreateFromExistingDomainModel(); + return wizard.isInitModelWizard() && ((InitModelWizard) wizard).isCreateFromExistingDomainModel(); } @Override @@ -177,7 +178,7 @@ public class CDONewModelStorageProvider extends AbstractNewModelStorageProvider @Override public ISelectProviderPart createSelectProviderPart() { - if(selectProviderPart == null) { + if (selectProviderPart == null) { selectProviderPart = new RepositorySelectionPart(PapyrusRepositoryManager.INSTANCE, bus, new Supplier<IRunnableContext>() { @Override @@ -204,16 +205,16 @@ public class CDONewModelStorageProvider extends AbstractNewModelStorageProvider /** * Instantiates a new new diagram for existing model page. - * + * * @param selection - * the selection + * the selection * @param modelKindName - * the user-presentable (translatable) name of the kind of - * model to create + * the user-presentable (translatable) name of the kind of + * model to create * @param bus - * an event bus for posting events + * an event bus for posting events * @param defaultResourceName - * the default resource name + * the default resource name */ public NewDiagramForExistingModelPage(IStructuredSelection selection, String modelKindName, EventBus bus, String defaultResourceName) { @@ -235,9 +236,9 @@ public class CDONewModelStorageProvider extends AbstractNewModelStorageProvider protected void validatePage() { super.validatePage(); - if(getMessageType() < ERROR) { - if(!myDiagramResourceName.equals(getNewResourceName())) { - setMessage(org.eclipse.papyrus.uml.diagram.wizards.Messages.bind(org.eclipse.papyrus.uml.diagram.wizards.Messages.InitModelWizard_diagram_name_is_different_from_domain_model, myDiagramResourceName), ERROR); + if (getMessageType() < ERROR) { + if (!myDiagramResourceName.equals(getNewResourceName())) { + setMessage(NLS.bind(org.eclipse.papyrus.uml.diagram.wizards.Messages.InitModelWizard_diagram_name_is_different_from_domain_model, myDiagramResourceName), ERROR); setPageComplete(false); } } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.diagram.ui/src/org/eclipse/papyrus/cdo/uml/diagram/internal/ui/wizards/NewModelPage.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.diagram.ui/src/org/eclipse/papyrus/cdo/uml/diagram/internal/ui/wizards/NewModelPage.java index e8e971e40f1..ed5b3c1fad3 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.diagram.ui/src/org/eclipse/papyrus/cdo/uml/diagram/internal/ui/wizards/NewModelPage.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.diagram.ui/src/org/eclipse/papyrus/cdo/uml/diagram/internal/ui/wizards/NewModelPage.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -73,9 +73,9 @@ public class NewModelPage extends WizardPage { setTitle(NLS.bind(Messages.NewModelPage_0, modelKindName)); setDescription(NLS.bind(Messages.NewModelPage_1, modelKindName)); - if(!selection.isEmpty()) { + if (!selection.isEmpty()) { selectedNode = adapt(selection.getFirstElement(), CDOResourceNode.class); - if((selectedNode != null) && !(selectedNode instanceof CDOResourceFolder)) { + if ((selectedNode != null) && !(selectedNode instanceof CDOResourceFolder)) { selectedNode = selectedNode.getFolder(); } } @@ -83,6 +83,7 @@ public class NewModelPage extends WizardPage { bus.register(this); } + @Override public void createControl(Composite parent) { Composite myComposite = new Composite(parent, SWT.NONE); GridDataFactory.fillDefaults().grab(true, true).applyTo(myComposite); @@ -102,10 +103,10 @@ public class NewModelPage extends WizardPage { foldersTree.setContentProvider(itemProvider); foldersTree.setLabelProvider(new DecoratingLabelProvider(itemProvider, PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator())); foldersTree.setSorter(itemProvider); - if(getRepository() != null) { + if (getRepository() != null) { foldersTree.setInput(getRepository()); } - if(selectedNode != null) { + if (selectedNode != null) { foldersTree.setSelection(new StructuredSelection(selectedNode)); } @@ -119,6 +120,7 @@ public class NewModelPage extends WizardPage { folderText.addModifyListener(new ModifyListener() { + @Override public void modifyText(ModifyEvent e) { findFolderSelection(); validatePage(); @@ -127,8 +129,9 @@ public class NewModelPage extends WizardPage { foldersTree.addSelectionChangedListener(new ISelectionChangedListener() { + @Override public void selectionChanged(SelectionChangedEvent event) { - IStructuredSelection selection = (IStructuredSelection)event.getSelection(); + IStructuredSelection selection = (IStructuredSelection) event.getSelection(); selectedNode = selection.isEmpty() ? null : adapt(selection.getFirstElement(), CDOResourceNode.class); updateFolderSelection(); validatePage(); @@ -137,6 +140,7 @@ public class NewModelPage extends WizardPage { nameText.addModifyListener(new ModifyListener() { + @Override public void modifyText(ModifyEvent e) { validatePage(); } @@ -149,7 +153,7 @@ public class NewModelPage extends WizardPage { public void setRepository(IPapyrusRepository repository) { this.repository = repository; - if(foldersTree != null) { + if (foldersTree != null) { foldersTree.setInput(repository); } @@ -157,7 +161,7 @@ public class NewModelPage extends WizardPage { } private IInternalPapyrusRepository getRepository() { - return ((IInternalPapyrusRepository)repository); + return ((IInternalPapyrusRepository) repository); } CDOView getView() { @@ -172,17 +176,18 @@ public class NewModelPage extends WizardPage { void updateFolderSelection() { whileSynchronizingFolderSelection(new Runnable() { + @Override public void run() { CDOResourceFolder selected = null; - if(selectedNode instanceof CDOResourceFolder) { - selected = (CDOResourceFolder)selectedNode; - } else if(selectedNode != null) { + if (selectedNode instanceof CDOResourceFolder) { + selected = (CDOResourceFolder) selectedNode; + } else if (selectedNode != null) { // will be null if the selectedNode is contained by the root // resource selected = selectedNode.getFolder(); } - if(selected == null) { + if (selected == null) { folderText.setText(""); //$NON-NLS-1$ } else { folderText.setText(selected.getPath()); @@ -194,11 +199,12 @@ public class NewModelPage extends WizardPage { void findFolderSelection() { whileSynchronizingFolderSelection(new Runnable() { + @Override public void run() { String folder = folderText.getText().trim(); CDOView view = getView(); - if(view != null) { - if(folder.equals("")) { //$NON-NLS-1$ + if (view != null) { + if (folder.equals("")) { //$NON-NLS-1$ foldersTree.setSelection(StructuredSelection.EMPTY); } else { try { @@ -213,7 +219,7 @@ public class NewModelPage extends WizardPage { } private void whileSynchronizingFolderSelection(Runnable runnable) { - if(!synchronizingFolderSelection) { + if (!synchronizingFolderSelection) { synchronizingFolderSelection = true; try { @@ -228,9 +234,9 @@ public class NewModelPage extends WizardPage { String result = String.format("%s.%s", baseName, extension); //$NON-NLS-1$ CDOView view = getView(); - if(view != null) { - for(int i = 1;; i++) { - if(!view.hasResource(getNewResourcePath(result))) { + if (view != null) { + for (int i = 1;; i++) { + if (!view.hasResource(getNewResourcePath(result))) { break; } else { // use %s instead of %d to avoid any thousands separators @@ -247,17 +253,17 @@ public class NewModelPage extends WizardPage { String result = null; String path = getSelectedFolderPath(); - if(path.equals("")) { //$NON-NLS-1$ + if (path.equals("")) { //$NON-NLS-1$ // it's a resource in the root result = "/" + name; //$NON-NLS-1$ } else { StringBuilder buf = new StringBuilder(); - if(!path.startsWith("/")) { //$NON-NLS-1$ + if (!path.startsWith("/")) { //$NON-NLS-1$ buf.append("/"); //$NON-NLS-1$ } buf.append(path); - if(!path.endsWith("/")) { //$NON-NLS-1$ + if (!path.endsWith("/")) { //$NON-NLS-1$ buf.append("/"); //$NON-NLS-1$ } buf.append(name); @@ -284,12 +290,12 @@ public class NewModelPage extends WizardPage { String result = null; String name = getNewResourceName(); - if(name != null) { + if (name != null) { // the proper extension is whatever follows the *last* '.', // but for our purposes we need e.g. "profile.uml" to be // an extension int dot = name.indexOf('.'); - if(dot >= 0) { + if (dot >= 0) { result = name.substring(dot + 1); } } @@ -299,18 +305,18 @@ public class NewModelPage extends WizardPage { /** * Diagram extension changed. - * + * * @param newExtension - * the new extension + * the new extension * @return result of validation of the new extension */ public IStatus diagramExtensionChanged(String newExtension) { String currentExtension = getExtension(); - if(!newExtension.equals(currentExtension)) { + if (!newExtension.equals(currentExtension)) { String oldFileName = getNewResourceName(); String base = oldFileName; - if(currentExtension != null) { + if (currentExtension != null) { // take one off for the '.' base = base.substring(0, base.length() - currentExtension.length() - 1); } @@ -319,13 +325,13 @@ public class NewModelPage extends WizardPage { setNewResourceName(newFileName); String message1 = org.eclipse.papyrus.uml.diagram.wizards.Messages.NewModelFilePage_new_diagram_category_needs_specific_extension; - String message2 = org.eclipse.papyrus.uml.diagram.wizards.Messages.bind(org.eclipse.papyrus.uml.diagram.wizards.Messages.NewModelFilePage_diagram_file_was_renamed, oldFileName, newFileName); + String message2 = NLS.bind(org.eclipse.papyrus.uml.diagram.wizards.Messages.NewModelFilePage_diagram_file_was_renamed, oldFileName, newFileName); String message = message1 + message2; - Status resultStatus = new Status(Status.INFO, Activator.PLUGIN_ID, message); + Status resultStatus = new Status(IStatus.INFO, Activator.PLUGIN_ID, message); String errorMessage = getErrorMessage(); - if(errorMessage != null) { - resultStatus = new Status(Status.ERROR, Activator.PLUGIN_ID, errorMessage); + if (errorMessage != null) { + resultStatus = new Status(IStatus.ERROR, Activator.PLUGIN_ID, errorMessage); } return resultStatus; } @@ -337,22 +343,22 @@ public class NewModelPage extends WizardPage { setPageComplete(true); String name = getNewResourceName(); - if(getView() == null) { + if (getView() == null) { setMessage(Messages.NewModelPage_16, ERROR); setPageComplete(false); - } else if(Strings.isNullOrEmpty(name)) { + } else if (Strings.isNullOrEmpty(name)) { setMessage(Messages.NewModelPage_17, ERROR); setPageComplete(false); } else { String path = getNewResourcePath(name); - if(getView().hasResource(path)) { + if (getView().hasResource(path)) { setMessage(NLS.bind(Messages.NewModelPage_18, path), ERROR); setPageComplete(false); } else { // check existence of folder (if any) String folderPath = getSelectedFolderPath(); - if(!Strings.isNullOrEmpty(folderPath)) { - if(!getView().hasResource(folderPath)) { + if (!Strings.isNullOrEmpty(folderPath)) { + if (!getView().hasResource(folderPath)) { setMessage(Messages.NewModelPage_19, WARNING); } } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.diagram.ui/src/org/eclipse/papyrus/cdo/uml/diagram/internal/ui/wizards/RepositorySelectionPart.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.diagram.ui/src/org/eclipse/papyrus/cdo/uml/diagram/internal/ui/wizards/RepositorySelectionPart.java index beaee4e54cc..481bf9eeebd 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.diagram.ui/src/org/eclipse/papyrus/cdo/uml/diagram/internal/ui/wizards/RepositorySelectionPart.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.diagram.ui/src/org/eclipse/papyrus/cdo/uml/diagram/internal/ui/wizards/RepositorySelectionPart.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -47,11 +47,12 @@ public class RepositorySelectionPart this.bus = bus; } + @Override public Control createControl(Composite parent) { bus.register(this); repoSelectionBlock = new RepositorySelectionBlock(repoMan, bus, - runnableContext); + runnableContext); return repoSelectionBlock.createControl(parent); } @@ -63,8 +64,8 @@ public class RepositorySelectionPart public IPapyrusRepository getSelectedRepository() { return (repoSelectionBlock == null) - ? null - : repoSelectionBlock.getSelectedRepository(); + ? null + : repoSelectionBlock.getSelectedRepository(); } @Subscribe @@ -72,9 +73,10 @@ public class RepositorySelectionPart firePartCompleteChanged(); } + @Override public boolean isPartComplete() { return (getSelectedRepository() != null) - && getSelectedRepository().isConnected(); + && getSelectedRepository().isConnected(); } } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.search.ui/src/org/eclipse/papyrus/cdo/uml/search/internal/ui/Activator.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.search.ui/src/org/eclipse/papyrus/cdo/uml/search/internal/ui/Activator.java index 01963be9abd..d87006de68f 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.search.ui/src/org/eclipse/papyrus/cdo/uml/search/internal/ui/Activator.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.search.ui/src/org/eclipse/papyrus/cdo/uml/search/internal/ui/Activator.java @@ -1,6 +1,6 @@ /***************************************************************************** * Copyright (c) 2013 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 @@ -25,7 +25,7 @@ public class Activator extends AbstractUIPlugin { // The shared instance private static Activator plugin; - + /** Logging helper */ public static LogHelper log = new LogHelper(); @@ -36,15 +36,17 @@ public class Activator extends AbstractUIPlugin { super(); } + @Override public void start(BundleContext context) throws Exception { super.start(context); plugin = this; - + // register the log helper log.setPlugin(plugin); } + @Override public void stop(BundleContext context) throws Exception { log = null; plugin = null; diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.search.ui/src/org/eclipse/papyrus/cdo/uml/search/internal/ui/open/CDOOpenElementService.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.search.ui/src/org/eclipse/papyrus/cdo/uml/search/internal/ui/open/CDOOpenElementService.java index 722c3c72992..8ef6c971044 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.search.ui/src/org/eclipse/papyrus/cdo/uml/search/internal/ui/open/CDOOpenElementService.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.search.ui/src/org/eclipse/papyrus/cdo/uml/search/internal/ui/open/CDOOpenElementService.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -41,6 +41,6 @@ public class CDOOpenElementService extends OpenElementServiceImpl { @Override protected IMultiDiagramEditor openEditor(IWorkbenchPage workbenchPage, IEditorInput input) throws PartInitException { - return (IMultiDiagramEditor)PapyrusCDOEditorManager.INSTANCE.openEditor(workbenchPage, input); + return (IMultiDiagramEditor) PapyrusCDOEditorManager.INSTANCE.openEditor(workbenchPage, input); } } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.search.ui/src/org/eclipse/papyrus/cdo/uml/search/internal/ui/query/AttributeMatchStrategy.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.search.ui/src/org/eclipse/papyrus/cdo/uml/search/internal/ui/query/AttributeMatchStrategy.java index e08035635a0..5e2559547fd 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.search.ui/src/org/eclipse/papyrus/cdo/uml/search/internal/ui/query/AttributeMatchStrategy.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.search.ui/src/org/eclipse/papyrus/cdo/uml/search/internal/ui/query/AttributeMatchStrategy.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -51,7 +51,7 @@ public abstract class AttributeMatchStrategy { public static AttributeMatchStrategy create(QueryInfo info) { AttributeMatchStrategy result; - if(info.isSearchAllStringAttributes()) { + if (info.isSearchAllStringAttributes()) { result = new AnyStringAttribute(info); } else { result = new NameOnly(info); @@ -68,7 +68,7 @@ public abstract class AttributeMatchStrategy { protected void match(String value, EAttribute attribute, AbstractResultEntry parentMatch, EObject element, Collection<? super AttributeMatch> results) { matcher.reset(value); - while(matcher.find()) { + while (matcher.find()) { results.add(new AttributeMatch(parentMatch, matcher.start(), matcher.end() - matcher.start(), element, attribute, null)); } } @@ -85,9 +85,9 @@ public abstract class AttributeMatchStrategy { @Override public void apply(AbstractResultEntry parentMatch, EObject element, Collection<? super AttributeMatch> results) { - String name = (element instanceof NamedElement) ? ((NamedElement)element).getName() : null; + String name = (element instanceof NamedElement) ? ((NamedElement) element).getName() : null; - if(name != null) { + if (name != null) { match(name, UMLPackage.Literals.NAMED_ELEMENT__NAME, parentMatch, element, results); } } @@ -101,16 +101,16 @@ public abstract class AttributeMatchStrategy { @Override public void apply(AbstractResultEntry parentMatch, EObject element, Collection<? super AttributeMatch> results) { - for(EAttribute next : element.eClass().getEAllAttributes()) { - if(isString(next)) { - if(!next.isMany()) { - String value = (String)element.eGet(next); - if(value != null) { + for (EAttribute next : element.eClass().getEAllAttributes()) { + if (isString(next)) { + if (!next.isMany()) { + String value = (String) element.eGet(next); + if (value != null) { match(value, next, parentMatch, element, results); } } else { // FIXME: Using list's string representation as in core Papyrus, but it doesn't make sense - List<?> value = (List<?>)element.eGet(next); + List<?> value = (List<?>) element.eGet(next); match(value.toString(), next, parentMatch, element, results); } } @@ -136,29 +136,29 @@ public abstract class AttributeMatchStrategy { apply(element.eClass(), parentMatch, element, results); - for(EClass next : element.eClass().getEAllSuperTypes()) { + for (EClass next : element.eClass().getEAllSuperTypes()) { apply(next, parentMatch, element, results); } } protected void apply(EClass eclass, AbstractResultEntry parentMatch, EObject element, Collection<? super AttributeMatch> results) { - if(this.attributes.containsKey(eclass)) { + if (this.attributes.containsKey(eclass)) { Collection<EAttribute> attributes = this.attributes.get(eclass); - if(attributes.isEmpty()) { + if (attributes.isEmpty()) { attributes = eclass.getEAllAttributes(); } - for(EAttribute next : attributes) { + for (EAttribute next : attributes) { // don't repeat any attributes because of inheritance - if(seen.add(next)) { - if(!next.isMany()) { + if (seen.add(next)) { + if (!next.isMany()) { Object value = element.eGet(next); - if(value != null) { + if (value != null) { match(value.toString(), next, parentMatch, element, results); } } else { // FIXME: Using list's string representation as in core Papyrus, but it doesn't make sense - List<?> value = (List<?>)element.eGet(next); + List<?> value = (List<?>) element.eGet(next); match(value.toString(), next, parentMatch, element, results); } } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.search.ui/src/org/eclipse/papyrus/cdo/uml/search/internal/ui/query/CDOPapyrusQuery.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.search.ui/src/org/eclipse/papyrus/cdo/uml/search/internal/ui/query/CDOPapyrusQuery.java index f7b8541313d..1cbeb0364bb 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.search.ui/src/org/eclipse/papyrus/cdo/uml/search/internal/ui/query/CDOPapyrusQuery.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.search.ui/src/org/eclipse/papyrus/cdo/uml/search/internal/ui/query/CDOPapyrusQuery.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -100,14 +100,14 @@ public class CDOPapyrusQuery extends AbstractPapyrusQuery { // we cannot query for EClasses that the server doesn't know about. And, // if it doesn't know about an EClass, then a priori, none of its // instances exist, so we don't need to run the query - if(view.getSession().getPackageRegistry().getPackageInfo(UMLPackage.eINSTANCE) != null) { + if (view.getSession().getPackageRegistry().getPackageInfo(UMLPackage.eINSTANCE) != null) { List<Element> queryResult = query.getResult(Element.class); final Map<URI, ScopeEntry> scopeEntries = Maps.newHashMap(); // don't use an iterator because it won't be able to advance // past a resource proxy that cannot be resolved - for(int i = 0; i < queryResult.size(); i++) { + for (int i = 0; i < queryResult.size(); i++) { try { Element next = queryResult.get(i); @@ -115,7 +115,7 @@ public class CDOPapyrusQuery extends AbstractPapyrusQuery { ResourceSet rset = resource.getResourceSet(); ServicesRegistry services = ServiceUtilsForResourceSet.getInstance().getServiceRegistry(rset); ScopeEntry scopeEntry = scopeEntries.get(resource.getURI()); - if(scopeEntry == null) { + if (scopeEntry == null) { scopeEntry = new ScopeEntry(resource.getURI(), services); scopeEntries.put(resource.getURI(), scopeEntry); } @@ -141,7 +141,7 @@ public class CDOPapyrusQuery extends AbstractPapyrusQuery { List<Match> attributeMatches = Lists.newArrayListWithExpectedSize(1); attributeMatchStrategy.apply(elementMatch, element, attributeMatches); - if(!attributeMatches.isEmpty()) { + if (!attributeMatches.isEmpty()) { searchResult.addMatches(Iterables.toArray(attributeMatches, Match.class)); } } @@ -156,9 +156,9 @@ public class CDOPapyrusQuery extends AbstractPapyrusQuery { @Override protected void onDeactivated(ILifecycle lifecycle) { - // the view is closed. The user probably closed the repository session. Attempts to access the search results + // the view is closed. The user probably closed the repository session. Attempts to access the search results // will fail henceforth, so clear them - if(searchResult != null) { + if (searchResult != null) { searchResult.removeAll(); } } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.search.ui/src/org/eclipse/papyrus/cdo/uml/search/internal/ui/query/CDOSearchQueryProvider.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.search.ui/src/org/eclipse/papyrus/cdo/uml/search/internal/ui/query/CDOSearchQueryProvider.java index 9688dcccc79..d469c7594ab 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.search.ui/src/org/eclipse/papyrus/cdo/uml/search/internal/ui/query/CDOSearchQueryProvider.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.search.ui/src/org/eclipse/papyrus/cdo/uml/search/internal/ui/query/CDOSearchQueryProvider.java @@ -1,6 +1,6 @@ /***************************************************************************** * Copyright (c) 2013, 2014 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 @@ -9,7 +9,7 @@ * Contributors: * CEA LIST - Initial API and implementation * Christian W. Damus (CEA) - bug 431953 (pre-requisite refactoring of ModelSet service start-up) - * + * *****************************************************************************/ package org.eclipse.papyrus.cdo.uml.search.internal.ui.query; @@ -93,7 +93,7 @@ public class CDOSearchQueryProvider implements IPapyrusQueryProvider { CDOQuery result = input.getElement2().createQuery("ocl", ocl, UMLPackage.Literals.NAMED_ELEMENT); // variables referenced by the OCL query expression - for(Map.Entry<String, ?> next : parameters.entrySet()) { + for (Map.Entry<String, ?> next : parameters.entrySet()) { result.setParameter(next.getKey(), next.getValue()); } @@ -108,21 +108,21 @@ public class CDOSearchQueryProvider implements IPapyrusQueryProvider { final String searchPattern = _searchPattern.getElement1(); final boolean isRegexMatch = _searchPattern.getElement2(); - // build a multi-map of EClasses to EAttributes. For any EClass that doesn't have + // build a multi-map of EClasses to EAttributes. For any EClass that doesn't have // attributes specifically selected, add all of its attributes final Multimap<EClass, EAttribute> attributes = ArrayListMultimap.create(); - for(ParticipantTypeAttribute next : filter(queryInfo.getParticipantTypes(), ParticipantTypeAttribute.class)) { - if(next.getParent().getElement() instanceof EClass) { - EAttribute attr = (EAttribute)next.getElement(); - attributes.put((EClass)next.getParent().getElement(), attr); + for (ParticipantTypeAttribute next : filter(queryInfo.getParticipantTypes(), ParticipantTypeAttribute.class)) { + if (next.getParent().getElement() instanceof EClass) { + EAttribute attr = (EAttribute) next.getElement(); + attributes.put((EClass) next.getParent().getElement(), attr); } } - for(ParticipantTypeElement next : filter(queryInfo.getParticipantTypes(), not(instanceOf(ParticipantTypeAttribute.class)))) { - if(next.getElement() instanceof EClass) { - EClass eclass = (EClass)next.getElement(); - if(!attributes.containsKey(eclass)) { + for (ParticipantTypeElement next : filter(queryInfo.getParticipantTypes(), not(instanceOf(ParticipantTypeAttribute.class)))) { + if (next.getElement() instanceof EClass) { + EClass eclass = (EClass) next.getElement(); + if (!attributes.containsKey(eclass)) { // don't bother looking for instances of classes that have no attributes to search anyways - if(!eclass.getEAllAttributes().isEmpty()) { + if (!eclass.getEAllAttributes().isEmpty()) { attributes.putAll(eclass, eclass.getEAllAttributes()); } } @@ -138,7 +138,7 @@ public class CDOSearchQueryProvider implements IPapyrusQueryProvider { CDOQuery result = input.getElement2().createQuery("ocl", ocl, UMLPackage.Literals.NAMED_ELEMENT); // variables referenced by the OCL query expression - for(Map.Entry<String, ?> next : parameters.entrySet()) { + for (Map.Entry<String, ?> next : parameters.entrySet()) { result.setParameter(next.getKey(), next.getValue()); } @@ -150,7 +150,7 @@ public class CDOSearchQueryProvider implements IPapyrusQueryProvider { protected Pair<String, Boolean> getSearchPattern(QueryInfo queryInfo) { String searchPattern = PatternUtil.wrap(queryInfo.getQueryText(), queryInfo.isCaseSensitive(), queryInfo.isRegularExpression(), queryInfo.isSearchAllStringAttributes()); boolean isRegexMatch = searchPattern != null; - if(!isRegexMatch) { + if (!isRegexMatch) { searchPattern = queryInfo.getQueryText(); } @@ -162,7 +162,7 @@ public class CDOSearchQueryProvider implements IPapyrusQueryProvider { Multimap<CDOView, URI> views = getViews(queryInfo.getScope()); List<AbstractPapyrusQuery> result = Lists.newArrayListWithCapacity(views.keySet().size()); - for(CDOView view : views.keySet()) { + for (CDOView view : views.keySet()) { CDOQuery query = queryFunction.apply(new Triplet<QueryInfo, CDOView, Collection<URI>>(queryInfo, view, views.get(view))); // parameters for the server-side OCL query handler @@ -187,11 +187,11 @@ public class CDOSearchQueryProvider implements IPapyrusQueryProvider { Map<IInternalPapyrusRepository, CDOView> views = Maps.newHashMap(); try { - for(URI uri : scope) { + for (URI uri : scope) { IInternalPapyrusRepository repo = PapyrusRepositoryManager.INSTANCE.getRepositoryForURI(uri); - if((repo != null) && repo.isConnected()) { + if ((repo != null) && repo.isConnected()) { CDOView view = views.get(repo); - if(view == null) { + if (view == null) { // no view, yet, for this repo ServicesRegistry services = new ServicesRegistry(); @@ -227,8 +227,8 @@ public class CDOSearchQueryProvider implements IPapyrusQueryProvider { StringBuilder scopeClause = getScopeClause(scope); // based on the CDOResource scope clause, find the candidate NamedElements - if(scopeClause.length() == 0) { - // easy case. Do an allInstances() query + if (scopeClause.length() == 0) { + // easy case. Do an allInstances() query result.append("NamedElement.allInstances()"); //$NON-NLS-1$ } else { // iterate the contents of resources matching the scope criteria @@ -244,11 +244,11 @@ public class CDOSearchQueryProvider implements IPapyrusQueryProvider { } // from our candidate NamedElements, select those that match - if(isAllStringAttributes) { + if (isAllStringAttributes) { result.append("->select(e | e.cdoMatches(searchPattern))"); //$NON-NLS-1$ } else { result.append("->select(e | not e.name.oclIsUndefined() and e.name."); //$NON-NLS-1$ - if(isRegexMatch) { + if (isRegexMatch) { result.append("matches(searchPattern)"); //$NON-NLS-1$ } else { result.append("indexOf(searchPattern) > 0"); //$NON-NLS-1$ @@ -265,13 +265,13 @@ public class CDOSearchQueryProvider implements IPapyrusQueryProvider { StringBuilder result = new StringBuilder(); boolean first = true; - for(URI uri : scope) { + for (URI uri : scope) { String path = CDOURIUtil.extractResourcePath(uri); - if(uri.hasTrailingPathSeparator() && !path.endsWith("/")) { //$NON-NLS-1$ + if (uri.hasTrailingPathSeparator() && !path.endsWith("/")) { //$NON-NLS-1$ path = path + "/"; //$NON-NLS-1$ } - if((path.length() > 1) || (!path.startsWith("/") && (path.length() > 0))) { //$NON-NLS-1$ - if(first) { + if ((path.length() > 1) || (!path.startsWith("/") && (path.length() > 0))) { //$NON-NLS-1$ + if (first) { first = false; } else { result.append(" or "); //$NON-NLS-1$ @@ -299,8 +299,8 @@ public class CDOSearchQueryProvider implements IPapyrusQueryProvider { StringBuilder scopeClause = getScopeClause(scope); // based on the CDOResource scope clause, find the candidate NamedElements - if(scopeClause.length() == 0) { - // easy case. Do an allInstances() query + if (scopeClause.length() == 0) { + // easy case. Do an allInstances() query result.append("NamedElement.allInstances()"); //$NON-NLS-1$ } else { // iterate the contents of resources matching the scope criteria @@ -319,8 +319,8 @@ public class CDOSearchQueryProvider implements IPapyrusQueryProvider { result.append("->select(e | "); //$NON-NLS-1$ boolean firstEClass = true; - for(EClass next : attributes.keySet()) { - if(firstEClass) { + for (EClass next : attributes.keySet()) { + if (firstEClass) { firstEClass = false; } else { result.append(" or "); @@ -330,21 +330,21 @@ public class CDOSearchQueryProvider implements IPapyrusQueryProvider { result.append("let s : ").append(next.getName()).append(" = e.oclAsType(").append(next.getName()).append(") in "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ boolean firstAttr = true; - for(EAttribute attr : attributes.get(next)) { - if(firstAttr) { + for (EAttribute attr : attributes.get(next)) { + if (firstAttr) { firstAttr = false; } else { result.append(" or "); } - if(isString(attr)) { - if(attr.isMany()) { + if (isString(attr)) { + if (attr.isMany()) { result.append("s.").append(attr.getName()).append("->excluding(null)->exists(v | v"); //$NON-NLS-1$ //$NON-NLS-2$ } else { result.append("(not s.").append(attr.getName()).append(".oclIsUndefined() and s.").append(attr.getName()); //$NON-NLS-1$ //$NON-NLS-2$ } - if(isRegexMatch) { + if (isRegexMatch) { result.append(".matches(searchPattern)"); //$NON-NLS-1$ } else { result.append(".indexOf(searchPattern) > 0"); //$NON-NLS-1$ @@ -353,11 +353,11 @@ public class CDOSearchQueryProvider implements IPapyrusQueryProvider { // close the exists iterator (many case) or 'and' group (scalar case) result.append(")"); //$NON-NLS-1$ } else { - // need toString() conversions. For simplicity, because we're doing extra conversions anyways, coerce scalars to sets. + // need toString() conversions. For simplicity, because we're doing extra conversions anyways, coerce scalars to sets. // N.B.: toString() can produce nulls that need to be filtered out! result.append("s.").append(attr.getName()).append("->excluding(null).toString()->excluding(null)->exists(v | v"); //$NON-NLS-1$ //$NON-NLS-2$ - if(isRegexMatch) { + if (isRegexMatch) { result.append(".matches(searchPattern)"); //$NON-NLS-1$ } else { result.append(".indexOf(searchPattern) > 0"); //$NON-NLS-1$ @@ -380,7 +380,7 @@ public class CDOSearchQueryProvider implements IPapyrusQueryProvider { static String oclQuoteString(String s) { return s.replace("'", "\\'") //$NON-NLS-1$ //$NON-NLS-2$ - .replace("\\", "\\\\"); //$NON-NLS-1$ //$NON-NLS-2$ + .replace("\\", "\\\\"); //$NON-NLS-1$ //$NON-NLS-2$ } static boolean isString(ETypedElement element) { diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.search.ui/src/org/eclipse/papyrus/cdo/uml/search/internal/ui/query/PatternUtil.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.search.ui/src/org/eclipse/papyrus/cdo/uml/search/internal/ui/query/PatternUtil.java index b4c67f63a02..d50f6373d29 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.search.ui/src/org/eclipse/papyrus/cdo/uml/search/internal/ui/query/PatternUtil.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.search.ui/src/org/eclipse/papyrus/cdo/uml/search/internal/ui/query/PatternUtil.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -31,25 +31,25 @@ public class PatternUtil { /** * OCL queries always use reqular expressions to implement either regex search (obviously) or case-insensitive search because there * is no better way using OCL's String operations. - * + * * @param searchText - * the user's search text + * the user's search text * @param caseSensitive - * whether the search is case-sensitive + * whether the search is case-sensitive * @param regularExpression - * whether the search text is to be interpreted as a regular expression + * whether the search text is to be interpreted as a regular expression * @param allStringAttributes - * whether the search text is sought in all string attributes of an object - * + * whether the search text is sought in all string attributes of an object + * * @return the appropriately modified string specifying the regular expression search term, or {@code null} if the search text * is actually a literal exact sub-string match */ public static String wrap(String searchText, boolean caseSensitive, boolean regularExpression, boolean allStringAttributes) { String result; - if(caseSensitive) { - if(!regularExpression) { - if(allStringAttributes) { + if (caseSensitive) { + if (!regularExpression) { + if (allStringAttributes) { // the cdoMatches() operation needs a regex result = String.format("%s%s%s", WILDCARD, quote(searchText), WILDCARD); } else { @@ -60,7 +60,7 @@ public class PatternUtil { result = ensureRegexSubstring(searchText); } } else { - if(!regularExpression) { + if (!regularExpression) { // make a case-insensitive regex matching the literal text result = String.format("(?i)%s%s%s", WILDCARD, quote(searchText), WILDCARD); } else { @@ -74,10 +74,10 @@ public class PatternUtil { // ensure that the regex matches any substring by starting and finishing with wildcards private static String ensureRegexSubstring(String regex) { String result = regex; - if(!result.startsWith(WILDCARD)) { + if (!result.startsWith(WILDCARD)) { result = WILDCARD + result; } - if(!result.endsWith(WILDCARD)) { + if (!result.endsWith(WILDCARD)) { result = result + WILDCARD; } return result; @@ -86,27 +86,27 @@ public class PatternUtil { /** * Local post-processing of element matches uses {@link Matcher#find()} to gather up all applicable attribute matches. This method converts * the user's search criteria into an appropriate regular expression. - * + * * @param searchText - * the user's search text + * the user's search text * @param caseSensitive - * whether the search is case-sensitive + * whether the search is case-sensitive * @param regularExpression - * whether the search tex is to be interpreted as a regular expression - * + * whether the search tex is to be interpreted as a regular expression + * * @return the appropriately modified string specifying the regular expression search term, never {@code null} */ public static String wrapForFind(String searchText, boolean caseSensitive, boolean regularExpression) { String result; - if(caseSensitive) { - if(!regularExpression) { + if (caseSensitive) { + if (!regularExpression) { result = quote(searchText); // simple sub-string search } else { result = searchText; // already a regex } } else { - if(!regularExpression) { + if (!regularExpression) { // make a case-insensitive regex matching the literal text result = String.format("(?i)%s", quote(searchText)); } else { diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.search.ui/src/org/eclipse/papyrus/cdo/uml/search/internal/ui/scope/CDOScopeProvider.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.search.ui/src/org/eclipse/papyrus/cdo/uml/search/internal/ui/scope/CDOScopeProvider.java index 592342b0401..a476f26adb0 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.search.ui/src/org/eclipse/papyrus/cdo/uml/search/internal/ui/scope/CDOScopeProvider.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.search.ui/src/org/eclipse/papyrus/cdo/uml/search/internal/ui/scope/CDOScopeProvider.java @@ -1,6 +1,6 @@ /***************************************************************************** * Copyright (c) 2013 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 @@ -47,14 +47,14 @@ public class CDOScopeProvider implements IScopeProvider { Collection<URI> result; final Collection<? extends IInternalPapyrusRepository> repos = PapyrusRepositoryManager.INSTANCE.getRepositories(); - if(repos.isEmpty()) { + if (repos.isEmpty()) { result = Collections.emptyList(); } else { result = Lists.newArrayListWithCapacity(repos.size()); - for(IInternalPapyrusRepository next : repos) { - if(next.isConnected()) { + for (IInternalPapyrusRepository next : repos) { + if (next.isConnected()) { CDOView view = next.getMasterView(); - if(view != null) { + if (view != null) { result.add(view.getRootResource().getURI()); } } @@ -70,29 +70,29 @@ public class CDOScopeProvider implements IScopeProvider { // try to get the contextual resource node CDOResourceNode node = CDOUtils.adapt(selected, CDOResourceNode.class); - if(node == null) { + if (node == null) { EObject obj = CDOUtils.adapt(selected, EObject.class); - if(obj != null) { + if (obj != null) { node = CDOUtils.adapt(obj.eResource(), CDOResource.class); } } - if(node == null) { + if (node == null) { result = Collections.emptyList(); } else { URI uri = node.getURI(); - if(!node.isRoot() && (node instanceof CDOResource)) { + if (!node.isRoot() && (node instanceof CDOResource)) { // ensure that we search the UML resource, not the notation or di uri = uri.trimFileExtension().appendFileExtension(UMLResource.FILE_EXTENSION); - if(!uri.equals(node.getURI())) { - // does the UML resource exist? If not, don't try to search it + if (!uri.equals(node.getURI())) { + // does the UML resource exist? If not, don't try to search it String path = CDOURIUtil.extractResourcePath(uri); - if(!node.cdoView().hasResource(path)) { + if (!node.cdoView().hasResource(path)) { uri = null; } } - } else if((node instanceof CDOResourceFolder) && !uri.hasTrailingPathSeparator()) { + } else if ((node instanceof CDOResourceFolder) && !uri.hasTrailingPathSeparator()) { uri = uri.appendSegment(""); //$NON-NLS-1$ } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.ui/src/org/eclipse/papyrus/cdo/uml/internal/ui/Activator.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.ui/src/org/eclipse/papyrus/cdo/uml/internal/ui/Activator.java index 655981349d4..d044343e3fb 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.ui/src/org/eclipse/papyrus/cdo/uml/internal/ui/Activator.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.ui/src/org/eclipse/papyrus/cdo/uml/internal/ui/Activator.java @@ -14,7 +14,7 @@ public class Activator extends AbstractUIPlugin { // The shared instance private static Activator plugin; - + /** Logging helper */ public static LogHelper log = new LogHelper(); @@ -25,14 +25,16 @@ public class Activator extends AbstractUIPlugin { super(); } + @Override public void start(BundleContext context) throws Exception { super.start(context); plugin = this; - + // register the log helper log.setPlugin(plugin); } + @Override public void stop(BundleContext context) throws Exception { log = null; plugin = null; diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.ui/src/org/eclipse/papyrus/cdo/uml/internal/ui/importsources/CDOPackageImportSource.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.ui/src/org/eclipse/papyrus/cdo/uml/internal/ui/importsources/CDOPackageImportSource.java index 0a676330152..e7646671ed4 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.ui/src/org/eclipse/papyrus/cdo/uml/internal/ui/importsources/CDOPackageImportSource.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.ui/src/org/eclipse/papyrus/cdo/uml/internal/ui/importsources/CDOPackageImportSource.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -69,7 +69,7 @@ public class CDOPackageImportSource extends AbstractPackageImportSource { public boolean canImportInto(Collection<?> selection) { boolean result = super.canImportInto(selection); - if(result) { + if (result) { Package package_ = getPackage(selection); result = CDOUtils.isCDOObject(package_); } @@ -80,8 +80,8 @@ public class CDOPackageImportSource extends AbstractPackageImportSource { @Override public void initialize(Collection<?> selection) { availableRepos = new java.util.ArrayList<IPapyrusRepository>(); - for(IPapyrusRepository next : repoMan.getRepositories()) { - if(next.isConnected()) { + for (IPapyrusRepository next : repoMan.getRepositories()) { + if (next.isConnected()) { availableRepos.add(next); } } @@ -110,7 +110,7 @@ public class CDOPackageImportSource extends AbstractPackageImportSource { protected Image customGetImage(Object element) { Image result = null; - if(element == CDOPackageImportSource.this) { + if (element == CDOPackageImportSource.this) { result = SharedImages.getImage(ICON_PAPYRUS_MODEL); } @@ -121,7 +121,7 @@ public class CDOPackageImportSource extends AbstractPackageImportSource { protected String customGetText(Object element) { String result = null; - if(element == CDOPackageImportSource.this) { + if (element == CDOPackageImportSource.this) { result = Messages.CDOPackageImportSource_0; } @@ -133,10 +133,10 @@ public class CDOPackageImportSource extends AbstractPackageImportSource { protected CDOResource getCDOResource(Object model) { CDOResource result = null; - if(model instanceof CDOResource) { - result = (CDOResource)model; - } else if(model instanceof IAdaptable) { - result = (CDOResource)((IAdaptable)model).getAdapter(CDOResource.class); + if (model instanceof CDOResource) { + result = (CDOResource) model; + } else if (model instanceof IAdaptable) { + result = (CDOResource) ((IAdaptable) model).getAdapter(CDOResource.class); } return result; @@ -146,7 +146,7 @@ public class CDOPackageImportSource extends AbstractPackageImportSource { protected void validateSelection(Object model) throws CoreException { CDOResource cdo = getCDOResource(model); - if(cdo == null) { + if (cdo == null) { throw new CoreException(new Status(IStatus.WARNING, Activator.PLUGIN_ID, NLS.bind(Messages.CDOPackageImportSource_1, getText(model)))); } @@ -158,12 +158,12 @@ public class CDOPackageImportSource extends AbstractPackageImportSource { List<Package> result; - if(model instanceof DIModel) { + if (model instanceof DIModel) { result = new java.util.ArrayList<Package>(3); - for(Object next : ((DIModel)model).getChildren()) { - if(next instanceof Resource) { - result.addAll(EcoreUtil.<Package> getObjectsByType(((Resource)next).getContents(), UMLPackage.Literals.PACKAGE)); + for (Object next : ((DIModel) model).getChildren()) { + if (next instanceof Resource) { + result.addAll(EcoreUtil.<Package> getObjectsByType(((Resource) next).getContents(), UMLPackage.Literals.PACKAGE)); } } } else { @@ -196,7 +196,7 @@ public class CDOPackageImportSource extends AbstractPackageImportSource { @Override public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { - if(newInput == null) { + if (newInput == null) { itemProvider.inputChanged(viewer, repoMan, null); super.inputChanged(viewer, repoMan, null); } else { @@ -210,14 +210,17 @@ public class CDOPackageImportSource extends AbstractPackageImportSource { } } + @Override public Object getParent(Object element) { return itemProvider.getParent(element); } + @Override public boolean hasChildren(Object element) { return itemProvider.hasChildren(element); } + @Override public Object[] getChildren(Object parentElement) { Object[] result = itemProvider.getChildren(parentElement); diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.ui/src/org/eclipse/papyrus/cdo/uml/internal/ui/l10n/Messages.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.ui/src/org/eclipse/papyrus/cdo/uml/internal/ui/l10n/Messages.java index 38ba0783975..75713344954 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.ui/src/org/eclipse/papyrus/cdo/uml/internal/ui/l10n/Messages.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.ui/src/org/eclipse/papyrus/cdo/uml/internal/ui/l10n/Messages.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -14,7 +14,7 @@ package org.eclipse.papyrus.cdo.uml.internal.ui.l10n; import org.eclipse.osgi.util.NLS; /** - * This is the Messages type. Enjoy. + * This is the Messages type. Enjoy. */ public class Messages extends NLS { diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.edit/src/org/eclipse/papyrus/cdo/validation/problems/edit/IProblemTypeProvider.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.edit/src/org/eclipse/papyrus/cdo/validation/problems/edit/IProblemTypeProvider.java index 19084d82525..1ae47299a23 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.edit/src/org/eclipse/papyrus/cdo/validation/problems/edit/IProblemTypeProvider.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.edit/src/org/eclipse/papyrus/cdo/validation/problems/edit/IProblemTypeProvider.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -14,8 +14,7 @@ package org.eclipse.papyrus.cdo.validation.problems.edit; import org.eclipse.papyrus.cdo.validation.problems.EProblem; /** - * Optional protocol for edit providers to provide a "problem type" for an - * {@link EProblem}. This is intended for models that extend the CDO Problems + * Optional protocol for edit providers to provide a "problem type" for an {@link EProblem}. This is intended for models that extend the CDO Problems * model to provide custom problems. */ public interface IProblemTypeProvider { diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.edit/src/org/eclipse/papyrus/cdo/validation/problems/edit/ProblemEditUtil.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.edit/src/org/eclipse/papyrus/cdo/validation/problems/edit/ProblemEditUtil.java index 79819b78820..00df00cbb67 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.edit/src/org/eclipse/papyrus/cdo/validation/problems/edit/ProblemEditUtil.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.edit/src/org/eclipse/papyrus/cdo/validation/problems/edit/ProblemEditUtil.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -40,10 +40,10 @@ public class ProblemEditUtil { protected IProblemTypeProvider getProblemTypeProvider(EProblem problem) { Adapter provider = adapterFactory.adapt(problem, - IProblemTypeProvider.class); + IProblemTypeProvider.class); IProblemTypeProvider result = provider instanceof IProblemTypeProvider - ? (IProblemTypeProvider) provider - : null; + ? (IProblemTypeProvider) provider + : null; if (result == null) { for (Adapter next : problem.eAdapters()) { @@ -73,6 +73,7 @@ public class ProblemEditUtil { protected class DefaultProblemTypeProviderAdapter implements Adapter, IProblemTypeProvider { + @Override public String getProblemType(Object object) { String result = null; @@ -82,7 +83,7 @@ public class ProblemEditUtil { if (element != null) { EPackage model = element.eClass().getEPackage(); IItemLabelProvider labels = (IItemLabelProvider) adapterFactory - .adapt(model, IItemLabelProvider.class); + .adapt(model, IItemLabelProvider.class); if (labels != null) { result = labels.getText(model); } else { @@ -94,19 +95,23 @@ public class ProblemEditUtil { return result; } + @Override public boolean isAdapterForType(Object type) { return false; } + @Override public Notifier getTarget() { // I am stateless, so I am re-used on multiple targets return null; } + @Override public void setTarget(Notifier newTarget) { // pass } + @Override public void notifyChanged(Notification notification) { // pass } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.edit/src/org/eclipse/papyrus/cdo/validation/problems/edit/ProblemTypeItemProviderAdapter.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.edit/src/org/eclipse/papyrus/cdo/validation/problems/edit/ProblemTypeItemProviderAdapter.java index 3afbb49f722..361a805f787 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.edit/src/org/eclipse/papyrus/cdo/validation/problems/edit/ProblemTypeItemProviderAdapter.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.edit/src/org/eclipse/papyrus/cdo/validation/problems/edit/ProblemTypeItemProviderAdapter.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -15,8 +15,7 @@ import org.eclipse.emf.common.notify.AdapterFactory; import org.eclipse.emf.edit.provider.ItemProviderAdapter; /** - * Convenient base class for generated item provider adapters to implement the - * {@link IProblemTypeProvider} protocol. + * Convenient base class for generated item provider adapters to implement the {@link IProblemTypeProvider} protocol. */ public class ProblemTypeItemProviderAdapter extends ItemProviderAdapter @@ -26,6 +25,7 @@ public class ProblemTypeItemProviderAdapter super(adapterFactory); } + @Override public String getProblemType(Object object) { return getString("_UI_problem_type", true); //$NON-NLS-1$ } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.edit/src/org/eclipse/papyrus/cdo/validation/problems/provider/AttributeItemProvider.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.edit/src/org/eclipse/papyrus/cdo/validation/problems/provider/AttributeItemProvider.java index f0530cd238b..14097927a3e 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.edit/src/org/eclipse/papyrus/cdo/validation/problems/provider/AttributeItemProvider.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.edit/src/org/eclipse/papyrus/cdo/validation/problems/provider/AttributeItemProvider.java @@ -1,11 +1,11 @@ /** * 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 */ @@ -45,14 +45,17 @@ import org.eclipse.papyrus.cdo.validation.problems.edit.ProblemTypeItemProviderA * This is the item provider adapter for a {@link java.util.Map.Entry} object. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ -public class AttributeItemProvider extends ProblemTypeItemProviderAdapter implements IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource, ITableItemLabelProvider, ITableItemColorProvider, ITableItemFontProvider, IItemColorProvider, IItemFontProvider { +public class AttributeItemProvider extends ProblemTypeItemProviderAdapter implements IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource, ITableItemLabelProvider, + ITableItemColorProvider, ITableItemFontProvider, IItemColorProvider, IItemFontProvider { /** * This constructs an instance from a factory and a notifier. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ public AttributeItemProvider(AdapterFactory adapterFactory) { @@ -63,11 +66,12 @@ public class AttributeItemProvider extends ProblemTypeItemProviderAdapter implem * This returns the property descriptors for the adapted class. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ @Override public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { - if(itemPropertyDescriptors == null) { + if (itemPropertyDescriptors == null) { super.getPropertyDescriptors(object); addKeyPropertyDescriptor(object); @@ -80,29 +84,32 @@ public class AttributeItemProvider extends ProblemTypeItemProviderAdapter implem * This adds a property descriptor for the Key feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ protected void addKeyPropertyDescriptor(Object object) { - itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_Attribute_key_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_Attribute_key_feature", "_UI_Attribute_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - ProblemsPackage.Literals.ATTRIBUTE__KEY, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); + itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_Attribute_key_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_Attribute_key_feature", "_UI_Attribute_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + ProblemsPackage.Literals.ATTRIBUTE__KEY, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } /** * This adds a property descriptor for the Value feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ protected void addValuePropertyDescriptor(Object object) { - itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_Attribute_value_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_Attribute_value_feature", "_UI_Attribute_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - ProblemsPackage.Literals.ATTRIBUTE__VALUE, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); + itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_Attribute_value_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_Attribute_value_feature", "_UI_Attribute_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + ProblemsPackage.Literals.ATTRIBUTE__VALUE, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ @Override @@ -114,6 +121,7 @@ public class AttributeItemProvider extends ProblemTypeItemProviderAdapter implem * This returns Attribute.gif. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ @Override @@ -125,11 +133,12 @@ public class AttributeItemProvider extends ProblemTypeItemProviderAdapter implem * This returns the label text for the adapted class. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ @Override public String getText(Object object) { - Map.Entry<?, ?> attribute = (Map.Entry<?, ?>)object; + Map.Entry<?, ?> attribute = (Map.Entry<?, ?>) object; return "" + attribute.getKey() + " -> " + attribute.getValue(); //$NON-NLS-1$ //$NON-NLS-2$ } @@ -138,13 +147,14 @@ public class AttributeItemProvider extends ProblemTypeItemProviderAdapter implem * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ @Override public void notifyChanged(Notification notification) { updateChildren(notification); - switch(notification.getFeatureID(Map.Entry.class)) { + switch (notification.getFeatureID(Map.Entry.class)) { case ProblemsPackage.ATTRIBUTE__KEY: case ProblemsPackage.ATTRIBUTE__VALUE: fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); @@ -158,6 +168,7 @@ public class AttributeItemProvider extends ProblemTypeItemProviderAdapter implem * that can be created under this object. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ @Override @@ -169,11 +180,12 @@ public class AttributeItemProvider extends ProblemTypeItemProviderAdapter implem * Return the resource locator for this item provider's resources. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ @Override public ResourceLocator getResourceLocator() { - return ((IChildCreationExtender)adapterFactory).getResourceLocator(); + return ((IChildCreationExtender) adapterFactory).getResourceLocator(); } } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.edit/src/org/eclipse/papyrus/cdo/validation/problems/provider/EProblemItemProvider.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.edit/src/org/eclipse/papyrus/cdo/validation/problems/provider/EProblemItemProvider.java index 6f0f86104fb..88f1dbc346c 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.edit/src/org/eclipse/papyrus/cdo/validation/problems/provider/EProblemItemProvider.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.edit/src/org/eclipse/papyrus/cdo/validation/problems/provider/EProblemItemProvider.java @@ -1,6 +1,6 @@ /** * 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 @@ -40,18 +40,18 @@ import org.eclipse.papyrus.cdo.validation.problems.ProblemsPackage; import org.eclipse.papyrus.cdo.validation.problems.edit.ProblemTypeItemProviderAdapter; /** - * This is the item provider adapter for a - * {@link org.eclipse.papyrus.cdo.validation.problems.EProblem} object. <!-- + * This is the item provider adapter for a {@link org.eclipse.papyrus.cdo.validation.problems.EProblem} object. <!-- * begin-user-doc --> <!-- end-user-doc --> - * + * * @generated */ -public class EProblemItemProvider extends ProblemTypeItemProviderAdapter implements IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource, ITableItemLabelProvider, ITableItemColorProvider, ITableItemFontProvider, IItemColorProvider, IItemFontProvider { +public class EProblemItemProvider extends ProblemTypeItemProviderAdapter implements IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource, ITableItemLabelProvider, + ITableItemColorProvider, ITableItemFontProvider, IItemColorProvider, IItemFontProvider { /** * This constructs an instance from a factory and a notifier. <!-- * begin-user-doc --> <!-- end-user-doc --> - * + * * @generated */ public EProblemItemProvider(AdapterFactory adapterFactory) { @@ -61,12 +61,12 @@ public class EProblemItemProvider extends ProblemTypeItemProviderAdapter impleme /** * This returns the property descriptors for the adapted class. <!-- * begin-user-doc --> <!-- end-user-doc --> - * + * * @generated */ @Override public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { - if(itemPropertyDescriptors == null) { + if (itemPropertyDescriptors == null) { super.getPropertyDescriptors(object); addSeverityPropertyDescriptor(object); @@ -83,98 +83,100 @@ public class EProblemItemProvider extends ProblemTypeItemProviderAdapter impleme /** * This adds a property descriptor for the Severity feature. <!-- * begin-user-doc --> <!-- end-user-doc --> - * + * * @generated */ protected void addSeverityPropertyDescriptor(Object object) { - itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_EProblem_severity_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_EProblem_severity_feature", "_UI_EProblem_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - ProblemsPackage.Literals.EPROBLEM__SEVERITY, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); + itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_EProblem_severity_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_EProblem_severity_feature", "_UI_EProblem_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + ProblemsPackage.Literals.EPROBLEM__SEVERITY, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } /** * This adds a property descriptor for the Message feature. <!-- * begin-user-doc --> <!-- end-user-doc --> - * + * * @generated */ protected void addMessagePropertyDescriptor(Object object) { - itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_EProblem_message_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_EProblem_message_feature", "_UI_EProblem_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - ProblemsPackage.Literals.EPROBLEM__MESSAGE, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); + itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_EProblem_message_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_EProblem_message_feature", "_UI_EProblem_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + ProblemsPackage.Literals.EPROBLEM__MESSAGE, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } /** * This adds a property descriptor for the Source feature. <!-- * begin-user-doc --> <!-- end-user-doc --> - * + * * @generated */ protected void addSourcePropertyDescriptor(Object object) { - itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_EProblem_source_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_EProblem_source_feature", "_UI_EProblem_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - ProblemsPackage.Literals.EPROBLEM__SOURCE, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); + itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_EProblem_source_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_EProblem_source_feature", "_UI_EProblem_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + ProblemsPackage.Literals.EPROBLEM__SOURCE, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } /** * This adds a property descriptor for the Code feature. * <!-- begin-user-doc * --> <!-- end-user-doc --> + * * @generated */ protected void addCodePropertyDescriptor(Object object) { - itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_EProblem_code_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_EProblem_code_feature", "_UI_EProblem_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - ProblemsPackage.Literals.EPROBLEM__CODE, true, false, false, ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE, null, null)); + itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_EProblem_code_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_EProblem_code_feature", "_UI_EProblem_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + ProblemsPackage.Literals.EPROBLEM__CODE, true, false, false, ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE, null, null)); } /** * This adds a property descriptor for the Element feature. <!-- * begin-user-doc --> <!-- end-user-doc --> - * + * * @generated */ protected void addElementPropertyDescriptor(Object object) { - itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_EProblem_element_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_EProblem_element_feature", "_UI_EProblem_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - ProblemsPackage.Literals.EPROBLEM__ELEMENT, true, false, true, null, null, null)); + itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_EProblem_element_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_EProblem_element_feature", "_UI_EProblem_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + ProblemsPackage.Literals.EPROBLEM__ELEMENT, true, false, true, null, null, null)); } /** * This adds a property descriptor for the Related feature. <!-- * begin-user-doc --> <!-- end-user-doc --> - * + * * @generated */ protected void addRelatedPropertyDescriptor(Object object) { - itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_EProblem_related_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_EProblem_related_feature", "_UI_EProblem_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - ProblemsPackage.Literals.EPROBLEM__RELATED, true, false, true, null, null, null)); + itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_EProblem_related_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_EProblem_related_feature", "_UI_EProblem_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + ProblemsPackage.Literals.EPROBLEM__RELATED, true, false, true, null, null, null)); } /** * This adds a property descriptor for the Type feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ protected void addTypePropertyDescriptor(Object object) { - itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_EProblem_type_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_EProblem_type_feature", "_UI_EProblem_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - ProblemsPackage.Literals.EPROBLEM__TYPE, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); + itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_EProblem_type_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_EProblem_type_feature", "_UI_EProblem_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + ProblemsPackage.Literals.EPROBLEM__TYPE, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } /** - * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an - * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or + * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ @Override public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) { - if(childrenFeatures == null) { + if (childrenFeatures == null) { super.getChildrenFeatures(object); childrenFeatures.add(ProblemsPackage.Literals.EPROBLEM__ATTRIBUTES); } @@ -184,6 +186,7 @@ public class EProblemItemProvider extends ProblemTypeItemProviderAdapter impleme /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ @Override @@ -196,6 +199,7 @@ public class EProblemItemProvider extends ProblemTypeItemProviderAdapter impleme /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ @Override @@ -206,6 +210,7 @@ public class EProblemItemProvider extends ProblemTypeItemProviderAdapter impleme /** * This returns EProblem.gif. * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ @Override @@ -217,14 +222,15 @@ public class EProblemItemProvider extends ProblemTypeItemProviderAdapter impleme * This returns the label text for the adapted class. * <!-- begin-user-doc * --> <!-- end-user-doc --> + * * @generated */ @Override public String getText(Object object) { - ESeverity labelValue = ((EProblem)object).getSeverity(); + ESeverity labelValue = ((EProblem) object).getSeverity(); String label = labelValue == null ? null : labelValue.toString(); return label == null || label.length() == 0 ? getString("_UI_EProblem_type") : //$NON-NLS-1$ - getString("_UI_EProblem_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$ + getString("_UI_EProblem_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$ } /** @@ -232,13 +238,14 @@ public class EProblemItemProvider extends ProblemTypeItemProviderAdapter impleme * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. * <!-- begin-user-doc --> <!-- * end-user-doc --> + * * @generated */ @Override public void notifyChanged(Notification notification) { updateChildren(notification); - switch(notification.getFeatureID(EProblem.class)) { + switch (notification.getFeatureID(EProblem.class)) { case ProblemsPackage.EPROBLEM__SEVERITY: case ProblemsPackage.EPROBLEM__MESSAGE: case ProblemsPackage.EPROBLEM__SOURCE: @@ -257,7 +264,7 @@ public class EProblemItemProvider extends ProblemTypeItemProviderAdapter impleme * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s * describing the children that can be created under this object. <!-- * begin-user-doc --> <!-- end-user-doc --> - * + * * @generated */ @Override @@ -270,12 +277,12 @@ public class EProblemItemProvider extends ProblemTypeItemProviderAdapter impleme /** * Return the resource locator for this item provider's resources. <!-- * begin-user-doc --> <!-- end-user-doc --> - * + * * @generated */ @Override public ResourceLocator getResourceLocator() { - return ((IChildCreationExtender)adapterFactory).getResourceLocator(); + return ((IChildCreationExtender) adapterFactory).getResourceLocator(); } } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.edit/src/org/eclipse/papyrus/cdo/validation/problems/provider/EProblemsContainerItemProvider.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.edit/src/org/eclipse/papyrus/cdo/validation/problems/provider/EProblemsContainerItemProvider.java index 843ae5599ca..ba8ec885d8d 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.edit/src/org/eclipse/papyrus/cdo/validation/problems/provider/EProblemsContainerItemProvider.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.edit/src/org/eclipse/papyrus/cdo/validation/problems/provider/EProblemsContainerItemProvider.java @@ -1,6 +1,6 @@ /** * 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 @@ -40,14 +40,16 @@ import org.eclipse.papyrus.cdo.validation.problems.edit.ProblemTypeItemProviderA /** * This is the item provider adapter for a {@link org.eclipse.papyrus.cdo.validation.problems.EProblemsContainer} object. * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ -public class EProblemsContainerItemProvider extends ProblemTypeItemProviderAdapter implements IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource, ITableItemLabelProvider, ITableItemColorProvider, ITableItemFontProvider, IItemColorProvider, IItemFontProvider { +public class EProblemsContainerItemProvider extends ProblemTypeItemProviderAdapter implements IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource, ITableItemLabelProvider, + ITableItemColorProvider, ITableItemFontProvider, IItemColorProvider, IItemFontProvider { /** * This constructs an instance from a factory and a notifier. <!-- * begin-user-doc --> <!-- end-user-doc --> - * + * * @generated */ public EProblemsContainerItemProvider(AdapterFactory adapterFactory) { @@ -57,12 +59,12 @@ public class EProblemsContainerItemProvider extends ProblemTypeItemProviderAdapt /** * This returns the property descriptors for the adapted class. <!-- * begin-user-doc --> <!-- end-user-doc --> - * + * * @generated */ @Override public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { - if(itemPropertyDescriptors == null) { + if (itemPropertyDescriptors == null) { super.getPropertyDescriptors(object); addSubjectsPropertyDescriptor(object); @@ -73,25 +75,25 @@ public class EProblemsContainerItemProvider extends ProblemTypeItemProviderAdapt /** * This adds a property descriptor for the Subjects feature. <!-- * begin-user-doc --> <!-- end-user-doc --> - * + * * @generated */ protected void addSubjectsPropertyDescriptor(Object object) { - itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_EProblemsContainer_subjects_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_EProblemsContainer_subjects_feature", "_UI_EProblemsContainer_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - ProblemsPackage.Literals.EPROBLEMS_CONTAINER__SUBJECTS, true, false, true, null, null, null)); + itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_EProblemsContainer_subjects_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_EProblemsContainer_subjects_feature", "_UI_EProblemsContainer_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + ProblemsPackage.Literals.EPROBLEMS_CONTAINER__SUBJECTS, true, false, true, null, null, null)); } /** - * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an - * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or + * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ @Override public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) { - if(childrenFeatures == null) { + if (childrenFeatures == null) { super.getChildrenFeatures(object); childrenFeatures.add(ProblemsPackage.Literals.EPROBLEMS_CONTAINER__PROBLEMS); childrenFeatures.add(ProblemsPackage.Literals.EPROBLEMS_CONTAINER__SUBCONTAINERS); @@ -101,6 +103,7 @@ public class EProblemsContainerItemProvider extends ProblemTypeItemProviderAdapt /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ @Override @@ -113,6 +116,7 @@ public class EProblemsContainerItemProvider extends ProblemTypeItemProviderAdapt /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ @Override @@ -124,6 +128,7 @@ public class EProblemsContainerItemProvider extends ProblemTypeItemProviderAdapt * This returns EProblemsContainer.gif. * <!-- begin-user-doc --> <!-- * end-user-doc --> + * * @generated */ @Override @@ -135,6 +140,7 @@ public class EProblemsContainerItemProvider extends ProblemTypeItemProviderAdapt * This returns the label text for the adapted class. * <!-- begin-user-doc * --> <!-- end-user-doc --> + * * @generated */ @Override @@ -147,13 +153,14 @@ public class EProblemsContainerItemProvider extends ProblemTypeItemProviderAdapt * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. * <!-- begin-user-doc --> <!-- * end-user-doc --> + * * @generated */ @Override public void notifyChanged(Notification notification) { updateChildren(notification); - switch(notification.getFeatureID(EProblemsContainer.class)) { + switch (notification.getFeatureID(EProblemsContainer.class)) { case ProblemsPackage.EPROBLEMS_CONTAINER__PROBLEMS: case ProblemsPackage.EPROBLEMS_CONTAINER__SUBCONTAINERS: fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); @@ -166,7 +173,7 @@ public class EProblemsContainerItemProvider extends ProblemTypeItemProviderAdapt * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s * describing the children that can be created under this object. <!-- * begin-user-doc --> <!-- end-user-doc --> - * + * * @generated */ @Override @@ -181,12 +188,12 @@ public class EProblemsContainerItemProvider extends ProblemTypeItemProviderAdapt /** * Return the resource locator for this item provider's resources. <!-- * begin-user-doc --> <!-- end-user-doc --> - * + * * @generated */ @Override public ResourceLocator getResourceLocator() { - return ((IChildCreationExtender)adapterFactory).getResourceLocator(); + return ((IChildCreationExtender) adapterFactory).getResourceLocator(); } } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.edit/src/org/eclipse/papyrus/cdo/validation/problems/provider/ProblemsEditPlugin.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.edit/src/org/eclipse/papyrus/cdo/validation/problems/provider/ProblemsEditPlugin.java index d83ed17a9e3..a949f228e4b 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.edit/src/org/eclipse/papyrus/cdo/validation/problems/provider/ProblemsEditPlugin.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.edit/src/org/eclipse/papyrus/cdo/validation/problems/provider/ProblemsEditPlugin.java @@ -1,6 +1,6 @@ /** * 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 @@ -17,7 +17,7 @@ import org.eclipse.emf.common.util.ResourceLocator; /** * This is the central singleton for the Problems edit plugin. <!-- * begin-user-doc --> <!-- end-user-doc --> - * + * * @generated */ public final class ProblemsEditPlugin extends EMFPlugin { @@ -25,7 +25,7 @@ public final class ProblemsEditPlugin extends EMFPlugin { /** * Keep track of the singleton. <!-- begin-user-doc --> <!-- end-user-doc * --> - * + * * @generated */ public static final ProblemsEditPlugin INSTANCE = new ProblemsEditPlugin(); @@ -33,7 +33,7 @@ public final class ProblemsEditPlugin extends EMFPlugin { /** * Keep track of the singleton. <!-- begin-user-doc --> <!-- end-user-doc * --> - * + * * @generated */ private static Implementation plugin; @@ -41,16 +41,18 @@ public final class ProblemsEditPlugin extends EMFPlugin { /** * Create the instance. * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ public ProblemsEditPlugin() { - super(new ResourceLocator[]{}); + super(new ResourceLocator[] {}); } /** * Returns the singleton instance of the Eclipse plugin. * <!-- begin-user-doc * --> <!-- end-user-doc --> + * * @return the singleton instance. * @generated */ @@ -63,6 +65,7 @@ public final class ProblemsEditPlugin extends EMFPlugin { * Returns the singleton instance of the Eclipse plugin. * <!-- begin-user-doc * --> <!-- end-user-doc --> + * * @return the singleton instance. * @generated */ @@ -73,7 +76,7 @@ public final class ProblemsEditPlugin extends EMFPlugin { /** * The actual implementation of the Eclipse <b>Plugin</b>. <!-- * begin-user-doc --> <!-- end-user-doc --> - * + * * @generated */ public static class Implementation extends EclipsePlugin { @@ -81,6 +84,7 @@ public final class ProblemsEditPlugin extends EMFPlugin { /** * Creates an instance. * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ public Implementation() { diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.edit/src/org/eclipse/papyrus/cdo/validation/problems/provider/ProblemsItemProviderAdapterFactory.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.edit/src/org/eclipse/papyrus/cdo/validation/problems/provider/ProblemsItemProviderAdapterFactory.java index 087d0c5f83f..01235e6337a 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.edit/src/org/eclipse/papyrus/cdo/validation/problems/provider/ProblemsItemProviderAdapterFactory.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.edit/src/org/eclipse/papyrus/cdo/validation/problems/provider/ProblemsItemProviderAdapterFactory.java @@ -1,6 +1,6 @@ /** * 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 @@ -49,6 +49,7 @@ import org.eclipse.papyrus.cdo.validation.problems.util.ProblemsAdapterFactory; * Note that most of the adapters are shared among multiple instances. * <!-- begin-user-doc --> <!-- * end-user-doc --> + * * @generated */ public class ProblemsItemProviderAdapterFactory extends ProblemsAdapterFactory implements ComposeableAdapterFactory, IChangeNotifier, IDisposable, IChildCreationExtender { @@ -56,15 +57,15 @@ public class ProblemsItemProviderAdapterFactory extends ProblemsAdapterFactory i /** * This keeps track of the root adapter factory that delegates to this adapter factory. * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ protected ComposedAdapterFactory parentAdapterFactory; /** - * This is used to implement - * {@link org.eclipse.emf.edit.provider.IChangeNotifier}. <!-- + * This is used to implement {@link org.eclipse.emf.edit.provider.IChangeNotifier}. <!-- * begin-user-doc --> <!-- end-user-doc --> - * + * * @generated */ protected IChangeNotifier changeNotifier = new ChangeNotifier(); @@ -73,6 +74,7 @@ public class ProblemsItemProviderAdapterFactory extends ProblemsAdapterFactory i * This helps manage the child creation extenders. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ protected ChildCreationExtenderManager childCreationExtenderManager = new ChildCreationExtenderManager(ProblemsEditPlugin.INSTANCE, ProblemsPackage.eNS_URI); @@ -81,6 +83,7 @@ public class ProblemsItemProviderAdapterFactory extends ProblemsAdapterFactory i * This keeps track of all the supported types checked by {@link #isFactoryForType isFactoryForType}. * <!-- begin-user-doc --> <!-- * end-user-doc --> + * * @generated */ protected Collection<Object> supportedTypes = new ArrayList<Object>(); @@ -92,7 +95,7 @@ public class ProblemsItemProviderAdapterFactory extends ProblemsAdapterFactory i /** * This constructs an instance. <!-- begin-user-doc --> <!-- end-user-doc * --> - * + * * @generated */ public ProblemsItemProviderAdapterFactory() { @@ -111,20 +114,20 @@ public class ProblemsItemProviderAdapterFactory extends ProblemsAdapterFactory i /** * This keeps track of the one adapter used for all {@link org.eclipse.papyrus.cdo.validation.problems.EProblem} instances. * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ protected EProblemItemProvider eProblemItemProvider; /** - * This creates an adapter for a - * {@link org.eclipse.papyrus.cdo.validation.problems.EProblem}. <!-- + * This creates an adapter for a {@link org.eclipse.papyrus.cdo.validation.problems.EProblem}. <!-- * begin-user-doc --> <!-- end-user-doc --> - * + * * @generated */ @Override public Adapter createEProblemAdapter() { - if(eProblemItemProvider == null) { + if (eProblemItemProvider == null) { eProblemItemProvider = new EProblemItemProvider(this); } @@ -134,6 +137,7 @@ public class ProblemsItemProviderAdapterFactory extends ProblemsAdapterFactory i /** * This keeps track of the one adapter used for all {@link org.eclipse.papyrus.cdo.validation.problems.EProblemsContainer} instances. * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ protected EProblemsContainerItemProvider eProblemsContainerItemProvider; @@ -141,11 +145,12 @@ public class ProblemsItemProviderAdapterFactory extends ProblemsAdapterFactory i /** * This creates an adapter for a {@link org.eclipse.papyrus.cdo.validation.problems.EProblemsContainer}. * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ @Override public Adapter createEProblemsContainerAdapter() { - if(eProblemsContainerItemProvider == null) { + if (eProblemsContainerItemProvider == null) { eProblemsContainerItemProvider = new EProblemsContainerItemProvider(this); } @@ -156,6 +161,7 @@ public class ProblemsItemProviderAdapterFactory extends ProblemsAdapterFactory i * This keeps track of the one adapter used for all {@link java.util.Map.Entry} instances. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ protected AttributeItemProvider attributeItemProvider; @@ -164,11 +170,12 @@ public class ProblemsItemProviderAdapterFactory extends ProblemsAdapterFactory i * This creates an adapter for a {@link java.util.Map.Entry}. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ @Override public Adapter createAttributeAdapter() { - if(attributeItemProvider == null) { + if (attributeItemProvider == null) { attributeItemProvider = new AttributeItemProvider(this); } @@ -178,9 +185,10 @@ public class ProblemsItemProviderAdapterFactory extends ProblemsAdapterFactory i /** * This returns the root adapter factory that contains this factory. <!-- * begin-user-doc --> <!-- end-user-doc --> - * + * * @generated */ + @Override public ComposeableAdapterFactory getRootAdapterFactory() { return parentAdapterFactory == null ? this : parentAdapterFactory.getRootAdapterFactory(); } @@ -188,15 +196,17 @@ public class ProblemsItemProviderAdapterFactory extends ProblemsAdapterFactory i /** * This sets the composed adapter factory that contains this factory. <!-- * begin-user-doc --> <!-- end-user-doc --> - * + * * @generated */ + @Override public void setParentAdapterFactory(ComposedAdapterFactory parentAdapterFactory) { this.parentAdapterFactory = parentAdapterFactory; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ @Override @@ -207,6 +217,7 @@ public class ProblemsItemProviderAdapterFactory extends ProblemsAdapterFactory i /** * This implementation substitutes the factory itself as the key for the adapter. * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ @Override @@ -216,13 +227,14 @@ public class ProblemsItemProviderAdapterFactory extends ProblemsAdapterFactory i /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ @Override public Object adapt(Object object, Object type) { - if(isFactoryForType(type)) { + if (isFactoryForType(type)) { Object adapter = super.adapt(object, type); - if(!(type instanceof Class<?>) || (((Class<?>)type).isInstance(adapter))) { + if (!(type instanceof Class<?>) || (((Class<?>) type).isInstance(adapter))) { return adapter; } } @@ -232,6 +244,7 @@ public class ProblemsItemProviderAdapterFactory extends ProblemsAdapterFactory i /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ public List<IChildCreationExtender> getChildCreationExtenders() { @@ -240,16 +253,20 @@ public class ProblemsItemProviderAdapterFactory extends ProblemsAdapterFactory i /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ + @Override public Collection<?> getNewChildDescriptors(Object object, EditingDomain editingDomain) { return childCreationExtenderManager.getNewChildDescriptors(object, editingDomain); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ + @Override public ResourceLocator getResourceLocator() { return childCreationExtenderManager; } @@ -257,8 +274,10 @@ public class ProblemsItemProviderAdapterFactory extends ProblemsAdapterFactory i /** * This adds a listener. * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ + @Override public void addListener(INotifyChangedListener notifyChangedListener) { changeNotifier.addListener(notifyChangedListener); } @@ -266,23 +285,25 @@ public class ProblemsItemProviderAdapterFactory extends ProblemsAdapterFactory i /** * This removes a listener. * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ + @Override public void removeListener(INotifyChangedListener notifyChangedListener) { changeNotifier.removeListener(notifyChangedListener); } /** - * This delegates to {@link #changeNotifier} and to - * {@link #parentAdapterFactory}. <!-- begin-user-doc --> <!-- end-user-doc + * This delegates to {@link #changeNotifier} and to {@link #parentAdapterFactory}. <!-- begin-user-doc --> <!-- end-user-doc * --> - * + * * @generated */ + @Override public void fireNotifyChanged(Notification notification) { changeNotifier.fireNotifyChanged(notification); - if(parentAdapterFactory != null) { + if (parentAdapterFactory != null) { parentAdapterFactory.fireNotifyChanged(notification); } } @@ -290,16 +311,20 @@ public class ProblemsItemProviderAdapterFactory extends ProblemsAdapterFactory i /** * This disposes all of the item providers created by this factory. <!-- * begin-user-doc --> <!-- end-user-doc --> - * + * * @generated */ + @Override public void dispose() { - if(eProblemItemProvider != null) + if (eProblemItemProvider != null) { eProblemItemProvider.dispose(); - if(eProblemsContainerItemProvider != null) + } + if (eProblemsContainerItemProvider != null) { eProblemsContainerItemProvider.dispose(); - if(attributeItemProvider != null) + } + if (attributeItemProvider != null) { attributeItemProvider.dispose(); + } } } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems/src/org/eclipse/papyrus/cdo/validation/problems/EProblem.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems/src/org/eclipse/papyrus/cdo/validation/problems/EProblem.java index 2d4b915c4c7..2c4183c270c 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems/src/org/eclipse/papyrus/cdo/validation/problems/EProblem.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems/src/org/eclipse/papyrus/cdo/validation/problems/EProblem.java @@ -1,6 +1,6 @@ /** * 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 @@ -18,8 +18,7 @@ import org.eclipse.emf.common.util.EMap; import org.eclipse.emf.ecore.EObject; /** - * <!-- begin-user-doc --> A representation of the model object ' - * <em><b>EProblem</b></em>'. <!-- end-user-doc --> + * <!-- begin-user-doc --> A representation of the model object ' <em><b>EProblem</b></em>'. <!-- end-user-doc --> * * <!-- begin-model-doc --> * Description of a problem in some element of an EMF-based model instance. @@ -28,15 +27,15 @@ import org.eclipse.emf.ecore.EObject; * <p> * The following features are supported: * <ul> - * <li>{@link org.eclipse.papyrus.cdo.validation.problems.EProblem#getSeverity <em>Severity</em>}</li> - * <li>{@link org.eclipse.papyrus.cdo.validation.problems.EProblem#getMessage <em>Message</em>}</li> - * <li>{@link org.eclipse.papyrus.cdo.validation.problems.EProblem#getSource <em>Source</em>}</li> - * <li>{@link org.eclipse.papyrus.cdo.validation.problems.EProblem#getCode <em>Code</em>}</li> - * <li>{@link org.eclipse.papyrus.cdo.validation.problems.EProblem#getElement <em>Element</em>}</li> - * <li>{@link org.eclipse.papyrus.cdo.validation.problems.EProblem#getRelated <em>Related</em>}</li> - * <li>{@link org.eclipse.papyrus.cdo.validation.problems.EProblem#getContainer <em>Container</em>}</li> - * <li>{@link org.eclipse.papyrus.cdo.validation.problems.EProblem#getType <em>Type</em>}</li> - * <li>{@link org.eclipse.papyrus.cdo.validation.problems.EProblem#getAttributes <em>Attributes</em>}</li> + * <li>{@link org.eclipse.papyrus.cdo.validation.problems.EProblem#getSeverity <em>Severity</em>}</li> + * <li>{@link org.eclipse.papyrus.cdo.validation.problems.EProblem#getMessage <em>Message</em>}</li> + * <li>{@link org.eclipse.papyrus.cdo.validation.problems.EProblem#getSource <em>Source</em>}</li> + * <li>{@link org.eclipse.papyrus.cdo.validation.problems.EProblem#getCode <em>Code</em>}</li> + * <li>{@link org.eclipse.papyrus.cdo.validation.problems.EProblem#getElement <em>Element</em>}</li> + * <li>{@link org.eclipse.papyrus.cdo.validation.problems.EProblem#getRelated <em>Related</em>}</li> + * <li>{@link org.eclipse.papyrus.cdo.validation.problems.EProblem#getContainer <em>Container</em>}</li> + * <li>{@link org.eclipse.papyrus.cdo.validation.problems.EProblem#getType <em>Type</em>}</li> + * <li>{@link org.eclipse.papyrus.cdo.validation.problems.EProblem#getAttributes <em>Attributes</em>}</li> * </ul> * </p> * @@ -49,15 +48,13 @@ public interface EProblem extends CDOObject { /** * Returns the value of the '<em><b>Severity</b></em>' attribute. The - * literals are from the enumeration - * {@link org.eclipse.papyrus.cdo.validation.problems.ESeverity}. <!-- + * literals are from the enumeration {@link org.eclipse.papyrus.cdo.validation.problems.ESeverity}. <!-- * begin-user-doc --> * <p> - * If the meaning of the '<em>Severity</em>' attribute isn't clear, there - * really should be more of a description here... + * If the meaning of the '<em>Severity</em>' attribute isn't clear, there really should be more of a description here... * </p> * <!-- end-user-doc --> - * + * * @return the value of the '<em>Severity</em>' attribute. * @see org.eclipse.papyrus.cdo.validation.problems.ESeverity * @see #setSeverity(ESeverity) @@ -68,11 +65,10 @@ public interface EProblem extends CDOObject { ESeverity getSeverity(); /** - * Sets the value of the ' - * {@link org.eclipse.papyrus.cdo.validation.problems.EProblem#getSeverity + * Sets the value of the ' {@link org.eclipse.papyrus.cdo.validation.problems.EProblem#getSeverity * <em>Severity</em>}' attribute. <!-- begin-user-doc --> <!-- end-user-doc * --> - * + * * @param value * the new value of the '<em>Severity</em>' attribute. * @see org.eclipse.papyrus.cdo.validation.problems.ESeverity @@ -85,11 +81,10 @@ public interface EProblem extends CDOObject { * Returns the value of the '<em><b>Message</b></em>' attribute. <!-- * begin-user-doc --> * <p> - * If the meaning of the '<em>Message</em>' attribute isn't clear, there - * really should be more of a description here... + * If the meaning of the '<em>Message</em>' attribute isn't clear, there really should be more of a description here... * </p> * <!-- end-user-doc --> - * + * * @return the value of the '<em>Message</em>' attribute. * @see #setMessage(String) * @see org.eclipse.papyrus.cdo.validation.problems.ProblemsPackage#getEProblem_Message() @@ -99,11 +94,10 @@ public interface EProblem extends CDOObject { String getMessage(); /** - * Sets the value of the ' - * {@link org.eclipse.papyrus.cdo.validation.problems.EProblem#getMessage + * Sets the value of the ' {@link org.eclipse.papyrus.cdo.validation.problems.EProblem#getMessage * <em>Message</em>}' attribute. <!-- begin-user-doc --> <!-- end-user-doc * --> - * + * * @param value * the new value of the '<em>Message</em>' attribute. * @see #getMessage() @@ -115,11 +109,10 @@ public interface EProblem extends CDOObject { * Returns the value of the '<em><b>Source</b></em>' attribute. <!-- * begin-user-doc --> * <p> - * If the meaning of the '<em>Source</em>' attribute isn't clear, there - * really should be more of a description here... + * If the meaning of the '<em>Source</em>' attribute isn't clear, there really should be more of a description here... * </p> * <!-- end-user-doc --> - * + * * @return the value of the '<em>Source</em>' attribute. * @see #setSource(String) * @see org.eclipse.papyrus.cdo.validation.problems.ProblemsPackage#getEProblem_Source() @@ -129,11 +122,10 @@ public interface EProblem extends CDOObject { String getSource(); /** - * Sets the value of the ' - * {@link org.eclipse.papyrus.cdo.validation.problems.EProblem#getSource + * Sets the value of the ' {@link org.eclipse.papyrus.cdo.validation.problems.EProblem#getSource * <em>Source</em>}' attribute. <!-- begin-user-doc --> <!-- end-user-doc * --> - * + * * @param value * the new value of the '<em>Source</em>' attribute. * @see #getSource() @@ -145,11 +137,10 @@ public interface EProblem extends CDOObject { * Returns the value of the '<em><b>Code</b></em>' attribute. <!-- * begin-user-doc --> * <p> - * If the meaning of the '<em>Code</em>' attribute isn't clear, there really - * should be more of a description here... + * If the meaning of the '<em>Code</em>' attribute isn't clear, there really should be more of a description here... * </p> * <!-- end-user-doc --> - * + * * @return the value of the '<em>Code</em>' attribute. * @see #setCode(int) * @see org.eclipse.papyrus.cdo.validation.problems.ProblemsPackage#getEProblem_Code() @@ -161,7 +152,9 @@ public interface EProblem extends CDOObject { /** * Sets the value of the '{@link org.eclipse.papyrus.cdo.validation.problems.EProblem#getCode <em>Code</em>}' attribute. * <!-- begin-user-doc --> <!-- end-user-doc --> - * @param value the new value of the '<em>Code</em>' attribute. + * + * @param value + * the new value of the '<em>Code</em>' attribute. * @see #getCode() * @generated */ @@ -171,7 +164,7 @@ public interface EProblem extends CDOObject { * Returns the value of the '<em><b>Element</b></em>' reference. <!-- * begin-user-doc --> <!-- end-user-doc --> <!-- begin-model-doc --> The * element that manifests the problem. <!-- end-model-doc --> - * + * * @return the value of the '<em>Element</em>' reference. * @see #setElement(EObject) * @see org.eclipse.papyrus.cdo.validation.problems.ProblemsPackage#getEProblem_Element() @@ -181,11 +174,10 @@ public interface EProblem extends CDOObject { EObject getElement(); /** - * Sets the value of the ' - * {@link org.eclipse.papyrus.cdo.validation.problems.EProblem#getElement + * Sets the value of the ' {@link org.eclipse.papyrus.cdo.validation.problems.EProblem#getElement * <em>Element</em>}' reference. <!-- begin-user-doc --> <!-- end-user-doc * --> - * + * * @param value * the new value of the '<em>Element</em>' reference. * @see #getElement() @@ -200,7 +192,7 @@ public interface EProblem extends CDOObject { * model elements contributing to or otherwise related to the problem. May * be, but not necessarily derived from, the 'data' list of an Ecore * Diagnostic. <!-- end-model-doc --> - * + * * @return the value of the '<em>Related</em>' reference list. * @see org.eclipse.papyrus.cdo.validation.problems.ProblemsPackage#getEProblem_Related() * @model @@ -213,10 +205,10 @@ public interface EProblem extends CDOObject { * It is bidirectional and its opposite is '{@link org.eclipse.papyrus.cdo.validation.problems.EProblemsContainer#getProblems <em>Problems</em>}'. * <!-- begin-user-doc --> * <p> - * If the meaning of the '<em>Container</em>' container reference isn't - * clear, there really should be more of a description here... + * If the meaning of the '<em>Container</em>' container reference isn't clear, there really should be more of a description here... * </p> * <!-- end-user-doc --> + * * @return the value of the '<em>Container</em>' container reference. * @see #setContainer(EProblemsContainer) * @see org.eclipse.papyrus.cdo.validation.problems.ProblemsPackage#getEProblem_Container() @@ -230,7 +222,9 @@ public interface EProblem extends CDOObject { * Sets the value of the '{@link org.eclipse.papyrus.cdo.validation.problems.EProblem#getContainer <em>Container</em>}' container reference. * <!-- begin-user-doc --> <!-- * end-user-doc --> - * @param value the new value of the '<em>Container</em>' container reference. + * + * @param value + * the new value of the '<em>Container</em>' container reference. * @see #getContainer() * @generated */ @@ -242,8 +236,9 @@ public interface EProblem extends CDOObject { * <!-- begin-user-doc --> * <!-- end-user-doc --> * <!-- begin-model-doc --> - * Optional identifier of a problem type. This should correspond to a marker type registered on the Eclipse {@code org.eclipse.core.resources.markers} extension point. + * Optional identifier of a problem type. This should correspond to a marker type registered on the Eclipse {@code org.eclipse.core.resources.markers} extension point. * <!-- end-model-doc --> + * * @return the value of the '<em>Type</em>' attribute. * @see #setType(String) * @see org.eclipse.papyrus.cdo.validation.problems.ProblemsPackage#getEProblem_Type() @@ -256,7 +251,9 @@ public interface EProblem extends CDOObject { * Sets the value of the '{@link org.eclipse.papyrus.cdo.validation.problems.EProblem#getType <em>Type</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> - * @param value the new value of the '<em>Type</em>' attribute. + * + * @param value + * the new value of the '<em>Type</em>' attribute. * @see #getType() * @generated */ @@ -268,10 +265,10 @@ public interface EProblem extends CDOObject { * and the value is of type {@link java.lang.String}, * <!-- begin-user-doc --> * <p> - * If the meaning of the '<em>Attributes</em>' map isn't clear, - * there really should be more of a description here... + * If the meaning of the '<em>Attributes</em>' map isn't clear, there really should be more of a description here... * </p> * <!-- end-user-doc --> + * * @return the value of the '<em>Attributes</em>' map. * @see org.eclipse.papyrus.cdo.validation.problems.ProblemsPackage#getEProblem_Attributes() * @model mapType="org.eclipse.papyrus.cdo.validation.problems.Attribute<org.eclipse.emf.ecore.EString, org.eclipse.emf.ecore.EString>" @@ -281,6 +278,7 @@ public interface EProblem extends CDOObject { /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @model dataType="org.eclipse.papyrus.cdo.validation.problems.EDiagnostic" required="true" * @generated */ diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems/src/org/eclipse/papyrus/cdo/validation/problems/EProblemsContainer.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems/src/org/eclipse/papyrus/cdo/validation/problems/EProblemsContainer.java index d9aab9b6e72..02b9ed5ff9d 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems/src/org/eclipse/papyrus/cdo/validation/problems/EProblemsContainer.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems/src/org/eclipse/papyrus/cdo/validation/problems/EProblemsContainer.java @@ -1,6 +1,6 @@ /** * 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 @@ -19,8 +19,7 @@ import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EObject; /** - * <!-- begin-user-doc --> A representation of the model object ' - * <em><b>EProblems Container</b></em>'. <!-- end-user-doc --> + * <!-- begin-user-doc --> A representation of the model object ' <em><b>EProblems Container</b></em>'. <!-- end-user-doc --> * * <!-- begin-model-doc --> * An optional container for problems, to provide a single node that can be conveniently contained in some larger structure such as an XML resource (which can only have one root element) or other generic container. @@ -29,10 +28,10 @@ import org.eclipse.emf.ecore.EObject; * <p> * The following features are supported: * <ul> - * <li>{@link org.eclipse.papyrus.cdo.validation.problems.EProblemsContainer#getProblems <em>Problems</em>}</li> - * <li>{@link org.eclipse.papyrus.cdo.validation.problems.EProblemsContainer#getSubjects <em>Subjects</em>}</li> - * <li>{@link org.eclipse.papyrus.cdo.validation.problems.EProblemsContainer#getSubcontainers <em>Subcontainers</em>}</li> - * <li>{@link org.eclipse.papyrus.cdo.validation.problems.EProblemsContainer#getContainer <em>Container</em>}</li> + * <li>{@link org.eclipse.papyrus.cdo.validation.problems.EProblemsContainer#getProblems <em>Problems</em>}</li> + * <li>{@link org.eclipse.papyrus.cdo.validation.problems.EProblemsContainer#getSubjects <em>Subjects</em>}</li> + * <li>{@link org.eclipse.papyrus.cdo.validation.problems.EProblemsContainer#getSubcontainers <em>Subcontainers</em>}</li> + * <li>{@link org.eclipse.papyrus.cdo.validation.problems.EProblemsContainer#getContainer <em>Container</em>}</li> * </ul> * </p> * @@ -49,10 +48,10 @@ public interface EProblemsContainer extends CDOObject { * It is bidirectional and its opposite is '{@link org.eclipse.papyrus.cdo.validation.problems.EProblem#getContainer <em>Container</em>}'. * <!-- begin-user-doc --> * <p> - * If the meaning of the '<em>Problems</em>' containment reference list - * isn't clear, there really should be more of a description here... + * If the meaning of the '<em>Problems</em>' containment reference list isn't clear, there really should be more of a description here... * </p> * <!-- end-user-doc --> + * * @return the value of the '<em>Problems</em>' containment reference list. * @see org.eclipse.papyrus.cdo.validation.problems.ProblemsPackage#getEProblemsContainer_Problems() * @see org.eclipse.papyrus.cdo.validation.problems.EProblem#getContainer @@ -67,7 +66,7 @@ public interface EProblemsContainer extends CDOObject { * begin-user-doc --> <!-- end-user-doc --> <!-- begin-model-doc --> * Optional reference to elements that are the subjects of some collection * of problems. <!-- end-model-doc --> - * + * * @return the value of the '<em>Subjects</em>' reference list. * @see org.eclipse.papyrus.cdo.validation.problems.ProblemsPackage#getEProblemsContainer_Subjects() * @model @@ -77,15 +76,13 @@ public interface EProblemsContainer extends CDOObject { /** * Returns the value of the '<em><b>Subcontainers</b></em>' containment - * reference list. The list contents are of type - * {@link org.eclipse.papyrus.cdo.validation.problems.EProblemsContainer}. - * It is bidirectional and its opposite is ' - * {@link org.eclipse.papyrus.cdo.validation.problems.EProblemsContainer#getContainer + * reference list. The list contents are of type {@link org.eclipse.papyrus.cdo.validation.problems.EProblemsContainer}. + * It is bidirectional and its opposite is ' {@link org.eclipse.papyrus.cdo.validation.problems.EProblemsContainer#getContainer * <em>Container</em>}'. <!-- begin-user-doc --> <!-- end-user-doc --> <!-- * begin-model-doc --> Optional nested group of containers, possibly * referencing different subjects than the parent container. <!-- * end-model-doc --> - * + * * @return the value of the '<em>Subcontainers</em>' containment reference * list. * @see org.eclipse.papyrus.cdo.validation.problems.ProblemsPackage#getEProblemsContainer_Subcontainers() @@ -100,10 +97,10 @@ public interface EProblemsContainer extends CDOObject { * It is bidirectional and its opposite is '{@link org.eclipse.papyrus.cdo.validation.problems.EProblemsContainer#getSubcontainers <em>Subcontainers</em>}'. * <!-- begin-user-doc --> * <p> - * If the meaning of the '<em>Container</em>' container reference isn't - * clear, there really should be more of a description here... + * If the meaning of the '<em>Container</em>' container reference isn't clear, there really should be more of a description here... * </p> * <!-- end-user-doc --> + * * @return the value of the '<em>Container</em>' container reference. * @see #setContainer(EProblemsContainer) * @see org.eclipse.papyrus.cdo.validation.problems.ProblemsPackage#getEProblemsContainer_Container() @@ -117,7 +114,9 @@ public interface EProblemsContainer extends CDOObject { * Sets the value of the '{@link org.eclipse.papyrus.cdo.validation.problems.EProblemsContainer#getContainer <em>Container</em>}' container reference. * <!-- begin-user-doc --> <!-- * end-user-doc --> - * @param value the new value of the '<em>Container</em>' container reference. + * + * @param value + * the new value of the '<em>Container</em>' container reference. * @see #getContainer() * @generated */ @@ -125,6 +124,7 @@ public interface EProblemsContainer extends CDOObject { /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @model dataType="org.eclipse.papyrus.cdo.validation.problems.EIterator<org.eclipse.papyrus.cdo.validation.problems.EProblem>" required="true" * @generated */ @@ -132,6 +132,7 @@ public interface EProblemsContainer extends CDOObject { /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @model dataType="org.eclipse.papyrus.cdo.validation.problems.EIterator<org.eclipse.papyrus.cdo.validation.problems.EProblem>" required="true" elementRequired="true" * @generated */ @@ -139,6 +140,7 @@ public interface EProblemsContainer extends CDOObject { /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @model dataType="org.eclipse.papyrus.cdo.validation.problems.EDiagnostic" * @generated */ @@ -146,6 +148,7 @@ public interface EProblemsContainer extends CDOObject { /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @model dataType="org.eclipse.papyrus.cdo.validation.problems.EDiagnostic" elementRequired="true" * @generated */ @@ -153,6 +156,7 @@ public interface EProblemsContainer extends CDOObject { /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @model * @generated */ diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems/src/org/eclipse/papyrus/cdo/validation/problems/ESeverity.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems/src/org/eclipse/papyrus/cdo/validation/problems/ESeverity.java index b998f244ae7..e093b7995c2 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems/src/org/eclipse/papyrus/cdo/validation/problems/ESeverity.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems/src/org/eclipse/papyrus/cdo/validation/problems/ESeverity.java @@ -1,6 +1,6 @@ /** * 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 @@ -18,11 +18,10 @@ import java.util.List; import org.eclipse.emf.common.util.Enumerator; /** - * <!-- begin-user-doc --> A representation of the literals of the enumeration ' - * <em><b>ESeverity</b></em>', and utility methods for working with them. <!-- + * <!-- begin-user-doc --> A representation of the literals of the enumeration ' <em><b>ESeverity</b></em>', and utility methods for working with them. <!-- * end-user-doc --> <!-- begin-model-doc --> Enumeration of problem severities, * corresponding to the Ecore Diagnostic severity values. <!-- end-model-doc --> - * + * * @see org.eclipse.papyrus.cdo.validation.problems.ProblemsPackage#getESeverity() * @model * @generated @@ -32,6 +31,7 @@ public enum ESeverity implements Enumerator { * The '<em><b>OK</b></em>' literal object. * <!-- begin-user-doc --> <!-- * end-user-doc --> + * * @see #OK_VALUE * @generated * @ordered @@ -42,6 +42,7 @@ public enum ESeverity implements Enumerator { * The '<em><b>INFO</b></em>' literal object. * <!-- begin-user-doc --> <!-- * end-user-doc --> + * * @see #INFO_VALUE * @generated * @ordered @@ -52,6 +53,7 @@ public enum ESeverity implements Enumerator { * The '<em><b>WARNING</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @see #WARNING_VALUE * @generated * @ordered @@ -62,6 +64,7 @@ public enum ESeverity implements Enumerator { * The '<em><b>ERROR</b></em>' literal object. * <!-- begin-user-doc --> <!-- * end-user-doc --> + * * @see #ERROR_VALUE * @generated * @ordered @@ -72,6 +75,7 @@ public enum ESeverity implements Enumerator { * The '<em><b>CANCEL</b></em>' literal object. * <!-- begin-user-doc --> <!-- * end-user-doc --> + * * @see #CANCEL_VALUE * @generated * @ordered @@ -82,10 +86,10 @@ public enum ESeverity implements Enumerator { * The '<em><b>OK</b></em>' literal value. * <!-- begin-user-doc --> * <p> - * If the meaning of '<em><b>OK</b></em>' literal object isn't clear, there - * really should be more of a description here... + * If the meaning of '<em><b>OK</b></em>' literal object isn't clear, there really should be more of a description here... * </p> * <!-- end-user-doc --> + * * @see #OK * @model * @generated @@ -97,10 +101,10 @@ public enum ESeverity implements Enumerator { * The '<em><b>INFO</b></em>' literal value. * <!-- begin-user-doc --> * <p> - * If the meaning of '<em><b>INFO</b></em>' literal object isn't clear, - * there really should be more of a description here... + * If the meaning of '<em><b>INFO</b></em>' literal object isn't clear, there really should be more of a description here... * </p> * <!-- end-user-doc --> + * * @see #INFO * @model * @generated @@ -112,10 +116,10 @@ public enum ESeverity implements Enumerator { * The '<em><b>WARNING</b></em>' literal value. * <!-- begin-user-doc --> * <p> - * If the meaning of '<em><b>WARNING</b></em>' literal object isn't clear, - * there really should be more of a description here... + * If the meaning of '<em><b>WARNING</b></em>' literal object isn't clear, there really should be more of a description here... * </p> * <!-- end-user-doc --> + * * @see #WARNING * @model * @generated @@ -127,10 +131,10 @@ public enum ESeverity implements Enumerator { * The '<em><b>ERROR</b></em>' literal value. * <!-- begin-user-doc --> * <p> - * If the meaning of '<em><b>ERROR</b></em>' literal object isn't clear, - * there really should be more of a description here... + * If the meaning of '<em><b>ERROR</b></em>' literal object isn't clear, there really should be more of a description here... * </p> * <!-- end-user-doc --> + * * @see #ERROR * @model * @generated @@ -142,10 +146,10 @@ public enum ESeverity implements Enumerator { * The '<em><b>CANCEL</b></em>' literal value. * <!-- begin-user-doc --> * <p> - * If the meaning of '<em><b>CANCEL</b></em>' literal object isn't clear, - * there really should be more of a description here... + * If the meaning of '<em><b>CANCEL</b></em>' literal object isn't clear, there really should be more of a description here... * </p> * <!-- end-user-doc --> + * * @see #CANCEL * @model * @generated @@ -156,14 +160,15 @@ public enum ESeverity implements Enumerator { /** * An array of all the '<em><b>ESeverity</b></em>' enumerators. <!-- * begin-user-doc --> <!-- end-user-doc --> - * + * * @generated */ - private static final ESeverity[] VALUES_ARRAY = new ESeverity[]{ OK, INFO, WARNING, ERROR, CANCEL, }; + private static final ESeverity[] VALUES_ARRAY = new ESeverity[] { OK, INFO, WARNING, ERROR, CANCEL, }; /** * A public read-only list of all the '<em><b>ESeverity</b></em>' enumerators. * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ public static final List<ESeverity> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); @@ -171,12 +176,13 @@ public enum ESeverity implements Enumerator { /** * Returns the '<em><b>ESeverity</b></em>' literal with the specified literal value. * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ public static ESeverity get(String literal) { - for(int i = 0; i < VALUES_ARRAY.length; ++i) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { ESeverity result = VALUES_ARRAY[i]; - if(result.toString().equals(literal)) { + if (result.toString().equals(literal)) { return result; } } @@ -186,12 +192,13 @@ public enum ESeverity implements Enumerator { /** * Returns the '<em><b>ESeverity</b></em>' literal with the specified name. * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ public static ESeverity getByName(String name) { - for(int i = 0; i < VALUES_ARRAY.length; ++i) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { ESeverity result = VALUES_ARRAY[i]; - if(result.getName().equals(name)) { + if (result.getName().equals(name)) { return result; } } @@ -201,10 +208,11 @@ public enum ESeverity implements Enumerator { /** * Returns the '<em><b>ESeverity</b></em>' literal with the specified integer value. * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ public static ESeverity get(int value) { - switch(value) { + switch (value) { case OK_VALUE: return OK; case INFO_VALUE: @@ -221,18 +229,21 @@ public enum ESeverity implements Enumerator { /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ private final int value; /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ private final String name; /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ private final String literal; @@ -241,6 +252,7 @@ public enum ESeverity implements Enumerator { * Only this class can construct instances. * <!-- begin-user-doc --> <!-- * end-user-doc --> + * * @generated */ private ESeverity(int value, String name, String literal) { @@ -251,24 +263,30 @@ public enum ESeverity implements Enumerator { /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ + @Override public int getValue() { return value; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ + @Override public String getName() { return name; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ + @Override public String getLiteral() { return literal; } @@ -276,6 +294,7 @@ public enum ESeverity implements Enumerator { /** * Returns the literal value of the enumerator, which is its string representation. * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ @Override diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems/src/org/eclipse/papyrus/cdo/validation/problems/ProblemsFactory.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems/src/org/eclipse/papyrus/cdo/validation/problems/ProblemsFactory.java index d7c987e1814..deebf800276 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems/src/org/eclipse/papyrus/cdo/validation/problems/ProblemsFactory.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems/src/org/eclipse/papyrus/cdo/validation/problems/ProblemsFactory.java @@ -1,6 +1,6 @@ /** * 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 @@ -16,6 +16,7 @@ import org.eclipse.emf.ecore.EFactory; /** * <!-- begin-user-doc --> The <b>Factory</b> for the model. It provides a * create method for each non-abstract class of the model. <!-- end-user-doc --> + * * @see org.eclipse.papyrus.cdo.validation.problems.ProblemsPackage * @generated */ @@ -25,6 +26,7 @@ public interface ProblemsFactory extends EFactory { * The singleton instance of the factory. * <!-- begin-user-doc --> <!-- * end-user-doc --> + * * @generated */ ProblemsFactory eINSTANCE = org.eclipse.papyrus.cdo.validation.problems.impl.ProblemsFactoryImpl.init(); @@ -33,6 +35,7 @@ public interface ProblemsFactory extends EFactory { * Returns a new object of class '<em>EProblem</em>'. * <!-- begin-user-doc * --> <!-- end-user-doc --> + * * @return a new object of class '<em>EProblem</em>'. * @generated */ @@ -41,7 +44,7 @@ public interface ProblemsFactory extends EFactory { /** * Returns a new object of class '<em>EProblems Container</em>'. <!-- * begin-user-doc --> <!-- end-user-doc --> - * + * * @return a new object of class '<em>EProblems Container</em>'. * @generated */ @@ -51,6 +54,7 @@ public interface ProblemsFactory extends EFactory { * Returns the package supported by this factory. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @return the package supported by this factory. * @generated */ diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems/src/org/eclipse/papyrus/cdo/validation/problems/ProblemsPackage.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems/src/org/eclipse/papyrus/cdo/validation/problems/ProblemsPackage.java index c4505e4a0cb..69053426631 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems/src/org/eclipse/papyrus/cdo/validation/problems/ProblemsPackage.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems/src/org/eclipse/papyrus/cdo/validation/problems/ProblemsPackage.java @@ -1,6 +1,6 @@ /** * 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 @@ -33,7 +33,7 @@ import org.eclipse.emf.ecore.EReference; * primarily as a persistence vehicle for Ecore Diagnostics in contexts where * Eclipse resource problem markers (IProblemMarker) are either not available or * not appropriate. <!-- end-model-doc --> - * + * * @see org.eclipse.papyrus.cdo.validation.problems.ProblemsFactory * @model kind="package" * @generated @@ -43,6 +43,7 @@ public interface ProblemsPackage extends EPackage { /** * The package name. * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ String eNAME = "problems"; //$NON-NLS-1$ @@ -50,6 +51,7 @@ public interface ProblemsPackage extends EPackage { /** * The package namespace URI. * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ String eNS_URI = "http://www.eclipse.org/papyrus/cdo/problems/1.0.0"; //$NON-NLS-1$ @@ -57,6 +59,7 @@ public interface ProblemsPackage extends EPackage { /** * The package namespace name. * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ String eNS_PREFIX = "problems"; //$NON-NLS-1$ @@ -65,6 +68,7 @@ public interface ProblemsPackage extends EPackage { * The singleton instance of the package. * <!-- begin-user-doc --> <!-- * end-user-doc --> + * * @generated */ ProblemsPackage eINSTANCE = org.eclipse.papyrus.cdo.validation.problems.impl.ProblemsPackageImpl.init(); @@ -72,6 +76,7 @@ public interface ProblemsPackage extends EPackage { /** * The meta object id for the '{@link org.eclipse.papyrus.cdo.validation.problems.impl.EProblemImpl <em>EProblem</em>}' class. * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @see org.eclipse.papyrus.cdo.validation.problems.impl.EProblemImpl * @see org.eclipse.papyrus.cdo.validation.problems.impl.ProblemsPackageImpl#getEProblem() * @generated @@ -81,7 +86,7 @@ public interface ProblemsPackage extends EPackage { /** * The feature id for the '<em><b>Severity</b></em>' attribute. <!-- * begin-user-doc --> <!-- end-user-doc --> - * + * * @generated * @ordered */ @@ -90,7 +95,7 @@ public interface ProblemsPackage extends EPackage { /** * The feature id for the '<em><b>Message</b></em>' attribute. <!-- * begin-user-doc --> <!-- end-user-doc --> - * + * * @generated * @ordered */ @@ -99,7 +104,7 @@ public interface ProblemsPackage extends EPackage { /** * The feature id for the '<em><b>Source</b></em>' attribute. <!-- * begin-user-doc --> <!-- end-user-doc --> - * + * * @generated * @ordered */ @@ -108,7 +113,7 @@ public interface ProblemsPackage extends EPackage { /** * The feature id for the '<em><b>Code</b></em>' attribute. <!-- * begin-user-doc --> <!-- end-user-doc --> - * + * * @generated * @ordered */ @@ -117,7 +122,7 @@ public interface ProblemsPackage extends EPackage { /** * The feature id for the '<em><b>Element</b></em>' reference. <!-- * begin-user-doc --> <!-- end-user-doc --> - * + * * @generated * @ordered */ @@ -126,7 +131,7 @@ public interface ProblemsPackage extends EPackage { /** * The feature id for the '<em><b>Related</b></em>' reference list. <!-- * begin-user-doc --> <!-- end-user-doc --> - * + * * @generated * @ordered */ @@ -135,6 +140,7 @@ public interface ProblemsPackage extends EPackage { /** * The feature id for the '<em><b>Container</b></em>' container reference. * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated * @ordered */ @@ -144,6 +150,7 @@ public interface ProblemsPackage extends EPackage { * The feature id for the '<em><b>Type</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated * @ordered */ @@ -153,6 +160,7 @@ public interface ProblemsPackage extends EPackage { * The feature id for the '<em><b>Attributes</b></em>' map. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated * @ordered */ @@ -161,7 +169,7 @@ public interface ProblemsPackage extends EPackage { /** * The number of structural features of the '<em>EProblem</em>' class. <!-- * begin-user-doc --> <!-- end-user-doc --> - * + * * @generated * @ordered */ @@ -170,7 +178,7 @@ public interface ProblemsPackage extends EPackage { /** * The operation id for the '<em>To Diagnostic</em>' operation. <!-- * begin-user-doc --> <!-- end-user-doc --> - * + * * @generated * @ordered */ @@ -179,7 +187,7 @@ public interface ProblemsPackage extends EPackage { /** * The number of operations of the '<em>EProblem</em>' class. <!-- * begin-user-doc --> <!-- end-user-doc --> - * + * * @generated * @ordered */ @@ -189,6 +197,7 @@ public interface ProblemsPackage extends EPackage { * The meta object id for the '{@link org.eclipse.papyrus.cdo.validation.problems.impl.EProblemsContainerImpl <em>EProblems Container</em>}' class. * <!-- begin-user-doc --> <!-- * end-user-doc --> + * * @see org.eclipse.papyrus.cdo.validation.problems.impl.EProblemsContainerImpl * @see org.eclipse.papyrus.cdo.validation.problems.impl.ProblemsPackageImpl#getEProblemsContainer() * @generated @@ -198,6 +207,7 @@ public interface ProblemsPackage extends EPackage { /** * The feature id for the '<em><b>Problems</b></em>' containment reference list. * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated * @ordered */ @@ -206,7 +216,7 @@ public interface ProblemsPackage extends EPackage { /** * The feature id for the '<em><b>Subjects</b></em>' reference list. <!-- * begin-user-doc --> <!-- end-user-doc --> - * + * * @generated * @ordered */ @@ -215,6 +225,7 @@ public interface ProblemsPackage extends EPackage { /** * The feature id for the '<em><b>Subcontainers</b></em>' containment reference list. * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated * @ordered */ @@ -223,6 +234,7 @@ public interface ProblemsPackage extends EPackage { /** * The feature id for the '<em><b>Container</b></em>' container reference. * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated * @ordered */ @@ -231,6 +243,7 @@ public interface ProblemsPackage extends EPackage { /** * The number of structural features of the '<em>EProblems Container</em>' class. * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated * @ordered */ @@ -239,7 +252,7 @@ public interface ProblemsPackage extends EPackage { /** * The operation id for the '<em>All Problems</em>' operation. <!-- * begin-user-doc --> <!-- end-user-doc --> - * + * * @generated * @ordered */ @@ -248,7 +261,7 @@ public interface ProblemsPackage extends EPackage { /** * The operation id for the '<em>All Problems</em>' operation. <!-- * begin-user-doc --> <!-- end-user-doc --> - * + * * @generated * @ordered */ @@ -257,7 +270,7 @@ public interface ProblemsPackage extends EPackage { /** * The operation id for the '<em>All Diagnostics</em>' operation. <!-- * begin-user-doc --> <!-- end-user-doc --> - * + * * @generated * @ordered */ @@ -266,7 +279,7 @@ public interface ProblemsPackage extends EPackage { /** * The operation id for the '<em>All Diagnostics</em>' operation. <!-- * begin-user-doc --> <!-- end-user-doc --> - * + * * @generated * @ordered */ @@ -275,7 +288,7 @@ public interface ProblemsPackage extends EPackage { /** * The operation id for the '<em>Get Worst Problem</em>' operation. <!-- * begin-user-doc --> <!-- end-user-doc --> - * + * * @generated * @ordered */ @@ -284,6 +297,7 @@ public interface ProblemsPackage extends EPackage { /** * The number of operations of the '<em>EProblems Container</em>' class. * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated * @ordered */ @@ -293,6 +307,7 @@ public interface ProblemsPackage extends EPackage { * The meta object id for the '{@link org.eclipse.papyrus.cdo.validation.problems.impl.AttributeImpl <em>Attribute</em>}' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @see org.eclipse.papyrus.cdo.validation.problems.impl.AttributeImpl * @see org.eclipse.papyrus.cdo.validation.problems.impl.ProblemsPackageImpl#getAttribute() * @generated @@ -303,6 +318,7 @@ public interface ProblemsPackage extends EPackage { * The feature id for the '<em><b>Key</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated * @ordered */ @@ -312,6 +328,7 @@ public interface ProblemsPackage extends EPackage { * The feature id for the '<em><b>Value</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated * @ordered */ @@ -321,6 +338,7 @@ public interface ProblemsPackage extends EPackage { * The number of structural features of the '<em>Attribute</em>' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated * @ordered */ @@ -330,6 +348,7 @@ public interface ProblemsPackage extends EPackage { * The number of operations of the '<em>Attribute</em>' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated * @ordered */ @@ -338,6 +357,7 @@ public interface ProblemsPackage extends EPackage { /** * The meta object id for the '{@link org.eclipse.papyrus.cdo.validation.problems.ESeverity <em>ESeverity</em>}' enum. * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @see org.eclipse.papyrus.cdo.validation.problems.ESeverity * @see org.eclipse.papyrus.cdo.validation.problems.impl.ProblemsPackageImpl#getESeverity() * @generated @@ -347,7 +367,7 @@ public interface ProblemsPackage extends EPackage { /** * The meta object id for the '<em>EDiagnostic</em>' data type. <!-- * begin-user-doc --> <!-- end-user-doc --> - * + * * @see org.eclipse.emf.common.util.Diagnostic * @see org.eclipse.papyrus.cdo.validation.problems.impl.ProblemsPackageImpl#getEDiagnostic() * @generated @@ -357,7 +377,7 @@ public interface ProblemsPackage extends EPackage { /** * The meta object id for the '<em>EIterator</em>' data type. <!-- * begin-user-doc --> <!-- end-user-doc --> - * + * * @see java.util.Iterator * @see org.eclipse.papyrus.cdo.validation.problems.impl.ProblemsPackageImpl#getEIterator() * @generated @@ -367,6 +387,7 @@ public interface ProblemsPackage extends EPackage { /** * Returns the meta object for class '{@link org.eclipse.papyrus.cdo.validation.problems.EProblem <em>EProblem</em>}'. * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @return the meta object for class '<em>EProblem</em>'. * @see org.eclipse.papyrus.cdo.validation.problems.EProblem * @generated @@ -376,6 +397,7 @@ public interface ProblemsPackage extends EPackage { /** * Returns the meta object for the attribute '{@link org.eclipse.papyrus.cdo.validation.problems.EProblem#getSeverity <em>Severity</em>}'. * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @return the meta object for the attribute '<em>Severity</em>'. * @see org.eclipse.papyrus.cdo.validation.problems.EProblem#getSeverity() * @see #getEProblem() @@ -386,6 +408,7 @@ public interface ProblemsPackage extends EPackage { /** * Returns the meta object for the attribute '{@link org.eclipse.papyrus.cdo.validation.problems.EProblem#getMessage <em>Message</em>}'. * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @return the meta object for the attribute '<em>Message</em>'. * @see org.eclipse.papyrus.cdo.validation.problems.EProblem#getMessage() * @see #getEProblem() @@ -396,6 +419,7 @@ public interface ProblemsPackage extends EPackage { /** * Returns the meta object for the attribute '{@link org.eclipse.papyrus.cdo.validation.problems.EProblem#getSource <em>Source</em>}'. * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @return the meta object for the attribute '<em>Source</em>'. * @see org.eclipse.papyrus.cdo.validation.problems.EProblem#getSource() * @see #getEProblem() @@ -406,6 +430,7 @@ public interface ProblemsPackage extends EPackage { /** * Returns the meta object for the attribute '{@link org.eclipse.papyrus.cdo.validation.problems.EProblem#getCode <em>Code</em>}'. * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @return the meta object for the attribute '<em>Code</em>'. * @see org.eclipse.papyrus.cdo.validation.problems.EProblem#getCode() * @see #getEProblem() @@ -416,6 +441,7 @@ public interface ProblemsPackage extends EPackage { /** * Returns the meta object for the reference '{@link org.eclipse.papyrus.cdo.validation.problems.EProblem#getElement <em>Element</em>}'. * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @return the meta object for the reference '<em>Element</em>'. * @see org.eclipse.papyrus.cdo.validation.problems.EProblem#getElement() * @see #getEProblem() @@ -426,6 +452,7 @@ public interface ProblemsPackage extends EPackage { /** * Returns the meta object for the reference list '{@link org.eclipse.papyrus.cdo.validation.problems.EProblem#getRelated <em>Related</em>}'. * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @return the meta object for the reference list '<em>Related</em>'. * @see org.eclipse.papyrus.cdo.validation.problems.EProblem#getRelated() * @see #getEProblem() @@ -436,6 +463,7 @@ public interface ProblemsPackage extends EPackage { /** * Returns the meta object for the container reference '{@link org.eclipse.papyrus.cdo.validation.problems.EProblem#getContainer <em>Container</em>}'. * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @return the meta object for the container reference '<em>Container</em>'. * @see org.eclipse.papyrus.cdo.validation.problems.EProblem#getContainer() * @see #getEProblem() @@ -447,6 +475,7 @@ public interface ProblemsPackage extends EPackage { * Returns the meta object for the attribute '{@link org.eclipse.papyrus.cdo.validation.problems.EProblem#getType <em>Type</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @return the meta object for the attribute '<em>Type</em>'. * @see org.eclipse.papyrus.cdo.validation.problems.EProblem#getType() * @see #getEProblem() @@ -458,6 +487,7 @@ public interface ProblemsPackage extends EPackage { * Returns the meta object for the map '{@link org.eclipse.papyrus.cdo.validation.problems.EProblem#getAttributes <em>Attributes</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @return the meta object for the map '<em>Attributes</em>'. * @see org.eclipse.papyrus.cdo.validation.problems.EProblem#getAttributes() * @see #getEProblem() @@ -469,6 +499,7 @@ public interface ProblemsPackage extends EPackage { * Returns the meta object for the '{@link org.eclipse.papyrus.cdo.validation.problems.EProblem#toDiagnostic() <em>To Diagnostic</em>}' operation. * <!-- begin-user-doc --> <!-- * end-user-doc --> + * * @return the meta object for the '<em>To Diagnostic</em>' operation. * @see org.eclipse.papyrus.cdo.validation.problems.EProblem#toDiagnostic() * @generated @@ -476,11 +507,10 @@ public interface ProblemsPackage extends EPackage { EOperation getEProblem__ToDiagnostic(); /** - * Returns the meta object for class ' - * {@link org.eclipse.papyrus.cdo.validation.problems.EProblemsContainer + * Returns the meta object for class ' {@link org.eclipse.papyrus.cdo.validation.problems.EProblemsContainer * <em>EProblems Container</em>}'. <!-- begin-user-doc --> <!-- end-user-doc * --> - * + * * @return the meta object for class '<em>EProblems Container</em>'. * @see org.eclipse.papyrus.cdo.validation.problems.EProblemsContainer * @generated @@ -490,6 +520,7 @@ public interface ProblemsPackage extends EPackage { /** * Returns the meta object for the containment reference list '{@link org.eclipse.papyrus.cdo.validation.problems.EProblemsContainer#getProblems <em>Problems</em>}'. * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @return the meta object for the containment reference list '<em>Problems</em>'. * @see org.eclipse.papyrus.cdo.validation.problems.EProblemsContainer#getProblems() * @see #getEProblemsContainer() @@ -500,6 +531,7 @@ public interface ProblemsPackage extends EPackage { /** * Returns the meta object for the reference list '{@link org.eclipse.papyrus.cdo.validation.problems.EProblemsContainer#getSubjects <em>Subjects</em>}'. * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @return the meta object for the reference list '<em>Subjects</em>'. * @see org.eclipse.papyrus.cdo.validation.problems.EProblemsContainer#getSubjects() * @see #getEProblemsContainer() @@ -510,6 +542,7 @@ public interface ProblemsPackage extends EPackage { /** * Returns the meta object for the containment reference list '{@link org.eclipse.papyrus.cdo.validation.problems.EProblemsContainer#getSubcontainers <em>Subcontainers</em>}'. * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @return the meta object for the containment reference list '<em>Subcontainers</em>'. * @see org.eclipse.papyrus.cdo.validation.problems.EProblemsContainer#getSubcontainers() * @see #getEProblemsContainer() @@ -520,6 +553,7 @@ public interface ProblemsPackage extends EPackage { /** * Returns the meta object for the container reference '{@link org.eclipse.papyrus.cdo.validation.problems.EProblemsContainer#getContainer <em>Container</em>}'. * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @return the meta object for the container reference '<em>Container</em>'. * @see org.eclipse.papyrus.cdo.validation.problems.EProblemsContainer#getContainer() * @see #getEProblemsContainer() @@ -531,6 +565,7 @@ public interface ProblemsPackage extends EPackage { * Returns the meta object for the '{@link org.eclipse.papyrus.cdo.validation.problems.EProblemsContainer#allProblems() <em>All Problems</em>}' operation. * <!-- begin-user-doc --> <!-- * end-user-doc --> + * * @return the meta object for the '<em>All Problems</em>' operation. * @see org.eclipse.papyrus.cdo.validation.problems.EProblemsContainer#allProblems() * @generated @@ -541,6 +576,7 @@ public interface ProblemsPackage extends EPackage { * Returns the meta object for the '{@link org.eclipse.papyrus.cdo.validation.problems.EProblemsContainer#allProblems(org.eclipse.emf.ecore.EObject) <em>All Problems</em>}' operation. * <!-- begin-user-doc --> <!-- * end-user-doc --> + * * @return the meta object for the '<em>All Problems</em>' operation. * @see org.eclipse.papyrus.cdo.validation.problems.EProblemsContainer#allProblems(org.eclipse.emf.ecore.EObject) * @generated @@ -551,6 +587,7 @@ public interface ProblemsPackage extends EPackage { * Returns the meta object for the '{@link org.eclipse.papyrus.cdo.validation.problems.EProblemsContainer#allDiagnostics() <em>All Diagnostics</em>}' operation. * <!-- begin-user-doc --> <!-- * end-user-doc --> + * * @return the meta object for the '<em>All Diagnostics</em>' operation. * @see org.eclipse.papyrus.cdo.validation.problems.EProblemsContainer#allDiagnostics() * @generated @@ -561,6 +598,7 @@ public interface ProblemsPackage extends EPackage { * Returns the meta object for the '{@link org.eclipse.papyrus.cdo.validation.problems.EProblemsContainer#allDiagnostics(org.eclipse.emf.ecore.EObject) <em>All Diagnostics</em>}' operation. * <!-- begin-user-doc --> <!-- * end-user-doc --> + * * @return the meta object for the '<em>All Diagnostics</em>' operation. * @see org.eclipse.papyrus.cdo.validation.problems.EProblemsContainer#allDiagnostics(org.eclipse.emf.ecore.EObject) * @generated @@ -571,6 +609,7 @@ public interface ProblemsPackage extends EPackage { * Returns the meta object for the '{@link org.eclipse.papyrus.cdo.validation.problems.EProblemsContainer#getWorstProblem(org.eclipse.emf.ecore.EObject) <em>Get Worst Problem</em>}' operation. * <!-- begin-user-doc --> <!-- * end-user-doc --> + * * @return the meta object for the '<em>Get Worst Problem</em>' operation. * @see org.eclipse.papyrus.cdo.validation.problems.EProblemsContainer#getWorstProblem(org.eclipse.emf.ecore.EObject) * @generated @@ -581,6 +620,7 @@ public interface ProblemsPackage extends EPackage { * Returns the meta object for class '{@link java.util.Map.Entry <em>Attribute</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @return the meta object for class '<em>Attribute</em>'. * @see java.util.Map.Entry * @model keyDataType="org.eclipse.emf.ecore.EString" keyRequired="true" @@ -593,6 +633,7 @@ public interface ProblemsPackage extends EPackage { * Returns the meta object for the attribute '{@link java.util.Map.Entry <em>Key</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @return the meta object for the attribute '<em>Key</em>'. * @see java.util.Map.Entry * @see #getAttribute() @@ -604,6 +645,7 @@ public interface ProblemsPackage extends EPackage { * Returns the meta object for the attribute '{@link java.util.Map.Entry <em>Value</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @return the meta object for the attribute '<em>Value</em>'. * @see java.util.Map.Entry * @see #getAttribute() @@ -614,6 +656,7 @@ public interface ProblemsPackage extends EPackage { /** * Returns the meta object for enum '{@link org.eclipse.papyrus.cdo.validation.problems.ESeverity <em>ESeverity</em>}'. * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @return the meta object for enum '<em>ESeverity</em>'. * @see org.eclipse.papyrus.cdo.validation.problems.ESeverity * @generated @@ -623,6 +666,7 @@ public interface ProblemsPackage extends EPackage { /** * Returns the meta object for data type '{@link org.eclipse.emf.common.util.Diagnostic <em>EDiagnostic</em>}'. * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @return the meta object for data type '<em>EDiagnostic</em>'. * @see org.eclipse.emf.common.util.Diagnostic * @model instanceClass="org.eclipse.emf.common.util.Diagnostic" serializeable="false" @@ -633,6 +677,7 @@ public interface ProblemsPackage extends EPackage { /** * Returns the meta object for data type '{@link java.util.Iterator <em>EIterator</em>}'. * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @return the meta object for data type '<em>EIterator</em>'. * @see java.util.Iterator * @model instanceClass="java.util.Iterator" serializeable="false" typeParameters="E" @@ -643,7 +688,7 @@ public interface ProblemsPackage extends EPackage { /** * Returns the factory that creates the instances of the model. <!-- * begin-user-doc --> <!-- end-user-doc --> - * + * * @return the factory that creates the instances of the model. * @generated */ @@ -660,16 +705,16 @@ public interface ProblemsPackage extends EPackage { * <li>and each data type</li> * </ul> * <!-- end-user-doc --> + * * @generated */ interface Literals { /** - * The meta object literal for the ' - * {@link org.eclipse.papyrus.cdo.validation.problems.impl.EProblemImpl + * The meta object literal for the ' {@link org.eclipse.papyrus.cdo.validation.problems.impl.EProblemImpl * <em>EProblem</em>}' class. <!-- begin-user-doc --> <!-- end-user-doc * --> - * + * * @see org.eclipse.papyrus.cdo.validation.problems.impl.EProblemImpl * @see org.eclipse.papyrus.cdo.validation.problems.impl.ProblemsPackageImpl#getEProblem() * @generated @@ -679,6 +724,7 @@ public interface ProblemsPackage extends EPackage { /** * The meta object literal for the '<em><b>Severity</b></em>' attribute feature. * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ EAttribute EPROBLEM__SEVERITY = eINSTANCE.getEProblem_Severity(); @@ -686,6 +732,7 @@ public interface ProblemsPackage extends EPackage { /** * The meta object literal for the '<em><b>Message</b></em>' attribute feature. * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ EAttribute EPROBLEM__MESSAGE = eINSTANCE.getEProblem_Message(); @@ -693,6 +740,7 @@ public interface ProblemsPackage extends EPackage { /** * The meta object literal for the '<em><b>Source</b></em>' attribute feature. * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ EAttribute EPROBLEM__SOURCE = eINSTANCE.getEProblem_Source(); @@ -700,6 +748,7 @@ public interface ProblemsPackage extends EPackage { /** * The meta object literal for the '<em><b>Code</b></em>' attribute feature. * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ EAttribute EPROBLEM__CODE = eINSTANCE.getEProblem_Code(); @@ -707,6 +756,7 @@ public interface ProblemsPackage extends EPackage { /** * The meta object literal for the '<em><b>Element</b></em>' reference feature. * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ EReference EPROBLEM__ELEMENT = eINSTANCE.getEProblem_Element(); @@ -714,6 +764,7 @@ public interface ProblemsPackage extends EPackage { /** * The meta object literal for the '<em><b>Related</b></em>' reference list feature. * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ EReference EPROBLEM__RELATED = eINSTANCE.getEProblem_Related(); @@ -721,6 +772,7 @@ public interface ProblemsPackage extends EPackage { /** * The meta object literal for the '<em><b>Container</b></em>' container reference feature. * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ EReference EPROBLEM__CONTAINER = eINSTANCE.getEProblem_Container(); @@ -729,6 +781,7 @@ public interface ProblemsPackage extends EPackage { * The meta object literal for the '<em><b>Type</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ EAttribute EPROBLEM__TYPE = eINSTANCE.getEProblem_Type(); @@ -737,6 +790,7 @@ public interface ProblemsPackage extends EPackage { * The meta object literal for the '<em><b>Attributes</b></em>' map feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ EReference EPROBLEM__ATTRIBUTES = eINSTANCE.getEProblem_Attributes(); @@ -744,6 +798,7 @@ public interface ProblemsPackage extends EPackage { /** * The meta object literal for the '<em><b>To Diagnostic</b></em>' operation. * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ EOperation EPROBLEM___TO_DIAGNOSTIC = eINSTANCE.getEProblem__ToDiagnostic(); @@ -752,6 +807,7 @@ public interface ProblemsPackage extends EPackage { * The meta object literal for the '{@link org.eclipse.papyrus.cdo.validation.problems.impl.EProblemsContainerImpl <em>EProblems Container</em>}' class. * <!-- begin-user-doc --> <!-- * end-user-doc --> + * * @see org.eclipse.papyrus.cdo.validation.problems.impl.EProblemsContainerImpl * @see org.eclipse.papyrus.cdo.validation.problems.impl.ProblemsPackageImpl#getEProblemsContainer() * @generated @@ -762,6 +818,7 @@ public interface ProblemsPackage extends EPackage { * The meta object literal for the '<em><b>Problems</b></em>' containment reference list feature. * <!-- begin-user-doc --> <!-- * end-user-doc --> + * * @generated */ EReference EPROBLEMS_CONTAINER__PROBLEMS = eINSTANCE.getEProblemsContainer_Problems(); @@ -769,6 +826,7 @@ public interface ProblemsPackage extends EPackage { /** * The meta object literal for the '<em><b>Subjects</b></em>' reference list feature. * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ EReference EPROBLEMS_CONTAINER__SUBJECTS = eINSTANCE.getEProblemsContainer_Subjects(); @@ -777,6 +835,7 @@ public interface ProblemsPackage extends EPackage { * The meta object literal for the '<em><b>Subcontainers</b></em>' containment reference list feature. * <!-- begin-user-doc --> <!-- * end-user-doc --> + * * @generated */ EReference EPROBLEMS_CONTAINER__SUBCONTAINERS = eINSTANCE.getEProblemsContainer_Subcontainers(); @@ -784,6 +843,7 @@ public interface ProblemsPackage extends EPackage { /** * The meta object literal for the '<em><b>Container</b></em>' container reference feature. * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ EReference EPROBLEMS_CONTAINER__CONTAINER = eINSTANCE.getEProblemsContainer_Container(); @@ -791,6 +851,7 @@ public interface ProblemsPackage extends EPackage { /** * The meta object literal for the '<em><b>All Problems</b></em>' operation. * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ EOperation EPROBLEMS_CONTAINER___ALL_PROBLEMS = eINSTANCE.getEProblemsContainer__AllProblems(); @@ -798,6 +859,7 @@ public interface ProblemsPackage extends EPackage { /** * The meta object literal for the '<em><b>All Problems</b></em>' operation. * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ EOperation EPROBLEMS_CONTAINER___ALL_PROBLEMS__EOBJECT = eINSTANCE.getEProblemsContainer__AllProblems__EObject(); @@ -805,6 +867,7 @@ public interface ProblemsPackage extends EPackage { /** * The meta object literal for the '<em><b>All Diagnostics</b></em>' operation. * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ EOperation EPROBLEMS_CONTAINER___ALL_DIAGNOSTICS = eINSTANCE.getEProblemsContainer__AllDiagnostics(); @@ -812,6 +875,7 @@ public interface ProblemsPackage extends EPackage { /** * The meta object literal for the '<em><b>All Diagnostics</b></em>' operation. * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ EOperation EPROBLEMS_CONTAINER___ALL_DIAGNOSTICS__EOBJECT = eINSTANCE.getEProblemsContainer__AllDiagnostics__EObject(); @@ -819,6 +883,7 @@ public interface ProblemsPackage extends EPackage { /** * The meta object literal for the '<em><b>Get Worst Problem</b></em>' operation. * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ EOperation EPROBLEMS_CONTAINER___GET_WORST_PROBLEM__EOBJECT = eINSTANCE.getEProblemsContainer__GetWorstProblem__EObject(); @@ -827,6 +892,7 @@ public interface ProblemsPackage extends EPackage { * The meta object literal for the '{@link org.eclipse.papyrus.cdo.validation.problems.impl.AttributeImpl <em>Attribute</em>}' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @see org.eclipse.papyrus.cdo.validation.problems.impl.AttributeImpl * @see org.eclipse.papyrus.cdo.validation.problems.impl.ProblemsPackageImpl#getAttribute() * @generated @@ -837,6 +903,7 @@ public interface ProblemsPackage extends EPackage { * The meta object literal for the '<em><b>Key</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ EAttribute ATTRIBUTE__KEY = eINSTANCE.getAttribute_Key(); @@ -845,16 +912,16 @@ public interface ProblemsPackage extends EPackage { * The meta object literal for the '<em><b>Value</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ EAttribute ATTRIBUTE__VALUE = eINSTANCE.getAttribute_Value(); /** - * The meta object literal for the ' - * {@link org.eclipse.papyrus.cdo.validation.problems.ESeverity + * The meta object literal for the ' {@link org.eclipse.papyrus.cdo.validation.problems.ESeverity * <em>ESeverity</em>}' enum. <!-- begin-user-doc --> <!-- end-user-doc * --> - * + * * @see org.eclipse.papyrus.cdo.validation.problems.ESeverity * @see org.eclipse.papyrus.cdo.validation.problems.impl.ProblemsPackageImpl#getESeverity() * @generated @@ -864,6 +931,7 @@ public interface ProblemsPackage extends EPackage { /** * The meta object literal for the '<em>EDiagnostic</em>' data type. * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @see org.eclipse.emf.common.util.Diagnostic * @see org.eclipse.papyrus.cdo.validation.problems.impl.ProblemsPackageImpl#getEDiagnostic() * @generated @@ -873,7 +941,7 @@ public interface ProblemsPackage extends EPackage { /** * The meta object literal for the '<em>EIterator</em>' data type. <!-- * begin-user-doc --> <!-- end-user-doc --> - * + * * @see java.util.Iterator * @see org.eclipse.papyrus.cdo.validation.problems.impl.ProblemsPackageImpl#getEIterator() * @generated diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems/src/org/eclipse/papyrus/cdo/validation/problems/impl/AttributeImpl.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems/src/org/eclipse/papyrus/cdo/validation/problems/impl/AttributeImpl.java index 78c3f877f81..80b753e70de 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems/src/org/eclipse/papyrus/cdo/validation/problems/impl/AttributeImpl.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems/src/org/eclipse/papyrus/cdo/validation/problems/impl/AttributeImpl.java @@ -1,11 +1,11 @@ /** * 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 */ @@ -28,8 +28,8 @@ import org.eclipse.papyrus.cdo.validation.problems.ProblemsPackage; * <p> * The following features are implemented: * <ul> - * <li>{@link org.eclipse.papyrus.cdo.validation.problems.impl.AttributeImpl#getTypedKey <em>Key</em>}</li> - * <li>{@link org.eclipse.papyrus.cdo.validation.problems.impl.AttributeImpl#getTypedValue <em>Value</em>}</li> + * <li>{@link org.eclipse.papyrus.cdo.validation.problems.impl.AttributeImpl#getTypedKey <em>Key</em>}</li> + * <li>{@link org.eclipse.papyrus.cdo.validation.problems.impl.AttributeImpl#getTypedValue <em>Value</em>}</li> * </ul> * </p> * @@ -40,6 +40,7 @@ public class AttributeImpl extends CDOObjectImpl implements BasicEMap.Entry<Stri /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ protected AttributeImpl() { @@ -49,6 +50,7 @@ public class AttributeImpl extends CDOObjectImpl implements BasicEMap.Entry<Stri /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ @Override @@ -59,6 +61,7 @@ public class AttributeImpl extends CDOObjectImpl implements BasicEMap.Entry<Stri /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ @Override @@ -69,15 +72,17 @@ public class AttributeImpl extends CDOObjectImpl implements BasicEMap.Entry<Stri /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ public String getTypedKey() { - return (String)eGet(ProblemsPackage.Literals.ATTRIBUTE__KEY, true); + return (String) eGet(ProblemsPackage.Literals.ATTRIBUTE__KEY, true); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ public void setTypedKey(String newKey) { @@ -87,15 +92,17 @@ public class AttributeImpl extends CDOObjectImpl implements BasicEMap.Entry<Stri /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ public String getTypedValue() { - return (String)eGet(ProblemsPackage.Literals.ATTRIBUTE__VALUE, true); + return (String) eGet(ProblemsPackage.Literals.ATTRIBUTE__VALUE, true); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ public void setTypedValue(String newValue) { @@ -105,6 +112,7 @@ public class AttributeImpl extends CDOObjectImpl implements BasicEMap.Entry<Stri /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ protected int hash = -1; @@ -112,10 +120,12 @@ public class AttributeImpl extends CDOObjectImpl implements BasicEMap.Entry<Stri /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ + @Override public int getHash() { - if(hash == -1) { + if (hash == -1) { Object theKey = getKey(); hash = (theKey == null ? 0 : theKey.hashCode()); } @@ -125,8 +135,10 @@ public class AttributeImpl extends CDOObjectImpl implements BasicEMap.Entry<Stri /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ + @Override public void setHash(int hash) { this.hash = hash; } @@ -134,8 +146,10 @@ public class AttributeImpl extends CDOObjectImpl implements BasicEMap.Entry<Stri /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ + @Override public String getKey() { return getTypedKey(); } @@ -143,8 +157,10 @@ public class AttributeImpl extends CDOObjectImpl implements BasicEMap.Entry<Stri /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ + @Override public void setKey(String key) { setTypedKey(key); } @@ -152,8 +168,10 @@ public class AttributeImpl extends CDOObjectImpl implements BasicEMap.Entry<Stri /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ + @Override public String getValue() { return getTypedValue(); } @@ -161,8 +179,10 @@ public class AttributeImpl extends CDOObjectImpl implements BasicEMap.Entry<Stri /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ + @Override public String setValue(String value) { String oldValue = getValue(); setTypedValue(value); @@ -172,12 +192,13 @@ public class AttributeImpl extends CDOObjectImpl implements BasicEMap.Entry<Stri /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ @SuppressWarnings("unchecked") public EMap<String, String> getEMap() { EObject container = eContainer(); - return container == null ? null : (EMap<String, String>)container.eGet(eContainmentFeature()); + return container == null ? null : (EMap<String, String>) container.eGet(eContainmentFeature()); } -} //AttributeImpl +} // AttributeImpl diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems/src/org/eclipse/papyrus/cdo/validation/problems/impl/EProblemImpl.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems/src/org/eclipse/papyrus/cdo/validation/problems/impl/EProblemImpl.java index d154a2601e9..7f68f8b3fa8 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems/src/org/eclipse/papyrus/cdo/validation/problems/impl/EProblemImpl.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems/src/org/eclipse/papyrus/cdo/validation/problems/impl/EProblemImpl.java @@ -1,6 +1,6 @@ /** * 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 @@ -27,20 +27,19 @@ import org.eclipse.papyrus.cdo.validation.problems.ESeverity; import org.eclipse.papyrus.cdo.validation.problems.ProblemsPackage; /** - * <!-- begin-user-doc --> An implementation of the model object ' - * <em><b>EProblem</b></em>'. <!-- end-user-doc --> + * <!-- begin-user-doc --> An implementation of the model object ' <em><b>EProblem</b></em>'. <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> - * <li>{@link org.eclipse.papyrus.cdo.validation.problems.impl.EProblemImpl#getSeverity <em>Severity</em>}</li> - * <li>{@link org.eclipse.papyrus.cdo.validation.problems.impl.EProblemImpl#getMessage <em>Message</em>}</li> - * <li>{@link org.eclipse.papyrus.cdo.validation.problems.impl.EProblemImpl#getSource <em>Source</em>}</li> - * <li>{@link org.eclipse.papyrus.cdo.validation.problems.impl.EProblemImpl#getCode <em>Code</em>}</li> - * <li>{@link org.eclipse.papyrus.cdo.validation.problems.impl.EProblemImpl#getElement <em>Element</em>}</li> - * <li>{@link org.eclipse.papyrus.cdo.validation.problems.impl.EProblemImpl#getRelated <em>Related</em>}</li> - * <li>{@link org.eclipse.papyrus.cdo.validation.problems.impl.EProblemImpl#getContainer <em>Container</em>}</li> - * <li>{@link org.eclipse.papyrus.cdo.validation.problems.impl.EProblemImpl#getType <em>Type</em>}</li> - * <li>{@link org.eclipse.papyrus.cdo.validation.problems.impl.EProblemImpl#getAttributes <em>Attributes</em>}</li> + * <li>{@link org.eclipse.papyrus.cdo.validation.problems.impl.EProblemImpl#getSeverity <em>Severity</em>}</li> + * <li>{@link org.eclipse.papyrus.cdo.validation.problems.impl.EProblemImpl#getMessage <em>Message</em>}</li> + * <li>{@link org.eclipse.papyrus.cdo.validation.problems.impl.EProblemImpl#getSource <em>Source</em>}</li> + * <li>{@link org.eclipse.papyrus.cdo.validation.problems.impl.EProblemImpl#getCode <em>Code</em>}</li> + * <li>{@link org.eclipse.papyrus.cdo.validation.problems.impl.EProblemImpl#getElement <em>Element</em>}</li> + * <li>{@link org.eclipse.papyrus.cdo.validation.problems.impl.EProblemImpl#getRelated <em>Related</em>}</li> + * <li>{@link org.eclipse.papyrus.cdo.validation.problems.impl.EProblemImpl#getContainer <em>Container</em>}</li> + * <li>{@link org.eclipse.papyrus.cdo.validation.problems.impl.EProblemImpl#getType <em>Type</em>}</li> + * <li>{@link org.eclipse.papyrus.cdo.validation.problems.impl.EProblemImpl#getAttributes <em>Attributes</em>}</li> * </ul> * </p> * @@ -50,6 +49,7 @@ public class EProblemImpl extends CDOObjectImpl implements EProblem { /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ protected EProblemImpl() { @@ -58,6 +58,7 @@ public class EProblemImpl extends CDOObjectImpl implements EProblem { /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ @Override @@ -67,6 +68,7 @@ public class EProblemImpl extends CDOObjectImpl implements EProblem { /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ @Override @@ -76,105 +78,131 @@ public class EProblemImpl extends CDOObjectImpl implements EProblem { /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ + @Override public ESeverity getSeverity() { - return (ESeverity)eGet(ProblemsPackage.Literals.EPROBLEM__SEVERITY, true); + return (ESeverity) eGet(ProblemsPackage.Literals.EPROBLEM__SEVERITY, true); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ + @Override public void setSeverity(ESeverity newSeverity) { eSet(ProblemsPackage.Literals.EPROBLEM__SEVERITY, newSeverity); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ + @Override public String getMessage() { - return (String)eGet(ProblemsPackage.Literals.EPROBLEM__MESSAGE, true); + return (String) eGet(ProblemsPackage.Literals.EPROBLEM__MESSAGE, true); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ + @Override public void setMessage(String newMessage) { eSet(ProblemsPackage.Literals.EPROBLEM__MESSAGE, newMessage); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ + @Override public String getSource() { - return (String)eGet(ProblemsPackage.Literals.EPROBLEM__SOURCE, true); + return (String) eGet(ProblemsPackage.Literals.EPROBLEM__SOURCE, true); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ + @Override public void setSource(String newSource) { eSet(ProblemsPackage.Literals.EPROBLEM__SOURCE, newSource); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ + @Override public int getCode() { - return (Integer)eGet(ProblemsPackage.Literals.EPROBLEM__CODE, true); + return (Integer) eGet(ProblemsPackage.Literals.EPROBLEM__CODE, true); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ + @Override public void setCode(int newCode) { eSet(ProblemsPackage.Literals.EPROBLEM__CODE, newCode); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ + @Override public EObject getElement() { - return (EObject)eGet(ProblemsPackage.Literals.EPROBLEM__ELEMENT, true); + return (EObject) eGet(ProblemsPackage.Literals.EPROBLEM__ELEMENT, true); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ + @Override public void setElement(EObject newElement) { eSet(ProblemsPackage.Literals.EPROBLEM__ELEMENT, newElement); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ + @Override @SuppressWarnings("unchecked") public EList<EObject> getRelated() { - return (EList<EObject>)eGet(ProblemsPackage.Literals.EPROBLEM__RELATED, true); + return (EList<EObject>) eGet(ProblemsPackage.Literals.EPROBLEM__RELATED, true); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ + @Override public EProblemsContainer getContainer() { - return (EProblemsContainer)eGet(ProblemsPackage.Literals.EPROBLEM__CONTAINER, true); + return (EProblemsContainer) eGet(ProblemsPackage.Literals.EPROBLEM__CONTAINER, true); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ + @Override public void setContainer(EProblemsContainer newContainer) { eSet(ProblemsPackage.Literals.EPROBLEM__CONTAINER, newContainer); } @@ -182,17 +210,21 @@ public class EProblemImpl extends CDOObjectImpl implements EProblem { /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ + @Override public String getType() { - return (String)eGet(ProblemsPackage.Literals.EPROBLEM__TYPE, true); + return (String) eGet(ProblemsPackage.Literals.EPROBLEM__TYPE, true); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ + @Override public void setType(String newType) { eSet(ProblemsPackage.Literals.EPROBLEM__TYPE, newType); } @@ -200,23 +232,26 @@ public class EProblemImpl extends CDOObjectImpl implements EProblem { /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ + @Override @SuppressWarnings("unchecked") public EMap<String, String> getAttributes() { - return (EMap<String, String>)eGet(ProblemsPackage.Literals.EPROBLEM__ATTRIBUTES, true); + return (EMap<String, String>) eGet(ProblemsPackage.Literals.EPROBLEM__ATTRIBUTES, true); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> - * + * * @generated NOT */ + @Override public Diagnostic toDiagnostic() { Collection<EObject> related = getRelated(); Object[] data = new Object[1 + related.size()]; data[0] = getElement(); - if(!related.isEmpty()) { + if (!related.isEmpty()) { System.arraycopy(related.toArray(), 0, data, 1, related.size()); } return new BasicDiagnostic(getSeverity().getValue(), getSource(), getCode(), getMessage(), data); @@ -224,11 +259,12 @@ public class EProblemImpl extends CDOObjectImpl implements EProblem { /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ @Override public Object eInvoke(int operationID, EList<?> arguments) throws InvocationTargetException { - switch(operationID) { + switch (operationID) { case ProblemsPackage.EPROBLEM___TO_DIAGNOSTIC: return toDiagnostic(); } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems/src/org/eclipse/papyrus/cdo/validation/problems/impl/EProblemsContainerImpl.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems/src/org/eclipse/papyrus/cdo/validation/problems/impl/EProblemsContainerImpl.java index 1b5db58c916..a7a5c0bb314 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems/src/org/eclipse/papyrus/cdo/validation/problems/impl/EProblemsContainerImpl.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems/src/org/eclipse/papyrus/cdo/validation/problems/impl/EProblemsContainerImpl.java @@ -1,6 +1,6 @@ /** * 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 @@ -27,15 +27,14 @@ import org.eclipse.papyrus.cdo.validation.problems.EProblemsContainer; import org.eclipse.papyrus.cdo.validation.problems.ProblemsPackage; /** - * <!-- begin-user-doc --> An implementation of the model object ' - * <em><b>EProblems Container</b></em>'. <!-- end-user-doc --> + * <!-- begin-user-doc --> An implementation of the model object ' <em><b>EProblems Container</b></em>'. <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> - * <li>{@link org.eclipse.papyrus.cdo.validation.problems.impl.EProblemsContainerImpl#getProblems <em>Problems</em>}</li> - * <li>{@link org.eclipse.papyrus.cdo.validation.problems.impl.EProblemsContainerImpl#getSubjects <em>Subjects</em>}</li> - * <li>{@link org.eclipse.papyrus.cdo.validation.problems.impl.EProblemsContainerImpl#getSubcontainers <em>Subcontainers</em>}</li> - * <li>{@link org.eclipse.papyrus.cdo.validation.problems.impl.EProblemsContainerImpl#getContainer <em>Container</em>}</li> + * <li>{@link org.eclipse.papyrus.cdo.validation.problems.impl.EProblemsContainerImpl#getProblems <em>Problems</em>}</li> + * <li>{@link org.eclipse.papyrus.cdo.validation.problems.impl.EProblemsContainerImpl#getSubjects <em>Subjects</em>}</li> + * <li>{@link org.eclipse.papyrus.cdo.validation.problems.impl.EProblemsContainerImpl#getSubcontainers <em>Subcontainers</em>}</li> + * <li>{@link org.eclipse.papyrus.cdo.validation.problems.impl.EProblemsContainerImpl#getContainer <em>Container</em>}</li> * </ul> * </p> * @@ -45,6 +44,7 @@ public class EProblemsContainerImpl extends CDOObjectImpl implements EProblemsCo /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ protected EProblemsContainerImpl() { @@ -53,6 +53,7 @@ public class EProblemsContainerImpl extends CDOObjectImpl implements EProblemsCo /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ @Override @@ -62,6 +63,7 @@ public class EProblemsContainerImpl extends CDOObjectImpl implements EProblemsCo /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ @Override @@ -71,61 +73,73 @@ public class EProblemsContainerImpl extends CDOObjectImpl implements EProblemsCo /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ + @Override @SuppressWarnings("unchecked") public EList<EProblem> getProblems() { - return (EList<EProblem>)eGet(ProblemsPackage.Literals.EPROBLEMS_CONTAINER__PROBLEMS, true); + return (EList<EProblem>) eGet(ProblemsPackage.Literals.EPROBLEMS_CONTAINER__PROBLEMS, true); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ + @Override @SuppressWarnings("unchecked") public EList<EObject> getSubjects() { - return (EList<EObject>)eGet(ProblemsPackage.Literals.EPROBLEMS_CONTAINER__SUBJECTS, true); + return (EList<EObject>) eGet(ProblemsPackage.Literals.EPROBLEMS_CONTAINER__SUBJECTS, true); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ + @Override @SuppressWarnings("unchecked") public EList<EProblemsContainer> getSubcontainers() { - return (EList<EProblemsContainer>)eGet(ProblemsPackage.Literals.EPROBLEMS_CONTAINER__SUBCONTAINERS, true); + return (EList<EProblemsContainer>) eGet(ProblemsPackage.Literals.EPROBLEMS_CONTAINER__SUBCONTAINERS, true); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ + @Override public EProblemsContainer getContainer() { - return (EProblemsContainer)eGet(ProblemsPackage.Literals.EPROBLEMS_CONTAINER__CONTAINER, true); + return (EProblemsContainer) eGet(ProblemsPackage.Literals.EPROBLEMS_CONTAINER__CONTAINER, true); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ + @Override public void setContainer(EProblemsContainer newContainer) { eSet(ProblemsPackage.Literals.EPROBLEMS_CONTAINER__CONTAINER, newContainer); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> - * + * * @generated NOT */ + @Override public Iterator<EProblem> allProblems() { return new EProblemsIterator(eAllContents()); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> - * + * * @generated NOT */ + @Override public Iterator<EProblem> allProblems(final EObject element) { return new EProblemsIterator(eAllContents()) { @@ -138,13 +152,14 @@ public class EProblemsContainerImpl extends CDOObjectImpl implements EProblemsCo /** * <!-- begin-user-doc --> <!-- end-user-doc --> - * + * * @generated NOT */ + @Override public EList<Diagnostic> allDiagnostics() { List<Diagnostic> result = new java.util.ArrayList<Diagnostic>(); - for(Iterator<EProblem> allProblems = allProblems(); allProblems.hasNext();) { + for (Iterator<EProblem> allProblems = allProblems(); allProblems.hasNext();) { result.add(allProblems.next().toDiagnostic()); } @@ -153,13 +168,14 @@ public class EProblemsContainerImpl extends CDOObjectImpl implements EProblemsCo /** * <!-- begin-user-doc --> <!-- end-user-doc --> - * + * * @generated NOT */ + @Override public EList<Diagnostic> allDiagnostics(EObject element) { List<Diagnostic> result = new java.util.ArrayList<Diagnostic>(); - for(Iterator<EProblem> allProblems = allProblems(element); allProblems.hasNext();) { + for (Iterator<EProblem> allProblems = allProblems(element); allProblems.hasNext();) { result.add(allProblems.next().toDiagnostic()); } @@ -168,17 +184,18 @@ public class EProblemsContainerImpl extends CDOObjectImpl implements EProblemsCo /** * <!-- begin-user-doc --> <!-- end-user-doc --> - * + * * @generated NOT */ + @Override public EProblem getWorstProblem(EObject element) { EProblem result = null; - for(Iterator<EProblem> problems = allProblems(element); problems.hasNext();) { + for (Iterator<EProblem> problems = allProblems(element); problems.hasNext();) { EProblem next = problems.next(); - if(result == null) { + if (result == null) { result = next; - } else if(next.getSeverity().compareTo(result.getSeverity()) > 0) { + } else if (next.getSeverity().compareTo(result.getSeverity()) > 0) { result = next; } } @@ -188,21 +205,22 @@ public class EProblemsContainerImpl extends CDOObjectImpl implements EProblemsCo /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ @Override public Object eInvoke(int operationID, EList<?> arguments) throws InvocationTargetException { - switch(operationID) { + switch (operationID) { case ProblemsPackage.EPROBLEMS_CONTAINER___ALL_PROBLEMS: return allProblems(); case ProblemsPackage.EPROBLEMS_CONTAINER___ALL_PROBLEMS__EOBJECT: - return allProblems((EObject)arguments.get(0)); + return allProblems((EObject) arguments.get(0)); case ProblemsPackage.EPROBLEMS_CONTAINER___ALL_DIAGNOSTICS: return allDiagnostics(); case ProblemsPackage.EPROBLEMS_CONTAINER___ALL_DIAGNOSTICS__EOBJECT: - return allDiagnostics((EObject)arguments.get(0)); + return allDiagnostics((EObject) arguments.get(0)); case ProblemsPackage.EPROBLEMS_CONTAINER___GET_WORST_PROBLEM__EOBJECT: - return getWorstProblem((EObject)arguments.get(0)); + return getWorstProblem((EObject) arguments.get(0)); } return super.eInvoke(operationID, arguments); } @@ -217,13 +235,14 @@ public class EProblemsContainerImpl extends CDOObjectImpl implements EProblemsCo this.delegate = delegate; } + @Override public boolean hasNext() { - if(preparedNext == null) { - while(delegate.hasNext()) { + if (preparedNext == null) { + while (delegate.hasNext()) { Object next = delegate.next(); - if(next instanceof EProblem) { - EProblem problem = (EProblem)next; - if(accept(problem)) { + if (next instanceof EProblem) { + EProblem problem = (EProblem) next; + if (accept(problem)) { preparedNext = problem; break; } @@ -238,8 +257,9 @@ public class EProblemsContainerImpl extends CDOObjectImpl implements EProblemsCo return true; } + @Override public EProblem next() { - if(!hasNext()) { + if (!hasNext()) { throw new NoSuchElementException(); } @@ -248,6 +268,7 @@ public class EProblemsContainerImpl extends CDOObjectImpl implements EProblemsCo return result; } + @Override public void remove() { throw new UnsupportedOperationException("remove"); //$NON-NLS-1$ } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems/src/org/eclipse/papyrus/cdo/validation/problems/impl/ProblemsFactoryImpl.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems/src/org/eclipse/papyrus/cdo/validation/problems/impl/ProblemsFactoryImpl.java index 679a2a8e2ba..db8ffa7b17b 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems/src/org/eclipse/papyrus/cdo/validation/problems/impl/ProblemsFactoryImpl.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems/src/org/eclipse/papyrus/cdo/validation/problems/impl/ProblemsFactoryImpl.java @@ -1,6 +1,6 @@ /** * 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 @@ -27,6 +27,7 @@ import org.eclipse.papyrus.cdo.validation.problems.ProblemsPackage; /** * <!-- begin-user-doc --> An implementation of the model <b>Factory</b>. <!-- * end-user-doc --> + * * @generated */ public class ProblemsFactoryImpl extends EFactoryImpl implements ProblemsFactory { @@ -35,12 +36,13 @@ public class ProblemsFactoryImpl extends EFactoryImpl implements ProblemsFactory * Creates the default factory implementation. * <!-- begin-user-doc --> <!-- * end-user-doc --> + * * @generated */ public static ProblemsFactory init() { try { - ProblemsFactory theProblemsFactory = (ProblemsFactory)EPackage.Registry.INSTANCE.getEFactory(ProblemsPackage.eNS_URI); - if(theProblemsFactory != null) { + ProblemsFactory theProblemsFactory = (ProblemsFactory) EPackage.Registry.INSTANCE.getEFactory(ProblemsPackage.eNS_URI); + if (theProblemsFactory != null) { return theProblemsFactory; } } catch (Exception exception) { @@ -53,6 +55,7 @@ public class ProblemsFactoryImpl extends EFactoryImpl implements ProblemsFactory * Creates an instance of the factory. * <!-- begin-user-doc --> <!-- * end-user-doc --> + * * @generated */ public ProblemsFactoryImpl() { @@ -61,17 +64,18 @@ public class ProblemsFactoryImpl extends EFactoryImpl implements ProblemsFactory /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ @Override public EObject create(EClass eClass) { - switch(eClass.getClassifierID()) { + switch (eClass.getClassifierID()) { case ProblemsPackage.EPROBLEM: - return (EObject)createEProblem(); + return createEProblem(); case ProblemsPackage.EPROBLEMS_CONTAINER: - return (EObject)createEProblemsContainer(); + return createEProblemsContainer(); case ProblemsPackage.ATTRIBUTE: - return (EObject)createAttribute(); + return (EObject) createAttribute(); default: throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$ } @@ -79,11 +83,12 @@ public class ProblemsFactoryImpl extends EFactoryImpl implements ProblemsFactory /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ @Override public Object createFromString(EDataType eDataType, String initialValue) { - switch(eDataType.getClassifierID()) { + switch (eDataType.getClassifierID()) { case ProblemsPackage.ESEVERITY: return createESeverityFromString(eDataType, initialValue); default: @@ -93,11 +98,12 @@ public class ProblemsFactoryImpl extends EFactoryImpl implements ProblemsFactory /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ @Override public String convertToString(EDataType eDataType, Object instanceValue) { - switch(eDataType.getClassifierID()) { + switch (eDataType.getClassifierID()) { case ProblemsPackage.ESEVERITY: return convertESeverityToString(eDataType, instanceValue); default: @@ -107,8 +113,10 @@ public class ProblemsFactoryImpl extends EFactoryImpl implements ProblemsFactory /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ + @Override public EProblem createEProblem() { EProblemImpl eProblem = new EProblemImpl(); return eProblem; @@ -116,8 +124,10 @@ public class ProblemsFactoryImpl extends EFactoryImpl implements ProblemsFactory /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ + @Override public EProblemsContainer createEProblemsContainer() { EProblemsContainerImpl eProblemsContainer = new EProblemsContainerImpl(); return eProblemsContainer; @@ -126,6 +136,7 @@ public class ProblemsFactoryImpl extends EFactoryImpl implements ProblemsFactory /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ public Map.Entry<String, String> createAttribute() { @@ -135,17 +146,21 @@ public class ProblemsFactoryImpl extends EFactoryImpl implements ProblemsFactory /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ public ESeverity createESeverityFromString(EDataType eDataType, String initialValue) { ESeverity result = ESeverity.get(initialValue); - if(result == null) + if (result == null) + { throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } return result; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ public String convertESeverityToString(EDataType eDataType, Object instanceValue) { @@ -154,14 +169,17 @@ public class ProblemsFactoryImpl extends EFactoryImpl implements ProblemsFactory /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ + @Override public ProblemsPackage getProblemsPackage() { - return (ProblemsPackage)getEPackage(); + return (ProblemsPackage) getEPackage(); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @deprecated * @generated */ diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems/src/org/eclipse/papyrus/cdo/validation/problems/impl/ProblemsPackageImpl.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems/src/org/eclipse/papyrus/cdo/validation/problems/impl/ProblemsPackageImpl.java index 689a07c3cc7..b8556dcecb5 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems/src/org/eclipse/papyrus/cdo/validation/problems/impl/ProblemsPackageImpl.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems/src/org/eclipse/papyrus/cdo/validation/problems/impl/ProblemsPackageImpl.java @@ -1,6 +1,6 @@ /** * 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 @@ -33,18 +33,21 @@ import org.eclipse.papyrus.cdo.validation.problems.ProblemsPackage; /** * <!-- begin-user-doc --> An implementation of the model <b>Package</b>. <!-- * end-user-doc --> + * * @generated */ public class ProblemsPackageImpl extends EPackageImpl implements ProblemsPackage { /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ private EClass eProblemEClass = null; /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ private EClass eProblemsContainerEClass = null; @@ -52,38 +55,38 @@ public class ProblemsPackageImpl extends EPackageImpl implements ProblemsPackage /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ private EClass attributeEClass = null; /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ private EEnum eSeverityEEnum = null; /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ private EDataType eDiagnosticEDataType = null; /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ private EDataType eIteratorEDataType = null; /** - * Creates an instance of the model <b>Package</b>, registered with - * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the + * Creates an instance of the model <b>Package</b>, registered with {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the * package package URI value. * <p> - * Note: the correct way to create the package is via the static factory - * method {@link #init init()}, which also performs initialization of the - * package, or returns the registered package, if one already exists. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * + * Note: the correct way to create the package is via the static factory method {@link #init init()}, which also performs initialization of the package, or returns the registered package, if one already exists. <!-- begin-user-doc --> <!-- end-user-doc --> + * * @see org.eclipse.emf.ecore.EPackage.Registry * @see org.eclipse.papyrus.cdo.validation.problems.ProblemsPackage#eNS_URI * @see #init() @@ -95,6 +98,7 @@ public class ProblemsPackageImpl extends EPackageImpl implements ProblemsPackage /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ private static boolean isInited = false; @@ -102,24 +106,22 @@ public class ProblemsPackageImpl extends EPackageImpl implements ProblemsPackage /** * Creates, registers, and initializes the <b>Package</b> for this model, * and for any others upon which it depends. - * + * * <p> - * This method is used to initialize {@link ProblemsPackage#eINSTANCE} when - * that field is accessed. Clients should not invoke it directly. Instead, - * they should simply access that field to obtain the package. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * + * This method is used to initialize {@link ProblemsPackage#eINSTANCE} when that field is accessed. Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. <!-- begin-user-doc --> <!-- end-user-doc --> + * * @see #eNS_URI * @see #createPackageContents() * @see #initializePackageContents() * @generated */ public static ProblemsPackage init() { - if(isInited) - return (ProblemsPackage)EPackage.Registry.INSTANCE.getEPackage(ProblemsPackage.eNS_URI); + if (isInited) { + return (ProblemsPackage) EPackage.Registry.INSTANCE.getEPackage(ProblemsPackage.eNS_URI); + } // Obtain or create and register package - ProblemsPackageImpl theProblemsPackage = (ProblemsPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof ProblemsPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new ProblemsPackageImpl()); + ProblemsPackageImpl theProblemsPackage = (ProblemsPackageImpl) (EPackage.Registry.INSTANCE.get(eNS_URI) instanceof ProblemsPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new ProblemsPackageImpl()); isInited = true; @@ -140,170 +142,212 @@ public class ProblemsPackageImpl extends EPackageImpl implements ProblemsPackage /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ + @Override public EClass getEProblem() { return eProblemEClass; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ + @Override public EAttribute getEProblem_Severity() { - return (EAttribute)eProblemEClass.getEStructuralFeatures().get(0); + return (EAttribute) eProblemEClass.getEStructuralFeatures().get(0); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ + @Override public EAttribute getEProblem_Message() { - return (EAttribute)eProblemEClass.getEStructuralFeatures().get(1); + return (EAttribute) eProblemEClass.getEStructuralFeatures().get(1); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ + @Override public EAttribute getEProblem_Source() { - return (EAttribute)eProblemEClass.getEStructuralFeatures().get(2); + return (EAttribute) eProblemEClass.getEStructuralFeatures().get(2); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ + @Override public EAttribute getEProblem_Code() { - return (EAttribute)eProblemEClass.getEStructuralFeatures().get(3); + return (EAttribute) eProblemEClass.getEStructuralFeatures().get(3); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ + @Override public EReference getEProblem_Element() { - return (EReference)eProblemEClass.getEStructuralFeatures().get(4); + return (EReference) eProblemEClass.getEStructuralFeatures().get(4); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ + @Override public EReference getEProblem_Related() { - return (EReference)eProblemEClass.getEStructuralFeatures().get(5); + return (EReference) eProblemEClass.getEStructuralFeatures().get(5); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ + @Override public EReference getEProblem_Container() { - return (EReference)eProblemEClass.getEStructuralFeatures().get(6); + return (EReference) eProblemEClass.getEStructuralFeatures().get(6); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ + @Override public EAttribute getEProblem_Type() { - return (EAttribute)eProblemEClass.getEStructuralFeatures().get(7); + return (EAttribute) eProblemEClass.getEStructuralFeatures().get(7); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ + @Override public EReference getEProblem_Attributes() { - return (EReference)eProblemEClass.getEStructuralFeatures().get(8); + return (EReference) eProblemEClass.getEStructuralFeatures().get(8); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ + @Override public EOperation getEProblem__ToDiagnostic() { return eProblemEClass.getEOperations().get(0); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ + @Override public EClass getEProblemsContainer() { return eProblemsContainerEClass; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ + @Override public EReference getEProblemsContainer_Problems() { - return (EReference)eProblemsContainerEClass.getEStructuralFeatures().get(0); + return (EReference) eProblemsContainerEClass.getEStructuralFeatures().get(0); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ + @Override public EReference getEProblemsContainer_Subjects() { - return (EReference)eProblemsContainerEClass.getEStructuralFeatures().get(1); + return (EReference) eProblemsContainerEClass.getEStructuralFeatures().get(1); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ + @Override public EReference getEProblemsContainer_Subcontainers() { - return (EReference)eProblemsContainerEClass.getEStructuralFeatures().get(2); + return (EReference) eProblemsContainerEClass.getEStructuralFeatures().get(2); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ + @Override public EReference getEProblemsContainer_Container() { - return (EReference)eProblemsContainerEClass.getEStructuralFeatures().get(3); + return (EReference) eProblemsContainerEClass.getEStructuralFeatures().get(3); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ + @Override public EOperation getEProblemsContainer__AllProblems() { return eProblemsContainerEClass.getEOperations().get(0); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ + @Override public EOperation getEProblemsContainer__AllProblems__EObject() { return eProblemsContainerEClass.getEOperations().get(1); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ + @Override public EOperation getEProblemsContainer__AllDiagnostics() { return eProblemsContainerEClass.getEOperations().get(2); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ + @Override public EOperation getEProblemsContainer__AllDiagnostics__EObject() { return eProblemsContainerEClass.getEOperations().get(3); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ + @Override public EOperation getEProblemsContainer__GetWorstProblem__EObject() { return eProblemsContainerEClass.getEOperations().get(4); } @@ -311,8 +355,10 @@ public class ProblemsPackageImpl extends EPackageImpl implements ProblemsPackage /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ + @Override public EClass getAttribute() { return attributeEClass; } @@ -320,69 +366,84 @@ public class ProblemsPackageImpl extends EPackageImpl implements ProblemsPackage /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ + @Override public EAttribute getAttribute_Key() { - return (EAttribute)attributeEClass.getEStructuralFeatures().get(0); + return (EAttribute) attributeEClass.getEStructuralFeatures().get(0); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ + @Override public EAttribute getAttribute_Value() { - return (EAttribute)attributeEClass.getEStructuralFeatures().get(1); + return (EAttribute) attributeEClass.getEStructuralFeatures().get(1); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ + @Override public EEnum getESeverity() { return eSeverityEEnum; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ + @Override public EDataType getEDiagnostic() { return eDiagnosticEDataType; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ + @Override public EDataType getEIterator() { return eIteratorEDataType; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ + @Override public ProblemsFactory getProblemsFactory() { - return (ProblemsFactory)getEFactoryInstance(); + return (ProblemsFactory) getEFactoryInstance(); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ private boolean isCreated = false; /** - * Creates the meta-model objects for the package. This method is + * Creates the meta-model objects for the package. This method is * guarded to have no affect on any invocation but its first. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ public void createPackageContents() { - if(isCreated) + if (isCreated) { return; + } isCreated = true; // Create classes and their features @@ -423,6 +484,7 @@ public class ProblemsPackageImpl extends EPackageImpl implements ProblemsPackage /** * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ private boolean isInitialized = false; @@ -431,12 +493,13 @@ public class ProblemsPackageImpl extends EPackageImpl implements ProblemsPackage * Complete the initialization of the package and its meta-model. This * method is guarded to have no affect on any invocation but its first. <!-- * begin-user-doc --> <!-- end-user-doc --> - * + * * @generated */ public void initializePackageContents() { - if(isInitialized) + if (isInitialized) { return; + } isInitialized = true; // Initialize package @@ -459,17 +522,22 @@ public class ProblemsPackageImpl extends EPackageImpl implements ProblemsPackage initEAttribute(getEProblem_Code(), ecorePackage.getEInt(), "code", null, 0, 1, EProblem.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ initEReference(getEProblem_Element(), ecorePackage.getEObject(), null, "element", null, 1, 1, EProblem.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ initEReference(getEProblem_Related(), ecorePackage.getEObject(), null, "related", null, 0, -1, EProblem.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEReference(getEProblem_Container(), this.getEProblemsContainer(), this.getEProblemsContainer_Problems(), "container", null, 0, 1, EProblem.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + initEReference(getEProblem_Container(), this.getEProblemsContainer(), this.getEProblemsContainer_Problems(), + "container", null, 0, 1, EProblem.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ initEAttribute(getEProblem_Type(), ecorePackage.getEString(), "type", "org.eclipse.emf.ecore.diagnostic", 0, 1, EProblem.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ //$NON-NLS-2$ initEReference(getEProblem_Attributes(), this.getAttribute(), null, "attributes", null, 0, -1, EProblem.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ initEOperation(getEProblem__ToDiagnostic(), this.getEDiagnostic(), "toDiagnostic", 1, 1, IS_UNIQUE, IS_ORDERED); //$NON-NLS-1$ initEClass(eProblemsContainerEClass, EProblemsContainer.class, "EProblemsContainer", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEReference(getEProblemsContainer_Problems(), this.getEProblem(), this.getEProblem_Container(), "problems", null, 0, -1, EProblemsContainer.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEReference(getEProblemsContainer_Subjects(), ecorePackage.getEObject(), null, "subjects", null, 0, -1, EProblemsContainer.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEReference(getEProblemsContainer_Subcontainers(), this.getEProblemsContainer(), this.getEProblemsContainer_Container(), "subcontainers", null, 0, -1, EProblemsContainer.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEReference(getEProblemsContainer_Container(), this.getEProblemsContainer(), this.getEProblemsContainer_Subcontainers(), "container", null, 0, 1, EProblemsContainer.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + initEReference(getEProblemsContainer_Problems(), this.getEProblem(), this.getEProblem_Container(), + "problems", null, 0, -1, EProblemsContainer.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + initEReference(getEProblemsContainer_Subjects(), ecorePackage.getEObject(), null, + "subjects", null, 0, -1, EProblemsContainer.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + initEReference(getEProblemsContainer_Subcontainers(), this.getEProblemsContainer(), this.getEProblemsContainer_Container(), + "subcontainers", null, 0, -1, EProblemsContainer.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + initEReference(getEProblemsContainer_Container(), this.getEProblemsContainer(), this.getEProblemsContainer_Subcontainers(), + "container", null, 0, 1, EProblemsContainer.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ EOperation op = initEOperation(getEProblemsContainer__AllProblems(), null, "allProblems", 1, 1, IS_UNIQUE, IS_ORDERED); //$NON-NLS-1$ EGenericType g1 = createEGenericType(this.getEIterator()); diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems/src/org/eclipse/papyrus/cdo/validation/problems/internal/ProblemsPlugin.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems/src/org/eclipse/papyrus/cdo/validation/problems/internal/ProblemsPlugin.java index 9eb88ced11a..d368d45b240 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems/src/org/eclipse/papyrus/cdo/validation/problems/internal/ProblemsPlugin.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems/src/org/eclipse/papyrus/cdo/validation/problems/internal/ProblemsPlugin.java @@ -1,11 +1,11 @@ /** * 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 */ @@ -19,6 +19,7 @@ import org.eclipse.emf.common.util.ResourceLocator; * This is the central singleton for the Problems model plugin. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ public final class ProblemsPlugin extends EMFPlugin { @@ -27,6 +28,7 @@ public final class ProblemsPlugin extends EMFPlugin { * Keep track of the singleton. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ public static final ProblemsPlugin INSTANCE = new ProblemsPlugin(); @@ -35,6 +37,7 @@ public final class ProblemsPlugin extends EMFPlugin { * Keep track of the singleton. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ private static Implementation plugin; @@ -43,16 +46,18 @@ public final class ProblemsPlugin extends EMFPlugin { * Create the instance. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ public ProblemsPlugin() { - super(new ResourceLocator[]{}); + super(new ResourceLocator[] {}); } /** * Returns the singleton instance of the Eclipse plugin. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @return the singleton instance. * @generated */ @@ -65,6 +70,7 @@ public final class ProblemsPlugin extends EMFPlugin { * Returns the singleton instance of the Eclipse plugin. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @return the singleton instance. * @generated */ @@ -76,6 +82,7 @@ public final class ProblemsPlugin extends EMFPlugin { * The actual implementation of the Eclipse <b>Plugin</b>. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ public static class Implementation extends EclipsePlugin { @@ -84,6 +91,7 @@ public final class ProblemsPlugin extends EMFPlugin { * Creates an instance. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ public Implementation() { diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems/src/org/eclipse/papyrus/cdo/validation/problems/util/ProblemsAdapterFactory.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems/src/org/eclipse/papyrus/cdo/validation/problems/util/ProblemsAdapterFactory.java index 13feafe3730..7e7fd10dbdd 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems/src/org/eclipse/papyrus/cdo/validation/problems/util/ProblemsAdapterFactory.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems/src/org/eclipse/papyrus/cdo/validation/problems/util/ProblemsAdapterFactory.java @@ -1,6 +1,6 @@ /** * 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 @@ -24,6 +24,7 @@ import org.eclipse.papyrus.cdo.validation.problems.ProblemsPackage; * <!-- begin-user-doc --> The <b>Adapter Factory</b> for the model. It provides * an adapter <code>createXXX</code> method for each class of the model. <!-- * end-user-doc --> + * * @see org.eclipse.papyrus.cdo.validation.problems.ProblemsPackage * @generated */ @@ -32,6 +33,7 @@ public class ProblemsAdapterFactory extends AdapterFactoryImpl { /** * The cached model package. * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ protected static ProblemsPackage modelPackage; @@ -40,10 +42,11 @@ public class ProblemsAdapterFactory extends AdapterFactoryImpl { * Creates an instance of the adapter factory. * <!-- begin-user-doc --> <!-- * end-user-doc --> + * * @generated */ public ProblemsAdapterFactory() { - if(modelPackage == null) { + if (modelPackage == null) { modelPackage = ProblemsPackage.eINSTANCE; } } @@ -53,16 +56,17 @@ public class ProblemsAdapterFactory extends AdapterFactoryImpl { * <!-- begin-user-doc --> This implementation returns <code>true</code> if * the object is either the model's package or is an instance object of the * model. <!-- end-user-doc --> + * * @return whether this factory is applicable for the type of the object. * @generated */ @Override public boolean isFactoryForType(Object object) { - if(object == modelPackage) { + if (object == modelPackage) { return true; } - if(object instanceof EObject) { - return ((EObject)object).eClass().getEPackage() == modelPackage; + if (object instanceof EObject) { + return ((EObject) object).eClass().getEPackage() == modelPackage; } return false; } @@ -70,7 +74,7 @@ public class ProblemsAdapterFactory extends AdapterFactoryImpl { /** * The switch that delegates to the <code>createXXX</code> methods. <!-- * begin-user-doc --> <!-- end-user-doc --> - * + * * @generated */ protected ProblemsSwitch<Adapter> modelSwitch = new ProblemsSwitch<Adapter>() { @@ -100,23 +104,24 @@ public class ProblemsAdapterFactory extends AdapterFactoryImpl { * Creates an adapter for the <code>target</code>. * <!-- begin-user-doc --> * <!-- end-user-doc --> - * @param target the object to adapt. + * + * @param target + * the object to adapt. * @return the adapter for the <code>target</code>. * @generated */ @Override public Adapter createAdapter(Notifier target) { - return modelSwitch.doSwitch((EObject)target); + return modelSwitch.doSwitch((EObject) target); } /** - * Creates a new adapter for an object of class ' - * {@link org.eclipse.papyrus.cdo.validation.problems.EProblem + * Creates a new adapter for an object of class ' {@link org.eclipse.papyrus.cdo.validation.problems.EProblem * <em>EProblem</em>}'. <!-- begin-user-doc --> This default implementation * returns null so that we can easily ignore cases; it's useful to ignore a * case when inheritance will catch all the cases anyway. <!-- end-user-doc * --> - * + * * @return the new adapter. * @see org.eclipse.papyrus.cdo.validation.problems.EProblem * @generated @@ -131,6 +136,7 @@ public class ProblemsAdapterFactory extends AdapterFactoryImpl { * implementation returns null so that we can easily ignore cases; it's * useful to ignore a case when inheritance will catch all the cases anyway. * <!-- end-user-doc --> + * * @return the new adapter. * @see org.eclipse.papyrus.cdo.validation.problems.EProblemsContainer * @generated @@ -145,6 +151,7 @@ public class ProblemsAdapterFactory extends AdapterFactoryImpl { * This default implementation returns null so that we can easily ignore cases; * it's useful to ignore a case when inheritance will catch all the cases anyway. * <!-- end-user-doc --> + * * @return the new adapter. * @see java.util.Map.Entry * @generated @@ -157,6 +164,7 @@ public class ProblemsAdapterFactory extends AdapterFactoryImpl { * Creates a new adapter for the default case. * <!-- begin-user-doc --> This * default implementation returns null. <!-- end-user-doc --> + * * @return the new adapter. * @generated */ diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems/src/org/eclipse/papyrus/cdo/validation/problems/util/ProblemsEvent.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems/src/org/eclipse/papyrus/cdo/validation/problems/util/ProblemsEvent.java index 63f52b8c189..2974f9eb5ac 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems/src/org/eclipse/papyrus/cdo/validation/problems/util/ProblemsEvent.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems/src/org/eclipse/papyrus/cdo/validation/problems/util/ProblemsEvent.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -38,6 +38,7 @@ public class ProblemsEvent this.problem = problem; } + @Override public ProblemsManager getSource() { return (ProblemsManager) super.getSource(); } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems/src/org/eclipse/papyrus/cdo/validation/problems/util/ProblemsListener.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems/src/org/eclipse/papyrus/cdo/validation/problems/util/ProblemsListener.java index b1f4ec189d6..fb62f167aa4 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems/src/org/eclipse/papyrus/cdo/validation/problems/util/ProblemsListener.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems/src/org/eclipse/papyrus/cdo/validation/problems/util/ProblemsListener.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems/src/org/eclipse/papyrus/cdo/validation/problems/util/ProblemsManager.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems/src/org/eclipse/papyrus/cdo/validation/problems/util/ProblemsManager.java index 2284f5fc853..20943e17397 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems/src/org/eclipse/papyrus/cdo/validation/problems/util/ProblemsManager.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems/src/org/eclipse/papyrus/cdo/validation/problems/util/ProblemsManager.java @@ -1,6 +1,6 @@ /***************************************************************************** * 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 @@ -58,12 +58,12 @@ public class ProblemsManager { ProblemsManager(Notifier notifier) { adapter = new ManagerAdapter(); notifier.eAdapters().add(adapter); - ((EObservableAdapterList)notifier.eAdapters()).addListener(adapter); + ((EObservableAdapterList) notifier.eAdapters()).addListener(adapter); xrefs = ECrossReferenceAdapter.getCrossReferenceAdapter(notifier); problems = ProblemsFactory.eINSTANCE.createEProblemsContainer(); - if(xrefs != null) { + if (xrefs != null) { problems.eAdapters().add(xrefs); } @@ -74,23 +74,23 @@ public class ProblemsManager { /** * Gets the problems manager associated with the specified {@code resourceSet}. If none has been created yet, then it is created and * associated on demand. - * + * * @param resourceSet - * a resource set - * + * a resource set + * * @return the {@code resourceSet}'s problems manager (never {@code null}) */ public static ProblemsManager getProblemsManager(ResourceSet resourceSet) { ProblemsManager result = null; - for(Adapter next : resourceSet.eAdapters()) { - if(next instanceof ManagerAdapter) { - result = ((ManagerAdapter)next).getManager(); + for (Adapter next : resourceSet.eAdapters()) { + if (next instanceof ManagerAdapter) { + result = ((ManagerAdapter) next).getManager(); break; } } - if(result == null) { + if (result == null) { result = new ProblemsManager(resourceSet); } @@ -100,17 +100,17 @@ public class ProblemsManager { /** * Creates a new problems manager on a custom problem class and associates * it with the specified {@code resourceSet}. - * + * * @param resourceSet - * a resource set + * a resource set * @param customProblemClass - * an {@link EClass} conforming to <tt>EProblem</tt> to create - * instead of the default <tt>EProblem</tt> type - * + * an {@link EClass} conforming to <tt>EProblem</tt> to create + * instead of the default <tt>EProblem</tt> type + * * @return the new problems manager */ public static ProblemsManager createProblemsManager(ResourceSet resourceSet, EClass customProblemClass) { - if(customProblemClass == null) { + if (customProblemClass == null) { throw new IllegalArgumentException("null customProblemClass"); //$NON-NLS-1$ } @@ -130,17 +130,17 @@ public class ProblemsManager { EObject element = null; Iterator<?> data = diagnostic.getData().iterator(); - while(data.hasNext()) { + while (data.hasNext()) { Object next = data.next(); // CDOResources are EObjects - if((next instanceof EObject) && !(next instanceof Resource)) { - element = (EObject)next; + if ((next instanceof EObject) && !(next instanceof Resource)) { + element = (EObject) next; break; } } - if(element == null) { + if (element == null) { // can't create a problem without the element to attach it to result = null; } else { @@ -151,17 +151,17 @@ public class ProblemsManager { result.setCode(diagnostic.getCode()); result.setMessage(diagnostic.getMessage()); - if(type != null) { + if (type != null) { result.setType(type); } result.setElement(element); - while(data.hasNext()) { + while (data.hasNext()) { Object next = data.next(); // CDOResources are EObjects - if((next instanceof EObject) && !(next instanceof Resource)) { - result.getRelated().add((EObject)next); + if ((next instanceof EObject) && !(next instanceof Resource)) { + result.getRelated().add((EObject) next); } } } @@ -179,21 +179,21 @@ public class ProblemsManager { /** * Obtains all of the problems tracked by this problems manager for the * specified {@code eObject}. - * + * * @param eObject - * an object in the resource set scope for which I track problems + * an object in the resource set scope for which I track problems */ public Iterator<EProblem> getAllProblems(EObject eObject) { Iterator<EProblem> result; - if(xrefs == null) { + if (xrefs == null) { result = problems.allProblems(eObject); } else { result = new EProblemsIterator<EStructuralFeature.Setting>(xrefs.getNonNavigableInverseReferences(eObject).iterator()) { @Override protected EProblem convert(EStructuralFeature.Setting object) { - return object.getEStructuralFeature() == ProblemsPackage.Literals.EPROBLEM__ELEMENT ? (EProblem)object.getEObject() : null; + return object.getEStructuralFeature() == ProblemsPackage.Literals.EPROBLEM__ELEMENT ? (EProblem) object.getEObject() : null; } }; } @@ -204,15 +204,15 @@ public class ProblemsManager { /** * Obtains all of the problems tracked by this problems manager for the * objects in the specified {@code resource}. - * + * * @param resource - * an resource in the resource set scope for which I track - * problems + * an resource in the resource set scope for which I track + * problems */ public Iterator<EProblem> getAllProblems(final Resource resource) { Iterator<EProblem> result; - if(xrefs == null) { + if (xrefs == null) { // more efficient to iterate all problems and filter for those whose // element is in the resource than to repeat iteration over the // problems for each object in the resource @@ -222,11 +222,12 @@ public class ProblemsManager { private EProblem next; + @Override public boolean hasNext() { - if(next == null) { - while(all.hasNext()) { + if (next == null) { + while (all.hasNext()) { EProblem couldBe = all.next(); - if(couldBe.getElement().eResource() == resource) { + if (couldBe.getElement().eResource() == resource) { next = couldBe; break; } @@ -236,8 +237,9 @@ public class ProblemsManager { return next != null; } + @Override public EProblem next() { - if(!hasNext()) { + if (!hasNext()) { throw new NoSuchElementException(); } @@ -246,6 +248,7 @@ public class ProblemsManager { return result; } + @Override public void remove() { throw new UnsupportedOperationException("remove"); //$NON-NLS-1$ } @@ -259,22 +262,25 @@ public class ProblemsManager { private Iterator<EProblem> iterator = Collections.<EProblem> emptyList().iterator(); + @Override public boolean hasNext() { - while(!iterator.hasNext() && objects.hasNext()) { + while (!iterator.hasNext() && objects.hasNext()) { iterator = getAllProblems(objects.next()); } return iterator.hasNext(); } + @Override public EProblem next() { - if(!hasNext()) { + if (!hasNext()) { throw new NoSuchElementException(); } return iterator.next(); } + @Override public void remove() { throw new UnsupportedOperationException("remove"); //$NON-NLS-1$ } @@ -295,10 +301,10 @@ public class ProblemsManager { public boolean addDiagnostic(Diagnostic diagnostic, String type) { boolean result; - if(!diagnostic.getChildren().isEmpty()) { + if (!diagnostic.getChildren().isEmpty()) { // add the children result = false; - for(Diagnostic next : diagnostic.getChildren()) { + for (Diagnostic next : diagnostic.getChildren()) { result = addDiagnostic(next, type) || result; } } else { @@ -315,7 +321,7 @@ public class ProblemsManager { @SuppressWarnings("unchecked") public void purgeProblems(Collection<? extends EObject> objects) { - purgeProblems((Iterator<? extends EObject>)EcoreUtil.getAllContents(objects)); + purgeProblems((Iterator<? extends EObject>) EcoreUtil.getAllContents(objects)); } public void purgeProblems(Resource resource) { @@ -323,7 +329,7 @@ public class ProblemsManager { } public void purgeAllProblems() { - for(EProblem next : problems.getProblems()) { + for (EProblem next : problems.getProblems()) { next.eAdapters().clear(); } problems.getProblems().clear(); @@ -335,9 +341,9 @@ public class ProblemsManager { * longer be used. */ public void dispose() { - if(problems != null) { + if (problems != null) { problems.eAdapters().clear(); - for(Iterator<EObject> iter = problems.eAllContents(); iter.hasNext();) { + for (Iterator<EObject> iter = problems.eAllContents(); iter.hasNext();) { iter.next().eAdapters().clear(); } @@ -345,7 +351,7 @@ public class ProblemsManager { } Notifier target = adapter.getTarget(); - if(target != null) { + if (target != null) { target.eAdapters().remove(adapter); } @@ -357,14 +363,14 @@ public class ProblemsManager { } void setCrossReferenceAdapter(ECrossReferenceAdapter adapter) { - if(adapter != xrefs) { - if(xrefs != null && problems != null) { + if (adapter != xrefs) { + if (xrefs != null && problems != null) { problems.eAdapters().remove(xrefs); } xrefs = adapter; - if(adapter != null && problems != null) { + if (adapter != null && problems != null) { problems.eAdapters().add(adapter); } } @@ -373,14 +379,14 @@ public class ProblemsManager { private void purgeProblems(Iterator<? extends EObject> contents) { List<EProblem> toRemove = new java.util.ArrayList<EProblem>(); - while(contents.hasNext()) { + while (contents.hasNext()) { Iterator<EProblem> problems = getAllProblems(contents.next()); - while(problems.hasNext()) { + while (problems.hasNext()) { toRemove.add(problems.next()); } } - for(EProblem next : toRemove) { + for (EProblem next : toRemove) { next.eAdapters().clear(); } problems.getProblems().removeAll(toRemove); @@ -401,9 +407,9 @@ public class ProblemsManager { } protected void fireAdded(EProblem problem) { - if(!listeners.isEmpty()) { + if (!listeners.isEmpty()) { ProblemsEvent event = new ProblemsEvent(this, ProblemsEvent.ADDED, problem); - for(ProblemsListener next : listeners) { + for (ProblemsListener next : listeners) { try { next.problemAdded(event); } catch (Exception e) { @@ -414,9 +420,9 @@ public class ProblemsManager { } protected void fireRemoved(EProblem problem) { - if(!listeners.isEmpty()) { + if (!listeners.isEmpty()) { ProblemsEvent event = new ProblemsEvent(this, ProblemsEvent.REMOVED, problem); - for(ProblemsListener next : listeners) { + for (ProblemsListener next : listeners) { try { next.problemRemoved(event); } catch (Exception e) { @@ -437,7 +443,7 @@ public class ProblemsManager { public Custom(Notifier notifier, EClass customProblemClass) { super(notifier); - if(!ProblemsPackage.Literals.EPROBLEM.isSuperTypeOf(customProblemClass)) { + if (!ProblemsPackage.Literals.EPROBLEM.isSuperTypeOf(customProblemClass)) { throw new IllegalArgumentException("customProblemClass does not conform to EProblem"); //$NON-NLS-1$ } @@ -446,7 +452,7 @@ public class ProblemsManager { @Override protected EProblem createProblem() { - return (EProblem)EcoreUtil.create(customProblemClass); + return (EProblem) EcoreUtil.create(customProblemClass); } } @@ -460,20 +466,22 @@ public class ProblemsManager { public void setTarget(Notifier newTarget) { super.setTarget(newTarget); - if(newTarget == null) { + if (newTarget == null) { // we've been unloaded. Unload the problems model dispose(); } } + @Override public void added(Notifier notifier, Adapter adapter) { - if(adapter instanceof ECrossReferenceAdapter) { - setCrossReferenceAdapter((ECrossReferenceAdapter)adapter); + if (adapter instanceof ECrossReferenceAdapter) { + setCrossReferenceAdapter((ECrossReferenceAdapter) adapter); } } + @Override public void removed(Notifier notifier, Adapter adapter) { - if(adapter instanceof ECrossReferenceAdapter) { + if (adapter instanceof ECrossReferenceAdapter) { setCrossReferenceAdapter(null); } } @@ -483,22 +491,22 @@ public class ProblemsManager { @Override public void notifyChanged(Notification msg) { - if(msg.getFeature() == ProblemsPackage.Literals.EPROBLEMS_CONTAINER__PROBLEMS) { - switch(msg.getEventType()) { + if (msg.getFeature() == ProblemsPackage.Literals.EPROBLEMS_CONTAINER__PROBLEMS) { + switch (msg.getEventType()) { case Notification.ADD: - fireAdded((EProblem)msg.getNewValue()); + fireAdded((EProblem) msg.getNewValue()); break; case Notification.ADD_MANY: - for(Object next : (Collection<?>)msg.getNewValue()) { - fireAdded((EProblem)next); + for (Object next : (Collection<?>) msg.getNewValue()) { + fireAdded((EProblem) next); } break; case Notification.REMOVE: - fireRemoved((EProblem)msg.getOldValue()); + fireRemoved((EProblem) msg.getOldValue()); break; case Notification.REMOVE_MANY: - for(Object next : (Collection<?>)msg.getOldValue()) { - fireRemoved((EProblem)next); + for (Object next : (Collection<?>) msg.getOldValue()) { + fireRemoved((EProblem) next); } break; } @@ -516,11 +524,12 @@ public class ProblemsManager { this.delegate = delegate; } + @Override public boolean hasNext() { - if(preparedNext == null) { - while(delegate.hasNext()) { + if (preparedNext == null) { + while (delegate.hasNext()) { EProblem problem = convert(delegate.next()); - if(problem != null) { + if (problem != null) { preparedNext = problem; break; } @@ -532,8 +541,9 @@ public class ProblemsManager { protected abstract EProblem convert(E object); + @Override public EProblem next() { - if(!hasNext()) { + if (!hasNext()) { throw new NoSuchElementException(); } @@ -542,6 +552,7 @@ public class ProblemsManager { return result; } + @Override public void remove() { throw new UnsupportedOperationException("remove"); //$NON-NLS-1$ } @@ -557,38 +568,47 @@ public class ProblemsManager { this.problem = problem; } + @Override public IStatus[] getChildren() { return NO_STATUSES; } + @Override public int getCode() { return problem.getCode(); } + @Override public Throwable getException() { return null; } + @Override public String getMessage() { return problem.getMessage(); } + @Override public String getPlugin() { return problem.getSource(); } + @Override public int getSeverity() { return problem.getSeverity().getValue(); } + @Override public boolean isMultiStatus() { return false; } + @Override public boolean isOK() { return getSeverity() == IStatus.OK; } + @Override public boolean matches(int severityMask) { return (getSeverity() & severityMask) != 0; } diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems/src/org/eclipse/papyrus/cdo/validation/problems/util/ProblemsSwitch.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems/src/org/eclipse/papyrus/cdo/validation/problems/util/ProblemsSwitch.java index 3ab735cf8e3..1cea4eaf031 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems/src/org/eclipse/papyrus/cdo/validation/problems/util/ProblemsSwitch.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems/src/org/eclipse/papyrus/cdo/validation/problems/util/ProblemsSwitch.java @@ -1,6 +1,6 @@ /** * 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 @@ -21,11 +21,11 @@ import org.eclipse.papyrus.cdo.validation.problems.ProblemsPackage; /** * <!-- begin-user-doc --> The <b>Switch</b> for the model's inheritance - * hierarchy. It supports the call {@link #doSwitch(EObject) doSwitch(object)} - * to invoke the <code>caseXXX</code> method for each class of the model, + * hierarchy. It supports the call {@link #doSwitch(EObject) doSwitch(object)} to invoke the <code>caseXXX</code> method for each class of the model, * starting with the actual class of the object and proceeding up the * inheritance hierarchy until a non-null result is returned, which is the * result of the switch. <!-- end-user-doc --> + * * @see org.eclipse.papyrus.cdo.validation.problems.ProblemsPackage * @generated */ @@ -34,6 +34,7 @@ public class ProblemsSwitch<T> extends Switch<T> { /** * The cached model package * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ protected static ProblemsPackage modelPackage; @@ -42,10 +43,11 @@ public class ProblemsSwitch<T> extends Switch<T> { * Creates an instance of the switch. * <!-- begin-user-doc --> <!-- * end-user-doc --> + * * @generated */ public ProblemsSwitch() { - if(modelPackage == null) { + if (modelPackage == null) { modelPackage = ProblemsPackage.eINSTANCE; } } @@ -53,7 +55,7 @@ public class ProblemsSwitch<T> extends Switch<T> { /** * Checks whether this is a switch for the given package. <!-- * begin-user-doc --> <!-- end-user-doc --> - * + * * @parameter ePackage the package in question. * @return whether this is a switch for the given package. * @generated @@ -67,35 +69,36 @@ public class ProblemsSwitch<T> extends Switch<T> { * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. * <!-- begin-user-doc --> <!-- * end-user-doc --> + * * @return the first non-null result returned by a <code>caseXXX</code> call. * @generated */ @Override protected T doSwitch(int classifierID, EObject theEObject) { - switch(classifierID) { - case ProblemsPackage.EPROBLEM: - { - EProblem eProblem = (EProblem)theEObject; + switch (classifierID) { + case ProblemsPackage.EPROBLEM: { + EProblem eProblem = (EProblem) theEObject; T result = caseEProblem(eProblem); - if(result == null) + if (result == null) { result = defaultCase(theEObject); + } return result; } - case ProblemsPackage.EPROBLEMS_CONTAINER: - { - EProblemsContainer eProblemsContainer = (EProblemsContainer)theEObject; + case ProblemsPackage.EPROBLEMS_CONTAINER: { + EProblemsContainer eProblemsContainer = (EProblemsContainer) theEObject; T result = caseEProblemsContainer(eProblemsContainer); - if(result == null) + if (result == null) { result = defaultCase(theEObject); + } return result; } - case ProblemsPackage.ATTRIBUTE: - { + case ProblemsPackage.ATTRIBUTE: { @SuppressWarnings("unchecked") - Map.Entry<String, String> attribute = (Map.Entry<String, String>)theEObject; + Map.Entry<String, String> attribute = (Map.Entry<String, String>) theEObject; T result = caseAttribute(attribute); - if(result == null) + if (result == null) { result = defaultCase(theEObject); + } return result; } default: @@ -108,7 +111,9 @@ public class ProblemsSwitch<T> extends Switch<T> { * <!-- begin-user-doc --> This implementation returns * null; returning a non-null result will terminate the switch. <!-- * end-user-doc --> - * @param object the target of the switch. + * + * @param object + * the target of the switch. * @return the result of interpreting the object as an instance of '<em>EProblem</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated @@ -122,7 +127,9 @@ public class ProblemsSwitch<T> extends Switch<T> { * <!-- begin-user-doc --> This * implementation returns null; returning a non-null result will terminate * the switch. <!-- end-user-doc --> - * @param object the target of the switch. + * + * @param object + * the target of the switch. * @return the result of interpreting the object as an instance of '<em>EProblems Container</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated @@ -137,7 +144,9 @@ public class ProblemsSwitch<T> extends Switch<T> { * This implementation returns null; * returning a non-null result will terminate the switch. * <!-- end-user-doc --> - * @param object the target of the switch. + * + * @param object + * the target of the switch. * @return the result of interpreting the object as an instance of '<em>Attribute</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated @@ -151,7 +160,9 @@ public class ProblemsSwitch<T> extends Switch<T> { * <!-- begin-user-doc --> This implementation returns * null; returning a non-null result will terminate the switch, but this is * the last case anyway. <!-- end-user-doc --> - * @param object the target of the switch. + * + * @param object + * the target of the switch. * @return the result of interpreting the object as an instance of '<em>EObject</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) * @generated |