1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

Externalizing strings.

This commit is contained in:
Mikhail Khodjaiants 2004-06-18 22:17:10 +00:00
parent ef4eaa9e09
commit 0c164d2456
87 changed files with 2498 additions and 3165 deletions

View file

@ -10,7 +10,6 @@
***********************************************************************/
package org.eclipse.cdt.debug.core;
import java.text.MessageFormat;
import java.util.HashMap;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
@ -67,7 +66,7 @@ public class CDebugCorePlugin extends Plugin {
private SessionManager fSessionManager = null;
static {
try {
fgResourceBundle = ResourceBundle.getBundle( "org.eclipse.cdt.debug.core.CDebugCorePluginResources" ); //$NON-NLS-1$
fgResourceBundle = ResourceBundle.getBundle( "org.eclipse.cdt.debug.internal.core.CDebugCorePluginResources" ); //$NON-NLS-1$
}
catch( MissingResourceException x ) {
fgResourceBundle = null;
@ -127,13 +126,7 @@ public class CDebugCorePlugin extends Plugin {
}
}
public static String getFormattedString( String key, String arg ) {
return MessageFormat.format( getResourceString( key ), new String[]{ arg } );
}
public static String getFormattedString( String key, String[] args ) {
return MessageFormat.format( getResourceString( key ), args );
}
public static ResourceBundle getResourceBundle() {
return fgResourceBundle;
@ -200,7 +193,7 @@ public class CDebugCorePlugin extends Plugin {
}
ICDebugConfiguration dbgCfg = (ICDebugConfiguration)fDebugConfigurations.get( id );
if ( dbgCfg == null ) {
IStatus status = new Status( IStatus.ERROR, getUniqueIdentifier(), 100, CDebugCorePlugin.getResourceString( "core.CDebugCorePlugin.No_such_debugger" ), null ); //$NON-NLS-1$
IStatus status = new Status( IStatus.ERROR, getUniqueIdentifier(), 100, DebugCoreMessages.getString( "CDebugCorePlugin.0" ), null ); //$NON-NLS-1$
throw new CoreException( status );
}
return dbgCfg;

View file

@ -1,46 +0,0 @@
core.CDebugCorePlugin.No_such_debugger=No such debugger
core.CDebugCorePlugin.Unable_to_set_temp_brkpt=Unable to set temporary breakpoint in main.\nReason: {0}\nContinue?
internal.core.sourcelookup.CSourceLocator.Unable_to_create_memento=Unable to create memento for C/C++ source locator.
internal.core.sourcelookup.CSourceLocator.Unable_to_restore_src_locator=Unable to restore C/C++ source locator - invalid format.
internal.core.sourcelookup.CSourceLocator.Exception_initializing_src_locator=Exception occurred initializing source locator.
internal.core.sourcelookup.CSourceLocator.Error_initializing_src_location=Error initializing directory source location.
internal.core.sourcelookup.CProjectSourceLocation.Unable_to_initialize_src_location_no_project_name=Unable to initialize source location - missing project name
internal.core.sourcelookup.CProjectSourceLocation.Exception_intializing_src_location=Exception occurred initializing source location.
internal.core.sourcelookup.CProjectSourceLocation.Unable_to_create_memento_for_src_location=Unable to create memento for C/C++ project source location {0}.
internal.core.sourcelookup.CDirectorySourceLocation.Unable_to_create_memento=Unable to create memento for C/C++ directory source location {0}
internal.core.sourcelookup.CDirectorySourceLocation.Unable_to_initialize_src_location_no_dir=Unable to initialize source location - missing directory path
internal.core.sourcelookup.CDirectorySourceLocation.Unable_to_initialize_src_location_invalid_dir=Unable to initialize source location - invalid directory path {0}
internal.core.sourcelookup.CDirectorySourceLocation.Exception_initializing_src_location=Exception occurred initializing source location.
internal.core.CBreakpointManager.Set_breakpoint_failed=Set breakpoint failed. Reason:
internal.core.CBreakpointManager.Delete_breakpoint_failed=Delete breakpoint failed. Reason:
internal.core.CBreakpointManager.Change_brkpt_properties_failed=Change breakpoint properties failed. Reason:
internal.core.breakpoints.CLineBreakpoint.Line_breakpoint=Line breakpoint:
internal.core.breakpoints.CLineBreakpoint.line=line:
internal.core.breakpoints.CBreakpoint.ignore_count=ignore count:
internal.core.breakpoints.CWatchpoint.Write_watchpoint=Write watchpoint
internal.core.breakpoints.CWatchpoint.Read_watchpoint=Read watchpoint
internal.core.breakpoints.CWatchpoint.Access_watchpoint=Access watchpoint
internal.core.breakpoints.CWatchpoint.Watchpoint=Watchpoint:
internal.core.breakpoints.CWatchpoint.at=at
internal.core.breakpoints.CAddressBreakpoint.Address_breakpoint=Address breakpoint:
internal.core.breakpoints.CAddressBreakpoint.address=\ [address:
internal.core.breakpoints.CFunctionBreakpoint.Function_breakpoint=Function breakpoint:
internal.core.breakpoints.CFunctionBreakpoint.function=function:
internal.core.breakpoints.CBreakpoint.if=\ if
internal.core.model.CStackFrame.function_at_file={0} at {1}:
internal.core.model.CArrayPartition.Type_not_available=Type is not available.
internal.core.model.CArrayPartition.Qualified_name_not_available=Qualified name is not available.
internal.core.model.CVariable.Value_modification_unsupported=Variable does not support value modification.
internal.core.model.CVariable.Qualified_name_unavailable=Qualified name is not available.
internal.core.model.CVariable.Type_unavailable=Type is not available.
internal.core.model.CVariable.not_available=not available: {0}
internal.core.model.CValue.Not_available=not available:
internal.core.model.CModificationVariable.Unable_to_set_value=Unable to set value.
internal.core.model.CThread.Stack_not_available=Stack is not available:
internal.core.model.CDebugTarget.Disconnect_session_unsupported=Session does not support \'disconnect\'
internal.core.model.CDebugTarget.Execution_suspended_because_of_error=The execution of program is suspended because of error.
internal.core.model.CDebugElement.Target_request_failed=Target request failed:
internal.core.DisassemblyStorage.disassembly=disassembly

View file

@ -6,6 +6,7 @@
package org.eclipse.cdt.debug.core;
import java.text.MessageFormat;
import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.ICDIConfiguration;
import org.eclipse.cdt.debug.core.cdi.ICDILocation;
@ -373,8 +374,7 @@ public class CDebugModel
}
catch( DebugException e )
{
//String message = MessageFormat.format( "Unable to set temporary breakpoint in main.\nReason: {0}\nContinue?", new String[] { e.getStatus().getMessage() } );
String message = CDebugCorePlugin.getFormattedString("core.CDebugCorePlugin.Unable_to_set_temp_brkpt", new String[] { e.getStatus().getMessage() } ); //$NON-NLS-1$
String message = MessageFormat.format( DebugCoreMessages.getString( "CDebugModel.0" ), new String[] { e.getStatus().getMessage() } ); //$NON-NLS-1$
IStatus newStatus = new Status( IStatus.WARNING,
e.getStatus().getPlugin(),
ICDebugInternalConstants.STATUS_CODE_QUESTION,

View file

@ -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.core;
import java.util.MissingResourceException;
//import java.util.ResourceBundle;
public class DebugCoreMessages {
// private static final String BUNDLE_NAME = "org.eclipse.cdt.debug.core.DebugCoreMessages";//$NON-NLS-1$
// private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME );
private DebugCoreMessages() {
}
public static String getString( String key ) {
try {
return CDebugCorePlugin.getResourceString( key );
// return RESOURCE_BUNDLE.getString( key );
}
catch( MissingResourceException e ) {
return '!' + key + '!';
}
}
}

View file

@ -0,0 +1,2 @@
CDebugCorePlugin.0=No such debugger
CDebugModel.0=Unable to set temporary breakpoint in main.\nReason: {0}\nContinue?

View file

@ -10,6 +10,7 @@
***********************************************************************/
package org.eclipse.cdt.debug.internal.core;
import java.text.MessageFormat;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
@ -291,13 +292,13 @@ public class CBreakpointManager implements IBreakpointManagerListener, ICDIEvent
setBreakpointCondition( breakpoint );
}
catch( CoreException e ) {
requestFailed( CDebugCorePlugin.getResourceString( "internal.core.CBreakpointManager.Set_breakpoint_failed" ) + e.getMessage(), e ); //$NON-NLS-1$
requestFailed( MessageFormat.format( InternalDebugCoreMessages.getString( "CBreakpointManager.0" ), new String[] { e.getMessage() } ), e ); //$NON-NLS-1$
}
catch( NumberFormatException e ) {
requestFailed( CDebugCorePlugin.getResourceString( "internal.core.CBreakpointManager.Set_breakpoint_failed" ) + e.getMessage(), e ); //$NON-NLS-1$
requestFailed( MessageFormat.format( InternalDebugCoreMessages.getString( "CBreakpointManager.1" ), new String[] { e.getMessage() } ), e ); //$NON-NLS-1$
}
catch( CDIException e ) {
targetRequestFailed( CDebugCorePlugin.getResourceString( "internal.core.CBreakpointManager.Set_breakpoint_failed" ) + e.getMessage(), e ); //$NON-NLS-1$
targetRequestFailed( MessageFormat.format( InternalDebugCoreMessages.getString( "CBreakpointManager.2" ), new String[] { e.getMessage() } ), e ); //$NON-NLS-1$
}
}
@ -313,7 +314,7 @@ public class CBreakpointManager implements IBreakpointManagerListener, ICDIEvent
bm.deleteBreakpoints( new ICDIBreakpoint[]{ cdiBreakpoint } );
}
catch( CDIException e ) {
targetRequestFailed( CDebugCorePlugin.getResourceString( "internal.core.CBreakpointManager.Delete_breakpoint_failed" ) + e.getMessage(), e ); //$NON-NLS-1$
targetRequestFailed( MessageFormat.format( InternalDebugCoreMessages.getString( "CBreakpointManager.3" ), new String[] { e.getMessage() } ), e ); //$NON-NLS-1$
}
}
}
@ -343,10 +344,10 @@ public class CBreakpointManager implements IBreakpointManagerListener, ICDIEvent
}
}
catch( CoreException e ) {
requestFailed( CDebugCorePlugin.getResourceString( "internal.core.CBreakpointManager.Change_brkpt_properties_failed" ) + e.getMessage(), e ); //$NON-NLS-1$
requestFailed( MessageFormat.format( InternalDebugCoreMessages.getString( "CBreakpointManager.4" ), new String[] { e.getMessage() } ), e ); //$NON-NLS-1$
}
catch( CDIException e ) {
targetRequestFailed( CDebugCorePlugin.getResourceString( "internal.core.CBreakpointManager.Change_brkpt_properties_failed" ) + e.getMessage(), e ); //$NON-NLS-1$
targetRequestFailed( MessageFormat.format( InternalDebugCoreMessages.getString( "CBreakpointManager.5" ), new String[] { e.getMessage() } ), e ); //$NON-NLS-1$
}
}
@ -670,4 +671,4 @@ public class CBreakpointManager implements IBreakpointManagerListener, ICDIEvent
}
}
}
}
}

View file

@ -0,0 +1,36 @@
CDebugCorePlugin.0=No such debugger
CDebugModel.0=Unable to set temporary breakpoint in main.\nReason: {0}\nContinue?
CBreakpointManager.0=Set breakpoint failed. Reason: {0}.
CBreakpointManager.1=Set breakpoint failed. Reason: {0}.
CBreakpointManager.2=Set breakpoint failed. Reason: {0}.
CBreakpointManager.3=Delete breakpoint failed. Reason: {0}.
CBreakpointManager.4=Change breakpoint properties failed. Reason: {0}.
CBreakpointManager.5=Change breakpoint properties failed. Reason: {0}.
CDebugTarget.Unable_to_get_globals_1=Unable to get globals. Reason:
CArrayPartition.0=Type is not available.
CArrayPartition.1=Qualified name is not available.
CDebugTarget.0=Session does not support 'disconnect'.
CDebugTarget.1=Execution is suspended because of error.
CModificationVariable.0=Unable to set value.
CModificationVariable.1=Unable to set value.
CStackFrame.0={0} at {1}: {2}
CThread.0=Stack is not available: {0}.
CThread.1=Stack is not available: {0}.
CValue.0=not available:
CVariable.0=not available: {0}
CVariable.1=not available: {0}
CVariable.2=Variable does not support value modification.
CVariable.3=Variable does not support value modification.
CVariable.4=Qualified name is not available.
CVariable.5=Type is not available.
CDirectorySourceLocation.0=Unable to create memento for C/C++ directory source location {0}.
CDirectorySourceLocation.1=Unable to initialize source location - missing directory path.
CDirectorySourceLocation.2=Unable to initialize source location - invalid directory path {0}.
CDirectorySourceLocation.3=Exception occurred initializing source location.
CProjectSourceLocation.0=Unable to create memento for C/C++ project source location {0}.
CProjectSourceLocation.1=Unable to initialize source location - missing project name
CProjectSourceLocation.2=Exception occurred initializing source location.
CSourceLocator.0=Unable to create memento for C/C++ source locator.
CSourceLocator.1=Unable to restore C/C++ source locator - invalid format.
CSourceLocator.2=Exception occurred initializing source locator.
CSourceLocator.3=Error initializing directory source location.

View file

@ -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.core;
import java.util.MissingResourceException;
//import java.util.ResourceBundle;
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
public class InternalDebugCoreMessages {
// private static final String BUNDLE_NAME = "org.eclipse.cdt.debug.internal.core.InternalDebugCoreMessages";//$NON-NLS-1$
// private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME );
private InternalDebugCoreMessages() {
}
public static String getString( String key ) {
try {
return CDebugCorePlugin.getResourceString( key );
// return RESOURCE_BUNDLE.getString( key );
}
catch( MissingResourceException e ) {
return '!' + key + '!';
}
}
}

View file

@ -0,0 +1,6 @@
CBreakpointManager.0=Set breakpoint failed. Reason: {0}.
CBreakpointManager.1=Set breakpoint failed. Reason: {0}.
CBreakpointManager.2=Set breakpoint failed. Reason: {0}.
CBreakpointManager.3=Delete breakpoint failed. Reason: {0}.
CBreakpointManager.4=Change breakpoint properties failed. Reason: {0}.
CBreakpointManager.5=Change breakpoint properties failed. Reason: {0}.

View file

@ -8,7 +8,6 @@ package org.eclipse.cdt.debug.internal.core.model;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.event.ICDIEvent;
import org.eclipse.cdt.debug.core.cdi.model.ICDIValue;
@ -18,7 +17,6 @@ import org.eclipse.cdt.debug.core.cdi.model.type.ICDIArrayValue;
import org.eclipse.cdt.debug.core.model.ICType;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.model.IValue;
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
/**
*
@ -178,7 +176,7 @@ public class CArrayPartition extends CVariable
}
catch (CDIException e)
{
requestFailed( CDebugCorePlugin.getResourceString("internal.core.model.CArrayPartition.Type_not_available"), e ); //$NON-NLS-1$
requestFailed( CoreModelMessages.getString( "CArrayPartition.0" ), e ); //$NON-NLS-1$
}
}
return fType;
@ -208,7 +206,7 @@ public class CArrayPartition extends CVariable
}
catch( CDIException e )
{
requestFailed( CDebugCorePlugin.getResourceString("internal.core.model.CArrayPartition.Qualified_name_not_available"), e ); //$NON-NLS-1$
requestFailed( CoreModelMessages.getString( "CArrayPartition.1" ), e ); //$NON-NLS-1$
}
}
return fQualifiedName;

View file

@ -6,6 +6,7 @@
package org.eclipse.cdt.debug.internal.core.model;
import java.text.MessageFormat;
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
import org.eclipse.cdt.debug.core.CDebugModel;
import org.eclipse.cdt.debug.core.CDebugUtils;
@ -250,7 +251,7 @@ public class CDebugElement extends PlatformObject
*/
public void targetRequestFailed( String message, CDIException e ) throws DebugException
{
requestFailed( CDebugCorePlugin.getResourceString("internal.core.model.CDebugElement.Target_request_failed") + message, e, DebugException.TARGET_REQUEST_FAILED ); //$NON-NLS-1$
requestFailed( MessageFormat.format( "Target request failed: {0}.", new String[] { message } ), e, DebugException.TARGET_REQUEST_FAILED ); //$NON-NLS-1$
}
/**
@ -275,7 +276,7 @@ public class CDebugElement extends PlatformObject
*/
public void targetRequestFailed( String message, Throwable e ) throws DebugException
{
throwDebugException( CDebugCorePlugin.getResourceString("internal.core.model.CDebugElement.Target_request_failed") + message, DebugException.TARGET_REQUEST_FAILED, e ); //$NON-NLS-1$
throwDebugException( MessageFormat.format( "Target request failed: {0}.", new String[] { message } ), DebugException.TARGET_REQUEST_FAILED, e ); //$NON-NLS-1$
}
/**

View file

@ -865,7 +865,7 @@ public class CDebugTarget extends CDebugElement
if ( !canDisconnect() )
{
notSupported( CDebugCorePlugin.getResourceString("internal.core.model.CDebugTarget.Disconnect_session_unsupported") ); //$NON-NLS-1$
notSupported( CoreModelMessages.getString( "CDebugTarget.0" ) ); //$NON-NLS-1$
}
try
@ -1549,7 +1549,8 @@ public class CDebugTarget extends CDebugElement
{
MultiStatus status = new MultiStatus( CDebugCorePlugin.getUniqueIdentifier(),
ICDebugInternalConstants.STATUS_CODE_ERROR,
CDebugCorePlugin.getResourceString("internal.core.model.CDebugTarget.Execution_suspended_because_of_error"), null ); //$NON-NLS-1$
CoreModelMessages.getString( "CDebugTarget.1" ), //$NON-NLS-1$
null );
StringTokenizer st = new StringTokenizer( info.getDetailMessage(), "\n\r" ); //$NON-NLS-1$
while( st.hasMoreTokens() )
{

View file

@ -12,7 +12,7 @@ import org.eclipse.cdt.debug.core.cdi.model.ICDIVariable;
import org.eclipse.cdt.debug.core.cdi.model.ICDIVariableObject;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.model.IValue;
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
import org.eclipse.debug.core.model.IValueModification;
/**
*
@ -70,7 +70,7 @@ public class CModificationVariable extends CVariable
if ( cdiVariable != null )
cdiVariable.setValue( newExpression );
else
requestFailed( CDebugCorePlugin.getResourceString("internal.core.model.CModificationVariable.Unable_to_set_value"), null ); //$NON-NLS-1$
requestFailed( CoreModelMessages.getString( "CModificationVariable.0" ), null ); //$NON-NLS-1$
}
catch( CDIException e )
@ -94,7 +94,7 @@ public class CModificationVariable extends CVariable
if ( cdiVariable != null )
cdiVariable.setValue( value );
else
requestFailed( CDebugCorePlugin.getResourceString("internal.core.model.CModificationVariable.Unable_to_set_value"), null ); //$NON-NLS-1$
requestFailed( CoreModelMessages.getString( "CModificationVariable.1" ), null ); //$NON-NLS-1$
}
catch( CDIException e )
{

View file

@ -10,6 +10,7 @@
***********************************************************************/
package org.eclipse.cdt.debug.internal.core.model;
import java.text.MessageFormat;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.Arrays;
@ -220,7 +221,7 @@ public class CStackFrame extends CDebugElement implements ICStackFrame, IRestart
else {
return func;
}
return CDebugCorePlugin.getFormattedString( "internal.core.model.CStackFrame.function_at_file", new String[]{ func, file } ) + line; //$NON-NLS-1$
return MessageFormat.format( CoreModelMessages.getString( "CStackFrame.0" ), new String[]{ func, file, line } ); //$NON-NLS-1$
}
/*

View file

@ -6,12 +6,11 @@
package org.eclipse.cdt.debug.internal.core.model;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
import org.eclipse.cdt.debug.core.CDebugUtils;
import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.ICDIConfiguration;
@ -272,7 +271,7 @@ public class CThread extends CDebugElement
}
catch( CDIException e )
{
setStatus( ICDebugElementErrorStatus.WARNING, CDebugCorePlugin.getResourceString("internal.core.model.CThread.Stack_not_available") + e.getMessage() ); //$NON-NLS-1$
setStatus( ICDebugElementErrorStatus.WARNING, MessageFormat.format( CoreModelMessages.getString( "CThread.0" ), new String[] { e.getMessage() } ) ); //$NON-NLS-1$
targetRequestFailed( e.getMessage(), null );
}
return new ICDIStackFrame[0];
@ -1041,7 +1040,7 @@ public class CThread extends CDebugElement
}
catch( CDIException e )
{
setStatus( ICDebugElementErrorStatus.WARNING, CDebugCorePlugin.getResourceString("internal.core.model.CThread.Stack_not_available") + e.getMessage() ); //$NON-NLS-1$
setStatus( ICDebugElementErrorStatus.WARNING, MessageFormat.format( CoreModelMessages.getString( "CThread.1" ), new String[] { e.getMessage() } ) ); //$NON-NLS-1$
}
return depth;
}

View file

@ -12,7 +12,6 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.ICDIFormat;
import org.eclipse.cdt.debug.core.cdi.model.ICDIValue;
@ -33,7 +32,6 @@ import org.eclipse.cdt.debug.core.model.ICExpressionEvaluator;
import org.eclipse.cdt.debug.core.model.ICValue;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.model.IVariable;
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
/**
*
@ -187,7 +185,7 @@ public class CValue extends CDebugElement implements ICValue
}
catch( CDIException e )
{
requestFailed( CDebugCorePlugin.getResourceString("internal.core.model.CValue.Not_available"), e ); //$NON-NLS-1$
requestFailed( CoreModelMessages.getString( "CValue.0" ), e ); //$NON-NLS-1$
}
return Arrays.asList( vars );
}

View file

@ -6,6 +6,7 @@
package org.eclipse.cdt.debug.internal.core.model;
import java.text.MessageFormat;
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
import org.eclipse.cdt.debug.core.ICDebugConstants;
@ -205,8 +206,7 @@ public abstract class CVariable extends CDebugElement
catch( CDIException e )
{
fCDIVariable = new ErrorVariable( getCDIVariableObject(), e );
setStatus( ICDebugElementErrorStatus.ERROR,
CDebugCorePlugin.getFormattedString( "internal.core.model.CVariable.not_available", new String[] { e.getMessage() } ) ); //$NON-NLS-1$
setStatus( ICDebugElementErrorStatus.ERROR, MessageFormat.format( CoreModelMessages.getString( "CVariable.0" ), new String[] { e.getMessage() } ) ); //$NON-NLS-1$
}
}
return fCDIVariable;
@ -415,7 +415,7 @@ public abstract class CVariable extends CDebugElement
fShadow = null;
if ( cdiVariableObject instanceof ErrorVariable )
setStatus( ICDebugElementErrorStatus.ERROR,
CDebugCorePlugin.getFormattedString( "internal.core.model.CVariable.not_available", new String[] { ((ErrorVariable)cdiVariableObject).getException().getMessage() } ) ); //$NON-NLS-1$
MessageFormat.format( CoreModelMessages.getString( "CVariable.1" ), new String[] { ((ErrorVariable)cdiVariableObject).getException().getMessage() } ) ); //$NON-NLS-1$
fFormat = CDebugCorePlugin.getDefault().getPluginPreferences().getInt( ICDebugConstants.PREF_DEFAULT_VARIABLE_FORMAT );
getCDISession().getEventManager().addEventListener( this );
}
@ -485,7 +485,7 @@ public abstract class CVariable extends CDebugElement
*/
public void setValue( String expression ) throws DebugException
{
notSupported( CDebugCorePlugin.getResourceString("internal.core.model.CVariable.Value_modification_unsupported") ); //$NON-NLS-1$
notSupported( CoreModelMessages.getString( "CVariable.2" ) ); //$NON-NLS-1$
}
/* (non-Javadoc)
@ -493,7 +493,7 @@ public abstract class CVariable extends CDebugElement
*/
public void setValue( IValue value ) throws DebugException
{
notSupported( CDebugCorePlugin.getResourceString("internal.core.model.CVariable.Value_modification_unsupported") ); //$NON-NLS-1$
notSupported( CoreModelMessages.getString( "CVariable.3" ) ); //$NON-NLS-1$
}
/* (non-Javadoc)
@ -938,7 +938,7 @@ public abstract class CVariable extends CDebugElement
}
catch( CDIException e )
{
requestFailed( CDebugCorePlugin.getResourceString("internal.core.model.CVariable.Qualified_name_unavailable"), e ); //$NON-NLS-1$
requestFailed( CoreModelMessages.getString( "CVariable.4" ), e ); //$NON-NLS-1$
}
return result;
}
@ -959,7 +959,7 @@ public abstract class CVariable extends CDebugElement
}
catch( CDIException e )
{
requestFailed( CDebugCorePlugin.getResourceString("internal.core.model.CVariable.Type_unavailable"), e ); //$NON-NLS-1$
requestFailed( CoreModelMessages.getString( "CVariable.5" ), e ); //$NON-NLS-1$
}
}
return type;

View file

@ -11,20 +11,22 @@
package org.eclipse.cdt.debug.internal.core.model;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
//import java.util.ResourceBundle;
public class CoreModelMessages {
private static final String BUNDLE_NAME = "org.eclipse.cdt.debug.internal.core.model.CoreModelMessages"; //$NON-NLS-1$
// private static final String BUNDLE_NAME = "org.eclipse.cdt.debug.internal.core.model.CoreModelMessages"; //$NON-NLS-1$
private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME );
// private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME );
private CoreModelMessages() {
}
public static String getString( String key ) {
try {
return RESOURCE_BUNDLE.getString( key );
return CDebugCorePlugin.getResourceString( key );
// return RESOURCE_BUNDLE.getString( key );
}
catch( MissingResourceException e ) {
return '!' + key + '!';

View file

@ -1 +1,17 @@
CDebugTarget.Unable_to_get_globals_1=Unable to get globals. Reason:
CArrayPartition.0=Type is not available.
CArrayPartition.1=Qualified name is not available.
CDebugTarget.0=Session does not support 'disconnect'.
CDebugTarget.1=Execution is suspended because of error.
CModificationVariable.0=Unable to set value.
CModificationVariable.1=Unable to set value.
CStackFrame.0={0} at {1}: {2}
CThread.0=Stack is not available: {0}.
CThread.1=Stack is not available: {0}.
CValue.0=not available:
CVariable.0=not available: {0}
CVariable.1=not available: {0}
CVariable.2=Variable does not support value modification.
CVariable.3=Variable does not support value modification.
CVariable.4=Qualified name is not available.
CVariable.5=Type is not available.

View file

@ -319,7 +319,7 @@ public class CDirectorySourceLocation implements IDirectorySourceLocation
{
ex = e;
}
abort( MessageFormat.format( CDebugCorePlugin.getResourceString( "internal.core.sourcelookup.CDirectorySourceLocation.Unable_to_create_memento" ), new String[] { getDirectory().toOSString() } ), ex ); //$NON-NLS-1$
abort( MessageFormat.format( InternalSourceLookupMessages.getString( "CDirectorySourceLocation.0" ), new String[] { getDirectory().toOSString() } ), ex ); //$NON-NLS-1$
// execution will not reach here
return null;
}
@ -341,7 +341,7 @@ public class CDirectorySourceLocation implements IDirectorySourceLocation
String dir = root.getAttribute( ATTR_DIRECTORY );
if ( isEmpty( dir ) )
{
abort( CDebugCorePlugin.getResourceString("internal.core.sourcelookup.CDirectorySourceLocation.Unable_to_initialize_src_location_no_dir"), null ); //$NON-NLS-1$
abort( InternalSourceLookupMessages.getString( "CDirectorySourceLocation.1" ), null ); //$NON-NLS-1$
}
else
{
@ -352,7 +352,7 @@ public class CDirectorySourceLocation implements IDirectorySourceLocation
}
else
{
abort( MessageFormat.format( CDebugCorePlugin.getResourceString("internal.core.sourcelookup.CDirectorySourceLocation.Unable_to_initialize_src_location_invalid_dir"), new String[] { dir } ), null ); //$NON-NLS-1$
abort( MessageFormat.format( InternalSourceLookupMessages.getString( "CDirectorySourceLocation.2" ), new String[] { dir } ), null ); //$NON-NLS-1$
}
}
dir = root.getAttribute( ATTR_ASSOCIATION );
@ -387,7 +387,7 @@ public class CDirectorySourceLocation implements IDirectorySourceLocation
{
ex = e;
}
abort( CDebugCorePlugin.getResourceString("internal.core.sourcelookup.CDirectorySourceLocation.Exception_initializing_src_location"), ex ); //$NON-NLS-1$
abort( InternalSourceLookupMessages.getString( "CDirectorySourceLocation.3" ), ex ); //$NON-NLS-1$
}
/**

View file

@ -8,6 +8,7 @@ package org.eclipse.cdt.debug.internal.core.sourcelookup;
import java.io.File;
import java.io.IOException;
import java.io.StringReader;
import java.text.MessageFormat;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
@ -251,7 +252,7 @@ public class CProjectSourceLocation implements IProjectSourceLocation
{
ex = e;
}
abort( CDebugCorePlugin.getFormattedString( "internal.core.sourcelookup.CProjectSourceLocation.Unable_to_create_memento_for_src_location", new String[] { getProject().getName() } ), ex ); //$NON-NLS-1$
abort( MessageFormat.format( InternalSourceLookupMessages.getString( "CProjectSourceLocation.0" ), new String[] { getProject().getName() } ), ex ); //$NON-NLS-1$
// execution will not reach here
return null;
}
@ -273,7 +274,7 @@ public class CProjectSourceLocation implements IProjectSourceLocation
String name = root.getAttribute( ATTR_PROJECT );
if ( isEmpty( name ) )
{
abort( CDebugCorePlugin.getResourceString("internal.core.sourcelookup.CProjectSourceLocation.Unable_to_initialize_src_location_no_project_name"), null ); //$NON-NLS-1$
abort( InternalSourceLookupMessages.getString( "CProjectSourceLocation.1" ), null ); //$NON-NLS-1$
}
else
{
@ -298,7 +299,7 @@ public class CProjectSourceLocation implements IProjectSourceLocation
{
ex = e;
}
abort( CDebugCorePlugin.getResourceString("internal.core.sourcelookup.CProjectSourceLocation.Exception_intializing_src_location"), ex ); //$NON-NLS-1$
abort( InternalSourceLookupMessages.getString( "CProjectSourceLocation.2" ), ex ); //$NON-NLS-1$
}
/**

View file

@ -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.core.sourcelookup;
import java.io.IOException;
@ -49,21 +53,24 @@ import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
/**
*
* Default source locator.
*
* @since Aug 19, 2002
*/
public class CSourceLocator implements ICSourceLocator, IPersistableSourceLocator, IResourceChangeListener {
public class CSourceLocator implements ICSourceLocator, IPersistableSourceLocator, IResourceChangeListener
{
private static final String SOURCE_LOCATOR_NAME = "cSourceLocator"; //$NON-NLS-1$
private static final String DISABLED_GENERIC_PROJECT_NAME = "disabledGenericProject"; //$NON-NLS-1$
private static final String ADDITIONAL_SOURCE_LOCATION_NAME = "additionalSourceLocation"; //$NON-NLS-1$
private static final String SOURCE_LOCATION_NAME = "cSourceLocation"; //$NON-NLS-1$
private static final String ATTR_CLASS = "class"; //$NON-NLS-1$
private static final String ATTR_MEMENTO = "memento"; //$NON-NLS-1$
private static final String ATTR_PROJECT_NAME = "projectName"; //$NON-NLS-1$
private static final String ATTR_DUPLICATE_FILES = "duplicateFiles"; //$NON-NLS-1$
/**
@ -82,62 +89,54 @@ public class CSourceLocator implements ICSourceLocator, IPersistableSourceLocato
private List fReferencedProjects = new ArrayList( 10 );
/**
* The flag specifies whether to search for all source elements,
* or just the first match.
* The flag specifies whether to search for all source elements, or just the first match.
*/
private boolean fDuplicateFiles = false;
/**
* Constructor for CSourceLocator.
*/
public CSourceLocator( IProject project )
{
public CSourceLocator( IProject project ) {
setProject( project );
setReferencedProjects();
setSourceLocations( getDefaultSourceLocations() );
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.debug.core.model.ISourceLocator#getSourceElement(IStackFrame)
*/
public Object getSourceElement( IStackFrame stackFrame )
{
public Object getSourceElement( IStackFrame stackFrame ) {
return getInput( stackFrame );
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.debug.core.ICSourceLocator#getLineNumber(IStackFrameInfo)
*/
public int getLineNumber( IStackFrame frame )
{
return ( frame instanceof ICStackFrame ) ? ((ICStackFrame)frame).getFrameLineNumber() : 0;
public int getLineNumber( IStackFrame frame ) {
return (frame instanceof ICStackFrame) ? ((ICStackFrame)frame).getFrameLineNumber() : 0;
}
protected Object getInput( IStackFrame f )
{
if ( f instanceof ICStackFrame )
{
protected Object getInput( IStackFrame f ) {
if ( f instanceof ICStackFrame ) {
ICStackFrame frame = (ICStackFrame)f;
LinkedList list = new LinkedList();
if ( frame != null )
{
if ( frame != null ) {
Object result = null;
String fileName = frame.getFile();
if ( fileName != null && fileName.length() > 0 )
{
if ( fileName != null && fileName.length() > 0 ) {
ICSourceLocation[] locations = getSourceLocations();
for ( int i = 0; i < locations.length; ++i )
{
try
{
for( int i = 0; i < locations.length; ++i ) {
try {
result = locations[i].findSourceElement( fileName );
}
catch( CoreException e )
{
catch( CoreException e ) {
// do nothing
}
if ( result != null )
{
if ( result != null ) {
if ( result instanceof List )
list.addAll( (List)result );
else
@ -147,135 +146,117 @@ public class CSourceLocator implements ICSourceLocator, IPersistableSourceLocato
}
}
}
}
return ( list.size() > 0 ) ? ( ( list.size() == 1 ) ? list.getFirst() : list ) : null;
}
return (list.size() > 0) ? ((list.size() == 1) ? list.getFirst() : list) : null;
}
return null;
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.debug.core.ICSourceLocator#contains(IResource)
*/
public boolean contains( IResource resource )
{
public boolean contains( IResource resource ) {
ICSourceLocation[] locations = getSourceLocations();
for ( int i = 0; i < locations.length; ++i )
{
if ( resource instanceof IProject )
{
if ( locations[i] instanceof CProjectSourceLocation &&
((CProjectSourceLocation)locations[i]).getProject().equals( resource ) )
{
for( int i = 0; i < locations.length; ++i ) {
if ( resource instanceof IProject ) {
if ( locations[i] instanceof CProjectSourceLocation && ((CProjectSourceLocation)locations[i]).getProject().equals( resource ) ) {
return true;
}
}
if ( resource instanceof IFile )
{
try
{
if ( resource instanceof IFile ) {
try {
Object result = locations[i].findSourceElement( resource.getLocation().toOSString() );
if ( result instanceof IFile && ((IFile)result).equals( resource ) )
return true;
if ( result instanceof List && ((List)result).contains( resource ) )
return true;
}
catch( CoreException e )
{
catch( CoreException e ) {
}
}
}
return false;
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator#getSourceLocations()
*/
public ICSourceLocation[] getSourceLocations()
{
public ICSourceLocation[] getSourceLocations() {
return fSourceLocations;
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator#setSourceLocations(ICSourceLocation[])
*/
public void setSourceLocations( ICSourceLocation[] locations )
{
public void setSourceLocations( ICSourceLocation[] locations ) {
fSourceLocations = locations;
}
/**
* Returns a default collection of source locations for
* the given project. Default source locations consist
* of the given project and all of its referenced projects.
* Returns a default collection of source locations for the given project. Default source locations consist of the given project and all of its referenced
* projects.
*
* @param project a project
* @return a collection of source locations for all required
* projects
* @exception CoreException
* @param project
* a project
* @return a collection of source locations for all required projects
* @exception CoreException
*/
public static ICSourceLocation[] getDefaultSourceLocations( IProject project )
{
public static ICSourceLocation[] getDefaultSourceLocations( IProject project ) {
ArrayList list = new ArrayList();
if ( project != null && project.exists() )
{
if ( project != null && project.exists() ) {
list.add( SourceLookupFactory.createProjectSourceLocation( project ) );
addReferencedSourceLocations( list, project );
}
return (ICSourceLocation[])list.toArray( new ICSourceLocation[list.size()] );
}
private static void addReferencedSourceLocations( List list, IProject project )
{
if ( project != null )
{
try
{
private static void addReferencedSourceLocations( List list, IProject project ) {
if ( project != null ) {
try {
IProject[] projects = project.getReferencedProjects();
for ( int i = 0; i < projects.length; i++ )
{
if ( projects[i].exists() && !containsProject( list, projects[i] ) )
{
for( int i = 0; i < projects.length; i++ ) {
if ( projects[i].exists() && !containsProject( list, projects[i] ) ) {
list.add( SourceLookupFactory.createProjectSourceLocation( projects[i] ) );
addReferencedSourceLocations( list, projects[i] );
}
}
}
catch( CoreException e )
{
catch( CoreException e ) {
// do nothing
}
}
}
private static boolean containsProject( List list, IProject project )
{
private static boolean containsProject( List list, IProject project ) {
Iterator it = list.iterator();
while( it.hasNext() )
{
while( it.hasNext() ) {
CProjectSourceLocation location = (CProjectSourceLocation)it.next();
if ( project.equals( location.getProject() ) )
return true;
}
return false;
}
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator#findSourceElement(String)
*/
public Object findSourceElement( String fileName )
{
public Object findSourceElement( String fileName ) {
Object result = null;
if ( fileName != null && fileName.length() > 0 )
{
if ( fileName != null && fileName.length() > 0 ) {
ICSourceLocation[] locations = getSourceLocations();
for ( int i = 0; i < locations.length; ++i )
{
try
{
for( int i = 0; i < locations.length; ++i ) {
try {
result = locations[i].findSourceElement( fileName );
}
catch( CoreException e )
{
catch( CoreException e ) {
// do nothing
}
if ( result != null )
@ -285,117 +266,100 @@ public class CSourceLocator implements ICSourceLocator, IPersistableSourceLocato
return result;
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.debug.core.model.IPersistableSourceLocator#getMemento()
*/
public String getMemento() throws CoreException
{
Document document = null;
Throwable ex = null;
try
{
document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
Element node = document.createElement( SOURCE_LOCATOR_NAME );
document.appendChild( node );
ICSourceLocation[] locations = getSourceLocations();
saveDisabledGenericSourceLocations( locations, document, node );
saveAdditionalSourceLocations( locations, document, node );
node.setAttribute( ATTR_DUPLICATE_FILES, new Boolean( searchForDuplicateFiles() ).toString() );
public String getMemento() throws CoreException {
Document document = null;
Throwable ex = null;
try {
document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
Element node = document.createElement( SOURCE_LOCATOR_NAME );
document.appendChild( node );
ICSourceLocation[] locations = getSourceLocations();
saveDisabledGenericSourceLocations( locations, document, node );
saveAdditionalSourceLocations( locations, document, node );
node.setAttribute( ATTR_DUPLICATE_FILES, new Boolean( searchForDuplicateFiles() ).toString() );
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( CDebugCorePlugin.getResourceString( "internal.core.sourcelookup.CSourceLocator.Unable_to_create_memento" ), ex ); //$NON-NLS-1$
catch( TransformerException e ) {
ex = e;
}
abort( InternalSourceLookupMessages.getString( "CSourceLocator.0" ), ex ); //$NON-NLS-1$
// execution will not reach here
return null;
}
/* (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 {
setSourceLocations( getDefaultSourceLocations() );
}
/* (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( SOURCE_LOCATOR_NAME ) )
{
abort( CDebugCorePlugin.getResourceString("internal.core.sourcelookup.CSourceLocator.Unable_to_restore_src_locator"), null ); //$NON-NLS-1$
if ( !root.getNodeName().equalsIgnoreCase( SOURCE_LOCATOR_NAME ) ) {
abort( InternalSourceLookupMessages.getString( "CSourceLocator.1" ) , null ); //$NON-NLS-1$
}
List sourceLocations = new ArrayList();
// Add locations based on referenced projects
IProject project = getProject();
if ( project != null && project.exists() && project.isOpen() )
sourceLocations.addAll( Arrays.asList( getDefaultSourceLocations() ) );
removeDisabledLocations( root, sourceLocations );
addAdditionalLocations( root, sourceLocations );
// To support old launch configuration
addOldLocations( root, sourceLocations );
setSourceLocations( (ICSourceLocation[])sourceLocations.toArray( new ICSourceLocation[sourceLocations.size()] ) );
setSearchForDuplicateFiles( Boolean.valueOf( root.getAttribute( ATTR_DUPLICATE_FILES ) ).booleanValue() );
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( CDebugCorePlugin.getResourceString("internal.core.sourcelookup.CSourceLocator.Exception_initializing_src_locator"), ex ); //$NON-NLS-1$
abort( InternalSourceLookupMessages.getString( "CSourceLocator.2" ), ex ); //$NON-NLS-1$
}
private void removeDisabledLocations( Element root, List sourceLocations )
{
private void removeDisabledLocations( Element root, List sourceLocations ) {
NodeList list = root.getChildNodes();
int length = list.getLength();
HashSet disabledProjects = new HashSet( length );
for ( int i = 0; i < length; ++i )
{
for( int i = 0; i < length; ++i ) {
Node node = list.item( i );
short type = node.getNodeType();
if ( type == Node.ELEMENT_NODE )
{
if ( type == Node.ELEMENT_NODE ) {
Element entry = (Element)node;
if ( entry.getNodeName().equalsIgnoreCase( DISABLED_GENERIC_PROJECT_NAME ) )
{
if ( entry.getNodeName().equalsIgnoreCase( DISABLED_GENERIC_PROJECT_NAME ) ) {
String projectName = entry.getAttribute( ATTR_PROJECT_NAME );
if ( isEmpty( projectName ) )
{
if ( isEmpty( projectName ) ) {
CDebugCorePlugin.log( "Unable to restore C/C++ source locator - invalid format." ); //$NON-NLS-1$
}
disabledProjects.add( projectName.trim() );
@ -403,74 +367,55 @@ public class CSourceLocator implements ICSourceLocator, IPersistableSourceLocato
}
}
Iterator it = sourceLocations.iterator();
while( it.hasNext() )
{
while( it.hasNext() ) {
ICSourceLocation location = (ICSourceLocation)it.next();
if ( location instanceof IProjectSourceLocation &&
disabledProjects.contains( ((IProjectSourceLocation)location).getProject().getName() ) )
it.remove();
if ( location instanceof IProjectSourceLocation && disabledProjects.contains( ((IProjectSourceLocation)location).getProject().getName() ) )
it.remove();
}
}
private void addAdditionalLocations( Element root, List sourceLocations ) throws CoreException
{
private void addAdditionalLocations( Element root, List sourceLocations ) throws CoreException {
Bundle bundle = CDebugCorePlugin.getDefault().getBundle();
MultiStatus status = new MultiStatus( CDebugCorePlugin.getUniqueIdentifier(),
CDebugCorePlugin.INTERNAL_ERROR,
CDebugCorePlugin.getResourceString("internal.core.sourcelookup.CSourceLocator.Error_initializing_src_location"), //$NON-NLS-1$
null );
MultiStatus status = new MultiStatus( CDebugCorePlugin.getUniqueIdentifier(), CDebugCorePlugin.INTERNAL_ERROR, InternalSourceLookupMessages.getString( "CSourceLocator.3" ), null ); //$NON-NLS-1$
NodeList list = root.getChildNodes();
int length = list.getLength();
for ( int i = 0; i < length; ++i )
{
for( int i = 0; i < length; ++i ) {
Node node = list.item( i );
short type = node.getNodeType();
if ( type == Node.ELEMENT_NODE )
{
if ( type == Node.ELEMENT_NODE ) {
Element entry = (Element)node;
if ( entry.getNodeName().equalsIgnoreCase( ADDITIONAL_SOURCE_LOCATION_NAME ) )
{
if ( entry.getNodeName().equalsIgnoreCase( ADDITIONAL_SOURCE_LOCATION_NAME ) ) {
String className = entry.getAttribute( ATTR_CLASS );
String data = entry.getAttribute( ATTR_MEMENTO );
if ( isEmpty( className ) )
{
if ( isEmpty( className ) ) {
CDebugCorePlugin.log( "Unable to restore C/C++ source locator - invalid format." ); //$NON-NLS-1$
continue;
}
Class clazz = null;
try
{
try {
clazz = bundle.loadClass( className );
}
catch( ClassNotFoundException e )
{
CDebugCorePlugin.log( MessageFormat.format( "Unable to restore source location - class not found {0}", new String[] { className } ) ); //$NON-NLS-1$
catch( ClassNotFoundException e ) {
CDebugCorePlugin.log( MessageFormat.format( "Unable to restore source location - class not found {0}", new String[]{ className } ) ); //$NON-NLS-1$
continue;
}
ICSourceLocation location = null;
try
{
try {
location = (ICSourceLocation)clazz.newInstance();
}
catch( IllegalAccessException e )
{
catch( IllegalAccessException e ) {
CDebugCorePlugin.log( "Unable to restore source location." ); //$NON-NLS-1$
continue;
}
catch( InstantiationException e )
{
catch( InstantiationException e ) {
CDebugCorePlugin.log( "Unable to restore source location." ); //$NON-NLS-1$
continue;
}
try
{
try {
location.initializeFrom( data );
sourceLocations.add( location );
}
catch( CoreException e )
{
catch( CoreException e ) {
status.addAll( e.getStatus() );
}
}
@ -480,57 +425,44 @@ public class CSourceLocator implements ICSourceLocator, IPersistableSourceLocato
throw new CoreException( status );
}
private void addOldLocations( Element root, List sourceLocations ) throws CoreException
{
private void addOldLocations( Element root, List sourceLocations ) throws CoreException {
Bundle bundle = CDebugCorePlugin.getDefault().getBundle();
NodeList list = root.getChildNodes();
int length = list.getLength();
for ( int i = 0; i < length; ++i )
{
for( int i = 0; i < length; ++i ) {
Node node = list.item( i );
short type = node.getNodeType();
if ( type == Node.ELEMENT_NODE )
{
if ( type == Node.ELEMENT_NODE ) {
Element entry = (Element)node;
if ( entry.getNodeName().equalsIgnoreCase( SOURCE_LOCATION_NAME ) )
{
if ( entry.getNodeName().equalsIgnoreCase( SOURCE_LOCATION_NAME ) ) {
String className = entry.getAttribute( ATTR_CLASS );
String data = entry.getAttribute( ATTR_MEMENTO );
if ( isEmpty( className ) )
{
if ( isEmpty( className ) ) {
CDebugCorePlugin.log( "Unable to restore C/C++ source locator - invalid format." ); //$NON-NLS-1$
continue;
}
Class clazz = null;
try
{
try {
clazz = bundle.loadClass( className );
}
catch( ClassNotFoundException e )
{
CDebugCorePlugin.log( MessageFormat.format( "Unable to restore source location - class not found {0}", new String[] { className } ) ); //$NON-NLS-1$
catch( ClassNotFoundException e ) {
CDebugCorePlugin.log( MessageFormat.format( "Unable to restore source location - class not found {0}", new String[]{ className } ) ); //$NON-NLS-1$
continue;
}
ICSourceLocation location = null;
try
{
try {
location = (ICSourceLocation)clazz.newInstance();
}
catch( IllegalAccessException e )
{
catch( IllegalAccessException e ) {
CDebugCorePlugin.log( "Unable to restore source location." ); //$NON-NLS-1$
continue;
}
catch( InstantiationException e )
{
catch( InstantiationException e ) {
CDebugCorePlugin.log( "Unable to restore source location." ); //$NON-NLS-1$
continue;
}
location.initializeFrom( data );
if ( !sourceLocations.contains( location ) )
{
if ( !sourceLocations.contains( location ) ) {
if ( location instanceof CProjectSourceLocation )
((CProjectSourceLocation)location).setGenerated( isReferencedProject( ((CProjectSourceLocation)location).getProject() ) );
sourceLocations.add( location );
@ -543,31 +475,21 @@ public class CSourceLocator implements ICSourceLocator, IPersistableSourceLocato
/**
* Throws an internal error exception
*/
private void abort( String message, Throwable e ) throws CoreException
{
IStatus s = new Status( IStatus.ERROR,
CDebugCorePlugin.getUniqueIdentifier(),
CDebugCorePlugin.INTERNAL_ERROR,
message,
e );
private void abort( String message, Throwable e ) throws CoreException {
IStatus s = new Status( IStatus.ERROR, CDebugCorePlugin.getUniqueIdentifier(), CDebugCorePlugin.INTERNAL_ERROR, message, e );
throw new CoreException( s );
}
private boolean isEmpty( String string )
{
private boolean isEmpty( String string ) {
return string == null || string.trim().length() == 0;
}
public void resourceChanged( IResourceChangeEvent event )
{
if ( event.getSource() instanceof IWorkspace && event.getDelta() != null )
{
public void resourceChanged( IResourceChangeEvent event ) {
if ( event.getSource() instanceof IWorkspace && event.getDelta() != null ) {
IResourceDelta[] deltas = event.getDelta().getAffectedChildren();
if ( deltas != null )
{
if ( deltas != null ) {
ArrayList list = new ArrayList( deltas.length );
for ( int i = 0; i < deltas.length; ++i )
for( int i = 0; i < deltas.length; ++i )
if ( deltas[i].getResource() instanceof IProject )
list.add( deltas[i].getResource() );
resetSourceLocations( list );
@ -575,27 +497,21 @@ public class CSourceLocator implements ICSourceLocator, IPersistableSourceLocato
}
}
private void saveDisabledGenericSourceLocations( ICSourceLocation[] locations, Document doc, Element node )
{
private void saveDisabledGenericSourceLocations( ICSourceLocation[] locations, Document doc, Element node ) {
IProject project = getProject();
if ( project != null && project.exists() && project.isOpen() )
{
if ( project != null && project.exists() && project.isOpen() ) {
List list = CDebugUtils.getReferencedProjects( project );
HashSet names = new HashSet( list.size() + 1 );
names.add( project.getName() );
Iterator it = list.iterator();
while( it.hasNext() )
{
while( it.hasNext() ) {
names.add( ((IProject)it.next()).getName() );
}
for ( int i = 0; i < locations.length; ++i )
if ( locations[i] instanceof IProjectSourceLocation &&
((IProjectSourceLocation)locations[i]).isGeneric() )
names.remove( ((IProjectSourceLocation)locations[i]).getProject().getName() );
for( int i = 0; i < locations.length; ++i )
if ( locations[i] instanceof IProjectSourceLocation && ((IProjectSourceLocation)locations[i]).isGeneric() )
names.remove( ((IProjectSourceLocation)locations[i]).getProject().getName() );
it = names.iterator();
while ( it.hasNext() )
{
while( it.hasNext() ) {
Element child = doc.createElement( DISABLED_GENERIC_PROJECT_NAME );
child.setAttribute( ATTR_PROJECT_NAME, (String)it.next() );
node.appendChild( child );
@ -603,21 +519,16 @@ public class CSourceLocator implements ICSourceLocator, IPersistableSourceLocato
}
}
private void saveAdditionalSourceLocations( ICSourceLocation[] locations, Document doc, Element node )
{
for ( int i = 0; i < locations.length; i++ )
{
if ( locations[i] instanceof IProjectSourceLocation &&
((IProjectSourceLocation)locations[i]).isGeneric() )
private void saveAdditionalSourceLocations( ICSourceLocation[] locations, Document doc, Element node ) {
for( int i = 0; i < locations.length; i++ ) {
if ( locations[i] instanceof IProjectSourceLocation && ((IProjectSourceLocation)locations[i]).isGeneric() )
continue;
Element child = doc.createElement( ADDITIONAL_SOURCE_LOCATION_NAME );
child.setAttribute( ATTR_CLASS, locations[i].getClass().getName() );
try
{
try {
child.setAttribute( ATTR_MEMENTO, locations[i].getMemento() );
}
catch( CoreException e )
{
catch( CoreException e ) {
CDebugCorePlugin.log( e );
continue;
}
@ -625,49 +536,42 @@ public class CSourceLocator implements ICSourceLocator, IPersistableSourceLocato
}
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator#getProject()
*/
public IProject getProject()
{
public IProject getProject() {
return fProject;
}
protected void setProject( IProject project )
{
protected void setProject( IProject project ) {
fProject = project;
}
private boolean isReferencedProject( IProject ref )
{
if ( getProject() != null )
{
try
{
private boolean isReferencedProject( IProject ref ) {
if ( getProject() != null ) {
try {
return Arrays.asList( getProject().getReferencedProjects() ).contains( ref );
}
catch( CoreException e )
{
catch( CoreException e ) {
CDebugCorePlugin.log( e );
}
}
return false;
}
private void setReferencedProjects()
{
fReferencedProjects.clear();
private void setReferencedProjects() {
fReferencedProjects.clear();
fReferencedProjects = CDebugUtils.getReferencedProjects( getProject() );
}
protected ICSourceLocation[] getDefaultSourceLocations()
{
protected ICSourceLocation[] getDefaultSourceLocations() {
Iterator it = fReferencedProjects.iterator();
ArrayList list = new ArrayList( fReferencedProjects.size() );
if ( getProject() != null && getProject().exists() && getProject().isOpen() )
list.add( SourceLookupFactory.createProjectSourceLocation( getProject() ) );
while( it.hasNext() )
{
while( it.hasNext() ) {
IProject project = (IProject)it.next();
if ( project != null && project.exists() && project.isOpen() )
list.add( SourceLookupFactory.createProjectSourceLocation( project ) );
@ -675,50 +579,39 @@ public class CSourceLocator implements ICSourceLocator, IPersistableSourceLocato
return (ICSourceLocation[])list.toArray( new ICSourceLocation[list.size()] );
}
private void resetSourceLocations( List affectedProjects )
{
if ( affectedProjects.size() != 0 && getProject() != null )
{
if ( !getProject().exists() || !getProject().isOpen() )
{
private void resetSourceLocations( List affectedProjects ) {
if ( affectedProjects.size() != 0 && getProject() != null ) {
if ( !getProject().exists() || !getProject().isOpen() ) {
removeGenericSourceLocations();
}
else
{
else {
updateGenericSourceLocations( affectedProjects );
}
}
}
private void removeGenericSourceLocations()
{
private void removeGenericSourceLocations() {
fReferencedProjects.clear();
ICSourceLocation[] locations = getSourceLocations();
ArrayList newLocations = new ArrayList( locations.length );
for ( int i = 0; i < locations.length; ++i )
ArrayList newLocations = new ArrayList( locations.length );
for( int i = 0; i < locations.length; ++i )
if ( !(locations[i] instanceof IProjectSourceLocation) || !((IProjectSourceLocation)locations[i]).isGeneric() )
newLocations.add( locations[i] );
setSourceLocations( (ICSourceLocation[])newLocations.toArray( new ICSourceLocation[newLocations.size()] ) );
}
private void updateGenericSourceLocations( List affectedProjects )
{
private void updateGenericSourceLocations( List affectedProjects ) {
List newRefs = CDebugUtils.getReferencedProjects( getProject() );
ICSourceLocation[] locations = getSourceLocations();
ArrayList newLocations = new ArrayList( locations.length );
for ( int i = 0; i < locations.length; ++i )
{
if ( !(locations[i] instanceof IProjectSourceLocation) || !((IProjectSourceLocation)locations[i]).isGeneric() )
{
ArrayList newLocations = new ArrayList( locations.length );
for( int i = 0; i < locations.length; ++i ) {
if ( !(locations[i] instanceof IProjectSourceLocation) || !((IProjectSourceLocation)locations[i]).isGeneric() ) {
newLocations.add( locations[i] );
}
else
{
else {
IProject project = ((IProjectSourceLocation)locations[i]).getProject();
if ( project.exists() && project.isOpen() )
{
if ( newRefs.contains( project ) || project.equals( getProject() ) )
{
if ( project.exists() && project.isOpen() ) {
if ( newRefs.contains( project ) || project.equals( getProject() ) ) {
newLocations.add( locations[i] );
newRefs.remove( project );
}
@ -726,8 +619,7 @@ public class CSourceLocator implements ICSourceLocator, IPersistableSourceLocato
}
}
Iterator it = newRefs.iterator();
while( it.hasNext() )
{
while( it.hasNext() ) {
IProject project = (IProject)it.next();
if ( !fReferencedProjects.contains( project ) )
newLocations.add( SourceLookupFactory.createProjectSourceLocation( project ) );
@ -736,19 +628,19 @@ public class CSourceLocator implements ICSourceLocator, IPersistableSourceLocato
setSourceLocations( (ICSourceLocation[])newLocations.toArray( new ICSourceLocation[newLocations.size()] ) );
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator#searchForDuplicateFiles()
*/
public boolean searchForDuplicateFiles()
{
public boolean searchForDuplicateFiles() {
return fDuplicateFiles;
}
public void setSearchForDuplicateFiles( boolean search )
{
public void setSearchForDuplicateFiles( boolean search ) {
fDuplicateFiles = search;
ICSourceLocation[] locations = getSourceLocations();
for ( int i = 0; i < locations.length; ++i )
for( int i = 0; i < locations.length; ++i )
locations[i].setSearchForDuplicateFiles( search );
}
}

View file

@ -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.core.sourcelookup;
import java.util.MissingResourceException;
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
//import java.util.ResourceBundle;
public class InternalSourceLookupMessages {
// private static final String BUNDLE_NAME = "org.eclipse.cdt.debug.internal.core.sourcelookup.InternalSourceLookupMessages";//$NON-NLS-1$
// private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME );
private InternalSourceLookupMessages() {
}
public static String getString( String key ) {
try {
return CDebugCorePlugin.getResourceString( key );
// return RESOURCE_BUNDLE.getString( key );
}
catch( MissingResourceException e ) {
return '!' + key + '!';
}
}
}

View file

@ -0,0 +1,11 @@
CDirectorySourceLocation.0=Unable to create memento for C/C++ directory source location {0}.
CDirectorySourceLocation.1=Unable to initialize source location - missing directory path.
CDirectorySourceLocation.2=Unable to initialize source location - invalid directory path {0}.
CDirectorySourceLocation.3=Exception occurred initializing source location.
CProjectSourceLocation.0=Unable to create memento for C/C++ project source location {0}.
CProjectSourceLocation.1=Unable to initialize source location - missing project name
CProjectSourceLocation.2=Exception occurred initializing source location.
CSourceLocator.0=Unable to create memento for C/C++ source locator.
CSourceLocator.1=Unable to restore C/C++ source locator - invalid format.
CSourceLocator.2=Exception occurred initializing source locator.
CSourceLocator.3=Error initializing directory source location.

View file

@ -5,14 +5,12 @@
package org.eclipse.cdt.debug.mi.internal.ui;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.cdt.debug.mi.internal.ui.MIUIPlugin;
public class CygwinDebuggerPage extends GDBDebuggerPage
{
public String getName()
{
return MIUIPlugin.getResourceString("internal.ui.CygwinDebuggerPage.Cygwin_GDB_Debugger_Options"); //$NON-NLS-1$
return MIUIMessages.getString( "CygwinDebuggerPage.0" ); //$NON-NLS-1$
}
/* (non-Javadoc)

View file

@ -7,13 +7,13 @@ package org.eclipse.cdt.debug.mi.internal.ui;
import java.io.File;
import java.util.Observable;
import java.util.Observer;
import org.eclipse.cdt.debug.mi.core.IMILaunchConfigurationConstants;
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
import org.eclipse.debug.ui.ILaunchConfigurationTab;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
@ -29,7 +29,6 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.TabFolder;
import org.eclipse.swt.widgets.TabItem;
import org.eclipse.swt.widgets.Text;
import org.eclipse.cdt.debug.mi.internal.ui.MIUIPlugin;
public class GDBDebuggerPage extends AbstractLaunchConfigurationTab implements Observer
{
@ -74,7 +73,7 @@ public class GDBDebuggerPage extends AbstractLaunchConfigurationTab implements O
}
else
{
setErrorMessage( MIUIPlugin.getResourceString("internal.ui.GDBDebuggerPage.Debugger_exec_must_be_specified") ); //$NON-NLS-1$
setErrorMessage( MIUIMessages.getString( "GDBDebuggerPage.0" ) ); //$NON-NLS-1$
setMessage( null );
}
return valid;
@ -112,7 +111,7 @@ public class GDBDebuggerPage extends AbstractLaunchConfigurationTab implements O
public String getName()
{
return MIUIPlugin.getResourceString("internal.ui.GDBDebuggerPage.GDB_Debugger_Options"); //$NON-NLS-1$
return MIUIMessages.getString( "GDBDebuggerPage.1" ); //$NON-NLS-1$
}
/**
@ -155,7 +154,7 @@ public class GDBDebuggerPage extends AbstractLaunchConfigurationTab implements O
public void createMainTab( TabFolder tabFolder )
{
TabItem tabItem = new TabItem( tabFolder, SWT.NONE );
tabItem.setText( MIUIPlugin.getResourceString("internal.ui.GDBDebuggerPage.Main") ); //$NON-NLS-1$
tabItem.setText( MIUIMessages.getString( "GDBDebuggerPage.2" ) ); //$NON-NLS-1$
Composite comp = ControlFactory.createCompositeEx( fTabFolder, 1, GridData.FILL_BOTH );
((GridLayout)comp.getLayout()).makeColumnsEqualWidth = false;
@ -164,7 +163,7 @@ public class GDBDebuggerPage extends AbstractLaunchConfigurationTab implements O
Composite subComp = ControlFactory.createCompositeEx( comp, 3, GridData.FILL_HORIZONTAL );
((GridLayout)subComp.getLayout()).makeColumnsEqualWidth = false;
Label label = ControlFactory.createLabel( subComp, MIUIPlugin.getResourceString("internal.ui.GDBDebuggerPage.GDB_debugger")+':' ); //$NON-NLS-1$
Label label = ControlFactory.createLabel( subComp, MIUIMessages.getString( "GDBDebuggerPage.3" ) ); //$NON-NLS-1$
GridData gd = new GridData();
// gd.horizontalSpan = 2;
label.setLayoutData( gd );
@ -179,7 +178,7 @@ public class GDBDebuggerPage extends AbstractLaunchConfigurationTab implements O
}
} );
Button button = createPushButton( subComp, MIUIPlugin.getResourceString("internal.ui.GDBDebuggerPage.Browse"), null ); //$NON-NLS-1$
Button button = createPushButton( subComp, MIUIMessages.getString( "GDBDebuggerPage.4" ), null ); //$NON-NLS-1$
button.addSelectionListener(
new SelectionAdapter()
{
@ -192,7 +191,7 @@ public class GDBDebuggerPage extends AbstractLaunchConfigurationTab implements O
private void handleGDBButtonSelected()
{
FileDialog dialog = new FileDialog( getShell(), SWT.NONE );
dialog.setText( MIUIPlugin.getResourceString("internal.ui.GDBDebuggerPage.GDB_Debugger") ); //$NON-NLS-1$
dialog.setText( MIUIMessages.getString( "GDBDebuggerPage.5" ) ); //$NON-NLS-1$
String gdbCommand = fGDBCommandText.getText().trim();
int lastSeparatorIndex = gdbCommand.lastIndexOf( File.separator );
if ( lastSeparatorIndex != -1 )
@ -208,7 +207,7 @@ public class GDBDebuggerPage extends AbstractLaunchConfigurationTab implements O
}
} );
label = ControlFactory.createLabel( subComp, MIUIPlugin.getResourceString("internal.ui.GDBDebuggerPage.GDB_command_file")+':' ); //$NON-NLS-1$
label = ControlFactory.createLabel( subComp, MIUIMessages.getString( "GDBDebuggerPage.6" ) ); //$NON-NLS-1$
gd = new GridData();
// gd.horizontalSpan = 2;
label.setLayoutData( gd );
@ -223,7 +222,7 @@ public class GDBDebuggerPage extends AbstractLaunchConfigurationTab implements O
updateLaunchConfigurationDialog();
}
} );
button = createPushButton( subComp, MIUIPlugin.getResourceString("internal.ui.GDBDebuggerPage.Browse"), null ); //$NON-NLS-1$
button = createPushButton( subComp, MIUIMessages.getString( "GDBDebuggerPage.7" ), null ); //$NON-NLS-1$
button.addSelectionListener(
new SelectionAdapter()
{
@ -236,7 +235,7 @@ public class GDBDebuggerPage extends AbstractLaunchConfigurationTab implements O
private void handleGDBInitButtonSelected()
{
FileDialog dialog = new FileDialog( getShell(), SWT.NONE );
dialog.setText( MIUIPlugin.getResourceString("internal.ui.GDBDebuggerPage.GDB_Command_File") ); //$NON-NLS-1$
dialog.setText( MIUIMessages.getString( "GDBDebuggerPage.8" ) ); //$NON-NLS-1$
String gdbCommand = fGDBInitText.getText().trim();
int lastSeparatorIndex = gdbCommand.lastIndexOf( File.separator );
if ( lastSeparatorIndex != -1 )
@ -253,7 +252,7 @@ public class GDBDebuggerPage extends AbstractLaunchConfigurationTab implements O
} );
label = ControlFactory.createLabel( comp,
MIUIPlugin.getResourceString("internal.ui.GDBDebuggerPage.Warning_startup_operation_interference"), //$NON-NLS-1$
MIUIMessages.getString( "GDBDebuggerPage.9" ), //$NON-NLS-1$
200,
SWT.DEFAULT,
SWT.WRAP );
@ -266,7 +265,7 @@ public class GDBDebuggerPage extends AbstractLaunchConfigurationTab implements O
public void createSolibTab( TabFolder tabFolder )
{
TabItem tabItem = new TabItem( tabFolder, SWT.NONE );
tabItem.setText( MIUIPlugin.getResourceString("internal.ui.GDBDebuggerPage.Shared_libraries") ); //$NON-NLS-1$
tabItem.setText( MIUIMessages.getString( "GDBDebuggerPage.10" ) ); //$NON-NLS-1$
Composite comp = ControlFactory.createCompositeEx( fTabFolder, 1, GridData.FILL_BOTH );
tabItem.setControl( comp );
@ -287,3 +286,4 @@ public class GDBDebuggerPage extends AbstractLaunchConfigurationTab implements O
super.dispose();
}
}

View file

@ -7,7 +7,6 @@
package org.eclipse.cdt.debug.mi.internal.ui;
import java.io.File;
import org.eclipse.cdt.debug.mi.core.IGDBServerMILaunchConfigurationConstants;
import org.eclipse.cdt.debug.mi.internal.ui.dialogfields.ComboDialogField;
import org.eclipse.cdt.debug.mi.internal.ui.dialogfields.DialogField;
@ -31,7 +30,6 @@ import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.TabFolder;
import org.eclipse.swt.widgets.TabItem;
import org.eclipse.cdt.debug.mi.internal.ui.MIUIPlugin;
/**
* Enter type comment.
@ -40,8 +38,8 @@ import org.eclipse.cdt.debug.mi.internal.ui.MIUIPlugin;
*/
public class GDBServerDebuggerPage extends GDBDebuggerPage
{
private final static String CONNECTION_TCP = MIUIPlugin.getResourceString("internal.ui.GDBServerDebuggerPage.TCP"); //$NON-NLS-1$
private final static String CONNECTION_SERIAL = MIUIPlugin.getResourceString("internal.ui.GDBServerDebuggerPage.Serial"); //$NON-NLS-1$
private final static String CONNECTION_TCP = MIUIMessages.getString( "GDBServerDebuggerPage.0" ); //$NON-NLS-1$
private final static String CONNECTION_SERIAL = MIUIMessages.getString( "GDBServerDebuggerPage.1" ); //$NON-NLS-1$
private ComboDialogField fConnectionField;
@ -63,7 +61,7 @@ public class GDBServerDebuggerPage extends GDBDebuggerPage
public void createMainTab( TabFolder tabFolder )
{
TabItem tabItem = new TabItem( tabFolder, SWT.NONE );
tabItem.setText( MIUIPlugin.getResourceString("internal.ui.GDBServerDebuggerPage.Main") ); //$NON-NLS-1$
tabItem.setText( MIUIMessages.getString( "GDBServerDebuggerPage.2" ) ); //$NON-NLS-1$
Composite comp = ControlFactory.createCompositeEx( fTabFolder, 1, GridData.FILL_BOTH );
((GridLayout)comp.getLayout()).makeColumnsEqualWidth = false;
@ -72,7 +70,7 @@ public class GDBServerDebuggerPage extends GDBDebuggerPage
Composite subComp = ControlFactory.createCompositeEx( comp, 3, GridData.FILL_HORIZONTAL );
((GridLayout)subComp.getLayout()).makeColumnsEqualWidth = false;
Label label = ControlFactory.createLabel( subComp, MIUIPlugin.getResourceString("internal.ui.GDBDebuggerPage.GDB_debugger") ); //$NON-NLS-1$
Label label = ControlFactory.createLabel( subComp, MIUIMessages.getString( "GDBServerDebuggerPage.3" ) ); //$NON-NLS-1$
GridData gd = new GridData();
// gd.horizontalSpan = 2;
label.setLayoutData( gd );
@ -87,7 +85,7 @@ public class GDBServerDebuggerPage extends GDBDebuggerPage
}
} );
Button button = createPushButton( subComp, MIUIPlugin.getResourceString("internal.ui.GDBDebuggerPage.Browse"), null ); //$NON-NLS-1$
Button button = createPushButton( subComp, MIUIMessages.getString( "GDBServerDebuggerPage.4" ), null ); //$NON-NLS-1$
button.addSelectionListener(
new SelectionAdapter()
{
@ -100,7 +98,7 @@ public class GDBServerDebuggerPage extends GDBDebuggerPage
private void handleGDBButtonSelected()
{
FileDialog dialog = new FileDialog( getShell(), SWT.NONE );
dialog.setText( MIUIPlugin.getResourceString("internal.ui.GDBDebuggerPage.GDB_Debugger") ); //$NON-NLS-1$
dialog.setText( MIUIMessages.getString( "GDBServerDebuggerPage.5" ) ); //$NON-NLS-1$
String gdbCommand = fGDBCommandText.getText().trim();
int lastSeparatorIndex = gdbCommand.lastIndexOf( File.separator );
if ( lastSeparatorIndex != -1 )
@ -116,7 +114,7 @@ public class GDBServerDebuggerPage extends GDBDebuggerPage
}
} );
label = ControlFactory.createLabel( subComp, MIUIPlugin.getResourceString("internal.ui.GDBDebuggerPage.GDB_command_file")+':' ); //$NON-NLS-1$
label = ControlFactory.createLabel( subComp, MIUIMessages.getString( "GDBServerDebuggerPage.6" ) ); //$NON-NLS-1$
gd = new GridData();
// gd.horizontalSpan = 2;
label.setLayoutData( gd );
@ -131,7 +129,7 @@ public class GDBServerDebuggerPage extends GDBDebuggerPage
updateLaunchConfigurationDialog();
}
} );
button = createPushButton( subComp, MIUIPlugin.getResourceString("internal.ui.GDBDebuggerPage.Browse"), null ); //$NON-NLS-1$
button = createPushButton( subComp, MIUIMessages.getString( "GDBServerDebuggerPage.7" ), null ); //$NON-NLS-1$
button.addSelectionListener(
new SelectionAdapter()
{
@ -144,7 +142,7 @@ public class GDBServerDebuggerPage extends GDBDebuggerPage
private void handleGDBInitButtonSelected()
{
FileDialog dialog = new FileDialog( getShell(), SWT.NONE );
dialog.setText( MIUIPlugin.getResourceString("internal.ui.GDBDebuggerPage.GDB_Command_File") ); //$NON-NLS-1$
dialog.setText( MIUIMessages.getString( "GDBServerDebuggerPage.8" ) ); //$NON-NLS-1$
String gdbCommand = fGDBInitText.getText().trim();
int lastSeparatorIndex = gdbCommand.lastIndexOf( File.separator );
if ( lastSeparatorIndex != -1 )
@ -188,7 +186,7 @@ public class GDBServerDebuggerPage extends GDBDebuggerPage
private ComboDialogField createConnectionField()
{
ComboDialogField field = new ComboDialogField( SWT.DROP_DOWN | SWT.READ_ONLY );
field.setLabelText( MIUIPlugin.getResourceString("internal.ui.GDBServerDebuggerPage.Connection"));//$NON-NLS-1$
field.setLabelText( MIUIMessages.getString( "GDBServerDebuggerPage.9" ) ); //$NON-NLS-1$
field.setItems( fConnections );
field.setDialogFieldListener(
new IDialogFieldListener()
@ -286,3 +284,4 @@ public class GDBServerDebuggerPage extends GDBDebuggerPage
fSerialBlock.setDefaults( configuration );
}
}

View file

@ -8,7 +8,6 @@ package org.eclipse.cdt.debug.mi.internal.ui;
import java.util.Map;
import java.util.Observable;
import java.util.Observer;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
import org.eclipse.cdt.debug.mi.core.IMILaunchConfigurationConstants;
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
@ -21,7 +20,6 @@ import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.cdt.debug.mi.internal.ui.MIUIPlugin;
/**
* Enter type comment.
@ -56,7 +54,7 @@ public class GDBSolibBlock extends Observable implements Observer
if ( autoSolib )
{
fAutoSoLibButton = ControlFactory.createCheckBox( subComp, MIUIPlugin.getResourceString("mi.internal.ui.GDBSolibBlock.Load_shared_lib_symbols_automatically") ); //$NON-NLS-1$
fAutoSoLibButton = ControlFactory.createCheckBox( subComp, MIUIMessages.getString( "GDBSolibBlock.0" ) ); //$NON-NLS-1$
fAutoSoLibButton.addSelectionListener(
new SelectionAdapter()
{
@ -70,7 +68,7 @@ public class GDBSolibBlock extends Observable implements Observer
if ( stopOnSolibEvents )
{
fStopOnSolibEventsButton = ControlFactory.createCheckBox( subComp, MIUIPlugin.getResourceString("mi.internal.ui.GDBSolibBlock.Stop_on_shared_lib_events") ); //$NON-NLS-1$
fStopOnSolibEventsButton = ControlFactory.createCheckBox( subComp, MIUIMessages.getString( "GDBSolibBlock.1" ) ); //$NON-NLS-1$
fStopOnSolibEventsButton.addSelectionListener(
new SelectionAdapter()
{
@ -192,3 +190,4 @@ public class GDBSolibBlock extends Observable implements Observer
}
}
}

View file

@ -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.mi.internal.ui;
import java.util.MissingResourceException;
//import java.util.ResourceBundle;
public class MIUIMessages {
// private static final String BUNDLE_NAME = "org.eclipse.cdt.debug.mi.internal.ui.MIUIMessages";//$NON-NLS-1$
// private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME );
private MIUIMessages() {
}
public static String getString( String key ) {
try {
return MIUIPlugin.getResourceString( key );
// return RESOURCE_BUNDLE.getString( key );
}
catch( MissingResourceException e ) {
return '!' + key + '!';
}
}
}

View file

@ -0,0 +1,41 @@
CygwinDebuggerPage.0=Cygwin GDB Debugger Options
GDBDebuggerPage.0=Debugger executable must be specified.
GDBDebuggerPage.1=GDB Debugger Options
GDBDebuggerPage.2=Main
GDBDebuggerPage.3=GDB debugger:
GDBDebuggerPage.4=&Browse...
GDBDebuggerPage.5=GDB Debugger
GDBDebuggerPage.6=GDB command file:
GDBDebuggerPage.7=&Browse...
GDBDebuggerPage.8=GDB Command File
GDBDebuggerPage.9=(Warning: Some commands in this file may interfere with the startup operation of the debugger, for example "run".)
GDBDebuggerPage.10=Shared Libraries
GDBServerDebuggerPage.0=TCP
GDBServerDebuggerPage.1=Serial
GDBServerDebuggerPage.2=Main
GDBServerDebuggerPage.3=GDB debugger
GDBServerDebuggerPage.4=&Browse...
GDBServerDebuggerPage.5=GDB Debugger
GDBServerDebuggerPage.6=GDB command file:
GDBServerDebuggerPage.7=&Browse...
GDBServerDebuggerPage.8=GDB Command File
GDBServerDebuggerPage.9=Connection:
GDBSolibBlock.0=Load shared library symbols automatically
GDBSolibBlock.1=Stop on shared library events
SerialPortSettingsBlock.0=Device:
SerialPortSettingsBlock.1=Speed:
SerialPortSettingsBlock.2=Device must be specified.
SerialPortSettingsBlock.3=Invalid device.
SerialPortSettingsBlock.4=Speed must be specified.
SolibSearchPathBlock.0=Add...
SolibSearchPathBlock.1=Up
SolibSearchPathBlock.2=Down
SolibSearchPathBlock.3=Remove
SolibSearchPathBlock.4=Directories:
SolibSearchPathBlock.5=Select directory that contains shared library.
TCPSettingsBlock.0=Host name or IP address:
TCPSettingsBlock.1=Port number:
TCPSettingsBlock.2=Host name or IP address must be specified.
TCPSettingsBlock.3=Invalid host name or IP address.
TCPSettingsBlock.4=Port number must be specified.
TCPSettingsBlock.5=Invalid port number.

View file

@ -1,41 +1,48 @@
mi.internal.ui.GDBSolibBlock.Load_shared_lib_symbols_automatically=Load shared library symbols automatically
mi.internal.ui.GDBSolibBlock.Stop_on_shared_lib_events=Stop on shared library events
mi.internal.ui.SerialPortSettingsBlock.Device=Device:
mi.internal.ui.SerialPortSettingsBlock.Speed=Speed:
mi.internal.ui.SerialPortSettingsBlock.Device_must_be_specified=Device must be specified.
mi.internal.ui.SerialPortSettingsBlock.Invalid_device=Invalid device.
mi.internal.ui.SerialPortSettingsBlock.Speed_must_be_specified=Speed must be specified.
TCPSettingsBlock.Host_or_IP=Host name or IP address:
TCPSettingsBlock.Port=Port number:
TCPSettingsBlock.Host_or_IP_must_be_specified=Host name or IP address must be specified.
TCPSettingsBlock.Invalid_host_or_IP=Invalid host name or IP address.
TCPSettingsBlock.Port_must_be_specified=Port number must be specified.
TCPSettingsBlock.Invalid_port=Invalid port number.
internal.ui.GDBDebuggerPage.Debugger_exec_must_be_specified=Debugger executable must be specified
internal.ui.GDBDebuggerPage.GDB_Debugger_Options=GDB Debugger Options
internal.ui.GDBDebuggerPage.Main=Main
internal.ui.GDBDebuggerPage.GDB_debugger=GDB debugger
internal.ui.GDBDebuggerPage.GDB_Debugger=GDB Debugger
internal.ui.GDBDebuggerPage.Browse=&Browse...
internal.ui.GDBDebuggerPage.GDB_Command_File=GDB Command File
internal.ui.GDBDebuggerPage.GDB_command_file=GDB command file
internal.ui.GDBDebuggerPage.Warning_startup_operation_interference=(Warning: Some commands in this file may interfere with the startup operation of the debugger, for example "run".)
internal.ui.GDBDebuggerPage.Shared_libraries=Shared Libraries
internal.ui.SolibSearchPathBlock.Add=Add...
internal.ui.SolibSearchPathBlock.Up=Up
internal.ui.SolibSearchPathBlock.Down=Down
internal.ui.SolibSearchPathBlock.Remove=Remove
internal.ui.SolibSearchPathBlock.Directories=Directories:
internal.ui.SolibSearchPathBlock.Select_directory_with_shared_lib=Select directory that contains shared library.
internal.ui.GDBServerDebuggerPage.TCP=TCP
internal.ui.GDBServerDebuggerPage.Serial=Serial
internal.ui.GDBServerDebuggerPage.Main=Main
internal.ui.GDBServerDebuggerPage.Connection=Connection:
internal.ui.CygwinDebuggerPage.Cygwin_GDB_Debugger_Options=Cygwin GDB Debugger Options
internal.ui.actions.SetAutoSolibActionDelegate.Exception_set_automatically_load_symbols=Exceptions occurred attempting to set 'Automatically Load Symbols' mode.
internal.ui.actions.SetAutoSolibActionDelegate.Set_automatically_load_symbols_failed=Set 'Automatically Load Symbols' mode failed.
internal.ui.preferences.MIPreferencePage.General_GDBMI_settings=General settings for GDB MI.
internal.ui.preferences.MIPreferencePage.Communication=Communication
internal.ui.preferences.MIPreferencePage.Debugger_timeout=&Debugger timeout (ms):
internal.ui.preferences.MIPreferencePage.Launch_timeout=&Launch timeout (ms):
internal.ui.preferences.MIPreferencePage.Error_Request_timeout_range=The valid value range is [{0},{1}].
CygwinDebuggerPage.0=Cygwin GDB Debugger Options
GDBDebuggerPage.0=Debugger executable must be specified.
GDBDebuggerPage.1=GDB Debugger Options
GDBDebuggerPage.2=Main
GDBDebuggerPage.3=GDB debugger:
GDBDebuggerPage.4=&Browse...
GDBDebuggerPage.5=GDB Debugger
GDBDebuggerPage.6=GDB command file:
GDBDebuggerPage.7=&Browse...
GDBDebuggerPage.8=GDB Command File
GDBDebuggerPage.9=(Warning: Some commands in this file may interfere with the startup operation of the debugger, for example "run".)
GDBDebuggerPage.10=Shared Libraries
GDBServerDebuggerPage.0=TCP
GDBServerDebuggerPage.1=Serial
GDBServerDebuggerPage.2=Main
GDBServerDebuggerPage.3=GDB debugger
GDBServerDebuggerPage.4=&Browse...
GDBServerDebuggerPage.5=GDB Debugger
GDBServerDebuggerPage.6=GDB command file:
GDBServerDebuggerPage.7=&Browse...
GDBServerDebuggerPage.8=GDB Command File
GDBServerDebuggerPage.9=Connection:
GDBSolibBlock.0=Load shared library symbols automatically
GDBSolibBlock.1=Stop on shared library events
SerialPortSettingsBlock.0=Device:
SerialPortSettingsBlock.1=Speed:
SerialPortSettingsBlock.2=Device must be specified.
SerialPortSettingsBlock.3=Invalid device.
SerialPortSettingsBlock.4=Speed must be specified.
SolibSearchPathBlock.0=Add...
SolibSearchPathBlock.1=Up
SolibSearchPathBlock.2=Down
SolibSearchPathBlock.3=Remove
SolibSearchPathBlock.4=Directories:
SolibSearchPathBlock.5=Select directory that contains shared library.
TCPSettingsBlock.0=Host name or IP address:
TCPSettingsBlock.1=Port number:
TCPSettingsBlock.2=Host name or IP address must be specified.
TCPSettingsBlock.3=Invalid host name or IP address.
TCPSettingsBlock.4=Port number must be specified.
TCPSettingsBlock.5=Invalid port number.
SetAutoSolibActionDelegate.0=Exceptions occurred attempting to set 'Automatically Load Symbols' mode.
SetAutoSolibActionDelegate.1=Set 'Automatically Load Symbols' mode failed.
MIPreferencePage.0=General settings for GDB MI.
MIPreferencePage.1=Communication
MIPreferencePage.2=&Debugger timeout (ms):
MIPreferencePage.3=&Launch timeout (ms):
MIPreferencePage.4=The valid value range is [{0},{1}].

View file

@ -7,7 +7,6 @@
package org.eclipse.cdt.debug.mi.internal.ui;
import java.util.Observable;
import org.eclipse.cdt.debug.mi.core.IGDBServerMILaunchConfigurationConstants;
import org.eclipse.cdt.debug.mi.internal.ui.dialogfields.ComboDialogField;
import org.eclipse.cdt.debug.mi.internal.ui.dialogfields.DialogField;
@ -25,7 +24,6 @@ import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.cdt.debug.mi.internal.ui.MIUIPlugin;
/**
* Enter type comment.
@ -110,7 +108,7 @@ public class SerialPortSettingsBlock extends Observable
private StringDialogField createDeviceField()
{
StringDialogField field = new StringDialogField();
field.setLabelText( MIUIPlugin.getResourceString("mi.internal.ui.SerialPortSettingsBlock.Device") ); //$NON-NLS-1$
field.setLabelText( MIUIMessages.getString( "SerialPortSettingsBlock.0" ) ); //$NON-NLS-1$
field.setDialogFieldListener(
new IDialogFieldListener()
{
@ -125,7 +123,7 @@ public class SerialPortSettingsBlock extends Observable
private ComboDialogField createSpeedField()
{
ComboDialogField field = new ComboDialogField( SWT.DROP_DOWN | SWT.READ_ONLY );
field.setLabelText( MIUIPlugin.getResourceString("mi.internal.ui.SerialPortSettingsBlock.Speed") ); //$NON-NLS-1$
field.setLabelText( MIUIMessages.getString( "SerialPortSettingsBlock.1" ) ); //$NON-NLS-1$
field.setItems( fSpeedChoices );
field.setDialogFieldListener(
new IDialogFieldListener()
@ -217,11 +215,11 @@ public class SerialPortSettingsBlock extends Observable
if ( fDeviceField != null && fSpeedField != null )
{
if ( fDeviceField.getText().trim().length() == 0 )
setErrorMessage( MIUIPlugin.getResourceString("mi.internal.ui.SerialPortSettingsBlock.Device_must_be_specified") ); //$NON-NLS-1$
setErrorMessage( MIUIMessages.getString( "SerialPortSettingsBlock.2" ) ); //$NON-NLS-1$
else if ( !deviceIsValid( fDeviceField.getText().trim() ) )
setErrorMessage( MIUIPlugin.getResourceString("mi.internal.ui.SerialPortSettingsBlock.Invalid_device") ); //$NON-NLS-1$
setErrorMessage( MIUIMessages.getString( "SerialPortSettingsBlock.3" ) ); //$NON-NLS-1$
else if ( fSpeedField.getSelectionIndex() < 0 )
setErrorMessage( MIUIPlugin.getResourceString("mi.internal.ui.SerialPortSettingsBlock.Speed_must_be_specified") ); //$NON-NLS-1$
setErrorMessage( MIUIMessages.getString( "SerialPortSettingsBlock.4" ) ); //$NON-NLS-1$
}
}
@ -240,3 +238,4 @@ public class SerialPortSettingsBlock extends Observable
return true;
}
}

View file

@ -8,7 +8,6 @@ package org.eclipse.cdt.debug.mi.internal.ui;
import java.util.Collections;
import java.util.Observable;
import org.eclipse.cdt.debug.mi.core.IMILaunchConfigurationConstants;
import org.eclipse.cdt.debug.mi.internal.ui.dialogfields.DialogField;
import org.eclipse.cdt.debug.mi.internal.ui.dialogfields.IListAdapter;
@ -26,7 +25,6 @@ import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.cdt.debug.mi.internal.ui.MIUIPlugin;
/**
* Enter type comment.
@ -64,12 +62,12 @@ public class SolibSearchPathBlock extends Observable
String[] buttonLabels = new String[]
{
/* 0 */ MIUIPlugin.getResourceString("internal.ui.SolibSearchPathBlock.Add"), //$NON-NLS-1$
/* 0 */ MIUIMessages.getString( "SolibSearchPathBlock.0" ), //$NON-NLS-1$
/* 1 */ null,
/* 2 */ MIUIPlugin.getResourceString("internal.ui.SolibSearchPathBlock.Up"), //$NON-NLS-1$
/* 3 */ MIUIPlugin.getResourceString("internal.ui.SolibSearchPathBlock.Down"), //$NON-NLS-1$
/* 2 */ MIUIMessages.getString( "SolibSearchPathBlock.1" ), //$NON-NLS-1$
/* 3 */ MIUIMessages.getString( "SolibSearchPathBlock.2" ), //$NON-NLS-1$
/* 4 */ null,
/* 5 */ MIUIPlugin.getResourceString("internal.ui.SolibSearchPathBlock.Remove"), //$NON-NLS-1$
/* 5 */ MIUIMessages.getString( "SolibSearchPathBlock.3" ), //$NON-NLS-1$
};
IListAdapter listAdapter = new IListAdapter()
@ -85,7 +83,7 @@ public class SolibSearchPathBlock extends Observable
};
fDirList = new SolibSearchPathListDialogField( listAdapter, buttonLabels, new LabelProvider() );
fDirList.setLabelText( MIUIPlugin.getResourceString("internal.ui.SolibSearchPathBlock.Directories") ); //$NON-NLS-1$
fDirList.setLabelText( MIUIMessages.getString( "SolibSearchPathBlock.4" ) ); //$NON-NLS-1$
fDirList.setUpButtonIndex( 2 );
fDirList.setDownButtonIndex( 3 );
fDirList.setRemoveButtonIndex( 5 );
@ -151,7 +149,7 @@ public class SolibSearchPathBlock extends Observable
private void addDirectory()
{
DirectoryDialog dialog = new DirectoryDialog( getShell() );
dialog.setMessage( MIUIPlugin.getResourceString("internal.ui.SolibSearchPathBlock.Select_directory_with_shared_lib") ); //$NON-NLS-1$
dialog.setMessage( MIUIMessages.getString( "SolibSearchPathBlock.5" ) ); //$NON-NLS-1$
String res = dialog.open();
if ( res != null )
fDirList.addElement( res );
@ -162,3 +160,4 @@ public class SolibSearchPathBlock extends Observable
deleteObservers();
}
}

View file

@ -7,7 +7,6 @@
package org.eclipse.cdt.debug.mi.internal.ui;
import java.util.Observable;
import org.eclipse.cdt.debug.mi.core.IGDBServerMILaunchConfigurationConstants;
import org.eclipse.cdt.debug.mi.internal.ui.dialogfields.DialogField;
import org.eclipse.cdt.debug.mi.internal.ui.dialogfields.IDialogFieldListener;
@ -23,7 +22,6 @@ import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.cdt.debug.mi.internal.ui.MIUIPlugin;
/**
* Enter type comment.
@ -104,7 +102,7 @@ public class TCPSettingsBlock extends Observable
private StringDialogField createHostNameField()
{
StringDialogField field = new StringDialogField();
field.setLabelText( MIUIPlugin.getResourceString("TCPSettingsBlock.Host_or_IP") ); //$NON-NLS-1$
field.setLabelText( MIUIMessages.getString( "TCPSettingsBlock.0" ) ); //$NON-NLS-1$
field.setDialogFieldListener(
new IDialogFieldListener()
{
@ -119,7 +117,7 @@ public class TCPSettingsBlock extends Observable
private StringDialogField createPortNumberField()
{
StringDialogField field = new StringDialogField();
field.setLabelText( MIUIPlugin.getResourceString("TCPSettingsBlock.Port") ); //$NON-NLS-1$
field.setLabelText( MIUIMessages.getString( "TCPSettingsBlock.1" ) ); //$NON-NLS-1$
field.setDialogFieldListener(
new IDialogFieldListener()
{
@ -195,13 +193,13 @@ public class TCPSettingsBlock extends Observable
if ( fHostNameField != null && fPortNumberField != null )
{
if ( fHostNameField.getText().trim().length() == 0 )
setErrorMessage( MIUIPlugin.getResourceString("TCPSettingsBlock.Host_or_IP_must_be_specified") ); //$NON-NLS-1$
setErrorMessage( MIUIMessages.getString( "TCPSettingsBlock.2" ) ); //$NON-NLS-1$
else if ( !hostNameIsValid( fHostNameField.getText().trim() ) )
setErrorMessage( MIUIPlugin.getResourceString("TCPSettingsBlock.Invalid_host_or_IP") ); //$NON-NLS-1$
setErrorMessage( MIUIMessages.getString( "TCPSettingsBlock.3" ) ); //$NON-NLS-1$
else if ( fPortNumberField.getText().trim().length() == 0 )
setErrorMessage( MIUIPlugin.getResourceString("TCPSettingsBlock.Port_must_be_specified") ); //$NON-NLS-1$
setErrorMessage( MIUIMessages.getString( "TCPSettingsBlock.4" ) ); //$NON-NLS-1$
else if ( !portNumberIsValid( fPortNumberField.getText().trim() ) )
setErrorMessage( MIUIPlugin.getResourceString("TCPSettingsBlock.Invalid_port") ); //$NON-NLS-1$
setErrorMessage( MIUIMessages.getString( "TCPSettingsBlock.5" ) ); //$NON-NLS-1$
}
}
@ -235,3 +233,4 @@ public class TCPSettingsBlock extends Observable
return true;
}
}

View file

@ -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.mi.internal.ui.actions;
import java.util.MissingResourceException;
import org.eclipse.cdt.debug.mi.internal.ui.MIUIPlugin;
//import java.util.ResourceBundle;
public class ActionMessages {
// private static final String BUNDLE_NAME = "org.eclipse.cdt.debug.mi.internal.ui.actions.ActionMessages";//$NON-NLS-1$
// private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME );
private ActionMessages() {
}
public static String getString( String key ) {
try {
return MIUIPlugin.getResourceString( key );
// return RESOURCE_BUNDLE.getString( key );
}
catch( MissingResourceException e ) {
return '!' + key + '!';
}
}
}

View file

@ -0,0 +1,2 @@
SetAutoSolibActionDelegate.0=Exceptions occurred attempting to set 'Automatically Load Symbols' mode.
SetAutoSolibActionDelegate.1=Set 'Automatically Load Symbols' mode failed.

View file

@ -7,6 +7,7 @@ package org.eclipse.cdt.debug.mi.internal.ui.actions;
import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.ICDISession;
import org.eclipse.cdt.debug.internal.ui.actions.AbstractDebugActionDelegate;
import org.eclipse.cdt.debug.mi.core.MIPlugin;
import org.eclipse.cdt.debug.mi.core.cdi.Session;
import org.eclipse.cdt.debug.mi.core.cdi.SharedLibraryManager;
@ -28,7 +29,6 @@ import org.eclipse.ui.IViewActionDelegate;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.cdt.debug.mi.internal.ui.MIUIPlugin;
/**
* Enter type comment.
@ -223,7 +223,7 @@ public class SetAutoSolibActionDelegate implements IViewActionDelegate,
protected String getStatusMessage()
{
return MIUIPlugin.getResourceString("internal.ui.actions.SetAutoSolibActionDelegate.Exception_set_automatically_load_symbols"); //$NON-NLS-1$
return ActionMessages.getString( "SetAutoSolibActionDelegate.0" ); //$NON-NLS-1$
}
/**
@ -231,7 +231,7 @@ public class SetAutoSolibActionDelegate implements IViewActionDelegate,
*/
protected String getErrorDialogMessage()
{
return MIUIPlugin.getResourceString("internal.ui.actions.SetAutoSolibActionDelegate.Set_automatically_load_symbols_failed"); //$NON-NLS-1$
return ActionMessages.getString( "SetAutoSolibActionDelegate.1" ); //$NON-NLS-1$
}
protected void setStatus( IStatus status )
@ -278,3 +278,4 @@ public class SetAutoSolibActionDelegate implements IViewActionDelegate,
return null;
}
}

View file

@ -50,7 +50,7 @@ public class MIPreferencePage extends PreferencePage implements IWorkbenchPrefer
{
super();
setPreferenceStore( MIUIPlugin.getDefault().getPreferenceStore() );
setDescription( MIUIPlugin.getResourceString("internal.ui.preferences.MIPreferencePage.General_GDBMI_settings") ); //$NON-NLS-1$
setDescription( PreferenceMessages.getString( "MIPreferencePage.0" ) ); //$NON-NLS-1$
}
/* (non-Javadoc)
@ -149,7 +149,7 @@ public class MIPreferencePage extends PreferencePage implements IWorkbenchPrefer
private void createCommunicationPreferences( Composite composite )
{
Composite comp = createGroupComposite( composite, 1, MIUIPlugin.getResourceString("internal.ui.preferences.MIPreferencePage.Communication") ); //$NON-NLS-1$
Composite comp = createGroupComposite( composite, 1, PreferenceMessages.getString( "MIPreferencePage.1" ) ); //$NON-NLS-1$
//Add in an intermediate composite to allow for spacing
Composite spacingComposite = new Composite( comp, SWT.NONE );
GridLayout layout = new GridLayout();
@ -158,7 +158,7 @@ public class MIPreferencePage extends PreferencePage implements IWorkbenchPrefer
data.horizontalSpan = 2;
spacingComposite.setLayoutData( data );
fDebugTimeoutText = createTimeoutField( IMIConstants.PREF_REQUEST_TIMEOUT, MIUIPlugin.getResourceString("internal.ui.preferences.MIPreferencePage.Debugger_timeout"), spacingComposite ); //$NON-NLS-1$
fDebugTimeoutText = createTimeoutField( IMIConstants.PREF_REQUEST_TIMEOUT, PreferenceMessages.getString( "MIPreferencePage.2" ), spacingComposite ); //$NON-NLS-1$
fDebugTimeoutText.setPropertyChangeListener(
new IPropertyChangeListener()
{
@ -169,7 +169,7 @@ public class MIPreferencePage extends PreferencePage implements IWorkbenchPrefer
}
} );
fLaunchTimeoutText = createTimeoutField( IMIConstants.PREF_REQUEST_LAUNCH_TIMEOUT, MIUIPlugin.getResourceString("internal.ui.preferences.MIPreferencePage.Launch_timeout"), spacingComposite ); //$NON-NLS-1$
fLaunchTimeoutText = createTimeoutField( IMIConstants.PREF_REQUEST_LAUNCH_TIMEOUT, PreferenceMessages.getString( "MIPreferencePage.3" ), spacingComposite ); //$NON-NLS-1$
fLaunchTimeoutText.setPropertyChangeListener(
new IPropertyChangeListener()
{
@ -203,8 +203,9 @@ public class MIPreferencePage extends PreferencePage implements IWorkbenchPrefer
toText.setValidRange( IMIConstants.MIN_REQUEST_TIMEOUT, IMIConstants.MAX_REQUEST_TIMEOUT );
String minValue = Integer.toString( IMIConstants.MIN_REQUEST_TIMEOUT );
String maxValue = Integer.toString( IMIConstants.MAX_REQUEST_TIMEOUT );
toText.setErrorMessage( MessageFormat.format( MIUIPlugin.getResourceString("internal.ui.preferences.MIPreferencePage.Error_Request_timeout_range"), new String[]{ minValue, maxValue } ) ); //$NON-NLS-1$
toText.setErrorMessage( MessageFormat.format( PreferenceMessages.getString( "MIPreferencePage.4" ), new String[]{ minValue, maxValue } ) ); //$NON-NLS-1$
toText.load();
return toText;
}
}

View file

@ -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.mi.internal.ui.preferences;
import java.util.MissingResourceException;
import org.eclipse.cdt.debug.mi.internal.ui.MIUIPlugin;
//import java.util.ResourceBundle;
public class PreferenceMessages {
// private static final String BUNDLE_NAME = "org.eclipse.cdt.debug.mi.internal.ui.preferences.PreferenceMessages";//$NON-NLS-1$
// private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME );
private PreferenceMessages() {
}
public static String getString( String key ) {
try {
return MIUIPlugin.getResourceString( key );
// return RESOURCE_BUNDLE.getString( key );
}
catch( MissingResourceException e ) {
return '!' + key + '!';
}
}
}

View file

@ -0,0 +1,5 @@
MIPreferencePage.0=General settings for GDB MI.
MIPreferencePage.1=Communication
MIPreferencePage.2=&Debugger timeout (ms):
MIPreferencePage.3=&Launch timeout (ms):
MIPreferencePage.4=The valid value range is [{0},{1}].

Binary file not shown.

Before

Width:  |  Height:  |  Size: 885 B

After

Width:  |  Height:  |  Size: 148 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 897 B

After

Width:  |  Height:  |  Size: 343 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 222 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 343 B

View file

@ -10,6 +10,11 @@ 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
@ -36,6 +41,7 @@ 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
@ -45,3 +51,71 @@ 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

View file

@ -247,7 +247,7 @@ public class AddGlobalsActionDelegate extends ActionDelegate implements IViewAct
}
return null;
}
}, CDebugUIPlugin.getResourceString( "internal.ui.actions.AddGlobalsActionDelegate.Select_Variables" ) ); //$NON-NLS-1$
}, ActionMessages.getString( "AddGlobalsActionDelegate.0" ) ); //$NON-NLS-1$
}
protected IGlobalVariableDescriptor[] getGlobals() {
@ -276,7 +276,7 @@ public class AddGlobalsActionDelegate extends ActionDelegate implements IViewAct
* @see AbstractDebugActionDelegate#getErrorDialogMessage()
*/
protected String getErrorDialogMessage() {
return CDebugUIPlugin.getResourceString( "internal.ui.actions.AddGlobalsActionDelegate.Add_global_variables_failed" ); //$NON-NLS-1$
return ActionMessages.getString( "AddGlobalsActionDelegate.1" ); //$NON-NLS-1$
}
protected void setStatus( IStatus status ) {
@ -298,4 +298,4 @@ public class AddGlobalsActionDelegate extends ActionDelegate implements IViewAct
setSelection( (element != null) ? new StructuredSelection( element ) : new StructuredSelection() );
update( action );
}
}
}

View file

@ -188,7 +188,7 @@ public class AddWatchpointActionDelegate extends ActionDelegate implements IWork
CDIDebugModel.createWatchpoint( getSourceHandle(), getResource(), write, read, expression, true, 0, "", true ); //$NON-NLS-1$
}
catch( CoreException ce ) {
CDebugUIPlugin.errorDialog( CDebugUIPlugin.getResourceString( "internal.ui.actions.AddWatchpointActionDelegate.Cannot_add_watchpoint" ), ce ); //$NON-NLS-1$
CDebugUIPlugin.errorDialog( ActionMessages.getString( "AddWatchpointActionDelegate.0" ), ce ); //$NON-NLS-1$
}
}
}

View file

@ -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.actions;
import org.eclipse.cdt.debug.internal.ui.CDebugImages;
@ -22,168 +27,150 @@ import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
/**
*
* Enter type comment.
*
* @since Sep 4, 2002
* The "Add Watchpoint" dialog of the "Toggle watchpoint" action.
*/
public class AddWatchpointDialog extends Dialog
{
public class AddWatchpointDialog extends Dialog {
private Button fBtnOk = null;
private Text fTextExpression;
private Button fChkBtnWrite;
private Button fChkBtnRead;
private boolean fWrite = true;
private boolean fRead = false;
private String fExpression = ""; //$NON-NLS-1$
/**
* Constructor for AddWatchpointDialog.
*
* @param parentShell
*/
public AddWatchpointDialog( Shell parentShell, boolean write, boolean read, String expression )
{
public AddWatchpointDialog( Shell parentShell, boolean write, boolean read, String expression ) {
super( parentShell );
fWrite = write;
fRead = read;
if ( expression != null )
fExpression = expression;
fExpression = expression;
}
protected void configureShell( Shell shell )
{
protected void configureShell( Shell shell ) {
super.configureShell( shell );
shell.setText( CDebugUIPlugin.getResourceString("internal.ui.actions.AddWatchpointDialog.Add_C_C++_Watchpoint") ); //$NON-NLS-1$
shell.setText( ActionMessages.getString( "AddWatchpointDialog.0" ) ); //$NON-NLS-1$
shell.setImage( CDebugImages.get( CDebugImages.IMG_OBJS_WATCHPOINT_ENABLED ) );
}
protected Control createContents( Composite parent )
{
protected Control createContents( Composite parent ) {
Control control = super.createContents( parent );
setOkButtonState();
return control;
}
protected Control createDialogArea( Composite parent )
{
protected Control createDialogArea( Composite parent ) {
Composite composite = new Composite( parent, SWT.NONE );
composite.setLayout( new GridLayout() );
((GridLayout)composite.getLayout()).marginWidth = 10;
composite.setLayoutData( new GridData( GridData.FILL_BOTH ) );
composite.setLayoutData( new GridData( GridData.FILL_BOTH ) );
createDataWidgets( composite );
initializeDataWidgets();
return composite;
}
protected void createButtonsForButtonBar( Composite parent )
{
protected void createButtonsForButtonBar( Composite parent ) {
fBtnOk = createButton( parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true );
createButton( parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false );
}
private void createDataWidgets( Composite parent )
{
fTextExpression = createExpressionText( parent );
private void createDataWidgets( Composite parent ) {
fTextExpression = createExpressionText( parent );
createAccessWidgets( parent );
}
private void initializeDataWidgets()
{
private void initializeDataWidgets() {
fTextExpression.setText( fExpression );
fChkBtnRead.setSelection( fRead );
fChkBtnWrite.setSelection( fWrite );
setOkButtonState();
}
private Text createExpressionText( Composite parent )
{
private Text createExpressionText( Composite parent ) {
Label label = new Label( parent, SWT.RIGHT );
label.setText( CDebugUIPlugin.getResourceString("internal.ui.actions.AddWatchpointDialog.Expression_to_watch") ); //$NON-NLS-1$
label.setText( ActionMessages.getString( "AddWatchpointDialog.1" ) ); //$NON-NLS-1$
final Text text = new Text( parent, SWT.BORDER );
GridData gridData = new GridData( GridData.FILL_HORIZONTAL );
gridData.widthHint = 300;
text.setLayoutData( gridData );
addModifyListener( text );
addModifyListener( text );
return text;
}
private void createAccessWidgets( Composite parent )
{
private void createAccessWidgets( Composite parent ) {
Group group = new Group( parent, SWT.NONE );
group.setLayout( new GridLayout() );
group.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
group.setText( CDebugUIPlugin.getResourceString("internal.ui.actions.AddWatchpointDialog.Access") ); //$NON-NLS-1$
group.setText( ActionMessages.getString( "AddWatchpointDialog.2" ) ); //$NON-NLS-1$
fChkBtnWrite = new Button( group, SWT.CHECK );
fChkBtnWrite.setText( CDebugUIPlugin.getResourceString("internal.ui.actions.AddWatchpointDialog.Write") ); //$NON-NLS-1$
addSelectionListener( fChkBtnWrite );
fChkBtnWrite.setText( ActionMessages.getString( "AddWatchpointDialog.3" ) ); //$NON-NLS-1$
addSelectionListener( fChkBtnWrite );
fChkBtnRead = new Button( group, SWT.CHECK );
fChkBtnRead.setText( CDebugUIPlugin.getResourceString("internal.ui.actions.AddWatchpointDialog.Read") ); //$NON-NLS-1$
addSelectionListener( fChkBtnRead );
fChkBtnRead.setText( ActionMessages.getString( "AddWatchpointDialog.4" ) ); //$NON-NLS-1$
addSelectionListener( fChkBtnRead );
}
private void addSelectionListener( Button button )
{
button.addSelectionListener(
new SelectionAdapter()
{
public void widgetSelected( SelectionEvent e )
{
setOkButtonState();
}
} );
private void addSelectionListener( Button button ) {
button.addSelectionListener( new SelectionAdapter() {
public void widgetSelected( SelectionEvent e ) {
setOkButtonState();
}
} );
}
protected void setOkButtonState()
{
protected void setOkButtonState() {
if ( fBtnOk == null )
return;
fBtnOk.setEnabled( (fChkBtnRead.getSelection() || fChkBtnWrite.getSelection()) &&
fTextExpression.getText().trim().length() > 0 );
fBtnOk.setEnabled( (fChkBtnRead.getSelection() || fChkBtnWrite.getSelection()) && fTextExpression.getText().trim().length() > 0 );
}
private void storeData()
{
private void storeData() {
fExpression = fTextExpression.getText().trim();
fRead = fChkBtnRead.getSelection();
fWrite = fChkBtnWrite.getSelection();
}
private void addModifyListener( Text text )
{
text.addModifyListener(
new ModifyListener()
{
public void modifyText( ModifyEvent e )
{
setOkButtonState();
}
} );
private void addModifyListener( Text text ) {
text.addModifyListener( new ModifyListener() {
public void modifyText( ModifyEvent e ) {
setOkButtonState();
}
} );
}
public String getExpression()
{
public String getExpression() {
return fExpression;
}
public boolean getWriteAccess()
{
public boolean getWriteAccess() {
return fWrite;
}
public boolean getReadAccess()
{
public boolean getReadAccess() {
return fRead;
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.dialogs.Dialog#okPressed()
*/
protected void okPressed()
{
protected void okPressed() {
storeData();
super.okPressed();
}

View file

@ -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.actions;
import org.eclipse.cdt.debug.internal.ui.CDebugImages;
@ -11,46 +16,42 @@ import org.eclipse.cdt.debug.internal.ui.views.memory.MemoryViewer;
import org.eclipse.ui.actions.SelectionProviderAction;
import org.eclipse.ui.help.WorkbenchHelp;
import org.eclipse.ui.texteditor.IUpdate;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
/**
* Enter type comment.
*
* @since: Oct 21, 2002
* The "Auto-Refresh" action of the Memory View.
*/
public class AutoRefreshMemoryAction extends SelectionProviderAction implements IUpdate
{
public class AutoRefreshMemoryAction extends SelectionProviderAction implements IUpdate {
private MemoryViewer fMemoryViewer;
/**
* Constructor for AutoRefreshMemoryAction.
* @param provider
* @param text
*/
public AutoRefreshMemoryAction( MemoryViewer viewer )
{
super( viewer, CDebugUIPlugin.getResourceString("internal.ui.actions.AutoRefreshMemoryAction.Auto-Refresh") ); //$NON-NLS-1$
public AutoRefreshMemoryAction( MemoryViewer viewer ) {
super( viewer, ActionMessages.getString( "AutoRefreshMemoryAction.0" ) ); //$NON-NLS-1$
fMemoryViewer = viewer;
CDebugImages.setLocalImageDescriptors( this, CDebugImages.IMG_LCL_AUTO_REFRESH );
setDescription( CDebugUIPlugin.getResourceString("internal.ui.actions.AutoRefreshMemoryAction.Automatically_Refresh_Memory_Block") ); //$NON-NLS-1$
setToolTipText( CDebugUIPlugin.getResourceString("internal.ui.actions.AutoRefreshMemoryAction.Auto-Refresh") ); //$NON-NLS-1$
setDescription( ActionMessages.getString( "AutoRefreshMemoryAction.1" ) ); //$NON-NLS-1$
setToolTipText( ActionMessages.getString( "AutoRefreshMemoryAction.2" ) ); //$NON-NLS-1$
WorkbenchHelp.setHelp( this, ICDebugHelpContextIds.AUTO_REFRESH_MEMORY_ACTION );
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.texteditor.IUpdate#update()
*/
public void update()
{
public void update() {
setEnabled( fMemoryViewer.canUpdate() );
setChecked( !fMemoryViewer.isFrozen() );
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.action.IAction#run()
*/
public void run()
{
public void run() {
fMemoryViewer.setFrozen( !isChecked() );
}
}

View file

@ -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.actions;
import org.eclipse.cdt.debug.core.CDebugUtils;
@ -26,31 +31,24 @@ import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
/**
*
* The preference page that is used to present the properties of a breakpoint as
* preferences. A CBreakpointPreferenceStore is used to interface between this
* page and the breakpoint.
*
* @since Aug 27, 2002
* The preference page used to present the properties of a breakpoint as preferences. A CBreakpointPreferenceStore is used to interface between this page and
* the breakpoint.
*/
public class CBreakpointPreferencePage extends FieldEditorPreferencePage
{
class BreakpointIntegerFieldEditor extends IntegerFieldEditor
{
public BreakpointIntegerFieldEditor( String name, String labelText, Composite parent )
{
public class CBreakpointPreferencePage extends FieldEditorPreferencePage {
class BreakpointIntegerFieldEditor extends IntegerFieldEditor {
public BreakpointIntegerFieldEditor( String name, String labelText, Composite parent ) {
super( name, labelText, parent );
setErrorMessage( CDebugUIPlugin.getResourceString("internal.ui.actions.CBreakpointPreferencePage.Ignore_count_must_be_positive_integer") ); //$NON-NLS-1$
setErrorMessage( ActionMessages.getString( "CBreakpointPreferencePage.0" ) ); //$NON-NLS-1$
}
/**
* @see IntegerFieldEditor#checkState()
*/
protected boolean checkState()
{
protected boolean checkState() {
Text control = getTextControl();
if ( !control.isEnabled() )
{
if ( !control.isEnabled() ) {
clearErrorMessage();
return true;
}
@ -60,73 +58,61 @@ public class CBreakpointPreferencePage extends FieldEditorPreferencePage
/**
* Overrode here to be package visible.
*/
protected void refreshValidState()
{
protected void refreshValidState() {
super.refreshValidState();
}
/**
* Only store if the text control is enabled
*
* @see FieldEditor#doStore()
*/
protected void doStore()
{
protected void doStore() {
Text text = getTextControl();
if ( text.isEnabled() )
{
if ( text.isEnabled() ) {
super.doStore();
}
}
/**
* Clears the error message from the message line if the error
* message is the error message from this field editor.
* Clears the error message from the message line if the error message is the error message from this field editor.
*/
protected void clearErrorMessage()
{
if ( getPreferencePage() != null )
{
protected void clearErrorMessage() {
if ( getPreferencePage() != null ) {
String message = getPreferencePage().getErrorMessage();
if ( message != null )
{
if ( getErrorMessage().equals( message ) )
{
if ( message != null ) {
if ( getErrorMessage().equals( message ) ) {
super.clearErrorMessage();
}
}
else
{
else {
super.clearErrorMessage();
}
}
}
}
class BreakpointStringFieldEditor extends StringFieldEditor
{
public BreakpointStringFieldEditor( String name, String labelText, Composite parent )
{
class BreakpointStringFieldEditor extends StringFieldEditor {
public BreakpointStringFieldEditor( String name, String labelText, Composite parent ) {
super( name, labelText, parent );
}
/**
* @see StringFieldEditor#checkState()
*/
protected boolean checkState()
{
protected boolean checkState() {
Text control = getTextControl();
if ( !control.isEnabled() )
{
if ( !control.isEnabled() ) {
clearErrorMessage();
return true;
}
return super.checkState();
}
protected void doStore()
{
protected void doStore() {
Text text = getTextControl();
if ( text.isEnabled() )
{
if ( text.isEnabled() ) {
super.doStore();
}
}
@ -134,59 +120,52 @@ public class CBreakpointPreferencePage extends FieldEditorPreferencePage
/**
* @see FieldEditor#refreshValidState()
*/
protected void refreshValidState()
{
protected void refreshValidState() {
super.refreshValidState();
}
/**
* Clears the error message from the message line if the error
* message is the error message from this field editor.
* Clears the error message from the message line if the error message is the error message from this field editor.
*/
protected void clearErrorMessage()
{
if ( getPreferencePage() != null )
{
protected void clearErrorMessage() {
if ( getPreferencePage() != null ) {
String message = getPreferencePage().getErrorMessage();
if ( message != null )
{
if ( getErrorMessage().equals( message ) )
{
if ( message != null ) {
if ( getErrorMessage().equals( message ) ) {
super.clearErrorMessage();
}
}
else
{
else {
super.clearErrorMessage();
}
}
}
}
class LabelFieldEditor extends FieldEditor
{
class LabelFieldEditor extends FieldEditor {
private Label fTitleLabel;
private Label fValueLabel;
private Composite fBasicComposite;
private String fValue;
private String fTitle;
public LabelFieldEditor( Composite parent, String title, String value )
{
public LabelFieldEditor( Composite parent, String title, String value ) {
fValue = value;
fTitle = title;
this.createControl( parent );
}
protected void adjustForNumColumns( int numColumns )
{
protected void adjustForNumColumns( int numColumns ) {
((GridData)fBasicComposite.getLayoutData()).horizontalSpan = numColumns;
}
protected void doFillIntoGrid( Composite parent, int numColumns )
{
fBasicComposite = new Composite(parent, SWT.NULL);
protected void doFillIntoGrid( Composite parent, int numColumns ) {
fBasicComposite = new Composite( parent, SWT.NULL );
GridLayout layout = new GridLayout();
layout.marginWidth = 0;
layout.marginHeight = 0;
@ -196,231 +175,190 @@ public class CBreakpointPreferencePage extends FieldEditorPreferencePage
data.verticalAlignment = GridData.FILL;
data.horizontalAlignment = GridData.FILL;
fBasicComposite.setLayoutData( data );
fTitleLabel = new Label( fBasicComposite, SWT.NONE );
fTitleLabel.setText( fTitle );
GridData gd = new GridData();
gd.verticalAlignment = SWT.TOP;
fTitleLabel.setLayoutData( gd );
fValueLabel = new Label( fBasicComposite, SWT.WRAP );
fValueLabel.setText( fValue );
gd = new GridData();
fValueLabel.setLayoutData( gd );
}
public int getNumberOfControls()
{
public int getNumberOfControls() {
return 1;
}
/**
* The label field editor is only used to present a text label
* on a preference page.
* The label field editor is only used to present a text label on a preference page.
*/
protected void doLoad()
{
protected void doLoad() {
}
protected void doLoadDefault()
{
protected void doLoadDefault() {
}
protected void doStore()
{
protected void doStore() {
}
}
private BreakpointStringFieldEditor fCondition;
private Text fIgnoreCountTextControl;
private BreakpointIntegerFieldEditor fIgnoreCount;
private ICBreakpoint fBreakpoint;
/**
* Constructor for CBreakpointPreferencePage.
*
* @param breakpoint
*/
public CBreakpointPreferencePage( ICBreakpoint breakpoint )
{
public CBreakpointPreferencePage( ICBreakpoint breakpoint ) {
super( GRID );
setBreakpoint( breakpoint );
noDefaultAndApplyButton();
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
*/
protected void createFieldEditors()
{
protected void createFieldEditors() {
ICBreakpoint breakpoint = getBreakpoint();
createTypeSpecificLabelFieldEditors( breakpoint );
IPreferenceStore store = getPreferenceStore();
try
{
String condition= breakpoint.getCondition();
if ( condition == null )
{
try {
String condition = breakpoint.getCondition();
if ( condition == null ) {
condition = ""; //$NON-NLS-1$
}
store.setValue( CBreakpointPreferenceStore.CONDITION, condition );
createConditionEditor( getFieldEditorParent() );
store.setValue( CBreakpointPreferenceStore.ENABLED, breakpoint.isEnabled() );
int ignoreCount = breakpoint.getIgnoreCount();
store.setValue( CBreakpointPreferenceStore.IGNORE_COUNT, ( ignoreCount >= 0 ) ? ignoreCount : 0 );
store.setValue( CBreakpointPreferenceStore.IGNORE_COUNT, (ignoreCount >= 0) ? ignoreCount : 0 );
createIgnoreCountEditor( getFieldEditorParent() );
}
catch( CoreException ce )
{
catch( CoreException ce ) {
CDebugUIPlugin.log( ce );
}
}
/**
* Method createTypeSpecificLabelFieldEditors.
*
* @param breakpoint
*/
private void createTypeSpecificLabelFieldEditors( ICBreakpoint breakpoint )
{
if ( breakpoint instanceof ICFunctionBreakpoint )
{
private void createTypeSpecificLabelFieldEditors( ICBreakpoint breakpoint ) {
if ( breakpoint instanceof ICFunctionBreakpoint ) {
ICFunctionBreakpoint fbrkpt = (ICFunctionBreakpoint)breakpoint;
String function = CDebugUIPlugin.getResourceString("internal.ui.actions.CBreakpointPreferencePage.Not_available"); //$NON-NLS-1$
try
{
String function = ActionMessages.getString( "CBreakpointPreferencePage.1" ); //$NON-NLS-1$
try {
function = fbrkpt.getFunction();
}
catch( CoreException e )
{
catch( CoreException e ) {
}
catch( NumberFormatException e )
{
catch( NumberFormatException e ) {
}
if ( function != null )
{
addField( createLabelEditor( getFieldEditorParent(), CDebugUIPlugin.getResourceString("internal.ui.actions.CBreakpointPreferencePage.Function_name"), function ) ); //$NON-NLS-1$
if ( function != null ) {
addField( createLabelEditor( getFieldEditorParent(), ActionMessages.getString( "CBreakpointPreferencePage.2" ), function ) ); //$NON-NLS-1$
}
setTitle( CDebugUIPlugin.getResourceString("internal.ui.actions.CBreakpointPreferencePage.Function_Breakpoint_Properties") ); //$NON-NLS-1$
setTitle( ActionMessages.getString( "CBreakpointPreferencePage.3" ) ); //$NON-NLS-1$
}
else if ( breakpoint instanceof ICAddressBreakpoint )
{
else if ( breakpoint instanceof ICAddressBreakpoint ) {
ICAddressBreakpoint abrkpt = (ICAddressBreakpoint)breakpoint;
String address = CDebugUIPlugin.getResourceString("internal.ui.actions.CBreakpointPreferencePage.Not_available"); //$NON-NLS-1$
try
{
String address = ActionMessages.getString( "CBreakpointPreferencePage.4" ); //$NON-NLS-1$
try {
address = CDebugUtils.toHexAddressString( Long.parseLong( abrkpt.getAddress() ) );
}
catch( CoreException e )
{
catch( CoreException e ) {
}
catch( NumberFormatException e )
{
catch( NumberFormatException e ) {
}
if ( address != null )
{
addField( createLabelEditor( getFieldEditorParent(), CDebugUIPlugin.getResourceString("internal.ui.actions.CBreakpointPreferencePage.Address"), address ) ); //$NON-NLS-1$
if ( address != null ) {
addField( createLabelEditor( getFieldEditorParent(), ActionMessages.getString( "CBreakpointPreferencePage.5" ), address ) ); //$NON-NLS-1$
}
setTitle( CDebugUIPlugin.getResourceString("internal.ui.actions.CBreakpointPreferencePage.Address_Breakpoint_Properties") ); //$NON-NLS-1$
setTitle( ActionMessages.getString( "CBreakpointPreferencePage.6" ) ); //$NON-NLS-1$
}
else if ( breakpoint instanceof ILineBreakpoint )
{
else if ( breakpoint instanceof ILineBreakpoint ) {
String fileName = breakpoint.getMarker().getResource().getLocation().toOSString();
if ( fileName != null )
{
addField( createLabelEditor( getFieldEditorParent(), CDebugUIPlugin.getResourceString("internal.ui.actions.CBreakpointPreferencePage.File"), fileName ) ); //$NON-NLS-1$
if ( fileName != null ) {
addField( createLabelEditor( getFieldEditorParent(), ActionMessages.getString( "CBreakpointPreferencePage.7" ), fileName ) ); //$NON-NLS-1$
}
setTitle( CDebugUIPlugin.getResourceString("internal.ui.actions.CBreakpointPreferencePage.Line_Breakpoint_Properties") ); //$NON-NLS-1$
setTitle( ActionMessages.getString( "CBreakpointPreferencePage.8" ) ); //$NON-NLS-1$
ILineBreakpoint lBreakpoint = (ILineBreakpoint)breakpoint;
StringBuffer lineNumber = new StringBuffer( 4 );
try
{
try {
int lNumber = lBreakpoint.getLineNumber();
if ( lNumber > 0 )
{
if ( lNumber > 0 ) {
lineNumber.append( lNumber );
}
}
catch( CoreException ce )
{
catch( CoreException ce ) {
CDebugUIPlugin.log( ce );
}
if ( lineNumber.length() > 0 )
{
addField( createLabelEditor( getFieldEditorParent(), CDebugUIPlugin.getResourceString("internal.ui.actions.CBreakpointPreferencePage.Line_Number"), lineNumber.toString() ) ); //$NON-NLS-1$
if ( lineNumber.length() > 0 ) {
addField( createLabelEditor( getFieldEditorParent(), ActionMessages.getString( "CBreakpointPreferencePage.9" ), lineNumber.toString() ) ); //$NON-NLS-1$
}
}
else if ( breakpoint instanceof ICWatchpoint )
{
else if ( breakpoint instanceof ICWatchpoint ) {
String projectName = breakpoint.getMarker().getResource().getLocation().toOSString();
if ( projectName != null )
{
addField( createLabelEditor( getFieldEditorParent(), CDebugUIPlugin.getResourceString("internal.ui.actions.CBreakpointPreferencePage.Project"), projectName ) ); //$NON-NLS-1$
if ( projectName != null ) {
addField( createLabelEditor( getFieldEditorParent(), ActionMessages.getString( "CBreakpointPreferencePage.10" ), projectName ) ); //$NON-NLS-1$
}
ICWatchpoint watchpoint = (ICWatchpoint)breakpoint;
String title = ""; //$NON-NLS-1$
String expression = ""; //$NON-NLS-1$
try
{
try {
if ( watchpoint.isReadType() && !watchpoint.isWriteType() )
title = CDebugUIPlugin.getResourceString("internal.ui.actions.CBreakpointPreferencePage.Read_Watchpoint_Properties"); //$NON-NLS-1$
title = ActionMessages.getString( "CBreakpointPreferencePage.11" ); //$NON-NLS-1$
else if ( !watchpoint.isReadType() && watchpoint.isWriteType() )
title = CDebugUIPlugin.getResourceString("internal.ui.actions.CBreakpointPreferencePage.Watchpoint_Properties"); //$NON-NLS-1$
title = ActionMessages.getString( "CBreakpointPreferencePage.12" ); //$NON-NLS-1$
else
title = CDebugUIPlugin.getResourceString("internal.ui.actions.CBreakpointPreferencePage.Access_Watchpoint_Properties"); //$NON-NLS-1$
title = ActionMessages.getString( "CBreakpointPreferencePage.13" ); //$NON-NLS-1$
expression = watchpoint.getExpression();
}
catch( CoreException ce )
{
catch( CoreException ce ) {
CDebugUIPlugin.log( ce );
}
setTitle( title );
addField( createLabelEditor( getFieldEditorParent(), CDebugUIPlugin.getResourceString("internal.ui.actions.CBreakpointPreferencePage.Expression_To_Watch"), expression ) ); //$NON-NLS-1$
addField( createLabelEditor( getFieldEditorParent(), ActionMessages.getString( "CBreakpointPreferencePage.14" ), expression ) ); //$NON-NLS-1$
}
}
protected void createConditionEditor( Composite parent )
{
fCondition = new BreakpointStringFieldEditor( CBreakpointPreferenceStore.CONDITION, CDebugUIPlugin.getResourceString("internal.ui.actions.CBreakpointPreferencePage.Condition"), parent ); //$NON-NLS-1$
protected void createConditionEditor( Composite parent ) {
fCondition = new BreakpointStringFieldEditor( CBreakpointPreferenceStore.CONDITION, ActionMessages.getString( "CBreakpointPreferencePage.15" ), parent ); //$NON-NLS-1$
fCondition.setEmptyStringAllowed( true );
fCondition.setErrorMessage( CDebugUIPlugin.getResourceString("internal.ui.actions.CBreakpointPreferencePage.Invalid_condition") ); //$NON-NLS-1$
fCondition.setErrorMessage( ActionMessages.getString( "CBreakpointPreferencePage.16" ) ); //$NON-NLS-1$
addField( fCondition );
}
protected void createIgnoreCountEditor( Composite parent )
{
fIgnoreCount = new BreakpointIntegerFieldEditor( CBreakpointPreferenceStore.IGNORE_COUNT, CDebugUIPlugin.getResourceString("internal.ui.actions.CBreakpointPreferencePage.Ignore_Count"), parent ); //$NON-NLS-1$
protected void createIgnoreCountEditor( Composite parent ) {
fIgnoreCount = new BreakpointIntegerFieldEditor( CBreakpointPreferenceStore.IGNORE_COUNT, ActionMessages.getString( "CBreakpointPreferencePage.17" ), parent ); //$NON-NLS-1$
fIgnoreCount.setValidRange( 0, Integer.MAX_VALUE );
fIgnoreCountTextControl = fIgnoreCount.getTextControl( parent );
try
{
try {
fIgnoreCountTextControl.setEnabled( getBreakpoint().getIgnoreCount() >= 0 );
}
catch (CoreException ce)
{
catch( CoreException ce ) {
CDebugUIPlugin.log( ce );
}
addField( fIgnoreCount );
}
protected FieldEditor createLabelEditor( Composite parent, String title, String value )
{
protected FieldEditor createLabelEditor( Composite parent, String title, String value ) {
return new LabelFieldEditor( parent, title, value );
}
protected ICBreakpoint getBreakpoint()
{
protected ICBreakpoint getBreakpoint() {
return fBreakpoint;
}
protected void setBreakpoint( ICBreakpoint breakpoint )
{
protected void setBreakpoint( ICBreakpoint breakpoint ) {
fBreakpoint = breakpoint;
}
}

View file

@ -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.actions;
import org.eclipse.cdt.debug.core.model.ICastToArray;
@ -40,176 +44,149 @@ import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.actions.ActionDelegate;
/**
* Enter type comment.
*
* @since Mar 10, 2003
* The delegate of the "Display As Array" action.
*/
public class CastToArrayActionDelegate extends ActionDelegate implements IObjectActionDelegate
{
protected class CastToArrayDialog extends Dialog
{
public class CastToArrayActionDelegate extends ActionDelegate implements IObjectActionDelegate {
protected class CastToArrayDialog extends Dialog {
private String fType = ""; //$NON-NLS-1$
private int fFirstIndex = 0;
private int fLength = 0;
private Button fOkButton;
private Label fErrorMessageLabel;
private Text fFirstIndexText;
private Text fLengthText;
public CastToArrayDialog( Shell parentShell, String initialType, int initialStart, int initialLength )
{
public CastToArrayDialog( Shell parentShell, String initialType, int initialStart, int initialLength ) {
super( parentShell );
fType = ( initialType == null ) ? "" : initialType; //$NON-NLS-1$
fType = (initialType == null) ? "" : initialType; //$NON-NLS-1$
fFirstIndex = initialStart;
fLength = initialLength;
}
protected String getType()
{
protected String getType() {
return fType;
}
protected int getFirstIndex()
{
protected int getFirstIndex() {
return fFirstIndex;
}
protected int getLength()
{
protected int getLength() {
return fLength;
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
*/
protected void configureShell( Shell newShell )
{
protected void configureShell( Shell newShell ) {
super.configureShell( newShell );
newShell.setText( CDebugUIPlugin.getResourceString("internal.ui.actions.CastToArrayActionDelegate.Shell_Display_As_Array") ); //$NON-NLS-1$
newShell.setText( ActionMessages.getString( "CastToArrayActionDelegate.0" ) ); //$NON-NLS-1$
newShell.setImage( CDebugImages.get( CDebugImages.IMG_LCL_DISPLAY_AS_ARRAY ) );
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
*/
protected void createButtonsForButtonBar( Composite parent )
{
protected void createButtonsForButtonBar( Composite parent ) {
// create OK and Cancel buttons by default
fOkButton = createButton( parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true );
createButton( parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false );
//do this here because setting the text will set enablement on the ok button
/*
fTypeText.setFocus();
if ( fType != null )
{
fTypeText.setText( fType );
fTypeText.selectAll();
fFirstIndexText.setText( String.valueOf( fFirstIndex ) );
fLengthText.setText( String.valueOf( fLength ) );
}
*/
/*
* fTypeText.setFocus(); if ( fType != null ) { fTypeText.setText( fType ); fTypeText.selectAll(); fFirstIndexText.setText( String.valueOf(
* fFirstIndex ) ); fLengthText.setText( String.valueOf( fLength ) ); }
*/
fFirstIndexText.setText( String.valueOf( fFirstIndex ) );
fLengthText.setText( String.valueOf( fLength ) );
}
protected Label getErrorMessageLabel()
{
protected Label getErrorMessageLabel() {
return fErrorMessageLabel;
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
*/
protected Control createDialogArea( Composite parent )
{
protected Control createDialogArea( Composite parent ) {
Composite composite = (Composite)super.createDialogArea( parent );
createDialogFields( composite );
fErrorMessageLabel = new Label( composite, SWT.NONE );
fErrorMessageLabel.setLayoutData( new GridData( GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL ) );
fErrorMessageLabel.setFont(parent.getFont());
fErrorMessageLabel.setFont( parent.getFont() );
return composite;
}
private void createDialogFields( Composite parent )
{
private void createDialogFields( Composite parent ) {
Composite composite = ControlFactory.createComposite( parent, 4 );
((GridData)composite.getLayoutData()).widthHint = convertHorizontalDLUsToPixels( IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH );
((GridLayout)composite.getLayout()).makeColumnsEqualWidth = true;
Label label = ControlFactory.createLabel( composite, CDebugUIPlugin.getResourceString("internal.ui.actions.CastToArrayActionDelegate.Start_index") ); //$NON-NLS-1$
Label label = ControlFactory.createLabel( composite, ActionMessages.getString( "CastToArrayActionDelegate.1" ) ); //$NON-NLS-1$
((GridData)label.getLayoutData()).horizontalSpan = 3;
fFirstIndexText = ControlFactory.createTextField( composite );
fFirstIndexText.addModifyListener(
new ModifyListener()
{
public void modifyText( ModifyEvent e )
{
validateInput();
}
} );
fFirstIndexText.addModifyListener( new ModifyListener() {
label = ControlFactory.createLabel( composite, CDebugUIPlugin.getResourceString("internal.ui.actions.CastToArrayActionDelegate.Length") ); //$NON-NLS-1$
public void modifyText( ModifyEvent e ) {
validateInput();
}
} );
label = ControlFactory.createLabel( composite, ActionMessages.getString( "CastToArrayActionDelegate.2" ) ); //$NON-NLS-1$
((GridData)label.getLayoutData()).horizontalSpan = 3;
fLengthText = ControlFactory.createTextField( composite );
fLengthText.addModifyListener(
new ModifyListener()
{
public void modifyText( ModifyEvent e )
{
validateInput();
}
} );
fLengthText.addModifyListener( new ModifyListener() {
public void modifyText( ModifyEvent e ) {
validateInput();
}
} );
}
protected void validateInput()
{
protected void validateInput() {
boolean enabled = true;
String message = ""; //$NON-NLS-1$
String firstIndex = fFirstIndexText.getText().trim();
if ( firstIndex.length() == 0 )
{
message = CDebugUIPlugin.getResourceString("internal.ui.actions.CastToArrayActionDelegate.First_index_field_must_not_be_empty"); //$NON-NLS-1$
if ( firstIndex.length() == 0 ) {
message = ActionMessages.getString( "CastToArrayActionDelegate.3" ); //$NON-NLS-1$
enabled = false;
}
else
{
try
{
else {
try {
Integer.parseInt( firstIndex );
}
catch( NumberFormatException e )
{
message = CDebugUIPlugin.getResourceString("internal.ui.actions.CastToArrayActionDelegate.Invalid_first_index"); //$NON-NLS-1$
catch( NumberFormatException e ) {
message = ActionMessages.getString( "CastToArrayActionDelegate.4" ); //$NON-NLS-1$
enabled = false;
}
if ( enabled )
{
if ( enabled ) {
String lengthText = fLengthText.getText().trim();
if ( lengthText.length() == 0 )
{
message = CDebugUIPlugin.getResourceString("internal.ui.actions.CastToArrayActionDelegate.Empty_last_index"); //$NON-NLS-1$
if ( lengthText.length() == 0 ) {
message = ActionMessages.getString( "CastToArrayActionDelegate.5" ); //$NON-NLS-1$
enabled = false;
}
else
{
else {
int length = -1;
try
{
try {
length = Integer.parseInt( lengthText );
}
catch( NumberFormatException e )
{
message = CDebugUIPlugin.getResourceString("internal.ui.actions.CastToArrayActionDelegate.Invalid_last_index."); //$NON-NLS-1$
catch( NumberFormatException e ) {
message = ActionMessages.getString( "CastToArrayActionDelegate.6" ); //$NON-NLS-1$
enabled = false;
}
if ( enabled && length < 1 )
{
message = CDebugUIPlugin.getResourceString("internal.ui.actions.CastToArrayActionDelegate.The_length_must_be_greater_than_0"); //$NON-NLS-1$
if ( enabled && length < 1 ) {
message = ActionMessages.getString( "CastToArrayActionDelegate.7" ); //$NON-NLS-1$
enabled = false;
}
}
@ -219,28 +196,25 @@ public class CastToArrayActionDelegate extends ActionDelegate implements IObject
getErrorMessageLabel().setText( message );
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int)
*/
protected void buttonPressed( int buttonId )
{
if ( buttonId == IDialogConstants.OK_ID )
{
protected void buttonPressed( int buttonId ) {
if ( buttonId == IDialogConstants.OK_ID ) {
String firstIndex = fFirstIndexText.getText().trim();
String lengthText = fLengthText.getText().trim();
try
{
try {
fFirstIndex = Integer.parseInt( firstIndex );
fLength = Integer.parseInt( lengthText );
}
catch( NumberFormatException e )
{
catch( NumberFormatException e ) {
fFirstIndex = 0;
fLength = 0;
}
}
else
{
else {
fType = null;
}
super.buttonPressed( buttonId );
@ -248,73 +222,67 @@ public class CastToArrayActionDelegate extends ActionDelegate implements IObject
}
private ICastToArray fCastToArray = null;
private IStatus fStatus = null;
private IWorkbenchPart fTargetPart = null;
public CastToArrayActionDelegate()
{
public CastToArrayActionDelegate() {
super();
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.action.IAction, org.eclipse.ui.IWorkbenchPart)
*/
public void setActivePart( IAction action, IWorkbenchPart targetPart )
{
public void setActivePart( IAction action, IWorkbenchPart targetPart ) {
fTargetPart = targetPart;
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
*/
public void run( IAction action )
{
public void run( IAction action ) {
if ( getCastToArray() == null )
return;
BusyIndicator.showWhile( Display.getCurrent(),
new Runnable()
{
public void run()
{
try
{
doAction( getCastToArray() );
setStatus( null );
}
catch( DebugException e )
{
setStatus( e.getStatus() );
}
}
} );
if ( getStatus() != null && !getStatus().isOK() )
{
IWorkbenchWindow window= CDebugUIPlugin.getActiveWorkbenchWindow();
if ( window != null )
{
CDebugUIPlugin.errorDialog( CDebugUIPlugin.getResourceString("internal.ui.actions.CastToArrayActionDelegate.Unable_to_display_this_variable_as_an_array"), getStatus() ); //$NON-NLS-1$
}
else
{
BusyIndicator.showWhile( Display.getCurrent(), new Runnable() {
public void run() {
try {
doAction( getCastToArray() );
setStatus( null );
}
catch( DebugException e ) {
setStatus( e.getStatus() );
}
}
} );
if ( getStatus() != null && !getStatus().isOK() ) {
IWorkbenchWindow window = CDebugUIPlugin.getActiveWorkbenchWindow();
if ( window != null ) {
CDebugUIPlugin.errorDialog( ActionMessages.getString( "CastToArrayActionDelegate.8" ), getStatus() ); //$NON-NLS-1$
}
else {
CDebugUIPlugin.log( getStatus() );
}
}
}
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
*/
public void selectionChanged( IAction action, ISelection selection )
{
if ( selection instanceof IStructuredSelection )
{
public void selectionChanged( IAction action, ISelection selection ) {
if ( selection instanceof IStructuredSelection ) {
Object element = ((IStructuredSelection)selection).getFirstElement();
if ( element instanceof ICastToArray )
{
if ( element instanceof ICastToArray ) {
boolean enabled = ((ICastToArray)element).supportsCastToArray();
action.setEnabled( enabled );
if ( enabled )
{
if ( enabled ) {
setCastToArray( (ICastToArray)element );
return;
}
@ -324,32 +292,26 @@ public class CastToArrayActionDelegate extends ActionDelegate implements IObject
setCastToArray( null );
}
protected ICastToArray getCastToArray()
{
protected ICastToArray getCastToArray() {
return fCastToArray;
}
protected void setCastToArray( ICastToArray castToArray )
{
protected void setCastToArray( ICastToArray castToArray ) {
fCastToArray = castToArray;
}
public IStatus getStatus()
{
public IStatus getStatus() {
return fStatus;
}
public void setStatus( IStatus status )
{
public void setStatus( IStatus status ) {
fStatus = status;
}
protected void doAction( ICastToArray castToArray ) throws DebugException
{
protected void doAction( ICastToArray castToArray ) throws DebugException {
String currentType = castToArray.getCurrentType().trim();
CastToArrayDialog dialog = new CastToArrayDialog( CDebugUIPlugin.getActiveWorkbenchShell(), currentType, 0, 1 );
if ( dialog.open() == Window.OK )
{
if ( dialog.open() == Window.OK ) {
int firstIndex = dialog.getFirstIndex();
int lastIndex = dialog.getLength();
castToArray.castToArray( firstIndex, lastIndex );
@ -358,8 +320,7 @@ public class CastToArrayActionDelegate extends ActionDelegate implements IObject
}
}
private ISelectionProvider getSelectionProvider()
{
return ( fTargetPart instanceof IDebugView ) ? ((IDebugView)fTargetPart).getViewer() : null;
private ISelectionProvider getSelectionProvider() {
return (fTargetPart instanceof IDebugView) ? ((IDebugView)fTargetPart).getViewer() : null;
}
}

View file

@ -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.actions;
import org.eclipse.cdt.debug.core.model.ICastToType;
@ -29,119 +33,105 @@ import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.actions.ActionDelegate;
/**
* Enter type comment.
*
* @since Mar 7, 2003
* The delegate of the "Cast To Type" action.
*/
public class CastToTypeActionDelegate extends ActionDelegate
implements IObjectActionDelegate
{
static protected class CastToTypeInputValidator implements IInputValidator
{
public CastToTypeInputValidator()
{
public class CastToTypeActionDelegate extends ActionDelegate implements IObjectActionDelegate {
static protected class CastToTypeInputValidator implements IInputValidator {
public CastToTypeInputValidator() {
}
public String isValid( String newText )
{
if ( newText.trim().length() == 0 )
{
return CDebugUIPlugin.getResourceString("internal.ui.actions.CastToTypeActionDelegate.Type_field_must_not_be_empty"); //$NON-NLS-1$
public String isValid( String newText ) {
if ( newText.trim().length() == 0 ) {
return ActionMessages.getString( "CastToTypeActionDelegate.0" ); //$NON-NLS-1$
}
return null;
}
}
protected class CastToTypeDialog extends InputDialog
{
public CastToTypeDialog( Shell parentShell, String initialValue )
{
super( parentShell,
CDebugUIPlugin.getResourceString("internal.ui.actions.CastToTypeActionDelegate.Cast_To_Type"), //$NON-NLS-1$
CDebugUIPlugin.getResourceString("internal.ui.actions.CastToTypeActionDelegate.Enter_type"), //$NON-NLS-1$
initialValue, new CastToTypeInputValidator() ); //$NON-NLS-1$ //$NON-NLS-2$
protected class CastToTypeDialog extends InputDialog {
public CastToTypeDialog( Shell parentShell, String initialValue ) {
super( parentShell, ActionMessages.getString( "CastToTypeActionDelegate.1" ), //$NON-NLS-1$
ActionMessages.getString( "CastToTypeActionDelegate.2" ), //$NON-NLS-1$
initialValue,
new CastToTypeInputValidator() );
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
*/
protected void configureShell( Shell shell )
{
protected void configureShell( Shell shell ) {
super.configureShell( shell );
shell.setImage( CDebugImages.get( CDebugImages.IMG_LCL_CAST_TO_TYPE ) );
}
}
private ICastToType fCastToType = null;
private IStatus fStatus = null;
private IWorkbenchPart fTargetPart = null;
public CastToTypeActionDelegate()
{
public CastToTypeActionDelegate() {
super();
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.action.IAction, org.eclipse.ui.IWorkbenchPart)
*/
public void setActivePart( IAction action, IWorkbenchPart targetPart )
{
public void setActivePart( IAction action, IWorkbenchPart targetPart ) {
fTargetPart = targetPart;
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
*/
public void run( IAction action )
{
public void run( IAction action ) {
if ( getCastToType() == null )
return;
BusyIndicator.showWhile( Display.getCurrent(),
new Runnable()
{
public void run()
{
try
{
doAction( getCastToType() );
setStatus( null );
}
catch( DebugException e )
{
setStatus( e.getStatus() );
}
}
} );
if ( getStatus() != null && !getStatus().isOK() )
{
IWorkbenchWindow window= CDebugUIPlugin.getActiveWorkbenchWindow();
if ( window != null )
{
CDebugUIPlugin.errorDialog( CDebugUIPlugin.getResourceString("internal.ui.actions.CastToTypeActionDelegate.Unable_to_cast_to_type."), getStatus() ); //$NON-NLS-1$
}
else
{
BusyIndicator.showWhile( Display.getCurrent(), new Runnable() {
public void run() {
try {
doAction( getCastToType() );
setStatus( null );
}
catch( DebugException e ) {
setStatus( e.getStatus() );
}
}
} );
if ( getStatus() != null && !getStatus().isOK() ) {
IWorkbenchWindow window = CDebugUIPlugin.getActiveWorkbenchWindow();
if ( window != null ) {
CDebugUIPlugin.errorDialog( ActionMessages.getString( "CastToTypeActionDelegate.3" ), getStatus() ); //$NON-NLS-1$
}
else {
CDebugUIPlugin.log( getStatus() );
}
}
}
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
*/
public void selectionChanged( IAction action, ISelection selection )
{
if ( selection instanceof IStructuredSelection )
{
public void selectionChanged( IAction action, ISelection selection ) {
if ( selection instanceof IStructuredSelection ) {
Object element = ((IStructuredSelection)selection).getFirstElement();
if ( element instanceof ICastToType )
{
if ( element instanceof ICastToType ) {
boolean enabled = ((ICastToType)element).supportsCasting();
action.setEnabled( enabled );
if ( enabled )
{
if ( enabled ) {
setCastToType( (ICastToType)element );
return;
}
@ -151,32 +141,26 @@ public class CastToTypeActionDelegate extends ActionDelegate
setCastToType( null );
}
protected ICastToType getCastToType()
{
protected ICastToType getCastToType() {
return fCastToType;
}
protected void setCastToType( ICastToType castToType )
{
protected void setCastToType( ICastToType castToType ) {
fCastToType = castToType;
}
public IStatus getStatus()
{
public IStatus getStatus() {
return fStatus;
}
public void setStatus( IStatus status )
{
public void setStatus( IStatus status ) {
fStatus = status;
}
protected void doAction( ICastToType castToType ) throws DebugException
{
protected void doAction( ICastToType castToType ) throws DebugException {
String currentType = castToType.getCurrentType().trim();
CastToTypeDialog dialog = new CastToTypeDialog( CDebugUIPlugin.getActiveWorkbenchShell(), currentType );
if ( dialog.open() == Window.OK )
{
if ( dialog.open() == Window.OK ) {
String newType = dialog.getValue().trim();
castToType.cast( newType );
if ( getSelectionProvider() != null )
@ -184,8 +168,7 @@ public class CastToTypeActionDelegate extends ActionDelegate
}
}
private ISelectionProvider getSelectionProvider()
{
return ( fTargetPart instanceof IDebugView ) ? ((IDebugView)fTargetPart).getViewer() : null;
private ISelectionProvider getSelectionProvider() {
return (fTargetPart instanceof IDebugView) ? ((IDebugView)fTargetPart).getViewer() : null;
}
}

View file

@ -1,273 +0,0 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*
*/
package org.eclipse.cdt.debug.internal.ui.actions;
import java.util.Iterator;
import org.eclipse.cdt.debug.internal.ui.CDebugImages;
import org.eclipse.cdt.debug.internal.ui.ICDebugHelpContextIds;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.model.IValueModification;
import org.eclipse.debug.core.model.IVariable;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.TreeEditor;
import org.eclipse.swt.events.FocusAdapter;
import org.eclipse.swt.events.FocusEvent;
import org.eclipse.swt.events.KeyAdapter;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeItem;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.actions.SelectionProviderAction;
import org.eclipse.ui.help.WorkbenchHelp;
/**
*
* Enter type comment.
*
* @since Sep 16, 2002
*/
public class ChangeRegisterValueAction extends SelectionProviderAction
{
protected Tree fTree;
protected TreeEditor fTreeEditor;
protected Composite fComposite;
protected Label fEditorLabel;
protected Text fEditorText;
protected IVariable fVariable;
protected boolean fKeyReleased = false;
/**
* Constructor for ChangeRegisterValueAction.
* @param provider
* @param text
*/
public ChangeRegisterValueAction( Viewer viewer )
{
super( viewer, CDebugUIPlugin.getResourceString("internal.ui.actions.ChangeRegisterValueAction.Change_Register_Value") ); //$NON-NLS-1$
setDescription( CDebugUIPlugin.getResourceString("internal.ui.actions.ChangeRegisterValueAction.Change_Register_Value") ); //$NON-NLS-1$
CDebugImages.setLocalImageDescriptors( this, CDebugImages.IMG_LCL_CHANGE_REGISTER_VALUE );
fTree = ((TreeViewer)viewer).getTree();
fTreeEditor = new TreeEditor( fTree );
WorkbenchHelp.setHelp( this, ICDebugHelpContextIds.CHANGE_REGISTER_VALUE_ACTION );
}
/**
* Edit the variable value with an inline text editor.
*/
protected void doActionPerformed( final IVariable variable )
{
IWorkbenchWindow window = CDebugUIPlugin.getActiveWorkbenchWindow();
if ( window == null )
{
return;
}
final Shell activeShell = window.getShell();
// If a previous edit is still in progress, finish it
if ( fEditorText != null )
{
saveChangesAndCleanup( fVariable, activeShell );
}
fVariable = variable;
// Use a Composite containing a Label and a Text. This allows us to edit just
// the value, while still showing the variable name.
fComposite = new Composite( fTree, SWT.NONE );
fComposite.setBackground( fTree.getBackground() );
GridLayout layout = new GridLayout();
layout.numColumns = 2;
layout.marginHeight = 0;
layout.marginWidth = 0;
fComposite.setLayout( layout );
fEditorLabel = new Label( fComposite, SWT.LEFT );
fEditorLabel.setLayoutData( new GridData( GridData.FILL_VERTICAL ) );
// Fix for bug 1766. Border behavior on Windows & Linux for text
// fields is different. On Linux, you always get a border, on Windows,
// you don't. Specifying a border on Linux results in the characters
// getting pushed down so that only there very tops are visible. Thus,
// we have to specify different style constants for the different platforms.
int textStyles = SWT.SINGLE | SWT.LEFT;
if ( SWT.getPlatform().equals( "win32" ) ) //$NON-NLS-1$
{ //$NON-NLS-1$
textStyles |= SWT.BORDER;
}
fEditorText = new Text( fComposite, textStyles );
fEditorText.setLayoutData( new GridData( GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL ) );
String valueString = ""; //$NON-NLS-1$
try
{
valueString = fVariable.getValue().getValueString();
}
catch( DebugException de )
{
CDebugUIPlugin.errorDialog( CDebugUIPlugin.getResourceString("internal.ui.actions.ChangeRegisterValueAction.Setting_the_register_value_failed"), de ); //$NON-NLS-1$
}
TreeItem[] selectedItems = fTree.getSelection();
fTreeEditor.horizontalAlignment = SWT.LEFT;
fTreeEditor.grabHorizontal = true;
fTreeEditor.setEditor( fComposite, selectedItems[0] );
// There is no API on the model presentation to get just the variable name,
// so we have to make do with just calling IVariable.getName()
String varName = ""; //$NON-NLS-1$
try
{
varName = fVariable.getName();
}
catch (DebugException de)
{
CDebugUIPlugin.errorDialog( CDebugUIPlugin.getResourceString("internal.ui.actions.ChangeRegisterValueAction.Setting_register_value_failed"), de ); //$NON-NLS-1$
}
fEditorLabel.setText( varName + "=" ); //$NON-NLS-1$
fEditorText.setText( valueString );
fEditorText.selectAll();
fComposite.layout( true );
fComposite.setVisible( true );
fEditorText.setFocus();
// CR means commit the changes, ESC means abort changing the value
fEditorText.addKeyListener(
new KeyAdapter()
{
public void keyReleased( KeyEvent event )
{
if ( event.character == SWT.CR )
{
if ( fKeyReleased )
{
saveChangesAndCleanup( fVariable, activeShell );
}
else
{
cleanup();
return;
}
}
if ( event.character == SWT.ESC )
{
cleanup();
return;
}
fKeyReleased = true;
}
} );
// If the focus is lost, then act as if user hit CR and commit changes
fEditorText.addFocusListener(
new FocusAdapter()
{
public void focusLost( FocusEvent fe )
{
if ( fKeyReleased )
{
saveChangesAndCleanup( fVariable, activeShell );
}
else
{
cleanup();
}
}
} );
}
/**
* If the new value validates, save it, and dispose the text widget,
* otherwise sound the system bell and leave the user in the editor.
*/
protected void saveChangesAndCleanup( IVariable variable, Shell shell )
{
String newValue = fEditorText.getText();
try
{
if ( !variable.verifyValue( newValue ) )
{
shell.getDisplay().beep();
return;
}
variable.setValue( newValue );
}
catch( DebugException de )
{
cleanup();
CDebugUIPlugin.errorDialog( CDebugUIPlugin.getResourceString("internal.ui.actions.ChangeRegisterValueAction.Setting_register_value_failed"), de ); //$NON-NLS-1$
return;
}
cleanup();
}
/**
* Tidy up the widgets that were used
*/
protected void cleanup()
{
fKeyReleased = false;
if ( fEditorText != null )
{
fEditorText.dispose();
fEditorText = null;
fVariable = null;
fTreeEditor.setEditor( null, null );
fComposite.setVisible( false );
}
}
/**
* Updates the enabled state of this action based
* on the selection
*/
protected void update( IStructuredSelection sel )
{
Iterator iter = sel.iterator();
if (iter.hasNext())
{
Object object = iter.next();
if ( object instanceof IValueModification )
{
IValueModification varMod = (IValueModification)object;
if ( !varMod.supportsValueModification() )
{
setEnabled( false );
return;
}
setEnabled( !iter.hasNext() );
return;
}
}
setEnabled( false );
}
/**
* @see Action
*/
public void run()
{
Iterator iterator = getStructuredSelection().iterator();
doActionPerformed( (IVariable)iterator.next() );
}
/**
* @see SelectionProviderAction
*/
public void selectionChanged( IStructuredSelection sel )
{
update( sel );
}
}

View file

@ -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.actions;
import org.eclipse.cdt.debug.internal.ui.CDebugImages;
@ -11,45 +16,41 @@ import org.eclipse.cdt.debug.internal.ui.views.memory.MemoryViewer;
import org.eclipse.ui.actions.SelectionProviderAction;
import org.eclipse.ui.help.WorkbenchHelp;
import org.eclipse.ui.texteditor.IUpdate;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
/**
* Enter type comment.
*
* @since: Oct 21, 2002
* The "Clear" action of the Memory view.
*/
public class ClearMemoryAction extends SelectionProviderAction implements IUpdate
{
public class ClearMemoryAction extends SelectionProviderAction implements IUpdate {
private MemoryViewer fMemoryViewer;
/**
* Constructor for ClearMemoryAction.
* @param provider
* @param text
*/
public ClearMemoryAction( MemoryViewer viewer )
{
super( viewer, CDebugUIPlugin.getResourceString("internal.ui.actions.ClearMemoryAction.Clear") ); //$NON-NLS-1$
public ClearMemoryAction( MemoryViewer viewer ) {
super( viewer, ActionMessages.getString( "ClearMemoryAction.0" ) ); //$NON-NLS-1$
fMemoryViewer = viewer;
CDebugImages.setLocalImageDescriptors( this, CDebugImages.IMG_LCL_MEMORY_CLEAR );
setDescription( CDebugUIPlugin.getResourceString("internal.ui.actions.ClearMemoryAction.Clear_Memory_Block") ); //$NON-NLS-1$
setToolTipText( CDebugUIPlugin.getResourceString("internal.ui.actions.ClearMemoryAction.Clear") ); //$NON-NLS-1$
setDescription( ActionMessages.getString( "ClearMemoryAction.1" ) ); //$NON-NLS-1$
setToolTipText( ActionMessages.getString( "ClearMemoryAction.2" ) ); //$NON-NLS-1$
WorkbenchHelp.setHelp( this, ICDebugHelpContextIds.MEMORY_CLEAR_ACTION );
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.texteditor.IUpdate#update()
*/
public void update()
{
public void update() {
setEnabled( fMemoryViewer.canUpdate() );
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.action.IAction#run()
*/
public void run()
{
public void run() {
fMemoryViewer.clear();
}
}

View file

@ -1,13 +1,16 @@
/*
*(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.Iterator;
import org.eclipse.cdt.debug.core.model.ICVariable;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
import org.eclipse.core.runtime.MultiStatus;
@ -21,122 +24,105 @@ import org.eclipse.ui.IViewActionDelegate;
import org.eclipse.ui.IViewPart;
/**
* Enter type comment.
*
* @since Jun 19, 2003
* The delegate of the "Enable" action contribution to the "IVariable" objects.
*/
public class EnableVariablesActionDelegate implements IViewActionDelegate
{
public class EnableVariablesActionDelegate implements IViewActionDelegate {
private IViewPart fView;
private IAction fAction;
public EnableVariablesActionDelegate()
{
public EnableVariablesActionDelegate() {
}
protected IViewPart getView()
{
protected IViewPart getView() {
return fView;
}
protected void setView( IViewPart view )
{
protected void setView( IViewPart view ) {
fView = view;
}
protected IAction getAction()
{
protected IAction getAction() {
return fAction;
}
protected void setAction( IAction action )
{
protected void setAction( IAction action ) {
fAction = action;
}
/**
* This action enables variables.
*/
protected boolean isEnableAction()
{
protected boolean isEnableAction() {
return true;
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart)
*/
public void init( IViewPart view )
{
setView(view);
public void init( IViewPart view ) {
setView( view );
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
*/
public void run( IAction action )
{
public void run( IAction action ) {
IStructuredSelection selection = getSelection();
final int size = selection.size();
if ( size == 0 )
return;
final Iterator enum = selection.iterator();
final MultiStatus ms = new MultiStatus( CDebugUIPlugin.getUniqueIdentifier(), DebugException.REQUEST_FAILED, CDebugUIPlugin.getResourceString("internal.ui.actions.EnableVariablesActionDelegate.Exceptions_occurred_enabling_the_variables"), null ); //$NON-NLS-1$
BusyIndicator.showWhile(
Display.getCurrent(),
new Runnable()
{
public void run()
{
while( enum.hasNext() )
{
ICVariable var = (ICVariable)enum.next();
try
{
if ( size > 1 )
{
if ( isEnableAction() )
var.setEnabled( true );
else
var.setEnabled( false );
}
else
var.setEnabled( !var.isEnabled() );
}
catch( DebugException e )
{
ms.merge( e.getStatus() );
}
}
update();
}
} );
final MultiStatus ms = new MultiStatus( CDebugUIPlugin.getUniqueIdentifier(), DebugException.REQUEST_FAILED, ActionMessages.getString( "EnableVariablesActionDelegate.0" ), null ); //$NON-NLS-1$
BusyIndicator.showWhile( Display.getCurrent(), new Runnable() {
if ( !ms.isOK() )
{
CDebugUIPlugin.errorDialog( CDebugUIPlugin.getResourceString("internal.ui.actions.EnableVariablesActionDelegate.Enable_variables_failed."), ms ); //$NON-NLS-1$
public void run() {
while( enum.hasNext() ) {
ICVariable var = (ICVariable)enum.next();
try {
if ( size > 1 ) {
if ( isEnableAction() )
var.setEnabled( true );
else
var.setEnabled( false );
}
else
var.setEnabled( !var.isEnabled() );
}
catch( DebugException e ) {
ms.merge( e.getStatus() );
}
}
update();
}
} );
if ( !ms.isOK() ) {
CDebugUIPlugin.errorDialog( ActionMessages.getString( "EnableVariablesActionDelegate.1" ), ms ); //$NON-NLS-1$
}
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
*/
public void selectionChanged( IAction action, ISelection selection )
{
public void selectionChanged( IAction action, ISelection selection ) {
setAction( action );
if ( !( selection instanceof IStructuredSelection ) )
if ( !(selection instanceof IStructuredSelection) )
return;
IStructuredSelection sel = (IStructuredSelection)selection;
Object o = sel.getFirstElement();
if ( !( o instanceof ICVariable ) )
if ( !(o instanceof ICVariable) )
return;
Iterator enum = sel.iterator();
boolean allEnabled = true;
boolean allDisabled = true;
while( enum.hasNext() )
{
while( enum.hasNext() ) {
ICVariable var = (ICVariable)enum.next();
if ( !var.canEnableDisable() )
continue;
@ -145,20 +131,17 @@ public class EnableVariablesActionDelegate implements IViewActionDelegate
else
allEnabled = false;
}
if ( isEnableAction() )
action.setEnabled( !allEnabled );
else
action.setEnabled( !allDisabled );
}
private IStructuredSelection getSelection()
{
private IStructuredSelection getSelection() {
return (IStructuredSelection)getView().getViewSite().getSelectionProvider().getSelection();
}
protected void update()
{
protected void update() {
getView().getViewSite().getSelectionProvider().setSelection( getView().getViewSite().getSelectionProvider().getSelection() );
}
}

View file

@ -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.actions;
import org.eclipse.debug.internal.ui.DebugPluginImages;
@ -20,122 +25,107 @@ import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
/**
*
* Enter type comment.
*
* @since Sep 17, 2002
* The "Add Expression" dialog.
*/
public class ExpressionDialog extends Dialog
{
public class ExpressionDialog extends Dialog {
private Button fBtnOk = null;
private Text fTextExpression;
private String fExpression = ""; //$NON-NLS-1$
/**
* Constructor for ExpressionDialog.
*
* @param parentShell
*/
public ExpressionDialog( Shell parentShell, String expression )
{
public ExpressionDialog( Shell parentShell, String expression ) {
super( parentShell );
if ( expression != null )
fExpression = expression;
fExpression = expression;
}
protected void configureShell( Shell shell )
{
protected void configureShell( Shell shell ) {
super.configureShell( shell );
shell.setText( CDebugUIPlugin.getResourceString("internal.ui.actions.ExpressionDialog.Add_Expression") ); //$NON-NLS-1$
shell.setText( ActionMessages.getString( "ExpressionDialog.0" ) ); //$NON-NLS-1$
shell.setImage( DebugPluginImages.getImage( IDebugUIConstants.IMG_OBJS_EXPRESSION ) );
}
protected Control createContents( Composite parent )
{
protected Control createContents( Composite parent ) {
Control control = super.createContents( parent );
setOkButtonState();
return control;
}
protected Control createDialogArea( Composite parent )
{
protected Control createDialogArea( Composite parent ) {
Composite composite = new Composite( parent, SWT.NONE );
composite.setLayout( new GridLayout() );
((GridLayout)composite.getLayout()).marginWidth = 10;
composite.setLayoutData( new GridData( GridData.FILL_BOTH ) );
composite.setLayoutData( new GridData( GridData.FILL_BOTH ) );
createDataWidgets( composite );
initializeDataWidgets();
return composite;
}
protected void createButtonsForButtonBar( Composite parent )
{
protected void createButtonsForButtonBar( Composite parent ) {
fBtnOk = createButton( parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true );
createButton( parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false );
}
private void createDataWidgets( Composite parent )
{
fTextExpression = createExpressionText( parent );
private void createDataWidgets( Composite parent ) {
fTextExpression = createExpressionText( parent );
}
private void initializeDataWidgets()
{
private void initializeDataWidgets() {
fTextExpression.setText( fExpression );
fTextExpression.setSelection( fExpression.length() );
fTextExpression.selectAll();
setOkButtonState();
}
private Text createExpressionText( Composite parent )
{
private Text createExpressionText( Composite parent ) {
Label label = new Label( parent, SWT.RIGHT );
label.setText( CDebugUIPlugin.getResourceString("internal.ui.actions.ExpressionDialog.Expression_to_add") ); //$NON-NLS-1$
label.setText( ActionMessages.getString( "ExpressionDialog.1" ) ); //$NON-NLS-1$
final Text text = new Text( parent, SWT.BORDER );
GridData gridData = new GridData( GridData.FILL_HORIZONTAL );
gridData.widthHint = 300;
text.setLayoutData( gridData );
addModifyListener( text );
addModifyListener( text );
return text;
}
protected void setOkButtonState()
{
protected void setOkButtonState() {
if ( fBtnOk == null )
return;
fBtnOk.setEnabled( fTextExpression.getText().trim().length() > 0 );
}
private void storeData()
{
private void storeData() {
fExpression = fTextExpression.getText().trim();
}
private void addModifyListener( Text text )
{
text.addModifyListener(
new ModifyListener()
{
public void modifyText( ModifyEvent e )
{
setOkButtonState();
}
} );
private void addModifyListener( Text text ) {
text.addModifyListener( new ModifyListener() {
public void modifyText( ModifyEvent e ) {
setOkButtonState();
}
} );
}
public String getExpression()
{
public String getExpression() {
return fExpression;
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.dialogs.Dialog#okPressed()
*/
protected void okPressed()
{
protected void okPressed() {
storeData();
super.okPressed();
}

View file

@ -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.actions;
import org.eclipse.cdt.debug.core.model.IFormattedMemoryBlock;
@ -14,24 +19,20 @@ import org.eclipse.jface.action.IAction;
import org.eclipse.ui.texteditor.IUpdate;
/**
*
* Enter type comment.
*
* @since Nov 3, 2002
* The "Format" action of the Memory view.
*/
public class MemoryFormatAction extends Action implements IUpdate
{
public class MemoryFormatAction extends Action implements IUpdate {
private MemoryActionSelectionGroup fGroup;
private MemoryViewer fMemoryViewer;
private int fFormat = 0;
/**
* Constructor for MemoryFormatAction.
*/
public MemoryFormatAction( MemoryActionSelectionGroup group,
MemoryViewer viewer,
int format )
{
public MemoryFormatAction( MemoryActionSelectionGroup group, MemoryViewer viewer, int format ) {
super( getLabel( format ), IAction.AS_CHECK_BOX );
fGroup = group;
fMemoryViewer = viewer;
@ -41,49 +42,44 @@ public class MemoryFormatAction extends Action implements IUpdate
/**
* @see org.eclipse.ui.texteditor.IUpdate#update()
*/
public void update()
{
public void update() {
setEnabled( fMemoryViewer.canChangeFormat( fFormat ) );
setChecked( fMemoryViewer.getCurrentFormat() == fFormat );
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.action.IAction#run()
*/
public void run()
{
try
{
public void run() {
try {
fMemoryViewer.setFormat( fFormat );
fGroup.setCurrentSelection( this );
}
catch( DebugException e )
{
CDebugUIPlugin.errorDialog( CDebugUIPlugin.getResourceString("internal.ui.actions.MemoryFormatAction.Unable_to_change_format"), e.getStatus() ); //$NON-NLS-1$
catch( DebugException e ) {
CDebugUIPlugin.errorDialog( ActionMessages.getString( "MemoryFormatAction.0" ), e.getStatus() ); //$NON-NLS-1$
setChecked( false );
}
}
private static String getLabel( int id )
{
private static String getLabel( int id ) {
String label = ""; //$NON-NLS-1$
switch( id )
{
case( IFormattedMemoryBlock.MEMORY_FORMAT_HEX ):
label = CDebugUIPlugin.getResourceString("internal.ui.actions.MemoryFormatAction.Hexadecimal"); //$NON-NLS-1$
switch( id ) {
case (IFormattedMemoryBlock.MEMORY_FORMAT_HEX ):
label = ActionMessages.getString( "MemoryFormatAction.1" ); //$NON-NLS-1$
break;
case( IFormattedMemoryBlock.MEMORY_FORMAT_SIGNED_DECIMAL ):
label = CDebugUIPlugin.getResourceString("internal.ui.actions.MemoryFormatAction.Signed_Decimal"); //$NON-NLS-1$
case (IFormattedMemoryBlock.MEMORY_FORMAT_SIGNED_DECIMAL ):
label = ActionMessages.getString( "MemoryFormatAction.2" ); //$NON-NLS-1$
break;
case( IFormattedMemoryBlock.MEMORY_FORMAT_UNSIGNED_DECIMAL ):
label = CDebugUIPlugin.getResourceString("internal.ui.actions.MemoryFormatAction.Unsigned_Decimal"); //$NON-NLS-1$
case (IFormattedMemoryBlock.MEMORY_FORMAT_UNSIGNED_DECIMAL ):
label = ActionMessages.getString( "MemoryFormatAction.3" ); //$NON-NLS-1$
break;
}
return label;
}
public String getActionId()
{
public String getActionId() {
return "MemoryFormat" + fFormat; //$NON-NLS-1$
}
}

View file

@ -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.actions;
import org.eclipse.cdt.debug.internal.ui.views.memory.MemoryViewer;
@ -13,66 +18,57 @@ import org.eclipse.jface.action.IAction;
import org.eclipse.ui.texteditor.IUpdate;
/**
* Enter type comment.
*
* @since: Oct 25, 2002
* The "Number Of Memory View Coulumns" action.
*/
public class MemoryNumberOfColumnAction extends Action implements IUpdate
{
public class MemoryNumberOfColumnAction extends Action implements IUpdate {
private MemoryActionSelectionGroup fGroup;
private MemoryViewer fMemoryViewer;
private int fNumberOfColumns = 0;
/**
* Constructor for MemoryNumberOfColumnAction.
*/
public MemoryNumberOfColumnAction( MemoryActionSelectionGroup group,
MemoryViewer viewer,
int numberOfColumns )
{
public MemoryNumberOfColumnAction( MemoryActionSelectionGroup group, MemoryViewer viewer, int numberOfColumns ) {
super( getLabel( numberOfColumns ), IAction.AS_CHECK_BOX );
fGroup = group;
fMemoryViewer = viewer;
fNumberOfColumns = numberOfColumns;
}
private static String getLabel( int numberOfColumns )
{
//String col = CDebugUIPlugin.getResourceString("internal.ui.actions.MemoryNumberOfColumnsAction.column");
//String cols = CDebugUIPlugin.getResourceString("internal.ui.actions.MemoryNumberOfColumnsAction.columns");
//ChoiceFormat myform = new ChoiceFormat("0# "+cols+"|1# "+col+"|2# "+cols);
//return Integer.toString( numberOfColumns) + myform.format(numberOfColumns);
return CDebugUIPlugin.getFormattedString("internal.ui.actions.MemoryNumberOfColumnsAction.number_of_columns", new Integer(numberOfColumns)); //$NON-NLS-1$
private static String getLabel( int numberOfColumns ) {
return CDebugUIPlugin.getFormattedString( ActionMessages.getString( "MemoryNumberOfColumnAction.0" ), new Integer( numberOfColumns ) ); //$NON-NLS-1$
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.texteditor.IUpdate#update()
*/
public void update()
{
public void update() {
setEnabled( fMemoryViewer.canUpdate() );
setChecked( fMemoryViewer.getCurrentNumberOfColumns() == fNumberOfColumns );
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.action.IAction#run()
*/
public void run()
{
try
{
public void run() {
try {
fMemoryViewer.setNumberOfColumns( fNumberOfColumns );
fGroup.setCurrentSelection( this );
}
catch( DebugException e )
{
CDebugUIPlugin.errorDialog( CDebugUIPlugin.getResourceString("internal.ui.actions.MemoryNumberOfColumnAction.Unable_to_change_the_column_number."), e.getStatus() ); //$NON-NLS-1$
catch( DebugException e ) {
CDebugUIPlugin.errorDialog( ActionMessages.getString( "MemoryNumberOfColumnAction.1" ), e.getStatus() ); //$NON-NLS-1$
setChecked( false );
}
}
public String getActionId()
{
public String getActionId() {
return "MemoryNumberOfColumns" + fNumberOfColumns; //$NON-NLS-1$
}
}

View file

@ -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.actions;
import org.eclipse.cdt.debug.core.model.IFormattedMemoryBlock;
@ -14,75 +19,69 @@ import org.eclipse.jface.action.IAction;
import org.eclipse.ui.texteditor.IUpdate;
/**
* Enter type comment.
*
* @since: Oct 22, 2002
* The "Memory Unit Size" action.
*/
public class MemorySizeAction extends Action implements IUpdate
{
public class MemorySizeAction extends Action implements IUpdate {
private MemoryActionSelectionGroup fGroup;
private MemoryViewer fMemoryViewer;
private int fId = 0;
/**
* Constructor for MemorySizeAction.
*/
public MemorySizeAction( MemoryActionSelectionGroup group,
MemoryViewer viewer,
int id )
{
public MemorySizeAction( MemoryActionSelectionGroup group, MemoryViewer viewer, int id ) {
super( getLabel( id ), IAction.AS_CHECK_BOX );
fGroup = group;
fMemoryViewer = viewer;
fId = id;
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.texteditor.IUpdate#update()
*/
public void update()
{
public void update() {
setEnabled( fMemoryViewer.canUpdate() );
setChecked( fMemoryViewer.getCurrentWordSize() == fId );
}
private static String getLabel( int id )
{
private static String getLabel( int id ) {
String label = ""; //$NON-NLS-1$
switch( id )
{
case( IFormattedMemoryBlock.MEMORY_SIZE_BYTE ):
case( IFormattedMemoryBlock.MEMORY_SIZE_HALF_WORD ):
case( IFormattedMemoryBlock.MEMORY_SIZE_WORD ):
case( IFormattedMemoryBlock.MEMORY_SIZE_DOUBLE_WORD ):
// English value of key is "{0, number} {0, choice, 1#byte|2#bytes}"
label = CDebugUIPlugin.getFormattedString("internal.ui.actions.MemorySizeAction.byte_bytes", new Integer(id)); //$NON-NLS-1$
break;
switch( id ) {
case IFormattedMemoryBlock.MEMORY_SIZE_BYTE:
case IFormattedMemoryBlock.MEMORY_SIZE_HALF_WORD:
case IFormattedMemoryBlock.MEMORY_SIZE_WORD:
case IFormattedMemoryBlock.MEMORY_SIZE_DOUBLE_WORD:
// Examples of the display for the following value are "1 byte" and "8 bytes".
// Normally placeholders in {} are not translated, except when they are choice forms,
// where the strings after each "#" are to be translated.
label = CDebugUIPlugin.getFormattedString( ActionMessages.getString( "MemorySizeAction.0" ), new Integer( id ) ); //$NON-NLS-1$
break;
}
return label;
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.action.IAction#run()
*/
public void run()
{
try
{
public void run() {
try {
fMemoryViewer.setWordSize( fId );
fGroup.setCurrentSelection( this );
}
catch( DebugException e )
{
CDebugUIPlugin.errorDialog( CDebugUIPlugin.getResourceString("MemorySizeAction.Unable_to_change_memory_unit_size"), e.getStatus() ); //$NON-NLS-1$
catch( DebugException e ) {
CDebugUIPlugin.errorDialog( ActionMessages.getString( "MemorySizeAction.1" ), e.getStatus() ); //$NON-NLS-1$
setChecked( false );
}
}
public String getActionId()
{
public String getActionId() {
return "MemorySize" + fId; //$NON-NLS-1$
}
}

View file

@ -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.actions;
import org.eclipse.cdt.debug.internal.ui.CDebugImages;
@ -11,45 +16,41 @@ import org.eclipse.cdt.debug.internal.ui.views.memory.MemoryViewer;
import org.eclipse.ui.actions.SelectionProviderAction;
import org.eclipse.ui.help.WorkbenchHelp;
import org.eclipse.ui.texteditor.IUpdate;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
/**
* Enter type comment.
*
* @since: Oct 18, 2002
* The "Refresh" action of the Memory view.
*/
public class RefreshMemoryAction extends SelectionProviderAction implements IUpdate
{
public class RefreshMemoryAction extends SelectionProviderAction implements IUpdate {
private MemoryViewer fMemoryViewer;
/**
* Constructor for RefreshMemoryAction.
* @param provider
* @param text
*/
public RefreshMemoryAction( MemoryViewer viewer )
{
public RefreshMemoryAction( MemoryViewer viewer ) {
super( viewer, "Refresh" ); //$NON-NLS-1$
fMemoryViewer = viewer;
CDebugImages.setLocalImageDescriptors( this, CDebugImages.IMG_LCL_REFRESH );
setDescription( CDebugUIPlugin.getResourceString("internal.ui.actions.RefreshMemoryAction.Refresh_Memory_Block") ); //$NON-NLS-1$
setToolTipText( CDebugUIPlugin.getResourceString("internal.ui.actions.RefreshMemoryAction.Refresh") ); //$NON-NLS-1$
setDescription( ActionMessages.getString( "RefreshMemoryAction.0" ) ); //$NON-NLS-1$
setToolTipText( ActionMessages.getString( "RefreshMemoryAction.1" ) ); //$NON-NLS-1$
WorkbenchHelp.setHelp( this, ICDebugHelpContextIds.REFRESH_MEMORY_ACTION );
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.texteditor.IUpdate#update()
*/
public void update()
{
public void update() {
setEnabled( fMemoryViewer.canUpdate() );
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.action.IAction#run()
*/
public void run()
{
public void run() {
fMemoryViewer.refreshMemoryBlock();
}
}

View file

@ -1,79 +1,75 @@
/*
*(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 org.eclipse.cdt.debug.core.model.IRestart;
import org.eclipse.debug.core.DebugException;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
/**
*
* Enter type comment.
*
* @since Aug 23, 2002
* The delegate of the "Restart" action.
*/
public class RestartActionDelegate extends AbstractListenerActionDelegate
{
/* (non-Javadoc)
public class RestartActionDelegate extends AbstractListenerActionDelegate {
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.debug.internal.ui.actions.AbstractDebugActionDelegate#doAction(Object)
*/
protected void doAction( Object element ) throws DebugException
{
if ( element instanceof IRestart )
{
protected void doAction( Object element ) throws DebugException {
if ( element instanceof IRestart ) {
((IRestart)element).restart();
}
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.debug.internal.ui.actions.AbstractDebugActionDelegate#isEnabledFor(Object)
*/
protected boolean isEnabledFor( Object element )
{
if ( element instanceof IRestart )
{
protected boolean isEnabledFor( Object element ) {
if ( element instanceof IRestart ) {
return checkCapability( (IRestart)element );
}
return false;
}
protected boolean checkCapability( IRestart element )
{
protected boolean checkCapability( IRestart element ) {
return element.canRestart();
}
/**
* @see AbstractDebugActionDelegate#enableForMultiSelection()
*/
protected boolean enableForMultiSelection()
{
protected boolean enableForMultiSelection() {
return false;
}
/**
* @see AbstractDebugActionDelegate#getStatusMessage()
*/
protected String getStatusMessage()
{
return CDebugUIPlugin.getResourceString("internal.ui.actions.RestartActionDelegate.Exceptions_occurred_attempting_to_restart"); //$NON-NLS-1$
protected String getStatusMessage() {
return ActionMessages.getString( "RestartActionDelegate.0" ); //$NON-NLS-1$
}
/**
* @see AbstractDebugActionDelegate#getErrorDialogMessage()
*/
protected String getErrorDialogMessage()
{
return CDebugUIPlugin.getResourceString("internal.ui.actions.RestartActionDelegate.Restart_failed"); //$NON-NLS-1$
protected String getErrorDialogMessage() {
return ActionMessages.getString( "RestartActionDelegate.1" ); //$NON-NLS-1$
}
/**
* @see AbstractDebugActionDelegate#getErrorDialogTitle()
*/
protected String getErrorDialogTitle()
{
return CDebugUIPlugin.getResourceString("internal.ui.actions.RestartActionDelegate.Restart"); //$NON-NLS-1$
protected String getErrorDialogTitle() {
return ActionMessages.getString( "RestartActionDelegate.2" ); //$NON-NLS-1$
}
}

View file

@ -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.actions;
import org.eclipse.cdt.debug.core.model.ICastToType;
@ -21,92 +25,73 @@ import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.actions.ActionDelegate;
/**
* Enter type comment.
*
* @since Mar 9, 2003
* The delegate of the "Restore Default Type" action.
*/
public class RestoreDefaultTypeActionDelegate extends ActionDelegate
implements IObjectActionDelegate
{
public class RestoreDefaultTypeActionDelegate extends ActionDelegate implements IObjectActionDelegate {
private ICastToType fCastToType = null;
private IStatus fStatus = null;
/**
/*
* (non-Javadoc)
*
*/
public RestoreDefaultTypeActionDelegate()
{
super();
}
/* (non-Javadoc)
* @see org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.action.IAction, org.eclipse.ui.IWorkbenchPart)
*/
public void setActivePart( IAction action, IWorkbenchPart targetPart )
{
public void setActivePart( IAction action, IWorkbenchPart targetPart ) {
}
protected ICastToType getCastToType()
{
protected ICastToType getCastToType() {
return fCastToType;
}
protected void setCastToType( ICastToType castToType )
{
protected void setCastToType( ICastToType castToType ) {
fCastToType = castToType;
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
*/
public void run( IAction action )
{
public void run( IAction action ) {
if ( getCastToType() == null )
return;
BusyIndicator.showWhile( Display.getCurrent(),
new Runnable()
{
public void run()
{
try
{
doAction( getCastToType() );
setStatus( null );
}
catch( DebugException e )
{
setStatus( e.getStatus() );
}
}
} );
if ( getStatus() != null && !getStatus().isOK() )
{
IWorkbenchWindow window= CDebugUIPlugin.getActiveWorkbenchWindow();
if ( window != null )
{
CDebugUIPlugin.errorDialog( CDebugUIPlugin.getResourceString("internal.ui.actions.RestoreDefaultTypeActionDelegate.Unable_to_cast_type"), getStatus() ); //$NON-NLS-1$
}
else
{
BusyIndicator.showWhile( Display.getCurrent(), new Runnable() {
public void run() {
try {
doAction( getCastToType() );
setStatus( null );
}
catch( DebugException e ) {
setStatus( e.getStatus() );
}
}
} );
if ( getStatus() != null && !getStatus().isOK() ) {
IWorkbenchWindow window = CDebugUIPlugin.getActiveWorkbenchWindow();
if ( window != null ) {
CDebugUIPlugin.errorDialog( ActionMessages.getString( "RestoreDefaultTypeActionDelegate.0" ), getStatus() ); //$NON-NLS-1$
}
else {
CDebugUIPlugin.log( getStatus() );
}
}
}
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
*/
public void selectionChanged( IAction action, ISelection selection )
{
if ( selection instanceof IStructuredSelection )
{
public void selectionChanged( IAction action, ISelection selection ) {
if ( selection instanceof IStructuredSelection ) {
Object element = ((IStructuredSelection)selection).getFirstElement();
if ( element instanceof ICastToType )
{
if ( element instanceof ICastToType ) {
boolean enabled = ((ICastToType)element).isCasted();
action.setEnabled( enabled );
if ( enabled )
{
if ( enabled ) {
setCastToType( (ICastToType)element );
return;
}
@ -116,18 +101,15 @@ public class RestoreDefaultTypeActionDelegate extends ActionDelegate
setCastToType( null );
}
public IStatus getStatus()
{
public IStatus getStatus() {
return fStatus;
}
public void setStatus( IStatus status )
{
public void setStatus( IStatus status ) {
fStatus = status;
}
protected void doAction( ICastToType castToType ) throws DebugException
{
protected void doAction( ICastToType castToType ) throws DebugException {
castToType.restoreDefault();
}
}
}

View file

@ -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.actions;
import org.eclipse.cdt.debug.internal.ui.CDebugImages;
@ -11,46 +16,47 @@ import org.eclipse.cdt.debug.internal.ui.views.memory.MemoryViewer;
import org.eclipse.ui.actions.SelectionProviderAction;
import org.eclipse.ui.help.WorkbenchHelp;
import org.eclipse.ui.texteditor.IUpdate;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
/**
* Enter type comment.
*
* @since: Oct 21, 2002
*/
public class ShowAsciiAction extends SelectionProviderAction implements IUpdate
{
public class ShowAsciiAction extends SelectionProviderAction implements IUpdate {
private MemoryViewer fMemoryViewer;
/**
* Constructor for ShowAsciiAction.
*
* @param provider
* @param text
*/
public ShowAsciiAction( MemoryViewer viewer )
{
super( viewer, CDebugUIPlugin.getResourceString("internal.ui.actions.ShowAsciiAction.Show_ASCII") ); //$NON-NLS-1$
public ShowAsciiAction( MemoryViewer viewer ) {
super( viewer, ActionMessages.getString( "ShowAsciiAction.0" ) ); //$NON-NLS-1$
fMemoryViewer = viewer;
CDebugImages.setLocalImageDescriptors( this, CDebugImages.IMG_LCL_SHOW_ASCII );
setDescription( CDebugUIPlugin.getResourceString("internal.ui.actions.ShowAsciiAction.Show_ASCII") ); //$NON-NLS-1$
setToolTipText( CDebugUIPlugin.getResourceString("internal.ui.actions.ShowAsciiAction.Show_ASCII") ); //$NON-NLS-1$
setDescription( ActionMessages.getString( "ShowAsciiAction.1" ) ); //$NON-NLS-1$
setToolTipText( ActionMessages.getString( "ShowAsciiAction.2" ) ); //$NON-NLS-1$
WorkbenchHelp.setHelp( this, ICDebugHelpContextIds.MEMORY_SHOW_ASCII_ACTION );
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.texteditor.IUpdate#update()
*/
public void update()
{
public void update() {
setEnabled( fMemoryViewer.canShowAscii() );
setChecked( fMemoryViewer.showAscii() );
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.action.IAction#run()
*/
public void run()
{
public void run() {
fMemoryViewer.setShowAscii( isChecked() );
}
}
}

View file

@ -1,97 +0,0 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*
*/
package org.eclipse.cdt.debug.internal.ui.actions;
import org.eclipse.cdt.debug.internal.ui.CDebugImages;
import org.eclipse.cdt.debug.internal.ui.ICDebugHelpContextIds;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
import org.eclipse.debug.ui.IDebugModelPresentation;
import org.eclipse.debug.ui.IDebugView;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.swt.custom.BusyIndicator;
import org.eclipse.ui.help.WorkbenchHelp;
/**
*
* An action that toggles the state of a viewer to show/hide type names
* of registers.
*
* @since Sep 16, 2002
*/
public class ShowRegisterTypesAction extends Action
{
private IDebugView fView;
/**
* Constructor for ShowRegisterTypesAction.
*/
public ShowRegisterTypesAction( IDebugView view )
{
super( CDebugUIPlugin.getResourceString("internal.ui.actions.ShowRegisterTypesAction.Show_Type_Names_checkbox"), IAction.AS_CHECK_BOX ); //$NON-NLS-1$
setView( view );
setToolTipText( CDebugUIPlugin.getResourceString("internal.ui.actions.ShowRegisterTypesAction.Show_Type_Names_tooltip") ); //$NON-NLS-1$
CDebugImages.setLocalImageDescriptors( this, CDebugImages.IMG_LCL_TYPE_NAMES );
setId( CDebugUIPlugin.getUniqueIdentifier() + ".ShowTypesAction" ); //$NON-NLS-1$
WorkbenchHelp.setHelp( this, ICDebugHelpContextIds.SHOW_TYPES_ACTION );
}
/**
* @see Action#run()
*/
public void run()
{
valueChanged( isChecked() );
}
private void valueChanged( boolean on )
{
if ( getViewer().getControl().isDisposed() )
{
return;
}
IDebugModelPresentation debugLabelProvider = (IDebugModelPresentation)getView().getAdapter( IDebugModelPresentation.class );
if ( debugLabelProvider != null )
{
debugLabelProvider.setAttribute( IDebugModelPresentation.DISPLAY_VARIABLE_TYPE_NAMES, ( on ? Boolean.TRUE : Boolean.FALSE ) );
BusyIndicator.showWhile( getViewer().getControl().getDisplay(),
new Runnable()
{
public void run()
{
getViewer().refresh();
}
} );
}
}
/**
* @see Action#setChecked(boolean)
*/
public void setChecked( boolean value )
{
super.setChecked( value );
valueChanged( value );
}
protected StructuredViewer getViewer()
{
if ( getView() != null && getView().getViewer() instanceof StructuredViewer )
return (StructuredViewer)getView().getViewer();
return null;
}
protected IDebugView getView()
{
return fView;
}
public void setView( IDebugView view )
{
fView = view;
}
}

View file

@ -1,8 +1,13 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
/*******************************************************************************
* Copyright (c) 2000, 2003 IBM Corporation 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:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.debug.internal.ui.actions;
import org.eclipse.cdt.debug.core.model.ICSignal;
@ -17,85 +22,66 @@ import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IObjectActionDelegate;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.actions.ActionDelegate;
/**
* Enter type comment.
*
* @since: Jan 31, 2003
* The delegate of the "Resume With Signal" action.
*/
public class SignalActionDelegate implements IObjectActionDelegate
{
public class SignalActionDelegate extends ActionDelegate implements IObjectActionDelegate {
private ICSignal fSignal = null;
/**
* Constructor for SignalActionDelegate.
*/
public SignalActionDelegate()
{
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.IObjectActionDelegate#setActivePart(IAction, IWorkbenchPart)
*/
public void setActivePart( IAction action, IWorkbenchPart targetPart )
{
public void setActivePart( IAction action, IWorkbenchPart targetPart ) {
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.IActionDelegate#run(IAction)
*/
public void run( IAction action )
{
if ( getSignal() != null )
{
final MultiStatus ms = new MultiStatus( CDebugUIPlugin.getUniqueIdentifier(),
DebugException.REQUEST_FAILED,
CDebugUIPlugin.getResourceString( "internal.ui.actions.SignalActionDelegate.Unable_to_deliver_signal_to_target" ), //$NON-NLS-1$
null );
BusyIndicator.showWhile( Display.getCurrent(),
new Runnable()
{
public void run()
{
try
{
doAction( getSignal() );
}
catch( DebugException e )
{
ms.merge( e.getStatus() );
}
}
} );
if ( !ms.isOK() )
{
IWorkbenchWindow window = CDebugUIPlugin.getActiveWorkbenchWindow();
if ( window != null )
{
CDebugUIPlugin.errorDialog( CDebugUIPlugin.getResourceString("internal.ui.actions.SignalActionDelegate.Operation_failed"), ms ); //$NON-NLS-1$
public void run( IAction action ) {
if ( getSignal() != null ) {
final MultiStatus ms = new MultiStatus( CDebugUIPlugin.getUniqueIdentifier(), DebugException.REQUEST_FAILED, ActionMessages.getString( "SignalActionDelegate.0" ), null ); //$NON-NLS-1$
BusyIndicator.showWhile( Display.getCurrent(), new Runnable() {
public void run() {
try {
doAction( getSignal() );
}
catch( DebugException e ) {
ms.merge( e.getStatus() );
}
}
else
{
} );
if ( !ms.isOK() ) {
IWorkbenchWindow window = CDebugUIPlugin.getActiveWorkbenchWindow();
if ( window != null ) {
CDebugUIPlugin.errorDialog( ActionMessages.getString( "SignalActionDelegate.1" ), ms ); //$NON-NLS-1$
}
else {
CDebugUIPlugin.log( ms );
}
}
}
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.IActionDelegate#selectionChanged(IAction, ISelection)
*/
public void selectionChanged( IAction action, ISelection selection )
{
if ( selection instanceof IStructuredSelection )
{
public void selectionChanged( IAction action, ISelection selection ) {
if ( selection instanceof IStructuredSelection ) {
Object element = ((IStructuredSelection)selection).getFirstElement();
if ( element instanceof ICSignal )
{
if ( element instanceof ICSignal ) {
boolean enabled = enablesFor( (ICSignal)element );
action.setEnabled( enabled );
if ( enabled )
{
if ( enabled ) {
setSignal( (ICSignal)element );
return;
}
@ -105,23 +91,19 @@ public class SignalActionDelegate implements IObjectActionDelegate
setSignal( null );
}
protected void doAction( ICSignal signal ) throws DebugException
{
protected void doAction( ICSignal signal ) throws DebugException {
signal.signal();
}
private boolean enablesFor( ICSignal signal )
{
return ( signal != null && signal.getDebugTarget().isSuspended() );
private boolean enablesFor( ICSignal signal ) {
return (signal != null && signal.getDebugTarget().isSuspended());
}
private void setSignal( ICSignal signal )
{
private void setSignal( ICSignal signal ) {
fSignal = signal;
}
protected ICSignal getSignal()
{
protected ICSignal getSignal() {
return fSignal;
}
}

View file

@ -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.actions;
import org.eclipse.cdt.debug.core.model.IResumeWithoutSignal;
@ -17,86 +22,66 @@ import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IObjectActionDelegate;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.actions.ActionDelegate;
/**
* Enter type comment.
*
* @since: Feb 4, 2003
* The object contribution delegate of the "Resume Without Signal" action.
*/
public class SignalZeroObjectActionDelegate implements IObjectActionDelegate
{
public class SignalZeroObjectActionDelegate extends ActionDelegate implements IObjectActionDelegate {
private IResumeWithoutSignal fTarget = null;
/**
* Constructor for SignalZeroObjectActionDelegate.
*/
public SignalZeroObjectActionDelegate()
{
super();
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.IObjectActionDelegate#setActivePart(IAction, IWorkbenchPart)
*/
public void setActivePart( IAction action, IWorkbenchPart targetPart )
{
public void setActivePart( IAction action, IWorkbenchPart targetPart ) {
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.IActionDelegate#run(IAction)
*/
public void run( IAction action )
{
if ( getTarget() != null )
{
final MultiStatus ms = new MultiStatus( CDebugUIPlugin.getUniqueIdentifier(),
DebugException.REQUEST_FAILED,
CDebugUIPlugin.getResourceString("internal.ui.actions.SignalZeroObjectActionDelegate.Unable_to_resume_ignoring_signal"), //$NON-NLS-1$
null );
BusyIndicator.showWhile( Display.getCurrent(),
new Runnable()
{
public void run()
{
try
{
doAction( getTarget() );
}
catch( DebugException e )
{
ms.merge( e.getStatus() );
}
}
} );
if ( !ms.isOK() )
{
IWorkbenchWindow window = CDebugUIPlugin.getActiveWorkbenchWindow();
if ( window != null )
{
CDebugUIPlugin.errorDialog( CDebugUIPlugin.getResourceString("internal.ui.actions.SignalZeroObjectActionDelegate.Operation_failed"), ms ); //$NON-NLS-1$
public void run( IAction action ) {
if ( getTarget() != null ) {
final MultiStatus ms = new MultiStatus( CDebugUIPlugin.getUniqueIdentifier(), DebugException.REQUEST_FAILED, ActionMessages.getString( "SignalZeroObjectActionDelegate.0" ), null ); //$NON-NLS-1$
BusyIndicator.showWhile( Display.getCurrent(), new Runnable() {
public void run() {
try {
doAction( getTarget() );
}
catch( DebugException e ) {
ms.merge( e.getStatus() );
}
}
else
{
} );
if ( !ms.isOK() ) {
IWorkbenchWindow window = CDebugUIPlugin.getActiveWorkbenchWindow();
if ( window != null ) {
CDebugUIPlugin.errorDialog( ActionMessages.getString( "SignalZeroObjectActionDelegate.1" ), ms ); //$NON-NLS-1$
}
else {
CDebugUIPlugin.log( ms );
}
}
}
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.IActionDelegate#selectionChanged(IAction, ISelection)
*/
public void selectionChanged( IAction action, ISelection selection )
{
if ( selection instanceof IStructuredSelection )
{
public void selectionChanged( IAction action, ISelection selection ) {
if ( selection instanceof IStructuredSelection ) {
Object element = ((IStructuredSelection)selection).getFirstElement();
if ( element instanceof IResumeWithoutSignal )
{
if ( element instanceof IResumeWithoutSignal ) {
boolean enabled = ((IResumeWithoutSignal)element).canResumeWithoutSignal();
action.setEnabled( enabled );
if ( enabled )
{
if ( enabled ) {
setTarget( (IResumeWithoutSignal)element );
return;
}
@ -106,18 +91,15 @@ public class SignalZeroObjectActionDelegate implements IObjectActionDelegate
setTarget( null );
}
protected void doAction( IResumeWithoutSignal target ) throws DebugException
{
protected void doAction( IResumeWithoutSignal target ) throws DebugException {
target.resumeWithoutSignal();
}
protected IResumeWithoutSignal getTarget()
{
protected IResumeWithoutSignal getTarget() {
return fTarget;
}
protected void setTarget( IResumeWithoutSignal target )
{
protected void setTarget( IResumeWithoutSignal target ) {
fTarget = target;
}
}

View file

@ -1,39 +1,41 @@
/*
*(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 org.eclipse.cdt.debug.core.model.IResumeWithoutSignal;
import org.eclipse.debug.core.DebugException;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
/**
* Enter type comment.
*
* @since: Feb 7, 2003
* The workbench delegate of the "Resume Without Signal" action.
*/
public class SignalZeroWorkbenchActionDelegate extends AbstractListenerActionDelegate
{
/* (non-Javadoc)
public class SignalZeroWorkbenchActionDelegate extends AbstractListenerActionDelegate {
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.debug.internal.ui.actions.AbstractDebugActionDelegate#doAction(java.lang.Object)
*/
protected void doAction( Object element ) throws DebugException
{
if ( element instanceof IResumeWithoutSignal )
{
protected void doAction( Object element ) throws DebugException {
if ( element instanceof IResumeWithoutSignal ) {
((IResumeWithoutSignal)element).resumeWithoutSignal();
}
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.debug.internal.ui.actions.AbstractDebugActionDelegate#isEnabledFor(java.lang.Object)
*/
protected boolean isEnabledFor( Object element )
{
if ( element instanceof IResumeWithoutSignal )
{
protected boolean isEnabledFor( Object element ) {
if ( element instanceof IResumeWithoutSignal ) {
return ((IResumeWithoutSignal)element).canResumeWithoutSignal();
}
return false;
@ -42,24 +44,21 @@ public class SignalZeroWorkbenchActionDelegate extends AbstractListenerActionDel
/**
* @see AbstractDebugActionDelegate#getStatusMessage()
*/
protected String getStatusMessage()
{
return CDebugUIPlugin.getResourceString("internal.ui.actions.SignalZeroWorkbenchActionDelegate.Exceptions_occurred_attempting_to_resume_without_signal"); //$NON-NLS-1$
protected String getStatusMessage() {
return ActionMessages.getString( "SignalZeroWorkbenchActionDelegate.0" ); //$NON-NLS-1$
}
/**
* @see AbstractDebugActionDelegate#getErrorDialogMessage()
*/
protected String getErrorDialogMessage()
{
return CDebugUIPlugin.getResourceString("internal.ui.actions.SignalZeroWorkbenchActionDelegate.ErrorMsg_Resume_without_signal_failed"); //$NON-NLS-1$
protected String getErrorDialogMessage() {
return ActionMessages.getString( "SignalZeroWorkbenchActionDelegate.1" ); //$NON-NLS-1$
}
/**
* @see AbstractDebugActionDelegate#getErrorDialogTitle()
*/
protected String getErrorDialogTitle()
{
return CDebugUIPlugin.getResourceString("internal.ui.actions.SignalZeroWorkbenchActionDelegate.ErrorMsgTitle_Resume_Without_Signal"); //$NON-NLS-1$
protected String getErrorDialogTitle() {
return ActionMessages.getString( "SignalZeroWorkbenchActionDelegate.2" ); //$NON-NLS-1$
}
}

View file

@ -1,14 +1,18 @@
/*
*(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.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.eclipse.cdt.debug.core.cdi.ICDIFormat;
import org.eclipse.cdt.debug.core.model.ICVariable;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
@ -24,121 +28,96 @@ import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
/**
*
* Enter type comment.
*
* @since Dec 16, 2002
* The delegate of the "Format" action.
*/
public class VariableFormatActionDelegate implements IObjectActionDelegate
{
public class VariableFormatActionDelegate implements IObjectActionDelegate {
private int fFormat = ICDIFormat.NATURAL;
private ICVariable[] fVariables = null;
/**
* Constructor for VariableFormatActionDelegate.
*/
public VariableFormatActionDelegate( int format )
{
public VariableFormatActionDelegate( int format ) {
fFormat = format;
}
/**
* @see org.eclipse.ui.IObjectActionDelegate#setActivePart(IAction, IWorkbenchPart)
*/
public void setActivePart( IAction action, IWorkbenchPart targetPart )
{
public void setActivePart( IAction action, IWorkbenchPart targetPart ) {
}
/**
* @see org.eclipse.ui.IActionDelegate#run(IAction)
*/
public void run( IAction action )
{
public void run( IAction action ) {
ICVariable[] vars = getVariables();
if ( vars != null && vars.length > 0 )
{
final MultiStatus ms = new MultiStatus( CDebugUIPlugin.getUniqueIdentifier(),
DebugException.REQUEST_FAILED, "", null ); //$NON-NLS-1$
BusyIndicator.showWhile( Display.getCurrent(),
new Runnable()
{
public void run()
{
try
{
doAction( getVariables() );
}
catch( DebugException e )
{
ms.merge( e.getStatus() );
}
}
} );
if ( !ms.isOK() )
{
IWorkbenchWindow window = CDebugUIPlugin.getActiveWorkbenchWindow();
if ( window != null )
{
CDebugUIPlugin.errorDialog( CDebugUIPlugin.getResourceString("internal.ui.actions.VariableFormatActionDelegate.Unable_to_set_format_of_variable"), ms ); //$NON-NLS-1$
if ( vars != null && vars.length > 0 ) {
final MultiStatus ms = new MultiStatus( CDebugUIPlugin.getUniqueIdentifier(), DebugException.REQUEST_FAILED, "", null ); //$NON-NLS-1$
BusyIndicator.showWhile( Display.getCurrent(), new Runnable() {
public void run() {
try {
doAction( getVariables() );
}
catch( DebugException e ) {
ms.merge( e.getStatus() );
}
}
else
{
} );
if ( !ms.isOK() ) {
IWorkbenchWindow window = CDebugUIPlugin.getActiveWorkbenchWindow();
if ( window != null ) {
CDebugUIPlugin.errorDialog( ActionMessages.getString( "VariableFormatActionDelegate.0" ), ms ); //$NON-NLS-1$
}
else {
CDebugUIPlugin.log( ms );
}
}
}
}
/**
* @see org.eclipse.ui.IActionDelegate#selectionChanged(IAction, ISelection)
*/
public void selectionChanged( IAction action, ISelection selection )
{
if ( selection instanceof IStructuredSelection )
{
public void selectionChanged( IAction action, ISelection selection ) {
if ( selection instanceof IStructuredSelection ) {
List list = new ArrayList();
IStructuredSelection ssel = (IStructuredSelection)selection;
Iterator i = ssel.iterator();
while ( i.hasNext() )
{
while( i.hasNext() ) {
Object o = i.next();
if ( o instanceof ICVariable )
{
if ( o instanceof ICVariable ) {
ICVariable var = (ICVariable)o;
boolean enabled = var.isEditable();
action.setEnabled( enabled );
if ( enabled )
{
if ( enabled ) {
action.setChecked( var.getFormat() == fFormat );
list.add(o);
list.add( o );
}
}
}
setVariables( (ICVariable[])list.toArray( new ICVariable[list.size()] ) );
}
else
{
}
else {
action.setChecked( false );
action.setEnabled( false );
}
}
protected void doAction( ICVariable[] vars ) throws DebugException
{
for( int i = 0; i < vars.length; i++ )
{
protected void doAction( ICVariable[] vars ) throws DebugException {
for( int i = 0; i < vars.length; i++ ) {
vars[i].setFormat( fFormat );
}
}
protected ICVariable[] getVariables()
{
protected ICVariable[] getVariables() {
return fVariables;
}
private void setVariables( ICVariable[] variables )
{
private void setVariables( ICVariable[] variables ) {
fVariables = variables;
}
}
}

View file

@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.cdt.debug.internal.ui.actions;
import org.eclipse.debug.ui.IDebugView;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
import org.eclipse.jface.action.IAction;

View file

@ -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.editors;
import java.text.MessageFormat;
@ -10,7 +15,6 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import org.eclipse.cdt.core.resources.FileStorage;
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocation;
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator;
@ -64,151 +68,131 @@ import org.eclipse.ui.IViewPart;
import org.eclipse.ui.part.FileEditorInput;
/**
* Enter type comment.
*
* @since: Feb 26, 2003
* The Debugger specific extension fo the C editor.
*/
public class CDebugEditor extends CEditor
{
public class AttachSourceForm implements IPropertyChangeListener
{
public class CDebugEditor extends CEditor {
public class AttachSourceForm implements IPropertyChangeListener {
/** The horizontal scroll increment. */
private static final int HORIZONTAL_SCROLL_INCREMENT = 10;
/** The vertical scroll increment. */
private static final int VERTICAL_SCROLL_INCREMENT = 10;
/** The form's root widget */
private Font fFont;
/** The form's root widget */
private ScrolledComposite fScrolledComposite;
/** The background color */
private Color fBackgroundColor;
/** The foreground color */
private Color fForegroundColor;
/** The separator's color */
private Color fSeparatorColor;
/** The form headers */
private List fHeaderLabels = new ArrayList();
/** The form banners */
private List fBannerLabels = new ArrayList();
/** The form text */
private Label fInputLabel;
/** The attach source button */
private Button fAttachButton = null;
/** The preference change listener */
// private IPropertyChangeListener fPropertyChangeListener;
/** The preference change listener */
// private IPropertyChangeListener fPropertyChangeListener;
private IEditorInput fInput = null;
public AttachSourceForm( Composite parent, IEditorInput input )
{
public AttachSourceForm( Composite parent, IEditorInput input ) {
Display display = parent.getDisplay();
fBackgroundColor = display.getSystemColor( SWT.COLOR_LIST_BACKGROUND );
fForegroundColor = display.getSystemColor( SWT.COLOR_LIST_FOREGROUND );
fSeparatorColor = new Color( display, 152, 170, 203 );
JFaceResources.getFontRegistry().addListener( AttachSourceForm.this );
fScrolledComposite = new ScrolledComposite( parent, SWT.H_SCROLL | SWT.V_SCROLL );
fScrolledComposite.setAlwaysShowScrollBars( false );
fScrolledComposite.setExpandHorizontal( true );
fScrolledComposite.setExpandVertical( true );
fScrolledComposite.addDisposeListener(
new DisposeListener()
{
public void widgetDisposed( DisposeEvent e )
{
JFaceResources.getFontRegistry().removeListener( AttachSourceForm.this );
setScrolledComposite( null );
getSeparatorColor().dispose();
setSeparatorColor( null );
getBannerLabels().clear();
getHeaderLabels().clear();
if ( getFont() != null )
{
getFont().dispose();
setFont( null );
}
}
} );
fScrolledComposite.addControlListener(
new ControlListener()
{
public void controlMoved( ControlEvent e )
{
}
public void controlResized(ControlEvent e)
{
Rectangle clientArea = getScrolledComposite().getClientArea();
fScrolledComposite.addDisposeListener( new DisposeListener() {
ScrollBar verticalBar = getScrolledComposite().getVerticalBar();
verticalBar.setIncrement( VERTICAL_SCROLL_INCREMENT );
verticalBar.setPageIncrement( clientArea.height - verticalBar.getIncrement() );
public void widgetDisposed( DisposeEvent e ) {
JFaceResources.getFontRegistry().removeListener( AttachSourceForm.this );
setScrolledComposite( null );
getSeparatorColor().dispose();
setSeparatorColor( null );
getBannerLabels().clear();
getHeaderLabels().clear();
if ( getFont() != null ) {
getFont().dispose();
setFont( null );
}
}
} );
fScrolledComposite.addControlListener( new ControlListener() {
ScrollBar horizontalBar = getScrolledComposite().getHorizontalBar();
horizontalBar.setIncrement( HORIZONTAL_SCROLL_INCREMENT );
horizontalBar.setPageIncrement( clientArea.width - horizontalBar.getIncrement() );
}
} );
public void controlMoved( ControlEvent e ) {
}
public void controlResized( ControlEvent e ) {
Rectangle clientArea = getScrolledComposite().getClientArea();
ScrollBar verticalBar = getScrolledComposite().getVerticalBar();
verticalBar.setIncrement( VERTICAL_SCROLL_INCREMENT );
verticalBar.setPageIncrement( clientArea.height - verticalBar.getIncrement() );
ScrollBar horizontalBar = getScrolledComposite().getHorizontalBar();
horizontalBar.setIncrement( HORIZONTAL_SCROLL_INCREMENT );
horizontalBar.setPageIncrement( clientArea.width - horizontalBar.getIncrement() );
}
} );
Composite composite = createComposite( fScrolledComposite );
composite.setLayout( new GridLayout() );
createTitleLabel( composite, CDebugUIPlugin.getResourceString("internal.ui.editors.CDebugEditor.C_CPP_File_Editor") ); //$NON-NLS-1$
createTitleLabel( composite, EditorMessages.getString( "CDebugEditor.0" ) ); //$NON-NLS-1$
createLabel( composite, null );
createLabel( composite, null );
createHeadingLabel( composite, CDebugUIPlugin.getResourceString("internal.ui.editors.CDebugEditor.Source_not_found") ); //$NON-NLS-1$
createHeadingLabel( composite, EditorMessages.getString( "CDebugEditor.1" ) ); //$NON-NLS-1$
Composite separator = createCompositeSeparator( composite );
GridData data = new GridData( GridData.FILL_HORIZONTAL );
data.heightHint = 2;
separator.setLayoutData( data );
fInputLabel = createLabel( composite, "" ); //$NON-NLS-1$
createLabel( composite, CDebugUIPlugin.getResourceString("internal.ui.editors.CDebugEditor.attach_source_location_instructions") ); //$NON-NLS-1$
createLabel( composite, EditorMessages.getString( "CDebugEditor.2" ) ); //$NON-NLS-1$
createLabel( composite, null );
fAttachButton = createButton( composite, EditorMessages.getString( "CDebugEditor.3" ) ); //$NON-NLS-1$
fAttachButton.addSelectionListener( new SelectionListener() {
fAttachButton = createButton( composite, CDebugUIPlugin.getResourceString("internal.ui.editors.CDebugEditor.Attach_Source_button") ); //$NON-NLS-1$
fAttachButton.addSelectionListener(
new SelectionListener()
{
public void widgetSelected( SelectionEvent event )
{
attachSourceLocation();
}
public void widgetDefaultSelected( SelectionEvent e )
{
}
} );
public void widgetSelected( SelectionEvent event ) {
attachSourceLocation();
}
public void widgetDefaultSelected( SelectionEvent e ) {
}
} );
separator = createCompositeSeparator( composite );
data = new GridData( GridData.FILL_HORIZONTAL );
data.heightHint = 2;
separator.setLayoutData( data );
fScrolledComposite.setContent( composite );
fScrolledComposite.setMinSize( composite.computeSize( SWT.DEFAULT, SWT.DEFAULT ) );
if ( getEditorInput() != null )
{
if ( getEditorInput() != null ) {
setInputLabelText( getEditorInput() );
}
fInput = input;
}
private Composite createComposite( Composite parent )
{
private Composite createComposite( Composite parent ) {
Composite composite = new Composite( parent, SWT.NONE );
composite.setBackground( fBackgroundColor );
return composite;
}
private Label createLabel( Composite parent, String text )
{
private Label createLabel( Composite parent, String text ) {
Label label = new Label( parent, SWT.NONE );
if ( text != null )
label.setText( text );
@ -217,8 +201,7 @@ public class CDebugEditor extends CEditor
return label;
}
private Label createTitleLabel( Composite parent, String text )
{
private Label createTitleLabel( Composite parent, String text ) {
Label label = new Label( parent, SWT.NONE );
if ( text != null )
label.setText( text );
@ -229,8 +212,7 @@ public class CDebugEditor extends CEditor
return label;
}
private Label createHeadingLabel( Composite parent, String text )
{
private Label createHeadingLabel( Composite parent, String text ) {
Label label = new Label( parent, SWT.NONE );
if ( text != null )
label.setText( text );
@ -241,15 +223,13 @@ public class CDebugEditor extends CEditor
return label;
}
private Composite createCompositeSeparator( Composite parent )
{
private Composite createCompositeSeparator( Composite parent ) {
Composite composite = new Composite( parent, SWT.NONE );
composite.setBackground( fSeparatorColor );
return composite;
}
private Button createButton( Composite parent, String text )
{
private Button createButton( Composite parent, String text ) {
Button button = new Button( parent, SWT.FLAT );
button.setBackground( fBackgroundColor );
button.setForeground( fForegroundColor );
@ -258,95 +238,78 @@ public class CDebugEditor extends CEditor
return button;
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
*/
public void propertyChange( PropertyChangeEvent event )
{
for ( Iterator iterator = fBannerLabels.iterator(); iterator.hasNext(); )
{
public void propertyChange( PropertyChangeEvent event ) {
for( Iterator iterator = fBannerLabels.iterator(); iterator.hasNext(); ) {
Label label = (Label)iterator.next();
label.setFont( JFaceResources.getBannerFont() );
}
for ( Iterator iterator = fHeaderLabels.iterator(); iterator.hasNext(); )
{
for( Iterator iterator = fHeaderLabels.iterator(); iterator.hasNext(); ) {
Label label = (Label)iterator.next();
label.setFont( JFaceResources.getHeaderFont() );
}
Control control = fScrolledComposite.getContent();
fScrolledComposite.setMinSize( control.computeSize( SWT.DEFAULT, SWT.DEFAULT ) );
fScrolledComposite.setContent( control );
fScrolledComposite.layout( true );
fScrolledComposite.redraw();
}
private void setInputLabelText( IEditorInput input )
{
private void setInputLabelText( IEditorInput input ) {
FileNotFoundElement element = (FileNotFoundElement)input.getAdapter( FileNotFoundElement.class );
if ( element != null )
fInputLabel.setText( MessageFormat.format( CDebugUIPlugin.getResourceString("internal.ui.editors.CDebugEditor.Can_not_find_file"), new String[] { element.getFullPath().toOSString() } ) ); //$NON-NLS-1$
fInputLabel.setText( MessageFormat.format( EditorMessages.getString( "CDebugEditor.4" ), new String[]{ element.getFullPath().toOSString() } ) ); //$NON-NLS-1$
}
protected ScrolledComposite getScrolledComposite()
{
protected ScrolledComposite getScrolledComposite() {
return fScrolledComposite;
}
protected void setScrolledComposite( ScrolledComposite scrolledComposite )
{
protected void setScrolledComposite( ScrolledComposite scrolledComposite ) {
fScrolledComposite = scrolledComposite;
}
protected Color getSeparatorColor()
{
protected Color getSeparatorColor() {
return fSeparatorColor;
}
protected void setSeparatorColor( Color separatorColor )
{
protected void setSeparatorColor( Color separatorColor ) {
fSeparatorColor = separatorColor;
}
protected List getBannerLabels()
{
protected List getBannerLabels() {
return fBannerLabels;
}
protected void setBannerLabels( List bannerLabels )
{
protected void setBannerLabels( List bannerLabels ) {
fBannerLabels = bannerLabels;
}
protected List getHeaderLabels()
{
protected List getHeaderLabels() {
return fHeaderLabels;
}
protected void setHeaderLabels( List headerLabels )
{
protected void setHeaderLabels( List headerLabels ) {
fHeaderLabels = headerLabels;
}
protected Font getFont()
{
protected Font getFont() {
return fFont;
}
protected void setFont( Font font )
{
protected void setFont( Font font ) {
fFont = font;
}
public Control getControl()
{
public Control getControl() {
return fScrolledComposite;
}
public IEditorInput getInput()
{
public IEditorInput getInput() {
return fInput;
}
}
@ -358,91 +321,78 @@ public class CDebugEditor extends CEditor
/**
* Constructor for CDebugEditor.
*/
public CDebugEditor()
{
public CDebugEditor() {
super();
setDocumentProvider( CUIPlugin.getDefault().getDocumentProvider() );
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.IWorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
*/
public void createPartControl( Composite parent )
{
public void createPartControl( Composite parent ) {
super.createPartControl( parent );
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.texteditor.AbstractTextEditor#doSetInput(org.eclipse.ui.IEditorInput)
*/
protected void doSetInput( IEditorInput input ) throws CoreException
{
protected void doSetInput( IEditorInput input ) throws CoreException {
IEditorInput newInput = input;
if ( input instanceof EditorInputDelegate && ((EditorInputDelegate)input).getDelegate() != null )
{
if ( input instanceof EditorInputDelegate && ((EditorInputDelegate)input).getDelegate() != null ) {
newInput = ((EditorInputDelegate)input).getDelegate();
}
IEditorInput oldInput = getEditorInput();
if ( oldInput instanceof EditorInputDelegate )
{
if ( oldInput instanceof EditorInputDelegate ) {
oldInput = ((EditorInputDelegate)oldInput).getDelegate();
}
if (oldInput != null)
{
CUIPlugin.getDefault().getWorkingCopyManager().disconnect(oldInput);
if ( oldInput != null ) {
CUIPlugin.getDefault().getWorkingCopyManager().disconnect( oldInput );
}
super.doSetInput( newInput );
// This hack should be after the super.doSetInput();
CUIPlugin.getDefault().getWorkingCopyManager().connect(newInput);
CUIPlugin.getDefault().getWorkingCopyManager().connect( newInput );
}
protected void attachSourceLocation()
{
if ( getEditorInput() != null && getEditorInput().getAdapter( FileNotFoundElement.class ) != null )
{
protected void attachSourceLocation() {
if ( getEditorInput() != null && getEditorInput().getAdapter( FileNotFoundElement.class ) != null ) {
FileNotFoundElement element = (FileNotFoundElement)getEditorInput().getAdapter( FileNotFoundElement.class );
if ( element.getLaunch() != null && element.getLaunch().getSourceLocator() instanceof IAdaptable )
{
if ( element.getLaunch() != null && element.getLaunch().getSourceLocator() instanceof IAdaptable ) {
ILaunch launch = element.getLaunch();
ICSourceLocator locator = (ICSourceLocator)((IAdaptable)element.getLaunch().getSourceLocator()).getAdapter( ICSourceLocator.class );
if ( locator != null )
{
if ( locator != null ) {
IPath path = element.getFullPath();
INewSourceLocationWizard wizard = null;
if ( path.isAbsolute() )
{
if ( path.isAbsolute() ) {
path = path.removeLastSegments( 1 );
wizard = new AddDirectorySourceLocationWizard( path );
}
else
{
else {
wizard = new AddSourceLocationWizard( locator.getSourceLocations() );
}
WizardDialog dialog = new WizardDialog( CDebugUIPlugin.getActiveWorkbenchShell(), wizard );
if ( dialog.open() == Window.OK )
{
if ( dialog.open() == Window.OK ) {
ICSourceLocation[] locations = locator.getSourceLocations();
ArrayList list = new ArrayList( Arrays.asList( locations ) );
list.add( wizard.getSourceLocation() );
locator.setSourceLocations( (ICSourceLocation[])list.toArray( new ICSourceLocation[list.size()] ) );
if ( locator instanceof IPersistableSourceLocator )
{
if ( locator instanceof IPersistableSourceLocator ) {
ILaunchConfiguration configuration = launch.getLaunchConfiguration();
saveChanges( configuration, (IPersistableSourceLocator)launch.getSourceLocator() );
}
Object newElement = locator.getSourceElement( element.getStackFrame() );
IEditorInput newInput = null;
if ( newElement instanceof IFile )
{
if ( newElement instanceof IFile ) {
newInput = new FileEditorInput( (IFile)newElement );
}
else if ( newElement instanceof FileStorage )
{
else if ( newElement instanceof FileStorage ) {
newInput = new ExternalEditorInput( (IStorage)newElement );
}
IEditorInput oldInput = ((EditorInputDelegate)getEditorInput()).getDelegate();
CUIPlugin.getDefault().getWorkingCopyManager().disconnect(oldInput);
CUIPlugin.getDefault().getWorkingCopyManager().disconnect( oldInput );
((EditorInputDelegate)getEditorInput()).setDelegate( newInput );
resetInput( element.getStackFrame() );
}
@ -450,27 +400,22 @@ public class CDebugEditor extends CEditor
}
}
}
private void resetInput( IStackFrame frame )
{
private void resetInput( IStackFrame frame ) {
setInput( getEditorInput() );
IViewPart view = CDebugUIPlugin.getActivePage().findView( IDebugUIConstants.ID_DEBUG_VIEW );
if ( view instanceof IDebugView )
{
if ( view instanceof IDebugView ) {
((IDebugView)view).getViewer().setSelection( new StructuredSelection( frame ) );
}
}
}
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 );
}
}
@ -478,8 +423,7 @@ public class CDebugEditor extends CEditor
/**
* @see org.eclipse.ui.texteditor.StatusTextEditor#createStatusControl(Composite, IStatus)
*/
protected Control createStatusControl( Composite parent, IStatus status )
{
protected Control createStatusControl( Composite parent, IStatus status ) {
fAttachSourceForm = new AttachSourceForm( parent, getEditorInput() );
return fAttachSourceForm.getControl();
}
@ -487,12 +431,9 @@ public class CDebugEditor extends CEditor
/**
* @see org.eclipse.ui.texteditor.StatusTextEditor#updatePartControl(IEditorInput)
*/
public void updatePartControl( IEditorInput input )
{
if ( fAttachSourceForm != null )
{
if ( fAttachSourceForm.getInput() != null && !fAttachSourceForm.getInput().equals( input ) )
{
public void updatePartControl( IEditorInput input ) {
if ( fAttachSourceForm != null ) {
if ( fAttachSourceForm.getInput() != null && !fAttachSourceForm.getInput().equals( input ) ) {
fAttachSourceForm = null;
super.updatePartControl( input );
}
@ -501,18 +442,18 @@ public class CDebugEditor extends CEditor
super.updatePartControl( input );
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.IWorkbenchPart#dispose()
*/
public void dispose() {
IEditorInput input = getEditorInput();
IEditorInput newInput = input;
if ( input instanceof EditorInputDelegate && ((EditorInputDelegate)input).getDelegate() != null )
{
if ( input instanceof EditorInputDelegate && ((EditorInputDelegate)input).getDelegate() != null ) {
newInput = ((EditorInputDelegate)input).getDelegate();
}
CUIPlugin.getDefault().getWorkingCopyManager().disconnect(newInput);
CUIPlugin.getDefault().getWorkingCopyManager().disconnect( newInput );
super.dispose();
}
}

View file

@ -0,0 +1,37 @@
/**********************************************************************
* 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.editors;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
/**
* 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 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 );
}
catch( MissingResourceException e ) {
return '!' + key + '!';
}
}
}

View file

@ -0,0 +1,5 @@
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.

View file

@ -77,7 +77,7 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr
// Format constants
private static int[] fFormatIds = new int[]{ ICDIFormat.NATURAL, ICDIFormat.HEXADECIMAL, ICDIFormat.DECIMAL };
private static String[] fFormatLabels = new String[]{ CDebugUIPlugin.getResourceString( "internal.ui.preferences.CDebugPreferencePage.Natural" ), CDebugUIPlugin.getResourceString( "internal.ui.preferences.CDebugPreferencePage.Hexadecimal" ), CDebugUIPlugin.getResourceString( "internal.ui.preferences.CDebugPreferencePage.Decimal" ) }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
private static String[] fFormatLabels = new String[]{ PreferenceMessages.getString( "CDebugPreferencePage.0" ), PreferenceMessages.getString( "CDebugPreferencePage.1" ), PreferenceMessages.getString( "CDebugPreferencePage.2" ) }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
private PropertyChangeListener fPropertyChangeListener;
@ -106,7 +106,7 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr
super();
setPreferenceStore( CDebugUIPlugin.getDefault().getPreferenceStore() );
getPreferenceStore().addPropertyChangeListener( getPropertyChangeListener() );
setDescription( CDebugUIPlugin.getResourceString( "internal.ui.preferences.CDebugPreferencePage.Preference_page_description" ) ); //$NON-NLS-1$
setDescription( PreferenceMessages.getString( "CDebugPreferencePage.3" ) ); //$NON-NLS-1$
}
/*
@ -205,29 +205,29 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr
* Create the view setting preferences composite widget
*/
private void createViewSettingPreferences( Composite parent ) {
Composite comp = createGroupComposite( parent, 1, CDebugUIPlugin.getResourceString( "internal.ui.preferences.CDebugPreferencePage.Opened_view_default_settings" ) ); //$NON-NLS-1$
fPathsButton = createCheckButton( comp, CDebugUIPlugin.getResourceString( "internal.ui.preferences.CDebugPreferencePage.pathsButton" ) ); //$NON-NLS-1$
fRefreshRegistersButton = createCheckButton( comp, CDebugUIPlugin.getResourceString( "internal.ui.preferences.CDebugPreferencePage.autoRefreshRegistersButton" ) ); //$NON-NLS-1$
fRefreshSolibsButton = createCheckButton( comp, CDebugUIPlugin.getResourceString( "internal.ui.preferences.CDebugPreferencePage.autoRefreshSolibsButton" ) ); //$NON-NLS-1$
Composite comp = createGroupComposite( parent, 1, PreferenceMessages.getString( "CDebugPreferencePage.4" ) ); //$NON-NLS-1$
fPathsButton = createCheckButton( comp, PreferenceMessages.getString( "CDebugPreferencePage.5" ) ); //$NON-NLS-1$
fRefreshRegistersButton = createCheckButton( comp, PreferenceMessages.getString( "CDebugPreferencePage.6" ) ); //$NON-NLS-1$
fRefreshSolibsButton = createCheckButton( comp, PreferenceMessages.getString( "CDebugPreferencePage.7" ) ); //$NON-NLS-1$
Composite formatComposite = ControlFactory.createCompositeEx( comp, 2, 0 );
((GridLayout)formatComposite.getLayout()).makeColumnsEqualWidth = true;
fVariableFormatCombo = createComboBox( formatComposite, CDebugUIPlugin.getResourceString( "internal.ui.preferences.CDebugPreferencePage.variableFormatCombo" ), fFormatLabels, fFormatLabels[0] ); //$NON-NLS-1$
fExpressionFormatCombo = createComboBox( formatComposite, CDebugUIPlugin.getResourceString( "internal.ui.preferences.CDebugPreferencePage.expressionFormatCombo" ), fFormatLabels, fFormatLabels[0] ); //$NON-NLS-1$
fRegisterFormatCombo = createComboBox( formatComposite, CDebugUIPlugin.getResourceString( "internal.ui.preferences.CDebugPreferencePage.registerFormatCombo" ), fFormatLabels, fFormatLabels[0] ); //$NON-NLS-1$
fVariableFormatCombo = createComboBox( formatComposite, PreferenceMessages.getString( "CDebugPreferencePage.8" ), fFormatLabels, fFormatLabels[0] ); //$NON-NLS-1$
fExpressionFormatCombo = createComboBox( formatComposite, PreferenceMessages.getString( "CDebugPreferencePage.9" ), fFormatLabels, fFormatLabels[0] ); //$NON-NLS-1$
fRegisterFormatCombo = createComboBox( formatComposite, PreferenceMessages.getString( "CDebugPreferencePage.10" ), fFormatLabels, fFormatLabels[0] ); //$NON-NLS-1$
}
/**
* Create the disassembly setting preferences composite widget
*/
private void createDisassemblySettingPreferences( Composite parent ) {
Composite group = createGroupComposite( parent, 1, CDebugUIPlugin.getResourceString( "internal.ui.preferences.CDebugPreferencePage.Disassembly_options" ) ); //$NON-NLS-1$
Composite group = createGroupComposite( parent, 1, PreferenceMessages.getString( "CDebugPreferencePage.11" ) ); //$NON-NLS-1$
Composite comp = ControlFactory.createComposite( group, 2 );
createMaxNumberOfInstructionsField( comp );
createDisassemblyColorsField( comp );
}
private void createMaxNumberOfInstructionsField( Composite parent ) {
fMaxNumberOfInstructionsText = new IntegerFieldEditor( ICDebugConstants.PREF_MAX_NUMBER_OF_INSTRUCTIONS, CDebugUIPlugin.getResourceString( "internal.ui.preferences.CDebugPreferencePage.maxNumberOfInstructions" ), parent, NUMBER_OF_DIGITS ); //$NON-NLS-1$
fMaxNumberOfInstructionsText = new IntegerFieldEditor( ICDebugConstants.PREF_MAX_NUMBER_OF_INSTRUCTIONS, PreferenceMessages.getString( "CDebugPreferencePage.12" ), parent, NUMBER_OF_DIGITS ); //$NON-NLS-1$
GridData data = (GridData)fMaxNumberOfInstructionsText.getTextControl( parent ).getLayoutData();
data.horizontalAlignment = GridData.BEGINNING;
data.widthHint = convertWidthInCharsToPixels( NUMBER_OF_DIGITS + 1 );
@ -236,7 +236,7 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr
fMaxNumberOfInstructionsText.setValidRange( ICDebugConstants.MIN_NUMBER_OF_INSTRUCTIONS, ICDebugConstants.MAX_NUMBER_OF_INSTRUCTIONS );
String minValue = Integer.toString( ICDebugConstants.MIN_NUMBER_OF_INSTRUCTIONS );
String maxValue = Integer.toString( ICDebugConstants.MAX_NUMBER_OF_INSTRUCTIONS );
fMaxNumberOfInstructionsText.setErrorMessage( MessageFormat.format( CDebugUIPlugin.getResourceString( "internal.ui.preferences.CDebugPreferencePage.ErrorMaxNumberOfInstructionsRange" ), new String[]{ minValue, maxValue } ) ); //$NON-NLS-1$
fMaxNumberOfInstructionsText.setErrorMessage( MessageFormat.format( PreferenceMessages.getString( "CDebugPreferencePage.13" ), new String[]{ minValue, maxValue } ) ); //$NON-NLS-1$
fMaxNumberOfInstructionsText.load();
fMaxNumberOfInstructionsText.setPropertyChangeListener( new IPropertyChangeListener() {
@ -389,4 +389,4 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr
private ColorFieldEditor getDisassemblySourceColor() {
return fDisassemblySourceColor;
}
}
}

View file

@ -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.preferences;
import org.eclipse.cdt.debug.internal.ui.ICDebugHelpContextIds;
@ -23,80 +28,57 @@ import org.eclipse.ui.IWorkbenchPreferencePage;
import org.eclipse.ui.help.WorkbenchHelp;
/**
*
* Enter type comment.
*
* @since Jul 25, 2002
* The preference page of the Memory view.
*/
public class MemoryViewPreferencePage extends FieldEditorPreferencePage
implements IWorkbenchPreferencePage
{
public class MemoryViewPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
/**
* Constructor for MemoryViewPreferencePage.
* @param style
*/
public MemoryViewPreferencePage()
{
public MemoryViewPreferencePage() {
super( GRID );
setDescription( CDebugUIPlugin.getResourceString("internal.ui.preferences.MemoryViewPreferencePage.Description") ); //$NON-NLS-1$
setDescription( PreferenceMessages.getString( "MemoryViewPreferencePage.0" ) ); //$NON-NLS-1$
setPreferenceStore( CDebugUIPlugin.getDefault().getPreferenceStore() );
}
/**
* @see PreferencePage#createControl(Composite)
*/
public void createControl( Composite parent )
{
public void createControl( Composite parent ) {
super.createControl( parent );
WorkbenchHelp.setHelp( parent, ICDebugHelpContextIds.MEMORY_PREFERENCE_PAGE );
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
*/
protected void createFieldEditors()
{
/*
String[][] sizes = { { "Byte", "1" },
{ "Half Word", "2" },
{ "Word", "4" },
{ "Double Word", "8" },
// { "Float", "8" },
// { "Double Float", "16" },
};
addField( new ComboFieldEditor( ICDebugPreferenceConstants.PREF_MEMORY_SIZE, "Size:", sizes, getFieldEditorParent() ) );
String[][] formats = { { "Hexadecimal", "0" },
{ "Binary", "1" },
// { "Octal", "2" },
// { "Signed Decimal", "3" },
// { "Unsigned Decimal", "4" },
};
addField( new ComboFieldEditor( ICDebugPreferenceConstants.PREF_MEMORY_FORMAT, "Format:", formats, getFieldEditorParent() ) );
String[][] bytesPerRow = { { "4", "4" }, { "8", "8" },
{ "16", "16" }, { "32", "32" },
{ "64", "64" }, { "128", "128" } };
addField( new ComboFieldEditor( ICDebugPreferenceConstants.PREF_MEMORY_BYTES_PER_ROW, "Bytes Per Row:", bytesPerRow, getFieldEditorParent() ) );
addField( new BooleanFieldEditor( ICDebugPreferenceConstants.PREF_MEMORY_DISPLAY_ASCII, "Display ASCII", getFieldEditorParent() ) );
*/
ColorFieldEditor foreground = new ColorFieldEditor( ICDebugPreferenceConstants.MEMORY_FOREGROUND_RGB, CDebugUIPlugin.getResourceString("internal.ui.preferences.MemoryViewPreferencePage.Text_Color"), getFieldEditorParent() ); //$NON-NLS-1$
ColorFieldEditor background = new ColorFieldEditor( ICDebugPreferenceConstants.MEMORY_BACKGROUND_RGB, CDebugUIPlugin.getResourceString("internal.ui.preferences.MemoryViewPreferencePage.Background_Color"), getFieldEditorParent() ); //$NON-NLS-1$
ColorFieldEditor address = new ColorFieldEditor( ICDebugPreferenceConstants.MEMORY_ADDRESS_RGB, CDebugUIPlugin.getResourceString("internal.ui.preferences.MemoryViewPreferencePage.Address_Color"), getFieldEditorParent() ); //$NON-NLS-1$
ColorFieldEditor changed = new ColorFieldEditor( ICDebugPreferenceConstants.MEMORY_CHANGED_RGB, CDebugUIPlugin.getResourceString("internal.ui.preferences.MemoryViewPreferencePage.Changed_Value_Color"), getFieldEditorParent() ); //$NON-NLS-1$
protected void createFieldEditors() {
/*
* String[][] sizes = { { "Byte", "1" }, { "Half Word", "2" }, { "Word", "4" }, { "Double Word", "8" }, // { "Float", "8" }, // { "Double Float", "16" }, };
* addField( new ComboFieldEditor( ICDebugPreferenceConstants.PREF_MEMORY_SIZE, "Size:", sizes, getFieldEditorParent() ) );
*
* String[][] formats = { { "Hexadecimal", "0" }, { "Binary", "1" }, // { "Octal", "2" }, // { "Signed Decimal", "3" }, // { "Unsigned Decimal", "4" }, };
* addField( new ComboFieldEditor( ICDebugPreferenceConstants.PREF_MEMORY_FORMAT, "Format:", formats, getFieldEditorParent() ) );
*
* String[][] bytesPerRow = { { "4", "4" }, { "8", "8" }, { "16", "16" }, { "32", "32" }, { "64", "64" }, { "128", "128" } }; addField( new
* ComboFieldEditor( ICDebugPreferenceConstants.PREF_MEMORY_BYTES_PER_ROW, "Bytes Per Row:", bytesPerRow, getFieldEditorParent() ) );
*
* addField( new BooleanFieldEditor( ICDebugPreferenceConstants.PREF_MEMORY_DISPLAY_ASCII, "Display ASCII", getFieldEditorParent() ) );
*/
ColorFieldEditor foreground = new ColorFieldEditor( ICDebugPreferenceConstants.MEMORY_FOREGROUND_RGB, PreferenceMessages.getString( "MemoryViewPreferencePage.1" ), getFieldEditorParent() ); //$NON-NLS-1$
ColorFieldEditor background = new ColorFieldEditor( ICDebugPreferenceConstants.MEMORY_BACKGROUND_RGB, PreferenceMessages.getString( "MemoryViewPreferencePage.2" ), getFieldEditorParent() ); //$NON-NLS-1$
ColorFieldEditor address = new ColorFieldEditor( ICDebugPreferenceConstants.MEMORY_ADDRESS_RGB, PreferenceMessages.getString( "MemoryViewPreferencePage.3" ), getFieldEditorParent() ); //$NON-NLS-1$
ColorFieldEditor changed = new ColorFieldEditor( ICDebugPreferenceConstants.MEMORY_CHANGED_RGB, PreferenceMessages.getString( "MemoryViewPreferencePage.4" ), getFieldEditorParent() ); //$NON-NLS-1$
// ColorFieldEditor dirty = new ColorFieldEditor( ICDebugPreferenceConstants.MEMORY_DIRTY_RGB, "Modified Value Color:", getFieldEditorParent() );
FontFieldEditor font = new FontFieldEditor( ICDebugPreferenceConstants.MEMORY_FONT, CDebugUIPlugin.getResourceString("internal.ui.preferences.MemoryViewPreferencePage.Font"), getFieldEditorParent() ); //$NON-NLS-1$
FontFieldEditor font = new FontFieldEditor( ICDebugPreferenceConstants.MEMORY_FONT, PreferenceMessages.getString( "MemoryViewPreferencePage.5" ), getFieldEditorParent() ); //$NON-NLS-1$
addField( foreground );
addField( background );
addField( address );
addField( changed );
// addField( dirty );
// addField( dirty );
addField( font );
StringFieldEditor paddingChar = createPaddingCharacterField();
paddingChar.setTextLimit( 1 );
addField( paddingChar );
@ -104,25 +86,24 @@ public class MemoryViewPreferencePage extends FieldEditorPreferencePage
createDefaultSettingsFields();
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.IWorkbenchPreferencePage#init(IWorkbench)
*/
public void init( IWorkbench workbench )
{
public void init( IWorkbench workbench ) {
}
protected void createSpacer( Composite composite, int columnSpan )
{
protected void createSpacer( Composite composite, int columnSpan ) {
Label label = new Label( composite, SWT.NONE );
GridData gd = new GridData();
gd.horizontalSpan = columnSpan;
label.setLayoutData( gd );
}
public static void initDefaults( IPreferenceStore store )
{
store.setDefault( ICDebugPreferenceConstants.PREF_MEMORY_PADDING_CHAR, ICDebugPreferenceConstants.DEFAULT_MEMORY_PADDING_CHAR );
store.setDefault( ICDebugPreferenceConstants.PREF_MEMORY_AUTO_REFRESH, true );
public static void initDefaults( IPreferenceStore store ) {
store.setDefault( ICDebugPreferenceConstants.PREF_MEMORY_PADDING_CHAR, ICDebugPreferenceConstants.DEFAULT_MEMORY_PADDING_CHAR );
store.setDefault( ICDebugPreferenceConstants.PREF_MEMORY_AUTO_REFRESH, true );
store.setDefault( ICDebugPreferenceConstants.PREF_MEMORY_SHOW_ASCII, true );
PreferenceConverter.setDefault( store, ICDebugPreferenceConstants.MEMORY_FONT, ICDebugPreferenceConstants.DEFAULT_MEMORY_FONT );
PreferenceConverter.setDefault( store, ICDebugPreferenceConstants.MEMORY_FOREGROUND_RGB, ICDebugPreferenceConstants.DEFAULT_MEMORY_FOREGROUND_RGB );
@ -135,27 +116,24 @@ public class MemoryViewPreferencePage extends FieldEditorPreferencePage
/**
* @see IPreferencePage#performOk()
*/
public boolean performOk()
{
public boolean performOk() {
boolean ok = super.performOk();
CDebugUIPlugin.getDefault().savePluginPreferences();
return ok;
}
private StringFieldEditor createPaddingCharacterField()
{
return new StringFieldEditor( ICDebugPreferenceConstants.PREF_MEMORY_PADDING_CHAR, CDebugUIPlugin.getResourceString("internal.ui.preferences.MemoryViewPreferencePage.Padding_Character"), 1, getFieldEditorParent() ) //$NON-NLS-1$
{
protected boolean doCheckState()
{
return ( getTextControl().getText().length() == 1 );
}
};
private StringFieldEditor createPaddingCharacterField() {
return new StringFieldEditor( ICDebugPreferenceConstants.PREF_MEMORY_PADDING_CHAR, PreferenceMessages.getString( "MemoryViewPreferencePage.6" ), 1, getFieldEditorParent() ) //$NON-NLS-1$
{
protected boolean doCheckState() {
return (getTextControl().getText().length() == 1);
}
};
}
private void createDefaultSettingsFields()
{
addField( new BooleanFieldEditor( ICDebugPreferenceConstants.PREF_MEMORY_AUTO_REFRESH, CDebugUIPlugin.getResourceString("internal.ui.preferences.MemoryViewPreferencePage.Auto_Refresh_by_default"), SWT.NONE, getFieldEditorParent() ) ); //$NON-NLS-1$
addField( new BooleanFieldEditor( ICDebugPreferenceConstants.PREF_MEMORY_SHOW_ASCII, CDebugUIPlugin.getResourceString("internal.ui.preferences.MemoryViewPreferencePage.Show_ascii_by_default"), SWT.NONE, getFieldEditorParent() ) ); //$NON-NLS-1$
private void createDefaultSettingsFields() {
addField( new BooleanFieldEditor( ICDebugPreferenceConstants.PREF_MEMORY_AUTO_REFRESH, PreferenceMessages.getString( "MemoryViewPreferencePage.7" ), SWT.NONE, getFieldEditorParent() ) ); //$NON-NLS-1$
addField( new BooleanFieldEditor( ICDebugPreferenceConstants.PREF_MEMORY_SHOW_ASCII, PreferenceMessages.getString( "MemoryViewPreferencePage.8" ), SWT.NONE, getFieldEditorParent() ) ); //$NON-NLS-1$
}
}

View file

@ -1 +1,27 @@
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

View file

@ -1,15 +1,18 @@
/*
*(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.preferences;
import java.util.Arrays;
import java.util.Observable;
import java.util.Observer;
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
import org.eclipse.cdt.debug.core.ICDebugConstants;
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocation;
@ -37,34 +40,31 @@ import org.eclipse.ui.IWorkbenchPreferencePage;
import org.eclipse.ui.help.WorkbenchHelp;
/**
* Enter type comment.
*
* @since Oct 22, 2003
* The "Source Code Locations" preference page.
*/
public class SourcePreferencePage extends PreferencePage implements IWorkbenchPreferencePage, Observer
{
public class SourcePreferencePage extends PreferencePage implements IWorkbenchPreferencePage, Observer {
private SourceListDialogField fSourceListField;
private SelectionButtonDialogField fSearchForDuplicateFiles;
private boolean fChanged = false;
public SourcePreferencePage()
{
public SourcePreferencePage() {
super();
setPreferenceStore( CDebugUIPlugin.getDefault().getPreferenceStore() );
setDescription( CDebugUIPlugin.getResourceString("internal.ui.preferences.SourcePreferencePage.Description") ); //$NON-NLS-1$
setDescription( PreferenceMessages.getString( "SourcePreferencePage.0" ) ); //$NON-NLS-1$
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
*/
protected Control createContents( Composite parent )
{
protected Control createContents( Composite parent ) {
WorkbenchHelp.setHelp( getControl(), ICDebugHelpContextIds.SOURCE_PREFERENCE_PAGE );
fSourceListField = createSourceListField();
fSearchForDuplicateFiles = createSearchForDuplicateFilesButton();
Composite control = new Composite( parent, SWT.NONE );
GridLayout layout = new GridLayout();
layout.numColumns = 2;
@ -76,157 +76,138 @@ public class SourcePreferencePage extends PreferencePage implements IWorkbenchPr
data.horizontalAlignment = GridData.FILL;
control.setLayoutData( data );
control.setFont( JFaceResources.getDialogFont() );
PixelConverter converter = new PixelConverter( control );
fSourceListField.doFillIntoGrid( control, 3 );
LayoutUtil.setHorizontalSpan( fSourceListField.getLabelControl( null ), 2 );
LayoutUtil.setWidthHint( fSourceListField.getLabelControl( null ), converter.convertWidthInCharsToPixels( 40 ) );
LayoutUtil.setHorizontalGrabbing( fSourceListField.getListControl( null ) );
fSearchForDuplicateFiles.doFillIntoGrid( control, 3 );
setValues();
return control;
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
*/
public void init( IWorkbench workbench )
{
public void init( IWorkbench workbench ) {
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see java.util.Observer#update(java.util.Observable, java.lang.Object)
*/
public void update( Observable o, Object arg )
{
public void update( Observable o, Object arg ) {
setChanged( true );
}
private SourceListDialogField createSourceListField()
{
SourceListDialogField field =
new SourceListDialogField( CDebugUIPlugin.getResourceString("internal.ui.preferences.SourcePreferencePage.Source_locations"), //$NON-NLS-1$
new IListAdapter()
{
public void customButtonPressed( DialogField f, int index )
{
sourceButtonPressed( index );
}
private SourceListDialogField createSourceListField() {
SourceListDialogField field = new SourceListDialogField( PreferenceMessages.getString( "SourcePreferencePage.1" ), //$NON-NLS-1$
new IListAdapter() {
public void selectionChanged(DialogField f)
{
}
} );
public void customButtonPressed( DialogField f, int index ) {
sourceButtonPressed( 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("internal.ui.preferences.SourcePreferencePage.Search_for_duplicate_source_files") ); //$NON-NLS-1$
button.setDialogFieldListener(
new IDialogFieldListener()
{
public void dialogFieldChanged( DialogField field )
{
setChanged( true );
}
} );
button.setLabelText( PreferenceMessages.getString( "SourcePreferencePage.2" ) ); //$NON-NLS-1$
button.setDialogFieldListener( new IDialogFieldListener() {
public void dialogFieldChanged( DialogField field ) {
setChanged( true );
}
} );
return button;
}
protected void sourceButtonPressed( int index )
{
switch( index )
{
case 0: // Add...
protected void sourceButtonPressed( int index ) {
switch( index ) {
case 0: // Add...
if ( addSourceLocation() )
setChanged( true );
break;
case 2: // Up
case 3: // Down
case 5: // Remove
case 2: // Up
case 3: // Down
case 5: // Remove
setChanged( true );
break;
}
}
protected boolean isChanged()
{
protected boolean isChanged() {
return fChanged;
}
protected void setChanged( boolean changed )
{
protected void setChanged( boolean changed ) {
fChanged = changed;
}
private boolean addSourceLocation()
{
private boolean addSourceLocation() {
AddSourceLocationWizard wizard = new AddSourceLocationWizard( getSourceLocations() );
WizardDialog dialog = new WizardDialog( getShell(), wizard );
if ( dialog.open() == Window.OK )
{
if ( dialog.open() == Window.OK ) {
fSourceListField.addElement( wizard.getSourceLocation() );
return true;
}
return false;
}
public ICSourceLocation[] getSourceLocations()
{
return ( fSourceListField != null ) ? fSourceListField.getSourceLocations() : new ICSourceLocation[0];
public ICSourceLocation[] getSourceLocations() {
return (fSourceListField != null) ? fSourceListField.getSourceLocations() : new ICSourceLocation[0];
}
public void setSourceLocations( ICSourceLocation[] locations )
{
if ( fSourceListField != null )
public void setSourceLocations( ICSourceLocation[] locations ) {
if ( fSourceListField != null )
fSourceListField.setElements( Arrays.asList( locations ) );
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.PreferencePage#performDefaults()
*/
protected void performDefaults()
{
protected void performDefaults() {
setSourceLocations( new ICSourceLocation[0] );
setSearchForDuplicateFiles( false );
super.performDefaults();
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.IPreferencePage#performOk()
*/
public boolean performOk()
{
public boolean performOk() {
storeValues();
CDebugCorePlugin.getDefault().savePluginPreferences();
return true;
}
private boolean searchForDuplicateFiles()
{
return ( fSearchForDuplicateFiles != null ) ? fSearchForDuplicateFiles.isSelected() : false;
private boolean searchForDuplicateFiles() {
return (fSearchForDuplicateFiles != null) ? fSearchForDuplicateFiles.isSelected() : false;
}
private void setSearchForDuplicateFiles( boolean search )
{
private void setSearchForDuplicateFiles( boolean search ) {
if ( fSearchForDuplicateFiles != null )
fSearchForDuplicateFiles.setSelection( search );
}
private void setValues()
{
private void setValues() {
setSourceLocations( CDebugCorePlugin.getDefault().getCommonSourceLocations() );
setSearchForDuplicateFiles( CDebugCorePlugin.getDefault().getPluginPreferences().getBoolean( ICDebugConstants.PREF_SEARCH_DUPLICATE_FILES ) );
}
private void storeValues()
{
private void storeValues() {
CDebugCorePlugin.getDefault().saveCommonSourceLocations( getSourceLocations() );
CDebugCorePlugin.getDefault().getPluginPreferences().setValue( ICDebugConstants.PREF_SEARCH_DUPLICATE_FILES, searchForDuplicateFiles() );
}

View file

@ -1,8 +1,9 @@
/*
*(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.wizards;
import org.eclipse.cdt.debug.core.sourcelookup.IDirectorySourceLocation;
@ -25,67 +26,58 @@ import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
/**
* Enter type comment.
*
* @since: Dec 12, 2002
*/
public class AddDirectorySourceLocationBlock
{
public class AddDirectorySourceLocationBlock {
private Composite fControl = null;
private Text fLocationText = null;
private Text fAssociationText = null;
private Button fAssocitedCheckButton = null;
private Button fSearchSubfoldersButton = null;
private Shell fShell = null;
private IPath fInitialAssosciationPath = null;
/**
* Constructor for AddDirectorySourceLocationBlock.
*/
public AddDirectorySourceLocationBlock( IPath initialAssosciationPath )
{
public AddDirectorySourceLocationBlock( IPath initialAssosciationPath ) {
fInitialAssosciationPath = initialAssosciationPath;
}
public void createControl( Composite parent )
{
public void createControl( Composite parent ) {
fShell = parent.getShell();
fControl = new Composite( parent, SWT.NONE );
fControl.setLayout( new GridLayout() );
fControl.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
fControl.setFont( JFaceResources.getDialogFont() );
fControl.setFont( JFaceResources.getDialogFont() );
createLocationControls( fControl );
createAssociationControls( fControl );
createSearchSubfoldersButton( fControl );
setInitialAssociationPath();
}
private void setInitialAssociationPath()
{
fAssociationText.setEnabled( ( fInitialAssosciationPath != null ) );
fAssocitedCheckButton.setSelection( ( fInitialAssosciationPath != null ) );
if ( fInitialAssosciationPath != null )
{
private void setInitialAssociationPath() {
fAssociationText.setEnabled( (fInitialAssosciationPath != null) );
fAssocitedCheckButton.setSelection( (fInitialAssosciationPath != null) );
if ( fInitialAssosciationPath != null ) {
fAssociationText.setText( fInitialAssosciationPath.toOSString() );
}
}
public Control getControl()
{
public Control getControl() {
return fControl;
}
protected void createLocationControls( Composite parent )
{
protected void createLocationControls( Composite parent ) {
PixelConverter converter = new PixelConverter( parent );
Label label = new Label( parent, SWT.NONE );
label.setText( CDebugUIPlugin.getResourceString("AddDirectorySourceLocationBlock.Select_location_directory") ); //$NON-NLS-1$
label.setText( WizardMessages.getString( "AddDirectorySourceLocationBlock.0" ) ); //$NON-NLS-1$
label.setLayoutData( new GridData( GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL ) );
Composite composite = new Composite( parent, SWT.NONE );
composite.setLayout( new GridLayout( 2, false ) );
@ -94,159 +86,135 @@ public class AddDirectorySourceLocationBlock
composite.setLayoutData( data );
fLocationText = new Text( composite, SWT.SINGLE | SWT.BORDER );
fLocationText.setLayoutData( new GridData( GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL ) );
Button button = createButton( composite, CDebugUIPlugin.getResourceString("AddDirectorySourceLocationBlock.Browse") ); //$NON-NLS-1$
button.addSelectionListener( new SelectionAdapter()
{
/* (non-Javadoc)
* @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(SelectionEvent)
*/
public void widgetSelected( SelectionEvent e )
{
selectLocation();
}
} );
Button button = createButton( composite, WizardMessages.getString( "AddDirectorySourceLocationBlock.1" ) ); //$NON-NLS-1$
button.addSelectionListener( new SelectionAdapter() {
/*
* (non-Javadoc)
*
* @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(SelectionEvent)
*/
public void widgetSelected( SelectionEvent e ) {
selectLocation();
}
} );
}
protected void selectLocation()
{
protected void selectLocation() {
DirectoryDialog dialog = new DirectoryDialog( fShell );
dialog.setMessage( CDebugUIPlugin.getResourceString("AddDirectorySourceLocationBlock.Select_Location_Directory") ); //$NON-NLS-1$
dialog.setMessage( WizardMessages.getString( "AddDirectorySourceLocationBlock.2" ) ); //$NON-NLS-1$
String result = dialog.open();
if ( result != null )
{
if ( result != null ) {
fLocationText.setText( result );
}
}
protected void createAssociationControls( Composite parent )
{
protected void createAssociationControls( Composite parent ) {
Composite composite = new Composite( parent, SWT.NONE );
composite.setLayout( new GridLayout() );
GridData data = new GridData( GridData.FILL_BOTH );
composite.setLayoutData( data );
fAssocitedCheckButton = new Button( composite, SWT.CHECK );
fAssocitedCheckButton.setText( CDebugUIPlugin.getResourceString("AddDirectorySourceLocationBlock.Associate_with") ); //$NON-NLS-1$
fAssocitedCheckButton.setText( WizardMessages.getString( "AddDirectorySourceLocationBlock.3" ) ); //$NON-NLS-1$
fAssociationText = new Text( composite, SWT.SINGLE | SWT.BORDER );
fAssociationText.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
fAssocitedCheckButton.addSelectionListener( new SelectionAdapter()
{
/* (non-Javadoc)
* @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(SelectionEvent)
*/
public void widgetSelected(SelectionEvent e)
{
associationSelectionChanged();
}
fAssocitedCheckButton.addSelectionListener( new SelectionAdapter() {
} );
/*
* (non-Javadoc)
*
* @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(SelectionEvent)
*/
public void widgetSelected( SelectionEvent e ) {
associationSelectionChanged();
}
} );
}
protected void associationSelectionChanged()
{
protected void associationSelectionChanged() {
boolean checked = fAssocitedCheckButton.getSelection();
fAssociationText.setEnabled( checked );
if ( !checked )
fAssociationText.setText( "" ); //$NON-NLS-1$
}
protected void createSearchSubfoldersButton( Composite parent )
{
protected void createSearchSubfoldersButton( Composite parent ) {
Composite composite = new Composite( parent, SWT.NONE );
composite.setLayout( new GridLayout() );
GridData data = new GridData( GridData.FILL_BOTH );
composite.setLayoutData( data );
fSearchSubfoldersButton = new Button( composite, SWT.CHECK );
fSearchSubfoldersButton.setText( CDebugUIPlugin.getResourceString("AddDirectorySourceLocationBlock.Search_subfolders") ); //$NON-NLS-1$
fSearchSubfoldersButton.setText( WizardMessages.getString( "AddDirectorySourceLocationBlock.4" ) ); //$NON-NLS-1$
}
protected Button createButton( Composite parent, String label )
{
protected Button createButton( Composite parent, String label ) {
Button button = new Button( parent, SWT.PUSH );
button.setText( label );
GridData data = new GridData( GridData.END );
button.setLayoutData( data );
SWTUtil.setButtonDimensionHint( button );
button.setFont( parent.getFont() );
return button;
}
public String getLocationPath()
{
public String getLocationPath() {
return fLocationText.getText().trim();
}
public String getAssociationPath()
{
if ( fAssocitedCheckButton.getSelection() )
{
public String getAssociationPath() {
if ( fAssocitedCheckButton.getSelection() ) {
return fAssociationText.getText().trim();
}
return ""; //$NON-NLS-1$
}
public boolean searchSubfolders()
{
return ( fSearchSubfoldersButton != null ) ? fSearchSubfoldersButton.getSelection() : false;
public boolean searchSubfolders() {
return (fSearchSubfoldersButton != null) ? fSearchSubfoldersButton.getSelection() : false;
}
public IDirectorySourceLocation getSourceLocation()
{
if ( isLocationPathValid() )
{
Path association = ( isAssociationPathValid() ) ? new Path( getAssociationPath() ) : null;
public IDirectorySourceLocation getSourceLocation() {
if ( isLocationPathValid() ) {
Path association = (isAssociationPathValid()) ? new Path( getAssociationPath() ) : null;
return SourceLookupFactory.createDirectorySourceLocation( new Path( getLocationPath() ), association, searchSubfolders() );
}
}
return null;
}
public void addDirectoryModifyListener( ModifyListener listener )
{
if ( fLocationText != null )
{
public void addDirectoryModifyListener( ModifyListener listener ) {
if ( fLocationText != null ) {
fLocationText.addModifyListener( listener );
}
}
public void addAssociationModifyListener( ModifyListener listener )
{
if ( fAssociationText != null )
{
public void addAssociationModifyListener( ModifyListener listener ) {
if ( fAssociationText != null ) {
fAssociationText.addModifyListener( listener );
}
}
public void removeDirectoryModifyListener( ModifyListener listener )
{
if ( fLocationText != null )
{
public void removeDirectoryModifyListener( ModifyListener listener ) {
if ( fLocationText != null ) {
fLocationText.removeModifyListener( listener );
}
}
public void removeAssociationModifyListener( ModifyListener listener )
{
if ( fAssociationText != null )
{
public void removeAssociationModifyListener( ModifyListener listener ) {
if ( fAssociationText != null ) {
fAssociationText.removeModifyListener( listener );
}
}
private boolean isLocationPathValid()
{
if ( fLocationText != null && Path.EMPTY.isValidPath( fLocationText.getText().trim() ) )
{
private boolean isLocationPathValid() {
if ( fLocationText != null && Path.EMPTY.isValidPath( fLocationText.getText().trim() ) ) {
Path path = new Path( fLocationText.getText().trim() );
return ( path.toFile().exists() && path.toFile().isAbsolute() );
return (path.toFile().exists() && path.toFile().isAbsolute());
}
return false;
}
public boolean isAssociationPathValid()
{
public boolean isAssociationPathValid() {
String pathString = getAssociationPath();
if ( pathString.length() > 0 )
{
if ( pathString.length() > 0 ) {
return Path.EMPTY.isValidPath( pathString );
}
return true;

View file

@ -1,12 +1,16 @@
/*
*(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.wizards;
import java.io.File;
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocation;
import org.eclipse.cdt.debug.core.sourcelookup.IDirectorySourceLocation;
import org.eclipse.cdt.debug.internal.ui.CDebugImages;
@ -23,36 +27,27 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
/**
*
* Enter type comment.
*
* @since Dec 23, 2002
* The wizard to add a file system directory based source location to the source locator.
*/
public class AddDirectorySourceLocationWizard extends Wizard implements INewSourceLocationWizard
{
public class AddDirectorySourceLocationWizard extends Wizard implements INewSourceLocationWizard {
protected static final String PAGE_NAME = "AddDirectorySourceLocationWizardPage"; //$NON-NLS-1$
/**
*
* Enter type comment.
*
* @since Dec 25, 2002
*/
public class AddDirtectorySourceLocationWizardPage extends WizardPage
{
public class AddDirtectorySourceLocationWizardPage extends WizardPage {
private AddDirectorySourceLocationBlock fAttachBlock;
/**
* Constructor for AddDirtectorySourceLocationWizardPage.
*
* @param pageName
* @param title
* @param titleImage
*/
public AddDirtectorySourceLocationWizardPage( AddDirectorySourceLocationWizard wizard, IPath initialAssociationPath )
{
super( PAGE_NAME, CDebugUIPlugin.getResourceString("internal.ui.wizards.AddDirectorySourceLocationWizard.Select_Directory"), CDebugImages.DESC_WIZBAN_ADD_DIR_SOURCE_LOCATION ); //$NON-NLS-1$
setWindowTitle( CDebugUIPlugin.getResourceString("internal.ui.wizards.AddDirectorySourceLocationWizard.WindowTitle") ); //$NON-NLS-1$
setMessage( CDebugUIPlugin.getResourceString("internal.ui.wizards.AddDirectorySourceLocationWizard.WindowMessage") ); //$NON-NLS-1$
public AddDirtectorySourceLocationWizardPage( AddDirectorySourceLocationWizard wizard, IPath initialAssociationPath ) {
super( PAGE_NAME, WizardMessages.getString( "AddDirectorySourceLocationWizard.0" ), CDebugImages.DESC_WIZBAN_ADD_DIR_SOURCE_LOCATION ); //$NON-NLS-1$
setWindowTitle( WizardMessages.getString( "AddDirectorySourceLocationWizard.1" ) ); //$NON-NLS-1$
setMessage( WizardMessages.getString( "AddDirectorySourceLocationWizard.2" ) ); //$NON-NLS-1$
setWizard( wizard );
fAttachBlock = new AddDirectorySourceLocationBlock( initialAssociationPath );
}
@ -60,98 +55,82 @@ public class AddDirectorySourceLocationWizard extends Wizard implements INewSour
/**
* @see org.eclipse.jface.dialogs.IDialogPage#createControl(Composite)
*/
public void createControl( Composite parent )
{
public void createControl( Composite parent ) {
Composite composite = new Composite( parent, SWT.NULL );
composite.setLayout( new GridLayout() );
composite.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
fAttachBlock.createControl( composite );
fAttachBlock.addDirectoryModifyListener( new ModifyListener()
{
public void modifyText( ModifyEvent e )
{
directoryChanged();
}
} );
fAttachBlock.addDirectoryModifyListener( new ModifyListener() {
fAttachBlock.addAssociationModifyListener( new ModifyListener()
{
public void modifyText( ModifyEvent e )
{
associationChanged();
}
} );
public void modifyText( ModifyEvent e ) {
directoryChanged();
}
} );
fAttachBlock.addAssociationModifyListener( new ModifyListener() {
public void modifyText( ModifyEvent e ) {
associationChanged();
}
} );
setControl( composite );
updateState();
}
protected void directoryChanged()
{
protected void directoryChanged() {
updateState();
}
protected void associationChanged()
{
protected void associationChanged() {
updateState();
}
private void updateState()
{
private void updateState() {
boolean complete = true;
setErrorMessage( null );
String dirText = fAttachBlock.getLocationPath();
if ( dirText.length() == 0 )
{
setErrorMessage( CDebugUIPlugin.getResourceString("internal.ui.wizards.AddDirectorySourceLocationWizard.ErrorDirectoryEmpty") ); //$NON-NLS-1$
if ( dirText.length() == 0 ) {
setErrorMessage( CDebugUIPlugin.getResourceString( "internal.ui.wizards.AddDirectorySourceLocationWizard.ErrorDirectoryEmpty" ) ); //$NON-NLS-1$
complete = false;
}
else
{
else {
File file = new File( dirText );
if ( !file.exists() || !file.isDirectory() )
{
setErrorMessage( CDebugUIPlugin.getResourceString("internal.ui.wizards.AddDirectorySourceLocationWizard.ErrorDirectoryDoesNotExist") ); //$NON-NLS-1$
if ( !file.exists() || !file.isDirectory() ) {
setErrorMessage( WizardMessages.getString( "AddDirectorySourceLocationWizard.3" ) ); //$NON-NLS-1$
complete = false;
}
else if ( !file.isAbsolute() )
{
setErrorMessage( CDebugUIPlugin.getResourceString("internal.ui.wizards.AddDirectorySourceLocationWizard.ErrorDirectoryMustBeAbsolute") ); //$NON-NLS-1$
else if ( !file.isAbsolute() ) {
setErrorMessage( WizardMessages.getString( "AddDirectorySourceLocationWizard.4" ) ); //$NON-NLS-1$
complete = false;
}
}
setPageComplete( complete );
}
private IDirectorySourceLocation getSourceLocation()
{
private IDirectorySourceLocation getSourceLocation() {
return fAttachBlock.getSourceLocation();
}
protected boolean finish()
{
protected boolean finish() {
fSourceLocation = getSourceLocation();
return ( fSourceLocation != null );
return (fSourceLocation != null);
}
}
protected IDirectorySourceLocation fSourceLocation = null;
private IPath fInitialAssociationPath = null;
/**
* Constructor for AddDirectorySourceLocationWizard.
*/
public AddDirectorySourceLocationWizard()
{
public AddDirectorySourceLocationWizard() {
super();
}
/**
* Constructor for AddDirectorySourceLocationWizard.
*/
public AddDirectorySourceLocationWizard( IPath initialAssociationPath )
{
public AddDirectorySourceLocationWizard( IPath initialAssociationPath ) {
super();
fInitialAssociationPath = initialAssociationPath;
}
@ -159,11 +138,9 @@ public class AddDirectorySourceLocationWizard extends Wizard implements INewSour
/**
* @see org.eclipse.jface.wizard.IWizard#performFinish()
*/
public boolean performFinish()
{
public boolean performFinish() {
AddDirtectorySourceLocationWizardPage page = (AddDirtectorySourceLocationWizardPage)getStartingPage();
if ( page != null )
{
if ( page != null ) {
return page.finish();
}
return false;
@ -172,24 +149,21 @@ public class AddDirectorySourceLocationWizard extends Wizard implements INewSour
/**
* @see org.eclipse.cdt.debug.ui.sourcelookup.INewSourceLocationWizard#getDescription()
*/
public String getDescription()
{
return CDebugUIPlugin.getResourceString("internal.ui.wizards.AddDirectorySourceLocationWizard.Description"); //$NON-NLS-1$
public String getDescription() {
return WizardMessages.getString( "AddDirectorySourceLocationWizard.5" ); //$NON-NLS-1$
}
/**
* @see org.eclipse.jface.wizard.IWizard#addPages()
*/
public void addPages()
{
public void addPages() {
addPage( new AddDirtectorySourceLocationWizardPage( this, fInitialAssociationPath ) );
}
/**
* @see org.eclipse.cdt.debug.ui.sourcelookup.INewSourceLocationWizard#getSourceLocation()
*/
public ICSourceLocation getSourceLocation()
{
public ICSourceLocation getSourceLocation() {
return fSourceLocation;
}
}

View file

@ -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.wizards;
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocation;
@ -20,42 +25,29 @@ import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
/**
*
* Enter type comment.
*
* @since Dec 23, 2002
* The wizard to add a project based source location to the source locator.
*/
public class AddProjectSourceLocationWizard extends Wizard implements INewSourceLocationWizard
{
public class AddProjectSourceLocationWizard extends Wizard implements INewSourceLocationWizard {
protected static final String PAGE_NAME = "AddProjectSourceLocationWizardPage"; //$NON-NLS-1$
protected IProject[] fProjects = null;
protected IProjectSourceLocation fSourceLocation = null;
/**
*
* Enter type comment.
*
* @since Dec 27, 2002
*/
public class AddProjectSourceLocationWizardPage extends WizardPage
implements ISelectionChangedListener, IDoubleClickListener
{
public class AddProjectSourceLocationWizardPage extends WizardPage implements ISelectionChangedListener, IDoubleClickListener {
private AddProjectSourceLocationBlock fBlock;
/**
* Constructor for AddProjectSourceLocationWizardPage.
* @param pageName
*/
public AddProjectSourceLocationWizardPage( AddProjectSourceLocationWizard wizard )
{
super( PAGE_NAME, CDebugUIPlugin.getResourceString("internal.ui.wizards.AddProjectSourceLocationWizard.Select_Project"), CDebugImages.DESC_WIZBAN_ADD_PRJ_SOURCE_LOCATION ); //$NON-NLS-1$
setWindowTitle( CDebugUIPlugin.getResourceString("internal.ui.wizards.AddProjectSourceLocationWizard.WindowTitle") ); //$NON-NLS-1$
setMessage( CDebugUIPlugin.getResourceString("internal.ui.wizards.AddProjectSourceLocationWizard.AddProjectLocationMessage") ); //$NON-NLS-1$
public AddProjectSourceLocationWizardPage( AddProjectSourceLocationWizard wizard ) {
super( PAGE_NAME, WizardMessages.getString( "AddProjectSourceLocationWizard.0" ), CDebugImages.DESC_WIZBAN_ADD_PRJ_SOURCE_LOCATION ); //$NON-NLS-1$
setWindowTitle( WizardMessages.getString( "AddProjectSourceLocationWizard.1" ) ); //$NON-NLS-1$
setMessage( WizardMessages.getString( "AddProjectSourceLocationWizard.2" ) ); //$NON-NLS-1$
setWizard( wizard );
fBlock = new AddProjectSourceLocationBlock( fProjects );
setPageComplete( false );
@ -64,49 +56,41 @@ public class AddProjectSourceLocationWizard extends Wizard implements INewSource
/**
* @see org.eclipse.jface.dialogs.IDialogPage#createControl(Composite)
*/
public void createControl( Composite parent )
{
public void createControl( Composite parent ) {
Composite composite = new Composite( parent, SWT.NULL );
composite.setLayout( new GridLayout() );
composite.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
fBlock.createControl( composite );
fBlock.addDoubleClickListener( this );
fBlock.addSelectionChangedListener( this );
setControl( composite );
}
/**
* @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(SelectionChangedEvent)
*/
public void selectionChanged( SelectionChangedEvent event )
{
public void selectionChanged( SelectionChangedEvent event ) {
setPageComplete( !event.getSelection().isEmpty() );
}
/**
* @see org.eclipse.jface.viewers.IDoubleClickListener#doubleClick(DoubleClickEvent)
*/
public void doubleClick( DoubleClickEvent event )
{
public void doubleClick( DoubleClickEvent event ) {
}
protected boolean finish()
{
if ( fBlock != null )
{
protected boolean finish() {
if ( fBlock != null ) {
fSourceLocation = fBlock.getSourceLocation();
}
return ( fSourceLocation != null );
return (fSourceLocation != null);
}
}
/**
* Constructor for AddProjectSourceLocationWizard.
*/
public AddProjectSourceLocationWizard( IProject[] projects )
{
public AddProjectSourceLocationWizard( IProject[] projects ) {
super();
fProjects = projects;
}
@ -114,11 +98,9 @@ public class AddProjectSourceLocationWizard extends Wizard implements INewSource
/**
* @see org.eclipse.jface.wizard.IWizard#performFinish()
*/
public boolean performFinish()
{
public boolean performFinish() {
AddProjectSourceLocationWizardPage page = (AddProjectSourceLocationWizardPage)getStartingPage();
if ( page != null )
{
if ( page != null ) {
return page.finish();
}
return false;
@ -127,24 +109,21 @@ public class AddProjectSourceLocationWizard extends Wizard implements INewSource
/**
* @see org.eclipse.cdt.debug.ui.sourcelookup.INewSourceLocationWizard#getDescription()
*/
public String getDescription()
{
return CDebugUIPlugin.getResourceString("internal.ui.wizards.AddProjectSourceLocationWizard.Description"); //$NON-NLS-1$
public String getDescription() {
return WizardMessages.getString( "AddProjectSourceLocationWizard.3" ); //$NON-NLS-1$
}
/**
* @see org.eclipse.cdt.debug.ui.sourcelookup.INewSourceLocationWizard#getSourceLocation()
*/
public ICSourceLocation getSourceLocation()
{
public ICSourceLocation getSourceLocation() {
return fSourceLocation;
}
/**
* @see org.eclipse.jface.wizard.IWizard#addPages()
*/
public void addPages()
{
public void addPages() {
addPage( new AddProjectSourceLocationWizardPage( this ) );
}
}

View file

@ -1,56 +1,57 @@
/*
*(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.wizards;
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocation;
import org.eclipse.cdt.debug.ui.sourcelookup.INewSourceLocationWizard;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
/**
* Enter type comment.
*
* @since: Dec 20, 2002
* The wizard to add a source location to the source locator.
*/
public class AddSourceLocationWizard extends Wizard implements INewSourceLocationWizard
{
public class AddSourceLocationWizard extends Wizard implements INewSourceLocationWizard {
private ICSourceLocation[] fLocations = null;
/**
* Constructor for AddSourceLocationWizard.
*/
public AddSourceLocationWizard( ICSourceLocation[] locations )
{
public AddSourceLocationWizard( ICSourceLocation[] locations ) {
super();
setWindowTitle( CDebugUIPlugin.getResourceString("AddSourceLocationWizard.Window_Title") ); //$NON-NLS-1$
setWindowTitle( WizardMessages.getString( "AddSourceLocationWizard.0" ) ); //$NON-NLS-1$
setForcePreviousAndNextButtons( true );
fLocations = locations;
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.wizard.IWizard#performFinish()
*/
public boolean performFinish()
{
public boolean performFinish() {
return false;
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.wizard.Wizard#addPages()
*/
public void addPages()
{
public void addPages() {
addPage( new SourceLocationSelectionPage( fLocations ) );
}
public ICSourceLocation getSourceLocation()
{
public ICSourceLocation getSourceLocation() {
SourceLocationSelectionPage page = (SourceLocationSelectionPage)getStartingPage();
if ( page != null )
{
if ( page != null ) {
return page.getSourceLocation();
}
return null;
@ -59,8 +60,7 @@ public class AddSourceLocationWizard extends Wizard implements INewSourceLocatio
/**
* @see org.eclipse.cdt.debug.ui.sourcelookup.INewSourceLocationWizard#getDescription()
*/
public String getDescription()
{
public String getDescription() {
return ""; //$NON-NLS-1$
}
}
}

View file

@ -1,12 +1,16 @@
/*
*(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.wizards;
import java.util.ArrayList;
import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocation;
import org.eclipse.cdt.debug.core.sourcelookup.IProjectSourceLocation;
@ -33,131 +37,107 @@ import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Table;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
/**
*
* Enter type comment.
*
* @since Dec 24, 2002
* The source lookup properties of debug sessions.
*/
public class SourceLocationSelectionPage extends WizardSelectionPage
implements ISelectionChangedListener,
IDoubleClickListener
{
private static final String PAGE_NAME = CDebugUIPlugin.getResourceString("internal.ui.preferences.SourceLocationSelectionPage.Add_Source_Location"); //$NON-NLS-1$
public class SourceLocationSelectionPage extends WizardSelectionPage implements ISelectionChangedListener, IDoubleClickListener {
private static final String PAGE_NAME = WizardMessages.getString( "SourceLocationSelectionPage.0" ); //$NON-NLS-1$
private final static int SIZING_LISTS_HEIGHT = 200;
private final static int SIZING_LISTS_WIDTH = 150;
protected TableViewer fWizardSelectionViewer;
protected Object[] fElements = null;
/**
* Constructor for SourceLocationSelectionPage.
*
* @param pageName
*/
public SourceLocationSelectionPage( ICSourceLocation[] locations )
{
public SourceLocationSelectionPage( ICSourceLocation[] locations ) {
super( PAGE_NAME );
setTitle( CDebugUIPlugin.getResourceString("internal.ui.preferences.SourceLocationSelectionPage.WindowTitle") ); //$NON-NLS-1$
setTitle( WizardMessages.getString( "SourceLocationSelectionPage.1" ) ); //$NON-NLS-1$
setImageDescriptor( CDebugImages.DESC_WIZBAN_ADD_SOURCE_LOCATION );
fElements = new Object[] { new AddProjectSourceLocationWizard( getProjectList( locations ) ),
new AddDirectorySourceLocationWizard() };
fElements = new Object[]{ new AddProjectSourceLocationWizard( getProjectList( locations ) ), new AddDirectorySourceLocationWizard() };
}
/**
* @see org.eclipse.jface.dialogs.IDialogPage#createControl(Composite)
*/
public void createControl( Composite parent )
{
public void createControl( Composite parent ) {
// create composite for page.
Composite outerContainer = new Composite( parent, SWT.NONE );
outerContainer.setLayout( new GridLayout() );
outerContainer.setLayoutData( new GridData( GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL ) );
new Label( outerContainer, SWT.NONE ).setText( CDebugUIPlugin.getResourceString("internal.ui.preferences.SourceLocationSelectionPage.Select_source_location_type") ); //$NON-NLS-1$
new Label( outerContainer, SWT.NONE ).setText( WizardMessages.getString( "SourceLocationSelectionPage.2" ) ); //$NON-NLS-1$
//Create a table for the list
Table table = new Table( outerContainer, SWT.BORDER );
GridData data = new GridData( GridData.FILL_HORIZONTAL );
data.widthHint = SIZING_LISTS_WIDTH;
data.heightHint = SIZING_LISTS_HEIGHT;
table.setLayoutData( data );
// the list viewer
// the list viewer
fWizardSelectionViewer = new TableViewer( table );
fWizardSelectionViewer.setContentProvider( new IStructuredContentProvider()
{
public Object[] getElements( Object inputElement )
{
return fElements;
}
public void inputChanged( Viewer viewer, Object oldInput, Object newInput )
{
}
fWizardSelectionViewer.setContentProvider( new IStructuredContentProvider() {
public void dispose()
{
}
} );
fWizardSelectionViewer.setLabelProvider( new LabelProvider()
{
public String getText( Object element )
{
if ( element instanceof AddProjectSourceLocationWizard )
{
return CDebugUIPlugin.getResourceString("internal.ui.preferences.SourceLocationSelectionPage.Existing_Project_Into_Workspace"); //$NON-NLS-1$
}
if ( element instanceof AddDirectorySourceLocationWizard )
{
return CDebugUIPlugin.getResourceString("internal.ui.preferences.SourceLocationSelectionPage.File_System_Directory"); //$NON-NLS-1$
}
return super.getText( element );
}
public Object[] getElements( Object inputElement ) {
return fElements;
}
/**
* @see org.eclipse.jface.viewers.LabelProvider#getImage(Object)
*/
public Image getImage(Object element)
{
if ( element instanceof AddProjectSourceLocationWizard )
{
return CDebugImages.get( CDebugImages.IMG_TOOLS_ADD_PRJ_SOURCE_LOCATION );
}
if ( element instanceof AddDirectorySourceLocationWizard )
{
return CDebugImages.get( CDebugImages.IMG_TOOLS_ADD_DIR_SOURCE_LOCATION );
}
return super.getImage( element );
}
} );
public void inputChanged( Viewer viewer, Object oldInput, Object newInput ) {
}
public void dispose() {
}
} );
fWizardSelectionViewer.setLabelProvider( new LabelProvider() {
public String getText( Object element ) {
if ( element instanceof AddProjectSourceLocationWizard ) {
return WizardMessages.getString( "SourceLocationSelectionPage.3" ); //$NON-NLS-1$
}
if ( element instanceof AddDirectorySourceLocationWizard ) {
return WizardMessages.getString( "SourceLocationSelectionPage.4" ); //$NON-NLS-1$
}
return super.getText( element );
}
/**
* @see org.eclipse.jface.viewers.LabelProvider#getImage(Object)
*/
public Image getImage( Object element ) {
if ( element instanceof AddProjectSourceLocationWizard ) {
return CDebugImages.get( CDebugImages.IMG_TOOLS_ADD_PRJ_SOURCE_LOCATION );
}
if ( element instanceof AddDirectorySourceLocationWizard ) {
return CDebugImages.get( CDebugImages.IMG_TOOLS_ADD_DIR_SOURCE_LOCATION );
}
return super.getImage( element );
}
} );
fWizardSelectionViewer.addSelectionChangedListener( this );
fWizardSelectionViewer.addDoubleClickListener( this );
fWizardSelectionViewer.setInput( fElements );
fWizardSelectionViewer.setSelection( new StructuredSelection( fElements[0] ) );
setControl( outerContainer );
}
/**
* @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(SelectionChangedEvent)
*/
public void selectionChanged( SelectionChangedEvent event )
{
public void selectionChanged( SelectionChangedEvent event ) {
setErrorMessage( null );
IStructuredSelection selection = (IStructuredSelection)event.getSelection();
INewSourceLocationWizard currentWizardSelection = (INewSourceLocationWizard)selection.getFirstElement();
if ( currentWizardSelection == null )
{
if ( currentWizardSelection == null ) {
setMessage( null );
setSelectedNode( null );
return;
}
setSelectedNode( createWizardNode( currentWizardSelection ) );
setMessage( currentWizardSelection.getDescription() );
}
@ -165,59 +145,46 @@ public class SourceLocationSelectionPage extends WizardSelectionPage
/**
* @see org.eclipse.jface.viewers.IDoubleClickListener#doubleClick(DoubleClickEvent)
*/
public void doubleClick( DoubleClickEvent event )
{
public void doubleClick( DoubleClickEvent event ) {
selectionChanged( new SelectionChangedEvent( fWizardSelectionViewer, fWizardSelectionViewer.getSelection() ) );
getContainer().showPage( getNextPage() );
}
private IWizardNode createWizardNode( INewSourceLocationWizard wizard )
{
private IWizardNode createWizardNode( INewSourceLocationWizard wizard ) {
return new SourceLocationWizardNode( wizard );
}
/**
* @see org.eclipse.jface.dialogs.IDialogPage#dispose()
*/
public void dispose()
{
if ( fElements != null )
{
for ( int i = 0; i < fElements.length; ++i )
{
public void dispose() {
if ( fElements != null ) {
for( int i = 0; i < fElements.length; ++i ) {
((INewSourceLocationWizard)fElements[i]).dispose();
}
fElements = null;
}
super.dispose();
}
public ICSourceLocation getSourceLocation()
{
public ICSourceLocation getSourceLocation() {
return ((INewSourceLocationWizard)getSelectedNode().getWizard()).getSourceLocation();
}
private IProject[] getProjectList( ICSourceLocation[] locations )
{
private IProject[] getProjectList( ICSourceLocation[] locations ) {
ArrayList projects = new ArrayList( locations.length );
for ( int i = 0; i < locations.length; ++i )
{
if ( locations[i] instanceof IProjectSourceLocation )
{
for( int i = 0; i < locations.length; ++i ) {
if ( locations[i] instanceof IProjectSourceLocation ) {
projects.add( ((IProjectSourceLocation)locations[i]).getProject() );
}
}
IProject[] allProjects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
ArrayList result = new ArrayList( allProjects.length );
for ( int i = 0; i < allProjects.length; ++i )
{
if ( ( CoreModel.hasCNature( allProjects[i] ) || CoreModel.hasCCNature( allProjects[i] ) ) &&
allProjects[i].isOpen() &&
!projects.contains( allProjects[i] ) )
{
for( int i = 0; i < allProjects.length; ++i ) {
if ( (CoreModel.hasCNature( allProjects[i] ) || CoreModel.hasCCNature( allProjects[i] )) && allProjects[i].isOpen() && !projects.contains( allProjects[i] ) ) {
result.add( allProjects[i] );
}
}
return (IProject[])result.toArray( new IProject[result.size()] );
}
}
}

View file

@ -0,0 +1,37 @@
/**********************************************************************
* 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.wizards;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
/**
* 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 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 );
}
catch( MissingResourceException e ) {
return '!' + key + '!';
}
}
}

View file

@ -0,0 +1,21 @@
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.
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

View file

@ -7,7 +7,7 @@
*
* Contributors:
* QNX Software Systems - Initial API and implementation
***********************************************************************/
***********************************************************************/
package org.eclipse.cdt.debug.ui;
import java.text.MessageFormat;
@ -55,15 +55,16 @@ import org.osgi.framework.BundleContext;
/**
* The main plugin class to be used in the desktop.
*/
public class CDebugUIPlugin extends AbstractUIPlugin implements ISelectionListener
{
public class CDebugUIPlugin extends AbstractUIPlugin implements ISelectionListener {
/**
* The plug-in identifier (value <code>"org.eclipse.cdt.debug.ui"</code>).
*/
public static final String PLUGIN_ID = "org.eclipse.cdt.debug.ui" ; //$NON-NLS-1$
public static final String PLUGIN_ID = "org.eclipse.cdt.debug.ui"; //$NON-NLS-1$
//The shared instance.
private static CDebugUIPlugin plugin;
//Resource bundle.
private ResourceBundle resourceBundle;
@ -74,17 +75,13 @@ public class CDebugUIPlugin extends AbstractUIPlugin implements ISelectionListen
/**
* The constructor.
*/
public CDebugUIPlugin()
{
public CDebugUIPlugin() {
super();
plugin = this;
try
{
resourceBundle =
ResourceBundle.getBundle( "org.eclipse.cdt.debug.ui.CDebugUIPluginResources" ); //$NON-NLS-1$
try {
resourceBundle = ResourceBundle.getBundle( "org.eclipse.cdt.debug.ui.CDebugUIPluginResources" ); //$NON-NLS-1$
}
catch( MissingResourceException x )
{
catch( MissingResourceException x ) {
resourceBundle = null;
}
}
@ -92,60 +89,57 @@ public class CDebugUIPlugin extends AbstractUIPlugin implements ISelectionListen
/**
* Returns the shared instance.
*/
public static CDebugUIPlugin getDefault()
{
public static CDebugUIPlugin getDefault() {
return plugin;
}
/**
* Returns the workspace instance.
*/
public static IWorkspace getWorkspace()
{
public static IWorkspace getWorkspace() {
return ResourcesPlugin.getWorkspace();
}
/**
* Returns the string from the plugin's resource bundle,
* or 'key' if not found.
* Returns the string from the plugin's resource bundle, or 'key' if not found.
*/
public static String getResourceString(String key)
{
public static String getResourceString( String key ) {
ResourceBundle bundle = CDebugUIPlugin.getDefault().getResourceBundle();
try {
try {
return bundle.getString( key );
} catch (MissingResourceException e) {
}
catch( MissingResourceException e ) {
return '!' + key + '!';
} catch (NullPointerException e) {
}
catch( NullPointerException e ) {
return '#' + key + '#';
}
}
public static String getFormattedString(String key, String arg) {
return MessageFormat.format(getResourceString(key), new String[] { arg });
}
public static String getFormattedString(String key, Integer arg) {
return MessageFormat.format(getResourceString(key), new Object[] { arg });
public static String getFormattedString( String key, String arg ) {
return MessageFormat.format( getResourceString( key ), new String[]{ arg } );
}
public static String getFormattedString(String key, String[] args) {
return MessageFormat.format(getResourceString(key), args);
public static String getFormattedString( String key, Integer arg ) {
return MessageFormat.format( getResourceString( key ), new Object[]{ arg } );
}
public static String getFormattedString( String key, String[] args ) {
return MessageFormat.format( getResourceString( key ), args );
}
/**
* Returns the plugin's resource bundle,
*/
public ResourceBundle getResourceBundle()
{
public ResourceBundle getResourceBundle() {
return resourceBundle;
}
/**
* Convenience method which returns the unique identifier of this plugin.
*/
public static String getUniqueIdentifier()
{
if ( getDefault() == null )
{
public static String getUniqueIdentifier() {
if ( getDefault() == null ) {
// If the default instance is not yet initialized,
// return a static identifier. This identifier must
// match the plugin id defined in plugin.xml
@ -155,67 +149,64 @@ public class CDebugUIPlugin extends AbstractUIPlugin implements ISelectionListen
}
/**
* Returns the a color based on the type of output.
* Valid types:
* Returns the a color based on the type of output. Valid types:
* <li>CHANGED_REGISTER_RGB</li>
*/
public static Color getPreferenceColor( String type )
{
return ColorManager.getDefault().getColor(
PreferenceConverter.getColor( getDefault().getPreferenceStore(), type ) );
public static Color getPreferenceColor( String type ) {
return ColorManager.getDefault().getColor( PreferenceConverter.getColor( getDefault().getPreferenceStore(), type ) );
}
public static CDTDebugModelPresentation getDebugModelPresentation()
{
public static CDTDebugModelPresentation getDebugModelPresentation() {
return CDTDebugModelPresentation.getDefault();
}
/**
* Logs the specified status with this plug-in's log.
*
* @param status status to log
* @param status
* status to log
*/
public static void log( IStatus status )
{
public static void log( IStatus status ) {
getDefault().getLog().log( status );
}
/**
* Logs an internal error with the specified throwable
*
* @param e the exception to be logged
*/
public static void log( Throwable e )
{
* @param e
* the exception to be logged
*/
public static void log( Throwable e ) {
log( new Status( IStatus.ERROR, getUniqueIdentifier(), ICDebugUIConstants.INTERNAL_ERROR, "Internal Error", e ) ); //$NON-NLS-1$
}
/**
* Logs an internal error with the specified message.
*
* @param message the error message to log
* @param message
* the error message to log
*/
public static void logErrorMessage( String message )
{
public static void logErrorMessage( String message ) {
log( new Status( IStatus.ERROR, getUniqueIdentifier(), ICDebugUIConstants.INTERNAL_ERROR, message, null ) );
}
public ILaunchConfigurationTab getDebuggerPage(String debuggerID) {
if (fDebuggerPageMap == null) {
public ILaunchConfigurationTab getDebuggerPage( String debuggerID ) {
if ( fDebuggerPageMap == null ) {
initializeDebuggerPageMap();
}
IConfigurationElement configElement = (IConfigurationElement) fDebuggerPageMap.get(debuggerID);
IConfigurationElement configElement = (IConfigurationElement)fDebuggerPageMap.get( debuggerID );
ILaunchConfigurationTab tab = null;
if (configElement != null) {
if ( configElement != null ) {
try {
tab = (ILaunchConfigurationTab) configElement.createExecutableExtension("class"); //$NON-NLS-1$
} catch(CoreException ce) {
log(new Status(IStatus.ERROR, getUniqueIdentifier(), 100, "An error occurred retrieving a C Debugger page", ce)); //$NON-NLS-1$
tab = (ILaunchConfigurationTab)configElement.createExecutableExtension( "class" ); //$NON-NLS-1$
}
catch( CoreException ce ) {
log( new Status( IStatus.ERROR, getUniqueIdentifier(), 100, "An error occurred retrieving a C Debugger page", ce ) ); //$NON-NLS-1$
}
}
return tab;
}
protected void initializeDebuggerPageMap() {
fDebuggerPageMap = new HashMap( 10 );
IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint( PLUGIN_ID, "CDebuggerPage" ); //$NON-NLS-1$
@ -226,24 +217,20 @@ public class CDebugUIPlugin extends AbstractUIPlugin implements ISelectionListen
}
}
public static void errorDialog( String message, IStatus status )
{
public static void errorDialog( String message, IStatus status ) {
log( status );
Shell shell = getActiveWorkbenchShell();
if ( shell != null )
{
ErrorDialog.openError( shell, CDebugUIPlugin.getResourceString("ui.CDebugUIPlugin.Error"), message, status ); //$NON-NLS-1$
if ( shell != null ) {
ErrorDialog.openError( shell, CDebugUIPlugin.getResourceString( "ui.CDebugUIPlugin.Error" ), message, status ); //$NON-NLS-1$
}
}
public static void errorDialog( String message, Throwable t )
{
public static void errorDialog( String message, Throwable t ) {
log( t );
Shell shell = getActiveWorkbenchShell();
if ( shell != null )
{
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, CDebugUIPlugin.getResourceString( "ui.CDebugUIPlugin.Error" ), message, status ); //$NON-NLS-1$
}
}
@ -252,16 +239,13 @@ public class CDebugUIPlugin extends AbstractUIPlugin implements ISelectionListen
*
* @return the active workbench window
*/
public static IWorkbenchWindow getActiveWorkbenchWindow()
{
public static IWorkbenchWindow getActiveWorkbenchWindow() {
return getDefault().getWorkbench().getActiveWorkbenchWindow();
}
public static IWorkbenchPage getActivePage()
{
public static IWorkbenchPage getActivePage() {
IWorkbenchWindow w = getActiveWorkbenchWindow();
if ( w != null )
{
if ( w != null ) {
return w.getActivePage();
}
return null;
@ -272,23 +256,19 @@ public class CDebugUIPlugin extends AbstractUIPlugin implements ISelectionListen
*
* @return the active workbench shell or <code>null</code> if none
*/
public static Shell getActiveWorkbenchShell()
{
public static Shell getActiveWorkbenchShell() {
IWorkbenchWindow window = getActiveWorkbenchWindow();
if ( window != null )
{
if ( window != null ) {
return window.getShell();
}
return null;
}
/**
* Returns the standard display to be used. The method first checks, if
* the thread calling this method has an associated display. If so, this
* display is returned. Otherwise the method returns the default display.
* Returns the standard display to be used. The method first checks, if the thread calling this method has an associated display. If so, this display is
* returned. Otherwise the method returns the default display.
*/
public static Display getStandardDisplay()
{
public static Display getStandardDisplay() {
Display display;
display = Display.getCurrent();
if ( display == null )
@ -299,57 +279,44 @@ public class CDebugUIPlugin extends AbstractUIPlugin implements ISelectionListen
/**
* Returns the image descriptor registry used for this plugin.
*/
public static CDebugImageDescriptorRegistry getImageDescriptorRegistry()
{
if ( getDefault().fImageDescriptorRegistry == null )
{
public static CDebugImageDescriptorRegistry getImageDescriptorRegistry() {
if ( getDefault().fImageDescriptorRegistry == null ) {
getDefault().fImageDescriptorRegistry = new CDebugImageDescriptorRegistry();
}
return getDefault().fImageDescriptorRegistry;
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.ISelectionListener#selectionChanged(IWorkbenchPart, ISelection)
*/
public void selectionChanged( IWorkbenchPart part, ISelection selection )
{
if ( selection != null && selection instanceof IStructuredSelection )
{
if ( ((IStructuredSelection)selection).size() == 1 )
{
public void selectionChanged( IWorkbenchPart part, ISelection selection ) {
if ( selection != null && selection instanceof IStructuredSelection ) {
if ( ((IStructuredSelection)selection).size() == 1 ) {
Object element = ((IStructuredSelection)selection).getFirstElement();
if ( element != null && element instanceof IThread )
{
if ( ((IThread)element).getDebugTarget() instanceof ISwitchToThread )
{
try
{
if ( !sameThread( (IDebugElement)element ) )
{
if ( element != null && element instanceof IThread ) {
if ( ((IThread)element).getDebugTarget() instanceof ISwitchToThread ) {
try {
if ( !sameThread( (IDebugElement)element ) ) {
((ISwitchToThread)((IThread)element).getDebugTarget()).setCurrentThread( (IThread)element );
}
}
catch( DebugException e )
{
catch( DebugException e ) {
errorDialog( e.getMessage(), e );
}
}
}
else if ( element != null && element instanceof IStackFrame )
{
if ( ((IStackFrame)element).getThread() instanceof ISwitchToFrame )
{
try
{
if ( !sameThread( (IDebugElement)element ) )
{
else if ( element != null && element instanceof IStackFrame ) {
if ( ((IStackFrame)element).getThread() instanceof ISwitchToFrame ) {
try {
if ( !sameThread( (IDebugElement)element ) ) {
((ISwitchToThread)((IStackFrame)element).getDebugTarget()).setCurrentThread( ((IStackFrame)element).getThread() );
}
((ISwitchToFrame)((IStackFrame)element).getThread()).switchToFrame( (IStackFrame)element );
}
catch( DebugException e )
{
// errorDialog( "Switch to stack frame failed.", e );
catch( DebugException e ) {
// errorDialog( "Switch to stack frame failed.", e );
}
}
}
@ -357,41 +324,36 @@ public class CDebugUIPlugin extends AbstractUIPlugin implements ISelectionListen
}
}
private boolean sameThread( IDebugElement element ) throws DebugException
{
if ( element.getDebugTarget() instanceof ISwitchToThread )
{
if ( element instanceof IThread )
{
private boolean sameThread( IDebugElement element ) throws DebugException {
if ( element.getDebugTarget() instanceof ISwitchToThread ) {
if ( element instanceof IThread ) {
return ((IThread)element).equals( ((ISwitchToThread)element.getDebugTarget()).getCurrentThread() );
}
if ( element instanceof IStackFrame )
{
if ( element instanceof IStackFrame ) {
return ((IStackFrame)element).getThread().equals( ((ISwitchToThread)element.getDebugTarget()).getCurrentThread() );
}
}
return false;
}
public static IPersistableSourceLocator createDefaultSourceLocator()
{
public static IPersistableSourceLocator createDefaultSourceLocator() {
return new DefaultSourceLocator();
}
public static String getDefaultSourceLocatorID()
{
public static String getDefaultSourceLocatorID() {
return DefaultSourceLocator.ID_DEFAULT_SOURCE_LOCATOR;
}
/*
* to support old launch configurations
*/
public static String getDefaultSourceLocatorOldID()
{
public static String getDefaultSourceLocatorOldID() {
return DefaultSourceLocator.ID_OLD_DEFAULT_SOURCE_LOCATOR;
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
*/
public void start( BundleContext context ) throws Exception {
@ -403,7 +365,9 @@ public class CDebugUIPlugin extends AbstractUIPlugin implements ISelectionListen
CDebugCorePlugin.getDefault().addCBreakpointListener( CBreakpointUpdater.getInstance() );
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
*/
public void stop( BundleContext context ) throws Exception {
@ -417,4 +381,4 @@ public class CDebugUIPlugin extends AbstractUIPlugin implements ISelectionListen
}
super.stop( context );
}
}
}

View file

@ -1,183 +1,3 @@
internal.ui.actions.SignalActionDelegate.Unable_to_deliver_signal_to_target=Unable to deliver the signal to the target.
internal.ui.actions.SignalActionDelegate.Operation_failed=Operation failed.
internal.ui.actions.ShowRegisterTypesAction.Show_Type_Names_checkbox=Show &Type Names
internal.ui.actions.ShowRegisterTypesAction.Show_Type_Names_tooltip=Show Type Names
internal.ui.actions.LoadSymbolsForAllAction.Load_Symbols_For_all=Load Symbols For All
internal.ui.actions.LoadSymbolsForAllAction.Load_symbols_for_all_shared_libraries.=Load symbols for all shared libraries.
internal.ui.actions.LoadSymbolsForAllAction.Load_Symbols_For_All=Load Symbols For All
internal.ui.actions.LoadSymbolsForAllAction.Unable_to_load_symbols.=Unable to load symbols.
internal.ui.actions.AutoRefreshMemoryAction.Auto-Refresh=Auto-Refresh
internal.ui.actions.AutoRefreshMemoryAction.Automatically_Refresh_Memory_Block=Automatically Refresh Memory Block
internal.ui.actions.AutoRefreshMemoryAction.Auto-Refresh=Auto-Refresh
internal.ui.actions.RestartActionDelegate.Exceptions_occurred_attempting_to_restart=Exceptions occurred attempting to restart.
internal.ui.actions.RestartActionDelegate.Restart_failed=Restart failed.
internal.ui.actions.RestartActionDelegate.Restart=Restart
internal.ui.actions.RestoreDefaultTypeActionDelegate.Unable_to_cast_type=Unable to cast to type.
internal.ui.actions.CBreakpointPropertiesRulerAction.Breakpoint_Properties=Breakpoint &Properties...
internal.ui.actions.ManageFunctionBreakpointActionDelegate.Cannot_add_breakpoint=Cannot add breakpoint
internal.ui.actions.SwitchToDisassemblyActionDelegate.Exceptions_occurred_attempting_to_switch_to_disassemblysource_mode.=Exceptions occurred attempting to switch to disassembly/source mode.
internal.ui.actions.SwitchToDisassemblyActionDelegate.1=Switch to disassembly/source mode failed.
internal.ui.actions.SwitchToDisassemblyActionDelegate.2=Switch to disassembly/source mode
internal.ui.actions.ShowAsciiAction.Show_ASCII=Show ASCII
internal.ui.actions.AddGlobalsActionDelegate.Select_Variables=Select Variables:
internal.ui.actions.AddGlobalsActionDelegate.Exceptions_occurred_attempting_to_add_global_variables.=Exceptions occurred attempting to add global variables.
internal.ui.actions.AddGlobalsActionDelegate.Add_global_variables_failed=Add global variables failed.
internal.ui.actions.EnableDisableBreakpointRulerAction.Enable_Breakpoint=&Enable Breakpoint
internal.ui.actions.EnableDisableBreakpointRulerAction.Enabling_disabling_breakpoints=Enabling/disabling breakpoints
internal.ui.actions.EnableDisableBreakpointRulerAction.Exceptions_occured_enabling_disabling_breakpoint=Exceptions occurred enabling or disabling the breakpoint
internal.ui.actions.EnableDisableBreakpointRulerAction.Disable_breakpoint=&Disable Breakpoint
internal.ui.actions.VariableFormatActionDelegate.Unable_to_set_format_of_variable=Unable to set format of variable.
internal.ui.actions.RefreshAction.Unable_to_refresh=Unable to refresh.
internal.ui.actions.ExpressionDialog.Add_Expression=Add Expression
internal.ui.actions.ExpressionDialog.Expression_to_add=Expression to add:
internal.ui.actions.CastToTypeActionDelegate.Type_field_must_not_be_empty=The 'Type' field must not be empty.
internal.ui.actions.CastToTypeActionDelegate.Cast_To_Type=Cast To Type
internal.ui.actions.CastToTypeActionDelegate.Enter_type=Enter type:
internal.ui.actions.CastToTypeActionDelegate.Unable_to_cast_to_type.=Unable to cast to type.
internal.ui.actions.EnableVariablesActionDelegate.Enable_variables_failed.=Enable variable(s) failed.
internal.ui.actions.EnableVariablesActionDelegate.Exceptions_occurred_enabling_the_variables=Exceptions occurred enabling the variable(s).
internal.ui.actions.MemorySizeAction.Unable_to_change_memory_unit_size=Unable to change memory unit size.
#
# Examples of the display for the following value are "1 byte" and "8 bytes".
# Normally placeholders in {} are not translated, except when they are choice forms,
# where the strings after each "#" are to be translated.
#
internal.ui.actions.MemorySizeAction.byte_bytes={0, number, integer} {0, choice, 1#byte|2#bytes}
internal.ui.actions.MemoryNumberOfColumnsAction.number_of_columns={0, number, integer} {0, choice, 0#columns|1#column|2#columns}
internal.ui.actions.SignalZeroWorkbenchActionDelegate.Exceptions_occurred_attempting_to_resume_without_signal=Exceptions occurred attempting to resume without signal.
internal.ui.actions.SignalZeroWorkbenchActionDelegate.ErrorMsg_Resume_without_signal_failed=Resume without signal failed.
internal.ui.actions.SignalZeroWorkbenchActionDelegate.ErrorMsgTitle_Resume_Without_Signal=Resume Without Signal
internal.ui.actions.CastToArrayActionDelegate.Shell_Display_As_Array=Display As Array
internal.ui.actions.CastToArrayActionDelegate.Start_index=Start index:
internal.ui.actions.CastToArrayActionDelegate.Length=Length:
internal.ui.actions.CastToArrayActionDelegate.First_index_field_must_not_be_empty=The 'First index' field must not be empty.
internal.ui.actions.CastToArrayActionDelegate.Invalid_first_index=Invalid first index.
internal.ui.actions.CastToArrayActionDelegate.Empty_last_index=The 'Last index' field must not be empty.
internal.ui.actions.CastToArrayActionDelegate.Invalid_last_index.=Invalid last index.
internal.ui.actions.CastToArrayActionDelegate.The_length_must_be_greater_than_0=The length must be greater than 0.
internal.ui.actions.CastToArrayActionDelegate.Unable_to_display_this_variable_as_an_array=Unable to display this variable as an array.
internal.ui.actions.SignalZeroObjectActionDelegate.Unable_to_resume_ignoring_signal=Unable to resume ignoring signal.
internal.ui.actions.SignalZeroObjectActionDelegate.Operation_failed=Operation failed.
internal.ui.actions.CBreakpointPreferencePage.Ignore_count_must_be_positive_integer=Ignore count must be a positive integer
internal.ui.actions.CBreakpointPreferencePage.Not_available=Not available
internal.ui.actions.CBreakpointPreferencePage.Function_name=Function name:
internal.ui.actions.CBreakpointPreferencePage.Function_Breakpoint_Properties=C/C++ Function Breakpoint Properties
internal.ui.actions.CBreakpointPreferencePage.Address=Address:
internal.ui.actions.CBreakpointPreferencePage.Address_Breakpoint_Properties=C/C++ Address Breakpoint Properties
internal.ui.actions.CBreakpointPreferencePage.File=File:
internal.ui.actions.CBreakpointPreferencePage.Line_Breakpoint_Properties=C/C++ Line Breakpoint Properties
internal.ui.actions.CBreakpointPreferencePage.Line_Number=Line Number:
internal.ui.actions.CBreakpointPreferencePage.Project=Project:
internal.ui.actions.CBreakpointPreferencePage.Read_Watchpoint_Properties=C/C++ Read Watchpoint Properties
internal.ui.actions.CBreakpointPreferencePage.Watchpoint_Properties=C/C++ Watchpoint Properties
internal.ui.actions.CBreakpointPreferencePage.Access_Watchpoint_Properties=C/C++ Access Watchpoint Properties
internal.ui.actions.CBreakpointPreferencePage.Expression_To_Watch=Expression To Watch:
internal.ui.actions.CBreakpointPreferencePage.Condition=&Condition
internal.ui.actions.CBreakpointPreferencePage.Invalid_condition=Invalid_condition
internal.ui.actions.CBreakpointPreferencePage.Ignore_Count=&Ignore Count:
internal.ui.actions.AddWatchpointActionDelegate.Cannot_add_watchpoint=Cannot add watchpoint
internal.ui.actions.MemoryNumberOfColumnAction.Unable_to_change_the_column_number.=Unable to change the column number.
internal.ui.actions.RunToLineRulerAction.Run_To_Line=Run To Line
internal.ui.actions.AddAddressBreakpointActionDelegate.Invalid_address=Invalid address.
internal.ui.actions.AddAddressBreakpointActionDelegate.Address_can_not_be_0=Address can not be 0.
internal.ui.actions.AddAddressBreakpointActionDelegate.Add_Address_Breakpoint=Add Address Breakpoint
internal.ui.actions.AddAddressBreakpointActionDelegate.Enter_address=Enter address:
internal.ui.actions.ClearMemoryAction.Clear=Clear
internal.ui.actions.ClearMemoryAction.Clear_Memory_Block=Clear Memory Block
internal.ui.actions.AddWatchpointDialog.Add_C_C++_Watchpoint=Add C/C++ Watchpoint
internal.ui.actions.AddWatchpointDialog.Expression_to_watch=Expression to watch:
internal.ui.actions.AddWatchpointDialog.Access=Access
internal.ui.actions.AddWatchpointDialog.Write=Write
internal.ui.actions.AddWatchpointDialog.Read=Read
internal.ui.actions.ManageBreakpointRulerAction.Add_Breakpoint=Add Breakpoint
internal.ui.actions.ManageBreakpointRulerAction.Remove_Breakpoint=Remove Breakpoint
internal.ui.actions.ManageBreakpointRulerAction.Cannot_add_breakpoint=Cannot add breakpoint
internal.ui.actions.ManageBreakpointRulerAction.Cannot_remove_breakpoint=Cannot remove breakpoint
internal.ui.actions.AddExpressionActionDelegate.Evaluation_of_expression_failed=Evaluation of expression failed.
internal.ui.actions.LoadSymbolsActionDelegate.Unable_to_load_symbols_of_shared_library=Unable to load symbols of shared library.
internal.ui.actions.LoadSymbolsActionDelegate.Operation_failed=Operation failed.
internal.ui.actions.ChangeRegisterValueAction.Change_Register_Value=Change Register Value
internal.ui.actions.ChangeRegisterValueAction.Setting_the_register_value_failed=Setting the register value failed.
internal.ui.actions.RefreshMemoryAction.Refresh_Memory_Block=Refresh Memory Block
internal.ui.actions.RefreshMemoryAction.Refresh=Refresh
internal.ui.actions.ManageBreakpointActionDelegate.Cannot_add_breakpoint=Cannot add breakpoint
internal.ui.actions.MemoryFormatAction.Unable_to_change_format=Unable to change format.
internal.ui.actions.MemoryFormatAction.Hexadecimal=Hexadecimal
internal.ui.actions.MemoryFormatAction.Signed_Decimal=Signed Decimal
internal.ui.actions.MemoryFormatAction.Unsigned_Decimal=Unsigned Decimal
internal.ui.actions.ManageFunctionBreakpointActionDelegate.Cannot_add_breakpoint=Cannot add breakpoint
internal.ui.actions.ChangeRegisterValueAction.Setting_register_value_failed=Setting the register value failed.
internal.ui.editors.DisassemblyMarkerAnnotationModel.Resource_Changed=Resource Changed
internal.ui.editors.CDebugEditor.C_CPP_File_Editor=C/C++ File Editor
internal.ui.editors.CDebugEditor.Source_not_found=Source not found
internal.ui.editors.CDebugEditor.attach_source_location_instructions=You can attach a new source location by pressing the button below:
internal.ui.editors.CDebugEditor.Attach_Source_button=&Attach Source...
internal.ui.editors.CDebugEditor.Can_not_find_file=Can not find the file ''{0}'' in the specified source locations.
internal.ui.editors.DisassemblyEditorInput.Disassembly=Disassembly
internal.ui.preferences.SharedLibrariesViewPreferencePage.Shared_Libraries_View_Settings=Shared Libraries View Settings.
internal.ui.preferences.SharedLibrariesViewPreferencePage.Auto-Refresh_by_default=Auto-Refresh by default
internal.ui.preferences.CDebugPreferencePage.Natural=Natural
internal.ui.preferences.CDebugPreferencePage.Hexadecimal=Hexadecimal
internal.ui.preferences.CDebugPreferencePage.Decimal=Decimal
internal.ui.preferences.CDebugPreferencePage.Preference_page_description=General settings for C/C++ Debugging.
internal.ui.preferences.CDebugPreferencePage.Opened_view_default_settings=Opened view default settings
internal.ui.preferences.CDebugPreferencePage.pathsButton=Show full &paths
internal.ui.preferences.CDebugPreferencePage.variableFormatCombo=Default variable format:
internal.ui.preferences.CDebugPreferencePage.expressionFormatCombo=Default expression format:
internal.ui.preferences.CDebugPreferencePage.registerFormatCombo=Default register format:
internal.ui.preferences.CDebugPreferencePage.Disassembly_options=Disassembly options
internal.ui.preferences.CDebugPreferencePage.autoDisassemblyButton=Automatically switch to &disassembly mode
internal.ui.preferences.CDebugPreferencePage.maxNumberOfInstructions=Maximum number of instructions:
internal.ui.preferences.CDebugPreferencePage.ErrorMaxNumberOfInstructionsRange=The valid value range is [{0},{1}].
internal.ui.preferences.SourcePreferencePage.Description=Common source lookup settings.
internal.ui.preferences.SourcePreferencePage.Source_locations=Source Locations
internal.ui.preferences.SourcePreferencePage.Search_for_duplicate_source_files=Search for duplicate source files
internal.ui.preferences.CDebugPreferencePage.autoRefreshRegistersButton=Automatically refresh registers
internal.ui.preferences.CDebugPreferencePage.autoRefreshSolibsButton=Automatically refresh shared libraries
internal.ui.preferences.MemoryViewPreferencePage.Description=Memory View Settings.
internal.ui.preferences.MemoryViewPreferencePage.Text_Color=Text Color:
internal.ui.preferences.MemoryViewPreferencePage.Background_Color=Background Color:
internal.ui.preferences.MemoryViewPreferencePage.Address_Color=Address Color:
internal.ui.preferences.MemoryViewPreferencePage.Changed_Value_Color=Changed Value Color:
internal.ui.preferences.MemoryViewPreferencePage.Font=Font:
internal.ui.preferences.MemoryViewPreferencePage.Padding_Character=Padding Character:
internal.ui.preferences.MemoryViewPreferencePage.Auto_Refresh_by_default=Auto-Refresh by default
internal.ui.preferences.MemoryViewPreferencePage.Show_ascii_by_default=Show ASCII by default
internal.ui.wizards.AddProjectSourceLocationWizard.Select_Project=Select Project
internal.ui.wizards.AddProjectSourceLocationWizard.WindowTitle=Add Project Source Location
internal.ui.wizards.AddProjectSourceLocationWizard.AddProjectLocationMessage=Add an existing workspace project to the source locations list.
internal.ui.wizards.AddProjectSourceLocationWizard.Description=Add an existing project to the source locations list.
internal.ui.wizards.AddDirectorySourceLocationWizard.Select_Directory=Select Directory
internal.ui.wizards.AddDirectorySourceLocationWizard.WindowTitle=Add Directory Source Location
internal.ui.wizards.AddDirectorySourceLocationWizard.WindowMessage=Add a local file system directory to the source locations list.
internal.ui.wizards.AddDirectorySourceLocationWizard.ErrorDirectoryEmpty=Directory must not be empty.
internal.ui.wizards.AddDirectorySourceLocationWizard.ErrorDirectoryDoesNotExist=Directory does not exist.
internal.ui.wizards.AddDirectorySourceLocationWizard.ErrorDirectoryMustBeAbsolute=Directory must be absolute.
internal.ui.wizards.AddDirectorySourceLocationWizard.Description=Add a local file system directory to the source locations list.
AddSourceLocationWizard.Window_Title=Add Source Location
AddDirectorySourceLocationBlock.Select_location_directory=Select location directory:
AddDirectorySourceLocationBlock.Browse=&Browse...
AddDirectorySourceLocationBlock.Select_Location_Directory=Select Location Directory
AddDirectorySourceLocationBlock.Associate_with=&Associate with
AddDirectorySourceLocationBlock.Search_subfolders=Search sub&folders
internal.ui.preferences.SourceLocationSelectionPage.Add_Source_Location=Add Source Location
internal.ui.preferences.SourceLocationSelectionPage.WindowTitle=Select
internal.ui.preferences.SourceLocationSelectionPage.Select_source_location_type=Select source location type:
internal.ui.preferences.SourceLocationSelectionPage.Existing_Project_Into_Workspace=Existing Project Into Workspace
internal.ui.preferences.SourceLocationSelectionPage.File_System_Directory=File System Directory
internal.ui.dialogfields.SourceListDialogField.yes=yes
internal.ui.dialogfields.SourceListDialogField.no=no
internal.ui.dialogfields.SourceListDialogField.Add=Add...
internal.ui.dialogfields.SourceListDialogField.Up=Up
internal.ui.dialogfields.SourceListDialogField.Down=Down
internal.ui.dialogfields.SourceListDialogField.Remove=Remove
internal.ui.dialogfields.SourceListDialogField.Location=Location
internal.ui.dialogfields.SourceListDialogField.Association=Association
internal.ui.dialogfields.SourceListDialogField.Search_subfolders=Search subfolders
ui.sourcelookup.SourceListDialogField.yes=yes
ui.sourcelookup.SourceListDialogField.no=no
ui.sourcelookup.SourceListDialogField.Add=Add...