mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Cosmetics.
This commit is contained in:
parent
aa09934d72
commit
5f065af0d8
5 changed files with 36 additions and 67 deletions
|
@ -317,7 +317,7 @@ public class BaseUITestCase extends BaseTestCase {
|
|||
|
||||
final protected TreeItem checkTreeNode(Tree tree, int i0, String label) {
|
||||
TreeItem root= null;
|
||||
for (int millis=0; millis < 5000; millis= millis==0 ? 1 : millis*2) {
|
||||
for (int millis= 0; millis < 5000; millis= millis == 0 ? 1 : millis * 2) {
|
||||
runEventQueue(millis);
|
||||
try {
|
||||
root= tree.getItem(i0);
|
||||
|
@ -340,7 +340,7 @@ public class BaseUITestCase extends BaseTestCase {
|
|||
String itemText= null;
|
||||
SWTException ex= null;
|
||||
String firstItemText= null;
|
||||
for (int millis=0; millis < 5000; millis= millis==0 ? 1 : millis*2) {
|
||||
for (int millis= 0; millis < 5000; millis= millis == 0 ? 1 : millis * 2) {
|
||||
runEventQueue(millis);
|
||||
TreeItem root= tree.getItem(i0);
|
||||
if (!root.getExpanded()) {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Markus Schorn - initial API and implementation
|
||||
* Markus Schorn - initial API and implementation
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.ui.tests.includebrowser;
|
||||
|
@ -34,13 +34,12 @@ public class BasicIncludeBrowserTest extends IncludeBrowserBaseTest {
|
|||
return suite(BasicIncludeBrowserTest.class);
|
||||
}
|
||||
|
||||
|
||||
// // source
|
||||
// #include "user.h"
|
||||
// #include <system.h>
|
||||
|
||||
public void testSimpleInclusion() throws Exception {
|
||||
TestScannerProvider.sIncludes= new String[]{getProject().getProject().getLocation().toOSString()};
|
||||
TestScannerProvider.sIncludes= new String[] { getProject().getProject().getLocation().toOSString() };
|
||||
|
||||
StringBuilder[] contents= getContentsForTest(1);
|
||||
IProject project= getProject().getProject();
|
||||
|
@ -55,7 +54,7 @@ public class BasicIncludeBrowserTest extends IncludeBrowserBaseTest {
|
|||
checkTreeNode(tree, 0, 0, "user.h");
|
||||
checkTreeNode(tree, 0, 1, "system.h");
|
||||
|
||||
// the tree has to be reversed
|
||||
// The tree has to be reversed
|
||||
openIncludeBrowser(user, true);
|
||||
checkTreeNode(tree, 0, "user.h");
|
||||
checkTreeNode(tree, 0, 0, "source.cpp");
|
||||
|
@ -72,9 +71,9 @@ public class BasicIncludeBrowserTest extends IncludeBrowserBaseTest {
|
|||
public void testInclusionAccrossProjects() throws Exception {
|
||||
ICProject op= CProjectHelper.createCCProject("__ibTest_other__", "bin", IPDOMManager.ID_FAST_INDEXER);
|
||||
try {
|
||||
fIndex= CCorePlugin.getIndexManager().getIndex(new ICProject[] {getProject(), op});
|
||||
fIndex= CCorePlugin.getIndexManager().getIndex(new ICProject[] { getProject(), op });
|
||||
|
||||
TestScannerProvider.sIncludes= new String[]{op.getProject().getLocation().toOSString()};
|
||||
TestScannerProvider.sIncludes= new String[] { op.getProject().getLocation().toOSString() };
|
||||
|
||||
StringBuilder[] contents= getContentsForTest(1);
|
||||
IFile user= createFile(op.getProject(), "user.h", "");
|
||||
|
@ -89,7 +88,7 @@ public class BasicIncludeBrowserTest extends IncludeBrowserBaseTest {
|
|||
checkTreeNode(tree, 0, 0, "user.h");
|
||||
checkTreeNode(tree, 0, 1, "system.h");
|
||||
|
||||
// the tree has to be reversed
|
||||
// The tree has to be reversed
|
||||
openIncludeBrowser(user, true);
|
||||
checkTreeNode(tree, 0, "user.h");
|
||||
checkTreeNode(tree, 0, 0, "source.cpp");
|
||||
|
@ -97,10 +96,8 @@ public class BasicIncludeBrowserTest extends IncludeBrowserBaseTest {
|
|||
openIncludeBrowser(system);
|
||||
checkTreeNode(tree, 0, "system.h");
|
||||
checkTreeNode(tree, 0, 0, "source.cpp");
|
||||
|
||||
} finally {
|
||||
CProjectHelper.delete(op);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Markus Schorn - initial API and implementation
|
||||
* Markus Schorn - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.ui.includebrowser;
|
||||
|
||||
|
@ -34,7 +34,6 @@ import org.eclipse.cdt.internal.ui.viewsupport.AsyncTreeContentProvider;
|
|||
* This is the content provider for the include browser.
|
||||
*/
|
||||
public class IBContentProvider extends AsyncTreeContentProvider {
|
||||
|
||||
private static final IProgressMonitor NPM = new NullProgressMonitor();
|
||||
private boolean fComputeIncludedBy = true;
|
||||
|
||||
|
@ -66,7 +65,7 @@ public class IBContentProvider extends AsyncTreeContentProvider {
|
|||
return NO_CHILDREN;
|
||||
}
|
||||
}
|
||||
// allow for async computation
|
||||
// Allow for asynchronous computation
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -98,8 +97,7 @@ public class IBContentProvider extends AsyncTreeContentProvider {
|
|||
IIndexInclude[] includes;
|
||||
if (fComputeIncludedBy) {
|
||||
includes= findIncludedBy(index, ifl, NPM);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
includes= findIncludesTo(index, ifl, NPM);
|
||||
directiveFile= node.getRepresentedFile();
|
||||
}
|
||||
|
@ -110,13 +108,11 @@ public class IBContentProvider extends AsyncTreeContentProvider {
|
|||
try {
|
||||
if (fComputeIncludedBy) {
|
||||
directiveFile= targetFile= new IBFile(project, include.getIncludedByLocation());
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
IIndexFileLocation includesPath= include.getIncludesLocation();
|
||||
if (includesPath == null) {
|
||||
targetFile= new IBFile(include.getFullName());
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
targetFile= new IBFile(project, includesPath);
|
||||
}
|
||||
}
|
||||
|
@ -127,24 +123,20 @@ public class IBContentProvider extends AsyncTreeContentProvider {
|
|||
newnode.setIsActiveCode(include.isActive());
|
||||
newnode.setIsSystemInclude(include.isSystemInclude());
|
||||
result.add(newnode);
|
||||
}
|
||||
catch (CoreException e) {
|
||||
} catch (CoreException e) {
|
||||
CUIPlugin.log(e);
|
||||
}
|
||||
}
|
||||
|
||||
return result.toArray();
|
||||
}
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
index.releaseReadLock();
|
||||
}
|
||||
}
|
||||
return NO_CHILDREN;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setComputeIncludedBy(boolean value) {
|
||||
fComputeIncludedBy = value;
|
||||
}
|
||||
|
@ -152,8 +144,7 @@ public class IBContentProvider extends AsyncTreeContentProvider {
|
|||
public boolean getComputeIncludedBy() {
|
||||
return fComputeIncludedBy;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private IIndexInclude[] findIncludedBy(IIndex index, IIndexFileLocation ifl, IProgressMonitor pm) {
|
||||
try {
|
||||
if (ifl != null) {
|
||||
|
@ -176,8 +167,7 @@ public class IBContentProvider extends AsyncTreeContentProvider {
|
|||
return list.toArray(new IIndexInclude[list.size()]);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (CoreException e) {
|
||||
} catch (CoreException e) {
|
||||
CUIPlugin.log(e);
|
||||
}
|
||||
return new IIndexInclude[0];
|
||||
|
@ -205,8 +195,7 @@ public class IBContentProvider extends AsyncTreeContentProvider {
|
|||
return list.toArray(new IIndexInclude[list.size()]);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (CoreException e) {
|
||||
} catch (CoreException e) {
|
||||
CUIPlugin.log(e);
|
||||
}
|
||||
return new IIndexInclude[0];
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Markus Schorn - initial API and implementation
|
||||
* Ed Swartz (Nokia)
|
||||
* Markus Schorn - initial API and implementation
|
||||
* Ed Swartz (Nokia)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.ui.includebrowser;
|
||||
|
||||
|
@ -104,9 +104,7 @@ import org.eclipse.cdt.internal.ui.viewsupport.WorkingSetFilterUI;
|
|||
/**
|
||||
* The view part for the include browser.
|
||||
*/
|
||||
public class IBViewPart extends ViewPart
|
||||
implements IShowInSource, IShowInTarget, IShowInTargetList {
|
||||
|
||||
public class IBViewPart extends ViewPart implements IShowInSource, IShowInTarget, IShowInTargetList {
|
||||
private static final int MAX_HISTORY_SIZE = 10;
|
||||
private static final String TRUE = "true"; //$NON-NLS-1$
|
||||
private static final String FALSE = "false"; //$NON-NLS-1$
|
||||
|
@ -183,8 +181,7 @@ public class IBViewPart extends ViewPart
|
|||
|
||||
if (CCorePlugin.getIndexManager().isIndexerIdle()) {
|
||||
setInputIndexerIdle(input);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
setMessage(IBMessages.IBViewPart_waitingOnIndexerMessage);
|
||||
fSetInputJob.setInput(input);
|
||||
fSetInputJob.schedule();
|
||||
|
@ -202,8 +199,7 @@ public class IBViewPart extends ViewPart
|
|||
fIncludesToAction.setChecked(!isHeader);
|
||||
fIncludedByAction.setEnabled(false);
|
||||
updateSorter();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fIncludedByAction.setEnabled(true);
|
||||
}
|
||||
fTreeViewer.setInput(input);
|
||||
|
@ -349,14 +345,12 @@ public class IBViewPart extends ViewPart
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void init(IViewSite site, IMemento memento) throws PartInitException {
|
||||
fMemento= memento;
|
||||
super.init(site, memento);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void saveState(IMemento memento) {
|
||||
putDialogSettings();
|
||||
|
@ -501,8 +495,7 @@ public class IBViewPart extends ViewPart
|
|||
public void run() {
|
||||
if (isChecked()) {
|
||||
fTreeViewer.addFilter(fInactiveFilter);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fTreeViewer.removeFilter(fInactiveFilter);
|
||||
}
|
||||
}
|
||||
|
@ -525,8 +518,7 @@ public class IBViewPart extends ViewPart
|
|||
public void run() {
|
||||
if (isChecked()) {
|
||||
fTreeViewer.addFilter(fSystemFilter);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fTreeViewer.removeFilter(fSystemFilter);
|
||||
}
|
||||
}
|
||||
|
@ -675,8 +667,7 @@ public class IBViewPart extends ViewPart
|
|||
private void updateSorter() {
|
||||
if (fIncludedByAction.isChecked()) {
|
||||
fTreeViewer.setComparator(fSorterAlphaNumeric);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fTreeViewer.setComparator(fSorterReferencePosition);
|
||||
}
|
||||
}
|
||||
|
@ -693,15 +684,13 @@ public class IBViewPart extends ViewPart
|
|||
file= path.lastSegment() + "(" + path.removeLastSegments(1) + ")"; //$NON-NLS-1$//$NON-NLS-2$
|
||||
if (fWorkingSetFilter == null) {
|
||||
scope= IBMessages.IBViewPart_workspaceScope;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
scope= fWorkingSetFilter.getLabel();
|
||||
}
|
||||
|
||||
if (fIncludedByAction.isChecked()) {
|
||||
format= IBMessages.IBViewPart_IncludedByContentDescription;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
format= IBMessages.IBViewPart_IncludesToContentDescription;
|
||||
}
|
||||
message= Messages.format(format, file, scope);
|
||||
|
@ -717,12 +706,10 @@ public class IBViewPart extends ViewPart
|
|||
fTreeViewer.removeFilter(fWorkingSetFilter);
|
||||
fWorkingSetFilter= null;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (fWorkingSetFilter != null) {
|
||||
fTreeViewer.refresh();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fWorkingSetFilter= new IBWorkingSetFilter(filterUI);
|
||||
fTreeViewer.addFilter(fWorkingSetFilter);
|
||||
}
|
||||
|
@ -777,7 +764,6 @@ public class IBViewPart extends ViewPart
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
m.add(new Separator(IContextMenuConstants.GROUP_ADDITIONS));
|
||||
|
@ -797,8 +783,7 @@ public class IBViewPart extends ViewPart
|
|||
IFile f= ibf.getResource();
|
||||
if (f != null) {
|
||||
EditorOpener.open(page, f, region, timestamp);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
IIndexFileLocation ifl = ibf.getLocation();
|
||||
if (ifl != null) {
|
||||
IPath location= IndexLocationFactory.getAbsolutePath(ifl);
|
||||
|
@ -807,8 +792,7 @@ public class IBViewPart extends ViewPart
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
ITranslationUnit tu= IBConversions.selectionToTU(selection);
|
||||
if (tu != null) {
|
||||
IResource r= tu.getResource();
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Markus Schorn - initial API and implementation
|
||||
* Markus Schorn - initial API and implementation
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.internal.ui.includebrowser;
|
||||
|
@ -39,7 +39,7 @@ public class IncludeBrowserUI {
|
|||
ITranslationUnit tu= convertToTranslationUnit(input);
|
||||
if (tu != null) {
|
||||
IWorkbenchPage page= window.getActivePage();
|
||||
IBViewPart result= (IBViewPart)page.showView(CUIPlugin.ID_INCLUDE_BROWSER);
|
||||
IBViewPart result= (IBViewPart) page.showView(CUIPlugin.ID_INCLUDE_BROWSER);
|
||||
result.setInput(tu);
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
|
@ -52,7 +52,7 @@ public class IncludeBrowserUI {
|
|||
public static void open(final ITextEditor editor, final ITextSelection sel) {
|
||||
if (editor != null) {
|
||||
ICElement inputCElement = CUIPlugin.getDefault().getWorkingCopyManager().getWorkingCopy(editor.getEditorInput());
|
||||
open (editor.getSite().getWorkbenchWindow(), inputCElement);
|
||||
open(editor.getSite().getWorkbenchWindow(), inputCElement);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -80,8 +80,7 @@ public class IncludeBrowserUI {
|
|||
return CoreModelUtil.findTranslationUnitForLocation(loc, project);
|
||||
}
|
||||
}
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
index.releaseReadLock();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue