1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-08 02:06:01 +02:00

NLS-style string resources.

This commit is contained in:
Sergey Prigogin 2010-12-02 23:13:07 +00:00
parent bd51ec8825
commit f257c2f55d
21 changed files with 649 additions and 698 deletions

View file

@ -25,5 +25,4 @@ public class AbsolutePathSourceContainerBrowser extends AbstractSourceContainerB
AbsolutePathSourceContainer absolutePathSourceContainer = new AbsolutePathSourceContainer(); AbsolutePathSourceContainer absolutePathSourceContainer = new AbsolutePathSourceContainer();
return new ISourceContainer[] { absolutePathSourceContainer }; return new ISourceContainer[] { absolutePathSourceContainer };
} }
} }

View file

@ -19,11 +19,10 @@ import org.eclipse.jface.viewers.IStructuredSelection;
* and the EditSourceLookupPathDialog. * and the EditSourceLookupPathDialog.
*/ */
public class AddContainerAction extends SourceContainerAction { public class AddContainerAction extends SourceContainerAction {
private ISourceLookupDirector fDirector; private ISourceLookupDirector fDirector;
public AddContainerAction() { public AddContainerAction() {
super(SourceLookupUIMessages.getString( "AddContainerAction.0" )); //$NON-NLS-1$ super(SourceLookupUIMessages.AddContainerAction_0);
} }
/** /**

View file

@ -46,7 +46,6 @@ import org.eclipse.ui.PlatformUI;
* @since 3.0 * @since 3.0
*/ */
public class AddSourceContainerDialog extends TitleAreaDialog { public class AddSourceContainerDialog extends TitleAreaDialog {
private TableViewer fViewer; private TableViewer fViewer;
private SourceContainerViewer fSourceContainerViewer; private SourceContainerViewer fSourceContainerViewer;
private boolean fDoubleClickSelects = true; private boolean fDoubleClickSelects = true;
@ -66,9 +65,8 @@ public class AddSourceContainerDialog extends TitleAreaDialog {
* Creates the dialog area to display source container types that are "browseable" * Creates the dialog area to display source container types that are "browseable"
*/ */
protected Control createDialogArea(Composite ancestor) { protected Control createDialogArea(Composite ancestor) {
getShell().setText(SourceLookupUIMessages.AddSourceContainerDialog_0);
getShell().setText(SourceLookupUIMessages.getString( "AddSourceContainerDialog.0" )); //$NON-NLS-1$ setTitle(SourceLookupUIMessages.AddSourceContainerDialog_1);
setTitle(SourceLookupUIMessages.getString( "AddSourceContainerDialog.1" )); //$NON-NLS-1$
Composite parent = new Composite(ancestor, SWT.NULL); Composite parent = new Composite(ancestor, SWT.NULL);
GridData gd= new GridData(GridData.FILL_BOTH); GridData gd= new GridData(GridData.FILL_BOTH);
@ -121,7 +119,7 @@ public class AddSourceContainerDialog extends TitleAreaDialog {
* @return the list of source container types that have browsers * @return the list of source container types that have browsers
*/ */
private ISourceContainerType[] filterTypes(ISourceContainerType[] types){ private ISourceContainerType[] filterTypes(ISourceContainerType[] types){
ArrayList validTypes = new ArrayList(); ArrayList<ISourceContainerType> validTypes = new ArrayList<ISourceContainerType>();
for (int i=0; i < types.length; i++) { for (int i=0; i < types.length; i++) {
ISourceContainerType type = types[i]; ISourceContainerType type = types[i];
if (fDirector.supportsSourceContainerType(type)) { if (fDirector.supportsSourceContainerType(type)) {
@ -131,8 +129,7 @@ public class AddSourceContainerDialog extends TitleAreaDialog {
} }
} }
} }
return (ISourceContainerType[]) validTypes.toArray(new ISourceContainerType[validTypes.size()]); return validTypes.toArray(new ISourceContainerType[validTypes.size()]);
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -151,5 +148,4 @@ public class AddSourceContainerDialog extends TitleAreaDialog {
} }
super.okPressed(); super.okPressed();
} }
} }

View file

@ -14,7 +14,6 @@ package org.eclipse.cdt.debug.internal.ui.sourcelookup;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Iterator;
import org.eclipse.cdt.core.model.ITranslationUnit; import org.eclipse.cdt.core.model.ITranslationUnit;
import org.eclipse.cdt.debug.core.CDebugCorePlugin; import org.eclipse.cdt.debug.core.CDebugCorePlugin;
@ -43,6 +42,7 @@ import org.eclipse.debug.core.sourcelookup.ISourceContainer;
import org.eclipse.debug.core.sourcelookup.containers.LocalFileStorage; import org.eclipse.debug.core.sourcelookup.containers.LocalFileStorage;
import org.eclipse.debug.ui.sourcelookup.CommonSourceNotFoundEditor; import org.eclipse.debug.ui.sourcelookup.CommonSourceNotFoundEditor;
import org.eclipse.debug.ui.sourcelookup.ISourceDisplay; import org.eclipse.debug.ui.sourcelookup.ISourceDisplay;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionEvent;
@ -55,15 +55,11 @@ import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException; import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI; import org.eclipse.ui.PlatformUI;
import com.ibm.icu.text.MessageFormat;
/** /**
* Editor that lets you select a replacement for the missing source file * Editor that lets you select a replacement for the missing source file
* and modifies the source locator accordingly. * and modifies the source locator accordingly.
*
*/ */
public class CSourceNotFoundEditor extends CommonSourceNotFoundEditor { public class CSourceNotFoundEditor extends CommonSourceNotFoundEditor {
public final String foundMappingsContainerName = "Found Mappings"; //$NON-NLS-1$ public final String foundMappingsContainerName = "Found Mappings"; //$NON-NLS-1$
private static final String UID_KEY = ".uid"; //$NON-NLS-1$ private static final String UID_KEY = ".uid"; //$NON-NLS-1$
private static final String UID_CLASS_NAME = CSourceNotFoundEditor.class.getName(); private static final String UID_CLASS_NAME = CSourceNotFoundEditor.class.getName();
@ -110,9 +106,10 @@ public class CSourceNotFoundEditor extends CommonSourceNotFoundEditor {
IPath tuPath = tunit.getLocation(); IPath tuPath = tunit.getLocation();
if (tuPath != null) if (tuPath != null)
missingFile = tuPath.toOSString(); missingFile = tuPath.toOSString();
} else } else {
missingFile = ""; //$NON-NLS-1$ missingFile = ""; //$NON-NLS-1$
} }
}
super.setInput(input); super.setInput(input);
syncButtons(); syncButtons();
} }
@ -126,9 +123,8 @@ public class CSourceNotFoundEditor extends CommonSourceNotFoundEditor {
protected String getText() { protected String getText() {
if (missingFile.length() > 0) { if (missingFile.length() > 0) {
return MessageFormat.format(SourceLookupUIMessages.getString( "CSourceNotFoundEditor.0" ), new String[] { missingFile }); //$NON-NLS-1$ return NLS.bind(SourceLookupUIMessages.CSourceNotFoundEditor_0, missingFile);
} } else {
else {
if (context == null) if (context == null)
return super.getText(); return super.getText();
String contextDescription; String contextDescription;
@ -137,21 +133,19 @@ public class CSourceNotFoundEditor extends CommonSourceNotFoundEditor {
contextDescription = description.getDescription(); contextDescription = description.getDescription();
else else
contextDescription = context.toString(); contextDescription = context.toString();
return MessageFormat.format(SourceLookupUIMessages.getString( "CSourceNotFoundEditor.3" ), new String[] { contextDescription }); //$NON-NLS-1$ return NLS.bind(SourceLookupUIMessages.CSourceNotFoundEditor_3, contextDescription);
} }
} }
protected void createButtons(Composite parent) { protected void createButtons(Composite parent) {
if (isDebugElement) {
if (isDebugElement)
{
GridData data; GridData data;
disassemblyButton = new Button(parent, SWT.PUSH); disassemblyButton = new Button(parent, SWT.PUSH);
data = new GridData(); data = new GridData();
data.grabExcessHorizontalSpace = false; data.grabExcessHorizontalSpace = false;
data.grabExcessVerticalSpace = false; data.grabExcessVerticalSpace = false;
disassemblyButton.setLayoutData(data); disassemblyButton.setLayoutData(data);
disassemblyButton.setText(SourceLookupUIMessages.getString( "CSourceNotFoundEditor.4" )); //$NON-NLS-1$ disassemblyButton.setText(SourceLookupUIMessages.CSourceNotFoundEditor_4);
disassemblyButton.addSelectionListener(new SelectionAdapter() { disassemblyButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent evt) { public void widgetSelected(SelectionEvent evt) {
viewDisassembly(); viewDisassembly();
@ -167,7 +161,7 @@ public class CSourceNotFoundEditor extends CommonSourceNotFoundEditor {
data.grabExcessHorizontalSpace = false; data.grabExcessHorizontalSpace = false;
data.grabExcessVerticalSpace = false; data.grabExcessVerticalSpace = false;
locateFileButton.setLayoutData(data); locateFileButton.setLayoutData(data);
locateFileButton.setText(SourceLookupUIMessages.getString( "CSourceNotFoundEditor.1" )); //$NON-NLS-1$ locateFileButton.setText(SourceLookupUIMessages.CSourceNotFoundEditor_1);
locateFileButton.addSelectionListener(new SelectionAdapter() { locateFileButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent evt) { public void widgetSelected(SelectionEvent evt) {
locateFile(); locateFile();
@ -176,25 +170,22 @@ public class CSourceNotFoundEditor extends CommonSourceNotFoundEditor {
locateFileButton.setData(UID_KEY, UID_LOCATE_FILE_BUTTON); locateFileButton.setData(UID_KEY, UID_LOCATE_FILE_BUTTON);
} }
if (isDebugElement) if (isDebugElement) {
{
GridData data; GridData data;
editLookupButton = new Button(parent, SWT.PUSH); editLookupButton = new Button(parent, SWT.PUSH);
data = new GridData(); data = new GridData();
data.grabExcessHorizontalSpace = false; data.grabExcessHorizontalSpace = false;
data.grabExcessVerticalSpace = false; data.grabExcessVerticalSpace = false;
editLookupButton.setLayoutData(data); editLookupButton.setLayoutData(data);
editLookupButton.setText(SourceLookupUIMessages.getString( "CSourceNotFoundEditor.5" )); //$NON-NLS-1$ editLookupButton.setText(SourceLookupUIMessages.CSourceNotFoundEditor_5);
editLookupButton.addSelectionListener(new SelectionAdapter() { editLookupButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent evt) { public void widgetSelected(SelectionEvent evt) {
editSourceLookupPath(); editSourceLookupPath();
} }
}); });
editLookupButton.setData(UID_KEY, UID_EDIT_LOOKUP_BUTTON); editLookupButton.setData(UID_KEY, UID_EDIT_LOOKUP_BUTTON);
} }
syncButtons(); syncButtons();
} }
protected void viewDisassembly() { protected void viewDisassembly() {
@ -202,36 +193,31 @@ public class CSourceNotFoundEditor extends CommonSourceNotFoundEditor {
if (page != null) { if (page != null) {
try { try {
page.showView("org.eclipse.cdt.dsf.debug.ui.disassembly.view"); //$NON-NLS-1$ page.showView("org.eclipse.cdt.dsf.debug.ui.disassembly.view"); //$NON-NLS-1$
} catch (PartInitException e) {} } catch (PartInitException e) {
}
} }
} }
private void addSourceMappingToDirector(IPath missingPath, IPath newSourcePath, AbstractSourceLookupDirector director) throws CoreException { private void addSourceMappingToDirector(IPath missingPath, IPath newSourcePath, AbstractSourceLookupDirector director) throws CoreException {
ArrayList<ISourceContainer> containerList = new ArrayList<ISourceContainer>(Arrays.asList(director.getSourceContainers()));
ArrayList containerList = new ArrayList(Arrays.asList(director.getSourceContainers()));
boolean hasFoundMappings = false;
MappingSourceContainer foundMappings = null; MappingSourceContainer foundMappings = null;
for (ISourceContainer container : containerList) {
for (Iterator iter = containerList.iterator(); iter.hasNext() && !hasFoundMappings;) { if (container instanceof MappingSourceContainer) {
ISourceContainer container = (ISourceContainer) iter.next(); if (container.getName().equals(foundMappingsContainerName)) {
if (container instanceof MappingSourceContainer)
{
hasFoundMappings = container.getName().equals(foundMappingsContainerName);
if (hasFoundMappings)
foundMappings = (MappingSourceContainer) container; foundMappings = (MappingSourceContainer) container;
break;
}
} }
} }
if (!hasFoundMappings) { if (foundMappings == null) {
foundMappings = new MappingSourceContainer(foundMappingsContainerName); foundMappings = new MappingSourceContainer(foundMappingsContainerName);
foundMappings.init(director); foundMappings.init(director);
containerList.add(foundMappings); containerList.add(foundMappings);
} }
foundMappings.addMapEntry(new MapEntrySourceContainer(missingPath, newSourcePath)); foundMappings.addMapEntry(new MapEntrySourceContainer(missingPath, newSourcePath));
director.setSourceContainers((ISourceContainer[]) containerList.toArray(new ISourceContainer[containerList.size()])); director.setSourceContainers(containerList.toArray(new ISourceContainer[containerList.size()]));
} }
/** /**
@ -271,25 +257,22 @@ public class CSourceNotFoundEditor extends CommonSourceNotFoundEditor {
} }
addSourceMappingToDirector(missingPath, newSourcePath, director); addSourceMappingToDirector(missingPath, newSourcePath, director);
configuration.setAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_MEMENTO, director.getMemento()); configuration.setAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_MEMENTO, director.getMemento());
configuration.setAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_ID, director.getId()); configuration.setAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_ID, director.getId());
configuration.doSave(); configuration.doSave();
} }
} }
protected void locateFile() { protected void locateFile() {
FileDialog dialog = new FileDialog(getEditorSite().getShell(), SWT.NONE); FileDialog dialog = new FileDialog(getEditorSite().getShell(), SWT.NONE);
Path missingPath = new Path(missingFile); Path missingPath = new Path(missingFile);
dialog.setFilterNames(new String[] {SourceLookupUIMessages.getString("CSourceNotFoundEditor.2")}); //$NON-NLS-1$ dialog.setFilterNames(new String[] {SourceLookupUIMessages.CSourceNotFoundEditor_2});
dialog.setFilterExtensions(new String[] {"*." + missingPath.getFileExtension()}); //$NON-NLS-1$ dialog.setFilterExtensions(new String[] {"*." + missingPath.getFileExtension()}); //$NON-NLS-1$
String res = dialog.open(); String res = dialog.open();
if (res != null) { if (res != null) {
Path newPath = new Path(res); Path newPath = new Path(res);
if (newPath.lastSegment().equalsIgnoreCase(missingPath.lastSegment())) { if (newPath.lastSegment().equalsIgnoreCase(missingPath.lastSegment())) {
if (missingPath.segmentCount() > 1) { if (missingPath.segmentCount() > 1) {
IPath compPath = missingPath.removeLastSegments(1); IPath compPath = missingPath.removeLastSegments(1);
IPath newSourcePath = newPath.removeLastSegments(1); IPath newSourcePath = newPath.removeLastSegments(1);
@ -298,22 +281,18 @@ public class CSourceNotFoundEditor extends CommonSourceNotFoundEditor {
addSourceMappingToLaunch(compPath, newSourcePath); addSourceMappingToLaunch(compPath, newSourcePath);
else else
addSourceMappingToCommon(compPath, newSourcePath); addSourceMappingToCommon(compPath, newSourcePath);
} catch (CoreException e) {} } catch (CoreException e) {
}
} }
IWorkbenchPage page = getEditorSite().getPage(); IWorkbenchPage page = getEditorSite().getPage();
if (isDebugElement) if (isDebugElement) {
{
ISourceDisplay adapter = (ISourceDisplay)context.getAdapter(ISourceDisplay.class); ISourceDisplay adapter = (ISourceDisplay)context.getAdapter(ISourceDisplay.class);
if (adapter != null) { if (adapter != null) {
adapter.displaySource(context, page, true); adapter.displaySource(context, page, true);
} }
} } else if (isTranslationUnit) {
else
if (isTranslationUnit)
{
reopenTranslationUnit(tunit); reopenTranslationUnit(tunit);
} }
closeEditor(); closeEditor();
@ -321,41 +300,34 @@ public class CSourceNotFoundEditor extends CommonSourceNotFoundEditor {
} }
} }
private boolean reopenTranslationUnit(ITranslationUnit tu) private boolean reopenTranslationUnit(ITranslationUnit tu){
{ if (tu != null){
if (tu != null)
{
IPath tuPath = tu.getLocation(); IPath tuPath = tu.getLocation();
if (tuPath != null) if (tuPath != null){
{
String filePath = tuPath.toOSString(); String filePath = tuPath.toOSString();
try { try {
Object[] foundElements = CDebugCorePlugin.getDefault().getCommonSourceLookupDirector().findSourceElements(filePath); Object[] foundElements = CDebugCorePlugin.getDefault().getCommonSourceLookupDirector().findSourceElements(filePath);
if (foundElements.length == 1 && foundElements[0] instanceof IFile) if (foundElements.length == 1 && foundElements[0] instanceof IFile){
{
EditorUtility.openInEditor(foundElements[0]); EditorUtility.openInEditor(foundElements[0]);
return true; return true;
} } else if (foundElements.length == 1 && foundElements[0] instanceof LocalFileStorage) {
else
if (foundElements.length == 1 && foundElements[0] instanceof LocalFileStorage)
{
LocalFileStorage newLocation = (LocalFileStorage) foundElements[0]; LocalFileStorage newLocation = (LocalFileStorage) foundElements[0];
if (newLocation.getFullPath().toFile().exists()) if (newLocation.getFullPath().toFile().exists()) {
{
ITranslationUnit remappedTU = tu; ITranslationUnit remappedTU = tu;
if (tu instanceof ExternalTranslationUnit) if (tu instanceof ExternalTranslationUnit)
// TODO: source lookup needs to be modified to use URIs // TODO: source lookup needs to be modified to use URIs
remappedTU = new ExternalTranslationUnit(tu.getParent(), URIUtil.toURI(newLocation.getFullPath()), tu.getContentTypeId()); remappedTU = new ExternalTranslationUnit(tu.getParent(), URIUtil.toURI(newLocation.getFullPath()), tu.getContentTypeId());
EditorUtility.openInEditor(remappedTU); EditorUtility.openInEditor(remappedTU);
return true; return true;
} }
} }
} catch (CoreException e) {} } catch (CoreException e) {
}
} }
} }
return false; return false;
} }
/** /**
* @Override * @Override
* @see org.eclipse.debug.ui.sourcelookup.CommonSourceNotFoundEditor#getArtifact() * @see org.eclipse.debug.ui.sourcelookup.CommonSourceNotFoundEditor#getArtifact()

View file

@ -8,7 +8,6 @@
* Contributors: * Contributors:
* Nokia - initial API and implementation * Nokia - initial API and implementation
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.debug.internal.ui.sourcelookup; package org.eclipse.cdt.debug.internal.ui.sourcelookup;
import org.eclipse.cdt.debug.internal.core.sourcelookup.CSourceNotFoundElement; import org.eclipse.cdt.debug.internal.core.sourcelookup.CSourceNotFoundElement;
@ -34,11 +33,9 @@ public class CSourceNotFoundEditorInput extends CommonSourceNotFoundEditorInput
@Override @Override
public boolean equals(Object other) { public boolean equals(Object other) {
if (other instanceof CSourceNotFoundEditorInput) if (other instanceof CSourceNotFoundEditorInput) {
{
return super.equals(other) || (this.getName().equals(((CSourceNotFoundEditorInput) other).getName())); return super.equals(other) || (this.getName().equals(((CSourceNotFoundEditorInput) other).getName()));
} }
return super.equals(other); return super.equals(other);
} }
} }

View file

@ -9,36 +9,38 @@
* IBM Corporation - initial API and implementation * IBM Corporation - initial API and implementation
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.debug.internal.ui.sourcelookup; package org.eclipse.cdt.debug.internal.ui.sourcelookup;
import java.util.List; import java.util.List;
import org.eclipse.debug.core.sourcelookup.ISourceContainer;
import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.IStructuredSelection;
/** /**
* The action for sorting the order of source containers in the dialog. * The action for sorting the order of source containers in the dialog.
*
*/ */
public class DownAction extends SourceContainerAction { public class DownAction extends SourceContainerAction {
public DownAction() { public DownAction() {
super(SourceLookupUIMessages.getString( "DownAction.0" )); //$NON-NLS-1$ super(SourceLookupUIMessages.DownAction_0);
} }
/** /**
* @see IAction#run() * @see IAction#run()
*/ */
public void run() { public void run() {
List targets = getOrderedSelection(); List<ISourceContainer> targets = getOrderedSelection();
if (targets.isEmpty()) { if (targets.isEmpty()) {
return; return;
} }
List list = getEntriesAsList(); List<ISourceContainer> list = getEntriesAsList();
int bottom = list.size() - 1; int bottom = list.size() - 1;
int index = 0; int index = 0;
for (int i = targets.size() - 1; i >= 0; i--) { for (int i = targets.size() - 1; i >= 0; i--) {
Object target = targets.get(i); ISourceContainer target = targets.get(i);
index = list.indexOf(target); index = list.indexOf(target);
if (index < bottom) { if (index < bottom) {
bottom = index + 1; bottom = index + 1;
Object temp = list.get(bottom); ISourceContainer temp = list.get(bottom);
list.set(bottom, target); list.set(bottom, target);
list.set(index, temp); list.set(index, temp);
} }
@ -51,7 +53,7 @@ public class DownAction extends SourceContainerAction {
* @see SelectionListenerAction#updateSelection(IStructuredSelection) * @see SelectionListenerAction#updateSelection(IStructuredSelection)
*/ */
protected boolean updateSelection(IStructuredSelection selection) { protected boolean updateSelection(IStructuredSelection selection) {
return !selection.isEmpty() && !isIndexSelected(selection, getEntriesAsList().size() - 1) && getViewer().getTree().getSelection()[0].getParentItem()==null; return !selection.isEmpty() && !isIndexSelected(selection, getEntriesAsList().size() - 1) &&
getViewer().getTree().getSelection()[0].getParentItem() == null;
} }
} }

View file

@ -22,13 +22,12 @@ import org.eclipse.jface.viewers.IStructuredSelection;
* Action used to edit source containers on a source lookup path * Action used to edit source containers on a source lookup path
*/ */
public class EditContainerAction extends SourceContainerAction { public class EditContainerAction extends SourceContainerAction {
private ISourceLookupDirector fDirector; private ISourceLookupDirector fDirector;
private ISourceContainer[] fContainers; private ISourceContainer[] fContainers;
private ISourceContainerBrowser fBrowser; private ISourceContainerBrowser fBrowser;
public EditContainerAction() { public EditContainerAction() {
super(SourceLookupUIMessages.getString( "EditContainerAction.0" )); //$NON-NLS-1$ super(SourceLookupUIMessages.EditContainerAction_0);
} }
/** /**
@ -65,7 +64,7 @@ public class EditContainerAction extends SourceContainerAction {
if (getViewer().getTree().getSelection()[0].getParentItem()==null) { if (getViewer().getTree().getSelection()[0].getParentItem()==null) {
// can only edit top level items of same type // can only edit top level items of same type
fContainers = new ISourceContainer[selection.size()]; fContainers = new ISourceContainer[selection.size()];
Iterator iterator = selection.iterator(); Iterator<?> iterator = selection.iterator();
ISourceContainer container = (ISourceContainer) iterator.next(); ISourceContainer container = (ISourceContainer) iterator.next();
ISourceContainerType type = container.getType(); ISourceContainerType type = container.getType();
fContainers[0] = container; fContainers[0] = container;

View file

@ -21,8 +21,7 @@ import org.eclipse.swt.widgets.Shell;
* Adds a path mapping to the source lookup path. * Adds a path mapping to the source lookup path.
*/ */
public class MappingSourceContainerBrowser extends AbstractSourceContainerBrowser { public class MappingSourceContainerBrowser extends AbstractSourceContainerBrowser {
private static final String MAPPING = SourceLookupUIMessages.MappingSourceContainerBrowser_0;
private static final String MAPPING = SourceLookupUIMessages.getString( "MappingSourceContainerBrowser.0" ); //$NON-NLS-1$
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.debug.ui.sourcelookup.AbstractSourceContainerBrowser#addSourceContainers(org.eclipse.swt.widgets.Shell, org.eclipse.debug.core.sourcelookup.ISourceLookupDirector) * @see org.eclipse.debug.ui.sourcelookup.AbstractSourceContainerBrowser#addSourceContainers(org.eclipse.swt.widgets.Shell, org.eclipse.debug.core.sourcelookup.ISourceLookupDirector)
@ -69,8 +68,7 @@ public class MappingSourceContainerBrowser extends AbstractSourceContainerBrowse
// int number = Integer.valueOf(name.substring(MAPPING.length())).intValue(); // int number = Integer.valueOf(name.substring(MAPPING.length())).intValue();
// if (number == counter) // if (number == counter)
// ++counter; // ++counter;
// } // } catch (NumberFormatException e) {
// catch( NumberFormatException e ) {
// } // }
// } // }
// } // }

View file

@ -65,7 +65,6 @@ import org.eclipse.ui.PlatformUI;
public class MappingSourceContainerDialog extends TitleAreaDialog { public class MappingSourceContainerDialog extends TitleAreaDialog {
class EntryCellModifier implements ICellModifier { class EntryCellModifier implements ICellModifier {
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.jface.viewers.ICellModifier#canModify(java.lang.Object, java.lang.String) * @see org.eclipse.jface.viewers.ICellModifier#canModify(java.lang.Object, java.lang.String)
*/ */
@ -177,7 +176,6 @@ public class MappingSourceContainerDialog extends TitleAreaDialog {
fOriginalContainer = container; fOriginalContainer = container;
fContainer = container.copy(); fContainer = container.copy();
fTableListener = new ControlListener() { fTableListener = new ControlListener() {
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.swt.events.ControlListener#controlMoved(org.eclipse.swt.events.ControlEvent) * @see org.eclipse.swt.events.ControlListener#controlMoved(org.eclipse.swt.events.ControlEvent)
*/ */
@ -218,8 +216,8 @@ public class MappingSourceContainerDialog extends TitleAreaDialog {
@Override @Override
protected void configureShell(Shell newShell) { protected void configureShell(Shell newShell) {
super.configureShell(newShell); super.configureShell(newShell);
newShell.setText( SourceLookupUIMessages.getString( "PathMappingDialog.16" ) ); //$NON-NLS-1$ newShell.setText(SourceLookupUIMessages.PathMappingDialog_16);
newShell.setToolTipText( SourceLookupUIMessages.getString( "MappingSourceContainerDialog.0" ) ); //$NON-NLS-1$ newShell.setToolTipText(SourceLookupUIMessages.MappingSourceContainerDialog_0);
newShell.setImage(CDebugImages.get( CDebugImages.IMG_OBJS_PATH_MAPPING)); newShell.setImage(CDebugImages.get( CDebugImages.IMG_OBJS_PATH_MAPPING));
} }
@ -239,8 +237,7 @@ public class MappingSourceContainerDialog extends TitleAreaDialog {
@Override @Override
protected Control createDialogArea(Composite parent) { protected Control createDialogArea(Composite parent) {
Composite control = (Composite)super.createDialogArea(parent); Composite control = (Composite)super.createDialogArea(parent);
setTitle(SourceLookupUIMessages.PathMappingDialog_0);
setTitle( SourceLookupUIMessages.getString( "PathMappingDialog.0" ) ); //$NON-NLS-1$
setTitleImage(CDebugImages.get(CDebugImages.IMG_WIZBAN_PATH_MAPPING)); setTitleImage(CDebugImages.get(CDebugImages.IMG_WIZBAN_PATH_MAPPING));
Composite composite = new Composite(control, SWT.None); Composite composite = new Composite(control, SWT.None);
@ -248,13 +245,10 @@ public class MappingSourceContainerDialog extends TitleAreaDialog {
composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
createNameArea(composite); createNameArea(composite);
createViewer(composite); createViewer(composite);
createViewerButtonBar(composite); createViewerButtonBar(composite);
PlatformUI.getWorkbench().getHelpSystem().setHelp(getShell(), ICDebugHelpContextIds.SOURCE_PATH_MAP_ENTRY_DIALOG); PlatformUI.getWorkbench().getHelpSystem().setHelp(getShell(), ICDebugHelpContextIds.SOURCE_PATH_MAP_ENTRY_DIALOG);
return control; return control;
} }
@ -267,8 +261,7 @@ public class MappingSourceContainerDialog extends TitleAreaDialog {
fOriginalContainer.setName(fNameText.getText().trim()); fOriginalContainer.setName(fNameText.getText().trim());
try { try {
fOriginalContainer.addMapEntries((MapEntrySourceContainer[])fContainer.getSourceContainers()); fOriginalContainer.addMapEntries((MapEntrySourceContainer[])fContainer.getSourceContainers());
} } catch (CoreException e) {
catch( CoreException e ) {
} }
super.okPressed(); super.okPressed();
} }
@ -292,13 +285,12 @@ public class MappingSourceContainerDialog extends TitleAreaDialog {
composite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 2, 1)); composite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 2, 1));
Label label = new Label(composite, SWT.NONE); Label label = new Label(composite, SWT.NONE);
label.setText( SourceLookupUIMessages.getString( "PathMappingDialog.12" ) ); //$NON-NLS-1$ label.setText(SourceLookupUIMessages.PathMappingDialog_12);
fNameText = new Text(composite, SWT.BORDER | SWT.SINGLE); fNameText = new Text(composite, SWT.BORDER | SWT.SINGLE);
GridData data = new GridData(SWT.FILL, SWT.CENTER, false, false); GridData data = new GridData(SWT.FILL, SWT.CENTER, false, false);
data.widthHint = 200; data.widthHint = 200;
fNameText.setLayoutData(data); fNameText.setLayoutData(data);
fNameText.addModifyListener(new ModifyListener() { fNameText.addModifyListener(new ModifyListener() {
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent) * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
*/ */
@ -325,13 +317,13 @@ public class MappingSourceContainerDialog extends TitleAreaDialog {
TableColumn nameColumn = new TableColumn(table, SWT.NULL); TableColumn nameColumn = new TableColumn(table, SWT.NULL);
nameColumn.setResizable(true); nameColumn.setResizable(true);
nameColumn.setText( SourceLookupUIMessages.getString( "PathMappingDialog.1" ) ); //$NON-NLS-1$ nameColumn.setText(SourceLookupUIMessages.PathMappingDialog_1);
nameColumn.setToolTipText( SourceLookupUIMessages.getString( "MappingSourceContainerDialog.1" ) ); //$NON-NLS-1$ nameColumn.setToolTipText(SourceLookupUIMessages.MappingSourceContainerDialog_1);
TableColumn valueColumn = new TableColumn(table, SWT.NULL); TableColumn valueColumn = new TableColumn(table, SWT.NULL);
valueColumn.setResizable(true); valueColumn.setResizable(true);
valueColumn.setText( SourceLookupUIMessages.getString( "PathMappingDialog.2" ) ); //$NON-NLS-1$ valueColumn.setText(SourceLookupUIMessages.PathMappingDialog_2);
valueColumn.setToolTipText( SourceLookupUIMessages.getString( "MappingSourceContainerDialog.2" ) ); //$NON-NLS-1$ valueColumn.setToolTipText(SourceLookupUIMessages.MappingSourceContainerDialog_2);
fViewer.setColumnProperties( fViewer.setColumnProperties(
new String[] { new String[] {
@ -340,7 +332,6 @@ public class MappingSourceContainerDialog extends TitleAreaDialog {
}); });
fViewer.setContentProvider(new IStructuredContentProvider() { fViewer.setContentProvider(new IStructuredContentProvider() {
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object) * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
*/ */
@ -348,8 +339,7 @@ public class MappingSourceContainerDialog extends TitleAreaDialog {
if (inputElement instanceof MappingSourceContainer) { if (inputElement instanceof MappingSourceContainer) {
try { try {
return ((MappingSourceContainer)inputElement).getSourceContainers(); return ((MappingSourceContainer)inputElement).getSourceContainers();
} } catch (CoreException e) {
catch( CoreException e ) {
} }
} }
return new Object[0]; return new Object[0];
@ -392,7 +382,7 @@ public class MappingSourceContainerDialog extends TitleAreaDialog {
buttonComp.setLayout(new GridLayout()); buttonComp.setLayout(new GridLayout());
buttonComp.setLayoutData(new GridData(SWT.RIGHT, SWT.FILL, false, false)); buttonComp.setLayoutData(new GridData(SWT.RIGHT, SWT.FILL, false, false));
fAddButton = createPushButton( buttonComp, SourceLookupUIMessages.getString( "MappingSourceContainerDialog.3" ) ); //$NON-NLS-1$ fAddButton = createPushButton(buttonComp, SourceLookupUIMessages.MappingSourceContainerDialog_3);
fAddButton.addSelectionListener(new SelectionAdapter() { fAddButton.addSelectionListener(new SelectionAdapter() {
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent) * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
@ -403,7 +393,7 @@ public class MappingSourceContainerDialog extends TitleAreaDialog {
} }
}); });
fRemoveButton = createPushButton( buttonComp, SourceLookupUIMessages.getString( "PathMappingDialog.15" ) ); //$NON-NLS-1$ fRemoveButton = createPushButton(buttonComp, SourceLookupUIMessages.PathMappingDialog_15);
fRemoveButton.addSelectionListener(new SelectionAdapter() { fRemoveButton.addSelectionListener(new SelectionAdapter() {
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent) * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
@ -414,7 +404,7 @@ public class MappingSourceContainerDialog extends TitleAreaDialog {
} }
}); });
fUpButton = createPushButton( buttonComp, SourceLookupUIMessages.getString( "MappingSourceContainerDialog.4" ) ); //$NON-NLS-1$ fUpButton = createPushButton(buttonComp, SourceLookupUIMessages.MappingSourceContainerDialog_4);
fUpButton.addSelectionListener(new SelectionAdapter() { fUpButton.addSelectionListener(new SelectionAdapter() {
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent) * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
@ -425,7 +415,7 @@ public class MappingSourceContainerDialog extends TitleAreaDialog {
} }
}); });
fDownButton = createPushButton( buttonComp, SourceLookupUIMessages.getString( "MappingSourceContainerDialog.5" ) ); //$NON-NLS-1$ fDownButton = createPushButton(buttonComp, SourceLookupUIMessages.MappingSourceContainerDialog_5);
fDownButton.addSelectionListener(new SelectionAdapter() { fDownButton.addSelectionListener(new SelectionAdapter() {
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent) * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
@ -468,33 +458,32 @@ public class MappingSourceContainerDialog extends TitleAreaDialog {
MapEntrySourceContainer entry = (MapEntrySourceContainer)c; MapEntrySourceContainer entry = (MapEntrySourceContainer)c;
IPath backendPath = entry.getBackendPath(); IPath backendPath = entry.getBackendPath();
if (backendPath.isEmpty()) { if (backendPath.isEmpty()) {
setErrorMessage( SourceLookupUIMessages.getString( "PathMappingDialog.5" ) ); //$NON-NLS-1$ setErrorMessage(SourceLookupUIMessages.PathMappingDialog_5);
break; break;
} }
if (!backendPath.isValidPath(backendPath.toString())) { if (!backendPath.isValidPath(backendPath.toString())) {
setErrorMessage( SourceLookupUIMessages.getString( "PathMappingDialog.6" ) ); //$NON-NLS-1$ setErrorMessage(SourceLookupUIMessages.PathMappingDialog_6);
break; break;
} }
IPath localPath = entry.getLocalPath(); IPath localPath = entry.getLocalPath();
if (localPath.isEmpty()) { if (localPath.isEmpty()) {
setErrorMessage( SourceLookupUIMessages.getString( "PathMappingDialog.7" ) ); //$NON-NLS-1$ setErrorMessage(SourceLookupUIMessages.PathMappingDialog_7);
break; break;
} }
if (!localPath.toFile().exists()) { if (!localPath.toFile().exists()) {
setErrorMessage( SourceLookupUIMessages.getString( "PathMappingDialog.8" ) ); //$NON-NLS-1$ setErrorMessage(SourceLookupUIMessages.PathMappingDialog_8);
break; break;
} }
if (!localPath.toFile().isDirectory()) { if (!localPath.toFile().isDirectory()) {
setErrorMessage( SourceLookupUIMessages.getString( "PathMappingDialog.9" ) ); //$NON-NLS-1$ setErrorMessage(SourceLookupUIMessages.PathMappingDialog_9);
break; break;
} }
if (!localPath.toFile().isAbsolute()) { if (!localPath.toFile().isAbsolute()) {
setErrorMessage( SourceLookupUIMessages.getString( "PathMappingDialog.10" ) ); //$NON-NLS-1$ setErrorMessage(SourceLookupUIMessages.PathMappingDialog_10);
break; break;
} }
} }
} } catch (CoreException e) {
catch( CoreException e ) {
// ignore // ignore
} }
} }
@ -515,15 +504,13 @@ public class MappingSourceContainerDialog extends TitleAreaDialog {
if (entries.length != 1) { if (entries.length != 1) {
up = false; up = false;
down = false; down = false;
} } else {
else {
up = (!entries[0].equals(allEntries[0])); up = (!entries[0].equals(allEntries[0]));
down = (!entries[0].equals(allEntries[allEntries.length - 1])); down = (!entries[0].equals(allEntries[allEntries.length - 1]));
} }
ok = (allEntries.length != 0 && fIsValid); ok = (allEntries.length != 0 && fIsValid);
} } catch (CoreException e) {
catch( CoreException e ) {
// ignore, shouldn't happen // ignore, shouldn't happen
} }
getButton(IDialogConstants.OK_ID).setEnabled(ok); getButton(IDialogConstants.OK_ID).setEnabled(ok);
@ -591,10 +578,8 @@ public class MappingSourceContainerDialog extends TitleAreaDialog {
fContainer.clear(); fContainer.clear();
fContainer.addMapEntries(list.toArray(new MapEntrySourceContainer[list.size()])); fContainer.addMapEntries(list.toArray(new MapEntrySourceContainer[list.size()]));
refresh(); refresh();
} } catch (CoreException e) {
catch( CoreException e ) { } catch (IndexOutOfBoundsException e) {
}
catch( IndexOutOfBoundsException e ) {
} }
} }
} }

View file

@ -8,7 +8,6 @@
* Contributors: * Contributors:
* ARM Limited - Initial API and implementation * ARM Limited - Initial API and implementation
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.debug.internal.ui.sourcelookup; package org.eclipse.cdt.debug.internal.ui.sourcelookup;
import org.eclipse.cdt.debug.core.sourcelookup.MappingSourceContainer; import org.eclipse.cdt.debug.core.sourcelookup.MappingSourceContainer;
@ -19,8 +18,7 @@ import org.eclipse.jface.window.Window;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
public class NewMappingSourceContainerBrowser extends AbstractSourceContainerBrowser { public class NewMappingSourceContainerBrowser extends AbstractSourceContainerBrowser {
private static final String MAPPING = SourceLookupUIMessages.MappingSourceContainerBrowser_0;
private static final String MAPPING = SourceLookupUIMessages.getString( "MappingSourceContainerBrowser.0" ); //$NON-NLS-1$
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.debug.ui.sourcelookup.AbstractSourceContainerBrowser#addSourceContainers(org.eclipse.swt.widgets.Shell, org.eclipse.debug.core.sourcelookup.ISourceLookupDirector) * @see org.eclipse.debug.ui.sourcelookup.AbstractSourceContainerBrowser#addSourceContainers(org.eclipse.swt.widgets.Shell, org.eclipse.debug.core.sourcelookup.ISourceLookupDirector)

View file

@ -11,6 +11,8 @@
package org.eclipse.cdt.debug.internal.ui.sourcelookup; package org.eclipse.cdt.debug.internal.ui.sourcelookup;
import java.io.File; import java.io.File;
import java.util.List;
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;
@ -60,9 +62,7 @@ import org.eclipse.ui.model.WorkbenchLabelProvider;
public class PathMappingDialog extends TitleAreaDialog { public class PathMappingDialog extends TitleAreaDialog {
class MapEntryDialog extends TitleAreaDialog { class MapEntryDialog extends TitleAreaDialog {
private MapEntrySourceContainer fEntry; private MapEntrySourceContainer fEntry;
protected Text fBackendPathText; protected Text fBackendPathText;
protected Text fLocalPathText; protected Text fLocalPathText;
@ -86,7 +86,7 @@ public class PathMappingDialog extends TitleAreaDialog {
* @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite) * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
*/ */
protected Control createDialogArea(Composite parent) { protected Control createDialogArea(Composite parent) {
setTitle( SourceLookupUIMessages.getString( "PathMappingDialog.0" ) ); //$NON-NLS-1$ setTitle(SourceLookupUIMessages.PathMappingDialog_0);
setTitleImage(CDebugImages.get(CDebugImages.IMG_WIZBAN_PATH_MAP_ENTRY)); setTitleImage(CDebugImages.get(CDebugImages.IMG_WIZBAN_PATH_MAP_ENTRY));
Font font = parent.getFont(); Font font = parent.getFont();
@ -108,7 +108,7 @@ public class PathMappingDialog extends TitleAreaDialog {
setMessage(null); setMessage(null);
Label label = new Label(composite, SWT.LEFT); Label label = new Label(composite, SWT.LEFT);
label.setText( SourceLookupUIMessages.getString( "PathMappingDialog.1" ) ); //$NON-NLS-1$ label.setText(SourceLookupUIMessages.PathMappingDialog_1);
data = new GridData(GridData.FILL_HORIZONTAL); data = new GridData(GridData.FILL_HORIZONTAL);
data.horizontalSpan = 2; data.horizontalSpan = 2;
label.setLayoutData(data); label.setLayoutData(data);
@ -126,7 +126,7 @@ public class PathMappingDialog extends TitleAreaDialog {
}); });
label = new Label(composite, SWT.LEFT); label = new Label(composite, SWT.LEFT);
label.setText( SourceLookupUIMessages.getString( "PathMappingDialog.2" ) ); //$NON-NLS-1$ label.setText(SourceLookupUIMessages.PathMappingDialog_2);
data = new GridData(GridData.FILL_HORIZONTAL); data = new GridData(GridData.FILL_HORIZONTAL);
data.horizontalSpan = 2; data.horizontalSpan = 2;
label.setLayoutData(data); label.setLayoutData(data);
@ -144,7 +144,7 @@ public class PathMappingDialog extends TitleAreaDialog {
Button button = new Button(composite, SWT.PUSH); Button button = new Button(composite, SWT.PUSH);
button.setFont(font); button.setFont(font);
button.setText( SourceLookupUIMessages.getString( "PathMappingDialog.3" ) ); //$NON-NLS-1$ button.setText(SourceLookupUIMessages.PathMappingDialog_3);
button.addSelectionListener(new SelectionListener() { button.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) {
@ -170,7 +170,7 @@ public class PathMappingDialog extends TitleAreaDialog {
} }
protected void configureShell(Shell newShell) { protected void configureShell(Shell newShell) {
newShell.setText( SourceLookupUIMessages.getString( "PathMappingDialog.4" ) ); //$NON-NLS-1$ newShell.setText(SourceLookupUIMessages.PathMappingDialog_4);
super.configureShell(newShell); super.configureShell(newShell);
} }
@ -192,29 +192,29 @@ public class PathMappingDialog extends TitleAreaDialog {
setErrorMessage(null); setErrorMessage(null);
String backendText = fBackendPathText.getText().trim(); String backendText = fBackendPathText.getText().trim();
if (backendText.length() == 0) { if (backendText.length() == 0) {
setErrorMessage( SourceLookupUIMessages.getString( "PathMappingDialog.5" ) ); //$NON-NLS-1$ setErrorMessage(SourceLookupUIMessages.PathMappingDialog_5);
return false; return false;
} }
if (!new Path(backendText).isValidPath(backendText)) { if (!new Path(backendText).isValidPath(backendText)) {
setErrorMessage( SourceLookupUIMessages.getString( "PathMappingDialog.6" ) ); //$NON-NLS-1$ setErrorMessage(SourceLookupUIMessages.PathMappingDialog_6);
return false; return false;
} }
String localText = fLocalPathText.getText().trim(); String localText = fLocalPathText.getText().trim();
if (localText.length() == 0) { if (localText.length() == 0) {
setErrorMessage( SourceLookupUIMessages.getString( "PathMappingDialog.7" ) ); //$NON-NLS-1$ setErrorMessage(SourceLookupUIMessages.PathMappingDialog_7);
return false; return false;
} }
File localPath = new File(localText); File localPath = new File(localText);
if (!localPath.exists()) { if (!localPath.exists()) {
setErrorMessage( SourceLookupUIMessages.getString( "PathMappingDialog.8" ) ); //$NON-NLS-1$ setErrorMessage(SourceLookupUIMessages.PathMappingDialog_8);
return false; return false;
} }
if (!localPath.isDirectory()) { if (!localPath.isDirectory()) {
setErrorMessage( SourceLookupUIMessages.getString( "PathMappingDialog.9" ) ); //$NON-NLS-1$ setErrorMessage(SourceLookupUIMessages.PathMappingDialog_9);
return false; return false;
} }
if (!localPath.isAbsolute()) { if (!localPath.isAbsolute()) {
setErrorMessage( SourceLookupUIMessages.getString( "PathMappingDialog.10" ) ); //$NON-NLS-1$ setErrorMessage(SourceLookupUIMessages.PathMappingDialog_10);
return false; return false;
} }
return true; return true;
@ -240,7 +240,6 @@ public class PathMappingDialog extends TitleAreaDialog {
} }
class PathMappingLabelProvider extends LabelProvider { class PathMappingLabelProvider extends LabelProvider {
private ILabelProvider fLabelProvider = null; private ILabelProvider fLabelProvider = null;
/* (non-Javadoc) /* (non-Javadoc)
@ -263,8 +262,7 @@ public class PathMappingDialog extends TitleAreaDialog {
if (element instanceof ISourceContainer) { if (element instanceof ISourceContainer) {
return ((ISourceContainer)element).getName(); return ((ISourceContainer)element).getName();
} }
} } else {
else {
return label; return label;
} }
return super.getText(element); return super.getText(element);
@ -289,7 +287,6 @@ public class PathMappingDialog extends TitleAreaDialog {
} }
class ContentProvider implements IStructuredContentProvider { class ContentProvider implements IStructuredContentProvider {
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object) * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
*/ */
@ -297,8 +294,7 @@ public class PathMappingDialog extends TitleAreaDialog {
if (input instanceof MappingSourceContainer) { if (input instanceof MappingSourceContainer) {
try { try {
return ((MappingSourceContainer)input).getSourceContainers(); return ((MappingSourceContainer)input).getSourceContainers();
} } catch(CoreException e) {
catch( CoreException e ) {
setErrorMessage(e.getMessage()); setErrorMessage(e.getMessage());
} }
} }
@ -319,9 +315,7 @@ public class PathMappingDialog extends TitleAreaDialog {
} }
private MappingSourceContainer fOriginalMapping; private MappingSourceContainer fOriginalMapping;
protected MappingSourceContainer fMapping; protected MappingSourceContainer fMapping;
private TableViewer fViewer; private TableViewer fViewer;
private Text fNameText; private Text fNameText;
@ -348,7 +342,7 @@ public class PathMappingDialog extends TitleAreaDialog {
* @see org.eclipse.jface.dialogs.TitleAreaDialog#createDialogArea(org.eclipse.swt.widgets.Composite) * @see org.eclipse.jface.dialogs.TitleAreaDialog#createDialogArea(org.eclipse.swt.widgets.Composite)
*/ */
protected Control createDialogArea(Composite parent) { protected Control createDialogArea(Composite parent) {
setTitle( SourceLookupUIMessages.getString( "PathMappingDialog.11" ) ); //$NON-NLS-1$ setTitle(SourceLookupUIMessages.PathMappingDialog_11);
setTitleImage(CDebugImages.get(CDebugImages.IMG_WIZBAN_PATH_MAPPING)); setTitleImage(CDebugImages.get(CDebugImages.IMG_WIZBAN_PATH_MAPPING));
Font font = parent.getFont(); Font font = parent.getFont();
@ -380,7 +374,7 @@ public class PathMappingDialog extends TitleAreaDialog {
data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
label.setLayoutData(data); label.setLayoutData(data);
label.setFont(font); label.setFont(font);
label.setText( SourceLookupUIMessages.getString( "PathMappingDialog.12" ) ); //$NON-NLS-1$ label.setText(SourceLookupUIMessages.PathMappingDialog_12);
fNameText = new Text(nameComp, SWT.SINGLE | SWT.BORDER); fNameText = new Text(nameComp, SWT.SINGLE | SWT.BORDER);
data = new GridData(GridData.FILL_HORIZONTAL); data = new GridData(GridData.FILL_HORIZONTAL);
fNameText.setLayoutData(data); fNameText.setLayoutData(data);
@ -415,7 +409,7 @@ public class PathMappingDialog extends TitleAreaDialog {
FontMetrics fontMetrics = gc.getFontMetrics(); FontMetrics fontMetrics = gc.getFontMetrics();
gc.dispose(); gc.dispose();
fAddButton = createPushButton( buttonComp, SourceLookupUIMessages.getString( "PathMappingDialog.13" ), fontMetrics ); //$NON-NLS-1$ fAddButton = createPushButton(buttonComp, SourceLookupUIMessages.PathMappingDialog_13, fontMetrics);
fAddButton.addSelectionListener(new SelectionAdapter() { fAddButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent evt) { public void widgetSelected(SelectionEvent evt) {
MapEntryDialog dialog = new MapEntryDialog(getShell()); MapEntryDialog dialog = new MapEntryDialog(getShell());
@ -425,7 +419,7 @@ public class PathMappingDialog extends TitleAreaDialog {
} }
}); });
fEditButton = createPushButton( buttonComp, SourceLookupUIMessages.getString( "PathMappingDialog.14" ), fontMetrics ); //$NON-NLS-1$ fEditButton = createPushButton(buttonComp, SourceLookupUIMessages.PathMappingDialog_14, fontMetrics);
fEditButton.addSelectionListener(new SelectionAdapter() { fEditButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent evt) { public void widgetSelected(SelectionEvent evt) {
MapEntrySourceContainer[] entries = getSelection(); MapEntrySourceContainer[] entries = getSelection();
@ -438,7 +432,7 @@ public class PathMappingDialog extends TitleAreaDialog {
} }
}); });
fRemoveButton = createPushButton( buttonComp, SourceLookupUIMessages.getString( "PathMappingDialog.15" ), fontMetrics ); //$NON-NLS-1$ fRemoveButton = createPushButton(buttonComp, SourceLookupUIMessages.PathMappingDialog_15, fontMetrics);
fRemoveButton.addSelectionListener(new SelectionAdapter() { fRemoveButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent evt) { public void widgetSelected(SelectionEvent evt) {
MapEntrySourceContainer[] entries = getSelection(); MapEntrySourceContainer[] entries = getSelection();
@ -450,7 +444,6 @@ public class PathMappingDialog extends TitleAreaDialog {
}); });
setMessage(null); setMessage(null);
fViewer.setInput(fMapping); fViewer.setInput(fMapping);
return composite; return composite;
@ -487,7 +480,7 @@ public class PathMappingDialog extends TitleAreaDialog {
* @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell) * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
*/ */
protected void configureShell(Shell newShell) { protected void configureShell(Shell newShell) {
newShell.setText( SourceLookupUIMessages.getString( "PathMappingDialog.16" ) ); //$NON-NLS-1$ newShell.setText(SourceLookupUIMessages.PathMappingDialog_16);
super.configureShell(newShell); super.configureShell(newShell);
} }
@ -503,8 +496,7 @@ public class PathMappingDialog extends TitleAreaDialog {
fOriginalMapping.setName(fNameText.getText().trim()); fOriginalMapping.setName(fNameText.getText().trim());
try { try {
fOriginalMapping.addMapEntries((MapEntrySourceContainer[])fMapping.getSourceContainers()); fOriginalMapping.addMapEntries((MapEntrySourceContainer[])fMapping.getSourceContainers());
} } catch(CoreException e) {
catch( CoreException e ) {
} }
fMapping.dispose(); fMapping.dispose();
super.okPressed(); super.okPressed();
@ -515,7 +507,8 @@ public class PathMappingDialog extends TitleAreaDialog {
ISelection s = getViewer().getSelection(); ISelection s = getViewer().getSelection();
if (s instanceof IStructuredSelection) { if (s instanceof IStructuredSelection) {
int size = ((IStructuredSelection)s).size(); int size = ((IStructuredSelection)s).size();
result = (MapEntrySourceContainer[])((IStructuredSelection)s).toList().toArray( new MapEntrySourceContainer[size] ); List<?> list = ((IStructuredSelection) s).toList();
result = list.toArray(new MapEntrySourceContainer[size]);
} }
return result; return result;
} }

View file

@ -12,24 +12,25 @@ package org.eclipse.cdt.debug.internal.ui.sourcelookup;
import java.util.List; import java.util.List;
import org.eclipse.debug.core.sourcelookup.ISourceContainer;
import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.IStructuredSelection;
/** /**
* The action used to remove source containers in the source location dialog/tab. * The action used to remove source containers in the source location dialog/tab.
*
*/ */
public class RemoveAction extends SourceContainerAction { public class RemoveAction extends SourceContainerAction {
public RemoveAction() { public RemoveAction() {
super(SourceLookupUIMessages.getString( "RemoveAction.0" )); //$NON-NLS-1$ super(SourceLookupUIMessages.RemoveAction_0);
} }
/** /**
* Removes all selected entries. * Removes all selected entries.
* *
* @see IAction#run() * @see IAction#run()
*/ */
public void run() { public void run() {
List targets = getOrderedSelection(); List<ISourceContainer> targets = getOrderedSelection();
List list = getEntriesAsList(); List<ISourceContainer> list = getEntriesAsList();
list.removeAll(targets); list.removeAll(targets);
setEntries(list); setEntries(list);
} }
@ -41,5 +42,4 @@ public class RemoveAction extends SourceContainerAction {
//check that something is selected and it is a root tree node. //check that something is selected and it is a root tree node.
return !selection.isEmpty() && getViewer().getTree().getSelection()[0].getParentItem() == null; return !selection.isEmpty() && getViewer().getTree().getSelection()[0].getParentItem() == null;
} }
} }

View file

@ -71,10 +71,9 @@ public abstract class SourceContainerAction extends SelectionListenerAction {
* *
* @return targets for an action * @return targets for an action
*/ */
protected List getOrderedSelection() { protected List<ISourceContainer> getOrderedSelection() {
List targets = new ArrayList(); List<ISourceContainer> targets = new ArrayList<ISourceContainer>();
List selection = List<?> selection = ((IStructuredSelection) getViewer().getSelection()).toList();
((IStructuredSelection) getViewer().getSelection()).toList();
ISourceContainer[] entries = getViewer().getEntries(); ISourceContainer[] entries = getViewer().getEntries();
for (int i = 0; i < entries.length; i++) { for (int i = 0; i < entries.length; i++) {
ISourceContainer target = entries[i]; ISourceContainer target = entries[i];
@ -88,9 +87,9 @@ public abstract class SourceContainerAction extends SelectionListenerAction {
/** /**
* Returns a list (copy) of the entries in the viewer * Returns a list (copy) of the entries in the viewer
*/ */
protected List getEntriesAsList() { protected List<ISourceContainer> getEntriesAsList() {
ISourceContainer[] entries = getViewer().getEntries(); ISourceContainer[] entries = getViewer().getEntries();
List list = new ArrayList(entries.length); List<ISourceContainer> list = new ArrayList<ISourceContainer>(entries.length);
for (int i = 0; i < entries.length; i++) { for (int i = 0; i < entries.length; i++) {
list.add(entries[i]); list.add(entries[i]);
} }
@ -100,9 +99,8 @@ public abstract class SourceContainerAction extends SelectionListenerAction {
/** /**
* Updates the entries to the entries in the given list * Updates the entries to the entries in the given list
*/ */
protected void setEntries(List list) { protected void setEntries(List<ISourceContainer> list) {
getViewer().setEntries( getViewer().setEntries(list.toArray(new ISourceContainer[list.size()]));
(ISourceContainer[]) list.toArray(new ISourceContainer[list.size()]));
// update all selection listeners // update all selection listeners
getViewer().setSelection(getViewer().getSelection()); getViewer().setSelection(getViewer().getSelection());
} }
@ -111,14 +109,12 @@ public abstract class SourceContainerAction extends SelectionListenerAction {
* Returns whether the item at the given index in the list * Returns whether the item at the given index in the list
* (visually) is selected. * (visually) is selected.
*/ */
protected boolean isIndexSelected( protected boolean isIndexSelected(IStructuredSelection selection, int index) {
IStructuredSelection selection,
int index) {
if (selection.isEmpty()) { if (selection.isEmpty()) {
return false; return false;
} }
Iterator entries = selection.iterator(); Iterator<?> entries = selection.iterator();
List list = getEntriesAsList(); List<?> list = getEntriesAsList();
while (entries.hasNext()) { while (entries.hasNext()) {
Object next = entries.next(); Object next = entries.next();
if (list.indexOf(next) == index) { if (list.indexOf(next) == index) {

View file

@ -21,7 +21,7 @@ public class SourceContainerAdapterFactory implements IAdapterFactory {
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class) * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
*/ */
public Object getAdapter( Object adaptableObject, Class adapterType ) { public Object getAdapter(Object adaptableObject, @SuppressWarnings("rawtypes") Class adapterType) {
if (adapterType.equals(IWorkbenchAdapter.class)) { if (adapterType.equals(IWorkbenchAdapter.class)) {
return new SourceContainerWorkbenchAdapter(); return new SourceContainerWorkbenchAdapter();
} }
@ -31,7 +31,7 @@ public class SourceContainerAdapterFactory implements IAdapterFactory {
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList() * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
*/ */
public Class[] getAdapterList() { public Class<?>[] getAdapterList() {
return new Class[]{ IWorkbenchAdapter.class }; return new Class[]{ IWorkbenchAdapter.class };
} }
} }

View file

@ -22,7 +22,6 @@ import org.eclipse.ui.model.WorkbenchLabelProvider;
* Label provider for source containers and source container types. * Label provider for source containers and source container types.
*/ */
public class SourceContainerLabelProvider extends LabelProvider { public class SourceContainerLabelProvider extends LabelProvider {
private ILabelProvider fLabelProvider = null; private ILabelProvider fLabelProvider = null;
/* (non-Javadoc) /* (non-Javadoc)

View file

@ -26,7 +26,6 @@ import org.eclipse.swt.widgets.Composite;
* It is a tree viewer since the containers are represented in tree form. * It is a tree viewer since the containers are represented in tree form.
*/ */
public class SourceContainerViewer extends TreeViewer { public class SourceContainerViewer extends TreeViewer {
/** /**
* Whether enabled/editable. * Whether enabled/editable.
*/ */
@ -34,10 +33,9 @@ public class SourceContainerViewer extends TreeViewer {
/** /**
* The source container entries displayed in this viewer * The source container entries displayed in this viewer
*/ */
protected List fEntries = new ArrayList(); protected List<ISourceContainer> fEntries = new ArrayList<ISourceContainer>();
class ContentProvider implements ITreeContentProvider { class ContentProvider implements ITreeContentProvider {
/** /**
* @see IStructuredContentProvider#getElements(Object) * @see IStructuredContentProvider#getElements(Object)
*/ */
@ -81,7 +79,6 @@ public class SourceContainerViewer extends TreeViewer {
public boolean hasChildren(Object element) { public boolean hasChildren(Object element) {
return ((ISourceContainer)element).isComposite(); return ((ISourceContainer)element).isComposite();
} }
} }
/** /**
@ -124,7 +121,7 @@ public class SourceContainerViewer extends TreeViewer {
* @return the entries in this viewer * @return the entries in this viewer
*/ */
public ISourceContainer[] getEntries() { public ISourceContainer[] getEntries() {
return (ISourceContainer[])fEntries.toArray(new ISourceContainer[fEntries.size()]); return fEntries.toArray(new ISourceContainer[fEntries.size()]);
} }
/** /**
@ -143,8 +140,7 @@ public class SourceContainerViewer extends TreeViewer {
fEntries.add(entries[i]); fEntries.add(entries[i]);
} }
} }
} } else {
else {
int index = fEntries.indexOf(sel.getFirstElement()); int index = fEntries.indexOf(sel.getFirstElement());
for (int i = 0; i < entries.length; i++) { for (int i = 0; i < entries.length; i++) {
if (!fEntries.contains(entries[i])) { if (!fEntries.contains(entries[i])) {
@ -166,7 +162,7 @@ public class SourceContainerViewer extends TreeViewer {
*/ */
public void setEnabled(boolean enabled) { public void setEnabled(boolean enabled) {
fEnabled = enabled; fEnabled = enabled;
// fire selection change to upate actions // fire selection change to update actions
setSelection(getSelection()); setSelection(getSelection());
} }

View file

@ -67,7 +67,7 @@ public class SourceContainerWorkbenchAdapter implements IWorkbenchAdapter {
*/ */
public String getLabel(Object o) { public String getLabel(Object o) {
if (o instanceof MappingSourceContainer) { if (o instanceof MappingSourceContainer) {
return SourceLookupUIMessages.getString( "SourceContainerWorkbenchAdapter.0" ) + ((MappingSourceContainer)o).getName(); //$NON-NLS-1$ return SourceLookupUIMessages.SourceContainerWorkbenchAdapter_0 + ((MappingSourceContainer)o).getName();
} }
if (o instanceof MapEntrySourceContainer) { if (o instanceof MapEntrySourceContainer) {
return ((MapEntrySourceContainer)o).getName(); return ((MapEntrySourceContainer)o).getName();

View file

@ -8,7 +8,6 @@
* Contributors: * Contributors:
* ARM Limited - Initial API and implementation * ARM Limited - Initial API and implementation
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.debug.internal.ui.sourcelookup; package org.eclipse.cdt.debug.internal.ui.sourcelookup;
import org.eclipse.cdt.debug.core.model.ICStackFrame; import org.eclipse.cdt.debug.core.model.ICStackFrame;
@ -34,7 +33,6 @@ import org.eclipse.ui.progress.UIJob;
public class SourceDisplayAdapter implements ISourceDisplay { public class SourceDisplayAdapter implements ISourceDisplay {
class DelegatingStackFrame implements IStackFrame { class DelegatingStackFrame implements IStackFrame {
private ICStackFrame fDelegate; private ICStackFrame fDelegate;
DelegatingStackFrame(ICStackFrame delegate) { DelegatingStackFrame(ICStackFrame delegate) {
@ -129,8 +127,7 @@ public class SourceDisplayAdapter implements ISourceDisplay {
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class) * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
*/ */
@SuppressWarnings("unchecked") public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) {
public Object getAdapter( Class adapter ) {
if (ICStackFrame.class.equals(adapter)) if (ICStackFrame.class.equals(adapter))
return fDelegate; return fDelegate;
return fDelegate.getAdapter(adapter); return fDelegate.getAdapter(adapter);
@ -240,7 +237,6 @@ public class SourceDisplayAdapter implements ISourceDisplay {
public void terminate() throws DebugException { public void terminate() throws DebugException {
fDelegate.terminate(); fDelegate.terminate();
} }
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -251,8 +247,7 @@ public class SourceDisplayAdapter implements ISourceDisplay {
ICStackFrame frame = (ICStackFrame)element; ICStackFrame frame = (ICStackFrame)element;
if (isDisplayDisassembly(frame, page)) { if (isDisplayDisassembly(frame, page)) {
displayDisassembly(page, frame); displayDisassembly(page, frame);
} } else {
else {
DelegatingStackFrame delegatingFrame = new DelegatingStackFrame((ICStackFrame)element); DelegatingStackFrame delegatingFrame = new DelegatingStackFrame((ICStackFrame)element);
ISourceDisplay sd = (ISourceDisplay)Platform.getAdapterManager().getAdapter(delegatingFrame, ISourceDisplay.class); ISourceDisplay sd = (ISourceDisplay)Platform.getAdapterManager().getAdapter(delegatingFrame, ISourceDisplay.class);
if (sd != null) if (sd != null)
@ -273,7 +268,6 @@ public class SourceDisplayAdapter implements ISourceDisplay {
private void displayDisassembly(final IWorkbenchPage page, final Object debugContext) { private void displayDisassembly(final IWorkbenchPage page, final Object debugContext) {
Job uijob = new UIJob("Display Disassembly Job") { //$NON-NLS-1$ Job uijob = new UIJob("Display Disassembly Job") { //$NON-NLS-1$
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.ui.progress.UIJob#runInUIThread(org.eclipse.core.runtime.IProgressMonitor) * @see org.eclipse.ui.progress.UIJob#runInUIThread(org.eclipse.core.runtime.IProgressMonitor)
*/ */

View file

@ -7,28 +7,58 @@
* *
* Contributors: * 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.sourcelookup; package org.eclipse.cdt.debug.internal.ui.sourcelookup;
import java.util.MissingResourceException; import org.eclipse.osgi.util.NLS;
import java.util.ResourceBundle;
public class SourceLookupUIMessages { public class SourceLookupUIMessages extends NLS {
public static String AddContainerAction_0;
public static String AddSourceContainerDialog_0;
public static String AddSourceContainerDialog_1;
public static String DownAction_0;
public static String EditContainerAction_0;
public static String MappingSourceContainerBrowser_0;
public static String MappingSourceContainerDialog_0;
public static String MappingSourceContainerDialog_1;
public static String MappingSourceContainerDialog_2;
public static String MappingSourceContainerDialog_3;
public static String MappingSourceContainerDialog_4;
public static String MappingSourceContainerDialog_5;
public static String AbsolutePathSourceContainerBrowser_0;
public static String PathMappingDialog_0;
public static String PathMappingDialog_1;
public static String PathMappingDialog_2;
public static String PathMappingDialog_3;
public static String PathMappingDialog_4;
public static String PathMappingDialog_5;
public static String PathMappingDialog_6;
public static String PathMappingDialog_7;
public static String PathMappingDialog_8;
public static String PathMappingDialog_9;
public static String PathMappingDialog_10;
public static String PathMappingDialog_11;
public static String PathMappingDialog_12;
public static String PathMappingDialog_13;
public static String PathMappingDialog_14;
public static String PathMappingDialog_15;
public static String PathMappingDialog_16;
public static String RemoveAction_0;
public static String SourceContainerWorkbenchAdapter_0;
public static String UpAction_0;
public static String CSourceNotFoundEditor_0;
public static String CSourceNotFoundEditor_1;
public static String CSourceNotFoundEditor_2;
public static String CSourceNotFoundEditor_3;
public static String CSourceNotFoundEditor_4;
public static String CSourceNotFoundEditor_5;
private static final String BUNDLE_NAME = "org.eclipse.cdt.debug.internal.ui.sourcelookup.SourceLookupUIMessages"; //$NON-NLS-1$ static {
NLS.initializeMessages(SourceLookupUIMessages.class.getName(), SourceLookupUIMessages.class);
private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME ); }
private SourceLookupUIMessages() { private SourceLookupUIMessages() {
} // Do not instantiate
public static String getString( String key ) {
// TODO Auto-generated method stub
try {
return RESOURCE_BUNDLE.getString( key );
}
catch( MissingResourceException e ) {
return '!' + key + '!';
}
} }
} }

View file

@ -10,42 +10,42 @@
# Ken Ryall (Nokia) - Added support for CSourceNotFoundElement ( 167305 ) # Ken Ryall (Nokia) - Added support for CSourceNotFoundElement ( 167305 )
# Ken Ryall (Nokia) - Option to open disassembly view when no source ( 81353 ) # Ken Ryall (Nokia) - Option to open disassembly view when no source ( 81353 )
############################################################################### ###############################################################################
AddContainerAction.0=&Add... AddContainerAction_0=&Add...
AddSourceContainerDialog.0=Add Source AddSourceContainerDialog_0=Add Source
AddSourceContainerDialog.1=Select the type of source to add to the source lookup path AddSourceContainerDialog_1=Select the type of source to add to the source lookup path
DownAction.0=&Down DownAction_0=&Down
EditContainerAction.0=&Edit... EditContainerAction_0=&Edit...
MappingSourceContainerBrowser.0=New Mapping MappingSourceContainerBrowser_0=New Mapping
MappingSourceContainerDialog.0=Add/Modify path mapping MappingSourceContainerDialog_0=Add/Modify path mapping
MappingSourceContainerDialog.1=Compilation path MappingSourceContainerDialog_1=Compilation path
MappingSourceContainerDialog.2=Local file system path MappingSourceContainerDialog_2=Local file system path
MappingSourceContainerDialog.3=Add MappingSourceContainerDialog_3=Add
MappingSourceContainerDialog.4=Up MappingSourceContainerDialog_4=Up
MappingSourceContainerDialog.5=Down MappingSourceContainerDialog_5=Down
AbsolutePathSourceContainerBrowser.0=Absolute Path AbsolutePathSourceContainerBrowser_0=Absolute Path
PathMappingDialog.0=Specify the mapping paths PathMappingDialog_0=Specify the mapping paths
PathMappingDialog.1=Compilation path: PathMappingDialog_1=Compilation path:
PathMappingDialog.2=Local file system path: PathMappingDialog_2=Local file system path:
PathMappingDialog.3=&Browse... PathMappingDialog_3=&Browse...
PathMappingDialog.4=Path Mapping PathMappingDialog_4=Path Mapping
PathMappingDialog.5=The compilation path must not be empty PathMappingDialog_5=The compilation path must not be empty
PathMappingDialog.6=Invalid compilation path. PathMappingDialog_6=Invalid compilation path.
PathMappingDialog.7=The local file systems path must not be empty PathMappingDialog_7=The local file systems path must not be empty
PathMappingDialog.8=The specified local file system path doesn't exist PathMappingDialog_8=The specified local file system path doesn't exist
PathMappingDialog.9=The local file system path must be a directory PathMappingDialog_9=The local file system path must be a directory
PathMappingDialog.10=The local file system path must be absolute PathMappingDialog_10=The local file system path must be absolute
PathMappingDialog.11=Modify the path mappings PathMappingDialog_11=Modify the path mappings
PathMappingDialog.12=Name: PathMappingDialog_12=Name:
PathMappingDialog.13=&Add... PathMappingDialog_13=&Add...
PathMappingDialog.14=&Edit... PathMappingDialog_14=&Edit...
PathMappingDialog.15=Re&move PathMappingDialog_15=Re&move
PathMappingDialog.16=Path Mappings 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
CSourceNotFoundEditor.0=Can''t find a source file at \"{0}\" \nLocate the file or edit the source lookup path to include its location. CSourceNotFoundEditor_0=Can''t find a source file at \"{0}\" \nLocate the file or edit the source lookup path to include its location.
CSourceNotFoundEditor.1=Locate File... CSourceNotFoundEditor_1=Locate File...
CSourceNotFoundEditor.2=Missing Source File CSourceNotFoundEditor_2=Missing Source File
CSourceNotFoundEditor.3=No source available for \"{0}\" \n CSourceNotFoundEditor_3=No source available for \"{0}\" \n
CSourceNotFoundEditor.4=View Disassembly... CSourceNotFoundEditor_4=View Disassembly...
CSourceNotFoundEditor.5=Edit Source Lookup Path... CSourceNotFoundEditor_5=Edit Source Lookup Path...

View file

@ -10,9 +10,9 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.debug.internal.ui.sourcelookup; package org.eclipse.cdt.debug.internal.ui.sourcelookup;
import java.util.Iterator;
import java.util.List; import java.util.List;
import org.eclipse.debug.core.sourcelookup.ISourceContainer;
import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.IStructuredSelection;
/** /**
@ -21,28 +21,27 @@ import org.eclipse.jface.viewers.IStructuredSelection;
public class UpAction extends SourceContainerAction { public class UpAction extends SourceContainerAction {
public UpAction() { public UpAction() {
super(SourceLookupUIMessages.getString( "UpAction.0" )); //$NON-NLS-1$ super(SourceLookupUIMessages.UpAction_0);
} }
/** /**
* Moves all selected entries up one position (if possible). * Moves all selected entries up one position (if possible).
* *
* @see IAction#run() * @see IAction#run()
*/ */
public void run() { public void run() {
List targets = getOrderedSelection(); List<ISourceContainer> targets = getOrderedSelection();
if (targets.isEmpty()) { if (targets.isEmpty()) {
return; return;
} }
int top = 0; int top = 0;
int index = 0; int index = 0;
List list = getEntriesAsList(); List<ISourceContainer> list = getEntriesAsList();
Iterator entries = targets.iterator(); for (ISourceContainer target : targets) {
while (entries.hasNext()) {
Object target = entries.next();
index = list.indexOf(target); index = list.indexOf(target);
if (index > top) { if (index > top) {
top = index - 1; top = index - 1;
Object temp = list.get(top); ISourceContainer temp = list.get(top);
list.set(top, target); list.set(top, target);
list.set(index, temp); list.set(index, temp);
} }
@ -58,5 +57,4 @@ public class UpAction extends SourceContainerAction {
//check that something is selected, it's not first in the list, and it is a root tree node. //check that something is selected, it's not first in the list, and it is a root tree node.
return !selection.isEmpty() && !isIndexSelected(selection, 0) && getViewer().getTree().getSelection()[0].getParentItem()==null; return !selection.isEmpty() && !isIndexSelected(selection, 0) && getViewer().getTree().getSelection()[0].getParentItem()==null;
} }
} }