MCPcopy Create free account
hub / github.com/MITK/MITK / ExecuteWithChecks

Method ExecuteWithChecks

Plugins/org.blueberry.core.commands/src/berryCommand.cpp:149–190  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

147}
148
149Object::Pointer Command::ExecuteWithChecks(const ExecutionEvent::ConstPointer event)
150{
151 this->FirePreExecute(event);
152 const IHandler::Pointer handler(this->handler);
153
154 if (!this->IsDefined())
155 {
156 const NotDefinedException exception(
157 "Trying to execute a command that is not defined. " + this->GetId());
158 this->FireNotDefined(&exception);
159 throw exception;
160 }
161
162 // Perform the execution, if there is a handler.
163 if (handler && handler->IsHandled())
164 {
165 this->SetEnabled(event->GetApplicationContext());
166 if (!this->IsEnabled()) {
167 const NotEnabledException exception(
168 "Trying to execute the disabled command " + this->GetId());
169 this->FireNotEnabled(&exception);
170 throw exception;
171 }
172
173 try
174 {
175 const Object::Pointer returnValue(handler->Execute(event));
176 this->FirePostExecuteSuccess(returnValue);
177 return returnValue;
178 }
179 catch (const ExecutionException* e)
180 {
181 this->FirePostExecuteFailure(e);
182 throw e;
183 }
184 }
185
186 const NotHandledException e(
187 "There is no handler to execute for command " + this->GetId());
188 this->FireNotHandled(&e);
189 throw e;
190}
191
192void Command::FireCommandChanged(const CommandEvent::ConstPointer commandEvent)
193{

Callers 2

ExecuteCommandMethod · 0.45

Calls 13

FirePreExecuteMethod · 0.95
FireNotDefinedMethod · 0.95
SetEnabledMethod · 0.95
IsEnabledMethod · 0.95
FireNotEnabledMethod · 0.95
FireNotHandledMethod · 0.95
IsDefinedMethod · 0.80
GetIdMethod · 0.45
IsHandledMethod · 0.45
GetApplicationContextMethod · 0.45

Tested by

no test coverage detected