Java Code Examples for org.eclipse.swt.widgets.Control

The following examples show how to use org.eclipse.swt.widgets.Control. These examples are extracted from open source projects.
Example 1
Project: Pydev   File: DebuggerTestUtils.java    License: Eclipse Public License 1.0 6 votes vote down vote up
/**
 * @return an action that can be run to create a breakpoint in the given line
 */
public PyBreakpointRulerAction createAddBreakPointAction(final int line) {
    PyBreakpointRulerAction ret = new PyBreakpointRulerAction(debugEditor, new IVerticalRulerInfo() {
        @Override
        public int getLineOfLastMouseButtonActivity() {
            return line;
        }

        @Override
        public Control getControl() {
            throw new RuntimeException("Not Implemented");
        }

        @Override
        public int getWidth() {
            throw new RuntimeException("Not Implemented");
        }

        @Override
        public int toDocumentLineNumber(int y_coordinate) {
            throw new RuntimeException("Not Implemented");
        }
    });
    ret.update();
    return ret;
}
 
Example 2
Project: bonita-studio   File: GroovyEditorDocumentationDialogTray.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
protected Control createContents(final Composite parent) {

    final Composite mainComposite = new Composite(parent, SWT.NONE);
    mainComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    mainComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).margins(0, 0).create());

    createFunctionCategories(mainComposite);

    final SashForm sashForm = new SashForm(mainComposite, SWT.VERTICAL);
    sashForm.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).hint(250, 250).minSize(100, SWT.DEFAULT).create());
    final GridLayout gridLaout = GridLayoutFactory.fillDefaults().numColumns(1).margins(0, 2).create();
    sashForm.setLayout(gridLaout);
    createFunctionsList(sashForm);
    createFunctionDocumentaion(sashForm);

    sashForm.setWeights(new int[] { 1, 1 });

    return mainComposite;
}
 
Example 3
Project: codewind-eclipse   File: RegistryManagementDialog.java    License: Eclipse Public License 2.0 6 votes vote down vote up
protected Control createDialogArea(Composite parent) {
	setTitleImage(CodewindUIPlugin.getImage(CodewindUIPlugin.CODEWIND_BANNER));
	setTitle(Messages.RegMgmtDialogTitle);
	if (connection.isLocal()) {
		setMessage(Messages.RegMgmtDialogLocalMessage);
	} else {
		setMessage(Messages.RegMgmtDialogMessage);
	}
	
	Composite content = (Composite) super.createDialogArea(parent);
	content.setLayout(new GridLayout());
	content.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
	
	regComposite = new RegistryManagementComposite(content, connection, regList, pushReg);
	GridData data = new GridData(GridData.FILL, GridData.FILL, true, true);
	data.widthHint = 250;
	regComposite.setLayoutData(data);

	return parent; 
}
 
Example 4
Project: tmxeditor8   File: TMXValidatorDialog.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent) {
	Composite tparent = (Composite) super.createDialogArea(parent);
	GridDataFactory.fillDefaults().grab(true, true).hint(500, 450).applyTo(tparent);
	GridLayoutFactory.fillDefaults().spacing(0, 0).extendedMargins(8, 8, 0, 8).applyTo(tparent);

	createMenu(tparent);
	createToolBar(tparent);

	styledText = new StyledText(tparent, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.WRAP);
	GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).hint(100, 100).grab(true, true).applyTo(styledText);
	styledText.setText("");

	tparent.layout();
	getShell().layout();
	return tparent;
}
 
Example 5
Project: Eclipse-Postfix-Code-Completion   File: JavaBuildConfigurationBlock.java    License: Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected Control createContents(Composite parent) {
	fPixelConverter= new PixelConverter(parent);
	setShell(parent.getShell());

	Composite mainComp= new Composite(parent, SWT.NONE);
	mainComp.setFont(parent.getFont());
	GridLayout layout= new GridLayout();
	layout.marginHeight= 0;
	layout.marginWidth= 0;
	mainComp.setLayout(layout);

	Composite othersComposite= createBuildPathTabContent(mainComp);
	GridData gridData= new GridData(GridData.FILL, GridData.FILL, true, true);
	gridData.heightHint= fPixelConverter.convertHeightInCharsToPixels(20);
	othersComposite.setLayoutData(gridData);

	validateSettings(null, null, null);

	return mainComp;
}
 
Example 6
Project: APICloud-Studio   File: PropertyAndPreferencePage.java    License: GNU General Public License v3.0 6 votes vote down vote up
protected Control createContents(Composite parent)
{
	Composite composite = new Composite(parent, SWT.NONE);
	GridLayout layout = new GridLayout();
	layout.marginHeight = 0;
	layout.marginWidth = 0;
	composite.setLayout(layout);
	composite.setFont(parent.getFont());

	GridData data = new GridData(GridData.FILL, GridData.FILL, true, true);

	fConfigurationBlockControl = createPreferenceContent(composite);
	fConfigurationBlockControl.setLayoutData(data);

	if (isProjectPreferencePage())
	{
		boolean useProjectSettings = hasProjectSpecificOptions(getProject());
		enableProjectSpecificSettings(useProjectSettings);
	}

	Dialog.applyDialogFont(composite);
	return composite;
}
 
Example 7
Project: Eclipse-Postfix-Code-Completion   File: JavaSearchPage.java    License: Eclipse Public License 1.0 6 votes vote down vote up
private Control createSearchFor(Composite parent) {
	Group result= new Group(parent, SWT.NONE);
	result.setText(SearchMessages.SearchPage_searchFor_label);
	result.setLayout(new GridLayout(2, true));

	fSearchFor= new Button[] {
		createButton(result, SWT.RADIO, SearchMessages.SearchPage_searchFor_type, TYPE, true),
		createButton(result, SWT.RADIO, SearchMessages.SearchPage_searchFor_method, METHOD, false),
		createButton(result, SWT.RADIO, SearchMessages.SearchPage_searchFor_package, PACKAGE, false),
		createButton(result, SWT.RADIO, SearchMessages.SearchPage_searchFor_constructor, CONSTRUCTOR, false),
		createButton(result, SWT.RADIO, SearchMessages.SearchPage_searchFor_field, FIELD, false)
	};

	// Fill with dummy radio buttons
	Label filler= new Label(result, SWT.NONE);
	filler.setVisible(false);
	filler.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));

	return result;
}
 
Example 8
Project: tmxeditor8   File: CustomMatchConditionDialog.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * 刷新过滤器设置组件
 */
private void refresh() {
	filterNameTxt.setText("");
	andBtn.setSelection(true);
	orBtn.setSelection(false);
	btnIsTagged.setSelection(false);
	btnQT.setSelection(false);
	btnPT.setSelection(false);
	if (btnIsRemoveFromSrc != null) {
		btnIsRemoveFromSrc.setSelection(false);
	}
	for (Control ctl : conditionList) {
		if (!ctl.isDisposed()) {
			ctl.dispose();
		}
	}
	conditionList.clear();
	new DynaComposite(dynaComp, SWT.NONE);
	scroll.setMinSize(dynaComp.computeSize(SWT.DEFAULT, SWT.DEFAULT));
	dynaComp.layout();

}
 
Example 9
Project: APICloud-Studio   File: SelectionButtonDialogField.java    License: GNU General Public License v3.0 6 votes vote down vote up
@Override
public Control[] doFillIntoGrid(Composite parent, int nColumns)
{
	assertEnoughColumns(nColumns);

	Button button = getSelectionButton(parent);
	GridData gd = new GridData();
	gd.horizontalSpan = nColumns;
	gd.horizontalAlignment = GridData.FILL;
	if (fButtonStyle == SWT.PUSH)
	{
		gd.widthHint = getButtonWidthHint(button);
	}

	button.setLayoutData(gd);

	return new Control[] { button };
}
 
Example 10
Project: tmxeditor8   File: CustomFilterDialog.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * 刷新过滤器设置组件
 */
private void refresh() {
	filterNameTxt.setText("");
	andBtn.setSelection(true);
	orBtn.setSelection(false);
	for (Control ctl : conditionList) {
		if (!ctl.isDisposed()) {
			ctl.dispose();
		}
	}
	conditionList.clear();
	new DynaComposite(dynaComp, SWT.NONE);
	scroll.setMinSize(dynaComp.computeSize(SWT.DEFAULT, SWT.DEFAULT));
	dynaComp.layout();

}
 
Example 11
Project: birt   File: DataDefinitionTextManager.java    License: Eclipse Public License 1.0 6 votes vote down vote up
public void addDataDefinitionText( Control text,
		IQueryExpressionManager queryManager )
{
	textCollection.put( text, queryManager );
	// update control color when switching.
	updateControlBackground( text, queryManager.getQuery( ).getDefinition( ) );
	text.addDisposeListener( new DisposeListener( ) {

		public void widgetDisposed( DisposeEvent e )
		{
			if ( e.widget instanceof Control )
			{
				removeDataDefinitionText( (Control) e.widget );
			}

		}
	} );
}
 
Example 12
Project: tm4e   File: TMinGenericEditorTest.java    License: Eclipse Public License 1.0 6 votes vote down vote up
@Test
public void testTMHighlightInGenericEditorEdit() throws IOException, PartInitException {
	f = File.createTempFile("test" + System.currentTimeMillis(), ".ts");
	FileOutputStream fileOutputStream = new FileOutputStream(f);
	fileOutputStream.write("let a = '';".getBytes());
	fileOutputStream.close();
	f.deleteOnExit();
	editor = IDE.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(),
			f.toURI(), editorDescriptor.getId(), true);
	StyledText text = (StyledText)editor.getAdapter(Control.class);
	Assert.assertTrue(new DisplayHelper() {
		@Override
		protected boolean condition() {
			return text.getStyleRanges().length > 1;
		}
	}.waitForCondition(text.getDisplay(), 3000));
	int initialNumberOfRanges = text.getStyleRanges().length;
	text.setText("let a = '';\nlet b = 10;\nlet c = true;");
	Assert.assertTrue("More styles should have been added", new DisplayHelper() {
		@Override protected boolean condition() {
			return text.getStyleRanges().length > initialNumberOfRanges + 3;
		}
	}.waitForCondition(text.getDisplay(), 300000));
}
 
Example 13
Project: nebula   File: InternalCompositeTable.java    License: Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Indicate to listeners that the focus is arriving on the specified row
 */
private void fireRowArriveEvent() {
       if (rows.size() < 1 || !isRowVisible(currentRow)) {
           return;
       }
       for (Iterator<?> rowChangeListenersIter = parent.rowFocusListeners
               .iterator(); rowChangeListenersIter.hasNext();) {
           IRowFocusListener listener = 
               (IRowFocusListener) rowChangeListenersIter.next();
           // currentRow() can be null if it's scrolled off the top or bottom
           TableRow row = currentRow();
           Control control = row != null ? row.getRowControl() : null;
           listener.arrive(parent, topRow + currentRow, control);
       }

}
 
Example 14
Project: APICloud-Studio   File: FindBarDecorator.java    License: GNU General Public License v3.0 6 votes vote down vote up
void updateSearchScope(FindScope scope)
{
	findScope = scope;
	scopeToolItem.setImage(FindBarPlugin.getImage(scopeMap.get(findScope)));
	scopeToolItem.setToolTipText(MessageFormat.format(Messages.FindBarDecorator_TOOLTIP_Scope_menu_item,
			findScope.toString()));

	boolean isCurrentFile = findScope == FindScope.CURRENT_FILE;
	Control[] controls = new Control[] { textReplace, replace, replaceAll, replaceFind };

	for (Control control : controls)
	{
		control.setEnabled(isCurrentFile);
	}
	textReplace.setBackground(isCurrentFile ? null : UIUtils.getDisplay().getSystemColor(
			SWT.COLOR_WIDGET_BACKGROUND));
	replaceHistory.setEnabled(isCurrentFile);
	searchSelection.setEnabled(isCurrentFile);
	countMatches.setEnabled(isCurrentFile);
}
 
Example 15
Project: arx   File: ComponentTitledSeparator.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Redraw the composite
 */
private void redrawComposite() {
        // Dispose previous content
        for (final Control c : this.getChildren()) {
                c.dispose();
        }

        int numberOfColumns = 1;

        if (this.text != null) {
                numberOfColumns++;
        }

        if (this.image != null) {
                numberOfColumns++;
        }

        if (this.alignment == SWT.CENTER) {
                numberOfColumns++;
        }

        super.setLayout(new GridLayout(numberOfColumns, false));
        createContent();
}
 
Example 16
Project: Eclipse-Postfix-Code-Completion   File: CallHierarchyViewPart.java    License: Eclipse Public License 1.0 5 votes vote down vote up
private void showPage(int page) {
boolean isEmpty= page == PAGE_EMPTY;
Control control= isEmpty ? (Control) fNoHierarchyShownLabel : fHierarchyLocationSplitter;
if (isEmpty) {
	setContentDescription(""); //$NON-NLS-1$
	setTitleToolTip(getPartName());
	getViewSite().getActionBars().getStatusLineManager().setMessage(""); //$NON-NLS-1$
	getViewer().clearViewer();
}
fPagebook.showPage(control);
if (fRefreshViewAction != null)
	fRefreshViewAction.setEnabled(!isEmpty);
if (fRefreshSingleElementAction != null)
	fRefreshSingleElementAction.setEnabled(!isEmpty);
  }
 
Example 17
Project: bonita-studio   File: BonitaRulerGridPropertySection.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event)
 */
public void handleEvent(Event event) {
	switch (event.type) {
	case SWT.KeyDown:
		textModified = true;
		if (event.character == SWT.CR)
			textChanged((Control) event.widget);
		break;
	case SWT.FocusOut:
		textChanged((Control) event.widget);
		break;
	}
}
 
Example 18
Project: typescript.java   File: TypeScriptTemplatePreferencePage.java    License: MIT License 5 votes vote down vote up
protected Control createContents(Composite ancestor) {
	ScrolledPageContent scrolled= new ScrolledPageContent(ancestor, SWT.H_SCROLL | SWT.V_SCROLL);
	scrolled.setExpandHorizontal(true);
	scrolled.setExpandVertical(true);
	
	Control control= super.createContents(scrolled);

	scrolled.setContent(control); 
	final Point size= control.computeSize(SWT.DEFAULT, SWT.DEFAULT);
	scrolled.setMinSize(size.x, size.y);
	
	return scrolled;
}
 
Example 19
Project: offspring   File: PlaceBidOrderWizard.java    License: MIT License 5 votes vote down vote up
@Override
public Control createControl(Composite parent) {
  Composite composite = new Composite(parent, SWT.NONE);
  GridLayoutFactory.fillDefaults().numColumns(2).spacing(10, 0)
      .margins(0, 0).applyTo(composite);

  textAsset = new Text(composite, SWT.BORDER);
  GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER)
      .grab(true, false).applyTo(textAsset);

  String id = presetAssetId != null ? Convert.toUnsignedLong(presetAssetId)
      : "";
  textAsset.setText(id);
  textAsset.addModifyListener(new ModifyListener() {

    @Override
    public void modifyText(ModifyEvent e) {
      requestVerification();
    }
  });

  labelAssetName = new Label(composite, SWT.NONE);

  GC gc = new GC(labelAssetName);
  GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.CENTER)
      .hint(gc.textExtent(THIRD_COLUMN).x, SWT.DEFAULT)
      .applyTo(labelAssetName);
  gc.dispose();

  labelAssetName.setText(EMPTY_NAME);
  return composite;
}
 
Example 20
Project: tlaplus   File: SpecPropertyPage.java    License: MIT License 5 votes vote down vote up
protected Control createContents(Composite parent) {
	Control control = super.createContents(parent);

	// ensure the page has no special buttons
	noDefaultAndApplyButton();

	UIHelper.setHelp(control, IHelpConstants.SPEC_PROPERTY_PAGE);
	return control;
}
 
Example 21
Project: Eclipse-Postfix-Code-Completion   File: NameConventionConfigurationBlock.java    License: Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent) {
	Composite composite= (Composite) super.createDialogArea(parent);
	Composite inner= new Composite(composite, SWT.NONE);
	inner.setFont(composite.getFont());
	GridLayout layout= new GridLayout();
	layout.marginHeight= 0;
	layout.marginWidth= 0;
	layout.numColumns= 2;
	inner.setLayout(layout);

	fMessageField.doFillIntoGrid(inner, 2);
	fPrefixField.doFillIntoGrid(inner, 2);
	fSuffixField.doFillIntoGrid(inner, 2);

	LayoutUtil.setHorizontalGrabbing(fPrefixField.getTextControl(null));
	LayoutUtil.setWidthHint(fPrefixField.getTextControl(null), convertWidthInCharsToPixels(45));
	LayoutUtil.setWidthHint(fSuffixField.getTextControl(null), convertWidthInCharsToPixels(45));

	fPrefixField.postSetFocusOnDialogField(parent.getDisplay());

	applyDialogFont(composite);

	PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IJavaHelpContextIds.CODE_STYLE_EDIT_PREFIX_SUFFIX);

	return composite;
}
 
Example 22
Project: gama   File: SliderEditor.java    License: GNU General Public License v3.0 5 votes vote down vote up
@Override
protected Control createCustomParameterControl(final Composite comp) throws GamaRuntimeException {
	final List<GamaColor> colors = getParam().getColor(getScope());
	Color left = IGamaColors.OK.color();
	Color right = IGamaColors.GRAY_LABEL.lighter();
	Color thumb = left;
	if (colors != null) {
		if (colors.size() == 1) {
			left = thumb = GamaColors.get(colors.get(0)).color();
		} else if (colors.size() == 2) {
			left = GamaColors.get(colors.get(0)).color();
			right = GamaColors.get(colors.get(1)).color();
		} else if (colors.size() >= 3) {
			left = GamaColors.get(colors.get(0)).color();
			thumb = GamaColors.get(colors.get(1)).color();
			right = GamaColors.get(colors.get(2)).color();
		}
	}
	slider = new SimpleSlider(comp, left, right, thumb, false) {};

	if (stepValue != null) {
		final Double realStep = stepValue.doubleValue() / (maxValue.doubleValue() - minValue.doubleValue());
		slider.setStep(realStep);
	}

	slider.addPositionChangeListener((s, position) -> modifyAndDisplayValue(computeValue(position)));
	slider.pack(true);
	return slider;
}
 
Example 23
Project: tracecompass   File: ViewFilterDialog.java    License: Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent) {
    getShell().setText(Messages.AbstractTimeGraphView_TimeEventFilterDialogTitle);

    Composite container = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout(3, false);
    layout.horizontalSpacing = 0;
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    container.setLayout(layout);

    Composite labels = createCLabelsArea(container);
    createFilterTextArea(parent, container,  labels);
    createCloseButton(container);

    // support close on escape button
    getShell().addListener(SWT.Traverse, e -> {
        if (e.detail == SWT.TRAVERSE_ESCAPE) {
            clearFilter();
        }
    });

    for (String label : fFilterRegexes) {
        createCLabels(parent, labels, label);
    }

    fControl.addControlListener(fControlListener);
    fControl.getShell().addControlListener(fControlListener);

    return parent;
}
 
Example 24
Project: tesb-studio-se   File: NewOrEditDependencyDialog.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent) {
    final String name = type;
    final boolean isNew = origin == null;
    getShell().setText(name);
    setTitle(MessageFormat.format(isNew ? Messages.NewDependencyItemDialog_addTitle
        : Messages.NewDependencyItemDialog_editTitle, name));
    setMessage(MessageFormat.format(isNew ? Messages.NewDependencyItemDialog_addMsg
        : Messages.NewDependencyItemDialog_editMsg, name));

    parent.setLayout(new GridLayout());

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

    new Label(c, SWT.NONE).setText(Messages.NewDependencyItemDialog_name);
    fNameText = new Text(c, SWT.BORDER);
    fNameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    if (type != ManifestItem.EXPORT_PACKAGE) {
        Group propertiesGroup = new Group(parent, SWT.NONE);
        propertiesGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
        propertiesGroup.setText(Messages.NewOrEditDependencyDialog_properties);
        propertiesGroup.setLayout(new GridLayout());
        fOptionalBtn = new Button(propertiesGroup, SWT.CHECK);
        fOptionalBtn.setText(Messages.NewDependencyItemDialog_optional);
    }

    fVersionPart.createVersionFields(parent, true, true);

    preloadFields();
    addListeners();
    return c;
}
 
Example 25
Project: tmxeditor8   File: SegmentViewer.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * 重置 ;
 */
public void reset() {
	StyledText styledText = getTextWidget();
	Control[] children = styledText.getChildren();
	for (Control child : children) {
		if (child != null && !child.isDisposed()) {
			child.dispose();
		}
	}
	innerTagCacheList.clear();
	errorTagStart = 0;
}
 
Example 26
Project: Eclipse-Postfix-Code-Completion   File: OccurrencesSearchMenuAction.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
public Menu getMenu(Control parent) {
	setMenu(new Menu(parent));
	fillMenu(fMenu);
	initMenu(fMenu);
	return fMenu;
}
 
Example 27
Project: pentaho-kettle   File: MqttDialogSecurityLayout.java    License: Apache License 2.0 5 votes vote down vote up
private void buildSSLTable( Composite parentWidget, Control relativePosition ) {
  ColumnInfo[] columns = getSSLColumns();

  sslTable = new TableView(
    transMeta,
    parentWidget,
    SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI,
    columns,
    0,  // num of starting rows (will be added later)
    false,
    lsMod,
    props,
    false
  );

  sslTable.setSortable( false );
  sslTable.getTable().addListener( SWT.Resize, event -> {
    Table table = (Table) event.widget;
    table.getColumn( 1 ).setWidth( 200 );
    table.getColumn( 2 ).setWidth( 200 );
  } );

  populateSSLData();

  FormData fdData = new FormData();
  fdData.left = new FormAttachment( 0, 0 );
  fdData.top = new FormAttachment( relativePosition, 5 );
  fdData.bottom = new FormAttachment( 100, 0 );
  fdData.width = INPUT_WIDTH + 80;

  // resize the columns to fit the data in them
  stream( sslTable.getTable().getColumns() ).forEach( column -> {
    if ( column.getWidth() > 0 ) {
      // don't pack anything with a 0 width, it will resize it to make it visible (like the index column)
      column.setWidth( 200 );
    }
  } );

  sslTable.setLayoutData( fdData );
}
 
Example 28
Project: birt   File: ReportPreviewFormPage.java    License: Eclipse Public License 1.0 5 votes vote down vote up
public Control getPartControl( )
{
	if ( reportViewer instanceof SWTAbstractViewer )
	{
		return ( (SWTAbstractViewer) reportViewer ).getUI( );
		// reportViewer.setReportDesignFile( getReportDesignFilePath( ) );
	}
	return null;
}
 
Example 29
Project: uima-uimaj   File: CommonInputDialog.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent) {
  Composite mainArea = (Composite) super.createDialogArea(parent, existing);

  text = newSingleLineStyledText(mainArea, "");
  AbstractSection.spacer(mainArea);
  newErrorMessage(mainArea);

  if (null != existing)
    text.setText(existing);
  else
    text.setText(S_);

  return mainArea;
}
 
Example 30
Project: birt   File: OptionsConfigurationBlock.java    License: Eclipse Public License 1.0 5 votes vote down vote up
public void selectOption( Key key )
{
	Control control = findControl( key );
	if ( control != null )
	{
		control.setFocus( );
	}
}
 
Example 31
Project: thym   File: WinEmulatorStatusHandler.java    License: Eclipse Public License 1.0 5 votes vote down vote up
protected Control createDialogArea(Composite parent) {
	Composite composite = (Composite) super.createDialogArea(parent);
	GridLayout layout = (GridLayout) composite.getLayout();
	layout.numColumns = 1;
	Link desc = new Link(composite, SWT.NONE);
	desc.setText(Messages.WinEmulatorsStatusHandler_Message);
	desc.addSelectionListener(new SelectionAdapter() {
		public void widgetSelected(SelectionEvent e) {
			Program.launch(WinConstants.SDK_DOWNLOAD_URL);
		}
	});
	getShell().setText(Messages.WinEmulatorsStatusHandler_Title);
	return composite;
}
 
Example 32
Project: Rel   File: LoadQueryDialog.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Create contents of the dialog.
 * @param parent
 */
@Override
protected Control createDialogArea(Composite parent) {
	Composite container = (Composite) super.createDialogArea(parent);
	container.setLayout(new FillLayout(SWT.HORIZONTAL));
	
	List list = new List(container, SWT.BORDER);
	for (String item: items)
		list.add(item);
	list.addListener(SWT.Selection, e -> item = list.getSelection()[0]);

	return container;
}
 
Example 33
Project: Eclipse-Postfix-Code-Completion   File: SourceFolderSelectionDialogButtonField.java    License: Eclipse Public License 1.0 5 votes vote down vote up
public Control[] doFillIntoGrid(Composite parent, int nColumns, int textWidth) {
	Control[] res= super.doFillIntoGrid(parent, nColumns);

	final Text text= getTextControl(null);
	LayoutUtil.setWidthHint(text, textWidth);
	LayoutUtil.setHorizontalGrabbing(text);

	return res;
}
 
Example 34
Project: birt   File: LevelDynamicAttributeDialog.java    License: Eclipse Public License 1.0 5 votes vote down vote up
protected Control createDialogArea( Composite parent )
{
	Composite composite = (Composite) super.createDialogArea( parent );

	Composite container = new Composite( composite, SWT.NONE );
	container.setLayoutData( new GridData( GridData.FILL_BOTH ) );

	GridLayout layout = new GridLayout( );
	layout.numColumns = 2;
	layout.marginWidth = layout.marginHeight = 0;
	container.setLayout( layout );

	Label nameLabel = new Label( container, SWT.WRAP );
	nameLabel.setText( Messages.getString("LevelDynamicAttributeDialog.Label.Member") ); //$NON-NLS-1$
	nameLabel.setLayoutData( new GridData( ) );
	nameLabel.setFont( parent.getFont( ) );

	memberCombo = new Combo( container, SWT.BORDER | SWT.READ_ONLY );
	memberCombo.setVisibleItemCount( 30 );
	GridData gd = new GridData( GridData.GRAB_HORIZONTAL
			| GridData.HORIZONTAL_ALIGN_FILL );
	gd.widthHint = 250;
	memberCombo.setLayoutData( gd );
	memberCombo.addSelectionListener( new SelectionAdapter( ) {

		public void widgetSelected( SelectionEvent e )
		{
			checkButtonStatus( );
		}
	} );

	applyDialogFont( composite );

	UIUtil.bindHelp( parent, IHelpContextIds.LEVEL_DYNAMIC_ATTRIBUTE_DIALOG );

	initDialog( );

	return composite;
}
 
Example 35
Project: statecharts   File: AbstractEditorPropertySection.java    License: Eclipse Public License 1.0 5 votes vote down vote up
protected void initContextMenu(Control control) {
	MenuManager menuManager = new FilteringMenuManager();
	Menu contextMenu = menuManager.createContextMenu(control);
	control.setMenu(contextMenu);
	IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
	IWorkbenchPartSite site = window.getActivePage().getActiveEditor().getSite();
	site.registerContextMenu(CONTEXTMENUID, menuManager, site.getSelectionProvider());
}
 
Example 36
Project: birt   File: CubeBuilder.java    License: Eclipse Public License 1.0 5 votes vote down vote up
protected Control createContents( Composite parent )
{
	String title = Messages.getString( "CubeBuilder.Title" ); //$NON-NLS-1$
	getShell( ).setText( title );

	if ( showNodeId != null )
	{
		setDefaultNode( showNodeId );
	}

	Control control = super.createContents( parent );
	return control;
}
 
Example 37
Project: AndroidRobot   File: StyledTextContentAdapter.java    License: Apache License 2.0 5 votes vote down vote up
public Rectangle getInsertionBounds(Control control) {
	StyledText text = (StyledText) control;
	Point caretOrigin = text.getCaret().getLocation();
	
	return new Rectangle(caretOrigin.x + text.getClientArea().x,
			caretOrigin.y + text.getClientArea().y + 3, 1,
			text.getLineHeight());
}
 
Example 38
Project: nebula   File: TableRow.java    License: Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Return the column number of a specified SWT control or -1 if not found.
 * 
 * @param control The control to find.
 * @return control's column number or -1 if that column control is not in this row.
 */
public int getColumnNumber(Control control) {
	for (int i = 0; i < columns.length; i++) {
		if (columns[i] == control) {
			return i;
		}
	}
	return -1;
}
 
Example 39
Project: Pydev   File: GlobalsTwoPanelElementSelector2.java    License: Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent) {
    Control ret = super.createDialogArea(parent);

    NotifyViewCreated.notifyViewCreated(this);
    createdCallbacksForControls = callRecursively(onControlCreated, parent, new ArrayList());

    return ret;
}
 
Example 40
Project: nebula   File: VTracker.java    License: Eclipse Public License 2.0 5 votes vote down vote up
private static void setFocusToNext(Composite comp) {
	if(comp != null) {
		Composite parent = comp.getParent();
		Control[] controls = parent.getTabList();
		if(parent instanceof Shell) {
			for(int i = 0; i < controls.length; i++) {
				if(controls[i] == comp) {
					for(int j = 0; j < controls.length; j++) {
						i++;
						if(i > controls.length-1) {
							i = 0;
						}
						if(controls[i].forceFocus()) {
							return;
						}
					}
				}
			}
		} else {
			for(int i = 0; i < controls.length; i++) {
				if(controls[i] == comp) {
					for( ; i < controls.length-1; i++) {
						if(controls[i+1].forceFocus()) {
							return;
						}
					}
					setFocusToNext(comp.getParent());
				}
			}
		}
	}
}