Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergey Prigogin2010-12-10 22:39:43 +0000
committerSergey Prigogin2010-12-10 22:39:43 +0000
commit9aee6c4850fa0e464f50122bdee94527d926eb30 (patch)
tree3bf51d103c90fc2ef2277044bff2949679132710 /debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui
parent49332004f6240d4cc050aa715028d67033fc5887 (diff)
downloadorg.eclipse.cdt-9aee6c4850fa0e464f50122bdee94527d926eb30.tar.gz
org.eclipse.cdt-9aee6c4850fa0e464f50122bdee94527d926eb30.tar.xz
org.eclipse.cdt-9aee6c4850fa0e464f50122bdee94527d926eb30.zip
Bug 225805 - Sourcelookup handling does not scale to large projects
Diffstat (limited to 'debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui')
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/ICDebugHelpContextIds.java8
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/IInternalCDebugUIConstants.java15
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/PreferenceMessages.properties4
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/SourcePreferencePage.java2
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/sourcelookup/CProjectSourceContainerBrowser.java64
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/sourcelookup/CompilationDirectorySourceContainerBrowser.java67
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/sourcelookup/CompilationDirectorySourceContainerDialog.java231
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/sourcelookup/ProgramRelativePathSourceContainerBrowser.java27
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/sourcelookup/SourceContainerWorkbenchAdapter.java14
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/sourcelookup/SourceFoldersRelativePathSourceContainerBrowser.java64
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/sourcelookup/SourceLookupUIMessages.java15
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/sourcelookup/SourceLookupUIMessages.properties20
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/sourcelookup/TargetProjectSourceContainerDialog.java73
13 files changed, 584 insertions, 20 deletions
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/ICDebugHelpContextIds.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/ICDebugHelpContextIds.java
index 250e5c46b94..2d98298566c 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/ICDebugHelpContextIds.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/ICDebugHelpContextIds.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 QNX Software Systems and others.
+ * Copyright (c) 2000, 2010 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
@@ -8,14 +8,13 @@
* Contributors:
* QNX Software Systems - Initial API and implementation
* Markus Schorn (Wind River Systems)
+ * Sergey Prigogin (Google)
*******************************************************************************/
-
package org.eclipse.cdt.debug.internal.ui;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
/**
- *
* Help context ids for the C/C++ debug ui.
* <p>
* This interface contains constants only; it is not intended to be implemented
@@ -80,9 +79,10 @@ public interface ICDebugHelpContextIds {
public static final String ADD_DIRECTORY_CONTAINER_DIALOG = PREFIX + "add_directory_container_dialog"; //$NON-NLS-1$
public static final String REGISTER_GROUP = PREFIX + "register_group_dialog"; //$NON-NLS-1$
public static final String CONFIGURE_COLUMNS_DIALOG = PREFIX + "configure_columns_dialog_context"; //$NON-NLS-1$;
+ public static final String COMPILATION_DIRECTORY_SOURCE_CONTAINER_DIALOG = PREFIX + "compilation_directory_source_container_dialog_context"; //$NON-NLS-1$;;
+ public static final String ADD_TARGET_PROJECT_CONTAINER_DIALOG = PREFIX + "target_project_source_container_dialog";//$NON-NLS-1$
// Wizards
public static final String IMPORT_EXECUTABLE_PAGE_ONE = PREFIX + "import_executable_page_one"; //$NON-NLS-1$
public static final String IMPORT_EXECUTABLE_PAGE_TWO = PREFIX + "import_executable_page_two"; //$NON-NLS-1$
-
}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/IInternalCDebugUIConstants.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/IInternalCDebugUIConstants.java
index b3a07378b51..780fcf6a689 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/IInternalCDebugUIConstants.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/IInternalCDebugUIConstants.java
@@ -1,12 +1,13 @@
/*******************************************************************************
- * Copyright (c) 2004, 2008 QNX Software Systems and others.
+ * Copyright (c) 2004, 2010 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
+ * QNX Software Systems - Initial API and implementation
+ * Sergey Prigogin (Google)
*******************************************************************************/
package org.eclipse.cdt.debug.internal.ui;
@@ -43,7 +44,7 @@ public interface IInternalCDebugUIConstants {
public static final RGB DEFAULT_DISASSEMBLY_SOURCE_LINE_RGB = Display.getDefault().getSystemColor( SWT.COLOR_DARK_BLUE ).getRGB();
- //Current stack frame instruction pointer
+ // Current stack frame instruction pointer
public static final String DISASM_INSTRUCTION_POINTER = PREFIX + "disassemblyInstructionPointer"; //$NON-NLS-1$
// marker types for instruction pointer annotations - top stack frame, and secondary
@@ -74,10 +75,12 @@ public interface IInternalCDebugUIConstants {
*/
public static final int INTERNAL_ERROR = 150;
- // new disassembly (start)
+ // new disassembly
public static final String DISASM_DISPLAY_MODE_INSTRUCTIONS = "instructions"; //$NON-NLS-1$
public static final String DISASM_DISPLAY_MODE_SOURCE = "source"; //$NON-NLS-1$
-
- // new disassembly (end)
+
+ // wizard images
+ public static final String IMG_ADD_COMP_DIR_WIZ = "IMG_ADD_SRC_DIRECTORY"; //$NON-NLS-1$
+ public static final String IMG_EDIT_COMP_DIR_WIZ = "IMG_EDIT_SRC_DIRECTORY"; //$NON-NLS-1$
}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/PreferenceMessages.properties b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/PreferenceMessages.properties
index 369e4b42227..f3fe088b32c 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/PreferenceMessages.properties
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/PreferenceMessages.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2003, 2009 QNX Software Systems and others.
+# Copyright (c) 2003, 2010 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
@@ -25,7 +25,7 @@ CDebugPreferencePage.13=Value must be an integer between {0} and {1}.
CDebugPreferencePage.14=Binary
CDebugPreferencePage.15=Show source files in binaries
CDebugPreferencePage.16=Character encoding:
-SourcePreferencePage.0=Common S&ource Lookup Path:
+SourcePreferencePage.0=Default S&ource Lookup Path:
DebuggerTypesPage.0=Select All
DebuggerTypesPage.1=Deselect All
DebuggerTypesPage.2=Default
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/SourcePreferencePage.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/SourcePreferencePage.java
index 529f155fe1a..9ea87e3c139 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/SourcePreferencePage.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/SourcePreferencePage.java
@@ -41,7 +41,7 @@ import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
/**
- * The "Common Source Lookup Path" preference page.
+ * The "Source Lookup Path" preference page.
*/
public class SourcePreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
private SourceContainerViewer fPathViewer;
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/sourcelookup/CProjectSourceContainerBrowser.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/sourcelookup/CProjectSourceContainerBrowser.java
new file mode 100644
index 00000000000..0109a48e93d
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/sourcelookup/CProjectSourceContainerBrowser.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Google, Inc 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:
+ * Sergey Prigogin (Google) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.debug.internal.ui.sourcelookup;
+
+import java.util.ArrayList;
+
+import org.eclipse.cdt.debug.core.sourcelookup.CProjectSourceContainer;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.debug.core.sourcelookup.ISourceContainer;
+import org.eclipse.debug.core.sourcelookup.ISourceLookupDirector;
+import org.eclipse.debug.internal.ui.sourcelookup.BasicContainerContentProvider;
+import org.eclipse.debug.internal.ui.sourcelookup.browsers.ProjectSourceContainerDialog;
+import org.eclipse.debug.ui.sourcelookup.AbstractSourceContainerBrowser;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.model.WorkbenchLabelProvider;
+
+/**
+ * The browser for adding a source folder relative path source container.
+ */
+public class CProjectSourceContainerBrowser extends AbstractSourceContainerBrowser {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.sourcelookup.ISourceContainerBrowser#createSourceContainers(org.eclipse.swt.widgets.Shell, org.eclipse.debug.core.ILaunchConfiguration)
+ */
+ public ISourceContainer[] addSourceContainers(Shell shell, ISourceLookupDirector director) {
+ if (director.getLaunchConfiguration() == null) {
+ TargetProjectSourceContainerDialog dialog = new TargetProjectSourceContainerDialog(shell);
+ if (dialog.open() == Window.OK) {
+ return new ISourceContainer[] {
+ new CProjectSourceContainer(null, dialog.isAddReferencedProjects()) };
+ }
+ } else {
+ Object input = ResourcesPlugin.getWorkspace().getRoot();
+ IStructuredContentProvider contentProvider=new BasicContainerContentProvider();
+ ILabelProvider labelProvider = new WorkbenchLabelProvider();
+ ProjectSourceContainerDialog dialog =
+ new ProjectSourceContainerDialog(shell, input, contentProvider, labelProvider,
+ SourceLookupUIMessages.projectSelection_chooseLabel);
+ if (dialog.open() == Window.OK) {
+ ArrayList<ISourceContainer> res= new ArrayList<ISourceContainer>();
+ for (Object element : dialog.getResult()) {
+ if (!(element instanceof IProject))
+ continue;
+ res.add(new CProjectSourceContainer((IProject) element,
+ dialog.isAddRequiredProjects()));
+ }
+ return res.toArray(new ISourceContainer[res.size()]);
+ }
+ }
+ return new ISourceContainer[0];
+ }
+}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/sourcelookup/CompilationDirectorySourceContainerBrowser.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/sourcelookup/CompilationDirectorySourceContainerBrowser.java
new file mode 100644
index 00000000000..334658bc347
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/sourcelookup/CompilationDirectorySourceContainerBrowser.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Google, Inc 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:
+ * Sergey Prigogin (Google) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.debug.internal.ui.sourcelookup;
+
+import org.eclipse.core.runtime.Path;
+import org.eclipse.debug.core.sourcelookup.ISourceContainer;
+import org.eclipse.debug.core.sourcelookup.ISourceLookupDirector;
+import org.eclipse.debug.ui.sourcelookup.AbstractSourceContainerBrowser;
+import org.eclipse.cdt.debug.internal.core.sourcelookup.CompilationDirectorySourceContainer;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * The browser for adding a compilation directory source container.
+ */
+public class CompilationDirectorySourceContainerBrowser extends AbstractSourceContainerBrowser {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.sourcelookup.ISourceContainerBrowser#createSourceContainers(org.eclipse.swt.widgets.Shell, org.eclipse.debug.core.ILaunchConfiguration)
+ */
+ public ISourceContainer[] addSourceContainers(Shell shell, ISourceLookupDirector director) {
+ ISourceContainer[] containers = new ISourceContainer[1];
+ CompilationDirectorySourceContainerDialog dialog = new CompilationDirectorySourceContainerDialog(shell);
+ if (dialog.open() == Window.OK) {
+ String directory = dialog.getDirectory();
+ if (directory != null) {
+ containers[0] = new CompilationDirectorySourceContainer(new Path(directory), dialog.isCompilationSubfolders());
+ return containers;
+ }
+ }
+ return new ISourceContainer[0];
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.sourcelookup.AbstractSourceContainerBrowser#canEditSourceContainers(org.eclipse.debug.core.sourcelookup.ISourceLookupDirector, org.eclipse.debug.core.sourcelookup.ISourceContainer[])
+ */
+ public boolean canEditSourceContainers(ISourceLookupDirector director, ISourceContainer[] containers) {
+ return containers.length == 1 && CompilationDirectorySourceContainer.TYPE_ID.equals(containers[0].getType().getId());
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.sourcelookup.AbstractSourceContainerBrowser#editSourceContainers(org.eclipse.swt.widgets.Shell, org.eclipse.debug.core.sourcelookup.ISourceLookupDirector, org.eclipse.debug.core.sourcelookup.ISourceContainer[])
+ */
+ public ISourceContainer[] editSourceContainers(Shell shell, ISourceLookupDirector director, ISourceContainer[] containers) {
+ if (containers.length == 1 && CompilationDirectorySourceContainer.TYPE_ID.equals(containers[0].getType().getId()) ) {
+ CompilationDirectorySourceContainer c = (CompilationDirectorySourceContainer) containers[0];
+ CompilationDirectorySourceContainerDialog dialog =
+ new CompilationDirectorySourceContainerDialog(shell, c.getDirectory().getPath(), c.isComposite());
+ if (dialog.open() == Window.OK) {
+ String directory = dialog.getDirectory();
+ if (directory != null) {
+ containers[0].dispose();
+ return new ISourceContainer[] { new CompilationDirectorySourceContainer(new Path(directory), dialog.isCompilationSubfolders()) };
+ }
+ }
+ }
+ return containers;
+ }
+}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/sourcelookup/CompilationDirectorySourceContainerDialog.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/sourcelookup/CompilationDirectorySourceContainerDialog.java
new file mode 100644
index 00000000000..050df7b9e67
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/sourcelookup/CompilationDirectorySourceContainerDialog.java
@@ -0,0 +1,231 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Google, Inc 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:
+ * Sergey Prigogin (Google) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.debug.internal.ui.sourcelookup;
+
+import java.io.File;
+
+import org.eclipse.cdt.debug.internal.ui.CDebugImages;
+import org.eclipse.cdt.debug.internal.ui.ICDebugHelpContextIds;
+import org.eclipse.cdt.debug.internal.ui.IInternalCDebugUIConstants;
+import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.TitleAreaDialog;
+import org.eclipse.jface.resource.JFaceResources;
+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.graphics.Font;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+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.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * The dialog for selecting the external folder for which a compilation directory source container
+ * will be created.
+ */
+public class CompilationDirectorySourceContainerDialog extends TitleAreaDialog {
+ private static final String LAST_PATH_SETTING = "EXT_FOLDER_LAST_PATH_SETTING"; //$NON-NLS-1$
+ private static final String LAST_SUBDIR_SETTING = "EXT_FOLDER_LAST_SUBDIR_SETTING"; //$NON-NLS-1$
+
+ private String fDirectory;
+ private boolean fCompilationSubfolders;
+
+ private Text fDirText;
+ private Button fSubfoldersButton;
+ private boolean fNewContainer;
+
+ /**
+ * Creates a dialog to select a new file system folder.
+ *
+ * @param shell shell
+ */
+ public CompilationDirectorySourceContainerDialog(Shell shell) {
+ this(shell, "", //$NON-NLS-1$
+ CDebugUIPlugin.getDefault().getDialogSettings().getBoolean(LAST_SUBDIR_SETTING));
+ fNewContainer = true;
+ }
+
+ /**
+ * Creates a dialog to edit file system folder.
+ *
+ * @param shell shell
+ * @param directory directory to edit or empty string
+ * @param compilationSubfolders whether the 'Subdirectories are also used for compilation'
+ * checkbox should be checked
+ * @param newContainer
+ */
+ public CompilationDirectorySourceContainerDialog(Shell shell, String directory, boolean compilationSubfolders) {
+ super(shell);
+ setShellStyle(getShellStyle() | SWT.RESIZE);
+ fDirectory = directory;
+ fCompilationSubfolders = compilationSubfolders;
+ fNewContainer = false;
+ }
+
+ /**
+ * Returns the result of the dialog.open() operation
+ * @return the dialog.open() result
+ */
+ public String getDirectory() {
+ return fDirectory;
+ }
+
+ /**
+ * Returns whether the 'Subdirectories are also used for compilation' option is selected.
+ *
+ * @return whether the 'Subdirectories are also used for compilation' option is selected
+ */
+ public boolean isCompilationSubfolders() {
+ return fCompilationSubfolders;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.TitleAreaDialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+ */
+ protected Control createDialogArea(Composite parent) {
+ Image image = fNewContainer ?
+ CDebugImages.get(IInternalCDebugUIConstants.IMG_ADD_COMP_DIR_WIZ) :
+ CDebugImages.get(IInternalCDebugUIConstants.IMG_EDIT_COMP_DIR_WIZ);
+ setTitle(SourceLookupUIMessages.CompilationDirectorySourceContainerDialog_2);
+ setMessage(SourceLookupUIMessages.CompilationDirectorySourceContainerDialog_3);
+ setTitleImage(image);
+ Composite parentComposite = (Composite) super.createDialogArea(parent);
+ Font font = parentComposite.getFont();
+ Composite composite = new Composite(parentComposite, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ 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);
+ composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+ composite.setFont(font);
+
+ Composite dirComposite = new Composite(composite, SWT.NONE);
+ layout = new GridLayout(2, false);
+ dirComposite.setLayout(layout);
+ dirComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ dirComposite.setFont(font);
+
+ Label label = new Label(dirComposite, SWT.NONE);
+ label.setText(SourceLookupUIMessages.CompilationDirectorySourceContainerDialog_4);
+ GridData data = new GridData(GridData.FILL_HORIZONTAL);
+ data.horizontalSpan = 2;
+ label.setLayoutData(data);
+ label.setFont(font);
+
+ fDirText = new Text(dirComposite, SWT.BORDER);
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ data.horizontalSpan = 1;
+ fDirText.setLayoutData(data);
+ fDirText.setFont(font);
+ fDirText.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ validate();
+ }
+ });
+
+ Button button = new Button(dirComposite, SWT.PUSH);
+ button.setText(SourceLookupUIMessages.CompilationDirectorySourceContainerDialog_5);
+ data = new GridData();
+ int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
+ Point minSize = button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
+ data.widthHint = Math.max(widthHint, minSize.x);
+ button.setLayoutData(data);
+ button.setFont(JFaceResources.getDialogFont());
+ button.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent event) {
+ browse();
+ }
+ });
+
+ fSubfoldersButton = new Button(dirComposite, SWT.CHECK);
+ fSubfoldersButton.setText(SourceLookupUIMessages.CompilationDirectorySourceContainerDialog_6);
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ data.verticalIndent = layout.verticalSpacing; // Extra vertical spacing
+ fSubfoldersButton.setLayoutData(data);
+ fSubfoldersButton.setFont(font);
+
+ return parentComposite;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
+ */
+ protected void configureShell(Shell newShell) {
+ String title = null;
+ if (fNewContainer) {
+ title = SourceLookupUIMessages.CompilationDirectorySourceContainerDialog_7;
+ } else {
+ title = SourceLookupUIMessages.CompilationDirectorySourceContainerDialog_8;
+ }
+ newShell.setText(title);
+ super.configureShell(newShell);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.TitleAreaDialog#createContents(org.eclipse.swt.widgets.Composite)
+ */
+ protected Control createContents(Composite parent) {
+ Control c = super.createContents(parent);
+ fDirText.setText(fDirectory);
+ fSubfoldersButton.setSelection(fCompilationSubfolders);
+ validate();
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(c, ICDebugHelpContextIds.COMPILATION_DIRECTORY_SOURCE_CONTAINER_DIALOG);
+ return c;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.Dialog#okPressed()
+ */
+ protected void okPressed() {
+ fDirectory = fDirText.getText().trim();
+ fCompilationSubfolders = fSubfoldersButton.getSelection();
+ CDebugUIPlugin.getDefault().getDialogSettings().put(LAST_PATH_SETTING, fDirectory);
+ CDebugUIPlugin.getDefault().getDialogSettings().put(LAST_SUBDIR_SETTING, fCompilationSubfolders);
+ super.okPressed();
+ }
+
+ private void browse() {
+ String last = fDirText.getText().trim();
+ if (last.length() == 0) {
+ last = CDebugUIPlugin.getDefault().getDialogSettings().get(LAST_PATH_SETTING);
+ }
+ if (last == null) {
+ last = ""; //$NON-NLS-1$
+ }
+ DirectoryDialog dialog = new DirectoryDialog(getShell(), SWT.SINGLE);
+ dialog.setText(SourceLookupUIMessages.CompilationDirectorySourceContainerDialog_0);
+ dialog.setMessage(SourceLookupUIMessages.CompilationDirectorySourceContainerDialog_1);
+ dialog.setFilterPath(last);
+ String result = dialog.open();
+ if (result == null) {
+ return;
+ }
+ fDirText.setText(result);
+ }
+
+ private void validate() {
+ File file = new File(fDirText.getText().trim());
+ getButton(IDialogConstants.OK_ID).setEnabled(file.isDirectory() && file.exists());
+ }
+}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/sourcelookup/ProgramRelativePathSourceContainerBrowser.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/sourcelookup/ProgramRelativePathSourceContainerBrowser.java
new file mode 100644
index 00000000000..2e2f86715b0
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/sourcelookup/ProgramRelativePathSourceContainerBrowser.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Google, Inc 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:
+ * Sergey Prigogin (Google) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.debug.internal.ui.sourcelookup;
+
+import org.eclipse.cdt.debug.core.sourcelookup.ProgramRelativePathSourceContainer;
+import org.eclipse.debug.core.sourcelookup.ISourceContainer;
+import org.eclipse.debug.core.sourcelookup.ISourceLookupDirector;
+import org.eclipse.debug.ui.sourcelookup.AbstractSourceContainerBrowser;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * Adds a program-relative path to the source lookup path.
+ */
+public class ProgramRelativePathSourceContainerBrowser extends AbstractSourceContainerBrowser {
+
+ public ISourceContainer[] addSourceContainers(Shell shell, ISourceLookupDirector director) {
+ return new ISourceContainer[] { new ProgramRelativePathSourceContainer() };
+ }
+}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/sourcelookup/SourceContainerWorkbenchAdapter.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/sourcelookup/SourceContainerWorkbenchAdapter.java
index 510193344bb..6f9d983d0d3 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/sourcelookup/SourceContainerWorkbenchAdapter.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/sourcelookup/SourceContainerWorkbenchAdapter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2006 QNX Software Systems and others.
+ * Copyright (c) 2004, 2010 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
@@ -14,6 +14,7 @@ import java.io.File;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.ICProject;
+import org.eclipse.cdt.debug.core.sourcelookup.CProjectSourceContainer;
import org.eclipse.cdt.debug.core.sourcelookup.MappingSourceContainer;
import org.eclipse.cdt.debug.internal.core.sourcelookup.MapEntrySourceContainer;
import org.eclipse.cdt.debug.internal.ui.CDebugImages;
@@ -45,8 +46,15 @@ public class SourceContainerWorkbenchAdapter implements IWorkbenchAdapter {
if (o instanceof MapEntrySourceContainer) {
return CDebugImages.DESC_OBJS_PATH_MAP_ENTRY;
}
- if (o instanceof ProjectSourceContainer) {
- IProject project = ((ProjectSourceContainer)o).getProject();
+ if (o instanceof CProjectSourceContainer) {
+ IProject project = ((CProjectSourceContainer) o).getProject();
+ if (project != null) {
+ ICProject cProject = CCorePlugin.getDefault().getCoreModel().create(project);
+ if (cProject != null)
+ return getImageDescriptor(cProject);
+ }
+ } else if (o instanceof ProjectSourceContainer) {
+ IProject project = ((ProjectSourceContainer) o).getProject();
ICProject cProject = CCorePlugin.getDefault().getCoreModel().create(project);
if (cProject != null)
return getImageDescriptor(cProject);
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/sourcelookup/SourceFoldersRelativePathSourceContainerBrowser.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/sourcelookup/SourceFoldersRelativePathSourceContainerBrowser.java
new file mode 100644
index 00000000000..d8f64d4f924
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/sourcelookup/SourceFoldersRelativePathSourceContainerBrowser.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Google, Inc 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:
+ * Sergey Prigogin (Google) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.debug.internal.ui.sourcelookup;
+
+import java.util.ArrayList;
+
+import org.eclipse.cdt.debug.internal.core.sourcelookup.SourceFoldersRelativePathSourceContainer;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.debug.core.sourcelookup.ISourceContainer;
+import org.eclipse.debug.core.sourcelookup.ISourceLookupDirector;
+import org.eclipse.debug.internal.ui.sourcelookup.BasicContainerContentProvider;
+import org.eclipse.debug.internal.ui.sourcelookup.browsers.ProjectSourceContainerDialog;
+import org.eclipse.debug.ui.sourcelookup.AbstractSourceContainerBrowser;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.model.WorkbenchLabelProvider;
+
+/**
+ * The browser for adding a source folder relative path source container.
+ */
+public class SourceFoldersRelativePathSourceContainerBrowser extends AbstractSourceContainerBrowser {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.sourcelookup.ISourceContainerBrowser#createSourceContainers(org.eclipse.swt.widgets.Shell, org.eclipse.debug.core.ILaunchConfiguration)
+ */
+ public ISourceContainer[] addSourceContainers(Shell shell, ISourceLookupDirector director) {
+ if (director.getLaunchConfiguration() == null) {
+ TargetProjectSourceContainerDialog dialog = new TargetProjectSourceContainerDialog(shell);
+ if (dialog.open() == Window.OK) {
+ return new ISourceContainer[] {
+ new SourceFoldersRelativePathSourceContainer(null, dialog.isAddReferencedProjects()) };
+ }
+ } else {
+ Object input = ResourcesPlugin.getWorkspace().getRoot();
+ IStructuredContentProvider contentProvider=new BasicContainerContentProvider();
+ ILabelProvider labelProvider = new WorkbenchLabelProvider();
+ ProjectSourceContainerDialog dialog =
+ new ProjectSourceContainerDialog(shell, input, contentProvider, labelProvider,
+ SourceLookupUIMessages.projectSelection_chooseLabel);
+ if (dialog.open() == Window.OK) {
+ ArrayList<ISourceContainer> res= new ArrayList<ISourceContainer>();
+ for (Object element : dialog.getResult()) {
+ if (!(element instanceof IProject))
+ continue;
+ res.add(new SourceFoldersRelativePathSourceContainer((IProject) element,
+ dialog.isAddRequiredProjects()));
+ }
+ return res.toArray(new ISourceContainer[res.size()]);
+ }
+ }
+ return new ISourceContainer[0];
+ }
+}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/sourcelookup/SourceLookupUIMessages.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/sourcelookup/SourceLookupUIMessages.java
index 3752fccbe1e..3aa56f17b63 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/sourcelookup/SourceLookupUIMessages.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/sourcelookup/SourceLookupUIMessages.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2005 QNX Software Systems and others.
+ * Copyright (c) 2004, 2010 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
@@ -53,6 +53,19 @@ public class SourceLookupUIMessages extends NLS {
public static String CSourceNotFoundEditor_3;
public static String CSourceNotFoundEditor_4;
public static String CSourceNotFoundEditor_5;
+ public static String CompilationDirectorySourceContainerDialog_0;
+ public static String CompilationDirectorySourceContainerDialog_1;
+ public static String CompilationDirectorySourceContainerDialog_2;
+ public static String CompilationDirectorySourceContainerDialog_3;
+ public static String CompilationDirectorySourceContainerDialog_4;
+ public static String CompilationDirectorySourceContainerDialog_5;
+ public static String CompilationDirectorySourceContainerDialog_6;
+ public static String CompilationDirectorySourceContainerDialog_7;
+ public static String CompilationDirectorySourceContainerDialog_8;
+ public static String TargetProjectSourceContainerDialog_title;
+ public static String TargetProjectSourceContainerDialog_description;
+ public static String TargetProjectSourceContainerDialog_referencedLabel;
+ public static String projectSelection_chooseLabel;
static {
NLS.initializeMessages(SourceLookupUIMessages.class.getName(), SourceLookupUIMessages.class);
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/sourcelookup/SourceLookupUIMessages.properties b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/sourcelookup/SourceLookupUIMessages.properties
index 4764c96bdfc..00293eac067 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/sourcelookup/SourceLookupUIMessages.properties
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/sourcelookup/SourceLookupUIMessages.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2005, 2009 QNX Software Systems and others.
+# Copyright (c) 2005, 2010 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
@@ -7,8 +7,9 @@
#
# Contributors:
# QNX Software Systems - initial API and implementation
-# Ken Ryall (Nokia) - Added support for CSourceNotFoundElement ( 167305 )
-# Ken Ryall (Nokia) - Option to open disassembly view when no source ( 81353 )
+# Ken Ryall (Nokia) - Added support for CSourceNotFoundElement (167305)
+# Ken Ryall (Nokia) - Option to open disassembly view when no source (81353)
+# Sergey Prigogin (Google)
###############################################################################
AddContainerAction_0=&Add...
AddSourceContainerDialog_0=Add Source
@@ -49,3 +50,16 @@ CSourceNotFoundEditor_2=Missing Source File
CSourceNotFoundEditor_3=No source available for \"{0}\" \n
CSourceNotFoundEditor_4=View Disassembly...
CSourceNotFoundEditor_5=Edit Source Lookup Path...
+CompilationDirectorySourceContainerDialog_0=Directory Selection
+CompilationDirectorySourceContainerDialog_1=Choose directory to add:
+CompilationDirectorySourceContainerDialog_2=Compilation directory
+CompilationDirectorySourceContainerDialog_3=Specify directory and whether subdirectories are also used for compilation
+CompilationDirectorySourceContainerDialog_4=&Directory:
+CompilationDirectorySourceContainerDialog_5=&Browse...
+CompilationDirectorySourceContainerDialog_6=&Subdirectories are also used for compilation
+CompilationDirectorySourceContainerDialog_7=Add Compilation Directory
+CompilationDirectorySourceContainerDialog_8=Edit Compilation Directory
+TargetProjectSourceContainerDialog_title=Referenced Projects
+TargetProjectSourceContainerDialog_description=Specify whether referenced projects should be included
+TargetProjectSourceContainerDialog_referencedLabel=Add projects &referenced by the target project
+projectSelection_chooseLabel = Choose &project(s) to add:
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/sourcelookup/TargetProjectSourceContainerDialog.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/sourcelookup/TargetProjectSourceContainerDialog.java
new file mode 100644
index 00000000000..0478374af20
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/sourcelookup/TargetProjectSourceContainerDialog.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Google, Inc 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:
+ * Sergey Prigogin (Google) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.debug.internal.ui.sourcelookup;
+
+import org.eclipse.cdt.debug.internal.ui.ICDebugHelpContextIds;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.SelectionDialog;
+
+/**
+ * The dialog for configuring a source container for a project associated with the launch target.
+ */
+public class TargetProjectSourceContainerDialog extends SelectionDialog {
+ private boolean fAddReferencedProjects;
+
+ public TargetProjectSourceContainerDialog(Shell parentShell) {
+ super(parentShell);
+ setTitle(SourceLookupUIMessages.TargetProjectSourceContainerDialog_title);
+ setMessage(SourceLookupUIMessages.TargetProjectSourceContainerDialog_description);
+ }
+
+ /**
+ * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+ */
+ protected Control createDialogArea(Composite parent) {
+ Font font = parent.getFont();
+
+ // Page group
+ Composite composite = (Composite) super.createDialogArea(parent);
+ initializeDialogUnits(composite);
+
+ createMessageArea(composite);
+
+ final Button addRequired = new Button(composite, SWT.CHECK);
+ addRequired.setText(SourceLookupUIMessages.TargetProjectSourceContainerDialog_referencedLabel);
+ addRequired.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ fAddReferencedProjects = addRequired.getSelection();
+ }
+ });
+ addRequired.setSelection(fAddReferencedProjects);
+ addRequired.setFont(font);
+
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(getShell(),
+ ICDebugHelpContextIds.ADD_TARGET_PROJECT_CONTAINER_DIALOG);
+ applyDialogFont(composite);
+ return composite;
+ }
+
+ /**
+ * Returns whether the user has selected to add referenced projects.
+ *
+ * @return whether the user has selected to add referenced projects
+ */
+ public boolean isAddReferencedProjects() {
+ return fAddReferencedProjects;
+ }
+}

Back to the top