private void createContents(final Shell shell) { shell.setText("Choose one"); RowLayout rl1 = new RowLayout(); rl1.type = SWT.VERTICAL; shell.setLayout(rl1); final Composite composite = new Composite(shell, getStyle()); RowLayout rl2 = new RowLayout(); rl2.type = SWT.VERTICAL; composite.setLayout(rl2); for (String choice : choices) { Button radio = new Button(composite, SWT.RADIO); radio.setText(choice); } Composite buttons = new Composite(shell, getStyle()); buttons.setLayout(new RowLayout()); Button ok = new Button(buttons, SWT.PUSH); ok.setText("OK"); // ok.setLayoutData(data); ok.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { choiceMade = -1; int index = 0; for (Control child : composite.getChildren()) { if (child instanceof Button) { if (((Button) child).getSelection()) { choiceMade = index; break; } } index++; } log.log(Level.INFO, "User clicked on OK and selected option {0}", index); shell.close(); } }); Button cancel = new Button(buttons, SWT.PUSH); cancel.setText("Cancel"); cancel.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { log.info("User clicked on Cancel"); shell.close(); } }); shell.setDefaultButton(ok); }
/* * (non-Javadoc) * * @see net.refractions.udig.style.sld.SLDEditorPart#createPartControl(org.eclipse.swt.widgets.Composite) */ protected Control createPartControl(Composite parent) { myparent = parent; RowLayout layout = new RowLayout(); myparent.setLayout(layout); layout.pack = false; layout.wrap = true; layout.type = SWT.HORIZONTAL; /* Border Opacity */ Group borderOpacityArea = new Group(myparent, SWT.NONE); borderOpacityArea.setLayout(new GridLayout(2, false)); borderOpacityArea.setText("Raster Opacity"); // $NON-NLS-1$ opacityScale = new Scale(borderOpacityArea, SWT.HORIZONTAL); opacityScale.setMinimum(0); opacityScale.setMaximum(100); opacityScale.setPageIncrement(10); opacityScale.setBounds(0, 0, 10, SWT.DEFAULT); opacityScale.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { opacityText.setText(String.valueOf(opacityScale.getSelection()) + "%"); // $NON-NLS-1$ opacityText.pack(true); } }); opacityScale.addSelectionListener(this); opacityText = new Text(borderOpacityArea, SWT.BORDER | SWT.READ_ONLY); opacityText.pack(true); return parent; }
/** @return a pre-initialized RowLayout suitable for option tabs. */ private RowLayout createRowLayout() { RowLayout rowLayout = new RowLayout(); rowLayout.type = org.eclipse.swt.SWT.VERTICAL; rowLayout.spacing = 9; rowLayout.marginHeight = 9; rowLayout.marginWidth = 11; rowLayout.fill = true; return rowLayout; }
/** This method initializes compButtons */ protected void createCompButtons() { compButton = new Composite(getShell(), SWT.NONE); compButton.setBounds(new Rectangle(100, 520, 700, 40)); RowLayout rowLayout = new RowLayout(); rowLayout.wrap = false; rowLayout.pack = false; rowLayout.justify = true; rowLayout.type = SWT.HORIZONTAL; rowLayout.spacing = 0; compButton.setLayout(rowLayout); btnIedeaExport = new Button(compButton, SWT.NONE); btnIedeaExport.setText(Messages.getString("NewReports.button.export.iedea")); // $NON-NLS-1$ btnIedeaExport.setFont(ResourceUtils.getFont(iDartFont.VERASANS_8)); btnIedeaExport.setLayoutData(new RowData(200, 30)); btnIedeaExport.setToolTipText( Messages.getString("NewReports.button.export.tooltip.iedea")); // $NON-NLS-1$ btnIedeaExport.addSelectionListener( new org.eclipse.swt.events.SelectionAdapter() { @Override public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) { cmdIedeaExportsSelected(); } }); btnDataExport = new Button(compButton, SWT.NONE); btnDataExport.setText(Messages.getString("NewReports.button.export")); // $NON-NLS-1$ btnDataExport.setFont(ResourceUtils.getFont(iDartFont.VERASANS_8)); btnDataExport.setLayoutData(new RowData(200, 30)); btnDataExport.setToolTipText( Messages.getString("NewReports.button.export.tooltip")); // $NON-NLS-1$ btnDataExport.addSelectionListener( new org.eclipse.swt.events.SelectionAdapter() { @Override public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) { cmdDataExportsSelected(); } }); btnDataQuality = new Button(compButton, SWT.NONE); btnDataQuality.setText(Messages.getString("NewReports.button.dataQuality")); // $NON-NLS-1$ btnDataQuality.setFont(ResourceUtils.getFont(iDartFont.VERASANS_8)); btnDataQuality.setLayoutData(new RowData(200, 30)); btnDataQuality.setToolTipText( Messages.getString("NewReports.button.dataQuality.tooltip")); // $NON-NLS-1$ btnDataQuality.addSelectionListener( new org.eclipse.swt.events.SelectionAdapter() { @Override public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) { cmdDataQualitySelected(); } }); compButton.layout(); }
/** This method initializes composite */ private void createComposite() { RowLayout rowLayout1 = new RowLayout(); // rowLayout1.marginHeight = 5; rowLayout1.marginTop = 2; rowLayout1.marginBottom = 2; // rowLayout1.marginWidth = 5; rowLayout1.type = SWT.VERTICAL; composite = new Composite(composite1, SWT.NONE); composite.setLayout(rowLayout1); SelectionAdapter hexTextSelectionAdapter = new SelectionAdapter() { public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) { text.setText(text.getText()); // generate event lastHexButtonSelected = e.widget == hexRadioButton; /* Crashes when the text is not a number if (lastHexButtonSelected) return; String textNew = text.getText(); textNew = Integer.toHexString(Integer.parseInt(textNew)).toUpperCase(); text.setText(textNew); // generate event lastHexButtonSelected = true; */ } }; /* Crashes when the text is not radix 16 SelectionAdapter decTextSelectionAdapter = new SelectionAdapter() { public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) { if (!lastHexButtonSelected) return; String textNew = text.getText(); textNew = Integer.toString(Integer.parseInt(textNew, 16)); text.setText(textNew); // generate event lastHexButtonSelected = false; } }; */ // Besides the crashes: the user always knows which number is entering, don't need any automatic // conversion. What does sometimes happen is one enters the right number and the wrong hex or // dec was // selected. In that case automatic conversion is the wrong thing to do and very annoying. hexRadioButton = new Button(composite, SWT.RADIO); hexRadioButton.setText("Hex"); hexRadioButton.addSelectionListener(defaultSelectionAdapter); hexRadioButton.addSelectionListener(hexTextSelectionAdapter); decRadioButton = new Button(composite, SWT.RADIO); decRadioButton.setText("Dec"); decRadioButton.addSelectionListener(defaultSelectionAdapter); decRadioButton.addSelectionListener(hexTextSelectionAdapter); // decTextSelectionAdapter); }
/** This method initializes composite2 */ private void createComposite2() { RowLayout rowLayout1 = new RowLayout(); rowLayout1.type = org.eclipse.swt.SWT.VERTICAL; rowLayout1.marginHeight = 10; rowLayout1.marginWidth = 10; rowLayout1.fill = true; composite2 = new Composite(sShell, SWT.NONE); FormData formData = new FormData(); formData.left = new FormAttachment(composite1); formData.right = new FormAttachment(100); composite2.setLayoutData(formData); composite2.setLayout(rowLayout1); showButton = new Button(composite2, SWT.NONE); showButton.setText("Show location"); showButton.addSelectionListener(defaultSelectionAdapter); showButton.addSelectionListener( new org.eclipse.swt.events.SelectionAdapter() { public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) { buttonPressed = 1; saveResultAndClose(); } }); gotoButton = new Button(composite2, SWT.NONE); gotoButton.setText("Go to location"); gotoButton.addSelectionListener(defaultSelectionAdapter); gotoButton.addSelectionListener( new org.eclipse.swt.events.SelectionAdapter() { public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) { buttonPressed = 2; saveResultAndClose(); } }); closeButton = new Button(composite2, SWT.NONE); closeButton.setText("Close"); closeButton.addSelectionListener( new org.eclipse.swt.events.SelectionAdapter() { public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) { sShell.close(); } }); sShell.setDefaultButton(showButton); }
public Composite createPartControl(Composite parent) { content = new Composite(parent, SWT.NONE); RowLayout rowLayout = new RowLayout(); rowLayout.wrap = true; rowLayout.pack = true; rowLayout.fill = true; rowLayout.justify = false; rowLayout.type = SWT.HORIZONTAL; rowLayout.marginLeft = 2; rowLayout.marginTop = 2; rowLayout.marginRight = 2; rowLayout.marginBottom = 2; rowLayout.spacing = 3; content.setLayout(rowLayout); IThemeManager themeManager = PlatformUI.getWorkbench().getThemeManager(); themeManager.addPropertyChangeListener(themeChangeListener); ITheme theme = themeManager.getCurrentTheme(); setTheme(theme); content.addMouseListener(mouseListener); return content; }
private void initIcons(ApplicationFactory factory) { Composite center = null; if (Application.LICENSE == Install.PERSONAL) { center = new Composite(this, SWT.TRANSPARENCY_ALPHA); GridData gridData = new GridData(GridData.FILL_BOTH); center.setLayoutData(gridData); GridLayout gridLayout = new GridLayout(2, false); center.setLayout(gridLayout); Browser widget = null; // ClientLog.getInstance().setMessage(getShell(), new Exception( "buoc 1 da chay vao day // roi " + widget.toString())); try { widget = new Browser(center, SWT.NONE); // ClientLog.getInstance().setMessage(getShell(), new Exception( " da chay vao day // roi " + widget.toString())); } catch (Exception e) { widget = new Browser(center, SWT.NONE); ClientLog.getInstance().setException(null, e); } gridData = new GridData(GridData.FILL_BOTH); gridData.verticalSpan = 2; widget.setLayoutData(gridData); if (Application.GROUPS.length > 0 && Application.GROUPS[0].equals("XML")) { widget.setUrl("http://vietspider.org/webextractor/"); toolbar.setText("http://vietspider.org/webextractor/"); } else { widget.setUrl("http://nik.vn/tin/"); // widget.setUrl("http://*****:*****@SuppressWarnings("unused") public void linkActivated(HyperlinkEvent e) { BrowserWidget browser = workspace.getTab().createItem(); browser.viewPage(); } }; browserImageLink.addHyperlinkListener(listener); // browserLink.addHyperlinkListener(listener); composite = createItem(top); final ImageHyperlink creatorImageLink = new ImageHyperlink(composite, SWT.CENTER | SWT.TRANSPARENCY_ALPHA); creatorImageLink.setImage(factory.loadImage("large.createsource.png")); // creatorImageLink.setBackground(getBackground()); creatorImageLink.setToolTipText(factory.getLabel("creatorLink")); // final Hyperlink creatorLink = createLink(composite); // creatorLink.setText(factory.getLabel("creatorLink")); // creatorLink.setForeground(color); listener = new HyperlinkAdapter() { @SuppressWarnings("unused") public void linkEntered(HyperlinkEvent e) { // creatorLink.setUnderlined(true); } @SuppressWarnings("unused") public void linkExited(HyperlinkEvent e) { // creatorLink.setUnderlined(false); } @SuppressWarnings("unused") public void linkActivated(HyperlinkEvent e) { // creatorLink.setUnderlined(false); try { ChannelWizard wizard = (ChannelWizard) workspace.getTab().createTool(ChannelWizard.class, false, SWT.CLOSE); } catch (Exception exp) { ClientLog.getInstance().setException(null, exp); } // try { // Creator creator = (Creator)workspace.getTab().createTool( // Creator.class, false, SWT.CLOSE); // creator.selectData(new Worker[0], null, null); // } catch (Exception exp) { // ClientLog.getInstance().setException(null, exp); // } } }; creatorImageLink.addHyperlinkListener(listener); // creatorLink.addHyperlinkListener(listener); //////////////////////////////////////////////////////////////////////////////////////////////// Composite bottom = new Composite(center, SWT.TRANSPARENCY_ALPHA); if (Application.LICENSE == Install.PERSONAL) { gridData = new GridData(); gridData.widthHint = 350; } else { gridData = new GridData(GridData.FILL_BOTH); } bottom.setLayoutData(gridData); // bottom.setBackground(getBackground()); rowLayout = new RowLayout(); rowLayout.wrap = true; rowLayout.pack = true; rowLayout.justify = true; rowLayout.type = SWT.HORIZONTAL; rowLayout.marginLeft = 5; rowLayout.marginTop = 5; rowLayout.marginRight = 5; rowLayout.marginBottom = 5; rowLayout.spacing = 20; bottom.setLayout(rowLayout); if (Application.LICENSE != Install.PERSONAL) { composite = createItem(top); } else { composite = createItem(bottom); } final ImageHyperlink crawlerImageLink = new ImageHyperlink(composite, SWT.CENTER | SWT.TRANSPARENCY_ALPHA); crawlerImageLink.setImage(factory.loadImage("large.crawler.png")); // crawlerImageLink.setBackground(getBackground()); crawlerImageLink.setToolTipText(factory.getLabel("crawlerLink")); // final Hyperlink crawlerLink = createLink(composite); // crawlerLink.setText(factory.getLabel("crawlerLink")); // crawlerLink.setForeground(color); listener = new HyperlinkAdapter() { @SuppressWarnings("unused") public void linkEntered(HyperlinkEvent e) { // crawlerLink.setUnderlined(true); } @SuppressWarnings("unused") public void linkExited(HyperlinkEvent e) { // crawlerLink.setUnderlined(false); } @SuppressWarnings("unused") public void linkActivated(HyperlinkEvent e) { // crawlerLink.setUnderlined(false); try { workspace.getTab().createTool(Crawler.class, true, SWT.CLOSE); } catch (Exception exp) { ClientLog.getInstance().setException(getShell(), exp); } } }; crawlerImageLink.addHyperlinkListener(listener); // crawlerLink.addHyperlinkListener(listener); if (Application.LICENSE != Install.PERSONAL) { composite = createItem(bottom); final ImageHyperlink monitorImageLink = new ImageHyperlink(composite, SWT.CENTER | SWT.TRANSPARENCY_ALPHA); monitorImageLink.setImage(factory.loadImage("large.log.png")); // monitorImageLink.setBackground(getBackground()); monitorImageLink.setToolTipText(factory.getLabel("logLink")); // final Hyperlink monitorLink = createLink(composite); // monitorLink.setText(factory.getLabel("monitorLink")); // monitorLink.setForeground(color); listener = new HyperlinkAdapter() { @SuppressWarnings("unused") public void linkActivated(HyperlinkEvent e) { try { workspace.getTab().createTool(LogViewer2.class, true, SWT.CLOSE); } catch (Exception exp) { ClientLog.getInstance().setException(workspace.getShell(), exp); } } }; monitorImageLink.addHyperlinkListener(listener); // monitorLink.addHyperlinkListener(listener); } /*if(Application.LICENSE != Install.PERSONAL) { composite = createItem(bottom); final ImageHyperlink userImageLink = new ImageHyperlink(composite, SWT.CENTER | SWT.TRANSPARENCY_ALPHA); userImageLink.setImage(factory.loadImage("large.userfolder.png")); // userImageLink.setBackground(getBackground()); userImageLink.setToolTipText(factory.getLabel("userLink")); // final Hyperlink userLink = createLink(composite); // userLink.setText(factory.getLabel("userLink")); // userLink.setForeground(color); listener = new HyperlinkAdapter() { @SuppressWarnings("unused") public void linkEntered(HyperlinkEvent e) { // userLink.setUnderlined(true); } @SuppressWarnings("unused") public void linkExited(HyperlinkEvent e) { // userLink.setUnderlined(false); // userLink.setFont(UIDATA.FONT_9VB); } @SuppressWarnings("unused") public void linkActivated(HyperlinkEvent e) { // userLink.setUnderlined(false); try { workspace.getTab().createTool(Organization.class, true, SWT.CLOSE); }catch (Exception exp) { ClientLog.getInstance().setException(workspace.getShell(), exp); } } }; userImageLink.addHyperlinkListener(listener); // userLink.addHyperlinkListener(listener); }*/ composite = createItem(bottom); final ImageHyperlink configImageLink = new ImageHyperlink(composite, SWT.CENTER | SWT.TRANSPARENCY_ALPHA); configImageLink.setImage(factory.loadImage("large.settingsfolder.png")); // configImageLink.setBackground(getBackground()); configImageLink.setToolTipText(factory.getLabel("configLink")); // final Hyperlink configLink = createLink(composite); // configLink.setText(factory.getLabel("configLink")); // configLink.setForeground(color); listener = new HyperlinkAdapter() { @SuppressWarnings("unused") public void linkEntered(HyperlinkEvent e) { // configLink.setUnderlined(true); } @SuppressWarnings("unused") public void linkExited(HyperlinkEvent e) { // configLink.setUnderlined(false); } @SuppressWarnings("unused") public void linkActivated(HyperlinkEvent e) { // configLink.setUnderlined(false); try { workspace.getTab().createTool(Config.class, true, SWT.CLOSE); } catch (Exception exp) { ClientLog.getInstance().setException(workspace.getShell(), exp); } } }; configImageLink.addHyperlinkListener(listener); }
/** * Sets up row to configure deadlock preserving slicing and slice type. * * @param composite to layout the slice configuration widgets. * @pre composite != null */ private void setupSliceInfoUI(final Composite composite) { final SlicerConfiguration _cfg = (SlicerConfiguration) configuration; final GridLayout _gridLayout = new GridLayout(3, false); composite.setLayout(_gridLayout); executableSliceButton = new Button(composite, SWT.CHECK); executableSliceButton.setText("Executable slice"); final GridData _gridData2 = new GridData(); _gridData2.horizontalSpan = 1; executableSliceButton.setLayoutData(_gridData2); executableSliceButton.addSelectionListener( new BooleanPropertySelectionListener( SlicerConfiguration.EXECUTABLE_SLICE, executableSliceButton, _cfg)); if (_cfg.getSliceType().equals(SliceType.FORWARD_SLICE)) { executableSliceButton.setEnabled(false); } executableSliceButton.setSelection(_cfg.getExecutableSlice()); setupCallingContextUI(composite, _cfg); setupAssertionUI(composite, _cfg); setupDeadlockUI(composite, _cfg); // Slice type related group final Group _group2 = new Group(composite, SWT.SHADOW_ETCHED_IN); _group2.setText("Slice Type"); final GridData _gridData = new GridData(GridData.FILL_HORIZONTAL); _gridData.horizontalSpan = 1; _gridData.verticalAlignment = SWT.TOP; _gridData.horizontalAlignment = SWT.RIGHT; _group2.setLayoutData(_gridData); final RowLayout _rowLayout = new RowLayout(); _rowLayout.type = SWT.VERTICAL; _group2.setLayout(_rowLayout); final Button _backwardSlice = new Button(_group2, SWT.RADIO); _backwardSlice.setText("Backward slice"); final Button _forwardSlice = new Button(_group2, SWT.RADIO); _forwardSlice.setText("Forward slice"); final Button _completeSlice = new Button(_group2, SWT.RADIO); _completeSlice.setText("Complete slice"); final SelectionListener _sl6 = new SelectionListener() { public void widgetSelected(final SelectionEvent evt) { Object _value = null; if (evt.widget == _forwardSlice) { _value = SliceType.FORWARD_SLICE; executableSliceButton.setSelection(false); executableSliceButton.notifyListeners(SWT.Selection, null); executableSliceButton.setEnabled(false); } else { if (evt.widget == _backwardSlice) { _value = SliceType.BACKWARD_SLICE; } else if (evt.widget == _completeSlice) { _value = SliceType.COMPLETE_SLICE; } executableSliceButton.setEnabled(true); } if (_value != null) { _cfg.setProperty(SlicerConfiguration.SLICE_TYPE, _value); } } public void widgetDefaultSelected(final SelectionEvent evt) { widgetSelected(evt); } }; _backwardSlice.addSelectionListener(_sl6); _completeSlice.addSelectionListener(_sl6); _forwardSlice.addSelectionListener(_sl6); final Object _sliceType = _cfg.getSliceType(); if (_sliceType.equals(SliceType.BACKWARD_SLICE)) { _backwardSlice.setSelection(true); } else if (_sliceType.equals(SliceType.COMPLETE_SLICE)) { _completeSlice.setSelection(true); } else if (_sliceType.equals(SliceType.FORWARD_SLICE)) { _forwardSlice.setSelection(true); } }
/** * Sets up row corresponding to Ready DA in the configurator composite. * * @param composite to layout the ready dependence configuration widgets. * @pre composite != null */ private void setupReadyDepUI(final Composite composite) { final SlicerConfiguration _cfg = (SlicerConfiguration) configuration; final RowLayout _rowLayout1 = new RowLayout(SWT.VERTICAL); composite.setLayout(_rowLayout1); final Composite _readyComposite1 = new Composite(composite, SWT.NONE); final GridLayout _gridLayout2 = new GridLayout(); _gridLayout2.numColumns = 2; _readyComposite1.setLayout(_gridLayout2); final Button _useRDAButton = new Button(_readyComposite1, SWT.CHECK); _useRDAButton.setText("use ready dependence"); _useRDAButton.setToolTipText("Use ready dependence in calculation of the slice."); _useRDAButton.setSelection(_cfg.isReadyDepAnalysisUsed()); _useRDAButton.addSelectionListener( new BooleanPropertySelectionListener(SlicerConfiguration.USE_READYDA, _useRDAButton, _cfg)); // Sets up the composite and buttons pertaining to precision control. final Group _precisionOfRDAGroup = new Group(composite, SWT.SHADOW_ETCHED_IN); final GridLayout _gridLayout3 = new GridLayout(); _gridLayout3.numColumns = 2; _precisionOfRDAGroup.setLayout(_gridLayout3); _precisionOfRDAGroup.setText("Precision of Ready dependence"); final Group _precisionGroup = new Group(_precisionOfRDAGroup, SWT.SHADOW_ETCHED_IN); final GridLayout _gridLayout4 = new GridLayout(); _gridLayout4.numColumns = 1; _precisionGroup.setLayout(_gridLayout4); _precisionGroup.setText("Sort of analysis to be used."); _precisionGroup.setToolTipText( "Controls the precision via properties inherent to interference."); // Sets up the buttons that control the nature of ready dependence. final Button _typedRDA = new Button(_precisionGroup, SWT.RADIO); _typedRDA.setText("use type-based analysis"); _typedRDA.setToolTipText("Only primaries of compatible types will be considered"); final Button _equivalenceClassBasedEscapeAnalysisBasedRDA = new Button(_precisionGroup, SWT.RADIO); _equivalenceClassBasedEscapeAnalysisBasedRDA.setText( "use equivalence class-based escape analysis"); _equivalenceClassBasedEscapeAnalysisBasedRDA.setToolTipText( "Only primaries belonging to the same equivalence class will be considered."); final Button _symbolBasedEscapeAnalysisBasedRDA = new Button(_precisionGroup, SWT.RADIO); _symbolBasedEscapeAnalysisBasedRDA.setText( "use sybmolic and equivalence class-based escape analysis"); _symbolBasedEscapeAnalysisBasedRDA.setToolTipText( "Only symbolically equivalent primaries that belong to the same equivalence class will be considered."); SelectionListener _sl = new SelectionListener() { public void widgetSelected(final SelectionEvent evt) { Object _value = null; if (evt.widget == _equivalenceClassBasedEscapeAnalysisBasedRDA) { _value = SlicerConfiguration.EQUIVALENCE_CLASS_BASED_INFO; } else if (evt.widget == _symbolBasedEscapeAnalysisBasedRDA) { _value = SlicerConfiguration.SYMBOL_AND_EQUIVCLS_BASED_INFO; } else if (evt.widget == _typedRDA) { _value = SlicerConfiguration.TYPE_BASED_INFO; } if (_value != null) { _cfg.setProperty(SlicerConfiguration.NATURE_OF_READY_DA, _value); } } public void widgetDefaultSelected(final SelectionEvent evt) { widgetSelected(evt); } }; _equivalenceClassBasedEscapeAnalysisBasedRDA.addSelectionListener(_sl); _symbolBasedEscapeAnalysisBasedRDA.addSelectionListener(_sl); _typedRDA.addSelectionListener(_sl); final Object _temp = _cfg.getProperty(SlicerConfiguration.NATURE_OF_READY_DA); if (_temp == null || _temp.equals(SlicerConfiguration.SYMBOL_AND_EQUIVCLS_BASED_INFO)) { _symbolBasedEscapeAnalysisBasedRDA.setSelection(true); } else if (_temp.equals(SlicerConfiguration.EQUIVALENCE_CLASS_BASED_INFO)) { _equivalenceClassBasedEscapeAnalysisBasedRDA.setSelection(true); } else if (_temp.equals(SlicerConfiguration.TYPE_BASED_INFO)) { _typedRDA.setSelection(true); } // Sets up the buttons that control what auxiliary analysis are used improve precision. final Composite _analysisComposite = new Composite(_precisionOfRDAGroup, SWT.NONE); final RowLayout _rowLayout = new RowLayout(); _rowLayout.type = SWT.VERTICAL; _analysisComposite.setLayout(_rowLayout); final GridData _analysisCompositeGridData = new GridData(GridData.FILL_HORIZONTAL); _analysisCompositeGridData.verticalAlignment = SWT.TOP; _analysisComposite.setLayoutData(_analysisCompositeGridData); final Button _useOFAForReady = new Button(_analysisComposite, SWT.CHECK); _useOFAForReady.setText("use object flow analysis information"); _useOFAForReady.setToolTipText("Only aliasing primaries will be considered"); _useOFAForReady.setSelection(_cfg.isOFAUsedForReady()); _useOFAForReady.addSelectionListener( new BooleanPropertySelectionListener( SlicerConfiguration.USE_OFA_FOR_READY_DA, _useOFAForReady, _cfg)); final Button _useSLAForReady = new Button(_analysisComposite, SWT.CHECK); _useSLAForReady.setText("use safe lock analysis "); _useSLAForReady.setToolTipText("Safe locks will not considered"); _useSLAForReady.setSelection(_cfg.isSafeLockAnalysisUsedForReady()); _useSLAForReady.addSelectionListener( new BooleanPropertySelectionListener( SlicerConfiguration.USE_SLA_FOR_READY_DA, _useSLAForReady, _cfg)); final Button _useCallSiteSensitiveReady = new Button(_analysisComposite, SWT.CHECK); _useCallSiteSensitiveReady.setText("blocking call-site aware"); _useCallSiteSensitiveReady.setToolTipText( "Calls leading to blocking will be considered as blocking as well."); _useCallSiteSensitiveReady.setSelection(_cfg.isCallSiteSensitiveReadyUsed()); _useCallSiteSensitiveReady.addSelectionListener( new BooleanPropertySelectionListener( SlicerConfiguration.CALL_SITE_SENSITIVE_READY_DA, _useCallSiteSensitiveReady, _cfg)); // Sets up the buttons that control what rules of ready dependence analysis are used. final Group _natureOfRDAGroup = new Group(composite, SWT.SHADOW_ETCHED_IN); final GridLayout _gridLayout5 = new GridLayout(); _gridLayout5.numColumns = 2; _natureOfRDAGroup.setLayout(_gridLayout5); _natureOfRDAGroup.setText("Nature of Ready dependence"); final Button _rule1RDAButton = new Button(_natureOfRDAGroup, SWT.CHECK); _rule1RDAButton.setText("use rule 1 of ready dependence"); _rule1RDAButton.setToolTipText( "Intra-thread intra-procedural monitor acquisition based ready dependence"); _rule1RDAButton.setSelection(_cfg.isReadyRule1Used()); _rule1RDAButton.addSelectionListener( new BooleanPropertySelectionListener( SlicerConfiguration.USE_RULE1_IN_READYDA, _rule1RDAButton, _cfg)); final Button _rule2RDAButton = new Button(_natureOfRDAGroup, SWT.CHECK); _rule2RDAButton.setText("use rule 2 of ready dependence"); _rule2RDAButton.setToolTipText("Inter-thread monitor acquisition ready dependence"); _rule2RDAButton.setSelection(_cfg.isReadyRule2Used()); _rule2RDAButton.addSelectionListener( new BooleanPropertySelectionListener( SlicerConfiguration.USE_RULE2_IN_READYDA, _rule2RDAButton, _cfg)); final Button _rule3RDAButton = new Button(_natureOfRDAGroup, SWT.CHECK); _rule3RDAButton.setText("use rule 3 of ready dependence"); _rule3RDAButton.setToolTipText( "Intra-thread intra-procedural Object.wait() based ready dependence"); _rule3RDAButton.setSelection(_cfg.isReadyRule3Used()); _rule3RDAButton.addSelectionListener( new BooleanPropertySelectionListener( SlicerConfiguration.USE_RULE3_IN_READYDA, _rule3RDAButton, _cfg)); final Button _rule4RDAButton = new Button(_natureOfRDAGroup, SWT.CHECK); _rule4RDAButton.setText("use rule 4 of ready dependence"); _rule4RDAButton.setToolTipText("Inter-thread Object.wait() based ready dependence"); _rule4RDAButton.setSelection(_cfg.isReadyRule4Used()); _rule4RDAButton.addSelectionListener( new BooleanPropertySelectionListener( SlicerConfiguration.USE_RULE4_IN_READYDA, _rule4RDAButton, _cfg)); // Links up the buttons via selection listener to control toggling based on the user's decision // to use ready DA. _useRDAButton.addSelectionListener( new SelectionListener() { public void widgetSelected(@SuppressWarnings("unused") final SelectionEvent evt) { boolean _val = false; if (_useRDAButton.getSelection()) { _val = true; } _precisionGroup.setEnabled(_val); _precisionOfRDAGroup.setEnabled(_val); _equivalenceClassBasedEscapeAnalysisBasedRDA.setEnabled(_val); _typedRDA.setEnabled(_val); _useOFAForReady.setEnabled(_val); _useSLAForReady.setEnabled(_val); _useCallSiteSensitiveReady.setEnabled(_val); _symbolBasedEscapeAnalysisBasedRDA.setEnabled(_val); _rule1RDAButton.setEnabled(_val); _rule2RDAButton.setEnabled(_val); _rule3RDAButton.setEnabled(_val); _rule4RDAButton.setEnabled(_val); } public void widgetDefaultSelected(final SelectionEvent evt) { widgetSelected(evt); } }); _useRDAButton.setSelection(_cfg.isInterferenceDepAnalysisUsed()); _useRDAButton.notifyListeners(SWT.Selection, null); }
/** * Sets up row corresponding Interference DA in the configurator composite. * * @param composite to layout the interference dependence configuration widgets. * @pre composite != null */ private void setupInteferenceDepUI(final Composite composite) { final SlicerConfiguration _cfg = (SlicerConfiguration) configuration; final GridLayout _gridLayout = new GridLayout(); _gridLayout.numColumns = 2; composite.setLayout(_gridLayout); final Button _useIDAButton = new Button(composite, SWT.CHECK); _useIDAButton.setText("use interference dependence"); _useIDAButton.setToolTipText("Use interference dependence in calculation of the slice."); _useIDAButton.setSelection(_cfg.isInterferenceDepAnalysisUsed()); _useIDAButton.addSelectionListener( new BooleanPropertySelectionListener( SlicerConfiguration.USE_INTERFERENCEDA, _useIDAButton, _cfg)); // Sets up the composite and buttons pertaining to precision control. final Group _natureOfIDAGroup = new Group(composite, SWT.SHADOW_ETCHED_IN); final GridLayout _gridLayout3 = new GridLayout(); _gridLayout3.numColumns = 2; _natureOfIDAGroup.setLayout(_gridLayout3); _natureOfIDAGroup.setText("Precision of Interference dependence"); _natureOfIDAGroup.setToolTipText("Controls the precision of interference dependence."); final GridData _gridData1 = new GridData(GridData.FILL_HORIZONTAL); _gridData1.horizontalSpan = 2; _natureOfIDAGroup.setLayoutData(_gridData1); final Group _precisionGroup = new Group(_natureOfIDAGroup, SWT.SHADOW_ETCHED_IN); final GridLayout _gridLayout4 = new GridLayout(); _gridLayout4.numColumns = 1; _precisionGroup.setLayout(_gridLayout4); _precisionGroup.setText("Sort of analysis to be used."); _precisionGroup.setToolTipText( "Controls the precision via properties inherent to interference."); final Button _typedIDA = new Button(_precisionGroup, SWT.RADIO); _typedIDA.setText("use type-based analysis"); _typedIDA.setToolTipText("Only primaries of compatible types will be considered"); final Button _equivalenceClassBasedEscapeAnalysisBasedIDA = new Button(_precisionGroup, SWT.RADIO); _equivalenceClassBasedEscapeAnalysisBasedIDA.setText( "use equivalence class-based escape analysis"); _equivalenceClassBasedEscapeAnalysisBasedIDA.setToolTipText( "Only primaries of belonging to the same equivalence class will be considered."); final Button _symbolBasedEscapeAnalysisBasedIDA = new Button(_precisionGroup, SWT.RADIO); _symbolBasedEscapeAnalysisBasedIDA.setText( "use symbolic and equivalence class-based escape analysis"); _symbolBasedEscapeAnalysisBasedIDA.setToolTipText( "Only symbolically equivalent primaries that belong to the same equivalence class will be considered."); final SelectionListener _sl2 = new SelectionListener() { public void widgetSelected(final SelectionEvent evt) { Object _value = null; if (evt.widget == _equivalenceClassBasedEscapeAnalysisBasedIDA) { _value = SlicerConfiguration.EQUIVALENCE_CLASS_BASED_INFO; } else if (evt.widget == _symbolBasedEscapeAnalysisBasedIDA) { _value = SlicerConfiguration.SYMBOL_AND_EQUIVCLS_BASED_INFO; } else if (evt.widget == _typedIDA) { _value = SlicerConfiguration.TYPE_BASED_INFO; } if (_value != null) { _cfg.setProperty(SlicerConfiguration.NATURE_OF_INTERFERENCE_DA, _value); } } public void widgetDefaultSelected(final SelectionEvent evt) { widgetSelected(evt); } }; _equivalenceClassBasedEscapeAnalysisBasedIDA.addSelectionListener(_sl2); _symbolBasedEscapeAnalysisBasedIDA.addSelectionListener(_sl2); _typedIDA.addSelectionListener(_sl2); final Object _temp = _cfg.getProperty(SlicerConfiguration.NATURE_OF_INTERFERENCE_DA); if (_temp == null || _temp.equals(SlicerConfiguration.SYMBOL_AND_EQUIVCLS_BASED_INFO)) { _symbolBasedEscapeAnalysisBasedIDA.setSelection(true); } else if (_temp.equals(SlicerConfiguration.EQUIVALENCE_CLASS_BASED_INFO)) { _equivalenceClassBasedEscapeAnalysisBasedIDA.setSelection(true); } else if (_temp.equals(SlicerConfiguration.TYPE_BASED_INFO)) { _typedIDA.setSelection(true); } // Sets up the buttons that control what auxiliary analysis are used improve precision. final Composite _analysisComposite = new Composite(_natureOfIDAGroup, SWT.NONE); final RowLayout _rowLayout = new RowLayout(); _rowLayout.type = SWT.VERTICAL; _analysisComposite.setLayout(_rowLayout); final GridData _analysisCompositeGridData = new GridData(GridData.FILL_HORIZONTAL); _analysisCompositeGridData.verticalAlignment = SWT.TOP; _analysisComposite.setLayoutData(_analysisCompositeGridData); final Button _useOFAForInterference = new Button(_analysisComposite, SWT.CHECK); _useOFAForInterference.setText("use object flow analysis information"); _useOFAForInterference.setToolTipText("Only aliasing primaries will be considered"); _useOFAForInterference.addSelectionListener( new BooleanPropertySelectionListener( SlicerConfiguration.USE_OFA_FOR_INTERFERENCE_DA, _useOFAForInterference, _cfg)); _useOFAForInterference.setSelection(_cfg.isOFAUsedForInterference()); // Links up the buttons via selection listener to control toggling based on the user's decision // to use interference DA. _useIDAButton.addSelectionListener( new SelectionListener() { public void widgetSelected(@SuppressWarnings("unused") final SelectionEvent evt) { boolean _val = false; if (_useIDAButton.getSelection()) { _val = true; } _natureOfIDAGroup.setEnabled(_val); _equivalenceClassBasedEscapeAnalysisBasedIDA.setEnabled(_val); _typedIDA.setEnabled(_val); _symbolBasedEscapeAnalysisBasedIDA.setEnabled(_val); _useOFAForInterference.setEnabled(_val); _precisionGroup.setEnabled(_val); } public void widgetDefaultSelected(final SelectionEvent evt) { widgetSelected(evt); } }); _useOFAForInterference.setSelection(_cfg.isOFAUsedForInterference()); _useIDAButton.setSelection(_cfg.isInterferenceDepAnalysisUsed()); _useIDAButton.notifyListeners(SWT.Selection, null); }
/** * Sets up the deadlock preservation part of the UI. * * @param composite on which to install the UI. * @param cfg to be used. * @pre composite != null and cfg != null */ private void setupDeadlockUI(final Composite composite, final SlicerConfiguration cfg) { final Group _deadlockGroup = new Group(composite, SWT.NONE); final GridData _gridData1 = new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false); _gridData1.horizontalSpan = 2; _deadlockGroup.setLayoutData(_gridData1); final RowLayout _rowLayout1 = new RowLayout(); _rowLayout1.type = SWT.VERTICAL; _rowLayout1.fill = true; _deadlockGroup.setLayout(_rowLayout1); _deadlockGroup.setText("Preservation of Deadlocking property"); final Button _button = new Button(_deadlockGroup, SWT.CHECK); _button.setText("Preserve Deadlock"); final Button _applclasses = new Button(_deadlockGroup, SWT.CHECK); _applclasses.setText("Preserve sync constructs in application classes only"); _applclasses.setSelection(cfg.areSynchronizationsOnlyInAppClassesConsidered()); _applclasses.addSelectionListener( new BooleanPropertySelectionListener( SlicerConfiguration.SYNCS_IN_APPLICATION_CLASSES_ONLY, _applclasses, cfg)); final Group _group1 = new Group(_deadlockGroup, SWT.SHADOW_ETCHED_IN); _group1.setText("Deadlock Criteria Selection Strategy"); final RowLayout _rowLayout2 = new RowLayout(); _rowLayout2.type = SWT.VERTICAL; _group1.setLayout(_rowLayout2); final Button _allSyncStrategy = new Button(_group1, SWT.RADIO); _allSyncStrategy.setText("All Synchronization constructs"); _allSyncStrategy.setToolTipText( "Synchronization constructs are preserved independent of any property"); final Button _escapingSyncStrategy = new Button(_group1, SWT.RADIO); _escapingSyncStrategy.setText("Escaping Sychronization constructs"); _escapingSyncStrategy.setToolTipText( "Only synchronization constructs involving escaping lock object are preserved."); final Button _ctxtsensEscapingSyncStrategy = new Button(_group1, SWT.RADIO); _ctxtsensEscapingSyncStrategy.setText("Escaping Sychronization constructs with their contexts"); _ctxtsensEscapingSyncStrategy.setToolTipText( "Calling contexs of the preserved synchronization constructs " + "are considered"); final SelectionListener _sl4 = new SelectionListener() { public void widgetSelected(final SelectionEvent evt) { Object _value = null; if (evt.widget == _ctxtsensEscapingSyncStrategy) { _value = SlicerConfiguration.CONTEXT_SENSITIVE_ESCAPING_SYNC_CONSTRUCTS; } else if (evt.widget == _escapingSyncStrategy) { _value = SlicerConfiguration.ESCAPING_SYNC_CONSTRUCTS; } else if (evt.widget == _allSyncStrategy) { _value = SlicerConfiguration.ALL_SYNC_CONSTRUCTS; } if (_value != null) { cfg.setProperty(SlicerConfiguration.DEADLOCK_CRITERIA_SELECTION_STRATEGY, _value); } } public void widgetDefaultSelected(final SelectionEvent evt) { widgetSelected(evt); } }; _allSyncStrategy.addSelectionListener(_sl4); _escapingSyncStrategy.addSelectionListener(_sl4); _ctxtsensEscapingSyncStrategy.addSelectionListener(_sl4); final Object _temp = cfg.getDeadlockCriteriaSelectionStrategy(); if (_temp.equals(SlicerConfiguration.ALL_SYNC_CONSTRUCTS)) { _allSyncStrategy.setSelection(true); } else if (_temp.equals(SlicerConfiguration.ESCAPING_SYNC_CONSTRUCTS)) { _escapingSyncStrategy.setSelection(true); } else if (_temp.equals(SlicerConfiguration.CONTEXT_SENSITIVE_ESCAPING_SYNC_CONSTRUCTS)) { _ctxtsensEscapingSyncStrategy.setSelection(true); } final SelectionListener _sl5 = new BooleanPropertySelectionListener(SlicerConfiguration.SLICE_FOR_DEADLOCK, _button, cfg) { @Override public void widgetSelected(@SuppressWarnings("unused") final SelectionEvent evt) { final boolean _value = button.getSelection(); containingConfiguration.setProperty(id, Boolean.valueOf(_value)); _group1.setEnabled(_value); _applclasses.setEnabled(_value); _allSyncStrategy.setEnabled(_value); _escapingSyncStrategy.setEnabled(_value); _ctxtsensEscapingSyncStrategy.setEnabled(_value); } }; _button.addSelectionListener(_sl5); _button.setSelection(cfg.getSliceForDeadlock()); _button.notifyListeners(SWT.Selection, null); }
/** build the view */ private void buildView() { GridLayout gridLayout = new GridLayout(2, false); final Composite comp = new Composite(shell, SWT.NONE); shell.setLayout(new FillLayout()); comp.setLayout(gridLayout); GridData gridData = new GridData(); dataList = new List(comp, SWT.BORDER | SWT.SINGLE | SWT.V_SCROLL); gridData = new GridData(); gridData.widthHint = 200; gridData.verticalAlignment = SWT.FILL; gridData.grabExcessVerticalSpace = true; gridData.verticalSpan = 2; dataList.setLayoutData(gridData); dataList.addListener(SWT.Selection, new ListListener()); dataTable = new Table(comp, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI); dataTable.setLinesVisible(true); dataTable.setHeaderVisible(true); gridData = new GridData(); gridData.verticalAlignment = SWT.FILL; gridData.horizontalAlignment = SWT.FILL; gridData.grabExcessVerticalSpace = true; gridData.grabExcessHorizontalSpace = true; dataTable.setLayoutData(gridData); final TableColumn column1 = new TableColumn(dataTable, SWT.NONE); final TableColumn column2 = new TableColumn(dataTable, SWT.NONE); column1.setText("Time"); column2.setText("Value"); column1.setWidth(180); column2.setWidth(270); Composite buttonsComp = new Composite(comp, SWT.NONE); gridData = new GridData(); gridData.grabExcessHorizontalSpace = true; gridData.heightHint = 40; buttonsComp.setLayoutData(gridData); RowLayout rowLayout = new RowLayout(); rowLayout.type = SWT.HORIZONTAL; rowLayout.justify = true; rowLayout.pack = true; buttonsComp.setLayout(rowLayout); ButtonListener bl = new ButtonListener(); Button refreshButton = new Button(buttonsComp, SWT.NONE); refreshButton.setText("Refresh"); refreshButton.addSelectionListener(bl); Button exportButton = new Button(buttonsComp, SWT.NONE); exportButton.setText("Export"); exportButton.addSelectionListener(bl); Button deleteButton = new Button(buttonsComp, SWT.NONE); deleteButton.setText("Delete Selection"); deleteButton.addSelectionListener(bl); Button deleteallButton = new Button(buttonsComp, SWT.NONE); deleteallButton.setText("Delete all"); deleteallButton.addSelectionListener(bl); }
/** * show one popup menu over the main window * * @param menu_entry actual entry which should be shown or disposed * @param move TRUE if the curser be moved over one entry, otherwise by clicking false */ private void show(String menu_entry, boolean move) { Point abs; Group popup; Rectangle rect, popup_rect = new Rectangle(0, 0, 120, 100); TreeNodes node; RowLayout l; ArrayList<TreeNodes> nodes; ArrayList<Composite> comps; if (move && m_sMenu.equals("")) { return; } if (!m_sMenu.equals(menu_entry)) { if (m_popupShell != null) m_popupShell.dispose(); popup = m_mRootEntrys.get(menu_entry); rect = popup.getBounds(); m_popupShell = new Shell(m_oTopLevelShell, SWT.NO_TRIM); // popup_rect= m_popupShell.getClientArea(); abs = LayoutLoader.getAbsoluteUseFieldPoint(); popup_rect.x = m_oMenu.getBounds().x + abs.x + rect.x; popup_rect.y = abs.y + rect.y + rect.height; l = new RowLayout(); l.type = SWT.VERTICAL; l.pack = false; l.marginBottom = 0; l.marginHeight = 0; l.marginLeft = 0; l.marginRight = 0; l.marginTop = 0; l.marginWidth = 0; l.spacing = 0; m_popupShell.setLayout(l); node = m_mRootNodes.get(menu_entry); nodes = node.getChilds(); m_sMenu = menu_entry; if (nodes.size() == 0) { m_sMenu = ""; return; } comps = new ArrayList<Composite>(); for (TreeNodes subnode : nodes) { RowLayout layout = new RowLayout(); Composite comp = new Group(m_popupShell, SWT.NONE); Label text = new Label(comp, SWT.NONE); HashMap<String, String> metablock = subnode.getMetaData(); String popupspace = metablock.get("popupspace"); final String entry; int space = 20; FontObject font = new FontObject(); int popupsize = 0; boolean bold = false; boolean italic = false; String looks, ssize; MouseListener listener1, listener2; entry = m_sMenu + "/" + subnode.getName(); ssize = metablock.get("popupfontsize"); if (ssize != null) popupsize = Integer.parseInt(ssize); looks = metablock.get("popupstyle"); if (looks != null) { String[] split; split = looks.split(","); for (int i = 0; i < split.length; ++i) { split[i] = split[i].trim().toLowerCase(); if (split[i].equals("bold")) bold = true; else if (split[i].equals("italic")) italic = true; } } font.defineColor(popup, metablock.get("popupcolor"), colors.WIDGET, entry + " popup"); font.defineColor(popup, metablock.get("popupfontcolor"), colors.TEXT, entry + " popup"); font.defineFont( popup, metablock.get("popupfont"), popupsize, bold, italic, /*underline*/ false); text.setText(subnode.getTitle().trim()); if (popupspace != null) space = Integer.parseInt(popupspace); layout.type = SWT.VERTICAL; layout.marginTop = space; layout.marginRight = space; layout.marginBottom = space; layout.marginLeft = space; comp.setLayout(layout); font.setDevice(comp); font.setDevice(text); font.dispose(); comps.add(comp); text.addMouseListener( listener1 = new MouseAdapter() { public void mouseDown(MouseEvent event) { LayoutLoader loader; Thread t = null; if (HtmTags.lockDebug) { t = Thread.currentThread(); System.out.println(t.getName() + " want to setActiveSideVisible of " + entry); } loader = LayoutLoader.instance(); loader.m_sAktFolder = entry; synchronized (TreeNodes.m_DISPLAYLOCK) { loader.setCurrentSideVisible(/*inform server by no body*/ true); } m_nPopup = m_popupShell.getBounds(); destroyPopupShell(); m_sMenu = ""; } }); m_aPopupListeners.put(text, listener1); comp.addMouseListener( listener2 = new MouseAdapter() { public void mouseDown(MouseEvent event) { LayoutLoader loader; Thread t = null; if (HtmTags.lockDebug) { t = Thread.currentThread(); System.out.println(t.getName() + " want to setActiveSideVisible of " + entry); } loader = LayoutLoader.instance(); loader.m_sAktFolder = entry; synchronized (TreeNodes.m_DISPLAYLOCK) { loader.setCurrentSideVisible(/*inform server by no body*/ true); } m_nPopup = m_popupShell.getBounds(); destroyPopupShell(); m_sMenu = ""; } }); m_aPopupListeners.put(comp, listener2); } if (m_nPopup != null) popup_rect = m_nPopup; m_popupShell.setBounds(popup_rect); m_popupShell.setEnabled(false); m_popupShell.setVisible(false); m_popupShell.open(); m_popupShell.pack(); m_popupShell.setEnabled(true); m_popupShell.setVisible(true); } else if (!m_sMenu.equals("") && !move) { // actual popup is the same m_popupShell.dispose(); m_sMenu = ""; } }