本文整理汇总了Java中org.eclipse.jface.fieldassist.ControlDecoration.setShowOnlyOnFocus方法的典型用法代码示例。如果您正苦于以下问题:Java ControlDecoration.setShowOnlyOnFocus方法的具体用法?Java ControlDecoration.setShowOnlyOnFocus怎么用?Java ControlDecoration.setShowOnlyOnFocus使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jface.fieldassist.ControlDecoration
的用法示例。
在下文中一共展示了ControlDecoration.setShowOnlyOnFocus方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createContentAssistDecoration
import org.eclipse.jface.fieldassist.ControlDecoration; //导入方法依赖的package包/类
private ControlDecoration createContentAssistDecoration(StyledText styledText) {
final ControlDecoration result = new ControlDecoration(styledText, SWT.TOP | SWT.LEFT);
result.setShowHover(true);
result.setShowOnlyOnFocus(true);
final Image image = ImageDescriptor
.createFromFile(XtextStyledTextCellEditor.class, "images/content_assist_cue.gif").createImage();
result.setImage(image);
result.setDescriptionText("Content Assist Available (CTRL + Space)");
result.setMarginWidth(2);
styledText.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent e) {
if (getDecoration() != null) {
getDecoration().dispose();
}
if (image != null) {
image.dispose();
}
}
});
return result;
}
示例2: createContentAssistDecoration
import org.eclipse.jface.fieldassist.ControlDecoration; //导入方法依赖的package包/类
private void createContentAssistDecoration(StyledText styledText) {
decoration = new ControlDecoration(styledText, SWT.TOP | SWT.LEFT);
decoration.setShowHover(true);
decoration.setShowOnlyOnFocus(true);
final Image image = ImageDescriptor.createFromFile(XtextStyledTextCellEditor.class,
"images/content_assist_cue.gif").createImage();
decoration.setImage(image);
decoration.setDescriptionText("Content Assist Available (CTRL + Space)");
decoration.setMarginWidth(2);
styledText.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent e) {
if (decoration != null) {
decoration.dispose();
}
if (image != null) {
image.dispose();
}
}
});
}
示例3: showErrorDecoration
import org.eclipse.jface.fieldassist.ControlDecoration; //导入方法依赖的package包/类
private void showErrorDecoration( AssistField smartField, boolean show )
{
FieldDecoration dec = smartField.getErrorDecoration( );
ControlDecoration cd = smartField.controlDecoration;
if ( show )
{
cd.setImage( dec.getImage( ) );
cd.setDescriptionText( dec.getDescription( ) );
cd.setShowOnlyOnFocus( false );
cd.show( );
}
else
{
cd.hide( );
}
}
示例4: showWarningDecoration
import org.eclipse.jface.fieldassist.ControlDecoration; //导入方法依赖的package包/类
private void showWarningDecoration( AssistField smartField, boolean show )
{
FieldDecoration dec = smartField.getWarningDecoration( );
ControlDecoration cd = smartField.controlDecoration;
if ( show )
{
cd.setImage( dec.getImage( ) );
cd.setDescriptionText( dec.getDescription( ) );
cd.setShowOnlyOnFocus( false );
cd.show( );
}
else
{
cd.hide( );
}
}
示例5: showContentAssistDecoration
import org.eclipse.jface.fieldassist.ControlDecoration; //导入方法依赖的package包/类
private void showContentAssistDecoration( AssistField smartField,
boolean show )
{
FieldDecoration dec = getCueDecoration( );
ControlDecoration cd = smartField.controlDecoration;
if ( show )
{
cd.setImage( dec.getImage( ) );
cd.setDescriptionText( dec.getDescription( ) );
cd.setShowOnlyOnFocus( true );
cd.show( );
}
else
{
cd.hide( );
}
}
示例6: createContentProposalDecoration
import org.eclipse.jface.fieldassist.ControlDecoration; //导入方法依赖的package包/类
/**
* Adds the content proposal field decoration to a given control.
*
* @param control
* The control to decorate
*/
private ControlDecoration createContentProposalDecoration(Control control) {
ControlDecoration decoration = new ControlDecoration(control, SWT.TOP | SWT.LEFT);
decoration.setImage(contentProposalDecorationImage);
decoration.setShowOnlyOnFocus(true);
return decoration;
}
示例7: addBulbDecorator
import org.eclipse.jface.fieldassist.ControlDecoration; //导入方法依赖的package包/类
private void addBulbDecorator(final Control control, final String tooltip) {
ControlDecoration dec = new ControlDecoration(control, SWT.TOP | SWT.LEFT);
dec.setImage(FieldDecorationRegistry.getDefault()
.getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL).getImage());
dec.setShowOnlyOnFocus(true);
dec.setShowHover(true);
dec.setDescriptionText(tooltip);
}
示例8: createDecoration
import org.eclipse.jface.fieldassist.ControlDecoration; //导入方法依赖的package包/类
/***************************************************************************
* Create decoration for the input field
**************************************************************************/
private void createDecoration()
{
// Field decoration
deco = new ControlDecoration(m_contents, SWT.RIGHT);
deco.setDescriptionText("Use CTRL+Space to see the possible commands");
deco.setImage(FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION)
.getImage());
deco.setShowOnlyOnFocus(false);
deco.setShowHover(true);
KeyStroke keyStroke;
ArrayList<String> possibleCommandsList = new ArrayList<String>();
for (GuiExecutorCommand cmd : GuiExecutorCommand.values())
{
possibleCommandsList.add(cmd.label.toLowerCase());
}
String[] possibleCommands = possibleCommandsList.toArray(new String[0]);
char[] autoActivationCharacters = new char[0];
provider = new SimpleContentProposalProvider(possibleCommands);
try
{
keyStroke = KeyStroke.getInstance("Ctrl+Space");
adp = new ContentProposalAdapter(m_contents, new TextContentAdapter(), provider, keyStroke,
autoActivationCharacters);
adp.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE);
adp.addContentProposalListener((IContentProposalListener) m_contents.getParent().getParent());
}
catch (Exception ex)
{
ex.printStackTrace();
}
}
示例9: TextEditorErrorListener
import org.eclipse.jface.fieldassist.ControlDecoration; //导入方法依赖的package包/类
/**
* Creates a new text editor error listener.
*
* @param textCellEditor
* the associated text cell editor
* @param decor
* the control decoration
*/
public TextEditorErrorListener(TextCellEditor textCellEditor, ControlDecoration decor) {
this.textCellEditor = textCellEditor;
textCtrl = (Text) textCellEditor.getControl();
this.decor = decor;
decor.setImage(DECOR_IMG);
decor.setShowOnlyOnFocus(true);
decor.setShowHover(true);
decor.hide();
decor.hideHover();
}
示例10: addDecorationInfo
import org.eclipse.jface.fieldassist.ControlDecoration; //导入方法依赖的package包/类
/**
* Decorates the specified control with a info marker displaying the
* specified text as mouse over.
*
* @param inControl
* the Control to decorate
* @param inInfo
* String the information text to display as mouse over
* @return ControlDecoration the hint decoration
*/
public final static ControlDecoration addDecorationInfo(
final Control inControl, final String inInfo) {
final ControlDecoration outDecoration = new ControlDecoration(
inControl, SWT.LEFT | SWT.TOP);
outDecoration.setImage(IMG_INFO);
outDecoration.setDescriptionText(inInfo);
outDecoration.setShowOnlyOnFocus(true);
return outDecoration;
}
示例11: addDecorationHint
import org.eclipse.jface.fieldassist.ControlDecoration; //导入方法依赖的package包/类
/**
* Decorates the specified control with a hint displaying the specified text
* as mouse over.
*
* @param inControl
* the Control to decorate
* @param inHint
* String the hint text to display as mouse over
* @return ControlDecoration the hint decoration
*/
public final static ControlDecoration addDecorationHint(
final Control inControl, final String inHint) {
final ControlDecoration outDecoration = new ControlDecoration(
inControl, SWT.LEFT | SWT.TOP);
outDecoration.setImage(IMG_HINT);
outDecoration.setDescriptionText(inHint);
outDecoration.setShowOnlyOnFocus(true);
return outDecoration;
}