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


Java TreeSelection.iterator方法代碼示例

本文整理匯總了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);
    }
}
 
開發者ID:SK-HOLDINGS-CC,項目名稱:NEXCORE-UML-Modeler,代碼行數:30,代碼來源:DiagramDropTargetListener.java

示例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;
}
 
開發者ID:synergynet,項目名稱:synergyview,代碼行數:30,代碼來源:AnnotationTableViewPart.java

示例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;
	}
 
開發者ID:wolfgang-ch,項目名稱:mytourbook,代碼行數:15,代碼來源:TourCompareResultView.java

示例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;
	}
 
開發者ID:wolfgang-ch,項目名稱:mytourbook,代碼行數:15,代碼來源:TourCompareResultView.java

示例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();
		}
	}
}
 
開發者ID:wolfgang-ch,項目名稱:mytourbook,代碼行數:75,代碼來源:TourCompareResultView.java


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