本文整理匯總了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
}
}