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


Java FocusEvent类代码示例

本文整理汇总了Java中org.eclipse.swt.events.FocusEvent的典型用法代码示例。如果您正苦于以下问题:Java FocusEvent类的具体用法?Java FocusEvent怎么用?Java FocusEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: open

import org.eclipse.swt.events.FocusEvent; //导入依赖的package包/类
/**
 * Activates the editor at the given position.
 * 
 * @param row
 * @param col
 * @param rect
 */
public void open(KTable table, int col, int row, Rectangle rect) {
  m_Table = table;
  m_Model = table.getModel();
  m_Rect = rect;
  m_Row = row;
  m_Col = col;
  if (m_Control == null) {
    m_Control = createControl();
    m_Control.setToolTipText(toolTip);
    m_Control.addFocusListener(new FocusAdapter() {
      public void focusLost(FocusEvent arg0) {
        close(true);
      }
    });
  }
  setBounds(m_Rect);
  GC gc = new GC(m_Table);
  m_Table.drawCell(gc, m_Col, m_Row);
  gc.dispose();
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:28,代码来源:KTableCellEditor.java

示例2: createViewer

import org.eclipse.swt.events.FocusEvent; //导入依赖的package包/类
protected  SourceViewer createViewer (Composite composite) {
	SourceViewer viewer = ViewerHelper.createEditor(composite);	
	viewer.getControl().setData(WIDGET_ID, WIDGET_ACTION_SCRIPT);
	FocusListener listener = new FocusListener() {
		@Override
		public void focusGained(FocusEvent e) {
		}

		@Override
		public void focusLost(FocusEvent event) {
			if (!notification) return;
            if (viewer.getDocument() == null) return;
            String content  = viewer.getDocument().get();
            getProperties().setPropertyValue(ModelProperties.PROPERTY_EDGE_ACTION, content);

		}
	};
	viewer.getControl().addFocusListener(listener);
	return viewer;
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:21,代码来源:EdgeActionSection.java

示例3: createViewer

import org.eclipse.swt.events.FocusEvent; //导入依赖的package包/类
protected  SourceViewer createViewer (Composite composite) {
	SourceViewer viewer = ViewerHelper.createEditor(composite);	
	viewer.getControl().setData(WIDGET_ID, WIDGET_GUARD_SCRIPT);
	FocusListener listener = new FocusListener() {
		@Override
		public void focusGained(FocusEvent e) {
		}

		@Override
		public void focusLost(FocusEvent event) {
			if (!notification) return;
            if (viewer.getDocument() == null) return;
            String content  = viewer.getDocument().get();
            getProperties().setPropertyValue(ModelProperties.PROPERTY_EDGE_GUARD, content);
		}
	};
	viewer.getControl().addFocusListener(listener);
	return viewer;		
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:20,代码来源:EdgeGuardSection.java

示例4: focusLost

import org.eclipse.swt.events.FocusEvent; //导入依赖的package包/类
@Override
public void focusLost(FocusEvent e) {
	if (!notification)
		return;
	GW4EVertexEditPartProperties properties = (GW4EVertexEditPartProperties) sectionProvider
			.getAdapter(IPropertySource.class);

	txtSharedNameDecorator.hide();

	String value = textSharedName.getText();
	if (value == null || value.trim().length() == 0) {
		txtSharedNameDecorator.show();
		return;
	}
	
	properties.setPropertyValue(ModelProperties.PROPERTY_VERTEX_SHAREDNAME,value);
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:18,代码来源:VertexDefaultSection.java

示例5: focusLost

import org.eclipse.swt.events.FocusEvent; //导入依赖的package包/类
public void focusLost(FocusEvent e) {
    if (e.getSource() == this.minimumRangeValue) {
        // verify min value
        if (! validateMinimum( this.minimumRangeValue.getText()))
            this.minimumRangeValue.setText(String.valueOf(
                    this.minimumValue));
        else
            this.minimumValue = Double.parseDouble(
                    this.minimumRangeValue.getText());
    }
    else if (e.getSource() == this.maximumRangeValue) {
        // verify max value
        if (! validateMaximum(this.maximumRangeValue.getText()))
            this.maximumRangeValue.setText(String.valueOf(
                    this.maximumValue));
        else
            this.maximumValue = Double.parseDouble(
                    this.maximumRangeValue.getText());
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:21,代码来源:SWTNumberAxisEditor.java

示例6: focusLost

import org.eclipse.swt.events.FocusEvent; //导入依赖的package包/类
public void focusLost(FocusEvent e) {
    if (e.getSource() == this.minimumRangeValue) {
        // verify min value
        if (!validateMinimum(this.minimumRangeValue.getText()))
            this.minimumRangeValue.setText(String.valueOf(
                    this.minimumValue));
        else
            this.minimumValue = Double.parseDouble(
                    this.minimumRangeValue.getText());
    }
    else if (e.getSource() == this.maximumRangeValue) {
        // verify max value
        if (!validateMaximum(this.maximumRangeValue.getText()))
            this.maximumRangeValue.setText(String.valueOf(
                    this.maximumValue));
        else
            this.maximumValue = Double.parseDouble(
                    this.maximumRangeValue.getText());
    }
}
 
开发者ID:mdzio,项目名称:ccu-historian,代码行数:21,代码来源:SWTNumberAxisEditor.java

示例7: focusGained

import org.eclipse.swt.events.FocusEvent; //导入依赖的package包/类
@Override
public void focusGained(final FocusEvent e) {
    if (!(e.widget instanceof Text)) {
        return;
    }

    final Text text = (Text) e.widget;

    final Boolean b = (Boolean) text.getData(DECORATED_KEY);
    if (b != null) {
        if (b.booleanValue()) {
            final ModifyListener modifyListener = (ModifyListener) text.getData(MODIFY_LISTENER_KEY);
            if (modifyListener != null) {
                text.removeModifyListener(modifyListener);
            }
            text.setForeground(null);
            text.setText(""); //$NON-NLS-1$
            if (modifyListener != null) {
                text.addModifyListener(modifyListener);
            }
        }

        text.setData(DECORATED_KEY, Boolean.FALSE);
    }
}
 
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:26,代码来源:WITSearchDialog.java

示例8: focusGained

import org.eclipse.swt.events.FocusEvent; //导入依赖的package包/类
@Override
public void focusGained(final FocusEvent e) {
    final Text text = (Text) e.widget;

    final Boolean addedDecoration = (Boolean) e.widget.getData(HISTORY_TEXT_DECORATION_KEY);
    if (addedDecoration == null || !addedDecoration.booleanValue()) {
        return;
    }

    final ModifyListener modifyListener = (ModifyListener) text.getData(UPDATE_WORK_ITEM_LISTENER_KEY);
    text.removeModifyListener(modifyListener);
    text.setText(""); //$NON-NLS-1$
    text.addModifyListener(modifyListener);

    // Mac hack: grow to at least 60px so that the scroll bar displays
    // properly
    if (WindowSystem.isCurrentWindowSystem(WindowSystem.AQUA)) {
        ((GridData) text.getLayoutData()).heightHint = 70;
        text.getParent().layout(true);
    }

    e.widget.setData(HISTORY_TEXT_DECORATION_KEY, null);
}
 
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:24,代码来源:WorkItemHistoryControl.java

示例9: focusLost

import org.eclipse.swt.events.FocusEvent; //导入依赖的package包/类
@Override
public void focusLost(final FocusEvent e) {
    final Text text = (Text) e.widget;

    if (text.getText().trim().length() != 0) {
        return;
    }

    final Boolean addedDecoration = (Boolean) e.widget.getData(HISTORY_TEXT_DECORATION_KEY);
    if (addedDecoration != null && addedDecoration.booleanValue()) {
        return;
    }

    final ModifyListener modifyListener = (ModifyListener) text.getData(UPDATE_WORK_ITEM_LISTENER_KEY);
    text.removeModifyListener(modifyListener);
    text.setText(DECORATION_TEXT);
    text.addModifyListener(modifyListener);

    e.widget.setData(HISTORY_TEXT_DECORATION_KEY, Boolean.valueOf(true));
}
 
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:21,代码来源:WorkItemHistoryControl.java

示例10: edit

import org.eclipse.swt.events.FocusEvent; //导入依赖的package包/类
private void edit(final TableItem item, final TableEditor tableEditor) {
    final Text text = new Text(table, SWT.NONE);
    text.setText(item.getText(targetColumn));

    text.addFocusListener(new FocusAdapter() {

        @Override
        public void focusLost(final FocusEvent e) {
            item.setText(targetColumn, text.getText());
            text.dispose();
        }

    });

    tableEditor.setEditor(text, item, targetColumn);
    text.setFocus();
    text.selectAll();
}
 
开发者ID:roundrop,项目名称:ermasterr,代码行数:19,代码来源:ModelPropertiesDialog.java

示例11: edit

import org.eclipse.swt.events.FocusEvent; //导入依赖的package包/类
private void edit(final TableItem item, final TableEditor tableEditor) {
	final Text text = new Text(table, SWT.NONE);
	text.setText(item.getText(targetColumn));

	text.addFocusListener(new FocusAdapter() {

		@Override
		public void focusLost(FocusEvent e) {
			item.setText(targetColumn, text.getText());
			text.dispose();
		}

	});

	tableEditor.setEditor(text, item, targetColumn);
	text.setFocus();
	text.selectAll();
}
 
开发者ID:kozake,项目名称:ermaster-k,代码行数:19,代码来源:ModelPropertiesDialog.java

示例12: focusGained

import org.eclipse.swt.events.FocusEvent; //导入依赖的package包/类
@Override
public void focusGained(FocusEvent e) {
	Control c = (Control) e.getSource();
	ServiceInstance service = (ServiceInstance) c.getData();

	Rectangle bounds = service.getAppxLocation(); // child.getBounds();
	Rectangle area = scrollComp.getClientArea();
	Point origin = scrollComp.getOrigin();

	// Our view is lower than the item
	if (origin.y > bounds.y) {
		origin.y = Math.max(0, bounds.y);
	}

	// Our view is above the item
	if (origin.y + area.height < bounds.y + bounds.height) {
		origin.y = Math.max(0, bounds.y + bounds.height - area.height);
	}

	scrollComp.setOrigin(origin);
}
 
开发者ID:eclipse,项目名称:cft,代码行数:22,代码来源:CloudFoundryServiceWizardPageRightPanel.java

示例13: focusChanged

import org.eclipse.swt.events.FocusEvent; //导入依赖的package包/类
private void focusChanged(FocusEvent e)
{
	Control control = fControl;
	if (Helper.okToUse(control))
	{
		Display d = control.getDisplay();
		if (d != null)
		{
			d.asyncExec(new Runnable()
			{
				public void run()
				{
					if (!fProposalPopup.hasFocus()
							&& (fContextInfoPopup == null || !fContextInfoPopup.hasFocus()))
					{
						hide();
					}
				}
			});
		}
	}
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:23,代码来源:ContentAssistant.java

示例14: focusLost

import org.eclipse.swt.events.FocusEvent; //导入依赖的package包/类
/**
 * @see org.eclipse.swt.events.FocusListener#focusLost(org.eclipse.swt.events.FocusEvent)
 */
public void focusLost(FocusEvent e) {
    if (association.getName().equals(labelTextName.getText())) {
        return;
    }

    DomainUtil.run(new TransactionalAction() {
        /**
         * @see nexcore.tool.uml.manager.transaction.TransactionalAction#doExecute()
         */
        @Override
        public void doExecute() {
            association.setName(labelTextName.getText());
        }
    });
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:19,代码来源:AssociationGeneralSection.java

示例15: focusLost

import org.eclipse.swt.events.FocusEvent; //导入依赖的package包/类
/**
 * @see org.eclipse.swt.events.FocusListener#focusLost(org.eclipse.swt.events.FocusEvent)
 */
public void focusLost(FocusEvent e) {
    String text = multiplicityCombo.getText();

    try {
        final int value = new Integer(text).intValue();
        final Property property = this.getData();
        if (value > 0) {

            DomainUtil.run(new TransactionalAction() {
                @Override
                public void doExecute() {
                    property.setLower(value);
                    property.setUpper(value);
                }
            });
        }
    } catch (Exception e2) {
        // TODO: handle exception
    }

}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:25,代码来源:MultiplicityGeneralSection.java


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