mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
String externalization.
This commit is contained in:
parent
58d2390a65
commit
b776463efa
30 changed files with 1605 additions and 1746 deletions
|
@ -1,3 +1,6 @@
|
|||
2004-06-21 Mikhail Khodjaiants
|
||||
String externalization.
|
||||
|
||||
2004-06-16 Mikhail Khodjaiants
|
||||
Deleted the "C/C++ Debugger Appearance" theme.
|
||||
Moved the diassembly color preferences to the "C/C++ Debug" preference page.
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,13 +1,17 @@
|
|||
/*
|
||||
*(c) Copyright QNX Software Systems Ltd. 2002.
|
||||
* All Rights Reserved.
|
||||
/**********************************************************************
|
||||
* Copyright (c) 2004 QNX Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
*/
|
||||
* Contributors:
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
***********************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.ui;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.jface.util.Assert;
|
||||
|
@ -15,33 +19,28 @@ import org.eclipse.swt.graphics.Image;
|
|||
import org.eclipse.swt.widgets.Display;
|
||||
|
||||
/**
|
||||
*
|
||||
* A registry that maps <code>ImageDescriptors</code> to <code>Image</code>.
|
||||
*
|
||||
* @since Aug 30, 2002
|
||||
*/
|
||||
public class CDebugImageDescriptorRegistry
|
||||
{
|
||||
private HashMap fRegistry = new HashMap(10);
|
||||
public class CDebugImageDescriptorRegistry {
|
||||
|
||||
private HashMap fRegistry = new HashMap( 10 );
|
||||
|
||||
private Display fDisplay;
|
||||
|
||||
/**
|
||||
* Creates a new image descriptor registry for the current or default display,
|
||||
* respectively.
|
||||
* Creates a new image descriptor registry for the current or default display, respectively.
|
||||
*/
|
||||
public CDebugImageDescriptorRegistry()
|
||||
{
|
||||
public CDebugImageDescriptorRegistry() {
|
||||
this( CDebugUIPlugin.getStandardDisplay() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new image descriptor registry for the given display. All images
|
||||
* managed by this registry will be disposed when the display gets disposed.
|
||||
* Creates a new image descriptor registry for the given display. All images managed by this registry will be disposed when the display gets disposed.
|
||||
*
|
||||
* @param diaplay the display the images managed by this registry are allocated for
|
||||
* @param diaplay
|
||||
* the display the images managed by this registry are allocated for
|
||||
*/
|
||||
public CDebugImageDescriptorRegistry( Display display )
|
||||
{
|
||||
public CDebugImageDescriptorRegistry( Display display ) {
|
||||
fDisplay = display;
|
||||
Assert.isNotNull( fDisplay );
|
||||
hookDisplay();
|
||||
|
@ -50,20 +49,17 @@ public class CDebugImageDescriptorRegistry
|
|||
/**
|
||||
* Returns the image associated with the given image descriptor.
|
||||
*
|
||||
* @param descriptor the image descriptor for which the registry manages an image
|
||||
* @return the image associated with the image descriptor or <code>null</code>
|
||||
* if the image descriptor can't create the requested image.
|
||||
* @param descriptor
|
||||
* the image descriptor for which the registry manages an image
|
||||
* @return the image associated with the image descriptor or <code>null</code> if the image descriptor can't create the requested image.
|
||||
*/
|
||||
public Image get( ImageDescriptor descriptor )
|
||||
{
|
||||
public Image get( ImageDescriptor descriptor ) {
|
||||
if ( descriptor == null )
|
||||
descriptor = ImageDescriptor.getMissingImageDescriptor();
|
||||
|
||||
Image result = (Image)fRegistry.get( descriptor );
|
||||
if ( result != null )
|
||||
return result;
|
||||
|
||||
Assert.isTrue( fDisplay == CDebugUIPlugin.getStandardDisplay(), CDebugUIPlugin.getResourceString("internal.ui.CDebugImageDescriptorRegistry.Allocating_image_for_wrong_display") ); //$NON-NLS-1$
|
||||
Assert.isTrue( fDisplay == CDebugUIPlugin.getStandardDisplay(), CDebugUIMessages.getString( "CDebugImageDescriptorRegistry.0" ) ); //$NON-NLS-1$
|
||||
result = descriptor.createImage();
|
||||
if ( result != null )
|
||||
fRegistry.put( descriptor, result );
|
||||
|
@ -73,22 +69,21 @@ public class CDebugImageDescriptorRegistry
|
|||
/**
|
||||
* Disposes all images managed by this registry.
|
||||
*/
|
||||
public void dispose()
|
||||
{
|
||||
for ( Iterator iter = fRegistry.values().iterator(); iter.hasNext(); )
|
||||
{
|
||||
public void dispose() {
|
||||
for( Iterator iter = fRegistry.values().iterator(); iter.hasNext(); ) {
|
||||
Image image = (Image)iter.next();
|
||||
image.dispose();
|
||||
}
|
||||
fRegistry.clear();
|
||||
}
|
||||
|
||||
private void hookDisplay()
|
||||
{
|
||||
fDisplay.asyncExec(new Runnable() {
|
||||
private void hookDisplay() {
|
||||
fDisplay.asyncExec( new Runnable() {
|
||||
|
||||
public void run() {
|
||||
getDisplay().disposeExec( new Runnable() {
|
||||
public void run() {
|
||||
|
||||
public void run() {
|
||||
dispose();
|
||||
}
|
||||
} );
|
||||
|
@ -99,4 +94,4 @@ public class CDebugImageDescriptorRegistry
|
|||
protected Display getDisplay() {
|
||||
return fDisplay;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -11,20 +11,22 @@
|
|||
package org.eclipse.cdt.debug.internal.ui;
|
||||
|
||||
import java.util.MissingResourceException;
|
||||
import java.util.ResourceBundle;
|
||||
//import java.util.ResourceBundle;
|
||||
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
||||
|
||||
public class CDebugUIMessages {
|
||||
|
||||
private static final String BUNDLE_NAME = "org.eclipse.cdt.debug.internal.ui.CDebugUIMessages"; //$NON-NLS-1$
|
||||
// private static final String BUNDLE_NAME = "org.eclipse.cdt.debug.internal.ui.CDebugUIMessages"; //$NON-NLS-1$
|
||||
|
||||
private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME );
|
||||
// private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME );
|
||||
|
||||
private CDebugUIMessages() {
|
||||
}
|
||||
|
||||
public static String getString( String key ) {
|
||||
try {
|
||||
return RESOURCE_BUNDLE.getString( key );
|
||||
return CDebugUIPlugin.getResourceString( key );
|
||||
// return RESOURCE_BUNDLE.getString( key );
|
||||
}
|
||||
catch( MissingResourceException e ) {
|
||||
return '!' + key + '!';
|
||||
|
|
|
@ -1,3 +1,33 @@
|
|||
CDebugUIPlugin.Error_1=Error
|
||||
CDebugModelPresentation.unknown_1=unknown
|
||||
CDebugImageDescriptorRegistry.0=Allocating image for wrong display.
|
||||
CDebugModelPresentation.not_available_1=<not available>
|
||||
CDTDebugModelPresentation.0=<terminated>
|
||||
CDTDebugModelPresentation.1=<disconnected>
|
||||
CDTDebugModelPresentation.2=<not_responding>
|
||||
CDTDebugModelPresentation.3={0} (Exited.{1})
|
||||
CDTDebugModelPresentation.5=Signal ''{0}'' received. Description: {1}.
|
||||
CDTDebugModelPresentation.6=Exit code = {0}.
|
||||
CDTDebugModelPresentation.7={0} (Suspended)
|
||||
CDTDebugModelPresentation.8=Thread [{0}]
|
||||
CDTDebugModelPresentation.9=Thread [{0}] (Terminated)
|
||||
CDTDebugModelPresentation.10=Thread [{0}] (Stepping)
|
||||
CDTDebugModelPresentation.11=Thread [{0}] (Running)
|
||||
CDTDebugModelPresentation.13=: Signal ''{0}'' received. Description: {1}.
|
||||
CDTDebugModelPresentation.14=: Watchpoint triggered. Old value: ''{0}''. New value: ''{1}''.
|
||||
CDTDebugModelPresentation.15=: Watchpoint is out of scope.
|
||||
CDTDebugModelPresentation.16=: Breakpoint hit.
|
||||
CDTDebugModelPresentation.17=: Shared library event.
|
||||
CDTDebugModelPresentation.18=Thread [{0}] (Suspended{1})
|
||||
CDTDebugModelPresentation.19=Thread [{0}]
|
||||
CDTDebugModelPresentation.20=at
|
||||
CDTDebugModelPresentation.21=<symbol is not available>
|
||||
CDTDebugModelPresentation.22=(disabled)
|
||||
CDTDebugModelPresentation.23=Infinity
|
||||
CDTDebugModelPresentation.24=-Infinity
|
||||
CDTDebugModelPresentation.25=(disabled)
|
||||
CDTDebugModelPresentation.26=[line: {0}]
|
||||
CDTDebugModelPresentation.27=[address: {0}]
|
||||
CDTDebugModelPresentation.28=[function: {0}]
|
||||
CDTDebugModelPresentation.29=[ignore count: {0}]
|
||||
CDTDebugModelPresentation.30=if
|
||||
CDTDebugModelPresentation.31=at
|
||||
|
|
|
@ -1,31 +1,32 @@
|
|||
/*
|
||||
*(c) Copyright QNX Software Systems Ltd. 2002.
|
||||
* All Rights Reserved.
|
||||
/**********************************************************************
|
||||
* Copyright (c) 2004 QNX Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
*/
|
||||
|
||||
* Contributors:
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
***********************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.ui.actions;
|
||||
|
||||
import java.util.MissingResourceException;
|
||||
import java.util.ResourceBundle;
|
||||
//import java.util.ResourceBundle;
|
||||
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
||||
|
||||
/**
|
||||
* Enter type comment.
|
||||
*
|
||||
* @since: Feb 23, 2004
|
||||
*/
|
||||
public class ActionMessages {
|
||||
|
||||
private static final String BUNDLE_NAME = "org.eclipse.cdt.debug.internal.ui.actions.ActionMessages"; //$NON-NLS-1$
|
||||
// private static final String BUNDLE_NAME = "org.eclipse.cdt.debug.internal.ui.actions.ActionMessages"; //$NON-NLS-1$
|
||||
|
||||
private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME );
|
||||
// private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME );
|
||||
|
||||
private ActionMessages() {
|
||||
}
|
||||
|
||||
public static String getString( String key ) {
|
||||
try {
|
||||
return RESOURCE_BUNDLE.getString( key );
|
||||
return CDebugUIPlugin.getResourceString( key );
|
||||
// return RESOURCE_BUNDLE.getString( key );
|
||||
}
|
||||
catch( MissingResourceException e ) {
|
||||
return '!' + key + '!';
|
||||
|
|
|
@ -11,24 +11,22 @@
|
|||
package org.eclipse.cdt.debug.internal.ui.editors;
|
||||
|
||||
import java.util.MissingResourceException;
|
||||
import java.util.ResourceBundle;
|
||||
//import java.util.ResourceBundle;
|
||||
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
||||
|
||||
/**
|
||||
* Comment for .
|
||||
*/
|
||||
public class EditorMessages {
|
||||
|
||||
private static final String BUNDLE_NAME = "org.eclipse.cdt.debug.internal.ui.editors.EditorMessages";//$NON-NLS-1$
|
||||
// private static final String BUNDLE_NAME = "org.eclipse.cdt.debug.internal.ui.editors.EditorMessages";//$NON-NLS-1$
|
||||
|
||||
private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME );
|
||||
// private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME );
|
||||
|
||||
private EditorMessages() {
|
||||
}
|
||||
|
||||
public static String getString( String key ) {
|
||||
// TODO Auto-generated method stub
|
||||
try {
|
||||
return RESOURCE_BUNDLE.getString( key );
|
||||
return CDebugUIPlugin.getResourceString( key );
|
||||
// return RESOURCE_BUNDLE.getString( key );
|
||||
}
|
||||
catch( MissingResourceException e ) {
|
||||
return '!' + key + '!';
|
||||
|
|
|
@ -7,21 +7,22 @@
|
|||
package org.eclipse.cdt.debug.internal.ui.preferences;
|
||||
|
||||
import java.util.MissingResourceException;
|
||||
import java.util.ResourceBundle;
|
||||
//import java.util.ResourceBundle;
|
||||
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
||||
|
||||
public class PreferenceMessages {
|
||||
|
||||
private static final String BUNDLE_NAME = "org.eclipse.cdt.debug.internal.ui.preferences.PreferenceMessages";//$NON-NLS-1$
|
||||
// private static final String BUNDLE_NAME = "org.eclipse.cdt.debug.internal.ui.preferences.PreferenceMessages";//$NON-NLS-1$
|
||||
|
||||
private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME );
|
||||
// private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME );
|
||||
|
||||
private PreferenceMessages() {
|
||||
}
|
||||
|
||||
public static String getString( String key ) {
|
||||
// TODO Auto-generated method stub
|
||||
try {
|
||||
return RESOURCE_BUNDLE.getString( key );
|
||||
return CDebugUIPlugin.getResourceString( key );
|
||||
// return RESOURCE_BUNDLE.getString( key );
|
||||
}
|
||||
catch( MissingResourceException e ) {
|
||||
return '!' + key + '!';
|
||||
|
|
|
@ -11,20 +11,22 @@
|
|||
package org.eclipse.cdt.debug.internal.ui.views.disassembly;
|
||||
|
||||
import java.util.MissingResourceException;
|
||||
import java.util.ResourceBundle;
|
||||
//import java.util.ResourceBundle;
|
||||
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
||||
|
||||
public class DisassemblyMessages {
|
||||
|
||||
private static final String BUNDLE_NAME = "org.eclipse.cdt.debug.internal.ui.views.disassembly.DisassemblyMessages"; //$NON-NLS-1$
|
||||
// private static final String BUNDLE_NAME = "org.eclipse.cdt.debug.internal.ui.views.disassembly.DisassemblyMessages"; //$NON-NLS-1$
|
||||
|
||||
private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME );
|
||||
// private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME );
|
||||
|
||||
private DisassemblyMessages() {
|
||||
}
|
||||
|
||||
public static String getString( String key ) {
|
||||
try {
|
||||
return RESOURCE_BUNDLE.getString( key );
|
||||
return CDebugUIPlugin.getResourceString( key );
|
||||
// return RESOURCE_BUNDLE.getString( key );
|
||||
}
|
||||
catch( MissingResourceException e ) {
|
||||
return '!' + key + '!';
|
||||
|
|
|
@ -1,9 +1,13 @@
|
|||
/*
|
||||
*(c) Copyright QNX Software Systems Ltd. 2002.
|
||||
* All Rights Reserved.
|
||||
/**********************************************************************
|
||||
* Copyright (c) 2004 QNX Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
*/
|
||||
|
||||
* Contributors:
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
***********************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.ui.views.memory;
|
||||
|
||||
import org.eclipse.cdt.debug.core.CDebugModel;
|
||||
|
@ -39,43 +43,47 @@ import org.eclipse.swt.widgets.Label;
|
|||
import org.eclipse.swt.widgets.Text;
|
||||
|
||||
/**
|
||||
*
|
||||
* The tab content in the memory view.
|
||||
*
|
||||
* @since Jul 25, 2002
|
||||
*/
|
||||
public class MemoryControlArea extends Composite implements ITextOperationTarget
|
||||
{
|
||||
public class MemoryControlArea extends Composite implements ITextOperationTarget {
|
||||
|
||||
private MemoryView fMemoryView;
|
||||
|
||||
private MemoryPresentation fPresentation;
|
||||
|
||||
private int fIndex = 0;
|
||||
|
||||
private ICMemoryManager fMemoryManager = null;
|
||||
|
||||
private Text fAddressText;
|
||||
|
||||
private Button fEvaluateButton;
|
||||
|
||||
private MemoryText fMemoryText;
|
||||
|
||||
|
||||
private int fFormat = ICMemoryManager.MEMORY_FORMAT_HEX;
|
||||
|
||||
private int fWordSize = ICMemoryManager.MEMORY_SIZE_BYTE;
|
||||
|
||||
private int fNumberOfRows = 40;
|
||||
|
||||
private int fNumberOfColumns = 16;
|
||||
|
||||
private char fPaddingChar = '.';
|
||||
|
||||
/**
|
||||
* Constructor for MemoryControlArea.
|
||||
*
|
||||
* @param parent
|
||||
* @param style
|
||||
*/
|
||||
public MemoryControlArea( Composite parent, int style, int index, MemoryView view )
|
||||
{
|
||||
public MemoryControlArea( Composite parent, int style, int index, MemoryView view ) {
|
||||
super( parent, style );
|
||||
fMemoryView = view;
|
||||
GridLayout layout = new GridLayout();
|
||||
layout.marginHeight = 0;
|
||||
layout.marginWidth = 0;
|
||||
GridData gridData = new GridData( GridData.FILL_BOTH |
|
||||
GridData.GRAB_HORIZONTAL |
|
||||
GridData.GRAB_VERTICAL );
|
||||
GridData gridData = new GridData( GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL );
|
||||
setLayout( layout );
|
||||
setLayoutData( gridData );
|
||||
setIndex( index );
|
||||
|
@ -86,236 +94,185 @@ public class MemoryControlArea extends Composite implements ITextOperationTarget
|
|||
updateToolTipText();
|
||||
}
|
||||
|
||||
private void setDefaultPreferences()
|
||||
{
|
||||
private void setDefaultPreferences() {
|
||||
char[] paddingCharStr = CDebugUIPlugin.getDefault().getPreferenceStore().getString( ICDebugPreferenceConstants.PREF_MEMORY_PADDING_CHAR ).toCharArray();
|
||||
setPaddingChar( ( paddingCharStr.length > 0 ) ? paddingCharStr[0] : '.' );
|
||||
setPaddingChar( (paddingCharStr.length > 0) ? paddingCharStr[0] : '.' );
|
||||
fPresentation.setDisplayAscii( CDebugUIPlugin.getDefault().getPreferenceStore().getBoolean( ICDebugPreferenceConstants.PREF_MEMORY_SHOW_ASCII ) );
|
||||
}
|
||||
|
||||
private MemoryPresentation createPresentation()
|
||||
{
|
||||
private MemoryPresentation createPresentation() {
|
||||
return new MemoryPresentation();
|
||||
}
|
||||
|
||||
public MemoryPresentation getPresentation()
|
||||
{
|
||||
public MemoryPresentation getPresentation() {
|
||||
return fPresentation;
|
||||
}
|
||||
|
||||
private Text createAddressText( Composite parent )
|
||||
{
|
||||
|
||||
private Text createAddressText( Composite parent ) {
|
||||
Composite composite = new Composite( parent, SWT.NONE );
|
||||
composite.setLayout( new GridLayout( 3, false ) );
|
||||
composite.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
|
||||
// create label
|
||||
Label label = new Label( composite, SWT.RIGHT );
|
||||
label.setText( CDebugUIPlugin.getResourceString("MemoryControlArea.Address") ); //$NON-NLS-1$
|
||||
label.setText( MemoryViewMessages.getString( "MemoryControlArea.0" ) ); //$NON-NLS-1$
|
||||
label.pack();
|
||||
|
||||
// create address text
|
||||
Text text = new Text( composite, SWT.BORDER );
|
||||
text.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
|
||||
text.addTraverseListener( new TraverseListener()
|
||||
{
|
||||
public void keyTraversed( TraverseEvent e )
|
||||
{
|
||||
if ( e.detail == SWT.TRAVERSE_RETURN && e.stateMask == 0 )
|
||||
{
|
||||
e.doit = false;
|
||||
handleAddressEnter();
|
||||
}
|
||||
}
|
||||
} );
|
||||
text.addFocusListener( new FocusListener()
|
||||
{
|
||||
public void focusGained( FocusEvent e )
|
||||
{
|
||||
getMemoryView().updateObjects();
|
||||
}
|
||||
text.addTraverseListener( new TraverseListener() {
|
||||
|
||||
public void focusLost( FocusEvent e )
|
||||
{
|
||||
getMemoryView().updateObjects();
|
||||
}
|
||||
} );
|
||||
text.addModifyListener( new ModifyListener()
|
||||
{
|
||||
public void modifyText( ModifyEvent e )
|
||||
{
|
||||
handleAddressModification();
|
||||
}
|
||||
} );
|
||||
text.addKeyListener( new KeyListener()
|
||||
{
|
||||
public void keyPressed( KeyEvent e )
|
||||
{
|
||||
getMemoryView().updateObjects();
|
||||
}
|
||||
public void keyTraversed( TraverseEvent e ) {
|
||||
if ( e.detail == SWT.TRAVERSE_RETURN && e.stateMask == 0 ) {
|
||||
e.doit = false;
|
||||
handleAddressEnter();
|
||||
}
|
||||
}
|
||||
} );
|
||||
text.addFocusListener( new FocusListener() {
|
||||
|
||||
public void keyReleased( KeyEvent e )
|
||||
{
|
||||
getMemoryView().updateObjects();
|
||||
}
|
||||
} );
|
||||
text.addMouseListener( new MouseListener()
|
||||
{
|
||||
public void mouseDoubleClick( MouseEvent e )
|
||||
{
|
||||
getMemoryView().updateObjects();
|
||||
}
|
||||
public void focusGained( FocusEvent e ) {
|
||||
getMemoryView().updateObjects();
|
||||
}
|
||||
|
||||
public void mouseDown( MouseEvent e )
|
||||
{
|
||||
getMemoryView().updateObjects();
|
||||
}
|
||||
public void focusLost( FocusEvent e ) {
|
||||
getMemoryView().updateObjects();
|
||||
}
|
||||
} );
|
||||
text.addModifyListener( new ModifyListener() {
|
||||
|
||||
public void mouseUp( MouseEvent e )
|
||||
{
|
||||
getMemoryView().updateObjects();
|
||||
}
|
||||
} );
|
||||
public void modifyText( ModifyEvent e ) {
|
||||
handleAddressModification();
|
||||
}
|
||||
} );
|
||||
text.addKeyListener( new KeyListener() {
|
||||
|
||||
public void keyPressed( KeyEvent e ) {
|
||||
getMemoryView().updateObjects();
|
||||
}
|
||||
|
||||
public void keyReleased( KeyEvent e ) {
|
||||
getMemoryView().updateObjects();
|
||||
}
|
||||
} );
|
||||
text.addMouseListener( new MouseListener() {
|
||||
|
||||
public void mouseDoubleClick( MouseEvent e ) {
|
||||
getMemoryView().updateObjects();
|
||||
}
|
||||
|
||||
public void mouseDown( MouseEvent e ) {
|
||||
getMemoryView().updateObjects();
|
||||
}
|
||||
|
||||
public void mouseUp( MouseEvent e ) {
|
||||
getMemoryView().updateObjects();
|
||||
}
|
||||
} );
|
||||
fEvaluateButton = new Button( composite, SWT.PUSH );
|
||||
fEvaluateButton.setText( CDebugUIPlugin.getResourceString("MemoryControlArea.Evaluate") ); //$NON-NLS-1$
|
||||
fEvaluateButton.setToolTipText( CDebugUIPlugin.getResourceString("MemoryControlArea.Evaluate_Expression") ); //$NON-NLS-1$
|
||||
fEvaluateButton.addSelectionListener( new SelectionAdapter()
|
||||
{
|
||||
public void widgetSelected( SelectionEvent e )
|
||||
{
|
||||
evaluateAddressExpression();
|
||||
}
|
||||
} );
|
||||
fEvaluateButton.setText( MemoryViewMessages.getString( "MemoryControlArea.1" ) ); //$NON-NLS-1$
|
||||
fEvaluateButton.setToolTipText( MemoryViewMessages.getString( "MemoryControlArea.2" ) ); //$NON-NLS-1$
|
||||
fEvaluateButton.addSelectionListener( new SelectionAdapter() {
|
||||
|
||||
public void widgetSelected( SelectionEvent e ) {
|
||||
evaluateAddressExpression();
|
||||
}
|
||||
} );
|
||||
return text;
|
||||
}
|
||||
|
||||
private MemoryText createMemoryText( Composite parent,
|
||||
int styles,
|
||||
MemoryPresentation presentation )
|
||||
{
|
||||
private MemoryText createMemoryText( Composite parent, int styles, MemoryPresentation presentation ) {
|
||||
return new MemoryText( parent, SWT.BORDER | SWT.HIDE_SELECTION | SWT.V_SCROLL | SWT.H_SCROLL, presentation );
|
||||
}
|
||||
|
||||
protected void handleAddressEnter()
|
||||
{
|
||||
if ( getMemoryManager() != null )
|
||||
{
|
||||
protected void handleAddressEnter() {
|
||||
if ( getMemoryManager() != null ) {
|
||||
String address = fAddressText.getText().trim();
|
||||
try
|
||||
{
|
||||
try {
|
||||
removeBlock();
|
||||
if ( address.length() > 0 )
|
||||
{
|
||||
if ( address.length() > 0 ) {
|
||||
createBlock( address );
|
||||
}
|
||||
}
|
||||
catch( DebugException e )
|
||||
{
|
||||
CDebugUIPlugin.errorDialog( CDebugUIPlugin.getResourceString("MemoryControlArea.Error_memoryBlock"), e.getStatus() ); //$NON-NLS-1$
|
||||
catch( DebugException e ) {
|
||||
CDebugUIPlugin.errorDialog( MemoryViewMessages.getString( "MemoryControlArea.3" ), e.getStatus() ); //$NON-NLS-1$
|
||||
}
|
||||
refresh();
|
||||
getMemoryView().updateObjects();
|
||||
}
|
||||
}
|
||||
|
||||
public void propertyChange( PropertyChangeEvent event )
|
||||
{
|
||||
if ( event.getProperty().equals( ICDebugPreferenceConstants.MEMORY_BACKGROUND_RGB ) )
|
||||
{
|
||||
public void propertyChange( PropertyChangeEvent event ) {
|
||||
if ( event.getProperty().equals( ICDebugPreferenceConstants.MEMORY_BACKGROUND_RGB ) ) {
|
||||
fMemoryText.setBackgroundColor();
|
||||
}
|
||||
else if ( event.getProperty().equals( ICDebugPreferenceConstants.MEMORY_FOREGROUND_RGB ) )
|
||||
{
|
||||
else if ( event.getProperty().equals( ICDebugPreferenceConstants.MEMORY_FOREGROUND_RGB ) ) {
|
||||
fMemoryText.setForegroundColor();
|
||||
}
|
||||
else if ( event.getProperty().equals( ICDebugPreferenceConstants.MEMORY_FONT ) )
|
||||
{
|
||||
else if ( event.getProperty().equals( ICDebugPreferenceConstants.MEMORY_FONT ) ) {
|
||||
fMemoryText.changeFont();
|
||||
}
|
||||
else if ( event.getProperty().equals( ICDebugPreferenceConstants.MEMORY_ADDRESS_RGB ) )
|
||||
{
|
||||
else if ( event.getProperty().equals( ICDebugPreferenceConstants.MEMORY_ADDRESS_RGB ) ) {
|
||||
fMemoryText.setAddressColor();
|
||||
}
|
||||
else if ( event.getProperty().equals( ICDebugPreferenceConstants.MEMORY_CHANGED_RGB ) )
|
||||
{
|
||||
else if ( event.getProperty().equals( ICDebugPreferenceConstants.MEMORY_CHANGED_RGB ) ) {
|
||||
fMemoryText.setChangedColor();
|
||||
}
|
||||
else if ( event.getProperty().equals( ICDebugPreferenceConstants.MEMORY_DIRTY_RGB ) )
|
||||
{
|
||||
else if ( event.getProperty().equals( ICDebugPreferenceConstants.MEMORY_DIRTY_RGB ) ) {
|
||||
fMemoryText.setDirtyColor();
|
||||
}
|
||||
else if ( event.getProperty().equals( ICDebugPreferenceConstants.PREF_MEMORY_PADDING_CHAR ) )
|
||||
{
|
||||
else if ( event.getProperty().equals( ICDebugPreferenceConstants.PREF_MEMORY_PADDING_CHAR ) ) {
|
||||
String paddingCharString = (String)event.getNewValue();
|
||||
setPaddingChar( ( paddingCharString.length() > 0 ) ? paddingCharString.charAt( 0 ) : '.' );
|
||||
setPaddingChar( (paddingCharString.length() > 0) ? paddingCharString.charAt( 0 ) : '.' );
|
||||
refresh();
|
||||
}
|
||||
}
|
||||
|
||||
public void setInput( Object input )
|
||||
{
|
||||
setMemoryManager( ( input instanceof ICMemoryManager ) ? (ICMemoryManager)input : null );
|
||||
|
||||
public void setInput( Object input ) {
|
||||
setMemoryManager( (input instanceof ICMemoryManager) ? (ICMemoryManager)input : null );
|
||||
getPresentation().setMemoryBlock( getMemoryBlock() );
|
||||
setState();
|
||||
refresh();
|
||||
}
|
||||
|
||||
protected void refresh()
|
||||
{
|
||||
fAddressText.setText( ( getPresentation() != null ) ? getPresentation().getAddressExpression() : "" ); //$NON-NLS-1$
|
||||
|
||||
protected void refresh() {
|
||||
fAddressText.setText( (getPresentation() != null) ? getPresentation().getAddressExpression() : "" ); //$NON-NLS-1$
|
||||
fMemoryText.refresh();
|
||||
getMemoryView().updateObjects();
|
||||
updateToolTipText();
|
||||
}
|
||||
|
||||
protected void setMemoryManager( ICMemoryManager mm )
|
||||
{
|
||||
|
||||
protected void setMemoryManager( ICMemoryManager mm ) {
|
||||
fMemoryManager = mm;
|
||||
}
|
||||
|
||||
protected ICMemoryManager getMemoryManager()
|
||||
{
|
||||
protected ICMemoryManager getMemoryManager() {
|
||||
return fMemoryManager;
|
||||
}
|
||||
|
||||
protected IFormattedMemoryBlock getMemoryBlock()
|
||||
{
|
||||
return ( getMemoryManager() != null ) ? getMemoryManager().getBlock( getIndex() ) : null;
|
||||
|
||||
protected IFormattedMemoryBlock getMemoryBlock() {
|
||||
return (getMemoryManager() != null) ? getMemoryManager().getBlock( getIndex() ) : null;
|
||||
}
|
||||
|
||||
protected int getIndex()
|
||||
{
|
||||
protected int getIndex() {
|
||||
return fIndex;
|
||||
}
|
||||
|
||||
protected void setIndex( int index )
|
||||
{
|
||||
protected void setIndex( int index ) {
|
||||
fIndex = index;
|
||||
}
|
||||
|
||||
private void createBlock( String address ) throws DebugException
|
||||
{
|
||||
if ( getMemoryManager() != null )
|
||||
{
|
||||
getMemoryManager().setBlockAt( getIndex(),
|
||||
CDebugModel.createFormattedMemoryBlock( (IDebugTarget)getMemoryManager().getAdapter( IDebugTarget.class ),
|
||||
address,
|
||||
getFormat(),
|
||||
getWordSize(),
|
||||
getNumberOfRows(),
|
||||
getNumberOfColumns(),
|
||||
getPaddingChar() ) );
|
||||
getMemoryBlock().setFrozen( !CDebugUIPlugin.getDefault().getPreferenceStore().getBoolean( ICDebugPreferenceConstants.PREF_MEMORY_AUTO_REFRESH ) );
|
||||
private void createBlock( String address ) throws DebugException {
|
||||
if ( getMemoryManager() != null ) {
|
||||
getMemoryManager().setBlockAt( getIndex(), CDebugModel.createFormattedMemoryBlock( (IDebugTarget)getMemoryManager().getAdapter( IDebugTarget.class ), address, getFormat(), getWordSize(), getNumberOfRows(), getNumberOfColumns(), getPaddingChar() ) );
|
||||
getMemoryBlock().setFrozen( !CDebugUIPlugin.getDefault().getPreferenceStore().getBoolean( ICDebugPreferenceConstants.PREF_MEMORY_AUTO_REFRESH ) );
|
||||
getPresentation().setMemoryBlock( getMemoryBlock() );
|
||||
}
|
||||
setMemoryTextState();
|
||||
updateToolTipText();
|
||||
}
|
||||
|
||||
private void removeBlock() throws DebugException
|
||||
{
|
||||
if ( getMemoryManager() != null )
|
||||
{
|
||||
|
||||
private void removeBlock() throws DebugException {
|
||||
if ( getMemoryManager() != null ) {
|
||||
getMemoryManager().removeBlock( getIndex() );
|
||||
getPresentation().setMemoryBlock( null );
|
||||
}
|
||||
|
@ -323,94 +280,72 @@ public class MemoryControlArea extends Composite implements ITextOperationTarget
|
|||
updateToolTipText();
|
||||
}
|
||||
|
||||
public int getFormat()
|
||||
{
|
||||
public int getFormat() {
|
||||
return fFormat;
|
||||
}
|
||||
|
||||
public int getNumberOfColumns()
|
||||
{
|
||||
public int getNumberOfColumns() {
|
||||
return fNumberOfColumns;
|
||||
}
|
||||
|
||||
public int getNumberOfRows()
|
||||
{
|
||||
public int getNumberOfRows() {
|
||||
return fNumberOfRows;
|
||||
}
|
||||
|
||||
public char getPaddingChar()
|
||||
{
|
||||
public char getPaddingChar() {
|
||||
return fPaddingChar;
|
||||
}
|
||||
|
||||
public int getWordSize()
|
||||
{
|
||||
public int getWordSize() {
|
||||
return fWordSize;
|
||||
}
|
||||
|
||||
public void setFormat(int format)
|
||||
{
|
||||
public void setFormat( int format ) {
|
||||
fFormat = format;
|
||||
}
|
||||
|
||||
public void setNumberOfColumns( int numberOfColumns )
|
||||
{
|
||||
public void setNumberOfColumns( int numberOfColumns ) {
|
||||
fNumberOfColumns = numberOfColumns;
|
||||
}
|
||||
|
||||
public void setNumberOfRows( int numberOfRows )
|
||||
{
|
||||
public void setNumberOfRows( int numberOfRows ) {
|
||||
fNumberOfRows = numberOfRows;
|
||||
}
|
||||
|
||||
public void setPaddingChar( char paddingChar )
|
||||
{
|
||||
public void setPaddingChar( char paddingChar ) {
|
||||
fPaddingChar = paddingChar;
|
||||
if ( getMemoryBlock() != null )
|
||||
{
|
||||
try
|
||||
{
|
||||
getMemoryBlock().reformat( getMemoryBlock().getFormat(),
|
||||
getMemoryBlock().getWordSize(),
|
||||
getMemoryBlock().getNumberOfRows(),
|
||||
getMemoryBlock().getNumberOfColumns(),
|
||||
fPaddingChar );
|
||||
if ( getMemoryBlock() != null ) {
|
||||
try {
|
||||
getMemoryBlock().reformat( getMemoryBlock().getFormat(), getMemoryBlock().getWordSize(), getMemoryBlock().getNumberOfRows(), getMemoryBlock().getNumberOfColumns(), fPaddingChar );
|
||||
}
|
||||
catch( DebugException e )
|
||||
{
|
||||
catch( DebugException e ) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setWordSize( int wordSize )
|
||||
{
|
||||
public void setWordSize( int wordSize ) {
|
||||
fWordSize = wordSize;
|
||||
}
|
||||
|
||||
private void enableAddressText( boolean enable )
|
||||
{
|
||||
|
||||
private void enableAddressText( boolean enable ) {
|
||||
fAddressText.setEnabled( enable );
|
||||
}
|
||||
|
||||
protected void setState()
|
||||
{
|
||||
|
||||
protected void setState() {
|
||||
enableAddressText( getMemoryManager() != null );
|
||||
setMemoryTextState();
|
||||
}
|
||||
|
||||
private void setMemoryTextState()
|
||||
{
|
||||
|
||||
private void setMemoryTextState() {
|
||||
fMemoryText.setEditable( getMemoryManager() != null && getMemoryBlock() != null );
|
||||
}
|
||||
|
||||
protected MemoryText getMemoryText()
|
||||
{
|
||||
|
||||
protected MemoryText getMemoryText() {
|
||||
return fMemoryText;
|
||||
}
|
||||
|
||||
protected void clear()
|
||||
{
|
||||
|
||||
protected void clear() {
|
||||
fAddressText.setText( "" ); //$NON-NLS-1$
|
||||
handleAddressEnter();
|
||||
updateToolTipText();
|
||||
|
@ -419,137 +354,112 @@ public class MemoryControlArea extends Composite implements ITextOperationTarget
|
|||
/**
|
||||
* @see org.eclipse.swt.widgets.Widget#dispose()
|
||||
*/
|
||||
public void dispose()
|
||||
{
|
||||
if ( getPresentation() != null )
|
||||
{
|
||||
public void dispose() {
|
||||
if ( getPresentation() != null ) {
|
||||
getPresentation().dispose();
|
||||
}
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
protected String getTitle()
|
||||
{
|
||||
if ( getParent() instanceof CTabFolder )
|
||||
{
|
||||
protected String getTitle() {
|
||||
if ( getParent() instanceof CTabFolder ) {
|
||||
CTabItem[] tabItems = ((CTabFolder)getParent()).getItems();
|
||||
return tabItems[fIndex].getText();
|
||||
}
|
||||
return ""; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
protected void setTitle( String title )
|
||||
{
|
||||
if ( getParent() instanceof CTabFolder )
|
||||
{
|
||||
protected void setTitle( String title ) {
|
||||
if ( getParent() instanceof CTabFolder ) {
|
||||
CTabItem[] tabItems = ((CTabFolder)getParent()).getItems();
|
||||
tabItems[fIndex].setText( title );
|
||||
}
|
||||
}
|
||||
|
||||
protected void setTabItemToolTipText( String text )
|
||||
{
|
||||
protected void setTabItemToolTipText( String text ) {
|
||||
String newText = replaceMnemonicCharacters( text );
|
||||
if ( getParent() instanceof CTabFolder )
|
||||
{
|
||||
if ( getParent() instanceof CTabFolder ) {
|
||||
CTabItem[] tabItems = ((CTabFolder)getParent()).getItems();
|
||||
tabItems[fIndex].setToolTipText( CDebugUIPlugin.getResourceString("MemoryControlArea.Memory_view") + (fIndex + 1) + ( ( newText.length() > 0 ) ? ( ": " + newText ) : "" ) ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
tabItems[fIndex].setToolTipText( MemoryViewMessages.getString( "MemoryControlArea.4" ) + (fIndex + 1) + ((newText.length() > 0) ? (": " + newText) : "") ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
}
|
||||
}
|
||||
|
||||
protected void refreshMemoryBlock()
|
||||
{
|
||||
if ( getMemoryBlock() != null )
|
||||
{
|
||||
try
|
||||
{
|
||||
protected void refreshMemoryBlock() {
|
||||
if ( getMemoryBlock() != null ) {
|
||||
try {
|
||||
getMemoryBlock().refresh();
|
||||
}
|
||||
catch( DebugException e )
|
||||
{
|
||||
CDebugUIPlugin.errorDialog( CDebugUIPlugin.getResourceString("MemoryControlArea.Error_memoryRefresh"), e.getStatus() ); //$NON-NLS-1$
|
||||
catch( DebugException e ) {
|
||||
CDebugUIPlugin.errorDialog( MemoryViewMessages.getString( "MemoryControlArea.7" ), e.getStatus() ); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void updateToolTipText()
|
||||
{
|
||||
private void updateToolTipText() {
|
||||
setTabItemToolTipText( fAddressText.getText().trim() );
|
||||
}
|
||||
|
||||
private String replaceMnemonicCharacters( String text )
|
||||
{
|
||||
|
||||
private String replaceMnemonicCharacters( String text ) {
|
||||
StringBuffer sb = new StringBuffer( text.length() );
|
||||
for ( int i = 0; i < text.length(); ++i )
|
||||
{
|
||||
for( int i = 0; i < text.length(); ++i ) {
|
||||
char ch = text.charAt( i );
|
||||
sb.append( ch );
|
||||
if ( ch == '&' )
|
||||
{
|
||||
if ( ch == '&' ) {
|
||||
sb.append( ch );
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
protected void handleAddressModification()
|
||||
{
|
||||
|
||||
protected void handleAddressModification() {
|
||||
fEvaluateButton.setEnabled( fAddressText.getText().trim().length() > 0 );
|
||||
}
|
||||
|
||||
protected void evaluateAddressExpression()
|
||||
{
|
||||
if ( getMemoryManager() != null )
|
||||
{
|
||||
if ( getMemoryBlock() == null )
|
||||
{
|
||||
|
||||
protected void evaluateAddressExpression() {
|
||||
if ( getMemoryManager() != null ) {
|
||||
if ( getMemoryBlock() == null ) {
|
||||
String expression = fAddressText.getText().trim();
|
||||
try
|
||||
{
|
||||
try {
|
||||
removeBlock();
|
||||
if ( expression.length() > 0 )
|
||||
{
|
||||
if ( expression.length() > 0 ) {
|
||||
createBlock( expression );
|
||||
}
|
||||
}
|
||||
catch( DebugException e )
|
||||
{
|
||||
CDebugUIPlugin.errorDialog( CDebugUIPlugin.getResourceString("MemoryControlArea.Error_memoryBlock"), e.getStatus() ); //$NON-NLS-1$
|
||||
catch( DebugException e ) {
|
||||
CDebugUIPlugin.errorDialog( MemoryViewMessages.getString( "MemoryControlArea.8" ), e.getStatus() ); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
if ( getMemoryBlock() != null )
|
||||
{
|
||||
if ( getMemoryBlock() != null ) {
|
||||
fAddressText.setText( CDebugUIUtils.toHexAddressString( getMemoryBlock().getStartAddress() ) );
|
||||
handleAddressEnter();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.jface.text.ITextOperationTarget#canDoOperation(int)
|
||||
*/
|
||||
public boolean canDoOperation( int operation )
|
||||
{
|
||||
switch( operation )
|
||||
{
|
||||
public boolean canDoOperation( int operation ) {
|
||||
switch( operation ) {
|
||||
case CUT:
|
||||
case COPY:
|
||||
return ( fAddressText != null && fAddressText.isFocusControl() && fAddressText.isEnabled() && fAddressText.getSelectionCount() > 0 );
|
||||
return (fAddressText != null && fAddressText.isFocusControl() && fAddressText.isEnabled() && fAddressText.getSelectionCount() > 0);
|
||||
case PASTE:
|
||||
case SELECT_ALL:
|
||||
return ( fAddressText != null && fAddressText.isFocusControl() && fAddressText.isEnabled() );
|
||||
return (fAddressText != null && fAddressText.isFocusControl() && fAddressText.isEnabled());
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.jface.text.ITextOperationTarget#doOperation(int)
|
||||
*/
|
||||
public void doOperation( int operation )
|
||||
{
|
||||
switch( operation )
|
||||
{
|
||||
public void doOperation( int operation ) {
|
||||
switch( operation ) {
|
||||
case CUT:
|
||||
fAddressText.cut();
|
||||
break;
|
||||
|
@ -565,8 +475,7 @@ public class MemoryControlArea extends Composite implements ITextOperationTarget
|
|||
}
|
||||
}
|
||||
|
||||
protected MemoryView getMemoryView()
|
||||
{
|
||||
protected MemoryView getMemoryView() {
|
||||
return fMemoryView;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,13 @@
|
|||
/*
|
||||
*(c) Copyright QNX Software Systems Ltd. 2002.
|
||||
* All Rights Reserved.
|
||||
/**********************************************************************
|
||||
* Copyright (c) 2004 QNX Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
*/
|
||||
* Contributors:
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
***********************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.ui.views.memory;
|
||||
|
||||
import org.eclipse.cdt.debug.core.ICMemoryManager;
|
||||
|
@ -48,266 +53,231 @@ import org.eclipse.ui.texteditor.ITextEditorActionConstants;
|
|||
import org.eclipse.ui.texteditor.IUpdate;
|
||||
|
||||
/**
|
||||
*
|
||||
* This view shows the content of the memory blocks associated
|
||||
* with the selected debug target.
|
||||
*
|
||||
* @since Jul 24, 2002
|
||||
* This view shows the content of the memory blocks associated with the selected debug target.
|
||||
*/
|
||||
public class MemoryView extends AbstractDebugEventHandlerView
|
||||
implements ISelectionListener,
|
||||
IPropertyChangeListener,
|
||||
IDebugExceptionHandler
|
||||
{
|
||||
public class MemoryView extends AbstractDebugEventHandlerView implements ISelectionListener, IPropertyChangeListener, IDebugExceptionHandler {
|
||||
|
||||
private IDebugModelPresentation fModelPresentation = null;
|
||||
|
||||
private MemoryActionSelectionGroup fMemoryFormatGroup = null;
|
||||
|
||||
private MemoryActionSelectionGroup fMemorySizeGroup = null;
|
||||
|
||||
private MemoryActionSelectionGroup fMemoryNumberOfColumnsGroup = null;
|
||||
|
||||
/* (non-Javadoc)
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.debug.ui.AbstractDebugView#createViewer(Composite)
|
||||
*/
|
||||
protected Viewer createViewer( Composite parent )
|
||||
{
|
||||
protected Viewer createViewer( Composite parent ) {
|
||||
CDebugUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener( this );
|
||||
final MemoryViewer viewer = new MemoryViewer( parent, this );
|
||||
viewer.setContentProvider( createContentProvider() );
|
||||
viewer.setLabelProvider( getModelPresentation() );
|
||||
|
||||
getSite().getPage().addSelectionListener( IDebugUIConstants.ID_DEBUG_VIEW, this );
|
||||
setEventHandler( createEventHandler( viewer ) );
|
||||
|
||||
return viewer;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.debug.ui.AbstractDebugView#createActions()
|
||||
*/
|
||||
protected void createActions()
|
||||
{
|
||||
IAction action = null;
|
||||
|
||||
protected void createActions() {
|
||||
IAction action = null;
|
||||
action = new MemoryViewAction( this, ITextOperationTarget.CUT );
|
||||
String cutStr = CDebugUIPlugin.getResourceString("MemoryView.Cut"); //$NON-NLS-1$
|
||||
String cutStr = MemoryViewMessages.getString( "MemoryView.0" ); //$NON-NLS-1$
|
||||
action.setText( cutStr );
|
||||
action.setToolTipText( cutStr );
|
||||
action.setDescription( cutStr );
|
||||
setGlobalAction( ITextEditorActionConstants.CUT, (MemoryViewAction)action );
|
||||
|
||||
action = new MemoryViewAction( this, ITextOperationTarget.COPY );
|
||||
String copyStr = CDebugUIPlugin.getResourceString("MemoryView.Copy"); //$NON-NLS-1$
|
||||
String copyStr = MemoryViewMessages.getString( "MemoryView.1" ); //$NON-NLS-1$
|
||||
action.setText( copyStr );
|
||||
action.setToolTipText( copyStr );
|
||||
action.setDescription( copyStr );
|
||||
setGlobalAction( ITextEditorActionConstants.COPY, (MemoryViewAction)action );
|
||||
|
||||
action = new MemoryViewAction( this, ITextOperationTarget.PASTE );
|
||||
String pasteStr = CDebugUIPlugin.getResourceString("MemoryView.Paste"); //$NON-NLS-1$
|
||||
String pasteStr = MemoryViewMessages.getString( "MemoryView.2" ); //$NON-NLS-1$
|
||||
action.setText( pasteStr );
|
||||
action.setToolTipText( pasteStr );
|
||||
action.setDescription( pasteStr );
|
||||
setGlobalAction( ITextEditorActionConstants.PASTE, (MemoryViewAction)action );
|
||||
|
||||
action = new MemoryViewAction( this, ITextOperationTarget.SELECT_ALL );
|
||||
String selectAllStr = CDebugUIPlugin.getResourceString("MemoryView.Select_All"); //$NON-NLS-1$
|
||||
String selectAllStr = MemoryViewMessages.getString( "MemoryView.3" ); //$NON-NLS-1$
|
||||
action.setText( selectAllStr );
|
||||
action.setToolTipText( selectAllStr );
|
||||
action.setDescription( selectAllStr );
|
||||
setGlobalAction( ITextEditorActionConstants.SELECT_ALL, (MemoryViewAction)action );
|
||||
|
||||
action = new RefreshMemoryAction( (MemoryViewer)getViewer() );
|
||||
action.setEnabled( false );
|
||||
setAction( "RefreshMemory", action ); //$NON-NLS-1$
|
||||
add( (RefreshMemoryAction)action );
|
||||
|
||||
action = new AutoRefreshMemoryAction( (MemoryViewer)getViewer() );
|
||||
action.setEnabled( false );
|
||||
action.setChecked( CDebugUIPlugin.getDefault().getPreferenceStore().getBoolean( ICDebugPreferenceConstants.PREF_MEMORY_AUTO_REFRESH ) );
|
||||
setAction( "AutoRefreshMemory", action ); //$NON-NLS-1$
|
||||
add( (AutoRefreshMemoryAction)action );
|
||||
|
||||
action = new ClearMemoryAction( (MemoryViewer)getViewer() );
|
||||
action.setEnabled( false );
|
||||
setAction( "ClearMemory", action ); //$NON-NLS-1$
|
||||
add( (ClearMemoryAction)action );
|
||||
|
||||
action = new ShowAsciiAction( (MemoryViewer)getViewer() );
|
||||
action.setEnabled( false );
|
||||
action.setChecked( CDebugUIPlugin.getDefault().getPreferenceStore().getBoolean( ICDebugPreferenceConstants.PREF_MEMORY_SHOW_ASCII ) );
|
||||
setAction( "ShowAscii", action ); //$NON-NLS-1$
|
||||
add( (ShowAsciiAction)action );
|
||||
|
||||
fMemoryFormatGroup = new MemoryActionSelectionGroup();
|
||||
createFormatActionGroup( fMemoryFormatGroup );
|
||||
|
||||
fMemorySizeGroup = new MemoryActionSelectionGroup();
|
||||
createSizeActionGroup( fMemorySizeGroup );
|
||||
|
||||
fMemoryNumberOfColumnsGroup = new MemoryActionSelectionGroup();
|
||||
createNumberOfColumnsActionGroup( fMemoryNumberOfColumnsGroup );
|
||||
|
||||
// set initial content here, as viewer has to be set
|
||||
setInitialContent();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.debug.ui.AbstractDebugView#getHelpContextId()
|
||||
*/
|
||||
protected String getHelpContextId()
|
||||
{
|
||||
protected String getHelpContextId() {
|
||||
return ICDebugHelpContextIds.MEMORY_VIEW;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.debug.ui.AbstractDebugView#fillContextMenu(IMenuManager)
|
||||
*/
|
||||
protected void fillContextMenu( IMenuManager menu )
|
||||
{
|
||||
protected void fillContextMenu( IMenuManager menu ) {
|
||||
menu.add( new Separator( ICDebugUIConstants.EMPTY_MEMORY_GROUP ) );
|
||||
menu.add( new Separator( ICDebugUIConstants.MEMORY_GROUP ) );
|
||||
|
||||
menu.add( new Separator( ICDebugUIConstants.EMPTY_FORMAT_GROUP ) );
|
||||
menu.add( new Separator( ICDebugUIConstants.FORMAT_GROUP ) );
|
||||
|
||||
menu.add( new Separator( IDebugUIConstants.EMPTY_RENDER_GROUP ) );
|
||||
menu.add( new Separator( IDebugUIConstants.RENDER_GROUP ) );
|
||||
|
||||
menu.add( new Separator( IWorkbenchActionConstants.MB_ADDITIONS ) );
|
||||
|
||||
menu.appendToGroup( ICDebugUIConstants.MEMORY_GROUP, getAction( "AutoRefreshMemory" ) ); //$NON-NLS-1$
|
||||
menu.appendToGroup( ICDebugUIConstants.MEMORY_GROUP, getAction( "RefreshMemory" ) ); //$NON-NLS-1$
|
||||
menu.appendToGroup( ICDebugUIConstants.MEMORY_GROUP, getAction( "ClearMemory" ) ); //$NON-NLS-1$
|
||||
|
||||
MenuManager subMenu = new MenuManager( CDebugUIPlugin.getResourceString("MemoryView.Format") ); //$NON-NLS-1$
|
||||
MenuManager subMenu = new MenuManager( MemoryViewMessages.getString( "MemoryView.4" ) ); //$NON-NLS-1$
|
||||
{
|
||||
IAction[] actions = fMemoryFormatGroup.getActions();
|
||||
for ( int i = 0; i < actions.length; ++i )
|
||||
{
|
||||
for( int i = 0; i < actions.length; ++i ) {
|
||||
subMenu.add( actions[i] );
|
||||
}
|
||||
}
|
||||
menu.appendToGroup( ICDebugUIConstants.FORMAT_GROUP, subMenu );
|
||||
|
||||
subMenu = new MenuManager( CDebugUIPlugin.getResourceString("MemoryView.Memory_Unit_Size") ); //$NON-NLS-1$
|
||||
subMenu = new MenuManager( MemoryViewMessages.getString( "MemoryView.5" ) ); //$NON-NLS-1$
|
||||
{
|
||||
IAction[] actions = fMemorySizeGroup.getActions();
|
||||
for ( int i = 0; i < actions.length; ++i )
|
||||
{
|
||||
for( int i = 0; i < actions.length; ++i ) {
|
||||
subMenu.add( actions[i] );
|
||||
}
|
||||
}
|
||||
menu.appendToGroup( ICDebugUIConstants.FORMAT_GROUP, subMenu );
|
||||
|
||||
subMenu = new MenuManager( CDebugUIPlugin.getResourceString("MemoryView.Number_of_Columns") ); //$NON-NLS-1$
|
||||
subMenu = new MenuManager( MemoryViewMessages.getString( "MemoryView.6" ) ); //$NON-NLS-1$
|
||||
{
|
||||
IAction[] actions = fMemoryNumberOfColumnsGroup.getActions();
|
||||
for ( int i = 0; i < actions.length; ++i )
|
||||
{
|
||||
for( int i = 0; i < actions.length; ++i ) {
|
||||
subMenu.add( actions[i] );
|
||||
}
|
||||
}
|
||||
menu.appendToGroup( ICDebugUIConstants.FORMAT_GROUP, subMenu );
|
||||
|
||||
menu.appendToGroup( IDebugUIConstants.RENDER_GROUP, getAction( "ShowAscii" ) ); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.debug.ui.AbstractDebugView#configureToolBar(IToolBarManager)
|
||||
*/
|
||||
protected void configureToolBar( IToolBarManager tbm )
|
||||
{
|
||||
protected void configureToolBar( IToolBarManager tbm ) {
|
||||
tbm.add( new Separator( this.getClass().getName() ) );
|
||||
tbm.add( new Separator( ICDebugUIConstants.MEMORY_GROUP ) );
|
||||
tbm.add( getAction( "AutoRefreshMemory" ) ); //$NON-NLS-1$
|
||||
tbm.add( getAction( "RefreshMemory" ) ); //$NON-NLS-1$
|
||||
tbm.add( getAction( "ClearMemory" ) ); //$NON-NLS-1$
|
||||
|
||||
tbm.add( new Separator( IDebugUIConstants.RENDER_GROUP ) );
|
||||
tbm.add( getAction( "ShowAscii" ) ); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.ui.ISelectionListener#selectionChanged(IWorkbenchPart, ISelection)
|
||||
*/
|
||||
public void selectionChanged( IWorkbenchPart part, ISelection selection )
|
||||
{
|
||||
if ( selection instanceof IStructuredSelection )
|
||||
{
|
||||
public void selectionChanged( IWorkbenchPart part, ISelection selection ) {
|
||||
if ( selection instanceof IStructuredSelection ) {
|
||||
setViewerInput( (IStructuredSelection)selection );
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(PropertyChangeEvent)
|
||||
*/
|
||||
public void propertyChange( PropertyChangeEvent event )
|
||||
{
|
||||
((MemoryViewer)getViewer()).propertyChange( event );
|
||||
public void propertyChange( PropertyChangeEvent event ) {
|
||||
((MemoryViewer)getViewer()).propertyChange( event );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.cdt.debug.internal.ui.views.IDebugExceptionHandler#handleException(DebugException)
|
||||
*/
|
||||
public void handleException( DebugException e )
|
||||
{
|
||||
public void handleException( DebugException e ) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove myself as a selection listener and preference change
|
||||
* listener.
|
||||
*
|
||||
* Remove myself as a selection listener and preference change listener.
|
||||
*
|
||||
* @see IWorkbenchPart#dispose()
|
||||
*/
|
||||
public void dispose()
|
||||
{
|
||||
public void dispose() {
|
||||
removeActionGroup( fMemoryFormatGroup );
|
||||
fMemoryFormatGroup.dispose();
|
||||
removeActionGroup( fMemorySizeGroup );
|
||||
fMemorySizeGroup.dispose();
|
||||
removeActionGroup( fMemoryNumberOfColumnsGroup );
|
||||
fMemoryNumberOfColumnsGroup.dispose();
|
||||
|
||||
remove( (ShowAsciiAction)getAction( "ShowAscii" ) ); //$NON-NLS-1$
|
||||
remove( (ClearMemoryAction)getAction( "ClearMemory" ) ); //$NON-NLS-1$
|
||||
remove( (RefreshMemoryAction)getAction( "RefreshMemory" ) ); //$NON-NLS-1$
|
||||
remove( (AutoRefreshMemoryAction)getAction( "AutoRefreshMemory" ) ); //$NON-NLS-1$
|
||||
|
||||
getSite().getPage().removeSelectionListener( IDebugUIConstants.ID_DEBUG_VIEW, this );
|
||||
CDebugUIPlugin.getDefault().getPreferenceStore().removePropertyChangeListener( this );
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
protected void setViewerInput( IStructuredSelection ssel )
|
||||
{
|
||||
protected void setViewerInput( IStructuredSelection ssel ) {
|
||||
ICMemoryManager mm = null;
|
||||
if ( ssel != null && ssel.size() == 1 )
|
||||
{
|
||||
if ( ssel != null && ssel.size() == 1 ) {
|
||||
Object input = ssel.getFirstElement();
|
||||
if ( input instanceof IDebugElement )
|
||||
{
|
||||
if ( input instanceof IDebugElement ) {
|
||||
mm = (ICMemoryManager)((IDebugElement)input).getDebugTarget().getAdapter( ICMemoryManager.class );
|
||||
}
|
||||
}
|
||||
|
||||
Object current = getViewer().getInput();
|
||||
if ( current != null && current.equals( mm ) )
|
||||
{
|
||||
if ( current != null && current.equals( mm ) ) {
|
||||
return;
|
||||
}
|
||||
showViewer();
|
||||
getViewer().setInput( mm );
|
||||
updateObjects();
|
||||
}
|
||||
|
||||
private IContentProvider createContentProvider()
|
||||
{
|
||||
|
||||
private IContentProvider createContentProvider() {
|
||||
return new MemoryViewContentProvider();
|
||||
}
|
||||
|
||||
private IDebugModelPresentation getModelPresentation()
|
||||
{
|
||||
if ( fModelPresentation == null )
|
||||
{
|
||||
private IDebugModelPresentation getModelPresentation() {
|
||||
if ( fModelPresentation == null ) {
|
||||
fModelPresentation = CDebugUIPlugin.getDebugModelPresentation();
|
||||
}
|
||||
return fModelPresentation;
|
||||
|
@ -316,50 +286,42 @@ public class MemoryView extends AbstractDebugEventHandlerView
|
|||
/**
|
||||
* Creates this view's event handler.
|
||||
*
|
||||
* @param viewer the viewer associated with this view
|
||||
* @param viewer
|
||||
* the viewer associated with this view
|
||||
* @return an event handler
|
||||
*/
|
||||
protected AbstractDebugEventHandler createEventHandler( Viewer viewer )
|
||||
{
|
||||
protected AbstractDebugEventHandler createEventHandler( Viewer viewer ) {
|
||||
return new MemoryViewEventHandler( this );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the viewer input on creation
|
||||
*/
|
||||
protected void setInitialContent()
|
||||
{
|
||||
ISelection selection =
|
||||
getSite().getPage().getSelection( IDebugUIConstants.ID_DEBUG_VIEW );
|
||||
if ( selection instanceof IStructuredSelection && !selection.isEmpty() )
|
||||
{
|
||||
protected void setInitialContent() {
|
||||
ISelection selection = getSite().getPage().getSelection( IDebugUIConstants.ID_DEBUG_VIEW );
|
||||
if ( selection instanceof IStructuredSelection && !selection.isEmpty() ) {
|
||||
setViewerInput( (IStructuredSelection)selection );
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
setViewerInput( null );
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.debug.ui.AbstractDebugView#createContextMenu(Control)
|
||||
*/
|
||||
protected void createContextMenu( Control menuControl )
|
||||
{
|
||||
protected void createContextMenu( Control menuControl ) {
|
||||
CTabItem[] items = ((MemoryViewer)getViewer()).getTabFolder().getItems();
|
||||
for ( int i = 0; i < items.length; ++i )
|
||||
{
|
||||
for( int i = 0; i < items.length; ++i ) {
|
||||
super.createContextMenu( ((MemoryControlArea)items[i].getControl()).getMemoryText().getControl() );
|
||||
}
|
||||
}
|
||||
|
||||
private void createFormatActionGroup( MemoryActionSelectionGroup group )
|
||||
{
|
||||
int[] formats = new int[] { IFormattedMemoryBlock.MEMORY_FORMAT_HEX,
|
||||
IFormattedMemoryBlock.MEMORY_FORMAT_SIGNED_DECIMAL,
|
||||
IFormattedMemoryBlock.MEMORY_FORMAT_UNSIGNED_DECIMAL };
|
||||
for ( int i = 0; i < formats.length; ++i )
|
||||
{
|
||||
|
||||
private void createFormatActionGroup( MemoryActionSelectionGroup group ) {
|
||||
int[] formats = new int[]{ IFormattedMemoryBlock.MEMORY_FORMAT_HEX, IFormattedMemoryBlock.MEMORY_FORMAT_SIGNED_DECIMAL, IFormattedMemoryBlock.MEMORY_FORMAT_UNSIGNED_DECIMAL };
|
||||
for( int i = 0; i < formats.length; ++i ) {
|
||||
MemoryFormatAction action = new MemoryFormatAction( group, (MemoryViewer)getViewer(), formats[i] );
|
||||
action.setEnabled( false );
|
||||
setAction( action.getActionId(), action ); //$NON-NLS-1$
|
||||
|
@ -367,15 +329,10 @@ public class MemoryView extends AbstractDebugEventHandlerView
|
|||
group.addAction( action );
|
||||
}
|
||||
}
|
||||
|
||||
private void createSizeActionGroup( MemoryActionSelectionGroup group )
|
||||
{
|
||||
int[] ids = new int[] { IFormattedMemoryBlock.MEMORY_SIZE_BYTE,
|
||||
IFormattedMemoryBlock.MEMORY_SIZE_HALF_WORD,
|
||||
IFormattedMemoryBlock.MEMORY_SIZE_WORD,
|
||||
IFormattedMemoryBlock.MEMORY_SIZE_DOUBLE_WORD };
|
||||
for ( int i = 0; i < ids.length; ++i )
|
||||
{
|
||||
|
||||
private void createSizeActionGroup( MemoryActionSelectionGroup group ) {
|
||||
int[] ids = new int[]{ IFormattedMemoryBlock.MEMORY_SIZE_BYTE, IFormattedMemoryBlock.MEMORY_SIZE_HALF_WORD, IFormattedMemoryBlock.MEMORY_SIZE_WORD, IFormattedMemoryBlock.MEMORY_SIZE_DOUBLE_WORD };
|
||||
for( int i = 0; i < ids.length; ++i ) {
|
||||
MemorySizeAction action = new MemorySizeAction( group, (MemoryViewer)getViewer(), ids[i] );
|
||||
action.setEnabled( false );
|
||||
setAction( action.getActionId(), action ); //$NON-NLS-1$
|
||||
|
@ -383,16 +340,10 @@ public class MemoryView extends AbstractDebugEventHandlerView
|
|||
group.addAction( action );
|
||||
}
|
||||
}
|
||||
|
||||
private void createNumberOfColumnsActionGroup( MemoryActionSelectionGroup group )
|
||||
{
|
||||
int[] nocs = new int[] { IFormattedMemoryBlock.MEMORY_NUMBER_OF_COLUMNS_1,
|
||||
IFormattedMemoryBlock.MEMORY_NUMBER_OF_COLUMNS_2,
|
||||
IFormattedMemoryBlock.MEMORY_NUMBER_OF_COLUMNS_4,
|
||||
IFormattedMemoryBlock.MEMORY_NUMBER_OF_COLUMNS_8,
|
||||
IFormattedMemoryBlock.MEMORY_NUMBER_OF_COLUMNS_16 };
|
||||
for ( int i = 0; i < nocs.length; ++i )
|
||||
{
|
||||
|
||||
private void createNumberOfColumnsActionGroup( MemoryActionSelectionGroup group ) {
|
||||
int[] nocs = new int[]{ IFormattedMemoryBlock.MEMORY_NUMBER_OF_COLUMNS_1, IFormattedMemoryBlock.MEMORY_NUMBER_OF_COLUMNS_2, IFormattedMemoryBlock.MEMORY_NUMBER_OF_COLUMNS_4, IFormattedMemoryBlock.MEMORY_NUMBER_OF_COLUMNS_8, IFormattedMemoryBlock.MEMORY_NUMBER_OF_COLUMNS_16 };
|
||||
for( int i = 0; i < nocs.length; ++i ) {
|
||||
MemoryNumberOfColumnAction action = new MemoryNumberOfColumnAction( group, (MemoryViewer)getViewer(), nocs[i] );
|
||||
action.setEnabled( false );
|
||||
setAction( action.getActionId(), action ); //$NON-NLS-1$
|
||||
|
@ -400,32 +351,28 @@ public class MemoryView extends AbstractDebugEventHandlerView
|
|||
group.addAction( action );
|
||||
}
|
||||
}
|
||||
|
||||
private void removeActionGroup( MemoryActionSelectionGroup group )
|
||||
{
|
||||
|
||||
private void removeActionGroup( MemoryActionSelectionGroup group ) {
|
||||
IAction[] actions = group.getActions();
|
||||
for ( int i = 0; i < actions.length; ++i )
|
||||
{
|
||||
for( int i = 0; i < actions.length; ++i ) {
|
||||
remove( (IUpdate)actions[i] );
|
||||
}
|
||||
}
|
||||
|
||||
private void setGlobalAction( String actionId, MemoryViewAction action )
|
||||
{
|
||||
private void setGlobalAction( String actionId, MemoryViewAction action ) {
|
||||
add( action );
|
||||
getViewSite().getActionBars().setGlobalActionHandler( actionId, action );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
|
||||
*/
|
||||
public Object getAdapter( Class adapter )
|
||||
{
|
||||
if (ITextOperationTarget.class.equals( adapter ) )
|
||||
{
|
||||
public Object getAdapter( Class adapter ) {
|
||||
if ( ITextOperationTarget.class.equals( adapter ) ) {
|
||||
return ((MemoryViewer)getViewer()).getTextOperationTarget();
|
||||
}
|
||||
|
||||
return super.getAdapter(adapter);
|
||||
return super.getAdapter( adapter );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 QNX Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
***********************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.ui.views.memory;
|
||||
|
||||
import java.util.MissingResourceException;
|
||||
//import java.util.ResourceBundle;
|
||||
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
||||
|
||||
public class MemoryViewMessages {
|
||||
|
||||
// private static final String BUNDLE_NAME = "org.eclipse.cdt.debug.internal.ui.views.memory.MemoryViewMessages";//$NON-NLS-1$
|
||||
|
||||
// private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME );
|
||||
|
||||
private MemoryViewMessages() {
|
||||
}
|
||||
|
||||
public static String getString( String key ) {
|
||||
try {
|
||||
return CDebugUIPlugin.getResourceString( key );
|
||||
// return RESOURCE_BUNDLE.getString( key );
|
||||
}
|
||||
catch( MissingResourceException e ) {
|
||||
return '!' + key + '!';
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
MemoryViewer.0=Memory
|
||||
MemoryView.0=Cut
|
||||
MemoryView.1=Copy
|
||||
MemoryView.2=Paste
|
||||
MemoryView.3=Select All
|
||||
MemoryView.4=Format
|
||||
MemoryView.5=Memory Unit Size
|
||||
MemoryView.6=Number Of Columns
|
||||
MemoryControlArea.0=Address:
|
||||
MemoryControlArea.1=Evaluate
|
||||
MemoryControlArea.2=Evaluate expression to address
|
||||
MemoryControlArea.3=Unable to get the memory block.
|
||||
MemoryControlArea.4=Memory View
|
||||
MemoryControlArea.7=Unable to refresh the memory block.
|
||||
MemoryControlArea.8=Unable to get the memory block.
|
|
@ -1,8 +1,13 @@
|
|||
/*
|
||||
*(c) Copyright QNX Software Systems Ltd. 2002.
|
||||
* All Rights Reserved.
|
||||
/**********************************************************************
|
||||
* Copyright (c) 2004 QNX Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
*/
|
||||
* Contributors:
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
***********************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.ui.views.memory;
|
||||
|
||||
import org.eclipse.cdt.debug.core.model.IFormattedMemoryBlock;
|
||||
|
@ -20,41 +25,40 @@ import org.eclipse.swt.layout.GridData;
|
|||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
||||
|
||||
/**
|
||||
*
|
||||
* Memory viewer.
|
||||
*
|
||||
* @since Jul 24, 2002
|
||||
* The viewer of the Memory view.
|
||||
*/
|
||||
public class MemoryViewer extends ContentViewer
|
||||
{
|
||||
public class MemoryViewer extends ContentViewer {
|
||||
|
||||
static final private int NUMBER_OF_TABS = 4;
|
||||
|
||||
protected MemoryView fView = null;
|
||||
|
||||
protected MemoryView fView = null;
|
||||
|
||||
protected Composite fParent = null;
|
||||
|
||||
protected CTabFolder fTabFolder = null;
|
||||
|
||||
private Composite fControl = null;
|
||||
|
||||
private MemoryControlArea[] fMemoryControlAreas = new MemoryControlArea[NUMBER_OF_TABS];
|
||||
|
||||
/**
|
||||
* Constructor for MemoryViewer.
|
||||
*/
|
||||
public MemoryViewer( Composite parent, MemoryView view )
|
||||
{
|
||||
public MemoryViewer( Composite parent, MemoryView view ) {
|
||||
super();
|
||||
fParent = parent;
|
||||
fView = view;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.jface.viewers.Viewer#getControl()
|
||||
*/
|
||||
public Control getControl()
|
||||
{
|
||||
if ( fControl == null )
|
||||
{
|
||||
public Control getControl() {
|
||||
if ( fControl == null ) {
|
||||
fControl = new Composite( fParent, SWT.NONE );
|
||||
GridLayout layout = new GridLayout();
|
||||
layout.marginHeight = 0;
|
||||
|
@ -63,227 +67,190 @@ public class MemoryViewer extends ContentViewer
|
|||
fControl.setLayoutData( new GridData( GridData.FILL_BOTH ) );
|
||||
fTabFolder = new CTabFolder( fControl, SWT.TOP );
|
||||
fTabFolder.setLayoutData( new GridData( GridData.FILL_BOTH | GridData.GRAB_VERTICAL ) );
|
||||
for ( int i = 0; i < NUMBER_OF_TABS; ++i )
|
||||
{
|
||||
for( int i = 0; i < NUMBER_OF_TABS; ++i ) {
|
||||
CTabItem tabItem = new CTabItem( fTabFolder, SWT.NONE );
|
||||
tabItem.setText( CDebugUIPlugin.getResourceString("MemoryViewer.Memory") + (i + 1) ); //$NON-NLS-1$
|
||||
tabItem.setText( MemoryViewMessages.getString( "MemoryViewer.0" ) + ' ' + (i + 1) ); //$NON-NLS-1$
|
||||
fMemoryControlAreas[i] = new MemoryControlArea( fTabFolder, SWT.NONE, i, fView );
|
||||
tabItem.setControl( fMemoryControlAreas[i] );
|
||||
tabItem.setControl( fMemoryControlAreas[i] );
|
||||
}
|
||||
fTabFolder.addSelectionListener( new SelectionListener()
|
||||
{
|
||||
public void widgetSelected( SelectionEvent e )
|
||||
{
|
||||
fView.updateObjects();
|
||||
}
|
||||
|
||||
public void widgetDefaultSelected( SelectionEvent e )
|
||||
{
|
||||
fView.updateObjects();
|
||||
}
|
||||
} );
|
||||
fTabFolder.setSelection( 0 );
|
||||
fTabFolder.addSelectionListener( new SelectionListener() {
|
||||
|
||||
public void widgetSelected( SelectionEvent e ) {
|
||||
fView.updateObjects();
|
||||
}
|
||||
|
||||
public void widgetDefaultSelected( SelectionEvent e ) {
|
||||
fView.updateObjects();
|
||||
}
|
||||
} );
|
||||
fTabFolder.setSelection( 0 );
|
||||
}
|
||||
return fControl;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.jface.viewers.ISelectionProvider#getSelection()
|
||||
*/
|
||||
public ISelection getSelection()
|
||||
{
|
||||
public ISelection getSelection() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.jface.viewers.Viewer#refresh()
|
||||
*/
|
||||
public void refresh()
|
||||
{
|
||||
if ( fTabFolder != null )
|
||||
{
|
||||
public void refresh() {
|
||||
if ( fTabFolder != null ) {
|
||||
CTabItem[] tabItems = fTabFolder.getItems();
|
||||
for ( int i = 0; i < tabItems.length; ++i )
|
||||
for( int i = 0; i < tabItems.length; ++i )
|
||||
if ( tabItems[i].getControl() instanceof MemoryControlArea )
|
||||
((MemoryControlArea)tabItems[i].getControl()).refresh();
|
||||
}
|
||||
}
|
||||
|
||||
public void refresh( Object element )
|
||||
{
|
||||
if ( element instanceof IFormattedMemoryBlock )
|
||||
{
|
||||
public void refresh( Object element ) {
|
||||
if ( element instanceof IFormattedMemoryBlock ) {
|
||||
MemoryControlArea mca = getMemoryControlArea( (IFormattedMemoryBlock)element );
|
||||
if ( mca != null )
|
||||
{
|
||||
if ( mca != null ) {
|
||||
mca.refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void remove( Object element )
|
||||
{
|
||||
if ( element instanceof IFormattedMemoryBlock )
|
||||
{
|
||||
public void remove( Object element ) {
|
||||
if ( element instanceof IFormattedMemoryBlock ) {
|
||||
MemoryControlArea mca = getMemoryControlArea( (IFormattedMemoryBlock)element );
|
||||
if ( mca != null )
|
||||
{
|
||||
if ( mca != null ) {
|
||||
mca.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.jface.viewers.Viewer#setSelection(ISelection, boolean)
|
||||
*/
|
||||
public void setSelection( ISelection selection, boolean reveal )
|
||||
{
|
||||
public void setSelection( ISelection selection, boolean reveal ) {
|
||||
}
|
||||
|
||||
public void propertyChange( PropertyChangeEvent event )
|
||||
{
|
||||
if ( fTabFolder != null )
|
||||
{
|
||||
public void propertyChange( PropertyChangeEvent event ) {
|
||||
if ( fTabFolder != null ) {
|
||||
CTabItem[] tabItems = fTabFolder.getItems();
|
||||
for ( int i = 0; i < tabItems.length; ++i )
|
||||
for( int i = 0; i < tabItems.length; ++i )
|
||||
if ( tabItems[i].getControl() instanceof MemoryControlArea )
|
||||
((MemoryControlArea)tabItems[i].getControl()).propertyChange( event );
|
||||
}
|
||||
}
|
||||
|
||||
protected void inputChanged( Object input, Object oldInput )
|
||||
{
|
||||
for ( int i = 0; i < fMemoryControlAreas.length; ++i )
|
||||
|
||||
protected void inputChanged( Object input, Object oldInput ) {
|
||||
for( int i = 0; i < fMemoryControlAreas.length; ++i )
|
||||
fMemoryControlAreas[i].setInput( input );
|
||||
}
|
||||
|
||||
protected CTabFolder getTabFolder()
|
||||
{
|
||||
|
||||
protected CTabFolder getTabFolder() {
|
||||
return fTabFolder;
|
||||
}
|
||||
|
||||
private MemoryControlArea getMemoryControlArea( IFormattedMemoryBlock block )
|
||||
{
|
||||
|
||||
private MemoryControlArea getMemoryControlArea( IFormattedMemoryBlock block ) {
|
||||
CTabItem[] tabItems = fTabFolder.getItems();
|
||||
for ( int i = 0; i < tabItems.length; ++i )
|
||||
{
|
||||
if ( tabItems[i].getControl() instanceof MemoryControlArea &&
|
||||
block != null &&
|
||||
block.equals( ((MemoryControlArea)tabItems[i].getControl()).getMemoryBlock() ) )
|
||||
{
|
||||
return (MemoryControlArea)tabItems[i].getControl();
|
||||
}
|
||||
for( int i = 0; i < tabItems.length; ++i ) {
|
||||
if ( tabItems[i].getControl() instanceof MemoryControlArea && block != null && block.equals( ((MemoryControlArea)tabItems[i].getControl()).getMemoryBlock() ) ) {
|
||||
return (MemoryControlArea)tabItems[i].getControl();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean canChangeFormat( int format )
|
||||
{
|
||||
|
||||
public boolean canChangeFormat( int format ) {
|
||||
IFormattedMemoryBlock block = ((MemoryControlArea)fTabFolder.getSelection().getControl()).getMemoryBlock();
|
||||
return ( block != null && block.canChangeFormat( format ) );
|
||||
return (block != null && block.canChangeFormat( format ));
|
||||
}
|
||||
|
||||
public boolean canUpdate()
|
||||
{
|
||||
return ( ((MemoryControlArea)fTabFolder.getSelection().getControl()).getMemoryBlock() != null );
|
||||
|
||||
public boolean canUpdate() {
|
||||
return (((MemoryControlArea)fTabFolder.getSelection().getControl()).getMemoryBlock() != null);
|
||||
}
|
||||
|
||||
public boolean canSave()
|
||||
{
|
||||
return ( ((MemoryControlArea)fTabFolder.getSelection().getControl()).getMemoryBlock() != null );
|
||||
|
||||
public boolean canSave() {
|
||||
return (((MemoryControlArea)fTabFolder.getSelection().getControl()).getMemoryBlock() != null);
|
||||
}
|
||||
|
||||
public boolean isFrozen()
|
||||
{
|
||||
|
||||
public boolean isFrozen() {
|
||||
IFormattedMemoryBlock block = ((MemoryControlArea)fTabFolder.getSelection().getControl()).getMemoryBlock();
|
||||
return ( block != null ) ? block.isFrozen() : true;
|
||||
return (block != null) ? block.isFrozen() : true;
|
||||
}
|
||||
|
||||
public void setFrozen( boolean frozen )
|
||||
{
|
||||
|
||||
public void setFrozen( boolean frozen ) {
|
||||
IFormattedMemoryBlock block = ((MemoryControlArea)fTabFolder.getSelection().getControl()).getMemoryBlock();
|
||||
if ( block != null )
|
||||
{
|
||||
if ( block != null ) {
|
||||
block.setFrozen( frozen );
|
||||
}
|
||||
}
|
||||
|
||||
public void clear()
|
||||
{
|
||||
|
||||
public void clear() {
|
||||
((MemoryControlArea)fTabFolder.getSelection().getControl()).clear();
|
||||
}
|
||||
|
||||
public void refreshMemoryBlock()
|
||||
{
|
||||
public void refreshMemoryBlock() {
|
||||
((MemoryControlArea)fTabFolder.getSelection().getControl()).refreshMemoryBlock();
|
||||
}
|
||||
|
||||
public boolean showAscii()
|
||||
{
|
||||
|
||||
public boolean showAscii() {
|
||||
return ((MemoryControlArea)fTabFolder.getSelection().getControl()).getPresentation().displayASCII();
|
||||
}
|
||||
|
||||
public void setShowAscii( boolean show )
|
||||
{
|
||||
|
||||
public void setShowAscii( boolean show ) {
|
||||
((MemoryControlArea)fTabFolder.getSelection().getControl()).getPresentation().setDisplayAscii( show );
|
||||
((MemoryControlArea)fTabFolder.getSelection().getControl()).refresh();
|
||||
}
|
||||
|
||||
public boolean canShowAscii()
|
||||
{
|
||||
|
||||
public boolean canShowAscii() {
|
||||
return ((MemoryControlArea)fTabFolder.getSelection().getControl()).getPresentation().canDisplayAscii();
|
||||
}
|
||||
|
||||
public int getCurrentFormat()
|
||||
{
|
||||
|
||||
public int getCurrentFormat() {
|
||||
IFormattedMemoryBlock block = ((MemoryControlArea)fTabFolder.getSelection().getControl()).getMemoryBlock();
|
||||
return ( block != null ) ? block.getFormat() : 0;
|
||||
return (block != null) ? block.getFormat() : 0;
|
||||
}
|
||||
|
||||
public void setFormat( int format ) throws DebugException
|
||||
{
|
||||
|
||||
public void setFormat( int format ) throws DebugException {
|
||||
IFormattedMemoryBlock block = ((MemoryControlArea)fTabFolder.getSelection().getControl()).getMemoryBlock();
|
||||
if ( block != null )
|
||||
{
|
||||
if ( block != null ) {
|
||||
block.reformat( format, block.getWordSize(), block.getNumberOfRows(), block.getNumberOfColumns() );
|
||||
((MemoryControlArea)fTabFolder.getSelection().getControl()).refresh();
|
||||
}
|
||||
}
|
||||
|
||||
public int getCurrentWordSize()
|
||||
{
|
||||
|
||||
public int getCurrentWordSize() {
|
||||
IFormattedMemoryBlock block = ((MemoryControlArea)fTabFolder.getSelection().getControl()).getMemoryBlock();
|
||||
return ( block != null ) ? block.getWordSize() : 0;
|
||||
return (block != null) ? block.getWordSize() : 0;
|
||||
}
|
||||
|
||||
public void setWordSize( int size ) throws DebugException
|
||||
{
|
||||
|
||||
public void setWordSize( int size ) throws DebugException {
|
||||
IFormattedMemoryBlock block = ((MemoryControlArea)fTabFolder.getSelection().getControl()).getMemoryBlock();
|
||||
if ( block != null )
|
||||
{
|
||||
if ( block != null ) {
|
||||
block.reformat( block.getFormat(), size, block.getNumberOfRows(), block.getNumberOfColumns() );
|
||||
((MemoryControlArea)fTabFolder.getSelection().getControl()).refresh();
|
||||
}
|
||||
}
|
||||
|
||||
public int getCurrentNumberOfColumns()
|
||||
{
|
||||
|
||||
public int getCurrentNumberOfColumns() {
|
||||
IFormattedMemoryBlock block = ((MemoryControlArea)fTabFolder.getSelection().getControl()).getMemoryBlock();
|
||||
return ( block != null ) ? block.getNumberOfColumns() : 0;
|
||||
return (block != null) ? block.getNumberOfColumns() : 0;
|
||||
}
|
||||
|
||||
public void setNumberOfColumns( int numberOfColumns ) throws DebugException
|
||||
{
|
||||
|
||||
public void setNumberOfColumns( int numberOfColumns ) throws DebugException {
|
||||
IFormattedMemoryBlock block = ((MemoryControlArea)fTabFolder.getSelection().getControl()).getMemoryBlock();
|
||||
if ( block != null )
|
||||
{
|
||||
if ( block != null ) {
|
||||
block.reformat( block.getFormat(), block.getWordSize(), block.getNumberOfRows(), numberOfColumns );
|
||||
((MemoryControlArea)fTabFolder.getSelection().getControl()).refresh();
|
||||
}
|
||||
}
|
||||
|
||||
protected ITextOperationTarget getTextOperationTarget()
|
||||
{
|
||||
|
||||
protected ITextOperationTarget getTextOperationTarget() {
|
||||
return (MemoryControlArea)fTabFolder.getSelection().getControl();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -12,20 +12,22 @@
|
|||
package org.eclipse.cdt.debug.internal.ui.views.sharedlibs;
|
||||
|
||||
import java.util.MissingResourceException;
|
||||
import java.util.ResourceBundle;
|
||||
//import java.util.ResourceBundle;
|
||||
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
||||
|
||||
public class SharedLibrariesMessages {
|
||||
|
||||
private static final String BUNDLE_NAME = "org.eclipse.cdt.debug.internal.ui.views.sharedlibs.SharedLibrariesMessages"; //$NON-NLS-1$
|
||||
// private static final String BUNDLE_NAME = "org.eclipse.cdt.debug.internal.ui.views.sharedlibs.SharedLibrariesMessages"; //$NON-NLS-1$
|
||||
|
||||
private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
|
||||
// private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
|
||||
|
||||
private SharedLibrariesMessages() {
|
||||
}
|
||||
|
||||
public static String getString( String key ) {
|
||||
try {
|
||||
return RESOURCE_BUNDLE.getString( key );
|
||||
return CDebugUIPlugin.getResourceString( key );
|
||||
// return RESOURCE_BUNDLE.getString( key );
|
||||
}
|
||||
catch (MissingResourceException e) {
|
||||
return '!' + key + '!';
|
||||
|
|
|
@ -49,8 +49,6 @@ import org.eclipse.ui.IWorkbenchPart;
|
|||
|
||||
/**
|
||||
* Displays shared libraries.
|
||||
*
|
||||
* @since: Jan 21, 2003
|
||||
*/
|
||||
public class SharedLibrariesView extends AbstractDebugEventHandlerView
|
||||
implements ISelectionListener,
|
||||
|
|
|
@ -11,20 +11,22 @@
|
|||
package org.eclipse.cdt.debug.internal.ui.views.signals;
|
||||
|
||||
import java.util.MissingResourceException;
|
||||
import java.util.ResourceBundle;
|
||||
//import java.util.ResourceBundle;
|
||||
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
||||
|
||||
public class SignalsMessages {
|
||||
|
||||
private static final String BUNDLE_NAME = "org.eclipse.cdt.debug.internal.ui.views.signals.SignalsMessages";//$NON-NLS-1$
|
||||
// private static final String BUNDLE_NAME = "org.eclipse.cdt.debug.internal.ui.views.signals.SignalsMessages";//$NON-NLS-1$
|
||||
|
||||
private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME );
|
||||
// private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME );
|
||||
|
||||
private SignalsMessages() {
|
||||
}
|
||||
|
||||
public static String getString( String key ) {
|
||||
try {
|
||||
return RESOURCE_BUNDLE.getString( key );
|
||||
return CDebugUIPlugin.getResourceString( key );
|
||||
// return RESOURCE_BUNDLE.getString( key );
|
||||
} catch( MissingResourceException e ) {
|
||||
return '!' + key + '!';
|
||||
}
|
||||
|
|
|
@ -24,7 +24,6 @@ import org.eclipse.swt.events.ModifyListener;
|
|||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
||||
|
||||
/**
|
||||
* The wizard to add a file system directory based source location to the source locator.
|
||||
|
@ -89,7 +88,7 @@ public class AddDirectorySourceLocationWizard extends Wizard implements INewSour
|
|||
setErrorMessage( null );
|
||||
String dirText = fAttachBlock.getLocationPath();
|
||||
if ( dirText.length() == 0 ) {
|
||||
setErrorMessage( CDebugUIPlugin.getResourceString( "internal.ui.wizards.AddDirectorySourceLocationWizard.ErrorDirectoryEmpty" ) ); //$NON-NLS-1$
|
||||
setErrorMessage( WizardMessages.getString( "AddDirectorySourceLocationWizard.6" ) ); //$NON-NLS-1$
|
||||
complete = false;
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -11,24 +11,22 @@
|
|||
package org.eclipse.cdt.debug.internal.ui.wizards;
|
||||
|
||||
import java.util.MissingResourceException;
|
||||
import java.util.ResourceBundle;
|
||||
//import java.util.ResourceBundle;
|
||||
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
||||
|
||||
/**
|
||||
* Comment for .
|
||||
*/
|
||||
public class WizardMessages {
|
||||
|
||||
private static final String BUNDLE_NAME = "org.eclipse.cdt.debug.internal.ui.wizards.WizardMessages";//$NON-NLS-1$
|
||||
// private static final String BUNDLE_NAME = "org.eclipse.cdt.debug.internal.ui.wizards.WizardMessages";//$NON-NLS-1$
|
||||
|
||||
private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME );
|
||||
// private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME );
|
||||
|
||||
private WizardMessages() {
|
||||
}
|
||||
|
||||
public static String getString( String key ) {
|
||||
// TODO Auto-generated method stub
|
||||
try {
|
||||
return RESOURCE_BUNDLE.getString( key );
|
||||
return CDebugUIPlugin.getResourceString( key );
|
||||
// return RESOURCE_BUNDLE.getString( key );
|
||||
}
|
||||
catch( MissingResourceException e ) {
|
||||
return '!' + key + '!';
|
||||
|
|
|
@ -8,6 +8,7 @@ AddDirectorySourceLocationWizard.2=Add a local file system directory to the sour
|
|||
AddDirectorySourceLocationWizard.3=Directory does not exist.
|
||||
AddDirectorySourceLocationWizard.4=Directory path must be absolute.
|
||||
AddDirectorySourceLocationWizard.5=Add a local file system directory to the source locations list.
|
||||
AddDirectorySourceLocationWizard.6=Directory must not be empty.
|
||||
AddDirectorySourceLocationBlock.0=Select location directory:
|
||||
AddDirectorySourceLocationBlock.1=&Browse...
|
||||
AddDirectorySourceLocationBlock.2=Select Location Directory
|
||||
|
|
|
@ -221,7 +221,7 @@ public class CDebugUIPlugin extends AbstractUIPlugin implements ISelectionListen
|
|||
log( status );
|
||||
Shell shell = getActiveWorkbenchShell();
|
||||
if ( shell != null ) {
|
||||
ErrorDialog.openError( shell, CDebugUIPlugin.getResourceString( "ui.CDebugUIPlugin.Error" ), message, status ); //$NON-NLS-1$
|
||||
ErrorDialog.openError( shell, UIMessages.getString( "CDebugUIPlugin.0" ), message, status ); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -230,7 +230,7 @@ public class CDebugUIPlugin extends AbstractUIPlugin implements ISelectionListen
|
|||
Shell shell = getActiveWorkbenchShell();
|
||||
if ( shell != null ) {
|
||||
IStatus status = new Status( IStatus.ERROR, getUniqueIdentifier(), ICDebugUIConstants.INTERNAL_ERROR, t.getMessage(), null ); //$NON-NLS-1$
|
||||
ErrorDialog.openError( shell, CDebugUIPlugin.getResourceString( "ui.CDebugUIPlugin.Error" ), message, status ); //$NON-NLS-1$
|
||||
ErrorDialog.openError( shell, UIMessages.getString( "CDebugUIPlugin.0" ), message, status ); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,76 +1,268 @@
|
|||
ui.sourcelookup.SourceListDialogField.yes=yes
|
||||
ui.sourcelookup.SourceListDialogField.no=no
|
||||
ui.sourcelookup.SourceListDialogField.Add=Add...
|
||||
ui.sourcelookup.SourceListDialogField.Up=Up
|
||||
ui.sourcelookup.SourceListDialogField.Down=Down
|
||||
ui.sourcelookup.SourceListDialogField.Remove=Remove
|
||||
ui.sourcelookup.SourceListDialogField.Location=Location
|
||||
ui.sourcelookup.SourceListDialogField.Association=Association
|
||||
ui.sourcelookup.SourceListDialogField.Search_subfolders=Search subfolders
|
||||
ui.sourcelookup.SourcePropertyPage.Terminated=Terminated.
|
||||
ui.sourcelookup.SourceLookupBlock.Select_All=Select All
|
||||
ui.sourcelookup.SourceLookupBlock.Deselect_All=Deselect All
|
||||
ui.sourcelookup.SourceLookupBlock.Generic_Source_Locations=Generic Source Locations
|
||||
ui.sourcelookup.SourceLookupBlock.Additional_Source_Locations=Additional Source Locations
|
||||
ui.sourcelookup.SourceLookupBlock.Search_for_dup_src_files=Search for duplicate source files
|
||||
ui.sourcelookup.DefaultSourceLocator.Always_map_to_selection=Always map to the selection
|
||||
ui.sourcelookup.DefaultSourceLocator.Unable_to_create_memento_for_src_location=Unable to create memento for C/C++ source locator.
|
||||
ui.sourcelookup.DefaultSourceLocator.Unable_to_restore_prompting_src_locator=Unable to restore prompting source locator - invalid format.
|
||||
ui.sourcelookup.DefaultSourceLocator.Unable_to_restore_prompting_src_locator_project_not_found=Unable to restore prompting source locator - project {0} not found.
|
||||
ui.sourcelookup.DefaultSourceLocator.Exception_initializing_src_locator=Exception occurred initializing source locator.
|
||||
ui.sourcelookup.DefaultSourceLocator.Selection_needed=Selection needed
|
||||
ui.sourcelookup.DefaultSourceLocator.Select_file_associated_with_stack_frame=Debugger has found multiple files with the same name.\nPlease select one associated with the selected stack frame.
|
||||
ui.sourcelookup.DefaultSourceLocator.Project_does_not_exist=Project "{0}" does not exist.
|
||||
MemoryViewer.Memory=Memory
|
||||
MemoryControlArea.Address=Address:
|
||||
MemoryControlArea.Evaluate=Evaluate
|
||||
MemoryControlArea.Evaluate_Expression=Evaluate expression to address
|
||||
MemoryControlArea.Error_memoryBlock=Unable to get memory block.
|
||||
MemoryControlArea.Memory_view=Memory View
|
||||
MemoryControlArea.Error_memoryRefresh=Unable to refresh memory.
|
||||
MemoryView.Cut=Cut
|
||||
MemoryView.Copy=Copy
|
||||
MemoryView.Paste=Paste
|
||||
MemoryView.Select_All=Select All
|
||||
MemoryView.Format=Format
|
||||
MemoryView.Memory_Unit_Size=Memory Unit Size
|
||||
MemoryView.Number_of_Columns=Number Of Columns
|
||||
RegistersView.Auto_Refresh=Auto-Refresh
|
||||
RegistersView.Automatically_Refresh_Registers_View=Automatically Refresh Registers View
|
||||
RegistersView.Refresh_Registers_View=Refresh Registers View
|
||||
RegistersView.Refresh=Refresh
|
||||
SharedLibrariesView.Name=Name
|
||||
SharedLibrariesView.Start_Address=Start Address
|
||||
SharedLibrariesView.End_Address=End Address
|
||||
SharedLibrariesView.Refresh_Shared_Libraries_View=Refresh Shared Libraries View
|
||||
SignalsViewer.yes=yes
|
||||
SignalsViewer.no=no
|
||||
SignalsViewer.Name=Name
|
||||
SignalsViewer.Pass=Pass
|
||||
SignalsViewer.Suspend=Suspend
|
||||
SignalsViewer.Description=Description
|
||||
internal.ui.CDTDebugModelPresentation.terminated=<terminated>
|
||||
internal.ui.CDTDebugModelPresentation.disconnected=<disconnected>
|
||||
internal.ui.CDTDebugModelPresentation.not_responding=<not_responding>
|
||||
internal.ui.CDTDebugModelPresentation.Exited=\ (Exited
|
||||
internal.ui.CDTDebugModelPresentation.Signal_received_Description=: Signal ''{0}'' received. Description: {1}.
|
||||
internal.ui.CDTDebugModelPresentation.Exit_code=. Exit code =
|
||||
internal.ui.CDTDebugModelPresentation.closeBracket=)
|
||||
internal.ui.CDTDebugModelPresentation.Suspended=\ (Suspended
|
||||
internal.ui.CDTDebugModelPresentation.Thread_threadName_suspended=Thread [{0}] (Suspended)
|
||||
internal.ui.CDTDebugModelPresentation.Thread_name=Thread [{0}]
|
||||
internal.ui.CDTDebugModelPresentation.threadName_Terminated={0} (Terminated)
|
||||
internal.ui.CDTDebugModelPresentation.threadName_Stepping={0} (Stepping)
|
||||
internal.ui.CDTDebugModelPresentation.threadName_Running={0} (Running)
|
||||
internal.ui.CDTDebugModelPresentation.Thread_threadName_suspended=Thread [{0}] (Suspended)
|
||||
internal.ui.CDTDebugModelPresentation.Symbol_not_available=<symbol is not available>
|
||||
internal.ui.CDTDebugModelPresentation.disabled=\ (disabled)
|
||||
internal.ui.CDTDebugModelPresentation.Infinity=Infinity
|
||||
internal.ui.CDTDebugModelPresentation.line=\ [line: {0}]
|
||||
internal.ui.CDTDebugModelPresentation.function=\ [function: {0}]
|
||||
internal.ui.CDTDebugModelPresentation.address=\ [address: {0}]
|
||||
internal.ui.CDTDebugModelPresentation.ignore_count=\ [ignore count: {0}]
|
||||
internal.ui.CDTDebugModelPresentation.if=if
|
||||
internal.ui.CDTDebugModelPresentation.at=at
|
||||
internal.ui.CDebugImageDescriptorRegistry.Allocating_image_for_wrong_display=Allocating image for wrong display
|
||||
ui.CDebugUIPlugin.Error=Error
|
||||
CDebugModelPresentation.unknown_1=unknown
|
||||
CDebugImageDescriptorRegistry.0=Allocating image for wrong display.
|
||||
CDebugModelPresentation.not_available_1=<not available>
|
||||
CDTDebugModelPresentation.0=<terminated>
|
||||
CDTDebugModelPresentation.1=<disconnected>
|
||||
CDTDebugModelPresentation.2=<not_responding>
|
||||
CDTDebugModelPresentation.3={0} (Exited.{1})
|
||||
CDTDebugModelPresentation.5=Signal ''{0}'' received. Description: {1}.
|
||||
CDTDebugModelPresentation.6=Exit code = {0}.
|
||||
CDTDebugModelPresentation.7={0} (Suspended)
|
||||
CDTDebugModelPresentation.8=Thread [{0}]
|
||||
CDTDebugModelPresentation.9=Thread [{0}] (Terminated)
|
||||
CDTDebugModelPresentation.10=Thread [{0}] (Stepping)
|
||||
CDTDebugModelPresentation.11=Thread [{0}] (Running)
|
||||
CDTDebugModelPresentation.13=: Signal ''{0}'' received. Description: {1}.
|
||||
CDTDebugModelPresentation.14=: Watchpoint triggered. Old value: ''{0}''. New value: ''{1}''.
|
||||
CDTDebugModelPresentation.15=: Watchpoint is out of scope.
|
||||
CDTDebugModelPresentation.16=: Breakpoint hit.
|
||||
CDTDebugModelPresentation.17=: Shared library event.
|
||||
CDTDebugModelPresentation.18=Thread [{0}] (Suspended{1})
|
||||
CDTDebugModelPresentation.19=Thread [{0}]
|
||||
CDTDebugModelPresentation.20=at
|
||||
CDTDebugModelPresentation.21=<symbol is not available>
|
||||
CDTDebugModelPresentation.22=(disabled)
|
||||
CDTDebugModelPresentation.23=Infinity
|
||||
CDTDebugModelPresentation.24=-Infinity
|
||||
CDTDebugModelPresentation.25=(disabled)
|
||||
CDTDebugModelPresentation.26=[line: {0}]
|
||||
CDTDebugModelPresentation.27=[address: {0}]
|
||||
CDTDebugModelPresentation.28=[function: {0}]
|
||||
CDTDebugModelPresentation.29=[ignore count: {0}]
|
||||
CDTDebugModelPresentation.30=if
|
||||
CDTDebugModelPresentation.31=at
|
||||
LoadSymbolsActionDelegate.Unable_to_load_symbols_of_shared_library_1=Unable to load symbols of shared library.
|
||||
LoadSymbolsActionDelegate.Operation_failed_1=Operation failed.
|
||||
LoadSymbolsForAllAction.Load_Symbols_For_All_1=Load Symbols For All
|
||||
LoadSymbolsForAllAction.Load_symbols_for_all_shared_libraries_1=Load symbols for all shared libraries.
|
||||
LoadSymbolsForAllActionDelegate.Error(s)_occurred_loading_the_symbols_1=Error(s) occurred loading the symbols.
|
||||
LoadSymbolsForAllAction.Load_Symbols_For_All_2=Load Symbols For All
|
||||
LoadSymbolsForAllActionDelegate.Error_1=Error
|
||||
LoadSymbolsForAllAction.Unable_to_load_symbols_1=Unable to load symbols.
|
||||
SignalPropertiesDialog.Title_1=Properties for signal ''{0}''
|
||||
SignalPropertiesDialog.Description_label_1=Signal description: {0}.
|
||||
SignalPropertiesDialog.Stop_label_1=Suspend the program when this signal happens.
|
||||
SignalPropertiesDialog.Pass_label_1=Pass this signal to the program.
|
||||
SignalZeroWorkbenchActionDelegate.0=Exceptions occurred attempting to resume without signal.
|
||||
SignalZeroWorkbenchActionDelegate.1=Resume without signal failed.
|
||||
SignalZeroWorkbenchActionDelegate.2=Resume Without Signal
|
||||
SignalZeroObjectActionDelegate.0=Unable to resume ignoring the signal.
|
||||
SignalZeroObjectActionDelegate.1=Operation failed.
|
||||
SignalPropertiesActionDelegate.Unable_to_change_signal_properties_1=Unable to change signal properties.
|
||||
SignalPropertiesActionDelegate.Operation_failed_1=Operation failed.
|
||||
RunToLineActionDelegate.Error_1=Error
|
||||
RunToLineActionDelegate.Operation_failed_1=Operation failed.
|
||||
RunToLineAdapter.Empty_editor_1=Empty editor
|
||||
RunToLineAdapter.Missing_document_1=Missing document
|
||||
ToggleBreakpointAdapter.Empty_editor_1=Empty editor
|
||||
ToggleBreakpointAdapter.Missing_document_1=Missing document
|
||||
ToggleBreakpointAdapter.Missing_resource_1=Missing resource
|
||||
ToggleBreakpointAdapter.Invalid_line_1=Invalid line
|
||||
ToggleBreakpointAdapter.Empty_editor_2=Empty editor
|
||||
ToggleWatchpointActionDelegate.Error_1=Error
|
||||
ToggleBreakpointAdapter.Missing_document_2=Missing document
|
||||
ToggleBreakpointAdapter.Missing_resource_2=Missing resource
|
||||
ToggleBreakpointAdapter.Invalid_expression_1=Invalid expression:
|
||||
RunToLineAdapter.Operation_is_not_supported_1=Operation is not supported.
|
||||
EnableDisableBreakpointRulerAction.Enable_Breakpoint_1=&Enable Breakpoint
|
||||
EnableDisableBreakpointRulerAction.Enabling_disabling_breakpoints_1=Enabling/disabling breakpoints
|
||||
EnableDisableBreakpointRulerAction.Exceptions_occurred_enabling_or_disabling_breakpoint_1=Exceptions occurred enabling or disabling the breakpoint
|
||||
EnableDisableBreakpointRulerAction.Disable_Breakpoint_1=&Disable Breakpoint
|
||||
ToggleBreakpointRulerAction.Toggle_Breakpoint_1=Toggle &Breakpoint
|
||||
ToggleWatchpointActionDelegate.Operation_failed_1=Operation failed.
|
||||
ToggleBreakpointRulerAction.Error_1=Error
|
||||
ToggleBreakpointRulerAction.Operation_failed_1=Operation failed
|
||||
CBreakpointPropertiesRulerAction.Breakpoint_Properties=Breakpoint &Properties...
|
||||
ResumeAtLineActionDelegate.Error_1=Error
|
||||
RestoreDefaultTypeActionDelegate.0=Unable to restore the default type.
|
||||
ResumeAtLineActionDelegate.Operation_failed_1=Operation failed.
|
||||
ResumeAtLineActionDelegate.Missing_document=Missing document
|
||||
ResumeAtLineActionDelegate.Empty_editor_1=Empty editor
|
||||
ResumeAtLineActionDelegate.Operation_is_not_supported_1=Operation is not supported
|
||||
AddGlobalsActionDelegate.Error(s)_occured_adding_globals_1=Error(s) occured adding globals.
|
||||
AbstractRefreshActionDelegate.Error_1=Error
|
||||
AbstractRefreshActionDelegate.Error(s)_occurred_refreshing_the_view_1=Error(s) occurred refreshing the view.
|
||||
ManageFunctionBreakpointActionDelegate.Error_1=Error
|
||||
ManageFunctionBreakpointActionDelegate.Operation_failed_1=Operation failed.
|
||||
SignalActionDelegate.0=Unable to deliver the signal to the target.
|
||||
SignalActionDelegate.1=Operation failed.
|
||||
AutoRefreshMemoryAction.0=Auto-Refresh
|
||||
AutoRefreshMemoryAction.1=Turns on/off the auto-refresh mode.
|
||||
AutoRefreshMemoryAction.2=Auto-Refresh Mode
|
||||
RestartActionDelegate.0=Exception(s) occurred attempting to restart.
|
||||
RestartActionDelegate.1=Restart failed.
|
||||
RestartActionDelegate.2=Restart
|
||||
ShowAsciiAction.0=Show ASCII
|
||||
ShowAsciiAction.1=Displays the ASCII presentation of the memory.
|
||||
ShowAsciiAction.2=Show the ASCII presentation
|
||||
AddGlobalsActionDelegate.0=Select Variables:
|
||||
AddGlobalsActionDelegate.1=Add global variables failed.
|
||||
VariableFormatActionDelegate.0=Unable to set format.
|
||||
ExpressionDialog.0=Add Watch Expression
|
||||
ExpressionDialog.1=Expression to watch:
|
||||
CastToTypeActionDelegate.0=The 'Type' field must not be empty.
|
||||
CastToTypeActionDelegate.1=Cast To Type
|
||||
CastToTypeActionDelegate.2=Enter type:
|
||||
CastToTypeActionDelegate.3=Unable to cast to type.
|
||||
CastToArrayActionDelegate.0=Display As Array
|
||||
CastToArrayActionDelegate.1=Start index:
|
||||
CastToArrayActionDelegate.2=Length
|
||||
CastToArrayActionDelegate.3=The 'First index' field must not be empty.
|
||||
CastToArrayActionDelegate.4=Invalid first index.
|
||||
CastToArrayActionDelegate.5=The 'Last index' field must not be empty.
|
||||
CastToArrayActionDelegate.6=Invalid last index.
|
||||
CastToArrayActionDelegate.7=The length must be greater than 0.
|
||||
CastToArrayActionDelegate.8=Unable to display this variable as an array.
|
||||
EnableVariablesActionDelegate.0=Exceptions occurred enabling the variable(s).
|
||||
EnableVariablesActionDelegate.1=Enable variable(s) failed.
|
||||
MemorySizeAction.0={0, number, integer} {0, choice, 1\#byte|2\#bytes}
|
||||
MemorySizeAction.1=Unable to change memory unit size.
|
||||
MemoryFormatAction.0=Unable to change the format.
|
||||
MemoryFormatAction.1=Hexadecimal
|
||||
MemoryFormatAction.2=Signed_Decimal
|
||||
MemoryFormatAction.3=Unsigned_Decimal
|
||||
MemoryNumberOfColumnAction.0={0, number, integer} {0, choice, 0\#columns|1\#column|2\#columns}
|
||||
MemoryNumberOfColumnAction.1=Unable to change the column number.
|
||||
CBreakpointPreferencePage.0=Ignore count must be a positive integer
|
||||
CBreakpointPreferencePage.1=Not available
|
||||
CBreakpointPreferencePage.2=Function name:
|
||||
CBreakpointPreferencePage.3=C/C++ Function Breakpoint Properties
|
||||
CBreakpointPreferencePage.4=Not available
|
||||
CBreakpointPreferencePage.5=Address:
|
||||
CBreakpointPreferencePage.6=C/C++ Address Breakpoint Properties
|
||||
CBreakpointPreferencePage.7=File:
|
||||
CBreakpointPreferencePage.8=C/C++ Line Breakpoint Properties
|
||||
CBreakpointPreferencePage.9=Line_Number:
|
||||
CBreakpointPreferencePage.10=Project:
|
||||
CBreakpointPreferencePage.11=C/C++ Read Watchpoint Properties
|
||||
CBreakpointPreferencePage.12=C/C++ Watchpoint Properties
|
||||
CBreakpointPreferencePage.13=C/C++ Access Watchpoint Properties
|
||||
CBreakpointPreferencePage.14=Expression To Watch:
|
||||
CBreakpointPreferencePage.15=&Condition
|
||||
CBreakpointPreferencePage.16=Invalid_condition.
|
||||
CBreakpointPreferencePage.17=&Ignore Count:
|
||||
AddWatchpointActionDelegate.0=Cannot add watchpoint.
|
||||
AddWatchpointDialog.0=Add Watchpoint
|
||||
AddWatchpointDialog.1=Expression to watch:
|
||||
AddWatchpointDialog.2=Access
|
||||
AddWatchpointDialog.3=Write
|
||||
AddWatchpointDialog.4=Read
|
||||
ClearMemoryAction.0=Clear
|
||||
ClearMemoryAction.1=Clears the current memory block
|
||||
ClearMemoryAction.2=Clear
|
||||
RefreshMemoryAction.0=Refreshs the current memory block.
|
||||
RefreshMemoryAction.1=Refresh
|
||||
MemoryViewer.0=Memory
|
||||
MemoryView.0=Cut
|
||||
MemoryView.1=Copy
|
||||
MemoryView.2=Paste
|
||||
MemoryView.3=Select All
|
||||
MemoryView.4=Format
|
||||
MemoryView.5=Memory Unit Size
|
||||
MemoryView.6=Number Of Columns
|
||||
MemoryControlArea.0=Address:
|
||||
MemoryControlArea.1=Evaluate
|
||||
MemoryControlArea.2=Evaluate expression to address
|
||||
MemoryControlArea.3=Unable to get the memory block.
|
||||
MemoryControlArea.4=Memory View
|
||||
MemoryControlArea.7=Unable to refresh the memory block.
|
||||
MemoryControlArea.8=Unable to get the memory block.
|
||||
SharedLibrariesView.Name_1=Name
|
||||
SharedLibrariesView.Start_Address_1=Start Address
|
||||
SharedLibrariesView.End_Address_1=End Address
|
||||
SharedLibrariesView.Loaded_1=Loaded
|
||||
SharedLibrariesView.Not_loaded_1=Not loaded
|
||||
SharedLibrariesView.Symbols_1=Symbols
|
||||
SignalsViewer.4=Name
|
||||
SignalsViewer.5=Pass
|
||||
SignalsViewer.6=Suspend
|
||||
SignalsViewer.7=Description
|
||||
SignalsViewer.8=yes
|
||||
SignalsViewer.9=no
|
||||
CDebugEditor.0=C/C++ File Editor
|
||||
CDebugEditor.1=Source not found
|
||||
CDebugEditor.2=You can attach a new source location by pressing the button below.
|
||||
CDebugEditor.3=&Attach Source...
|
||||
CDebugEditor.4=Can not find the file ''{0}'' in the specified source locations.
|
||||
CDebugPreferencePage.Color_of_disassembly_source_lines_1=Color of source lines:
|
||||
CDebugPreferencePage.0=Natural
|
||||
CDebugPreferencePage.1=Hexadecimal
|
||||
CDebugPreferencePage.2=Decimal
|
||||
CDebugPreferencePage.3=General settings for C/C++ Debugging.
|
||||
CDebugPreferencePage.4=Opened view default settings
|
||||
CDebugPreferencePage.5=Show full &paths
|
||||
CDebugPreferencePage.6=Automatically refresh registers
|
||||
CDebugPreferencePage.7=Automatically refresh shared libraries
|
||||
CDebugPreferencePage.8=Default variable format:
|
||||
CDebugPreferencePage.9=Default expression format:
|
||||
CDebugPreferencePage.10=Default register format:
|
||||
CDebugPreferencePage.11=Disassembly options
|
||||
CDebugPreferencePage.12=Maximum number of displayed instructions:
|
||||
CDebugPreferencePage.13=The valid value range is [{0},{1}].
|
||||
SourcePreferencePage.0=Common source lookup settings.
|
||||
SourcePreferencePage.1=Source Locations
|
||||
SourcePreferencePage.2=Search for duplicate source files
|
||||
MemoryViewPreferencePage.0=The Memory view settings.
|
||||
MemoryViewPreferencePage.1=Text Color:
|
||||
MemoryViewPreferencePage.2=Background Color:
|
||||
MemoryViewPreferencePage.3=Address Color:
|
||||
MemoryViewPreferencePage.4=Changed Value Color:
|
||||
MemoryViewPreferencePage.5=Font:
|
||||
MemoryViewPreferencePage.6=Padding Character:
|
||||
MemoryViewPreferencePage.7=Auto-Refresh by default
|
||||
MemoryViewPreferencePage.8=Show ASCII by default
|
||||
DisassemblyDocumentProvider.Pending_1=Pending...
|
||||
DisassemblyInstructionPointerAnnotation.Current_Pointer_1=Current Disassembly Instruction Pointer
|
||||
DisassemblyInstructionPointerAnnotation.Secondary_Pointer_1=Secondary Disassembly Instruction Pointer
|
||||
DisassemblyAnnotationHover.Multiple_markers_at_this_line_1=Multiple markers at this line
|
||||
HTMLTextPresenter.ellipsis=
|
||||
HTML2TextReader.dash=-
|
||||
DisassemblyEditorInput.source_line_is_not_available_1=<source line is not available>
|
||||
AddProjectSourceLocationWizard.0=Select Project
|
||||
AddProjectSourceLocationWizard.1=Add Project Source Location
|
||||
AddProjectSourceLocationWizard.2=Add an existing workspace project to the source locations list.
|
||||
AddProjectSourceLocationWizard.3=Add an existing project to the source locations list.
|
||||
AddDirectorySourceLocationWizard.0=Select Directory
|
||||
AddDirectorySourceLocationWizard.1=Add Directory Source Location
|
||||
AddDirectorySourceLocationWizard.2=Add a local file system directory to the source locations list.
|
||||
AddDirectorySourceLocationWizard.3=Directory does not exist.
|
||||
AddDirectorySourceLocationWizard.4=Directory path must be absolute.
|
||||
AddDirectorySourceLocationWizard.5=Add a local file system directory to the source locations list.
|
||||
AddDirectorySourceLocationWizard.6=Directory must not be empty.
|
||||
AddDirectorySourceLocationBlock.0=Select location directory:
|
||||
AddDirectorySourceLocationBlock.1=&Browse...
|
||||
AddDirectorySourceLocationBlock.2=Select Location Directory
|
||||
AddDirectorySourceLocationBlock.3=&Associate with
|
||||
AddDirectorySourceLocationBlock.4=Search sub&folders
|
||||
AddSourceLocationWizard.0=Add Source Location
|
||||
SourceLocationSelectionPage.0=Add Source Location
|
||||
SourceLocationSelectionPage.1=Select
|
||||
SourceLocationSelectionPage.2=Select source location type:
|
||||
SourceLocationSelectionPage.3=Existing Project Into Workspace
|
||||
SourceLocationSelectionPage.4=File System Directory
|
||||
CDebugUIPlugin.0=Error
|
||||
SourceListDialogField.0=yes
|
||||
SourceListDialogField.1=no
|
||||
SourceListDialogField.2=Add...
|
||||
SourceListDialogField.3=Up
|
||||
SourceListDialogField.4=Down
|
||||
SourceListDialogField.5=Remove
|
||||
SourceListDialogField.6=Location
|
||||
SourceListDialogField.7=Association
|
||||
SourceListDialogField.8=Search subfolders
|
||||
SourcePropertyPage.0=Terminated.
|
||||
SourceLookupBlock.0=Select All
|
||||
SourceLookupBlock.1=Deselect All
|
||||
SourceLookupBlock.2=Generic Source Locations
|
||||
SourceLookupBlock.3=Additional Source Locations
|
||||
SourceLookupBlock.4=Search for duplicate source files
|
||||
DefaultSourceLocator.0=Always map to the selection
|
||||
DefaultSourceLocator.1=Unable to create memento for C/C++ source locator.
|
||||
DefaultSourceLocator.2=Unable to restore prompting source locator - invalid format.
|
||||
DefaultSourceLocator.3=Unable to restore prompting source locator - invalid format.
|
||||
DefaultSourceLocator.4=Unable to restore prompting source locator - project {0} not found.
|
||||
DefaultSourceLocator.5=Unable to restore prompting source locator - invalid format.
|
||||
DefaultSourceLocator.6=Exception occurred initializing source locator.
|
||||
DefaultSourceLocator.7=Selection needed
|
||||
DefaultSourceLocator.8=Debugger has found multiple files with the same name.\nPlease select one associated with the selected stack frame.
|
||||
DefaultSourceLocator.9=Project ''{0}'' does not exist.
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 QNX Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
***********************************************************************/
|
||||
package org.eclipse.cdt.debug.ui;
|
||||
|
||||
import java.util.MissingResourceException;
|
||||
//import java.util.ResourceBundle;
|
||||
|
||||
public class UIMessages {
|
||||
|
||||
// private static final String BUNDLE_NAME = "org.eclipse.cdt.debug.ui.UIMessages";//$NON-NLS-1$
|
||||
|
||||
// private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME );
|
||||
|
||||
private UIMessages() {
|
||||
}
|
||||
|
||||
public static String getString( String key ) {
|
||||
try {
|
||||
return CDebugUIPlugin.getResourceString( key );
|
||||
// return RESOURCE_BUNDLE.getString( key );
|
||||
}
|
||||
catch( MissingResourceException e ) {
|
||||
return '!' + key + '!';
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
CDebugUIPlugin.0=Error
|
|
@ -1,9 +1,13 @@
|
|||
/*
|
||||
*(c) Copyright QNX Software Systems Ltd. 2002.
|
||||
* All Rights Reserved.
|
||||
/**********************************************************************
|
||||
* Copyright (c) 2004 QNX Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
*/
|
||||
|
||||
* Contributors:
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
***********************************************************************/
|
||||
package org.eclipse.cdt.debug.ui.sourcelookup;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -54,60 +58,54 @@ import org.xml.sax.InputSource;
|
|||
import org.xml.sax.SAXException;
|
||||
|
||||
/**
|
||||
* Enter type comment.
|
||||
*
|
||||
* @since Oct 24, 2003
|
||||
* Default source locator.
|
||||
*/
|
||||
public class DefaultSourceLocator implements IPersistableSourceLocator, IAdaptable
|
||||
{
|
||||
public class SourceSelectionDialog extends ListDialog
|
||||
{
|
||||
public class DefaultSourceLocator implements IPersistableSourceLocator, IAdaptable {
|
||||
|
||||
public class SourceSelectionDialog extends ListDialog {
|
||||
|
||||
private SelectionButtonDialogField fAlwaysUseThisFileButton = new SelectionButtonDialogField( SWT.CHECK );
|
||||
|
||||
public SourceSelectionDialog( Shell parent )
|
||||
{
|
||||
public SourceSelectionDialog( Shell parent ) {
|
||||
super( parent );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.ui.dialogs.ListDialog#createDialogArea(org.eclipse.swt.widgets.Composite)
|
||||
*/
|
||||
protected Control createDialogArea( Composite parent )
|
||||
{
|
||||
protected Control createDialogArea( Composite parent ) {
|
||||
Composite comp = ControlFactory.createComposite( parent, 1 );
|
||||
super.createDialogArea( comp );
|
||||
Composite comp1 = ControlFactory.createComposite( comp, 1 );
|
||||
fAlwaysUseThisFileButton.setLabelText( CDebugUIPlugin.getResourceString("ui.sourcelookup.DefaultSourceLocator.Always_map_to_selection") ); //$NON-NLS-1$
|
||||
fAlwaysUseThisFileButton.setLabelText( SourceLookupMessages.getString( "DefaultSourceLocator.0" ) ); //$NON-NLS-1$
|
||||
fAlwaysUseThisFileButton.doFillIntoGrid( comp1, 1 );
|
||||
return comp;
|
||||
}
|
||||
|
||||
public boolean alwaysMapToSelection()
|
||||
{
|
||||
public boolean alwaysMapToSelection() {
|
||||
return fAlwaysUseThisFileButton.isSelected();
|
||||
}
|
||||
}
|
||||
|
||||
public class SourceElementLabelProvider extends LabelProvider
|
||||
{
|
||||
public class SourceElementLabelProvider extends LabelProvider {
|
||||
|
||||
protected CDebugImageDescriptorRegistry fDebugImageRegistry = CDebugUIPlugin.getImageDescriptorRegistry();
|
||||
|
||||
public SourceElementLabelProvider()
|
||||
{
|
||||
public SourceElementLabelProvider() {
|
||||
super();
|
||||
}
|
||||
|
||||
public String getText(Object element)
|
||||
{
|
||||
public String getText( Object element ) {
|
||||
if ( element instanceof IFile )
|
||||
return ((IFile)element).getFullPath().toString();
|
||||
if ( element instanceof FileStorage )
|
||||
return ((FileStorage)element).getFullPath().toOSString();
|
||||
return super.getText(element);
|
||||
return super.getText( element );
|
||||
}
|
||||
|
||||
public Image getImage( Object element )
|
||||
{
|
||||
public Image getImage( Object element ) {
|
||||
if ( element instanceof IFile )
|
||||
return fDebugImageRegistry.get( CDebugImages.DESC_OBJS_WORKSPACE_SOURCE_FILE );
|
||||
if ( element instanceof FileStorage )
|
||||
|
@ -117,15 +115,17 @@ public class DefaultSourceLocator implements IPersistableSourceLocator, IAdaptab
|
|||
}
|
||||
|
||||
/**
|
||||
* Identifier for the 'Default C/C++ Source Locator' extension
|
||||
* (value <code>"org.eclipse.cdt.debug.ui.DefaultSourceLocator"</code>).
|
||||
* Identifier for the 'Default C/C++ Source Locator' extension (value <code>"org.eclipse.cdt.debug.ui.DefaultSourceLocator"</code>).
|
||||
*/
|
||||
public static final String ID_DEFAULT_SOURCE_LOCATOR = CDebugUIPlugin.getUniqueIdentifier() + ".DefaultSourceLocator"; //$NON-NLS-1$
|
||||
|
||||
// to support old configurations
|
||||
public static final String ID_OLD_DEFAULT_SOURCE_LOCATOR = "org.eclipse.cdt.launch" + ".DefaultSourceLocator"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
||||
private static final String ELEMENT_NAME = "PromptingSourceLocator"; //$NON-NLS-1$
|
||||
|
||||
private static final String ATTR_PROJECT = "project"; //$NON-NLS-1$
|
||||
|
||||
private static final String ATTR_MEMENTO = "memento"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
|
@ -134,76 +134,67 @@ public class DefaultSourceLocator implements IPersistableSourceLocator, IAdaptab
|
|||
private ICSourceLocator fSourceLocator;
|
||||
|
||||
private HashMap fFramesToSource = null;
|
||||
|
||||
private HashMap fNamesToSource = null;
|
||||
|
||||
public DefaultSourceLocator()
|
||||
{
|
||||
public DefaultSourceLocator() {
|
||||
super();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.debug.core.model.IPersistableSourceLocator#getMemento()
|
||||
*/
|
||||
public String getMemento() throws CoreException
|
||||
{
|
||||
if ( getCSourceLocator() != null )
|
||||
{
|
||||
Document document = null;
|
||||
Throwable ex = null;
|
||||
try
|
||||
{
|
||||
document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
|
||||
Element element = document.createElement( ELEMENT_NAME );
|
||||
document.appendChild( element );
|
||||
public String getMemento() throws CoreException {
|
||||
if ( getCSourceLocator() != null ) {
|
||||
Document document = null;
|
||||
Throwable ex = null;
|
||||
try {
|
||||
document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
|
||||
Element element = document.createElement( ELEMENT_NAME );
|
||||
document.appendChild( element );
|
||||
element.setAttribute( ATTR_PROJECT, getCSourceLocator().getProject().getName() );
|
||||
IPersistableSourceLocator psl = getPersistableSourceLocator();
|
||||
if ( psl != null )
|
||||
{
|
||||
if ( psl != null ) {
|
||||
element.setAttribute( ATTR_MEMENTO, psl.getMemento() );
|
||||
}
|
||||
return CDebugUtils.serializeDocument( document );
|
||||
}
|
||||
catch( ParserConfigurationException e )
|
||||
{
|
||||
ex = e;
|
||||
}
|
||||
catch( IOException e )
|
||||
{
|
||||
}
|
||||
catch( ParserConfigurationException e ) {
|
||||
ex = e;
|
||||
}
|
||||
catch( TransformerException e )
|
||||
{
|
||||
catch( IOException e ) {
|
||||
ex = e;
|
||||
}
|
||||
abort( CDebugUIPlugin.getResourceString( "ui.sourcelookup.DefaultSourceLocator.Unable_to_create_memento_for_src_location" ), ex ); //$NON-NLS-1$
|
||||
catch( TransformerException e ) {
|
||||
ex = e;
|
||||
}
|
||||
abort( SourceLookupMessages.getString( "DefaultSourceLocator.1" ), ex ); //$NON-NLS-1$
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.debug.core.model.IPersistableSourceLocator#initializeFromMemento(java.lang.String)
|
||||
*/
|
||||
public void initializeFromMemento( String memento ) throws CoreException
|
||||
{
|
||||
public void initializeFromMemento( String memento ) throws CoreException {
|
||||
Exception ex = null;
|
||||
try
|
||||
{
|
||||
try {
|
||||
Element root = null;
|
||||
DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
|
||||
StringReader reader = new StringReader( memento );
|
||||
InputSource source = new InputSource( reader );
|
||||
root = parser.parse( source ).getDocumentElement();
|
||||
|
||||
if ( !root.getNodeName().equalsIgnoreCase( ELEMENT_NAME ) )
|
||||
{
|
||||
abort( CDebugUIPlugin.getResourceString("ui.sourcelookup.DefaultSourceLocator.Unable_to_restore_prompting_src_locator"), null ); //$NON-NLS-1$
|
||||
if ( !root.getNodeName().equalsIgnoreCase( ELEMENT_NAME ) ) {
|
||||
abort( SourceLookupMessages.getString( "DefaultSourceLocator.2" ), null ); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
String projectName = root.getAttribute( ATTR_PROJECT );
|
||||
String data = root.getAttribute( ATTR_MEMENTO );
|
||||
if ( isEmpty( projectName ) )
|
||||
{
|
||||
abort( CDebugUIPlugin.getResourceString("ui.sourcelookup.DefaultSourceLocator.Unable_to_restore_prompting_src_locator"), null ); //$NON-NLS-1$
|
||||
if ( isEmpty( projectName ) ) {
|
||||
abort( SourceLookupMessages.getString( "DefaultSourceLocator.3" ), null ); //$NON-NLS-1$
|
||||
}
|
||||
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject( projectName );
|
||||
if ( getCSourceLocator() == null )
|
||||
|
@ -211,78 +202,71 @@ public class DefaultSourceLocator implements IPersistableSourceLocator, IAdaptab
|
|||
if ( getCSourceLocator().getProject() != null && !getCSourceLocator().getProject().equals( project ) )
|
||||
return;
|
||||
if ( project == null || !project.exists() || !project.isOpen() )
|
||||
abort( MessageFormat.format( CDebugUIPlugin.getResourceString("ui.sourcelookup.DefaultSourceLocator.Unable_to_restore_prompting_src_locator_project_not_found"), new String[] { projectName } ), null ); //$NON-NLS-1$
|
||||
|
||||
abort( MessageFormat.format( SourceLookupMessages.getString( "DefaultSourceLocator.4" ), new String[]{ projectName } ), null ); //$NON-NLS-1$
|
||||
IPersistableSourceLocator psl = getPersistableSourceLocator();
|
||||
if ( psl != null )
|
||||
psl.initializeFromMemento( data );
|
||||
else
|
||||
abort( CDebugUIPlugin.getResourceString("ui.sourcelookup.DefaultSourceLocator.Unable_to_restore_prompting_src_locator_project_not_found"), null ); //$NON-NLS-1$
|
||||
abort( SourceLookupMessages.getString( "DefaultSourceLocator.5" ), null ); //$NON-NLS-1$
|
||||
return;
|
||||
}
|
||||
catch( ParserConfigurationException e )
|
||||
{
|
||||
catch( ParserConfigurationException e ) {
|
||||
ex = e;
|
||||
}
|
||||
catch( SAXException e )
|
||||
{
|
||||
catch( SAXException e ) {
|
||||
ex = e;
|
||||
}
|
||||
catch( IOException e )
|
||||
{
|
||||
catch( IOException e ) {
|
||||
ex = e;
|
||||
}
|
||||
abort( CDebugUIPlugin.getResourceString("ui.sourcelookup.DefaultSourceLocator.Exception_initializing_src_locator"), ex ); //$NON-NLS-1$
|
||||
abort( SourceLookupMessages.getString( "DefaultSourceLocator.6" ), ex ); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.debug.core.model.IPersistableSourceLocator#initializeDefaults(org.eclipse.debug.core.ILaunchConfiguration)
|
||||
*/
|
||||
public void initializeDefaults( ILaunchConfiguration configuration ) throws CoreException
|
||||
{
|
||||
public void initializeDefaults( ILaunchConfiguration configuration ) throws CoreException {
|
||||
setCSourceLocator( SourceLookupFactory.createSourceLocator( getProject( configuration ) ) );
|
||||
String memento = configuration.getAttribute( ILaunchConfiguration.ATTR_SOURCE_LOCATOR_MEMENTO, "" ); //$NON-NLS-1$
|
||||
if ( !isEmpty( memento ) )
|
||||
initializeFromMemento( memento );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
|
||||
*/
|
||||
public Object getAdapter( Class adapter )
|
||||
{
|
||||
if ( getCSourceLocator() instanceof IAdaptable )
|
||||
{
|
||||
if ( adapter.equals( ICSourceLocator.class ) )
|
||||
{
|
||||
public Object getAdapter( Class adapter ) {
|
||||
if ( getCSourceLocator() instanceof IAdaptable ) {
|
||||
if ( adapter.equals( ICSourceLocator.class ) ) {
|
||||
return ((IAdaptable)getCSourceLocator()).getAdapter( adapter );
|
||||
}
|
||||
if ( adapter.equals( IResourceChangeListener.class ) )
|
||||
{
|
||||
if ( adapter.equals( IResourceChangeListener.class ) ) {
|
||||
return ((IAdaptable)getCSourceLocator()).getAdapter( adapter );
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.debug.core.model.ISourceLocator#getSourceElement(org.eclipse.debug.core.model.IStackFrame)
|
||||
*/
|
||||
public Object getSourceElement( IStackFrame stackFrame )
|
||||
{
|
||||
public Object getSourceElement( IStackFrame stackFrame ) {
|
||||
Object res = cacheLookup( stackFrame );
|
||||
if ( res == null )
|
||||
{
|
||||
if ( res == null ) {
|
||||
res = getCSourceLocator().getSourceElement( stackFrame );
|
||||
if ( res instanceof List )
|
||||
{
|
||||
if ( res instanceof List ) {
|
||||
List list = (List)res;
|
||||
if ( list.size() != 0 )
|
||||
{
|
||||
if ( list.size() != 0 ) {
|
||||
SourceSelectionDialog dialog = createSourceSelectionDialog( list );
|
||||
dialog.open();
|
||||
Object[] objs = dialog.getResult();
|
||||
res = ( objs != null && objs.length > 0 ) ? objs[0] : null;
|
||||
res = (objs != null && objs.length > 0) ? objs[0] : null;
|
||||
if ( res != null )
|
||||
cacheSourceElement( stackFrame, res, dialog.alwaysMapToSelection() );
|
||||
}
|
||||
|
@ -290,10 +274,8 @@ public class DefaultSourceLocator implements IPersistableSourceLocator, IAdaptab
|
|||
res = null;
|
||||
}
|
||||
}
|
||||
if ( res == null )
|
||||
{
|
||||
if ( stackFrame instanceof ICStackFrame && !isEmpty( ((ICStackFrame)stackFrame).getFile() ) )
|
||||
{
|
||||
if ( res == null ) {
|
||||
if ( stackFrame instanceof ICStackFrame && !isEmpty( ((ICStackFrame)stackFrame).getFile() ) ) {
|
||||
res = new FileNotFoundElement( stackFrame );
|
||||
}
|
||||
else // don't show in editor
|
||||
|
@ -304,68 +286,56 @@ public class DefaultSourceLocator implements IPersistableSourceLocator, IAdaptab
|
|||
return res;
|
||||
}
|
||||
|
||||
protected void saveChanges( ILaunchConfiguration configuration, IPersistableSourceLocator locator )
|
||||
{
|
||||
try
|
||||
{
|
||||
protected void saveChanges( ILaunchConfiguration configuration, IPersistableSourceLocator locator ) {
|
||||
try {
|
||||
ILaunchConfigurationWorkingCopy copy = configuration.copy( configuration.getName() );
|
||||
copy.setAttribute( ILaunchConfiguration.ATTR_SOURCE_LOCATOR_MEMENTO, locator.getMemento() );
|
||||
copy.doSave();
|
||||
}
|
||||
catch( CoreException e )
|
||||
{
|
||||
catch( CoreException e ) {
|
||||
CDebugUIPlugin.errorDialog( e.getMessage(), (IStatus)null );
|
||||
}
|
||||
}
|
||||
|
||||
private SourceSelectionDialog createSourceSelectionDialog( List list )
|
||||
{
|
||||
private SourceSelectionDialog createSourceSelectionDialog( List list ) {
|
||||
SourceSelectionDialog dialog = new SourceSelectionDialog( CDebugUIPlugin.getActiveWorkbenchShell() );
|
||||
dialog.setInput( list.toArray() );
|
||||
dialog.setContentProvider( new ArrayContentProvider() );
|
||||
dialog.setLabelProvider( new SourceElementLabelProvider() );
|
||||
dialog.setTitle( CDebugUIPlugin.getResourceString("ui.sourcelookup.DefaultSourceLocator.Selection_needed") ); //$NON-NLS-1$
|
||||
dialog.setMessage( CDebugUIPlugin.getResourceString("ui.sourcelookup.DefaultSourceLocator.Select_file_associated_with_stack_frame") ); //$NON-NLS-1$
|
||||
dialog.setInitialSelections( new Object[] { list.get( 0 ) } );
|
||||
dialog.setTitle( SourceLookupMessages.getString( "DefaultSourceLocator.7" ) ); //$NON-NLS-1$
|
||||
dialog.setMessage( SourceLookupMessages.getString( "DefaultSourceLocator.8" ) ); //$NON-NLS-1$
|
||||
dialog.setInitialSelections( new Object[]{ list.get( 0 ) } );
|
||||
return dialog;
|
||||
}
|
||||
|
||||
private void cacheSourceElement( IStackFrame frame, Object sourceElement, boolean alwaysMapToSelection )
|
||||
{
|
||||
if ( alwaysMapToSelection )
|
||||
{
|
||||
private void cacheSourceElement( IStackFrame frame, Object sourceElement, boolean alwaysMapToSelection ) {
|
||||
if ( alwaysMapToSelection ) {
|
||||
String name = getFileName( frame );
|
||||
if ( name != null )
|
||||
{
|
||||
if ( fNamesToSource == null )
|
||||
if ( name != null ) {
|
||||
if ( fNamesToSource == null )
|
||||
fNamesToSource = new HashMap();
|
||||
fNamesToSource.put( name, sourceElement );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( fFramesToSource == null )
|
||||
else {
|
||||
if ( fFramesToSource == null )
|
||||
fFramesToSource = new HashMap();
|
||||
fFramesToSource.put( frame, sourceElement );
|
||||
}
|
||||
}
|
||||
|
||||
private Object cacheLookup( IStackFrame frame )
|
||||
{
|
||||
private Object cacheLookup( IStackFrame frame ) {
|
||||
String name = getFileName( frame );
|
||||
if ( name != null && fNamesToSource != null )
|
||||
{
|
||||
if ( name != null && fNamesToSource != null ) {
|
||||
Object result = fNamesToSource.get( name );
|
||||
if ( result != null )
|
||||
return result;
|
||||
}
|
||||
return ( fFramesToSource != null ) ? fFramesToSource.get( frame ) : null;
|
||||
return (fFramesToSource != null) ? fFramesToSource.get( frame ) : null;
|
||||
}
|
||||
|
||||
private String getFileName( IStackFrame frame )
|
||||
{
|
||||
if ( frame instanceof ICStackFrame )
|
||||
{
|
||||
private String getFileName( IStackFrame frame ) {
|
||||
if ( frame instanceof ICStackFrame ) {
|
||||
String name = ((ICStackFrame)frame).getFile();
|
||||
if ( !isEmpty( name ) )
|
||||
return name.trim();
|
||||
|
@ -373,48 +343,40 @@ public class DefaultSourceLocator implements IPersistableSourceLocator, IAdaptab
|
|||
return null;
|
||||
}
|
||||
|
||||
private ICSourceLocator getCSourceLocator()
|
||||
{
|
||||
private ICSourceLocator getCSourceLocator() {
|
||||
return fSourceLocator;
|
||||
}
|
||||
|
||||
private void setCSourceLocator( ICSourceLocator locator )
|
||||
{
|
||||
private void setCSourceLocator( ICSourceLocator locator ) {
|
||||
fSourceLocator = locator;
|
||||
}
|
||||
|
||||
private IPersistableSourceLocator getPersistableSourceLocator()
|
||||
{
|
||||
|
||||
private IPersistableSourceLocator getPersistableSourceLocator() {
|
||||
ICSourceLocator sl = getCSourceLocator();
|
||||
return ( sl instanceof IPersistableSourceLocator ) ? (IPersistableSourceLocator)sl : null;
|
||||
return (sl instanceof IPersistableSourceLocator) ? (IPersistableSourceLocator)sl : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Throws an internal error exception
|
||||
*/
|
||||
private void abort( String message, Throwable e ) throws CoreException
|
||||
{
|
||||
private void abort( String message, Throwable e ) throws CoreException {
|
||||
IStatus s = new Status( IStatus.ERROR, CDebugUIPlugin.getUniqueIdentifier(), 0, message, e );
|
||||
throw new CoreException( s );
|
||||
}
|
||||
|
||||
private boolean isEmpty( String string )
|
||||
{
|
||||
private boolean isEmpty( String string ) {
|
||||
return string == null || string.trim().length() == 0;
|
||||
}
|
||||
|
||||
private IProject getProject( ILaunchConfiguration configuration ) throws CoreException
|
||||
{
|
||||
private IProject getProject( ILaunchConfiguration configuration ) throws CoreException {
|
||||
String projectName = configuration.getAttribute( ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, (String)null );
|
||||
if ( !isEmpty( projectName ) )
|
||||
{
|
||||
if ( !isEmpty( projectName ) ) {
|
||||
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject( projectName );
|
||||
if ( project.exists() )
|
||||
{
|
||||
if ( project.exists() ) {
|
||||
return project;
|
||||
}
|
||||
}
|
||||
abort( MessageFormat.format( CDebugUIPlugin.getResourceString("ui.sourcelookup.DefaultSourceLocator.Project_does_not_exist"), new String[] { projectName } ), null ); //$NON-NLS-1$
|
||||
abort( MessageFormat.format( SourceLookupMessages.getString( "DefaultSourceLocator.9" ), new String[]{ projectName } ), null ); //$NON-NLS-1$
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
/*
|
||||
*(c) Copyright QNX Software Systems Ltd. 2002.
|
||||
* All Rights Reserved.
|
||||
/***************************************************************************************************************************************************************
|
||||
* Copyright (c) 2004 QNX Software Systems and others. All rights reserved. This program and the accompanying materials are made available under the terms of
|
||||
* the Common Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
*/
|
||||
|
||||
* Contributors: QNX Software Systems - Initial API and implementation
|
||||
**************************************************************************************************************************************************************/
|
||||
package org.eclipse.cdt.debug.ui.sourcelookup;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Observable;
|
||||
import java.util.Observer;
|
||||
|
||||
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocation;
|
||||
import org.eclipse.cdt.debug.internal.core.sourcelookup.CDirectorySourceLocation;
|
||||
import org.eclipse.cdt.debug.internal.ui.dialogfields.IListAdapter;
|
||||
|
@ -28,187 +27,153 @@ import org.eclipse.swt.layout.GridData;
|
|||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Table;
|
||||
import org.eclipse.swt.widgets.TableColumn;
|
||||
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
||||
|
||||
public class SourceListDialogField extends ListDialogField {
|
||||
|
||||
public class SourceListDialogField extends ListDialogField
|
||||
{
|
||||
public class ObservableSourceList extends Observable
|
||||
{
|
||||
protected synchronized void setChanged()
|
||||
{
|
||||
public class ObservableSourceList extends Observable {
|
||||
|
||||
protected synchronized void setChanged() {
|
||||
super.setChanged();
|
||||
}
|
||||
}
|
||||
|
||||
// String constants
|
||||
protected static final String YES_VALUE = CDebugUIPlugin.getResourceString("ui.sourcelookup.SourceListDialogField.yes"); //$NON-NLS-1$
|
||||
protected static final String NO_VALUE = CDebugUIPlugin.getResourceString("ui.sourcelookup.SourceListDialogField.no"); //$NON-NLS-1$
|
||||
protected static final String YES_VALUE = SourceLookupMessages.getString( "SourceListDialogField.0" ); //$NON-NLS-1$
|
||||
|
||||
protected static final String NO_VALUE = SourceLookupMessages.getString( "SourceListDialogField.1" ); //$NON-NLS-1$
|
||||
|
||||
// Column properties
|
||||
private static final String CP_LOCATION = "location"; //$NON-NLS-1$
|
||||
|
||||
private static final String CP_ASSOCIATION = "association"; //$NON-NLS-1$
|
||||
|
||||
private static final String CP_SEARCH_SUBFOLDERS = "searchSubfolders"; //$NON-NLS-1$
|
||||
|
||||
|
||||
private ObservableSourceList fObservable = new ObservableSourceList();
|
||||
|
||||
public SourceListDialogField( String title, IListAdapter listAdapter )
|
||||
{
|
||||
super( listAdapter,
|
||||
new String[]
|
||||
{
|
||||
/* 0 */ CDebugUIPlugin.getResourceString("ui.sourcelookup.SourceListDialogField.Add"), //$NON-NLS-1$
|
||||
/* 1 */ null,
|
||||
/* 2 */ CDebugUIPlugin.getResourceString("ui.sourcelookup.SourceListDialogField.Up"), //$NON-NLS-1$
|
||||
/* 3 */ CDebugUIPlugin.getResourceString("ui.sourcelookup.SourceListDialogField.Down"), //$NON-NLS-1$
|
||||
/* 4 */ null,
|
||||
/* 5 */ CDebugUIPlugin.getResourceString("ui.sourcelookup.SourceListDialogField.Remove"), //$NON-NLS-1$
|
||||
},
|
||||
new SourceLookupLabelProvider() );
|
||||
public SourceListDialogField( String title, IListAdapter listAdapter ) {
|
||||
super( listAdapter, new String[]{
|
||||
/* 0 */SourceLookupMessages.getString( "SourceListDialogField.2" ), //$NON-NLS-1$
|
||||
/* 1 */null,
|
||||
/* 2 */SourceLookupMessages.getString( "SourceListDialogField.3" ), //$NON-NLS-1$
|
||||
/* 3 */SourceLookupMessages.getString( "SourceListDialogField.4" ), //$NON-NLS-1$
|
||||
/* 4 */null,
|
||||
/* 5 */SourceLookupMessages.getString( "SourceListDialogField.5" ) //$NON-NLS-1$
|
||||
}, new SourceLookupLabelProvider() );
|
||||
setUpButtonIndex( 2 );
|
||||
setDownButtonIndex( 3 );
|
||||
setRemoveButtonIndex( 5 );
|
||||
setLabelText( title );
|
||||
}
|
||||
|
||||
protected boolean managedButtonPressed( int index )
|
||||
{
|
||||
protected boolean managedButtonPressed( int index ) {
|
||||
super.managedButtonPressed( index );
|
||||
return false;
|
||||
}
|
||||
|
||||
protected TableViewer createTableViewer( Composite parent )
|
||||
{
|
||||
protected TableViewer createTableViewer( Composite parent ) {
|
||||
TableViewer viewer = super.createTableViewer( parent );
|
||||
Table table = viewer.getTable();
|
||||
|
||||
TableLayout tableLayout = new TableLayout();
|
||||
table.setLayout( tableLayout );
|
||||
|
||||
GridData gd = new GridData( GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL );
|
||||
gd.grabExcessVerticalSpace = true;
|
||||
gd.grabExcessHorizontalSpace = true;
|
||||
table.setLayoutData( gd );
|
||||
|
||||
table.setLinesVisible( true );
|
||||
table.setHeaderVisible( true );
|
||||
|
||||
table.setHeaderVisible( true );
|
||||
new TableColumn( table, SWT.NULL );
|
||||
tableLayout.addColumnData( new ColumnWeightData( 2, true ) );
|
||||
new TableColumn( table, SWT.NULL );
|
||||
tableLayout.addColumnData( new ColumnWeightData( 2, true ) );
|
||||
new TableColumn( table, SWT.NULL );
|
||||
tableLayout.addColumnData( new ColumnWeightData( 1, true ) );
|
||||
|
||||
TableColumn[] columns = table.getColumns();
|
||||
columns[0].setText( CDebugUIPlugin.getResourceString("ui.sourcelookup.SourceListDialogField.Location") ); //$NON-NLS-1$
|
||||
columns[1].setText( CDebugUIPlugin.getResourceString("ui.sourcelookup.SourceListDialogField.Association") ); //$NON-NLS-1$
|
||||
columns[2].setText( CDebugUIPlugin.getResourceString("ui.sourcelookup.SourceListDialogField.Search_subfolders") ); //$NON-NLS-1$
|
||||
|
||||
columns[0].setText( SourceLookupMessages.getString( "SourceListDialogField.6" ) ); //$NON-NLS-1$
|
||||
columns[1].setText( SourceLookupMessages.getString( "SourceListDialogField.7" ) ); //$NON-NLS-1$
|
||||
columns[2].setText( SourceLookupMessages.getString( "SourceListDialogField.8" ) ); //$NON-NLS-1$
|
||||
CellEditor textCellEditor = new TextCellEditor( table );
|
||||
CellEditor comboCellEditor = new ComboBoxCellEditor( table, new String[]{ YES_VALUE, NO_VALUE } );
|
||||
viewer.setCellEditors( new CellEditor[]{ null, textCellEditor, comboCellEditor } );
|
||||
viewer.setColumnProperties( new String[]{ CP_LOCATION, CP_ASSOCIATION, CP_SEARCH_SUBFOLDERS } );
|
||||
viewer.setCellModifier( createCellModifier() );
|
||||
|
||||
return viewer;
|
||||
}
|
||||
|
||||
private ICellModifier createCellModifier()
|
||||
{
|
||||
return new ICellModifier()
|
||||
{
|
||||
public boolean canModify( Object element, String property )
|
||||
{
|
||||
return ( element instanceof CDirectorySourceLocation && ( property.equals( CP_ASSOCIATION ) || property.equals( CP_SEARCH_SUBFOLDERS ) ) );
|
||||
}
|
||||
private ICellModifier createCellModifier() {
|
||||
return new ICellModifier() {
|
||||
|
||||
public Object getValue( Object element, String property )
|
||||
{
|
||||
if ( element instanceof CDirectorySourceLocation && property.equals( CP_ASSOCIATION ) )
|
||||
{
|
||||
return ( ((CDirectorySourceLocation)element).getAssociation() != null ) ?
|
||||
((CDirectorySourceLocation)element).getAssociation().toOSString() : ""; //$NON-NLS-1$
|
||||
}
|
||||
if ( element instanceof CDirectorySourceLocation && property.equals( CP_SEARCH_SUBFOLDERS ) )
|
||||
{
|
||||
return ( ((CDirectorySourceLocation)element).searchSubfolders() ) ? new Integer( 0 ) : new Integer( 1 );
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public boolean canModify( Object element, String property ) {
|
||||
return (element instanceof CDirectorySourceLocation && (property.equals( CP_ASSOCIATION ) || property.equals( CP_SEARCH_SUBFOLDERS )));
|
||||
}
|
||||
|
||||
public void modify( Object element, String property, Object value )
|
||||
{
|
||||
Object entry = getSelection();
|
||||
if ( entry instanceof CDirectorySourceLocation )
|
||||
{
|
||||
if ( property.equals( CP_ASSOCIATION ) && value instanceof String )
|
||||
{
|
||||
IPath association = new Path( (String)value );
|
||||
if ( association.isValidPath( (String)value ) )
|
||||
{
|
||||
((CDirectorySourceLocation)entry).setAssociation( association );
|
||||
setChanged();
|
||||
}
|
||||
}
|
||||
if ( property.equals( CP_SEARCH_SUBFOLDERS ) && value instanceof Integer )
|
||||
{
|
||||
((CDirectorySourceLocation)entry).setSearchSubfolders( ((Integer)value).intValue() == 0 );
|
||||
setChanged();
|
||||
}
|
||||
if ( hasChanged() )
|
||||
{
|
||||
refresh();
|
||||
notifyObservers();
|
||||
}
|
||||
}
|
||||
public Object getValue( Object element, String property ) {
|
||||
if ( element instanceof CDirectorySourceLocation && property.equals( CP_ASSOCIATION ) ) {
|
||||
return (((CDirectorySourceLocation)element).getAssociation() != null) ? ((CDirectorySourceLocation)element).getAssociation().toOSString() : ""; //$NON-NLS-1$
|
||||
}
|
||||
if ( element instanceof CDirectorySourceLocation && property.equals( CP_SEARCH_SUBFOLDERS ) ) {
|
||||
return (((CDirectorySourceLocation)element).searchSubfolders()) ? new Integer( 0 ) : new Integer( 1 );
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void modify( Object element, String property, Object value ) {
|
||||
Object entry = getSelection();
|
||||
if ( entry instanceof CDirectorySourceLocation ) {
|
||||
if ( property.equals( CP_ASSOCIATION ) && value instanceof String ) {
|
||||
IPath association = new Path( (String)value );
|
||||
if ( association.isValidPath( (String)value ) ) {
|
||||
((CDirectorySourceLocation)entry).setAssociation( association );
|
||||
setChanged();
|
||||
}
|
||||
};
|
||||
}
|
||||
if ( property.equals( CP_SEARCH_SUBFOLDERS ) && value instanceof Integer ) {
|
||||
((CDirectorySourceLocation)entry).setSearchSubfolders( ((Integer)value).intValue() == 0 );
|
||||
setChanged();
|
||||
}
|
||||
if ( hasChanged() ) {
|
||||
refresh();
|
||||
notifyObservers();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
protected Object getSelection()
|
||||
{
|
||||
protected Object getSelection() {
|
||||
List list = getSelectedElements();
|
||||
return ( list.size() > 0 ) ? list.get( 0 ) : null;
|
||||
return (list.size() > 0) ? list.get( 0 ) : null;
|
||||
}
|
||||
|
||||
public synchronized void addObserver( Observer o )
|
||||
{
|
||||
public synchronized void addObserver( Observer o ) {
|
||||
fObservable.addObserver( o );
|
||||
}
|
||||
|
||||
public synchronized void deleteObserver( Observer o )
|
||||
{
|
||||
public synchronized void deleteObserver( Observer o ) {
|
||||
fObservable.deleteObserver( o );
|
||||
}
|
||||
|
||||
public synchronized boolean hasChanged()
|
||||
{
|
||||
public synchronized boolean hasChanged() {
|
||||
return fObservable.hasChanged();
|
||||
}
|
||||
|
||||
public void notifyObservers()
|
||||
{
|
||||
public void notifyObservers() {
|
||||
fObservable.notifyObservers();
|
||||
}
|
||||
|
||||
public void notifyObservers( Object arg )
|
||||
{
|
||||
public void notifyObservers( Object arg ) {
|
||||
fObservable.notifyObservers( arg );
|
||||
}
|
||||
|
||||
public void dispose()
|
||||
{
|
||||
public void dispose() {
|
||||
}
|
||||
|
||||
protected void setChanged()
|
||||
{
|
||||
protected void setChanged() {
|
||||
fObservable.setChanged();
|
||||
}
|
||||
|
||||
public ICSourceLocation[] getSourceLocations()
|
||||
{
|
||||
public ICSourceLocation[] getSourceLocations() {
|
||||
List list = getElements();
|
||||
return (ICSourceLocation[])list.toArray( new ICSourceLocation[list.size()] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,13 @@
|
|||
/*
|
||||
*(c) Copyright QNX Software Systems Ltd. 2002.
|
||||
* All Rights Reserved.
|
||||
/**********************************************************************
|
||||
* Copyright (c) 2004 QNX Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
*/
|
||||
* Contributors:
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
***********************************************************************/
|
||||
package org.eclipse.cdt.debug.ui.sourcelookup;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -10,7 +15,6 @@ import java.util.Iterator;
|
|||
import java.util.List;
|
||||
import java.util.Observable;
|
||||
import java.util.Observer;
|
||||
|
||||
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
|
||||
import org.eclipse.cdt.debug.core.CDebugUtils;
|
||||
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
|
||||
|
@ -51,33 +55,34 @@ import org.eclipse.swt.widgets.Composite;
|
|||
import org.eclipse.swt.widgets.Control;
|
||||
|
||||
/**
|
||||
*
|
||||
* Enter type comment.
|
||||
*
|
||||
* @since Dec 18, 2002
|
||||
* The composite widget shared by the source lookup launch tab and property page.
|
||||
*/
|
||||
public class SourceLookupBlock implements Observer
|
||||
{
|
||||
public class SourceLookupBlock implements Observer {
|
||||
|
||||
private Composite fControl = null;
|
||||
|
||||
private CheckedListDialogField fGeneratedSourceListField;
|
||||
|
||||
private SourceListDialogField fAddedSourceListField;
|
||||
|
||||
private SelectionButtonDialogField fSearchForDuplicateFiles;
|
||||
|
||||
private ILaunchConfigurationDialog fLaunchConfigurationDialog = null;
|
||||
|
||||
private boolean fIsDirty = false;
|
||||
|
||||
private IProject fProject = null;
|
||||
|
||||
/**
|
||||
* Constructor for SourceLookupBlock.
|
||||
*/
|
||||
public SourceLookupBlock()
|
||||
{
|
||||
public SourceLookupBlock() {
|
||||
fGeneratedSourceListField = createGeneratedSourceListField();
|
||||
fAddedSourceListField = createAddedSourceListField();
|
||||
fSearchForDuplicateFiles = createSearchForDuplicateFilesButton();
|
||||
}
|
||||
|
||||
public void createControl( Composite parent )
|
||||
{
|
||||
public void createControl( Composite parent ) {
|
||||
fControl = new Composite( parent, SWT.NONE );
|
||||
GridLayout layout = new GridLayout();
|
||||
layout.numColumns = 2;
|
||||
|
@ -86,54 +91,38 @@ public class SourceLookupBlock implements Observer
|
|||
fControl.setLayout( layout );
|
||||
fControl.setLayoutData( new GridData( GridData.FILL_BOTH ) );
|
||||
fControl.setFont( JFaceResources.getDialogFont() );
|
||||
|
||||
PixelConverter converter = new PixelConverter( fControl );
|
||||
|
||||
fGeneratedSourceListField.doFillIntoGrid( fControl, 3 );
|
||||
LayoutUtil.setHorizontalSpan( fGeneratedSourceListField.getLabelControl( null ), 2 );
|
||||
LayoutUtil.setWidthHint( fGeneratedSourceListField.getLabelControl( null ), converter.convertWidthInCharsToPixels( 40 ) );
|
||||
LayoutUtil.setHorizontalGrabbing( fGeneratedSourceListField.getListControl( null ) );
|
||||
((CheckboxTableViewer)fGeneratedSourceListField.getTableViewer()).
|
||||
addCheckStateListener( new ICheckStateListener()
|
||||
{
|
||||
public void checkStateChanged( CheckStateChangedEvent event )
|
||||
{
|
||||
if ( event.getElement() instanceof IProjectSourceLocation )
|
||||
doCheckStateChanged();
|
||||
}
|
||||
|
||||
} );
|
||||
((CheckboxTableViewer)fGeneratedSourceListField.getTableViewer()).addCheckStateListener( new ICheckStateListener() {
|
||||
|
||||
public void checkStateChanged( CheckStateChangedEvent event ) {
|
||||
if ( event.getElement() instanceof IProjectSourceLocation )
|
||||
doCheckStateChanged();
|
||||
}
|
||||
} );
|
||||
new Separator().doFillIntoGrid( fControl, 3, converter.convertHeightInCharsToPixels( 1 ) );
|
||||
|
||||
fAddedSourceListField.doFillIntoGrid( fControl, 3 );
|
||||
LayoutUtil.setHorizontalSpan( fAddedSourceListField.getLabelControl( null ), 2 );
|
||||
LayoutUtil.setWidthHint( fAddedSourceListField.getLabelControl( null ), converter.convertWidthInCharsToPixels( 40 ) );
|
||||
LayoutUtil.setHorizontalGrabbing( fAddedSourceListField.getListControl( null ) );
|
||||
|
||||
// new Separator().doFillIntoGrid( fControl, 3, converter.convertHeightInCharsToPixels( 1 ) );
|
||||
|
||||
// new Separator().doFillIntoGrid( fControl, 3, converter.convertHeightInCharsToPixels( 1 ) );
|
||||
fSearchForDuplicateFiles.doFillIntoGrid( fControl, 3 );
|
||||
}
|
||||
|
||||
public Control getControl()
|
||||
{
|
||||
public Control getControl() {
|
||||
return fControl;
|
||||
}
|
||||
|
||||
public void initialize( ILaunchConfiguration configuration )
|
||||
{
|
||||
|
||||
public void initialize( ILaunchConfiguration configuration ) {
|
||||
IProject project = getProjectFromLaunchConfiguration( configuration );
|
||||
if ( project != null )
|
||||
{
|
||||
if ( project != null ) {
|
||||
setProject( project );
|
||||
try
|
||||
{
|
||||
try {
|
||||
String id = configuration.getAttribute( ILaunchConfiguration.ATTR_SOURCE_LOCATOR_ID, "" ); //$NON-NLS-1$
|
||||
if ( isEmpty( id ) ||
|
||||
CDebugUIPlugin.getDefaultSourceLocatorID().equals( id ) ||
|
||||
CDebugUIPlugin.getDefaultSourceLocatorOldID().equals( id ) )
|
||||
{
|
||||
if ( isEmpty( id ) || CDebugUIPlugin.getDefaultSourceLocatorID().equals( id ) || CDebugUIPlugin.getDefaultSourceLocatorOldID().equals( id ) ) {
|
||||
String memento = configuration.getAttribute( ILaunchConfiguration.ATTR_SOURCE_LOCATOR_MEMENTO, "" ); //$NON-NLS-1$
|
||||
if ( !isEmpty( memento ) )
|
||||
initializeFromMemento( memento );
|
||||
|
@ -141,44 +130,37 @@ public class SourceLookupBlock implements Observer
|
|||
initializeDefaults();
|
||||
}
|
||||
}
|
||||
catch( CoreException e )
|
||||
{
|
||||
catch( CoreException e ) {
|
||||
initializeDefaults();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
initializeGeneratedLocations( null, new ICSourceLocation[0] );
|
||||
resetAdditionalLocations( CDebugCorePlugin.getDefault().getCommonSourceLocations() );
|
||||
fSearchForDuplicateFiles.setSelection( CDebugCorePlugin.getDefault().getPluginPreferences().getBoolean( ICDebugConstants.PREF_SEARCH_DUPLICATE_FILES ) );
|
||||
}
|
||||
}
|
||||
|
||||
private void initializeFromMemento( String memento ) throws CoreException
|
||||
{
|
||||
private void initializeFromMemento( String memento ) throws CoreException {
|
||||
IPersistableSourceLocator locator = CDebugUIPlugin.createDefaultSourceLocator();
|
||||
locator.initializeFromMemento( memento );
|
||||
if ( locator instanceof IAdaptable )
|
||||
{
|
||||
if ( locator instanceof IAdaptable ) {
|
||||
ICSourceLocator clocator = (ICSourceLocator)((IAdaptable)locator).getAdapter( ICSourceLocator.class );
|
||||
if ( clocator != null )
|
||||
initializeFromLocator( clocator );
|
||||
}
|
||||
}
|
||||
|
||||
private void initializeDefaults()
|
||||
{
|
||||
private void initializeDefaults() {
|
||||
fGeneratedSourceListField.removeAllElements();
|
||||
IProject project = getProject();
|
||||
if ( project != null && project.exists() && project.isOpen() )
|
||||
{
|
||||
if ( project != null && project.exists() && project.isOpen() ) {
|
||||
ICSourceLocation location = SourceLookupFactory.createProjectSourceLocation( project, true );
|
||||
fGeneratedSourceListField.addElement( location );
|
||||
fGeneratedSourceListField.setChecked( location, true );
|
||||
List list = CDebugUtils.getReferencedProjects( project );
|
||||
Iterator it = list.iterator();
|
||||
while( it.hasNext() )
|
||||
{
|
||||
while( it.hasNext() ) {
|
||||
location = SourceLookupFactory.createProjectSourceLocation( (IProject)it.next(), true );
|
||||
fGeneratedSourceListField.addElement( location );
|
||||
fGeneratedSourceListField.setChecked( location, true );
|
||||
|
@ -188,32 +170,28 @@ public class SourceLookupBlock implements Observer
|
|||
fSearchForDuplicateFiles.setSelection( CDebugCorePlugin.getDefault().getPluginPreferences().getBoolean( ICDebugConstants.PREF_SEARCH_DUPLICATE_FILES ) );
|
||||
}
|
||||
|
||||
private void initializeFromLocator( ICSourceLocator locator )
|
||||
{
|
||||
private void initializeFromLocator( ICSourceLocator locator ) {
|
||||
ICSourceLocation[] locations = locator.getSourceLocations();
|
||||
initializeGeneratedLocations( locator.getProject(), locations );
|
||||
resetAdditionalLocations( locations );
|
||||
fSearchForDuplicateFiles.setSelection( locator.searchForDuplicateFiles() );
|
||||
}
|
||||
|
||||
private void initializeGeneratedLocations( IProject project, ICSourceLocation[] locations )
|
||||
{
|
||||
private void initializeGeneratedLocations( IProject project, ICSourceLocation[] locations ) {
|
||||
fGeneratedSourceListField.removeAllElements();
|
||||
if ( project == null || !project.exists() || !project.isOpen() )
|
||||
return;
|
||||
List list = CDebugUtils.getReferencedProjects( project );
|
||||
IProject[] refs = (IProject[])list.toArray( new IProject[list.size()] );
|
||||
ICSourceLocation loc = getLocationForProject( project, locations );
|
||||
boolean checked = ( loc != null && ((IProjectSourceLocation)loc).isGeneric() );
|
||||
boolean checked = (loc != null && ((IProjectSourceLocation)loc).isGeneric());
|
||||
if ( loc == null )
|
||||
loc = SourceLookupFactory.createProjectSourceLocation( project, true );
|
||||
fGeneratedSourceListField.addElement( loc );
|
||||
fGeneratedSourceListField.setChecked( loc, checked );
|
||||
|
||||
for ( int i = 0; i < refs.length; ++i )
|
||||
{
|
||||
for( int i = 0; i < refs.length; ++i ) {
|
||||
loc = getLocationForProject( refs[i], locations );
|
||||
checked = ( loc != null );
|
||||
checked = (loc != null);
|
||||
if ( loc == null )
|
||||
loc = SourceLookupFactory.createProjectSourceLocation( refs[i], true );
|
||||
fGeneratedSourceListField.addElement( loc );
|
||||
|
@ -221,96 +199,78 @@ public class SourceLookupBlock implements Observer
|
|||
}
|
||||
}
|
||||
|
||||
private void resetGeneratedLocations( ICSourceLocation[] locations )
|
||||
{
|
||||
private void resetGeneratedLocations( ICSourceLocation[] locations ) {
|
||||
fGeneratedSourceListField.checkAll( false );
|
||||
for ( int i = 0; i < locations.length; ++i )
|
||||
{
|
||||
if ( locations[i] instanceof IProjectSourceLocation &&
|
||||
((IProjectSourceLocation)locations[i]).isGeneric() )
|
||||
for( int i = 0; i < locations.length; ++i ) {
|
||||
if ( locations[i] instanceof IProjectSourceLocation && ((IProjectSourceLocation)locations[i]).isGeneric() )
|
||||
fGeneratedSourceListField.setChecked( locations[i], true );
|
||||
}
|
||||
}
|
||||
|
||||
private void resetAdditionalLocations( ICSourceLocation[] locations )
|
||||
{
|
||||
private void resetAdditionalLocations( ICSourceLocation[] locations ) {
|
||||
fAddedSourceListField.removeAllElements();
|
||||
for ( int i = 0; i < locations.length; ++i )
|
||||
{
|
||||
if ( !( locations[i] instanceof IProjectSourceLocation ) || !((IProjectSourceLocation)locations[i]).isGeneric() )
|
||||
for( int i = 0; i < locations.length; ++i ) {
|
||||
if ( !(locations[i] instanceof IProjectSourceLocation) || !((IProjectSourceLocation)locations[i]).isGeneric() )
|
||||
fAddedSourceListField.addElement( locations[i] );
|
||||
}
|
||||
}
|
||||
|
||||
public void performApply( ILaunchConfigurationWorkingCopy configuration )
|
||||
{
|
||||
public void performApply( ILaunchConfigurationWorkingCopy configuration ) {
|
||||
IPersistableSourceLocator locator = CDebugUIPlugin.createDefaultSourceLocator();
|
||||
try
|
||||
{
|
||||
try {
|
||||
locator.initializeDefaults( configuration );
|
||||
if ( locator instanceof IAdaptable )
|
||||
{
|
||||
if ( locator instanceof IAdaptable ) {
|
||||
ICSourceLocator clocator = (ICSourceLocator)((IAdaptable)locator).getAdapter( ICSourceLocator.class );
|
||||
if ( clocator != null && getProject() != null && getProject().equals( getProjectFromLaunchConfiguration( configuration ) ) )
|
||||
{
|
||||
if ( clocator != null && getProject() != null && getProject().equals( getProjectFromLaunchConfiguration( configuration ) ) ) {
|
||||
clocator.setSourceLocations( getSourceLocations() );
|
||||
clocator.setSearchForDuplicateFiles( searchForDuplicateFiles() );
|
||||
}
|
||||
}
|
||||
configuration.setAttribute( ILaunchConfiguration.ATTR_SOURCE_LOCATOR_MEMENTO, locator.getMemento() );
|
||||
}
|
||||
catch( CoreException e )
|
||||
{
|
||||
catch( CoreException e ) {
|
||||
}
|
||||
}
|
||||
|
||||
protected void doCheckStateChanged()
|
||||
{
|
||||
protected void doCheckStateChanged() {
|
||||
fIsDirty = true;
|
||||
updateLaunchConfigurationDialog();
|
||||
}
|
||||
|
||||
protected void doGeneratedSourceButtonPressed( int index )
|
||||
{
|
||||
switch( index )
|
||||
{
|
||||
case 0: // Select All
|
||||
case 1: // Deselect All
|
||||
protected void doGeneratedSourceButtonPressed( int index ) {
|
||||
switch( index ) {
|
||||
case 0: // Select All
|
||||
case 1: // Deselect All
|
||||
fIsDirty = true;
|
||||
break;
|
||||
}
|
||||
if ( isDirty() )
|
||||
updateLaunchConfigurationDialog();
|
||||
}
|
||||
|
||||
protected void doGeneratedSourceSelectionChanged()
|
||||
{
|
||||
|
||||
protected void doGeneratedSourceSelectionChanged() {
|
||||
}
|
||||
|
||||
protected void doAddedSourceButtonPressed( int index )
|
||||
{
|
||||
switch( index )
|
||||
{
|
||||
case 0: // Add...
|
||||
protected void doAddedSourceButtonPressed( int index ) {
|
||||
switch( index ) {
|
||||
case 0: // Add...
|
||||
if ( addSourceLocation() )
|
||||
fIsDirty = true;
|
||||
break;
|
||||
case 2: // Up
|
||||
case 3: // Down
|
||||
case 5: // Remove
|
||||
case 2: // Up
|
||||
case 3: // Down
|
||||
case 5: // Remove
|
||||
fIsDirty = true;
|
||||
break;
|
||||
}
|
||||
if ( isDirty() )
|
||||
updateLaunchConfigurationDialog();
|
||||
}
|
||||
|
||||
public ICSourceLocation[] getSourceLocations()
|
||||
{
|
||||
|
||||
public ICSourceLocation[] getSourceLocations() {
|
||||
ArrayList list = new ArrayList( getGeneratedSourceListField().getElements().size() + getAddedSourceListField().getElements().size() );
|
||||
Iterator it = getGeneratedSourceListField().getElements().iterator();
|
||||
while( it.hasNext() )
|
||||
{
|
||||
while( it.hasNext() ) {
|
||||
IProjectSourceLocation location = (IProjectSourceLocation)it.next();
|
||||
if ( getGeneratedSourceListField().isChecked( location ) )
|
||||
list.add( location );
|
||||
|
@ -318,52 +278,43 @@ public class SourceLookupBlock implements Observer
|
|||
list.addAll( getAddedSourceListField().getElements() );
|
||||
return (ICSourceLocation[])list.toArray( new ICSourceLocation[list.size()] );
|
||||
}
|
||||
|
||||
private boolean addSourceLocation()
|
||||
{
|
||||
|
||||
private boolean addSourceLocation() {
|
||||
AddSourceLocationWizard wizard = new AddSourceLocationWizard( getSourceLocations() );
|
||||
WizardDialog dialog = new WizardDialog( fControl.getShell(), wizard );
|
||||
if ( dialog.open() == Window.OK )
|
||||
{
|
||||
if ( dialog.open() == Window.OK ) {
|
||||
fAddedSourceListField.addElement( wizard.getSourceLocation() );
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void updateLaunchConfigurationDialog()
|
||||
{
|
||||
if ( getLaunchConfigurationDialog() != null )
|
||||
{
|
||||
protected void updateLaunchConfigurationDialog() {
|
||||
if ( getLaunchConfigurationDialog() != null ) {
|
||||
getLaunchConfigurationDialog().updateMessage();
|
||||
getLaunchConfigurationDialog().updateButtons();
|
||||
fIsDirty = false;
|
||||
}
|
||||
}
|
||||
|
||||
public ILaunchConfigurationDialog getLaunchConfigurationDialog()
|
||||
{
|
||||
public ILaunchConfigurationDialog getLaunchConfigurationDialog() {
|
||||
return fLaunchConfigurationDialog;
|
||||
}
|
||||
|
||||
public void setLaunchConfigurationDialog( ILaunchConfigurationDialog launchConfigurationDialog )
|
||||
{
|
||||
public void setLaunchConfigurationDialog( ILaunchConfigurationDialog launchConfigurationDialog ) {
|
||||
fLaunchConfigurationDialog = launchConfigurationDialog;
|
||||
}
|
||||
|
||||
public boolean isDirty()
|
||||
{
|
||||
public boolean isDirty() {
|
||||
return fIsDirty;
|
||||
}
|
||||
|
||||
protected Object getSelection()
|
||||
{
|
||||
|
||||
protected Object getSelection() {
|
||||
List list = fAddedSourceListField.getSelectedElements();
|
||||
return ( list.size() > 0 ) ? list.get( 0 ) : null;
|
||||
return (list.size() > 0) ? list.get( 0 ) : null;
|
||||
}
|
||||
|
||||
protected void restoreDefaults()
|
||||
{
|
||||
|
||||
protected void restoreDefaults() {
|
||||
ICSourceLocation[] locations = new ICSourceLocation[0];
|
||||
if ( getProject() != null )
|
||||
locations = CSourceLocator.getDefaultSourceLocations( getProject() );
|
||||
|
@ -372,117 +323,95 @@ public class SourceLookupBlock implements Observer
|
|||
fSearchForDuplicateFiles.setSelection( CDebugCorePlugin.getDefault().getPluginPreferences().getBoolean( ICDebugConstants.PREF_SEARCH_DUPLICATE_FILES ) );
|
||||
}
|
||||
|
||||
public IProject getProject()
|
||||
{
|
||||
public IProject getProject() {
|
||||
return fProject;
|
||||
}
|
||||
|
||||
private void setProject( IProject project )
|
||||
{
|
||||
private void setProject( IProject project ) {
|
||||
fProject = project;
|
||||
}
|
||||
|
||||
public SourceListDialogField getAddedSourceListField()
|
||||
{
|
||||
public SourceListDialogField getAddedSourceListField() {
|
||||
return fAddedSourceListField;
|
||||
}
|
||||
|
||||
public CheckedListDialogField getGeneratedSourceListField()
|
||||
{
|
||||
public CheckedListDialogField getGeneratedSourceListField() {
|
||||
return fGeneratedSourceListField;
|
||||
}
|
||||
|
||||
private ICSourceLocation getLocationForProject( IProject project, ICSourceLocation[] locations )
|
||||
{
|
||||
for ( int i = 0; i < locations.length; ++i )
|
||||
if ( locations[i] instanceof IProjectSourceLocation &&
|
||||
project.equals( ((IProjectSourceLocation)locations[i]).getProject() ) )
|
||||
private ICSourceLocation getLocationForProject( IProject project, ICSourceLocation[] locations ) {
|
||||
for( int i = 0; i < locations.length; ++i )
|
||||
if ( locations[i] instanceof IProjectSourceLocation && project.equals( ((IProjectSourceLocation)locations[i]).getProject() ) )
|
||||
return locations[i];
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean searchForDuplicateFiles()
|
||||
{
|
||||
return ( fSearchForDuplicateFiles != null ) ? fSearchForDuplicateFiles.isSelected() : false;
|
||||
public boolean searchForDuplicateFiles() {
|
||||
return (fSearchForDuplicateFiles != null) ? fSearchForDuplicateFiles.isSelected() : false;
|
||||
}
|
||||
|
||||
private CheckedListDialogField createGeneratedSourceListField()
|
||||
{
|
||||
String[] generatedSourceButtonLabels = new String[]
|
||||
{
|
||||
/* 0 */ CDebugUIPlugin.getResourceString("ui.sourcelookup.SourceLookupBlock.Select_All"), //$NON-NLS-1$
|
||||
/* 1 */ CDebugUIPlugin.getResourceString("ui.sourcelookup.SourceLookupBlock.Deselect_All"), //$NON-NLS-1$
|
||||
private CheckedListDialogField createGeneratedSourceListField() {
|
||||
String[] generatedSourceButtonLabels = new String[]{
|
||||
/* 0 */SourceLookupMessages.getString( "SourceLookupBlock.0" ), //$NON-NLS-1$
|
||||
/* 1 */SourceLookupMessages.getString( "SourceLookupBlock.1" ), //$NON-NLS-1$
|
||||
};
|
||||
IListAdapter generatedSourceAdapter = new IListAdapter() {
|
||||
|
||||
IListAdapter generatedSourceAdapter = new IListAdapter()
|
||||
{
|
||||
public void customButtonPressed( DialogField field, int index )
|
||||
{
|
||||
doGeneratedSourceButtonPressed( index );
|
||||
}
|
||||
|
||||
public void selectionChanged( DialogField field )
|
||||
{
|
||||
doGeneratedSourceSelectionChanged();
|
||||
}
|
||||
};
|
||||
public void customButtonPressed( DialogField field, int index ) {
|
||||
doGeneratedSourceButtonPressed( index );
|
||||
}
|
||||
|
||||
public void selectionChanged( DialogField field ) {
|
||||
doGeneratedSourceSelectionChanged();
|
||||
}
|
||||
};
|
||||
CheckedListDialogField field = new CheckedListDialogField( generatedSourceAdapter, generatedSourceButtonLabels, new SourceLookupLabelProvider() );
|
||||
field.setLabelText( CDebugUIPlugin.getResourceString("ui.sourcelookup.SourceLookupBlock.Generic_Source_Locations") ); //$NON-NLS-1$
|
||||
field.setLabelText( SourceLookupMessages.getString( "SourceLookupBlock.2" ) ); //$NON-NLS-1$
|
||||
field.setCheckAllButtonIndex( 0 );
|
||||
field.setUncheckAllButtonIndex( 1 );
|
||||
field.setDialogFieldListener(
|
||||
new IDialogFieldListener()
|
||||
{
|
||||
public void dialogFieldChanged( DialogField f )
|
||||
{
|
||||
doCheckStateChanged();
|
||||
}
|
||||
} );
|
||||
field.setDialogFieldListener( new IDialogFieldListener() {
|
||||
|
||||
public void dialogFieldChanged( DialogField f ) {
|
||||
doCheckStateChanged();
|
||||
}
|
||||
} );
|
||||
return field;
|
||||
}
|
||||
|
||||
private SourceListDialogField createAddedSourceListField()
|
||||
{
|
||||
SourceListDialogField field =
|
||||
new SourceListDialogField( CDebugUIPlugin.getResourceString("ui.sourcelookup.SourceLookupBlock.Additional_Source_Locations"), //$NON-NLS-1$
|
||||
new IListAdapter()
|
||||
{
|
||||
public void customButtonPressed( DialogField f, int index )
|
||||
{
|
||||
doAddedSourceButtonPressed( index );
|
||||
}
|
||||
private SourceListDialogField createAddedSourceListField() {
|
||||
SourceListDialogField field = new SourceListDialogField( SourceLookupMessages.getString( "SourceLookupBlock.3" ), //$NON-NLS-1$
|
||||
new IListAdapter() {
|
||||
|
||||
public void selectionChanged(DialogField f)
|
||||
{
|
||||
}
|
||||
} );
|
||||
public void customButtonPressed( DialogField f, int index ) {
|
||||
doAddedSourceButtonPressed( index );
|
||||
}
|
||||
|
||||
public void selectionChanged( DialogField f ) {
|
||||
}
|
||||
} );
|
||||
field.addObserver( this );
|
||||
return field;
|
||||
}
|
||||
|
||||
private SelectionButtonDialogField createSearchForDuplicateFilesButton()
|
||||
{
|
||||
private SelectionButtonDialogField createSearchForDuplicateFilesButton() {
|
||||
SelectionButtonDialogField button = new SelectionButtonDialogField( SWT.CHECK );
|
||||
button.setLabelText( CDebugUIPlugin.getResourceString("ui.sourcelookup.SourceLookupBlock.Search_for_dup_src_files") ); //$NON-NLS-1$
|
||||
button.setDialogFieldListener(
|
||||
new IDialogFieldListener()
|
||||
{
|
||||
public void dialogFieldChanged( DialogField field )
|
||||
{
|
||||
doCheckStateChanged();
|
||||
}
|
||||
} );
|
||||
button.setLabelText( SourceLookupMessages.getString( "SourceLookupBlock.4" ) ); //$NON-NLS-1$
|
||||
button.setDialogFieldListener( new IDialogFieldListener() {
|
||||
|
||||
public void dialogFieldChanged( DialogField field ) {
|
||||
doCheckStateChanged();
|
||||
}
|
||||
} );
|
||||
return button;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see java.util.Observer#update(java.util.Observable, java.lang.Object)
|
||||
*/
|
||||
public void update( Observable o, Object arg )
|
||||
{
|
||||
if ( arg instanceof Integer && ((Integer)arg).intValue() == 0 )
|
||||
{
|
||||
public void update( Observable o, Object arg ) {
|
||||
if ( arg instanceof Integer && ((Integer)arg).intValue() == 0 ) {
|
||||
if ( addSourceLocation() )
|
||||
fIsDirty = true;
|
||||
}
|
||||
|
@ -492,34 +421,27 @@ public class SourceLookupBlock implements Observer
|
|||
updateLaunchConfigurationDialog();
|
||||
}
|
||||
|
||||
private boolean isEmpty( String string )
|
||||
{
|
||||
private boolean isEmpty( String string ) {
|
||||
return string == null || string.length() == 0;
|
||||
}
|
||||
|
||||
public void dispose()
|
||||
{
|
||||
if ( getAddedSourceListField() != null )
|
||||
{
|
||||
public void dispose() {
|
||||
if ( getAddedSourceListField() != null ) {
|
||||
getAddedSourceListField().deleteObserver( this );
|
||||
getAddedSourceListField().dispose();
|
||||
}
|
||||
}
|
||||
|
||||
private IProject getProjectFromLaunchConfiguration( ILaunchConfiguration configuration )
|
||||
{
|
||||
try
|
||||
{
|
||||
private IProject getProjectFromLaunchConfiguration( ILaunchConfiguration configuration ) {
|
||||
try {
|
||||
String projectName = configuration.getAttribute( ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, "" ); //$NON-NLS-1$
|
||||
if ( !isEmpty( projectName ) )
|
||||
{
|
||||
if ( !isEmpty( projectName ) ) {
|
||||
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject( projectName );
|
||||
if ( project != null && project.exists() && project.isOpen() )
|
||||
return project;
|
||||
}
|
||||
}
|
||||
catch( CoreException e )
|
||||
{
|
||||
catch( CoreException e ) {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 QNX Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
***********************************************************************/
|
||||
package org.eclipse.cdt.debug.ui.sourcelookup;
|
||||
|
||||
import java.util.MissingResourceException;
|
||||
//import java.util.ResourceBundle;
|
||||
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
||||
|
||||
public class SourceLookupMessages {
|
||||
|
||||
// private static final String BUNDLE_NAME = "org.eclipse.cdt.debug.ui.sourcelookup.SourceLookupMessages";//$NON-NLS-1$
|
||||
|
||||
// private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME );
|
||||
|
||||
private SourceLookupMessages() {
|
||||
}
|
||||
|
||||
public static String getString( String key ) {
|
||||
try {
|
||||
return CDebugUIPlugin.getResourceString( key );
|
||||
// return RESOURCE_BUNDLE.getString( key );
|
||||
}
|
||||
catch( MissingResourceException e ) {
|
||||
return '!' + key + '!';
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
SourceListDialogField.0=yes
|
||||
SourceListDialogField.1=no
|
||||
SourceListDialogField.2=Add...
|
||||
SourceListDialogField.3=Up
|
||||
SourceListDialogField.4=Down
|
||||
SourceListDialogField.5=Remove
|
||||
SourceListDialogField.6=Location
|
||||
SourceListDialogField.7=Association
|
||||
SourceListDialogField.8=Search subfolders
|
||||
SourcePropertyPage.0=Terminated.
|
||||
SourceLookupBlock.0=Select All
|
||||
SourceLookupBlock.1=Deselect All
|
||||
SourceLookupBlock.2=Generic Source Locations
|
||||
SourceLookupBlock.3=Additional Source Locations
|
||||
SourceLookupBlock.4=Search for duplicate source files
|
||||
DefaultSourceLocator.0=Always map to the selection
|
||||
DefaultSourceLocator.1=Unable to create memento for C/C++ source locator.
|
||||
DefaultSourceLocator.2=Unable to restore prompting source locator - invalid format.
|
||||
DefaultSourceLocator.3=Unable to restore prompting source locator - invalid format.
|
||||
DefaultSourceLocator.4=Unable to restore prompting source locator - project {0} not found.
|
||||
DefaultSourceLocator.5=Unable to restore prompting source locator - invalid format.
|
||||
DefaultSourceLocator.6=Exception occurred initializing source locator.
|
||||
DefaultSourceLocator.7=Selection needed
|
||||
DefaultSourceLocator.8=Debugger has found multiple files with the same name.\nPlease select one associated with the selected stack frame.
|
||||
DefaultSourceLocator.9=Project ''{0}'' does not exist.
|
|
@ -1,8 +1,13 @@
|
|||
/*
|
||||
*(c) Copyright QNX Software Systems Ltd. 2002.
|
||||
* All Rights Reserved.
|
||||
/**********************************************************************
|
||||
* Copyright (c) 2004 QNX Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
*/
|
||||
* Contributors:
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
***********************************************************************/
|
||||
package org.eclipse.cdt.debug.ui.sourcelookup;
|
||||
|
||||
import org.eclipse.cdt.debug.core.model.ICDebugTarget;
|
||||
|
@ -22,20 +27,16 @@ import org.eclipse.swt.widgets.Label;
|
|||
import org.eclipse.ui.dialogs.PropertyPage;
|
||||
|
||||
/**
|
||||
*
|
||||
* Enter type comment.
|
||||
*
|
||||
* @since Dec 18, 2002
|
||||
* The "Source Lookup" property page.
|
||||
*/
|
||||
public class SourcePropertyPage extends PropertyPage
|
||||
{
|
||||
public class SourcePropertyPage extends PropertyPage {
|
||||
|
||||
private SourceLookupBlock fBlock = null;
|
||||
|
||||
/**
|
||||
* Constructor for SourcePropertyPage.
|
||||
*/
|
||||
public SourcePropertyPage()
|
||||
{
|
||||
public SourcePropertyPage() {
|
||||
noDefaultAndApplyButton();
|
||||
fBlock = new SourceLookupBlock();
|
||||
}
|
||||
|
@ -43,74 +44,61 @@ public class SourcePropertyPage extends PropertyPage
|
|||
/**
|
||||
* @see org.eclipse.jface.preference.PreferencePage#createContents(Composite)
|
||||
*/
|
||||
protected Control createContents( Composite parent )
|
||||
{
|
||||
protected Control createContents( Composite parent ) {
|
||||
ICDebugTarget target = getDebugTarget();
|
||||
if ( target == null || target.isTerminated() || target.isDisconnected() )
|
||||
{
|
||||
if ( target == null || target.isTerminated() || target.isDisconnected() ) {
|
||||
return createTerminatedContents( parent );
|
||||
}
|
||||
return createActiveContents( parent );
|
||||
}
|
||||
|
||||
protected Control createTerminatedContents( Composite parent )
|
||||
{
|
||||
Label label= new Label( parent, SWT.LEFT );
|
||||
label.setText( CDebugUIPlugin.getResourceString("ui.sourcelookup.SourcePropertyPage.Terminated") ); //$NON-NLS-1$
|
||||
protected Control createTerminatedContents( Composite parent ) {
|
||||
Label label = new Label( parent, SWT.LEFT );
|
||||
label.setText( SourceLookupMessages.getString( "SourcePropertyPage.0" ) ); //$NON-NLS-1$
|
||||
return label;
|
||||
}
|
||||
|
||||
protected Control createActiveContents( Composite parent )
|
||||
{
|
||||
protected Control createActiveContents( Composite parent ) {
|
||||
fBlock.initialize( getLaunchConfiguration() );
|
||||
fBlock.createControl( parent );
|
||||
return fBlock.getControl();
|
||||
}
|
||||
|
||||
protected ICDebugTarget getDebugTarget()
|
||||
{
|
||||
|
||||
protected ICDebugTarget getDebugTarget() {
|
||||
IAdaptable element = getElement();
|
||||
if ( element != null )
|
||||
{
|
||||
if ( element != null ) {
|
||||
return (ICDebugTarget)element.getAdapter( ICDebugTarget.class );
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.jface.preference.IPreferencePage#performOk()
|
||||
*/
|
||||
public boolean performOk()
|
||||
{
|
||||
if ( fBlock.isDirty() )
|
||||
{
|
||||
try
|
||||
{
|
||||
public boolean performOk() {
|
||||
if ( fBlock.isDirty() ) {
|
||||
try {
|
||||
setAttributes( fBlock );
|
||||
}
|
||||
catch( DebugException e )
|
||||
{
|
||||
catch( DebugException e ) {
|
||||
CDebugUIPlugin.errorDialog( e.getMessage(), (IStatus)null );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void setAttributes( SourceLookupBlock block ) throws DebugException
|
||||
{
|
||||
|
||||
private void setAttributes( SourceLookupBlock block ) throws DebugException {
|
||||
ICDebugTarget target = getDebugTarget();
|
||||
if ( target != null )
|
||||
{
|
||||
if ( target.getLaunch().getSourceLocator() instanceof IAdaptable )
|
||||
{
|
||||
if ( target != null ) {
|
||||
if ( target.getLaunch().getSourceLocator() instanceof IAdaptable ) {
|
||||
ICSourceLocator locator = (ICSourceLocator)((IAdaptable)target.getLaunch().getSourceLocator()).getAdapter( ICSourceLocator.class );
|
||||
if ( locator != null )
|
||||
{
|
||||
if ( locator != null ) {
|
||||
locator.setSourceLocations( block.getSourceLocations() );
|
||||
locator.setSearchForDuplicateFiles( block.searchForDuplicateFiles() );
|
||||
if ( target.getLaunch().getSourceLocator() instanceof IPersistableSourceLocator )
|
||||
{
|
||||
if ( target.getLaunch().getSourceLocator() instanceof IPersistableSourceLocator ) {
|
||||
ILaunchConfiguration configuration = target.getLaunch().getLaunchConfiguration();
|
||||
saveChanges( configuration, (IPersistableSourceLocator)target.getLaunch().getSourceLocator() );
|
||||
}
|
||||
|
@ -119,34 +107,30 @@ public class SourcePropertyPage extends PropertyPage
|
|||
}
|
||||
}
|
||||
|
||||
protected void saveChanges( ILaunchConfiguration configuration, IPersistableSourceLocator locator )
|
||||
{
|
||||
try
|
||||
{
|
||||
protected void saveChanges( ILaunchConfiguration configuration, IPersistableSourceLocator locator ) {
|
||||
try {
|
||||
ILaunchConfigurationWorkingCopy copy = configuration.copy( configuration.getName() );
|
||||
copy.setAttribute( ILaunchConfiguration.ATTR_SOURCE_LOCATOR_MEMENTO, locator.getMemento() );
|
||||
copy.doSave();
|
||||
}
|
||||
catch( CoreException e )
|
||||
{
|
||||
catch( CoreException e ) {
|
||||
CDebugUIPlugin.errorDialog( e.getMessage(), (IStatus)null );
|
||||
}
|
||||
}
|
||||
|
||||
private ILaunchConfiguration getLaunchConfiguration()
|
||||
{
|
||||
private ILaunchConfiguration getLaunchConfiguration() {
|
||||
ICDebugTarget target = getDebugTarget();
|
||||
return ( target != null ) ? target.getLaunch().getLaunchConfiguration() : null;
|
||||
return (target != null) ? target.getLaunch().getLaunchConfiguration() : null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.jface.dialogs.IDialogPage#dispose()
|
||||
*/
|
||||
public void dispose()
|
||||
{
|
||||
public void dispose() {
|
||||
if ( fBlock != null )
|
||||
fBlock.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue