Package com.dubture.composer.ui.controller

Examples of com.dubture.composer.ui.controller.ScriptsController


    section.setLayoutData(gd);

    Composite container = createClientContainer(section, 2, toolkit);
    createViewerPartControl(container, SWT.SINGLE, 2, toolkit);
    TreePart treePart = getTreePart();
    ScriptsController scriptsController = new ScriptsController();
    scriptsViewer = treePart.getTreeViewer();
    scriptsViewer.setContentProvider(scriptsController);
    scriptsViewer.setLabelProvider(scriptsController);
   
    toolkit.paintBordersFor(container);
View Full Code Here


  private void handleAdd() {
    ScriptDialog diag = new ScriptDialog(scriptsViewer.getTree().getShell());
   
    if (!scriptsViewer.getSelection().isEmpty()) {
      Object element = ((StructuredSelection)scriptsViewer.getSelection()).getFirstElement();
      ScriptsController controller = (ScriptsController)scriptsViewer.getLabelProvider();
      String text = controller.getText(element);
      if (Arrays.asList(Scripts.getEvents()).contains(text)) {
        diag.setEvent(text);
      }
    }
   
View Full Code Here

    }
  }
 
  private void handleEdit() {
    Object element = ((StructuredSelection)scriptsViewer.getSelection()).getFirstElement();
    ScriptsController controller = (ScriptsController)scriptsViewer.getLabelProvider();
    String text = controller.getText(element);
    ScriptDialog diag = new ScriptDialog(scriptsViewer.getTree().getShell());
   
    // edit event
    if (Arrays.asList(Scripts.getEvents()).contains(text)) {
      diag.setEvent(text);
      diag.setHandlerEnabled(false);
      if (diag.open() == Dialog.OK) {
        String event = diag.getEvent();
        if (!event.equalsIgnoreCase(text)) {
          composerPackage.getScripts().set(event,
              composerPackage.getScripts().getAsArray(text));
          composerPackage.getScripts().remove(text);
        }
      }
    }
   
    // edit handler
    else {
      String event = controller.getText(controller.getParent(element));
      diag.setEvent(event);
      diag.setHandler(text);
      diag.setEventEnabled(false);
      if (diag.open() == Dialog.OK) {
        String handler = diag.getHandler();
View Full Code Here

    }
  }
 
  private void handleRemove() {
    Object element = ((StructuredSelection)scriptsViewer.getSelection()).getFirstElement();
    ScriptsController controller = (ScriptsController)scriptsViewer.getLabelProvider();
    String text = controller.getText(element);
   
    // remove event
    if (Arrays.asList(Scripts.getEvents()).contains(text)) {
      MessageDialog diag = new MessageDialog(
        scriptsViewer.getTree().getShell(),
        "Remove Event",
        null,
        "Do you really wan't to remove " + text + "?",
        MessageDialog.WARNING,
        new String[] {"Yes", "No"},
        0);

      if (diag.open() == Dialog.OK) {
        composerPackage.getScripts().remove(text);
      }
    }
   
    // remove handler
    else {
      String event = controller.getText(controller.getParent(element));
     
      MessageDialog diag = new MessageDialog(
          scriptsViewer.getTree().getShell(),
          "Remove Event",
          null,
View Full Code Here

TOP

Related Classes of com.dubture.composer.ui.controller.ScriptsController

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.