Java Code Examples for org.pentaho.di.core.Const#isOSX()

The following examples show how to use org.pentaho.di.core.Const#isOSX() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TransGraph.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public Point getRealPosition( Composite canvas, int x, int y ) {
  Point p = new Point( 0, 0 );
  Composite follow = canvas;
  while ( follow != null ) {
    org.eclipse.swt.graphics.Point loc = follow.getLocation();
    Point xy = new Point( loc.x, loc.y );
    p.x += xy.x;
    p.y += xy.y;
    follow = follow.getParent();
  }

  int offsetX = -16;
  int offsetY = -64;
  if ( Const.isOSX() ) {
    offsetX = -2;
    offsetY = -24;
  }
  p.x = x - p.x + offsetX;
  p.y = y - p.y + offsetY;

  return screen2real( p.x, p.y );
}
 
Example 2
Source File: ExpandedContentManager.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
/**
 * showExpandedContent( TransGraph graph )
 * 
 * @param graph
 *          TransGraph to create the web browser for. If the wev browser hasn't been created this will create one.
 *          Else it will just bring the web browser associated to this TransGraph to the top.
 */
public static void showExpandedContent( TransGraph graph ) {
  if ( graph == null ) {
    return;
  }
  Browser browser = getExpandedContentForTransGraph( graph );
  if ( browser == null ) {
    return;
  }
  if ( !isVisible( graph ) ) {
    maximizeExpandedContent( browser );
  }
  if ( Const.isOSX() && graph.isExecutionResultsPaneVisible() ) {
    graph.extraViewComposite.setVisible( false );
  }
  browser.moveAbove( null );
  browser.getParent().layout( true );
  browser.getParent().redraw();
}
 
Example 3
Source File: GetXMLDataDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
private void setXMLStreamField() {
  try {

    wXMLField.removeAll();

    RowMetaInterface r = transMeta.getPrevStepFields( stepname );
    if ( r != null ) {
      String[] fieldNames = r.getFieldNames();
      if ( fieldNames != null ) {

        for ( int i = 0; i < fieldNames.length; i++ ) {
          wXMLField.add( fieldNames[i] );
        }
      }
    }
  } catch ( KettleException ke ) {
    if ( !Const.isOSX() ) { // see PDI-8871 for details
      shell.setFocus();
    }
    wXMLField.add( EMPTY_FIELDS );
    wXMLField.setText( EMPTY_FIELDS );
    new ErrorDialog( shell, BaseMessages.getString( PKG, "GetXMLDataDialog.FailedToGetFields.DialogTitle" ),
        BaseMessages.getString( PKG, "GetXMLDataDialog.FailedToGetFields.DialogMessage" ), ke );
  }
}
 
Example 4
Source File: PentahoReportingOutput.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public PentahoReportingOutput( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr,
  TransMeta transMeta, Trans trans ) {
  super( stepMeta, stepDataInterface, copyNr, transMeta, trans );

  // To prevent CGLGraphicsConfig.getConfig() hang forever on mac
  if ( Const.isOSX() ) {
    GraphicsEnvironment.getLocalGraphicsEnvironment();
  }
}
 
Example 5
Source File: ConfigurationDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
protected void ok() {
  abstractMeta.setAlwaysShowRunOptions( alwaysShowOption.getSelection() );
  abstractMeta.setShowDialog( alwaysShowOption.getSelection() );
  if ( Const.isOSX() ) {
    // OSX bug workaround.
    wVariables.applyOSXChanges();
    wParams.applyOSXChanges();
  }
  getInfo();
  retval = true;
  dispose();
}
 
Example 6
Source File: ArgumentsDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
protected void ok() {
  if ( Const.isOSX() ) {
    // OSX bug workaround.
    //
    wArguments.applyOSXChanges();
  }
  getInfoArguments();
  dispose();
}
 
Example 7
Source File: BaseStepDialog.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
public static final void positionBottomButtons( Composite composite, Button[] buttons, int margin, int alignment,
                                                 Control lastControl ) {
  // Determine the largest button in the array
  Rectangle largest = null;
  for ( int i = 0; i < buttons.length; i++ ) {
    buttons[ i ].pack( true );
    Rectangle r = buttons[ i ].getBounds();
    if ( largest == null || r.width > largest.width ) {
      largest = r;
    }

    // Also, set the tooltip the same as the name if we don't have one...
    if ( buttons[ i ].getToolTipText() == null ) {
      buttons[ i ].setToolTipText( Const.replace( buttons[ i ].getText(), "&", "" ) );
    }
  }

  // Make buttons a bit larger... (nicer)
  largest.width += 10;
  if ( ( largest.width % 2 ) == 1 ) {
    largest.width++;
  }

  // Compute the left side of the 1st button
  switch ( alignment ) {
    case BUTTON_ALIGNMENT_CENTER:
      centerButtons( buttons, largest.width, margin, lastControl );
      break;
    case BUTTON_ALIGNMENT_LEFT:
      leftAlignButtons( buttons, largest.width, margin, lastControl );
      break;
    case BUTTON_ALIGNMENT_RIGHT:
      rightAlignButtons( buttons, largest.width, margin, lastControl );
      break;
    default:
      break;
  }
  if ( Const.isOSX() ) {
    Shell parentShell = composite.getShell();
    final List<TableView> tableViews = new ArrayList<TableView>();
    getTableViews( parentShell, tableViews );
    for ( final Button button : buttons ) {
      // We know the table views
      // We also know that if a button is hit, the table loses focus
      // In that case, we can apply the content of an open text editor...
      //
      button.addSelectionListener( new SelectionAdapter() {

        public void widgetSelected( SelectionEvent e ) {
          for ( TableView view : tableViews ) {
            view.applyOSXChanges();
          }
        }
      } );
    }
  }
}