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


Java AdapterFactoryEditingDomain.getEditingDomainFor方法代碼示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: 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

示例10: testGetEditingDomain

import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; //導入方法依賴的package包/類
@Test
public void testGetEditingDomain() {
	final TestElement leafSection = Create.testElement();
	final TestElement actor = Create.testElement();
	leafSection.getContainedElements().add(actor);

	new EMFStoreCommand() {
		@Override
		protected void doRun() {
			getProject().addModelElement(leafSection);
			clearOperations();
		}
	}.run(false);

	assertEquals(0, getProjectSpace().getOperations().size());

	final EditingDomain editingDomain = ESWorkspaceProviderImpl.getInstance().getEditingDomain();

	final EditingDomain domain1 = AdapterFactoryEditingDomain.getEditingDomainFor(actor);
	assertSame(editingDomain, domain1);
	assertNotNull(domain1);
	assertNotNull(editingDomain);
}
 
開發者ID:edgarmueller,項目名稱:emfstore-rest,代碼行數:24,代碼來源:CommandTest.java

示例11: 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 = GraphFactory.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:tesis-dynaware,項目名稱:graph-editor,代碼行數:31,代碼來源:JointCommands.java

示例12: replace

import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; //導入方法依賴的package包/類
private void replace ( final CompoundManager manager, final SingleValue v )
{
    if ( v instanceof ExternalValue )
    {
        return;
    }

    final EditingDomain domain = AdapterFactoryEditingDomain.getEditingDomainFor ( v );

    final Command command = ReplaceCommand.create ( domain, v.eContainer (), v.eContainmentFeature (), v, Collections.singletonList ( convert ( v ) ) );
    manager.append ( domain, command );
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:13,代碼來源:ConvertToExternalHandler.java

示例13: setMaster

import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; //導入方法依賴的package包/類
public void setMaster ( final MasterServer master, final MasterMode masterMode )
{
    final CompoundManager manager = new CompoundManager ();

    for ( final MasterAssigned v : SelectionHelper.iterable ( getSelection (), MasterAssigned.class ) )
    {
        final EditingDomain domain = AdapterFactoryEditingDomain.getEditingDomainFor ( v );
        if ( domain == null )
        {
            continue;
        }

        switch ( masterMode )
        {
            case ADD:
                manager.append ( domain, AddCommand.create ( domain, v, ComponentPackage.Literals.MASTER_ASSIGNED__MASTER_ON, master ) );
                break;
            case REPLACE:
                manager.append ( domain, SetCommand.create ( domain, v, ComponentPackage.Literals.MASTER_ASSIGNED__MASTER_ON, Collections.singletonList ( master ) ) );
                break;
            case DELETE:
                manager.append ( domain, RemoveCommand.create ( domain, v, ComponentPackage.Literals.MASTER_ASSIGNED__MASTER_ON, master ) );
                break;
        }
    }

    manager.executeAll ();
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:29,代碼來源:SetMasterHandler.java

示例14: flushCommandStack

import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; //導入方法依賴的package包/類
/**
 * Flushes the command stack, so that the undo/redo history is cleared.
 */
private void flushCommandStack() {

    final EditingDomain editingDomain = AdapterFactoryEditingDomain.getEditingDomainFor(graphEditor.getModel());
    if (editingDomain != null) {
        editingDomain.getCommandStack().flush();
    }
}
 
開發者ID:Heverton,項目名稱:grapheditor,代碼行數:11,代碼來源:GraphEditorDemoController.java

示例15: getEditingDomain

import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; //導入方法依賴的package包/類
/**
 * Gets the editing domain associated to the model.
 * 
 * <p>
 * Logs an error if none is found.
 * </p>
 * 
 * @param model a {@link GModel} instance
 * @return the {@link EditingDomain} associated to this model instance
 */
private static EditingDomain getEditingDomain(final GModel model) {

    final EditingDomain editingDomain = AdapterFactoryEditingDomain.getEditingDomainFor(model);

    if (editingDomain == null) {
        LOGGER.error(LogMessages.NO_EDITING_DOMAIN);
    }

    return editingDomain;
}
 
開發者ID:Heverton,項目名稱:grapheditor,代碼行數:21,代碼來源:Commands.java


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