use of org.eclipse.jface.fieldassist.IContentProposalProvider in project tdi-studio-se by Talend.
the class ExpressionCellEditor method createExpressionProposalProvider.
private ExpressionProposalProvider createExpressionProposalProvider() {
IContentProposalProvider[] contentProposalProviders = new IContentProposalProvider[0];
contentProposalProviders = new IContentProposalProvider[] { new TalendProposalProvider(mapperManager.getMapperComponent().getProcess()) };
ExpressionProposalProvider provider = new ExpressionProposalProvider(mapperManager, contentProposalProviders);
provider.init(source);
return provider;
}
use of org.eclipse.jface.fieldassist.IContentProposalProvider in project tdi-studio-se by Talend.
the class ExpressionProposalProvider method getProposals.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.fieldassist.IContentProposalProvider#getProposals(java.lang.String, int)
*/
public IContentProposal[] getProposals(String contents, int position) {
List<IContentProposal> proposals = new ArrayList<IContentProposal>();
TableEntryLocation sourceEntryLocation = new TableEntryLocation();
for (IDataMapTable table : this.tables) {
List<IColumnEntry> dataMapTableEntries = table.getColumnEntries();
for (IColumnEntry entrySource : dataMapTableEntries) {
sourceEntryLocation.tableName = entrySource.getParentName();
sourceEntryLocation.columnName = entrySource.getName();
if (mapperManager.getUiManager().checkSourceLocationIsValid(entrySource, currentModifiedEntry)) {
proposals.add(new EntryContentProposal(entrySource, this.currentLanguage));
}
}
// for the globalMap
if (table instanceof InputTable) {
InputTable inputTable = (InputTable) table;
List<GlobalMapEntry> globalMapEntries = inputTable.getGlobalMapEntries();
for (GlobalMapEntry entry : globalMapEntries) {
proposals.add(new EntryContentProposal(entry, this.currentLanguage));
}
}
}
for (IContentProposalProvider contentProposalProvider : otherContentProposalProviders) {
proposals.addAll(Arrays.asList(contentProposalProvider.getProposals(contents, position)));
}
IContentProposal[] res = new IContentProposal[proposals.size()];
res = proposals.toArray(res);
return res;
}
use of org.eclipse.jface.fieldassist.IContentProposalProvider in project tdi-studio-se by Talend.
the class SqlEditDialog method createEditorProposal.
/**
* Creates proposal for editor.
*/
private void createEditorProposal() {
try {
// create KeyStroke use Ctrl+Space as default
KeyStroke keyStroke = HotKeyUtil.getHotKey(HotKeyUtil.contentAssist);
IControlContentAdapter controlContentAdapter = new StyledTextContentAdapter();
IContentProposalProvider contentProposalProvider = new SQLEditorProposalProvider(repositoryNode, language);
SQLEditorProposalAdapter contentProposalAdapter = new SQLEditorProposalAdapter(colorText, controlContentAdapter, contentProposalProvider, keyStroke, new char[] { ' ', '.' });
contentProposalAdapter.setPropagateKeys(true);
contentProposalAdapter.setFilterStyle(ContentProposalAdapter.FILTER_CUMULATIVE);
contentProposalAdapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE);
contentProposalAdapter.setLabelProvider(new SQLEditorLabelProvider());
contentProposalAdapter.setAutoActivationDelay(10);
contentProposalAdapter.setPopupSize(new Point(300, 200));
} catch (Exception e) {
//$NON-NLS-1$
SqlBuilderPlugin.log(Messages.getString("SQLBuilderEditorComposite.logMessage"), e);
}
}
use of org.eclipse.jface.fieldassist.IContentProposalProvider in project tdi-studio-se by Talend.
the class ExpressionProposalProvider method getProposals.
@Override
public IContentProposal[] getProposals(String contents, int position) {
List<IContentProposal> proposals = new ArrayList<IContentProposal>();
proposals.addAll(proposalsInside);
for (IContentProposalProvider contentProposalProvider : otherContentProposalProviders) {
proposals.addAll(Arrays.asList(contentProposalProvider.getProposals(contents, position)));
}
IContentProposal[] res = new IContentProposal[proposals.size()];
res = proposals.toArray(res);
return res;
}
use of org.eclipse.jface.fieldassist.IContentProposalProvider in project tdi-studio-se by Talend.
the class DataMapTableView method initExpressionProposals.
/**
*
* Init proposals of Text control, and StyledText in tab "Expression editor".
*
* @param textControl
* @param zones
* @param tableViewerCreator
* @param currentModifiedEntry
*/
protected void initExpressionProposals(final TextCellEditorWithProposal textCellEditor, Zone[] zones, final TableViewerCreator tableViewerCreator, ITableEntry currentModifiedEntry) {
if (this.expressionProposalProvider == null) {
IContentProposalProvider[] contentProposalProviders = new IContentProposalProvider[0];
if (!MapperMain.isStandAloneMode()) {
contentProposalProviders = new IContentProposalProvider[] { // new ProcessProposalProvider(mapperManager.getComponent().getProcess())
new KeyWordProposalProvider("tsql", //$NON-NLS-1$ //$NON-NLS-2$
"KEYWORD1") };
}
this.expressionProposalProvider = new ExpressionProposalProvider(mapperManager, contentProposalProviders);
}
this.expressionProposalProvider.init(abstractDataMapTable, zones, currentModifiedEntry);
textCellEditor.setContentProposalProvider(this.expressionProposalProvider);
StyledTextHandler styledTextHandler = mapperManager.getUiManager().getTabFolderEditors().getStyledTextHandler();
styledTextHandler.getStyledText().setEnabled(true);
ContentProposalAdapterExtended expressionProposalStyledText = styledTextHandler.getContentProposalAdapter();
expressionProposalStyledText.setContentProposalProvider(this.expressionProposalProvider);
// System.out.println("init expression proposal:"+this.expressionProposal);
}
Aggregations