Package org.eclipse.ui.forms.widgets

Examples of org.eclipse.ui.forms.widgets.Section


            assistKeyStroke = KeyStroke.getInstance("Ctrl+Space");
        } catch (ParseException x) {
            // Ignore
        }

        Section mainSection = toolkit.createSection(parent, Section.TITLE_BAR);
        mainSection.setText(title);

        mainComposite = toolkit.createComposite(mainSection);
        mainSection.setClient(mainComposite);

        toolkit.createLabel(mainComposite, "Pattern:");
        txtName = toolkit.createText(mainComposite, "", SWT.BORDER);
        ControlDecoration decPattern = new ControlDecoration(txtName, SWT.LEFT | SWT.TOP, mainComposite);
        decPattern.setImage(assistDecor.getImage());
        if (assistKeyStroke == null) {
            decPattern.setDescriptionText("Content assist is available. Start typing to activate");
        } else {
            decPattern.setDescriptionText(MessageFormat.format("Content assist is available. Press {0} or start typing to activate", assistKeyStroke.format()));
        }
        decPattern.setShowHover(true);
        decPattern.setShowOnlyOnFocus(true);

        PkgPatternsProposalProvider proposalProvider = new PkgPatternsProposalProvider(new FormPartJavaSearchContext(this));
        ContentProposalAdapter patternProposalAdapter = new ContentProposalAdapter(txtName, new TextContentAdapter(), proposalProvider, assistKeyStroke, UIConstants.autoActivationCharacters());
        patternProposalAdapter.addContentProposalListener(proposalProvider);
        patternProposalAdapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_IGNORE);
        patternProposalAdapter.setAutoActivationDelay(1000);
        patternProposalAdapter.setLabelProvider(new PkgPatternProposalLabelProvider());
        patternProposalAdapter.addContentProposalListener(new IContentProposalListener() {
            public void proposalAccepted(IContentProposal proposal) {
                PkgPatternProposal patternProposal = (PkgPatternProposal) proposal;
                String toInsert = patternProposal.getContent();
                int currentPos = txtName.getCaretPosition();
                txtName.setSelection(patternProposal.getReplaceFromPos(), currentPos);
                txtName.insert(toInsert);
                txtName.setSelection(patternProposal.getCursorPosition());
            }
        });

        toolkit.createLabel(mainComposite, "Version:");
        txtVersion = toolkit.createText(mainComposite, "", SWT.BORDER);

        /*
         * Section attribsSection = toolkit.createSection(parent, Section.TITLE_BAR | Section.TWISTIE);
         * attribsSection.setText("Extra Attributes"); Composite attribsComposite =
         * toolkit.createComposite(attribsSection);
         */

        // Listeners
        txtName.addModifyListener(new ModifyListener() {
            public void modifyText(ModifyEvent e) {
                if (!modifyLock.isUnderModification()) {
                    if (selectedClauses.size() == 1) {
                        selectedClauses.get(0).setName(txtName.getText());
                        if (listPart != null) {
                            listPart.updateLabels(selectedClauses);
                            listPart.validate();
                        }
                        markDirty();
                    }
                }
            }
        });
        txtVersion.addModifyListener(new ModifyListener() {
            public void modifyText(ModifyEvent e) {
                if (!modifyLock.isUnderModification()) {
                    String text = txtVersion.getText();
                    if (text.length() == 0)
                        text = null;

                    for (HeaderClause clause : selectedClauses) {
                        clause.getAttribs().put(Constants.VERSION_ATTRIBUTE, text);
                    }
                    if (listPart != null) {
                        listPart.updateLabels(selectedClauses);
                        listPart.validate();
                    }
                    markDirty();
                }
            }
        });

        // Layout
        GridData gd;

        parent.setLayout(new GridLayout());
        mainSection.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
        mainComposite.setLayout(new GridLayout(2, false));

        gd = new GridData(SWT.FILL, SWT.TOP, true, false);
        gd.horizontalIndent = 5;
        gd.widthHint = 100;
View Full Code Here


        public void createContents(Composite parent) {
            FormToolkit toolkit = getManagedForm().getToolkit();
            // toolkit.createLabel(parent, "Nothing is selected");

            Section section = toolkit.createSection(parent, Section.TITLE_BAR | Section.EXPANDED);
            section.setText("Selection Details");

            section.setTitleBarBackground(greyTitleBarColour);
            // section.setTitleBarBorderColor(greyTitleBarColour);

            Composite composite = toolkit.createComposite(section);
            Label label = toolkit.createLabel(composite, "Select one or more items to view or edit their details.", SWT.WRAP);
            section.setClient(composite);

            GridLayout layout = new GridLayout();
            parent.setLayout(layout);

            GridData gd = new GridData(SWT.FILL, SWT.FILL, true, false);
            section.setLayoutData(gd);

            layout = new GridLayout();
            layout.marginWidth = 0;
            layout.marginHeight = 0;
            composite.setLayout(layout);
View Full Code Here

        createContent(composite, toolkit);
    }

    private void createContent(Composite parent, FormToolkit toolkit) {
        Section textSection = toolkit.createSection(parent, Section.TITLE_BAR | Section.EXPANDED);
        textSection.setText("Entry Content");
        Composite textComposite = toolkit.createComposite(textSection);
        text = toolkit.createText(textComposite, "", SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.READ_ONLY);
        text.setFont(JFaceResources.getTextFont());
        textSection.setClient(textComposite);

        Section encodingSection = toolkit.createSection(parent, Section.TITLE_BAR | Section.EXPANDED);
        encodingSection.setText("Display Options");
        Composite encodingPanel = toolkit.createComposite(encodingSection);
        encodingSection.setClient(encodingPanel);
        toolkit.createLabel(encodingPanel, "Show As:");
        final Button btnText = toolkit.createButton(encodingPanel, "Text", SWT.RADIO);
        btnText.setSelection(showAsText);
        Button btnBinary = toolkit.createButton(encodingPanel, "Binary (hex)", SWT.RADIO);
        btnBinary.setSelection(!showAsText);
        toolkit.createLabel(encodingPanel, "Text Encoding:");
        final Combo encodingCombo = new Combo(encodingPanel, SWT.READ_ONLY);
        encodingCombo.setEnabled(showAsText);

        // INITIALISE
        encodingCombo.setItems(charsets);
        encodingCombo.select(selectedCharset);

        // LISTENERS
        encodingSection.addExpansionListener(new ExpansionAdapter() {
            @Override
            public void expansionStateChanged(ExpansionEvent e) {
                getManagedForm().reflow(true);
            }
        });
        SelectionListener radioListener = new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                showAsText = btnText.getSelection();
                encodingCombo.setEnabled(showAsText);
                loadContent();
            }
        };
        btnText.addSelectionListener(radioListener);
        btnBinary.addSelectionListener(radioListener);
        encodingCombo.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                selectedCharset = encodingCombo.getSelectionIndex();
                loadContent();
            }
        });

        // LAYOUT
        GridLayout layout;
        GridData gd;

        layout = new GridLayout(1, false);
        parent.setLayout(layout);

        gd = new GridData(SWT.FILL, SWT.FILL, true, true);
        textSection.setLayoutData(gd);

        layout = new GridLayout(1, false);
        textComposite.setLayout(layout);

        gd = new GridData(SWT.FILL, SWT.FILL, true, true);
        text.setLayoutData(gd);

        gd = new GridData(SWT.FILL, SWT.FILL, true, false);
        encodingSection.setLayoutData(gd);
        encodingSection.setLayout(new FillLayout());
        encodingPanel.setLayout(new GridLayout(3, false));
        encodingCombo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 2, 1));
    }
View Full Code Here

    public JARContentTreePart(Composite parent, IManagedForm managedForm) {
        this.managedForm = managedForm;

        FormToolkit toolkit = managedForm.getToolkit();
        Section section = toolkit.createSection(parent, Section.TITLE_BAR | Section.EXPANDED);

        section.setText("Content Tree");
        tree = toolkit.createTree(section, SWT.FULL_SELECTION | SWT.SINGLE);
        tree.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TREE_BORDER);
        section.setClient(tree);
        toolkit.paintBordersFor(section);

        viewer = new TreeViewer(tree);
        viewer.setContentProvider(contentProvider);
        viewer.setLabelProvider(new JARTreeLabelProvider());

        managedForm.addPart(this);
        viewer.addSelectionChangedListener(new ISelectionChangedListener() {
            public void selectionChanged(SelectionChangedEvent event) {
                JARContentTreePart.this.managedForm.fireSelectionChanged(JARContentTreePart.this, event.getSelection());
            }
        });

        parent.setLayout(new GridLayout());
        section.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    }
View Full Code Here

        super(parent, toolkit, style);
        this.propertyName = propertyName;
        this.title = title;
        this.labelProvider = labelProvider;

        Section section = getSection();
        section.setText(title);
        createSection(section, toolkit);
    }
View Full Code Here

        super(parent, toolkit, style);
        this.propertyName = propertyName;
        this.title = title;
        this.labelProvider = labelProvider;

        Section section = getSection();
        section.setText(title);
        createSection(section, toolkit);
    }
View Full Code Here

    private final Text bundleContactAddress;
    private final ModificationLock lock = new ModificationLock();

    public DescriptionVendorPart(Composite parent, FormToolkit toolkit, int style) {
        super(parent, toolkit, style);
        Section section = getSection();
        section.setText("Vendor Information");
        Composite composite = toolkit.createComposite(section);
        section.setClient(composite);
        // BUNDLE_VENDOR
        toolkit.createLabel(composite, "Vendor:");
        bundleVendor = toolkit.createText(composite, "", SWT.BORDER);
        ToolTips.setupMessageAndToolTipFromSyntax(bundleVendor, Constants.BUNDLE_VENDOR);
        bundleVendor.addModifyListener(new ModifyListener() {
View Full Code Here

    private final Text bundleLicense;
    private final ModificationLock lock = new ModificationLock();

    public DescriptionRightsPart(Composite parent, FormToolkit toolkit, int style) {
        super(parent, toolkit, style);
        Section section = getSection();
        section.setText("Copyright and License");
        Composite composite = toolkit.createComposite(section);
        section.setClient(composite);
        // BUNDLE_COPYRIGHT
        toolkit.createLabel(composite, "Copyright:");
        bundleCopyright = toolkit.createText(composite, "", SWT.BORDER);
        ToolTips.setupMessageAndToolTipFromSyntax(bundleCopyright, Constants.BUNDLE_COPYRIGHT);
        bundleCopyright.addModifyListener(new ModifyListener() {
View Full Code Here

        @Override
        public void createContents(Composite parent) {
            FormToolkit toolkit = getManagedForm().getToolkit();
            // toolkit.createLabel(parent, "Nothing is selected");

            Section section = toolkit.createSection(parent, Section.TITLE_BAR | Section.EXPANDED);
            section.setText("Selection Details");

            Composite composite = toolkit.createComposite(section);
            Label label = toolkit.createLabel(composite, "Select one or more items to view or edit their details.", SWT.WRAP);
            section.setClient(composite);

            GridLayout layout = new GridLayout();
            parent.setLayout(layout);

            GridData gd = new GridData(SWT.FILL, SWT.FILL, true, false);
            section.setLayoutData(gd);

            layout = new GridLayout();
            layout.marginWidth = 0;
            layout.marginHeight = 0;
            composite.setLayout(layout);
View Full Code Here

    private final Text bundleCategory;
    private final ModificationLock lock = new ModificationLock();

    public DescriptionBundlePart(Composite parent, FormToolkit toolkit, int style) {
        super(parent, toolkit, style);
        Section section = getSection();
        section.setText("Bundle Information");
        Composite composite = toolkit.createComposite(section);
        section.setClient(composite);
        // BUNDLE_NAME
        toolkit.createLabel(composite, "Name:");
        bundleName = toolkit.createText(composite, "", SWT.BORDER);
        ToolTips.setupMessageAndToolTipFromSyntax(bundleName, Constants.BUNDLE_NAME);
        bundleName.addModifyListener(new ModifyListener() {
View Full Code Here

TOP

Related Classes of org.eclipse.ui.forms.widgets.Section

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.