org.eclipse.swt.widgets.Text#isDisposed ( )源码实例Demo

下面列出了org.eclipse.swt.widgets.Text#isDisposed ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: APICloud-Studio   文件: FindBarEntriesHelper.java
/**
 * Set the items available in the text (and ask it to ignore any changes while that's done).
 */
private void setTextText(Text text, IStartEndIgnore modifyListener, List<String> items)
{
	modifyListener.startIgnore();
	try
	{
		if (!text.isDisposed() && !CollectionsUtil.isEmpty(items))
		{
			if (ObjectUtil.areNotEqual(items.get(0), text.getText()))
			{
				text.setText(items.get(0));
			}
			text.setForeground(null);
		}
	}
	finally
	{
		modifyListener.endIgnore();
	}
}
 
源代码2 项目: birt   文件: BookMarkExpressionPage.java
private void refreshMessage( )
{
	Text text = bookMarkSection.getExpressionControl( ).getTextControl( );
	if ( text != null && !text.isDisposed( ) )
	{
		boolean isHidden = noteSection.getTextControl( ).isVisible( );
		if ( !validateBookMark( text.getText( ).trim( ) ) )
		{
			noteSection.setHidden( false );
		}
		else
		{
			noteSection.setHidden( true );
		}
		if ( noteSection.getTextControl( ).isVisible( ) != isHidden )
		{
			FormWidgetFactory.getInstance( ).paintFormStyle( container );
			FormWidgetFactory.getInstance( ).adapt( container );
			container.layout( true );
			container.redraw( );
		}
	}
}
 
/**
 * Someone changed something in the labels, update the active node
 */
private void getNodeLabelsFromView() {

  if ( activeNode != null ) {
    if ( monitorLabels ) {
      // System.out.println( "Labels changed! " + new Date().getTime() + " found " + wNodeLabels.nrNonEmpty() + " labels" );

      java.util.List<String> labels = new ArrayList<>();
      for ( int i = 0; i < wNodeLabels.nrNonEmpty(); i++ ) {
        labels.add( wNodeLabels.getNonEmpty( i ).getText( 1 ) );
      }

      TableEditor editor = wNodeLabels.getEditor();
      if ( editor != null && editor.getEditor() != null && ( editor.getEditor() instanceof Text ) ) {
        Text text = (Text) editor.getEditor();
        if ( !text.isDisposed() ) {
          if ( !labels.contains( text.getText() ) ) {
            labels.add( text.getText() );
          }
          // System.out.println( "editor content : " + text.getText() );
        }
      }

      activeNode.setLabels( labels );
      // System.out.println( "Set " + activeNode.getLabels().size() + " labels on active node" );
    }
  }
}
 
源代码4 项目: gama   文件: GamlSearchField.java
/**
 * Checks if the text or shell has focus. If not, closes the shell.
 *
 * @param table
 *            the shell's table
 * @param text
 *            the search text field
 */
protected void checkFocusLost(final Table table, final Text text) {
	if (!shell.isDisposed() && !table.isDisposed() && !text.isDisposed()) {
		if (table.getDisplay().getActiveShell() == table.getShell()) {
			// If the user selects the trim shell, leave focus on the text
			// so shell stays open
			text.setFocus();
			return;
		}
		if (!shell.isFocusControl() && !table.isFocusControl() && !text.isFocusControl()) {
			quickAccessContents.doClose();
		}
	}
}
 
@Override
public boolean performOk() {
	if (lstText != null) {
		LinkedHashMap<String, String> mapField = new LinkedHashMap<String, String>();
		for (Text txt : lstText) {
			if (!txt.isDisposed()) {
				mapField.put(TextUtil.stringToXML((String) txt.getData()), TextUtil.stringToXML(txt.getText()).trim());
			}
		}
		projCfgBean.setMapField(mapField);
	}

	if (lstCombo != null) {
		LinkedHashMap<String, Object[]> mapAttr = new LinkedHashMap<String, Object[]>();
		for (Combo cmb : lstCombo) {
			if (!cmb.isDisposed()) {
				ArrayList<String> lstAttrValue = new ArrayList<String>();
				for (String attrVal : cmb.getItems()) {
					lstAttrValue.add(TextUtil.stringToXML(attrVal));
				}
				mapAttr.put(TextUtil.stringToXML((String) cmb.getData()),
						new Object[] { TextUtil.stringToXML(cmb.getText()), lstAttrValue });
			}
		}
		projCfgBean.setMapAttr(mapAttr);
	}
	return super.performOk();
}
 
/**
 * 获取项目字段集合
 * @return key 为字段名称,value 为字段值
 */
public LinkedHashMap<String, String> getFieldMap() {
	LinkedHashMap<String, String> mapField = new LinkedHashMap<String, String>();
	if (lstText != null) {
		for (Text txt : lstText) {
			if (!txt.isDisposed()) {
				mapField.put(TextUtil.stringToXML((String) txt.getData()), TextUtil.stringToXML(txt.getText()).trim());
			}
		}
	}
	return mapField;
}
 
源代码7 项目: XPagesExtensionLibrary   文件: WizardUtils.java
public static String getTextValue(final Text txt, final String defVal) {
    if ((txt == null) || (txt.isDisposed())) {
        return defVal;
    }
    
    return (txt.getText());
}
 
源代码8 项目: tmxeditor8   文件: ProjectSettingBaseInfoPage.java
@Override
public boolean performOk() {
	if (lstText != null) {
		LinkedHashMap<String, String> mapField = new LinkedHashMap<String, String>();
		for (Text txt : lstText) {
			if (!txt.isDisposed()) {
				mapField.put(TextUtil.stringToXML((String) txt.getData()), TextUtil.stringToXML(txt.getText()).trim());
			}
		}
		projCfgBean.setMapField(mapField);
	}

	if (lstCombo != null) {
		LinkedHashMap<String, Object[]> mapAttr = new LinkedHashMap<String, Object[]>();
		for (Combo cmb : lstCombo) {
			if (!cmb.isDisposed()) {
				ArrayList<String> lstAttrValue = new ArrayList<String>();
				for (String attrVal : cmb.getItems()) {
					lstAttrValue.add(TextUtil.stringToXML(attrVal));
				}
				mapAttr.put(TextUtil.stringToXML((String) cmb.getData()),
						new Object[] { TextUtil.stringToXML(cmb.getText()), lstAttrValue });
			}
		}
		projCfgBean.setMapAttr(mapAttr);
	}
	return super.performOk();
}
 
源代码9 项目: tmxeditor8   文件: NewProjectWizardProjInfoPage.java
/**
 * 获取项目字段集合
 * @return key 为字段名称,value 为字段值
 */
public LinkedHashMap<String, String> getFieldMap() {
	LinkedHashMap<String, String> mapField = new LinkedHashMap<String, String>();
	if (lstText != null) {
		for (Text txt : lstText) {
			if (!txt.isDisposed()) {
				mapField.put(TextUtil.stringToXML((String) txt.getData()), TextUtil.stringToXML(txt.getText()).trim());
			}
		}
	}
	return mapField;
}
 
源代码10 项目: RepDev   文件: SymitarSession.java
/**
 * Helper method for runRepGen stuff
 * @param progress
 * @param value
 * @param text
 * @param str
 */
protected void setProgress(ProgressBar progress, int value, Text text, String str){
	if( progress != null && !progress.isDisposed() )
		progress.setSelection(value);

	if( text != null && str != null && !text.isDisposed())
		text.setText(str.replace("\r", "\n"));
}
 
源代码11 项目: birt   文件: PropertyBindingPage.java
public boolean performOk( )
{
	for ( int i = 0; i < propList.size( ); i++ )
	{
		try
		{
			String value = null;
			Text propertyText = (Text) propertyTextList.get( i );
			
			if ( !propertyText.isDisposed( )
					&& propertyText.getText( ) != null
					&& propertyText.getText( ).trim( ).length( ) > 0 )
			{
				value = propertyText.getText( ).trim( );
			}
			Expression expr = new Expression( value,
					(String) propertyText.getData( DataUIConstants.EXPR_TYPE ) );
			
			if ( ds instanceof DesignElementHandle )
			{
				if ( propList.get( i ) instanceof String[] )
				{
					( (DesignElementHandle) ds ).setPropertyBinding( ( (String[]) propList.get( i ) )[0],
							expr );
				}
				else if ( propList.get( i ) instanceof Property )
				{
					( (DesignElementHandle) ds ).setPropertyBinding( ( (Property) propList.get( i ) ).getName( ),
							expr );
				}
			}
		}
		catch ( Exception e )
		{
			logger.log( Level.FINE, e.getMessage( ), e );
			ExceptionHandler.handle( e );
			return true;
		}
	}
	return super.performOk( );
}
 
源代码12 项目: pentaho-kettle   文件: JobHistoryDelegate.java
private void showLogEntry() {
  JobHistoryLogTab model = models[tabFolder.getSelectionIndex()];

  Text text = model.logDisplayText;

  if ( text == null || text.isDisposed() ) {
    return;
  }

  List<Object[]> list = model.rows;

  if ( list == null || list.size() == 0 ) {
    String message;
    if ( model.logTable.isDefined() ) {
      message = BaseMessages.getString( PKG, "JobHistory.PleaseRefresh.Message" );
    } else {
      message = BaseMessages.getString( PKG, "JobHistory.HistoryConfiguration.Message" );
    }
    text.setText( message );
    return;
  }

  // grab the selected line in the table:
  int nr = model.logDisplayTableView.table.getSelectionIndex();
  if ( nr >= 0 && nr < list.size() ) {
    // OK, grab this one from the buffer...
    Object[] row = list.get( nr );

    // What is the name of the log field?
    //
    LogTableField logField = model.logTable.getLogField();
    if ( logField != null ) {
      int index = model.logTableFields.indexOf( logField );
      if ( index >= 0 ) {
        String logText = row[index].toString();

        text.setText( Const.NVL( logText, "" ) );

        text.setSelection( text.getText().length() );
        text.showSelection();
      } else {
        text.setText( BaseMessages.getString( PKG, "JobHistory.HistoryConfiguration.NoLoggingFieldDefined" ) );
      }
    }
  }
}
 
源代码13 项目: pentaho-kettle   文件: TransHistoryDelegate.java
private void showLogEntry() {
  TransHistoryLogTab model = models[tabFolder.getSelectionIndex()];

  Text text = model.logDisplayText;

  if ( text == null || text.isDisposed() ) {
    return;
  }

  List<Object[]> list = model.rows;

  if ( list == null || list.size() == 0 ) {
    String message;
    if ( model.logTable.isDefined() ) {
      message = BaseMessages.getString( PKG, "TransHistory.PleaseRefresh.Message" );
    } else {
      message = BaseMessages.getString( PKG, "TransHistory.HistoryConfiguration.Message" );
    }
    text.setText( message );
    return;
  }

  // grab the selected line in the table:
  int nr = model.logDisplayTableView.table.getSelectionIndex();
  if ( nr >= 0 && nr < list.size() ) {
    // OK, grab this one from the buffer...
    Object[] row = list.get( nr );

    // What is the name of the log field?
    //
    LogTableField logField = model.logTable.getLogField();
    if ( logField != null ) {
      int index = model.logTableFields.indexOf( logField );
      if ( index >= 0 ) {
        String logText = row[index].toString();

        text.setText( Const.NVL( logText, "" ) );

        text.setSelection( text.getText().length() );
        text.showSelection();
      } else {
        text.setText( BaseMessages.getString( PKG, "TransHistory.HistoryConfiguration.NoLoggingFieldDefined" ) );
      }
    }
  }
}