org.eclipse.ui.forms.widgets.TableWrapData Java Examples

The following examples show how to use org.eclipse.ui.forms.widgets.TableWrapData. 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: UIHelper.java    From tlaplus with MIT License 6 votes vote down vote up
/**
 * This appropriately scales the non-zero spatial values contained in the
 * <code>TableWrapData</code> instance to observe display scaling.
 * 
 * @param tableWrapData the <code>TableWrapData</code> which should be altered
 */
public static void appropriatelyScaleTableWrapData(final TableWrapData tableWrapData) {
	// Windows and Mac appear to do the correct thing
	if (Platform.getOS().equals(Platform.OS_LINUX)) {
		final double scale = getDisplayScaleFactor();
		
		tableWrapData.indent = (int)((double)tableWrapData.indent * scale);
		
		if (tableWrapData.maxWidth != SWT.DEFAULT) {
			tableWrapData.maxWidth = (int)((double)tableWrapData.maxWidth * scale);
		}
		if (tableWrapData.maxHeight != SWT.DEFAULT) {
			tableWrapData.maxHeight = (int)((double)tableWrapData.maxHeight * scale);
		}
		if (tableWrapData.heightHint != SWT.DEFAULT) {
			tableWrapData.heightHint = (int)((double)tableWrapData.heightHint * scale);
		}
	}
}
 
Example #2
Source File: EigendiagnoseDetailDisplay.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
public Composite createDisplay(Composite parent, IViewSite site){
	form = UiDesk.getToolkit().createForm(parent);
	TableWrapLayout twl = new TableWrapLayout();
	form.getBody().setLayout(twl);
	
	tblPls = new LabeledInputField.AutoForm(form.getBody(), data);
	tblPls.setModelService(ModelServiceHolder.get());
	
	TableWrapData twd = new TableWrapData(TableWrapData.FILL_GRAB);
	twd.grabHorizontal = true;
	tblPls.setLayoutData(twd);
	TableWrapData twd2 = new TableWrapData(TableWrapData.FILL_GRAB);
	tComment = UiDesk.getToolkit().createText(form.getBody(), StringTool.leer, SWT.BORDER);
	tComment.setLayoutData(twd2);
	return form.getBody();
}
 
Example #3
Source File: SWTHelper.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Ein TableWrapDAta-Objekt erzeugen, das den horizontalen und/oder vertikalen Freiraum
 * ausfüllt.
 * 
 * @param horizontal
 *            true, wenn horizontal gefüllt werden soll
 * @param vertical
 *            true, wenn vertikal gefüllt werden soll.
 * @return ein neu erzeugtes, direkt verwendbares GridData-Objekt
 */
public static TableWrapData getFillTableWrapData(final int hSpan, final boolean hFill,
	final int vSpan, final boolean vFill){
	TableWrapData layoutData = new TableWrapData(TableWrapData.LEFT, TableWrapData.TOP);
	
	if (hFill) {
		layoutData.grabHorizontal = true;
		layoutData.align = TableWrapData.FILL;
	}
	if (vFill) {
		layoutData.grabVertical = true;
		layoutData.valign = TableWrapData.FILL;
	}
	
	layoutData.colspan = (hSpan < 1 ? 1 : hSpan);
	layoutData.rowspan = (vSpan < 1 ? 1 : vSpan);
	
	return layoutData;
}
 
Example #4
Source File: Artikeldetail.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void createPartControl(Composite parent){
	parent.setLayout(new FillLayout());
	form = tk.createScrolledForm(parent);
	TableWrapLayout twl = new TableWrapLayout();
	form.getBody().setLayout(twl);
	
	tblArtikel =
		new LabeledInputField.AutoForm(form.getBody(), getFieldDefs(parent.getShell()));
	
	TableWrapData twd = new TableWrapData(TableWrapData.FILL_GRAB);
	twd.grabHorizontal = true;
	tblArtikel.setLayoutData(twd);
	GlobalEventDispatcher.addActivationListener(this, this);
	
}
 
Example #5
Source File: FormsPart.java    From codeexamples-eclipse with Eclipse Public License 1.0 6 votes vote down vote up
private void createSecondSection( ScrolledForm form, FormToolkit toolkit) {
	ExpandableComposite ec = toolkit.createExpandableComposite(form.getBody(), 
		     ExpandableComposite.TREE_NODE|
		     ExpandableComposite.CLIENT_INDENT);
		 ec.setText("Expandable Composite title");
		 String ctext = "We will now create a somewhat long text so that "+
		 "we can use it as content for the expandable composite. "+
		 "Expandable composite is used to hide or show the text using the " +
		 "toggle control";
		 Label client = toolkit.createLabel(ec, ctext, SWT.WRAP);
		 ec.setClient(client);
		 TableWrapData  td = new TableWrapData();
		 td.colspan = 2;
		 ec.setLayoutData(td);
		 ec.addExpansionListener(new ExpansionAdapter() {
		  @Override
		public void expansionStateChanged(ExpansionEvent e) {
		   form.reflow(true);
		  }
		 });

	
}
 
Example #6
Source File: EssentialsPage.java    From thym with Eclipse Public License 1.0 6 votes vote down vote up
private void createAuthorSection(Composite parent) {
	Section sctnAuthor = createSection(parent, "Author");
	sctnAuthor.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));

	Composite composite = formToolkit.createComposite(sctnAuthor, SWT.WRAP);
	formToolkit.paintBordersFor(composite);
	sctnAuthor.setClient(composite);
	composite.setLayout(FormUtils.createSectionClientGridLayout(false, 2));

	createFormFieldLabel(composite, "Name:");

	txtAuthorname = formToolkit.createText(composite, "", SWT.WRAP);
	txtAuthorname.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

	createFormFieldLabel(composite, "Email:");

	txtEmail = formToolkit.createText(composite, "", SWT.NONE);
	txtEmail.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

	createFormFieldLabel(composite, "URL:");

	txtUrl = formToolkit.createText(composite, "", SWT.NONE);
	txtUrl.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
}
 
Example #7
Source File: EssentialsPage.java    From thym with Eclipse Public License 1.0 6 votes vote down vote up
private void createPluginsSection(Composite parent) {
	Section sctnPlugins = createSection(parent, "Plug-ins");
	sctnPlugins.setLayout(FormUtils.createClearTableWrapLayout(false, 1));
	TableWrapData data = new TableWrapData(TableWrapData.FILL_GRAB);
	sctnPlugins.setLayoutData(data);

	FormText text = formToolkit.createFormText(sctnPlugins, true);
	ImageDescriptor idesc = HybridUI.getImageDescriptor(HybridUI.PLUGIN_ID, "/icons/etool16/cordovaplug_wiz.png");
	text.setImage("plugin", idesc.createImage());

	text.setText(PLUGINS_SECTION_CONTENT, true, false);

	sctnPlugins.setClient(text);
	text.addHyperlinkListener(this);

}
 
Example #8
Source File: HintTextGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
   * Creates a form text.
   *
   * @param parent the parent to put the form text on
   * @param text the form text to be displayed
   * @return the created form text
   *
   * @see FormToolkit#createFormText(org.eclipse.swt.widgets.Composite, boolean)
   */
  private FormText createFormText(Composite parent, String text) {
      FormToolkit toolkit= new FormToolkit(getShell().getDisplay());
      try {
      	FormText formText= toolkit.createFormText(parent, true);
      	formText.setFont(parent.getFont());
	try {
	    formText.setText(text, true, false);
	} catch (IllegalArgumentException e) {
	    formText.setText(e.getMessage(), false, false);
	    JavaPlugin.log(e);
	}
	formText.marginHeight= 2;
	formText.marginWidth= 0;
	formText.setBackground(null);
	formText.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
	return formText;
} finally {
       toolkit.dispose();
}
  }
 
Example #9
Source File: FilesPage.java    From typescript.java with MIT License 6 votes vote down vote up
private void createScopeSection(Composite parent) {
	FormToolkit toolkit = super.getToolkit();
	Section section = toolkit.createSection(parent, Section.DESCRIPTION | Section.TITLE_BAR);
	section.setDescription(TsconfigEditorMessages.FilesPage_ScopeSection_desc);
	section.setText(TsconfigEditorMessages.FilesPage_ScopeSection_title);
	TableWrapData data = new TableWrapData(TableWrapData.FILL_GRAB);
	section.setLayoutData(data);

	Composite client = toolkit.createComposite(section);
	section.setClient(client);
	GridLayout layout = new GridLayout();
	layout.numColumns = 1;
	layout.marginWidth = 2;
	layout.marginHeight = 2;
	client.setLayout(layout);

	Table table = toolkit.createTable(client, SWT.NONE);
	GridData gd = new GridData(GridData.FILL_BOTH);
	gd.heightHint = 200;
	gd.widthHint = 100;
	table.setLayoutData(gd);
}
 
Example #10
Source File: OutputPage.java    From typescript.java with MIT License 6 votes vote down vote up
private void createReportingSection(Composite parent) {
	FormToolkit toolkit = super.getToolkit();
	Section section = toolkit.createSection(parent, Section.DESCRIPTION | Section.TITLE_BAR);
	section.setDescription(TsconfigEditorMessages.OutputPage_ReportingSection_desc);
	section.setText(TsconfigEditorMessages.OutputPage_ReportingSection_title);
	TableWrapData data = new TableWrapData(TableWrapData.FILL_GRAB);
	section.setLayoutData(data);

	Composite body = createBody(section);

	createCheckbox(body, TsconfigEditorMessages.OutputPage_diagnostics_label,
			new JSONPath("compilerOptions.diagnostics"));
	createCheckbox(body, TsconfigEditorMessages.OutputPage_pretty_label, new JSONPath("compilerOptions.pretty"));
	createCheckbox(body, TsconfigEditorMessages.OutputPage_traceResolution_label,
			new JSONPath("compilerOptions.traceResolution"));
	createCheckbox(body, TsconfigEditorMessages.OutputPage_listEmittedFiles_label,
			new JSONPath("compilerOptions.listEmittedFiles"));
}
 
Example #11
Source File: OutputPage.java    From typescript.java with MIT License 6 votes vote down vote up
private void createDebuggingSection(Composite parent) {
	FormToolkit toolkit = super.getToolkit();
	Section section = toolkit.createSection(parent, Section.DESCRIPTION | Section.TITLE_BAR);
	section.setDescription(TsconfigEditorMessages.OutputPage_DebuggingSection_desc);
	section.setText(TsconfigEditorMessages.OutputPage_DebuggingSection_title);
	TableWrapData data = new TableWrapData(TableWrapData.FILL_GRAB);
	section.setLayoutData(data);
	Composite body = createBody(section);

	createCheckbox(body, TsconfigEditorMessages.OutputPage_sourceMap_label,
			new JSONPath("compilerOptions.sourceMap"));
	createTextAndBrowseButton(body, TsconfigEditorMessages.OutputPage_sourceRoot_label,
			new JSONPath("compilerOptions.sourceRoot"), false);
	createTextAndBrowseButton(body, TsconfigEditorMessages.OutputPage_mapRoot_label,
			new JSONPath("compilerOptions.mapRoot"), false);
	createCheckbox(body, TsconfigEditorMessages.OutputPage_inlineSourceMap_label,
			new JSONPath("compilerOptions.inlineSourceMap"));
	createCheckbox(body, TsconfigEditorMessages.OutputPage_inlineSources_label,
			new JSONPath("compilerOptions.inlineSources"));
}
 
Example #12
Source File: OverviewPage.java    From typescript.java with MIT License 6 votes vote down vote up
private void createGeneralInformationSection(Composite parent) {
	FormToolkit toolkit = super.getToolkit();
	Section section = toolkit.createSection(parent, Section.DESCRIPTION | Section.TITLE_BAR);
	section.setDescription(TsconfigEditorMessages.OverviewPage_GeneralInformationSection_desc);
	section.setText(TsconfigEditorMessages.OverviewPage_GeneralInformationSection_title);
	TableWrapData data = new TableWrapData(TableWrapData.FILL_GRAB);
	section.setLayoutData(data);

	Composite body = createBody(section);

	// Target/Module
	createCombo(body, TsconfigEditorMessages.OverviewPage_target_label, new JSONPath("compilerOptions.target"),
			TsconfigJson.getAvailableTargets(), TsconfigJson.getDefaultTarget());
	createCombo(body, TsconfigEditorMessages.OverviewPage_module_label, new JSONPath("compilerOptions.module"),
			TsconfigJson.getAvailableModules());
	createCombo(body, TsconfigEditorMessages.OverviewPage_moduleResolution_label,
			new JSONPath("compilerOptions.moduleResolution"), TsconfigJson.getAvailableModuleResolutions(),
			TsconfigJson.getDefaultModuleResolution());
	// Others....
	createCheckbox(body, TsconfigEditorMessages.OverviewPage_experimentalDecorators_label,
			new JSONPath("compilerOptions.experimentalDecorators"));

}
 
Example #13
Source File: OutputPage.java    From typescript.java with MIT License 5 votes vote down vote up
private void createJSXSection(Composite parent) {
	FormToolkit toolkit = super.getToolkit();
	Section section = toolkit.createSection(parent, Section.DESCRIPTION | Section.TITLE_BAR);
	section.setDescription(TsconfigEditorMessages.OutputPage_JSXSection_desc);
	section.setText(TsconfigEditorMessages.OutputPage_JSXSection_title);
	TableWrapData data = new TableWrapData(TableWrapData.FILL_GRAB);
	section.setLayoutData(data);

	Composite body = createBody(section);

	CCombo jsxCombo = createCombo(body, TsconfigEditorMessages.OutputPage_jsx_label,
			new JSONPath("compilerOptions.jsx"), new String[] { "", "preserve", "react" });
	Text reactNamespaceText = createText(body, TsconfigEditorMessages.OutputPage_reactNamespace_label,
			new JSONPath("compilerOptions.reactNamespace"), null, "jsxFactory");
}
 
Example #14
Source File: TextDropComponent.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
private void createRemoveButton() {
	removeButton = toolkit.createButton(this, "", SWT.PUSH);
	removeButton.setLayoutData(new TableWrapData());
	removeButton.setImage(Icon.DELETE.get());
	removeButton
			.setToolTipText(M.RemoveObject);
	if (content == null)
		removeButton.setEnabled(false);
	Controls.onSelect(removeButton, e -> {
		setContent(null);
		if (handler != null) {
			handler.accept(null);
		}
	});
}
 
Example #15
Source File: TextDropComponent.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
private void createTextField() {
	text = toolkit.createText(this, "", SWT.BORDER);
	text.setEditable(false);
	TableWrapData layoutData = new TableWrapData(TableWrapData.FILL,
			TableWrapData.FILL);
	layoutData.grabHorizontal = true;
	text.setLayoutData(layoutData);
	if (content != null)
		text.setText(content.name);
}
 
Example #16
Source File: TextDropComponent.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
private void createAddButton() {
	var btn = toolkit.createButton(this, "", SWT.PUSH);
	btn.setToolTipText(M.TextDropComponent_ToolTipText);
	btn.setLayoutData(new TableWrapData());
	btn.setImage(Images.get(modelType));
	btn.addMouseListener(new MouseAdapter() {
		@Override
		public void mouseDown(final MouseEvent e) {
			var d = ModelSelectionDialog.select(modelType);
			if (d != null) {
				handleAdd(d);
			}
		}
	});
}
 
Example #17
Source File: OverviewPage.java    From typescript.java with MIT License 5 votes vote down vote up
private void createLeftContent(Composite parent) {
	FormToolkit toolkit = super.getToolkit();
	Composite left = toolkit.createComposite(parent);
	left.setLayout(FormLayoutFactory.createFormPaneTableWrapLayout(false, 1));
	left.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
	// General Information
	createGeneralInformationSection(left);
	// Compiler section
	createCompilerSection(left);
}
 
Example #18
Source File: StickerComposite.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
public StickerComposite(Composite parent, int style, FormToolkit toolkit){
	super(parent, style);
	setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
	ColumnLayout cwl = new ColumnLayout();
	cwl.maxNumColumns = 4;
	cwl.horizontalSpacing = 1;
	cwl.bottomMargin = 10;
	cwl.topMargin = 0;
	cwl.rightMargin = 1;
	cwl.leftMargin = 1;
	setLayout(cwl);
	setBackground(parent.getBackground());
	this.toolkit = toolkit;
	this.setVisible(false);
}
 
Example #19
Source File: OverviewPage.java    From typescript.java with MIT License 5 votes vote down vote up
private void createRightContent(Composite parent) {
	FormToolkit toolkit = super.getToolkit();
	Composite right = toolkit.createComposite(parent);
	right.setLayout(FormLayoutFactory.createFormPaneTableWrapLayout(false, 1));
	right.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
	createValidatingSection(right);
}
 
Example #20
Source File: EssentialsPage.java    From thym with Eclipse Public License 1.0 5 votes vote down vote up
private void createExportSection(Composite parent) {
	Section sctnExport = createSection(parent, "Export");
	sctnExport.setLayout(FormUtils.createClearTableWrapLayout(false, 1));
	TableWrapData data = new TableWrapData(TableWrapData.FILL_GRAB);
	sctnExport.setLayoutData(data);
	FormText text = formToolkit.createFormText(sctnExport, true);
	ImageDescriptor idesc = HybridUI.getImageDescriptor(HybridUI.PLUGIN_ID, "/icons/etool16/export_wiz.png");
	text.setImage("export", idesc.createImage());
	text.setText(EXPORT_SECTION_CONTENT, true, false);

	sctnExport.setClient(text);
	text.addHyperlinkListener(this);
}
 
Example #21
Source File: OutputPage.java    From typescript.java with MIT License 5 votes vote down vote up
private void createLeftContent(Composite parent) {
	FormToolkit toolkit = super.getToolkit();
	Composite left = toolkit.createComposite(parent);
	left.setLayout(FormLayoutFactory.createFormPaneTableWrapLayout(false, 1));
	left.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
	createOutputSection(left);
}
 
Example #22
Source File: EssentialsPage.java    From thym with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected void createFormContent(IManagedForm managedForm) {
	super.createFormContent(managedForm);
	final ScrolledForm form = managedForm.getForm();
	formToolkit.decorateFormHeading(form.getForm());
	managedForm.getForm().setText(getTitle());
	Composite body = managedForm.getForm().getBody();
	body.setLayout(FormUtils.createFormTableWrapLayout(2));

	Composite left = formToolkit.createComposite(body);
	left.setLayout(FormUtils.createFormPaneTableWrapLayout(1));
	left.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));

	Composite right = formToolkit.createComposite(body);
	right.setLayout(FormUtils.createFormPaneTableWrapLayout(1));
	right.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));

	createNameDescriptionSection(left);
	createAuthorSection(left);
	createExportSection(left);

	createPluginsSection(right);
	createEngineSection(right);

	m_bindingContext = initDataBindings();
	bindAuthor(m_bindingContext); // binding separately is necessary to be able to work with WindowBuilder
	bindContent(m_bindingContext);

}
 
Example #23
Source File: OutputPage.java    From typescript.java with MIT License 5 votes vote down vote up
private void createRightContent(Composite parent) {
	FormToolkit toolkit = super.getToolkit();
	Composite right = toolkit.createComposite(parent);
	right.setLayout(FormLayoutFactory.createFormPaneTableWrapLayout(false, 1));
	right.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
	createDebuggingSection(right);
	createReportingSection(right);
	createJSXSection(right);
}
 
Example #24
Source File: OutputPage.java    From typescript.java with MIT License 5 votes vote down vote up
private void createOutputSection(Composite parent) {
	FormToolkit toolkit = super.getToolkit();
	Section section = toolkit.createSection(parent, Section.DESCRIPTION | Section.TITLE_BAR);
	section.setDescription(TsconfigEditorMessages.OutputPage_OutputSection_desc);
	section.setText(TsconfigEditorMessages.OutputPage_OutputSection_title);
	TableWrapData data = new TableWrapData(TableWrapData.FILL_GRAB);
	section.setLayoutData(data);

	Composite body = createBody(section);

	createTextAndBrowseButton(body, TsconfigEditorMessages.OutputPage_rootDir_label,
			new JSONPath("compilerOptions.rootDir"), false);
	createTextAndBrowseButton(body, TsconfigEditorMessages.OutputPage_outFile_label,
			new JSONPath("compilerOptions.outFile"), true);
	createTextAndBrowseButton(body, TsconfigEditorMessages.OutputPage_outDir_label,
			new JSONPath("compilerOptions.outDir"), false);

	createCheckbox(body, TsconfigEditorMessages.OutputPage_noEmit_label, new JSONPath("compilerOptions.noEmit"));
	createCheckbox(body, TsconfigEditorMessages.OutputPage_noEmitHelpers_label,
			new JSONPath("compilerOptions.noEmitHelpers"));
	createCheckbox(body, TsconfigEditorMessages.OutputPage_noEmitOnError_label,
			new JSONPath("compilerOptions.noEmitOnError"));
	createCheckbox(body, TsconfigEditorMessages.OutputPage_emitDecoratorMetadata_label,
			new JSONPath("compilerOptions.emitDecoratorMetadata"));
	createCheckbox(body, TsconfigEditorMessages.OutputPage_declaration_label,
			new JSONPath("compilerOptions.declaration"));
	createTextAndBrowseButton(body, TsconfigEditorMessages.OutputPage_declarationDir_label,
			new JSONPath("compilerOptions.declarationDir"), false);
	createCheckbox(body, TsconfigEditorMessages.OutputPage_emitBOM_label, new JSONPath("compilerOptions.emitBOM"));
	createCheckbox(body, TsconfigEditorMessages.OutputPage_preserveConstEnums_label,
			new JSONPath("compilerOptions.preserveConstEnums"));
	createCheckbox(body, TsconfigEditorMessages.OutputPage_removeComments_label,
			new JSONPath("compilerOptions.removeComments"));
	createCheckbox(body, TsconfigEditorMessages.OutputPage_isolatedModules_label,
			new JSONPath("compilerOptions.isolatedModules"));
	createCheckbox(body, TsconfigEditorMessages.OutputPage_stripInternal_label,
			new JSONPath("compilerOptions.stripInternal"));
}
 
Example #25
Source File: NodeInfoViewer.java    From jbt with Apache License 2.0 4 votes vote down vote up
/**
 * Updates all the information that is displayed on the Composite, by
 * obtaining it from the BTNode.
 */
private void updateView() {
	/* Clean previos information. */
	if (this.global.getBody().getChildren().length != 0) {
		for (Control c : this.global.getBody().getChildren()) {
			c.dispose();
		}
	}

	/* If child is null, do nothing. */
	if (this.node == null) {
		return;
	}

	Composite parent = this.global.getBody();
	this.toolkit.createLabel(parent, "Type").setLayoutData(
			new TableWrapData(TableWrapData.LEFT));
	Label valueLabel = this.toolkit.createLabel(parent, "", SWT.RIGHT);
	valueLabel.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));

	if (!this.node.getConceptualNode().getType().equals(NodeInternalType.ACTION.toString())
			&& !this.node.getConceptualNode().getType()
					.equals(NodeInternalType.CONDITION.toString())) {
		valueLabel.setText(this.node.getConceptualNode().getReadableType());
	} else {
		valueLabel.setText(this.node.getConceptualNode().getType());
	}

	/* Shows node's ID. */
	this.toolkit.createLabel(parent, "ID");
	this.toolkit.createLabel(parent, this.node.getID().toString(), SWT.RIGHT).setLayoutData(
			new TableWrapData(TableWrapData.FILL_GRAB));

	/* Shows name of the node. */
	if (this.node.getConceptualNode().getHasName()) {
		this.toolkit.createLabel(parent, "Name");

		valueLabel = this.toolkit.createLabel(parent, "", SWT.RIGHT);
		valueLabel.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));

		/* This is for the root. */
		if (this.node.getConceptualNode().getType().equals(NodeInternalType.ROOT.toString())) {
			if (this.node.getName() != null) {
				valueLabel.setText(this.node.getName());
			} else {
				valueLabel.setText("Not assigned");
			}
		} else {
			valueLabel.setText(this.node.getConceptualNode().getReadableType());
		}
	}

	/* Show parameters. */
	List<Parameter> parameters = this.node.getParameters();

	for (Parameter p : parameters) {
		Label nameLabel = this.toolkit.createLabel(parent, "");
		valueLabel = this.toolkit.createLabel(parent, p.getValue(), SWT.RIGHT);
		valueLabel.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));

		nameLabel.setText(p.getName() + (p.getFromContext() ? " (from context)" : ""));
	}

	/* Show error message. */
	if (this.node.getErrorMessage() != null) {
		this.toolkit.createLabel(parent, "ERROR");
		this.toolkit.createLabel(parent, this.node.getErrorMessage(), SWT.RIGHT).setLayoutData(
				new TableWrapData(TableWrapData.FILL_GRAB));
	}

	/* Lay out the Composite so that it refreshes. */
	global.reflow(true);
}
 
Example #26
Source File: OverviewPage.java    From typescript.java with MIT License 4 votes vote down vote up
private void createValidatingSection(Composite parent) {
	FormToolkit toolkit = super.getToolkit();
	Section section = toolkit.createSection(parent, Section.DESCRIPTION | Section.TITLE_BAR);
	section.setDescription(TsconfigEditorMessages.OverviewPage_ValidatingSection_desc);
	section.setText(TsconfigEditorMessages.OverviewPage_ValidatingSection_title);
	TableWrapData data = new TableWrapData(TableWrapData.FILL_GRAB);
	section.setLayoutData(data);

	Composite body = createBody(section);

	createCheckbox(body, TsconfigEditorMessages.OverviewPage_noImplicitAny_label,
			new JSONPath("compilerOptions.noImplicitAny"));
	createCheckbox(body, TsconfigEditorMessages.OverviewPage_noImplicitThis_label,
			new JSONPath("compilerOptions.noImplicitThis"));
	createCheckbox(body, TsconfigEditorMessages.OverviewPage_noUnusedLocals_label,
			new JSONPath("compilerOptions.noUnusedLocals"));
	createCheckbox(body, TsconfigEditorMessages.OverviewPage_noUnusedParameters_label,
			new JSONPath("compilerOptions.noUnusedParameters"));
	createCheckbox(body, TsconfigEditorMessages.OverviewPage_skipDefaultLibCheck_label,
			new JSONPath("compilerOptions.skipDefaultLibCheck"));
	createCheckbox(body, TsconfigEditorMessages.OverviewPage_skipLibCheck_label,
			new JSONPath("compilerOptions.skipLibCheck"));
	createCheckbox(body, TsconfigEditorMessages.OverviewPage_suppressExcessPropertyErrors_label,
			new JSONPath("compilerOptions.suppressExcessPropertyErrors"));
	createCheckbox(body, TsconfigEditorMessages.OverviewPage_suppressImplicitAnyIndexErrors_label,
			new JSONPath("compilerOptions.suppressImplicitAnyIndexErrors"));
	createCheckbox(body, TsconfigEditorMessages.OverviewPage_allowUnusedLabels_label,
			new JSONPath("compilerOptions.allowUnusedLabels"));
	createCheckbox(body, TsconfigEditorMessages.OverviewPage_noImplicitReturns_label,
			new JSONPath("compilerOptions.noImplicitReturns"));
	createCheckbox(body, TsconfigEditorMessages.OverviewPage_noFallthroughCasesInSwitch_label,
			new JSONPath("compilerOptions.noFallthroughCasesInSwitch"));
	createCheckbox(body, TsconfigEditorMessages.OverviewPage_allowUnreachableCode_label,
			new JSONPath("compilerOptions.allowUnreachableCode"));
	createCheckbox(body, TsconfigEditorMessages.OverviewPage_forceConsistentCasingInFileNames_label,
			new JSONPath("compilerOptions.forceConsistentCasingInFileNames"));
	createCheckbox(body, TsconfigEditorMessages.OverviewPage_allowSyntheticDefaultImports_label,
			new JSONPath("compilerOptions.allowSyntheticDefaultImports"));
	createCheckbox(body, TsconfigEditorMessages.OverviewPage_strictNullChecks_label,
			new JSONPath("compilerOptions.strictNullChecks"));
}
 
Example #27
Source File: DBImportFirstPage.java    From elexis-3-core with Eclipse Public License 1.0 4 votes vote down vote up
public void createControl(Composite parent){
	DBImportWizard wiz = (DBImportWizard) getWizard();
	
	FormToolkit tk = UiDesk.getToolkit();
	Form form = tk.createForm(parent);
	form.setText(Messages.DBImportFirstPage_Connection); //$NON-NLS-1$
	Composite body = form.getBody();
	body.setLayout(new TableWrapLayout());
	tk.createLabel(body, Messages.DBImportFirstPage_EnterType); //$NON-NLS-1$
	dbTypes = new List(body, SWT.BORDER);
	dbTypes.setItems(supportedDB);
	dbTypes.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e){
			int it = dbTypes.getSelectionIndex();
			switch (it) {
			case MYSQL:
			case POSTGRESQL:
				server.setEnabled(true);
				dbName.setEnabled(true);
				defaultUser = ""; //$NON-NLS-1$
				defaultPassword = ""; //$NON-NLS-1$
				break;
			case H2:
				server.setEnabled(false);
				dbName.setEnabled(true);
				defaultUser = "sa";
				defaultPassword = "";
				break;
			case ODBC:
				server.setEnabled(false);
				dbName.setEnabled(true);
				defaultUser = "sa"; //$NON-NLS-1$
				defaultPassword = ""; //$NON-NLS-1$
				break;
			default:
				break;
			}
			DBImportSecondPage sec = (DBImportSecondPage) getNextPage();
			sec.name.setText(defaultUser);
			sec.pwd.setText(defaultPassword);
			
		}
		
	});
	
	tk.adapt(dbTypes, true, true);
	tk.createLabel(body, Messages.DBImportFirstPage_serverAddress); //$NON-NLS-1$
	server = tk.createText(body, "", SWT.BORDER); //$NON-NLS-1$
	
	TableWrapData twr = new TableWrapData(TableWrapData.FILL_GRAB);
	server.setLayoutData(twr);
	tk.createLabel(body, Messages.DBImportFirstPage_databaseName); //$NON-NLS-1$
	dbName = tk.createText(body, "", SWT.BORDER); //$NON-NLS-1$
	TableWrapData twr2 = new TableWrapData(TableWrapData.FILL_GRAB);
	dbName.setLayoutData(twr2);
	if (wiz.preset != null && wiz.preset.length > 1) {
		int idx = StringTool.getIndex(supportedDB, wiz.preset[0]);
		if (idx < dbTypes.getItemCount()) {
			dbTypes.select(idx);
		}
		server.setText(wiz.preset[1]);
		dbName.setText(wiz.preset[2]);
	}
	setControl(form);
}
 
Example #28
Source File: DBConnectFirstPage.java    From elexis-3-core with Eclipse Public License 1.0 4 votes vote down vote up
public void createControl(Composite parent){
	FormToolkit tk = UiDesk.getToolkit();
	Form form = tk.createForm(parent);
	form.setText(Messages.DBConnectFirstPage_connectioNDetails); //$NON-NLS-1$
	Composite body = form.getBody();
	body.setLayout(new TableWrapLayout());
	FormText alt = tk.createFormText(body, false);
	StringBuilder old = new StringBuilder();
	old.append("<form>"); //$NON-NLS-1$
	String driver = "";
	String user = "";
	String typ = "";
	String connectString = "";
	Hashtable<Object, Object> hConn = null;
	String cnt = CoreHub.localCfg.get(Preferences.CFG_FOLDED_CONNECTION, null);
	if (cnt != null) {
		hConn = PersistentObject.fold(StringTool.dePrintable(cnt));
		if (hConn != null) {
			driver =
				PersistentObject.checkNull(hConn.get(Preferences.CFG_FOLDED_CONNECTION_DRIVER));
			connectString =
				PersistentObject.checkNull(hConn
					.get(Preferences.CFG_FOLDED_CONNECTION_CONNECTSTRING));
			user =
				PersistentObject.checkNull(hConn.get(Preferences.CFG_FOLDED_CONNECTION_USER));
			typ = PersistentObject.checkNull(hConn.get(Preferences.CFG_FOLDED_CONNECTION_TYPE));
		}
	}
	// Check whether we were overridden
	String dbUser = System.getProperty(ElexisSystemPropertyConstants.CONN_DB_USERNAME);
	String dbPw = System.getProperty(ElexisSystemPropertyConstants.CONN_DB_PASSWORD);
	String dbFlavor = System.getProperty(ElexisSystemPropertyConstants.CONN_DB_FLAVOR);
	String dbSpec = System.getProperty(ElexisSystemPropertyConstants.CONN_DB_SPEC);
	if (dbUser != null && dbPw != null && dbFlavor != null && dbSpec != null) {
		old.append("<br/><li><b>Aktuelle Verbindung wurde via Übergabeparameter ans Programm gesetzt!</b></li><br/>"); //$NON-NLS-1$
	}
	if (ch.rgw.tools.StringTool.isNothing(connectString)) {
		old.append("<br/>"); //$NON-NLS-1$
		old.append("Keine konfigurierte Verbindung."); //$NON-NLS-1$
	} else {
		old.append("Konfigurierte Verbindung ist:<br/>"); //$NON-NLS-1$
		old.append("<li><b>Typ:</b>       ").append(typ).append("</li>"); //$NON-NLS-1$ //$NON-NLS-2$
		old.append("<li><b>Treiber</b>    ").append(driver).append("</li>"); //$NON-NLS-1$ //$NON-NLS-2$
		old.append("<li><b>Verbinde</b>   ").append(connectString).append("</li>"); //$NON-NLS-1$ //$NON-NLS-2$
		old.append("<li><b>Username</b>   ").append(user).append("</li>"); //$NON-NLS-1$ //$NON-NLS-2$
	}
	if (PersistentObject.getConnection() != null
		&& PersistentObject.getConnection().getConnectString() != null) {
		old.append("<li><b>Effektiv</b> verwendet wird:").append( //$NON-NLS-1$
			PersistentObject.getConnection().getConnectString()).append("</li>"); //$NON-NLS-1$
	}
	old.append("</form>"); //$NON-NLS-1$
	alt.setText(old.toString(), true, false);
	// Composite form=new Composite(parent, SWT.BORDER);
	Label sep = tk.createSeparator(body, SWT.NONE);
	TableWrapData twd = new TableWrapData();
	twd.heightHint = 5;
	sep.setLayoutData(twd);
	tk.createLabel(body, Messages.DBConnectFirstPage_enterType); //$NON-NLS-1$
	dbTypes = new Combo(body, SWT.BORDER | SWT.SIMPLE);
	dbTypes.setItems(supportedDB);
	dbTypes.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e){
			int it = dbTypes.getSelectionIndex();
			switch (it) {
			case 0:
			case 1:
				server.setEnabled(true);
				dbName.setEnabled(true);
				defaultUser = "elexis"; //$NON-NLS-1$
				defaultPassword = "elexisTest"; //$NON-NLS-1$
				break;
			case 2:
				server.setEnabled(false);
				dbName.setEnabled(true);
				defaultUser = "sa"; //$NON-NLS-1$
				defaultPassword = ""; //$NON-NLS-1$
				break;
			default:
				break;
			}
			DBConnectSecondPage sec = (DBConnectSecondPage) getNextPage();
			sec.name.setText(defaultUser);
			sec.pwd.setText(defaultPassword);
			
		}
		
	});
	tk.adapt(dbTypes, true, true);
	tk.createLabel(body, Messages.DBConnectFirstPage_serevrAddress); //$NON-NLS-1$
	server = tk.createText(body, "", SWT.BORDER); //$NON-NLS-1$
	TableWrapData twr = new TableWrapData(TableWrapData.FILL_GRAB);
	server.setLayoutData(twr);
	tk.createLabel(body, Messages.DBConnectFirstPage_databaseName); //$NON-NLS-1$
	dbName = tk.createText(body, "", SWT.BORDER); //$NON-NLS-1$
	TableWrapData twr2 = new TableWrapData(TableWrapData.FILL_GRAB);
	dbName.setLayoutData(twr2);
	setControl(form);
}
 
Example #29
Source File: MechanicDialog.java    From workspacemechanic with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Add a form to the supplied Composite.
 */
private Control createForm(Composite parent) {

  final FormToolkit toolkit = new FormToolkit(parent.getDisplay());
  final ScrolledForm form = toolkit.createScrolledForm(parent);

  /*
   * For the life of me I can't understand why I have to supply
   * a GridData instance to the form object in order to get the form
   * to fill the dialog area.
   * 
   * BTW, I only found this out through trial and error.
   */
  form.setLayoutData(new GridData(GridData.FILL_BOTH));

  TableWrapLayout layout = new TableWrapLayout();
  layout.numColumns = 2;
  layout.horizontalSpacing = 15;
  layout.verticalSpacing = 10;

  form.getBody().setLayout(layout);
  form.getBody().setLayoutData(new TableWrapData(
      TableWrapData.FILL_GRAB, TableWrapData.FILL_GRAB, 1, 3));

  for (Task item : items) {

    // add an expandable description of the task, with a pretty title
    ExpandableComposite ec = toolkit.createExpandableComposite(form.getBody(),
        ExpandableComposite.TREE_NODE | ExpandableComposite.CLIENT_INDENT);
    ec.setText(item.getTitle());
    Label label = toolkit.createLabel(ec, item.getDescription(), SWT.WRAP);
    ec.setClient(label);
    ec.addExpansionListener(new ExpansionAdapter() {
      @Override 
      public void expansionStateChanged(ExpansionEvent e) {
        form.reflow(true);
      }
    });
    ec.setExpanded(true);
    ec.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));

    // add a combo box allowing the user to select the repair action to take
    createDecisionCombo(form.getBody(), item);
  }

  return parent;
}
 
Example #30
Source File: EssentialsPage.java    From thym with Eclipse Public License 1.0 3 votes vote down vote up
private void createNameDescriptionSection(Composite parent) {
	Section sctnNameAndDescription = createSection(parent, "Name and Description");
	sctnNameAndDescription.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));

	Composite container = formToolkit.createComposite(sctnNameAndDescription, SWT.WRAP);
	formToolkit.paintBordersFor(container);
	sctnNameAndDescription.setClient(container);
	container.setLayout(FormUtils.createSectionClientGridLayout(false, 2));

	GridData textGridData = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);

	createFormFieldLabel(container, "ID:");

	txtIdtxt = formToolkit.createText(container, "", SWT.NONE);
	txtIdtxt.setLayoutData(textGridData);

	createFormFieldLabel(container, "Name:");

	txtName = formToolkit.createText(container, "", SWT.NONE);
	GridDataFactory.createFrom(textGridData).applyTo(txtName);

	createFormFieldLabel(container, "Version:");

	txtVersion = formToolkit.createText(container, "", SWT.NONE);
	GridDataFactory.createFrom(textGridData).applyTo(txtVersion);

	createFormFieldLabel(container, "Description:");

	txtDescription = formToolkit.createText(container, "", SWT.MULTI | SWT.WRAP | SWT.V_SCROLL);
	GridDataFactory.createFrom(textGridData).hint(SWT.DEFAULT, 100).applyTo(txtDescription);

	createFormFieldLabel(container, "Content Source:");

	txtContentsource = formToolkit.createText(container, "", SWT.NONE);
	GridDataFactory.createFrom(textGridData).applyTo(txtContentsource);
}