本文整理汇总了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);
}
示例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;
}
示例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);
}
示例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;
}
});
}
}
示例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();
}