当前位置: 首页>>代码示例>>Java>>正文


Java StyledTextComp.getCaretOffset方法代码示例

本文整理汇总了Java中org.pentaho.di.ui.core.widget.StyledTextComp.getCaretOffset方法的典型用法代码示例。如果您正苦于以下问题:Java StyledTextComp.getCaretOffset方法的具体用法?Java StyledTextComp.getCaretOffset怎么用?Java StyledTextComp.getCaretOffset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.pentaho.di.ui.core.widget.StyledTextComp的用法示例。


在下文中一共展示了StyledTextComp.getCaretOffset方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setPosition

import org.pentaho.di.ui.core.widget.StyledTextComp; //导入方法依赖的package包/类
public void setPosition(){
	
	StyledTextComp wScript = getStyledTextComp();
	String scr = wScript.getText();
	int linenr = wScript.getLineAtOffset(wScript.getCaretOffset())+1;
	int posnr  = wScript.getCaretOffset();
	
	
	
	// Go back from position to last CR: how many positions?
	int colnr=0;
	while (posnr>0 && scr.charAt(posnr-1)!='\n' && scr.charAt(posnr-1)!='\r')
	{
		posnr--;
		colnr++;
	}
	wlPosition.setText(Messages.getString("ScriptValuesDialogMod.Position.Label2")+linenr+", "+colnr); //$NON-NLS-1$ //$NON-NLS-2$
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:19,代码来源:ScriptValuesModDialog.java

示例2: setPosition

import org.pentaho.di.ui.core.widget.StyledTextComp; //导入方法依赖的package包/类
public void setPosition(){
	
	StyledTextComp wScript = getStyledTextComp();
	String scr = wScript.getText();
	int linenr = wScript.getLineAtOffset(wScript.getCaretOffset())+1;
	int posnr  = wScript.getCaretOffset();
	
	
	
	// Go back from position to last CR: how many positions?
	int colnr=0;
	while (posnr>0 && scr.charAt(posnr-1)!='\n' && scr.charAt(posnr-1)!='\r')
	{
		posnr--;
		colnr++;
	}
	wlPosition.setText(BaseMessages.getString(PKG, "ScriptDialog.Position.Label2")+linenr+", "+colnr); //$NON-NLS-1$ //$NON-NLS-2$
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:19,代码来源:ScriptDialog.java

示例3: setPosition

import org.pentaho.di.ui.core.widget.StyledTextComp; //导入方法依赖的package包/类
public void setPosition(){
	
	StyledTextComp wScript = getStyledTextComp();
	String scr = wScript.getText();
	int linenr = wScript.getLineAtOffset(wScript.getCaretOffset())+1;
	int posnr  = wScript.getCaretOffset();
	
	
	
	// Go back from position to last CR: how many positions?
	int colnr=0;
	while (posnr>0 && scr.charAt(posnr-1)!='\n' && scr.charAt(posnr-1)!='\r')
	{
		posnr--;
		colnr++;
	}
	wlPosition.setText(BaseMessages.getString(PKG, "ScriptValuesDialogMod.Position.Label2")+linenr+", "+colnr); //$NON-NLS-1$ //$NON-NLS-2$
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:19,代码来源:ScriptValuesModDialog.java

示例4: setPosition

import org.pentaho.di.ui.core.widget.StyledTextComp; //导入方法依赖的package包/类
public void setPosition() {

		StyledTextComp wScript = getStyledTextComp();
		String scr = wScript.getText();
		int linenr = wScript.getLineAtOffset(wScript.getCaretOffset()) + 1;
		int posnr = wScript.getCaretOffset();

		// Go back from position to last CR: how many positions?
		int colnr = 0;
		while (posnr > 0 && scr.charAt(posnr - 1) != '\n' && scr.charAt(posnr - 1) != '\r') {
			posnr--;
			colnr++;
		}
		wlPosition
						.setText(BaseMessages.getString(PKG, "UserDefinedJavaClassDialog.Position.Label2") + linenr + ", " + colnr); //$NON-NLS-1$ //$NON-NLS-2$
	}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:17,代码来源:UserDefinedJavaClassDialog.java

示例5: treeDblClick

import org.pentaho.di.ui.core.widget.StyledTextComp; //导入方法依赖的package包/类
private void treeDblClick(Event event) {
	StyledTextComp wScript = getStyledTextComp();
	Point point = new Point(event.x, event.y);
	TreeItem item = wTree.getItem(point);

	// Qualification where the Click comes from
	if (item != null && item.getParentItem() != null) {
		if (item.getParentItem().equals(wTreeClassesItem)) {
			setActiveCtab(item.getText());
		} else if (!item.getData().equals("Snippit")) {
			int iStart = wScript.getCaretOffset();
			int selCount = wScript.getSelectionCount(); // this selection
			// will be replaced
			// by wScript.insert
			iStart = iStart - selCount; // when a selection is already there
			// we need to subtract the position
			if (iStart < 0) iStart = 0; // just safety
			String strInsert = (String) item.getData();
			wScript.insert(strInsert);
			wScript.setSelection(iStart, iStart + strInsert.length());
		}
	}
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:24,代码来源:UserDefinedJavaClassDialog.java

示例6: setPosition

import org.pentaho.di.ui.core.widget.StyledTextComp; //导入方法依赖的package包/类
public void setPosition(){
	StyledTextComp control = wCondition;
	if(wspecifyQuery.getSelection()) control = wQuery;
	
	String scr = control.getText();
	int linenr = control.getLineAtOffset(control.getCaretOffset())+1;
	int posnr  = control.getCaretOffset();
			
	// Go back from position to last CR: how many positions?
	int colnr=0;
	while (posnr>0 && scr.charAt(posnr-1)!='\n' && scr.charAt(posnr-1)!='\r')
	{
		posnr--;
		colnr++;
	}
	wlPosition.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.Position.Label",""+linenr,""+colnr));

}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:19,代码来源:SalesforceInputDialog.java

示例7: setPosition

import org.pentaho.di.ui.core.widget.StyledTextComp; //导入方法依赖的package包/类
public void setPosition() {
  StyledTextComp control = wCondition;
  if ( wspecifyQuery.getSelection() ) {
    control = wQuery;
  }

  String scr = control.getText();
  int linenr = control.getLineAtOffset( control.getCaretOffset() ) + 1;
  int posnr = control.getCaretOffset();

  // Go back from position to last CR: how many positions?
  int colnr = 0;
  while ( posnr > 0 && scr.charAt( posnr - 1 ) != '\n' && scr.charAt( posnr - 1 ) != '\r' ) {
    posnr--;
    colnr++;
  }
  wlPosition.setText( BaseMessages.getString( PKG, "SalesforceInputDialog.Position.Label", "" + linenr, ""
    + colnr ) );

}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:21,代码来源:SalesforceInputDialog.java

示例8: setPosition

import org.pentaho.di.ui.core.widget.StyledTextComp; //导入方法依赖的package包/类
public void setPosition(){
	
	StyledTextComp wScript = getStyledTextComp();
	String scr = wScript.getText();
	int linenr = wScript.getLineAtOffset(wScript.getCaretOffset())+1;
	int posnr  = wScript.getCaretOffset();
	
	
	
	// Go back from position to last CR: how many positions?
	int colnr=0;
	while (posnr>0 && scr.charAt(posnr-1)!='\n' && scr.charAt(posnr-1)!='\r')
	{
		posnr--;
		colnr++;
	}
	wlPosition.setText(BaseMessages.getString(PKG, "GremlinScriptDialog.Position.Label2")+linenr+", "+colnr);  
}
 
开发者ID:mattyb149,项目名称:pdi-graph-computing,代码行数:19,代码来源:GremlinScriptDialog.java

示例9: setPosition

import org.pentaho.di.ui.core.widget.StyledTextComp; //导入方法依赖的package包/类
public void setPosition() {

    StyledTextComp wScript = getStyledTextComp();
    String scr = wScript.getText();
    int linenr = wScript.getLineAtOffset( wScript.getCaretOffset() ) + 1;
    int posnr = wScript.getCaretOffset();

    // Go back from position to last CR: how many positions?
    int colnr = 0;
    while ( posnr > 0 && scr.charAt( posnr - 1 ) != '\n' && scr.charAt( posnr - 1 ) != '\r' ) {
      posnr--;
      colnr++;
    }
    wlPosition.setText( BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.Position.Label2" )
      + linenr + ", " + colnr );
  }
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:17,代码来源:UserDefinedJavaClassDialog.java

示例10: treeDblClick

import org.pentaho.di.ui.core.widget.StyledTextComp; //导入方法依赖的package包/类
private void treeDblClick(Event event){
	StyledTextComp wScript = getStyledTextComp();
	Point point = new Point(event.x, event.y);
       TreeItem item = wTree.getItem(point);
       
       // Qualifikation where the Click comes from
       if(item !=null && item.getParentItem()!=null){
       	if(item.getParentItem().equals(wTreeScriptsItem)){
       		setActiveCtab(item.getText());
       	}else if(!item.getData().equals("Function")){
       		int iStart = wScript.getCaretOffset();
       		int selCount = wScript.getSelectionCount();  // this selection will be replaced by wScript.insert
       		iStart=iStart-selCount; //when a selection is already there we need to subtract the position
       		if (iStart<0) iStart=0; // just safety
           	String strInsert =(String)item.getData();
           	if(strInsert.equals("jsFunction")) strInsert = (String)item.getText();
           	wScript.insert(strInsert);
           	wScript.setSelection(iStart,iStart+strInsert.length());
       	}
       }
       /*
       if (item != null && item.getParentItem()!=null && !item.getData().equals("Function")) {
       	int iStart = wScript.getCaretOffset();
       	String strInsert =(String)item.getData();
       	if(strInsert.equals("jsFunction")) strInsert = (String)item.getText();
       	wScript.insert(strInsert);
       	wScript.setSelection(iStart,iStart+strInsert.length());
       }*/
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:30,代码来源:ScriptValuesModDialog.java

示例11: treeDblClick

import org.pentaho.di.ui.core.widget.StyledTextComp; //导入方法依赖的package包/类
private void treeDblClick(Event event){
	StyledTextComp wScript = getStyledTextComp();
	Point point = new Point(event.x, event.y);
       TreeItem item = wTree.getItem(point);
       
       // Qualifikation where the Click comes from
       if(item !=null && item.getParentItem()!=null){
       	if(item.getParentItem().equals(wTreeScriptsItem)){
       		setActiveCtab(item.getText());
       	}else if(!item.getData().equals("Function")){
       		int iStart = wScript.getCaretOffset();
       		int selCount = wScript.getSelectionCount();  // this selection will be replaced by wScript.insert
       		iStart=iStart-selCount; //when a selection is already there we need to subtract the position
       		if (iStart<0) iStart=0; // just safety
           	String strInsert =(String)item.getData();
           	if(strInsert.equals("jsFunction")) strInsert = item.getText();
           	wScript.insert(strInsert);
           	wScript.setSelection(iStart,iStart+strInsert.length());
       	}
       }
       /*
       if (item != null && item.getParentItem()!=null && !item.getData().equals("Function")) {
       	int iStart = wScript.getCaretOffset();
       	String strInsert =(String)item.getData();
       	if(strInsert.equals("jsFunction")) strInsert = (String)item.getText();
       	wScript.insert(strInsert);
       	wScript.setSelection(iStart,iStart+strInsert.length());
       }*/
}
 
开发者ID:mattyb149,项目名称:pdi-graph-computing,代码行数:30,代码来源:GremlinScriptDialog.java

示例12: setPosition

import org.pentaho.di.ui.core.widget.StyledTextComp; //导入方法依赖的package包/类
public void setPosition() {

    StyledTextComp wScript = getStyledTextComp();
    String scr = wScript.getText();
    int linenr = wScript.getLineAtOffset( wScript.getCaretOffset() ) + 1;
    int posnr = wScript.getCaretOffset();

    // Go back from position to last CR: how many positions?
    int colnr = 0;
    while ( posnr > 0 && scr.charAt( posnr - 1 ) != '\n' && scr.charAt( posnr - 1 ) != '\r' ) {
      posnr--;
      colnr++;
    }
    wlPosition.setText( BaseMessages.getString( PKG, "ScriptDialog.Position.Label2" ) + linenr + ", " + colnr );
  }
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:16,代码来源:ScriptDialog.java

示例13: treeDblClick

import org.pentaho.di.ui.core.widget.StyledTextComp; //导入方法依赖的package包/类
private void treeDblClick( Event event ) {
  StyledTextComp wScript = getStyledTextComp();
  Point point = new Point( event.x, event.y );
  TreeItem item = wTree.getItem( point );

  // Qualifikation where the Click comes from
  if ( item != null && item.getParentItem() != null ) {
    if ( item.getParentItem().equals( wTreeScriptsItem ) ) {
      setActiveCtab( item.getText() );
    } else if ( !item.getData().equals( "Function" ) ) {
      int iStart = wScript.getCaretOffset();
      int selCount = wScript.getSelectionCount(); // this selection will be replaced by wScript.insert
      iStart = iStart - selCount; // when a selection is already there we need to subtract the position
      if ( iStart < 0 ) {
        iStart = 0; // just safety
      }
      String strInsert = (String) item.getData();
      if ( strInsert.equals( "jsFunction" ) ) {
        strInsert = item.getText();
      }
      wScript.insert( strInsert );
      wScript.setSelection( iStart, iStart + strInsert.length() );
    }
  }
  /*
   * if (item != null && item.getParentItem()!=null && !item.getData().equals("Function")) { int iStart =
   * wScript.getCaretOffset(); String strInsert =(String)item.getData(); if(strInsert.equals("jsFunction")) strInsert
   * = (String)item.getText(); wScript.insert(strInsert); wScript.setSelection(iStart,iStart+strInsert.length()); }
   */
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:31,代码来源:ScriptDialog.java


注:本文中的org.pentaho.di.ui.core.widget.StyledTextComp.getCaretOffset方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。