/** * Returns the list of editparts which will participate in alignment. * * @param request * the alignment request * @return the list of parts which will be aligned */ protected List getOperationSet(Request request) { if (operationSet != null) return operationSet; List editparts = new ArrayList(getSelectedObjects()); if (editparts.isEmpty() || !(editparts.get(0) instanceof GraphicalEditPart)) return Collections.EMPTY_LIST; Object primary = editparts.get(editparts.size() - 1); editparts = ToolUtilities.getSelectionWithoutDependants(editparts); ToolUtilities.filterEditPartsUnderstanding(editparts, request); if (editparts.size() < 2 || !editparts.contains(primary)) return Collections.EMPTY_LIST; EditPart parent = ((EditPart) editparts.get(0)).getParent(); for (int i = 1; i < editparts.size(); i++) { EditPart part = (EditPart) editparts.get(i); if (part.getParent() != parent) return Collections.EMPTY_LIST; } return editparts; }
/** * Returns the list of editparts which will participate in alignment. * * @param request * the alignment request * @return the list of parts which will be aligned */ @SuppressWarnings("unchecked") protected List getOperationSet(final Request request) { if (operationSet != null) return operationSet; List editparts = new ArrayList(getSelectedObjects()); for (final Iterator iter = editparts.iterator(); iter.hasNext();) { if (iter.next() instanceof NormalColumnEditPart) { iter.remove(); } } if (editparts.isEmpty() || !(editparts.get(0) instanceof GraphicalEditPart)) return Collections.EMPTY_LIST; final Object primary = editparts.get(editparts.size() - 1); editparts = ToolUtilities.getSelectionWithoutDependants(editparts); ToolUtilities.filterEditPartsUnderstanding(editparts, request); if (editparts.size() < 2 || !editparts.contains(primary)) return Collections.EMPTY_LIST; final EditPart parent = ((EditPart) editparts.get(0)).getParent(); for (int i = 1; i < editparts.size(); i++) { final EditPart part = (EditPart) editparts.get(i); if (part.getParent() != parent) return Collections.EMPTY_LIST; } return editparts; }
/** * Returns the list of editparts which will participate in alignment. * * @param request * the alignment request * @return the list of parts which will be aligned */ @SuppressWarnings("unchecked") protected List getOperationSet(Request request) { if (operationSet != null) return operationSet; List editparts = new ArrayList(getSelectedObjects()); for (Iterator iter = editparts.iterator(); iter.hasNext();) { if (iter.next() instanceof NormalColumnEditPart) { iter.remove(); } } if (editparts.isEmpty() || !(editparts.get(0) instanceof GraphicalEditPart)) return Collections.EMPTY_LIST; Object primary = editparts.get(editparts.size() - 1); editparts = ToolUtilities.getSelectionWithoutDependants(editparts); ToolUtilities.filterEditPartsUnderstanding(editparts, request); if (editparts.size() < 2 || !editparts.contains(primary)) return Collections.EMPTY_LIST; EditPart parent = ((EditPart) editparts.get(0)).getParent(); for (int i = 1; i < editparts.size(); i++) { EditPart part = (EditPart) editparts.get(i); if (part.getParent() != parent) return Collections.EMPTY_LIST; } return editparts; }
protected List<EditPart> createOperationSet() { List<EditPart> editparts = null; if (editpart == null) { editparts = Collections.emptyList(); } else { editparts = new ArrayList<EditPart>(); editparts.add(editpart); ToolUtilities.filterEditPartsUnderstanding(editparts, getSourceRequest()); } return editparts; }
/** * Returns the list of editparts which will participate in alignment. * @param request the alignment request * @return the list of parts which will be aligned */ @SuppressWarnings({ "unchecked", "rawtypes" }) protected List getOperationSet(Request request) { if (operationSet != null) return operationSet; List<?> editparts = new ArrayList<Object>(getSelectedObjects()); for (final Iterator<?> iter = editparts.iterator(); iter.hasNext();) { if (iter.next() instanceof NormalColumnEditPart) { iter.remove(); } } if (editparts.isEmpty() || !(editparts.get(0) instanceof GraphicalEditPart)) { return Collections.EMPTY_LIST; } final Object primary = editparts.get(editparts.size() - 1); editparts = ToolUtilities.getSelectionWithoutDependants(editparts); ToolUtilities.filterEditPartsUnderstanding(editparts, request); if (editparts.size() < 2 || !editparts.contains(primary)) { return Collections.EMPTY_LIST; } final EditPart parent = ((EditPart) editparts.get(0)).getParent(); for (int i = 1; i < editparts.size(); i++) { final EditPart part = (EditPart) editparts.get(i); if (part.getParent() != parent) { return Collections.EMPTY_LIST; } } return editparts; }