Java Code Examples for org.eclipse.swt.SWT#INHERIT_DEFAULT

The following examples show how to use org.eclipse.swt.SWT#INHERIT_DEFAULT . 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: ExpressionViewer.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
protected void createControl(final Composite composite, final int style,
        final TabbedPropertySheetWidgetFactory widgetFactory) {
    control = new Composite(composite, SWT.INHERIT_DEFAULT) {

        @Override
        public void setEnabled(final boolean enabled) {
            super.setEnabled(enabled);
            updateEnablement(enabled);
        }

    };
    if (widgetFactory != null) {
        widgetFactory.adapt(control);
    }
    control.addDisposeListener(disposeListener);
    control.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).margins(0, 0).spacing(0, 0).create());
    createTextControl(style, widgetFactory);
    createToolbar(style, widgetFactory);
}
 
Example 2
Source File: ExecutionContextLabelProvider.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
protected static Composite createEditorComposite(TreeItem currentItem) {
	Composite comp = new Composite(currentItem.getParent(), SWT.INHERIT_DEFAULT);
	comp.setBackground(currentItem.getBackground());
	comp.setBackgroundMode(SWT.INHERIT_DEFAULT);
	GridLayout layout = new GridLayout(2, false);
	layout.marginHeight = 0;
	layout.marginWidth = 3;
	comp.setLayout(layout);
	return comp;
}
 
Example 3
Source File: PatternExpressionViewer.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
public PatternExpressionViewer(final Composite parent, final int style) {
	super(parent, style);
	setLayout(GridLayoutFactory.fillDefaults().numColumns(1).margins(0, 0).create());
	mc = new MagicComposite(this, SWT.INHERIT_DEFAULT);
	mc.setLayout(
			GridLayoutFactory.fillDefaults().numColumns(1).margins(0, 0).extendedMargins(15, 25, 0, 0).create());
	mc.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
	createTextViewer();
	createExpressionViewer();
	createEditorSwitch();
	mc.hide(getViewerControl());
	mc.show(expressionViewer.getControl());

}
 
Example 4
Source File: CheckBoxExpressionViewer.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void createControl(final Composite composite, final int style,
        final TabbedPropertySheetWidgetFactory widgetFactory) {
    mc = new MagicComposite(composite, SWT.INHERIT_DEFAULT);
    mc.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).margins(0, 0).spacing(0, 0).create());
    checkBoxControl = new Button(mc, SWT.CHECK);
    if (widgetFactory != null) {
        widgetFactory.adapt(checkBoxControl, true, true);
    }
    checkBoxControl
            .setLayoutData(GridDataFactory.fillDefaults().grab(false, true).hint(SWT.DEFAULT, 30).indent(16, 0)
                    .align(SWT.BEGINNING, SWT.CENTER).create());

    control = new Composite(mc, SWT.INHERIT_DEFAULT);
    if (widgetFactory != null) {
        widgetFactory.adapt(control);
    }
    control.addDisposeListener(disposeListener);
    control.setLayoutData(GridDataFactory.fillDefaults().grab(false, true).align(SWT.BEGINNING, SWT.CENTER).create());
    control.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).margins(0, 0).spacing(0, 0).create());
    createTextControl(style, widgetFactory);

    createToolbar(style, widgetFactory);
    if ((style & SWT.BORDER) != 0) {//Not in a table
        createSwitchEditorControl(widgetFactory);
    }
    addDecorator(composite);
    mc.show(checkBoxControl);
    mc.hide(control);
}
 
Example 5
Source File: ProblemView.java    From tlaplus with MIT License 4 votes vote down vote up
/**
 * Fill data
 * @param specLoaded
 */
private void fillData(Spec specLoaded)
{
    if (specLoaded == null)
    {
        hide();
        return;
    } else
    {

        // retrieve the markers associated with the loaded spec
        IMarker[] markers = TLAMarkerHelper.getProblemMarkers(specLoaded.getProject(), null);

        if (markers == null || markers.length == 0)
        {
            hide();
        }

        // sort the markers
        List<IMarker> markersList = new ArrayList<IMarker>(Arrays.asList(markers));
        Collections.sort(markersList, new MarkerComparator());

        // Bug fix: 2 June 2010.  It takes forever if
        // there are a large number of markers, which
        // can easily happen if you remove a definition
        // that's used hundreds of times.
        int iterations = Math.min(markers.length, 20);
        for (int j = 0; j < iterations; j++)
        {
            final IMarker problem = markersList.get(j);

            // listener
            Listener listener = new Listener() {
                // goto marker on click
                public void handleEvent(Event event)
                {
                    TLAMarkerHelper.gotoMarker(problem, ((event.stateMask & SWT.MOD1) != 0));
                }
            };

            // contents of the item
            Composite problemItem = new Composite(bar, SWT.LINE_SOLID);
            problemItem.setLayout(new RowLayout(SWT.VERTICAL));
            problemItem.addListener(SWT.MouseDown, listener);

            String[] lines = problem.getAttribute(IMarker.MESSAGE, "").split("\n");
            for (int i = 0; i < lines.length; i++)
            {
                StyledText styledText = new StyledText(problemItem, SWT.INHERIT_DEFAULT);
                styledText.setEditable(false);
                styledText.setCursor(styledText.getDisplay().getSystemCursor(SWT.CURSOR_HAND));
                styledText.setText(lines[i]);
                styledText.addListener(SWT.MouseDown, listener);

                if (isErrorLine(lines[i], problem))
                {
                    StyleRange range = new StyleRange();
                    range.underline = true;
                    range.foreground = styledText.getDisplay().getSystemColor(SWT.COLOR_RED);
                    range.start = 0;
                    range.length = lines[i].length();
                    styledText.setStyleRange(range);
                }
            }

            ExpandItem item = new ExpandItem(bar, SWT.NONE, 0);
            item.setExpanded(true);
            
            String markerType = TLAMarkerHelper.getType(problem);
            item.setText(AdapterFactory.getMarkerTypeAsText(markerType) + " " + AdapterFactory.getSeverityAsText(problem.getAttribute(IMarker.SEVERITY,
                    IMarker.SEVERITY_ERROR)));
            item.setHeight(problemItem.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
            item.setControl(problemItem);
            item.addListener(SWT.MouseDown, listener);
        }
    }
    return ;
}
 
Example 6
Source File: OpenCreateColumnGroupDialog.java    From translationstudio8 with GNU General Public License v2.0 4 votes vote down vote up
public OpenCreateColumnGroupDialog(Shell parentShell) {
	this.dialog = CreateColumnGroupDialog.createColumnGroupDialog(parentShell);
	 messageBox = new MessageBox(parentShell, SWT.INHERIT_DEFAULT | SWT.ICON_ERROR | SWT.OK);
}
 
Example 7
Source File: OpenCreateColumnGroupDialog.java    From tmxeditor8 with GNU General Public License v2.0 4 votes vote down vote up
public OpenCreateColumnGroupDialog(Shell parentShell) {
	this.dialog = CreateColumnGroupDialog.createColumnGroupDialog(parentShell);
	 messageBox = new MessageBox(parentShell, SWT.INHERIT_DEFAULT | SWT.ICON_ERROR | SWT.OK);
}
 
Example 8
Source File: PageComponentSwitchBuilder.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
public CheckBoxExpressionViewer createCheckboxControl(final Composite composite, final Checkbox object) {
    final Input input = getConnectorInput(object.getInputName());
    final ConnectorParameter parameter = connectorConfigurationSupport.getConnectorParameter(object.getInputName(),
            object, input);
    if (parameter != null) {
        final Composite exprLabelComposite = new Composite(composite, SWT.INHERIT_DEFAULT);
        exprLabelComposite.setLayoutData(GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).create());
        exprLabelComposite
                .setLayout(GridLayoutFactory.fillDefaults().numColumns(1).margins(0, 0).spacing(0, 0).create());
        createFieldLabel(exprLabelComposite, SWT.CENTER, object.getId(), input.isMandatory());

        final Label emptyLine = new Label(exprLabelComposite, SWT.NONE);
        emptyLine.setText("");

        final CheckBoxExpressionViewer viewer = new CheckBoxExpressionViewer(composite, null, SWT.BORDER,
                ConnectorConfigurationPackage.Literals.CONNECTOR_PARAMETER__EXPRESSION);
        viewer.setIsPageFlowContext(isPageFlowContext);
        viewer.setExpressionNameResolver(new ConnectorInputNameResolver(parameter.getKey()));
        viewer.getControl().setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
        viewer.setContext(container);

        if (input.isMandatory()) {
            viewer.setMandatoryField(getLabel(object.getId()), context);
        }
        viewer.addFilter(connectorExpressionContentTypeFilter);
        viewer.setInput(parameter);
        final String desc = getDescription(object.getId());
        if (desc != null && !desc.isEmpty()) {
            viewer.setMessage(desc);
        }
        if (((Expression) parameter.getExpression()).getName() == null) {
            final Expression falseExp = (Expression) parameter.getExpression();
            falseExp.setContent(Boolean.FALSE.toString());
            falseExp.setName(Boolean.FALSE.toString());
            falseExp.setContent(Boolean.FALSE.toString());
            falseExp.setReturnType(Boolean.class.getName());
            falseExp.setType(ExpressionConstants.CONSTANT_TYPE);
        }
        viewer.setSelection(new StructuredSelection(parameter.getExpression()));
        return viewer;
    }
    return null;
}
 
Example 9
Source File: CustomUserInfoConnectorConfigurationWizardPage.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
private Composite createComposite(final Composite parent, final int nbColumns, final int vSpacing) {
    final Composite composite = new Composite(parent, SWT.INHERIT_DEFAULT);
    composite.setLayout(GridLayoutFactory.fillDefaults().numColumns(nbColumns).margins(0, 0).spacing(3, vSpacing).create());
    composite.setLayoutData(GridDataFactory.fillDefaults().grab(false, false).span(2, 1).create());
    return composite;
}