Java Code Examples for org.eclipse.swt.widgets.Composite#setSize()

The following examples show how to use org.eclipse.swt.widgets.Composite#setSize() . 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: FieldEditorOverlayPage.java    From cppcheclipse with Apache License 2.0 6 votes vote down vote up
/**
 * Must be called for each composite after some fieldeditors are added,
 * because each field editor resets the parent's layout manager in
 * FieldEditor::createControl
 * 
 * @param composite
 */
protected void setCompositeLayout(Composite composite) {

	Point size = composite.computeSize(SWT.DEFAULT, SWT.DEFAULT);
	composite.setSize(size);
	composite.setFont(getFieldEditorParent().getFont());

	GridLayout layout = new GridLayout(2, false);
	/*
	 * layout.numColumns = 1; layout.marginLeft = 40; layout.marginHeight =
	 * 10;
	 */
	layout.horizontalSpacing = 8;
	composite.setLayout(layout);

	GridData gd = new GridData();
	gd.horizontalSpan = 2;
	composite.setLayoutData(gd);
}
 
Example 2
Source File: CSV2TMXConverterDialog.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent) {
	Composite tparent = (Composite) super.createDialogArea(parent);
	tparent.setLayout(new GridLayout());
	GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).hint(300, 250).grab(true, true).applyTo(tparent);

	ScrolledComposite cmpScrolled = new ScrolledComposite(tparent, SWT.V_SCROLL);
	cmpScrolled.setAlwaysShowScrollBars(false);
	cmpScrolled.setLayoutData(new GridData(GridData.FILL_BOTH));
	cmpScrolled.setExpandHorizontal(true);
	cmpScrolled.setShowFocusedControl(true);

	Composite cmpContent = new Composite(cmpScrolled, SWT.None);
	cmpScrolled.setContent(cmpContent);
	cmpContent.setLayout(new GridLayout(2, false));
	cmpContent.setLayoutData(new GridData(GridData.FILL_BOTH));

	arrCmbLangs = new Combo[size];
	for (int i = 0; i < size; i++) {
		createLabel(cmpContent, languages.get(i) + " : ");
		arrCmbLangs[i] = new Combo(cmpContent, SWT.READ_ONLY);
		arrCmbLangs[i].setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
		arrCmbLangs[i].setItems(LocaleService.getLanguages());
		String name = LocaleService.getLanguage(languages.get(i));
		if (!name.equals(languages.get(i))) {
			arrCmbLangs[i].setText(name);
		}
	}

	cmpContent.setSize(cmpContent.computeSize(SWT.DEFAULT, SWT.DEFAULT));

	return tparent;
}
 
Example 3
Source File: DataWizardPage.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void handleValueChange(final ValueChangeEvent event) {
    final DataType newType = (DataType) event.diff.getNewValue();
    if (newType instanceof JavaType && !(data instanceof JavaObjectData)) {
        final JavaObjectData javaData = ProcessFactory.eINSTANCE.createJavaObjectData();
        javaData.setDataType(newType);
        javaData.setClassName(List.class.getName());
        copyDataFeature(javaData);
        data = javaData;
        updateDatabinding();
    } else if (newType instanceof XMLType && !(data instanceof XMLData)) {
        final XMLData xmlData = ProcessFactory.eINSTANCE.createXMLData();
        xmlData.setDataType(newType);
        copyDataFeature(xmlData);
        data = xmlData;
    } else {
        if (!data.eClass().equals(ProcessPackage.Literals.DATA)) {
            Data simpleData = ProcessFactory.eINSTANCE.createData();
            simpleData.setDataType(newType);
            copyDataFeature(simpleData);
            data = simpleData;
        } else {
            data.setDataType(newType);
        }
    }

    updateMoreSection(newType);
    updateBrowseXMLButton(newType);
    if (mainComposite != null && !mainComposite.isDisposed()) {
        final Composite parent = mainComposite.getParent();
        final Point defaultSize = parent.getSize();
        final Point size = parent.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
        parent.setSize(defaultSize.x, size.y);
        parent.layout(true, true);
    }
    updateDatabinding();
}
 
Example 4
Source File: ParameterDialog.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
protected Control createDialogArea( Composite parent )
{
	setMessage( Messages.getString( "ParameterDialog.message" ) ); //$NON-NLS-1$
	ScrolledComposite scrollContent = new ScrolledComposite( (Composite) super.createDialogArea( parent ),
			SWT.H_SCROLL | SWT.V_SCROLL );
	scrollContent.setAlwaysShowScrollBars( false );
	scrollContent.setExpandHorizontal( true );
	scrollContent.setMinWidth( 600 );
	scrollContent.setLayout( new FillLayout( ) );
	scrollContent.setLayoutData( new GridData( GridData.FILL_BOTH ) );

	displayArea = new Composite( scrollContent, SWT.NONE );

	Composite topComposite = new Composite( displayArea, SWT.NONE );
	topComposite.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
	topComposite.setLayout( new GridLayout( 2, false ) );

	createPropertiesSection( topComposite );
	createDisplayOptionsSection( topComposite );
	createValuesDefineSection( displayArea );
	displayArea.setLayout( new GridLayout( ) );

	Point size = displayArea.computeSize( SWT.DEFAULT, SWT.DEFAULT );
	displayArea.setSize( size );

	scrollContent.setContent( displayArea );

	UIUtil.bindHelp( parent, IHelpContextIds.PARAMETER_DIALOG_ID );
	return scrollContent;
}
 
Example 5
Source File: MeasureDialog.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected Control createDialogArea( Composite parent )
{
	UIUtil.bindHelp( parent, IHelpContextIds.MEASURE_DIALOG );

	Composite area = (Composite) super.createDialogArea( parent );

       ScrolledComposite sc = new ScrolledComposite( area, SWT.V_SCROLL );
       sc.setAlwaysShowScrollBars( false );
       sc.setExpandHorizontal( true );
       sc.setLayoutData( new GridData( GridData.FILL_BOTH ) );
       
	Composite contents = new Composite( sc, SWT.NONE);
       sc.setContent( contents );

       GridLayout layout = new GridLayout( );
       layout.verticalSpacing = 0;
       layout.marginWidth = 20;
       contents.setLayout( layout );

       GridData data = new GridData( GridData.FILL_BOTH );
       data.widthHint = convertWidthInCharsToPixels( 70 );
       contents.setLayoutData( data );
       
	createMeasureArea( contents );

	createVisibilityGroup( contents);

	WidgetUtil.createGridPlaceholder( contents, 1, true );

	initMeasureDialog( );

       // calculate the size explicitly as it is in scrollable composite
       Point size = contents.computeSize( SWT.DEFAULT, SWT.DEFAULT );
       contents.setSize( Math.max( size.x, 400 ), Math.max( size.y, 320 ) );

	return contents;
}
 
Example 6
Source File: ClassPathsPageHelper.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public void createPageCustomControl( Composite parent )
{	
	this.parent = parent;
	ScrolledComposite sComposite = new ScrolledComposite( parent,
			SWT.H_SCROLL | SWT.V_SCROLL );
	sComposite.setLayout( new GridLayout( ) );
	sComposite.setMinWidth( 560 );
	sComposite.setExpandHorizontal( true );
	sComposite.setMinHeight( 400 );
	sComposite.setExpandVertical( true );

	Composite composite = new Composite( sComposite, SWT.NONE );
	GridLayout layout = new GridLayout( 1, false );
	layout.horizontalSpacing = 10;
	composite.setLayout( layout );
	
	createTabFolderArea( composite );
	
	createCheckboxArea( composite );

	Point size = composite.computeSize( SWT.DEFAULT, SWT.DEFAULT );
	composite.setSize( size.x, size.y );

	sComposite.setContent( composite );

	HelpUtil.setSystemHelp( parent, HelpUtil.CONEXT_ID_DATASOURCE_POJO );
	
}
 
Example 7
Source File: CSV2TMXConverterDialog.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent) {
	Composite tparent = (Composite) super.createDialogArea(parent);
	tparent.setLayout(new GridLayout());
	GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).hint(300, 250).grab(true, true).applyTo(tparent);

	ScrolledComposite cmpScrolled = new ScrolledComposite(tparent, SWT.V_SCROLL);
	cmpScrolled.setAlwaysShowScrollBars(false);
	cmpScrolled.setLayoutData(new GridData(GridData.FILL_BOTH));
	cmpScrolled.setExpandHorizontal(true);
	cmpScrolled.setShowFocusedControl(true);

	Composite cmpContent = new Composite(cmpScrolled, SWT.None);
	cmpScrolled.setContent(cmpContent);
	cmpContent.setLayout(new GridLayout(2, false));
	cmpContent.setLayoutData(new GridData(GridData.FILL_BOTH));

	arrCmbLangs = new Combo[size];
	for (int i = 0; i < size; i++) {
		createLabel(cmpContent, languages.get(i) + " : ");
		arrCmbLangs[i] = new Combo(cmpContent, SWT.READ_ONLY);
		arrCmbLangs[i].setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
		arrCmbLangs[i].setItems(LocaleService.getLanguages());
		String name = LocaleService.getLanguage(languages.get(i));
		if (!name.equals(languages.get(i))) {
			arrCmbLangs[i].setText(name);
		}
	}

	cmpContent.setSize(cmpContent.computeSize(SWT.DEFAULT, SWT.DEFAULT));

	return tparent;
}
 
Example 8
Source File: AbstractDialog.java    From uima-uimaj with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the error message.
 *
 * @param msg the new error message
 */
protected void setErrorMessage(String msg) {
  errorMessageUI.setText(msg);
  Composite shell = errorMessageUI.getParent();
  while (!(shell instanceof Shell))
    shell = shell.getParent();
  shell.setSize(shell.computeSize(-1, -1));
}
 
Example 9
Source File: HistogramView.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
public PackedScrolledComposite(Composite parent, int style) {
    super(parent, style);
    Composite composite = new Composite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
    composite.setSize(1, 1);
    fScrollBarSize = composite.computeSize(0, 0);
    composite.dispose();
}
 
Example 10
Source File: BugInfoView.java    From spotbugs with GNU Lesser General Public License v2.1 5 votes vote down vote up
private void createRootComposite(Composite parent) {
    rootComposite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout(1, true);
    layout.marginLeft = -5;
    layout.marginTop = -5;
    layout.marginBottom = -5;
    layout.marginRight = -5;
    rootComposite.setLayout(layout);
    rootComposite.setSize(SWT.DEFAULT, SWT.DEFAULT);
}
 
Example 11
Source File: VisualizeTxtUMLPage.java    From txtUML with Eclipse Public License 1.0 4 votes vote down vote up
private void createPage(Composite parent, IProgressMonitor monitor) {
	if (monitor != null)
		monitor.beginTask("Discovering diagram descriptions...", 100);

	sc = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
	container = new Composite(sc, SWT.NONE);

	GridLayout layout = new GridLayout(4, false);
	container.setLayout(layout);

	final Label label = new Label(container, SWT.TOP);
	label.setText("txtUML Diagrams: ");

	addInitialLayoutFields();

	// diagram descriptions tree
	ScrolledComposite treeComposite = new ScrolledComposite(container, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
	tree = getDiagramTreeViewer(treeComposite, monitor);
	tree.addDoubleClickListener(new IDoubleClickListener() {
		@Override
		public void doubleClick(DoubleClickEvent event) {
			ISelection selection = event.getSelection();
			Iterator<?> selectedElements = ((IStructuredSelection) selection).iterator();
			if (selectedElements.hasNext()) {
				Object selectedElement = selectedElements.next();
				if (selectedElement instanceof IJavaProject) {
					List<Object> expandedElements = new ArrayList<>(Arrays.asList(tree.getExpandedElements()));
					if (expandedElements.contains(selectedElement)) {
						expandedElements.remove(selectedElement);
					} else {
						expandedElements.add(selectedElement);
					}
					tree.setExpandedElements(expandedElements.toArray());
				} else if (selectedElement instanceof IType) {
					List<Object> checkedElements = new ArrayList<>(Arrays.asList(tree.getCheckedElements()));
					boolean isChecked = checkedElements.contains(selectedElement);
					tree.setChecked(selectedElement, !isChecked);
					IType selectedType = (IType) selectedElement;
					if (!isChecked && !txtUMLLayout.contains(selectedType)) {
						txtUMLLayout.add(selectedType);
					} else {
						txtUMLLayout.remove(selectedType);
					}
					selectElementsInDiagramTree(txtUMLLayout.toArray(), true);
				}
			}
		}
	});

	selectElementsInDiagramTree(txtUMLLayout.toArray(), false);
	setExpandedLayouts(txtUMLLayout);

	GridData treeGd = new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1);
	treeGd.heightHint = 200;
	treeGd.widthHint = 150;
	GridData labelGd = new GridData(SWT.FILL, SWT.TOP, false, false, 1, 1);
	labelGd.verticalIndent = 5;
	label.setLayoutData(labelGd);
	treeComposite.setLayoutData(treeGd);

	treeComposite.setContent(tree.getControl());
	treeComposite.setExpandHorizontal(true);
	treeComposite.setExpandVertical(true);
	sc.setContent(container);
	sc.setExpandHorizontal(true);
	sc.setExpandVertical(true);
	container.setSize(container.computeSize(450, 300, true));
	sc.setMinSize(container.getSize());
	sc.setSize(container.getSize());

	setControl(parent);
	setPageComplete(true);
	if (monitor != null)
		monitor.done();
}
 
Example 12
Source File: PopulationInspectView.java    From gama with GNU General Public License v3.0 4 votes vote down vote up
private void createExpressionComposite() {
	final Composite compo = new Composite(toolbar.getToolbar(SWT.RIGHT), SWT.None);
	compo.setSize(new Point(150, 30));
	compo.setBackground(IGamaColors.WHITE.color());
	compo.setLayout(new GridLayout(1, false));
	editor = new ExpressionControl(getScope(), compo, null, getScope().getAgent(), Types.CONTAINER.of(Types.AGENT),
			SWT.BORDER, false) {

		@Override
		public void modifyValue() {
			final Object oldVal = getCurrentValue();
			super.modifyValue();
			if (oldVal == null ? getCurrentValue() != null : !oldVal.equals(getCurrentValue())) {
				if (outputs.isEmpty()) { return; }
				try {
					getOutput().setNewExpression((IExpression) getCurrentValue());

				} catch (final GamaRuntimeException e) {
					e.printStackTrace();
				}
				updateSpecies();
				fillAttributeMenu();
				// TODO Make a test on the columns.
				recreateViewer();
				update(getOutput());

			}
		}
	};
	final GridData data = new GridData(SWT.FILL, SWT.CENTER, true, false);
	data.minimumHeight = 16;
	data.heightHint = 16;
	// if ( speciesName != null ) {
	editor.getControl().setText(getOutput().getExpressionText()); // TODO
																	// Output
																	// available
																	// ?
	// }
	editor.getControl().setLayoutData(data);
	editor.getControl().setToolTipText("Enter a GAML expression returning one or several agents ");
	toolbar.control(compo, 150, SWT.RIGHT);
	toolbar.refresh(true);
}
 
Example 13
Source File: AboutDialog.java    From developer-studio with Apache License 2.0 4 votes vote down vote up
protected Control createDialogArea(Composite parent) {

		Image logoImage =
		                  ResourceManager.getPluginImage("org.wso2.developerstudio.eclipse.platform.ui",
		                                                 "icons/carbon-studio-logo.png");
		logoWidth = logoImage.getImageData().width;
		logoHeight = logoImage.getImageData().height;

		parent.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
		Composite dialogArea = (Composite) super.createDialogArea(parent);
		dialogArea.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));

		Composite composite = new Composite(dialogArea, SWT.BORDER);
		composite.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
		composite.setLayout(new GridLayout(1, false));
		composite.setSize(new Point(logoWidth + 200, logoHeight * 4));
		
		GridData gd_composite = new GridData(SWT.CENTER, SWT.TOP, true, true, 1, 1);
		gd_composite.widthHint = logoWidth + 200;
		gd_composite.heightHint = logoHeight * 4;
		 
		composite.setLayoutData(gd_composite);

		Label lblDevsLogo = new Label(composite, SWT.NONE);
		lblDevsLogo.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
		lblDevsLogo.setImage(logoImage);
		GridData gdDevsLogo = new GridData(SWT.CENTER, SWT.TOP, false, false, 1, 1);
		gdDevsLogo.widthHint = logoWidth;
		gdDevsLogo.heightHint = logoHeight;
		lblDevsLogo.setLayoutData(gdDevsLogo);

		Label lblVersion = new Label(composite, SWT.NONE);
		lblVersion.setForeground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_BORDER));
		lblVersion.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
		lblVersion.setText(KERNAL_MSG.concat(getVersion()));

		Label lblLicense = new Label(composite, SWT.NONE);
		lblLicense.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
		lblLicense.setText(LICENSED);

		Link linkDevStudioUrl = new Link(composite, SWT.NONE);
		linkDevStudioUrl.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
		linkDevStudioUrl.setText("Visit :<a>" + URL + "</a>");
		linkDevStudioUrl.addListener(SWT.Selection, new Listener() {
			public void handleEvent(Event event) {
				org.eclipse.swt.program.Program.launch(URL);
			}
		});

		addProductIcons(composite);
		return dialogArea;
	}
 
Example 14
Source File: AboutDialog.java    From devstudio-tooling-ei with Apache License 2.0 4 votes vote down vote up
protected Control createDialogArea(Composite parent) {

		Image logoImage =
                ResourceManager.getPluginImage("org.wso2.developerstudio.eclipse.platform.ui",
                                               "icons/ei-tooling-logo.png");
		logoWidth = logoImage.getImageData().width;
		logoHeight = logoImage.getImageData().height;

		parent.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
		Composite dialogArea = (Composite) super.createDialogArea(parent);
		dialogArea.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
		dialogArea.setSize(new Point(logoWidth, logoHeight * 4 - 60));

		Composite composite = new Composite(dialogArea, SWT.BORDER);
		composite.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
		composite.setLayout(new GridLayout(1, false));
		composite.setSize(new Point(logoWidth + 45, logoHeight * 4 - 60));
		
		GridData gd_composite = new GridData(SWT.CENTER, SWT.TOP, true, true, 1, 1);
		gd_composite.widthHint = logoWidth + 45;
		gd_composite.heightHint = logoHeight * 4 - 60;
		 
		composite.setLayoutData(gd_composite);

		Label lblDevsLogo = new Label(composite, SWT.NONE);
		lblDevsLogo.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
		lblDevsLogo.setImage(logoImage);
		GridData gdDevsLogo = new GridData(SWT.CENTER, SWT.TOP, false, false, 1, 1);
		gdDevsLogo.widthHint = logoWidth;
		gdDevsLogo.heightHint = logoHeight;
		lblDevsLogo.setLayoutData(gdDevsLogo);

		Label lblVersion = new Label(composite, SWT.NONE);
		GridData versionGrid = new GridData();
		versionGrid.horizontalIndent = 25;
		lblVersion.setLayoutData(versionGrid);
		lblVersion.setForeground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_BORDER));
		lblVersion.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
		lblVersion.setText(VERSION);
		
		Label lblLicense = new Label(composite, SWT.NONE);
		GridData licenseGrid = new GridData();
		licenseGrid.horizontalIndent = 25;
		lblLicense.setLayoutData(licenseGrid);
		lblLicense.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
		lblLicense.setText(LICENSED);

		Link linkDevStudioUrl = new Link(composite, SWT.NONE);
		GridData urlGrid = new GridData();
		urlGrid.horizontalIndent = 25;
		linkDevStudioUrl.setLayoutData(urlGrid);
		linkDevStudioUrl.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
		linkDevStudioUrl.setText("Visit :<a>" + URL + "</a>");
		linkDevStudioUrl.addListener(SWT.Selection, new Listener() {
			public void handleEvent(Event event) {
				org.eclipse.swt.program.Program.launch(URL);
			}
		});

		addProductIcons(composite);
		return dialogArea;
	}
 
Example 15
Source File: MongoDBDataSetWizardPage.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public void createPageCustomControl( Composite parent )
{
	sComposite = new ScrolledComposite( parent, SWT.H_SCROLL | SWT.V_SCROLL );
	sComposite.setLayout( new GridLayout( ) );
	sComposite.setLayoutData( new GridData( GridData.FILL_BOTH ) );
	sComposite.setMinWidth( 600 );
	sComposite.setExpandHorizontal( true );

	Composite mainComposite = new Composite( sComposite, SWT.NONE );
	mainComposite.setLayout( new GridLayout( 1, false ) );
	GridData gridData = new GridData( GridData.FILL_BOTH );
	mainComposite.setLayoutData( gridData );

	createTopArea( mainComposite );

	createFieldsSelectionArea( mainComposite );

	createBottomArea( mainComposite );

	Point size = mainComposite.computeSize( SWT.DEFAULT, SWT.DEFAULT );
	mainComposite.setSize( size.x, size.y );

	sComposite.setContent( mainComposite );
	setControl( sComposite );
	setPageComplete( false );

	try
	{
		initPageInfos( );
	}
	catch ( final OdaException e )
	{
		initializeControl( );
		Display.getDefault( ).asyncExec( new Runnable( ) {

			public void run( )
			{
				String errorMsg = UIHelper.getUserErrorMessage( "MongoDBDataSetWizardPage.MessageDialog.ErrorMessage.InitPage", e ); //$NON-NLS-1$
				ExceptionHandler.showException( sComposite.getShell( ),
						Messages.getString( "MongoDBDataSetWizardPage.MessageDialog.title.GeneralError" ), //$NON-NLS-1$
						errorMsg,
						e );
			}
		} );

		return;
	}

	initializeControl( );

	resetLabelWidth( );

	modelChanged = false;

	UIHelper.setSystemHelp( getControl( ),
			IHelpConstants.CONTEXT_ID_WIZARD_DATASET_MONGODB );
}
 
Example 16
Source File: GroupDialog.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
protected Control createDialogArea( Composite parent )
{
	// Assert.isNotNull( dataSetList );

	if ( sytleChoicesAll == null )
	{
		sytleChoicesAll = getAllStyleChoices( );
	}

	// Composite topComposite = (Composite) super.createDialogArea( parent
	// );

	ScrolledComposite scrollContent = new ScrolledComposite( (Composite) super.createDialogArea( parent ),
			SWT.H_SCROLL | SWT.V_SCROLL );
	scrollContent.setAlwaysShowScrollBars( false );
	scrollContent.setExpandHorizontal( true );
	scrollContent.setMinWidth( 600 );
	scrollContent.setLayout( new FillLayout( ) );
	scrollContent.setLayoutData( new GridData( GridData.FILL_BOTH ) );

	applyDialogFont( scrollContent );

	Composite topComposite = new Composite( scrollContent, SWT.NONE );
	GridLayout layout = new GridLayout( );
	layout.marginHeight = convertVerticalDLUsToPixels( IDialogConstants.VERTICAL_MARGIN );
	layout.marginWidth = convertHorizontalDLUsToPixels( IDialogConstants.HORIZONTAL_MARGIN );
	layout.verticalSpacing = convertVerticalDLUsToPixels( IDialogConstants.VERTICAL_SPACING );
	layout.horizontalSpacing = convertHorizontalDLUsToPixels( IDialogConstants.HORIZONTAL_SPACING );
	topComposite.setLayout( layout );

	createTitleArea( topComposite );

	Composite composite = new Composite( topComposite, SWT.NONE );
	composite.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
	composite.setLayout( new GridLayout( 2, true ) );
	createFieldArea( composite );
	createGroupArea( composite );
	createBookmarkArea( topComposite );
	createTOCArea( topComposite );
	createFilterSortingArea( topComposite );
	UIUtil.bindHelp( parent, IHelpContextIds.GROUP_DIALOG_ID );

	Point size = topComposite.computeSize( SWT.DEFAULT, SWT.DEFAULT );
	topComposite.setSize( size.x, size.y );

	scrollContent.setContent( topComposite );

	return scrollContent;
}
 
Example 17
Source File: CascadingParametersDialog.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
protected Control createDialogArea( Composite parent )
{
	// Composite composite = (Composite) super.createDialogArea( parent );

	ScrolledComposite sc = new ScrolledComposite( (Composite) super.createDialogArea( parent ),
			SWT.H_SCROLL | SWT.V_SCROLL );
	sc.setLayout( new FillLayout( ) );
	sc.setLayoutData( new GridData( GridData.FILL_BOTH ) );
	applyDialogFont( sc );

	mainContent = new Composite( sc, SWT.NONE );
	GridLayout layout = new GridLayout( );
	layout.marginHeight = convertVerticalDLUsToPixels( IDialogConstants.VERTICAL_MARGIN );
	layout.marginWidth = convertHorizontalDLUsToPixels( IDialogConstants.HORIZONTAL_MARGIN );
	layout.verticalSpacing = convertVerticalDLUsToPixels( IDialogConstants.VERTICAL_SPACING );
	layout.horizontalSpacing = convertHorizontalDLUsToPixels( IDialogConstants.HORIZONTAL_SPACING );
	mainContent.setLayout( layout );

	UIUtil.bindHelp( parent, IHelpContextIds.CASCADING_PARAMETER_DIALOG_ID );

	GridData data = new GridData( GridData.FILL_BOTH );

	maxStrLengthProperty = getMaxStrLength( PROPERTY_LABEL_STRING,
			mainContent );

	maxStrLengthOption = getMaxStrLength( OPTION_LABEL_STRING, mainContent );

	mainContent.setLayoutData( data );

	createGeneralPart( mainContent );

	createChoicePart( mainContent );

	createDynamicParamsPart( mainContent );

	createPropertiesPart( mainContent );

	createSortingArea( mainContent );

	createOptionsPart( mainContent );

	createLabel( mainContent, null );
	errorMessageLine = new CLabel( mainContent, SWT.NONE );
	GridData msgLineGridData = new GridData( GridData.FILL_HORIZONTAL );
	msgLineGridData.horizontalSpan = 2;
	errorMessageLine.setLayoutData( msgLineGridData );

	sc.setContent( mainContent );
	sc.setExpandHorizontal( true );
	// sc.setExpandVertical( true );
	sc.setMinWidth( 500 );
	// sc.setMinHeight( 570 );

	Point size = mainContent.computeSize( SWT.DEFAULT, SWT.DEFAULT );
	mainContent.setSize( size );

	return sc;
}
 
Example 18
Source File: HyperlinkBuilder.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
private void switchToDrillthrough( )
{
	// new Label( displayArea, SWT.NONE ).setText( REQUIED_MARK +
	// LABEL_REPORT );
	// locationEditor = new Text( displayArea, SWT.BORDER | SWT.SINGLE );
	// locationEditor.setLayoutData( new GridData( GridData.FILL_HORIZONTAL
	// ) );
	// locationEditor.addModifyListener( new ModifyListener( ) {
	//
	// public void modifyText( ModifyEvent e )
	// {
	// closeReport( );
	// initParamterBindings( );
	// initBookmarkList( reportHandle );
	// updateButtons( );
	// }
	//
	// } );
	// createBrowerButton( displayArea, locationEditor, false, true );
	//
	// UIUtil.createBlankLabel( displayArea );
	// messageLine = new CLabel( displayArea, SWT.NONE );
	// GridData gd = new GridData( GridData.FILL_HORIZONTAL );
	// gd.horizontalSpan = 2;
	// messageLine.setLayoutData( gd );
	//
	// createBindingTable( displayArea );
	// createBookmarkBar( false );
	// createTargetBar( );
	// createFormatBar( );

	displayArea.setLayout( new GridLayout( ) );
	// final ScrolledComposite scrolledContainer = new ScrolledComposite(
	// displayArea,
	// SWT.NONE );

	final Composite container = new Composite( displayArea, SWT.NONE );
	container.setLayout( new GridLayout( ) );
	// scrolledContainer.setContent( container );
	container.setLayoutData( new GridData( GridData.FILL_BOTH ) );

	messageLine = new CLabel( container, SWT.NONE );
	messageLine.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
	createDrillthroughSelectTargetReport( container );
	createDrillthroughSelectTargetAnchor( container );
	createDrillthroughCreateLinkExpression( container );
	if ( bTargetEnabled )
	{
		createDrillthroughSelectShowTarget( container );
	}
	createDrillthroughSelectFormat( container );
	if ( bTooltipEnabled )
	{
		createDrillthroughTooltip( container );
	}

	container.setSize( container.computeSize( SWT.DEFAULT, SWT.DEFAULT ) );
}
 
Example 19
Source File: AbstractBindingDialogHelper.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
protected void setContentSize( Composite composite )
{
	Point size = composite.computeSize( SWT.DEFAULT, SWT.DEFAULT );
	composite.setSize( Math.max( size.x, 400 ), Math.max( size.y,
			isAggregate( ) ? 320 : 50 ) );
}
 
Example 20
Source File: ReferenceSearchViewPage.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public void createControl(Composite parent) {
	pagebook = new PageBook(parent, SWT.NULL);
	pagebook.setLayoutData(new GridData(GridData.FILL_BOTH));
	busyLabel = new Table(pagebook, SWT.NONE);
	TableItem item = new TableItem(busyLabel, SWT.NONE);
	item.setText(Messages.ReferenceSearchViewPage_busyLabel);
	busyLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	control = new Composite(pagebook, SWT.NULL);
	control.setLayoutData(new GridData(GridData.FILL_BOTH));
	control.setSize(100, 100);
	control.setLayout(new FillLayout());
	viewer = new TreeViewer(control, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
	viewer.setContentProvider(contentProvider);
	viewer.setLabelProvider(labelProvider);
	viewer.setComparator(sorter);
	createOpenAndLinkWithEditorHandler();
	IToolBarManager tbm = getSite().getActionBars().getToolBarManager();
	fillToolbar(tbm);
	tbm.update(true);
	pagebook.showPage(control);
	isBusyShowing = false;
	queryListener = createQueryListener();
	NewSearchUI.addQueryListener(queryListener);

	menu = new MenuManager("#PopUp"); //$NON-NLS-1$
	menu.setRemoveAllWhenShown(true);
	menu.setParent(getSite().getActionBars().getMenuManager());
	menu.addMenuListener(mgr -> {
		fillContextMenu(mgr);
		part.fillContextMenu(mgr);
	});

	viewer.getControl().setMenu(menu.createContextMenu(viewer.getControl()));
	viewer.getControl().addKeyListener(KeyListener.keyPressedAdapter(e -> {
		if (e.keyCode == SWT.DEL) {
			removeSelectedMatchesAction.run();
		} else if ((e.stateMask | SWT.COMMAND) != 0 && e.keyCode == 'c') {
			copyAction.run();
		}
	}));
}