public int selectedIndex() { Control[] children = radioGroup.getChildren(); for ( int i = 0; i < children.length; i++ ) { Control child = children[ i ]; Button button = (Button) child; if ( button.getSelection() ) { return i; } } return -1; }
public void setSelectedIndex( int index ) { for ( Control control : radioGroup.getChildren() ) { ( (Button) control ).setSelection( false ); } ( (Button) radioGroup.getChildren()[ index ] ).setSelection( true ); radioGroup.getChildren()[index].notifyListeners( SWT.Selection, new Event() ); } }
private void clearOptions() { for ( Control control : gOptions.getChildren() ) { control.dispose(); } }
public Composite createContent( String radioText ) { Control[] existingButtons = radioGroup.getChildren(); Button button = new Button( radioGroup, SWT.RADIO ); button.setText( radioText ); props.setLook( button ); FormData fdButton = new FormData(); fdButton.top = new FormAttachment( 0 ); fdButton.left = existingButtons.length == 0 ? new FormAttachment( 0 ) : new FormAttachment( existingButtons[existingButtons.length - 1], 40 ); button.setLayoutData( fdButton ); button.setSelection( existingButtons.length == 0 ); Composite content = new Composite( contentArea, SWT.NONE ); content.setVisible( existingButtons.length == 0 ); props.setLook( content ); content.setLayout( noMarginLayout ); content.setLayoutData( fdMaximize ); button.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected( SelectionEvent selectionEvent ) { for ( Control control : contentArea.getChildren() ) { control.setVisible( false ); } content.setVisible( true ); } } ); return content; }
/** * Sets the enabled state of all of the child of the given group * * @param group * @param enabled */ void setGroupEnablement(Group group, boolean enabled) { Control[] children = group.getChildren(); for (Control element : children) { element.setEnabled(enabled); } }
/** * Sets the enabled state of all of the child of the given group * @param group * @param enabled */ void setGroupEnablement(Group group, boolean enabled) { Control[] children = group.getChildren(); for (int i = 0; i < children.length; i++) { children[i].setEnabled(enabled); } }
private void updateOptionsDisplay () { boolean enabled = chkSegmentTarget.getSelection() || chkSegmentSource.getSelection(); grpOptions.setEnabled(enabled); for ( Control ctrl : grpOptions.getChildren() ) { ctrl.setEnabled(enabled); } }
@Override public Control remove(Group parent, Control control) { Thing parentThing = Designer.getThing(parent); Thing itemThing = Designer.getThing(control); parentThing.removeChild(itemThing); parentThing.save(); int index = -1; for(int i=0; i<parent.getChildren().length; i++){ index++; if(parent.getChildren()[i] == control){ break; } } control.dispose(); SwtUtils.layout(parent); if(index != -1){ if(parent.getChildren().length > index){ return parent.getChildren()[index]; }else if(parent.getChildren().length > index - 1 && index != 0){ return parent.getChildren()[index - 1]; }else{ return parent; } }else{ return parent; } }
public ItemInfo getItemIndex(Group parent, Control control){ int index = -1; for(Control item : parent.getChildren()){ index++; if(item == control){ return new ItemInfo(index, Designer.getThing(item)); } } return null; }
/** * Set whether or not the controls in the field editor are enabled. * * @param enabled * The enabled state. */ public void setEnabled(boolean enabled) { group.setEnabled(enabled); Control[] children = group.getChildren(); for (int i = 0; i < children.length; i++) { children[i].setEnabled(enabled); } } }
@Override public void handleEvent (Event event) { Control [] children = gRadio.getChildren (); for (int j=0; j<children.length; j++) { Control child = children [j]; if (child instanceof Button) { Button button = (Button) child; if ((button.getStyle () & SWT.RADIO) != 0) button.setSelection (false); } } Button button = (Button) event.widget; button.setSelection (true); int mode = Integer.parseInt((String)button.getData("iMode")); selected_button[0] = button; setModeText.run(); //linkLabel.setText( MessageText.getString(messTexts[mode]) ); linkLabel.setData( links[mode] ); /* if(mode == 1){ linkLabel1.setText( MessageText.getString(messTexts[3]) ); linkLabel1.setData( links[3] ); } else{ linkLabel1.setText( "" ); linkLabel1.setData( "" ); } */ COConfigurationManager.setParameter("User Mode", Integer.parseInt((String)button.getData("iMode"))); } };
@Override public void handleEvent (Event event) { Control [] children = gRadio.getChildren (); for (int j=0; j<children.length; j++) { Control child = children [j]; if (child instanceof Button) { Button button = (Button) child; if ((button.getStyle () & SWT.RADIO) != 0) button.setSelection (false); } } Button button = (Button) event.widget; button.setSelection (true); int mode = Integer.parseInt((String)button.getData("iMode")); text[0] = MessageText.getString("ConfigView.section.mode." + (String)button.getData("sMode")); labl.setText(text[0]); linkLabel.setText( MessageText.getString(messTexts[mode]) ); linkLabel.setData( links[mode] ); if(mode == 1){ linkLabel1.setText( MessageText.getString(messTexts[3]) ); linkLabel1.setData( links[3] ); } else{ linkLabel1.setText( "" ); linkLabel1.setData( "" ); } COConfigurationManager.setParameter("User Mode", Integer.parseInt((String)button.getData("iMode"))); } };
private void fillLimitToGroup(int searchFor, int limitTo) { Control[] children= fLimitToGroup.getChildren(); for (int i= 0; i < children.length; i++) { children[i].dispose();
private void fillLimitToGroup(int searchFor, int limitTo) { Control[] children= fLimitToGroup.getChildren(); for (int i= 0; i < children.length; i++) { children[i].dispose();
private Button createMethodLocationRadio(boolean isSelected) { if (fLimitToGroup.getChildren().length % 2 != 0) new Label(fLimitToGroup, SWT.NONE); Button button= createButton(fLimitToGroup, SWT.RADIO, SearchMessages.JavaSearchPage_match_locations_label, SPECIFIC_REFERENCES, isSelected); fMatchLocationsLink= new Link(fLimitToGroup, SWT.NONE); fMatchLocationsLink.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); fMatchLocationsLink.addSelectionListener(new SelectionAdapter() { @Override public void widgetDefaultSelected(SelectionEvent e) { performConfigureMatchLocation(); } @Override public void widgetSelected(SelectionEvent e) { performConfigureMatchLocation(); } }); fMatchLocationsLink.getAccessible().addAccessibleListener(new AccessibleAdapter() { /* * @see org.eclipse.swt.accessibility.AccessibleAdapter#getName(org.eclipse.swt.accessibility.AccessibleEvent) * @since 3.8 */ @Override public void getName(AccessibleEvent e) { if (e.childID == ACC.CHILDID_SELF) e.result= SearchMessages.JavaSearchPage_match_location_link_label_tooltip; } }); updateMatchLocationText(); return button; }
private Button createMethodLocationRadio(boolean isSelected) { if (fLimitToGroup.getChildren().length % 2 != 0) new Label(fLimitToGroup, SWT.NONE); Button button= createButton(fLimitToGroup, SWT.RADIO, SearchMessages.JavaSearchPage_match_locations_label, SPECIFIC_REFERENCES, isSelected); fMatchLocationsLink= new Link(fLimitToGroup, SWT.NONE); fMatchLocationsLink.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); fMatchLocationsLink.addSelectionListener(new SelectionAdapter() { @Override public void widgetDefaultSelected(SelectionEvent e) { performConfigureMatchLocation(); } @Override public void widgetSelected(SelectionEvent e) { performConfigureMatchLocation(); } }); fMatchLocationsLink.getAccessible().addAccessibleListener(new AccessibleAdapter() { /* * @see org.eclipse.swt.accessibility.AccessibleAdapter#getName(org.eclipse.swt.accessibility.AccessibleEvent) * @since 3.8 */ @Override public void getName(AccessibleEvent e) { if (e.childID == ACC.CHILDID_SELF) e.result= SearchMessages.JavaSearchPage_match_location_link_label_tooltip; } }); updateMatchLocationText(); return button; }
Control [] children = styleGroup.getChildren (); for (Control child : children) { if (child instanceof Button) {
Control[] otherChildren= group.getChildren(); if (fProject != null) { String label= PreferencesMessages.ComplianceConfigurationBlock_compliance_follows_EE_label; Control[] allChildren= group.getChildren(); fComplianceFollowsEEControls.addAll(Arrays.asList(allChildren)); fComplianceFollowsEEControls.removeAll(Arrays.asList(otherChildren)); addCheckBox(group, label, INTR_DEFAULT_COMPLIANCE, defaultUserValues, 0); allChildren= group.getChildren(); fComplianceControls.addAll(Arrays.asList(allChildren)); fComplianceControls.removeAll(Arrays.asList(otherChildren)); addComboBox(group, label, PREF_PB_ENUM_AS_IDENTIFIER, errorWarningInfoIgnore, errorWarningInfoIgnoreLabels, indent); allChildren= group.getChildren(); fComplianceChildControls.addAll(Arrays.asList(allChildren)); fComplianceChildControls.removeAll(Arrays.asList(otherChildren));
Control[] otherChildren= group.getChildren(); Control[] allChildren= group.getChildren(); fComplianceControls.addAll(Arrays.asList(allChildren)); fComplianceControls.removeAll(Arrays.asList(otherChildren));
private void toggleAttributesWidgets(boolean isValue) { if (!isValue) { // recreate the attribute list fValueTmp= fSnippetDocument.get(); createAttributeListWidgets(); } else if (isValue) { // dispose the attribute list saveAttributeValue(); Control[] children= fAttributesContainer.getChildren(); for (int i= 0; i < children.length; i++) { children[i].dispose(); } } // dispose and recreate the code snippet editor group Control[] children= fCodeGroup.getChildren(); for (int i = 0; i < children.length; i++) { children[i].dispose(); } fSnippetViewer.dispose(); createCodeGroupWidgets(isValue); setAttributesData(isValue); fParentComposite.layout(true, true); }