org.eclipse.swt.custom.CLabel Java Examples

The following examples show how to use org.eclipse.swt.custom.CLabel. 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: ApiDocumentationResultView.java    From scava with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Create the composite.
 * 
 * @param parent
 * @param style
 */
public ApiDocumentationResultView() {
	super(SWT.BORDER);
	setBackgroundMode(SWT.INHERIT_FORCE);
	setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
	GridLayout gridLayout = new GridLayout(2, false);
	gridLayout.verticalSpacing = 0;
	setLayout(gridLayout);

	lblLabel = new CLabel(this, SWT.NONE);
	lblLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
	lblLabel.setFont(SWTResourceManager.getFont("Segoe UI", 12, SWT.NORMAL));
	lblLabel.setText("<Title of the API documentation>");
	new Label(this, SWT.NONE);

	textUrl = new Text(this, SWT.READ_ONLY | SWT.WRAP);
	textUrl.setEditable(false);
	textUrl.setForeground(SWTResourceManager.getColor(SWT.COLOR_GRAY));
	textUrl.setText("<url>");
	textUrl.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

}
 
Example #2
Source File: DataItemLabel.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
public DataItemLabel ( final Composite composite, final String connectionId, final String itemId )
{
    this.label = new CLabel ( composite, SWT.NONE );
    this.dataItem = new DataItemObservableValue ( Activator.getDefault ().getBundle ().getBundleContext (), connectionId, itemId );
    this.label.addDisposeListener ( new DisposeListener () {

        @Override
        public void widgetDisposed ( final DisposeEvent e )
        {
            handleDispose ();
        }
    } );
    this.model = PojoObservables.observeDetailValue ( this.dataItem, "value", Variant.class ); //$NON-NLS-1$
    this.dbc = new DataBindingContext ();

    bind ();
}
 
Example #3
Source File: Messages.java    From BiglyBT with GNU General Public License v2.0 6 votes vote down vote up
public static void updateTooltipLanguageFromData(Widget widget) {
 	if (widget == null || widget.isDisposed()) {
 		return;
 	}
	if (widget.getData(RESOURCE_KEY) != null) {
		String sToolTip = MessageText.getString((String) widget.getData(RESOURCE_KEY));
		if (widget instanceof CLabel)
			Utils.setTT((CLabel) widget,sToolTip);
		else if (widget instanceof Label)
			Utils.setTT((Label) widget,sToolTip);
		else if (widget instanceof Text)
			Utils.setTT((Text) widget,sToolTip);
		else if (widget instanceof Canvas)
			Utils.setTT((Canvas) widget,sToolTip);
		else if (widget instanceof Composite)
			Utils.setTT((Composite) widget,sToolTip);
		else if (widget instanceof Control)
			Utils.setTT((Control) widget,sToolTip);
		else if (widget instanceof ToolItem)
			Utils.setTT((ToolItem) widget,sToolTip);
		else
			System.out.println("No cast for " + widget.getClass().getName());
	}
}
 
Example #4
Source File: AbstractSortableHeader.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
private void makeMouseAdapter() {
	this.sortMouseAdapter = new MouseAdapter() {

		public void mouseDown(MouseEvent e) {
			CLabel label = (CLabel) e.widget;
			int c = labels.indexOf(label);
			if (c != lastSortColumn) {
				sortDescending = null;
				sortIndicator = null;
			}
			lastSortColumn = c;
			sortOnColumn(c, toggleSortDirection());

			for (int i = 0; i < labels.size(); i++) {
				CLabel labelToSet = (CLabel) labels.get(i);
				if (i != c) {
					labelToSet.setImage(null);
				} else {
					labelToSet.setImage(sortIndicator);
				}
			}
		}
	};
}
 
Example #5
Source File: TmfEventsTableHeader.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
private void toggle() {
    fCollapsed = !fCollapsed;
    for (Control child : getChildren()) {
        if (child instanceof CLabel) {
            CLabel label = (CLabel) child;
            if (fCollapsed) {
                label.setImage(null);
                label.setToolTipText(label.getText());
                label.setText(null);
                label.setMargins(DEFAULT_MARGIN, 0, COLLAPSED_RIGHT_MARGIN, 0);
            } else {
                label.setImage(DELETE);
                label.setText(label.getToolTipText());
                label.setToolTipText((String) label.getData(TOOLTIP_KEY));
                label.setMargins(DEFAULT_MARGIN, DEFAULT_MARGIN, DEFAULT_MARGIN, DEFAULT_MARGIN);
            }
        }
    }
    getParent().layout();
}
 
Example #6
Source File: CloneDiffWizardPage.java    From JDeodorant with MIT License 6 votes vote down vote up
private void updateRenamedVariables() {
	Control[] children = renamedVariables.getChildren();
	for(Control child : children) {
		child.dispose();
	}
	Set<VariableBindingPair> renamedVariableBindingPairs = mapper.getRenamedVariableBindings();
	if(renamedVariableBindingPairs.size() > 0) {
		for(VariableBindingPair bindingPair : renamedVariableBindingPairs) {
			CLabel renamedVariableLabel = new CLabel(renamedVariables, SWT.NONE);
			String variable1 = bindingPair.getBinding1().getName();
			String variable2 = bindingPair.getBinding2().getName();
			renamedVariableLabel.setText(variable1 + " -> " + variable2);
			renamedVariableLabel.setFont(CONSOLAS_BOLD_FONT);
		}
	}
	renamedVariables.layout();
	renamedVariables.pack();
}
 
Example #7
Source File: ExtractMethodComposite.java    From Pydev with Eclipse Public License 1.0 6 votes vote down vote up
private void createOffsetStrategy(Composite mainComp) {
    FillLayout fillLayout = new FillLayout();
    fillLayout.type = org.eclipse.swt.SWT.VERTICAL;
    GridData gridData7 = new GridData();
    gridData7.horizontalSpan = 2;
    gridData7.verticalAlignment = GridData.CENTER;
    gridData7.grabExcessHorizontalSpace = true;
    gridData7.horizontalAlignment = GridData.FILL;
    Composite comboComp = new Composite(mainComp, SWT.NONE);
    comboComp.setLayoutData(gridData7);
    comboComp.setLayout(fillLayout);
    methodInsertionLbl = new CLabel(comboComp, SWT.NONE);
    methodInsertionLbl.setText(Messages.offsetStrategyInsertionPointMethod);
    methodInsertionComb = createComboViewer(comboComp);

    methodInsertionComb.getCombo().select(0);

}
 
Example #8
Source File: SWTFactory.java    From goclipse with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Creates a new <code>CLabel</code> that will wrap at the specified width and has the specified image
 * @param parent the parent to add this label to
 * @param text the text for the label
 * @param image the image for the label
 * @param hspan the h span to take up in the parent
 * @param wrapwidth the with to wrap at
 * @return a new <code>CLabel</code>
 * @since 3.3
 */
public static CLabel createWrapCLabel(Composite parent, String text, Image image, int hspan, int wrapwidth) {
	CLabel label = new CLabel(parent, SWT.NONE | SWT.WRAP);
	label.setFont(parent.getFont());
	if(text != null) {
		label.setText(text);
	}
	if(image != null) {
		label.setImage(image);
	}
	GridData gd = new GridData(GridData.FILL_HORIZONTAL);
	gd.horizontalSpan = hspan;
	gd.widthHint = wrapwidth;
	label.setLayoutData(gd);
	return label;
}
 
Example #9
Source File: DeployRequiredControl.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public DeployRequiredControl(Composite parent, AbstractBdmFormPage formPage, GridData gridData) {
    super(parent, SWT.NONE);
    setLayout(GridLayoutFactory.fillDefaults().create());
    setLayoutData(gridData);
    formPage.getToolkit().adapt(this);

    Group group = new Group(this, SWT.NONE);
    group.setLayout(GridLayoutFactory.fillDefaults().create());
    group.setLayoutData(GridDataFactory.fillDefaults().create());

    CLabel label = new CLabel(group, SWT.WRAP);
    label.setLayoutData(GridDataFactory.fillDefaults().create());
    label.setText(Messages.bdmDeployRequired);
    label.setImage(JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING));

    boolean show = formPage.getEditorContribution().observeDeployRequired().getValue();
    gridData.exclude = !show;
    setVisible(show);
}
 
Example #10
Source File: TextPropertySection.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public void createControls(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage) {
    super.createControls(parent, aTabbedPropertySheetPage);
    Composite composite = getWidgetFactory().createFlatFormComposite(parent);
    
    FormData data;

    this.text = getWidgetFactory().createText(composite, getDefaultValue()); //$NON-NLS-1$
    
    data = new FormData();
    data.left = new FormAttachment(0, STANDARD_LABEL_WIDTH);
    data.right = new FormAttachment(textBoxSize, 0);
    data.top = new FormAttachment(0, ITabbedPropertyConstants.VSPACE);
    this.text.setLayoutData(data);

    CLabel labelLabel = getWidgetFactory().createCLabel(composite, getPropertyDefinition().getName()); //$NON-NLS-1$
    data = new FormData();
    data.left = new FormAttachment(0, 0);
    data.right = new FormAttachment(text, -ITabbedPropertyConstants.HSPACE);
    data.top = new FormAttachment(text, 0, SWT.CENTER);
    labelLabel.setLayoutData(data);
}
 
Example #11
Source File: BonitaCompareEditorInput.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Control createContents(final Composite parent) {
    final CLabel label = new CLabel(parent, SWT.NONE);
    final String lastArgumentWithConditionOrNot = canBeContainedInScript
            ? " " + Messages.reviewChangesMessageWithConditionPlace : "";
    if (operationType == RefactoringOperationType.UPDATE) {
        if (elementName.equals(newName)) {
            label.setText(Messages.bind(Messages.reviewTypeChangesMessageRefactoring,
                    new String[] { elementName, lastArgumentWithConditionOrNot }));
        } else {
            label.setText(Messages.bind(Messages.reviewChangesMessageRefactoring,
                    new String[] { elementName, newName, lastArgumentWithConditionOrNot }));
        }

    } else {
        label.setText(Messages.bind(Messages.reviewChangesMessageRemoving, elementName, lastArgumentWithConditionOrNot));
    }
    label.setImage(Display.getCurrent().getSystemImage(SWT.ICON_WARNING));
    return super.createContents(parent);
}
 
Example #12
Source File: CreateContractInputFromBusinessObjectWizardPage.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
private void createReminderText(final EMFDataBindingContext dbc, final Composite composite) {
    final CLabel reminder = new CLabel(composite, SWT.NONE);
    final Display d = Display.getCurrent();
    final Image img = d.getSystemImage(SWT.ICON_WARNING);
    reminder.setImage(img);
    reminder.setLayoutData(GridDataFactory.fillDefaults().hint(600, SWT.DEFAULT).create());
    final Button autoGeneratedOperationButton = new Button(composite, SWT.RADIO);
    final Button manuallyDefinedOperationButton = new Button(composite, SWT.RADIO);
    actionObservable = new SelectObservableValue<>(Boolean.class);
    actionObservable.addOption(Boolean.TRUE, WidgetProperties.selection().observe(autoGeneratedOperationButton));
    actionObservable.addOption(Boolean.FALSE, WidgetProperties.selection().observe(manuallyDefinedOperationButton));
    if (contract.eContainer() instanceof Task) {
        reminder.setText(Messages.reminderForStepMessage);
        autoGeneratedOperationButton.setText(Messages.autoGeneratedOperationStepButton);
        manuallyDefinedOperationButton.setText(Messages.manuallyDefinedOperationStepButton);
    } else {
        reminder.setText(Messages.reminderForProcessMessage);
        autoGeneratedOperationButton.setText(Messages.autoGeneratedOperationProcessButton);
        manuallyDefinedOperationButton.setText(Messages.manuallyDefinedOperationProcessButton);
    }
    dbc.bindValue(actionObservable, generationOptions.getAutoGeneratedScriptObservable());
}
 
Example #13
Source File: ChartLegend.java    From olca-app with Mozilla Public License 2.0 6 votes vote down vote up
private void element(String text, Object model, int colorIndex) {
	if (model instanceof CategorizedDescriptor || model instanceof CategorizedEntity) {
		ImageHyperlink link = new ImageHyperlink(composite, SWT.TOP);
		link.setText(text);
		link.setImage(getImage(colorIndex));
		Controls.onClick(link, (e) -> {
			if (model instanceof CategorizedDescriptor) {
				App.openEditor((CategorizedDescriptor) model);
			} else if (model instanceof CategorizedEntity) {
				App.openEditor((CategorizedEntity) model);
			}
		});
		createdLinks.push(link);
	} else {
		CLabel label = new CLabel(composite, SWT.TOP);
		label.setImage(getImage(colorIndex));
		label.setText(text);
		createdLinks.push(label);
	}
}
 
Example #14
Source File: ScriptExpressionEditor.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Control createExpressionEditor(final Composite parent, final EMFDataBindingContext ctx) {
    mainComposite = new Composite(parent, SWT.NONE);
    mainComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    mainComposite.setLayout(GridLayoutFactory.fillDefaults().create());

    new Label(mainComposite, SWT.NONE)
            .setLayoutData(GridDataFactory.fillDefaults().indent(0, -LayoutConstants.getSpacing().y + 1).create()); //filler

    inputNameComposite = new Composite(mainComposite, SWT.NONE);
    inputNameComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(3).create());
    inputNameComposite.setLayoutData(GridDataFactory.fillDefaults().create());

    final Label scriptNameLabel = new Label(inputNameComposite, SWT.NONE);
    scriptNameLabel.setLayoutData(GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.CENTER).create());
    scriptNameLabel.setText(Messages.name);

    expressionNameText = new Text(inputNameComposite, SWT.BORDER | SWT.SINGLE);
    expressionNameText.setLayoutData(GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.CENTER).grab(false, false)
            .hint(400, SWT.DEFAULT).create());

    LocalResourceManager resourceManager = new LocalResourceManager(JFaceResources.getResources(), parent);
    Color errorColor = resourceManager.createColor(new RGB(214, 77, 77));

    errorLabel = new CLabel(inputNameComposite, SWT.NONE);
    errorLabel.setLayoutData(GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).create());
    errorLabel.setForeground(errorColor);

    final IScriptLanguageProvider provider = ScriptLanguageService.getInstance().getScriptLanguageProvider(languageId);
    editor = provider.getExpressionEditor();
    editor.setIsPageFlowContext(isPageFlowContext);
    final Composite editorComposite = new Composite(mainComposite, SWT.NONE);
    editorComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    editorComposite.setLayout(GridLayoutFactory.fillDefaults().create());
    editor.createExpressionEditor(editorComposite, ctx);

    createReturnTypeComposite(editorComposite);

    return mainComposite;
}
 
Example #15
Source File: OverrideMethodsPage.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
private Composite createMainComp(Composite parent) {
    GridData gridData12 = new GridData();
    gridData12.horizontalSpan = 2;
    GridData gridData11 = new GridData();
    gridData11.horizontalSpan = 2;
    GridLayout gridLayout2 = new GridLayout();
    gridLayout2.numColumns = 2;
    GridData gridData = new GridData();
    gridData.horizontalAlignment = GridData.FILL;
    gridData.grabExcessHorizontalSpace = true;
    gridData.grabExcessVerticalSpace = true;
    gridData.verticalAlignment = GridData.FILL;
    mainComp = new Composite(parent, SWT.NONE);
    mainComp.setLayoutData(gridData);
    cLabel = new CLabel(mainComp, SWT.NONE);
    cLabel.setText(Messages.overrideMethodsSelect);
    cLabel.setLayoutData(gridData11);
    createTreeComp();
    createButtonComp();
    mainComp.setLayout(gridLayout2);

    createComboComp();

    createCommentComp(mainComp);

    return mainComp;
}
 
Example #16
Source File: AbstractDefinitionSelectionImpementationWizardPage.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private void createCloudValidationComposite(Composite parent) {
    cloudValidationComposite = new Composite(parent, SWT.NONE);
    cloudValidationComposite.setLayout(GridLayoutFactory.fillDefaults().create());
    cloudValidationComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).span(2, 1).create());

    cloudValidationLabel = new CLabel(cloudValidationComposite, SWT.WRAP);
    cloudValidationLabel.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
}
 
Example #17
Source File: ComponentRiskThresholds.java    From arx with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a label
 * @param root
 * @param text
 */
private void createLabel(Composite root, String text) {

    // Label
    CLabel label = new CLabel(root, SWT.CENTER);
    label.setText(text);
    label.setLayoutData(SWTUtil.createFillHorizontallyGridData(true, 2));
    label.setToolTipText(text);
}
 
Example #18
Source File: ConstructorFieldPage.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
private void createComboComp() {
    FillLayout fillLayout = new FillLayout();
    fillLayout.type = org.eclipse.swt.SWT.VERTICAL;
    GridData gridData7 = new GridData();
    gridData7.horizontalSpan = 2;
    gridData7.verticalAlignment = GridData.CENTER;
    gridData7.grabExcessHorizontalSpace = true;
    gridData7.horizontalAlignment = GridData.FILL;
    comboComp = new Composite(mainComp, SWT.NONE);
    comboComp.setLayoutData(gridData7);
    comboComp.setLayout(fillLayout);
    methodInsertionLbl = new CLabel(comboComp, SWT.NONE);
    methodInsertionLbl.setText(Messages.offsetStrategyInsertionPointMethod);
    methodInsertionComb = createComboViewer(comboComp);
    methodInsertionComb.addSelectionChangedListener(new ISelectionChangedListener() {
        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            IStructuredSelection sel = (IStructuredSelection) event.getSelection();
            if (!sel.isEmpty()) {
                OffsetStrategyModel elem = (OffsetStrategyModel) sel.getFirstElement();
                getRequestProcessor().setMethodDestination(elem.getStrategy());
            }
        }
    });

    getRequestProcessor().setMethodDestination(strategyProvider.get(0).getStrategy());
    methodInsertionComb.getCombo().select(0);
}
 
Example #19
Source File: ConnectionStateComposite.java    From saros with GNU General Public License v2.0 5 votes vote down vote up
public ConnectionStateComposite(Composite parent, int style) {
  super(parent, style);

  SarosPluginContext.initComponent(this);

  setLayout(LayoutUtils.createGridLayout(1, false, 10, 3, 0, 0));
  stateLabel = new CLabel(this, SWT.NONE);
  stateLabel.setLayoutData(LayoutUtils.createFillHGrabGridData());
  FontUtils.makeBold(stateLabel);

  stateLabel.setForeground(getDisplay().getSystemColor(SWT.COLOR_WHITE));

  stateLabel.setBackground(getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY));

  setBackground(getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY));

  connectionHandler.addConnectionStateListener(connectionListener);

  accountStore.addListener(accountStoreListener);

  updateLabel(connectionHandler.getConnectionState(), connectionHandler.getConnectionError());

  addDisposeListener(
      new DisposeListener() {
        @Override
        public void widgetDisposed(DisposeEvent e) {
          connectionHandler.removeConnectionStateListener(connectionListener);
          accountStore.removeListener(accountStoreListener);
        }
      });
}
 
Example #20
Source File: GeneratePropertiesPage.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
private Composite createMainComp(Composite parent) {
    GridData gridData12 = new GridData();
    gridData12.horizontalSpan = 2;
    GridData gridData11 = new GridData();
    gridData11.horizontalSpan = 2;
    GridLayout gridLayout2 = new GridLayout();
    gridLayout2.numColumns = 2;
    GridData gridData = new GridData();
    gridData.horizontalAlignment = GridData.FILL;
    gridData.grabExcessHorizontalSpace = true;
    gridData.grabExcessVerticalSpace = true;
    gridData.verticalAlignment = GridData.FILL;
    mainComp = new Composite(parent, SWT.NONE);
    mainComp.setLayoutData(gridData);
    cLabel = new CLabel(mainComp, SWT.NONE);
    cLabel.setText(generatePropertiesSelect);
    cLabel.setLayoutData(gridData11);
    createTreeComp();
    createButtonComp();
    mainComp.setLayout(gridLayout2);

    createComboComp();

    createVisibilityGroup();

    return mainComp;
}
 
Example #21
Source File: ChartCubeBindingDialogHelper.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
private void createMessageSection( Composite composite )
{
	messageLine = new CLabel( composite, SWT.NONE );
	GridData layoutData = new GridData( GridData.FILL_HORIZONTAL );
	layoutData.horizontalSpan = 3;
	messageLine.setLayoutData( layoutData );
}
 
Example #22
Source File: WidgetMessageDecorator.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
public WidgetMessageDecorator(Composite parent, Optional<String> defaultMessage) {
    createComposite(parent);
    this.resourceManager = new LocalResourceManager(JFaceResources.getResources(), parent);
    errorColor = resourceManager.createColor(ColorConstants.ERROR_RGB);
    warningColor = resourceManager.createColor(ColorConstants.WARNING_RGB);
    this.defaultMessage = defaultMessage;
    messageLabel = new CLabel(composite, SWT.NONE);
    messageLabel.setTopMargin(1);
    messageLabel.setLeftMargin(0);
    messageLabel.setFont(getMessageFont());
    messageLabel.setText(defaultMessage.orElse(""));
    foregroundColor = Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_FOREGROUND);
    updateExpandState();
}
 
Example #23
Source File: H5ValuePage.java    From dawnsci with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Create contents of the view part.
 * @param parent
 */
@Override
public void createControl(Composite parent) {
	
	this.container = new Composite(parent, SWT.NONE);
	container.setLayout(new GridLayout(1, false));
	final GridLayout layout = (GridLayout)container.getLayout();
	layout.horizontalSpacing=0;
	layout.verticalSpacing  =0;
	layout.marginBottom     =0;
	layout.marginTop        =0;
	layout.marginLeft       =0;
	layout.marginRight      =0;
	layout.marginHeight     =0;
	layout.marginWidth      =0;
	container.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
	
	this.label  = new CLabel(container, SWT.LEFT);
	label.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false));
	label.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
	
	this.sourceViewer = new SourceViewer(container, null, SWT.H_SCROLL | SWT.V_SCROLL | SWT.READ_ONLY );
	sourceViewer.setEditable(false);
	sourceViewer.getTextWidget().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    		
	getSite().getPage().getWorkbenchWindow().getSelectionService().addSelectionListener(this);
	getSite().getPage().addPartListener(this);
	
	try {
		updateSelection(getActivePage().getSelection());
	} catch (Throwable ignored) {
		// There might not be a selection or page.
	}

}
 
Example #24
Source File: XSPEditorUtil.java    From XPagesExtensionLibrary with Apache License 2.0 5 votes vote down vote up
static public CLabel createCLabel(Composite parent, String label, int hSpan) {
    CLabel pgTitle = new CLabel(parent, SWT.NONE);
    pgTitle.setText(label); 
    pgTitle.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
    pgTitle.setFont(JFaceResources.getHeaderFont());
    GridData titleGridData = new GridData();
    titleGridData.grabExcessHorizontalSpace = true;
    titleGridData.horizontalSpan = hSpan;
    pgTitle.setLayoutData(titleGridData);
    return pgTitle;
}
 
Example #25
Source File: Widgets.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
public static CLabel readOnly(Composite parent, String label, Image image, String property, ModelEditor<?> editor,
		FormToolkit toolkit) {
	UI.formLabel(parent, label);
	CLabel labelWidget = new CLabel(parent, SWT.NONE);
	GridData gridData = UI.gridData(labelWidget, false, false);
	gridData.verticalAlignment = SWT.TOP;
	gridData.verticalIndent = 2;
	labelWidget.setImage(image);
	editor.getBinding().readOnly(editor.getModel(), property, labelWidget);
	new CommentControl(parent, toolkit, property, editor.getComments());
	return labelWidget;
}
 
Example #26
Source File: TimeSlice.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Initialize the control
 */
private void initialize() {
	timeLabel = new CLabel(this, SWT.RIGHT);
	timeLabel.setText("23:00 PM");
	Integer preferredWidth = new Integer(timeLabel.computeSize(SWT.DEFAULT,
			SWT.DEFAULT, false).x + 5);
	timeLabel.setLayoutData(preferredWidth);
	timeLabel.setText("");
	setBackground(Display.getCurrent().getSystemColor(
			SWT.COLOR_WIDGET_BACKGROUND));
	setSize(new Point(537, 16));
	setLayout(new TimeSliceAcrossTimeLayout());
}
 
Example #27
Source File: DayEditor.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * (non-API) Method initializeColumnHeaders. Called internally when the column
 * header text needs to be updated.
 *
 * @param columns
 *            A LinkedList of CLabels representing the column objects
 */
protected void refreshColumnHeaders(LinkedList<CLabel> columns) {
	Date startDate = getStartDate();
	GregorianCalendar gc = new GregorianCalendar();
	gc.setTime(startDate);

	SimpleDateFormat formatter = new SimpleDateFormat("EE, MMM d");
	formatter.applyLocalizedPattern(formatter.toLocalizedPattern());

	for (Iterator<CLabel> iter = columns.iterator(); iter.hasNext();) {
		CLabel headerLabel = iter.next();
		headerLabel.setText(formatter.format(gc.getTime()));
		gc.add(Calendar.DATE, 1);
	}
}
 
Example #28
Source File: ViewerPane.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public ViewerPane(Composite parent, int style) {
	super(parent, style);

	marginWidth= 0;
	marginHeight= 0;

	CLabel label= new CLabel(this, SWT.NONE);
	setTopLeft(label);

	ToolBar tb= new ToolBar(this, SWT.FLAT);
	setTopCenter(tb);
	fToolBarManager= new ToolBarManager(tb);
}
 
Example #29
Source File: XYGraphConfigDialog.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
private void addMaxWarningMessage(Composite composite, String type) {
	final CLabel warning = new CLabel(composite, SWT.NONE);
	warning.setText("There are too many " + type + " to edit");
	warning.setToolTipText("Currently only the first " + MAX_CONFIG_PAGE_COUNT + " " + type
			+ " can have their properties manually edited.\n"
			+ "This is due to a limitation with the current widget design on the configure form.\n"
			+ "Please see Bug 514179 for more details.");
	warning.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
	warning.setImage(XYGraphMediaFactory.getInstance().getImage("images/warning.png"));
}
 
Example #30
Source File: VariableBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public Control createContents(Composite parent) {
	Composite composite= new Composite(parent, SWT.NONE);
	composite.setFont(parent.getFont());

	LayoutUtil.doDefaultLayout(composite, new DialogField[] { fVariablesList }, true, 0, 0);
	LayoutUtil.setHorizontalGrabbing(fVariablesList.getListControl(null));

	fWarning= new CLabel(composite, SWT.NONE);
	fWarning.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, fVariablesList.getNumberOfControls() - 1, 1));

	fControl= composite;
	updateDeprecationWarning();

	return composite;
}