Package scripting

Examples of scripting.Script


          public void handleEvent(Event event) {
            Point point = new Point(event.x, event.y);
            final TreeItem item = checkboxTreeViewer.getTree()
                .getItem(point);
            if (item != null) {
              Script s = (Script) item.getData();
             
              if(!createNewTab(s)) {
                return;
              }
              showTab(s);
            }
          }

          private void showTab(final Script s) {
            curEditor.setText(s.getScript());
            buildTextModifyListener(s);
          }

          private void buildTextModifyListener(final Script s) {
            //TODO modified listener for rsyntaxtextarea
            /*curTextBox.addExtendedModifyListener(new ExtendedModifyListener(){

              @Override
              public void modifyText(ExtendedModifyEvent event) {
                CTabItem currentTab = tabs.getSelection();
                if(!currentTab.getText().startsWith("*")){
                  currentTab.setText("*"+currentTab.getText());
                }
               
               
              }});*/
          }

          private boolean createNewTab(Script s) {
            for(CTabItem c : tabs.getItems()){
              if(c.getData().equals(s)){
                //changeTab(c);
                return false;
              }
            }
            CTabItem newItem = new CTabItem(tabs, SWT.CLOSE);
            newItem.setData(s);
            newItem.setText(s.getReference().getName());
            newItem.addDisposeListener(new DisposeListener(){

              @Override
              public void widgetDisposed(DisposeEvent e) {
                if(tabs.getItemCount() == 0){
                  disableTopBar();
                }
               
              }

              private void disableTopBar() {
                combo.setEnabled(false);
                tltmSave.setEnabled(false);
                tltmCut.setEnabled(false);
                tltmCopy.setEnabled(false);
                tltmPaste.setEnabled(false);
               
              }});
                       
            Composite comp = new Composite(tabs, SWT.EMBEDDED | SWT.NO_BACKGROUND);
              ScriptEditor se = new ScriptEditor(comp, s);
              curEditor = se;
            newItem.setControl(comp);
           
            changeTab(newItem);
            //st.setFont(SWTResourceManager.getFont("Courier New", 9,  SWT.NORMAL));
            //buildTabStyler(s, st);
            enableTopBar(tltmSave, tltmCut, tltmCopy, tltmPaste);
            return true;
          }
/*
          private void buildTabStyler(Script s, final StyledText st) {
            final LineStyler styler = stylers.get(s.getScriptType());
            st.addLineStyleListener(styler);
           
            st.addKeyListener(new KeyListener() {

              @Override
              public void keyPressed(KeyEvent e) {
                styler.parseBlockComments(st.getText());
                if ((e.stateMask & SWT.CTRL) != 0) {
                  switch (e.keyCode) {
                  case 'a':
                    curTextBox.selectAll();
                    break;
                  case 's':
                    save();
                    break;
                  case 'z':
                    //undo();
                    break;
                  case 'y':
                    //redo();
                    break;
                  }
                }
               
              }

              @Override
              public void keyReleased(KeyEvent e) {

              }
            });
          }*/
        });
   
    checkboxTreeViewer.addCheckStateListener(new ICheckStateListener() {

      @Override
      public void checkStateChanged(CheckStateChangedEvent event) {
        Script s = (Script) event.getElement();
        s.setInUse(event.getChecked());

      }
    });
  }
View Full Code Here


            "modified_script_name.js",
            new ValidFileName());
        if(d.open() == Window.OK){
          for(TreeItem t : tree.getSelection()){
            for(Script s : ScriptManager.scripts){
              Script fScript = (Script)t.getData();
              if(s.getReference().equals(fScript.getReference())){
                fScript.getReference().renameTo(new File("./scripts/"+d.getValue()));
              }
            }
          }
        }
      }
View Full Code Here

   */
  private void enableTopBar(final ToolItem tltmSave, final ToolItem tltmCut,
      final ToolItem tltmCopy, final ToolItem tltmPaste) {
    //curTextBox = (StyledText) tabs.getSelection().getControl();
    combo.setEnabled(true);
    Script s = (Script)tabs.getSelection().getData();
    curScript = s;
    updateFunctionList();
    tltmSave.setEnabled(true);
    tltmCut.setEnabled(true);
    tltmCopy.setEnabled(true);
View Full Code Here

TOP

Related Classes of scripting.Script

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.