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 :

Pb avec editorContribution


Sujet :

Eclipse Platform

  1. #1
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Janvier 2003
    Messages
    42
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2003
    Messages : 42
    Points : 25
    Points
    25
    Par défaut Pb avec editorContribution
    Bonjour,

    Voila, je veux mettre une simple action d'éditeur.

    Voici mon plugin.xml
    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
    <?xml version="1.0" encoding="UTF-8"?>
    <?eclipse version="3.2"?>
    <plugin>
     
       <extension
             point="org.eclipse.ui.editors">
          <editor
                class="fff.editors.XMLEditor"
                contributorClass="org.eclipse.ui.texteditor.BasicTextEditorActionContributor"
                extensions="xml"
                icon="icons/sample.gif"
                id="fff.editors.XMLEditor"
                name="Sample XML Editor new">
          </editor>
       </extension>
       <extension
             point="org.eclipse.ui.editorActions">
          <editorContribution
                id="fff.editorContribution1"
                targetID="fff.editors.XMLEditor">
             <action
                   class="fff.EditorActionDelegate1"
                   id="fff.action1"
                   label="action1"
                   />
          </editorContribution>
       </extension>
     
    </plugin>
    et ma classe :
    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
    package fff;
     
    import org.eclipse.jface.action.IAction;
    import org.eclipse.jface.dialogs.MessageDialog;
    import org.eclipse.jface.viewers.ISelection;
    import org.eclipse.ui.IEditorActionDelegate;
    import org.eclipse.ui.IEditorPart;
     
    public class EditorActionDelegate1 implements IEditorActionDelegate {
        private IEditorPart editor;
     
        /**
         * Creates a new EditorActionDelegate.
         */
        public EditorActionDelegate1() {
            // do nothing
        }
     
        /* (non-Javadoc)
         * Method declared on IActionDelegate
         */
        public void run(IAction action) {
            MessageDialog.openInformation(editor.getSite().getShell(), MessageUtil
                    .getString("Readme_Editor"), //$NON-NLS-1$
                    MessageUtil.getString(" my Editor_Action_executed")); //$NON-NLS-1$
        }
     
        /** 
         * The <code>EditorActionDelegate</code> implementation of this
         * <code>IActionDelegate</code> method does nothing.
         *
         * Selection in the desktop has changed. Plugin provider
         * can use it to change the availability of the action
         * or to modify other presentation properties.
         *
         * <p>Action delegate cannot be notified about
         * selection changes before it is loaded. For that reason,
         * control of action's enable state should also be performed
         * through simple XML rules defined for the extension
         * point. These rules allow enable state control before
         * the delegate has been loaded.</p>
         */
        public void selectionChanged(IAction action, ISelection selection) {
            // do nothing
        }
     
        /** 
         * The <code>EditorActionDelegate</code> implementation of this
         * <code>IEditorActionDelegate</code> method remembers the active editor.
         *
         * The matching editor has been activated. Notification
         * guarantees that only editors that match the type for which 
         * this action has been registered will be tracked.
         *
         * @param action action proxy that represents this delegate in the desktop
         * @param editor the matching editor that has been activated
         */
        public void setActiveEditor(IAction action, IEditorPart editor) {
            this.editor = editor;
        }
    }
    Pourquoi ça marche pas ?

    merci

  2. #2
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Janvier 2003
    Messages
    42
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2003
    Messages : 42
    Points : 25
    Points
    25
    Par défaut
    il faut que le paramètre toolbarpath soit renseigné mais pourquoi ?
    il est optionnel !

Discussions similaires

  1. requete avec OBCD et visual c++
    Par Anonymous dans le forum MFC
    Réponses: 12
    Dernier message: 18/11/2004, 16h15
  2. [langage] Comparer Perl avec d'autres langages comme C ?
    Par Anonymous dans le forum Langage
    Réponses: 3
    Dernier message: 10/08/2002, 23h52
  3. Problème avec la mémoire virtuelle
    Par Anonymous dans le forum CORBA
    Réponses: 13
    Dernier message: 16/04/2002, 16h10
  4. [Kylix] Runtime error 230 avec INDY
    Par Anonymous dans le forum EDI
    Réponses: 2
    Dernier message: 23/03/2002, 11h51
  5. Réponses: 2
    Dernier message: 20/03/2002, 23h01

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