Java Code Examples for org.eclipse.swt.SWT#FULL_SELECTION

The following examples show how to use org.eclipse.swt.SWT#FULL_SELECTION . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BlockTableViewer.java    From offspring with MIT License 6 votes vote down vote up
public BlockTableViewer(Composite parent, INxtService nxt) {
  super(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION
      | SWT.BORDER | SWT.VIRTUAL);

  contentProvider = new BlockLazyContentProvider(this);

  // TODO implement hash function on NXT model objects
  setUseHashlookup(true);
  setContentProvider(contentProvider);
  setInput(nxt);
  setItemCount(nxt.getBlockCount());

  createColumns();

  getTable().setHeaderVisible(true);
  getTable().setLinesVisible(true);
  refresh();
}
 
Example 2
Source File: CListTable.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
private void createTable(Composite parent)
{
	tableViewer = new TableViewer(parent, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION);
	tableViewer.getControl().setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());

	tableViewer.setContentProvider(ArrayContentProvider.getInstance());
	tableViewer.setLabelProvider(new LabelProvider());
	tableViewer.setComparator(new ViewerComparator());
	tableViewer.setInput(items);
	tableViewer.addSelectionChangedListener(new ISelectionChangedListener()
	{

		public void selectionChanged(SelectionChangedEvent event)
		{
			updateStates();
		}

	});
	updateStates();
}
 
Example 3
Source File: RelationByExistingColumnsDialog.java    From ermaster-b with Apache License 2.0 6 votes vote down vote up
private void createComparisonTable(Composite composite) {
	GridData tableGridData = new GridData();
	tableGridData.horizontalSpan = 2;
	tableGridData.heightHint = 100;
	tableGridData.horizontalAlignment = GridData.FILL;
	tableGridData.grabExcessHorizontalSpace = true;

	this.comparisonTable = new Table(composite, SWT.SINGLE | SWT.BORDER
			| SWT.FULL_SELECTION);
	this.comparisonTable.setLayoutData(tableGridData);
	this.comparisonTable.setHeaderVisible(true);
	this.comparisonTable.setLinesVisible(true);

	TableColumn referencedColumn = new TableColumn(this.comparisonTable,
			SWT.NONE);
	referencedColumn.setWidth(COLUMN_WIDTH);
	referencedColumn.setText(ResourceString
			.getResourceString("label.reference.column"));

	TableColumn foreignKeyColumn = new TableColumn(this.comparisonTable,
			SWT.NONE);
	foreignKeyColumn.setWidth(COLUMN_WIDTH);
	foreignKeyColumn.setText(ResourceString
			.getResourceString("label.foreign.key"));
}
 
Example 4
Source File: MainEntryPoint.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
private Composite createMenu ( final Composite parent )
{
    final Composite menu = new Composite ( parent, SWT.NONE );

    menu.setLayout ( new FillLayout () );

    this.viewer = new TreeViewer ( menu, SWT.FULL_SELECTION );

    this.treeContentProvider = new ObservableListTreeContentProvider ( new FactoryImpl (), null );
    this.viewer.setContentProvider ( this.treeContentProvider );

    this.viewer.setLabelProvider ( new TreeNodeLabelProvider ( this.viewer,
            BeansObservables.observeMap ( this.treeContentProvider.getRealizedElements (), TreeNode.PROP_NAME ),
            BeansObservables.observeMap ( this.treeContentProvider.getRealizedElements (), TreeNode.PROP_PROVIDER_SET )
            ) );

    this.viewer.setInput ( this.manager.getRootNode () );

    this.viewer.addSelectionChangedListener ( new ISelectionChangedListener () {

        @Override
        public void selectionChanged ( final SelectionChangedEvent event )
        {
            handleSelectionChanged ( event );
        }
    } );

    this.viewer.setAutoExpandLevel ( 2 );

    return menu;
}
 
Example 5
Source File: CreateTextFileChangePreviewViewer.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
public void createControl(Composite parent) {
	fPane= new CreateTextFilePreviewer(parent, SWT.BORDER | SWT.FLAT);
	Dialog.applyDialogFont(fPane);

	fSourceViewer= new SourceViewer(fPane, null, SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI | SWT.FULL_SELECTION);
	fSourceViewer.setEditable(false);
	fSourceViewer.getControl().setFont(JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT));
	fPane.setContent(fSourceViewer.getControl());
}
 
Example 6
Source File: AlwStartPage.java    From XPagesExtensionLibrary with Apache License 2.0 5 votes vote down vote up
@Override
public void createControl(final Composite parent) {
    // Setup the initial data
    populateConfigurationList();

    Composite container = new Composite(parent, SWT.NONE);
    GridLayout layout = WizardUtils.createGridLayout(1, 5);
    container.setLayout(layout);

    // Create the radio group
    Group group = WizardUtils.createGroup(container, 1, 3);
    (_allRadio = WizardUtils.createRadio(group, "&All", 1, this)).setSelection(true); // $NLX-AlwStartPage.All-1$
    _responsiveRadio = WizardUtils.createRadio(group, "&Responsive", 1, this); // $NLX-AlwStartPage.Responsive-1$
    _nonResponsiveRadio = WizardUtils.createRadio(group, "N&on-Responsive", 1, this); // $NLX-AlwStartPage.NonResponsive-1$
    
    // Create the table
    _table = new Table(container, SWT.FULL_SELECTION | SWT.BORDER | SWT.V_SCROLL | SWT.NO_SCROLL);
    _table.setHeaderVisible(false);
    _table.setLinesVisible(false);
    GridData gd = new GridData(SWT.DEFAULT);
    gd.horizontalSpan = 1;
    gd.verticalAlignment = GridData.FILL;
    gd.grabExcessVerticalSpace = true;
    gd.horizontalAlignment = GridData.FILL;
    gd.grabExcessHorizontalSpace = true;
    
    // Set the preferred height (3 rows)
    gd.heightHint = (_defImage.getBounds().height + (MARGIN * 2)) * DEFAULT_ROWS; 
    _table.setLayoutData(gd);

    // Add one column
    new TableColumn(_table, SWT.NONE);
    
    // Add the rows
    refreshTable(ConfigurationType.ALL);

    setControl(container);
    setPageComplete(false);
}
 
Example 7
Source File: ChangePathsTableProvider.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
public ChangePathsTableProvider(Composite parent, IContentProvider contentProvider) {
  super(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.FULL_SELECTION);
  
  TableLayout layout = new TableLayout();
  GridData data = new GridData(GridData.FILL_BOTH);
  
  Table table = (Table) getControl();
  table.setHeaderVisible(true);
  table.setLinesVisible(true);
  table.setLayoutData(data);    
  table.setLayout(layout);
  table.addDisposeListener(new DisposeListener() {
    public void widgetDisposed(DisposeEvent e) {
      if(currentPathFont != null) {
        currentPathFont.dispose();
      }
    }
  });
  
  createColumns(table, layout);
  
  setLabelProvider(new ChangePathLabelProvider());
  setContentProvider(contentProvider);
  
  ChangePathsSorter sorter = new ChangePathsSorter(COL_PATH);
  setSorter(sorter);
  table.setSortDirection(SWT.UP);
}
 
Example 8
Source File: SmartImportBdmPage.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private Composite createMergeViewer(Composite parent) {
    Composite composite = new Composite(parent, SWT.None);
    composite.setLayout(GridLayoutFactory.fillDefaults().spacing(LayoutConstants.getSpacing().x, 1).create());
    composite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());

    viewer = new TreeViewer(composite,
            SWT.VIRTUAL | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION | SWT.BORDER);
    viewer.getTree().setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    viewer.setUseHashlookup(true);
    ColumnViewerToolTipSupport.enableFor(viewer);
    viewer.getTree().setHeaderVisible(true);
    viewer.getTree().setLinesVisible(true);
    viewer.setContentProvider(new SmartImportBdmTreeContentProvider());

    TableLayout layout = new TableLayout();
    layout.addColumnData(new ColumnWeightData(6, true));
    layout.addColumnData(new ColumnWeightData(2, true));
    viewer.getTree().setLayout(layout);

    createModelColumn();
    createActionColumn();

    IViewerObservableValue singleSelectionObservable = ViewerProperties.singleSelection().observe(viewer);
    viewer.addDoubleClickListener(e -> viewer.setExpandedState(singleSelectionObservable.getValue(),
            !viewer.getExpandedState(singleSelectionObservable.getValue())));
    return composite;
}
 
Example 9
Source File: ValidationPreferencePage.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
private Control createValidators(Composite parent)
{
	Composite main = new Composite(parent, SWT.NONE);
	main.setLayout(GridLayoutFactory.fillDefaults().spacing(0, 0).create());

	Composite labelComp = new Composite(main, SWT.NONE);
	labelComp.setLayout(GridLayoutFactory.fillDefaults().extendedMargins(5, 0, 0, 0).numColumns(2)
			.spacing(2, SWT.DEFAULT).create());
	labelComp.setLayoutData(GridDataFactory.swtDefaults().grab(true, false).create());
	Label label = new Label(labelComp, SWT.NONE);
	label.setText(Messages.ValidationPreferencePage_LBL_Validators);
	Label helpImage = new Label(labelComp, SWT.NONE);
	helpImage.setImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_LCL_LINKTO_HELP));
	helpImage.setToolTipText(Messages.ValidationPreferencePage_EnablingValidatorWarning);

	Group group = new Group(main, SWT.NONE);
	group.setLayout(GridLayoutFactory.swtDefaults().margins(4, 4).create());
	group.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());

	Table table = new Table(group, SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
	table.setLayoutData(GridDataFactory.fillDefaults().hint(300, 100).grab(true, false).create());
	table.setLinesVisible(true);
	table.setHeaderVisible(true);

	// set up columns
	// Name column
	TableColumn name = new TableColumn(table, SWT.LEFT);
	name.setWidth(250);
	name.setText(Messages.ValidationPreferencePage_NameColumn);
	name.setToolTipText(Messages.ValidationPreferencePage_NameColumn);

	// Build column
	TableColumn build = new TableColumn(table, SWT.CENTER);
	build.setWidth(40);
	build.setText(Messages.ValidationPreferencePage_BuildColumn);
	build.setToolTipText(Messages.ValidationPreferencePage_BuildColumn);

	// Reconcile column
	TableColumn reconcile = new TableColumn(table, SWT.CENTER);
	reconcile.setWidth(75);
	reconcile.setText(Messages.ValidationPreferencePage_ReconcileColumn);
	reconcile.setToolTipText(Messages.ValidationPreferencePage_ReconcileColumn);

	// Now set up table viewer!
	validatorsViewer = new TableViewer(table);
	// validatorsViewer.setUseHashlookup(true);
	validatorsViewer.setColumnProperties(new String[] { NAME, BUILD, RECONCILE });

	// Assign the cell editors to the viewer
	validatorsViewer.setCellEditors(new CellEditor[] { null, new CheckboxCellEditor(table),
			new CheckboxCellEditor(table) });

	// Set the cell modifier for the viewer
	validatorsViewer.setCellModifier(new ParticipantCellModifier(validatorsViewer));

	// Now set up content/label providers
	validatorsViewer.setContentProvider(ArrayContentProvider.getInstance());
	validatorsViewer.setLabelProvider(new ParticipantLabelProvider());
	// Hide required participants
	validatorsViewer.addFilter(new RequiredParticipantFilter());
	// check the selected build participant, show it's filters
	validatorsViewer.addSelectionChangedListener(new ISelectionChangedListener()
	{
		public void selectionChanged(SelectionChangedEvent event)
		{
			updateFilterExpressions();
		}
	});

	// Now set input
	validatorsViewer.setInput(this.participants);

	return main;
}
 
Example 10
Source File: DocumentExpressionEditor.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Control createExpressionEditor(final Composite parent, final EMFDataBindingContext ctx) {
    mainComposite = new Composite(parent, SWT.NONE);
    mainComposite.setLayoutData(GridDataFactory.fillDefaults()
            .grab(true, true).create());
    gridLayout = new GridLayout(1, false);
    mainComposite.setLayout(gridLayout);

    viewer = new TableViewer(mainComposite, SWT.FULL_SELECTION | SWT.BORDER
            | SWT.SINGLE | SWT.V_SCROLL);

    final TableLayout layout = new TableLayout();
    layout.addColumnData(new ColumnWeightData(100, false));
    viewer.getTable().setLayout(layout);
    viewer.getTable().setLayoutData(
            GridDataFactory.fillDefaults().grab(true, true).create());

    final TableViewerColumn columnViewer = new TableViewerColumn(viewer, SWT.NONE);
    final TableColumn column = columnViewer.getColumn();
    column.setText(org.bonitasoft.studio.document.i18n.Messages.name);

    final TableColumnSorter sorter = new TableColumnSorter(viewer);
    sorter.setColumn(column);

    viewer.getTable().setHeaderVisible(true);
    viewer.setContentProvider(new ArrayContentProvider());
    viewer.setLabelProvider(new AdapterFactoryLabelProvider(
            new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE)) {

        @Override
        public String getColumnText(final Object object, final int columnIndex) {
            if (object instanceof Document) {
                return ((Document) object).getName();
            }
            return super.getColumnText(object, columnIndex);
        }
    });

    viewer.addPostSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(final SelectionChangedEvent event) {
            if (!event.getSelection().isEmpty()) {
                DocumentExpressionEditor.this.fireSelectionChanged();
            }
        }
    });

    createReturnTypeComposite(parent);

    return mainComposite;
}
 
Example 11
Source File: ResolvablePropertiesDialog.java    From eclipse-cs with GNU Lesser General Public License v2.1 4 votes vote down vote up
/**
 * Creates the dialogs main contents.
 *
 * @param parent
 *          the parent composite
 */
@Override
protected Control createDialogArea(Composite parent) {

  // set the logo
  this.setTitleImage(CheckstyleUIPluginImages.getImage(CheckstyleUIPluginImages.PLUGIN_LOGO));
  this.setTitle(Messages.ResolvablePropertiesDialog_titleMessageArea);
  this.setMessage(Messages.ResolvablePropertiesDialog_msgAdditionalProperties);

  Composite composite = (Composite) super.createDialogArea(parent);

  Composite contents = new Composite(composite, SWT.NULL);
  contents.setLayout(new GridLayout(2, false));
  GridData fd = new GridData(GridData.FILL_BOTH);
  contents.setLayoutData(fd);

  Table table = new Table(contents, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
  table.setLayoutData(new GridData(GridData.FILL_BOTH));

  table.setHeaderVisible(true);
  table.setLinesVisible(true);

  TableLayout tableLayout = new TableLayout();
  table.setLayout(tableLayout);

  TableColumn column1 = new TableColumn(table, SWT.NULL);
  column1.setText(Messages.ResolvablePropertiesDialog_colName);
  tableLayout.addColumnData(new ColumnWeightData(50));

  TableColumn column2 = new TableColumn(table, SWT.NULL);
  column2.setText(Messages.ResolvablePropertiesDialog_colValue);
  tableLayout.addColumnData(new ColumnWeightData(50));

  mTableViewer = new EnhancedTableViewer(table);
  PropertiesLabelProvider multiProvider = new PropertiesLabelProvider();
  mTableViewer.setLabelProvider(multiProvider);
  mTableViewer.setTableComparableProvider(multiProvider);
  mTableViewer.setTableSettingsProvider(multiProvider);
  mTableViewer.installEnhancements();

  mTableViewer.setContentProvider(new ArrayContentProvider());
  mTableViewer.addDoubleClickListener(mController);
  mTableViewer.getTable().addKeyListener(mController);

  Composite buttonBar = new Composite(contents, SWT.NULL);
  GridLayout layout = new GridLayout(1, false);
  layout.marginHeight = 0;
  layout.marginWidth = 0;
  buttonBar.setLayout(layout);
  GridData gd = new GridData();
  gd.verticalAlignment = GridData.BEGINNING;
  buttonBar.setLayoutData(gd);

  mBtnAdd = new Button(buttonBar, SWT.PUSH);
  mBtnAdd.setText(Messages.ResolvablePropertiesDialog_btnAdd);
  mBtnAdd.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  mBtnAdd.addSelectionListener(mController);

  mBtnEdit = new Button(buttonBar, SWT.PUSH);
  mBtnEdit.setText(Messages.ResolvablePropertiesDialog_btnEdit);
  mBtnEdit.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  mBtnEdit.addSelectionListener(mController);

  mBtnRemove = new Button(buttonBar, SWT.PUSH);
  mBtnRemove.setText(Messages.ResolvablePropertiesDialog_btnRemove);
  mBtnRemove.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  mBtnRemove.addSelectionListener(mController);

  return composite;
}
 
Example 12
Source File: JmsProducerDialog.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
private void buildPropertiesTable( Composite parentWidget ) {
  ColumnInfo[] columns = getPropertiesColumns();

  int fieldCount = meta.getPropertyValuesByName().size();

  propertiesTable = new TableView(
    transMeta,
    parentWidget,
    SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI,
    columns,
    fieldCount,
    false,
    lsMod,
    props,
    false
  );

  propertiesTable.setSortable( false );
  propertiesTable.getTable().addListener( SWT.Resize, event -> {
    Table table = (Table) event.widget;
    table.getColumn( 1 ).setWidth( 215 );
    table.getColumn( 2 ).setWidth( 215 );
  } );

  populateProperties();

  FormData fdData = new FormData();
  fdData.left = new FormAttachment( 0, 0 );
  fdData.top = new FormAttachment( 0, 0 );
  fdData.right = new FormAttachment( 100, 0 );
  fdData.bottom = new FormAttachment( 100, 0 );

  // resize the columns to fit the data in them
  Arrays.stream( propertiesTable.getTable().getColumns() ).forEach( column -> {
    if ( column.getWidth() > 0 ) {
      // don't pack anything with a 0 width, it will resize it to make it visible (like the index column)
      column.setWidth( 120 );
    }
  } );

  propertiesTable.setLayoutData( fdData );
}
 
Example 13
Source File: ProjectSettingLanguagePage.java    From tmxeditor8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 创建组件
 * @param comp
 *            ;
 */
public void createControl(Composite comp) {
	Composite canSelectComp = new Composite(comp, SWT.NONE);
	canSelectComp.setLayout(new GridLayout(1, false));
	canSelectComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

	canSelectTableViewer = new TableViewer(canSelectComp, SWT.BORDER | SWT.V_SCROLL | SWT.MULTI
			| SWT.FULL_SELECTION);
	GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
	gridData.widthHint = 150;
	gridData.heightHint = 180;
	canSelectTableViewer.getTable().setLayoutData(gridData);

	canSelectTableViewer.setLabelProvider(new LanguageLabelProvider());
	canSelectTableViewer.setContentProvider(new ArrayContentProvider());
	canSelectTableViewer.setInput(canSelectInput);
	canSelectTableViewer.getTable().addListener(SWT.MouseDoubleClick, this);

	Composite selBtnComp = new Composite(comp, SWT.NONE);
	selBtnComp.setLayout(new GridLayout(1, false));
	selBtnComp.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, false, 1, 1));

	addBtn = new Button(selBtnComp, SWT.NONE);
	addBtn.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
	addBtn.setText(Messages.getString("projectsetting.ProjectSettingLanguagePage.addBtn"));
	addBtn.addListener(SWT.Selection, this);

	deleteBtn = new Button(selBtnComp, SWT.NONE);
	deleteBtn.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
	deleteBtn.setText(Messages.getString("projectsetting.ProjectSettingLanguagePage.deleteBtn"));
	deleteBtn.addListener(SWT.Selection, this);

	deleteAllBtn = new Button(selBtnComp, SWT.NONE);
	deleteAllBtn.setText(Messages.getString("projectsetting.ProjectSettingLanguagePage.deleteAllBtn"));
	deleteAllBtn.addListener(SWT.Selection, this);

	Composite hasSelComp = new Composite(comp, SWT.NONE);
	hasSelComp.setLayout(new GridLayout(1, false));
	hasSelComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));

	hasSelTableViewer = new TableViewer(hasSelComp, SWT.BORDER | SWT.V_SCROLL | SWT.MULTI | SWT.FULL_SELECTION);
	hasSelTableViewer.getTable().setLayoutData(gridData);
	hasSelTableViewer.setLabelProvider(new LanguageLabelProvider());
	hasSelTableViewer.setContentProvider(new ArrayContentProvider());
	hasSelTableViewer.setInput(hasSelectedList);
	hasSelTableViewer.getTable().addListener(SWT.MouseDoubleClick, this);
}
 
Example 14
Source File: ReverseConversionWizardPage.java    From translationstudio8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 创建文件列表区域
 * @param contents
 *            ;
 */
private Composite createFilesGroup(Composite contents) {
	Composite filesComposite = new Composite(contents, SWT.NONE);
	filesComposite.setLayout(new GridLayout(1, false));
	filesComposite.setLayoutData(new GridData(GridData.FILL_BOTH));

	filesTable = new Table(filesComposite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI
			| SWT.FULL_SELECTION);

	GridData tableData = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.FILL_BOTH);
	tableData.heightHint = 100;
	filesTable.setLayoutData(tableData);
	filesTable.setLinesVisible(true);
	filesTable.setHeaderVisible(true);

	filesTable.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			TableItem[] selected = filesTable.getSelection();
			if (selected.length == 0) {
				return;
			}

			String strTgtEnc = ""; //$NON-NLS-1$

			for (int i = 0; i < selected.length; i++) {
				String curTgtEnc = selected[i].getText(1);
				if (i == 0) {
					strTgtEnc = curTgtEnc;
				} else {
					if (!strTgtEnc.equals(curTgtEnc)) {
						strTgtEnc = ""; //$NON-NLS-1$
						break;
					}
				}
			}

			if (!"".equals(strTgtEnc)) { //$NON-NLS-1$
				tgtEncCombo.setText(strTgtEnc);
			} else {
				tgtEncCombo.deselectAll();
			}
		}
	});
	tableViewer = new TableViewer(filesTable);

	xliffColumn = new TableViewerColumn(tableViewer, SWT.NONE).getColumn();
	xliffColumn.setText("XLIFF 文件"); //$NON-NLS-1$

	tgtEncColumn = new TableViewerColumn(tableViewer, SWT.NONE).getColumn();
	tgtEncColumn.setText("目标编码"); //$NON-NLS-1$

	targetColumn = new TableViewerColumn(tableViewer, SWT.NONE).getColumn();
	targetColumn.setText("目标文件"); //$NON-NLS-1$

	IValueProperty[] valueProperties = BeanProperties.values(ConversionConfigBean.class, new String[] {
			"source", "targetEncoding", "target" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
	ViewerSupport.bind(tableViewer, new WritableList(conversionConfigBeans, ConversionConfigBean.class),
			valueProperties);

	filesComposite.addPaintListener(new PaintListener() {
		public void paintControl(PaintEvent arg0) {
			int width = filesTable.getClientArea().width;
			targetColumn.setWidth(width * 4 / 10);
			tgtEncColumn.setWidth(width * 2 / 10);
			xliffColumn.setWidth(width * 4 / 10);
		}
	});
	return filesComposite;
}
 
Example 15
Source File: JavaStatusContextViewer.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
@Override
protected SourceViewer createSourceViewer(Composite parent) {
	IPreferenceStore store= JavaPlugin.getDefault().getCombinedPreferenceStore();
	return new JavaSourceViewer(parent, null, null, false, SWT.LEFT_TO_RIGHT | SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI | SWT.FULL_SELECTION, store);
}
 
Example 16
Source File: MarkerStatsView.java    From eclipse-cs with GNU Lesser General Public License v2.1 4 votes vote down vote up
/**
 * Creates the table viewer for the master view.
 *
 * @param parent
 *          the parent composite
 * @return the master table viewer
 */
private EnhancedTableViewer createMasterView(Composite parent) {
  EnhancedTableViewer masterViewer = new EnhancedTableViewer(parent,
          SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE | SWT.FULL_SELECTION);
  GridData gridData = new GridData(GridData.FILL_BOTH);
  masterViewer.getControl().setLayoutData(gridData);

  // setup the table columns
  Table table = masterViewer.getTable();
  table.setLinesVisible(true);
  table.setHeaderVisible(true);

  TableColumn severityCol = new TableColumn(table, SWT.CENTER, 0);
  severityCol.setWidth(20);
  severityCol.setResizable(false);

  TableColumn idCol = new TableColumn(table, SWT.LEFT, 1);
  idCol.setText(Messages.MarkerStatsView_kindOfErrorColumn);
  idCol.setWidth(400);

  TableColumn countCol = new TableColumn(table, SWT.CENTER, 2);
  countCol.setText(Messages.MarkerStatsView_numberOfErrorsColumn);
  countCol.pack();

  // set the providers
  masterViewer.setContentProvider(new MasterContentProvider());
  MasterViewMultiProvider multiProvider = new MasterViewMultiProvider();
  masterViewer.setLabelProvider(multiProvider);
  masterViewer.setTableComparableProvider(multiProvider);
  masterViewer.setTableSettingsProvider(multiProvider);
  masterViewer.installEnhancements();

  // add selection listener to maintain action state
  masterViewer.addSelectionChangedListener(new ISelectionChangedListener() {
    @Override
    public void selectionChanged(SelectionChangedEvent event) {
      updateActions();
    }
  });

  // hooks the action to double click
  hookDoubleClickAction(mDrillDownAction, masterViewer);

  // and to the context menu too
  ArrayList<Object> actionList = new ArrayList<>(3);
  actionList.add(mDrillDownAction);
  actionList.add(new Separator());
  actionList.add(mChartAction);
  hookContextMenu(actionList, masterViewer);

  return masterViewer;
}
 
Example 17
Source File: ReportPropertySheetPage.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public void createControl( Composite parent )
{
	container = new Composite( parent, SWT.NONE );
	GridLayout layout = new GridLayout( );
	layout.marginWidth = layout.marginHeight = 0;
	container.setLayout( layout );
	title = new TabbedPropertyTitle( container,
			FormWidgetFactory.getInstance( ) );
	title.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );

	title.setActions( new Action[]{
			new GroupSortingAction( ),
			new AlphabeticSortingAction( ),
			new LocalModelAction( )
	} );

	Composite viewerContainer = new Composite( container, SWT.NONE );
	layout = new GridLayout( );
	layout.marginWidth = 10;
	layout.marginHeight = 3;
	viewerContainer.setLayout( layout );
	viewerContainer.setLayoutData( new GridData( GridData.FILL_BOTH ) );

	viewer = new CustomTreeViewer( viewerContainer, SWT.FULL_SELECTION );
	tableTree = viewer.getTree( );
	tableTree.setLayoutData( new GridData( GridData.FILL_BOTH ) );
	tableTree.setHeaderVisible( true );
	tableTree.setLinesVisible( true );

	viewer.setContentProvider( provider );

	TreeViewerColumn tvc1 = new TreeViewerColumn( viewer, SWT.NONE );
	tvc1.getColumn( ).setText( COLUMN_TITLE_PROPERTY );
	tvc1.getColumn( ).setWidth( 300 );
	tvc1.setLabelProvider( new DelegatingStyledCellLabelProvider( new ReportPropertySheetNameLabelProvider( ) ) );

	TreeViewerColumn tvc2 = new TreeViewerColumn( viewer, SWT.NONE );
	tvc2.getColumn( ).setText( COLUMN_TITLE_VALUE );
	tvc2.getColumn( ).setWidth( 400 );
	tvc2.setLabelProvider( new DelegatingStyledCellLabelProvider( new ReportPropertySheetValueLabelProvider( ) ) );

	AlphabeticallyViewSorter sorter = new AlphabeticallyViewSorter( );
	sorter.setAscending( true );
	viewer.setSorter( sorter );

	hookControl( );

	// create a new table tree editor
	tableTreeEditor = new TreeEditor( tableTree );

	// create the editor listener
	createEditorListener( );

	handleGlobalAction( );

	// suport the mediator
	SessionHandleAdapter.getInstance( )
			.getMediator( moduleHandle )
			.addColleague( this );

	FormWidgetFactory.getInstance( ).paintFormStyle( parent );
	FormWidgetFactory.getInstance( ).adapt( parent );

	IWorkbenchPage page = getSite( ).getPage( );

	MementoBuilder builder = new MementoBuilder( );
	if ( ( propertySheetMemento = builder.getRootMemento( )
			.getChild( IPageLayout.ID_PROP_SHEET ) ) == null )
	{
		propertySheetMemento = builder.getRootMemento( )
				.createChild( IPageLayout.ID_PROP_SHEET,
						MementoElement.Type_View );
	}

	if ( ( viewerMemento = propertySheetMemento.getChild( propertyViewerID ) ) == null )
	{
		viewerMemento = propertySheetMemento.createChild( propertyViewerID,
				MementoElement.Type_Viewer );
	}

	page.addSelectionListener( this );
	// handleSelectionChanged( page.getSelection( ) );
}
 
Example 18
Source File: UserDefinedJavaClassDialog.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
private void addTargetTab() {
  targetTab = new CTabItem( wTabFolder, SWT.NONE );
  targetTab.setText( BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.Tabs.Target.Title" ) );
  targetTab.setToolTipText( BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.Tabs.Target.TooltipText" ) );

  Composite wBottom = new Composite( wTabFolder, SWT.NONE );
  props.setLook( wBottom );
  targetTab.setControl( wBottom );
  FormLayout bottomLayout = new FormLayout();
  bottomLayout.marginWidth = Const.FORM_MARGIN;
  bottomLayout.marginHeight = Const.FORM_MARGIN;
  wBottom.setLayout( bottomLayout );

  Label wlFields = new Label( wBottom, SWT.NONE );
  wlFields.setText( BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.TargetSteps.Label" ) );
  props.setLook( wlFields );
  FormData fdlFields = new FormData();
  fdlFields.left = new FormAttachment( 0, 0 );
  fdlFields.top = new FormAttachment( 0, 0 );
  wlFields.setLayoutData( fdlFields );

  final int nrRows = input.getTargetStepDefinitions().size();
  ColumnInfo[] colinf =
    new ColumnInfo[] {
      new ColumnInfo(
        BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.ColumnInfo.StepTag" ),
        ColumnInfo.COLUMN_TYPE_TEXT, false ),
      new ColumnInfo(
        BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.ColumnInfo.StepName" ),
        ColumnInfo.COLUMN_TYPE_CCOMBO, nextStepNames ),
      new ColumnInfo(
        BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.ColumnInfo.StepDescription" ),
        ColumnInfo.COLUMN_TYPE_TEXT, false ), };

  wTargetSteps =
    new TableView(
      transMeta, wBottom, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinf, nrRows, lsMod, props );

  FormData fdFields = new FormData();
  fdFields.left = new FormAttachment( 0, 0 );
  fdFields.top = new FormAttachment( wlFields, margin );
  fdFields.right = new FormAttachment( 100, 0 );
  fdFields.bottom = new FormAttachment( 100, 0 );
  wTargetSteps.setLayoutData( fdFields );

  FormData fdBottom = new FormData();
  fdBottom.left = new FormAttachment( 0, 0 );
  fdBottom.top = new FormAttachment( 0, 0 );
  fdBottom.right = new FormAttachment( 100, 0 );
  fdBottom.bottom = new FormAttachment( 100, 0 );
  wBottom.setLayoutData( fdBottom );
}
 
Example 19
Source File: ModelPropertiesDialog.java    From erflute with Apache License 2.0 4 votes vote down vote up
/**
 * This method initializes composite1
 */
private void createTableComposite(Composite parent) {
    final GridLayout gridLayout = new GridLayout();
    gridLayout.numColumns = 3;

    final GridData gridData = new GridData();
    gridData.heightHint = 320;

    final GridData tableGridData = new GridData();
    tableGridData.horizontalSpan = 3;
    tableGridData.heightHint = 185;

    final Composite composite = new Composite(parent, SWT.BORDER);
    composite.setLayout(gridLayout);
    composite.setLayoutData(gridData);

    table = new Table(composite, SWT.BORDER | SWT.FULL_SELECTION);
    table.setHeaderVisible(true);
    table.setLayoutData(tableGridData);
    table.setLinesVisible(true);

    final TableColumn tableColumn0 = new TableColumn(table, SWT.NONE);
    tableColumn0.setWidth(200);
    tableColumn0.setText(DisplayMessages.getMessage("label.property.name"));
    final TableColumn tableColumn1 = new TableColumn(table, SWT.NONE);
    tableColumn1.setWidth(200);
    tableColumn1.setText(DisplayMessages.getMessage("label.property.value"));

    tableEditor = new TableEditor(table);
    tableEditor.grabHorizontal = true;

    table.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseDown(MouseEvent event) {
            final int index = table.getSelectionIndex();
            if (index == -1) {
                return;
            }

            final TableItem item = table.getItem(index);
            final Point selectedPoint = new Point(event.x, event.y);

            targetColumn = -1;

            for (int i = 0; i < table.getColumnCount(); i++) {
                final Rectangle rect = item.getBounds(i);
                if (rect.contains(selectedPoint)) {
                    targetColumn = i;
                    break;
                }
            }

            if (targetColumn == -1) {
                return;
            }

            edit(item, tableEditor);
        }
    });
}
 
Example 20
Source File: ProjectSettingLanguagePage.java    From translationstudio8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 创建组件
 * @param comp
 *            ;
 */
public void createControl(Composite comp) {
	Composite canSelectComp = new Composite(comp, SWT.NONE);
	canSelectComp.setLayout(new GridLayout(1, false));
	canSelectComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

	canSelectTableViewer = new TableViewer(canSelectComp, SWT.BORDER | SWT.V_SCROLL | SWT.MULTI
			| SWT.FULL_SELECTION);
	GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
	gridData.widthHint = 150;
	gridData.heightHint = 180;
	canSelectTableViewer.getTable().setLayoutData(gridData);

	canSelectTableViewer.setLabelProvider(new LanguageLabelProvider());
	canSelectTableViewer.setContentProvider(new ArrayContentProvider());
	canSelectTableViewer.setInput(canSelectInput);
	canSelectTableViewer.getTable().addListener(SWT.MouseDoubleClick, this);

	Composite selBtnComp = new Composite(comp, SWT.NONE);
	selBtnComp.setLayout(new GridLayout(1, false));
	selBtnComp.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, false, 1, 1));

	addBtn = new Button(selBtnComp, SWT.NONE);
	addBtn.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
	addBtn.setText(Messages.getString("projectsetting.ProjectSettingLanguagePage.addBtn"));
	addBtn.addListener(SWT.Selection, this);

	deleteBtn = new Button(selBtnComp, SWT.NONE);
	deleteBtn.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
	deleteBtn.setText(Messages.getString("projectsetting.ProjectSettingLanguagePage.deleteBtn"));
	deleteBtn.addListener(SWT.Selection, this);

	deleteAllBtn = new Button(selBtnComp, SWT.NONE);
	deleteAllBtn.setText(Messages.getString("projectsetting.ProjectSettingLanguagePage.deleteAllBtn"));
	deleteAllBtn.addListener(SWT.Selection, this);

	Composite hasSelComp = new Composite(comp, SWT.NONE);
	hasSelComp.setLayout(new GridLayout(1, false));
	hasSelComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));

	hasSelTableViewer = new TableViewer(hasSelComp, SWT.BORDER | SWT.V_SCROLL | SWT.MULTI | SWT.FULL_SELECTION);
	hasSelTableViewer.getTable().setLayoutData(gridData);
	hasSelTableViewer.setLabelProvider(new LanguageLabelProvider());
	hasSelTableViewer.setContentProvider(new ArrayContentProvider());
	hasSelTableViewer.setInput(hasSelectedList);
	hasSelTableViewer.getTable().addListener(SWT.MouseDoubleClick, this);
}