Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] [CDT Platform] Add a button to the debug toolbar

Hi Jonah !

I was quietly trying to work with your example ... when suddenly it was the drama :(
I'm working on Kepler and I haven' the choice :(

So I haven't the GdbSessionAdapters ... I 'll try to adapt it ...

Thank you for your example :) it's very nice !

-----Original Message-----
From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of Jonah Graham
Sent: Sunday, November 29, 2015 10:28 PM
To: CDT General developers list.
Subject: Re: [cdt-dev] [CDT Platform] Add a button to the debug toolbar

Hi Christelle,

In the end I decided that the best way to demonstrate adding a new command was to extend the dsf gdb example in the CDT repo. You can pick up the change to the example from my github fork of CDT here https://github.com/jonahkichwacoders/cdt/tree/new_command_in_dsf_example

The commit is here:
https://github.com/jonahkichwacoders/cdt/commit/e137b129c39d61ac34e094a411885dbf89444f35
where you can see all the different parts that work together. If there is any part of this commit I can explain, please let me know and I will add explanations to the code for all to benefit.

The bugzilla covering this enhancement to the example is
https://bugs.eclipse.org/bugs/show_bug.cgi?id=483234 with the associated gerrit.

I hope this helps.
Jonah
~~~
Jonah Graham
Kichwa Coders Ltd.
www.kichwacoders.com


On 27 November 2015 at 14:19, Christelle BURGUERA <Christelle.BURGUERA@xxxxxx> wrote:
> Many many thanks !!!
> :)
>
> I'll let you more than one hour ... I'm in week-end in one hour :)
>
> Have a nice week-end !
>
> -----Original Message-----
> From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx]
> On Behalf Of Jonah Graham
> Sent: Friday, November 27, 2015 3:09 PM
> To: CDT General developers list.
> Subject: Re: [cdt-dev] [CDT Platform] Add a button to the debug
> toolbar
>
> Hi Christelle,
>
> I'll try and put together a standalone example for you and we can see if that works in your environment. Give me an hour or two and I'll get back to you on this list again.
>
> Jonah
> ~~~
> Jonah Graham
> Kichwa Coders Ltd.
> www.kichwacoders.com
>
>
> On 27 November 2015 at 12:25, Christelle BURGUERA <Christelle.BURGUERA@xxxxxx> wrote:
>> Hi,
>>
>> I really not understand how can I do to enable and disable my button....
>> I want it enabled if debug is launching and disabled if not.
>>
>> I mimic the connect button, so I created a contributionMenu, a command and an handler (to test it I copied the "enabledWhen"). But the state of my button doesn’t change.
>> I don’t' understand the handler you use. There is no enable function ..
>>
>> Thank you
>> Christelle
>>
>>
>> -----Original Message-----
>> From: cdt-dev-bounces@xxxxxxxxxxx
>> [mailto:cdt-dev-bounces@xxxxxxxxxxx]
>> On Behalf Of Jonah Graham
>> Sent: Thursday, November 26, 2015 5:10 PM
>> To: CDT General developers list.
>> Subject: Re: [cdt-dev] [CDT Platform] Add a button to the debug
>> toolbar
>>
>> Hi Christelle,
>>
>> You want something like this, note the locationURI.
>>
>>       <menuContribution
>>             locationURI="toolbar:org.eclipse.debug.ui.DebugView?before=stepGroup">
>>          <command
>>                commandId="org.eclipse.cdt.debug.ui.command.connect"
>>                icon="icons/obj16/connect.gif"
>>                label="%Connect.label"
>>                style="push"
>>                tooltip="%Connect.tooltip">
>>          </command>
>>       </menuContribution>
>>
>> The above snippet comes from here:
>> http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/tree/debug/org.eclip
>> s
>> e.cdt.debug.ui/plugin.xml#n2726
>>
>> If you search the file for the id
>> "org.eclipse.cdt.debug.ui.command.connect" you should see all the parts you need to connect together.
>>
>> Jonah
>>
>> ~~~
>> Jonah Graham
>> Kichwa Coders Ltd.
>> www.kichwacoders.com
>>
>>
>> On 26 November 2015 at 15:18, Christelle BURGUERA <Christelle.BURGUERA@xxxxxx> wrote:
>>> Hi Marc,
>>>
>>>
>>>
>>> I’ll have a look.
>>>
>>> Do you know the plugin’s name where I can find this button ?
>>>
>>>
>>>
>>> Thank you !
>>>
>>> Christelle
>>>
>>>
>>>
>>> From: cdt-dev-bounces@xxxxxxxxxxx
>>> [mailto:cdt-dev-bounces@xxxxxxxxxxx]
>>> On Behalf Of Marc Khouzam
>>> Sent: Thursday, November 26, 2015 4:11 PM
>>> To: CDT General developers list.
>>> Subject: Re: [cdt-dev] [CDT Platform] Add a button to the debug
>>> toolbar
>>>
>>>
>>>
>>> I haven't looked deeply at the code you posted but I didn't notice
>>> the use of the menu.ui extension point.  When I use the command
>>> framework I use the extension points:
>>> Command
>>> Handler
>>> Menu
>>>
>>> I recommend you mimic the connect button which is added by CDT to
>>> the Debug toolbar. That should be the closest example you can find
>>> to what you seem to want.
>>>
>>> BR,
>>>
>>> Marc
>>>
>>>
>>>
>>> From: Christelle BURGUERA <Christelle.BURGUERA@xxxxxx>
>>> Sent: Nov 26, 2015 03:11
>>> To: cdt-dev@xxxxxxxxxxx
>>> Subject: [cdt-dev] [CDT Platform] Add a button to the debug toolbar
>>>
>>>
>>>
>>> Hi,
>>>
>>>
>>>
>>> I develop plugins installed on a CDT Eclipse to do C/C++ application.
>>>
>>> I would like to add a button to the debug toolbar next to “Resume”
>>> button for example or not so far ….
>>>
>>> To do that I was inspired by the button “Resume”. I did the same
>>> things, I just changed the id and name but for the moment my button
>>> should have the same behavior that Resume button !
>>>
>>> But no L !
>>>
>>>
>>>
>>> By default it’s enabled when no debug is launched and more annoying
>>> it’s visible in the others perspectives !
>>>
>>>
>>>
>>> I put breakpoints on “init” function of ResumeCommandActionDelegate
>>> and ResetCommandActionDelegate (my commandActionDelegate). When I
>>> open the debug perspective, the breakpoint on “init” function of
>>> ResumeCommandActionDelegate is detected but not in my
>>> commandActionDelegate, the breakpoint is detected only when I click on the button … but too late !
>>>
>>> I think my action isn’t register !
>>>
>>> But I don’t know why ….
>>>
>>>
>>>
>>> See the sources code :
>>>
>>> plugin.xml:
>>>
>>> [CODE]
>>>
>>> // actionSets
>>>
>>> <extension
>>>
>>>          point="org.eclipse.ui.actionSets">
>>>
>>>       <actionSet
>>>
>>>             id="blabla.debug.reset.actionset"
>>>
>>>             label="Reset"
>>>
>>>             visible="true">
>>>
>>>          <action
>>>
>>>                class="blabla.debug.actions.ResetCommandActionDelegate"
>>>
>>>                definitionId="blabla.debug.commands.Reset"
>>>
>>>                disabledIcon="icons/unselected_restart.gif"
>>>
>>>                hoverIcon="icons/selected_restart.gif"
>>>
>>>                icon="icons/selected_restart.gif"
>>>
>>>                id="blabla.debug.action.reset"
>>>
>>>                label="Reset"
>>>
>>>                menubarPath="org.eclipse.ui.run/stepGroup"
>>>
>>>                toolbarPath="org.eclipse.debug.ui.main.toolbar/additions"
>>>
>>>                tooltip="Reset the chip to restart the process">
>>>
>>>          </action>
>>>
>>>       </actionSet>
>>>
>>>    </extension>
>>>
>>> // Command
>>>
>>> <command
>>>
>>>             categoryId="org.eclipse.debug.ui.category.run"
>>>
>>>             defaultHandler="blabla.debug.commands.ResetHandler"
>>>
>>>             description="Reset the chip to restart the process"
>>>
>>>             id="blabla.debug.commands.Reset"
>>>
>>>             name="Reset">
>>>
>>>       </command>
>>>
>>> [/CODE]
>>>
>>>
>>>
>>> Associated sources:
>>>
>>> [CODE]
>>>
>>> package blabla.debug.commands;
>>>
>>>
>>>
>>> import org.eclipse.debug.core.commands.IRestartHandler;
>>>
>>> import org.eclipse.debug.core.commands.IResumeHandler;
>>>
>>> import org.eclipse.debug.ui.actions.DebugCommandHandler;
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> public class ResetHandler extends DebugCommandHandler {
>>>
>>>
>>>
>>>             @Override
>>>
>>>                         protected Class<IResumeHandler>
>>> getCommandType() {
>>>
>>>                     return IResumeHandler.class;
>>>
>>>                 }
>>>
>>>
>>>
>>> }
>>>
>>> [/CODE]
>>>
>>>
>>>
>>> [CODE]
>>>
>>> package blabla.debug.actions;
>>>
>>>
>>>
>>> import org.eclipse.debug.ui.actions.DebugCommandAction;
>>>
>>> import org.eclipse.jface.action.IAction;
>>>
>>> import org.eclipse.jface.viewers.ISelection;
>>>
>>> import org.eclipse.swt.widgets.Event;
>>>
>>> import org.eclipse.ui.IActionDelegate2;
>>>
>>> import org.eclipse.ui.IWorkbenchWindow;
>>>
>>> import org.eclipse.ui.IWorkbenchWindowActionDelegate;
>>>
>>>
>>>
>>> public class ResetCommandActionDelegate implements
>>> IWorkbenchWindowActionDelegate, IActionDelegate2 {
>>>
>>>
>>>
>>>
>>>
>>>             private DebugCommandActionfDebugAction = new
>>> ResetCommandAction();
>>>
>>>
>>>
>>>     @Override
>>>
>>>             public void dispose() {
>>>
>>>         fDebugAction.dispose();
>>>
>>>     }
>>>
>>>
>>>
>>>     @Override
>>>
>>>             public void init(IWorkbenchWindow window) {
>>>
>>>         fDebugAction.init(window);
>>>
>>>     }
>>>
>>>
>>>
>>>     @Override
>>>
>>>             public void run(IAction action) {
>>>
>>>         fDebugAction.run();
>>>
>>>     }
>>>
>>>
>>>
>>>     @Override
>>>
>>>             public void selectionChanged(IAction action, ISelection
>>> selection) {
>>>
>>>         // do nothing
>>>
>>>     }
>>>
>>>
>>>
>>>     @Override
>>>
>>>             public void init(IAction action) {
>>>
>>>         fDebugAction.setActionProxy(action);
>>>
>>>
>>>
>>>     }
>>>
>>>
>>>
>>>     @Override
>>>
>>>             public void runWithEvent(IAction action, Event event) {
>>>
>>>         run(action);
>>>
>>>     }
>>>
>>> }
>>>
>>> [/CODE]
>>>
>>>
>>>
>>> [CODE]
>>>
>>> package blabla.debug.actions;
>>>
>>>
>>>
>>> import org.eclipse.debug.core.commands.IRestartHandler;
>>>
>>> import org.eclipse.debug.core.commands.IResumeHandler;
>>>
>>> import org.eclipse.debug.internal.ui.DebugPluginImages;
>>>
>>> import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
>>>
>>> import org.eclipse.debug.internal.ui.actions.ActionMessages;
>>>
>>> import org.eclipse.debug.ui.actions.DebugCommandAction;
>>>
>>> import org.eclipse.jface.resource.ImageDescriptor;
>>>
>>> import org.eclipse.ui.plugin.AbstractUIPlugin;
>>>
>>>
>>>
>>> import blabla.debug.MCUDebugPlugin;
>>>
>>>
>>>
>>> public class ResetCommandAction extends DebugCommandAction {
>>>
>>>
>>>
>>>
>>>
>>>             public ResetCommandAction() {
>>>
>>>
>>> setActionDefinitionId("org.eclipse.debug.ui.commands.Resume");
>>> //$NON-NLS-1$
>>>
>>>             }
>>>
>>>
>>>
>>>     @Override
>>>
>>>             public String getText() {
>>>
>>>         return ActionMessages.ResumeAction_0;
>>>
>>>     }
>>>
>>>
>>>
>>>     @Override
>>>
>>>             public String getHelpContextId() {
>>>
>>>         return "org.eclipse.debug.ui.resume_action_context";
>>> //$NON-NLS-1$
>>>
>>>     }
>>>
>>>
>>>
>>>     @Override
>>>
>>>             public String getId() {
>>>
>>>         return "org.eclipse.debug.ui.debugview.toolbar.resume";
>>> //$NON-NLS-1$
>>>
>>>     }
>>>
>>>
>>>
>>>     @Override
>>>
>>>             public String getToolTipText() {
>>>
>>>         return ActionMessages.ResumeAction_3;
>>>
>>>     }
>>>
>>>
>>>
>>>     @Override
>>>
>>>             public ImageDescriptor getDisabledImageDescriptor() {
>>>
>>>         return
>>> DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_D
>>> L
>>> C
>>> L_RESUME);
>>>
>>>     }
>>>
>>>
>>>
>>>     @Override
>>>
>>>             public ImageDescriptor getHoverImageDescriptor() {
>>>
>>>         return
>>> DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_E
>>> L
>>> C
>>> L_RESUME);
>>>
>>>     }
>>>
>>>
>>>
>>>     @Override
>>>
>>>             public ImageDescriptor getImageDescriptor() {
>>>
>>>         return
>>> DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_E
>>> L
>>> C
>>> L_RESUME);
>>>
>>>     }
>>>
>>>
>>>
>>>             @Override
>>>
>>>             protected Class<IResumeHandler> getCommandType() {
>>>
>>>                         return IResumeHandler.class;
>>>
>>>             }
>>>
>>>
>>>
>>> }
>>>
>>> [/CODE]
>>>
>>>
>>>
>>> If you have any idea ….
>>>
>>> Many thanks !!!
>>>
>>>
>>>
>>> Chris
>>>
>>>
>>> _______________________________________________
>>> cdt-dev mailing list
>>> cdt-dev@xxxxxxxxxxx
>>> To change your delivery options, retrieve your password, or
>>> unsubscribe from this list, visit
>>> https://dev.eclipse.org/mailman/listinfo/cdt-dev
>> _______________________________________________
>> cdt-dev mailing list
>> cdt-dev@xxxxxxxxxxx
>> To change your delivery options, retrieve your password, or
>> unsubscribe from this list, visit
>> https://dev.eclipse.org/mailman/listinfo/cdt-dev
>> _______________________________________________
>> cdt-dev mailing list
>> cdt-dev@xxxxxxxxxxx
>> To change your delivery options, retrieve your password, or
>> unsubscribe from this list, visit
>> https://dev.eclipse.org/mailman/listinfo/cdt-dev
> _______________________________________________
> cdt-dev mailing list
> cdt-dev@xxxxxxxxxxx
> To change your delivery options, retrieve your password, or
> unsubscribe from this list, visit
> https://dev.eclipse.org/mailman/listinfo/cdt-dev
> _______________________________________________
> cdt-dev mailing list
> cdt-dev@xxxxxxxxxxx
> To change your delivery options, retrieve your password, or
> unsubscribe from this list, visit
> https://dev.eclipse.org/mailman/listinfo/cdt-dev
_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit https://dev.eclipse.org/mailman/listinfo/cdt-dev

Back to the top