Search in sources :

Example 41 with StyledTextComp

use of org.pentaho.di.ui.core.widget.StyledTextComp in project pentaho-kettle by pentaho.

the class UserDefinedJavaClassDialog method buildingFolderMenu.

private void buildingFolderMenu() {
    // styledTextPopupmenu = new Menu(, SWT.POP_UP);
    MenuItem addNewItem = new MenuItem(cMenu, SWT.PUSH);
    addNewItem.setText(BaseMessages.getString(PKG, "UserDefinedJavaClassDialog.AddNewTab"));
    addNewItem.addListener(SWT.Selection, new Listener() {

        public void handleEvent(Event e) {
            addCtab("", "", TabAddActions.ADD_BLANK);
        }
    });
    MenuItem copyItem = new MenuItem(cMenu, SWT.PUSH);
    copyItem.setText(BaseMessages.getString(PKG, "UserDefinedJavaClassDialog.AddCopy"));
    copyItem.addListener(SWT.Selection, new Listener() {

        public void handleEvent(Event e) {
            CTabItem item = folder.getSelection();
            StyledTextComp st = (StyledTextComp) item.getControl();
            addCtab(item.getText(), st.getText(), TabAddActions.ADD_COPY);
        }
    });
    new MenuItem(cMenu, SWT.SEPARATOR);
    MenuItem setActiveScriptItem = new MenuItem(cMenu, SWT.PUSH);
    setActiveScriptItem.setText(BaseMessages.getString(PKG, "UserDefinedJavaClassDialog.SetTransformClass"));
    setActiveScriptItem.addListener(SWT.Selection, new Listener() {

        public void handleEvent(Event e) {
            CTabItem item = folder.getSelection();
            for (int i = 0; i < folder.getItemCount(); i++) {
                if (folder.getItem(i).equals(item)) {
                    if (item.getImage().equals(imageActiveScript)) {
                        strActiveScript = "";
                    }
                    item.setImage(imageActiveScript);
                    strActiveScript = item.getText();
                } else if (folder.getItem(i).getImage().equals(imageActiveScript)) {
                    folder.getItem(i).setImage(imageInactiveScript);
                }
            }
            modifyTabTree(item, TabActions.SET_ACTIVE_ITEM);
        }
    });
    new MenuItem(cMenu, SWT.SEPARATOR);
    MenuItem setRemoveScriptItem = new MenuItem(cMenu, SWT.PUSH);
    setRemoveScriptItem.setText(BaseMessages.getString(PKG, "UserDefinedJavaClassDialog.RemoveClassType"));
    setRemoveScriptItem.addListener(SWT.Selection, new Listener() {

        public void handleEvent(Event e) {
            CTabItem item = folder.getSelection();
            input.setChanged(true);
            if (item.getImage().equals(imageActiveScript)) {
                strActiveScript = "";
            }
            item.setImage(imageInactiveScript);
        }
    });
    folder.setMenu(cMenu);
}
Also used : StyledTextComp(org.pentaho.di.ui.core.widget.StyledTextComp) Listener(org.eclipse.swt.widgets.Listener) ModifyListener(org.eclipse.swt.events.ModifyListener) FocusEvent(org.eclipse.swt.events.FocusEvent) KeyEvent(org.eclipse.swt.events.KeyEvent) ModifyEvent(org.eclipse.swt.events.ModifyEvent) CTabFolderEvent(org.eclipse.swt.custom.CTabFolderEvent) MouseEvent(org.eclipse.swt.events.MouseEvent) DragSourceEvent(org.eclipse.swt.dnd.DragSourceEvent) Event(org.eclipse.swt.widgets.Event) ShellEvent(org.eclipse.swt.events.ShellEvent) SelectionEvent(org.eclipse.swt.events.SelectionEvent) MenuItem(org.eclipse.swt.widgets.MenuItem) CTabItem(org.eclipse.swt.custom.CTabItem)

Aggregations

StyledTextComp (org.pentaho.di.ui.core.widget.StyledTextComp)41 Event (org.eclipse.swt.widgets.Event)28 Listener (org.eclipse.swt.widgets.Listener)28 ModifyEvent (org.eclipse.swt.events.ModifyEvent)27 ModifyListener (org.eclipse.swt.events.ModifyListener)27 ShellEvent (org.eclipse.swt.events.ShellEvent)27 SelectionEvent (org.eclipse.swt.events.SelectionEvent)26 FormAttachment (org.eclipse.swt.layout.FormAttachment)25 FormData (org.eclipse.swt.layout.FormData)25 FormLayout (org.eclipse.swt.layout.FormLayout)25 Button (org.eclipse.swt.widgets.Button)25 Label (org.eclipse.swt.widgets.Label)25 Shell (org.eclipse.swt.widgets.Shell)25 ShellAdapter (org.eclipse.swt.events.ShellAdapter)24 Display (org.eclipse.swt.widgets.Display)24 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)23 FocusEvent (org.eclipse.swt.events.FocusEvent)19 KeyEvent (org.eclipse.swt.events.KeyEvent)19 MouseEvent (org.eclipse.swt.events.MouseEvent)19 Text (org.eclipse.swt.widgets.Text)19