Java源码示例:org.eclipse.emf.edit.domain.EditingDomain

示例1
private Command refactorGroup(Group oldGroup, Group newGroup, Configuration configuration,
        EditingDomain editingDomain) {
    CompoundCommand cc = new CompoundCommand();
    for (ActorMapping ac : configuration.getActorMappings().getActorMapping()) {
        final Groups groups = ac.getGroups();
        if (groups != null) {
            if (groups.getGroup().contains(GroupContentProvider.getGroupPath(oldGroup))) {
                cc.appendIfCanExecute(RemoveCommand.create(editingDomain, groups,
                        ActorMappingPackage.Literals.GROUPS__GROUP, GroupContentProvider.getGroupPath(oldGroup)));
                cc.appendIfCanExecute(AddCommand.create(editingDomain, groups,
                        ActorMappingPackage.Literals.GROUPS__GROUP, GroupContentProvider.getGroupPath(newGroup)));
                //                    cc.append(new ReplaceCommand(editingDomain, groups.getGroup(), GroupContentProvider.getGroupPath(oldGroup),
                //                            GroupContentProvider.getGroupPath(newGroup)));
            }
        }
    }
    return cc;
}
 
示例2
private void addNewKPIConnectorDefinition(Configuration configuration, AbstractProcess process, CompoundCommand cc,	EditingDomain editingDomain) {
	final List<DatabaseKPIBinding> kpiBindings = ModelHelper.getAllItemsOfType(process, KpiPackage.Literals.DATABASE_KPI_BINDING) ;
	if(!kpiBindings.isEmpty()){
		final String defId = DB_CONNECTOR_FOR_KPI_ID ;
		final String defVersion = DB_CONNECTOR_VERSION ;
		boolean exists = false ;
		for(final DefinitionMapping association : configuration.getDefinitionMappings()){
			if(FragmentTypes.CONNECTOR.equals(association.getType()) && association.getDefinitionId().equals(defId) && association.getDefinitionVersion().equals(defVersion)){
				exists = true ;
				updateAssociation(configuration,association,cc,editingDomain);
				break ;
			}
		}
		if(!exists){
			final DefinitionMapping newAssociation = ConfigurationFactory.eINSTANCE.createDefinitionMapping() ;
			newAssociation.setDefinitionId(defId) ;
			newAssociation.setDefinitionVersion(defVersion) ;
			newAssociation.setType(getFragmentContainerId()) ;
			editingDomain.getCommandStack().execute(AddCommand.create(editingDomain, configuration, ConfigurationPackage.Literals.CONFIGURATION__DEFINITION_MAPPINGS, newAssociation)) ;
			updateAssociation(configuration, newAssociation, cc, editingDomain) ;
		}
	}
}
 
示例3
/**
 * 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);
    }

}
 
示例4
/**
 * 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();
}
 
示例5
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 ();
}
 
示例6
/**
 * Updates the {@link Generation#getTemplateFileName() template URI}.
 * 
 * @param gen
 *            the {@link Generation}
 * @param templateURI
 *            the new {@link Generation#getTemplateFileName() template URI}
 */
private void updateTemplateURI(Generation gen, final URI templateURI) {
    final URI genconfURI = gen.eResource().getURI();
    final String relativeTemplatePath;
    if (!templateURI.isPlatformPlugin()) {
        relativeTemplatePath = URI.decode(templateURI.deresolve(genconfURI).toString());
    } else {
        relativeTemplatePath = URI.decode(templateURI.toString());
    }
    final EditingDomain editingDomain = TransactionUtil.getEditingDomain(gen);
    templateCustomProperties = validatePage(gen,
            GenconfUtils.getResolvedURI(gen, URI.createURI(gen.getTemplateFileName(), false)));
    editingDomain.getCommandStack().execute(SetCommand.create(editingDomain, gen,
            GenconfPackage.Literals.GENERATION__TEMPLATE_FILE_NAME, relativeTemplatePath));
    if (gen.getResultFileName() == null || gen.getResultFileName().isEmpty()) {
        editingDomain.getCommandStack()
                .execute(SetCommand.create(editingDomain, gen, GenconfPackage.Literals.GENERATION__RESULT_FILE_NAME,
                        relativeTemplatePath.replace("." + M2DocUtils.DOCX_EXTENSION_FILE, "-generated.docx")));
    }
    if (gen.getValidationFileName() == null || gen.getValidationFileName().isEmpty()) {
        editingDomain.getCommandStack()
                .execute(SetCommand.create(editingDomain, gen,
                        GenconfPackage.Literals.GENERATION__VALIDATION_FILE_NAME,
                        relativeTemplatePath.replace("." + M2DocUtils.DOCX_EXTENSION_FILE, "-validation.docx")));
    }
}
 
示例7
protected void updateJarDependencies(final FragmentContainer connectorContainer, final ConnectorImplementation implementation,
        final EditingDomain editingDomain, final CompoundCommand cc, final boolean forceDriver) {
    for (final String jar : jarDependencies(implementation)) {
        boolean exists = false;
        for (final Fragment dep : connectorContainer.getFragments()) {
            if (dep.getValue().equals(jar)) {
                exists = true;
                break;
            }
        }
        if (!exists) {
            final Fragment depFragment = ConfigurationFactory.eINSTANCE.createFragment();
            depFragment.setExported(true);
            depFragment.setKey(implementation.getImplementationId() + " -- " + implementation.getImplementationVersion());
            depFragment.setValue(jar);
            depFragment.setType(getFragmentContainerId());
            editingDomain.getCommandStack().execute(
                    AddCommand.create(editingDomain, connectorContainer, ConfigurationPackage.Literals.FRAGMENT_CONTAINER__FRAGMENTS, depFragment));
        }
    }
}
 
示例8
public static Diagram getDiagramFor(final EObject element, EditingDomain domain) {
    if (element == null) {
        return null;
    }
    Resource resource = element.eResource();
    if (resource == null) {
        if (domain == null) {
            domain = TransactionUtil.getEditingDomain(element);
            if (domain != null) {
                resource = domain.getResourceSet().getResource(element.eResource().getURI(), true);
            }
        } else if (domain.getResourceSet() != null) {
            resource = domain.getResourceSet().getResource(element.eResource().getURI(), true);
        }
    }
    if (resource == null) {
        throw new IllegalStateException(String.format("No resource attached to EObject %s", element));
    }
    return getDiagramFor(element, resource);
}
 
示例9
private Command refactorUsername(final User oldUser, final User newUser,
        final Configuration configuration, EditingDomain editingDomain) {
    CompoundCommand cc = new CompoundCommand();
    for (ActorMapping ac : configuration.getActorMappings().getActorMapping()) {
        final Users users = ac.getUsers();
        if (users != null) {
            if (users.getUser().contains(oldUser.getUserName())) {
                cc.appendIfCanExecute(RemoveCommand.create(editingDomain, users,
                        ActorMappingPackage.Literals.USERS__USER, oldUser.getUserName()));
                cc.appendIfCanExecute(AddCommand.create(editingDomain, users,
                        ActorMappingPackage.Literals.USERS__USER, newUser.getUserName()));
            }
        }
    }
    if (Objects.equals(configuration.getUsername(), oldUser.getUserName())) {
        cc.appendIfCanExecute(SetCommand.create(editingDomain, configuration,
                ConfigurationPackage.Literals.CONFIGURATION__USERNAME, newUser.getUserName()));
    }
    return cc;
}
 
示例10
/**
 * 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);
    }
}
 
示例11
/**
 * 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 = GraphPackage.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();
        }
    }
}
 
示例12
/**
 * Clears everything in the given model.
 *
 * @param model the {@link GModel} to be cleared
 */
public static void clear(final GModel model) {

    final EditingDomain editingDomain = getEditingDomain(model);

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

        command.append(RemoveCommand.create(editingDomain, model, CONNECTIONS, model.getConnections()));
        command.append(RemoveCommand.create(editingDomain, model, NODES, model.getNodes()));

        if (command.canExecute()) {
            editingDomain.getCommandStack().execute(command);
        }
    }
}
 
示例13
private Command refactorUsername(
        final org.bonitasoft.studio.actors.model.organization.Membership oldMembership,
        final org.bonitasoft.studio.actors.model.organization.Membership newMembership,
        final Configuration configuration, EditingDomain editingDomain) {
    CompoundCommand cc = new CompoundCommand();
    for (ActorMapping ac : configuration.getActorMappings().getActorMapping()) {
        final Users users = ac.getUsers();
        if (users != null) {
            if (users.getUser().contains(oldMembership.getUserName())) {
                cc.appendIfCanExecute(new ReplaceCommand(editingDomain, users.getUser(),
                        oldMembership.getUserName(), newMembership.getUserName()));
            }
        }
    }
    return cc;
}
 
示例14
public ExpressionCollectionViewer(final Composite composite, final int nbRow,
        final boolean fixedRow, final int nbCol, final boolean fixedCol,
        final List<String> colCaptions,
        final TabbedPropertySheetWidgetFactory widgetFactory,
        final EditingDomain editingDomain, final boolean allowSwitchTableMode,
        final boolean allowRowSort, final boolean withConnectors) {
    this.editingDomain = editingDomain;
    captions = colCaptions;
    minNbRow = nbRow;
    minNbCol = nbCol;
    listeners = new ArrayList<>();
    modeListeners = new ArrayList<>();
    this.fixedCol = fixedCol;
    this.fixedRow = fixedRow;
    editingSupports = new ArrayList<>();
    this.allowSwitchTableMode = allowSwitchTableMode;
    this.allowRowSort = allowRowSort;
    this.withConnectors = withConnectors;
    lineTableCreator = new LineTableCreator();
    createComposite(composite, widgetFactory);
}
 
示例15
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 ();
}
 
示例16
@Override
protected void editControlSelected(final ToolBar tb, final Event event, final EditingDomain editingDomain) {
    Preconditions.checkState(context instanceof FormMapping);
    final String newPageId = createOrEditFormListener.handleEvent(context, null);
    if (newPageId != null) {
        pageStore.refresh();
        final WebPageFileStore webPageFileStore = pageStore.getChild(newPageId, true);
        if (webPageFileStore != null) {
            editingDomain.getCommandStack().execute(new UpdateFormMappingCommand(editingDomain, (FormMapping) context,
                    ExpressionHelper.createFormReferenceExpression(webPageFileStore.getCustomPageName(), newPageId)));
        }
    }
}
 
示例17
private void refactorConfParameter(final EditingDomain editingDomain, final CompoundCommand cc) {
    final String id = ModelHelper.getEObjectID(process);
    final String fileName = id + ".conf";
    final ProcessConfigurationRepositoryStore processConfStore = RepositoryManager.getInstance().getCurrentRepository()
            .getRepositoryStore(ProcessConfigurationRepositoryStore.class);
    final ProcessConfigurationFileStore file = processConfStore.getChild(fileName, true);
    Configuration localeConfiguration = null;
    Configuration localConfigurationCopy = null;
    if (file != null) {
        localeConfiguration = file.getContent();
        localConfigurationCopy = EcoreUtil.copy(localeConfiguration);
    }
    final List<Configuration> configurations = new ArrayList<>();
    if (localeConfiguration != null) {
        configurations.add(localeConfiguration);
    }
    configurations.addAll(process.getConfigurations());
    for (final Configuration configuration : configurations) {
        final List<Parameter> parameters = configuration.getParameters();
        for (final Parameter confParameter : parameters) {
            for (final ParameterRefactorPair pairToRefactor : pairsToRefactor) {
                if (pairToRefactor.getOldValueName().equals(confParameter.getName())) {
                    cc.append(SetCommand.create(editingDomain, confParameter, ParameterPackage.Literals.PARAMETER__NAME,
                            pairToRefactor.getNewValueName()));
                    cc.append(SetCommand.create(editingDomain, confParameter,
                            ParameterPackage.Literals.PARAMETER__DESCRIPTION, pairToRefactor
                                    .getNewValue().getDescription()));
                    cc.append(SetCommand.create(editingDomain, confParameter,
                            ParameterPackage.Literals.PARAMETER__TYPE_CLASSNAME,
                            pairToRefactor.getNewValue().getTypeClassname()));
                }
            }
        }
        if (configuration.equals(localeConfiguration)) {
            cc.append(new SaveConfigurationEMFCommand(file, localConfigurationCopy, localeConfiguration));
        }
    }
}
 
示例18
/**
 * This implements {@link org.eclipse.jface.viewers.ISelectionChangedListener},
 * handling {@link org.eclipse.jface.viewers.SelectionChangedEvent}s by querying for the children and siblings
 * that can be added to the selected object and updating the menus accordingly.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void selectionChanged(SelectionChangedEvent event) {
	// Remove any menu items for old selection.
	//
	if (createChildMenuManager != null) {
		depopulateManager(createChildMenuManager, createChildActions);
	}
	if (createSiblingMenuManager != null) {
		depopulateManager(createSiblingMenuManager, createSiblingActions);
	}

	// Query the new selection for appropriate new child/sibling descriptors
	//
	Collection<?> newChildDescriptors = null;
	Collection<?> newSiblingDescriptors = null;

	ISelection selection = event.getSelection();
	if (selection instanceof IStructuredSelection && ((IStructuredSelection)selection).size() == 1) {
		Object object = ((IStructuredSelection)selection).getFirstElement();

		EditingDomain domain = ((IEditingDomainProvider)activeEditorPart).getEditingDomain();

		newChildDescriptors = domain.getNewChildDescriptors(object, null);
		newSiblingDescriptors = domain.getNewChildDescriptors(null, object);
	}

	// Generate actions for selection; populate and redraw the menus.
	//
	createChildActions = generateCreateChildActions(newChildDescriptors, selection);
	createSiblingActions = generateCreateSiblingActions(newSiblingDescriptors, selection);

	if (createChildMenuManager != null) {
		populateManager(createChildMenuManager, createChildActions, null);
		createChildMenuManager.update(true);
	}
	if (createSiblingMenuManager != null) {
		populateManager(createSiblingMenuManager, createSiblingActions, null);
		createSiblingMenuManager.update(true);
	}
}
 
示例19
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public Collection<Object> getNewChildDescriptors ( Object object, EditingDomain editingDomain )
{
    ArrayList<Object> result = new ArrayList<Object> ();
    new CreationSwitch ( result, editingDomain ).doSwitch ( (EObject)object );
    return result;
}
 
示例20
private void addNewAdditionalResources(Configuration configuration, Pool pool, EditingDomain editingDomain,
        CompoundCommand cc) {
    pool.getAdditionalResources().stream()
            .filter(additionalResource -> configuration.getAdditionalResources().stream()
                    .noneMatch(anAdditionalResource -> Objects.equals(additionalResource.getName(),
                            anAdditionalResource.getBarPath())))
            .forEach(additionalResource -> {
                Resource newAdditionalResource = ConfigurationFactory.eINSTANCE.createResource();
                newAdditionalResource.setBarPath(additionalResource.getName());
                Command command = createAddCommand(editingDomain, configuration, newAdditionalResource);
                cc.append(command);
            });
}
 
示例21
/**
 * Calls the {@link RemoveCommand} on an EditPart. 
 * @param editingDomain - the domain required by {@link RemoveCommand#create(EditingDomain, Object)}. It is the EditingDomain of the {@link DiagramEditPart}
 * @param editParts - the EditParts that are to be removed
 */
public static void removeEditParts(EditingDomain editingDomain, List<EditPart> editParts) {
		List<Object> modelElements = new LinkedList<Object>();
		for(EditPart editPart : editParts){
			modelElements.add(editPart.getModel());
		}
		
		org.eclipse.emf.common.command.Command command = RemoveCommand.create(editingDomain, modelElements);
		if(command instanceof RemoveCommand){
			RemoveCommand removeCommand = (RemoveCommand) command;
			editingDomain.getCommandStack().execute(removeCommand);
		}
}
 
示例22
protected CompoundCommand createPerformFinishCommandOnCreation(
        final EditingDomain editingDomain) {
    final CompoundCommand cc = new CompoundCommand("Add Connector");
    cc.append(AddCommand.create(editingDomain, container,
            connectorContainmentFeature, connectorWorkingCopy));
    return cc;
}
 
示例23
protected void addNewConnectorDefinition(final Configuration configuration, final AbstractProcess process, final CompoundCommand cc,
        final EditingDomain editingDomain) {
    final List<Connector> connectors = getExistingConnectors(process);
    final List<Pair<String, String>> definitions = getDefinitions(connectors);
    for (final Pair<String, String> definition : definitions) {
        final String defId = definition.getFirst();
        final String defVersion = definition.getSecond();
        boolean exists = false;
        for (final DefinitionMapping association : configuration.getDefinitionMappings()) {
            if (association.getType().equals(getFragmentContainerId()) && association.getDefinitionId().equals(defId)
                    && association.getDefinitionVersion().equals(defVersion)) {
                exists = true;
                updateAssociation(configuration, association, cc, editingDomain);
                break;
            }
        }
        if (!exists) {
            final DefinitionMapping newAssociation = ConfigurationFactory.eINSTANCE.createDefinitionMapping();
            newAssociation.setDefinitionId(defId);
            newAssociation.setDefinitionVersion(defVersion);
            newAssociation.setType(getFragmentContainerId());
            editingDomain.getCommandStack().execute(
                    AddCommand.create(editingDomain, configuration, ConfigurationPackage.Literals.CONFIGURATION__DEFINITION_MAPPINGS, newAssociation));
            updateAssociation(configuration, newAssociation, cc, editingDomain);
        }
    }
}
 
示例24
/**
 * @deprecated Editing domain is retrieve in the input EObject
 * @param composite
 * @param style
 * @param widgetFactory
 * @param editingDomain
 * @param expressionReference
 * @param withConnector
 */
@Deprecated
public ExpressionViewer(final Composite composite, final int style, final TabbedPropertySheetWidgetFactory widgetFactory,
        final EditingDomain editingDomain, final EReference expressionReference, final boolean withConnector) {
    Assert.isNotNull(composite, "composite");
    expressionEditorService = ExpressionProviderService.getInstance();
    filters = new HashSet<>();
    this.withConnector = withConnector;
    createControl(composite, style, widgetFactory);
    setContentProvider(new ArrayContentProvider());
    setLabelProvider(new ExpressionLabelProvider());
}
 
示例25
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public Collection<Object> getNewChildDescriptors ( Object object, EditingDomain editingDomain )
{
    ArrayList<Object> result = new ArrayList<Object> ();
    new CreationSwitch ( result, editingDomain ).doSwitch ( (EObject)object );
    return result;
}
 
示例26
/**
 * Adds a node to the model.
 *
 * <p>
 * The node's x, y, width, and height values should be set before calling this method.
 * </p>
 *
 * @param model the {@link GModel} to which the node should be added
 * @param node the {@link GNode} to add to the model
 */
public static void addNode(final GModel model, final GNode node) {

    final EditingDomain editingDomain = getEditingDomain(model);

    if (editingDomain != null) {
        final Command command = AddCommand.create(editingDomain, model, NODES, node);

        if (command.canExecute()) {
            editingDomain.getCommandStack().execute(command);
        }
    }
}
 
示例27
public AddParameterWizard(final AbstractProcess container, final EditingDomain editingDomain) {
    this.container = container;
    setWindowTitle(Messages.newParameter);
    setDefaultPageImageDescriptor(Pics.getWizban());
    parameterWorkingCopy = ParameterFactory.eINSTANCE.createParameter();
    parameterWorkingCopy.setTypeClassname(String.class.getName());
    this.editingDomain = editingDomain;
}
 
示例28
protected IObservableValue getExpressionTypeObservable() {
    IObservableValue nameObservable;
    final EditingDomain editingDomain = getEditingDomain();
    if (editingDomain != null) {
        nameObservable = CustomEMFEditObservables.observeDetailValue(Realm.getDefault(),
                getSelectedExpressionObservable(),
                ExpressionPackage.Literals.EXPRESSION__TYPE);
    } else {
        nameObservable = EMFObservables.observeDetailValue(Realm.getDefault(), getSelectedExpressionObservable(),
                ExpressionPackage.Literals.EXPRESSION__TYPE);
    }
    return nameObservable;
}
 
示例29
public CompoundCommand applyUpdate(final EditingDomain editingDomain) {
    final CompoundCommand compoundCommand = new CompoundCommand();
    if (scriptHasChanged()) {
        compoundCommand.append(SetCommand.create(editingDomain, modelElement, scriptFeature,
                newScript));
    }
    return compoundCommand;
}
 
示例30
private static CompoundCommand clearExpression(final Expression expr, final EditingDomain editingDomain) {
    if (editingDomain != null) {
        String returnType = expr.getReturnType();
        if (!expr.isReturnTypeFixed() || expr.getReturnType() == null) {
            returnType = String.class.getName();
        }
        final CompoundCommand cc = new CompoundCommand("Clear Expression");
        if (!ExpressionConstants.CONDITION_TYPE.equals(expr.getType())) {
            cc.append(SetCommand.create(editingDomain, expr, ExpressionPackage.Literals.EXPRESSION__TYPE,
                    ExpressionConstants.CONSTANT_TYPE));
        }
        cc.append(SetCommand.create(editingDomain, expr, ExpressionPackage.Literals.EXPRESSION__NAME, ""));
        cc.append(SetCommand.create(editingDomain, expr, ExpressionPackage.Literals.EXPRESSION__CONTENT, ""));
        cc.append(
                SetCommand.create(editingDomain, expr, ExpressionPackage.Literals.EXPRESSION__RETURN_TYPE,
                        returnType));
        cc.append(RemoveCommand.create(editingDomain, expr,
                ExpressionPackage.Literals.EXPRESSION__REFERENCED_ELEMENTS,
                expr.getReferencedElements()));
        cc.append(RemoveCommand.create(editingDomain, expr, ExpressionPackage.Literals.EXPRESSION__CONNECTORS,
                expr.getConnectors()));
        return cc;
    } else {
        ExpressionHelper.clearExpression(expr);
        return null;
    }
}