本文整理匯總了Java中org.eclipse.jface.viewers.TreeSelection.iterator方法的典型用法代碼示例。如果您正苦於以下問題:Java TreeSelection.iterator方法的具體用法?Java TreeSelection.iterator怎麽用?Java TreeSelection.iterator使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.jface.viewers.TreeSelection
的用法示例。
在下文中一共展示了TreeSelection.iterator方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: drop
import org.eclipse.jface.viewers.TreeSelection; //導入方法依賴的package包/類
/**
* @see org.eclipse.swt.dnd.DropTargetListener#drop(org.eclipse.swt.dnd.DropTargetEvent)
*/
@SuppressWarnings("unchecked")
public void drop(DropTargetEvent event) {
if (event.data instanceof TreeSelection) {
TreeSelection selection = (TreeSelection) event.data;
if (!checkTreeSectionSource(selection)) {
return;
}
viewModelListInDiagram.clear();
viewModelListInDiagram.addAll(this.diagramEditor.getDiagram().getNodeList());
CompoundCommand commpoundCommand = new CompoundCommand();
int count = 0;
Object object = null;
for (Iterator<Object> i = selection.iterator(); i.hasNext();) {
object = i.next();
if (object instanceof ITreeNode) { // UML 요소일 경우
dropCommandForNode(event, commpoundCommand, (ITreeNode) object, count);
count++;
}
}
diagramEditor.getDiagramCommandStack().execute(commpoundCommand);
}
}
示例2: performDrop
import org.eclipse.jface.viewers.TreeSelection; //導入方法依賴的package包/類
@Override
public boolean performDrop(Object data) {
if (dropTarget != null) {
if (data instanceof TreeSelection) {
TreeSelection selection = (TreeSelection) data;
if (!selection.isEmpty()) {
@SuppressWarnings("rawtypes")
Iterator i = selection.iterator();
List<Attribute> list = new ArrayList<Attribute>();
while (i.hasNext()) {
Object o = i.next();
if (o instanceof AttributeNode) {
AttributeNode attributeNode = (AttributeNode) o;
if (attributeNode.getChildren().isEmpty()) {
if (!list.contains(attributeNode.getResource())) {
list.add(attributeNode.getResource());
}
}
if (node != null) {
node.getAnnotationAttributeController(dropTarget).addAttributeList(list);
}
}
}
}
}
}
dropTarget = null;
return true;
}
示例3: getSelectedComparedTour
import org.eclipse.jface.viewers.TreeSelection; //導入方法依賴的package包/類
private TVICompareResultComparedTour getSelectedComparedTour() {
final TreeSelection selection = (TreeSelection) _tourViewer.getSelection();
for (final Iterator<?> iterator = selection.iterator(); iterator.hasNext();) {
final Object treeItem = iterator.next();
if (treeItem instanceof TVICompareResultComparedTour) {
return (TVICompareResultComparedTour) treeItem;
}
}
return null;
}
示例4: getSelectedRefTour
import org.eclipse.jface.viewers.TreeSelection; //導入方法依賴的package包/類
private TVICompareResultReferenceTour getSelectedRefTour() {
final TreeSelection selection = (TreeSelection) _tourViewer.getSelection();
for (final Iterator<?> iterator = selection.iterator(); iterator.hasNext();) {
final Object treeItem = iterator.next();
if (treeItem instanceof TVICompareResultReferenceTour) {
return (TVICompareResultReferenceTour) treeItem;
}
}
return null;
}
示例5: saveCompareResults
import org.eclipse.jface.viewers.TreeSelection; //導入方法依賴的package包/類
/**
* Persist the compared tours which are checked or selected
*/
@SuppressWarnings("unchecked")
void saveCompareResults() {
final EntityManager em = TourDatabase.getInstance().getEntityManager();
if (em != null) {
final EntityTransaction ts = em.getTransaction();
try {
final ArrayList<TVICompareResultComparedTour> updatedItems = new ArrayList<TVICompareResultComparedTour>();
final SelectionPersistedCompareResults compareResultSelection = new SelectionPersistedCompareResults();
final ArrayList<TVICompareResultComparedTour> persistedCompareResults = compareResultSelection.persistedCompareResults;
/*
* save checked items
*/
for (final Object checkedItem : _tourViewer.getCheckedElements()) {
if (checkedItem instanceof TVICompareResultComparedTour) {
final TVICompareResultComparedTour checkedCompareItem = (TVICompareResultComparedTour) checkedItem;
if (checkedCompareItem.isSaved() == false) {
TourCompareManager.saveComparedTourItem(checkedCompareItem, em, ts);
persistedCompareResults.add(checkedCompareItem);
updatedItems.add(checkedCompareItem);
}
}
}
/*
* save selected items which are not checked
*/
final TreeSelection selection = (TreeSelection) _tourViewer.getSelection();
for (final Iterator<Object> iterator = selection.iterator(); iterator.hasNext();) {
final Object treeItem = iterator.next();
if (treeItem instanceof TVICompareResultComparedTour) {
final TVICompareResultComparedTour selectedComparedItem = (TVICompareResultComparedTour) treeItem;
if (selectedComparedItem.isSaved() == false) {
TourCompareManager.saveComparedTourItem(selectedComparedItem, em, ts);
persistedCompareResults.add(selectedComparedItem);
updatedItems.add(selectedComparedItem);
}
}
}
// uncheck all
_tourViewer.setCheckedElements(new Object[0]);
// update persistent status
_tourViewer.update(updatedItems.toArray(), null);
// fire post selection to update the tour catalog view
_postSelectionProvider.setSelection(compareResultSelection);
} catch (final Exception e) {
e.printStackTrace();
} finally {
if (ts.isActive()) {
ts.rollback();
}
em.close();
}
}
}