1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-06 16:45:25 +02:00

This commit was manufactured by cvs2svn to create branch 'cdt_1_2'.

Cherrypick from master 2003-10-24 17:49:22 UTC John Camelon <jcamelon@ca.ibm.com> 'CORE':
    core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTDesignator.java
    core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/ASTDesignator.java
    core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTInitializerClause.java
    core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTInitializerClause.java
    core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/CygPath.java
    core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/ICygwinToolsProvider.java
    core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/IToolsProvider.java
    core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/coff/parser/BinaryExecutable.java
    core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/coff/parser/BinaryFile.java
    core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/coff/parser/BinaryShared.java
    core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/coff/parser/CygwinPEParser.java
    debug/org.eclipse.cdt.debug.ui/icons/full/obj16/ext_file_obj.gif
    debug/org.eclipse.cdt.debug.ui/icons/full/obj16/prj_file_obj.gif
    debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/SourcePreferencePage.java
    debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/sourcelookup/SourceListDialogField.java
    debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/sourcelookup/SourceLookupLabelProvider.java
    releng/org.eclipse.cdt.releng/message.txt
This commit is contained in:
cvs2svn 2003-10-24 17:49:23 +00:00
parent ad9bebb9ca
commit d8b28329bd
17 changed files with 1285 additions and 0 deletions

View file

@ -0,0 +1,40 @@
/**********************************************************************
* Copyright (c) 2002,2003 Rational Software Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v05.html
*
* Contributors:
* IBM Rational Software - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.core.parser.ast;
import org.eclipse.cdt.core.parser.Enum;
/**
* @author jcamelon
*
*/
public interface IASTDesignator
{
public static class DesignatorKind extends Enum
{
public static final DesignatorKind FIELD = new DesignatorKind( 0 );
public static final DesignatorKind SUBSCRIPT = new DesignatorKind( 1 );
/**
* @param enumValue
*/
protected DesignatorKind(int enumValue)
{
super(enumValue);
// TODO Auto-generated constructor stub
}
}
public DesignatorKind getKind();
public IASTExpression arraySubscriptExpression();
public String fieldName();
public int fieldOffset();
}

View file

@ -0,0 +1,88 @@
/**********************************************************************
* Copyright (c) 2002,2003 Rational Software Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v05.html
*
* Contributors:
* IBM Rational Software - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.internal.core.parser.ast;
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
import org.eclipse.cdt.core.parser.ast.IASTDesignator;
import org.eclipse.cdt.core.parser.ast.IASTExpression;
/**
* @author jcamelon
*
*/
public class ASTDesignator implements IASTDesignator
{
/**
* @param kind
* @param constantExpression
* @param string
*/
public ASTDesignator(DesignatorKind kind, IASTExpression constantExpression, String fieldName, int fieldOffset )
{
this.fieldName = fieldName;
this.constantExpression = constantExpression;
this.kind = kind;
this.fieldOffset = fieldOffset;
}
private int fieldOffset;
private final String fieldName;
private final IASTExpression constantExpression;
private final DesignatorKind kind;
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTDesignator#getKind()
*/
public DesignatorKind getKind()
{
return kind;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTDesignator#arraySubscriptExpression()
*/
public IASTExpression arraySubscriptExpression()
{
return constantExpression;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTDesignator#fieldName()
*/
public String fieldName()
{
return fieldName;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
public void acceptElement(ISourceElementRequestor requestor)
{
if( constantExpression != null )
constantExpression.acceptElement(requestor);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
public void enterScope(ISourceElementRequestor requestor)
{
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
public void exitScope(ISourceElementRequestor requestor)
{
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTDesignator#fieldOffset()
*/
public int fieldOffset()
{
return fieldOffset;
}
}

View file

@ -0,0 +1,130 @@
/**********************************************************************
* Copyright (c) 2002,2003 Rational Software Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v05.html
*
* Contributors:
* IBM Rational Software - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.internal.core.parser.ast.complete;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
import org.eclipse.cdt.core.parser.ast.IASTExpression;
import org.eclipse.cdt.core.parser.ast.IASTInitializerClause;
import org.eclipse.cdt.core.parser.ast.IASTVariable;
import org.eclipse.cdt.internal.core.parser.ast.EmptyIterator;
/**
* @author jcamelon
*
*/
public class ASTInitializerClause implements IASTInitializerClause
{
private List references = new ArrayList();
private IASTVariable ownerDeclaration = null;
private final IASTInitializerClause.Kind kind;
private final IASTExpression assignmentExpression;
private final List initializerClauses;
private final List designators;
/**
* @param kind
* @param assignmentExpression
* @param initializerClauses
* @param designators
*/
public ASTInitializerClause(Kind kind, IASTExpression assignmentExpression, List initializerClauses, List designators)
{
this.kind = kind;
this.assignmentExpression = assignmentExpression;
this.initializerClauses = initializerClauses;
this.designators = designators;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTInitializerClause#getKind()
*/
public Kind getKind() {
return kind;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTInitializerClause#getInitializerList()
*/
public Iterator getInitializers() {
if( initializerClauses == null )
return new EmptyIterator();
return initializerClauses.iterator();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTInitializerClause#getAssigmentExpression()
*/
public IASTExpression getAssigmentExpression() {
return assignmentExpression;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
public void acceptElement(ISourceElementRequestor requestor)
{
Iterator i = getInitializers();
while( i.hasNext() )
((IASTInitializerClause)i.next()).acceptElement(requestor);
if( assignmentExpression != null )
assignmentExpression.acceptElement( requestor );
ASTReferenceStore store = new ASTReferenceStore( getReferences() );
store.processReferences(requestor);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
public void enterScope(ISourceElementRequestor requestor)
{
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
public void exitScope(ISourceElementRequestor requestor)
{
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTInitializerClause#getDesignators()
*/
public Iterator getDesignators()
{
return designators.iterator();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTInitializerClause#setOwnerDeclaration(org.eclipse.cdt.core.parser.ast.IASTDeclaration)
*/
public void setOwnerVariableDeclaration(IASTVariable declaration)
{
ownerDeclaration = declaration;
Iterator subInitializers = getInitializers();
while( subInitializers.hasNext() )
((IASTInitializerClause)subInitializers.next()).setOwnerVariableDeclaration(declaration);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTInitializerClause#getOwnerDeclaration()
*/
public IASTVariable getOwnerVariableDeclaration()
{
return ownerDeclaration;
}
public List getReferences()
{
return references;
}
}

View file

@ -0,0 +1,112 @@
/**********************************************************************
* Copyright (c) 2002,2003 Rational Software Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v05.html
*
* Contributors:
* IBM Rational Software - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.internal.core.parser.ast.quick;
import java.util.Iterator;
import java.util.List;
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
import org.eclipse.cdt.core.parser.ast.IASTExpression;
import org.eclipse.cdt.core.parser.ast.IASTInitializerClause;
import org.eclipse.cdt.core.parser.ast.IASTVariable;
import org.eclipse.cdt.internal.core.parser.ast.EmptyIterator;
/**
* @author jcamelon
*/
public class ASTInitializerClause implements IASTInitializerClause {
private final IASTInitializerClause.Kind kind;
private final IASTExpression assignmentExpression;
private final List initializerClauses;
private final List designators;
private IASTVariable ownerDeclaration = null;
/**
* @param kind
* @param assignmentExpression
* @param initializerClauses
*/
public ASTInitializerClause(Kind kind, IASTExpression assignmentExpression, List initializerClauses, List designators ) {
this.kind = kind;
this.assignmentExpression = assignmentExpression;
this.initializerClauses = initializerClauses;
this.designators = designators;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTInitializerClause#getKind()
*/
public Kind getKind() {
return kind;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTInitializerClause#getInitializerList()
*/
public Iterator getInitializers() {
if( initializerClauses == null )
return new EmptyIterator();
return initializerClauses.iterator();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTInitializerClause#getAssigmentExpression()
*/
public IASTExpression getAssigmentExpression() {
return assignmentExpression;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
public void acceptElement(ISourceElementRequestor requestor)
{
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
public void enterScope(ISourceElementRequestor requestor)
{
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
public void exitScope(ISourceElementRequestor requestor)
{
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTInitializerClause#getDesignators()
*/
public Iterator getDesignators()
{
return designators.iterator();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTInitializerClause#setOwnerDeclaration(org.eclipse.cdt.core.parser.ast.IASTDeclaration)
*/
public void setOwnerVariableDeclaration(IASTVariable declaration)
{
ownerDeclaration = declaration;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTInitializerClause#getOwnerDeclaration()
*/
public IASTVariable getOwnerVariableDeclaration()
{
return ownerDeclaration;
}
}

View file

@ -0,0 +1,53 @@
package org.eclipse.cdt.utils;
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import org.eclipse.cdt.utils.spawner.ProcessFactory;
public class CygPath {
private Process cygpath;
private BufferedReader stdout;
private BufferedWriter stdin;
public CygPath(String command) throws IOException {
String[] args = {command, "--windows", "--file", "-"};
cygpath = ProcessFactory.getFactory().exec(args);
//cppfilt = new Spawner(args);
stdin = new BufferedWriter(new OutputStreamWriter(cygpath.getOutputStream()));
stdout = new BufferedReader(new InputStreamReader(cygpath.getInputStream()));
}
public CygPath() throws IOException {
this("cygpath");
}
public String getFileName(String name) throws IOException {
stdin.write(name + "\n");
stdin.flush();
String str = stdout.readLine();
if ( str != null ) {
return str.trim();
}
throw new IOException();
}
public void dispose() {
try {
stdout.close();
stdin.close();
cygpath.getErrorStream().close();
}
catch (IOException e) {
}
cygpath.destroy();
}
}

View file

@ -0,0 +1,19 @@
/**********************************************************************
* Copyright (c) 2002,2003 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.utils;
/**
*/
public interface ICygwinToolsProvider extends IToolsProvider {
CygPath getCygPath();
}

View file

@ -0,0 +1,23 @@
/**********************************************************************
* Copyright (c) 2002,2003 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.utils;
import org.eclipse.core.runtime.IPath;
/**
*/
public interface IToolsProvider {
Addr2line getAddr2Line(IPath path);
CPPFilt getCPPFilt();
}

View file

@ -0,0 +1,41 @@
/**********************************************************************
* Copyright (c) 2002,2003 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.utils.coff.parser;
import java.io.IOException;
import org.eclipse.cdt.core.IBinaryParser.IBinaryExecutable;
import org.eclipse.cdt.core.IBinaryParser.IBinaryFile;
import org.eclipse.core.runtime.IPath;
/**
*/
public class BinaryExecutable extends BinaryObject implements IBinaryExecutable {
public BinaryExecutable(IPath path) throws IOException {
super(path);
}
/**
* @see org.eclipse.cdt.core.model.IBinaryParser.IBinaryExecutable#getNeededSharedLibs()
*/
public String[] getNeededSharedLibs() {
return new String[0];
}
/**
* @see org.eclipse.cdt.core.model.IBinaryParser.IBinaryFile#getType()
*/
public int getType() {
return IBinaryFile.EXECUTABLE;
}
}

View file

@ -0,0 +1,103 @@
/**********************************************************************
* Copyright (c) 2002,2003 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.utils.coff.parser;
import java.io.ByteArrayInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import org.eclipse.cdt.core.IBinaryParser.IBinaryFile;
import org.eclipse.cdt.utils.Addr2line;
import org.eclipse.cdt.utils.CPPFilt;
import org.eclipse.cdt.utils.CygPath;
import org.eclipse.cdt.utils.ICygwinToolsProvider;
import org.eclipse.cdt.utils.coff.PE.Attribute;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.PlatformObject;
/**
*
*/
public abstract class BinaryFile extends PlatformObject implements IBinaryFile {
protected IPath path;
protected ICygwinToolsProvider toolsProvider;
protected long timestamp;
public BinaryFile(IPath p) {
path = p;
}
public void setToolsProvider(ICygwinToolsProvider p) {
toolsProvider = p;
}
public Addr2line getAddr2Line() {
if (toolsProvider != null)
return toolsProvider.getAddr2Line(path);
return null;
}
public CPPFilt getCPPFilt() {
if (toolsProvider != null)
return toolsProvider.getCPPFilt();
return null;
}
public CygPath getCygPath() {
if (toolsProvider != null)
return toolsProvider.getCygPath();
return null;
}
/**
* @see org.eclipse.cdt.core.model.IBinaryParser.IBinaryFile#getFile()
*/
public IPath getPath() {
return path;
}
/**
* @see org.eclipse.cdt.core.model.IBinaryParser.IBinaryFile#getType()
*/
public abstract int getType();
/**
* @see org.eclipse.cdt.core.model.IBinaryParser.IBinaryFile#getContents()
*/
public InputStream getContents() {
InputStream stream = null;
if (path != null) {
try {
stream = new FileInputStream(path.toFile());
} catch (IOException e) {
}
}
if (stream == null) {
stream = new ByteArrayInputStream(new byte[0]);
}
return stream;
}
/**
* @return
*/
protected abstract Attribute getAttribute();
protected boolean hasChanged() {
long modification = getPath().toFile().lastModified();
boolean changed = modification != timestamp;
timestamp = modification;
return changed;
}
}

View file

@ -0,0 +1,51 @@
/**********************************************************************
* Copyright (c) 2002,2003 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.utils.coff.parser;
import java.io.IOException;
import org.eclipse.cdt.core.IBinaryParser.IBinaryFile;
import org.eclipse.cdt.core.IBinaryParser.IBinaryShared;
import org.eclipse.core.runtime.IPath;
/**
*/
public class BinaryShared extends BinaryExecutable implements IBinaryShared {
String soname;
public BinaryShared(IPath path) throws IOException {
super(path);
}
/**
* @see org.eclipse.cdt.core.model.IBinaryParser.IBinaryShared#getSoName()
*/
public String getSoName() {
if (hasChanged()) {
try {
loadInformation();
} catch (IOException e) {
}
}
if (soname != null) {
return soname;
}
return "";
}
/**
* @see org.eclipse.cdt.core.model.IBinaryParser.IBinaryFile#getType()
*/
public int getType() {
return IBinaryFile.SHARED;
}
}

View file

@ -0,0 +1,108 @@
/**********************************************************************
* Copyright (c) 2002,2003 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.utils.coff.parser;
import java.io.IOException;
import org.eclipse.cdt.core.IBinaryParser;
import org.eclipse.cdt.core.ICExtensionReference;
import org.eclipse.cdt.utils.Addr2line;
import org.eclipse.cdt.utils.CPPFilt;
import org.eclipse.cdt.utils.CygPath;
import org.eclipse.cdt.utils.ICygwinToolsProvider;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
/**
*/
public class CygwinPEParser extends PEParser implements IBinaryParser, ICygwinToolsProvider {
/**
* @see org.eclipse.cdt.core.model.IBinaryParser#getBinary(IPath)
*/
public IBinaryFile getBinary(IPath path) throws IOException {
IBinaryFile binary = super.getBinary(path);
if (binary instanceof BinaryFile) {
((BinaryFile)binary).setToolsProvider(this);
}
return binary;
}
/**
* @see org.eclipse.cdt.core.model.IBinaryParser#getFormat()
*/
public String getFormat() {
return "Cygwin PE";
}
public IPath getAddr2LinePath() {
ICExtensionReference ref = getExtensionReference();
String value = ref.getExtensionData("addr2line"); //$NON-NLS-1
if (value == null || value.length() == 0) {
value = "addr2line"; //$NON-NLS-1
}
return new Path(value);
}
public IPath getCPPFiltPath() {
ICExtensionReference ref = getExtensionReference();
String value = ref.getExtensionData("c++filt"); //$NON-NLS-1
if (value == null || value.length() == 0) {
value = "c++filt"; //$NON-NLS-1
}
return new Path(value);
}
public IPath getCygPathPath() {
ICExtensionReference ref = getExtensionReference();
String value = ref.getExtensionData("cygpath"); //$NON-NLS-1
if (value == null || value.length() == 0) {
value = "cygpath"; //$NON-NLS-1
}
return new Path(value);
}
public Addr2line getAddr2Line(IPath execFile) {
IPath addr2LinePath = getAddr2LinePath();
Addr2line addr2line = null;
if (addr2LinePath != null && !addr2LinePath.isEmpty()) {
try {
addr2line = new Addr2line(addr2LinePath.toOSString(), execFile.toOSString());
} catch (IOException e1) {
}
}
return addr2line;
}
public CPPFilt getCPPFilt() {
IPath cppFiltPath = getCPPFiltPath();
CPPFilt cppfilt = null;
if (cppFiltPath != null && ! cppFiltPath.isEmpty()) {
try {
cppfilt = new CPPFilt(cppFiltPath.toOSString());
} catch (IOException e2) {
}
}
return cppfilt;
}
public CygPath getCygPath() {
IPath cygPathPath = getCygPathPath();
CygPath cygpath = null;
if (cygPathPath != null && !cygPathPath.isEmpty()) {
try {
cygpath = new CygPath(cygPathPath.toOSString());
} catch (IOException e1) {
}
}
return cygpath;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 171 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 180 B

View file

@ -0,0 +1,233 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*
*/
package org.eclipse.cdt.debug.internal.ui.preferences;
import java.util.Arrays;
import java.util.Observable;
import java.util.Observer;
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
import org.eclipse.cdt.debug.core.ICDebugConstants;
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocation;
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.IListAdapter;
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.wizards.AddSourceLocationWizard;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
import org.eclipse.cdt.debug.ui.sourcelookup.SourceListDialogField;
import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.window.Window;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.eclipse.ui.help.WorkbenchHelp;
/**
* Enter type comment.
*
* @since Oct 22, 2003
*/
public class SourcePreferencePage extends PreferencePage implements IWorkbenchPreferencePage, Observer
{
private SourceListDialogField fSourceListField;
private SelectionButtonDialogField fSearchForDuplicateFiles;
private boolean fChanged = false;
public SourcePreferencePage()
{
super();
setPreferenceStore( CDebugUIPlugin.getDefault().getPreferenceStore() );
setDescription( "Common source lookup settings." );
}
/* (non-Javadoc)
* @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
*/
protected Control createContents( Composite parent )
{
WorkbenchHelp.setHelp( getControl(), ICDebugHelpContextIds.SOURCE_PREFERENCE_PAGE );
fSourceListField = createSourceListField();
fSearchForDuplicateFiles = createSearchForDuplicateFilesButton();
Composite control = new Composite( parent, SWT.NONE );
GridLayout layout = new GridLayout();
layout.numColumns = 2;
layout.marginWidth = 5;
layout.marginHeight = 5;
control.setLayout( layout );
GridData data = new GridData();
data.verticalAlignment = GridData.FILL;
data.horizontalAlignment = GridData.FILL;
control.setLayoutData( data );
control.setFont( JFaceResources.getDialogFont() );
PixelConverter converter = new PixelConverter( control );
fSourceListField.doFillIntoGrid( control, 3 );
LayoutUtil.setHorizontalSpan( fSourceListField.getLabelControl( null ), 2 );
LayoutUtil.setWidthHint( fSourceListField.getLabelControl( null ), converter.convertWidthInCharsToPixels( 40 ) );
LayoutUtil.setHorizontalGrabbing( fSourceListField.getListControl( null ) );
fSearchForDuplicateFiles.doFillIntoGrid( control, 3 );
setValues();
return control;
}
/* (non-Javadoc)
* @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
*/
public void init( IWorkbench workbench )
{
}
/* (non-Javadoc)
* @see java.util.Observer#update(java.util.Observable, java.lang.Object)
*/
public void update( Observable o, Object arg )
{
setChanged( true );
}
private SourceListDialogField createSourceListField()
{
SourceListDialogField field =
new SourceListDialogField( "Source Locations",
new IListAdapter()
{
public void customButtonPressed( DialogField field, int index )
{
sourceButtonPressed( index );
}
public void selectionChanged(DialogField field)
{
}
} );
field.addObserver( this );
return field;
}
private SelectionButtonDialogField createSearchForDuplicateFilesButton()
{
SelectionButtonDialogField button = new SelectionButtonDialogField( SWT.CHECK );
button.setLabelText( "Search for duplicate source files" );
button.setDialogFieldListener(
new IDialogFieldListener()
{
public void dialogFieldChanged( DialogField field )
{
setChanged( true );
}
} );
return button;
}
protected void sourceButtonPressed( int index )
{
switch( index )
{
case 0: // Add...
if ( addSourceLocation() )
setChanged( true );
break;
case 2: // Up
case 3: // Down
case 5: // Remove
setChanged( true );
break;
}
}
protected boolean isChanged()
{
return fChanged;
}
protected void setChanged( boolean changed )
{
fChanged = changed;
}
private boolean addSourceLocation()
{
AddSourceLocationWizard wizard = new AddSourceLocationWizard( getSourceLocations() );
WizardDialog dialog = new WizardDialog( getShell(), wizard );
if ( dialog.open() == Window.OK )
{
fSourceListField.addElement( wizard.getSourceLocation() );
return true;
}
return false;
}
public ICSourceLocation[] getSourceLocations()
{
return ( fSourceListField != null ) ? fSourceListField.getSourceLocations() : new ICSourceLocation[0];
}
public void setSourceLocations( ICSourceLocation[] locations )
{
if ( fSourceListField != null )
fSourceListField.setElements( Arrays.asList( locations ) );
}
/* (non-Javadoc)
* @see org.eclipse.jface.preference.PreferencePage#performDefaults()
*/
protected void performDefaults()
{
setSourceLocations( new ICSourceLocation[0] );
setSearchForDuplicateFiles( false );
super.performDefaults();
}
/* (non-Javadoc)
* @see org.eclipse.jface.preference.IPreferencePage#performOk()
*/
public boolean performOk()
{
storeValues();
CDebugCorePlugin.getDefault().savePluginPreferences();
return true;
}
private boolean searchForDuplicateFiles()
{
return ( fSearchForDuplicateFiles != null ) ? fSearchForDuplicateFiles.isSelected() : false;
}
private void setSearchForDuplicateFiles( boolean search )
{
if ( fSearchForDuplicateFiles != null )
fSearchForDuplicateFiles.setSelection( search );
}
private void setValues()
{
setSourceLocations( CDebugCorePlugin.getDefault().getCommonSourceLocations() );
setSearchForDuplicateFiles( CDebugCorePlugin.getDefault().getPluginPreferences().getBoolean( ICDebugConstants.PREF_SEARCH_DUPLICATE_FILES ) );
}
private void storeValues()
{
CDebugCorePlugin.getDefault().saveCommonSourceLocations( getSourceLocations() );
CDebugCorePlugin.getDefault().getPluginPreferences().setValue( ICDebugConstants.PREF_SEARCH_DUPLICATE_FILES, searchForDuplicateFiles() );
}
}

View file

@ -0,0 +1,213 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*
*/
package org.eclipse.cdt.debug.ui.sourcelookup;
import java.util.List;
import java.util.Observable;
import java.util.Observer;
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocation;
import org.eclipse.cdt.debug.internal.core.sourcelookup.CDirectorySourceLocation;
import org.eclipse.cdt.debug.internal.ui.dialogfields.IListAdapter;
import org.eclipse.cdt.debug.internal.ui.dialogfields.ListDialogField;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.ColumnWeightData;
import org.eclipse.jface.viewers.ComboBoxCellEditor;
import org.eclipse.jface.viewers.ICellModifier;
import org.eclipse.jface.viewers.TableLayout;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.TextCellEditor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
public class SourceListDialogField extends ListDialogField
{
public class ObservableSourceList extends Observable
{
protected synchronized void setChanged()
{
super.setChanged();
}
}
// String constants
protected static final String YES_VALUE = "yes";
protected static final String NO_VALUE = "no";
// Column properties
private static final String CP_LOCATION = "location";
private static final String CP_ASSOCIATION = "association";
private static final String CP_SEARCH_SUBFOLDERS = "searchSubfolders";
private ObservableSourceList fObservable = new ObservableSourceList();
public SourceListDialogField( String title, IListAdapter listAdapter )
{
super( listAdapter,
new String[]
{
/* 0 */ "Add...",
/* 1 */ null,
/* 2 */ "Up",
/* 3 */ "Down",
/* 4 */ null,
/* 5 */ "Remove",
},
new SourceLookupLabelProvider() );
setUpButtonIndex( 2 );
setDownButtonIndex( 3 );
setRemoveButtonIndex( 5 );
setLabelText( title );
}
protected boolean managedButtonPressed( int index )
{
super.managedButtonPressed( index );
return false;
}
protected TableViewer createTableViewer( Composite parent )
{
TableViewer viewer = super.createTableViewer( parent );
Table table = viewer.getTable();
TableLayout tableLayout = new TableLayout();
table.setLayout( tableLayout );
GridData gd = new GridData( GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL );
gd.grabExcessVerticalSpace = true;
gd.grabExcessHorizontalSpace = true;
table.setLayoutData( gd );
table.setLinesVisible( true );
table.setHeaderVisible( true );
new TableColumn( table, SWT.NULL );
tableLayout.addColumnData( new ColumnWeightData( 2, true ) );
new TableColumn( table, SWT.NULL );
tableLayout.addColumnData( new ColumnWeightData( 2, true ) );
new TableColumn( table, SWT.NULL );
tableLayout.addColumnData( new ColumnWeightData( 1, true ) );
TableColumn[] columns = table.getColumns();
columns[0].setText( "Location" );
columns[1].setText( "Association" );
columns[2].setText( "Search subfolders" );
CellEditor textCellEditor = new TextCellEditor( table );
CellEditor comboCellEditor = new ComboBoxCellEditor( table, new String[]{ YES_VALUE, NO_VALUE } );
viewer.setCellEditors( new CellEditor[]{ null, textCellEditor, comboCellEditor } );
viewer.setColumnProperties( new String[]{ CP_LOCATION, CP_ASSOCIATION, CP_SEARCH_SUBFOLDERS } );
viewer.setCellModifier( createCellModifier() );
return viewer;
}
private ICellModifier createCellModifier()
{
return new ICellModifier()
{
public boolean canModify( Object element, String property )
{
return ( element instanceof CDirectorySourceLocation && ( property.equals( CP_ASSOCIATION ) || property.equals( CP_SEARCH_SUBFOLDERS ) ) );
}
public Object getValue( Object element, String property )
{
if ( element instanceof CDirectorySourceLocation && property.equals( CP_ASSOCIATION ) )
{
return ( ((CDirectorySourceLocation)element).getAssociation() != null ) ?
((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;
}
public void modify( Object element, String property, Object value )
{
Object entry = getSelection();
if ( entry instanceof CDirectorySourceLocation )
{
if ( property.equals( CP_ASSOCIATION ) && value instanceof String )
{
IPath association = new Path( (String)value );
if ( association.isValidPath( (String)value ) )
{
((CDirectorySourceLocation)entry).setAssociation( association );
setChanged();
}
}
if ( property.equals( CP_SEARCH_SUBFOLDERS ) && value instanceof Integer )
{
((CDirectorySourceLocation)entry).setSearchSubfolders( ((Integer)value).intValue() == 0 );
setChanged();
}
if ( hasChanged() )
{
refresh();
notifyObservers();
}
}
}
};
}
protected Object getSelection()
{
List list = getSelectedElements();
return ( list.size() > 0 ) ? list.get( 0 ) : null;
}
public synchronized void addObserver( Observer o )
{
fObservable.addObserver( o );
}
public synchronized void deleteObserver( Observer o )
{
fObservable.deleteObserver( o );
}
public synchronized boolean hasChanged()
{
return fObservable.hasChanged();
}
public void notifyObservers()
{
fObservable.notifyObservers();
}
public void notifyObservers( Object arg )
{
fObservable.notifyObservers( arg );
}
public void dispose()
{
}
protected void setChanged()
{
fObservable.setChanged();
}
public ICSourceLocation[] getSourceLocations()
{
List list = getElements();
return (ICSourceLocation[])list.toArray( new ICSourceLocation[list.size()] );
}
}

View file

@ -0,0 +1,65 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*
*/
package org.eclipse.cdt.debug.ui.sourcelookup;
import org.eclipse.cdt.debug.core.sourcelookup.IDirectorySourceLocation;
import org.eclipse.cdt.debug.core.sourcelookup.IProjectSourceLocation;
import org.eclipse.cdt.debug.internal.ui.CDebugImages;
import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.swt.graphics.Image;
public class SourceLookupLabelProvider extends LabelProvider implements ITableLabelProvider
{
public Image getColumnImage( Object element, int columnIndex )
{
if ( columnIndex == 0 )
{
if ( element instanceof IProjectSourceLocation )
{
if ( ((IProjectSourceLocation)element).getProject().isOpen() )
return CDebugImages.get( CDebugImages.IMG_OBJS_PROJECT );
else
return CDebugImages.get( CDebugImages.IMG_OBJS_CLOSED_PROJECT );
}
if ( element instanceof IDirectorySourceLocation )
{
return CDebugImages.get( CDebugImages.IMG_OBJS_FOLDER );
}
}
return null;
}
public String getColumnText( Object element, int columnIndex )
{
if ( columnIndex == 0 )
{
if ( element instanceof IProjectSourceLocation )
{
return ((IProjectSourceLocation)element).getProject().getName();
}
if ( element instanceof IDirectorySourceLocation )
{
return ((IDirectorySourceLocation)element).getDirectory().toOSString();
}
}
else if ( columnIndex == 1 )
{
if ( element instanceof IDirectorySourceLocation && ((IDirectorySourceLocation)element).getAssociation() != null )
{
return ((IDirectorySourceLocation)element).getAssociation().toOSString();
}
}
else if ( columnIndex == 2 )
{
if ( element instanceof IDirectorySourceLocation )
return ( ((IDirectorySourceLocation)element).searchSubfolders() ) ? SourceListDialogField.YES_VALUE : SourceListDialogField.NO_VALUE;
}
return "";
}
}

View file

@ -0,0 +1,6 @@
The build is available at
http://update.eclipse.org/tools/cdt/updates/builds/2.0
Cheers,
dschaefer2, the buildmaster...