run Validation from custom Menu [message #138240] |
Thu, 21 June 2007 06:10  |
Eclipse User |
|
|
|
Hello,
I have a Custom Menu in my GMF diagram with a button "myValidate". I
want this button to run the Validation of the diagram (the same action
as in "Diagram/Validate" menu).
The problem is that I don't know how to access this IAction from the
Class that handels my menu actions.
How can I access this action in order to run it ?
thanks,
regards.
Tex.
|
|
|
|
|
|
|
|
|
Re: run Validation from custom Menu [message #139932 is a reply to message #139849] |
Wed, 27 June 2007 08:01   |
Eclipse User |
|
|
|
Yes there is a static method
runValidation(View view)
But then how can I get tje "view" parameter from a IEditorPart or a
DiagramEditor
thx ,
Tex
Dmitry Stadnik wrote:
> There should be a static method in ValidateAction class to run
> validation; I think it's not necessary to instantiate it.
>
> Tex Twil wrote:
>> ok,
>> I've just found the solution which is quite .... easy :)
>>
>> (editor is a IEditorPart)
>>
>> XXX.diagram.part.ValidateAction validateAction;
>>
>> IWorkbenchPartDescriptor partDescriptor =
>> new WorkbenchPartDescriptor(
>> editor.getSite().getId(),
>> editor.getClass(),
>> editor.getSite().getPage());
>>
>> validateAction = new ValidateAction(partDescriptor);
>> validateAction.run();
>>
>> cheers,
>> Tex.
>>
>>
>> Tex Twil wrote:
>>> Yes,
>>> it's in package XXX.diagram.part.
>>>
>>> I don't know where to get the parameter for the constructor:
>>>
>>> ValidateAction(IWorkbenchPartDescriptor workbenchPartDescriptor)
>>>
>>> Tex.
>>>
>>>
>>> Dmitry Stadnik wrote:
>>>> Now ValidateAction has it's own file.
>>>>
>>>> Tex Twil wrote:
>>>>> Hi,
>>>>> yes that's what I found here :
>>>>> http://dev.eclipse.org/newslists/news.eclipse.modeling.gmf/m sg06307.html
>>>>>
>>>>>
>>>>> but in my XXXValidationProvider class I don't have the static class
>>>>> ValidateAction class.
>>>>>
>>>>> Tex.
>>>>>
>>>>> Khai M Nguyen wrote:
>>>>>> In your generated ...diagram.providers package you should have a
>>>>>> XXXValidationProvider class with a static ValidateAction class
>>>>>> defined in it. From your menu item you can call the static method
>>>>>> ValidateAction.runValidation(view).
>>>>>>
>>>>>> -- Khai --
>>>>>>
>>>>>> Tex Twil wrote:
>>>>>>> Hello,
>>>>>>> I have a Custom Menu in my GMF diagram with a button
>>>>>>> "myValidate". I want this button to run the Validation of the
>>>>>>> diagram (the same action as in "Diagram/Validate" menu).
>>>>>>>
>>>>>>> The problem is that I don't know how to access this IAction from
>>>>>>> the Class that handels my menu actions.
>>>>>>>
>>>>>>> How can I access this action in order to run it ?
>>>>>>>
>>>>>>> thanks,
>>>>>>> regards.
>>>>>>> Tex.
|
|
|
Re: run Validation from custom Menu [message #139964 is a reply to message #139932] |
Wed, 27 June 2007 08:30   |
Eclipse User |
|
|
|
Originally posted by: 5d5.mail.ru
View is a model of editpart; you may use diagram editpart or editparts
selected on diagram.
Tex Twil wrote:
> Yes there is a static method
> runValidation(View view)
>
> But then how can I get tje "view" parameter from a IEditorPart or a
> DiagramEditor
>
> thx ,
> Tex
> Dmitry Stadnik wrote:
>> There should be a static method in ValidateAction class to run
>> validation; I think it's not necessary to instantiate it.
>>
>> Tex Twil wrote:
>>> ok,
>>> I've just found the solution which is quite .... easy :)
>>>
>>> (editor is a IEditorPart)
>>>
>>> XXX.diagram.part.ValidateAction validateAction;
>>>
>>> IWorkbenchPartDescriptor partDescriptor =
>>> new WorkbenchPartDescriptor(
>>> editor.getSite().getId(),
>>> editor.getClass(),
>>> editor.getSite().getPage());
>>>
>>> validateAction = new ValidateAction(partDescriptor);
>>> validateAction.run();
>>>
>>> cheers,
>>> Tex.
>>>
>>>
>>> Tex Twil wrote:
>>>> Yes,
>>>> it's in package XXX.diagram.part.
>>>>
>>>> I don't know where to get the parameter for the constructor:
>>>>
>>>> ValidateAction(IWorkbenchPartDescriptor workbenchPartDescriptor)
>>>>
>>>> Tex.
>>>>
>>>>
>>>> Dmitry Stadnik wrote:
>>>>> Now ValidateAction has it's own file.
>>>>>
>>>>> Tex Twil wrote:
>>>>>> Hi,
>>>>>> yes that's what I found here :
>>>>>> http://dev.eclipse.org/newslists/news.eclipse.modeling.gmf/m sg06307.html
>>>>>>
>>>>>>
>>>>>> but in my XXXValidationProvider class I don't have the static
>>>>>> class ValidateAction class.
>>>>>>
>>>>>> Tex.
>>>>>>
>>>>>> Khai M Nguyen wrote:
>>>>>>> In your generated ...diagram.providers package you should have a
>>>>>>> XXXValidationProvider class with a static ValidateAction class
>>>>>>> defined in it. From your menu item you can call the static
>>>>>>> method ValidateAction.runValidation(view).
>>>>>>>
>>>>>>> -- Khai --
>>>>>>>
>>>>>>> Tex Twil wrote:
>>>>>>>> Hello,
>>>>>>>> I have a Custom Menu in my GMF diagram with a button
>>>>>>>> "myValidate". I want this button to run the Validation of the
>>>>>>>> diagram (the same action as in "Diagram/Validate" menu).
>>>>>>>>
>>>>>>>> The problem is that I don't know how to access this IAction from
>>>>>>>> the Class that handels my menu actions.
>>>>>>>>
>>>>>>>> How can I access this action in order to run it ?
>>>>>>>>
>>>>>>>> thanks,
>>>>>>>> regards.
>>>>>>>> Tex.
|
|
|
Re: run Validation from custom Menu [message #139991 is a reply to message #139964] |
Wed, 27 June 2007 09:24  |
Eclipse User |
|
|
|
Ok, thank you very much. This helped me also for my other post about
validating while saving the diagram.
thx,
Tex.
Dmitry Stadnik wrote:
> View is a model of editpart; you may use diagram editpart or editparts
> selected on diagram.
>
> Tex Twil wrote:
>> Yes there is a static method
>> runValidation(View view)
>>
>> But then how can I get tje "view" parameter from a IEditorPart or a
>> DiagramEditor
>>
>> thx ,
>> Tex
>> Dmitry Stadnik wrote:
>>> There should be a static method in ValidateAction class to run
>>> validation; I think it's not necessary to instantiate it.
>>>
>>> Tex Twil wrote:
>>>> ok,
>>>> I've just found the solution which is quite .... easy :)
>>>>
>>>> (editor is a IEditorPart)
>>>>
>>>> XXX.diagram.part.ValidateAction validateAction;
>>>>
>>>> IWorkbenchPartDescriptor partDescriptor =
>>>> new WorkbenchPartDescriptor(
>>>> editor.getSite().getId(),
>>>> editor.getClass(),
>>>> editor.getSite().getPage());
>>>>
>>>> validateAction = new ValidateAction(partDescriptor);
>>>> validateAction.run();
>>>>
>>>> cheers,
>>>> Tex.
>>>>
>>>>
>>>> Tex Twil wrote:
>>>>> Yes,
>>>>> it's in package XXX.diagram.part.
>>>>>
>>>>> I don't know where to get the parameter for the constructor:
>>>>>
>>>>> ValidateAction(IWorkbenchPartDescriptor workbenchPartDescriptor)
>>>>>
>>>>> Tex.
>>>>>
>>>>>
>>>>> Dmitry Stadnik wrote:
>>>>>> Now ValidateAction has it's own file.
>>>>>>
>>>>>> Tex Twil wrote:
>>>>>>> Hi,
>>>>>>> yes that's what I found here :
>>>>>>> http://dev.eclipse.org/newslists/news.eclipse.modeling.gmf/m sg06307.html
>>>>>>>
>>>>>>>
>>>>>>> but in my XXXValidationProvider class I don't have the static
>>>>>>> class ValidateAction class.
>>>>>>>
>>>>>>> Tex.
>>>>>>>
>>>>>>> Khai M Nguyen wrote:
>>>>>>>> In your generated ...diagram.providers package you should have a
>>>>>>>> XXXValidationProvider class with a static ValidateAction class
>>>>>>>> defined in it. From your menu item you can call the static
>>>>>>>> method ValidateAction.runValidation(view).
>>>>>>>>
>>>>>>>> -- Khai --
>>>>>>>>
>>>>>>>> Tex Twil wrote:
>>>>>>>>> Hello,
>>>>>>>>> I have a Custom Menu in my GMF diagram with a button
>>>>>>>>> "myValidate". I want this button to run the Validation of the
>>>>>>>>> diagram (the same action as in "Diagram/Validate" menu).
>>>>>>>>>
>>>>>>>>> The problem is that I don't know how to access this IAction
>>>>>>>>> from the Class that handels my menu actions.
>>>>>>>>>
>>>>>>>>> How can I access this action in order to run it ?
>>>>>>>>>
>>>>>>>>> thanks,
>>>>>>>>> regards.
>>>>>>>>> Tex.
|
|
|
Powered by
FUDForum. Page generated in 0.02435 seconds