Search in sources :

Example 56 with ExpansionEvent

use of org.eclipse.ui.forms.events.ExpansionEvent in project titan.EclipsePlug-ins by eclipse.

the class ExternalCommandsSubPage method createExternalcommandsSection.

void createExternalcommandsSection(final Composite parent, final ScrolledForm form, final FormToolkit toolkit) {
    final Section section = toolkit.createSection(parent, ExpandableComposite.TWISTIE | Section.DESCRIPTION | ExpandableComposite.TITLE_BAR);
    section.setActiveToggleColor(toolkit.getHyperlinkGroup().getActiveForeground());
    section.setToggleColor(toolkit.getColors().getColor(IFormColors.SEPARATOR));
    section.setText("External commands");
    section.setDescription("Specify the external commands to be called at execution time for this configuration.");
    section.setExpanded(true);
    section.addExpansionListener(new ExpansionAdapter() {

        @Override
        public void expansionStateChanged(final ExpansionEvent e) {
            form.reflow(false);
        }
    });
    final GridData gd = new GridData(SWT.FILL, SWT.NONE, true, false);
    section.setLayoutData(gd);
    final Composite client = toolkit.createComposite(section, SWT.WRAP);
    section.setClient(client);
    final GridLayout layout = new GridLayout();
    layout.numColumns = 3;
    client.setLayout(layout);
    toolkit.paintBordersFor(client);
    valueChanged = true;
    toolkit.createLabel(client, "Begin control part:");
    beginControlPartText = toolkit.createText(client, "", SWT.SINGLE);
    beginControlPartText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    beginControlPartText.setEnabled(executeCommandSectionHandler != null);
    beginControlPartText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(final ModifyEvent e) {
            if (valueChanged || executeCommandSectionHandler == null) {
                return;
            }
            editor.setDirty();
            final String temp = beginControlPartText.getText();
            if (temp == null || temp.length() == 0) {
                // remove the node
                if (executeCommandSectionHandler.getBeginControlPartRoot() != null) {
                    ConfigTreeNodeUtilities.removeChild(executeCommandSectionHandler.getLastSectionRoot(), executeCommandSectionHandler.getBeginControlPartRoot());
                }
                executeCommandSectionHandler.setBeginControlPart(null);
                executeCommandSectionHandler.setBeginControlPartRoot(null);
                removeExternalCommandsSection();
            } else if (executeCommandSectionHandler.getBeginControlPart() == null) {
                // create the node
                createExternalCommandsSection();
                final ParseTree beginControlPartRoot = new ParserRuleContext();
                executeCommandSectionHandler.setBeginControlPartRoot(beginControlPartRoot);
                ConfigTreeNodeUtilities.addChild(executeCommandSectionHandler.getLastSectionRoot(), beginControlPartRoot);
                ConfigTreeNodeUtilities.addChild(beginControlPartRoot, new AddedParseTree("\nbeginControlPart := "));
                final ParseTree beginControlPart = new AddedParseTree(temp.trim());
                executeCommandSectionHandler.setBeginControlPart(beginControlPart);
                ConfigTreeNodeUtilities.addChild(beginControlPartRoot, beginControlPart);
            } else {
                // simple modification
                ConfigTreeNodeUtilities.setText(executeCommandSectionHandler.getBeginControlPart(), temp.trim());
            }
        }
    });
    if (executeCommandSectionHandler != null && executeCommandSectionHandler.getBeginControlPart() != null) {
        beginControlPartText.setText(ConfigTreeNodeUtilities.toString(executeCommandSectionHandler.getBeginControlPart()));
    }
    Button browse = toolkit.createButton(client, "Browse...", SWT.PUSH);
    browse.addSelectionListener(new ExternalCommandBrowser(beginControlPartText, (IFile) editor.getEditorInput().getAdapter(IFile.class)));
    toolkit.createLabel(client, "Begin testcase:");
    beginTestCaseText = toolkit.createText(client, "", SWT.SINGLE);
    beginTestCaseText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    beginTestCaseText.setEnabled(executeCommandSectionHandler != null);
    beginTestCaseText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(final ModifyEvent e) {
            if (valueChanged || executeCommandSectionHandler == null) {
                return;
            }
            editor.setDirty();
            final String temp = beginTestCaseText.getText();
            if (temp == null || temp.length() == 0) {
                // remove the node
                if (executeCommandSectionHandler.getBeginTestcaseRoot() != null) {
                    ConfigTreeNodeUtilities.removeChild(executeCommandSectionHandler.getLastSectionRoot(), executeCommandSectionHandler.getBeginTestcaseRoot());
                }
                executeCommandSectionHandler.setBeginTestcase(null);
                executeCommandSectionHandler.setBeginTestcaseRoot(null);
                removeExternalCommandsSection();
            } else if (executeCommandSectionHandler.getBeginTestcase() == null) {
                // create the node
                createExternalCommandsSection();
                final ParseTree beginTestcaseRoot = new ParserRuleContext();
                executeCommandSectionHandler.setBeginTestcaseRoot(beginTestcaseRoot);
                ConfigTreeNodeUtilities.addChild(executeCommandSectionHandler.getLastSectionRoot(), beginTestcaseRoot);
                ConfigTreeNodeUtilities.addChild(beginTestcaseRoot, new AddedParseTree("\nbeginTestcase := "));
                final ParseTree beginTestcase = new AddedParseTree(temp.trim());
                executeCommandSectionHandler.setBeginTestcase(beginTestcase);
                ConfigTreeNodeUtilities.addChild(beginTestcaseRoot, beginTestcase);
            } else {
                // simple modification
                ConfigTreeNodeUtilities.setText(executeCommandSectionHandler.getBeginTestcase(), temp.trim());
            }
        }
    });
    if (executeCommandSectionHandler != null && executeCommandSectionHandler.getBeginTestcase() != null) {
        beginTestCaseText.setText(ConfigTreeNodeUtilities.toString(executeCommandSectionHandler.getBeginTestcase()));
    }
    browse = toolkit.createButton(client, "Browse...", SWT.PUSH);
    browse.addSelectionListener(new ExternalCommandBrowser(beginTestCaseText, (IFile) editor.getEditorInput().getAdapter(IFile.class)));
    toolkit.createLabel(client, "End control part:");
    endControlPartText = toolkit.createText(client, "", SWT.SINGLE);
    endControlPartText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    endControlPartText.setEnabled(executeCommandSectionHandler != null);
    endControlPartText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(final ModifyEvent e) {
            if (valueChanged || executeCommandSectionHandler == null) {
                return;
            }
            editor.setDirty();
            final String temp = endControlPartText.getText();
            if (temp == null || temp.length() == 0) {
                // remove the node
                if (executeCommandSectionHandler.getEndControlPartRoot() != null) {
                    ConfigTreeNodeUtilities.removeChild(executeCommandSectionHandler.getLastSectionRoot(), executeCommandSectionHandler.getEndControlPartRoot());
                }
                executeCommandSectionHandler.setEndControlPart(null);
                executeCommandSectionHandler.setEndControlPartRoot(null);
                removeExternalCommandsSection();
            } else if (executeCommandSectionHandler.getEndControlPart() == null) {
                // create the node
                createExternalCommandsSection();
                final ParseTree endControlPartRoot = new ParserRuleContext();
                executeCommandSectionHandler.setEndControlPartRoot(endControlPartRoot);
                ConfigTreeNodeUtilities.addChild(executeCommandSectionHandler.getLastSectionRoot(), endControlPartRoot);
                ConfigTreeNodeUtilities.addChild(endControlPartRoot, new AddedParseTree("\nendControlPart := "));
                final ParseTree endControlPart = new AddedParseTree(temp.trim());
                executeCommandSectionHandler.setEndControlPart(endControlPart);
                ConfigTreeNodeUtilities.addChild(endControlPartRoot, endControlPart);
            } else {
                // simple modification
                ConfigTreeNodeUtilities.setText(executeCommandSectionHandler.getEndControlPart(), temp.trim());
            }
        }
    });
    if (executeCommandSectionHandler != null && executeCommandSectionHandler.getEndControlPart() != null) {
        endControlPartText.setText(ConfigTreeNodeUtilities.toString(executeCommandSectionHandler.getEndControlPart()));
    }
    browse = toolkit.createButton(client, "Browse...", SWT.PUSH);
    browse.addSelectionListener(new ExternalCommandBrowser(endControlPartText, (IFile) editor.getEditorInput().getAdapter(IFile.class)));
    toolkit.createLabel(client, "End testcase:");
    endTestCaseText = toolkit.createText(client, "", SWT.SINGLE);
    endTestCaseText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    endTestCaseText.setEnabled(executeCommandSectionHandler != null);
    endTestCaseText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(final ModifyEvent e) {
            if (valueChanged || executeCommandSectionHandler == null) {
                return;
            }
            editor.setDirty();
            final String temp = endTestCaseText.getText();
            if (temp == null || temp.length() == 0) {
                // remove the node
                if (executeCommandSectionHandler.getEndTestcaseRoot() != null) {
                    ConfigTreeNodeUtilities.removeChild(executeCommandSectionHandler.getLastSectionRoot(), executeCommandSectionHandler.getEndTestcaseRoot());
                }
                executeCommandSectionHandler.setEndTestcase(null);
                executeCommandSectionHandler.setEndTestcaseRoot(null);
                removeExternalCommandsSection();
            } else if (executeCommandSectionHandler.getEndTestcase() == null) {
                // create the node
                createExternalCommandsSection();
                final ParseTree endTestcaseRoot = new ParserRuleContext();
                executeCommandSectionHandler.setEndTestcaseRoot(endTestcaseRoot);
                ConfigTreeNodeUtilities.addChild(executeCommandSectionHandler.getLastSectionRoot(), endTestcaseRoot);
                ConfigTreeNodeUtilities.addChild(endTestcaseRoot, new AddedParseTree("\nendTestcase := "));
                final ParseTree endTestcase = new AddedParseTree(temp.trim());
                executeCommandSectionHandler.setEndTestcase(endTestcase);
                ConfigTreeNodeUtilities.addChild(endTestcaseRoot, endTestcase);
            } else {
                // simple modification
                ConfigTreeNodeUtilities.setText(executeCommandSectionHandler.getEndTestcase(), temp.trim());
            }
        }
    });
    if (executeCommandSectionHandler != null && executeCommandSectionHandler.getEndTestcase() != null) {
        endTestCaseText.setText(ConfigTreeNodeUtilities.toString(executeCommandSectionHandler.getEndTestcase()));
    }
    browse = toolkit.createButton(client, "Browse...", SWT.PUSH);
    browse.addSelectionListener(new ExternalCommandBrowser(endTestCaseText, (IFile) editor.getEditorInput().getAdapter(IFile.class)));
    valueChanged = false;
}
Also used : ParserRuleContext(org.antlr.v4.runtime.ParserRuleContext) IFile(org.eclipse.core.resources.IFile) Composite(org.eclipse.swt.widgets.Composite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) ModifyListener(org.eclipse.swt.events.ModifyListener) ExpansionAdapter(org.eclipse.ui.forms.events.ExpansionAdapter) AddedParseTree(org.eclipse.titan.common.parsers.AddedParseTree) Section(org.eclipse.ui.forms.widgets.Section) GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) ExpansionEvent(org.eclipse.ui.forms.events.ExpansionEvent) AddedParseTree(org.eclipse.titan.common.parsers.AddedParseTree) ParseTree(org.antlr.v4.runtime.tree.ParseTree)

Example 57 with ExpansionEvent

use of org.eclipse.ui.forms.events.ExpansionEvent in project titan.EclipsePlug-ins by eclipse.

the class LoggingBitsSubPage method createSubSectionFileMaskBits.

void createSubSectionFileMaskBits(final FormToolkit toolkit, final ScrolledForm form, final Composite parent) {
    final Section section = toolkit.createSection(parent, Section.DESCRIPTION | ExpandableComposite.TITLE_BAR);
    section.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
    section.setText("File Log bitmask");
    section.setExpanded(true);
    section.addExpansionListener(new ExpansionAdapter() {

        @Override
        public void expansionStateChanged(final ExpansionEvent e) {
            form.reflow(false);
        }
    });
    final Composite client = toolkit.createComposite(section, SWT.WRAP);
    final GridLayout layout = new GridLayout();
    layout.numColumns = 1;
    client.setLayout(layout);
    section.setClient(client);
    toolkit.paintBordersFor(client);
    fileMaskViewer = new CheckboxTreeViewer(client, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL);
    fileMaskViewer.setContentProvider(new LoggingBitsContentProvider());
    fileMaskViewer.getTree().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    fileMaskViewer.setLabelProvider(new LoggingBitsLabelProvider());
    fileMaskViewer.addCheckStateListener(new ICheckStateListener() {

        @Override
        public void checkStateChanged(final CheckStateChangedEvent event) {
            if (event.getChecked() && selectedLogEntry.getFileMaskRoot() == null) {
                createFileMaskRootNode(loggingPage.getSelectedTreeElement(), selectedLogEntry);
            }
            checkStateChangeHandler(selectedLogEntry.getFileMaskBits(), selectedLogEntry.getFileMask(), event);
            bitCompression(selectedLogEntry.getFileMaskBits(), selectedLogEntry.getFileMask());
            evaluateSelection(fileMaskViewer, selectedLogEntry.getFileMaskBits());
            if (!event.getChecked()) {
                if (selectedLogEntry.getFileMaskBits().keySet().isEmpty()) {
                    ConfigTreeNodeUtilities.removeChild(loggingSectionHandler.getLastSectionRoot(), selectedLogEntry.getFileMaskRoot());
                    selectedLogEntry.setFileMaskRoot(null);
                }
            }
        }
    });
    fileMaskViewer.getTree().addListener(SWT.MouseHover, new Listener() {

        @Override
        public void handleEvent(final Event event) {
            final TreeItem item = fileMaskViewer.getTree().getItem(new Point(event.x, event.y));
            if (item != null) {
                if (item.getData() instanceof LoggingBit) {
                    fileMaskViewer.getTree().setToolTipText(((LoggingBit) item.getData()).getToolTip());
                    return;
                }
            }
            fileMaskViewer.getTree().setToolTipText("");
        }
    });
    fileMaskViewer.addTreeListener(new ITreeViewerListener() {

        @Override
        public void treeCollapsed(final TreeExpansionEvent event) {
        // Do nothing
        }

        @Override
        public void treeExpanded(final TreeExpansionEvent event) {
            evaluateSelection(fileMaskViewer, selectedLogEntry.getFileMaskBits());
        }
    });
    if (selectedLogEntry == null) {
        fileMaskViewer.getControl().setEnabled(false);
        fileMaskViewer.setInput(new EnumMap<LoggingBit, ParseTree>(LoggingBit.class));
    } else {
        fileMaskViewer.getControl().setEnabled(true);
        fileMaskViewer.setInput(selectedLogEntry.getFileMaskBits());
        bitCompression(selectedLogEntry.getFileMaskBits(), selectedLogEntry.getFileMask());
        evaluateSelection(fileMaskViewer, selectedLogEntry.getFileMaskBits());
    }
}
Also used : ICheckStateListener(org.eclipse.jface.viewers.ICheckStateListener) Listener(org.eclipse.swt.widgets.Listener) ITreeViewerListener(org.eclipse.jface.viewers.ITreeViewerListener) Composite(org.eclipse.swt.widgets.Composite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) TreeItem(org.eclipse.swt.widgets.TreeItem) ICheckStateListener(org.eclipse.jface.viewers.ICheckStateListener) ITreeViewerListener(org.eclipse.jface.viewers.ITreeViewerListener) ExpansionAdapter(org.eclipse.ui.forms.events.ExpansionAdapter) Point(org.eclipse.swt.graphics.Point) Section(org.eclipse.ui.forms.widgets.Section) CheckboxTreeViewer(org.eclipse.jface.viewers.CheckboxTreeViewer) LoggingBit(org.eclipse.titan.common.parsers.cfg.indices.LoggingBit) GridLayout(org.eclipse.swt.layout.GridLayout) GridData(org.eclipse.swt.layout.GridData) Event(org.eclipse.swt.widgets.Event) ExpansionEvent(org.eclipse.ui.forms.events.ExpansionEvent) TreeExpansionEvent(org.eclipse.jface.viewers.TreeExpansionEvent) CheckStateChangedEvent(org.eclipse.jface.viewers.CheckStateChangedEvent) CheckStateChangedEvent(org.eclipse.jface.viewers.CheckStateChangedEvent) ExpansionEvent(org.eclipse.ui.forms.events.ExpansionEvent) TreeExpansionEvent(org.eclipse.jface.viewers.TreeExpansionEvent) TreeExpansionEvent(org.eclipse.jface.viewers.TreeExpansionEvent) AddedParseTree(org.eclipse.titan.common.parsers.AddedParseTree) ParseTree(org.antlr.v4.runtime.tree.ParseTree)

Example 58 with ExpansionEvent

use of org.eclipse.ui.forms.events.ExpansionEvent in project titan.EclipsePlug-ins by eclipse.

the class TestportParametersSectionPage method createDetailsPart.

private void createDetailsPart(final Composite parent, final ScrolledForm form, final FormToolkit toolkit) {
    final Section section = toolkit.createSection(parent, Section.DESCRIPTION | ExpandableComposite.TITLE_BAR);
    section.setActiveToggleColor(toolkit.getHyperlinkGroup().getActiveForeground());
    section.setToggleColor(toolkit.getColors().getColor(IFormColors.SEPARATOR));
    final Composite client = toolkit.createComposite(section, SWT.WRAP);
    final GridLayout layout = new GridLayout();
    layout.numColumns = 1;
    client.setLayout(layout);
    parameterValueText = toolkit.createText(client, "", SWT.MULTI | SWT.BORDER);
    parameterValueText.setLayoutData(new GridData(GridData.FILL_BOTH));
    parameterValueText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(final ModifyEvent e) {
            final StructuredSelection selection = (StructuredSelection) testportParametersTableViewer.getSelection();
            final Iterator<?> iterator = selection.iterator();
            if (!iterator.hasNext()) {
                return;
            }
            final TestportParameter testportParameter = (TestportParameter) iterator.next();
            ConfigTreeNodeUtilities.setText(testportParameter.getValue(), parameterValueText.getText());
            if (valueChanged) {
                valueChanged = false;
                return;
            }
            editor.setDirty();
        }
    });
    parameterValueText.setEnabled(testportParametersHandler != null);
    section.setText("Testport parameter details");
    section.setDescription("Specify the concrete value for the actually selected testport parameter.");
    section.setClient(client);
    section.setExpanded(true);
    section.addExpansionListener(new ExpansionAdapter() {

        @Override
        public void expansionStateChanged(final ExpansionEvent e) {
            form.reflow(false);
        }
    });
    final GridData gd = new GridData(GridData.FILL_BOTH);
    gd.grabExcessVerticalSpace = true;
    section.setLayoutData(gd);
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Composite(org.eclipse.swt.widgets.Composite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) ModifyListener(org.eclipse.swt.events.ModifyListener) TestportParameter(org.eclipse.titan.common.parsers.cfg.indices.TestportParameterSectionHandler.TestportParameter) GridData(org.eclipse.swt.layout.GridData) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) Iterator(java.util.Iterator) ExpansionAdapter(org.eclipse.ui.forms.events.ExpansionAdapter) Section(org.eclipse.ui.forms.widgets.Section) ExpansionEvent(org.eclipse.ui.forms.events.ExpansionEvent)

Example 59 with ExpansionEvent

use of org.eclipse.ui.forms.events.ExpansionEvent in project titan.EclipsePlug-ins by eclipse.

the class LoggingBitsSubPage method createSubSectionConsoleMaskBits.

void createSubSectionConsoleMaskBits(final FormToolkit toolkit, final ScrolledForm form, final Composite parent) {
    final Section section = toolkit.createSection(parent, Section.DESCRIPTION | ExpandableComposite.TITLE_BAR);
    section.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
    section.setText("Console Log bitmask");
    section.setExpanded(true);
    section.addExpansionListener(new ExpansionAdapter() {

        @Override
        public void expansionStateChanged(final ExpansionEvent e) {
            form.reflow(false);
        }
    });
    final Composite client = toolkit.createComposite(section, SWT.WRAP);
    final GridLayout layout = new GridLayout();
    layout.numColumns = 1;
    client.setLayout(layout);
    section.setClient(client);
    toolkit.paintBordersFor(client);
    consoleMaskViewer = new CheckboxTreeViewer(client, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL);
    consoleMaskViewer.setContentProvider(new LoggingBitsContentProvider());
    final GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
    gd.heightHint = 230;
    consoleMaskViewer.getTree().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    consoleMaskViewer.setLabelProvider(new LoggingBitsLabelProvider());
    consoleMaskViewer.addCheckStateListener(new ICheckStateListener() {

        @Override
        public void checkStateChanged(final CheckStateChangedEvent event) {
            if (event.getChecked() && selectedLogEntry.getConsoleMaskRoot() == null) {
                createConsoleMaskRootNode(loggingPage.getSelectedTreeElement(), selectedLogEntry);
            }
            checkStateChangeHandler(selectedLogEntry.getConsoleMaskBits(), selectedLogEntry.getConsoleMask(), event);
            bitCompression(selectedLogEntry.getConsoleMaskBits(), selectedLogEntry.getConsoleMask());
            evaluateSelection(consoleMaskViewer, selectedLogEntry.getConsoleMaskBits());
            if (!event.getChecked()) {
                if (selectedLogEntry.getConsoleMaskBits().keySet().isEmpty()) {
                    ConfigTreeNodeUtilities.removeChild(loggingSectionHandler.getLastSectionRoot(), selectedLogEntry.getConsoleMaskRoot());
                    selectedLogEntry.setConsoleMaskRoot(null);
                }
            }
        }
    });
    consoleMaskViewer.getTree().addListener(SWT.MouseHover, new Listener() {

        @Override
        public void handleEvent(final Event event) {
            final TreeItem item = consoleMaskViewer.getTree().getItem(new Point(event.x, event.y));
            if (item != null) {
                if (item.getData() instanceof LoggingBit) {
                    consoleMaskViewer.getTree().setToolTipText(((LoggingBit) item.getData()).getToolTip());
                    return;
                }
            }
            consoleMaskViewer.getTree().setToolTipText("");
        }
    });
    consoleMaskViewer.addTreeListener(new ITreeViewerListener() {

        @Override
        public void treeCollapsed(final TreeExpansionEvent event) {
        // Do nothing
        }

        @Override
        public void treeExpanded(final TreeExpansionEvent event) {
            evaluateSelection(consoleMaskViewer, selectedLogEntry.getConsoleMaskBits());
        }
    });
    if (selectedLogEntry == null) {
        consoleMaskViewer.getControl().setEnabled(false);
        consoleMaskViewer.setInput(new EnumMap<LoggingBit, ParseTree>(LoggingBit.class));
    } else {
        consoleMaskViewer.getControl().setEnabled(true);
        consoleMaskViewer.setInput(selectedLogEntry.getConsoleMaskBits());
        bitCompression(selectedLogEntry.getConsoleMaskBits(), selectedLogEntry.getConsoleMask());
        evaluateSelection(consoleMaskViewer, selectedLogEntry.getConsoleMaskBits());
    }
}
Also used : ICheckStateListener(org.eclipse.jface.viewers.ICheckStateListener) Listener(org.eclipse.swt.widgets.Listener) ITreeViewerListener(org.eclipse.jface.viewers.ITreeViewerListener) Composite(org.eclipse.swt.widgets.Composite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) TreeItem(org.eclipse.swt.widgets.TreeItem) ICheckStateListener(org.eclipse.jface.viewers.ICheckStateListener) ITreeViewerListener(org.eclipse.jface.viewers.ITreeViewerListener) ExpansionAdapter(org.eclipse.ui.forms.events.ExpansionAdapter) Point(org.eclipse.swt.graphics.Point) Section(org.eclipse.ui.forms.widgets.Section) CheckboxTreeViewer(org.eclipse.jface.viewers.CheckboxTreeViewer) LoggingBit(org.eclipse.titan.common.parsers.cfg.indices.LoggingBit) GridLayout(org.eclipse.swt.layout.GridLayout) GridData(org.eclipse.swt.layout.GridData) Event(org.eclipse.swt.widgets.Event) ExpansionEvent(org.eclipse.ui.forms.events.ExpansionEvent) TreeExpansionEvent(org.eclipse.jface.viewers.TreeExpansionEvent) CheckStateChangedEvent(org.eclipse.jface.viewers.CheckStateChangedEvent) CheckStateChangedEvent(org.eclipse.jface.viewers.CheckStateChangedEvent) ExpansionEvent(org.eclipse.ui.forms.events.ExpansionEvent) TreeExpansionEvent(org.eclipse.jface.viewers.TreeExpansionEvent) TreeExpansionEvent(org.eclipse.jface.viewers.TreeExpansionEvent) AddedParseTree(org.eclipse.titan.common.parsers.AddedParseTree) ParseTree(org.antlr.v4.runtime.tree.ParseTree)

Example 60 with ExpansionEvent

use of org.eclipse.ui.forms.events.ExpansionEvent in project titan.EclipsePlug-ins by eclipse.

the class ModuleParameterSectionPage method createDetailsPart.

private void createDetailsPart(final Composite parent, final ScrolledForm form, final FormToolkit toolkit) {
    final Section section = toolkit.createSection(parent, Section.DESCRIPTION | ExpandableComposite.TITLE_BAR);
    section.setActiveToggleColor(toolkit.getHyperlinkGroup().getActiveForeground());
    section.setToggleColor(toolkit.getColors().getColor(IFormColors.SEPARATOR));
    final Composite client = toolkit.createComposite(section, SWT.WRAP);
    final GridLayout layout = new GridLayout();
    layout.numColumns = 1;
    client.setLayout(layout);
    parameterValueText = toolkit.createText(client, "", SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
    parameterValueText.setLayoutData(new GridData(GridData.FILL_BOTH));
    parameterValueText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(final ModifyEvent e) {
            final StructuredSelection selection = (StructuredSelection) moduleParametersTableViewer.getSelection();
            final Iterator<?> iterator = selection.iterator();
            if (!iterator.hasNext()) {
                return;
            }
            final ModuleParameter moduleParameter = (ModuleParameter) iterator.next();
            ConfigTreeNodeUtilities.setText(moduleParameter.getValue(), parameterValueText.getText());
            if (valueChanged) {
                valueChanged = false;
                return;
            }
            editor.setDirty();
        }
    });
    parameterValueText.setEnabled(moduleParametersHandler != null);
    section.setText("Module parameter value");
    section.setDescription("Specify the concrete value for the actually selected module parameter.");
    section.setClient(client);
    section.setExpanded(true);
    section.addExpansionListener(new ExpansionAdapter() {

        @Override
        public void expansionStateChanged(final ExpansionEvent e) {
            form.reflow(false);
        }
    });
    final GridData gd = new GridData(GridData.FILL_BOTH);
    gd.grabExcessVerticalSpace = true;
    section.setLayoutData(gd);
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) ModuleParameter(org.eclipse.titan.common.parsers.cfg.indices.ModuleParameterSectionHandler.ModuleParameter) Composite(org.eclipse.swt.widgets.Composite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) ModifyListener(org.eclipse.swt.events.ModifyListener) GridData(org.eclipse.swt.layout.GridData) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) Iterator(java.util.Iterator) ExpansionAdapter(org.eclipse.ui.forms.events.ExpansionAdapter) Section(org.eclipse.ui.forms.widgets.Section) ExpansionEvent(org.eclipse.ui.forms.events.ExpansionEvent)

Aggregations

ExpansionEvent (org.eclipse.ui.forms.events.ExpansionEvent)69 ExpansionAdapter (org.eclipse.ui.forms.events.ExpansionAdapter)62 Composite (org.eclipse.swt.widgets.Composite)55 ExpandableComposite (org.eclipse.ui.forms.widgets.ExpandableComposite)52 GridData (org.eclipse.swt.layout.GridData)51 GridLayout (org.eclipse.swt.layout.GridLayout)44 Section (org.eclipse.ui.forms.widgets.Section)38 ScrolledComposite (org.eclipse.swt.custom.ScrolledComposite)11 Label (org.eclipse.swt.widgets.Label)10 ArrayList (java.util.ArrayList)9 ICellModifier (org.eclipse.jface.viewers.ICellModifier)9 TableViewer (org.eclipse.jface.viewers.TableViewer)9 SelectionEvent (org.eclipse.swt.events.SelectionEvent)8 List (java.util.List)7 TextCellEditor (org.eclipse.jface.viewers.TextCellEditor)7 SelectionListener (org.eclipse.swt.events.SelectionListener)7 Point (org.eclipse.swt.graphics.Point)7 TableColumn (org.eclipse.swt.widgets.TableColumn)7 TableItem (org.eclipse.swt.widgets.TableItem)7 ParseTree (org.antlr.v4.runtime.tree.ParseTree)6