Package com.dubture.composer.ui.dialogs

Examples of com.dubture.composer.ui.dialogs.ScriptDialog


    manager.add(editAction);
    manager.add(removeAction);
  }
 
  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);
      }
    }
   
    if (diag.open() == Dialog.OK) {
      composerPackage.getScripts().getAsArray(diag.getEvent()).add(diag.getHandler());
      refresh();
    }
  }
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();
        if (!handler.equalsIgnoreCase(text)) {
          JsonArray events = composerPackage.getScripts().getAsArray(event);
          events.replace(text, handler);
        }
      }
View Full Code Here

TOP

Related Classes of com.dubture.composer.ui.dialogs.ScriptDialog

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.