mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Patch for Andrew Niefer.
Skeleton implementation of C/C++ Search.
This commit is contained in:
parent
04804f1cf1
commit
18eca5c02b
24 changed files with 2313 additions and 0 deletions
|
@ -15,5 +15,6 @@
|
|||
<classpathentry kind="src" path="/org.eclipse.debug.core"/>
|
||||
<classpathentry kind="src" path="/org.eclipse.core.boot"/>
|
||||
<classpathentry kind="var" path="JRE_LIB" sourcepath="JRE_SRC"/>
|
||||
<classpathentry kind="src" path="search"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
|
|
@ -1,3 +1,11 @@
|
|||
2003-06-13 Andrew Niefer
|
||||
Added search\org.eclipse.cdt.core.search
|
||||
search\org.eclipse.cdt.internal.core.search
|
||||
search\org.eclipse.cdt.internal.core.search.matching
|
||||
search\org.eclipse.cdt.internal.core.search.processing
|
||||
with skeleton classes based on the JDT search as a beginning for
|
||||
implementing C/CPP search.
|
||||
|
||||
2003-06-06 Sean Evoy
|
||||
|
||||
Added new interface, IResourceBuildInfo, so clients could
|
||||
|
|
|
@ -0,0 +1,172 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2003 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Corp. - Rational Software - initial implementation
|
||||
******************************************************************************/
|
||||
/*
|
||||
* Created on Jun 11, 2003
|
||||
*/
|
||||
package org.eclipse.cdt.core.search;
|
||||
|
||||
/**
|
||||
* @author aniefer
|
||||
*
|
||||
* To change the template for this generated type comment go to
|
||||
* Window>Preferences>Java>Code Generation>Code and Comments
|
||||
*/
|
||||
public interface ICSearchConstants {
|
||||
/**
|
||||
* The nature of searched element or the nature
|
||||
* of match in unknown.
|
||||
*/
|
||||
int UNKNOWN = -1;
|
||||
|
||||
/* Nature of searched element */
|
||||
|
||||
/**
|
||||
* The searched element is a type.
|
||||
*/
|
||||
int TYPE= 0;
|
||||
|
||||
/**
|
||||
* The searched element is a method.
|
||||
*/
|
||||
int METHOD= 1;
|
||||
|
||||
/**
|
||||
* The searched element is a package.
|
||||
*/
|
||||
//int PACKAGE= 2;
|
||||
|
||||
/**
|
||||
* The searched element is a constructor.
|
||||
*/
|
||||
int CONSTRUCTOR= 2;
|
||||
|
||||
/**
|
||||
* The searched element is a field.
|
||||
*/
|
||||
int FIELD= 3;
|
||||
|
||||
/**
|
||||
* The searched element is a class.
|
||||
* More selective than using TYPE
|
||||
*/
|
||||
int CLASS= 4;
|
||||
|
||||
/**
|
||||
* The searched element is an interface.
|
||||
* More selective than using TYPE
|
||||
*/
|
||||
int INTERFACE= 5;
|
||||
|
||||
/* Nature of match */
|
||||
|
||||
/**
|
||||
* The search result is a declaration.
|
||||
* Can be used in conjunction with any of the nature of searched elements
|
||||
* so as to better narrow down the search.
|
||||
*/
|
||||
int DECLARATIONS= 0;
|
||||
|
||||
/**
|
||||
* The search result is a type that implements an interface.
|
||||
* Used in conjunction with either TYPE or CLASS or INTERFACE, it will
|
||||
* respectively search for any type implementing/extending an interface, or
|
||||
* rather exclusively search for classes implementing an interface, or interfaces
|
||||
* extending an interface.
|
||||
*/
|
||||
int IMPLEMENTORS= 1;
|
||||
|
||||
/**
|
||||
* The search result is a reference.
|
||||
* Can be used in conjunction with any of the nature of searched elements
|
||||
* so as to better narrow down the search.
|
||||
* References can contain implementers since they are more generic kind
|
||||
* of matches.
|
||||
*/
|
||||
int REFERENCES= 2;
|
||||
|
||||
/**
|
||||
* The search result is a declaration, a reference, or an implementer
|
||||
* of an interface.
|
||||
* Can be used in conjunction with any of the nature of searched elements
|
||||
* so as to better narrow down the search.
|
||||
*/
|
||||
int ALL_OCCURRENCES= 3;
|
||||
|
||||
/**
|
||||
* When searching for field matches, it will exclusively find read accesses, as
|
||||
* opposed to write accesses. Note that some expressions are considered both
|
||||
* as field read/write accesses: for example, x++; x+= 1;
|
||||
*
|
||||
* @since 2.0
|
||||
*/
|
||||
int READ_ACCESSES = 4;
|
||||
|
||||
/**
|
||||
* When searching for field matches, it will exclusively find write accesses, as
|
||||
* opposed to read accesses. Note that some expressions are considered both
|
||||
* as field read/write accesses: for example, x++; x+= 1;
|
||||
*
|
||||
* @since 2.0
|
||||
*/
|
||||
int WRITE_ACCESSES = 5;
|
||||
|
||||
/* Syntactic match modes */
|
||||
|
||||
/**
|
||||
* The search pattern matches exactly the search result,
|
||||
* that is, the source of the search result equals the search pattern.
|
||||
*/
|
||||
int EXACT_MATCH = 0;
|
||||
/**
|
||||
* The search pattern is a prefix of the search result.
|
||||
*/
|
||||
int PREFIX_MATCH = 1;
|
||||
/**
|
||||
* The search pattern contains one or more wild cards ('*') where a
|
||||
* wild-card can replace 0 or more characters in the search result.
|
||||
*/
|
||||
int PATTERN_MATCH = 2;
|
||||
|
||||
|
||||
/* Case sensitivity */
|
||||
|
||||
/**
|
||||
* The search pattern matches the search result only
|
||||
* if cases are the same.
|
||||
*/
|
||||
boolean CASE_SENSITIVE = true;
|
||||
/**
|
||||
* The search pattern ignores cases in the search result.
|
||||
*/
|
||||
boolean CASE_INSENSITIVE = false;
|
||||
|
||||
|
||||
/* Waiting policies */
|
||||
|
||||
/**
|
||||
* The search operation starts immediately, even if the underlying indexer
|
||||
* has not finished indexing the workspace. Results will more likely
|
||||
* not contain all the matches.
|
||||
*/
|
||||
//int FORCE_IMMEDIATE_SEARCH = IJob.ForceImmediate;
|
||||
/**
|
||||
* The search operation throws an <code>org.eclipse.core.runtime.OperationCanceledException</code>
|
||||
* if the underlying indexer has not finished indexing the workspace.
|
||||
*/
|
||||
//int CANCEL_IF_NOT_READY_TO_SEARCH = IJob.CancelIfNotReady;
|
||||
/**
|
||||
* The search operation waits for the underlying indexer to finish indexing
|
||||
* the workspace before starting the search.
|
||||
*/
|
||||
//int WAIT_UNTIL_READY_TO_SEARCH = IJob.WaitUntilReady;
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2003 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Corp. - Rational Software - initial implementation
|
||||
******************************************************************************/
|
||||
/*
|
||||
* Created on Jun 13, 2003
|
||||
*/
|
||||
package org.eclipse.cdt.core.search;
|
||||
|
||||
/**
|
||||
* @author aniefer
|
||||
*
|
||||
* To change the template for this generated type comment go to
|
||||
* Window>Preferences>Java>Code Generation>Code and Comments
|
||||
*/
|
||||
public interface ICSearchPattern {
|
||||
|
||||
}
|
|
@ -0,0 +1,75 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2003 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Corp. - Rational Software - initial implementation
|
||||
******************************************************************************/
|
||||
/*
|
||||
* Created on Jun 11, 2003
|
||||
*/
|
||||
package org.eclipse.cdt.core.search;
|
||||
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
|
||||
/**
|
||||
* @author aniefer
|
||||
*
|
||||
* To change the template for this generated type comment go to
|
||||
* Window>Preferences>Java>Code Generation>Code and Comments
|
||||
*/
|
||||
public interface ICSearchResultCollector {
|
||||
/**
|
||||
* The search result corresponds exactly to the search pattern.
|
||||
*/
|
||||
int EXACT_MATCH = 0;
|
||||
|
||||
/**
|
||||
* The search result is potentially a match for the search pattern,
|
||||
* but a problem prevented the search engine from being more accurate
|
||||
* (typically because of the classpath was not correctly set).
|
||||
*/
|
||||
int POTENTIAL_MATCH = 1;
|
||||
|
||||
/**
|
||||
* Called before the actual search starts.
|
||||
*/
|
||||
public void aboutToStart();
|
||||
/**
|
||||
* Accepts the given search result.
|
||||
*
|
||||
* @param resource the resource in which the match has been found
|
||||
* @param start the start position of the match, -1 if it is unknown
|
||||
* @param end the end position of the match, -1 if it is unknown;
|
||||
* the ending offset is exclusive, meaning that the actual range of characters
|
||||
* covered is <code>[start, end]</code>
|
||||
* @param enclosingElement the Java element that contains the character range
|
||||
* <code>[start, end]</code>; the value can be <code>null</code> indicating that
|
||||
* no enclosing Java element has been found
|
||||
* @param accuracy the level of accuracy the search result has; either
|
||||
* <code>EXACT_MATCH</code> or <code>POTENTIAL_MATCH</code>
|
||||
* @exception CoreException if this collector had a problem accepting the search result
|
||||
*/
|
||||
public void accept(
|
||||
IResource resource,
|
||||
int start,
|
||||
int end,
|
||||
/*IJavaElement*/ Object enclosingElement,
|
||||
int accuracy)
|
||||
throws CoreException;
|
||||
/**
|
||||
* Called when the search has ended.
|
||||
*/
|
||||
public void done();
|
||||
/**
|
||||
* Returns the progress monitor used to report progress.
|
||||
*
|
||||
* @return a progress monitor or null if no progress monitor is provided
|
||||
*/
|
||||
public IProgressMonitor getProgressMonitor();
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2003 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Corp. - Rational Software - initial implementation
|
||||
******************************************************************************/
|
||||
/*
|
||||
* Created on Jun 12, 2003
|
||||
*/
|
||||
package org.eclipse.cdt.core.search;
|
||||
|
||||
/**
|
||||
* @author aniefer
|
||||
*
|
||||
* To change the template for this generated type comment go to
|
||||
* Window>Preferences>Java>Code Generation>Code and Comments
|
||||
*/
|
||||
public interface ICSearchScope {
|
||||
|
||||
}
|
|
@ -0,0 +1,117 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2003 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Corp. - Rational Software - initial implementation
|
||||
******************************************************************************/
|
||||
/*
|
||||
* Created on Jun 11, 2003
|
||||
*/
|
||||
package org.eclipse.cdt.core.search;
|
||||
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
import org.eclipse.cdt.internal.core.index.IndexManager;
|
||||
import org.eclipse.cdt.internal.core.model.CModelManager;
|
||||
import org.eclipse.cdt.internal.core.search.Util;
|
||||
import org.eclipse.cdt.internal.core.search.matching.CSearchPattern;
|
||||
import org.eclipse.core.resources.IWorkspace;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
|
||||
/**
|
||||
* @author aniefer
|
||||
*
|
||||
* To change the template for this generated type comment go to
|
||||
* Window>Preferences>Java>Code Generation>Code and Comments
|
||||
*/
|
||||
public class SearchEngine {
|
||||
|
||||
private boolean VERBOSE = false;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public SearchEngine() {
|
||||
super();
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public static ICSearchScope createWorkspaceScope() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param objects
|
||||
* @return
|
||||
*/
|
||||
public static ICSearchScope createCSearchScope(Object[] objects) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
public static ICSearchPattern createSearchPattern( String stringPattern, int searchFor, int limitTo, boolean isCaseSensitive){
|
||||
int mode;
|
||||
|
||||
if( stringPattern.indexOf( '*' ) != -1 || stringPattern.indexOf( '?' ) != -1 ){
|
||||
mode = ICSearchConstants.PATTERN_MATCH;
|
||||
} else {
|
||||
mode = ICSearchConstants.EXACT_MATCH;
|
||||
}
|
||||
|
||||
return CSearchPattern.createPattern( stringPattern, searchFor, limitTo, mode, isCaseSensitive );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param _workspace
|
||||
* @param pattern
|
||||
* @param _scope
|
||||
* @param _collector
|
||||
*/
|
||||
public void search(IWorkspace workspace, ICSearchPattern pattern, ICSearchScope scope, ICSearchResultCollector collector) {
|
||||
if( VERBOSE ) {
|
||||
System.out.println("Searching for " + pattern + " in " + scope); //$NON-NLS-1$//$NON-NLS-2$
|
||||
}
|
||||
|
||||
if( pattern == null ){
|
||||
return;
|
||||
}
|
||||
|
||||
/* search is starting */
|
||||
collector.aboutToStart();
|
||||
|
||||
try{
|
||||
//initialize progress monitor
|
||||
IProgressMonitor progressMonitor = collector.getProgressMonitor();
|
||||
if( progressMonitor != null ){
|
||||
progressMonitor.beginTask( Util.bind("engine.searching"), 100 ); //$NON_NLS-1$
|
||||
}
|
||||
|
||||
CModelManager modelManager = CModelManager.getDefault();
|
||||
IndexManager indexManager = null; //modelManager.getIndexManager();
|
||||
|
||||
|
||||
} finally {
|
||||
collector.done();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param _workspace
|
||||
* @param _elementPattern
|
||||
* @param _limitTo
|
||||
* @param _scope
|
||||
* @param _collector
|
||||
*/
|
||||
public void search(IWorkspace workspace, ICElement elementPattern, int limitTo, ICSearchScope scope, ICSearchResultCollector collector) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2003 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Corp. - Rational Software - initial implementation
|
||||
******************************************************************************/
|
||||
/*
|
||||
* Created on Jun 12, 2003
|
||||
*/
|
||||
package org.eclipse.cdt.internal.core.search;
|
||||
|
||||
import org.eclipse.cdt.core.search.ICSearchScope;
|
||||
|
||||
/**
|
||||
* @author aniefer
|
||||
*
|
||||
* To change the template for this generated type comment go to
|
||||
* Window>Preferences>Java>Code Generation>Code and Comments
|
||||
*/
|
||||
public class CSearchScope implements ICSearchScope {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public CSearchScope() {
|
||||
super();
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2003 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Corp. - Rational Software - initial implementation
|
||||
******************************************************************************/
|
||||
/*
|
||||
* Created on Jun 13, 2003
|
||||
*/
|
||||
package org.eclipse.cdt.internal.core.search;
|
||||
|
||||
import org.eclipse.cdt.internal.core.search.processing.IJob;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
|
||||
/**
|
||||
* @author aniefer
|
||||
*
|
||||
* To change the template for this generated type comment go to
|
||||
* Window>Preferences>Java>Code Generation>Code and Comments
|
||||
*/
|
||||
public class PatternSearchJob implements IJob {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public PatternSearchJob() {
|
||||
super();
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.search.processing.IJob#belongsTo(java.lang.String)
|
||||
*/
|
||||
public boolean belongsTo(String jobFamily) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.search.processing.IJob#cancel()
|
||||
*/
|
||||
public void cancel() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.search.processing.IJob#execute(org.eclipse.core.runtime.IProgressMonitor)
|
||||
*/
|
||||
public boolean execute(IProgressMonitor progress) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.search.processing.IJob#isReadyToRun()
|
||||
*/
|
||||
public boolean isReadyToRun() {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2003 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Corp. - Rational Software - initial implementation
|
||||
******************************************************************************/
|
||||
/*
|
||||
* Created on Jun 13, 2003
|
||||
*/
|
||||
package org.eclipse.cdt.internal.core.search;
|
||||
|
||||
/**
|
||||
* @author aniefer
|
||||
*
|
||||
* To change the template for this generated type comment go to
|
||||
* Window>Preferences>Java>Code Generation>Code and Comments
|
||||
*/
|
||||
public class Util {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public Util() {
|
||||
super();
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string
|
||||
* @return
|
||||
*/
|
||||
public static String bind(String string) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,141 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2003 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Corp. - Rational Software - initial implementation
|
||||
******************************************************************************/
|
||||
/*
|
||||
* Created on Jun 13, 2003
|
||||
*/
|
||||
package org.eclipse.cdt.internal.core.search.matching;
|
||||
|
||||
import org.eclipse.cdt.core.search.ICSearchConstants;
|
||||
import org.eclipse.cdt.core.search.ICSearchPattern;
|
||||
|
||||
/**
|
||||
* @author aniefer
|
||||
*
|
||||
* To change the template for this generated type comment go to
|
||||
* Window>Preferences>Java>Code Generation>Code and Comments
|
||||
*/
|
||||
public abstract class CSearchPattern
|
||||
implements ICSearchConstants, ICSearchPattern {
|
||||
|
||||
/**
|
||||
* @param matchMode
|
||||
* @param caseSensitive
|
||||
*/
|
||||
public CSearchPattern(int matchMode, boolean caseSensitive) {
|
||||
_matchMode = matchMode;
|
||||
_caseSensitive = caseSensitive;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public CSearchPattern() {
|
||||
super();
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public static CSearchPattern createPattern( String patternString, int searchFor, int limitTo, int matchMode, boolean caseSensitive ){
|
||||
if( patternString == null || patternString.length() == 0 ){
|
||||
return null;
|
||||
}
|
||||
|
||||
CSearchPattern pattern = null;
|
||||
switch( searchFor ){
|
||||
case ICSearchConstants.TYPE:
|
||||
pattern = createTypePattern( patternString, limitTo, matchMode, caseSensitive );
|
||||
break;
|
||||
case ICSearchConstants.METHOD:
|
||||
pattern = createMethodPattern( patternString, limitTo, matchMode, caseSensitive );
|
||||
break;
|
||||
case ICSearchConstants.CONSTRUCTOR:
|
||||
pattern = createConstructorPattern( patternString, limitTo, matchMode, caseSensitive );
|
||||
break;
|
||||
case ICSearchConstants.FIELD:
|
||||
pattern = createFieldPattern( patternString, limitTo, matchMode, caseSensitive );
|
||||
break;
|
||||
}
|
||||
|
||||
return pattern;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param patternString
|
||||
* @param limitTo
|
||||
* @param matchMode
|
||||
* @param caseSensitive
|
||||
* @return
|
||||
*/
|
||||
private static CSearchPattern createFieldPattern(String patternString, int limitTo, int matchMode, boolean caseSensitive) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param patternString
|
||||
* @param limitTo
|
||||
* @param matchMode
|
||||
* @param caseSensitive
|
||||
* @return
|
||||
*/
|
||||
private static CSearchPattern createMethodPattern(String patternString, int limitTo, int matchMode, boolean caseSensitive) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param patternString
|
||||
* @param limitTo
|
||||
* @param matchMode
|
||||
* @param caseSensitive
|
||||
* @return
|
||||
*/
|
||||
private static CSearchPattern createConstructorPattern(String patternString, int limitTo, int matchMode, boolean caseSensitive) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param patternString
|
||||
* @param limitTo
|
||||
* @param matchMode
|
||||
* @param caseSensitive
|
||||
* @return
|
||||
*/
|
||||
private static CSearchPattern createTypePattern(String patternString, int limitTo, int matchMode, boolean caseSensitive) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
protected boolean matchesName( char[] pattern, char[] name ){
|
||||
if( pattern == null ){
|
||||
return true; //treat null as "*"
|
||||
}
|
||||
|
||||
if( name != null ){
|
||||
switch( _matchMode ){
|
||||
case EXACT_MATCH:
|
||||
//return CharOperation.equals( pattern, name, _caseSensitive );
|
||||
case PREFIX_MATCH:
|
||||
//return CharOperation.prefixEquals( pattern, name, _caseSensitive );
|
||||
case PATTERN_MATCH:
|
||||
if( !_caseSensitive ){
|
||||
//pattern = CharOperation.toLowerCase( pattern );
|
||||
}
|
||||
//return CharOperation.match( pattern, name, _caseSensitive );
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
protected int _matchMode;
|
||||
protected boolean _caseSensitive;
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2003 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Corp. - Rational Software - initial implementation
|
||||
******************************************************************************/
|
||||
/*
|
||||
* Created on Jun 13, 2003
|
||||
*/
|
||||
package org.eclipse.cdt.internal.core.search.matching;
|
||||
|
||||
/**
|
||||
* @author aniefer
|
||||
*
|
||||
* To change the template for this generated type comment go to
|
||||
* Window>Preferences>Java>Code Generation>Code and Comments
|
||||
*/
|
||||
public class ClassDeclarationPattern extends CSearchPattern {
|
||||
|
||||
public ClassDeclarationPattern( int matchMode, boolean caseSensitive ){
|
||||
super( matchMode, caseSensitive );
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,324 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2003 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Corp. - Rational Software - initial implementation
|
||||
******************************************************************************/
|
||||
/*
|
||||
* Created on Jun 13, 2003
|
||||
*/
|
||||
package org.eclipse.cdt.internal.core.search.matching;
|
||||
|
||||
import org.eclipse.cdt.core.parser.IProblem;
|
||||
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
|
||||
import org.eclipse.cdt.core.parser.ast.*;
|
||||
|
||||
/**
|
||||
* @author aniefer
|
||||
*
|
||||
* To change the template for this generated type comment go to
|
||||
* Window>Preferences>Java>Code Generation>Code and Comments
|
||||
*/
|
||||
public class MatchLocator implements ISourceElementRequestor {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public MatchLocator() {
|
||||
super();
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptProblem(org.eclipse.cdt.core.parser.IProblem)
|
||||
*/
|
||||
public void acceptProblem(IProblem problem) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptMacro(org.eclipse.cdt.core.parser.ast.IASTMacro)
|
||||
*/
|
||||
public void acceptMacro(IASTMacro macro) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptVariable(org.eclipse.cdt.core.parser.ast.IASTVariable)
|
||||
*/
|
||||
public void acceptVariable(IASTVariable variable) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptFunctionDeclaration(org.eclipse.cdt.core.parser.ast.IASTFunction)
|
||||
*/
|
||||
public void acceptFunctionDeclaration(IASTFunction function) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptUsingDirective(org.eclipse.cdt.core.parser.ast.IASTUsingDirective)
|
||||
*/
|
||||
public void acceptUsingDirective(IASTUsingDirective usageDirective) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptUsingDeclaration(org.eclipse.cdt.core.parser.ast.IASTUsingDeclaration)
|
||||
*/
|
||||
public void acceptUsingDeclaration(IASTUsingDeclaration usageDeclaration) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptASMDefinition(org.eclipse.cdt.core.parser.ast.IASTASMDefinition)
|
||||
*/
|
||||
public void acceptASMDefinition(IASTASMDefinition asmDefinition) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptTypedef(org.eclipse.cdt.core.parser.ast.IASTTypedef)
|
||||
*/
|
||||
public void acceptTypedef(IASTTypedef typedef) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterEnumSpecifier(org.eclipse.cdt.core.parser.ast.IASTEnumSpecifier)
|
||||
*/
|
||||
//public void enterEnumSpecifier(IASTEnumSpecifier enumSpec) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
//}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptEnumerator(org.eclipse.cdt.core.parser.ast.IASTEnumerator)
|
||||
*/
|
||||
public void acceptEnumerator(IASTEnumerator enumerator) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitEnumSpecifier(org.eclipse.cdt.core.parser.ast.IASTEnumSpecifier)
|
||||
*/
|
||||
//public void exitEnumSpecifier(IASTEnumSpecifier enumSpec) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
//}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterFunctionBody(org.eclipse.cdt.core.parser.ast.IASTFunction)
|
||||
*/
|
||||
public void enterFunctionBody(IASTFunction function) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitFunctionBody(org.eclipse.cdt.core.parser.ast.IASTFunction)
|
||||
*/
|
||||
public void exitFunctionBody(IASTFunction function) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterCompilationUnit(org.eclipse.cdt.core.parser.ast.IASTCompilationUnit)
|
||||
*/
|
||||
public void enterCompilationUnit(IASTCompilationUnit compilationUnit) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterInclusion(org.eclipse.cdt.core.parser.ast.IASTInclusion)
|
||||
*/
|
||||
public void enterInclusion(IASTInclusion inclusion) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterNamespaceDefinition(org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition)
|
||||
*/
|
||||
public void enterNamespaceDefinition(IASTNamespaceDefinition namespaceDefinition) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterClassSpecifier(org.eclipse.cdt.core.parser.ast.IASTClassSpecifier)
|
||||
*/
|
||||
public void enterClassSpecifier(IASTClassSpecifier classSpecification) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterLinkageSpecification(org.eclipse.cdt.core.parser.ast.IASTLinkageSpecification)
|
||||
*/
|
||||
public void enterLinkageSpecification(IASTLinkageSpecification linkageSpec) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterTemplateDeclaration(org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration)
|
||||
*/
|
||||
public void enterTemplateDeclaration(IASTTemplateDeclaration declaration) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterTemplateSpecialization(org.eclipse.cdt.core.parser.ast.IASTTemplateSpecialization)
|
||||
*/
|
||||
public void enterTemplateSpecialization(IASTTemplateSpecialization specialization) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterTemplateExplicitInstantiation(org.eclipse.cdt.core.parser.ast.IASTTemplateInstantiation)
|
||||
*/
|
||||
public void enterTemplateExplicitInstantiation(IASTTemplateInstantiation instantiation) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptMethodDeclaration(org.eclipse.cdt.core.parser.ast.IASTMethod)
|
||||
*/
|
||||
public void acceptMethodDeclaration(IASTMethod method) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterMethodBody(org.eclipse.cdt.core.parser.ast.IASTMethod)
|
||||
*/
|
||||
public void enterMethodBody(IASTMethod method) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitMethodBody(org.eclipse.cdt.core.parser.ast.IASTMethod)
|
||||
*/
|
||||
public void exitMethodBody(IASTMethod method) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptField(org.eclipse.cdt.core.parser.ast.IASTField)
|
||||
*/
|
||||
public void acceptField(IASTField field) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptConstructor(org.eclipse.cdt.core.parser.ast.IASTConstructor)
|
||||
*/
|
||||
public void acceptConstructor(IASTConstructor constructor) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitTemplateDeclaration(org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration)
|
||||
*/
|
||||
public void exitTemplateDeclaration(IASTTemplateDeclaration declaration) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitTemplateSpecialization(org.eclipse.cdt.core.parser.ast.IASTTemplateSpecialization)
|
||||
*/
|
||||
public void exitTemplateSpecialization(IASTTemplateSpecialization specialization) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitTemplateExplicitInstantiation(org.eclipse.cdt.core.parser.ast.IASTTemplateInstantiation)
|
||||
*/
|
||||
public void exitTemplateExplicitInstantiation(IASTTemplateInstantiation instantiation) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitLinkageSpecification(org.eclipse.cdt.core.parser.ast.IASTLinkageSpecification)
|
||||
*/
|
||||
public void exitLinkageSpecification(IASTLinkageSpecification linkageSpec) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitClassSpecifier(org.eclipse.cdt.core.parser.ast.IASTClassSpecifier)
|
||||
*/
|
||||
public void exitClassSpecifier(IASTClassSpecifier classSpecification) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitNamespaceDefinition(org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition)
|
||||
*/
|
||||
public void exitNamespaceDefinition(IASTNamespaceDefinition namespaceDefinition) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitInclusion(org.eclipse.cdt.core.parser.ast.IASTInclusion)
|
||||
*/
|
||||
public void exitInclusion(IASTInclusion inclusion) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitCompilationUnit(org.eclipse.cdt.core.parser.ast.IASTCompilationUnit)
|
||||
*/
|
||||
public void exitCompilationUnit(IASTCompilationUnit compilationUnit) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptEnumerationSpecifier(org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier)
|
||||
*/
|
||||
public void acceptEnumerationSpecifier(IASTEnumerationSpecifier enumeration) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptClassReference(org.eclipse.cdt.core.parser.ast.IASTClassSpecifier, int)
|
||||
*/
|
||||
public void acceptClassReference(IASTClassSpecifier classSpecifier, int referenceOffset) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2003 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Corp. - Rational Software - initial implementation
|
||||
******************************************************************************/
|
||||
/*
|
||||
* Created on Jun 13, 2003
|
||||
*/
|
||||
package org.eclipse.cdt.internal.core.search.processing;
|
||||
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
|
||||
/**
|
||||
* @author aniefer
|
||||
*
|
||||
* To change the template for this generated type comment go to
|
||||
* Window>Preferences>Java>Code Generation>Code and Comments
|
||||
*/
|
||||
public interface IJob {
|
||||
/* Waiting policies */
|
||||
int ForceImmediate = 1;
|
||||
int CancelIfNotReady = 2;
|
||||
int WaitUntilReady = 3;
|
||||
|
||||
/* Job's result */
|
||||
boolean FAILED = false;
|
||||
boolean COMPLETE = true;
|
||||
|
||||
/**
|
||||
* Answer true if the job belongs to a given family (tag)
|
||||
*/
|
||||
public boolean belongsTo(String jobFamily);
|
||||
/**
|
||||
* Asks this job to cancel its execution. The cancellation
|
||||
* can take an undertermined amount of time.
|
||||
*/
|
||||
public void cancel();
|
||||
/**
|
||||
* Execute the current job, answer whether it was successful.
|
||||
*/
|
||||
public boolean execute(IProgressMonitor progress);
|
||||
/**
|
||||
* Answer whether the job is ready to run.
|
||||
*/
|
||||
public boolean isReadyToRun();
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2003 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Corp. - Rational Software - initial implementation
|
||||
******************************************************************************/
|
||||
/*
|
||||
* Created on Jun 13, 2003
|
||||
*/
|
||||
package org.eclipse.cdt.internal.core.search.processing;
|
||||
|
||||
/**
|
||||
* @author aniefer
|
||||
*
|
||||
* To change the template for this generated type comment go to
|
||||
* Window>Preferences>Java>Code Generation>Code and Comments
|
||||
*/
|
||||
public class JobManager implements Runnable {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public JobManager() {
|
||||
super();
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.lang.Runnable#run()
|
||||
*/
|
||||
public void run() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
BIN
core/org.eclipse.cdt.ui/icons/full/obj16/csearch_obj.gif
Normal file
BIN
core/org.eclipse.cdt.ui/icons/full/obj16/csearch_obj.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 959 B |
|
@ -888,5 +888,18 @@
|
|||
</tool>
|
||||
</target>
|
||||
</extension>
|
||||
<extension
|
||||
id="org.eclipse.cdt.ui.CSearchPage"
|
||||
name="CSearchPage"
|
||||
point="org.eclipse.search.searchPages">
|
||||
<page
|
||||
showScopeSection="true"
|
||||
label="C/CPP Search"
|
||||
icon="icons/full/obj16/csearch_obj.gif"
|
||||
class="org.eclipse.cdt.internal.ui.search.CSearchPage"
|
||||
sizeHint="460, 160"
|
||||
id="org.eclipse.cdt.ui.CSearchPage">
|
||||
</page>
|
||||
</extension>
|
||||
|
||||
</plugin>
|
||||
|
|
|
@ -0,0 +1,72 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2003 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Corp. - Rational Software - initial implementation
|
||||
******************************************************************************/
|
||||
/*
|
||||
* Created on Jun 11, 2003
|
||||
*/
|
||||
package org.eclipse.cdt.internal.ui.search;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.MissingResourceException;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
/**
|
||||
* @author aniefer
|
||||
*
|
||||
* To change the template for this generated type comment go to
|
||||
* Window>Preferences>Java>Code Generation>Code and Comments
|
||||
*/
|
||||
public class CSearchMessages {
|
||||
private static final String RESOURCE_BUNDLE= CSearchMessages.class.getName();
|
||||
|
||||
private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE);
|
||||
|
||||
private CSearchMessages() {
|
||||
}
|
||||
|
||||
public static String getString(String key) {
|
||||
try {
|
||||
return fgResourceBundle.getString(key);
|
||||
} catch (MissingResourceException e) {
|
||||
return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Gets a string from the resource bundle and formats it with the argument
|
||||
*
|
||||
* @param key the string used to get the bundle value, must not be null
|
||||
*/
|
||||
public static String getFormattedString(String key, Object[] args) {
|
||||
String format= null;
|
||||
try {
|
||||
format= fgResourceBundle.getString(key);
|
||||
} catch (MissingResourceException e) {
|
||||
return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
|
||||
}
|
||||
return MessageFormat.format(format, args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a string from the resource bundle and formats it with the argument
|
||||
*
|
||||
* @param key the string used to get the bundle value, must not be null
|
||||
*/
|
||||
public static String getFormattedString(String key, Object arg) {
|
||||
String format= null;
|
||||
try {
|
||||
format= fgResourceBundle.getString(key);
|
||||
} catch (MissingResourceException e) {
|
||||
return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
|
||||
}
|
||||
if (arg == null)
|
||||
arg= ""; //$NON-NLS-1$
|
||||
return MessageFormat.format(format, new Object[] { arg });
|
||||
}
|
||||
}
|
|
@ -0,0 +1,162 @@
|
|||
###############################################################################
|
||||
# Copyright (c) 2000, 2003 IBM Corporation and others.
|
||||
# All rights reserved. This program and the accompanying materials
|
||||
# are made available under the terms of the Common Public License v1.0
|
||||
# which accompanies this distribution, and is available at
|
||||
# http://www.eclipse.org/legal/cpl-v10.html
|
||||
#
|
||||
# Contributors:
|
||||
# IBM Corporation - initial API and implementation
|
||||
###############################################################################
|
||||
|
||||
group.search=S&earch
|
||||
group.declarations= Dec&larations
|
||||
group.references= Re&ferences
|
||||
group.readReferences= &Read Access
|
||||
group.writeReferences= &Write Access
|
||||
group.implementors= &Implementors
|
||||
|
||||
Search.Error.search.title=Search Error
|
||||
Search.Error.search.message=An error occurred during the search operation
|
||||
|
||||
Search.Error.javaElementAccess.title=Search Error
|
||||
Search.Error.javaElementAccess.message=An error occurred while accessing a Java element
|
||||
|
||||
Search.Error.markerAttributeAccess.title=Search Error
|
||||
Search.Error.markerAttributeAccess.message=An error occurred while accessing a marker attribute
|
||||
|
||||
Search.Error.createJavaElement.title=Search Error
|
||||
Search.Error.createJavaElement.message=An error occurred while creating a Java element
|
||||
|
||||
Search.Error.openEditor.title=Search Error
|
||||
Search.Error.openEditor.message=Could not open the editor
|
||||
|
||||
Search.Error.codeResolve= Code resolve error
|
||||
|
||||
Search.Error.setDescription.title=Search Error
|
||||
Search.Error.setDescription.message=Cannot save workspace description
|
||||
|
||||
SearchElementSelectionDialog.title=Search
|
||||
SearchElementSelectionDialog.message=Select the element to search for.
|
||||
|
||||
SearchResultCollector.match= 1 match
|
||||
SearchResultCollector.matches= {0} matches
|
||||
SearchResultCollector.done= Search done: {0}.
|
||||
SearchResultCollector.searching= Searching...
|
||||
|
||||
Search.potentialMatchDialog.title.foundPotentialMatch= Search: Found 1 Inexact Match
|
||||
Search.potentialMatchDialog.title.foundPotentialMatches= Search: Found {0} Inexact Matches
|
||||
Search.potentialMatchDialog.message= Inexact matches were found and will be displayed with a different\nforeground color. This can be configured on the Search preference page.
|
||||
|
||||
SearchPage.searchFor.label= Search For
|
||||
SearchPage.searchFor.type= &Type
|
||||
SearchPage.searchFor.method= &Method
|
||||
SearchPage.searchFor.field= &Field
|
||||
SearchPage.searchFor.package= &Package
|
||||
SearchPage.searchFor.constructor= Co&nstructor
|
||||
|
||||
SearchPage.limitTo.label= Limit To
|
||||
SearchPage.limitTo.declarations= Dec&larations
|
||||
SearchPage.limitTo.implementors= &Implementors
|
||||
SearchPage.limitTo.references= &References
|
||||
SearchPage.limitTo.allOccurrences= All &Occurrences
|
||||
SearchPage.limitTo.readReferences= Read A&ccess
|
||||
SearchPage.limitTo.writeReferences= Writ&e Access
|
||||
|
||||
SearchPage.expression.label= Se&arch string (* = any string, ? = any character):
|
||||
SearchPage.expression.caseSensitive= Case sens&itive
|
||||
|
||||
# Concatenate two working set names e.g. "Source, Lib"
|
||||
SearchUtil.workingSetConcatenation= {0}, {1}
|
||||
|
||||
Search.FindDeclarationAction.label= &Workspace
|
||||
Search.FindDeclarationAction.tooltip= Search for Declarations of the Selected Element in the Workspace
|
||||
|
||||
Search.FindDeclarationsInWorkingSetAction.label= Working &Set...
|
||||
Search.FindDeclarationsInWorkingSetAction.tooltip= Search for Declarations of the Selected Element in a Working Set
|
||||
|
||||
Search.FindHierarchyDeclarationsAction.label= &Hierarchy
|
||||
Search.FindHierarchyDeclarationsAction.tooltip= Search for Declarations of the Selected Element in its Hierarchy
|
||||
|
||||
Search.FindImplementorsAction.label= &Workspace
|
||||
Search.FindImplementorsAction.tooltip= Search for Implementors of the Selected Interface
|
||||
|
||||
Search.FindImplementorsInWorkingSetAction.label= Working &Set...
|
||||
Search.FindImplementorsInWorkingSetAction.tooltip= Search for Implementors of the Selected Interface in a Working Set
|
||||
|
||||
Search.FindReferencesAction.label= &Workspace
|
||||
Search.FindReferencesAction.tooltip= Search for References to the Selected Element in the Workspace
|
||||
|
||||
Search.FindReferencesAction.BinPrimConstWarnDialog.title= Search for References to a Binary Constant
|
||||
Search.FindReferencesAction.BinPrimConstWarnDialog.message= Matches to this constant will only be discovered in source files and binary files where the constant value is not inlined.
|
||||
|
||||
Search.FindReferencesInWorkingSetAction.label= Working &Set...
|
||||
Search.FindReferencesInWorkingSetAction.tooltip= Search for References to the Selected Element in a Working Set
|
||||
|
||||
Search.FindHierarchyReferencesAction.label= &Hierarchy
|
||||
Search.FindHierarchyReferencesAction.tooltip= Search for References of the Selected Element in its Hierarchy
|
||||
|
||||
Search.FindReadReferencesAction.label= &Workspace
|
||||
Search.FindReadReferencesAction.tooltip= Search for Read References to the Selected Element in the Workspace
|
||||
|
||||
Search.FindReadReferencesInWorkingSetAction.label= Working &Set...
|
||||
Search.FindReadReferencesInWorkingSetAction.tooltip= Search for Read References to the Selected Element in a Working Set
|
||||
|
||||
Search.FindReadReferencesInHierarchyAction.label= &Hierarchy
|
||||
Search.FindReadReferencesInHierarchyAction.tooltip= Search for Read References of the Selected Element in its Hierarchy
|
||||
|
||||
Search.FindWriteReferencesAction.label= &Workspace
|
||||
Search.FindWriteReferencesAction.tooltip= Search for Write References to the Selected Element in the Workspace
|
||||
|
||||
Search.FindWriteReferencesInWorkingSetAction.label= Working &Set...
|
||||
Search.FindWriteReferencesInWorkingSetAction.tooltip= Search for Write References to the Selected Element in a Working Set
|
||||
|
||||
Search.FindWriteReferencesInHierarchyAction.label= &Hierarchy
|
||||
Search.FindWriteReferencesInHierarchyAction.tooltip= Search for Write References of the Selected Element in its Hierarchy
|
||||
|
||||
Search.FindOccurrencesInFile.label= Occurre&nces in File
|
||||
Search.FindOccurrencesInFile.tooltip= Find occurrences of selected element in the editor
|
||||
|
||||
FindOccurrencesEngine.noSource.text= No source available. To perform this operation you need to attach source.
|
||||
FindOccurrencesEngine.noJavaElement.text= Cannot search for the current selection. Please select a valid Java element name.
|
||||
FindOccurrencesEngine.cannotParse.text= Cannot analyze the compilation unit or class file.
|
||||
|
||||
|
||||
JavaSearchOperation.default_package=(default package)
|
||||
|
||||
# The first argument will be replaced by the pattern and the second by the scope
|
||||
JavaSearchOperation.singularDeclarationsPostfix={0} - 1 Declaration in {1}
|
||||
JavaSearchOperation.singularReferencesPostfix={0} - 1 Reference in {1}
|
||||
JavaSearchOperation.singularReadReferencesPostfix={0} - 1 Read Reference in {1}
|
||||
JavaSearchOperation.singularWriteReferencesPostfix={0} - 1 Write Reference in {1}
|
||||
JavaSearchOperation.singularImplementorsPostfix={0} - 1 Implementor in {1}
|
||||
JavaSearchOperation.singularOccurrencesPostfix={0} - 1 Occurrence in {1}
|
||||
|
||||
# The first argument will be replaced by the pattern, the second by the count and the last by the scope
|
||||
JavaSearchOperation.pluralDeclarationsPostfix={0} - {1} Declarations in {2}
|
||||
JavaSearchOperation.pluralReferencesPostfix={0} - {1} References in {2}
|
||||
JavaSearchOperation.pluralReadReferencesPostfix={0} - {1} Read References in {2}
|
||||
JavaSearchOperation.pluralWriteReferencesPostfix={0} - {1} Write References in {2}
|
||||
JavaSearchOperation.pluralImplementorsPostfix={0} - {1} Implementors in {2}
|
||||
JavaSearchOperation.pluralOccurrencesPostfix={0} - {1} Occurrences in {2}
|
||||
|
||||
# The first argument will be replaced by the element name and the second one by the file name
|
||||
JavaSearchInFile.singularPostfix={0} - 1 Occurrence in {1}
|
||||
# The first argument will be replaced by the element name, the second by the count and the last by the file name
|
||||
JavaSearchInFile.pluralPostfix={0} - {1} Occurrences in {2}
|
||||
|
||||
JavaElementAction.typeSelectionDialog.title=Search
|
||||
JavaElementAction.typeSelectionDialog.message=&Select the type to search:
|
||||
JavaElementAction.error.open.message=An exception occurred while opening the type.
|
||||
|
||||
JavaElementAction.operationUnavailable.title= Operation Unavailable
|
||||
JavaElementAction.operationUnavailable.generic= The operation is unavailable on the current selection. Please select a valid Java element name.
|
||||
JavaElementAction.operationUnavailable.field= The operation is unavailable on the current selection. Please select the name of a field.
|
||||
JavaElementAction.operationUnavailable.interface= The operation is unavailable on the current selection. Please select the name of an interface.
|
||||
|
||||
JavaSearchResultLabelProvider.potentialMatch= \ (inexact)
|
||||
|
||||
WorkspaceScope= Workspace
|
||||
WorkingSetScope= Working Set - {0}
|
||||
SelectionScope= Selection
|
||||
HierarchyScope= Hierarchy - {0}
|
|
@ -0,0 +1,85 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2003 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Corp. - Rational Software - initial implementation
|
||||
******************************************************************************/
|
||||
/*
|
||||
* Created on Jun 11, 2003
|
||||
*/
|
||||
package org.eclipse.cdt.internal.ui.search;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
import org.eclipse.cdt.core.search.ICSearchPattern;
|
||||
import org.eclipse.cdt.core.search.ICSearchScope;
|
||||
import org.eclipse.cdt.core.search.SearchEngine;
|
||||
import org.eclipse.core.resources.IWorkspace;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.ui.actions.WorkspaceModifyOperation;
|
||||
|
||||
/**
|
||||
* @author aniefer
|
||||
*
|
||||
* To change the template for this generated type comment go to
|
||||
* Window>Preferences>Java>Code Generation>Code and Comments
|
||||
*/
|
||||
public class CSearchOperation extends WorkspaceModifyOperation {
|
||||
|
||||
public CSearchOperation(IWorkspace workspace, ICElement element, int limitTo, ICSearchScope scope, String scopeDescription, CSearchResultCollector collector) {
|
||||
this( workspace, limitTo, scope, scopeDescription, collector );
|
||||
_elementPattern = element;
|
||||
}
|
||||
|
||||
public CSearchOperation(IWorkspace workspace, String pattern, boolean caseSensitive, int searchFor, int limitTo, ICSearchScope scope, String scopeDescription, CSearchResultCollector collector) {
|
||||
this( workspace, limitTo, scope, scopeDescription, collector );
|
||||
_stringPattern = pattern;
|
||||
_caseSensitive = caseSensitive;
|
||||
_searchFor = searchFor;
|
||||
}
|
||||
|
||||
public CSearchOperation(IWorkspace workspace, int limitTo, ICSearchScope scope, String scopeDescription, CSearchResultCollector collector ){
|
||||
_workspace = workspace;
|
||||
_limitTo = limitTo;
|
||||
_scope = scope;
|
||||
_scopeDecsription = scopeDescription;
|
||||
_collector = collector;
|
||||
_collector.setOperation( this );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.ui.actions.WorkspaceModifyOperation#execute(org.eclipse.core.runtime.IProgressMonitor)
|
||||
*/
|
||||
protected void execute(IProgressMonitor monitor)
|
||||
throws CoreException, InvocationTargetException, InterruptedException
|
||||
{
|
||||
_collector.setProgressMonitor( monitor );
|
||||
|
||||
SearchEngine engine = new SearchEngine( );
|
||||
if( _elementPattern != null ){
|
||||
engine.search( _workspace, _elementPattern, _limitTo, _scope, _collector );
|
||||
} else {
|
||||
ICSearchPattern pattern = SearchEngine.createSearchPattern( _stringPattern, _searchFor, _limitTo, _caseSensitive );
|
||||
engine.search( _workspace, pattern, _scope, _collector );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private CSearchResultCollector _collector;
|
||||
private IWorkspace _workspace;
|
||||
private ICElement _elementPattern;
|
||||
private ICSearchScope _scope;
|
||||
private String _stringPattern;
|
||||
private String _scopeDecsription;
|
||||
private boolean _caseSensitive;
|
||||
private int _limitTo;
|
||||
private int _searchFor;
|
||||
|
||||
}
|
|
@ -0,0 +1,607 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2003 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Corp. - Rational Software - initial implementation
|
||||
******************************************************************************/
|
||||
/*
|
||||
* Created on Jun 10, 2003
|
||||
*/
|
||||
package org.eclipse.cdt.internal.ui.search;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.StringReader;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
import org.eclipse.cdt.core.search.ICSearchConstants;
|
||||
import org.eclipse.cdt.core.search.ICSearchScope;
|
||||
import org.eclipse.cdt.core.search.SearchEngine;
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
import org.eclipse.core.resources.IWorkspace;
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.jface.dialogs.Dialog;
|
||||
import org.eclipse.jface.dialogs.DialogPage;
|
||||
import org.eclipse.jface.dialogs.IDialogSettings;
|
||||
|
||||
import org.eclipse.jface.text.ITextSelection;
|
||||
import org.eclipse.jface.util.Assert;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.jface.viewers.StructuredSelection;
|
||||
|
||||
import org.eclipse.search.internal.ui.util.RowLayouter;
|
||||
|
||||
import org.eclipse.search.ui.ISearchPage;
|
||||
import org.eclipse.search.ui.ISearchPageContainer;
|
||||
import org.eclipse.search.ui.ISearchResultViewEntry;
|
||||
import org.eclipse.search.ui.SearchUI;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.ModifyEvent;
|
||||
import org.eclipse.swt.events.ModifyListener;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Button;
|
||||
import org.eclipse.swt.widgets.Combo;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.swt.widgets.Group;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.ui.IWorkbenchPage;
|
||||
import org.eclipse.ui.IWorkbenchPart;
|
||||
import org.eclipse.ui.IWorkbenchWindow;
|
||||
import org.eclipse.ui.IWorkingSet;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
import org.eclipse.ui.model.IWorkbenchAdapter;
|
||||
|
||||
/**
|
||||
* @author aniefer
|
||||
*
|
||||
* To change the template for this generated type comment go to
|
||||
* Window>Preferences>Java>Code Generation>Code and Comments
|
||||
*/
|
||||
public class CSearchPage extends DialogPage implements ISearchPage, ICSearchConstants {
|
||||
|
||||
public static final String EXTENSION_POINT_ID= "org.eclipse.cdt.ui.CSearchPage"; //$NON-NLS-1$
|
||||
|
||||
public boolean performAction() {
|
||||
SearchUI.activateSearchResultView();
|
||||
|
||||
SearchPatternData data = getPatternData();
|
||||
IWorkspace workspace = CUIPlugin.getWorkspace();
|
||||
|
||||
ICSearchScope scope = null;
|
||||
String scopeDescription = ""; //$NON-NLS-1$
|
||||
|
||||
switch( getContainer().getSelectedScope() ) {
|
||||
case ISearchPageContainer.WORKSPACE_SCOPE:
|
||||
scopeDescription = CSearchMessages.getString("WorkspaceScope"); //$NON-NLS-1$
|
||||
scope = SearchEngine.createWorkspaceScope();
|
||||
break;
|
||||
case ISearchPageContainer.SELECTION_SCOPE:
|
||||
scopeDescription = CSearchMessages.getString("SelectionScope"); //$NON-NLS-1$
|
||||
scope = CSearchScopeFactory.getInstance().createCSearchScope(fStructuredSelection);
|
||||
break;
|
||||
case ISearchPageContainer.WORKING_SET_SCOPE:
|
||||
IWorkingSet[] workingSets= getContainer().getSelectedWorkingSets();
|
||||
// should not happen - just to be sure
|
||||
if (workingSets == null || workingSets.length < 1)
|
||||
return false;
|
||||
scopeDescription = CSearchMessages.getFormattedString("WorkingSetScope", CSearchUtil.toString(workingSets)); //$NON-NLS-1$
|
||||
scope= CSearchScopeFactory.getInstance().createCSearchScope(getContainer().getSelectedWorkingSets());
|
||||
CSearchUtil.updateLRUWorkingSets(getContainer().getSelectedWorkingSets());
|
||||
}
|
||||
|
||||
CSearchResultCollector collector= new CSearchResultCollector();
|
||||
CSearchOperation op = null;
|
||||
if (data.cElement != null && getPattern().equals(fInitialData.pattern)) {
|
||||
op = new CSearchOperation(workspace, data.cElement, data.limitTo, scope, scopeDescription, collector);
|
||||
if (data.limitTo == ICSearchConstants.REFERENCES)
|
||||
CSearchUtil.warnIfBinaryConstant(data.cElement, getShell());
|
||||
} else {
|
||||
data.cElement= null;
|
||||
op = new CSearchOperation(workspace, data.pattern, data.isCaseSensitive, data.searchFor, data.limitTo, scope, scopeDescription, collector);
|
||||
}
|
||||
|
||||
try {
|
||||
getContainer().getRunnableContext().run(true, true, op);
|
||||
} catch (InvocationTargetException ex) {
|
||||
Shell shell = getControl().getShell();
|
||||
//ExceptionHandler.handle(ex, shell, CSearchMessages.getString("Search.Error.search.title"), CSearchMessages.getString("Search.Error.search.message")); //$NON-NLS-2$ //$NON-NLS-1$
|
||||
return false;
|
||||
} catch (InterruptedException ex) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void createControl(Composite parent) {
|
||||
initializeDialogUnits( parent );
|
||||
readConfiguration();
|
||||
|
||||
GridData gd;
|
||||
Composite result = new Composite( parent, SWT.NONE );
|
||||
GridLayout layout = new GridLayout( 2, false );
|
||||
layout.horizontalSpacing = 10;
|
||||
result.setLayout( layout );
|
||||
result.setLayoutData( new GridData(GridData.FILL_HORIZONTAL) );
|
||||
|
||||
RowLayouter layouter = new RowLayouter( layout.numColumns );
|
||||
gd = new GridData();
|
||||
gd.horizontalAlignment = GridData.FILL;
|
||||
gd.verticalAlignment = GridData.VERTICAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_FILL;
|
||||
|
||||
layouter.setDefaultGridData( gd, 0 );
|
||||
layouter.setDefaultGridData( gd, 1 );
|
||||
layouter.setDefaultSpan();
|
||||
|
||||
layouter.perform( createExpression(result) );
|
||||
layouter.perform( createSearchFor(result), createLimitTo(result), -1 );
|
||||
|
||||
SelectionAdapter cElementInitializer = new SelectionAdapter() {
|
||||
public void widgetSelected( SelectionEvent event ) {
|
||||
if( getSearchFor() == fInitialData.searchFor )
|
||||
fCElement= fInitialData.cElement;
|
||||
else
|
||||
fCElement= null;
|
||||
|
||||
setLimitTo( getSearchFor() );
|
||||
updateCaseSensitiveCheckbox();
|
||||
}
|
||||
};
|
||||
|
||||
fSearchFor[ TYPE ].addSelectionListener(cElementInitializer);
|
||||
fSearchFor[ METHOD ].addSelectionListener(cElementInitializer);
|
||||
fSearchFor[ FIELD ].addSelectionListener(cElementInitializer);
|
||||
fSearchFor[CONSTRUCTOR].addSelectionListener(cElementInitializer);
|
||||
//fSearchFor[ PACKAGE ].addSelectionListener(cElementInitializer);
|
||||
|
||||
setControl( result );
|
||||
|
||||
Dialog.applyDialogFont( result );
|
||||
//WorkbenchHelp.setHelp(result, IJavaHelpContextIds.JAVA_SEARCH_PAGE);
|
||||
}
|
||||
|
||||
private Control createExpression( Composite parent ) {
|
||||
Composite result = new Composite(parent, SWT.NONE);
|
||||
GridLayout layout = new GridLayout(2, false);
|
||||
result.setLayout(layout);
|
||||
GridData gd = new GridData( GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL );
|
||||
gd.horizontalSpan = 2;
|
||||
gd.horizontalIndent = 0;
|
||||
result.setLayoutData( gd );
|
||||
|
||||
// Pattern text + info
|
||||
Label label = new Label( result, SWT.LEFT );
|
||||
label.setText( CSearchMessages.getString( "SearchPage.expression.label" ) ); //$NON-NLS-1$
|
||||
gd = new GridData( GridData.BEGINNING );
|
||||
gd.horizontalSpan = 2;
|
||||
label.setLayoutData( gd );
|
||||
|
||||
// Pattern combo
|
||||
fPattern = new Combo( result, SWT.SINGLE | SWT.BORDER );
|
||||
fPattern.addSelectionListener( new SelectionAdapter() {
|
||||
public void widgetSelected( SelectionEvent e ) {
|
||||
handlePatternSelected();
|
||||
}
|
||||
});
|
||||
|
||||
fPattern.addModifyListener( new ModifyListener() {
|
||||
public void modifyText( ModifyEvent e ) {
|
||||
getContainer().setPerformActionEnabled( getPattern().length() > 0 );
|
||||
updateCaseSensitiveCheckbox();
|
||||
}
|
||||
});
|
||||
|
||||
gd = new GridData( GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL );
|
||||
gd.horizontalIndent = -gd.horizontalIndent;
|
||||
fPattern.setLayoutData( gd );
|
||||
|
||||
|
||||
// Ignore case checkbox
|
||||
fCaseSensitive= new Button(result, SWT.CHECK);
|
||||
fCaseSensitive.setText(CSearchMessages.getString("SearchPage.expression.caseSensitive")); //$NON-NLS-1$
|
||||
gd= new GridData();
|
||||
fCaseSensitive.setLayoutData(gd);
|
||||
fCaseSensitive.addSelectionListener( new SelectionAdapter() {
|
||||
public void widgetSelected( SelectionEvent e ) {
|
||||
fIsCaseSensitive= fCaseSensitive.getSelection();
|
||||
writeConfiguration();
|
||||
}
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
private void handlePatternSelected() {
|
||||
if( fPattern.getSelectionIndex() < 0 )
|
||||
return;
|
||||
|
||||
int index = fgPreviousSearchPatterns.size() - 1 - fPattern.getSelectionIndex();
|
||||
fInitialData = (SearchPatternData) fgPreviousSearchPatterns.get( index );
|
||||
|
||||
for (int i = 0; i < fSearchFor.length; i++)
|
||||
fSearchFor[i].setSelection(false);
|
||||
|
||||
for (int i = 0; i < fLimitTo.length; i++)
|
||||
fLimitTo[i].setSelection(false);
|
||||
|
||||
fSearchFor[ fInitialData.searchFor ].setSelection( true );
|
||||
setLimitTo( fInitialData.searchFor );
|
||||
fLimitTo[ fInitialData.limitTo ].setSelection( true );
|
||||
|
||||
fPattern.setText( fInitialData.pattern );
|
||||
fIsCaseSensitive = fInitialData.isCaseSensitive;
|
||||
fCElement = fInitialData.cElement;
|
||||
fCaseSensitive.setEnabled( fCElement == null );
|
||||
fCaseSensitive.setSelection( fInitialData.isCaseSensitive );
|
||||
|
||||
if( fInitialData.workingSets != null )
|
||||
getContainer().setSelectedWorkingSets( fInitialData.workingSets );
|
||||
else
|
||||
getContainer().setSelectedScope( fInitialData.scope );
|
||||
}
|
||||
|
||||
private String getPattern() {
|
||||
return fPattern.getText();
|
||||
}
|
||||
|
||||
private Control createLimitTo( Composite parent ) {
|
||||
Group result = new Group(parent, SWT.NONE);
|
||||
result.setText( CSearchMessages.getString("SearchPage.limitTo.label") ); //$NON-NLS-1$
|
||||
GridLayout layout = new GridLayout();
|
||||
layout.numColumns = 2;
|
||||
result.setLayout( layout );
|
||||
|
||||
fLimitTo = new Button[fLimitToText.length];
|
||||
for( int i = 0; i < fLimitToText.length; i++ ){
|
||||
Button button = new Button(result, SWT.RADIO);
|
||||
button.setText( fLimitToText[i] );
|
||||
fLimitTo[i] = button;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private int getLimitTo() {
|
||||
for (int i= 0; i < fLimitTo.length; i++) {
|
||||
if (fLimitTo[i].getSelection())
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
private void setLimitTo(int searchFor) {
|
||||
fLimitTo[ DECLARATIONS ].setEnabled( true );
|
||||
fLimitTo[ IMPLEMENTORS ].setEnabled( false);
|
||||
fLimitTo[ REFERENCES ].setEnabled( true );
|
||||
fLimitTo[ ALL_OCCURRENCES ].setEnabled( true );
|
||||
fLimitTo[ READ_ACCESSES ].setEnabled( false);
|
||||
fLimitTo[ WRITE_ACCESSES ].setEnabled( false);
|
||||
|
||||
if (!(searchFor == TYPE || searchFor == INTERFACE) && fLimitTo[IMPLEMENTORS].getSelection()) {
|
||||
fLimitTo[ IMPLEMENTORS ].setSelection(false);
|
||||
fLimitTo[ REFERENCES ].setSelection(true);
|
||||
}
|
||||
|
||||
if (!(searchFor == FIELD) && (getLimitTo() == READ_ACCESSES || getLimitTo() == WRITE_ACCESSES)) {
|
||||
fLimitTo[ getLimitTo()].setSelection(false);
|
||||
fLimitTo[ REFERENCES ].setSelection(true);
|
||||
}
|
||||
|
||||
switch (searchFor) {
|
||||
case TYPE:
|
||||
case INTERFACE:
|
||||
fLimitTo[ IMPLEMENTORS ].setEnabled(true);
|
||||
break;
|
||||
case FIELD:
|
||||
fLimitTo[ READ_ACCESSES ].setEnabled(true);
|
||||
fLimitTo[ WRITE_ACCESSES ].setEnabled(true);
|
||||
break;
|
||||
default :
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private Control createSearchFor(Composite parent) {
|
||||
Group result= new Group(parent, SWT.NONE);
|
||||
result.setText(CSearchMessages.getString("SearchPage.searchFor.label")); //$NON-NLS-1$
|
||||
GridLayout layout= new GridLayout();
|
||||
layout.numColumns= 3;
|
||||
result.setLayout(layout);
|
||||
|
||||
fSearchFor= new Button[fSearchForText.length];
|
||||
for (int i= 0; i < fSearchForText.length; i++) {
|
||||
Button button= new Button(result, SWT.RADIO);
|
||||
button.setText(fSearchForText[i]);
|
||||
fSearchFor[i]= button;
|
||||
}
|
||||
|
||||
// Fill with dummy radio buttons
|
||||
Button filler= new Button(result, SWT.RADIO);
|
||||
filler.setVisible(false);
|
||||
filler= new Button(result, SWT.RADIO);
|
||||
filler.setVisible(false);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private int getSearchFor() {
|
||||
for (int i= 0; i < fSearchFor.length; i++) {
|
||||
if (fSearchFor[i].getSelection())
|
||||
return i;
|
||||
}
|
||||
Assert.isTrue(false, "shouldNeverHappen"); //$NON-NLS-1$
|
||||
return -1;
|
||||
}
|
||||
|
||||
public void setContainer(ISearchPageContainer container) {
|
||||
fContainer = container;
|
||||
}
|
||||
|
||||
private ISearchPageContainer getContainer() {
|
||||
return fContainer;
|
||||
}
|
||||
|
||||
|
||||
private IDialogSettings getDialogSettings() {
|
||||
IDialogSettings settings = CUIPlugin.getDefault().getDialogSettings();
|
||||
fDialogSettings = settings.getSection( PAGE_NAME );
|
||||
if( fDialogSettings == null )
|
||||
fDialogSettings = settings.addNewSection( PAGE_NAME );
|
||||
|
||||
return fDialogSettings;
|
||||
}
|
||||
|
||||
private void readConfiguration() {
|
||||
IDialogSettings s = getDialogSettings();
|
||||
fIsCaseSensitive = s.getBoolean( STORE_CASE_SENSITIVE );
|
||||
}
|
||||
|
||||
private void writeConfiguration() {
|
||||
IDialogSettings s = getDialogSettings();
|
||||
s.put( STORE_CASE_SENSITIVE, fIsCaseSensitive );
|
||||
}
|
||||
|
||||
public void setVisible(boolean visible) {
|
||||
if (visible && fPattern != null) {
|
||||
if (fFirstTime) {
|
||||
fFirstTime= false;
|
||||
// Set item and text here to prevent page from resizing
|
||||
fPattern.setItems(getPreviousSearchPatterns());
|
||||
initSelections();
|
||||
}
|
||||
fPattern.setFocus();
|
||||
getContainer().setPerformActionEnabled(fPattern.getText().length() > 0);
|
||||
}
|
||||
super.setVisible(visible);
|
||||
}
|
||||
|
||||
private void updateCaseSensitiveCheckbox() {
|
||||
if (fInitialData != null && getPattern().equals(fInitialData.pattern) && fCElement != null) {
|
||||
fCaseSensitive.setEnabled(false);
|
||||
fCaseSensitive.setSelection(true);
|
||||
}
|
||||
else {
|
||||
fCaseSensitive.setEnabled(true);
|
||||
fCaseSensitive.setSelection(fIsCaseSensitive);
|
||||
}
|
||||
}
|
||||
|
||||
private void initSelections() {
|
||||
fStructuredSelection = asStructuredSelection();
|
||||
fInitialData = tryStructuredSelection( fStructuredSelection );
|
||||
if (fInitialData == null)
|
||||
fInitialData = trySimpleTextSelection( getContainer().getSelection() );
|
||||
if (fInitialData == null)
|
||||
fInitialData = getDefaultInitValues();
|
||||
|
||||
fCElement = fInitialData.cElement;
|
||||
fCaseSensitive.setSelection( fInitialData.isCaseSensitive );
|
||||
fCaseSensitive.setEnabled( fInitialData.cElement == null );
|
||||
fSearchFor[ fInitialData.searchFor ].setSelection( true );
|
||||
setLimitTo( fInitialData.searchFor );
|
||||
fLimitTo[ fInitialData.limitTo ].setSelection( true );
|
||||
fPattern.setText( fInitialData.pattern );
|
||||
}
|
||||
|
||||
private SearchPatternData tryStructuredSelection( IStructuredSelection selection ) {
|
||||
if( selection == null || selection.size() > 1 )
|
||||
return null;
|
||||
|
||||
Object o = selection.getFirstElement();
|
||||
if( o instanceof ICElement ) {
|
||||
return determineInitValuesFrom( (ICElement)o );
|
||||
} else if( o instanceof ISearchResultViewEntry ) {
|
||||
ICElement element = CSearchUtil.getCElement( ((ISearchResultViewEntry)o).getSelectedMarker() );
|
||||
return determineInitValuesFrom( element );
|
||||
//} else if( o instanceof LogicalPackage ) {
|
||||
// LogicalPackage lp = (LogicalPackage)o;
|
||||
// return new SearchPatternData( PACKAGE, REFERENCES, fIsCaseSensitive, lp.getElementName(), null );
|
||||
} else if( o instanceof IAdaptable ) {
|
||||
ICElement element = (ICElement)((IAdaptable)o).getAdapter( ICElement.class );
|
||||
if( element != null ) {
|
||||
return determineInitValuesFrom( element );
|
||||
} else {
|
||||
IWorkbenchAdapter adapter= (IWorkbenchAdapter)((IAdaptable)o).getAdapter( IWorkbenchAdapter.class );
|
||||
if( adapter != null )
|
||||
return new SearchPatternData( TYPE, REFERENCES, fIsCaseSensitive, adapter.getLabel(o), null );
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* try to initialize the Search pattern data based on the current text selection.
|
||||
* @param selection
|
||||
* @return
|
||||
*/
|
||||
private SearchPatternData trySimpleTextSelection(ISelection selection) {
|
||||
SearchPatternData result= null;
|
||||
if (selection instanceof ITextSelection) {
|
||||
BufferedReader reader= new BufferedReader(new StringReader(((ITextSelection)selection).getText()));
|
||||
String text;
|
||||
try {
|
||||
text= reader.readLine();
|
||||
if (text == null)
|
||||
text= ""; //$NON-NLS-1$
|
||||
} catch (IOException ex) {
|
||||
text= ""; //$NON-NLS-1$
|
||||
}
|
||||
result= new SearchPatternData(TYPE, REFERENCES, fIsCaseSensitive, text, null);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private SearchPatternData getDefaultInitValues() {
|
||||
return new SearchPatternData(TYPE, REFERENCES, fIsCaseSensitive, "", null); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
private String[] getPreviousSearchPatterns() {
|
||||
// Search results are not persistent
|
||||
int patternCount= fgPreviousSearchPatterns.size();
|
||||
String [] patterns= new String[patternCount];
|
||||
for (int i= 0; i < patternCount; i++)
|
||||
patterns[i]= ((SearchPatternData) fgPreviousSearchPatterns.get(patternCount - 1 - i)).pattern;
|
||||
return patterns;
|
||||
}
|
||||
private IStructuredSelection asStructuredSelection() {
|
||||
IWorkbenchWindow wbWindow= PlatformUI.getWorkbench().getActiveWorkbenchWindow();
|
||||
if (wbWindow != null) {
|
||||
IWorkbenchPage page= wbWindow.getActivePage();
|
||||
if (page != null) {
|
||||
IWorkbenchPart part= page.getActivePart();
|
||||
if (part != null){
|
||||
//try {
|
||||
// return SelectionConverter.getStructuredSelection(part);
|
||||
//} catch (JavaModelException ex) {
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
return StructuredSelection.EMPTY;
|
||||
}
|
||||
|
||||
private SearchPatternData determineInitValuesFrom( ICElement element ) {
|
||||
if( element == null )
|
||||
return null;
|
||||
|
||||
int searchFor = UNKNOWN;
|
||||
int limitTo = UNKNOWN;
|
||||
|
||||
String pattern = null;
|
||||
switch( element.getElementType() ) {
|
||||
/*case ICElement.PACKAGE_FRAGMENT:
|
||||
searchFor= PACKAGE;
|
||||
limitTo= REFERENCES;
|
||||
pattern= element.getElementName();
|
||||
break;*/
|
||||
}
|
||||
|
||||
if( searchFor != UNKNOWN && limitTo != UNKNOWN && pattern != null )
|
||||
return new SearchPatternData( searchFor, limitTo, true, pattern, element );
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private SearchPatternData getPatternData() {
|
||||
String pattern= getPattern();
|
||||
SearchPatternData match= null;
|
||||
int i= 0;
|
||||
int size= fgPreviousSearchPatterns.size();
|
||||
while (match == null && i < size) {
|
||||
match= (SearchPatternData) fgPreviousSearchPatterns.get(i);
|
||||
i++;
|
||||
if (!pattern.equals(match.pattern))
|
||||
match= null;
|
||||
};
|
||||
if (match == null) {
|
||||
match= new SearchPatternData(
|
||||
getSearchFor(),
|
||||
getLimitTo(),
|
||||
pattern,
|
||||
fCaseSensitive.getSelection(),
|
||||
fCElement,
|
||||
getContainer().getSelectedScope(),
|
||||
getContainer().getSelectedWorkingSets());
|
||||
fgPreviousSearchPatterns.add(match);
|
||||
}
|
||||
else {
|
||||
match.searchFor= getSearchFor();
|
||||
match.limitTo= getLimitTo();
|
||||
match.isCaseSensitive= fCaseSensitive.getSelection();
|
||||
match.cElement= fCElement;
|
||||
match.scope= getContainer().getSelectedScope();
|
||||
match.workingSets= getContainer().getSelectedWorkingSets();
|
||||
};
|
||||
return match;
|
||||
}
|
||||
|
||||
private static class SearchPatternData {
|
||||
int searchFor;
|
||||
int limitTo;
|
||||
String pattern;
|
||||
boolean isCaseSensitive;
|
||||
ICElement cElement;
|
||||
int scope;
|
||||
IWorkingSet[] workingSets;
|
||||
|
||||
public SearchPatternData(int s, int l, boolean i, String p, ICElement element) {
|
||||
this(s, l, p, i, element, ISearchPageContainer.WORKSPACE_SCOPE, null);
|
||||
}
|
||||
|
||||
public SearchPatternData(int s, int l, String p, boolean i, ICElement element, int scope, IWorkingSet[] workingSets) {
|
||||
searchFor= s;
|
||||
limitTo= l;
|
||||
pattern= p;
|
||||
isCaseSensitive= i;
|
||||
cElement= element;
|
||||
this.scope= scope;
|
||||
this.workingSets= workingSets;
|
||||
}
|
||||
}
|
||||
|
||||
//Dialog store id constants
|
||||
private final static String PAGE_NAME= "CSearchPage"; //$NON-NLS-1$
|
||||
private final static String STORE_CASE_SENSITIVE= PAGE_NAME + "CASE_SENSITIVE"; //$NON-NLS-1$
|
||||
|
||||
private static List fgPreviousSearchPatterns= new ArrayList(20);
|
||||
|
||||
private Button[] fSearchFor;
|
||||
private String[] fSearchForText= {
|
||||
CSearchMessages.getString("SearchPage.searchFor.type"), //$NON-NLS-1$
|
||||
CSearchMessages.getString("SearchPage.searchFor.method"), //$NON-NLS-1$
|
||||
//CSearchMessages.getString("SearchPage.searchFor.package"), //$NON-NLS-1$
|
||||
CSearchMessages.getString("SearchPage.searchFor.constructor"), //$NON-NLS-1$
|
||||
CSearchMessages.getString("SearchPage.searchFor.field")}; //$NON-NLS-1$
|
||||
|
||||
private Button[] fLimitTo;
|
||||
private String[] fLimitToText= {
|
||||
CSearchMessages.getString("SearchPage.limitTo.declarations"), //$NON-NLS-1$
|
||||
CSearchMessages.getString("SearchPage.limitTo.implementors"), //$NON-NLS-1$
|
||||
CSearchMessages.getString("SearchPage.limitTo.references"), //$NON-NLS-1$
|
||||
CSearchMessages.getString("SearchPage.limitTo.allOccurrences"), //$NON-NLS-1$
|
||||
CSearchMessages.getString("SearchPage.limitTo.readReferences"), //$NON-NLS-1$
|
||||
CSearchMessages.getString("SearchPage.limitTo.writeReferences")}; //$NON-NLS-1$
|
||||
|
||||
private SearchPatternData fInitialData;
|
||||
private IStructuredSelection fStructuredSelection;
|
||||
private ICElement fCElement;
|
||||
private boolean fFirstTime= true;
|
||||
private IDialogSettings fDialogSettings;
|
||||
private boolean fIsCaseSensitive;
|
||||
|
||||
private Combo fPattern;
|
||||
private ISearchPageContainer fContainer;
|
||||
private Button fCaseSensitive;
|
||||
}
|
|
@ -0,0 +1,92 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2003 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Corp. - Rational Software - initial implementation
|
||||
******************************************************************************/
|
||||
/*
|
||||
* Created on Jun 11, 2003
|
||||
*/
|
||||
package org.eclipse.cdt.internal.ui.search;
|
||||
|
||||
import org.eclipse.cdt.core.search.ICSearchResultCollector;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
|
||||
/**
|
||||
* @author aniefer
|
||||
*
|
||||
* To change the template for this generated type comment go to
|
||||
* Window>Preferences>Java>Code Generation>Code and Comments
|
||||
*/
|
||||
public class CSearchResultCollector implements ICSearchResultCollector {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public CSearchResultCollector() {
|
||||
super();
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.search.ICSearchResultCollector#aboutToStart()
|
||||
*/
|
||||
public void aboutToStart() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.search.ICSearchResultCollector#accept(org.eclipse.core.resources.IResource, int, int, java.lang.Object, int)
|
||||
*/
|
||||
public void accept(
|
||||
IResource resource,
|
||||
int start,
|
||||
int end,
|
||||
Object enclosingElement,
|
||||
int accuracy)
|
||||
throws CoreException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.search.ICSearchResultCollector#done()
|
||||
*/
|
||||
public void done() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.search.ICSearchResultCollector#getProgressMonitor()
|
||||
*/
|
||||
public IProgressMonitor getProgressMonitor() {
|
||||
return _monitor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param monitor
|
||||
*/
|
||||
public void setProgressMonitor(IProgressMonitor monitor) {
|
||||
this._monitor = monitor;
|
||||
}
|
||||
|
||||
private IProgressMonitor _monitor;
|
||||
|
||||
/**
|
||||
* @param operation
|
||||
*/
|
||||
public void setOperation( CSearchOperation operation ) {
|
||||
_operation = operation;
|
||||
}
|
||||
|
||||
|
||||
private CSearchOperation _operation;
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2003 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Corp. - Rational Software - initial implementation
|
||||
******************************************************************************/
|
||||
/*
|
||||
* Created on Jun 12, 2003
|
||||
*/
|
||||
package org.eclipse.cdt.internal.ui.search;
|
||||
|
||||
import org.eclipse.cdt.core.search.ICSearchScope;
|
||||
import org.eclipse.cdt.core.search.SearchEngine;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.ui.IWorkingSet;
|
||||
|
||||
/**
|
||||
* @author aniefer
|
||||
*
|
||||
* To change the template for this generated type comment go to
|
||||
* Window>Preferences>Java>Code Generation>Code and Comments
|
||||
*/
|
||||
public class CSearchScopeFactory {
|
||||
private static CSearchScopeFactory fgInstance;
|
||||
private static ICSearchScope EMPTY_SCOPE= SearchEngine.createCSearchScope(new Object[] {});
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public CSearchScopeFactory() {
|
||||
super();
|
||||
}
|
||||
|
||||
public static CSearchScopeFactory getInstance() {
|
||||
if (fgInstance == null)
|
||||
fgInstance = new CSearchScopeFactory();
|
||||
return fgInstance;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param sets
|
||||
* @return
|
||||
*/
|
||||
public ICSearchScope createCSearchScope(IWorkingSet[] sets) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param fStructuredSelection
|
||||
* @return
|
||||
*/
|
||||
public ICSearchScope createCSearchScope(IStructuredSelection fStructuredSelection) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2003 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Corp. - Rational Software - initial implementation
|
||||
******************************************************************************/
|
||||
/*
|
||||
* Created on Jun 12, 2003
|
||||
*/
|
||||
package org.eclipse.cdt.internal.ui.search;
|
||||
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
import org.eclipse.core.resources.IMarker;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.ui.IWorkingSet;
|
||||
|
||||
/**
|
||||
* @author aniefer
|
||||
*
|
||||
* To change the template for this generated type comment go to
|
||||
* Window>Preferences>Java>Code Generation>Code and Comments
|
||||
*/
|
||||
public class CSearchUtil {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public CSearchUtil() {
|
||||
super();
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
/**
|
||||
* @param sets
|
||||
*/
|
||||
public static void updateLRUWorkingSets(IWorkingSet[] sets) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object
|
||||
* @param shell
|
||||
*/
|
||||
public static void warnIfBinaryConstant( ICElement element, Shell shell) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param workingSets
|
||||
* @return
|
||||
*/
|
||||
public static Object toString(IWorkingSet[] workingSets) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param marker
|
||||
* @return
|
||||
*/
|
||||
public static ICElement getCElement(IMarker marker) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Reference in a new issue