org.eclipse.jface.viewers.IStructuredContentProvider Java Examples

The following examples show how to use org.eclipse.jface.viewers.IStructuredContentProvider. 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: TypeChooser.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
public JvmDeclaredType choose(final List<JvmDeclaredType> candidateTypes, Iterable<TypeUsage> usages, final XtextResource resource) {
	XtextEditor activeXtextEditor = EditorUtils.getActiveXtextEditor();
	if (activeXtextEditor==null) return null;
	revealInEditor(activeXtextEditor, usages, resource);
	Shell shell = Display.getDefault().getActiveShell();
	IStructuredContentProvider contentProvider = new ContentProvider();
	Dialog dialog = new Dialog(shell, new LabelProvider(labelProvider), contentProvider);
	dialog.setInput(candidateTypes);
	dialog.setInitialSelections((Object[])new JvmDeclaredType[] { candidateTypes.get(0) });
	int result = dialog.open();
	if(originalSelection != null)
		activeXtextEditor.getSelectionProvider().setSelection(originalSelection);
	if(result == Window.OK && dialog.getResult().length > 0) 
		return (JvmDeclaredType) dialog.getResult()[0];
	else 
		return null;
}
 
Example #2
Source File: ConnectorConfigurationWizardPage.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
@Override
public String isConfigurationPageValid(final Configuration conf) {
    if(viewer != null && viewer.getInput() != null){
        for(final Object element : ((IStructuredContentProvider) viewer.getContentProvider()).getElements(viewer.getInput())){
            final DefinitionMapping association = (DefinitionMapping) element ;
            final String implementationId = association.getImplementationId();
            final String implementationVersion = association.getImplementationVersion();
            if(implementationId == null || implementationVersion == null){
                return Messages.bind(Messages.invalidImplementationFor, association.getDefinitionId()) ;
            }
            final ConnectorImplementation impl = getImplStore().getImplementation(implementationId,implementationVersion) ;
            if(impl == null){
                return Messages.bind(Messages.implementationNotFound, implementationId +" ("+implementationVersion+")") ;
            }

        }
    }
    return null;
}
 
Example #3
Source File: SVNWizardPage.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Creates a ListViewer whose input is an array of IFiles.
 * 
 * @param parent  the parent of the viewer
 * @param title  the text for the title label
 * @param heightHint  the nominal height of the list
 * @return the created list viewer
 */
public ListViewer createFileListViewer(Composite parent, String title, int heightHint) {
	createLabel(parent, title);
	ListViewer listViewer = new ListViewer(parent, SWT.READ_ONLY | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
	listViewer.setContentProvider(new IStructuredContentProvider() {
		public Object[] getElements(Object inputElement) {
			return (Object[]) inputElement;
		}
		public void dispose() {
		}
		public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
		}
	});
	listViewer.setLabelProvider(new LabelProvider() {
		public String getText(Object element) {
			return ((IFile) element).getFullPath().toString();
		}
	});
	listViewer.setSorter(new WorkbenchViewerSorter());

	GridData data = new GridData(GridData.FILL_BOTH);
	data.heightHint = heightHint;
	listViewer.getList().setLayoutData(data);
	return listViewer;
}
 
Example #4
Source File: ProjectBuildPathPropertyPage.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
/**
 * getContentProvider
 * 
 * @return
 */
private IStructuredContentProvider getContentProvider()
{
	return new BaseWorkbenchContentProvider()
	{
		/*
		 * (non-Javadoc)
		 * @see org.eclipse.ui.model.BaseWorkbenchContentProvider#getChildren(java.lang.Object)
		 */
		@Override
		public Object[] getChildren(Object element)
		{
			if (element instanceof Set<?>)
			{
				return ((Set<?>) element).toArray();
			}
			return super.getChildren(element);
		}
	};
}
 
Example #5
Source File: TypeScriptSearchResultPage.java    From typescript.java with MIT License 6 votes vote down vote up
public String getLabel() {
	String label= super.getLabel();
	StructuredViewer viewer= getViewer();
	if (viewer instanceof TableViewer) {
		TableViewer tv= (TableViewer) viewer;

		AbstractTextSearchResult result= getInput();
		if (result != null) {
			int itemCount= ((IStructuredContentProvider) tv.getContentProvider()).getElements(getInput()).length;
			if (showLineMatches()) {
				int matchCount= getInput().getMatchCount();
				if (itemCount < matchCount) {
					return Messages.format(SearchMessages.FileSearchPage_limited_format_matches, new Object[]{label, new Integer(itemCount), new Integer(matchCount)});
				}
			} else {
				int fileCount= getInput().getElements().length;
				if (itemCount < fileCount) {
					return Messages.format(SearchMessages.FileSearchPage_limited_format_files, new Object[]{label, new Integer(itemCount), new Integer(fileCount)});
				}
			}
		}
	}
	return label;
}
 
Example #6
Source File: CheckboxTreeAndListGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 *	Creates an instance of this class.  Use this constructor if you wish to specify
 *	the width and/or height of the combined widget (to only hardcode one of the
 *	sizing dimensions, specify the other dimension's value as -1)
 * @param parent parent composite
 * @param rootObject
 * @param treeContentProvider
 * @param treeLabelProvider
 * @param listContentProvider
 * @param listLabelProvider
 * @param style
 * @param width the width
 * @param height the height
 */
public CheckboxTreeAndListGroup(
		Composite parent,
		Object rootObject,
		ITreeContentProvider treeContentProvider,
		ILabelProvider treeLabelProvider,
		IStructuredContentProvider listContentProvider,
		ILabelProvider listLabelProvider,
		int style,
		int width,
		int height) {
	fRoot= rootObject;
	fTreeContentProvider= treeContentProvider;
	fListContentProvider= listContentProvider;
	fTreeLabelProvider= treeLabelProvider;
	fListLabelProvider= listLabelProvider;
	createContents(parent, width, height, style);
}
 
Example #7
Source File: XtextEObjectSearchDialog.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
public XtextEObjectSearchDialog(Shell parent, IXtextEObjectSearch searchEngine, ILabelProvider labelProvider) {
	super(parent);
	this.searchEngine = searchEngine;
	this.labelProvider = labelProvider;
	setTitle(Messages.XtextEObjectSearchDialog_TableLabelDialogTitle);
	setMessage(Messages.XtextEObjectSearchDialog_TableLabelSearchControlLabel);
	setAddCancelButton(true);
	// super class needs an IStructuredContentProvider so we register this dummy and 
	// register the lazy one later
	setContentProvider(new IStructuredContentProvider() {
		@Override
		public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
		}

		@Override
		public void dispose() {
		}

		@Override
		public Object[] getElements(Object inputElement) {
			return null;
		}
	});
	setLabelProvider(labelProvider);
}
 
Example #8
Source File: ActorFilterConfigurationWizardPage.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
@Override
public String isConfigurationPageValid(Configuration conf) {
    if (viewer != null && viewer.getInput() != null) {
        for (Object element : ((IStructuredContentProvider) viewer.getContentProvider())
                .getElements(viewer.getInput())) {
            DefinitionMapping association = (DefinitionMapping) element;
            String implementationId = association.getImplementationId();
            String implementationVersion = association.getImplementationVersion();
            if (implementationId == null || implementationVersion == null) {
                return Messages.bind(Messages.invalidImplementationFor, association.getDefinitionId());
            }
            ConnectorImplementation impl = getImplStore().getImplementation(implementationId, implementationVersion);
            if (impl == null) {
                return Messages.bind(Messages.implementationNotFound,
                        implementationId + " (" + implementationVersion + ")");
            }

        }
    }
    return null;
}
 
Example #9
Source File: ExcelFileSelectionWizardPage.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Set the content of the ColumnsViewer
 * 
 */
private void setColumnsViewerContent( )
{
	selectedColumnsViewer.setContentProvider( new IStructuredContentProvider( ) {

		public Object[] getElements( Object inputElement )
		{
			if ( inputElement instanceof java.util.List )
			{
				return ( (java.util.List<?>) inputElement ).toArray( );
			}

			return new Object[0];
		}

		public void dispose( )
		{
		}

		public void inputChanged( Viewer viewer, Object oldInput,
				Object newInput )
		{
		}
	} );
}
 
Example #10
Source File: CascadingParametersDialog.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
protected int getTableIndex( Object element )
{
	Object[] input = ( (IStructuredContentProvider) valueTable.getContentProvider( ) ).getElements( valueTable.getInput( ) );

	int index = 0;

	for ( int i = 0; i < input.length; i++ )
	{
		if ( element == input[i] )
		{
			index = i;
			break;
		}
	}

	return index;
}
 
Example #11
Source File: AliasViewer.java    From offspring with MIT License 5 votes vote down vote up
public AliasViewer(Composite parent, Long accountId, INxtService nxt,
    IStylingEngine engine, IUserService userService, UISynchronize sync,
    IContactsService contactsService) {
  super(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE
      | SWT.BORDER);
  this.nxt = nxt;
  this.engine = engine;
  this.userService = userService;
  this.sync = sync;
  this.contactsService = contactsService;
  setGenericTable(new IGenericTable() {

    @Override
    public int getDefaultSortDirection() {
      return GenericComparator.DESCENDING;
    }

    @Override
    public IGenericTableColumn getDefaultSortColumn() {
      return columnName;
    }

    @Override
    public IStructuredContentProvider getContentProvider() {
      return contentProvider;
    }

    @Override
    public IGenericTableColumn[] getColumns() {
      return new IGenericTableColumn[] { columnName, columnURI, columnID,
          columnDate };
    }
  });
  setInput(accountId);
}
 
Example #12
Source File: MessagingTreeViewer.java    From offspring with MIT License 5 votes vote down vote up
public MessagingTreeViewer(Composite parent, Long accountId,
    IContactsService contactsService, INxtService nxt, IStylingEngine engine,
    IUserService userService, UISynchronize sync) {
  super(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
  this.contactsService = contactsService;
  this.nxt = nxt;
  this.accountId = accountId;
  this.engine = engine;
  this.userService = userService;
  this.sync = sync;
  
  setGenericTable(new IGenericTable() {

    @Override
    public int getDefaultSortDirection() {
      return 99; // Not used
    }

    @Override
    public IGenericTableColumn getDefaultSortColumn() {
      return null; // Not used
    }

    @Override
    public IStructuredContentProvider getContentProvider() {
      return contentProvider;
    }

    @Override
    public IGenericTableColumn[] getColumns() {
      return new IGenericTableColumn[] { columnMain };
    }
  });
  setInput(accountId);
}
 
Example #13
Source File: TagCloudViewer.java    From gef with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected void inputChanged(Object input, Object oldInput) {
	selection.clear();
	objectMap.clear();
	IStructuredContentProvider contentProvider = (IStructuredContentProvider) getContentProvider();
	Object[] elements = contentProvider.getElements(input);
	List<Word> words = new ArrayList<>();
	ICloudLabelProvider labelProvider = (ICloudLabelProvider) getLabelProvider();
	short i = 0;
	for (Object element : elements) {
		Word word = new Word(labelProvider.getLabel(element));
		word.setColor(labelProvider.getColor(element));
		word.weight = labelProvider.getWeight(element);
		word.setFontData(labelProvider.getFontData(element));
		word.angle = labelProvider.getAngle(element);
		word.data = element;
		Assert.isLegal(word.string != null, "Labelprovider must return a String for each element");
		Assert.isLegal(word.getColor() != null, "Labelprovider must return a Color for each element");
		Assert.isLegal(word.getFontData() != null, "Labelprovider must return a FontData for each element");
		Assert.isLegal(word.weight >= 0,
				"Labelprovider must return a weight between 0 and 1 (inclusive), but value was " + word.weight);
		Assert.isLegal(word.weight <= 1,
				"Labelprovider must return a weight between 0 and 1 (inclusive), but value was " + word.weight);
		Assert.isLegal(word.angle >= -90,
				"Angle of an element must be between -90 and +90 (inclusive), but was " + word.angle);
		Assert.isLegal(word.angle <= 90,
				"Angle of an element must be between -90 and +90 (inclusive), but was " + word.angle);
		words.add(word);
		i++;
		word.id = i;
		objectMap.put(element, word);
		if (i == maxWords)
			break;
	}
	selection.clear();
	if (monitor != null) {
		monitor.subTask("Layouting...");
	}
	cloud.setWords(words, monitor);
}
 
Example #14
Source File: TransactionsViewer.java    From offspring with MIT License 5 votes vote down vote up
public TransactionsViewer(Composite parent, Long accountId,
    IContactsService contactsService, INxtService nxt, IStylingEngine engine,
    IUserService userService, UISynchronize sync) {
  super(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE
      | SWT.BORDER);
  this.contactsService = contactsService;
  this.nxt = nxt;
  this.accountId = accountId;
  this.engine = engine;
  this.userService = userService;
  this.sync = sync;
  setGenericTable(new IGenericTable() {

    @Override
    public int getDefaultSortDirection() {
      return GenericComparator.DESCENDING;
    }

    @Override
    public IGenericTableColumn getDefaultSortColumn() {
      return columnDate;
    }

    @Override
    public IStructuredContentProvider getContentProvider() {
      return contentProvider;
    }

    @Override
    public IGenericTableColumn[] getColumns() {
      return new IGenericTableColumn[] { columnType, columnConfirmations,
          columnDate, columnAmount, columnFee, columnAccount, columnID,
          columnTransactionType };
    }
  });
  setInput(accountId);
}
 
Example #15
Source File: AssetsViewer.java    From offspring with MIT License 5 votes vote down vote up
public AssetsViewer(Composite parent, Long accountId, INxtService nxt,
    IUserService userService, IContactsService contactsService,
    UISynchronize sync, IStylingEngine engine) {
  super(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE
      | SWT.BORDER);
  this.nxt = nxt;
  this.accountId = accountId;
  this.userService = userService;
  this.contactsService = contactsService;
  this.sync = sync;
  this.account = Account.getAccount(accountId);
  this.engine = engine;
  setGenericTable(new IGenericTable() {

    @Override
    public int getDefaultSortDirection() {
      return GenericComparator.DESCENDING;
    }

    @Override
    public IGenericTableColumn getDefaultSortColumn() {
      return columnName;
    }

    @Override
    public IStructuredContentProvider getContentProvider() {
      return contentProvider;
    }

    @Override
    public IGenericTableColumn[] getColumns() {
      return new IGenericTableColumn[] { columnName, columnBalance,
          columnQuantity, columnIssuer, columnDescription };
    }
  });
  setInput(accountId);
}
 
Example #16
Source File: BlockTransactionViewer.java    From offspring with MIT License 5 votes vote down vote up
public BlockTransactionViewer(Composite parent, Long blockId,
    IContactsService contactsService, INxtService nxt, IStylingEngine engine,
    IUserService userService, UISynchronize sync) {
  super(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE
      | SWT.BORDER);
  this.contactsService = contactsService;
  this.nxt = nxt;
  this.blockId = blockId;
  this.engine = engine;
  this.userService = userService;
  this.sync = sync;
  setGenericTable(new IGenericTable() {

    @Override
    public int getDefaultSortDirection() {
      return GenericComparator.DESCENDING;
    }

    @Override
    public IGenericTableColumn getDefaultSortColumn() {
      return columnDate;
    }

    @Override
    public IStructuredContentProvider getContentProvider() {
      return contentProvider;
    }

    @Override
    public IGenericTableColumn[] getColumns() {
      return new IGenericTableColumn[] { columnDate, columnAmount, columnFee,
          columnSender, columnRecipient, columnID, columnTransactionType };
    }
  });
  setInput(blockId);
}
 
Example #17
Source File: CheckboxTreeAndListGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 *	Sets the list viewer's providers to those passed
 *
 *	@param contentProvider ITreeContentProvider
 *	@param labelProvider ILabelProvider
 */
public void setListProviders(
	IStructuredContentProvider contentProvider,
	ILabelProvider labelProvider) {
	fListViewer.setContentProvider(contentProvider);
	fListViewer.setLabelProvider(labelProvider);
}
 
Example #18
Source File: GeneratedBlocksViewer.java    From offspring with MIT License 5 votes vote down vote up
public GeneratedBlocksViewer(Composite parent, Long accountId,
    IStylingEngine engine, INxtService nxt, IUserService userService,
    UISynchronize sync, IContactsService contactsService) {
  super(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE
      | SWT.BORDER);
  this.engine = engine;
  this.nxt = nxt;
  this.userService = userService;
  this.sync = sync;
  this.contactsService = contactsService;
  setGenericTable(new IGenericTable() {

    @Override
    public int getDefaultSortDirection() {
      return GenericComparator.ASSCENDING;
    }

    @Override
    public IGenericTableColumn getDefaultSortColumn() {
      return columnDate;
    }

    @Override
    public IStructuredContentProvider getContentProvider() {
      return contentProvider;
    }

    @Override
    public IGenericTableColumn[] getColumns() {
      return new IGenericTableColumn[] { columnHeight, columnDate, columnId,
          columnGenerator, columnAmount, columnFee, columnPayload,
          columnBaseTarget };
    }
  });
  setInput(accountId);
}
 
Example #19
Source File: RecentBlocksViewer.java    From offspring with MIT License 5 votes vote down vote up
public RecentBlocksViewer(Composite parent, INxtService nxt,
    IStylingEngine engine, IUserService userService, UISynchronize sync,
    IContactsService contactsService) {
  super(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE
      | SWT.BORDER);
  this.nxt = nxt;
  this.engine = engine;
  this.userService = userService;
  this.sync = sync;
  this.contactsService = contactsService;
  setGenericTable(new IGenericTable() {

    @Override
    public int getDefaultSortDirection() {
      return 0; // not used
    }

    @Override
    public IGenericTableColumn getDefaultSortColumn() {
      return null;
    }

    @Override
    public IStructuredContentProvider getContentProvider() {
      return contentProvider;
    }

    @Override
    public IGenericTableColumn[] getColumns() {
      return new IGenericTableColumn[] { columnHeight, columnDate, columnID,
          columnFee, columnAmount, columnTransactionCount, columnEmpty };
    }
  });
  refresh();
}
 
Example #20
Source File: RecentTransactionsViewer.java    From offspring with MIT License 5 votes vote down vote up
public RecentTransactionsViewer(Composite parent, INxtService nxt,
    IStylingEngine engine, IUserService userService, UISynchronize sync,
    IContactsService contactsService) {
  super(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE
      | SWT.BORDER);
  this.nxt = nxt;
  this.engine = engine;
  this.userService = userService;
  this.sync = sync;
  this.contactsService = contactsService;
  setGenericTable(new IGenericTable() {

    @Override
    public int getDefaultSortDirection() {
      return 0; // not used
    }

    @Override
    public IGenericTableColumn getDefaultSortColumn() {
      return null;
    }

    @Override
    public IStructuredContentProvider getContentProvider() {
      return contentProvider;
    }

    @Override
    public IGenericTableColumn[] getColumns() {
      return new IGenericTableColumn[] { columnHeight, columnDate, columnID,
          columnSender, columnReceiver, columnAmount, columnFee,
          columnTransactionType, columnEmpty };
    }
  });
  refresh();
}
 
Example #21
Source File: TradesViewer.java    From offspring with MIT License 5 votes vote down vote up
public TradesViewer(Composite parent, INxtService nxt,
    IContactsService contactsService, IStylingEngine engine,
    IUserService userService, UISynchronize sync) {
  super(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE
      | SWT.BORDER);
  this.nxt = nxt;
  this.contactsService = contactsService;
  this.engine = engine;
  this.userService = userService;
  this.sync = sync;
  setGenericTable(new IGenericTable() {

    @Override
    public int getDefaultSortDirection() {
      return GenericComparator.DESCENDING;
    }

    @Override
    public IGenericTableColumn getDefaultSortColumn() {
      return columnPrice;
    }

    @Override
    public IStructuredContentProvider getContentProvider() {
      return contentProvider;
    }

    @Override
    public IGenericTableColumn[] getColumns() {
      return new IGenericTableColumn[] { columnDate, columnPrice,
          columnQuantity, columnAskOrder, columnBidOrder };
    }
  });
  refresh();
}
 
Example #22
Source File: MyTradesViewer.java    From offspring with MIT License 5 votes vote down vote up
public MyTradesViewer(Composite parent, INxtService nxt,
    IContactsService contactsService, IStylingEngine engine,
    IUserService userService, UISynchronize sync, IAssetExchange exchange) {
  super(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE
      | SWT.BORDER);
  this.nxt = nxt;
  this.contactsService = contactsService;
  this.engine = engine;
  this.userService = userService;
  this.sync = sync;
  this.exchange = exchange;
  setGenericTable(new IGenericTable() {

    @Override
    public int getDefaultSortDirection() {
      return GenericComparator.DESCENDING;
    }

    @Override
    public IGenericTableColumn getDefaultSortColumn() {
      return columnPrice;
    }

    @Override
    public IStructuredContentProvider getContentProvider() {
      return contentProvider;
    }

    @Override
    public IGenericTableColumn[] getColumns() {
      return new IGenericTableColumn[] { columnDate, columnPrice,
          columnQuantity, columnAskOrder, columnBidOrder };
    }
  });
  refresh();
}
 
Example #23
Source File: MySellOrdersViewer.java    From offspring with MIT License 5 votes vote down vote up
public MySellOrdersViewer(Composite parent, INxtService nxt,
    IAssetExchange exchange, IUserService userService) {
  super(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE
      | SWT.BORDER);
  this.nxt = nxt;
  this.userService = userService;
  this.exchange = exchange;
  setGenericTable(new IGenericTable() {

    @Override
    public int getDefaultSortDirection() {
      return GenericComparator.ASSCENDING;
    }

    @Override
    public IGenericTableColumn getDefaultSortColumn() {
      return columnPrice;
    }

    @Override
    public IStructuredContentProvider getContentProvider() {
      return contentProvider;
    }

    @Override
    public IGenericTableColumn[] getColumns() {
      return new IGenericTableColumn[] { columnPending, columnTotal,
          columnPrice, columnQuantity };
    }
  });
  setInput(1);
}
 
Example #24
Source File: MyAssetsViewer.java    From offspring with MIT License 5 votes vote down vote up
public MyAssetsViewer(Composite parent, INxtService nxt,
    IUserService userService, IContactsService contactsService,
    UISynchronize sync, IStylingEngine engine) {
  super(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE
      | SWT.BORDER);
  this.nxt = nxt;
  this.userService = userService;
  this.contactsService = contactsService;
  this.sync = sync;
  this.engine = engine;
  setGenericTable(new IGenericTable() {

    @Override
    public int getDefaultSortDirection() {
      return GenericComparator.DESCENDING;
    }

    @Override
    public IGenericTableColumn getDefaultSortColumn() {
      return columnName;
    }

    @Override
    public IStructuredContentProvider getContentProvider() {
      return contentProvider;
    }

    @Override
    public IGenericTableColumn[] getColumns() {
      return new IGenericTableColumn[] { columnName, columnBalance,
          columnQuantity, columnIssuer, columnDescription };
    }
  });
  setInput(1);
}
 
Example #25
Source File: AskOrdersViewer.java    From offspring with MIT License 5 votes vote down vote up
public AskOrdersViewer(Composite parent, INxtService nxt,
    IContactsService contactsService, IStylingEngine engine,
    IUserService userService, UISynchronize sync) {
  super(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE
      | SWT.BORDER);
  this.nxt = nxt;
  this.contactsService = contactsService;
  this.engine = engine;
  this.userService = userService;
  this.sync = sync;
  setGenericTable(new IGenericTable() {

    @Override
    public int getDefaultSortDirection() {
      return GenericComparator.ASSCENDING;
    }

    @Override
    public IGenericTableColumn getDefaultSortColumn() {
      return columnPrice;
    }

    @Override
    public IStructuredContentProvider getContentProvider() {
      return contentProvider;
    }

    @Override
    public IGenericTableColumn[] getColumns() {
      return new IGenericTableColumn[] { columnTotal, columnPrice,
          columnQuantity, columnSeller };
    }
  });
  refresh();
}
 
Example #26
Source File: AssetsViewer.java    From offspring with MIT License 5 votes vote down vote up
public AssetsViewer(Composite parent, INxtService nxt) {
  super(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE
      | SWT.BORDER);
  this.nxt = nxt;
  setGenericTable(new IGenericTable() {

    @Override
    public int getDefaultSortDirection() {
      return GenericComparator.ASSCENDING;
    }

    @Override
    public IGenericTableColumn getDefaultSortColumn() {
      return columnName;
    }

    @Override
    public IStructuredContentProvider getContentProvider() {
      return contentProvider;
    }

    @Override
    public IGenericTableColumn[] getColumns() {
      return new IGenericTableColumn[] { columnName, columnQuantity };
    }
  });
  refresh();
}
 
Example #27
Source File: BidOrdersViewer.java    From offspring with MIT License 5 votes vote down vote up
public BidOrdersViewer(Composite parent, INxtService nxt,
    IContactsService contactsService, IStylingEngine engine,
    IUserService userService, UISynchronize sync) {
  super(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE
      | SWT.BORDER);
  this.nxt = nxt;
  this.contactsService = contactsService;
  this.engine = engine;
  this.userService = userService;
  this.sync = sync;
  setGenericTable(new IGenericTable() {

    @Override
    public int getDefaultSortDirection() {
      return GenericComparator.DESCENDING;
    }

    @Override
    public IGenericTableColumn getDefaultSortColumn() {
      return columnPrice;
    }

    @Override
    public IStructuredContentProvider getContentProvider() {
      return contentProvider;
    }

    @Override
    public IGenericTableColumn[] getColumns() {
      return new IGenericTableColumn[] { columnTotal, columnPrice,
          columnQuantity, columnBuyer };
    }
  });
  refresh();
}
 
Example #28
Source File: MyBuyOrdersViewer.java    From offspring with MIT License 5 votes vote down vote up
public MyBuyOrdersViewer(Composite parent, INxtService nxt,
    IAssetExchange exchange, IUserService userService) {
  super(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE
      | SWT.BORDER);
  this.nxt = nxt;
  this.userService = userService;
  this.exchange = exchange;
  setGenericTable(new IGenericTable() {

    @Override
    public int getDefaultSortDirection() {
      return GenericComparator.DESCENDING;
    }

    @Override
    public IGenericTableColumn getDefaultSortColumn() {
      return columnPrice;
    }

    @Override
    public IStructuredContentProvider getContentProvider() {
      return contentProvider;
    }

    @Override
    public IGenericTableColumn[] getColumns() {
      return new IGenericTableColumn[] { columnPending, columnTotal,
          columnPrice, columnQuantity };
    }
  });
  setInput(1);
}
 
Example #29
Source File: PaginationContainer.java    From offspring with MIT License 5 votes vote down vote up
/**
 * The TableViewer is already constructed and uses this composite as it's
 * parent. This works because in the constructor we create all other children
 * of this composite so they will be rendered before the table viewer. You
 * dont need to set any layout data on the table viewer, this method will take
 * care of that.
 * 
 * @param viewer
 */
public void setTableViewer(ColumnViewer viewer, int pageSize) {
  this.viewer = viewer;
  IStructuredContentProvider inner = ((IGenericViewer) viewer)
      .getGenericTable().getContentProvider();

  if (inner instanceof IPageableStructeredContentProvider) {
    ((IPageableStructeredContentProvider) inner).setPageSize(pageSize);
  }

  contentProvider = new PaginatedContentProvider(this, inner, pageSize);
  viewer.setContentProvider(contentProvider);
  GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true)
      .span(5, 1).applyTo(viewer.getControl());
}
 
Example #30
Source File: BonitaPropertiesBrowserPage.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Gets the tab list content provider for the contributor.
 * 
 * @return the tab list content provider for the contributor.
 */
@Override
protected IStructuredContentProvider getTabListContentProvider() {
    if (registry instanceof TabbedPropertyRegistryViewAware) {
        return new TabListContentProviderViewAware((TabbedPropertyRegistryViewAware) registry, getViewID());
    } else {
        return super.getTabListContentProvider();
    }
}