當前位置: 首頁>>代碼示例>>Java>>正文


Java AdapterFactoryEditingDomain.getAdapterFactory方法代碼示例

本文整理匯總了Java中org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain.getAdapterFactory方法的典型用法代碼示例。如果您正苦於以下問題:Java AdapterFactoryEditingDomain.getAdapterFactory方法的具體用法?Java AdapterFactoryEditingDomain.getAdapterFactory怎麽用?Java AdapterFactoryEditingDomain.getAdapterFactory使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain的用法示例。


在下文中一共展示了AdapterFactoryEditingDomain.getAdapterFactory方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getAdapterFactory

import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; //導入方法依賴的package包/類
public static AdapterFactory getAdapterFactory(Object object) {
	EditingDomain domain = null;
	if (object instanceof EditingDomain) {
		domain = (EditingDomain) object;
	} else {
		domain = AdapterFactoryEditingDomain.getEditingDomainFor(object);
	}
	if (domain instanceof AdapterFactoryEditingDomain) {
		AdapterFactoryEditingDomain aDomain = (AdapterFactoryEditingDomain) domain;
		AdapterFactory adapterFactory = aDomain.getAdapterFactory();
		if (adapterFactory != null) {
			return adapterFactory;
		}
	}
	return new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
}
 
開發者ID:nasa,項目名稱:OpenSPIFe,代碼行數:17,代碼來源:EMFUtils.java

示例2: isCompatibleWith

import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; //導入方法依賴的package包/類
@Override
public boolean isCompatibleWith(Object object, Object anotherObject, IItemPropertyDescriptor otherPD) {
	if (otherPD == this) {
		return true;
    } else {
    	EditingDomain domain = AdapterFactoryEditingDomain.getEditingDomainFor(anotherObject);
		if (domain instanceof AdapterFactoryEditingDomain) {
			AdapterFactoryEditingDomain thisDomain = (AdapterFactoryEditingDomain) domain;
			AdapterFactory thisAdapterFactory = thisDomain.getAdapterFactory();
			AdapterFactoryEditingDomain otherDomain = (AdapterFactoryEditingDomain) AdapterFactoryEditingDomain.getEditingDomainFor(object);
			AdapterFactory otherAdapterFactory = otherDomain == null ? null : otherDomain.getAdapterFactory();
			if (otherAdapterFactory == thisAdapterFactory 
					&& CommonUtils.equals(this.getDisplayName(object), otherPD.getDisplayName(anotherObject)) 
		            		&& CommonUtils.equals(this.getCategory(object), otherPD.getCategory(anotherObject)))
			{
				return true;
			}
		}
    }
	return false;
}
 
開發者ID:nasa,項目名稱:OpenSPIFe,代碼行數:22,代碼來源:CompatibleItemPropertyDescriptor.java

示例3: initializeEditingDomain

import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; //導入方法依賴的package包/類
protected void initializeEditingDomain(AdapterFactoryEditingDomain editingDomain) {

		this.editingDomain = editingDomain;
		this.adapterFactory = editingDomain.getAdapterFactory();

		refreshListener = new CommandStackListener() {
			public void commandStackChanged(final EventObject event) {
				getContainer().getDisplay().asyncExec(new Runnable() {
					public void run() {
						firePropertyChange(IEditorPart.PROP_DIRTY);

						// Try to select the affected objects.
						//
						Command mostRecentCommand = ((CommandStack) event.getSource()).getMostRecentCommand();
						if (mostRecentCommand != null) {
							setSelectionToViewer(mostRecentCommand.getAffectedObjects());
						}
						for (Iterator<PropertySheetPage> i = propertySheetPages.iterator(); i.hasNext();) {
							PropertySheetPage propertySheetPage = i.next();
							if (propertySheetPage.getControl().isDisposed()) {
								i.remove();
							} else {
								propertySheetPage.refresh();
							}
						}
					}
				});
			}
		};

		commandStack = editingDomain.getCommandStack();
		commandStack.addCommandStackListener(refreshListener);

	}
 
開發者ID:mondo-project,項目名稱:mondo-demo-wt,代碼行數:35,代碼來源:WTSpec4MEditor.java

示例4: hideStartAndEndTimes

import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; //導入方法依賴的package包/類
/**
 * Add an adapter factory to the AdapterFactoryEditingDomain if it is a ComposedAdapterFactory
 * Auxiliary to getTemporaryEPlan() to help initialize its return value.
 * Re-implemented to exclude startTime and endTime property descriptors.
 * @param tempPlan the plan returned by getTemporaryEPlan()
 */
private void hideStartAndEndTimes(EPlan tempPlan) {
	TransactionalEditingDomain editingDomain = TransactionUtils.getDomain(tempPlan);
	AdapterFactoryEditingDomain adapterFactoryEditingDomain = (AdapterFactoryEditingDomain)editingDomain;
	AdapterFactory f = adapterFactoryEditingDomain.getAdapterFactory();
	if (f instanceof ComposedAdapterFactory) {
	       final ComposedAdapterFactory factory = (ComposedAdapterFactory) f;
	       factory.addAdapterFactory(new TemporalItemProviderAdapterFactory() {
			@Override
			protected Adapter createAdapter(final Notifier target, Object type) {
				Adapter adapter = null;
				if(target instanceof TemporalMember) {
					adapter = new TemporalMemberItemProvider(factory) {
						@Override
						public List<IItemPropertyDescriptor> getPropertyDescriptors(Object target) {
							if (itemPropertyDescriptors == null) {
								List<IItemPropertyDescriptor> propertyDescriptors = super.getPropertyDescriptors(target);
								List<IItemPropertyDescriptor> itemsToRemove = new ArrayList<IItemPropertyDescriptor>();
								for(IItemPropertyDescriptor propertyDescriptor : propertyDescriptors) {
									Object feature = propertyDescriptor.getFeature(target);
									if(feature == TemporalPackage.Literals.TEMPORAL_MEMBER__START_TIME
											|| feature == TemporalPackage.Literals.TEMPORAL_MEMBER__END_TIME) {
										itemsToRemove.add(propertyDescriptor);
									}
								}
								itemPropertyDescriptors.removeAll(itemsToRemove);
							}
							return itemPropertyDescriptors;
						}
					};
				} else {
					adapter = super.createAdapter(target, type);
				}

				return adapter;
			}  
	     });
	}
}
 
開發者ID:nasa,項目名稱:OpenSPIFe,代碼行數:45,代碼來源:TemplatePlanElementEditor.java

示例5: PlanTimelineContentProvider

import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; //導入方法依賴的package包/類
public PlanTimelineContentProvider(EPlan plan) {
	super();
	this.plan = plan;
	EditingDomain domain = AdapterFactoryEditingDomain.getEditingDomainFor(plan);
	AdapterFactoryEditingDomain d = (AdapterFactoryEditingDomain) domain;
	this.adapterFactory = d.getAdapterFactory();
}
 
開發者ID:nasa,項目名稱:OpenSPIFe,代碼行數:8,代碼來源:PlanTimelineContentProvider.java


注:本文中的org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain.getAdapterFactory方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。