org.eclipse.jface.viewers.ArrayContentProvider Java Examples

The following examples show how to use org.eclipse.jface.viewers.ArrayContentProvider. 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: PageSizeComboRenderer.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
@Override
protected void createUI(Composite parent) {
	GridLayout layout = new GridLayout(2, false);
	layout.marginWidth = 0;
	layout.marginHeight = 0;
	this.setLayout(layout);

	itemsPerPageLabel = new Label(parent, SWT.NONE);
	itemsPerPageLabel.setText(Resources.getText(
			Resources.PaginationRenderer_itemsPerPage, getLocale()));
	itemsPerPageLabel.setLayoutData(new GridData());

	comboViewer = new ComboViewer(parent, SWT.READ_ONLY);
	comboViewer.setContentProvider(ArrayContentProvider.getInstance());
	comboViewer.setLabelProvider(InternalLabelProvider.getInstance());
	comboViewer.getCombo().setLayoutData(
			new GridData(GridData.FILL_HORIZONTAL));
	comboViewer.getCombo().addSelectionListener(this);

}
 
Example #2
Source File: DynamicWorkingSetPage.java    From eclipse-extras with Eclipse Public License 1.0 6 votes vote down vote up
private void createControls( Composite parent ) {
  composite = new Composite( parent, SWT.NONE );
  Label nameLabel = new Label( composite, SWT.NONE );
  nameLabel.setText( "&Name" );
  nameText = new Text( composite, SWT.BORDER );
  Label patternLabel = new Label( composite, SWT.NONE );
  patternLabel.setText( "&Pattern" );
  patternText = new Text( composite, SWT.BORDER );
  installPatternContentAssist();
  previewLabel = new Label( composite, SWT.NONE );
  previewLabel.setText( "Preview" );
  previewViewer = new TableViewer( composite, SWT.SINGLE | SWT.FULL_SELECTION | SWT.BORDER );
  previewViewer.getControl().setBackground( getWidgetBackgroundColor() );
  previewViewer.getControl().addListener( SWT.FocusOut, new PreviewFocusOutListener() );
  previewLabelProvider = new PreviewLabelProvider( getShell().getDisplay() );
  previewViewer.setLabelProvider( previewLabelProvider );
  previewViewer.setContentProvider( ArrayContentProvider.getInstance() );
  previewViewer.setInput( projectsProvider.getProjects() );
  previewViewer.setComparator( new PreviewComparator( "" ) );
}
 
Example #3
Source File: BuildpathJarSelectionDialog.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent) {
  Composite grid = new Composite(parent, SWT.NONE);
  GridData gridData = new GridData(GridData.FILL_BOTH);
  grid.setLayoutData(gridData);
  GridLayout gridLayout = new GridLayout(1, false);
  gridLayout.marginHeight = 8;
  gridLayout.marginWidth = 8;
  grid.setLayout(gridLayout);

  Label descriptionLabel = new Label(grid, SWT.NONE);
  descriptionLabel.setText("Select JAR file(s) from the build path:");

  jarsViewer = new TableViewer(grid);
  GridData jarsListGridData = new GridData(GridData.FILL_BOTH);
  jarsViewer.getTable().setLayoutData(jarsListGridData);
  jarsViewer.setContentProvider(new ArrayContentProvider());
  jarsViewer.setLabelProvider(new JarsLabelProvider());
  jarsViewer.setSorter(jarsSorter);

  return grid;
}
 
Example #4
Source File: StatechartPropertySection.java    From statecharts with Eclipse Public License 1.0 6 votes vote down vote up
protected void createDomainCombo(Composite leftColumn) {

		Label label = getToolkit().createLabel(leftColumn, "Statechart domain");
		GridDataFactory.fillDefaults().span(2, 1).align(SWT.FILL, SWT.CENTER).applyTo(label);
		domainCombo = new ComboViewer(leftColumn);
		GridDataFactory.fillDefaults().span(1, 1).align(SWT.FILL, SWT.CENTER).applyTo(domainCombo.getCombo());
		Label spacer = getToolkit().createLabel(leftColumn, "");
		GridDataFactory.fillDefaults().applyTo(spacer);
		domainCombo.setContentProvider(new ArrayContentProvider());
		domainCombo.setLabelProvider(new LabelProvider() {
			@Override
			public String getText(Object element) {
				return ((IDomain) element).getName();
			}
		});

		List<IDomain> domains = DomainRegistry.getDomains();
		for (IDomain domainDescriptor : domains) {
			domainCombo.add(domainDescriptor);
		}

		if (domains.size() <= 1) {
			domainCombo.getControl().setEnabled(false);
		}

	}
 
Example #5
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 #6
Source File: CleanupPreferencePage.java    From eclipse-extras with Eclipse Public License 1.0 6 votes vote down vote up
private void createPageControls( Composite parent ) {
  cleanupButton = new Button( parent, SWT.CHECK );
  cleanupButton.setText( "Remove on-the-fly generated launch configurations when no longer needed" );
  cleanupButton.addListener( SWT.Selection, this::cleanupButtonSelected );
  cleanupTypesLabel = new Label( parent, SWT.NONE );
  cleanupTypesLabel.setText( "Select the launch configuration types to clean up" );
  cleanupTypesViewer = CheckboxTableViewer.newCheckList( parent, SWT.BORDER );
  cleanupTypesViewer.setLabelProvider( DebugUITools.newDebugModelPresentation() );
  cleanupTypesViewer.setContentProvider( ArrayContentProvider.getInstance() );
  cleanupTypesViewer.setComparator( new WorkbenchViewerComparator() );
  cleanupTypesViewer.addFilter( new LaunchConfigTypeFilter() );
  cleanupTypesViewer.setInput( launchManager.getLaunchConfigurationTypes() );
  selectAllButton = new Button( parent, SWT.PUSH );
  selectAllButton.addListener( SWT.Selection, event -> cleanupTypesViewer.setAllChecked( true ) );
  selectAllButton.setText( "&Select All" );
  deselectAllButton = new Button( parent, SWT.PUSH );
  deselectAllButton.setText( "&Deselect All" );
  deselectAllButton.addListener( SWT.Selection, event -> cleanupTypesViewer.setAllChecked( false ) );
  notelabel = new Label( parent, SWT.WRAP );
  String text
    = "Note: Launch configurations are considered as on-the-fly generated if "
    + "they were created outside the Run Configurations dialog without further "
    + "manual changes. For example with Run As > JUnit Test";
  notelabel.setText( text );
}
 
Example #7
Source File: OrderElementControl.java    From statecharts with Eclipse Public License 1.0 6 votes vote down vote up
private void init() {
	this.setLayout(new GridLayout(2, false));
	viewer = new TableViewer(this, SWT.SINGLE | SWT.BORDER);
	viewer.setContentProvider(new ArrayContentProvider());
	viewer.setLabelProvider(new AdapterFactoryLabelProvider(new SGraphItemProviderAdapterFactory()));
	Composite buttonComposite = getToolkit().createComposite(this);
	buttonComposite.setLayout(new FillLayout(SWT.VERTICAL));
	btnUp = getToolkit().createButton(buttonComposite, "up", SWT.PUSH);
	btnDown = getToolkit().createButton(buttonComposite, "down", SWT.PUSH);
	viewer.addSelectionChangedListener(enableButtonListener);
	viewer.addSelectionChangedListener(editPartSelectionListener);
	btnUp.addSelectionListener(upButtonListener);
	btnDown.addSelectionListener(downButtonListener);
	GridDataFactory.fillDefaults().applyTo(viewer.getControl());
	GridDataFactory.fillDefaults().applyTo(buttonComposite);
	GridDataFactory.fillDefaults().grab(true, false).applyTo(viewer.getControl());
	GridDataFactory.fillDefaults().grab(true, false).applyTo(this);
}
 
Example #8
Source File: SvnPropertiesView.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
private TableViewer createTable(Composite parent) {
	Table table =	new Table(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.MULTI);
	table.setHeaderVisible(true);
	table.setLinesVisible(true);

	GridData gridData = new GridData(GridData.FILL_BOTH);
	table.setLayoutData(gridData);
	TableLayout layout = new TableLayout();
	table.setLayout(layout);
       
	tableViewer = new TableViewer(table);
	createColumns(table, layout);

	tableViewer.setContentProvider(new ArrayContentProvider());
	tableViewer.setLabelProvider(new PropertiesLabelProvider());
	return tableViewer;
}
 
Example #9
Source File: TableComboViewerTests.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
private TableComboViewer createTableComboViewer(final Composite parent, final int noOfItems) {
	final TableComboViewer result = new TableComboViewer(parent, SWT.NONE);
	result.getTableCombo().setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false));

	result.setContentProvider(ArrayContentProvider.getInstance());
	result.setLabelProvider(new TestLabelProvider());

	// create columns
	final String[] columns = new String[] { "Name", "Description" };
	result.getTableCombo().defineColumns(columns);

	// set input data
	final TestItem[] testItems = new TestItem[noOfItems];
	for (int i = 0; i < noOfItems; i++) {
		testItems[i] = new TestItem("Item " + i, "Description " + i);
	}
	result.setInput(testItems);

	return result;

}
 
Example #10
Source File: ChartMakerDialog.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
private void createTypeTable() {
    GridData typeGridData = new GridData();
    typeGridData.verticalSpan = 3;
    typeGridData.horizontalAlignment = SWT.FILL;
    typeGridData.verticalAlignment = SWT.FILL;
    typeGridData.grabExcessHorizontalSpace = false;
    typeGridData.grabExcessVerticalSpace = true;

    TableViewerColumn typeColumn = new TableViewerColumn(fTypeTable, SWT.NONE);
    typeColumn.getColumn().setWidth(50);
    typeColumn.setLabelProvider(new TypeLabelProvider());

    List<IChartTypeDefinition> types = new ArrayList<>();
    types.add(new BarChartTypeDefinition());
    types.add(new ScatterChartTypeDefinition());

    fTypeTable.getTable().setParent(fComposite);
    fTypeTable.getTable().setLayoutData(typeGridData);
    fTypeTable.setContentProvider(ArrayContentProvider.getInstance());
    fTypeTable.addSelectionChangedListener(new TypeSelectionListener());
    fTypeTable.setInput(types);
}
 
Example #11
Source File: TSLintWizardPage.java    From typescript.java with MIT License 6 votes vote down vote up
private void createEmbeddedTslintPluginField(Composite parent) {
	useEmbeddedTslintPluginButton = new Button(parent, SWT.RADIO);
	useEmbeddedTslintPluginButton.setText(TypeScriptUIMessages.TSLintWizardPage_useEmbeddedTslintPlugin_label);
	useEmbeddedTslintPluginButton.addListener(SWT.Selection, this);
	useEmbeddedTslintPluginButton.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			updateTslintPluginMode();
		}
	});

	embeddedTslintPlugin = new Combo(parent, SWT.READ_ONLY);
	embeddedTslintPlugin.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

	ComboViewer viewer = new ComboViewer(embeddedTslintPlugin);
	viewer.setContentProvider(ArrayContentProvider.getInstance());
	viewer.setLabelProvider(new TypeScriptRepositoryLabelProvider(false, true));
	List<ITypeScriptRepository> repositories = Arrays
			.stream(TypeScriptCorePlugin.getTypeScriptRepositoryManager().getRepositories())
			.filter(r -> r.getTslintLanguageServiceName() != null).collect(Collectors.toList());
	viewer.setInput(repositories);
}
 
Example #12
Source File: TSLintWizardPage.java    From typescript.java with MIT License 6 votes vote down vote up
private void createEmbeddedTslintField(Composite parent) {
	useEmbeddedTslintRuntimeButton = new Button(parent, SWT.RADIO);
	useEmbeddedTslintRuntimeButton.setText(TypeScriptUIMessages.TSLintWizardPage_useEmbeddedTslintRuntime_label);
	useEmbeddedTslintRuntimeButton.addListener(SWT.Selection, this);
	useEmbeddedTslintRuntimeButton.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			updateTslintRuntimeMode();
		}
	});

	embeddedTslintRuntime = new Combo(parent, SWT.READ_ONLY);
	embeddedTslintRuntime.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

	ComboViewer viewer = new ComboViewer(embeddedTslintRuntime);
	viewer.setContentProvider(ArrayContentProvider.getInstance());
	viewer.setLabelProvider(new TypeScriptRepositoryLabelProvider(true, false));
	List<ITypeScriptRepository> repositories = Arrays
			.stream(TypeScriptCorePlugin.getTypeScriptRepositoryManager().getRepositories())
			.filter(r -> r.getTslintFile() != null).collect(Collectors.toList());
	viewer.setInput(repositories);
}
 
Example #13
Source File: SvnRevPropertiesView.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
private TableViewer createTable(Composite parent) {
    Table table =   new Table(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.MULTI);
    table.setHeaderVisible(true);
    table.setLinesVisible(true);

    GridData gridData = new GridData(GridData.FILL_BOTH);
    table.setLayoutData(gridData);
    TableLayout layout = new TableLayout();
    table.setLayout(layout);
    
    tableViewer = new TableViewer(table);
    createColumns(table, layout);

    tableViewer.setContentProvider(new ArrayContentProvider());
    tableViewer.setLabelProvider(new PropertiesLabelProvider());
    return tableViewer;
}
 
Example #14
Source File: AbstractCallHierarchyViewPart.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
protected TableViewer createLocationViewer(Composite parent) {
	TableViewer locationViewer = new TableViewer(parent);
	locationViewer.setContentProvider(new ArrayContentProvider());
	locationViewer.setLabelProvider(createLocationLabelProvider());

	TableLayout layout = new TableLayout();
	locationViewer.getTable().setLayout(layout);
	locationViewer.getTable().setHeaderVisible(true);

	Pair<String, ColumnLayoutData>[] locationColumnDescriptions = getLocationColumnDescriptions();
	IntStream.range(0, locationColumnDescriptions.length).forEach(index -> {
		layout.addColumnData(locationColumnDescriptions[index].getValue());
		createColumn(locationViewer.getTable(), locationColumnDescriptions[index], index);
	});

	return locationViewer;
}
 
Example #15
Source File: MiniSelector.java    From google-cloud-eclipse with Apache License 2.0 6 votes vote down vote up
private void create(Composite parent) {
  displayExecutor = DisplayExecutor.create(parent.getDisplay());
  comboViewer = new ComboViewer(parent, SWT.READ_ONLY | SWT.DROP_DOWN);
  comboViewer.setComparator(new ViewerComparator());
  comboViewer.setLabelProvider(new LabelProvider() {
    @Override
    public String getText(Object element) {
      if (element instanceof GcpProject) {
        GcpProject project = (GcpProject) element;
        return project.getName() + " (" + project.getId() + ")";
      }
      return super.getText(element);
    }
  });
  comboViewer.setContentProvider(ArrayContentProvider.getInstance());
  comboViewer.setInput(EMPTY_PROJECTS);
  parent.addDisposeListener(new DisposeListener() {
    @Override
    public void widgetDisposed(DisposeEvent event) {
      cancelFetch();
    }
  });

  fetch();
}
 
Example #16
Source File: FieldDialogImpl.java    From jenerate with Eclipse Public License 1.0 6 votes vote down vote up
private Composite createFieldComposite(final Composite composite) {
    Composite fieldComposite = new Composite(composite, SWT.NONE);
    GridLayout layout = new GridLayout();
    fieldComposite.setLayout(layout);

    fieldViewer = CheckboxTableViewer.newCheckList(fieldComposite, SWT.MULTI | SWT.TOP | SWT.BORDER);
    GridData data = new GridData(GridData.FILL_BOTH);
    data.grabExcessHorizontalSpace = true;

    fieldViewer.getTable().setLayoutData(data);

    fieldViewer.setLabelProvider(new JavaElementLabelProvider());
    fieldViewer.setContentProvider(new ArrayContentProvider());
    fieldViewer.setInput(allFields);
    selectAllNonTransientFields();
    return fieldComposite;
}
 
Example #17
Source File: AppEngineStandardWizardPage.java    From google-cloud-eclipse with Apache License 2.0 6 votes vote down vote up
@Override
protected void createRuntimeField(Composite composite) {
  Label runtimeLabel = new Label(composite, SWT.LEAD);
  runtimeLabel.setText(Messages.getString("app.engine.standard.project.runtimetype")); //$NON-NLS-1$
  runtimeField = new ComboViewer(composite, SWT.READ_ONLY);
  runtimeField.setLabelProvider(new LabelProvider() {
    @Override
    public String getText(Object element) {
      return ((AppEngineRuntime) element).getLabel();
    }
  });
  runtimeField.setContentProvider(ArrayContentProvider.getInstance());
  runtimeField.setInput(AppEngineRuntime.STANDARD_RUNTIMES);
  runtimeField.setSelection(new StructuredSelection(DEFAULT_RUNTIME), true);
  runtimeField.addPostSelectionChangedListener(event -> revalidate());
}
 
Example #18
Source File: AggregatorPropertiesEditionPartForm.java    From eip-designer with Apache License 2.0 5 votes vote down vote up
protected Composite createPartEMFComboViewer(FormToolkit widgetFactory, Composite parent) {
	createDescription(parent, EipViewsRepository.Aggregator.Properties.part, EipMessages.AggregatorPropertiesEditionPart_PartLabel);
	part = new EMFComboViewer(parent);
	part.setContentProvider(new ArrayContentProvider());
	part.setLabelProvider(new AdapterFactoryLabelProvider(EEFRuntimePlugin.getDefault().getAdapterFactory()));
	GridData partData = new GridData(GridData.FILL_HORIZONTAL);
	part.getCombo().setLayoutData(partData);
	part.addSelectionChangedListener(new ISelectionChangedListener() {

		/**
		 * {@inheritDoc}
		 * 
		 * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
		 * 	
		 */
		public void selectionChanged(SelectionChangedEvent event) {
			if (propertiesEditionComponent != null)
				propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(AggregatorPropertiesEditionPartForm.this, EipViewsRepository.Aggregator.Properties.part, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.SET, null, getPart()));
		}

	});
	part.setID(EipViewsRepository.Aggregator.Properties.part);
	FormUtils.createHelpButton(widgetFactory, parent, propertiesEditionComponent.getHelpContent(EipViewsRepository.Aggregator.Properties.part, EipViewsRepository.FORM_KIND), null); //$NON-NLS-1$
	// Start of user code for createPartEMFComboViewer

	// End of user code
	return parent;
}
 
Example #19
Source File: BuilderPropertyPage.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
protected TableViewer createBlackListViewer(Composite group) {
	TableViewer result = new TableViewer(group, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL);
	result.getTable().setLinesVisible(true);
	GridDataFactory.fillDefaults().grab(true, true).applyTo(result.getControl());
	result.setContentProvider(new ArrayContentProvider());
	result.setLabelProvider(new WorkbenchLabelProvider());
	values = blacklist.getValues(getActualProject());
	result.setInput(values);
	return result;
}
 
Example #20
Source File: NewCheckCatalogWizardPage.java    From dsl-devkit with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates the grammars controls.
 * 
 * @param composite
 *          the composite
 */
private void createGrammarsControls(final Composite composite) {
  Label generatorConfigLabel = new Label(composite, SWT.NONE);
  generatorConfigLabel.setText(Messages.GRAMMAR_FIELD_NAME_LABEL);

  Combo generatorConfigurationField = new Combo(composite, SWT.READ_ONLY);
  GridData data = new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1);
  data.widthHint = PAGE_WIDTH_HINT; // prevents shrinking of combo view
  generatorConfigurationField.setLayoutData(data);
  generatorConfigurationField.setFont(composite.getFont());

  ComboViewer grammars = new ComboViewer(generatorConfigurationField);
  grammars.setContentProvider(new ArrayContentProvider());
  grammars.setLabelProvider(new LabelProvider() {
    @Override
    public String getText(final Object object) {
      if (object instanceof Grammar) {
        return new GrammarHelper((Grammar) object).getLabelName();
      }
      return super.getText(object);
    }
  });
  grammars.setInput(resourceUtil.getGrammars());

  // React to the selection of the viewer
  // Note that the viewer return the real object and not just a string
  // representation
  grammars.addSelectionChangedListener(new ISelectionChangedListener() {
    public void selectionChanged(final SelectionChangedEvent event) {
      if (event.getSelection() instanceof StructuredSelection) {
        grammar = (Grammar) ((StructuredSelection) event.getSelection()).getFirstElement();
        grammarStatus = validateGrammarAccess();
        handleFieldChanged(GRAMMAR);
      }
    }
  });
  grammars.setSelection(null); // no pre-defined grammar to be used, forces the user to make a decision about which language to target
}
 
Example #21
Source File: EdgeMatcherTableControl.java    From depan with Apache License 2.0 5 votes vote down vote up
public EdgeMatcherTableControl(Composite parent) {
  super(parent, SWT.NONE);
  setLayout(Widgets.buildContainerLayout(1));

  viewer = new TableViewer(this,
      SWT.MULTI | SWT.BORDER | SWT.V_SCROLL);

  // Layout embedded table
  Table relationTable = viewer.getTable();
  relationTable.setLayoutData(Widgets.buildGrabFillData());

  // initialize the table
  relationTable.setHeaderVisible(true);
  relationTable.setToolTipText("Edge Matcher Definition");
  EditColTableDef.setupTable(TABLE_DEF, relationTable);

  CellEditor[] cellEditors = new CellEditor[TABLE_DEF.length];
  cellEditors[INDEX_RELATION] = null;
  cellEditors[INDEX_FORWARD] = new CheckboxCellEditor(relationTable);
  cellEditors[INDEX_BACKWARD] = new CheckboxCellEditor(relationTable);

  // cell content
  viewer.setCellEditors(cellEditors);
  viewer.setLabelProvider(new CellLabelProvider());
  viewer.setColumnProperties(EditColTableDef.getProperties(TABLE_DEF));
  viewer.setCellModifier(new CellModifier());
  viewer.setContentProvider(ArrayContentProvider.getInstance());

  viewer.setComparator(new AlphabeticSorter(new ViewerObjectToString() {

    @Override
    public String getString(Object object) {
        if (object instanceof Relation) {
          return ((Relation) object).toString();
        }
        return object.toString();
      }
    }));
}
 
Example #22
Source File: RelationSetTableControl.java    From depan with Apache License 2.0 5 votes vote down vote up
public RelationSetTableControl(Composite parent) {
  super(parent, SWT.NONE);
  setLayout(Widgets.buildContainerLayout(1));

  // Layout embedded table
  relSetViewer = new TableViewer(this,
      SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER | SWT.V_SCROLL);

  // Set up layout properties
  Table relSetTable = relSetViewer.getTable();
  relSetTable.setLayoutData(Widgets.buildGrabFillData());

  // initialize the table
  relSetTable.setHeaderVisible(true);
  relSetTable.setToolTipText("List of Relations");
  EditColTableDef.setupTable(TABLE_DEF, relSetTable);

  // Configure cell editing
  CellEditor[] cellEditors = new CellEditor[TABLE_DEF.length];
  cellEditors[INDEX_NAME] = null;
  cellEditors[INDEX_SOURCE] = null;
  cellEditors[INDEX_VISIBLE] = new CheckboxCellEditor(relSetTable);

  // Configure table properties.
  relSetViewer.setCellEditors(cellEditors);
  relSetViewer.setLabelProvider(new ControlLabelProvider());
  relSetViewer.setColumnProperties(EditColTableDef.getProperties(TABLE_DEF));
  relSetViewer.setCellModifier(new ControlCellModifier());
  relSetViewer.setContentProvider(ArrayContentProvider.getInstance());

  configSorters(relSetTable);
}
 
Example #23
Source File: WorkspaceMergeDialog.java    From MergeProcessor with Apache License 2.0 5 votes vote down vote up
/**
 * Create the table viewer for showing warnings.
 * 
 * @param parent the parent composite of the table viewer
 * @return the table viewer
 */
private static ListViewer createWarningsTableViewer(final Composite parent) {
	final Composite composite = new Composite(parent, SWT.NONE);
	composite.setLayout(new FillLayout());
	GridDataFactory.fillDefaults().span(2, 1).grab(true, true).exclude(true).applyTo(composite);
	final ListViewer tableViewer = new ListViewer(composite);
	tableViewer.setContentProvider(ArrayContentProvider.getInstance());
	tableViewer.setLabelProvider(new LabelProvider());
	return tableViewer;
}
 
Example #24
Source File: TaskSelectionDialog.java    From workspacemechanic with Eclipse Public License 1.0 5 votes vote down vote up
public TaskSelectionDialog(Shell parent, String title,
    Collection<Task> items) {
  super(parent);
  setInput(items);
  setContentProvider(ArrayContentProvider.getInstance());
  setLabelProvider(new DefaultLabelProvider());
  setWidthInChars(80);
  setTitle(title);
}
 
Example #25
Source File: CreateParamDialog.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent) {
	setMessage(Messages.CreateParamDialog_INPUT_PARAM_NAME);
	Composite com = new Composite(parent, SWT.NONE);
	com.setLayout(new GridLayout(2, false));
	com.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	
	Label featureLabel = new Label(com, SWT.NONE);
	featureLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
	featureLabel.setText("feature");  //$NON-NLS-1$
	this.list = new ComboViewer(com, SWT.NONE);
	this.list.setLabelProvider(new LabelProvider());
	this.list.setContentProvider(new ArrayContentProvider());
	this.list.setInput(config.getFeatures());
	this.list.getCombo().select(0);
	
	Label paramNameLabel = new Label(com, SWT.NONE);
	paramNameLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
	paramNameLabel.setText(Messages.CreateParamDialog_NAME); 

	this.paramNameText = new Text(com, SWT.BORDER);
	this.paramNameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	
	Label paramValueLabel = new Label(com, SWT.NONE);
	paramValueLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
	paramValueLabel.setText(Messages.CreateParamDialog_VALUE); 

	this.paramValueText = new Text(com, SWT.BORDER);
	this.paramValueText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	
	return parent;
}
 
Example #26
Source File: EnricherPropertiesEditionPartImpl.java    From eip-designer with Apache License 2.0 5 votes vote down vote up
protected Composite createPartEMFComboViewer(Composite parent) {
	createDescription(parent, EipViewsRepository.Enricher.Properties.part, EipMessages.EnricherPropertiesEditionPart_PartLabel);
	part = new EMFComboViewer(parent);
	part.setContentProvider(new ArrayContentProvider());
	part.setLabelProvider(new AdapterFactoryLabelProvider(EEFRuntimePlugin.getDefault().getAdapterFactory()));
	GridData partData = new GridData(GridData.FILL_HORIZONTAL);
	part.getCombo().setLayoutData(partData);
	part.addSelectionChangedListener(new ISelectionChangedListener() {

		/**
		 * {@inheritDoc}
		 * 
		 * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
		 * 	
		 */
		public void selectionChanged(SelectionChangedEvent event) {
			if (propertiesEditionComponent != null)
				propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(EnricherPropertiesEditionPartImpl.this, EipViewsRepository.Enricher.Properties.part, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.SET, null, getPart()));
		}

	});
	part.setID(EipViewsRepository.Enricher.Properties.part);
	SWTUtils.createHelpButton(parent, propertiesEditionComponent.getHelpContent(EipViewsRepository.Enricher.Properties.part, EipViewsRepository.SWT_KIND), null); //$NON-NLS-1$
	// Start of user code for createPartEMFComboViewer

	// End of user code
	return parent;
}
 
Example #27
Source File: RecipientListRouterPropertiesEditionPartImpl.java    From eip-designer with Apache License 2.0 5 votes vote down vote up
protected Composite createTypeEMFComboViewer(Composite parent) {
	createDescription(parent, EipViewsRepository.RecipientListRouter.Properties.type, EipMessages.RecipientListRouterPropertiesEditionPart_TypeLabel);
	type = new EMFComboViewer(parent);
	type.setContentProvider(new ArrayContentProvider());
	type.setLabelProvider(new AdapterFactoryLabelProvider(EEFRuntimePlugin.getDefault().getAdapterFactory()));
	GridData typeData = new GridData(GridData.FILL_HORIZONTAL);
	type.getCombo().setLayoutData(typeData);
	type.addSelectionChangedListener(new ISelectionChangedListener() {

		/**
		 * {@inheritDoc}
		 * 
		 * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
		 * 	
		 */
		public void selectionChanged(SelectionChangedEvent event) {
			if (propertiesEditionComponent != null)
				propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(RecipientListRouterPropertiesEditionPartImpl.this, EipViewsRepository.RecipientListRouter.Properties.type, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.SET, null, getType()));
		}

	});
	type.setID(EipViewsRepository.RecipientListRouter.Properties.type);
	SWTUtils.createHelpButton(parent, propertiesEditionComponent.getHelpContent(EipViewsRepository.RecipientListRouter.Properties.type, EipViewsRepository.SWT_KIND), null); //$NON-NLS-1$
	// Start of user code for createTypeEMFComboViewer

	// End of user code
	return parent;
}
 
Example #28
Source File: InterfacesTab.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void createTab ( final TabFolder tabFolder )
{
    this.item = new TabItem ( tabFolder, SWT.NONE );
    this.item.setText ( Messages.InterfacesTab_TabItem_Label );

    this.viewer = new ListViewer ( tabFolder );
    this.item.setControl ( this.viewer.getControl () );
    this.viewer.setContentProvider ( new ArrayContentProvider () );
}
 
Example #29
Source File: AssignWorkingSetsAction.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates the dialog for working set assignment.
 *
 * @param workingSets
 *            All the working set the user should be able to select from
 * @param numberOfSelectedProjects
 *            The number of selected projects
 */
private ListSelectionDialog createDialog(Collection<WorkingSet> workingSets, int numberOfSelectedProjects) {
	// Filter 'Other Projects' working set
	List<WorkingSet> selectableWorkingSets = workingSets.stream()
			.filter(set -> !set.getId().equals(WorkingSet.OTHERS_WORKING_SET_ID)).collect(Collectors.toList());

	String message = String.format(DIALOG_SUBTITLE, numberOfSelectedProjects);

	ListSelectionDialog dialog = new NonEmptyListSelectionDialog(site.getShell(),
			selectableWorkingSets, ArrayContentProvider.getInstance(), WorkingSetLabelProvider.INSTANCE, message);

	dialog.setTitle(DIALOG_TITLE);
	return dialog;
}
 
Example #30
Source File: RouterPropertiesEditionPartForm.java    From eip-designer with Apache License 2.0 5 votes vote down vote up
protected Composite createTypeEMFComboViewer(FormToolkit widgetFactory, Composite parent) {
	createDescription(parent, EipViewsRepository.Router.Properties.type, EipMessages.RouterPropertiesEditionPart_TypeLabel);
	type = new EMFComboViewer(parent);
	type.setContentProvider(new ArrayContentProvider());
	type.setLabelProvider(new AdapterFactoryLabelProvider(EEFRuntimePlugin.getDefault().getAdapterFactory()));
	GridData typeData = new GridData(GridData.FILL_HORIZONTAL);
	type.getCombo().setLayoutData(typeData);
	type.addSelectionChangedListener(new ISelectionChangedListener() {

		/**
		 * {@inheritDoc}
		 * 
		 * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
		 * 	
		 */
		public void selectionChanged(SelectionChangedEvent event) {
			if (propertiesEditionComponent != null)
				propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(RouterPropertiesEditionPartForm.this, EipViewsRepository.Router.Properties.type, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.SET, null, getType()));
		}

	});
	type.setID(EipViewsRepository.Router.Properties.type);
	FormUtils.createHelpButton(widgetFactory, parent, propertiesEditionComponent.getHelpContent(EipViewsRepository.Router.Properties.type, EipViewsRepository.FORM_KIND), null); //$NON-NLS-1$
	// Start of user code for createTypeEMFComboViewer

	// End of user code
	return parent;
}