当前位置: 首页>>代码示例>>Java>>正文


Java IContentProposalListener类代码示例

本文整理汇总了Java中org.eclipse.jface.fieldassist.IContentProposalListener的典型用法代码示例。如果您正苦于以下问题:Java IContentProposalListener类的具体用法?Java IContentProposalListener怎么用?Java IContentProposalListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IContentProposalListener类属于org.eclipse.jface.fieldassist包,在下文中一共展示了IContentProposalListener类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: bindToViewModel

import org.eclipse.jface.fieldassist.IContentProposalListener; //导入依赖的package包/类
public void bindToViewModel(PatriciaTrie<ContentProposal> proposals, String[] sortedNames) {
	final TagListContentProposalProvider proposalProvider = new TagListContentProposalProvider(proposals);
	ContentProposalAdapter proposalAdapter = new ContentProposalAdapter(
			tagEntry, new ComboContentAdapter(), proposalProvider, null, null);
	proposalAdapter.setPropagateKeys(true);
	proposalAdapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE);

	proposalAdapter.addContentProposalListener(new IContentProposalListener() {

		@Override
		public void proposalAccepted(IContentProposal userSelectedProposal) {
			if (proposalProvider.getMakeNewProposal() == userSelectedProposal) {
				for (TagListSelectedEventHandler handler: eventHandlers) {
					handler.requestNewTag(userSelectedProposal.getContent());
					
					clearText();
				}
			}
			addTagInternal(userSelectedProposal.getContent());
		}

	});
	
	tagEntry.setItems(sortedNames);
}
 
开发者ID:sjclemen,项目名称:peten,代码行数:26,代码来源:TagListCombo.java

示例2: notifyProposalAccepted

import org.eclipse.jface.fieldassist.IContentProposalListener; //导入依赖的package包/类
private void notifyProposalAccepted(IContentProposal proposal) {
	if (DEBUG) {
		System.out.println("Notify listeners - proposal accepted."); //$NON-NLS-1$
	}
	final Object[] listenerArray = proposalListeners.getListeners();
	for (int i = 0; i < listenerArray.length; i++) {
		((IContentProposalListener) listenerArray[i])
				.proposalAccepted(proposal);
	}
}
 
开发者ID:Transkribus,项目名称:TranskribusSwtGui,代码行数:11,代码来源:MyContentProposalAdapter.java

示例3: createDecoration

import org.eclipse.jface.fieldassist.IContentProposalListener; //导入依赖的package包/类
/***************************************************************************
 * Create decoration for the input field
 **************************************************************************/
private void createDecoration()
{
	// Field decoration
	deco = new ControlDecoration(m_contents, SWT.RIGHT);
	deco.setDescriptionText("Use CTRL+Space to see the possible commands");
	deco.setImage(FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION)
	        .getImage());
	deco.setShowOnlyOnFocus(false);
	deco.setShowHover(true);

	KeyStroke keyStroke;
	ArrayList<String> possibleCommandsList = new ArrayList<String>();
	for (GuiExecutorCommand cmd : GuiExecutorCommand.values())
	{
		possibleCommandsList.add(cmd.label.toLowerCase());
	}
	String[] possibleCommands = possibleCommandsList.toArray(new String[0]);
	char[] autoActivationCharacters = new char[0];
	
	provider = new SimpleContentProposalProvider(possibleCommands);
	
	try
	{
		keyStroke = KeyStroke.getInstance("Ctrl+Space");
		adp = new ContentProposalAdapter(m_contents, new TextContentAdapter(), provider, keyStroke,
		        autoActivationCharacters);
		
		adp.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE);
		adp.addContentProposalListener((IContentProposalListener) m_contents.getParent().getParent());
	}
	catch (Exception ex)
	{
		ex.printStackTrace();
	}
}
 
开发者ID:Spacecraft-Code,项目名称:SPELL,代码行数:39,代码来源:PromptField.java

示例4: createContentProposalAdapter

import org.eclipse.jface.fieldassist.IContentProposalListener; //导入依赖的package包/类
/**
 * Set up content proposal provider for object text field.
 */
private void createContentProposalAdapter() {
	if (relationConfig != null) {
		try {
			KeyStroke keyStroke = KeyStroke.getInstance("Ctrl+Space");
			contentProposalAdapter = new ContentProposalAdapter(
					text,
					new TextContentAdapter(),
					new ObjectSelectionProposalProvider(
							generalObjectController, relationConfig, corpusObject),
					keyStroke,
					null);
			contentProposalAdapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE);
			contentProposalAdapter.addContentProposalListener(new IContentProposalListener() {
				@Override
				public void proposalAccepted(IContentProposal proposal) {
					Command command = SetCommand.create(
							getEditingDomain(),
							relation,
							BtsmodelPackage.eINSTANCE.getBTSRelation_ObjectId(),
							proposal.getContent());
					getEditingDomain().getCommandStack().execute(
							command);
					text.setToolTipText(proposal.getLabel());
					text.setText(proposal.getLabel());
				}
			});
			// add decorator to textfield explaining all of this
			textFieldInfoDeco = new ControlDecoration(text,
					SWT.BOTTOM | SWT.LEFT);
			// re-use an existing image
			Image image = FieldDecorationRegistry
					.getDefault()
					.getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION)
					.getImage();
			// set description and image
			textFieldInfoDeco.setDescriptionText("Hit Ctrl+Space for content assist.");
			textFieldInfoDeco.setImage(image);
			textFieldInfoDeco.hide();
		} catch (ParseException e1) {
			e1.printStackTrace();
		}
	}
}
 
开发者ID:cplutte,项目名称:bts,代码行数:47,代码来源:RelationEditorComposite.java

示例5: createDialogArea

import org.eclipse.jface.fieldassist.IContentProposalListener; //导入依赖的package包/类
@Override
protected Control createDialogArea(Composite parent){
	setTitle("Angaben zur Impfung ändern");
	setTitleImage(ResourceManager.getPluginImage("at.medevit.elexis.impfplan.ui",
		"rsc/icons/vaccination_logo.png"));
	Patient sp = ElexisEventDispatcher.getSelectedPatient();
	setMessage((sp!=null) ? sp.getLabel() : "missing patient name"); //$NON-NLS-1$
	
	Composite area = (Composite) super.createDialogArea(parent);
	Composite container = new Composite(area, SWT.NONE);
	container.setLayout(new GridLayout(2, false));
	container.setLayoutData(new GridData(GridData.FILL_BOTH));
	
	Label lblAdministratingContact = new Label(container, SWT.NONE);
	lblAdministratingContact
		.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
	lblAdministratingContact.setText("Verabreicht von");
	
	txtAdministrator = new Text(container, SWT.BORDER);
	administratorString = vacc.get(Vaccination.FLD_ADMINISTRATOR);
	txtAdministrator.setText(vacc.getAdministratorLabel());
	txtAdministrator.addModifyListener(new ModifyListener() {
		public void modifyText(ModifyEvent e){
			administratorString = txtAdministrator.getText();
		}
	});
	txtAdministrator.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	PersistentObjectProposalProvider<Mandant> mopp =
		new PersistentObjectProposalProvider<Mandant>(Mandant.class) {
			@Override
			public String getLabelForObject(Mandant a){
				return a.getMandantLabel();
			}
		};
		
	ContentProposalAdapter mandatorProposalAdapter = new ContentProposalAdapter(
		txtAdministrator, new TextContentAdapter(), mopp, null, null);
	mandatorProposalAdapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE);
	mandatorProposalAdapter.addContentProposalListener(new IContentProposalListener() {
		
		@Override
		public void proposalAccepted(IContentProposal proposal){
			PersistentObjectContentProposal<Mandant> prop =
				(PersistentObjectContentProposal<Mandant>) proposal;
			administratorString = prop.getPersistentObject().storeToString();
		}
	});
	
	Label lblLotNo = new Label(container, SWT.NONE);
	lblLotNo.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
	lblLotNo.setText("Lot-Nr");
	
	txtLotNo = new Text(container, SWT.BORDER);
	txtLotNo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
	txtLotNo.setText(vacc.getLotNo());
	
	Label lblVerabreichungsdatum = new Label(container, SWT.NONE);
	lblVerabreichungsdatum
		.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
	lblVerabreichungsdatum.setAlignment(SWT.RIGHT);
	lblVerabreichungsdatum.setText("Verabreichungsdatum");
	
	dateTimeDOA = new DateTime(container, SWT.BORDER);
	TimeTool doa = vacc.getDateOfAdministration();
	dateTimeDOA.setDate(doa.get(Calendar.YEAR), doa.get(Calendar.MONTH),
		doa.get(Calendar.DAY_OF_MONTH));
		
	if(vacc.get(Vaccination.FLD_ARTIKEL_REF).length()==0) {
		// nachtragsimpfung mit formal unbekanntem artikel
		Label lblImpfungGegen = new Label(container, SWT.NONE);
		lblImpfungGegen.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, false, 1, 1));
		lblImpfungGegen.setAlignment(SWT.RIGHT);
		lblImpfungGegen.setText("Impfung gegen");
		
		vect = new VaccinationEffectCheckboxTreeViewer(container, SWT.BORDER,
			vacc.get(Vaccination.FLD_VACC_AGAINST));
		vect.getTree().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
	}
	
	return area;
}
 
开发者ID:elexis,项目名称:elexis-3-base,代码行数:82,代码来源:EditVaccinationDialog.java

示例6: addContentProposalListener

import org.eclipse.jface.fieldassist.IContentProposalListener; //导入依赖的package包/类
/**
 * Add the specified listener to the list of content proposal listeners that
 * are notified when content proposals are chosen.
 * </p>
 * 
 * @param listener
 *            the IContentProposalListener to be added as a listener. Must
 *            not be <code>null</code>. If an attempt is made to register
 *            an instance which is already registered with this instance,
 *            this method has no effect.
 * 
 * @see org.eclipse.jface.fieldassist.IContentProposalListener
 */
public void addContentProposalListener(IContentProposalListener listener) {
	proposalListeners.add(listener);
}
 
开发者ID:Transkribus,项目名称:TranskribusSwtGui,代码行数:17,代码来源:MyContentProposalAdapter.java

示例7: removeContentProposalListener

import org.eclipse.jface.fieldassist.IContentProposalListener; //导入依赖的package包/类
/**
 * Removes the specified listener from the list of content proposal
 * listeners that are notified when content proposals are chosen.
 * </p>
 * 
 * @param listener
 *            the IContentProposalListener to be removed as a listener. Must
 *            not be <code>null</code>. If the listener has not already
 *            been registered, this method has no effect.
 * 
 * @since 3.3
 * @see org.eclipse.jface.fieldassist.IContentProposalListener
 */
public void removeContentProposalListener(IContentProposalListener listener) {
	proposalListeners.remove(listener);
}
 
开发者ID:Transkribus,项目名称:TranskribusSwtGui,代码行数:17,代码来源:MyContentProposalAdapter.java

示例8: addProposalSelectedListener

import org.eclipse.jface.fieldassist.IContentProposalListener; //导入依赖的package包/类
/**
 * Add the specified listener to the list of content proposal listeners that
 * are notified when content proposals are chosen.
 * </p>
 * 
 * @param listener
 *            the IContentProposalListener to be added as a listener. Must
 *            not be <code>null</code>. If an attempt is made to register
 *            an instance which is already registered with this instance,
 *            this method has no effect.

 */
public void addProposalSelectedListener(IContentProposalListener listener){
	adapter.addContentProposalListener(listener);
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:16,代码来源:ManualyOpenedAutocomplete.java


注:本文中的org.eclipse.jface.fieldassist.IContentProposalListener类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。