Package org.eclipse.swt.custom

Examples of org.eclipse.swt.custom.TableEditor


    }
    for (int i = 0; i < 3; i++) {
      TableItem item = new TableItem(table, SWT.NONE);
      item.setText(new String[] { "" + i, "" + i, "" + i });
    }
    final TableEditor editor = new TableEditor(table);
    editor.horizontalAlignment = SWT.LEFT;
    editor.grabHorizontal = true;
    table.addListener(SWT.MouseDown, new Listener() {
      public void handleEvent(Event event) {
        Rectangle clientArea = table.getClientArea();
        Point pt = new Point(event.x, event.y);
        int index = table.getTopIndex();
        while (index < table.getItemCount()) {
          boolean visible = false;
          final TableItem item = table.getItem(index);
          for (int i = 0; i < table.getColumnCount(); i++) {
            Rectangle rect = item.getBounds(i);
            if (rect.contains(pt)) {
              final int column = i;
              final Text text = new Text(table, SWT.NONE);
              Listener textListener = new Listener() {
                public void handleEvent(final Event e) {
                  switch (e.type) {
                  case SWT.FocusOut:
                    item.setText(column, text.getText());
                    text.dispose();
                    break;
                  case SWT.Traverse:
                    switch (e.detail) {
                    case SWT.TRAVERSE_RETURN:
                      item
                          .setText(column, text
                              .getText());
                    //FALL THROUGH
                    case SWT.TRAVERSE_ESCAPE:
                      text.dispose();
                      e.doit = false;
                    }
                    break;
                  }
                }
              };
              text.addListener(SWT.FocusOut, textListener);
              text.addListener(SWT.Traverse, textListener);
              editor.setEditor(text, item, i);
              text.setText(item.getText(i));
              text.selectAll();
              text.setFocus();
              return;
            }
View Full Code Here


        .getResourceString("page2.package.caption"));
       
        namespace2packageTable.setVisible(true);
       
        // add the table editor
        final TableEditor editor = new TableEditor(namespace2packageTable);
        namespace2packageTable.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
          // Clean up any previous editor control
          Control oldEditor = editor.getEditor();
          if (oldEditor != null) oldEditor.dispose();
     
          // Identify the selected row
          TableItem item = (TableItem)e.item;
          if (item == null) return;
     
          // The control that will be the editor must be a child of the Table
          Text newEditor = new Text(namespace2packageTable, SWT.NONE);
          newEditor.setText(item.getText(EDITABLECOLUMN));
          newEditor.addModifyListener(new ModifyListener() {
            public void modifyText(ModifyEvent me) {
              Text text = (Text)editor.getEditor();
              editor.getItem().setText(EDITABLECOLUMN, text.getText());
            }
          });
          newEditor.selectAll();
          newEditor.setFocus();
          editor.setEditor(newEditor, item, EDITABLECOLUMN);
        }
      });
       
        //adjust the width
        //adjustColumnWidth(namespace2packageTable);
View Full Code Here

        // menu.setVisible (true);
        table.setMenu(menu);
      }
    });
   
    editor = new TableEditor(table);
    editor.horizontalAlignment = SWT.LEFT;
      editor.grabHorizontal = true;
      editor.minimumWidth = 50;
     
    table.addMouseListener(new MouseListener() {
View Full Code Here

  private boolean multiline;
 
  public EditListener(Table table, boolean edit){
    this.table = table;
    this.edit = edit;
    editor = new TableEditor(table);
    editor.horizontalAlignment = SWT.LEFT;
    editor.grabHorizontal = true;
  }
View Full Code Here

  }
  public EditListener(Table table, boolean edit, boolean multiline){
    this.table = table;
    this.edit = edit;
    this.multiline = multiline;
    editor = new TableEditor(table);
    editor.horizontalAlignment = SWT.LEFT;
    editor.grabHorizontal = true;
  }
View Full Code Here

        gridData.widthHint = 200;
        gridData.minimumWidth = 200;
        aliasesTable.setLayoutData( gridData );

        // Aliases Table Editor
        tableEditor = new TableEditor( aliasesTable );
        tableEditor.horizontalAlignment = SWT.LEFT;
        tableEditor.grabHorizontal = true;
        tableEditor.minimumWidth = 200;

        // Add Button
View Full Code Here

          tableColumnY.setWidth(width - tableColumnX.getWidth());
        }
      }
    });

    editorX = new TableEditor(coordinatesTable);
    // The editor must have the same size as the cell and must
    // not be any smaller than 50 pixels.
    editorX.horizontalAlignment = SWT.LEFT;
    editorX.grabHorizontal = true;
    editorX.minimumWidth = 50;

    editorY = new TableEditor(coordinatesTable);
    // The editor must have the same size as the cell and must
    // not be any smaller than 50 pixels.
    editorY.horizontalAlignment = SWT.LEFT;
    editorY.grabHorizontal = true;
    editorY.minimumWidth = 50;
View Full Code Here

          }
        } else {
          SchedulerTableItem.this.progressBar = new ProgressBar(table, SWT.NONE);
        }

        SchedulerTableItem.this.tableEditor = new TableEditor(table);
        SchedulerTableItem.this.tableEditor.grabHorizontal = true;
        SchedulerTableItem.this.tableEditor.grabVertical = true;
        SchedulerTableItem.this.tableEditor.setEditor(
          SchedulerTableItem.this.progressBar,
          SchedulerTableItem.this.tableItem,
View Full Code Here

          public void run() {
            Table table = (Table) progressBar.getParent();
            SchedulerTableItem.this.progressBar.dispose();
            SchedulerTableItem.this.progressBar = new ProgressBar(table, SWT.NONE);
            SchedulerTableItem.this.progressBar.setSelection(progressBar.getMinimum());
            SchedulerTableItem.this.tableEditor = new TableEditor(table);
            SchedulerTableItem.this.tableEditor.grabHorizontal = true;
            SchedulerTableItem.this.tableEditor.grabVertical = true;
            SchedulerTableItem.this.tableEditor.setEditor(
              SchedulerTableItem.this.progressBar,
              SchedulerTableItem.this.tableItem,
View Full Code Here

      }
    });
    cancelButton.setBounds(416, 486, 78, 23);
    cancelButton.setText(ApplicationResources.getString("SpreadInspector.17")); //$NON-NLS-1$
    //
    valueEditorActive = new TableEditor(this.activatedConcepts);
    valueEditorRelations = new TableEditor(this.relationsWeight);
   
    activatedConcepts.addSelectionListener (new SelectionAdapter() {
      public void widgetSelected(SelectionEvent e) {

        // Clean up any previous editor control
View Full Code Here

TOP

Related Classes of org.eclipse.swt.custom.TableEditor

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.