Java Code Examples for org.eclipse.swt.widgets.Tree.setRedraw()

The following are Jave code examples for showing how to use setRedraw() of the org.eclipse.swt.widgets.Tree class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: mytourbook   File: CollatedToursView.java   View Source Code Vote up 6 votes
@Override
public void reloadViewer() {

	if (_isInReload) {
		return;
	}

	final Tree tree = _tourViewer.getTree();
	tree.setRedraw(false);
	_isInReload = true;
	{
		final Object[] expandedElements = _tourViewer.getExpandedElements();
		final ISelection selection = _tourViewer.getSelection();

		_tourViewer.setInput(_rootItem = new TVICollatedTour_Root(this));

		_tourViewer.setExpandedElements(expandedElements);
		_tourViewer.setSelection(selection, true);
	}
	_isInReload = false;
	tree.setRedraw(true);
}
 
Example 2
Project: mytourbook   File: TourCompareResultView.java   View Source Code Vote up 6 votes
@Override
public void reloadViewer() {

	final Tree tree = _tourViewer.getTree();
	tree.setRedraw(false);
	{
		final Object[] expandedElements = _tourViewer.getExpandedElements();
		final ISelection selection = _tourViewer.getSelection();

		_tourViewer.setInput(_rootItem = new TVICompareResultRootItem());

		_tourViewer.setExpandedElements(expandedElements);
		_tourViewer.setSelection(selection);
	}
	tree.setRedraw(true);
}
 
Example 3
Project: mytourbook   File: TourCatalogView.java   View Source Code Vote up 6 votes
@Override
public void reloadViewer() {

	final Tree tree = _tourViewer.getTree();
	tree.setRedraw(false);
	{
		final Object[] expandedElements = _tourViewer.getExpandedElements();
		final ISelection selection = _tourViewer.getSelection();

		_tourViewer.setInput(_rootItem = new TVICatalogRootItem(this));

		_tourViewer.setExpandedElements(expandedElements);
		_tourViewer.setSelection(selection);
	}
	tree.setRedraw(true);
}
 
Example 4
Project: mytourbook   File: TourBookView.java   View Source Code Vote up 6 votes
@Override
public void reloadViewer() {

	if (_isInReload) {
		return;
	}

	final Tree tree = _tourViewer.getTree();
	tree.setRedraw(false);
	_isInReload = true;
	{
		final Object[] expandedElements = _tourViewer.getExpandedElements();
		final ISelection selection = _tourViewer.getSelection();

		_tourViewer.setInput(_rootItem = new TVITourBookRoot(this));

		_tourViewer.setExpandedElements(expandedElements);
		_tourViewer.setSelection(selection, true);
	}
	_isInReload = false;
	tree.setRedraw(true);
}
 
Example 5
Project: mytourbook   File: ActionCollapseOthers.java   View Source Code Vote up 6 votes
@Override
public void run() {

	if (fTourViewer != null) {

		final ColumnViewer viewer = fTourViewer.getViewer();
		if (viewer instanceof TreeViewer) {

			final TreeViewer treeViewer = (TreeViewer) viewer;
			final Object firstElement = ((StructuredSelection) treeViewer.getSelection()).getFirstElement();

			if (firstElement != null) {

				final Tree tree = treeViewer.getTree();
				tree.setRedraw(false);
				{
					treeViewer.collapseAll();
					treeViewer.setExpandedElements(new Object[] { firstElement });
					treeViewer.setSelection(new StructuredSelection(firstElement), true);
				}
				tree.setRedraw(true);
			}
		}
	}
}
 
Example 6
Project: mytourbook   File: ActionExpandAll.java   View Source Code Vote up 6 votes
@Override
public void run() {

	if (_tourViewer == null) {
		return;
	}

	final ColumnViewer viewer = _tourViewer.getViewer();
	if (viewer instanceof TreeViewer) {

		final TreeViewer treeViewer = (TreeViewer) viewer;
		final Tree tree = treeViewer.getTree();

		// disable redraw that the UI in not flickering
		tree.setRedraw(false);
		{
			treeViewer.expandAll();
		}
		tree.setRedraw(true);

	}
}
 
Example 7
Project: gwt-eclipse-plugin   File: BreadcrumbItemDropDown.java   View Source Code Vote up 5 votes
private void toggleExpansionState(Object element) {
  Tree tree = fDropDownViewer.getTree();
  if (fDropDownViewer.getExpandedState(element))
    fDropDownViewer.collapseToLevel(element, 1);
  else {
    tree.setRedraw(false);
    try {
      fDropDownViewer.expandToLevel(element, 1);
      resizeShell(fShell);
    } finally {
      tree.setRedraw(true);
    }
  }
}
 
Example 8
Project: mytourbook   File: TaggingView.java   View Source Code Vote up 5 votes
/**
 * reload the content of the tag viewer
 */
@Override
public void reloadViewer() {

	final Tree tree = _tagViewer.getTree();
	tree.setRedraw(false);
	{
		final Object[] expandedElements = _tagViewer.getExpandedElements();

		_tagViewer.setInput(_rootItem = new TVITagViewRoot(this, _tagViewLayout));
		_tagViewer.setExpandedElements(expandedElements);
	}
	tree.setRedraw(true);
}
 
Example 9
Project: mytourbook   File: ActionExpandSelection.java   View Source Code Vote up 5 votes
@Override
public void run() {

	if (_tourViewer == null) {
		return;
	}

	final ColumnViewer viewer = _tourViewer.getViewer();
	if (viewer instanceof TreeViewer) {

		final TreeViewer treeViewer = (TreeViewer) viewer;
		final ITreeSelection selection = (ITreeSelection) treeViewer.getSelection();

		if (selection.size() == 0) {
			return;
		}

		final Tree tree = treeViewer.getTree();
		tree.setRedraw(false);
		{
			for (final Iterator<?> iterator = selection.iterator(); iterator.hasNext();) {
				treeViewer.expandToLevel(iterator.next(), _expandLevels);
			}
		}
		tree.setRedraw(true);
	}
}
 
Example 10
Project: mytourbook   File: PicDirFolder.java   View Source Code Vote up 4 votes
/**
 * This behavior is complex and still have possible problems.
 * 
 * @param selectedFolderItem
 * @param treeSelection
 * @param selectedTreePath
 * @param isFromNavigationHistory
 */
private void onSelectFolder_10_AutoExpandCollapse_Runnable(	final TVIFolderFolder selectedFolderItem,
															final ITreeSelection treeSelection,
															final TreePath selectedTreePath,
															final boolean isFromNavigationHistory) {
	_isExpandingSelection = true;
	{
		final Tree tree = _folderViewer.getTree();

		tree.setRedraw(false);
		{
			final TreeItem topItem = tree.getTopItem();

			final boolean isExpanded = _folderViewer.getExpandedState(selectedTreePath);

			/*
			 * collapse all tree paths
			 */
			final TreePath[] allExpandedTreePaths = _folderViewer.getExpandedTreePaths();
			for (final TreePath treePath : allExpandedTreePaths) {
				_folderViewer.setExpandedState(treePath, false);
			}

			/*
			 * expand and select selected folder
			 */
			_folderViewer.setExpandedTreePaths(new TreePath[] { selectedTreePath });
			_folderViewer.setSelection(treeSelection, true);

			if (_isBehaviourAutoExpandCollapse && isExpanded) {

				// auto collapse expanded folder
				_folderViewer.setExpandedState(selectedTreePath, false);
			}

			/**
			 * set top item to the previous top item, otherwise the expanded/collapse item is
			 * positioned at the bottom and the UI is jumping all the time
			 * <p>
			 * win behaviour: when an item is set to top which was collapsed bevore, it will be
			 * expanded
			 */
			if (topItem.isDisposed() == false) {
				tree.setTopItem(topItem);
			}
		}
		tree.setRedraw(true);
	}
	_isExpandingSelection = false;

	displayFolderImages(selectedFolderItem, isFromNavigationHistory, false);
}