List of usage examples for org.eclipse.jface.viewers CheckboxTableViewer CheckboxTableViewer
public CheckboxTableViewer(Table table)
From source file:org.apache.directory.studio.schemaeditor.view.wizards.ExportSchemasAsXmlWizardPage.java
License:Apache License
/** * {@inheritDoc}// w ww .j a va2 s . c om */ public void createControl(Composite parent) { Composite composite = new Composite(parent, SWT.NULL); GridLayout layout = new GridLayout(); composite.setLayout(layout); // Schemas Group Group schemasGroup = new Group(composite, SWT.NONE); schemasGroup.setText(Messages.getString("ExportSchemasAsXmlWizardPage.Schemas")); //$NON-NLS-1$ schemasGroup.setLayout(new GridLayout(2, false)); schemasGroup.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false)); // Schemas TableViewer Label schemasLabel = new Label(schemasGroup, SWT.NONE); schemasLabel.setText(Messages.getString("ExportSchemasAsXmlWizardPage.SelectSchemasToExport")); //$NON-NLS-1$ schemasLabel.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false, 2, 1)); schemasTableViewer = new CheckboxTableViewer( new Table(schemasGroup, SWT.BORDER | SWT.CHECK | SWT.FULL_SELECTION)); GridData schemasTableViewerGridData = new GridData(SWT.FILL, SWT.NONE, true, false, 1, 2); schemasTableViewerGridData.heightHint = 125; schemasTableViewer.getTable().setLayoutData(schemasTableViewerGridData); schemasTableViewer.setContentProvider(new ArrayContentProvider()); schemasTableViewer.setLabelProvider(new LabelProvider() { public String getText(Object element) { if (element instanceof Schema) { return ((Schema) element).getSchemaName(); } // Default return super.getText(element); } public Image getImage(Object element) { if (element instanceof Schema) { return Activator.getDefault().getImage(PluginConstants.IMG_SCHEMA); } // Default return super.getImage(element); } }); schemasTableViewer.addCheckStateListener(new ICheckStateListener() { /** * Notifies of a change to the checked state of an element. * * @param event * event object describing the change */ public void checkStateChanged(CheckStateChangedEvent event) { dialogChanged(); } }); schemasTableSelectAllButton = new Button(schemasGroup, SWT.PUSH); schemasTableSelectAllButton.setText(Messages.getString("ExportSchemasAsXmlWizardPage.SelectAll")); //$NON-NLS-1$ schemasTableSelectAllButton.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, false, false)); schemasTableSelectAllButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { schemasTableViewer.setAllChecked(true); dialogChanged(); } }); schemasTableDeselectAllButton = new Button(schemasGroup, SWT.PUSH); schemasTableDeselectAllButton.setText(Messages.getString("ExportSchemasAsXmlWizardPage.DeselectAll")); //$NON-NLS-1$ schemasTableDeselectAllButton.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, false, false)); schemasTableDeselectAllButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { schemasTableViewer.setAllChecked(false); dialogChanged(); } }); // Export Destination Group Group exportDestinationGroup = new Group(composite, SWT.NULL); exportDestinationGroup.setText(Messages.getString("ExportSchemasAsXmlWizardPage.ExportDdestination")); //$NON-NLS-1$ exportDestinationGroup.setLayout(new GridLayout(4, false)); exportDestinationGroup.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false)); // Export Multiple Files exportMultipleFilesRadio = new Button(exportDestinationGroup, SWT.RADIO); exportMultipleFilesRadio .setText(Messages.getString("ExportSchemasAsXmlWizardPage.ExportEachSchemaAsSeparateFile")); //$NON-NLS-1$ exportMultipleFilesRadio.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false, 4, 1)); exportMultipleFilesRadio.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { exportMultipleFilesSelected(); dialogChanged(); } }); Label exportMultipleFilesFiller = new Label(exportDestinationGroup, SWT.NONE); exportMultipleFilesFiller.setText(" "); //$NON-NLS-1$ exportMultipleFilesLabel = new Label(exportDestinationGroup, SWT.NONE); exportMultipleFilesLabel.setText(Messages.getString("ExportSchemasAsXmlWizardPage.Directory")); //$NON-NLS-1$ exportMultipleFilesText = new Text(exportDestinationGroup, SWT.BORDER); exportMultipleFilesText.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false)); exportMultipleFilesText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { dialogChanged(); } }); exportMultipleFilesButton = new Button(exportDestinationGroup, SWT.PUSH); exportMultipleFilesButton.setText(Messages.getString("ExportSchemasAsXmlWizardPage.Browse")); //$NON-NLS-1$ exportMultipleFilesButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { chooseExportDirectory(); dialogChanged(); } }); // Export Single File exportSingleFileRadio = new Button(exportDestinationGroup, SWT.RADIO); exportSingleFileRadio.setText(Messages.getString("ExportSchemasAsXmlWizardPage.ExportSchemaAsSingleFile")); //$NON-NLS-1$ exportSingleFileRadio.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false, 4, 1)); exportSingleFileRadio.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { exportSingleFileSelected(); dialogChanged(); } }); Label exportSingleFileFiller = new Label(exportDestinationGroup, SWT.NONE); exportSingleFileFiller.setText(" "); //$NON-NLS-1$ exportSingleFileLabel = new Label(exportDestinationGroup, SWT.NONE); exportSingleFileLabel.setText(Messages.getString("ExportSchemasAsXmlWizardPage.ExportFile")); //$NON-NLS-1$ exportSingleFileText = new Text(exportDestinationGroup, SWT.BORDER); exportSingleFileText.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false)); exportSingleFileText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { dialogChanged(); } }); exportSingleFileButton = new Button(exportDestinationGroup, SWT.PUSH); exportSingleFileButton.setText(Messages.getString("ExportSchemasAsXmlWizardPage.Browse")); //$NON-NLS-1$ exportSingleFileButton.addSelectionListener(new SelectionAdapter() { /** * {@inheritDoc} */ public void widgetSelected(SelectionEvent e) { chooseExportFile(); dialogChanged(); } }); initFields(); dialogChanged(); setControl(composite); }
From source file:org.apache.directory.studio.schemaeditor.view.wizards.ExportSchemasForADSWizardPage.java
License:Apache License
/** * {@inheritDoc}//from w w w . j a v a 2 s . co m */ public void createControl(Composite parent) { Composite composite = new Composite(parent, SWT.NULL); GridLayout layout = new GridLayout(); composite.setLayout(layout); // Schemas Group Group schemasGroup = new Group(composite, SWT.NONE); schemasGroup.setText(Messages.getString("ExportSchemasForADSWizardPage.Schemas")); //$NON-NLS-1$ schemasGroup.setLayout(new GridLayout(2, false)); schemasGroup.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false)); // Schemas TableViewer Label schemasLabel = new Label(schemasGroup, SWT.NONE); schemasLabel.setText(Messages.getString("ExportSchemasForADSWizardPage.SelectSchemaToExport")); //$NON-NLS-1$ schemasLabel.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false, 2, 1)); schemasTableViewer = new CheckboxTableViewer( new Table(schemasGroup, SWT.BORDER | SWT.CHECK | SWT.FULL_SELECTION)); GridData schemasTableViewerGridData = new GridData(SWT.FILL, SWT.NONE, true, false, 1, 2); schemasTableViewerGridData.heightHint = 125; schemasTableViewer.getTable().setLayoutData(schemasTableViewerGridData); schemasTableViewer.setContentProvider(new ArrayContentProvider()); schemasTableViewer.setLabelProvider(new LabelProvider() { public String getText(Object element) { if (element instanceof Schema) { return ((Schema) element).getSchemaName(); } // Default return super.getText(element); } public Image getImage(Object element) { if (element instanceof Schema) { return Activator.getDefault().getImage(PluginConstants.IMG_SCHEMA); } // Default return super.getImage(element); } }); schemasTableViewer.addCheckStateListener(new ICheckStateListener() { /** * Notifies of a change to the checked state of an element. * * @param event * event object describing the change */ public void checkStateChanged(CheckStateChangedEvent event) { dialogChanged(); } }); schemasTableSelectAllButton = new Button(schemasGroup, SWT.PUSH); schemasTableSelectAllButton.setText(Messages.getString("ExportSchemasForADSWizardPage.SelectAll")); //$NON-NLS-1$ schemasTableSelectAllButton.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, false, false)); schemasTableSelectAllButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { schemasTableViewer.setAllChecked(true); dialogChanged(); } }); schemasTableDeselectAllButton = new Button(schemasGroup, SWT.PUSH); schemasTableDeselectAllButton.setText(Messages.getString("ExportSchemasForADSWizardPage.DeselectAll")); //$NON-NLS-1$ schemasTableDeselectAllButton.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, false, false)); schemasTableDeselectAllButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { schemasTableViewer.setAllChecked(false); dialogChanged(); } }); // Export Destination Group Group exportDestinationGroup = new Group(composite, SWT.NULL); exportDestinationGroup.setText(Messages.getString("ExportSchemasForADSWizardPage.ExportDestination")); //$NON-NLS-1$ exportDestinationGroup.setLayout(new GridLayout(4, false)); exportDestinationGroup.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false)); // Export Multiple Files exportMultipleFilesRadio = new Button(exportDestinationGroup, SWT.RADIO); exportMultipleFilesRadio .setText(Messages.getString("ExportSchemasForADSWizardPage.ExportSchemaAsSeparateFiles")); //$NON-NLS-1$ exportMultipleFilesRadio.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false, 4, 1)); exportMultipleFilesRadio.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { exportMultipleFilesSelected(); dialogChanged(); } }); Label exportMultipleFilesFiller = new Label(exportDestinationGroup, SWT.NONE); exportMultipleFilesFiller.setText(" "); //$NON-NLS-1$ exportMultipleFilesLabel = new Label(exportDestinationGroup, SWT.NONE); exportMultipleFilesLabel.setText(Messages.getString("ExportSchemasForADSWizardPage.Directory")); //$NON-NLS-1$ exportMultipleFilesText = new Text(exportDestinationGroup, SWT.BORDER); exportMultipleFilesText.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false)); exportMultipleFilesText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { dialogChanged(); } }); exportMultipleFilesButton = new Button(exportDestinationGroup, SWT.PUSH); exportMultipleFilesButton.setText(Messages.getString("ExportSchemasForADSWizardPage.Browse")); //$NON-NLS-1$ exportMultipleFilesButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { chooseExportDirectory(); dialogChanged(); } }); // Export Single File exportSingleFileRadio = new Button(exportDestinationGroup, SWT.RADIO); exportSingleFileRadio.setText(Messages.getString("ExportSchemasForADSWizardPage.ExportSchemaAsSingleFile")); //$NON-NLS-1$ exportSingleFileRadio.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false, 4, 1)); exportSingleFileRadio.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { exportSingleFileSelected(); dialogChanged(); } }); Label exportSingleFileFiller = new Label(exportDestinationGroup, SWT.NONE); exportSingleFileFiller.setText(" "); //$NON-NLS-1$ exportSingleFileLabel = new Label(exportDestinationGroup, SWT.NONE); exportSingleFileLabel.setText(Messages.getString("ExportSchemasForADSWizardPage.ExportFile")); //$NON-NLS-1$ exportSingleFileText = new Text(exportDestinationGroup, SWT.BORDER); exportSingleFileText.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false)); exportSingleFileText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { dialogChanged(); } }); exportSingleFileButton = new Button(exportDestinationGroup, SWT.PUSH); exportSingleFileButton.setText(Messages.getString("ExportSchemasForADSWizardPage.Browse")); //$NON-NLS-1$ exportSingleFileButton.addSelectionListener(new SelectionAdapter() { /** * {@inheritDoc} */ public void widgetSelected(SelectionEvent e) { chooseExportFile(); dialogChanged(); } }); initFields(); dialogChanged(); setControl(composite); }
From source file:org.apache.directory.studio.schemaeditor.view.wizards.ImportProjectsWizardPage.java
License:Apache License
/** * {@inheritDoc}/* ww w.j a v a2 s . co m*/ */ public void createControl(Composite parent) { Composite composite = new Composite(parent, SWT.NULL); GridLayout layout = new GridLayout(); composite.setLayout(layout); // From Directory Group Group fromDirectoryGroup = new Group(composite, SWT.NONE); fromDirectoryGroup.setText(Messages.getString("ImportProjectsWizardPage.FromDirectory")); //$NON-NLS-1$ fromDirectoryGroup.setLayout(new GridLayout(3, false)); fromDirectoryGroup.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false)); // From Directory Label fromDirectoryLabel = new Label(fromDirectoryGroup, SWT.NONE); fromDirectoryLabel.setText(Messages.getString("ImportProjectsWizardPage.FromDirectoryColon")); //$NON-NLS-1$ fromDirectoryText = new Text(fromDirectoryGroup, SWT.BORDER); fromDirectoryText.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false)); fromDirectoryText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { dialogChanged(); } }); fromDirectoryButton = new Button(fromDirectoryGroup, SWT.PUSH); fromDirectoryButton.setText(Messages.getString("ImportProjectsWizardPage.Browse")); //$NON-NLS-1$ fromDirectoryButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { chooseFromDirectory(); } }); // Schema Files Group Group schemaFilesGroup = new Group(composite, SWT.NONE); schemaFilesGroup.setText(Messages.getString("ImportProjectsWizardPage.SchemaProjectFiles")); //$NON-NLS-1$ schemaFilesGroup.setLayout(new GridLayout(2, false)); schemaFilesGroup.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false)); // Schema Files projectFilesTableViewer = new CheckboxTableViewer( new Table(schemaFilesGroup, SWT.BORDER | SWT.CHECK | SWT.FULL_SELECTION)); GridData schemasTableViewerGridData = new GridData(SWT.FILL, SWT.NONE, true, false, 1, 2); schemasTableViewerGridData.heightHint = 125; projectFilesTableViewer.getTable().setLayoutData(schemasTableViewerGridData); projectFilesTableViewer.setContentProvider(new ArrayContentProvider()); projectFilesTableViewer.setLabelProvider(new LabelProvider() { public String getText(Object element) { if (element instanceof File) { return ((File) element).getName(); } // Default return super.getText(element); } public Image getImage(Object element) { if (element instanceof File) { return Activator.getDefault().getImage(PluginConstants.IMG_PROJECT_FILE); } // Default return super.getImage(element); } }); projectFilesTableViewer.addCheckStateListener(new ICheckStateListener() { /** * Notifies of a change to the checked state of an element. * * @param event * event object describing the change */ public void checkStateChanged(CheckStateChangedEvent event) { dialogChanged(); } }); projectFilesTableSelectAllButton = new Button(schemaFilesGroup, SWT.PUSH); projectFilesTableSelectAllButton.setText(Messages.getString("ImportProjectsWizardPage.SelectAll")); //$NON-NLS-1$ projectFilesTableSelectAllButton.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, false, false)); projectFilesTableSelectAllButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { projectFilesTableViewer.setAllChecked(true); dialogChanged(); } }); projectFilesTableDeselectAllButton = new Button(schemaFilesGroup, SWT.PUSH); projectFilesTableDeselectAllButton.setText(Messages.getString("ImportProjectsWizardPage.DeselectAll")); //$NON-NLS-1$ projectFilesTableDeselectAllButton.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, false, false)); projectFilesTableDeselectAllButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { projectFilesTableViewer.setAllChecked(false); dialogChanged(); } }); initFields(); setControl(composite); }
From source file:org.apache.directory.studio.schemaeditor.view.wizards.ImportSchemasFromOpenLdapWizardPage.java
License:Apache License
/** * {@inheritDoc}/*w ww.j a va 2 s .c om*/ */ public void createControl(Composite parent) { Composite composite = new Composite(parent, SWT.NULL); GridLayout layout = new GridLayout(); composite.setLayout(layout); // From Directory Group Group fromDirectoryGroup = new Group(composite, SWT.NONE); fromDirectoryGroup.setText(Messages.getString("ImportSchemasFromOpenLdapWizardPage.FromDirectory")); //$NON-NLS-1$ fromDirectoryGroup.setLayout(new GridLayout(3, false)); fromDirectoryGroup.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false)); // From Directory Label fromDirectoryLabel = new Label(fromDirectoryGroup, SWT.NONE); fromDirectoryLabel.setText(Messages.getString("ImportSchemasFromOpenLdapWizardPage.FromDirectoryColon")); //$NON-NLS-1$ fromDirectoryText = new Text(fromDirectoryGroup, SWT.BORDER); fromDirectoryText.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false)); fromDirectoryText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { dialogChanged(); } }); fromDirectoryButton = new Button(fromDirectoryGroup, SWT.PUSH); fromDirectoryButton.setText(Messages.getString("ImportSchemasFromOpenLdapWizardPage.Browse")); //$NON-NLS-1$ fromDirectoryButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { chooseFromDirectory(); } }); // Schema Files Group Group schemaFilesGroup = new Group(composite, SWT.NONE); schemaFilesGroup.setText(Messages.getString("ImportSchemasFromOpenLdapWizardPage.SchemaFiles")); //$NON-NLS-1$ schemaFilesGroup.setLayout(new GridLayout(2, false)); schemaFilesGroup.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false)); // Schema Files schemaFilesTableViewer = new CheckboxTableViewer( new Table(schemaFilesGroup, SWT.BORDER | SWT.CHECK | SWT.FULL_SELECTION)); GridData schemasTableViewerGridData = new GridData(SWT.FILL, SWT.NONE, true, false, 1, 2); schemasTableViewerGridData.heightHint = 125; schemaFilesTableViewer.getTable().setLayoutData(schemasTableViewerGridData); schemaFilesTableViewer.setContentProvider(new ArrayContentProvider()); schemaFilesTableViewer.setLabelProvider(new LabelProvider() { public String getText(Object element) { if (element instanceof File) { return ((File) element).getName(); } // Default return super.getText(element); } public Image getImage(Object element) { if (element instanceof File) { return Activator.getDefault().getImage(PluginConstants.IMG_SCHEMA); } // Default return super.getImage(element); } }); schemaFilesTableViewer.addCheckStateListener(new ICheckStateListener() { /** * Notifies of a change to the checked state of an element. * * @param event * event object describing the change */ public void checkStateChanged(CheckStateChangedEvent event) { dialogChanged(); } }); schemaFilesTableSelectAllButton = new Button(schemaFilesGroup, SWT.PUSH); schemaFilesTableSelectAllButton .setText(Messages.getString("ImportSchemasFromOpenLdapWizardPage.SelectAll")); //$NON-NLS-1$ schemaFilesTableSelectAllButton.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, false, false)); schemaFilesTableSelectAllButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { schemaFilesTableViewer.setAllChecked(true); dialogChanged(); } }); schemaFilesTableDeselectAllButton = new Button(schemaFilesGroup, SWT.PUSH); schemaFilesTableDeselectAllButton .setText(Messages.getString("ImportSchemasFromOpenLdapWizardPage.DeselectAll")); //$NON-NLS-1$ schemaFilesTableDeselectAllButton.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, false, false)); schemaFilesTableDeselectAllButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { schemaFilesTableViewer.setAllChecked(false); dialogChanged(); } }); initFields(); dialogChanged(); setControl(composite); }
From source file:org.apache.directory.studio.schemaeditor.view.wizards.ImportSchemasFromXmlWizardPage.java
License:Apache License
/** * {@inheritDoc}/*from w ww . ja v a2 s . com*/ */ public void createControl(Composite parent) { Composite composite = new Composite(parent, SWT.NULL); GridLayout layout = new GridLayout(); composite.setLayout(layout); // From Directory Group Group fromDirectoryGroup = new Group(composite, SWT.NONE); fromDirectoryGroup.setText(Messages.getString("ImportSchemasFromXmlWizardPage.FromDirectory")); //$NON-NLS-1$ fromDirectoryGroup.setLayout(new GridLayout(3, false)); fromDirectoryGroup.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false)); // From Directory Label fromDirectoryLabel = new Label(fromDirectoryGroup, SWT.NONE); fromDirectoryLabel.setText(Messages.getString("ImportSchemasFromXmlWizardPage.FromDirectoryColon")); //$NON-NLS-1$ fromDirectoryText = new Text(fromDirectoryGroup, SWT.BORDER); fromDirectoryText.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false)); fromDirectoryText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { dialogChanged(); } }); fromDirectoryButton = new Button(fromDirectoryGroup, SWT.PUSH); fromDirectoryButton.setText(Messages.getString("ImportSchemasFromXmlWizardPage.Browse")); //$NON-NLS-1$ fromDirectoryButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { chooseFromDirectory(); } }); // Schema Files Group Group schemaFilesGroup = new Group(composite, SWT.NONE); schemaFilesGroup.setText(Messages.getString("ImportSchemasFromXmlWizardPage.SchemaFiles")); //$NON-NLS-1$ schemaFilesGroup.setLayout(new GridLayout(2, false)); schemaFilesGroup.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false)); // Schema Files schemaFilesTableViewer = new CheckboxTableViewer( new Table(schemaFilesGroup, SWT.BORDER | SWT.CHECK | SWT.FULL_SELECTION)); GridData schemasTableViewerGridData = new GridData(SWT.FILL, SWT.NONE, true, false, 1, 2); schemasTableViewerGridData.heightHint = 125; schemaFilesTableViewer.getTable().setLayoutData(schemasTableViewerGridData); schemaFilesTableViewer.setContentProvider(new ArrayContentProvider()); schemaFilesTableViewer.setLabelProvider(new LabelProvider() { public String getText(Object element) { if (element instanceof File) { return ((File) element).getName(); } // Default return super.getText(element); } public Image getImage(Object element) { if (element instanceof File) { return Activator.getDefault().getImage(PluginConstants.IMG_SCHEMA); } // Default return super.getImage(element); } }); schemaFilesTableViewer.addCheckStateListener(new ICheckStateListener() { /** * Notifies of a change to the checked state of an element. * * @param event * event object describing the change */ public void checkStateChanged(CheckStateChangedEvent event) { dialogChanged(); } }); schemaFilesTableSelectAllButton = new Button(schemaFilesGroup, SWT.PUSH); schemaFilesTableSelectAllButton.setText(Messages.getString("ImportSchemasFromXmlWizardPage.SelectAll")); //$NON-NLS-1$ schemaFilesTableSelectAllButton.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, false, false)); schemaFilesTableSelectAllButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { schemaFilesTableViewer.setAllChecked(true); dialogChanged(); } }); schemaFilesTableDeselectAllButton = new Button(schemaFilesGroup, SWT.PUSH); schemaFilesTableDeselectAllButton.setText(Messages.getString("ImportSchemasFromXmlWizardPage.DeselectAll")); //$NON-NLS-1$ schemaFilesTableDeselectAllButton.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, false, false)); schemaFilesTableDeselectAllButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { schemaFilesTableViewer.setAllChecked(false); dialogChanged(); } }); initFields(); dialogChanged(); setControl(composite); }
From source file:org.apache.directory.studio.templateeditor.view.wizards.ExportTemplatesWizardPage.java
License:Apache License
/** * {@inheritDoc}/*from w ww .j av a 2s .c om*/ */ public void createControl(Composite parent) { Composite composite = BaseWidgetUtils.createColumnContainer(parent, 1, 1); // Templates Group Group templatesGroup = new Group(composite, SWT.NONE); templatesGroup.setText(Messages.getString("ExportTemplatesWizardPage.Templates")); //$NON-NLS-1$ templatesGroup.setLayout(new GridLayout(2, false)); templatesGroup.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false)); // Templates TableViewer Label templatesLabel = new Label(templatesGroup, SWT.NONE); templatesLabel.setText(Messages.getString("ExportTemplatesWizardPage.SelectTheTemplatesToExport")); //$NON-NLS-1$ templatesLabel.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false, 2, 1)); templatesTableViewer = new CheckboxTableViewer( new Table(templatesGroup, SWT.BORDER | SWT.CHECK | SWT.FULL_SELECTION)); GridData templatesTableViewerGridData = new GridData(SWT.FILL, SWT.NONE, true, false, 1, 2); templatesTableViewerGridData.heightHint = 125; templatesTableViewer.getTable().setLayoutData(templatesTableViewerGridData); templatesTableViewer.setContentProvider(new ArrayContentProvider()); templatesTableViewer.setLabelProvider(new LabelProvider() { public String getText(Object element) { return ((Template) element).getTitle(); } public Image getImage(Object element) { return EntryTemplatePlugin.getDefault().getImage(EntryTemplatePluginConstants.IMG_TEMPLATE); } }); templatesTableViewer.addCheckStateListener(new ICheckStateListener() { /** * Notifies of a change to the checked state of an element. * * @param event * event object describing the change */ public void checkStateChanged(CheckStateChangedEvent event) { dialogChanged(); } }); templatesTableSelectAllButton = new Button(templatesGroup, SWT.PUSH); templatesTableSelectAllButton.setText(Messages.getString("ExportTemplatesWizardPage.SelectAll")); //$NON-NLS-1$ templatesTableSelectAllButton.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, false, false)); templatesTableSelectAllButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { templatesTableViewer.setAllChecked(true); dialogChanged(); } }); templatesTableDeselectAllButton = new Button(templatesGroup, SWT.PUSH); templatesTableDeselectAllButton.setText(Messages.getString("ExportTemplatesWizardPage.DeselectAll")); //$NON-NLS-1$ templatesTableDeselectAllButton.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, false, false)); templatesTableDeselectAllButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { templatesTableViewer.setAllChecked(false); dialogChanged(); } }); // Export Destination Group Group exportDestinationGroup = new Group(composite, SWT.NULL); exportDestinationGroup.setText(Messages.getString("ExportTemplatesWizardPage.ExportDestination")); //$NON-NLS-1$ exportDestinationGroup.setLayout(new GridLayout(3, false)); exportDestinationGroup.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false)); exportDirectoryLabel = new Label(exportDestinationGroup, SWT.NONE); exportDirectoryLabel.setText(Messages.getString("ExportTemplatesWizardPage.Directory")); //$NON-NLS-1$ exportDirectoryText = new Text(exportDestinationGroup, SWT.BORDER); exportDirectoryText.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false)); exportDirectoryText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { dialogChanged(); } }); exportDirectoryButton = new Button(exportDestinationGroup, SWT.PUSH); exportDirectoryButton.setText(Messages.getString("ExportTemplatesWizardPage.Browse")); //$NON-NLS-1$ exportDirectoryButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { chooseExportDirectory(); dialogChanged(); } }); initFields(); setControl(composite); }
From source file:org.apache.directory.studio.templateeditor.view.wizards.ImportTemplatesWizardPage.java
License:Apache License
/** * {@inheritDoc}//from w ww . j a v a 2 s.c o m */ public void createControl(Composite parent) { Composite composite = BaseWidgetUtils.createColumnContainer(parent, 1, 1); // From Directory Group Group fromDirectoryGroup = new Group(composite, SWT.NONE); fromDirectoryGroup.setText(Messages.getString("ImportTemplatesWizardPage.FromDirectory")); //$NON-NLS-1$ fromDirectoryGroup.setLayout(new GridLayout(3, false)); fromDirectoryGroup.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false)); // From Directory Label fromDirectoryLabel = new Label(fromDirectoryGroup, SWT.NONE); fromDirectoryLabel.setText(Messages.getString("ImportTemplatesWizardPage.FromDirectoryColon")); //$NON-NLS-1$ fromDirectoryText = new Text(fromDirectoryGroup, SWT.BORDER); fromDirectoryText.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false)); fromDirectoryText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { dialogChanged(); } }); fromDirectoryButton = new Button(fromDirectoryGroup, SWT.PUSH); fromDirectoryButton.setText(Messages.getString("ImportTemplatesWizardPage.Browse")); //$NON-NLS-1$ fromDirectoryButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { chooseFromDirectory(); } }); // Template files Group Group templatesFilesGroup = new Group(composite, SWT.NONE); templatesFilesGroup.setText(Messages.getString("ImportTemplatesWizardPage.TemplateFiles")); //$NON-NLS-1$ templatesFilesGroup.setLayout(new GridLayout(2, false)); templatesFilesGroup.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false)); // Template Files Viewer templateFilesTableViewer = new CheckboxTableViewer( new Table(templatesFilesGroup, SWT.BORDER | SWT.CHECK | SWT.FULL_SELECTION)); GridData templateFilesTableViewerGridData = new GridData(SWT.FILL, SWT.NONE, true, false, 1, 2); templateFilesTableViewerGridData.heightHint = 125; templateFilesTableViewer.getTable().setLayoutData(templateFilesTableViewerGridData); templateFilesTableViewer.setContentProvider(new ArrayContentProvider()); templateFilesTableViewer.setLabelProvider(new LabelProvider() { public String getText(Object element) { if (element instanceof File) { return ((File) element).getName(); } // Default return super.getText(element); } public Image getImage(Object element) { if (element instanceof File) { return EntryTemplatePlugin.getDefault().getImage(EntryTemplatePluginConstants.IMG_TEMPLATE); } // Default return super.getImage(element); } }); templateFilesTableViewer.addCheckStateListener(new ICheckStateListener() { public void checkStateChanged(CheckStateChangedEvent event) { dialogChanged(); } }); templateFilesTableSelectAllButton = new Button(templatesFilesGroup, SWT.PUSH); templateFilesTableSelectAllButton.setText(Messages.getString("ImportTemplatesWizardPage.SelectAll")); //$NON-NLS-1$ templateFilesTableSelectAllButton.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, false, false)); templateFilesTableSelectAllButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { templateFilesTableViewer.setAllChecked(true); dialogChanged(); } }); templateFilesTableDeselectAllButton = new Button(templatesFilesGroup, SWT.PUSH); templateFilesTableDeselectAllButton.setText(Messages.getString("ImportTemplatesWizardPage.DeselectAll")); //$NON-NLS-1$ templateFilesTableDeselectAllButton.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, false, false)); templateFilesTableDeselectAllButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { templateFilesTableViewer.setAllChecked(false); dialogChanged(); } }); initFields(); setControl(composite); }
From source file:org.apache.felix.sigil.eclipse.ui.internal.preferences.installs.OSGiInstallsPreferencePage.java
License:Apache License
private void buildComponents(Composite control) { new Label(control, SWT.NONE).setText("Installs:"); new Label(control, SWT.NONE); // padding Table table = new Table(control, SWT.CHECK | SWT.SINGLE | SWT.BORDER); Button add = new Button(control, SWT.PUSH); add.setText("Add"); add.addSelectionListener(new SelectionAdapter() { @Override/*from w w w .j a v a 2s . co m*/ public void widgetSelected(SelectionEvent e) { add(); } }); final Button remove = new Button(control, SWT.PUSH); remove.setEnabled(false); remove.setText("Remove"); remove.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { remove(); } }); // viewers viewer = new CheckboxTableViewer(table); viewer.setContentProvider(new DefaultTableProvider() { public Object[] getElements(Object inputElement) { return toArray(inputElement); } }); viewer.setLabelProvider(new LabelProvider() { @Override public String getText(Object element) { Install i = (Install) element; IOSGiInstallType type = i.getType(); if (type == null) { return "<invalid> [" + i.location + "]"; } else { return type.getName() + " " + type.getVersion() + " [" + i.location + "]"; } } @Override public Image getImage(Object element) { Install i = (Install) element; IOSGiInstallType type = i.getType(); if (type == null) { return null; } else { return type.getIcon(); } } }); viewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { boolean enabled = !event.getSelection().isEmpty(); remove.setEnabled(enabled); } }); viewer.addCheckStateListener(new ICheckStateListener() { public void checkStateChanged(CheckStateChangedEvent event) { if (event.getChecked()) { changed = true; } viewer.setCheckedElements(new Object[] { event.getElement() }); } }); viewer.setInput(installs.values()); // layout control.setLayout(new GridLayout(2, false)); table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 3)); add.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); remove.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); }
From source file:org.apache.sling.ide.eclipse.ui.wizards.ConvertProjectsPage.java
License:Apache License
public void createControl(Composite parent) { Composite container = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 2;//ww w . j a v a 2 s. c om layout.marginHeight = 0; layout.marginWidth = 5; container.setLayout(layout); Table table = new Table(container, SWT.MULTI | SWT.CHECK | SWT.BORDER); GridData gd = new GridData(GridData.FILL_BOTH); table.setLayoutData(gd); ctv = new CheckboxTableViewer(table); ctv.setLabelProvider(new ProjectLabelProvider()); ctv.add(projects.toArray()); ctv.setCheckedElements(initialSelection); setControl(container); Dialog.applyDialogFont(container); }
From source file:org.archicontribs.modelrepository.dialogs.ConflictsDialog.java
License:Open Source License
private void createTableControl(Composite parent) { Composite tableComp = new Composite(parent, SWT.BORDER); TableColumnLayout tableLayout = new TableColumnLayout(); tableComp.setLayout(tableLayout);/*from ww w .ja va2 s. c om*/ tableComp.setLayoutData(new GridData(GridData.FILL_BOTH)); Table table = new Table(tableComp, SWT.MULTI | SWT.FULL_SELECTION | SWT.CHECK); table.setHeaderVisible(true); fTableViewer = new CheckboxTableViewer(table); fTableViewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); fTableViewer.getTable().setLinesVisible(true); fTableViewer.setComparator(new ViewerComparator()); // Columns TableViewerColumn column1 = new TableViewerColumn(fTableViewer, SWT.NONE, 0); column1.getColumn().setText(Messages.ConflictsDialog_5); tableLayout.setColumnData(column1.getColumn(), new ColumnWeightData(100, true)); // Content Provider fTableViewer.setContentProvider(new IStructuredContentProvider() { public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { } public void dispose() { } public Object[] getElements(Object inputElement) { MergeResult result = fHandler.getMergeResult(); return result.getConflicts().keySet().toArray(); } }); fTableViewer.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { String path = (String) ((StructuredSelection) event.getSelection()).getFirstElement(); try { fFileViewerOurs.setText( GraficoUtils.getFileContents(fHandler.getLocalGitFolder(), path, Constants.HEAD)); fFileViewerTheirs.setText( GraficoUtils.getFileContents(fHandler.getLocalGitFolder(), path, "origin/master")); //$NON-NLS-1$ fFileViewerDiff .setText(GraficoUtils.getWorkingTreeFileContents(fHandler.getLocalGitFolder(), path)); } catch (IOException ex) { ex.printStackTrace(); } } }); // Label Provider fTableViewer.setLabelProvider(new LabelProvider()); // Start the table fTableViewer.setInput(""); // anything will do //$NON-NLS-1$ }