org.eclipse.emf.edit.domain.EditingDomain Java Examples
The following examples show how to use
org.eclipse.emf.edit.domain.EditingDomain.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SelectionCopier.java From graph-editor with Eclipse Public License 1.0 | 6 votes |
/** * 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); } }
Example #2
Source File: ModelHelper.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
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); }
Example #3
Source File: RefactorActorMappingsOperation.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
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; }
Example #4
Source File: ExpressionCollectionViewer.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
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); }
Example #5
Source File: ConnectorsConfigurationSynchronizer.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
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) ; } } }
Example #6
Source File: RefactorActorMappingsOperation.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
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; }
Example #7
Source File: SetConnectionHandler.java From neoscada with Eclipse Public License 1.0 | 6 votes |
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 (); }
Example #8
Source File: RefactorActorMappingsOperation.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
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; }
Example #9
Source File: GraphEditorPersistence.java From graph-editor with Eclipse Public License 1.0 | 6 votes |
/** * 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(); }
Example #10
Source File: JointCommands.java From graph-editor with Eclipse Public License 1.0 | 6 votes |
/** * 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); } }
Example #11
Source File: AbstractConnectorConfigurationSynchronizer.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
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)); } } }
Example #12
Source File: Commands.java From graph-editor with Eclipse Public License 1.0 | 6 votes |
/** * 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); } } }
Example #13
Source File: TitledSkinController.java From graph-editor with Eclipse Public License 1.0 | 6 votes |
/** * 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(); } } }
Example #14
Source File: GenerationFileNamesPage.java From M2Doc with Eclipse Public License 1.0 | 6 votes |
/** * 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"))); } }
Example #15
Source File: Commands.java From graph-editor with Eclipse Public License 1.0 | 5 votes |
/** * 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); } } }
Example #16
Source File: AddParameterWizard.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
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; }
Example #17
Source File: ScriptContainer.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
public CompoundCommand applyUpdate(final EditingDomain editingDomain) { final CompoundCommand compoundCommand = new CompoundCommand(); if (scriptHasChanged()) { compoundCommand.append(SetCommand.create(editingDomain, modelElement, scriptFeature, newScript)); } return compoundCommand; }
Example #18
Source File: ConnectorWizard.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
protected CompoundCommand createPerformFinishCommandOnCreation( final EditingDomain editingDomain) { final CompoundCommand cc = new CompoundCommand("Add Connector"); cc.append(AddCommand.create(editingDomain, container, connectorContainmentFeature, connectorWorkingCopy)); return cc; }
Example #19
Source File: ElementsManagerUtils.java From txtUML with Eclipse Public License 1.0 | 5 votes |
/** * 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); } }
Example #20
Source File: AdditionalResourcesConfigurationSyncronizer.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
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); }); }
Example #21
Source File: SetMasterHandler.java From neoscada with Eclipse Public License 1.0 | 5 votes |
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 (); }
Example #22
Source File: ExpressionViewer.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
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; }
Example #23
Source File: RefactorDataOperation.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
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; } }
Example #24
Source File: Commands.java From graph-editor with Eclipse Public License 1.0 | 5 votes |
/** * Updates the model's layout values to match those in the skin instances. * * <p> * This method adds set operations to the given compound command but does <b>not</b> execute it. * </p> * * @param command a {@link CompoundCommand} to which the set commands will be added * @param model the {@link GModel} whose layout values should be updated * @param skinLookup the {@link SkinLookup} in use for this graph editor instance */ public static void updateLayoutValues(final CompoundCommand command, final GModel model, final SkinLookup skinLookup) { final EditingDomain editingDomain = getEditingDomain(model); if (editingDomain != null) { for (final GNode node : model.getNodes()) { final Region nodeRegion = skinLookup.lookupNode(node).getRoot(); command.append(SetCommand.create(editingDomain, node, NODE_X, nodeRegion.getLayoutX())); command.append(SetCommand.create(editingDomain, node, NODE_Y, nodeRegion.getLayoutY())); command.append(SetCommand.create(editingDomain, node, NODE_WIDTH, nodeRegion.getWidth())); command.append(SetCommand.create(editingDomain, node, NODE_HEIGHT, nodeRegion.getHeight())); } for (final GConnection connection : model.getConnections()) { for (final GJoint joint : connection.getJoints()) { final GJointSkin jointSkin = skinLookup.lookupJoint(joint); final Region jointRegion = jointSkin.getRoot(); final double x = jointRegion.getLayoutX() + jointSkin.getWidth() / 2; final double y = jointRegion.getLayoutY() + jointSkin.getHeight() / 2; command.append(SetCommand.create(editingDomain, joint, JOINT_X, x)); command.append(SetCommand.create(editingDomain, joint, JOINT_Y, y)); } } } }
Example #25
Source File: AbstractGroovyScriptConfigurationSynchronizer.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
private void removeDeletedPackage(Configuration configuration, GroovyRepositoryStore store, CompoundCommand cc, EditingDomain editingDomain) { IFolder srcFolder = store.getResource(); FragmentContainer container = getContainer(configuration); for (Fragment f : container.getFragments()) { IResource member = srcFolder.findMember(Path.fromOSString(f.getValue())); if (member == null || !member.exists()) { cc.append(RemoveCommand.create(editingDomain, container, ConfigurationPackage.Literals.FRAGMENT_CONTAINER__FRAGMENTS, f)); } } }
Example #26
Source File: CompoundManager.java From neoscada with Eclipse Public License 1.0 | 5 votes |
public void append ( final EditingDomain domain, final Command command ) { CompoundHandler handler = this.handlers.get ( domain ); if ( handler == null ) { handler = new CompoundHandler ( domain ); this.handlers.put ( domain, handler ); } handler.addCommand ( command ); }
Example #27
Source File: ComponentItemProviderAdapterFactory.java From neoscada with Eclipse Public License 1.0 | 5 votes |
/** * <!-- 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; }
Example #28
Source File: RefactorActorMappingsOperation.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
private Command refactorGroup(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 Groups groups = ac.getGroups(); if (groups != null) { if (groups.getGroup().contains(GroupContentProvider.getGroupPath(oldMembership.getGroupName(), oldMembership.getGroupParentPath()))) { cc.appendIfCanExecute( RemoveCommand.create(editingDomain, groups, ActorMappingPackage.Literals.GROUPS__GROUP, GroupContentProvider.getGroupPath(oldMembership.getGroupName(), oldMembership.getGroupParentPath()))); cc.appendIfCanExecute( AddCommand.create(editingDomain, groups, ActorMappingPackage.Literals.GROUPS__GROUP, GroupContentProvider.getGroupPath(newMembership.getGroupName(), newMembership.getGroupParentPath()))); // cc.appendIfCanExecute(new ReplaceCommand(editingDomain, groups.getGroup(), // GroupContentProvider.getGroupPath(oldMembership.getGroupName(), // oldMembership.getGroupParentPath()), // GroupContentProvider.getGroupPath(newMembership.getGroupName(), // newMembership.getGroupParentPath()))); } } } return cc; }
Example #29
Source File: JointCommands.java From graph-editor with Eclipse Public License 1.0 | 5 votes |
/** * Removes joints from a connection. * * <p> * This method adds the remove operations to the given compound command and does not execute it. * </p> * * @param command a {@link CompoundCommand} to which the remove commands will be added * @param indices the indices within the connection's list of joints specifying the joints to be removed * @param connection the connection whose joints are to be removed */ public static void removeJoints(final CompoundCommand command, final Set<Integer> indices, final GConnection connection) { final EditingDomain editingDomain = AdapterFactoryEditingDomain.getEditingDomainFor(connection); for (int i = 0; i < connection.getJoints().size(); i++) { if (indices.contains(i)) { final GJoint joint = connection.getJoints().get(i); command.append(RemoveCommand.create(editingDomain, connection, JOINTS, joint)); } } }
Example #30
Source File: Commands.java From graph-editor with Eclipse Public License 1.0 | 5 votes |
/** * 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; }