Java Code Examples for org.eclipse.jface.fieldassist.FieldDecorationRegistry#getDefault()

The following examples show how to use org.eclipse.jface.fieldassist.FieldDecorationRegistry#getDefault() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ServerPortExtension.java    From google-cloud-eclipse with Apache License 2.0 6 votes vote down vote up
@Override
public void createControl(UI_POSITION position, Composite parent) {
  // We add controls only to the BOTTOM position.
  if (position == UI_POSITION.BOTTOM) {
    portLabel = new Label(parent, SWT.NONE);
    portLabel.setVisible(false);
    portLabel.setText(Messages.getString("NEW_SERVER_DIALOG_PORT"));

    portText = new Text(parent, SWT.SINGLE | SWT.BORDER);
    portText.setVisible(false);
    portText.setText(String.valueOf(LocalAppEngineServerBehaviour.DEFAULT_SERVER_PORT));
    portText.addVerifyListener(new PortChangeMonitor());
    portText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    FieldDecorationRegistry registry = FieldDecorationRegistry.getDefault();
    Image errorImage = registry.getFieldDecoration(FieldDecorationRegistry.DEC_ERROR).getImage();

    portDecoration = new ControlDecoration(portText, SWT.LEFT | SWT.TOP);
    portDecoration.setDescriptionText(Messages.getString("NEW_SERVER_DIALOG_INVALID_PORT_VALUE"));
    portDecoration.setImage(errorImage);
    portDecoration.hide();
  }
}
 
Example 2
Source File: ExtractClassWizard.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
protected void updateDecoration(ControlDecoration decoration, RefactoringStatus status) {
	RefactoringStatusEntry highestSeverity= status.getEntryWithHighestSeverity();
	if (highestSeverity != null) {
		Image newImage= null;
		FieldDecorationRegistry registry= FieldDecorationRegistry.getDefault();
		switch (highestSeverity.getSeverity()) {
			case RefactoringStatus.INFO:
				newImage= registry.getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION).getImage();
				break;
			case RefactoringStatus.WARNING:
				newImage= registry.getFieldDecoration(FieldDecorationRegistry.DEC_WARNING).getImage();
				break;
			case RefactoringStatus.FATAL:
			case RefactoringStatus.ERROR:
				newImage= registry.getFieldDecoration(FieldDecorationRegistry.DEC_ERROR).getImage();
		}
		decoration.setDescriptionText(highestSeverity.getMessage());
		decoration.setImage(newImage);
		decoration.show();
	} else {
		decoration.setDescriptionText(null);
		decoration.hide();
	}
}
 
Example 3
Source File: FieldAssistHelper.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
private FieldDecoration getCueDecoration( )
{
	// We use our own decoration which is based on the JFace version.
	FieldDecorationRegistry registry = FieldDecorationRegistry.getDefault( );
	FieldDecoration dec = registry.getFieldDecoration( DEC_CONTENTASSIST_ID );
	if ( dec == null )
	{
		// Get the standard one. We use its image and our own customized
		// text.
		FieldDecoration standardDecoration = registry.getFieldDecoration( FieldDecorationRegistry.DEC_CONTENT_PROPOSAL );
		registry.registerFieldDecoration( DEC_CONTENTASSIST_ID,
				Messages.getFormattedString( "ssDecoratorContentAssist", //$NON-NLS-1$
						getTriggerKeyText( ) ),
				standardDecoration.getImage( ) );
		dec = registry.getFieldDecoration( DEC_CONTENTASSIST_ID );
	}
	else
	{
		dec.setDescription( Messages.getFormattedString( "ssDecoratorContentAssist", //$NON-NLS-1$
				getTriggerKeyText( ) ) );
	}
	return dec;
}
 
Example 4
Source File: GcpLocalRunTab.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
private void showServiceKeyDecorationMessage(String message, boolean isError) {
  FieldDecorationRegistry registry = FieldDecorationRegistry.getDefault();
  FieldDecoration fieldDecoration = registry.getFieldDecoration(
      isError ? FieldDecorationRegistry.DEC_ERROR : FieldDecorationRegistry.DEC_INFORMATION);

  serviceKeyDecoration.show();
  serviceKeyDecoration.setImage(fieldDecoration.getImage());
  serviceKeyDecoration.setDescriptionText(message);
  serviceKeyDecoration.showHoverText(message);
}