mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-25 18:05:33 +02:00
[170728] fix for a refresh issue during the rename
This commit is contained in:
parent
6e247d6d59
commit
0d2b4d765f
2 changed files with 70 additions and 16 deletions
|
@ -39,7 +39,6 @@ import org.eclipse.jface.action.MenuManager;
|
|||
import org.eclipse.jface.action.Separator;
|
||||
import org.eclipse.jface.viewers.DecoratingLabelProvider;
|
||||
import org.eclipse.jface.viewers.DoubleClickEvent;
|
||||
import org.eclipse.jface.viewers.IBaseLabelProvider;
|
||||
import org.eclipse.jface.viewers.IBasicPropertyConstants;
|
||||
import org.eclipse.jface.viewers.IDoubleClickListener;
|
||||
import org.eclipse.jface.viewers.ILabelDecorator;
|
||||
|
@ -365,7 +364,7 @@ public class SystemView extends TreeViewer implements ISystemTree, ISystemResour
|
|||
protected void init() {
|
||||
_setList = new ArrayList();
|
||||
busyCursor = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
|
||||
setUseHashlookup(true); // new for our 2nd release. Attempt to fix 38 minutes to refresh for 15K elements
|
||||
//setUseHashlookup(true); // new for our 2nd release. Attempt to fix 38 minutes to refresh for 15K elements
|
||||
|
||||
// set content provider
|
||||
SystemViewLabelAndContentProvider lcProvider = new SystemViewLabelAndContentProvider();
|
||||
|
@ -2646,10 +2645,9 @@ public class SystemView extends TreeViewer implements ISystemTree, ISystemResour
|
|||
}
|
||||
|
||||
// rename explicitly here (since internalUpdate doesn't seem to have an effect
|
||||
System.out.println("setting name to "+newElementName);
|
||||
match.setText(newElementName);
|
||||
|
||||
//internalUpdate(match, data, properties);
|
||||
//updateItem(match, renameObject);
|
||||
internalUpdate(match, data, properties);
|
||||
|
||||
//update(data, properties); // for refreshing non-structural properties in viewer when model changes
|
||||
//System.out.println("Match found. refresh required? " + refresh);
|
||||
|
@ -2661,7 +2659,8 @@ public class SystemView extends TreeViewer implements ISystemTree, ISystemResour
|
|||
|
||||
if (refresh)
|
||||
{
|
||||
smartRefresh((TreeItem[])matches.toArray(new TreeItem[matches.size()]));
|
||||
// causes duplicates to appear when there are more than one rename objects
|
||||
//smartRefresh((TreeItem[])matches.toArray(new TreeItem[matches.size()]));
|
||||
getTree().setSelection(selected);
|
||||
}
|
||||
|
||||
|
@ -2770,6 +2769,23 @@ public class SystemView extends TreeViewer implements ISystemTree, ISystemResour
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void doUpdateItem(final Item item, Object element)
|
||||
{
|
||||
super.doUpdateItem(item, element);
|
||||
|
||||
// adding this because base eclipse version isn't renaming properly on duplicates
|
||||
ISystemRemoteElementAdapter adapter = getRemoteAdapter(element);
|
||||
if (adapter != null)
|
||||
{
|
||||
String oldText = item.getText();
|
||||
String newText = adapter.getName(element);
|
||||
if (!oldText.equals(newText))
|
||||
{
|
||||
item.setText(newText);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Given the result of findAllRemoteItemReferences, scan for first non-filter object
|
||||
|
@ -2829,6 +2845,12 @@ public class SystemView extends TreeViewer implements ISystemTree, ISystemResour
|
|||
logDebugMsg("in doOurInternalRefresh on " + getAdapter(element).getName(element)); //$NON-NLS-1$
|
||||
logDebugMsg("...current selection is " + getFirstSelectionName(getSelection())); //$NON-NLS-1$
|
||||
}
|
||||
ISystemViewElementAdapter adapter = getAdapter(element);
|
||||
if (adapter != null)
|
||||
{
|
||||
//String name = adapter.getName(element);
|
||||
//System.out.println("refreshing "+ ((TreeItem)widget).getText() + " with " + name);
|
||||
}
|
||||
SystemElapsedTimer timer = null;
|
||||
if (doTimings) timer = new SystemElapsedTimer();
|
||||
if (widget instanceof Item) {
|
||||
|
@ -3243,6 +3265,11 @@ public class SystemView extends TreeViewer implements ISystemTree, ISystemResour
|
|||
timer.setStartTime();
|
||||
}
|
||||
}
|
||||
|
||||
public void refreshRemote(Object element)
|
||||
{
|
||||
smartRefresh(element, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Do an intelligent refresh of the given element. Can be null for full refresh
|
||||
|
@ -5268,11 +5295,11 @@ public class SystemView extends TreeViewer implements ISystemTree, ISystemResour
|
|||
_setList.add(newSet);
|
||||
return newSet;
|
||||
}
|
||||
|
||||
/*
|
||||
protected boolean usingElementMap() {
|
||||
return false;
|
||||
}
|
||||
|
||||
*/
|
||||
public void add(Object parentElementOrTreePath, Object[] childElements) {
|
||||
assertElementsNotNull(childElements);
|
||||
|
||||
|
|
|
@ -39,7 +39,6 @@ import org.eclipse.jface.action.MenuManager;
|
|||
import org.eclipse.jface.action.Separator;
|
||||
import org.eclipse.jface.viewers.DecoratingLabelProvider;
|
||||
import org.eclipse.jface.viewers.DoubleClickEvent;
|
||||
import org.eclipse.jface.viewers.IBaseLabelProvider;
|
||||
import org.eclipse.jface.viewers.IBasicPropertyConstants;
|
||||
import org.eclipse.jface.viewers.IDoubleClickListener;
|
||||
import org.eclipse.jface.viewers.ILabelDecorator;
|
||||
|
@ -365,7 +364,7 @@ public class SystemView extends TreeViewer implements ISystemTree, ISystemResour
|
|||
protected void init() {
|
||||
_setList = new ArrayList();
|
||||
busyCursor = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
|
||||
setUseHashlookup(true); // new for our 2nd release. Attempt to fix 38 minutes to refresh for 15K elements
|
||||
//setUseHashlookup(true); // new for our 2nd release. Attempt to fix 38 minutes to refresh for 15K elements
|
||||
|
||||
// set content provider
|
||||
SystemViewLabelAndContentProvider lcProvider = new SystemViewLabelAndContentProvider();
|
||||
|
@ -2646,10 +2645,9 @@ public class SystemView extends TreeViewer implements ISystemTree, ISystemResour
|
|||
}
|
||||
|
||||
// rename explicitly here (since internalUpdate doesn't seem to have an effect
|
||||
System.out.println("setting name to "+newElementName);
|
||||
match.setText(newElementName);
|
||||
|
||||
//internalUpdate(match, data, properties);
|
||||
//updateItem(match, renameObject);
|
||||
internalUpdate(match, data, properties);
|
||||
|
||||
//update(data, properties); // for refreshing non-structural properties in viewer when model changes
|
||||
//System.out.println("Match found. refresh required? " + refresh);
|
||||
|
@ -2661,7 +2659,8 @@ public class SystemView extends TreeViewer implements ISystemTree, ISystemResour
|
|||
|
||||
if (refresh)
|
||||
{
|
||||
smartRefresh((TreeItem[])matches.toArray(new TreeItem[matches.size()]));
|
||||
// causes duplicates to appear when there are more than one rename objects
|
||||
//smartRefresh((TreeItem[])matches.toArray(new TreeItem[matches.size()]));
|
||||
getTree().setSelection(selected);
|
||||
}
|
||||
|
||||
|
@ -2770,6 +2769,23 @@ public class SystemView extends TreeViewer implements ISystemTree, ISystemResour
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void doUpdateItem(final Item item, Object element)
|
||||
{
|
||||
super.doUpdateItem(item, element);
|
||||
|
||||
// adding this because base eclipse version isn't renaming properly on duplicates
|
||||
ISystemRemoteElementAdapter adapter = getRemoteAdapter(element);
|
||||
if (adapter != null)
|
||||
{
|
||||
String oldText = item.getText();
|
||||
String newText = adapter.getName(element);
|
||||
if (!oldText.equals(newText))
|
||||
{
|
||||
item.setText(newText);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Given the result of findAllRemoteItemReferences, scan for first non-filter object
|
||||
|
@ -2829,6 +2845,12 @@ public class SystemView extends TreeViewer implements ISystemTree, ISystemResour
|
|||
logDebugMsg("in doOurInternalRefresh on " + getAdapter(element).getName(element)); //$NON-NLS-1$
|
||||
logDebugMsg("...current selection is " + getFirstSelectionName(getSelection())); //$NON-NLS-1$
|
||||
}
|
||||
ISystemViewElementAdapter adapter = getAdapter(element);
|
||||
if (adapter != null)
|
||||
{
|
||||
//String name = adapter.getName(element);
|
||||
//System.out.println("refreshing "+ ((TreeItem)widget).getText() + " with " + name);
|
||||
}
|
||||
SystemElapsedTimer timer = null;
|
||||
if (doTimings) timer = new SystemElapsedTimer();
|
||||
if (widget instanceof Item) {
|
||||
|
@ -3243,6 +3265,11 @@ public class SystemView extends TreeViewer implements ISystemTree, ISystemResour
|
|||
timer.setStartTime();
|
||||
}
|
||||
}
|
||||
|
||||
public void refreshRemote(Object element)
|
||||
{
|
||||
smartRefresh(element, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Do an intelligent refresh of the given element. Can be null for full refresh
|
||||
|
@ -5268,11 +5295,11 @@ public class SystemView extends TreeViewer implements ISystemTree, ISystemResour
|
|||
_setList.add(newSet);
|
||||
return newSet;
|
||||
}
|
||||
|
||||
/*
|
||||
protected boolean usingElementMap() {
|
||||
return false;
|
||||
}
|
||||
|
||||
*/
|
||||
public void add(Object parentElementOrTreePath, Object[] childElements) {
|
||||
assertElementsNotNull(childElements);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue