Java Code Examples for org.eclipse.ui.forms.widgets.FormToolkit#decorateFormHeading()

The following examples show how to use org.eclipse.ui.forms.widgets.FormToolkit#decorateFormHeading() . 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: AbstractFormPage.java    From typescript.java with MIT License 6 votes vote down vote up
@Override
protected void createFormContent(IManagedForm managedForm) {
	final ScrolledForm form = managedForm.getForm();
	FormToolkit toolkit = managedForm.getToolkit();
	toolkit.decorateFormHeading(form.getForm());

	IToolBarManager manager = form.getToolBarManager();
	if (contributeToToolbar(manager)) {
		form.updateToolBar();
	}
	String titleText = getFormTitleText();
	if (titleText != null) {
		form.setText(titleText);
	}
	Image titleImage = getFormTitleImage();
	if (titleImage != null) {
		form.setImage(titleImage);
	}
	toolkit.decorateFormHeading(form.getForm());
	createUI(managedForm);
}
 
Example 2
Source File: SimulationPage.java    From olca-app with Mozilla Public License 2.0 6 votes vote down vote up
@Override
protected void createFormContent(IManagedForm mform) {
	form = mform.getForm();
	FormToolkit tk = mform.getToolkit();
	form.setText(M.MonteCarloSimulation);
	tk.decorateFormHeading(form.getForm());
	Composite body = UI.formBody(form, tk);
	createSettingsSection(tk, body);

	PinBoard pinBoard = new PinBoard(simulator);
	pinBoard.create(tk, body);
	pinBoard.onResultPinChange = (pp) -> {
		this.resultPin = pp;
		updateSelection();
	};

	createProgressSection(tk, body);
	createResultSection(tk, body);
	form.reflow(true);
}
 
Example 3
Source File: AbstractEditorPropertySection.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public final void createControls(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage) {
	toolkit = new FormToolkit(parent.getDisplay());
	toolkit.setBorderStyle(SWT.BORDER);
	super.createControls(parent, aTabbedPropertySheetPage);
	GridDataFactory.fillDefaults().grab(true, true).applyTo(parent);
	parent.setLayout(new GridLayout(1, true));
	form = toolkit.createForm(parent);
	toolkit.decorateFormHeading(form);
	GridDataFactory.fillDefaults().grab(true, true).applyTo(form);
	form.getBody().setLayout(createBodyLayout());
	createControls(form.getBody());
}
 
Example 4
Source File: FormsPart.java    From codeexamples-eclipse with Eclipse Public License 1.0 5 votes vote down vote up
@PostConstruct
public void createPartControl(Composite parent) {
	FormToolkit toolkit = new FormToolkit(parent.getDisplay());
	ScrolledForm form = toolkit.createScrolledForm(parent);
	toolkit.decorateFormHeading(form.getForm());

	form.setText("Eclipse Forms API Example");

	createFirstSection(parent, toolkit);
	createSecondSection(form, toolkit);
}
 
Example 5
Source File: UI.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
public static ScrolledForm formHeader(IManagedForm mform, String title, Image image) {
	ScrolledForm form = mform.getForm();
	FormToolkit tk = mform.getToolkit();
	tk.getHyperlinkGroup().setHyperlinkUnderlineMode(
			HyperlinkSettings.UNDERLINE_HOVER);
	if (title != null)
		form.setText(title);
	if (image != null)
		form.setImage(image);
	tk.decorateFormHeading(form.getForm());
	return form;
}
 
Example 6
Source File: BasicFormPage.java    From tlaplus with MIT License 4 votes vote down vote up
/**
  * Called during FormPage life cycle and delegates the form creation
  * to three methods {@link BasicFormPage#createBodyContent(IManagedForm)}, 
  * {@link BasicFormPage#loadData()}, {@link BasicFormPage#pageInitializationComplete()}
  */
 protected void createFormContent(IManagedForm managedForm)
 {
     ScrolledForm formWidget = managedForm.getForm();
     formWidget.setText(getTitle());
     if (imagePathTemplate != null)
     {
// Show the given image left of the form page's title and beneath the tab
// bar. E.g. the main model page displays three sliders left of its "Model
// Overview" label.
         formWidget.setImage(createRegisteredImage(24));
     }

     Composite body = formWidget.getBody();

     FormToolkit toolkit = managedForm.getToolkit();
     toolkit.decorateFormHeading(formWidget.getForm());

     /*
      * The head client is the second row of the header section, below the title; if we don't create this
      * with 'NO_FOCUS' then the toolbar will always take focus on a form page that gains focus.
      */
     ToolBar headClientTB = new ToolBar(formWidget.getForm().getHead(), SWT.HORIZONTAL | SWT.NO_FOCUS);
     headClientTBM = new ToolBarManager(headClientTB);
     // run button
     headClientTBM.add(new DynamicContributionItem(new RunAction()));
     // validate button
     headClientTBM.add(new DynamicContributionItem(new GenerateAction()));
     // stop button
     headClientTBM.add(new DynamicContributionItem(new StopAction()));

     // refresh the head client toolbar
     headClientTBM.update(true);

     formWidget.getForm().setHeadClient(headClientTB);

     // setup body layout
     body.setLayout(getBodyLayout());

     // create the body of the page
     createBodyContent(managedForm);

     super.createFormContent(managedForm);
     try
     {
         // load data from the model
     	//TODO decouple from UI thread (causes I/O)
         loadData();
     } catch (CoreException e)
     {
         TLCUIActivator.getDefault().logError("Error loading data from the model into the form fields", e);
     }

     // check the model is-running state
     refresh();

     // finalizes the page construction
     // activates the change listeners
     pageInitializationComplete();
     TLCUIHelper.setHelp(getPartControl(), helpId);

     getManagedForm().getForm().getForm().addMessageHyperlinkListener(errorMessageHyperLinkListener);
 }