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


Java AdapterFactoryEditingDomain类代码示例

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


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

示例1: getFragmentedPackageList

import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; //导入依赖的package包/类
/**
 * 
 * 모델에 포함된 단편화 패키지 목록을 반환 한다.
 *  
 * @param model
 * @return TreeMap<String,Package>
 */
public static TreeMap<String, Package> getFragmentedPackageList(Package model) {

    TreeMap<String, Package> packageList = new TreeMap<String, Package>();

    SELECT statement = new SELECT(new FROM(model),
        new WHERE(new EObjectTypeRelationCondition(UMLPackage.eINSTANCE.getPackage())));
    IQueryResult result = statement.execute();

    for (Iterator<?> ir = result.iterator(); ir.hasNext();) {
        Package pkg = (Package) ir.next();

        if (pkg == null || pkg.getQualifiedName() == null) {
            continue;
        }
        if (AdapterFactoryEditingDomain.isControlled(pkg)) {
            packageList.put(pkg.getQualifiedName(), pkg);
            continue;
        }
    }

    return packageList;
 }
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:30,代码来源:ProjectUtil.java

示例2: getFragmentPackages

import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; //导入依赖的package包/类
public static TreeMap<String, Package> getFragmentPackages(final Model model) {

        TreeMap<String, Package> packageList = new TreeMap<String, Package>();

        SELECT statement = new SELECT(new FROM(model),
            new WHERE(new EObjectTypeRelationCondition(UMLPackage.eINSTANCE.getPackage())));
        IQueryResult result = statement.execute();

        for (Iterator<?> ir = result.iterator(); ir.hasNext();) {
            Package pkg = (Package) ir.next();

            if (pkg == null || pkg.getQualifiedName() == null) {
                continue;
            }
            if (AdapterFactoryEditingDomain.isControlled(pkg)) {
                packageList.put(String.format("%s_%s", pkg.getQualifiedName(), EcoreUtil.getURI(pkg).fragment()), pkg);
                continue;
            }
        }

        return packageList;
    }
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:23,代码来源:ModelInformationUtil.java

示例3: execute

import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; //导入依赖的package包/类
@Override
public Object execute ( final ExecutionEvent event ) throws ExecutionException
{

    final IEditorPart editor = getActivePage ().getActiveEditor ();

    byte b = (byte)1;
    for ( final Attribute attribute : SelectionHelper.iterable ( getSelection (), Attribute.class ) )
    {
        EditingDomain domain = AdapterFactoryEditingDomain.getEditingDomainFor ( attribute );

        if ( domain == null && editor instanceof IEditingDomainProvider )
        {
            domain = ( (IEditingDomainProvider)editor ).getEditingDomain ();
        }

        SetCommand.create ( domain, attribute, ProtocolPackage.Literals.ATTRIBUTE__FIELD_NUMBER, b ).execute ();

        b++;
    }

    return null;
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:24,代码来源:FillFieldNumbersHandler.java

示例4: PreviewEditorImpl

import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; //导入依赖的package包/类
public PreviewEditorImpl ()
{
    this.adapterFactory = new ComposedAdapterFactory ( ComposedAdapterFactory.Descriptor.Registry.INSTANCE );
    this.adapterFactory.addAdapterFactory ( new ResourceItemProviderAdapterFactory () );
    this.adapterFactory.addAdapterFactory ( new ReflectiveItemProviderAdapterFactory () );

    final BasicCommandStack commandStack = new BasicCommandStack ();

    this.editingDomain = new AdapterFactoryEditingDomain ( this.adapterFactory, commandStack, new HashMap<Resource, Boolean> () );

    this.factoryContext = new FactoryContext () {

        @Override
        public void loadedResource ( final URI uri )
        {
            handleLoadedResource ( uri );
        }
    };

    ResourcesPlugin.getWorkspace ().addResourceChangeListener ( this.resourceChangeListener, IResourceChangeEvent.POST_CHANGE );
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:22,代码来源:PreviewEditorImpl.java

示例5: setConnection

import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; //导入依赖的package包/类
public void setConnection ( final Driver driver )
{
    final CompoundManager manager = new CompoundManager ();

    for ( final ExternalValue v : SelectionHelper.iterable ( getSelection (), ExternalValue.class ) )
    {
        final EditingDomain domain = AdapterFactoryEditingDomain.getEditingDomainFor ( v );
        if ( domain == null )
        {
            continue;
        }
        manager.append ( domain, SetCommand.create ( domain, v, ComponentPackage.Literals.EXTERNAL_VALUE__CONNECTION, driver ) );
    }

    manager.executeAll ();
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:17,代码来源:SetConnectionHandler.java

示例6: setExternalName

import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; //导入依赖的package包/类
public void setExternalName ( final CompiledScript script ) throws Exception
{
    final CompoundManager manager = new CompoundManager ();

    for ( final ExternalValue v : SelectionHelper.iterable ( this.selection, ExternalValue.class ) )
    {
        final EditingDomain domain = AdapterFactoryEditingDomain.getEditingDomainFor ( v );
        if ( domain == null )
        {
            continue;
        }
        final String name = evalName ( script, v );
        manager.append ( domain, SetCommand.create ( domain, v, ComponentPackage.Literals.EXTERNAL_VALUE__SOURCE_NAME, name ) );
    }

    manager.executeAll ();
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:18,代码来源:SetExternalNameWizard.java

示例7: saveModel

import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; //导入依赖的package包/类
/**
 * Saves the graph editor's model state in the given file.
 *
 * @param file the {@link File} the model state will be saved in
 * @param model the {@link GModel} to be saved
 */
private void saveModel(final File file, final GModel model) {

    String absolutePath = file.getAbsolutePath();
    if (!absolutePath.endsWith(FILE_EXTENSION)) {
        absolutePath += FILE_EXTENSION;
    }

    final EditingDomain editingDomain = AdapterFactoryEditingDomain.getEditingDomainFor(model);

    final URI fileUri = URI.createFileURI(absolutePath);
    final XMIResourceFactoryImpl resourceFactory = new XMIResourceFactoryImpl();
    final Resource resource = resourceFactory.createResource(fileUri);
    resource.getContents().add(model);

    try {
        resource.save(Collections.EMPTY_MAP);
    } catch (final IOException e) {
        e.printStackTrace();
    }

    editingDomain.getResourceSet().getResources().clear();
    editingDomain.getResourceSet().getResources().add(resource);

    initialDirectory = file.getParentFile();
}
 
开发者ID:Heverton,项目名称:grapheditor,代码行数:32,代码来源:GraphEditorPersistence.java

示例8: allocateIds

import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; //导入依赖的package包/类
/**
 * Allocates ID's to recently pasted nodes.
 * 
 * @param nodes the recently pasted nodes
 * @param command the command responsible for adding the nodes
 */
private void allocateIds(final List<GNode> nodes, final CompoundCommand command) {

    final EditingDomain domain = AdapterFactoryEditingDomain.getEditingDomainFor(graphEditor.getModel());
    final EAttribute feature = ModelPackage.Literals.GNODE__ID;

    for (final GNode node : nodes) {

        if (checkNeedsNewId(node, nodes)) {

            final String id = allocateNewId();
            final Command setCommand = SetCommand.create(domain, node, feature, id);

            if (setCommand.canExecute()) {
                command.appendAndExecute(setCommand);
            }

            graphEditor.getSkinLookup().lookupNode(node).initialize();
        }
    }
}
 
开发者ID:Heverton,项目名称:grapheditor,代码行数:27,代码来源:TitledSkinController.java

示例9: setNewJoints

import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; //导入依赖的package包/类
/**
 * Removes any existing joints from the connection and creates a new set of joints at the given positions.
 *
 * <p>
 * This is executed as a single compound command and is therefore a single element in the undo-redo stack.
 * </p>
 *
 * @param positions a list of {@link Point2D} instances speciying the x and y positions of the new joints
 * @param connection the connection in which the joints will be set
 */
public static void setNewJoints(final List<Point2D> positions, final GConnection connection) {

    final EditingDomain editingDomain = AdapterFactoryEditingDomain.getEditingDomainFor(connection);
    final CompoundCommand command = new CompoundCommand();

    command.append(RemoveCommand.create(editingDomain, connection, JOINTS, connection.getJoints()));

    for (final Point2D position : positions) {

        final GJoint newJoint = ModelFactory.eINSTANCE.createGJoint();
        newJoint.setX(position.getX());
        newJoint.setY(position.getY());

        command.append(AddCommand.create(editingDomain, connection, JOINTS, newJoint));
    }

    if (command.canExecute()) {
        editingDomain.getCommandStack().execute(command);
    }
}
 
开发者ID:Heverton,项目名称:grapheditor,代码行数:31,代码来源:JointCommands.java

示例10: removeConnection

import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; //导入依赖的package包/类
/**
 * Removes a connection from the model.
 *
 * @param model the {@link GModel} from which the connection should be removed
 * @param connection the {@link GConnection} to be removed
 * @return the newly-executed {@link CompoundCommand} that removed the connection
 */
public static CompoundCommand removeConnection(final GModel model, final GConnection connection) {

    final EditingDomain editingDomain = AdapterFactoryEditingDomain.getEditingDomainFor(model);

    if (editingDomain != null) {
        final CompoundCommand command = new CompoundCommand();

        final GConnector source = connection.getSource();
        final GConnector target = connection.getTarget();

        command.append(RemoveCommand.create(editingDomain, model, CONNECTIONS, connection));
        command.append(RemoveCommand.create(editingDomain, source, CONNECTOR_CONNECTIONS, connection));
        command.append(RemoveCommand.create(editingDomain, target, CONNECTOR_CONNECTIONS, connection));

        if (command.canExecute()) {
            editingDomain.getCommandStack().execute(command);
        }
        return command;

    } else {
        return null;
    }
}
 
开发者ID:Heverton,项目名称:grapheditor,代码行数:31,代码来源:ConnectionCommands.java

示例11: addPastedElements

import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; //导入依赖的package包/类
/**
 * Adds the pasted elements to the graph editor via a single EMF command.
 *
 * @param pastedNodes the pasted nodes to be added
 * @param pastedConnections the pasted connections to be added
 * @param consumer a consumer to allow custom commands to be appended to the paste command
 */
private void addPastedElements(final List<GNode> pastedNodes, final List<GConnection> pastedConnections,
        final BiConsumer<List<GNode>, CompoundCommand> consumer) {

    final EditingDomain editingDomain = AdapterFactoryEditingDomain.getEditingDomainFor(model);
    final CompoundCommand command = new CompoundCommand();

    for (final GNode pastedNode : pastedNodes) {
        command.append(AddCommand.create(editingDomain, model, NODES, pastedNode));
    }

    for (final GConnection pastedConnection : pastedConnections) {
        command.append(AddCommand.create(editingDomain, model, CONNECTIONS, pastedConnection));
    }

    if (command.canExecute()) {
        editingDomain.getCommandStack().execute(command);
    }

    if (consumer != null) {
        consumer.accept(pastedNodes, command);
    }

}
 
开发者ID:Heverton,项目名称:grapheditor,代码行数:31,代码来源:SelectionCopier.java

示例12: removeFragmentResource

import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; //导入依赖的package包/类
/**
     * 
     * 
     *  
     * @param parentResource void
     */
    public void removeFragmentResource(Resource parentResource) {
        EList<EObject> contents = parentResource.getContents();
        if (contents != null && contents.size() > 0) {
            EObject eobject = contents.get(0);

            if (!AdapterFactoryEditingDomain.isControlled(eobject)) {
                EAnnotation eAnnotation = getFragmentAnnotation(eobject);
                if (eAnnotation == null)
                    return;
                EList<EObject> references = eAnnotation.getReferences();
                for (EObject reference : references) {
                    if (reference != null && reference.eResource() != null) {
//                        removeResource(reference.eResource());
                        ResourceUnloader.getInstance().put(reference.eResource());
                    }
                }
            }
        }
    }
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:26,代码来源:ResourceManager.java

示例13: packageFragmentOfResource

import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; //导入依赖的package包/类
/**
 * 
 * 리소스에 포함된 단편 개수 void
 */
public static TreeMap<String, Package> packageFragmentOfResource(Resource resource) {
    
    Model model = (org.eclipse.uml2.uml.Model) EcoreUtil.getObjectByType(resource.getContents(),
        UMLPackage.Literals.MODEL);

    TreeMap<String, Package> packageList = new TreeMap<String, Package>();

    if (model == null)
        return packageList;

    SELECT statement = new SELECT(new FROM(model),
        new WHERE(new EObjectTypeRelationCondition(UMLPackage.eINSTANCE.getPackage())));
    IQueryResult result = statement.execute();

    for (Iterator<?> ir = result.iterator(); ir.hasNext();) {
        Package pkg = (Package) ir.next();

        if (pkg == null || pkg.getQualifiedName() == null) {
            continue;
        }
        if (AdapterFactoryEditingDomain.isControlled(pkg)) {
            packageList.put(String.format("%s_%s", pkg.getQualifiedName(), EcoreUtil.getURI(pkg).fragment()), pkg);
        }
    }

    return packageList;
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:32,代码来源:ModelInformationUtil.java

示例14: createEditingDomain

import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; //导入依赖的package包/类
private void createEditingDomain() {
	// Create an adapter factory that yields item providers.
	//
	ComposedAdapterFactory adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE);

	adapterFactory.addAdapterFactory(new ResourceItemProviderAdapterFactory());
	adapterFactory.addAdapterFactory(new BibtexItemProviderAdapterFactory());
	adapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory());

	// Create the command stack that will notify this editor as commands are
	// executed.
	//
	BasicCommandStack commandStack = new BasicCommandStack();

	// Create the editing domain with a special command stack.
	//
	sharedEditingDomain = new AdapterFactoryEditingDomain(adapterFactory,commandStack, new HashMap<Resource, Boolean>());
}
 
开发者ID:sebastiangoetz,项目名称:slr-toolkit,代码行数:19,代码来源:ModelRegistry.java

示例15: getIcon

import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; //导入依赖的package包/类
/**
 * Get the corresponding icon for the given plan element,
 * regardless of type.
 * @param pe
 * @return
 */
public static Image getIcon(EPlanElement pe) {
	if (pe != null) {
		TransactionalEditingDomain domain = TransactionUtils.getDomain(pe);
		if (domain != null) {
			AdapterFactory factory = ((AdapterFactoryEditingDomain)domain).getAdapterFactory();
			if (factory != null) {
				ILabelProvider lp = (ILabelProvider) factory.adapt(pe, ILabelProvider.class);
				if (lp != null) {
					Image image = lp.getImage(pe);
					lp.dispose();
					return image;
				}
			}
		}
	}
	return null;
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:24,代码来源:PlanUtils.java


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