public int compare(Viewer viewer, Object object1, Object object2) { String first= ""; //$NON-NLS-1$ String second= ""; //$NON-NLS-1$ if (object1 instanceof IBinding[]) first= fProvider.getText(((IBinding[]) object1)[1]); else if (object1 instanceof IVariableBinding) first= ((IBinding) object1).getName(); if (object2 instanceof IBinding[]) second= fProvider.getText(((IBinding[]) object2)[1]); else if (object2 instanceof IVariableBinding) second= ((IBinding) object2).getName(); return fCollator.compare(first, second); } }
Composite addSuperClassConstructorChoices(Composite composite) { Label label= new Label(composite, SWT.NONE); label.setText(ActionMessages.GenerateConstructorUsingFieldsSelectionDialog_sort_constructor_choices_label); GridData gd= new GridData(GridData.FILL_HORIZONTAL); label.setLayoutData(gd); BindingLabelProvider provider= new BindingLabelProvider(); final Combo combo= new Combo(composite, SWT.READ_ONLY); for (int i= 0; i < fSuperConstructors.length; i++) { combo.add(provider.getText(fSuperConstructors[i])); } // TODO: Can we be a little more intelligent about guessing the super() ? combo.setText(combo.getItem(0)); combo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); combo.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { fSuperIndex= combo.getSelectionIndex(); // Disable omit super checkbox unless default constructor fOmitSuperButton.setEnabled(getSuperConstructorChoice().getParameterTypes().length == 0); updateOKStatus(); } }); return composite; }
Composite addSuperClassConstructorChoices(Composite composite) { Label label= new Label(composite, SWT.NONE); label.setText(ActionMessages.GenerateConstructorUsingFieldsSelectionDialog_sort_constructor_choices_label); GridData gd= new GridData(GridData.FILL_HORIZONTAL); label.setLayoutData(gd); BindingLabelProvider provider= new BindingLabelProvider(); final Combo combo= new Combo(composite, SWT.READ_ONLY); SWTUtil.setDefaultVisibleItemCount(combo); for (int i= 0; i < fSuperConstructors.length; i++) { combo.add(provider.getText(fSuperConstructors[i])); } // TODO: Can we be a little more intelligent about guessing the super() ? combo.setText(combo.getItem(0)); combo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); combo.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { fSuperIndex= combo.getSelectionIndex(); // Disable omit super checkbox unless default constructor fOmitSuperButton.setEnabled(getSuperConstructorChoice().getParameterTypes().length == 0); updateOKStatus(); } }); return composite; }
Composite addSuperClassConstructorChoices(Composite composite) { Label label= new Label(composite, SWT.NONE); label.setText(ActionMessages.GenerateConstructorUsingFieldsSelectionDialog_sort_constructor_choices_label); GridData gd= new GridData(GridData.FILL_HORIZONTAL); label.setLayoutData(gd); BindingLabelProvider provider= new BindingLabelProvider(); final Combo combo= new Combo(composite, SWT.READ_ONLY); SWTUtil.setDefaultVisibleItemCount(combo); for (int i= 0; i < fSuperConstructors.length; i++) { combo.add(provider.getText(fSuperConstructors[i])); } // TODO: Can we be a little more intelligent about guessing the super() ? combo.setText(combo.getItem(0)); combo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); combo.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { fSuperIndex= combo.getSelectionIndex(); // Disable omit super checkbox unless default constructor fOmitSuperButton.setEnabled(getSuperConstructorChoice().getParameterTypes().length == 0); updateOKStatus(); } }); return composite; }