mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Added the "Search subfolders" option for directory search locations.
This commit is contained in:
parent
2767f3a948
commit
8968c45d84
7 changed files with 221 additions and 48 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2003-10-20 Mikhail Khodjaiants
|
||||||
|
Core support of the "Search subfolders" option for directory source locations.
|
||||||
|
* IDirectorySourceLocation.java
|
||||||
|
* SourceLocationFactory.java
|
||||||
|
* CDirectorySourceLocation.java
|
||||||
|
|
||||||
2003-10-20 Mikhail Khodjaiants
|
2003-10-20 Mikhail Khodjaiants
|
||||||
Do not interrupt the initialization of all additional source locations
|
Do not interrupt the initialization of all additional source locations
|
||||||
if the initialization of one fails.
|
if the initialization of one fails.
|
||||||
|
|
|
@ -16,5 +16,8 @@ import org.eclipse.core.runtime.IPath;
|
||||||
public interface IDirectorySourceLocation extends ICSourceLocation
|
public interface IDirectorySourceLocation extends ICSourceLocation
|
||||||
{
|
{
|
||||||
IPath getDirectory();
|
IPath getDirectory();
|
||||||
|
|
||||||
IPath getAssociation();
|
IPath getAssociation();
|
||||||
|
|
||||||
|
boolean searchSubfolders();
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,13 +28,8 @@ public class SourceLocationFactory
|
||||||
return new CProjectSourceLocation( project, generated );
|
return new CProjectSourceLocation( project, generated );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IDirectorySourceLocation createDirectorySourceLocation( IPath directory )
|
public static IDirectorySourceLocation createDirectorySourceLocation( IPath directory, IPath association, boolean searchSubfolders )
|
||||||
{
|
{
|
||||||
return new CDirectorySourceLocation( directory );
|
return new CDirectorySourceLocation( directory, association, searchSubfolders );
|
||||||
}
|
|
||||||
|
|
||||||
public static IDirectorySourceLocation createDirectorySourceLocation( IPath directory, IPath association )
|
|
||||||
{
|
|
||||||
return new CDirectorySourceLocation( directory, association );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,10 +6,14 @@
|
||||||
package org.eclipse.cdt.debug.internal.core.sourcelookup;
|
package org.eclipse.cdt.debug.internal.core.sourcelookup;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.FileFilter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.StringReader;
|
import java.io.StringReader;
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import javax.xml.parsers.DocumentBuilder;
|
import javax.xml.parsers.DocumentBuilder;
|
||||||
import javax.xml.parsers.DocumentBuilderFactory;
|
import javax.xml.parsers.DocumentBuilderFactory;
|
||||||
|
@ -46,6 +50,7 @@ public class CDirectorySourceLocation implements IDirectorySourceLocation
|
||||||
private static final String ELEMENT_NAME = "cDirectorySourceLocation";
|
private static final String ELEMENT_NAME = "cDirectorySourceLocation";
|
||||||
private static final String ATTR_DIRECTORY = "directory";
|
private static final String ATTR_DIRECTORY = "directory";
|
||||||
private static final String ATTR_ASSOCIATION = "association";
|
private static final String ATTR_ASSOCIATION = "association";
|
||||||
|
private static final String ATTR_SEARCH_SUBFOLDERS = "searchSubfolders";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The root directory of this source location
|
* The root directory of this source location
|
||||||
|
@ -59,6 +64,10 @@ public class CDirectorySourceLocation implements IDirectorySourceLocation
|
||||||
|
|
||||||
private boolean fSearchForDuplicateFiles = false;
|
private boolean fSearchForDuplicateFiles = false;
|
||||||
|
|
||||||
|
private boolean fSearchSubfolders = false;
|
||||||
|
|
||||||
|
private File[] fFolders = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for CDirectorySourceLocation.
|
* Constructor for CDirectorySourceLocation.
|
||||||
*/
|
*/
|
||||||
|
@ -69,18 +78,11 @@ public class CDirectorySourceLocation implements IDirectorySourceLocation
|
||||||
/**
|
/**
|
||||||
* Constructor for CDirectorySourceLocation.
|
* Constructor for CDirectorySourceLocation.
|
||||||
*/
|
*/
|
||||||
public CDirectorySourceLocation( IPath directory )
|
public CDirectorySourceLocation( IPath directory, IPath association, boolean searchSubfolders )
|
||||||
{
|
|
||||||
setDirectory( directory );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor for CDirectorySourceLocation.
|
|
||||||
*/
|
|
||||||
public CDirectorySourceLocation( IPath directory, IPath association )
|
|
||||||
{
|
{
|
||||||
setDirectory( directory );
|
setDirectory( directory );
|
||||||
setAssociation( association );
|
setAssociation( association );
|
||||||
|
setSearchSubfolders( searchSubfolders );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -159,12 +161,44 @@ public class CDirectorySourceLocation implements IDirectorySourceLocation
|
||||||
}
|
}
|
||||||
|
|
||||||
private Object findFileByAbsolutePath( String name )
|
private Object findFileByAbsolutePath( String name )
|
||||||
|
{
|
||||||
|
File file = new File( name );
|
||||||
|
if ( !file.isAbsolute() )
|
||||||
|
return null;
|
||||||
|
File[] folders = getFolders();
|
||||||
|
if ( folders != null )
|
||||||
|
{
|
||||||
|
LinkedList list = new LinkedList();
|
||||||
|
for ( int i = 0; i < folders.length; ++i )
|
||||||
|
{
|
||||||
|
Object result = findFileByAbsolutePath( folders[i], name );
|
||||||
|
if ( result instanceof List )
|
||||||
|
{
|
||||||
|
if ( searchForDuplicateFiles() )
|
||||||
|
list.addAll( (List)result );
|
||||||
|
else
|
||||||
|
return list.getFirst();
|
||||||
|
}
|
||||||
|
else if ( result != null )
|
||||||
|
{
|
||||||
|
if ( searchForDuplicateFiles() )
|
||||||
|
list.add( result );
|
||||||
|
else
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Object findFileByAbsolutePath( File folder, String name )
|
||||||
{
|
{
|
||||||
File file = new File( name );
|
File file = new File( name );
|
||||||
if ( !file.isAbsolute() )
|
if ( !file.isAbsolute() )
|
||||||
return null;
|
return null;
|
||||||
IPath filePath = new Path( name );
|
IPath filePath = new Path( name );
|
||||||
IPath path = getDirectory();
|
IPath path = new Path( folder.getAbsolutePath() );
|
||||||
IPath association = getAssociation();
|
IPath association = getAssociation();
|
||||||
if ( isPrefix( path, filePath ) )
|
if ( isPrefix( path, filePath ) )
|
||||||
{
|
{
|
||||||
|
@ -201,27 +235,53 @@ public class CDirectorySourceLocation implements IDirectorySourceLocation
|
||||||
|
|
||||||
private Object findFileByRelativePath( String fileName )
|
private Object findFileByRelativePath( String fileName )
|
||||||
{
|
{
|
||||||
IPath path = getDirectory();
|
File[] folders = getFolders();
|
||||||
if ( path != null )
|
if ( folders != null )
|
||||||
{
|
{
|
||||||
path = path.append( fileName );
|
LinkedList list = new LinkedList();
|
||||||
File file = path.toFile();
|
for ( int i = 0; i < folders.length; ++i )
|
||||||
if ( file.exists() )
|
|
||||||
{
|
{
|
||||||
path = new Path( file.getAbsolutePath() ); // can't use getCanonicalPath because of links
|
Object result = findFileByRelativePath( folders[i], fileName );
|
||||||
IFile[] wsFiles = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation( path );
|
if ( result instanceof List )
|
||||||
LinkedList list = new LinkedList();
|
{
|
||||||
for ( int j = 0; j < wsFiles.length; ++j )
|
if ( searchForDuplicateFiles() )
|
||||||
if ( wsFiles[j].exists() )
|
list.addAll( (List)result );
|
||||||
if ( !searchForDuplicateFiles() )
|
else
|
||||||
return wsFiles[j];
|
return list.getFirst();
|
||||||
else
|
}
|
||||||
list.add( wsFiles[j] );
|
else if ( result != null )
|
||||||
if ( list.size() > 0 )
|
{
|
||||||
return ( list.size() == 1 ) ? list.getFirst() : list;
|
if ( searchForDuplicateFiles() )
|
||||||
else
|
list.add( result );
|
||||||
return createExternalFileStorage( path );
|
else
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Object findFileByRelativePath( File folder, String fileName )
|
||||||
|
{
|
||||||
|
IPath path = new Path( folder.getAbsolutePath() );
|
||||||
|
path = path.append( fileName );
|
||||||
|
File file = path.toFile();
|
||||||
|
if ( file.exists() )
|
||||||
|
{
|
||||||
|
path = new Path( file.getAbsolutePath() );
|
||||||
|
IFile[] wsFiles = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation( path );
|
||||||
|
LinkedList list = new LinkedList();
|
||||||
|
for ( int j = 0; j < wsFiles.length; ++j )
|
||||||
|
if ( wsFiles[j].exists() )
|
||||||
|
if ( !searchForDuplicateFiles() )
|
||||||
|
return wsFiles[j];
|
||||||
|
else
|
||||||
|
list.add( wsFiles[j] );
|
||||||
|
if ( list.size() > 0 )
|
||||||
|
return ( list.size() == 1 ) ? list.getFirst() : list;
|
||||||
|
else
|
||||||
|
return createExternalFileStorage( path );
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -242,6 +302,7 @@ public class CDirectorySourceLocation implements IDirectorySourceLocation
|
||||||
node.setAttribute( ATTR_DIRECTORY, getDirectory().toOSString() );
|
node.setAttribute( ATTR_DIRECTORY, getDirectory().toOSString() );
|
||||||
if ( getAssociation() != null )
|
if ( getAssociation() != null )
|
||||||
node.setAttribute( ATTR_ASSOCIATION, getAssociation().toOSString() );
|
node.setAttribute( ATTR_ASSOCIATION, getAssociation().toOSString() );
|
||||||
|
node.setAttribute( ATTR_SEARCH_SUBFOLDERS, new Boolean( searchSubfolders() ).toString() );
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return CDebugUtils.serializeDocument( doc, " " );
|
return CDebugUtils.serializeDocument( doc, " " );
|
||||||
|
@ -276,7 +337,7 @@ public class CDirectorySourceLocation implements IDirectorySourceLocation
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
IPath path = new Path( dir );
|
IPath path = new Path( dir );
|
||||||
if ( path.isValidPath( dir ) && path.toFile().isDirectory() )
|
if ( path.isValidPath( dir ) && path.toFile().isDirectory() && path.toFile().exists() )
|
||||||
{
|
{
|
||||||
setDirectory( path );
|
setDirectory( path );
|
||||||
}
|
}
|
||||||
|
@ -302,6 +363,7 @@ public class CDirectorySourceLocation implements IDirectorySourceLocation
|
||||||
setAssociation( null );
|
setAssociation( null );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
setSearchSubfolders( Boolean.valueOf( root.getAttribute( ATTR_SEARCH_SUBFOLDERS ) ).booleanValue() );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
catch( ParserConfigurationException e )
|
catch( ParserConfigurationException e )
|
||||||
|
@ -385,4 +447,59 @@ public class CDirectorySourceLocation implements IDirectorySourceLocation
|
||||||
{
|
{
|
||||||
return fSearchForDuplicateFiles;
|
return fSearchForDuplicateFiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.debug.core.sourcelookup.IDirectorySourceLocation#searchSubfolders()
|
||||||
|
*/
|
||||||
|
public boolean searchSubfolders()
|
||||||
|
{
|
||||||
|
return fSearchSubfolders;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSearchSubfolders( boolean search )
|
||||||
|
{
|
||||||
|
fSearchSubfolders = search;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected File[] getFolders()
|
||||||
|
{
|
||||||
|
if ( fFolders == null )
|
||||||
|
initializeFolders();
|
||||||
|
return fFolders;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void resetFolders()
|
||||||
|
{
|
||||||
|
fFolders = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initializeFolders()
|
||||||
|
{
|
||||||
|
if ( getDirectory() != null )
|
||||||
|
{
|
||||||
|
ArrayList list = new ArrayList();
|
||||||
|
File root = getDirectory().toFile();
|
||||||
|
list.add( root );
|
||||||
|
if ( searchSubfolders() )
|
||||||
|
list.addAll( getFileFolders( root ) );
|
||||||
|
fFolders = (File[])list.toArray( new File[list.size()] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private List getFileFolders( File file )
|
||||||
|
{
|
||||||
|
ArrayList list = new ArrayList();
|
||||||
|
File[] folders = file.listFiles(
|
||||||
|
new FileFilter()
|
||||||
|
{
|
||||||
|
public boolean accept( File pathname )
|
||||||
|
{
|
||||||
|
return pathname.isDirectory();
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
list.addAll( Arrays.asList( folders ) );
|
||||||
|
for ( int i = 0; i < folders.length; ++i )
|
||||||
|
list.addAll( getFileFolders( folders[i] ) );
|
||||||
|
return list;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
2003-10-20 Mikhail Khodjaiants
|
||||||
|
Implementation of the "Search subfolders" option for directory source locations.
|
||||||
|
* AddDirectorySourceLocationBlock.java
|
||||||
|
* SourceLookupBlock.java
|
||||||
|
|
||||||
2003-10-17 Mikhail Khodjaiants
|
2003-10-17 Mikhail Khodjaiants
|
||||||
UI support of the 'Search for duplicate source files' option.
|
UI support of the 'Search for duplicate source files' option.
|
||||||
* icons/full/obj16/prj_file_obj.gif: new
|
* icons/full/obj16/prj_file_obj.gif: new
|
||||||
|
|
|
@ -37,6 +37,7 @@ public class AddDirectorySourceLocationBlock
|
||||||
private Text fLocationText = null;
|
private Text fLocationText = null;
|
||||||
private Text fAssociationText = null;
|
private Text fAssociationText = null;
|
||||||
private Button fAssocitedCheckButton = null;
|
private Button fAssocitedCheckButton = null;
|
||||||
|
private Button fSearchSubfoldersButton = null;
|
||||||
private Shell fShell = null;
|
private Shell fShell = null;
|
||||||
|
|
||||||
private IPath fInitialAssosciationPath = null;
|
private IPath fInitialAssosciationPath = null;
|
||||||
|
@ -59,6 +60,7 @@ public class AddDirectorySourceLocationBlock
|
||||||
|
|
||||||
createLocationControls( fControl );
|
createLocationControls( fControl );
|
||||||
createAssociationControls( fControl );
|
createAssociationControls( fControl );
|
||||||
|
createSearchSubfoldersButton( fControl );
|
||||||
|
|
||||||
setInitialAssociationPath();
|
setInitialAssociationPath();
|
||||||
}
|
}
|
||||||
|
@ -146,6 +148,16 @@ public class AddDirectorySourceLocationBlock
|
||||||
fAssociationText.setText( "" );
|
fAssociationText.setText( "" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void createSearchSubfoldersButton( Composite parent )
|
||||||
|
{
|
||||||
|
Composite composite = new Composite( parent, SWT.NONE );
|
||||||
|
composite.setLayout( new GridLayout() );
|
||||||
|
GridData data = new GridData( GridData.FILL_BOTH );
|
||||||
|
composite.setLayoutData( data );
|
||||||
|
fSearchSubfoldersButton = new Button( composite, SWT.CHECK );
|
||||||
|
fSearchSubfoldersButton.setText( "Search sub&folders" );
|
||||||
|
}
|
||||||
|
|
||||||
protected Button createButton( Composite parent, String label )
|
protected Button createButton( Composite parent, String label )
|
||||||
{
|
{
|
||||||
Button button = new Button( parent, SWT.PUSH );
|
Button button = new Button( parent, SWT.PUSH );
|
||||||
|
@ -172,12 +184,17 @@ public class AddDirectorySourceLocationBlock
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean searchSubfolders()
|
||||||
|
{
|
||||||
|
return ( fSearchSubfoldersButton != null ) ? fSearchSubfoldersButton.getSelection() : false;
|
||||||
|
}
|
||||||
|
|
||||||
public IDirectorySourceLocation getSourceLocation()
|
public IDirectorySourceLocation getSourceLocation()
|
||||||
{
|
{
|
||||||
if ( isLocationPathValid() )
|
if ( isLocationPathValid() )
|
||||||
{
|
{
|
||||||
Path association = ( isAssociationPathValid() ) ? new Path( getAssociationPath() ) : null;
|
Path association = ( isAssociationPathValid() ) ? new Path( getAssociationPath() ) : null;
|
||||||
return SourceLocationFactory.createDirectorySourceLocation( new Path( getLocationPath() ), association );
|
return SourceLocationFactory.createDirectorySourceLocation( new Path( getLocationPath() ), association, searchSubfolders() );
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,7 @@ import org.eclipse.jface.viewers.CellEditor;
|
||||||
import org.eclipse.jface.viewers.CheckStateChangedEvent;
|
import org.eclipse.jface.viewers.CheckStateChangedEvent;
|
||||||
import org.eclipse.jface.viewers.CheckboxTableViewer;
|
import org.eclipse.jface.viewers.CheckboxTableViewer;
|
||||||
import org.eclipse.jface.viewers.ColumnWeightData;
|
import org.eclipse.jface.viewers.ColumnWeightData;
|
||||||
|
import org.eclipse.jface.viewers.ComboBoxCellEditor;
|
||||||
import org.eclipse.jface.viewers.ICellModifier;
|
import org.eclipse.jface.viewers.ICellModifier;
|
||||||
import org.eclipse.jface.viewers.ICheckStateListener;
|
import org.eclipse.jface.viewers.ICheckStateListener;
|
||||||
import org.eclipse.jface.viewers.ILabelProvider;
|
import org.eclipse.jface.viewers.ILabelProvider;
|
||||||
|
@ -94,13 +95,16 @@ public class SourceLookupBlock
|
||||||
table.setHeaderVisible( true );
|
table.setHeaderVisible( true );
|
||||||
|
|
||||||
new TableColumn( table, SWT.NULL );
|
new TableColumn( table, SWT.NULL );
|
||||||
tableLayout.addColumnData( new ColumnWeightData( 1, true ) );
|
tableLayout.addColumnData( new ColumnWeightData( 2, true ) );
|
||||||
|
new TableColumn( table, SWT.NULL );
|
||||||
|
tableLayout.addColumnData( new ColumnWeightData( 2, true ) );
|
||||||
new TableColumn( table, SWT.NULL );
|
new TableColumn( table, SWT.NULL );
|
||||||
tableLayout.addColumnData( new ColumnWeightData( 1, true ) );
|
tableLayout.addColumnData( new ColumnWeightData( 1, true ) );
|
||||||
|
|
||||||
TableColumn[] columns = table.getColumns();
|
TableColumn[] columns = table.getColumns();
|
||||||
columns[0].setText( "Location" );
|
columns[0].setText( "Location" );
|
||||||
columns[1].setText( "Association" );
|
columns[1].setText( "Association" );
|
||||||
|
columns[2].setText( "Search subfolders" );
|
||||||
|
|
||||||
return viewer;
|
return viewer;
|
||||||
}
|
}
|
||||||
|
@ -147,13 +151,23 @@ public class SourceLookupBlock
|
||||||
return ((IDirectorySourceLocation)element).getAssociation().toOSString();
|
return ((IDirectorySourceLocation)element).getAssociation().toOSString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if ( columnIndex == 2 )
|
||||||
|
{
|
||||||
|
if ( element instanceof IDirectorySourceLocation )
|
||||||
|
return ( ((IDirectorySourceLocation)element).searchSubfolders() ) ? YES_VALUE : NO_VALUE;
|
||||||
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// String constants
|
||||||
|
protected static final String YES_VALUE = "yes";
|
||||||
|
protected static final String NO_VALUE = "no";
|
||||||
|
|
||||||
// Column properties
|
// Column properties
|
||||||
private static final String CP_LOCATION = "location";
|
private static final String CP_LOCATION = "location";
|
||||||
private static final String CP_ASSOCIATION = "association";
|
private static final String CP_ASSOCIATION = "association";
|
||||||
|
private static final String CP_SEARCH_SUBFOLDERS = "searchSubfolders";
|
||||||
|
|
||||||
private Composite fControl = null;
|
private Composite fControl = null;
|
||||||
private Shell fShell = null;
|
private Shell fShell = null;
|
||||||
|
@ -280,9 +294,10 @@ public class SourceLookupBlock
|
||||||
|
|
||||||
TableViewer viewer = fAddedSourceListField.getTableViewer();
|
TableViewer viewer = fAddedSourceListField.getTableViewer();
|
||||||
Table table = viewer.getTable();
|
Table table = viewer.getTable();
|
||||||
CellEditor cellEditor = new TextCellEditor( table );
|
CellEditor textCellEditor = new TextCellEditor( table );
|
||||||
viewer.setCellEditors( new CellEditor[]{ null, cellEditor } );
|
CellEditor comboCellEditor = new ComboBoxCellEditor( table, new String[]{ YES_VALUE, NO_VALUE } );
|
||||||
viewer.setColumnProperties( new String[]{ CP_LOCATION, CP_ASSOCIATION } );
|
viewer.setCellEditors( new CellEditor[]{ null, textCellEditor, comboCellEditor } );
|
||||||
|
viewer.setColumnProperties( new String[]{ CP_LOCATION, CP_ASSOCIATION, CP_SEARCH_SUBFOLDERS } );
|
||||||
viewer.setCellModifier( createCellModifier() );
|
viewer.setCellModifier( createCellModifier() );
|
||||||
|
|
||||||
// new Separator().doFillIntoGrid( fControl, 3, converter.convertHeightInCharsToPixels( 1 ) );
|
// new Separator().doFillIntoGrid( fControl, 3, converter.convertHeightInCharsToPixels( 1 ) );
|
||||||
|
@ -296,7 +311,7 @@ public class SourceLookupBlock
|
||||||
{
|
{
|
||||||
public boolean canModify( Object element, String property )
|
public boolean canModify( Object element, String property )
|
||||||
{
|
{
|
||||||
return ( element instanceof CDirectorySourceLocation && property.equals( CP_ASSOCIATION ) );
|
return ( element instanceof CDirectorySourceLocation && ( property.equals( CP_ASSOCIATION ) || property.equals( CP_SEARCH_SUBFOLDERS ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object getValue( Object element, String property )
|
public Object getValue( Object element, String property )
|
||||||
|
@ -306,20 +321,35 @@ public class SourceLookupBlock
|
||||||
return ( ((CDirectorySourceLocation)element).getAssociation() != null ) ?
|
return ( ((CDirectorySourceLocation)element).getAssociation() != null ) ?
|
||||||
((CDirectorySourceLocation)element).getAssociation().toOSString() : "";
|
((CDirectorySourceLocation)element).getAssociation().toOSString() : "";
|
||||||
}
|
}
|
||||||
|
if ( element instanceof CDirectorySourceLocation && property.equals( CP_SEARCH_SUBFOLDERS ) )
|
||||||
|
{
|
||||||
|
return ( ((CDirectorySourceLocation)element).searchSubfolders() ) ? new Integer( 0 ) : new Integer( 1 );
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void modify( Object element, String property, Object value )
|
public void modify( Object element, String property, Object value )
|
||||||
{
|
{
|
||||||
Object entry = getSelection();
|
Object entry = getSelection();
|
||||||
if ( entry instanceof CDirectorySourceLocation &&
|
if ( entry instanceof CDirectorySourceLocation )
|
||||||
property.equals( CP_ASSOCIATION ) &&
|
|
||||||
value instanceof String )
|
|
||||||
{
|
{
|
||||||
Path association = new Path( (String)value );
|
boolean changed = false;
|
||||||
if ( association.isValidPath( (String)value ) )
|
if ( property.equals( CP_ASSOCIATION ) && value instanceof String )
|
||||||
|
{
|
||||||
|
Path association = new Path( (String)value );
|
||||||
|
if ( association.isValidPath( (String)value ) )
|
||||||
|
{
|
||||||
|
((CDirectorySourceLocation)entry).setAssociation( association );
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( property.equals( CP_SEARCH_SUBFOLDERS ) && value instanceof Integer )
|
||||||
|
{
|
||||||
|
((CDirectorySourceLocation)entry).setSearchSubfolders( ((Integer)value).intValue() == 0 );
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
if ( changed )
|
||||||
{
|
{
|
||||||
((CDirectorySourceLocation)entry).setAssociation( association );
|
|
||||||
getAddedSourceListField().refresh();
|
getAddedSourceListField().refresh();
|
||||||
updateLaunchConfigurationDialog();
|
updateLaunchConfigurationDialog();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue