Skip to content

Commit

Permalink
componente CheboxTableViewer
Browse files Browse the repository at this point in the history
  • Loading branch information
jribacruz committed Jun 16, 2012
1 parent e95e91f commit 93dc8f5
Showing 1 changed file with 28 additions and 6 deletions.
@@ -1,12 +1,19 @@
package smart.generator.plugin.core.ui.wizards;

import java.util.Set;

import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jface.dialogs.IDialogPage;
import org.eclipse.jface.viewers.CheckboxTableViewer;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;

import smart.generator.plugin.core.ui.providers.CompilationUnitContentProvider;
import smart.generator.plugin.core.ui.providers.CompilationUnitLabelProvider;

/**
* The "New" wizard page allows setting the container for the new file as well
* as the file name. The page will only accept file name without the extension
Expand All @@ -17,15 +24,19 @@ public class CompilationUnitWizardPage extends WizardPage {

private ISelection selection;

private CheckboxTableViewer tableViewer;

private Set<ICompilationUnit> units;

/**
* Constructor for SampleNewWizardPage.
*
* @param pageName
*/
public CompilationUnitWizardPage(ISelection selection) {
super("wizardPage");
setTitle("Multi-page Editor File");
setDescription("This wizard creates a new file with *.mpe extension that can be opened by a multi-page editor.");
super("compilationUnitWizardPage");
setTitle("Metamodelos");
setDescription("Selecione os metamodelos que serão usados para a geração");
this.selection = selection;
}

Expand All @@ -37,15 +48,26 @@ public void createControl(Composite parent) {
Composite container = new Composite(parent, SWT.NULL);
FillLayout layout = new FillLayout();
container.setLayout(layout);

tableViewer = CheckboxTableViewer.newCheckList(container, SWT.BORDER);
tableViewer.setLabelProvider(new CompilationUnitLabelProvider());
tableViewer.setContentProvider(new CompilationUnitContentProvider());

initialize();
setControl(container);
}

/**
* Tests if the current workbench selection is a suitable container to use.
*/
@Override
public boolean isPageComplete() {
return tableViewer.getCheckedElements().length > 0;
}

private void initialize() {
tableViewer.setInput(units);
}

public void setUnits(Set<ICompilationUnit> units) {
this.units = units;
}

}

0 comments on commit 93dc8f5

Please sign in to comment.