| 1 | /* |
| 2 | * Copyright 2006 SDQ Research Group, University of Karlsruhe (TH) |
| 3 | */ |
| 4 | package de.uka.ipd.sdq.pcm.gmf.seff.edit.parts; |
| 5 | |
| 6 | import org.eclipse.draw2d.FigureUtilities; |
| 7 | import org.eclipse.draw2d.Label; |
| 8 | import org.eclipse.draw2d.geometry.Dimension; |
| 9 | import org.eclipse.draw2d.geometry.Rectangle; |
| 10 | import org.eclipse.gef.EditPart; |
| 11 | import org.eclipse.gef.EditPartFactory; |
| 12 | import org.eclipse.gef.tools.CellEditorLocator; |
| 13 | import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart; |
| 14 | import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; |
| 15 | import org.eclipse.gmf.runtime.notation.View; |
| 16 | import org.eclipse.jface.viewers.CellEditor; |
| 17 | import org.eclipse.swt.SWT; |
| 18 | import org.eclipse.swt.widgets.Text; |
| 19 | |
| 20 | import de.uka.ipd.sdq.pcm.gmf.seff.part.PalladioComponentModelVisualIDRegistry; |
| 21 | |
| 22 | /** |
| 23 | * @generated |
| 24 | */ |
| 25 | public class PalladioComponentModelEditPartFactory implements EditPartFactory { |
| 26 | |
| 27 | /** |
| 28 | * @generated |
| 29 | */ |
| 30 | public EditPart createEditPart(EditPart context, Object model) { |
| 31 | if (model instanceof View) { |
| 32 | View view = (View) model; |
| 33 | switch (PalladioComponentModelVisualIDRegistry.getVisualID(view)) { |
| 34 | |
| 35 | case ResourceDemandingSEFFEditPart.VISUAL_ID: |
| 36 | return new ResourceDemandingSEFFEditPart(view); |
| 37 | |
| 38 | case StartActionEditPart.VISUAL_ID: |
| 39 | return new StartActionEditPart(view); |
| 40 | |
| 41 | case StopActionEditPart.VISUAL_ID: |
| 42 | return new StopActionEditPart(view); |
| 43 | |
| 44 | case ExternalCallActionEditPart.VISUAL_ID: |
| 45 | return new ExternalCallActionEditPart(view); |
| 46 | |
| 47 | case ExternalCallActionEntityNameEditPart.VISUAL_ID: |
| 48 | return new ExternalCallActionEntityNameEditPart(view); |
| 49 | |
| 50 | case EmitEventActionEditPart.VISUAL_ID: |
| 51 | return new EmitEventActionEditPart(view); |
| 52 | |
| 53 | case EmitEventActionEntityNameEditPart.VISUAL_ID: |
| 54 | return new EmitEventActionEntityNameEditPart(view); |
| 55 | |
| 56 | case LoopActionEditPart.VISUAL_ID: |
| 57 | return new LoopActionEditPart(view); |
| 58 | |
| 59 | case LoopActionEntityNameEditPart.VISUAL_ID: |
| 60 | return new LoopActionEntityNameEditPart(view); |
| 61 | |
| 62 | case LoopIterationsLabelEditPart.VISUAL_ID: |
| 63 | return new LoopIterationsLabelEditPart(view); |
| 64 | |
| 65 | case BranchActionEditPart.VISUAL_ID: |
| 66 | return new BranchActionEditPart(view); |
| 67 | |
| 68 | case BranchActionEntityNameEditPart.VISUAL_ID: |
| 69 | return new BranchActionEntityNameEditPart(view); |
| 70 | |
| 71 | case InternalActionEditPart.VISUAL_ID: |
| 72 | return new InternalActionEditPart(view); |
| 73 | |
| 74 | case InternalActionEntityNameEditPart.VISUAL_ID: |
| 75 | return new InternalActionEntityNameEditPart(view); |
| 76 | |
| 77 | case CollectionIteratorActionEditPart.VISUAL_ID: |
| 78 | return new CollectionIteratorActionEditPart(view); |
| 79 | |
| 80 | case CollectionIteratorActionEntityNameEditPart.VISUAL_ID: |
| 81 | return new CollectionIteratorActionEntityNameEditPart(view); |
| 82 | |
| 83 | case CollectionIteratorParameterLabel2EditPart.VISUAL_ID: |
| 84 | return new CollectionIteratorParameterLabel2EditPart(view); |
| 85 | |
| 86 | case SetVariableActionEditPart.VISUAL_ID: |
| 87 | return new SetVariableActionEditPart(view); |
| 88 | |
| 89 | case SetVariableActionEntityNameEditPart.VISUAL_ID: |
| 90 | return new SetVariableActionEntityNameEditPart(view); |
| 91 | |
| 92 | case AcquireActionEditPart.VISUAL_ID: |
| 93 | return new AcquireActionEditPart(view); |
| 94 | |
| 95 | case AcquireActionEntityNameEditPart.VISUAL_ID: |
| 96 | return new AcquireActionEntityNameEditPart(view); |
| 97 | |
| 98 | case ReleaseActionEditPart.VISUAL_ID: |
| 99 | return new ReleaseActionEditPart(view); |
| 100 | |
| 101 | case ReleaseActionEntityNameEditPart.VISUAL_ID: |
| 102 | return new ReleaseActionEntityNameEditPart(view); |
| 103 | |
| 104 | case ForkActionEditPart.VISUAL_ID: |
| 105 | return new ForkActionEditPart(view); |
| 106 | |
| 107 | case ForkActionEntityNameEditPart.VISUAL_ID: |
| 108 | return new ForkActionEntityNameEditPart(view); |
| 109 | |
| 110 | case RecoveryActionEditPart.VISUAL_ID: |
| 111 | return new RecoveryActionEditPart(view); |
| 112 | |
| 113 | case RecoveryActionEntityNameEditPart.VISUAL_ID: |
| 114 | return new RecoveryActionEntityNameEditPart(view); |
| 115 | |
| 116 | case VariableUsageEditPart.VISUAL_ID: |
| 117 | return new VariableUsageEditPart(view); |
| 118 | |
| 119 | case VariableUsageLabelEditPart.VISUAL_ID: |
| 120 | return new VariableUsageLabelEditPart(view); |
| 121 | |
| 122 | case VariableCharacterisationEditPart.VISUAL_ID: |
| 123 | return new VariableCharacterisationEditPart(view); |
| 124 | |
| 125 | case VariableUsage2EditPart.VISUAL_ID: |
| 126 | return new VariableUsage2EditPart(view); |
| 127 | |
| 128 | case WrappingLabelEditPart.VISUAL_ID: |
| 129 | return new WrappingLabelEditPart(view); |
| 130 | |
| 131 | case VariableCharacterisation2EditPart.VISUAL_ID: |
| 132 | return new VariableCharacterisation2EditPart(view); |
| 133 | |
| 134 | case VariableUsage4EditPart.VISUAL_ID: |
| 135 | return new VariableUsage4EditPart(view); |
| 136 | |
| 137 | case VariableUsage4LabelEditPart.VISUAL_ID: |
| 138 | return new VariableUsage4LabelEditPart(view); |
| 139 | |
| 140 | case VariableCharacterisation3EditPart.VISUAL_ID: |
| 141 | return new VariableCharacterisation3EditPart(view); |
| 142 | |
| 143 | case ResourceDemandingBehaviourEditPart.VISUAL_ID: |
| 144 | return new ResourceDemandingBehaviourEditPart(view); |
| 145 | |
| 146 | case StartAction2EditPart.VISUAL_ID: |
| 147 | return new StartAction2EditPart(view); |
| 148 | |
| 149 | case StopAction2EditPart.VISUAL_ID: |
| 150 | return new StopAction2EditPart(view); |
| 151 | |
| 152 | case LoopAction2EditPart.VISUAL_ID: |
| 153 | return new LoopAction2EditPart(view); |
| 154 | |
| 155 | case LoopActionEntityName2EditPart.VISUAL_ID: |
| 156 | return new LoopActionEntityName2EditPart(view); |
| 157 | |
| 158 | case Loop2IterationsLabelEditPart.VISUAL_ID: |
| 159 | return new Loop2IterationsLabelEditPart(view); |
| 160 | |
| 161 | case InternalAction2EditPart.VISUAL_ID: |
| 162 | return new InternalAction2EditPart(view); |
| 163 | |
| 164 | case InternalActionEntityName2EditPart.VISUAL_ID: |
| 165 | return new InternalActionEntityName2EditPart(view); |
| 166 | |
| 167 | case ParametricResourceDemandEditPart.VISUAL_ID: |
| 168 | return new ParametricResourceDemandEditPart(view); |
| 169 | |
| 170 | case InternalFailureOccurrenceDescriptionEditPart.VISUAL_ID: |
| 171 | return new InternalFailureOccurrenceDescriptionEditPart(view); |
| 172 | |
| 173 | case InfrastructureCallEditPart.VISUAL_ID: |
| 174 | return new InfrastructureCallEditPart(view); |
| 175 | |
| 176 | case InfrastructureCallNumberOfCallsLabelEditPart.VISUAL_ID: |
| 177 | return new InfrastructureCallNumberOfCallsLabelEditPart(view); |
| 178 | |
| 179 | case InfrastructureCallTargetLabelEditPart.VISUAL_ID: |
| 180 | return new InfrastructureCallTargetLabelEditPart(view); |
| 181 | |
| 182 | case VariableUsage5EditPart.VISUAL_ID: |
| 183 | return new VariableUsage5EditPart(view); |
| 184 | |
| 185 | case VariableUsage5LabelEditPart.VISUAL_ID: |
| 186 | return new VariableUsage5LabelEditPart(view); |
| 187 | |
| 188 | case VariableCharacterisation4EditPart.VISUAL_ID: |
| 189 | return new VariableCharacterisation4EditPart(view); |
| 190 | |
| 191 | case BranchAction2EditPart.VISUAL_ID: |
| 192 | return new BranchAction2EditPart(view); |
| 193 | |
| 194 | case BranchActionEntityName2EditPart.VISUAL_ID: |
| 195 | return new BranchActionEntityName2EditPart(view); |
| 196 | |
| 197 | case ProbabilisticBranchTransitionEditPart.VISUAL_ID: |
| 198 | return new ProbabilisticBranchTransitionEditPart(view); |
| 199 | |
| 200 | case ProbabilisticBranchTransitionEntityNameEditPart.VISUAL_ID: |
| 201 | return new ProbabilisticBranchTransitionEntityNameEditPart(view); |
| 202 | |
| 203 | case ProbabilisticBranchTransitionBranchProbabilityEditPart.VISUAL_ID: |
| 204 | return new ProbabilisticBranchTransitionBranchProbabilityEditPart( |
| 205 | view); |
| 206 | |
| 207 | case ResourceDemandingBehaviour2EditPart.VISUAL_ID: |
| 208 | return new ResourceDemandingBehaviour2EditPart(view); |
| 209 | |
| 210 | case ExternalCallAction2EditPart.VISUAL_ID: |
| 211 | return new ExternalCallAction2EditPart(view); |
| 212 | |
| 213 | case ExternalCallActionEntityName2EditPart.VISUAL_ID: |
| 214 | return new ExternalCallActionEntityName2EditPart(view); |
| 215 | |
| 216 | case EmitEventAction2EditPart.VISUAL_ID: |
| 217 | return new EmitEventAction2EditPart(view); |
| 218 | |
| 219 | case EmitEventActionEntityName2EditPart.VISUAL_ID: |
| 220 | return new EmitEventActionEntityName2EditPart(view); |
| 221 | |
| 222 | case AcquireAction2EditPart.VISUAL_ID: |
| 223 | return new AcquireAction2EditPart(view); |
| 224 | |
| 225 | case AcquireActionEntityName2EditPart.VISUAL_ID: |
| 226 | return new AcquireActionEntityName2EditPart(view); |
| 227 | |
| 228 | case ReleaseAction2EditPart.VISUAL_ID: |
| 229 | return new ReleaseAction2EditPart(view); |
| 230 | |
| 231 | case ReleaseActionEntityName2EditPart.VISUAL_ID: |
| 232 | return new ReleaseActionEntityName2EditPart(view); |
| 233 | |
| 234 | case ForkAction2EditPart.VISUAL_ID: |
| 235 | return new ForkAction2EditPart(view); |
| 236 | |
| 237 | case ForkActionEntityName2EditPart.VISUAL_ID: |
| 238 | return new ForkActionEntityName2EditPart(view); |
| 239 | |
| 240 | case ForkedBehaviourEditPart.VISUAL_ID: |
| 241 | return new ForkedBehaviourEditPart(view); |
| 242 | |
| 243 | case CollectionIteratorAction2EditPart.VISUAL_ID: |
| 244 | return new CollectionIteratorAction2EditPart(view); |
| 245 | |
| 246 | case CollectionIteratorActionEntityName2EditPart.VISUAL_ID: |
| 247 | return new CollectionIteratorActionEntityName2EditPart(view); |
| 248 | |
| 249 | case CollectionIteratorParameterLabelEditPart.VISUAL_ID: |
| 250 | return new CollectionIteratorParameterLabelEditPart(view); |
| 251 | |
| 252 | case ResourceDemandingBehaviour3EditPart.VISUAL_ID: |
| 253 | return new ResourceDemandingBehaviour3EditPart(view); |
| 254 | |
| 255 | case RecoveryAction2EditPart.VISUAL_ID: |
| 256 | return new RecoveryAction2EditPart(view); |
| 257 | |
| 258 | case RecoveryActionEntityName2EditPart.VISUAL_ID: |
| 259 | return new RecoveryActionEntityName2EditPart(view); |
| 260 | |
| 261 | case RecoveryActionBehaviourEditPart.VISUAL_ID: |
| 262 | return new RecoveryActionBehaviourEditPart(view); |
| 263 | |
| 264 | case RecoveryActionBehaviourEntityNameEditPart.VISUAL_ID: |
| 265 | return new RecoveryActionBehaviourEntityNameEditPart(view); |
| 266 | |
| 267 | case SetVariableAction2EditPart.VISUAL_ID: |
| 268 | return new SetVariableAction2EditPart(view); |
| 269 | |
| 270 | case SetVariableActionEntityName2EditPart.VISUAL_ID: |
| 271 | return new SetVariableActionEntityName2EditPart(view); |
| 272 | |
| 273 | case VariableUsage3EditPart.VISUAL_ID: |
| 274 | return new VariableUsage3EditPart(view); |
| 275 | |
| 276 | case VariableUsage3LabelEditPart.VISUAL_ID: |
| 277 | return new VariableUsage3LabelEditPart(view); |
| 278 | |
| 279 | case VariableCharacterisation5EditPart.VISUAL_ID: |
| 280 | return new VariableCharacterisation5EditPart(view); |
| 281 | |
| 282 | case SynchronisationPointEditPart.VISUAL_ID: |
| 283 | return new SynchronisationPointEditPart(view); |
| 284 | |
| 285 | case ForkedBehaviour2EditPart.VISUAL_ID: |
| 286 | return new ForkedBehaviour2EditPart(view); |
| 287 | |
| 288 | case GuardedBranchTransitionEditPart.VISUAL_ID: |
| 289 | return new GuardedBranchTransitionEditPart(view); |
| 290 | |
| 291 | case GuardedBranchTransitionEntityNameEditPart.VISUAL_ID: |
| 292 | return new GuardedBranchTransitionEntityNameEditPart(view); |
| 293 | |
| 294 | case GuardedBranchTransitionIdEditPart.VISUAL_ID: |
| 295 | return new GuardedBranchTransitionIdEditPart(view); |
| 296 | |
| 297 | case ResourceDemandingBehaviour4EditPart.VISUAL_ID: |
| 298 | return new ResourceDemandingBehaviour4EditPart(view); |
| 299 | |
| 300 | case ExternalCallActionInputVariableUsageEditPart.VISUAL_ID: |
| 301 | return new ExternalCallActionInputVariableUsageEditPart(view); |
| 302 | |
| 303 | case ExternalCallActionOutputVariableUsageEditPart.VISUAL_ID: |
| 304 | return new ExternalCallActionOutputVariableUsageEditPart(view); |
| 305 | |
| 306 | case VariableUsageVariableCharacterisationEditPart.VISUAL_ID: |
| 307 | return new VariableUsageVariableCharacterisationEditPart(view); |
| 308 | |
| 309 | case VariableUsageVariableCharacterisation2EditPart.VISUAL_ID: |
| 310 | return new VariableUsageVariableCharacterisation2EditPart(view); |
| 311 | |
| 312 | case EmitEventActionInputVariableUsageEventEditPart.VISUAL_ID: |
| 313 | return new EmitEventActionInputVariableUsageEventEditPart(view); |
| 314 | |
| 315 | case VariableUsageVariableCharacterisation4EditPart.VISUAL_ID: |
| 316 | return new VariableUsageVariableCharacterisation4EditPart(view); |
| 317 | |
| 318 | case ResourceDemandingBehaviourBehaviourCompartmentEditPart.VISUAL_ID: |
| 319 | return new ResourceDemandingBehaviourBehaviourCompartmentEditPart( |
| 320 | view); |
| 321 | |
| 322 | case InternalActionResourceDemandEditPart.VISUAL_ID: |
| 323 | return new InternalActionResourceDemandEditPart(view); |
| 324 | |
| 325 | case InternalActionFailureOccurrenceDescriptionsEditPart.VISUAL_ID: |
| 326 | return new InternalActionFailureOccurrenceDescriptionsEditPart( |
| 327 | view); |
| 328 | |
| 329 | case InternalActionInfrastructureCallsCompartmentEditPart.VISUAL_ID: |
| 330 | return new InternalActionInfrastructureCallsCompartmentEditPart( |
| 331 | view); |
| 332 | |
| 333 | case InfrastructureCallInfrastructureCallInputVariableUsagesEditPart.VISUAL_ID: |
| 334 | return new InfrastructureCallInfrastructureCallInputVariableUsagesEditPart( |
| 335 | view); |
| 336 | |
| 337 | case VariableUsageVariableCharacterisation5EditPart.VISUAL_ID: |
| 338 | return new VariableUsageVariableCharacterisation5EditPart(view); |
| 339 | |
| 340 | case BranchActionBranchTransitionCompartmentEditPart.VISUAL_ID: |
| 341 | return new BranchActionBranchTransitionCompartmentEditPart(view); |
| 342 | |
| 343 | case ResourceDemandingBehaviourBehaviourCompartment2EditPart.VISUAL_ID: |
| 344 | return new ResourceDemandingBehaviourBehaviourCompartment2EditPart( |
| 345 | view); |
| 346 | |
| 347 | case ExternalCallActionInputVariableUsage2EditPart.VISUAL_ID: |
| 348 | return new ExternalCallActionInputVariableUsage2EditPart(view); |
| 349 | |
| 350 | case ExternalCallActionOutputVariableUsage2EditPart.VISUAL_ID: |
| 351 | return new ExternalCallActionOutputVariableUsage2EditPart(view); |
| 352 | |
| 353 | case EmitEventActionInputVariableUsageEvent2EditPart.VISUAL_ID: |
| 354 | return new EmitEventActionInputVariableUsageEvent2EditPart(view); |
| 355 | |
| 356 | case ForkActionForkedBehavioursEditPart.VISUAL_ID: |
| 357 | return new ForkActionForkedBehavioursEditPart(view); |
| 358 | |
| 359 | case ForkedBehaviourBehaviourCompartmentEditPart.VISUAL_ID: |
| 360 | return new ForkedBehaviourBehaviourCompartmentEditPart(view); |
| 361 | |
| 362 | case ResourceDemandingBehaviourBehaviourCompartment3EditPart.VISUAL_ID: |
| 363 | return new ResourceDemandingBehaviourBehaviourCompartment3EditPart( |
| 364 | view); |
| 365 | |
| 366 | case RecoveryActionRecoveryBlockCompartmentEditPart.VISUAL_ID: |
| 367 | return new RecoveryActionRecoveryBlockCompartmentEditPart(view); |
| 368 | |
| 369 | case RecoveryActionBehaviourAlternativeBehaviourCompartmentEditPart.VISUAL_ID: |
| 370 | return new RecoveryActionBehaviourAlternativeBehaviourCompartmentEditPart( |
| 371 | view); |
| 372 | |
| 373 | case SetVariableActionVariableSetterEditPart.VISUAL_ID: |
| 374 | return new SetVariableActionVariableSetterEditPart(view); |
| 375 | |
| 376 | case VariableUsageVariableCharacterisation3EditPart.VISUAL_ID: |
| 377 | return new VariableUsageVariableCharacterisation3EditPart(view); |
| 378 | |
| 379 | case SynchronisationPointSynchronisationPointEditPart.VISUAL_ID: |
| 380 | return new SynchronisationPointSynchronisationPointEditPart( |
| 381 | view); |
| 382 | |
| 383 | case ForkedBehaviourSynchronisationPointForkedBehavioursEditPart.VISUAL_ID: |
| 384 | return new ForkedBehaviourSynchronisationPointForkedBehavioursEditPart( |
| 385 | view); |
| 386 | |
| 387 | case ResourceDemandingBehaviourBehaviourCompartment4EditPart.VISUAL_ID: |
| 388 | return new ResourceDemandingBehaviourBehaviourCompartment4EditPart( |
| 389 | view); |
| 390 | |
| 391 | case BranchActionBranchTransitionCompartment2EditPart.VISUAL_ID: |
| 392 | return new BranchActionBranchTransitionCompartment2EditPart( |
| 393 | view); |
| 394 | |
| 395 | case InternalActionResourceDemand2EditPart.VISUAL_ID: |
| 396 | return new InternalActionResourceDemand2EditPart(view); |
| 397 | |
| 398 | case InternalActionFailureOccurrenceDescriptions2EditPart.VISUAL_ID: |
| 399 | return new InternalActionFailureOccurrenceDescriptions2EditPart( |
| 400 | view); |
| 401 | |
| 402 | case InternalActionInfrastructureCallsCompartment2EditPart.VISUAL_ID: |
| 403 | return new InternalActionInfrastructureCallsCompartment2EditPart( |
| 404 | view); |
| 405 | |
| 406 | case SetVariableActionVariableSetter2EditPart.VISUAL_ID: |
| 407 | return new SetVariableActionVariableSetter2EditPart(view); |
| 408 | |
| 409 | case ForkActionForkedBehaviours2EditPart.VISUAL_ID: |
| 410 | return new ForkActionForkedBehaviours2EditPart(view); |
| 411 | |
| 412 | case RecoveryActionRecoveryBlockCompartment2EditPart.VISUAL_ID: |
| 413 | return new RecoveryActionRecoveryBlockCompartment2EditPart(view); |
| 414 | |
| 415 | case AbstractActionSuccessor_AbstractActionEditPart.VISUAL_ID: |
| 416 | return new AbstractActionSuccessor_AbstractActionEditPart(view); |
| 417 | |
| 418 | case RecoveryActionBehaviourFailureHandlingAlternatives__RecoveryActionBehaviourEditPart.VISUAL_ID: |
| 419 | return new RecoveryActionBehaviourFailureHandlingAlternatives__RecoveryActionBehaviourEditPart( |
| 420 | view); |
| 421 | |
| 422 | } |
| 423 | } |
| 424 | return createUnrecognizedEditPart(context, model); |
| 425 | } |
| 426 | |
| 427 | /** |
| 428 | * @generated |
| 429 | */ |
| 430 | private EditPart createUnrecognizedEditPart(EditPart context, Object model) { |
| 431 | // Handle creation of unrecognized child node EditParts here |
| 432 | return null; |
| 433 | } |
| 434 | |
| 435 | /** |
| 436 | * @generated |
| 437 | */ |
| 438 | public static CellEditorLocator getTextCellEditorLocator( |
| 439 | ITextAwareEditPart source) { |
| 440 | if (source.getFigure() instanceof WrappingLabel) |
| 441 | return new TextCellEditorLocator((WrappingLabel) source.getFigure()); |
| 442 | else { |
| 443 | return new LabelCellEditorLocator((Label) source.getFigure()); |
| 444 | } |
| 445 | } |
| 446 | |
| 447 | /** |
| 448 | * @generated |
| 449 | */ |
| 450 | static private class TextCellEditorLocator implements CellEditorLocator { |
| 451 | |
| 452 | /** |
| 453 | * @generated |
| 454 | */ |
| 455 | private WrappingLabel wrapLabel; |
| 456 | |
| 457 | /** |
| 458 | * @generated |
| 459 | */ |
| 460 | public TextCellEditorLocator(WrappingLabel wrapLabel) { |
| 461 | this.wrapLabel = wrapLabel; |
| 462 | } |
| 463 | |
| 464 | /** |
| 465 | * @generated |
| 466 | */ |
| 467 | public WrappingLabel getWrapLabel() { |
| 468 | return wrapLabel; |
| 469 | } |
| 470 | |
| 471 | /** |
| 472 | * @generated |
| 473 | */ |
| 474 | public void relocate(CellEditor celleditor) { |
| 475 | Text text = (Text) celleditor.getControl(); |
| 476 | Rectangle rect = getWrapLabel().getTextBounds().getCopy(); |
| 477 | getWrapLabel().translateToAbsolute(rect); |
| 478 | if (getWrapLabel().isTextWrapOn() |
| 479 | && getWrapLabel().getText().length() > 0) { |
| 480 | rect.setSize(new Dimension(text.computeSize(rect.width, |
| 481 | SWT.DEFAULT))); |
| 482 | } else { |
| 483 | int avr = FigureUtilities.getFontMetrics(text.getFont()) |
| 484 | .getAverageCharWidth(); |
| 485 | rect.setSize(new Dimension(text.computeSize(SWT.DEFAULT, |
| 486 | SWT.DEFAULT)).expand(avr * 2, 0)); |
| 487 | } |
| 488 | if (!rect.equals(new Rectangle(text.getBounds()))) { |
| 489 | text.setBounds(rect.x, rect.y, rect.width, rect.height); |
| 490 | } |
| 491 | } |
| 492 | |
| 493 | } |
| 494 | |
| 495 | /** |
| 496 | * @generated |
| 497 | */ |
| 498 | private static class LabelCellEditorLocator implements CellEditorLocator { |
| 499 | |
| 500 | /** |
| 501 | * @generated |
| 502 | */ |
| 503 | private Label label; |
| 504 | |
| 505 | /** |
| 506 | * @generated |
| 507 | */ |
| 508 | public LabelCellEditorLocator(Label label) { |
| 509 | this.label = label; |
| 510 | } |
| 511 | |
| 512 | /** |
| 513 | * @generated |
| 514 | */ |
| 515 | public Label getLabel() { |
| 516 | return label; |
| 517 | } |
| 518 | |
| 519 | /** |
| 520 | * @generated |
| 521 | */ |
| 522 | public void relocate(CellEditor celleditor) { |
| 523 | Text text = (Text) celleditor.getControl(); |
| 524 | Rectangle rect = getLabel().getTextBounds().getCopy(); |
| 525 | getLabel().translateToAbsolute(rect); |
| 526 | int avr = FigureUtilities.getFontMetrics(text.getFont()) |
| 527 | .getAverageCharWidth(); |
| 528 | rect.setSize(new Dimension(text.computeSize(SWT.DEFAULT, |
| 529 | SWT.DEFAULT)).expand(avr * 2, 0)); |
| 530 | if (!rect.equals(new Rectangle(text.getBounds()))) { |
| 531 | text.setBounds(rect.x, rect.y, rect.width, rect.height); |
| 532 | } |
| 533 | } |
| 534 | } |
| 535 | } |