1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-07 17:56: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();
return new ISourceContainer[] { absolutePathSourceContainer };
}
}

View file

@ -19,11 +19,10 @@ import org.eclipse.jface.viewers.IStructuredSelection;
* and the EditSourceLookupPathDialog.
*/
public class AddContainerAction extends SourceContainerAction {
private ISourceLookupDirector fDirector;
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
*/
public class AddSourceContainerDialog extends TitleAreaDialog {
private TableViewer fViewer;
private SourceContainerViewer fSourceContainerViewer;
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"
*/
protected Control createDialogArea(Composite ancestor) {
getShell().setText(SourceLookupUIMessages.getString( "AddSourceContainerDialog.0" )); //$NON-NLS-1$
setTitle(SourceLookupUIMessages.getString( "AddSourceContainerDialog.1" )); //$NON-NLS-1$
getShell().setText(SourceLookupUIMessages.AddSourceContainerDialog_0);
setTitle(SourceLookupUIMessages.AddSourceContainerDialog_1);
Composite parent = new Composite(ancestor, SWT.NULL);
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
*/
private ISourceContainerType[] filterTypes(ISourceContainerType[] types){
ArrayList validTypes = new ArrayList();
ArrayList<ISourceContainerType> validTypes = new ArrayList<ISourceContainerType>();
for (int i=0; i < types.length; i++) {
ISourceContainerType type = types[i];
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)
@ -151,5 +148,4 @@ public class AddSourceContainerDialog extends TitleAreaDialog {
}
super.okPressed();
}
}

View file

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

View file

@ -8,7 +8,6 @@
* Contributors:
* Nokia - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.debug.internal.ui.sourcelookup;
import org.eclipse.cdt.debug.internal.core.sourcelookup.CSourceNotFoundElement;
@ -34,11 +33,9 @@ public class CSourceNotFoundEditorInput extends CommonSourceNotFoundEditorInput
@Override
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);
}
}

View file

@ -9,36 +9,38 @@
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.debug.internal.ui.sourcelookup;
import java.util.List;
import org.eclipse.debug.core.sourcelookup.ISourceContainer;
import org.eclipse.jface.viewers.IStructuredSelection;
/**
* The action for sorting the order of source containers in the dialog.
*
*/
public class DownAction extends SourceContainerAction {
public DownAction() {
super(SourceLookupUIMessages.getString( "DownAction.0" )); //$NON-NLS-1$
super(SourceLookupUIMessages.DownAction_0);
}
/**
* @see IAction#run()
*/
public void run() {
List targets = getOrderedSelection();
List<ISourceContainer> targets = getOrderedSelection();
if (targets.isEmpty()) {
return;
}
List list = getEntriesAsList();
List<ISourceContainer> list = getEntriesAsList();
int bottom = list.size() - 1;
int index = 0;
for (int i = targets.size() - 1; i >= 0; i--) {
Object target = targets.get(i);
ISourceContainer target = targets.get(i);
index = list.indexOf(target);
if (index < bottom) {
bottom = index + 1;
Object temp = list.get(bottom);
ISourceContainer temp = list.get(bottom);
list.set(bottom, target);
list.set(index, temp);
}
@ -51,7 +53,7 @@ public class DownAction extends SourceContainerAction {
* @see SelectionListenerAction#updateSelection(IStructuredSelection)
*/
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
*/
public class EditContainerAction extends SourceContainerAction {
private ISourceLookupDirector fDirector;
private ISourceContainer[] fContainers;
private ISourceContainerBrowser fBrowser;
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) {
// can only edit top level items of same type
fContainers = new ISourceContainer[selection.size()];
Iterator iterator = selection.iterator();
Iterator<?> iterator = selection.iterator();
ISourceContainer container = (ISourceContainer) iterator.next();
ISourceContainerType type = container.getType();
fContainers[0] = container;

View file

@ -21,8 +21,7 @@ import org.eclipse.swt.widgets.Shell;
* Adds a path mapping to the source lookup path.
*/
public class MappingSourceContainerBrowser extends AbstractSourceContainerBrowser {
private static final String MAPPING = SourceLookupUIMessages.getString( "MappingSourceContainerBrowser.0" ); //$NON-NLS-1$
private static final String MAPPING = SourceLookupUIMessages.MappingSourceContainerBrowser_0;
/* (non-Javadoc)
* @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();
// if (number == counter)
// ++counter;
// }
// catch( NumberFormatException e ) {
// } catch (NumberFormatException e) {
// }
// }
// }

View file

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

View file

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

View file

@ -12,24 +12,25 @@ package org.eclipse.cdt.debug.internal.ui.sourcelookup;
import java.util.List;
import org.eclipse.debug.core.sourcelookup.ISourceContainer;
import org.eclipse.jface.viewers.IStructuredSelection;
/**
* The action used to remove source containers in the source location dialog/tab.
*
*/
public class RemoveAction extends SourceContainerAction {
public RemoveAction() {
super(SourceLookupUIMessages.getString( "RemoveAction.0" )); //$NON-NLS-1$
super(SourceLookupUIMessages.RemoveAction_0);
}
/**
* Removes all selected entries.
*
* @see IAction#run()
*/
public void run() {
List targets = getOrderedSelection();
List list = getEntriesAsList();
List<ISourceContainer> targets = getOrderedSelection();
List<ISourceContainer> list = getEntriesAsList();
list.removeAll(targets);
setEntries(list);
}
@ -41,5 +42,4 @@ public class RemoveAction extends SourceContainerAction {
//check that something is selected and it is a root tree node.
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
*/
protected List getOrderedSelection() {
List targets = new ArrayList();
List selection =
((IStructuredSelection) getViewer().getSelection()).toList();
protected List<ISourceContainer> getOrderedSelection() {
List<ISourceContainer> targets = new ArrayList<ISourceContainer>();
List<?> selection = ((IStructuredSelection) getViewer().getSelection()).toList();
ISourceContainer[] entries = getViewer().getEntries();
for (int i = 0; i < entries.length; 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
*/
protected List getEntriesAsList() {
protected List<ISourceContainer> getEntriesAsList() {
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++) {
list.add(entries[i]);
}
@ -100,9 +99,8 @@ public abstract class SourceContainerAction extends SelectionListenerAction {
/**
* Updates the entries to the entries in the given list
*/
protected void setEntries(List list) {
getViewer().setEntries(
(ISourceContainer[]) list.toArray(new ISourceContainer[list.size()]));
protected void setEntries(List<ISourceContainer> list) {
getViewer().setEntries(list.toArray(new ISourceContainer[list.size()]));
// update all selection listeners
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
* (visually) is selected.
*/
protected boolean isIndexSelected(
IStructuredSelection selection,
int index) {
protected boolean isIndexSelected(IStructuredSelection selection, int index) {
if (selection.isEmpty()) {
return false;
}
Iterator entries = selection.iterator();
List list = getEntriesAsList();
Iterator<?> entries = selection.iterator();
List<?> list = getEntriesAsList();
while (entries.hasNext()) {
Object next = entries.next();
if (list.indexOf(next) == index) {

View file

@ -21,7 +21,7 @@ public class SourceContainerAdapterFactory implements IAdapterFactory {
/* (non-Javadoc)
* @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)) {
return new SourceContainerWorkbenchAdapter();
}
@ -31,7 +31,7 @@ public class SourceContainerAdapterFactory implements IAdapterFactory {
/* (non-Javadoc)
* @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
*/
public Class[] getAdapterList() {
public Class<?>[] getAdapterList() {
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.
*/
public class SourceContainerLabelProvider extends LabelProvider {
private ILabelProvider fLabelProvider = null;
/* (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.
*/
public class SourceContainerViewer extends TreeViewer {
/**
* Whether enabled/editable.
*/
@ -34,10 +33,9 @@ public class SourceContainerViewer extends TreeViewer {
/**
* The source container entries displayed in this viewer
*/
protected List fEntries = new ArrayList();
protected List<ISourceContainer> fEntries = new ArrayList<ISourceContainer>();
class ContentProvider implements ITreeContentProvider {
/**
* @see IStructuredContentProvider#getElements(Object)
*/
@ -81,7 +79,6 @@ public class SourceContainerViewer extends TreeViewer {
public boolean hasChildren(Object element) {
return ((ISourceContainer)element).isComposite();
}
}
/**
@ -124,7 +121,7 @@ public class SourceContainerViewer extends TreeViewer {
* @return the entries in this viewer
*/
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]);
}
}
}
else {
} else {
int index = fEntries.indexOf(sel.getFirstElement());
for (int i = 0; i < entries.length; i++) {
if (!fEntries.contains(entries[i])) {
@ -166,7 +162,7 @@ public class SourceContainerViewer extends TreeViewer {
*/
public void setEnabled(boolean enabled) {
fEnabled = enabled;
// fire selection change to upate actions
// fire selection change to update actions
setSelection(getSelection());
}

View file

@ -67,7 +67,7 @@ public class SourceContainerWorkbenchAdapter implements IWorkbenchAdapter {
*/
public String getLabel(Object o) {
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) {
return ((MapEntrySourceContainer)o).getName();

View file

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

View file

@ -7,28 +7,58 @@
*
* Contributors:
* QNX Software Systems - Initial API and implementation
* Sergey Prigogin (Google)
*******************************************************************************/
package org.eclipse.cdt.debug.internal.ui.sourcelookup;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import org.eclipse.osgi.util.NLS;
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$
private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME );
static {
NLS.initializeMessages(SourceLookupUIMessages.class.getName(), SourceLookupUIMessages.class);
}
private SourceLookupUIMessages() {
}
public static String getString( String key ) {
// TODO Auto-generated method stub
try {
return RESOURCE_BUNDLE.getString( key );
}
catch( MissingResourceException e ) {
return '!' + key + '!';
}
// Do not instantiate
}
}

View file

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

View file

@ -10,9 +10,9 @@
*******************************************************************************/
package org.eclipse.cdt.debug.internal.ui.sourcelookup;
import java.util.Iterator;
import java.util.List;
import org.eclipse.debug.core.sourcelookup.ISourceContainer;
import org.eclipse.jface.viewers.IStructuredSelection;
/**
@ -21,28 +21,27 @@ import org.eclipse.jface.viewers.IStructuredSelection;
public class UpAction extends SourceContainerAction {
public UpAction() {
super(SourceLookupUIMessages.getString( "UpAction.0" )); //$NON-NLS-1$
super(SourceLookupUIMessages.UpAction_0);
}
/**
* Moves all selected entries up one position (if possible).
*
* @see IAction#run()
*/
public void run() {
List targets = getOrderedSelection();
List<ISourceContainer> targets = getOrderedSelection();
if (targets.isEmpty()) {
return;
}
int top = 0;
int index = 0;
List list = getEntriesAsList();
Iterator entries = targets.iterator();
while (entries.hasNext()) {
Object target = entries.next();
List<ISourceContainer> list = getEntriesAsList();
for (ISourceContainer target : targets) {
index = list.indexOf(target);
if (index > top) {
top = index - 1;
Object temp = list.get(top);
ISourceContainer temp = list.get(top);
list.set(top, target);
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.
return !selection.isEmpty() && !isIndexSelected(selection, 0) && getViewer().getTree().getSelection()[0].getParentItem()==null;
}
}