mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 18:26:01 +02:00
The DirectorySourceContainer's UI now supports the subfolders searching option (see bug 89748). Removed the UI related to CDirectorySourceContainer.
This commit is contained in:
parent
e1c3a8d36b
commit
e69e9f0765
5 changed files with 1 additions and 253 deletions
|
@ -1150,11 +1150,6 @@
|
||||||
adaptableType="org.eclipse.debug.core.sourcelookup.containers.ProjectSourceContainer"
|
adaptableType="org.eclipse.debug.core.sourcelookup.containers.ProjectSourceContainer"
|
||||||
class="org.eclipse.cdt.debug.internal.ui.sourcelookup.SourceContainerAdapterFactory">
|
class="org.eclipse.cdt.debug.internal.ui.sourcelookup.SourceContainerAdapterFactory">
|
||||||
<adapter type="org.eclipse.ui.model.IWorkbenchAdapter"/>
|
<adapter type="org.eclipse.ui.model.IWorkbenchAdapter"/>
|
||||||
</factory>
|
|
||||||
<factory
|
|
||||||
adaptableType="org.eclipse.cdt.debug.core.sourcelookup.CDirectorySourceContainer"
|
|
||||||
class="org.eclipse.cdt.debug.internal.ui.sourcelookup.SourceContainerAdapterFactory">
|
|
||||||
<adapter type="org.eclipse.ui.model.IWorkbenchAdapter"/>
|
|
||||||
</factory>
</extension>
|
</factory>
</extension>
|
||||||
<extension
|
<extension
|
||||||
point="org.eclipse.ui.themes">
|
point="org.eclipse.ui.themes">
|
||||||
|
|
|
@ -1,42 +0,0 @@
|
||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2004, 2005 QNX Software Systems and others.
|
|
||||||
* All rights reserved. This program and the accompanying materials
|
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
|
||||||
* which accompanies this distribution, and is available at
|
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* QNX Software Systems - Initial API and implementation
|
|
||||||
*******************************************************************************/
|
|
||||||
package org.eclipse.cdt.debug.internal.ui.sourcelookup;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.core.sourcelookup.CDirectorySourceContainer;
|
|
||||||
import org.eclipse.debug.core.sourcelookup.ISourceContainer;
|
|
||||||
import org.eclipse.debug.core.sourcelookup.ISourceLookupDirector;
|
|
||||||
import org.eclipse.debug.ui.sourcelookup.AbstractSourceContainerBrowser;
|
|
||||||
import org.eclipse.jface.window.Window;
|
|
||||||
import org.eclipse.swt.widgets.Shell;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The browser for adding and editing a directory source container.
|
|
||||||
*/
|
|
||||||
public class CDirectorySourceContainerBrowser extends AbstractSourceContainerBrowser {
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.debug.ui.sourcelookup.AbstractSourceContainerBrowser#addSourceContainers(org.eclipse.swt.widgets.Shell, org.eclipse.debug.core.sourcelookup.ISourceLookupDirector)
|
|
||||||
*/
|
|
||||||
public ISourceContainer[] addSourceContainers( Shell shell, ISourceLookupDirector director ) {
|
|
||||||
CDirectorySourceContainerDialog dialog = new CDirectorySourceContainerDialog( shell );
|
|
||||||
if ( dialog.open() == Window.OK ) {
|
|
||||||
return new ISourceContainer[] { new CDirectorySourceContainer( dialog.getDirectory(), dialog.isSearchSubfolders() ) };
|
|
||||||
}
|
|
||||||
return new ISourceContainer[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.debug.ui.sourcelookup.AbstractSourceContainerBrowser#canAddSourceContainers(org.eclipse.debug.core.sourcelookup.ISourceLookupDirector)
|
|
||||||
*/
|
|
||||||
public boolean canAddSourceContainers( ISourceLookupDirector director ) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,188 +0,0 @@
|
||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2004, 2005 QNX Software Systems and others.
|
|
||||||
* All rights reserved. This program and the accompanying materials
|
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
|
||||||
* which accompanies this distribution, and is available at
|
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* QNX Software Systems - Initial API and implementation
|
|
||||||
*******************************************************************************/
|
|
||||||
package org.eclipse.cdt.debug.internal.ui.sourcelookup;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import org.eclipse.cdt.debug.internal.ui.ICDebugHelpContextIds;
|
|
||||||
import org.eclipse.cdt.debug.internal.ui.PixelConverter;
|
|
||||||
import org.eclipse.cdt.debug.internal.ui.dialogfields.DialogField;
|
|
||||||
import org.eclipse.cdt.debug.internal.ui.dialogfields.IDialogFieldListener;
|
|
||||||
import org.eclipse.cdt.debug.internal.ui.dialogfields.IStringButtonAdapter;
|
|
||||||
import org.eclipse.cdt.debug.internal.ui.dialogfields.LayoutUtil;
|
|
||||||
import org.eclipse.cdt.debug.internal.ui.dialogfields.SelectionButtonDialogField;
|
|
||||||
import org.eclipse.cdt.debug.internal.ui.dialogfields.Separator;
|
|
||||||
import org.eclipse.cdt.debug.internal.ui.dialogfields.StringButtonDialogField;
|
|
||||||
import org.eclipse.jface.dialogs.Dialog;
|
|
||||||
import org.eclipse.jface.dialogs.IDialogConstants;
|
|
||||||
import org.eclipse.jface.dialogs.TitleAreaDialog;
|
|
||||||
import org.eclipse.swt.SWT;
|
|
||||||
import org.eclipse.swt.graphics.Font;
|
|
||||||
import org.eclipse.swt.layout.GridData;
|
|
||||||
import org.eclipse.swt.layout.GridLayout;
|
|
||||||
import org.eclipse.swt.widgets.Button;
|
|
||||||
import org.eclipse.swt.widgets.Composite;
|
|
||||||
import org.eclipse.swt.widgets.Control;
|
|
||||||
import org.eclipse.swt.widgets.DirectoryDialog;
|
|
||||||
import org.eclipse.swt.widgets.Shell;
|
|
||||||
import org.eclipse.ui.PlatformUI;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The dialog for selecting the local file system for which a source
|
|
||||||
* container will be created.
|
|
||||||
*/
|
|
||||||
public class CDirectorySourceContainerDialog extends TitleAreaDialog {
|
|
||||||
|
|
||||||
private StringButtonDialogField fDirectoryField;
|
|
||||||
private SelectionButtonDialogField fSubfoldersField;
|
|
||||||
private File fDirectory;
|
|
||||||
private boolean fSearchSubfolders;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor for CDirectorySourceContainerDialog.
|
|
||||||
*/
|
|
||||||
public CDirectorySourceContainerDialog( Shell parentShell ) {
|
|
||||||
this( parentShell, new File( "" ), false ); //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor for CDirectorySourceContainerDialog.
|
|
||||||
*/
|
|
||||||
public CDirectorySourceContainerDialog( Shell parentShell, File directory, boolean searchSubfolders ) {
|
|
||||||
super( parentShell );
|
|
||||||
fDirectory = directory;
|
|
||||||
fSearchSubfolders = searchSubfolders;
|
|
||||||
fDirectoryField = new StringButtonDialogField(
|
|
||||||
new IStringButtonAdapter() {
|
|
||||||
|
|
||||||
public void changeControlPressed( DialogField field ) {
|
|
||||||
browse();
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
fDirectoryField.setLabelText( SourceLookupUIMessages.getString( "CDirectorySourceContainerDialog.0" ) ); //$NON-NLS-1$
|
|
||||||
fDirectoryField.setButtonLabel( SourceLookupUIMessages.getString( "CDirectorySourceContainerDialog.1" ) ); //$NON-NLS-1$
|
|
||||||
fDirectoryField.setDialogFieldListener(
|
|
||||||
new IDialogFieldListener() {
|
|
||||||
|
|
||||||
public void dialogFieldChanged( DialogField field ) {
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
|
|
||||||
fSubfoldersField = new SelectionButtonDialogField( SWT.CHECK );
|
|
||||||
fSubfoldersField.setLabelText( SourceLookupUIMessages.getString( "CDirectorySourceContainerDialog.2" ) ); //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.jface.dialogs.TitleAreaDialog#createDialogArea(org.eclipse.swt.widgets.Composite)
|
|
||||||
*/
|
|
||||||
protected Control createDialogArea( Composite parent ) {
|
|
||||||
setTitle( SourceLookupUIMessages.getString( "CDirectorySourceContainerDialog.3" ) ); //$NON-NLS-1$
|
|
||||||
Font font = parent.getFont();
|
|
||||||
Composite composite = new Composite( parent, SWT.NONE );
|
|
||||||
GridLayout layout = new GridLayout();
|
|
||||||
layout.numColumns = Math.max( fDirectoryField.getNumberOfControls(), fSubfoldersField.getNumberOfControls() );
|
|
||||||
layout.marginHeight = convertVerticalDLUsToPixels( IDialogConstants.VERTICAL_MARGIN );
|
|
||||||
layout.marginWidth = convertHorizontalDLUsToPixels( IDialogConstants.HORIZONTAL_MARGIN );
|
|
||||||
// layout.verticalSpacing = convertVerticalDLUsToPixels( IDialogConstants.VERTICAL_SPACING );
|
|
||||||
// layout.horizontalSpacing = convertHorizontalDLUsToPixels( IDialogConstants.HORIZONTAL_SPACING );
|
|
||||||
composite.setLayout( layout );
|
|
||||||
GridData data = new GridData( GridData.FILL_BOTH );
|
|
||||||
composite.setLayoutData( data );
|
|
||||||
composite.setFont( font );
|
|
||||||
|
|
||||||
Dialog.applyDialogFont( composite );
|
|
||||||
PlatformUI.getWorkbench().getHelpSystem().setHelp( getShell(), ICDebugHelpContextIds.ADD_DIRECTORY_CONTAINER_DIALOG );
|
|
||||||
|
|
||||||
PixelConverter converter = new PixelConverter( composite );
|
|
||||||
fDirectoryField.doFillIntoGrid( composite, layout.numColumns );
|
|
||||||
LayoutUtil.setHorizontalGrabbing( fDirectoryField.getTextControl( null ) );
|
|
||||||
|
|
||||||
new Separator().doFillIntoGrid( composite, layout.numColumns, converter.convertHeightInCharsToPixels( 1 ) );
|
|
||||||
|
|
||||||
fSubfoldersField.doFillIntoGrid( composite, layout.numColumns );
|
|
||||||
|
|
||||||
initialize();
|
|
||||||
|
|
||||||
setMessage( null );
|
|
||||||
return super.createDialogArea( parent );
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
|
|
||||||
*/
|
|
||||||
protected void configureShell( Shell newShell ) {
|
|
||||||
newShell.setText( SourceLookupUIMessages.getString( "CDirectorySourceContainerDialog.4" ) ); //$NON-NLS-1$
|
|
||||||
super.configureShell( newShell );
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void browse() {
|
|
||||||
String last = fDirectoryField.getText();
|
|
||||||
DirectoryDialog dialog = new DirectoryDialog( getShell(), SWT.SINGLE );
|
|
||||||
dialog.setFilterPath( last );
|
|
||||||
String result = dialog.open();
|
|
||||||
if ( result == null ) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
fDirectoryField.setText( result );
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.jface.dialogs.Dialog#okPressed()
|
|
||||||
*/
|
|
||||||
protected void okPressed() {
|
|
||||||
fDirectory = new File( fDirectoryField.getText() );
|
|
||||||
fSearchSubfolders = fSubfoldersField.isSelected();
|
|
||||||
super.okPressed();
|
|
||||||
}
|
|
||||||
|
|
||||||
public File getDirectory() {
|
|
||||||
return fDirectory;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isSearchSubfolders() {
|
|
||||||
return fSearchSubfolders;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initialize() {
|
|
||||||
fDirectoryField.setText( getDirectory().getPath() );
|
|
||||||
fSubfoldersField.setSelection( isSearchSubfolders() );
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void update() {
|
|
||||||
boolean isOk = updateErrorMessage();
|
|
||||||
Button ok = getButton( IDialogConstants.OK_ID );
|
|
||||||
if ( ok != null )
|
|
||||||
ok.setEnabled( isOk );
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean updateErrorMessage() {
|
|
||||||
setErrorMessage( null );
|
|
||||||
String text = fDirectoryField.getText().trim();
|
|
||||||
if ( text.length() == 0 ) {
|
|
||||||
setErrorMessage( SourceLookupUIMessages.getString ( "CDirectorySourceContainerDialog.5" ) ); //$NON-NLS-1$
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
File file = new File( text );
|
|
||||||
if ( !file.exists() ) {
|
|
||||||
setErrorMessage( SourceLookupUIMessages.getString ( "CDirectorySourceContainerDialog.6" ) ); //$NON-NLS-1$
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ( !file.isDirectory() ) {
|
|
||||||
setErrorMessage( SourceLookupUIMessages.getString ( "CDirectorySourceContainerDialog.7" ) ); //$NON-NLS-1$
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ( !file.isAbsolute() ) {
|
|
||||||
setErrorMessage( SourceLookupUIMessages.getString ( "CDirectorySourceContainerDialog.8" ) ); //$NON-NLS-1$
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -14,13 +14,11 @@ import java.io.File;
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.model.ICElement;
|
import org.eclipse.cdt.core.model.ICElement;
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
import org.eclipse.cdt.debug.core.sourcelookup.CDirectorySourceContainer;
|
|
||||||
import org.eclipse.cdt.debug.core.sourcelookup.MappingSourceContainer;
|
import org.eclipse.cdt.debug.core.sourcelookup.MappingSourceContainer;
|
||||||
import org.eclipse.cdt.debug.internal.core.sourcelookup.MapEntrySourceContainer;
|
import org.eclipse.cdt.debug.internal.core.sourcelookup.MapEntrySourceContainer;
|
||||||
import org.eclipse.cdt.debug.internal.ui.CDebugImages;
|
import org.eclipse.cdt.debug.internal.ui.CDebugImages;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.Path;
|
|
||||||
import org.eclipse.debug.core.sourcelookup.containers.ProjectSourceContainer;
|
import org.eclipse.debug.core.sourcelookup.containers.ProjectSourceContainer;
|
||||||
import org.eclipse.jface.resource.ImageDescriptor;
|
import org.eclipse.jface.resource.ImageDescriptor;
|
||||||
import org.eclipse.ui.model.IWorkbenchAdapter;
|
import org.eclipse.ui.model.IWorkbenchAdapter;
|
||||||
|
@ -68,12 +66,6 @@ public class SourceContainerWorkbenchAdapter implements IWorkbenchAdapter {
|
||||||
* @see org.eclipse.ui.model.IWorkbenchAdapter#getLabel(java.lang.Object)
|
* @see org.eclipse.ui.model.IWorkbenchAdapter#getLabel(java.lang.Object)
|
||||||
*/
|
*/
|
||||||
public String getLabel( Object o ) {
|
public String getLabel( Object o ) {
|
||||||
if ( o instanceof CDirectorySourceContainer ) {
|
|
||||||
CDirectorySourceContainer container = (CDirectorySourceContainer)o;
|
|
||||||
File file = container.getDirectory();
|
|
||||||
IPath path = new Path( file.getAbsolutePath() );
|
|
||||||
return getQualifiedName( path );
|
|
||||||
}
|
|
||||||
if ( o instanceof MappingSourceContainer ) {
|
if ( o instanceof MappingSourceContainer ) {
|
||||||
return SourceLookupUIMessages.getString( "SourceContainerWorkbenchAdapter.0" ) + ((MappingSourceContainer)o).getName(); //$NON-NLS-1$
|
return SourceLookupUIMessages.getString( "SourceContainerWorkbenchAdapter.0" ) + ((MappingSourceContainer)o).getName(); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,12 +34,3 @@ PathMappingDialog.16=Path Mappings
|
||||||
RemoveAction.0=Re&move
|
RemoveAction.0=Re&move
|
||||||
SourceContainerWorkbenchAdapter.0=Path Mapping:
|
SourceContainerWorkbenchAdapter.0=Path Mapping:
|
||||||
UpAction.0=U&p
|
UpAction.0=U&p
|
||||||
CDirectorySourceContainerDialog.0=&Directory:
|
|
||||||
CDirectorySourceContainerDialog.1=&Browse...
|
|
||||||
CDirectorySourceContainerDialog.2=Search sub&folders
|
|
||||||
CDirectorySourceContainerDialog.3=Choose directory to add:
|
|
||||||
CDirectorySourceContainerDialog.4=Directory Selection
|
|
||||||
CDirectorySourceContainerDialog.5=The directory path must not be empty
|
|
||||||
CDirectorySourceContainerDialog.6=The specified directory doesn't exist
|
|
||||||
CDirectorySourceContainerDialog.7=The specified path must be a directory
|
|
||||||
CDirectorySourceContainerDialog.8=The specified path must be absolute
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue