org.eclipse.ui.forms.IManagedForm#getForm ( )源码实例Demo

下面列出了org.eclipse.ui.forms.IManagedForm#getForm ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: typescript.java   文件: AbstractFormPage.java
@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);
}
 
源代码2 项目: olca-app   文件: SimulationPage.java
@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);
}
 
源代码3 项目: olca-app   文件: ReportViewer.java
@Override
protected void createFormContent(IManagedForm mform) {
	ScrolledForm form = mform.getForm();
	Composite comp = form.getBody();
	comp.setLayout(new FillLayout());
	try {
		Browser b = new Browser(comp, SWT.NONE);
		b.setJavascriptEnabled(true);
		UI.onLoaded(b, HtmlFolder.getUrl("report.html"), () -> {
			Gson gson = new Gson();
			String json = gson.toJson(report);
			String command = "setData(" + json + ")";
			b.execute(command);
		});
	} catch (Exception e) {
		Logger log = LoggerFactory.getLogger(getClass());
		log.error("failed to load report in browser", e);
	}
}
 
源代码4 项目: ice   文件: ErrorMessageFormPage.java
@Override
public void createFormContent(IManagedForm managedForm) {
	// Local Declarations
	final ScrolledForm form = managedForm.getForm();
	GridLayout layout = new GridLayout();

	// Setup the layout and layout data
	layout.numColumns = 1;
	form.getBody().setLayoutData(
			new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
	form.getBody().setLayout(new FillLayout());

	String errorMsg = "There is no data to show in your Form or in this "
			+ "particular component. Please file a bug or email "
			+ "[email protected]";
	managedForm.getToolkit().createText(form.getBody(), errorMsg);

	return;
}
 
源代码5 项目: thym   文件: AbstactConfigEditorPage.java
@Override
protected void createFormContent(IManagedForm managedForm) {
	final ScrolledForm form = managedForm.getForm();
	LaunchCordovaPluginWizardAction action = new LaunchCordovaPluginWizardAction(getConfigEditor());
	form.getToolBarManager().add(action);
	form.updateToolBar();
}
 
源代码6 项目: olca-app   文件: UI.java
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;
}
 
源代码7 项目: ice   文件: ICEMasterDetailsPage.java
/**
 * <p>
 * This operation overrides the default/abstract implementation of
 * FormPage.createFormContents to create the contents of the
 * ICEMasterDetailsPage.
 * </p>
 * 
 * @param managedForm
 *            <p>
 *            The Form widget on which the ICEMasterDetailsPage exists.
 *            </p>
 */
@Override
protected void createFormContent(IManagedForm managedForm) {

	// Set the Form
	final ScrolledForm scrolledForm = managedForm.getForm();

	FormToolkit toolkit = managedForm.getToolkit();
	Section section = toolkit.createSection(scrolledForm.getBody(),
			Section.DESCRIPTION | ExpandableComposite.TITLE_BAR);

	GridData gd = new GridData(GridData.FILL_HORIZONTAL);
	section.setLayoutData(gd);

	// Set the MasterDetailsComponent's "header component" that contains
	// global data if it exists.
	ICEDataComponentSectionPart headerSectionPart = new ICEDataComponentSectionPart(
			section, ICEFormEditor, managedForm);
	DataComponent header = masterDetailsComponent.getGlobalsComponent();
	if (header != null) {
		headerSectionPart.setDataComponent(header);
		headerSectionPart.renderSection();
	}

	// Get the Provider
	ICEDetailsPageProvider pageProvider = new ICEDetailsPageProvider(
			masterDetailsComponent, ICEFormEditor);

	// Create a scrolledPropertiesBlock with given providers.
	block = new ICEScrolledPropertiesBlock(masterDetailsComponent,
			ICEFormEditor, pageProvider);
	block.createContent(managedForm);

}
 
源代码8 项目: ice   文件: ICEScrolledPropertiesBlock.java
/**
 * <p>
 * This operation creates actions in the toolbar for the block.
 * </p>
 * 
 * @param managedForm
 *            <p>
 *            The parent Form
 *            </p>
 */
@Override
protected void createToolBarActions(IManagedForm managedForm) {
	final ScrolledForm form = managedForm.getForm();
	Action haction = new Action("Horizontal Orientation",
			IAction.AS_RADIO_BUTTON) {
		@Override
		public void run() {
			sashForm.setOrientation(SWT.HORIZONTAL);
			form.reflow(true);
		}
	};
	haction.setChecked(true);
	haction.setToolTipText("Set Details to the Right of Masters");
	Action vaction = new Action("Vertical Orientation",
			IAction.AS_RADIO_BUTTON) {
		@Override
		public void run() {
			sashForm.setOrientation(SWT.VERTICAL);
			form.reflow(true);
		}
	};
	vaction.setChecked(false);
	vaction.setToolTipText("Set Details Below Masters");
	form.getToolBarManager().add(haction);
	form.getToolBarManager().add(vaction);
}
 
源代码9 项目: bonita-studio   文件: AbstractFormPage.java
@Override
protected void createFormContent(IManagedForm managedForm) {
    toolkit = managedForm.getToolkit();
    scrolledForm = managedForm.getForm();
    scrolledForm.setHeadClient(createHeader(scrolledForm.getForm()));
    scrolledForm.getBody().setLayout(GridLayoutFactory.swtDefaults().create());
    scrolledForm.getBody().setLayoutData(GridDataFactory.fillDefaults().create());
    createForm();
}
 
源代码10 项目: uima-uimaj   文件: HeaderPage.java
/**
 * Setup 1 column layout.
 *
 * @param managedForm the managed form
 * @return the composite
 */
public Composite setup1ColumnLayout(IManagedForm managedForm) {
  final ScrolledForm sform = managedForm.getForm();
  final Composite form = sform.getBody();
  form.setLayout(new GridLayout(1, false)); // this is required !
  Composite xtra = toolkit.createComposite(form);
  xtra.setLayout(new GridLayout(1, false));
  xtra.setLayoutData(new GridData(GridData.FILL_BOTH));

  Control c = form.getParent();
  while (!(c instanceof ScrolledComposite))
    c = c.getParent();
  ((GridData) xtra.getLayoutData()).widthHint = c.getSize().x;
  return xtra;
}
 
源代码11 项目: olca-app   文件: StartPage.java
@Override
protected void createFormContent(IManagedForm mform) {
	ScrolledForm form = mform.getForm();
	Composite comp = form.getBody();
	comp.setLayout(new FillLayout());
	Browser browser = new Browser(comp, SWT.NONE);
	browser.setJavascriptEnabled(true);

	// handles link clicks and opens them in the browser
	UI.bindFunction(browser, "onOpenLink", (args) -> {
		if (args == null || args.length == 0)
			return null;
		Object s = args[0];
		if (!(s instanceof String))
			return null;
		Desktop.browse(s.toString());
		return null;
	});

	// handles click on the "native library hint"
	UI.bindFunction(browser, "onLibHintClick", (args) -> {
		LibraryDownload.open();
		return null;
	});

	// set the start page configuration
	UI.onLoaded(browser, HtmlFolder.getUrl("home.html"), () -> {
		HashMap<String, Object> config = new HashMap<>();
		config.put("version", getVersion());
		String lang = AppArg.get("nl");
		config.put("lang", Strings.nullOrEmpty(lang) ? "en" : lang);
		config.put("showLibHint", !Julia.isWithUmfpack());
		String json = new Gson().toJson(config);
		browser.execute("setData(" + json + ")");
	});
}
 
源代码12 项目: uima-uimaj   文件: HeaderPage.java
/**
 * Setup 2 column layout.
 *
 * @param managedForm the managed form
 * @param w1 the w 1
 * @param w2 the w 2
 * @return the form 2 panel
 */
public Form2Panel setup2ColumnLayout(IManagedForm managedForm, int w1, int w2) {
  final ScrolledForm sform = managedForm.getForm();
  final Composite form = sform.getBody();
  form.setLayout(new GridLayout(1, false)); // this is required !
  Composite xtra = toolkit.createComposite(form);
  xtra.setLayout(new GridLayout(1, false));
  xtra.setLayoutData(new GridData(GridData.FILL_BOTH));
  Control c = xtra.getParent();
  while (!(c instanceof ScrolledComposite))
    c = c.getParent();
  ((GridData) xtra.getLayoutData()).widthHint = c.getSize().x;
  ((GridData) xtra.getLayoutData()).heightHint = c.getSize().y;
  sashForm = new SashForm(xtra, SWT.HORIZONTAL);

  sashForm.setLayoutData(new GridData(GridData.FILL_BOTH)); // needed

  leftPanel = newComposite(sashForm);
  ((GridLayout) leftPanel.getLayout()).marginHeight = 5;
  ((GridLayout) leftPanel.getLayout()).marginWidth = 5;
  rightPanel = newComposite(sashForm);
  ((GridLayout) rightPanel.getLayout()).marginHeight = 5;
  ((GridLayout) rightPanel.getLayout()).marginWidth = 5;
  sashForm.setWeights(new int[] { w1, w2 });
  leftPanelPercent = (float) w1 / (float) (w1 + w2);
  rightPanelPercent = (float) w2 / (float) (w1 + w2);

  rightPanel.addControlListener(new ControlAdapter() {
    @Override
    public void controlResized(ControlEvent e) {
      setSashFormWidths();
    }
  });

  return new Form2Panel(form, leftPanel, rightPanel);
}
 
源代码13 项目: uima-uimaj   文件: HeaderPage.java
/**
 * Setup 2 column layout not sash.
 *
 * @param managedForm the managed form
 * @param equalWidth the equal width
 * @return the form 2 panel
 */
public Form2Panel setup2ColumnLayoutNotSash(IManagedForm managedForm, boolean equalWidth) {
  final ScrolledForm sform = managedForm.getForm();
  final Composite form = sform.getBody();
  GridLayout layout = new GridLayout(2, equalWidth);
  form.setLayout(layout);
  form.setLayoutData(new GridData(GridData.FILL_BOTH));
  leftPanel = newComposite(form);
  rightPanel = newComposite(form);
  // strategy for setting size hints of right and left panels
  // Why set hints? Because they make the inner containing things
  // scroll horiz. if they're too wide (useful for aggregates having
  // long names).
  // What hint to set? The hint should be the smallest size you want
  // with child scrolling, before the tabbed page container itself
  // gets a scroll bar.
  // When in the life cycle to do this? Only need to do it once, but
  // after the Grid Layout has happened. This can be the first resizing
  // event (learned this by debugging)

  sform.addListener(SWT.Resize, new Listener() {
    @Override
    public void handleEvent(Event event) {
      float col1CurrentWidth = leftPanel.getSize().x;
      float col2CurrentWidth = rightPanel.getSize().x;
      final int minLeftPanelWidth = 250; // in pels
      final int minRightPanelWidth = (int) (col2CurrentWidth * minLeftPanelWidth / col1CurrentWidth);
      ((GridData) leftPanel.getLayoutData()).widthHint = minLeftPanelWidth;
      ((GridData) rightPanel.getLayoutData()).widthHint = minRightPanelWidth;
      sform.removeListener(SWT.Resize, this); // only do this one time
    }
  });
  return new Form2Panel(form, leftPanel, rightPanel);
}
 
源代码14 项目: uima-uimaj   文件: HeaderPageWithSash.java
/**
 * Creates the tool bar actions.
 *
 * @param managedForm the managed form
 */
protected void createToolBarActions(IManagedForm managedForm) {
  final ScrolledForm form = managedForm.getForm();

  haction = new Action("hor", IAction.AS_RADIO_BUTTON) { //$NON-NLS-1$
    @Override
    public void run() {
      sashForm.setOrientation(SWT.HORIZONTAL);
      form.reflow(true);
    }
  };
  haction.setChecked(true);
  haction.setToolTipText("Horizontal Orientation");
  TAEConfiguratorPlugin instance = TAEConfiguratorPlugin.getDefault();
  haction.setImageDescriptor(instance
          .getImageDescriptor(TAEConfiguratorPlugin.IMAGE_TH_HORIZONTAL));
  haction.setDisabledImageDescriptor(instance
          .getImageDescriptor(TAEConfiguratorPlugin.IMAGE_TH_HORIZONTAL));

  vaction = new Action("ver", IAction.AS_RADIO_BUTTON) { //$NON-NLS-1$
    @Override
    public void run() {
      sashForm.setOrientation(SWT.VERTICAL);
      form.reflow(true);
    }
  };
  vaction.setChecked(false);
  vaction.setToolTipText("Vertical Orientation");
  vaction.setImageDescriptor(instance
          .getImageDescriptor(TAEConfiguratorPlugin.IMAGE_TH_VERTICAL));
  vaction.setDisabledImageDescriptor(instance
          .getImageDescriptor(TAEConfiguratorPlugin.IMAGE_TH_VERTICAL));
  form.getToolBarManager().add(haction);
  form.getToolBarManager().add(vaction);
  form.updateToolBar();
  maybeInitialize(managedForm);
}
 
源代码15 项目: olca-app   文件: LogFileEditor.java
@Override
protected void createFormContent(IManagedForm mform) {
	ScrolledForm form = mform.getForm();
	FormToolkit toolkit = mform.getToolkit();
	UI.formHeader(mform, M.OpenLCALog);
	Composite body = UI.formBody(form, toolkit);
	Browser browser = new Browser(body, SWT.NONE);
	UI.gridData(browser, true, true);
	try {
		browser.setUrl(file.toURI().toURL().toString());
	} catch (IOException e) {
		log.error("Error loading log files", e);
	}
}
 
源代码16 项目: olca-app   文件: AddRepositoryDialog.java
@Override
protected void createFormContent(IManagedForm mform) {
	ScrolledForm form = mform.getForm();
	FormToolkit toolkit = mform.getToolkit();
	UI.formHeader(mform, M.AddNewRepository);
	Composite body = UI.formBody(form, toolkit);
	UI.gridLayout(body, 3);
	createConfigViewer(body, toolkit);
	createRepositoryViewer(body, toolkit);
	initConfigViewer();

}
 
源代码17 项目: olca-app   文件: ConfigureRepositoriesDialog.java
@Override
protected void createFormContent(IManagedForm mform) {
	ScrolledForm form = mform.getForm();
	FormToolkit toolkit = mform.getToolkit();
	UI.formHeader(mform, M.ConfigureRepositories);
	Composite body = UI.formBody(form, toolkit);
	viewer = new RepositoryConfigViewer(body);
	Tables.bindColumnWidths(viewer.getViewer(), 0.4, 0.3, 0.2, 0.1);
	viewer.setInput(RepositoryConfig.loadAll(Database.get()));
	Actions.bind(viewer.getViewer(), new AddAction(), new RemoveAction());
}
 
源代码18 项目: tlaplus   文件: BasicFormPage.java
/**
  * 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);
 }
 
源代码19 项目: thym   文件: PropertiesPage.java
@Override
protected void createFormContent(IManagedForm managedForm) {
	super.createFormContent(managedForm);
	final ScrolledForm form = managedForm.getForm();
	
	formToolkit.decorateFormHeading( form.getForm());
	managedForm.getForm().setText(getTitle());

	GridLayout formGridLayout = new GridLayout();
	formGridLayout.horizontalSpacing = FormUtils.FORM_BODY_HORIZONTAL_SPACING;
	formGridLayout.verticalSpacing = FormUtils.FORM_BODY_VERTICAL_SPACING;
	formGridLayout.marginBottom = FormUtils.FORM_BODY_MARGIN_BOTTOM;
	formGridLayout.marginTop = FormUtils.FORM_BODY_MARGIN_TOP;
	formGridLayout.marginRight = FormUtils.FORM_BODY_MARGIN_RIGHT;
	formGridLayout.marginLeft = FormUtils.FORM_BODY_MARGIN_LEFT;
	formGridLayout.marginWidth =FormUtils.FORM_BODY_MARGIN_WIDTH;
	formGridLayout.marginHeight = FormUtils.FORM_BODY_MARGIN_HEIGHT;
	formGridLayout.makeColumnsEqualWidth = true;
	formGridLayout.numColumns = 2;
	Composite body = managedForm.getForm().getBody();
	body.setLayout(formGridLayout);
	
	Composite left, right;
	left = formToolkit.createComposite(body);
	left.setLayout(FormUtils.createFormPaneGridLayout(false, 1));
	GridDataFactory.fillDefaults().grab(true, true).applyTo(left);;
	right = formToolkit.createComposite(body);
	right.setLayout(FormUtils.createFormPaneGridLayout(false, 1));
	GridDataFactory.fillDefaults().grab(true, true).applyTo(right);
	
	
	createFeaturesSection(left);
	createFeatureParamsSection(right);
	createPreferencesSection(left);
	createAccessSection(right);
	
	m_bindingContext = initDataBindings();
	
	selectFirstFeature();
	
}
 
源代码20 项目: ice   文件: ListComponentSectionPage.java
@Override
protected void createFormContent(IManagedForm managedForm) {

	// Get the parent form and the toolkit
	final ScrolledForm scrolledForm = managedForm.getForm();
	final FormToolkit formToolkit = managedForm.getToolkit();

	// Set a GridLayout with a single column. Remove the default margins.
	GridLayout layout = new GridLayout(1, true);
	layout.marginWidth = 0;
	layout.marginHeight = 0;
	scrolledForm.getBody().setLayout(layout);

	// Only create something if there is valid input.
	if (list != null) {

		// Get the parent
		Composite parent = managedForm.getForm().getBody();

		shell = parent.getShell();
		// Create the section and set its layout info
		Section listSection = formToolkit.createSection(parent,
				ExpandableComposite.TITLE_BAR | Section.DESCRIPTION
						| ExpandableComposite.TWISTIE
						| ExpandableComposite.EXPANDED
						| ExpandableComposite.COMPACT);
		listSection.setLayout(new GridLayout(1, false));
		listSection.setLayoutData(
				new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
		// Create the section client, which is the client area of the
		// section that will actually render data.
		sectionClient = new Composite(listSection, SWT.FLAT);
		sectionClient.setLayout(new GridLayout(2, false));
		sectionClient.setLayoutData(
				new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
		// Fixes section header bug where label color is spammed
		sectionClient.setBackground(
				Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
		// Fixes background color bug for NatTable
		sectionClient.setBackgroundMode(SWT.INHERIT_FORCE);

		// Draws the table and sets that instance variable
		table = new ListComponentNattable(sectionClient, list, true);

		// Create the buttons for add, delete, up, and down
		createButtons();

		// Set the section client.
		listSection.setClient(sectionClient);
	}

	return;
}