From 01eaafd33ae0e5465e1d475c95b32985259e9be4 Mon Sep 17 00:00:00 2001 From: Mikhail Khodjaiants Date: Mon, 6 Feb 2006 22:37:21 +0000 Subject: [PATCH] Use getters to access members of "MICommand". --- debug/org.eclipse.cdt.debug.mi.core/ChangeLog | 8 +++++ .../mi/core/command/MIBreakCondition.java | 1 + .../cdt/debug/mi/core/command/MICommand.java | 27 +++++++++-------- .../mi/core/command/MIDataDisassemble.java | 1 + .../mi/core/command/MIEnvironmentCD.java | 1 + .../mi/core/command/MIGDBSetEnvironment.java | 1 + .../win32/StandardWinCommandFactory.java | 30 +++++++++++++++++++ 7 files changed, 57 insertions(+), 12 deletions(-) diff --git a/debug/org.eclipse.cdt.debug.mi.core/ChangeLog b/debug/org.eclipse.cdt.debug.mi.core/ChangeLog index 258ad9c0345..87247a67a69 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/ChangeLog +++ b/debug/org.eclipse.cdt.debug.mi.core/ChangeLog @@ -1,3 +1,11 @@ +2006-02-06 Mikhail Khodjaiants + Use getters to access members of "MICommand". + * MIBreakCondition.java + * MICommand.java + * MIDataDisassemble.java + * MIEnvironmentCD.java + * MIGDBSetEnvironment.java + 2006-02-06 Mikhail Khodjaiants Bug 114793: Add an extension point to contribute command factories. * MANIFEST.MF diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIBreakCondition.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIBreakCondition.java index b0789a4d381..de3b3c22924 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIBreakCondition.java +++ b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIBreakCondition.java @@ -31,6 +31,7 @@ public class MIBreakCondition extends MICommand { * etc .. doing this will break the command -break-condition. */ protected String parametersToString() { + String[] parameters = getParameters(); StringBuffer buffer = new StringBuffer(); for (int i = 0; i < parameters.length; i++) { buffer.append(' ').append(parameters[i]); diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MICommand.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MICommand.java index a43a11316c3..7a9b32b5567 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MICommand.java +++ b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MICommand.java @@ -17,9 +17,9 @@ package org.eclipse.cdt.debug.mi.core.command; */ public class MICommand extends Command { final static String[] empty = new String[0]; - String[] options = empty; - String[] parameters = empty; - String operation = new String(); + String[] fOptions = empty; + String[] fParameters = empty; + String fOperation = new String(); String fMIVersion; public MICommand(String miVersion, String oper) { @@ -32,9 +32,9 @@ public class MICommand extends Command { public MICommand(String miVersion, String oper, String[] opt, String[] params) { fMIVersion = miVersion; - this.operation = oper; - this.options = opt; - this.parameters = params; + fOperation = oper; + fOptions = opt; + fParameters = params; } /** @@ -75,11 +75,11 @@ public class MICommand extends Command { * @return the operation of this command */ public String getOperation() { - return operation; + return fOperation; } protected void setOperation(String op) { - operation = op; + fOperation = op; } /** @@ -89,11 +89,11 @@ public class MICommand extends Command { * @return an array of command's options */ public String[] getOptions() { - return options; + return fOptions; } public void setOptions(String[] opt) { - options = opt; + fOptions = opt; } /** @@ -103,14 +103,15 @@ public class MICommand extends Command { * @return an array of command's parameters */ public String[] getParameters() { - return parameters; + return fParameters; } public void setParameters(String[] p) { - parameters = p; + fParameters = p; } protected String optionsToString() { + String[] options = getOptions(); StringBuffer sb = new StringBuffer(); if (options != null && options.length > 0) { for (int i = 0; i < options.length; i++) { @@ -141,6 +142,8 @@ public class MICommand extends Command { } protected String parametersToString() { + String[] parameters = getParameters(); + String[] options = getOptions(); StringBuffer buffer = new StringBuffer(); if (parameters != null && parameters.length > 0) { // According to GDB/MI spec diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIDataDisassemble.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIDataDisassemble.java index 4ae92753d8c..6d49c8afdde 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIDataDisassemble.java +++ b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIDataDisassemble.java @@ -113,6 +113,7 @@ public class MIDataDisassemble extends MICommand * So override the MICommand */ protected String parametersToString() { + String[] parameters = getParameters(); if (parameters != null && parameters.length > 0) { return "-- " + parameters[0]; //$NON-NLS-1$ } diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIEnvironmentCD.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIEnvironmentCD.java index c302486aac6..5b4df38e8b7 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIEnvironmentCD.java +++ b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIEnvironmentCD.java @@ -33,6 +33,7 @@ public class MIEnvironmentCD extends MICommand * @see org.eclipse.cdt.debug.mi.core.command.MICommand#parametersToString() */ protected String parametersToString() { + String[] parameters = getParameters(); if (parameters != null && parameters.length == 1) { return parameters[0]; } diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIGDBSetEnvironment.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIGDBSetEnvironment.java index 36df1a92dd0..15d5400ccb2 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIGDBSetEnvironment.java +++ b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIGDBSetEnvironment.java @@ -39,6 +39,7 @@ public class MIGDBSetEnvironment extends MIGDBSet { * So pass the strings raw without interpretation. */ protected String parametersToString() { + String[] parameters = getParameters(); StringBuffer buffer = new StringBuffer(); if (parameters != null) { for (int i = 0; i < parameters.length; i++) { diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/win32/StandardWinCommandFactory.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/win32/StandardWinCommandFactory.java index 5f08d1d8cc0..3b6f7da3a28 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/win32/StandardWinCommandFactory.java +++ b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/win32/StandardWinCommandFactory.java @@ -12,6 +12,7 @@ package org.eclipse.cdt.debug.mi.core.command.factories.win32; import org.eclipse.cdt.debug.mi.core.command.CLIInfoSharedLibrary; import org.eclipse.cdt.debug.mi.core.command.MIEnvironmentCD; +import org.eclipse.cdt.debug.mi.core.command.MIGDBSetAutoSolib; import org.eclipse.cdt.debug.mi.core.command.factories.StandardCommandFactory; /** @@ -46,4 +47,33 @@ public class StandardWinCommandFactory extends StandardCommandFactory { public CLIInfoSharedLibrary createCLIInfoSharedLibrary() { return new WinCLIInfoSharedLibrary(); } + + /* (non-Javadoc) + * @see org.eclipse.cdt.debug.mi.core.command.CommandFactory#createMIGDBSetAutoSolib(boolean) + */ + public MIGDBSetAutoSolib createMIGDBSetAutoSolib( boolean set ) { + return new MIGDBSetAutoSolib( getMIVersion(), true ) { + + /* (non-Javadoc) + * @see org.eclipse.cdt.debug.mi.core.command.MICommand#getOperation() + */ + public String getOperation() { + return ""; //$NON-NLS-1$ + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.debug.mi.core.command.MICommand#getOptions() + */ + public String[] getOptions() { + return new String[0]; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.debug.mi.core.command.MICommand#getParameters() + */ + public String[] getParameters() { + return new String[0]; + } + }; + } }