IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Eclipse Platform Discussion :

Création plugin Java


Sujet :

Eclipse Platform

  1. #1
    Membre à l'essai
    Homme Profil pro
    Étudiant
    Inscrit en
    Février 2015
    Messages
    25
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Turquie

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Février 2015
    Messages : 25
    Points : 24
    Points
    24
    Par défaut Création plugin Java
    Bonjour,

    J'ai développé une transformation ATL sous Eclipse et j'aimerais bien transformer cette transformation en un plugin java sous Eclipse.

    Quelqu'un saurait-il m'indiquer comment faire ?

    Merci d'avance votre aide.

  2. #2
    Modérateur
    Avatar de joel.drigo
    Homme Profil pro
    Ingénieur R&D - Développeur Java
    Inscrit en
    Septembre 2009
    Messages
    12 430
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 54
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Ingénieur R&D - Développeur Java
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Septembre 2009
    Messages : 12 430
    Points : 29 131
    Points
    29 131
    Billets dans le blog
    2
    Par défaut
    Salut,

    le tutoriel de base pour commencer.
    L'expression "ça marche pas" ne veut rien dire. Indiquez l'erreur, et/ou les comportements attendus et obtenus, et donnez un Exemple Complet Minimal qui permet de reproduire le problème.
    La plupart des réponses à vos questions sont déjà dans les FAQs ou les Tutoriels, ou peut-être dans une autre discussion : utilisez la recherche interne.
    Des questions sur Java : consultez le Forum Java. Des questions sur l'EDI Eclipse ou la plateforme Eclipse RCP : consultez le Forum Eclipse.
    Une question correctement posée et rédigée et vous aurez plus de chances de réponses adaptées et rapides.
    N'oubliez pas de mettre vos extraits de code entre balises CODE (Voir Mode d'emploi de l'éditeur de messages).
    Nouveau sur le forum ? Consultez Les Règles du Club.

  3. #3
    Membre à l'essai
    Homme Profil pro
    Étudiant
    Inscrit en
    Février 2015
    Messages
    25
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Turquie

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Février 2015
    Messages : 25
    Points : 24
    Points
    24
    Par défaut
    Merci beaucoup.

    J'ai commencé à transformer le module ATL en un plugin Eclipse mais le problème est qu'après la création du plugin, je ne sais pas comment l'exécuter.

    Voici le code du fichier .java de ce plugin:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    /*******************************************************************************
     * Copyright (c) 2010 Obeo.
     * All rights reserved. This program and 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:
     *     Obeo - initial API and implementation
     *******************************************************************************/
    package org.eclipse.m2m.atl.sample.files;
     
    import java.io.IOException;
    import java.io.InputStream;
    import java.net.URL;
    import java.util.HashMap;
    import java.util.Map;
    import java.util.Properties;
    import java.util.Map.Entry;
     
    import org.eclipse.core.runtime.FileLocator;
    import org.eclipse.core.runtime.IProgressMonitor;
    import org.eclipse.core.runtime.NullProgressMonitor;
    import org.eclipse.core.runtime.Path;
    import org.eclipse.core.runtime.Platform;
    import org.eclipse.emf.ecore.resource.Resource;
    import org.eclipse.emf.ecore.xmi.impl.EcoreResourceFactoryImpl;
    import org.eclipse.m2m.atl.common.ATLExecutionException;
    import org.eclipse.m2m.atl.core.ATLCoreException;
    import org.eclipse.m2m.atl.core.IExtractor;
    import org.eclipse.m2m.atl.core.IInjector;
    import org.eclipse.m2m.atl.core.IModel;
    import org.eclipse.m2m.atl.core.IReferenceModel;
    import org.eclipse.m2m.atl.core.ModelFactory;
    import org.eclipse.m2m.atl.core.emf.EMFExtractor;
    import org.eclipse.m2m.atl.core.emf.EMFInjector;
    import org.eclipse.m2m.atl.core.emf.EMFModelFactory;
    import org.eclipse.m2m.atl.core.launch.ILauncher;
    import org.eclipse.m2m.atl.engine.emfvm.launch.EMFVMLauncher;
     
    /**
     * Entry point of the 'GramWSDL2WSDL' transformation module.
     */
    public class GramWSDL2WSDL {
     
        /**
         * The property file. Stores module list, the metamodel and library locations.
         * @generated
         */
        private Properties properties;
     
        /**
         * The IN model.
         * @generated
         */
        protected IModel inModel;    
     
        /**
         * The OUT model.
         * @generated
         */
        protected IModel outModel;    
     
        /**
         * The main method.
         * 
         * @param args
         *            are the arguments
         * @generated
         */
        public static void main(String[] args) {
            try {
                if (args.length < 2) {
                    System.out.println("Arguments not valid : {IN_model_path, OUT_model_path}.");
                } else {
                    GramWSDL2WSDL runner = new GramWSDL2WSDL();
                    runner.loadModels(args[0]);
                    runner.doGramWSDL2WSDL(new NullProgressMonitor());
                    runner.saveModels(args[1]);
                }
            } catch (ATLCoreException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            } catch (ATLExecutionException e) {
                e.printStackTrace();
            }
        }
     
        /**
         * Constructor.
         *
         * @generated
         */
        public GramWSDL2WSDL() throws IOException {
            properties = new Properties();
            properties.load(getFileURL("GramWSDL2WSDL.properties").openStream());
            Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("ecore", new EcoreResourceFactoryImpl());
        }
     
        /**
         * Load the input and input/output models, initialize output models.
         * 
         * @param inModelPath
         *            the IN model path
         * @throws ATLCoreException
         *             if a problem occurs while loading models
         *
         * @generated
         */
        public void loadModels(String inModelPath) throws ATLCoreException {
            ModelFactory factory = new EMFModelFactory();
            IInjector injector = new EMFInjector();
            IReferenceModel mmwsdlMetamodel = factory.getMetametamodel();
            IReferenceModel wsdlgramraoudhaMetamodel = factory.getMetametamodel();
            this.inModel = factory.newModel(wsdlgramraoudhaMetamodel);
            injector.inject(inModel, inModelPath);
            this.outModel = factory.newModel(mmwsdlMetamodel);
        }
     
        /**
         * Save the output and input/output models.
         * 
         * @param outModelPath
         *            the OUT model path
         * @throws ATLCoreException
         *             if a problem occurs while saving models
         *
         * @generated
         */
        public void saveModels(String outModelPath) throws ATLCoreException {
            IExtractor extractor = new EMFExtractor();
            extractor.extract(outModel, outModelPath);
        }
     
        /**
         * Transform the models.
         * 
         * @param monitor
         *            the progress monitor
         * @throws ATLCoreException
         *             if an error occurs during models handling
         * @throws IOException
         *             if a module cannot be read
         * @throws ATLExecutionException
         *             if an error occurs during the execution
         *
         * @generated
         */
        public Object doGramWSDL2WSDL(IProgressMonitor monitor) throws ATLCoreException, IOException, ATLExecutionException {
            ILauncher launcher = new EMFVMLauncher();
            Map<String, Object> launcherOptions = getOptions();
            launcher.initialize(launcherOptions);
            launcher.addInModel(inModel, "IN", "WSDLGramRaoudha");
            launcher.addOutModel(outModel, "OUT", "MMWsdl");
            return launcher.launch("run", monitor, launcherOptions, (Object[]) getModulesList());
        }
     
        /**
         * Returns an Array of the module input streams, parameterized by the
         * property file.
         * 
         * @return an Array of the module input streams
         * @throws IOException
         *             if a module cannot be read
         *
         * @generated
         */
        protected InputStream[] getModulesList() throws IOException {
            InputStream[] modules = null;
            String modulesList = properties.getProperty("GramWSDL2WSDL.modules");
            if (modulesList != null) {
                String[] moduleNames = modulesList.split(",");
                modules = new InputStream[moduleNames.length];
                for (int i = 0; i < moduleNames.length; i++) {
                    String asmModulePath = new Path(moduleNames[i].trim()).removeFileExtension().addFileExtension("asm").toString();
                    modules[i] = getFileURL(asmModulePath).openStream();
                }
            }
            return modules;
        }
     
        /**
         * Returns the URI of the given metamodel, parameterized from the property file.
         * 
         * @param metamodelName
         *            the metamodel name
         * @return the metamodel URI
         *
         * @generated
         */
        protected String getMetamodelUri(String metamodelName) {
            return properties.getProperty("GramWSDL2WSDL.metamodels." + metamodelName);
        }
     
        /**
         * Returns the file name of the given library, parameterized from the property file.
         * 
         * @param libraryName
         *            the library name
         * @return the library file name
         *
         * @generated
         */
        protected InputStream getLibraryAsStream(String libraryName) throws IOException {
            return getFileURL(properties.getProperty("GramWSDL2WSDL.libraries." + libraryName)).openStream();
        }
     
        /**
         * Returns the options map, parameterized from the property file.
         * 
         * @return the options map
         *
         * @generated
         */
        protected Map<String, Object> getOptions() {
            Map<String, Object> options = new HashMap<String, Object>();
            for (Entry<Object, Object> entry : properties.entrySet()) {
                if (entry.getKey().toString().startsWith("GramWSDL2WSDL.options.")) {
                    options.put(entry.getKey().toString().replaceFirst("GramWSDL2WSDL.options.", ""), 
                    entry.getValue().toString());
                }
            }
            return options;
        }
     
        /**
         * Finds the file in the plug-in. Returns the file URL.
         * 
         * @param fileName
         *            the file name
         * @return the file URL
         * @throws IOException
         *             if the file doesn't exist
         * 
         * @generated
         */
        protected static URL getFileURL(String fileName) throws IOException {
            final URL fileURL;
            if (isEclipseRunning()) {
                URL resourceURL = GramWSDL2WSDL.class.getResource(fileName);
                if (resourceURL != null) {
                    fileURL = FileLocator.toFileURL(resourceURL);
                } else {
                    fileURL = null;
                }
            } else {
                fileURL = GramWSDL2WSDL.class.getResource(fileName);
            }
            if (fileURL == null) {
                throw new IOException("'" + fileName + "' not found");
            } else {
                return fileURL;
            }
        }
     
        /**
         * Tests if eclipse is running.
         * 
         * @return <code>true</code> if eclipse is running
         *
         * @generated
         */
        public static boolean isEclipseRunning() {
            try {
                return Platform.isRunning();
            } catch (Throwable exception) {
                // Assume that we aren't running.
            }
            return false;
        }
    }
    Quelqu'un saurait-il m'indiquer comment faire et comment générer ce plugin ?

    Merci d'avance pour votre aide.

Discussions similaires

  1. Création de plugins Java
    Par Rataah dans le forum Plateformes réactives et architectures modulaires
    Réponses: 6
    Dernier message: 06/09/2010, 16h13
  2. [PDE] Création plugin eclipse
    Par fremsoi dans le forum Eclipse Java
    Réponses: 2
    Dernier message: 20/03/2006, 21h23
  3. Problème de lien symbolique pour le plugin java avec firefox
    Par HNT dans le forum Applications et environnements graphiques
    Réponses: 2
    Dernier message: 18/03/2006, 19h50
  4. [Struts]Problème Création Plugin Struts
    Par DarkWark dans le forum Struts 1
    Réponses: 3
    Dernier message: 28/11/2005, 18h16
  5. [plugin][java] Execution d'un plugin
    Par relivio dans le forum Eclipse Java
    Réponses: 2
    Dernier message: 01/06/2004, 09h23

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo