1 11 12 package org.eclipse.pde.internal.ui.editor.cheatsheet.simple; 13 14 import java.io.IOException ; 15 import java.io.PrintWriter ; 16 import java.io.StringWriter ; 17 18 import org.eclipse.jface.action.IMenuManager; 19 import org.eclipse.jface.action.MenuManager; 20 import org.eclipse.jface.action.Separator; 21 import org.eclipse.jface.action.ToolBarManager; 22 import org.eclipse.jface.fieldassist.ControlDecoration; 23 import org.eclipse.jface.fieldassist.FieldDecorationRegistry; 24 import org.eclipse.jface.viewers.ISelection; 25 import org.eclipse.jface.viewers.IStructuredSelection; 26 import org.eclipse.jface.viewers.StructuredSelection; 27 import org.eclipse.jface.viewers.TreeViewer; 28 import org.eclipse.pde.core.IModelChangedEvent; 29 import org.eclipse.pde.internal.core.icheatsheet.simple.ISimpleCS; 30 import org.eclipse.pde.internal.core.icheatsheet.simple.ISimpleCSConstants; 31 import org.eclipse.pde.internal.core.icheatsheet.simple.ISimpleCSIntro; 32 import org.eclipse.pde.internal.core.icheatsheet.simple.ISimpleCSItem; 33 import org.eclipse.pde.internal.core.icheatsheet.simple.ISimpleCSModel; 34 import org.eclipse.pde.internal.core.icheatsheet.simple.ISimpleCSObject; 35 import org.eclipse.pde.internal.core.icheatsheet.simple.ISimpleCSRunContainerObject; 36 import org.eclipse.pde.internal.core.icheatsheet.simple.ISimpleCSSubItem; 37 import org.eclipse.pde.internal.core.icheatsheet.simple.ISimpleCSSubItemObject; 38 import org.eclipse.pde.internal.ui.PDEPlugin; 39 import org.eclipse.pde.internal.ui.PDEUIMessages; 40 import org.eclipse.pde.internal.ui.editor.PDEFormPage; 41 import org.eclipse.pde.internal.ui.editor.TreeSection; 42 import org.eclipse.pde.internal.ui.editor.actions.CollapseAction; 43 import org.eclipse.pde.internal.ui.editor.cheatsheet.ICSDetails; 44 import org.eclipse.pde.internal.ui.editor.cheatsheet.ICSMaster; 45 import org.eclipse.pde.internal.ui.editor.cheatsheet.simple.actions.SimpleCSAddStepAction; 46 import org.eclipse.pde.internal.ui.editor.cheatsheet.simple.actions.SimpleCSAddSubStepAction; 47 import org.eclipse.pde.internal.ui.editor.cheatsheet.simple.actions.SimpleCSRemoveRunObjectAction; 48 import org.eclipse.pde.internal.ui.editor.cheatsheet.simple.actions.SimpleCSRemoveStepAction; 49 import org.eclipse.pde.internal.ui.editor.cheatsheet.simple.actions.SimpleCSRemoveSubStepAction; 50 import org.eclipse.pde.internal.ui.parts.TreePart; 51 import org.eclipse.swt.SWT; 52 import org.eclipse.swt.events.DisposeEvent; 53 import org.eclipse.swt.events.DisposeListener; 54 import org.eclipse.swt.graphics.Cursor; 55 import org.eclipse.swt.widgets.Button; 56 import org.eclipse.swt.widgets.Composite; 57 import org.eclipse.swt.widgets.Display; 58 import org.eclipse.swt.widgets.ToolBar; 59 import org.eclipse.ui.IEditorInput; 60 import org.eclipse.ui.actions.ActionFactory; 61 import org.eclipse.ui.cheatsheets.OpenCheatSheetAction; 62 import org.eclipse.ui.forms.IDetailsPage; 63 import org.eclipse.ui.forms.widgets.FormToolkit; 64 import org.eclipse.ui.forms.widgets.Section; 65 66 70 public class SimpleCSMasterTreeSection extends TreeSection implements 71 ICSMaster { 72 73 private static final int F_BUTTON_ADD_STEP = 0; 74 75 private static final int F_BUTTON_ADD_SUBSTEP = 1; 76 77 private static final int F_BUTTON_REMOVE = 2; 78 79 private static final int F_BUTTON_UP = 3; 80 81 private static final int F_BUTTON_DOWN = 4; 82 83 private static final int F_BUTTON_PREVIEW = 5; 84 85 private static final int F_UP_FLAG = -1; 86 87 private static final int F_DOWN_FLAG = 1; 88 89 private TreeViewer fTreeViewer; 90 91 private ISimpleCSModel fModel; 92 93 private SimpleCSAddStepAction fAddStepAction; 94 95 private SimpleCSRemoveStepAction fRemoveStepAction; 96 97 private SimpleCSRemoveSubStepAction fRemoveSubStepAction; 98 99 private SimpleCSAddSubStepAction fAddSubStepAction; 100 101 private SimpleCSRemoveRunObjectAction fRemoveRunObjectAction; 102 103 private CollapseAction fCollapseAction; 104 105 private ControlDecoration fSubStepInfoDecoration; 106 107 113 public SimpleCSMasterTreeSection(PDEFormPage formPage, Composite parent) { 114 super(formPage, parent, Section.DESCRIPTION, new String [] { 115 PDEUIMessages.SimpleCSElementSection_0, 116 PDEUIMessages.SimpleCSElementSection_6, 117 PDEUIMessages.SimpleCSElementSection_7, 118 PDEUIMessages.SimpleCSElementSection_1, 119 PDEUIMessages.SimpleCSElementSection_2, 120 PDEUIMessages.SimpleCSElementSection_3}); 121 getSection().setText(PDEUIMessages.SimpleCSElementSection_4); 122 getSection().setDescription(PDEUIMessages.SimpleCSElementSection_5); 123 124 fAddStepAction = new SimpleCSAddStepAction(); 126 fRemoveStepAction = new SimpleCSRemoveStepAction(); 127 fRemoveSubStepAction = new SimpleCSRemoveSubStepAction(); 128 fAddSubStepAction = new SimpleCSAddSubStepAction(); 129 fRemoveRunObjectAction = new SimpleCSRemoveRunObjectAction(); 130 fCollapseAction = null; 131 } 132 133 134 137 protected void createClient(Section section, FormToolkit toolkit) { 138 fModel = (ISimpleCSModel)getPage().getModel(); 140 141 Composite container = createClientContainer(section, 2, toolkit); 142 createTree(container, toolkit); 143 toolkit.paintBordersFor(container); 144 section.setClient(container); 145 initializeTreeViewer(); 146 createSectionToolbar(section, toolkit); 147 } 148 149 153 private void createSectionToolbar(Section section, FormToolkit toolkit) { 154 155 ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT); 156 ToolBar toolbar = toolBarManager.createControl(section); 157 final Cursor handCursor = new Cursor(Display.getCurrent(), SWT.CURSOR_HAND); 158 toolbar.setCursor(handCursor); 159 toolbar.addDisposeListener(new DisposeListener() { 161 public void widgetDisposed(DisposeEvent e) { 162 if ((handCursor != null) && 163 (handCursor.isDisposed() == false)) { 164 handCursor.dispose(); 165 } 166 } 167 }); 168 fCollapseAction = new CollapseAction(fTreeViewer, 170 PDEUIMessages.ExtensionsPage_collapseAll, 171 1, 172 fModel.getSimpleCS()); 173 toolBarManager.add(fCollapseAction); 174 175 toolBarManager.update(true); 176 177 section.setTextClient(toolbar); 178 } 179 180 183 private void initializeTreeViewer() { 184 185 if (fModel == null) { 186 return; 187 } 188 fTreeViewer.setInput(fModel); 189 190 getTreePart().setButtonEnabled(F_BUTTON_ADD_STEP, fModel.isEditable()); 191 getTreePart().setButtonEnabled(F_BUTTON_ADD_SUBSTEP, false); 193 getTreePart().setButtonEnabled(F_BUTTON_REMOVE, false); 195 getTreePart().setButtonEnabled(F_BUTTON_UP, false); 197 getTreePart().setButtonEnabled(F_BUTTON_DOWN, false); 199 getTreePart().setButtonEnabled(F_BUTTON_PREVIEW, true); 200 201 ISimpleCS cheatsheet = fModel.getSimpleCS(); 202 fTreeViewer.setSelection(new StructuredSelection(cheatsheet), true); 204 fTreeViewer.expandToLevel(2); 205 } 206 207 211 private void createTree(Composite container, FormToolkit toolkit) { 212 TreePart treePart = getTreePart(); 213 createViewerPartControl(container, SWT.SINGLE, 2, toolkit); 214 fTreeViewer = treePart.getTreeViewer(); 215 fTreeViewer.setContentProvider(new SimpleCSContentProvider()); 216 fTreeViewer.setLabelProvider(PDEPlugin.getDefault().getLabelProvider()); 217 PDEPlugin.getDefault().getLabelProvider().connect(this); 218 createTreeListeners(); 219 createSubStepInfoDecoration(); 220 } 221 222 225 private void createSubStepInfoDecoration() { 226 Button button = getStructuredViewerPart().getButton(F_BUTTON_ADD_SUBSTEP); 228 int bits = SWT.TOP | SWT.RIGHT; 229 fSubStepInfoDecoration = new ControlDecoration(button, bits); 230 fSubStepInfoDecoration.setMarginWidth(0); 231 updateSubStepInfoDecoration(false, false, false); 232 fSubStepInfoDecoration.setImage( 233 FieldDecorationRegistry.getDefault().getFieldDecoration( 234 FieldDecorationRegistry.DEC_INFORMATION).getImage()); 235 } 236 237 242 private void updateSubStepInfoDecoration(boolean show, 243 boolean itemHasNoExecutable, boolean itemIsNotOptional) { 244 if (show) { 246 fSubStepInfoDecoration.show(); 247 if (itemHasNoExecutable == false) { 248 fSubStepInfoDecoration.setDescriptionText(PDEUIMessages.SimpleCSMasterTreeSection_msgButtonDisabledCommand); 249 } else if (itemIsNotOptional == false){ 250 fSubStepInfoDecoration.setDescriptionText(PDEUIMessages.SimpleCSMasterTreeSection_msgButtonDisabledOptional); 251 } 252 } else { 253 fSubStepInfoDecoration.hide(); 254 } 255 fSubStepInfoDecoration.setShowHover(show); 256 } 257 258 259 262 private void createTreeListeners() { 263 fTreeViewer.addPostSelectionChangedListener( 266 getPage().getPDEEditor().new PDEFormEditorChangeListener()); 267 } 268 269 272 public ISelection getSelection() { 273 return fTreeViewer.getSelection(); 274 } 275 276 279 protected void buttonSelected(int index) { 280 switch (index) { 281 case F_BUTTON_ADD_STEP: 282 handleAddStepAction(); 283 break; 284 case F_BUTTON_ADD_SUBSTEP: 285 handleAddSubStepAction(); 286 break; 287 case F_BUTTON_REMOVE: 288 handleDeleteAction(); 289 break; 290 case F_BUTTON_UP: 291 handleMoveStepAction(F_UP_FLAG); 292 break; 293 case F_BUTTON_DOWN: 294 handleMoveStepAction(F_DOWN_FLAG); 295 break; 296 case F_BUTTON_PREVIEW: 297 handlePreviewAction(); 298 break; 299 } 300 } 301 302 305 protected void selectionChanged(IStructuredSelection selection) { 306 updateButtons(); 307 } 308 309 312 public void updateButtons() { 313 if (!fModel.isEditable()) { 314 return; 315 } 316 ISimpleCSObject csObject = getCurrentSelection(); 317 318 boolean canAddItem = false; 319 boolean canAddSubItem = false; 320 boolean canRemove = false; 321 boolean canMoveUp = false; 322 boolean canMoveDown = false; 323 324 boolean itemHasNoExecutable = false; 325 boolean itemIsNotOptional = false; 326 boolean showDecoration = false; 327 328 if (csObject != null) { 329 330 if (csObject.getType() == ISimpleCSConstants.TYPE_CHEAT_SHEET) { 331 canAddItem = true; 333 } else if (csObject.getType() == ISimpleCSConstants.TYPE_INTRO) { 334 canAddItem = true; 337 } else if (csObject.getType() == ISimpleCSConstants.TYPE_ITEM) { 338 ISimpleCSItem item = (ISimpleCSItem)csObject; 339 if (item.getSimpleCS().isFirstItem(item) == false) { 340 canMoveUp = true; 341 } 342 if (item.getSimpleCS().isLastItem(item) == false) { 343 canMoveDown = true; 344 } 345 346 if (item.getSimpleCS().getItemCount() > 1) { 349 canRemove = true; 350 } 351 352 itemHasNoExecutable = (item.getExecutable() == null); 359 itemIsNotOptional = (item.getSkip() == false); 360 if (itemHasNoExecutable && itemIsNotOptional) { 361 canAddSubItem = true; 362 } 363 showDecoration = (canAddSubItem == false); 364 canAddItem = true; 366 367 } else if (csObject.getType() == ISimpleCSConstants.TYPE_SUBITEM) { 368 ISimpleCSSubItem subitem = (ISimpleCSSubItem)csObject; 369 ISimpleCSObject parent = subitem.getParent(); 370 if (parent.getType() == ISimpleCSConstants.TYPE_ITEM) { 371 ISimpleCSItem item = (ISimpleCSItem)parent; 372 if (item.isFirstSubItem(subitem) == false) { 373 canMoveUp = true; 374 } 375 if (item.isLastSubItem(subitem) == false) { 376 canMoveDown = true; 377 } 378 itemHasNoExecutable = (item.getExecutable() == null); 385 itemIsNotOptional = (item.getSkip() == false); 386 if (itemHasNoExecutable && itemIsNotOptional) { 387 canAddSubItem = true; 388 } 389 showDecoration = (canAddSubItem == false); 390 } 391 canRemove = true; 392 393 } else if ((csObject.getType() == ISimpleCSConstants.TYPE_REPEATED_SUBITEM) || 394 (csObject.getType() == ISimpleCSConstants.TYPE_CONDITIONAL_SUBITEM) || 395 (csObject.getType() == ISimpleCSConstants.TYPE_PERFORM_WHEN) || 396 (csObject.getType() == ISimpleCSConstants.TYPE_ACTION) || 397 (csObject.getType() == ISimpleCSConstants.TYPE_COMMAND)) { 398 canRemove = true; 402 } 403 404 updateSubStepInfoDecoration(showDecoration, itemHasNoExecutable, 405 itemIsNotOptional); 406 } 407 408 getTreePart().setButtonEnabled(F_BUTTON_ADD_STEP, canAddItem); 409 getTreePart().setButtonEnabled(F_BUTTON_ADD_SUBSTEP, canAddSubItem); 410 getTreePart().setButtonEnabled(F_BUTTON_REMOVE, canRemove); 411 getTreePart().setButtonEnabled(F_BUTTON_UP, canMoveUp); 412 getTreePart().setButtonEnabled(F_BUTTON_DOWN, canMoveDown); 413 } 414 415 418 private void handleAddStepAction() { 419 ISimpleCSObject csObject = getCurrentSelection(); 421 if (csObject == null) { 423 fAddStepAction.setDataObject(fModel.getSimpleCS()); 424 } else { 425 fAddStepAction.setDataObject(csObject); 426 } 427 fAddStepAction.run(); 429 } 430 431 434 private ISimpleCSObject getCurrentSelection() { 435 ISelection selection = fTreeViewer.getSelection(); 436 Object object = ((IStructuredSelection) selection).getFirstElement(); 437 return (ISimpleCSObject)object; 438 } 439 440 443 private void handleAddSubStepAction() { 444 ISimpleCSObject csObject = getCurrentSelection(); 446 if (csObject == null) { 448 return; 449 } 450 fAddSubStepAction.setDataObject(csObject); 452 fAddSubStepAction.run(); 454 } 455 456 459 private void handleMoveStepAction(int positionFlag) { 460 ISimpleCSObject object = getCurrentSelection(); 461 if (object != null) { 462 if (object instanceof ISimpleCSItem) { 463 ISimpleCSItem item = (ISimpleCSItem)object; 464 item.getSimpleCS().moveItem(item, positionFlag); 465 } else if (object instanceof ISimpleCSSubItem) { 466 ISimpleCSSubItem subitem = (ISimpleCSSubItem)object; 467 ISimpleCSObject parent = subitem.getParent(); 469 if (parent.getType() == ISimpleCSConstants.TYPE_ITEM) { 470 ISimpleCSItem item = (ISimpleCSItem)parent; 471 item.moveSubItem(subitem, positionFlag); 472 } 473 } 474 } 475 } 476 477 480 private void handlePreviewAction() { 481 IEditorInput input = getPage().getEditorInput(); 485 try { 486 StringWriter swriter = new StringWriter (); 488 PrintWriter writer = new PrintWriter (swriter); 489 fModel.getSimpleCS().write("", writer); writer.flush(); 491 swriter.close(); 492 OpenCheatSheetAction openAction = new OpenCheatSheetAction( 495 input.getName(), 496 input.getName(), 497 swriter.toString(), 498 null); 499 openAction.run(); 500 } catch (IOException e) { 501 PDEPlugin.logException(e); 502 } 503 } 504 505 508 public void modelChanged(IModelChangedEvent event) { 509 511 if (event.getChangeType() == IModelChangedEvent.WORLD_CHANGED) { 512 handleModelEventWorldChanged(event); 513 } else if (event.getChangeType() == IModelChangedEvent.INSERT) { 514 handleModelInsertType(event); 515 } else if (event.getChangeType() == IModelChangedEvent.REMOVE) { 516 handleModelRemoveType(event); 517 } else if (event.getChangeType() == IModelChangedEvent.CHANGE) { 518 handleModelChangeType(event); 519 } 520 } 521 522 525 private void handleModelEventWorldChanged(IModelChangedEvent event) { 526 527 Object [] objects = event.getChangedObjects(); 528 ISimpleCSObject object = (ISimpleCSObject) objects[0]; 529 if (object == null) { 530 return; 532 } else if (object.getType() == ISimpleCSConstants.TYPE_CHEAT_SHEET) { 533 SimpleCSPage page = (SimpleCSPage)getPage(); 535 IDetailsPage previousDetailsPage = 537 page.getBlock().getDetailsPart().getCurrentPage(); 538 fModel = ((ISimpleCS)object).getModel(); 541 fTreeViewer.setInput(fModel); 543 initializeTreeViewer(); 545 IDetailsPage currentDetailsPage = 547 page.getBlock().getDetailsPart().getCurrentPage(); 548 if (currentDetailsPage.equals(previousDetailsPage) && 553 currentDetailsPage instanceof ICSDetails) { 554 ((ICSDetails)currentDetailsPage).updateFields(); 555 } 556 } 557 558 } 559 560 563 private void handleModelInsertType(IModelChangedEvent event) { 564 Object [] objects = event.getChangedObjects(); 566 ISimpleCSObject object = (ISimpleCSObject) objects[0]; 567 if (object == null) { 568 } else if ((object.getType() == ISimpleCSConstants.TYPE_ITEM) 570 || (object.getType() == ISimpleCSConstants.TYPE_SUBITEM)) { 571 fTreeViewer.refresh(object.getParent()); 573 fTreeViewer.setSelection(new StructuredSelection(object), true); 575 } 576 } 577 578 581 private void handleModelRemoveType(IModelChangedEvent event) { 582 Object [] objects = event.getChangedObjects(); 584 ISimpleCSObject object = (ISimpleCSObject) objects[0]; 585 if (object == null) { 586 } else if (object.getType() == ISimpleCSConstants.TYPE_ITEM) { 588 fTreeViewer.remove(object); 590 ISimpleCSObject csObject = fRemoveStepAction.getObjectToSelect(); 592 if (csObject == null) { 593 csObject = object.getParent(); 594 } 595 fTreeViewer.setSelection(new StructuredSelection(csObject), true); 596 } else if (object.getType() == ISimpleCSConstants.TYPE_SUBITEM) { 597 fTreeViewer.remove(object); 599 ISimpleCSObject csObject = fRemoveSubStepAction.getObjectToSelect(); 601 if (csObject == null) { 602 csObject = object.getParent(); 603 } 604 fTreeViewer.setSelection(new StructuredSelection(csObject), true); 605 } else if ((object.getType() == ISimpleCSConstants.TYPE_CONDITIONAL_SUBITEM) 606 || (object.getType() == ISimpleCSConstants.TYPE_REPEATED_SUBITEM) 607 || (object.getType() == ISimpleCSConstants.TYPE_PERFORM_WHEN)) { 608 fTreeViewer.remove(object); 610 fTreeViewer.setSelection( 612 new StructuredSelection(object.getParent()), true); 613 } 614 } 615 616 619 private void handleModelChangeType(IModelChangedEvent event) { 620 Object [] objects = event.getChangedObjects(); 622 ISimpleCSObject object = (ISimpleCSObject)objects[0]; 623 if (object == null) { 624 } else if ((object.getType() == ISimpleCSConstants.TYPE_ITEM) 626 || (object.getType() == ISimpleCSConstants.TYPE_SUBITEM) 627 || (object.getType() == ISimpleCSConstants.TYPE_CHEAT_SHEET)) { 628 fTreeViewer.update(object, null); 630 } 631 } 632 633 636 public void fireSelection() { 637 fTreeViewer.setSelection(fTreeViewer.getSelection()); 638 } 639 640 643 protected void fillContextMenu(IMenuManager manager) { 644 ISimpleCSObject csObject = getCurrentSelection(); 646 MenuManager submenu = new MenuManager(PDEUIMessages.Menus_new_label); 648 manager.add(submenu); 650 if ((csObject == null) || 651 (csObject.getType() == ISimpleCSConstants.TYPE_CHEAT_SHEET)) { 652 fAddStepAction.setDataObject(fModel.getSimpleCS()); 655 fAddStepAction.setEnabled(fModel.isEditable()); 656 submenu.add(fAddStepAction); 657 } else if (csObject.getType() == ISimpleCSConstants.TYPE_ITEM) { 658 ISimpleCSItem item = (ISimpleCSItem)csObject; 659 fAddSubStepAction.setDataObject(csObject); 662 if ((item.getExecutable() == null) && 669 (item.getSkip() == false)) { 670 fAddSubStepAction.setEnabled(fModel.isEditable()); 671 } else { 672 fAddSubStepAction.setEnabled(false); 673 } 674 submenu.add(fAddSubStepAction); 675 manager.add(new Separator()); 678 fRemoveStepAction.setItem((ISimpleCSItem)csObject); 680 if (item.getSimpleCS().getItemCount() > 1) { 683 fRemoveStepAction.setEnabled(fModel.isEditable()); 684 } else { 685 fRemoveStepAction.setEnabled(false); 686 } 687 manager.add(fRemoveStepAction); 688 } else if ((csObject.getType() == ISimpleCSConstants.TYPE_SUBITEM) || 689 (csObject.getType() == ISimpleCSConstants.TYPE_REPEATED_SUBITEM) || 690 (csObject.getType() == ISimpleCSConstants.TYPE_CONDITIONAL_SUBITEM)) { 691 manager.add(new Separator()); 694 fRemoveSubStepAction.setSubItem((ISimpleCSSubItemObject)csObject); 696 fRemoveSubStepAction.setEnabled(fModel.isEditable()); 697 manager.add(fRemoveSubStepAction); 698 } else if ((csObject.getType() == ISimpleCSConstants.TYPE_PERFORM_WHEN) || 699 (csObject.getType() == ISimpleCSConstants.TYPE_ACTION) || 700 (csObject.getType() == ISimpleCSConstants.TYPE_COMMAND)) { 701 manager.add(new Separator()); 706 fRemoveRunObjectAction.setRunObject((ISimpleCSRunContainerObject)csObject); 708 fRemoveRunObjectAction.setEnabled(fModel.isEditable()); 709 manager.add(fRemoveRunObjectAction); 710 } 711 } 716 717 720 public boolean doGlobalAction(String actionId) { 721 if (actionId.equals(ActionFactory.DELETE.getId())) { 722 handleDeleteAction(); 723 return true; 724 } 725 return false; 726 } 727 728 731 private void handleDeleteAction() { 732 ISimpleCSObject object = getCurrentSelection(); 733 if (object != null) { 734 if (object instanceof ISimpleCSItem) { 735 ISimpleCSItem item = (ISimpleCSItem)object; 736 if (item.getSimpleCS().getItemCount() > 1) { 739 fRemoveStepAction.setItem(item); 740 fRemoveStepAction.run(); 741 } else { 742 Display.getCurrent().beep(); 744 } 745 } else if (object instanceof ISimpleCSSubItemObject) { 746 fRemoveSubStepAction.setSubItem((ISimpleCSSubItemObject)object); 747 fRemoveSubStepAction.run(); 748 } else if (object instanceof ISimpleCSRunContainerObject) { 749 fRemoveRunObjectAction.setRunObject((ISimpleCSRunContainerObject)object); 752 fRemoveRunObjectAction.run(); 753 } else if (object instanceof ISimpleCS) { 754 Display.getCurrent().beep(); 759 } else if (object instanceof ISimpleCSIntro) { 760 Display.getCurrent().beep(); 765 } 766 } 767 } 768 769 772 public boolean setFormInput(Object object) { 773 if (object instanceof ISimpleCSObject) { 777 fTreeViewer.setSelection(new StructuredSelection(object), true); 779 ISelection selection = fTreeViewer.getSelection(); 781 if ((selection != null) && 782 (selection.isEmpty() == false)) { 783 return true; 784 } 785 } 786 return false; 787 } 788 789 } 790 | Popular Tags |