本文整理汇总了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();
}
示例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;
}
示例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;
}
示例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);
}
示例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());
}
}
示例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());
}
}
示例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);
}
}
示例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);
}
示例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));
}
示例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();
}
示例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();
}
示例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);
}
示例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();
}
}
});
}
}
}
示例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());
}
});
}
示例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
}
}