mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-01 05:15:43 +02:00
Added ability to specify which CTags you want the CTags indexer to use
This commit is contained in:
parent
e28ba5192f
commit
f809cd9fcd
5 changed files with 244 additions and 26 deletions
|
@ -45,6 +45,7 @@ class CTagsIndexAll extends CTagsIndexRequest {
|
||||||
IProject project;
|
IProject project;
|
||||||
private String ctagsFile;
|
private String ctagsFile;
|
||||||
private String ctagsFileToUse;
|
private String ctagsFileToUse;
|
||||||
|
private String ctagsLocation;
|
||||||
|
|
||||||
public CTagsIndexAll(IProject project, CTagsIndexer indexer) {
|
public CTagsIndexAll(IProject project, CTagsIndexer indexer) {
|
||||||
super(project.getFullPath(), indexer);
|
super(project.getFullPath(), indexer);
|
||||||
|
@ -227,8 +228,15 @@ class CTagsIndexAll extends CTagsIndexRequest {
|
||||||
// Print the command for visual interaction.
|
// Print the command for visual interaction.
|
||||||
launcher.showCommand(true);
|
launcher.showCommand(true);
|
||||||
|
|
||||||
//Process p = launcher.execute(fCompileCommand, args, setEnvironment(launcher), fWorkingDirectory);
|
IPath ctagsExecutable = new Path("ctags"); //$NON-NLS-1$
|
||||||
Process p = launcher.execute(new Path("ctags"), args, null, directoryToRunFrom); //$NON-NLS-1$
|
if (!useDefaultCTags()){
|
||||||
|
//try to read the executable path from the descriptor
|
||||||
|
if (getCTagsLocation()){
|
||||||
|
ctagsExecutable = new Path(ctagsLocation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Process p = launcher.execute(ctagsExecutable, args, null, directoryToRunFrom); //$NON-NLS-1$
|
||||||
p.waitFor();
|
p.waitFor();
|
||||||
|
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
|
@ -279,6 +287,50 @@ class CTagsIndexAll extends CTagsIndexRequest {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean useDefaultCTags(){
|
||||||
|
try {
|
||||||
|
ICDescriptor cdesc = CCorePlugin.getDefault().getCProjectDescription(project, false);
|
||||||
|
if (cdesc == null)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
ICExtensionReference[] cext = cdesc.get(CCorePlugin.INDEXER_UNIQ_ID);
|
||||||
|
if (cext.length > 0) {
|
||||||
|
for (int i = 0; i < cext.length; i++) {
|
||||||
|
String orig = cext[i].getExtensionData("ctagslocationtype"); //$NON-NLS-1$
|
||||||
|
if (orig != null){
|
||||||
|
if (orig.equals(CTagsIndexer.CTAGS_PATH_DEFAULT))
|
||||||
|
return true;
|
||||||
|
else if (orig.equals(CTagsIndexer.CTAGS_PATH_SPECIFIED))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (CoreException e) {}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean getCTagsLocation() {
|
||||||
|
try {
|
||||||
|
ICDescriptor cdesc = CCorePlugin.getDefault().getCProjectDescription(project, false);
|
||||||
|
if (cdesc == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
ICExtensionReference[] cext = cdesc.get(CCorePlugin.INDEXER_UNIQ_ID);
|
||||||
|
if (cext.length > 0) {
|
||||||
|
for (int i = 0; i < cext.length; i++) {
|
||||||
|
String orig = cext[i].getExtensionData("ctagslocation"); //$NON-NLS-1$
|
||||||
|
if (orig != null){
|
||||||
|
ctagsLocation=orig;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (CoreException e) {}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
private boolean ctagIndexIncludes(){
|
private boolean ctagIndexIncludes(){
|
||||||
try {
|
try {
|
||||||
ICDescriptor cdesc = CCorePlugin.getDefault().getCProjectDescription(project, false);
|
ICDescriptor cdesc = CCorePlugin.getDefault().getCProjectDescription(project, false);
|
||||||
|
|
|
@ -63,7 +63,8 @@ public class CTagsIndexer extends AbstractCExtension implements ICDTIndexer {
|
||||||
|
|
||||||
public final static String CTAGS_INTERNAL = "ctags_internal"; //$NON-NLS-1$
|
public final static String CTAGS_INTERNAL = "ctags_internal"; //$NON-NLS-1$
|
||||||
public final static String CTAGS_EXTERNAL = "ctags_external"; //$NON-NLS-1$
|
public final static String CTAGS_EXTERNAL = "ctags_external"; //$NON-NLS-1$
|
||||||
public final static String CTAGS_LOCATION = "ctags_location"; //$NON-NLS-1$
|
public final static String CTAGS_PATH_DEFAULT = "ctags_path_default"; //$NON-NLS-1$
|
||||||
|
public final static String CTAGS_PATH_SPECIFIED = "ctags_path_specified"; //$NON-NLS-1$
|
||||||
|
|
||||||
protected List indexChangeListeners = Collections.synchronizedList(new ArrayList());
|
protected List indexChangeListeners = Collections.synchronizedList(new ArrayList());
|
||||||
public static final String INDEX_NOTIFICATION_NAME = Util.bind( "indexNotificationJob" ); //$NON-NLS-1$
|
public static final String INDEX_NOTIFICATION_NAME = Util.bind( "indexNotificationJob" ); //$NON-NLS-1$
|
||||||
|
|
|
@ -15,6 +15,8 @@ import java.io.OutputStream;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.CommandLauncher;
|
import org.eclipse.cdt.core.CommandLauncher;
|
||||||
|
import org.eclipse.cdt.core.ICDescriptor;
|
||||||
|
import org.eclipse.cdt.core.ICExtensionReference;
|
||||||
import org.eclipse.cdt.core.IConsoleParser;
|
import org.eclipse.cdt.core.IConsoleParser;
|
||||||
import org.eclipse.cdt.core.model.ICModelMarker;
|
import org.eclipse.cdt.core.model.ICModelMarker;
|
||||||
import org.eclipse.cdt.core.resources.IConsole;
|
import org.eclipse.cdt.core.resources.IConsole;
|
||||||
|
@ -33,6 +35,7 @@ import org.eclipse.core.runtime.Path;
|
||||||
*/
|
*/
|
||||||
public class CTagsIndexerRunner extends AbstractIndexerRunner {
|
public class CTagsIndexerRunner extends AbstractIndexerRunner {
|
||||||
private CTagsIndexer indexer;
|
private CTagsIndexer indexer;
|
||||||
|
String ctagsLocation;
|
||||||
/**
|
/**
|
||||||
* @param resource
|
* @param resource
|
||||||
* @param indexer
|
* @param indexer
|
||||||
|
@ -87,7 +90,16 @@ public class CTagsIndexerRunner extends AbstractIndexerRunner {
|
||||||
OutputStream consoleErr = (sniffer == null ? cos : sniffer.getErrorStream());
|
OutputStream consoleErr = (sniffer == null ? cos : sniffer.getErrorStream());
|
||||||
|
|
||||||
IPath fileDirectory = resourceFile.getRawLocation().removeLastSegments(1);
|
IPath fileDirectory = resourceFile.getRawLocation().removeLastSegments(1);
|
||||||
Process p = launcher.execute(new Path("ctags"), args, null, fileDirectory); //$NON-NLS-1$
|
|
||||||
|
IPath ctagsExecutable = new Path("ctags"); //$NON-NLS-1$
|
||||||
|
if (!useDefaultCTags()){
|
||||||
|
//try to read the executable path from the descriptor
|
||||||
|
if (getCTagsLocation()){
|
||||||
|
ctagsExecutable = new Path(ctagsLocation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Process p = launcher.execute(ctagsExecutable, args, null, fileDirectory); //$NON-NLS-1$
|
||||||
if (p != null) {
|
if (p != null) {
|
||||||
try {
|
try {
|
||||||
// Close the input of the Process explicitely.
|
// Close the input of the Process explicitely.
|
||||||
|
@ -113,6 +125,50 @@ public class CTagsIndexerRunner extends AbstractIndexerRunner {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean useDefaultCTags(){
|
||||||
|
try {
|
||||||
|
ICDescriptor cdesc = CCorePlugin.getDefault().getCProjectDescription(indexer.getProject(), false);
|
||||||
|
if (cdesc == null)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
ICExtensionReference[] cext = cdesc.get(CCorePlugin.INDEXER_UNIQ_ID);
|
||||||
|
if (cext.length > 0) {
|
||||||
|
for (int i = 0; i < cext.length; i++) {
|
||||||
|
String orig = cext[i].getExtensionData("ctagslocationtype"); //$NON-NLS-1$
|
||||||
|
if (orig != null){
|
||||||
|
if (orig.equals(CTagsIndexer.CTAGS_PATH_DEFAULT))
|
||||||
|
return true;
|
||||||
|
else if (orig.equals(CTagsIndexer.CTAGS_PATH_SPECIFIED))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (CoreException e) {}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean getCTagsLocation() {
|
||||||
|
try {
|
||||||
|
ICDescriptor cdesc = CCorePlugin.getDefault().getCProjectDescription(indexer.getProject(), false);
|
||||||
|
if (cdesc == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
ICExtensionReference[] cext = cdesc.get(CCorePlugin.INDEXER_UNIQ_ID);
|
||||||
|
if (cext.length > 0) {
|
||||||
|
for (int i = 0; i < cext.length; i++) {
|
||||||
|
String orig = cext[i].getExtensionData("ctagslocation"); //$NON-NLS-1$
|
||||||
|
if (orig != null){
|
||||||
|
ctagsLocation=orig;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (CoreException e) {}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
protected void addMarkers(IFile tempFile, IFile originator, Object problem, Object location) {}
|
protected void addMarkers(IFile tempFile, IFile originator, Object problem, Object location) {}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,10 @@ CTagsIndexerBlock.radioButtonInternal=Use internal CTags file (default)
|
||||||
CTagsIndexerBlock.radioButtonExternal=Import existing CTags file
|
CTagsIndexerBlock.radioButtonExternal=Import existing CTags file
|
||||||
CTagsIndexerBlock.browseButton=Browse...
|
CTagsIndexerBlock.browseButton=Browse...
|
||||||
CTagsIndexerBlock.fileBrowser=Select CTags File
|
CTagsIndexerBlock.fileBrowser=Select CTags File
|
||||||
|
CTagsIndexerBlock.radioButtonCTagsDefault=Use the CTags on the path (default)
|
||||||
|
CTagsIndexerBlock.radioButtonCTagsSpecified=Use the specified CTags
|
||||||
|
|
||||||
|
CTagsIndexerBlock.ctagsLocation=CTags Location
|
||||||
CTagsIndexerBlock.includeGroup=Include Files
|
CTagsIndexerBlock.includeGroup=Include Files
|
||||||
CTagsIndexerBlock.indexIncludes=Index include paths
|
CTagsIndexerBlock.indexIncludes=Index include paths
|
||||||
|
|
||||||
|
|
|
@ -47,13 +47,18 @@ public class CTagsIndexerBlock extends AbstractIndexerPage {
|
||||||
protected Button browseButton;
|
protected Button browseButton;
|
||||||
protected Text cTagsFile;
|
protected Text cTagsFile;
|
||||||
|
|
||||||
|
protected boolean useDefaultCTags = true;
|
||||||
private String storedInternalExternal;
|
protected boolean useSpecifiedCTagsExecutable = false;
|
||||||
private String storedTagFile;
|
protected Button useCTagsPath;
|
||||||
|
protected Button useCTagsExecutable;
|
||||||
|
protected Button browseButtonCTagsExec;
|
||||||
|
protected Text cTagsExecutable;
|
||||||
|
|
||||||
public final static String PREF_INTOREXT_CTAGS = CUIPlugin.PLUGIN_ID + ".intorextctags"; //$NON-NLS-1$
|
public final static String PREF_INTOREXT_CTAGS = CUIPlugin.PLUGIN_ID + ".intorextctags"; //$NON-NLS-1$
|
||||||
public final static String PREF_CTAGSLOCATION_CTAGS = CUIPlugin.PLUGIN_ID + ".ctagslocation"; //$NON-NLS-1$
|
public final static String PREF_CTAGS_FILE_LOCATION_CTAGS = CUIPlugin.PLUGIN_ID + ".ctagsfilelocation"; //$NON-NLS-1$
|
||||||
public final static String PREF_CTAGS_INDEXINCLUDEFILES = CUIPlugin.PLUGIN_ID + ".ctagsindexincludes"; //$NON-NLS-1$
|
public final static String PREF_CTAGS_INDEXINCLUDEFILES = CUIPlugin.PLUGIN_ID + ".ctagsindexincludes"; //$NON-NLS-1$
|
||||||
|
public final static String PREF_CTAGS_LOCATION_TYPE = CUIPlugin.PLUGIN_ID + ".ctagslocationtype"; //$NON-NLS-1$
|
||||||
|
public final static String PREF_CTAGS_LOCATION = CUIPlugin.PLUGIN_ID + ".ctagslocation"; //$NON-NLS-1$
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.ui.index.AbstractIndexerPage#initialize(org.eclipse.core.resources.IProject)
|
* @see org.eclipse.cdt.ui.index.AbstractIndexerPage#initialize(org.eclipse.core.resources.IProject)
|
||||||
|
@ -77,14 +82,26 @@ public class CTagsIndexerBlock extends AbstractIndexerPage {
|
||||||
ICOptionContainer container = getContainer();
|
ICOptionContainer container = getContainer();
|
||||||
IProject proj = null;
|
IProject proj = null;
|
||||||
String internalExternalCTagsString = internalTagsFile ? CTagsIndexer.CTAGS_INTERNAL : CTagsIndexer.CTAGS_EXTERNAL;
|
String internalExternalCTagsString = internalTagsFile ? CTagsIndexer.CTAGS_INTERNAL : CTagsIndexer.CTAGS_EXTERNAL;
|
||||||
String cTagsFileLocation = cTagsFile.getText();
|
String cTagsFileLocation = ""; //$NON-NLS-1$
|
||||||
|
if (!internalTagsFile)
|
||||||
|
cTagsFileLocation = cTagsFile.getText();
|
||||||
|
|
||||||
String indexIncludeFiles = new Boolean(indexIncludePaths.getSelection()).toString();
|
String indexIncludeFiles = new Boolean(indexIncludePaths.getSelection()).toString();
|
||||||
|
|
||||||
|
String cTagsLocationType = useDefaultCTags ? CTagsIndexer.CTAGS_PATH_DEFAULT : CTagsIndexer.CTAGS_PATH_SPECIFIED;
|
||||||
|
String cTagsLocation = ""; //$NON-NLS-1$
|
||||||
|
if (!useDefaultCTags)
|
||||||
|
cTagsLocation=cTagsExecutable.getText();
|
||||||
|
|
||||||
//if external has been chosen, ensure that there is a cTagsFileLocation selected; otherwise default
|
//if external has been chosen, ensure that there is a cTagsFileLocation selected; otherwise default
|
||||||
//to internal file
|
//to internal file
|
||||||
if (internalExternalCTagsString.equals(CTagsIndexer.CTAGS_EXTERNAL) && cTagsFileLocation.equals("")) //$NON-NLS-1$
|
if (internalExternalCTagsString.equals(CTagsIndexer.CTAGS_EXTERNAL) && cTagsFileLocation.equals("")) //$NON-NLS-1$
|
||||||
internalExternalCTagsString=CTagsIndexer.CTAGS_INTERNAL;
|
internalExternalCTagsString=CTagsIndexer.CTAGS_INTERNAL;
|
||||||
|
|
||||||
|
//if an external CPaths has been selected but no path has been provided, switch back to default setting
|
||||||
|
if (cTagsLocationType.equals(CTagsIndexer.CTAGS_PATH_SPECIFIED) && cTagsLocation.equals("")) //$NON-NLS-1$
|
||||||
|
cTagsLocationType=CTagsIndexer.CTAGS_PATH_DEFAULT;
|
||||||
|
|
||||||
if (container != null){
|
if (container != null){
|
||||||
proj = container.getProject();
|
proj = container.getProject();
|
||||||
}
|
}
|
||||||
|
@ -97,7 +114,6 @@ public class CTagsIndexerBlock extends AbstractIndexerPage {
|
||||||
ICExtensionReference[] cext = cdesc.get(CCorePlugin.INDEXER_UNIQ_ID);
|
ICExtensionReference[] cext = cdesc.get(CCorePlugin.INDEXER_UNIQ_ID);
|
||||||
if (cext.length > 0) {
|
if (cext.length > 0) {
|
||||||
for (int i = 0; i < cext.length; i++) {
|
for (int i = 0; i < cext.length; i++) {
|
||||||
String id = cext[i].getID();
|
|
||||||
String orig = cext[i].getExtensionData("ctagfiletype"); //$NON-NLS-1$
|
String orig = cext[i].getExtensionData("ctagfiletype"); //$NON-NLS-1$
|
||||||
if (orig == null || !orig.equals(internalExternalCTagsString)) {
|
if (orig == null || !orig.equals(internalExternalCTagsString)) {
|
||||||
cext[i].setExtensionData("ctagfiletype", internalExternalCTagsString); //$NON-NLS-1$
|
cext[i].setExtensionData("ctagfiletype", internalExternalCTagsString); //$NON-NLS-1$
|
||||||
|
@ -107,16 +123,26 @@ public class CTagsIndexerBlock extends AbstractIndexerPage {
|
||||||
cext[i].setExtensionData("ctagfilelocation", cTagsFileLocation); //$NON-NLS-1$
|
cext[i].setExtensionData("ctagfilelocation", cTagsFileLocation); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
orig = cext[i].getExtensionData("ctagsindexincludes"); //$NON-NLS-1$
|
orig = cext[i].getExtensionData("ctagsindexincludes"); //$NON-NLS-1$
|
||||||
if (orig == null || !orig.equals(cTagsFileLocation)) {
|
if (orig == null || !orig.equals(indexIncludeFiles)) {
|
||||||
cext[i].setExtensionData("ctagsindexincludes", indexIncludeFiles); //$NON-NLS-1$
|
cext[i].setExtensionData("ctagsindexincludes", indexIncludeFiles); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
orig = cext[i].getExtensionData("ctagslocationtype"); //$NON-NLS-1$
|
||||||
|
if (orig == null || !orig.equals(cTagsLocationType)) {
|
||||||
|
cext[i].setExtensionData("ctagslocationtype", cTagsLocationType); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
orig = cext[i].getExtensionData("ctagslocation"); //$NON-NLS-1$
|
||||||
|
if (orig == null || !orig.equals(cTagsLocation)) {
|
||||||
|
cext[i].setExtensionData("ctagslocation", cTagsLocation); //$NON-NLS-1$
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (prefStore != null) {
|
if (prefStore != null) {
|
||||||
prefStore.setValue(PREF_INTOREXT_CTAGS, internalExternalCTagsString);
|
prefStore.setValue(PREF_INTOREXT_CTAGS, internalExternalCTagsString);
|
||||||
prefStore.setValue(PREF_CTAGSLOCATION_CTAGS,cTagsFileLocation);
|
prefStore.setValue(PREF_CTAGS_FILE_LOCATION_CTAGS,cTagsFileLocation);
|
||||||
prefStore.setValue(PREF_CTAGS_INDEXINCLUDEFILES,indexIncludeFiles);
|
prefStore.setValue(PREF_CTAGS_INDEXINCLUDEFILES,indexIncludeFiles);
|
||||||
|
prefStore.setValue(PREF_CTAGS_LOCATION_TYPE,cTagsLocationType);
|
||||||
|
prefStore.setValue(PREF_CTAGS_LOCATION,cTagsLocation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -124,12 +150,22 @@ public class CTagsIndexerBlock extends AbstractIndexerPage {
|
||||||
* @see org.eclipse.cdt.ui.dialogs.ICOptionPage#performDefaults()
|
* @see org.eclipse.cdt.ui.dialogs.ICOptionPage#performDefaults()
|
||||||
*/
|
*/
|
||||||
public void performDefaults() {
|
public void performDefaults() {
|
||||||
|
//ctag file options
|
||||||
internalTagsFile=true;
|
internalTagsFile=true;
|
||||||
externalTagsFile=false;
|
externalTagsFile=false;
|
||||||
internalCTagsFile.setSelection(true);
|
internalCTagsFile.setSelection(true);
|
||||||
externalCTagsFile.setSelection(false);
|
externalCTagsFile.setSelection(false);
|
||||||
cTagsFile.setText(""); //$NON-NLS-1$
|
cTagsFile.setText(""); //$NON-NLS-1$
|
||||||
browseButton.setEnabled(false);
|
browseButton.setEnabled(false);
|
||||||
|
//ctag path options
|
||||||
|
useDefaultCTags=true;
|
||||||
|
useSpecifiedCTagsExecutable=false;
|
||||||
|
useCTagsPath.setSelection(true);
|
||||||
|
useCTagsExecutable.setSelection(false);
|
||||||
|
cTagsExecutable.setText(""); //$NON-NLS-1$
|
||||||
|
browseButtonCTagsExec.setEnabled(false);
|
||||||
|
//index include paths
|
||||||
|
indexIncludePaths.setSelection(false);
|
||||||
}
|
}
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
|
* @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
|
||||||
|
@ -137,7 +173,54 @@ public class CTagsIndexerBlock extends AbstractIndexerPage {
|
||||||
public void createControl(Composite parent) {
|
public void createControl(Composite parent) {
|
||||||
Composite page = ControlFactory.createComposite(parent, 1);
|
Composite page = ControlFactory.createComposite(parent, 1);
|
||||||
|
|
||||||
Group includeGroup = ControlFactory.createGroup(page,CUIMessages.getString("CTagsIndexerBlock.includeGroup"),1);
|
Group cTagsExecutableGroup = ControlFactory.createGroup(page,CUIMessages.getString("CTagsIndexerBlock.ctagsLocation"),3); //$NON-NLS-1$
|
||||||
|
GridData gd3 = (GridData) cTagsExecutableGroup.getLayoutData();
|
||||||
|
gd3.grabExcessHorizontalSpace = true;
|
||||||
|
gd3.horizontalAlignment = GridData.FILL;
|
||||||
|
|
||||||
|
SelectionListener cTagsListener = new SelectionAdapter() {
|
||||||
|
public void widgetSelected(SelectionEvent event) {
|
||||||
|
useDefaultCTags = useCTagsPath.getSelection();
|
||||||
|
useSpecifiedCTagsExecutable = useCTagsExecutable.getSelection();
|
||||||
|
|
||||||
|
if (useDefaultCTags){
|
||||||
|
setButtonState(CTagsIndexer.CTAGS_PATH_DEFAULT);
|
||||||
|
}
|
||||||
|
if (useSpecifiedCTagsExecutable){
|
||||||
|
setButtonState(CTagsIndexer.CTAGS_PATH_SPECIFIED);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
useCTagsPath = ControlFactory.createRadioButton(cTagsExecutableGroup,CUIMessages.getString("CTagsIndexerBlock.radioButtonCTagsDefault"),"CTagsDefault",cTagsListener);//$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
((GridData)useCTagsPath.getLayoutData()).horizontalSpan = 3;
|
||||||
|
((GridData)useCTagsPath.getLayoutData()).grabExcessHorizontalSpace = true;
|
||||||
|
useCTagsPath.setSelection(internalTagsFile);
|
||||||
|
|
||||||
|
useCTagsExecutable = ControlFactory.createRadioButton(cTagsExecutableGroup,CUIMessages.getString("CTagsIndexerBlock.radioButtonCTagsSpecified"),"CTafsSpecified",cTagsListener);//$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
((GridData)useCTagsExecutable.getLayoutData()).horizontalSpan = 3;
|
||||||
|
((GridData)useCTagsExecutable.getLayoutData()).grabExcessHorizontalSpace = true;
|
||||||
|
|
||||||
|
cTagsExecutable = ControlFactory.createTextField(cTagsExecutableGroup);
|
||||||
|
((GridData)cTagsExecutable.getLayoutData()).horizontalSpan = 2;
|
||||||
|
((GridData)cTagsExecutable.getLayoutData()).grabExcessHorizontalSpace = true;;
|
||||||
|
|
||||||
|
browseButtonCTagsExec = ControlFactory.createPushButton(cTagsExecutableGroup,CUIMessages.getString("CTagsIndexerBlock.browseButton")); //$NON-NLS-1$
|
||||||
|
((GridData)browseButtonCTagsExec.getLayoutData()).widthHint = SWTUtil.getButtonWidthHint(browseButtonCTagsExec);
|
||||||
|
browseButtonCTagsExec.setEnabled(false);
|
||||||
|
browseButtonCTagsExec.addSelectionListener(new SelectionAdapter() {
|
||||||
|
|
||||||
|
public void widgetSelected(SelectionEvent event) {
|
||||||
|
handleBrowseButtonSelected();
|
||||||
|
}
|
||||||
|
|
||||||
|
void handleBrowseButtonSelected() {
|
||||||
|
cTagsExecutable.setText(openFileBrowser());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//
|
||||||
|
|
||||||
|
Group includeGroup = ControlFactory.createGroup(page,CUIMessages.getString("CTagsIndexerBlock.includeGroup"),1); //$NON-NLS-1$
|
||||||
GridData gd2 = (GridData) includeGroup.getLayoutData();
|
GridData gd2 = (GridData) includeGroup.getLayoutData();
|
||||||
gd2.grabExcessHorizontalSpace = true;
|
gd2.grabExcessHorizontalSpace = true;
|
||||||
gd2.horizontalAlignment = GridData.FILL;
|
gd2.horizontalAlignment = GridData.FILL;
|
||||||
|
@ -190,35 +273,37 @@ public class CTagsIndexerBlock extends AbstractIndexerPage {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleBrowseButtonSelected() {
|
private void handleBrowseButtonSelected() {
|
||||||
FileDialog dialog = new FileDialog(getShell(), SWT.NONE);
|
cTagsFile.setText(openFileBrowser());
|
||||||
dialog.setText(CUIMessages.getString("CTagsIndexerBlock.fileBrowser")); //$NON-NLS-1$
|
|
||||||
String fileName = dialog.open();
|
|
||||||
if (fileName == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
cTagsFile.setText(fileName);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
setControl(page);
|
setControl(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String openFileBrowser(){
|
||||||
|
FileDialog dialog = new FileDialog(getShell(), SWT.NONE);
|
||||||
|
dialog.setText(CUIMessages.getString("CTagsIndexerBlock.fileBrowser")); //$NON-NLS-1$
|
||||||
|
String fileName = dialog.open();
|
||||||
|
if (fileName == null) {
|
||||||
|
return ""; //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
|
return fileName;
|
||||||
|
}
|
||||||
|
|
||||||
public void loadPersistedValues(IProject project) throws CoreException {
|
public void loadPersistedValues(IProject project) throws CoreException {
|
||||||
|
|
||||||
ICDescriptor cdesc = CCorePlugin.getDefault().getCProjectDescription(project, false);
|
ICDescriptor cdesc = CCorePlugin.getDefault().getCProjectDescription(project, false);
|
||||||
ICExtensionReference[] cext = cdesc.get(CCorePlugin.INDEXER_UNIQ_ID);
|
ICExtensionReference[] cext = cdesc.get(CCorePlugin.INDEXER_UNIQ_ID);
|
||||||
if (cext.length > 0) {
|
if (cext.length > 0) {
|
||||||
for (int i = 0; i < cext.length; i++) {
|
for (int i = 0; i < cext.length; i++) {
|
||||||
String id = cext[i].getID();
|
|
||||||
String orig = cext[i].getExtensionData("ctagfiletype"); //$NON-NLS-1$
|
String orig = cext[i].getExtensionData("ctagfiletype"); //$NON-NLS-1$
|
||||||
if (orig != null){
|
if (orig != null){
|
||||||
storedInternalExternal=orig;
|
|
||||||
setButtonState(orig);
|
setButtonState(orig);
|
||||||
}
|
}
|
||||||
|
|
||||||
orig = cext[i].getExtensionData("ctagfilelocation"); //$NON-NLS-1$
|
orig = cext[i].getExtensionData("ctagfilelocation"); //$NON-NLS-1$
|
||||||
if (orig != null){
|
if (orig != null){
|
||||||
storedTagFile=orig;
|
|
||||||
cTagsFile.setText(orig);
|
cTagsFile.setText(orig);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -230,6 +315,16 @@ public class CTagsIndexerBlock extends AbstractIndexerPage {
|
||||||
indexIncludePaths.setSelection(false);
|
indexIncludePaths.setSelection(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
orig = cext[i].getExtensionData("ctagslocationtype"); //$NON-NLS-1$
|
||||||
|
if (orig != null){
|
||||||
|
setButtonState(orig);
|
||||||
|
}
|
||||||
|
|
||||||
|
orig = cext[i].getExtensionData("ctagslocation"); //$NON-NLS-1$
|
||||||
|
if (orig != null){
|
||||||
|
cTagsExecutable.setText(orig);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -248,6 +343,18 @@ public class CTagsIndexerBlock extends AbstractIndexerPage {
|
||||||
externalCTagsFile.setSelection(true);
|
externalCTagsFile.setSelection(true);
|
||||||
internalCTagsFile.setSelection(false);
|
internalCTagsFile.setSelection(false);
|
||||||
browseButton.setEnabled(true);
|
browseButton.setEnabled(true);
|
||||||
|
} else if(orig.equals(CTagsIndexer.CTAGS_PATH_DEFAULT)){
|
||||||
|
useDefaultCTags=true;
|
||||||
|
useSpecifiedCTagsExecutable=false;
|
||||||
|
useCTagsPath.setSelection(true);
|
||||||
|
useCTagsExecutable.setSelection(false);
|
||||||
|
browseButtonCTagsExec.setEnabled(false);
|
||||||
|
} else if(orig.equals(CTagsIndexer.CTAGS_PATH_SPECIFIED)){
|
||||||
|
useDefaultCTags=false;
|
||||||
|
useSpecifiedCTagsExecutable=true;
|
||||||
|
useCTagsPath.setSelection(false);
|
||||||
|
useCTagsExecutable.setSelection(true);
|
||||||
|
browseButtonCTagsExec.setEnabled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -257,15 +364,14 @@ public class CTagsIndexerBlock extends AbstractIndexerPage {
|
||||||
setButtonState(indexerId);
|
setButtonState(indexerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
indexerId=prefStore.getString(PREF_CTAGSLOCATION_CTAGS);
|
indexerId=prefStore.getString(PREF_CTAGS_FILE_LOCATION_CTAGS);
|
||||||
if (!indexerId.equals("")) { //$NON-NLS-1$
|
if (!indexerId.equals("")) { //$NON-NLS-1$
|
||||||
storedTagFile=indexerId;
|
|
||||||
cTagsFile.setText(indexerId);
|
cTagsFile.setText(indexerId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removePreferences() {
|
public void removePreferences() {
|
||||||
prefStore.setToDefault(PREF_CTAGSLOCATION_CTAGS);
|
prefStore.setToDefault(PREF_CTAGS_FILE_LOCATION_CTAGS);
|
||||||
prefStore.setToDefault(PREF_INTOREXT_CTAGS);
|
prefStore.setToDefault(PREF_INTOREXT_CTAGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue