mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-24 17:35:35 +02:00
Bug 318658: Implement method: Add Select/Deselect All buttons
https://bugs.eclipse.org/bugs/show_bug.cgi?id=318658
This commit is contained in:
parent
d03905c62d
commit
e846e27bc9
3 changed files with 55 additions and 1 deletions
|
@ -16,7 +16,12 @@ import org.eclipse.jface.viewers.ICheckStateListener;
|
|||
import org.eclipse.jface.wizard.IWizardPage;
|
||||
import org.eclipse.ltk.ui.refactoring.UserInputWizardPage;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.layout.FillLayout;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Button;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.ui.dialogs.ContainerCheckedTreeViewer;
|
||||
|
||||
|
@ -55,18 +60,63 @@ public class ImplementMethodInputPage extends UserInputWizardPage{
|
|||
setMessage(Messages.ImplementMethodInputPage_Header);
|
||||
|
||||
Composite comp = new Composite(parent, SWT.NONE );
|
||||
comp.setLayout(new FillLayout());
|
||||
comp.setLayout(new GridLayout(2, false));
|
||||
createTree(comp);
|
||||
createFieldManagementButtonsComposite(comp);
|
||||
|
||||
setControl(comp);
|
||||
checkPage();
|
||||
}
|
||||
|
||||
private Composite createFieldManagementButtonsComposite(Composite comp) {
|
||||
Composite btComp = new Composite(comp, SWT.NONE);
|
||||
FillLayout layout = new FillLayout(SWT.VERTICAL);
|
||||
layout.spacing = 4;
|
||||
btComp.setLayout(layout);
|
||||
|
||||
GridData gd = new GridData();
|
||||
gd.verticalAlignment = SWT.TOP;
|
||||
btComp.setLayoutData(gd);
|
||||
|
||||
final Button selectAll = new Button(btComp, SWT.PUSH);
|
||||
selectAll.setText(Messages.ImplementMethodInputPage_SelectAll);
|
||||
selectAll.addSelectionListener(new SelectionAdapter(){
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
Object[] items = data.getElements(null);
|
||||
for (Object treeItem : items) {
|
||||
MethodToImplementConfig method = (MethodToImplementConfig)treeItem;
|
||||
method.setChecked(true);
|
||||
tree.setChecked(treeItem, true);
|
||||
}
|
||||
checkPage();
|
||||
}
|
||||
});
|
||||
|
||||
final Button deselectAll = new Button(btComp, SWT.PUSH);
|
||||
deselectAll.setText(Messages.ImplementMethodInputPage_DeselectAll);
|
||||
deselectAll.addSelectionListener(new SelectionAdapter(){
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
Object[] items = data.getElements(null);
|
||||
for (Object treeItem : items) {
|
||||
MethodToImplementConfig method = (MethodToImplementConfig)treeItem;
|
||||
method.setChecked(false);
|
||||
tree.setChecked(treeItem, false);
|
||||
}
|
||||
checkPage();
|
||||
}
|
||||
});
|
||||
|
||||
return btComp;
|
||||
}
|
||||
|
||||
private void createTree(Composite comp) {
|
||||
tree = new ContainerCheckedTreeViewer(comp);
|
||||
tree.setContentProvider(data);
|
||||
tree.setAutoExpandLevel(2);
|
||||
tree.setInput(""); //$NON-NLS-1$
|
||||
tree.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||
|
||||
tree.addCheckStateListener(new ICheckStateListener() {
|
||||
|
||||
|
|
|
@ -25,6 +25,8 @@ public final class Messages extends NLS {
|
|||
public static String ParameterNamesInputPage_CompleteMissingMails;
|
||||
public static String PreviewGenerationNotPossible;
|
||||
public static String ImplementMethodInputPage_PageTitle;
|
||||
public static String ImplementMethodInputPage_SelectAll;
|
||||
public static String ImplementMethodInputPage_DeselectAll;
|
||||
public static String ImplementMethodRefactoringPage_GeneratingPreview;
|
||||
public static String ImplementMethodRefactoring_NoMethodSelected;
|
||||
public static String ImplementMethodRefactoring_MethodHasImpl;
|
||||
|
|
|
@ -14,6 +14,8 @@ ParameterNamesInputPage_Title=Implement Method
|
|||
ImplementMethodInputPage_Header=Select Methods to implement:
|
||||
ParameterNamesInputPage_CompleteMissingMails=Please complete the missing variable names:
|
||||
ImplementMethodInputPage_PageTitle=Implement Method
|
||||
ImplementMethodInputPage_SelectAll=Select All
|
||||
ImplementMethodInputPage_DeselectAll=Deselect All
|
||||
ImplementMethodRefactoring_MethodDefinition=Method Definition
|
||||
ImplementMethodRefactoringPage_GeneratingPreview=Generating preview...
|
||||
ImplementMethodRefactoring_NoMethodSelected=No method declaration selected
|
||||
|
|
Loading…
Add table
Reference in a new issue