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

Use getters to access members of "MICommand".

This commit is contained in:
Mikhail Khodjaiants 2006-02-06 22:37:21 +00:00
parent c2dfa48e4d
commit 01eaafd33a
7 changed files with 57 additions and 12 deletions

View file

@ -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 2006-02-06 Mikhail Khodjaiants
Bug 114793: Add an extension point to contribute command factories. Bug 114793: Add an extension point to contribute command factories.
* MANIFEST.MF * MANIFEST.MF

View file

@ -31,6 +31,7 @@ public class MIBreakCondition extends MICommand {
* etc .. doing this will break the command -break-condition. * etc .. doing this will break the command -break-condition.
*/ */
protected String parametersToString() { protected String parametersToString() {
String[] parameters = getParameters();
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
for (int i = 0; i < parameters.length; i++) { for (int i = 0; i < parameters.length; i++) {
buffer.append(' ').append(parameters[i]); buffer.append(' ').append(parameters[i]);

View file

@ -17,9 +17,9 @@ package org.eclipse.cdt.debug.mi.core.command;
*/ */
public class MICommand extends Command { public class MICommand extends Command {
final static String[] empty = new String[0]; final static String[] empty = new String[0];
String[] options = empty; String[] fOptions = empty;
String[] parameters = empty; String[] fParameters = empty;
String operation = new String(); String fOperation = new String();
String fMIVersion; String fMIVersion;
public MICommand(String miVersion, String oper) { 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) { public MICommand(String miVersion, String oper, String[] opt, String[] params) {
fMIVersion = miVersion; fMIVersion = miVersion;
this.operation = oper; fOperation = oper;
this.options = opt; fOptions = opt;
this.parameters = params; fParameters = params;
} }
/** /**
@ -75,11 +75,11 @@ public class MICommand extends Command {
* @return the operation of this command * @return the operation of this command
*/ */
public String getOperation() { public String getOperation() {
return operation; return fOperation;
} }
protected void setOperation(String op) { 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 * @return an array of command's options
*/ */
public String[] getOptions() { public String[] getOptions() {
return options; return fOptions;
} }
public void setOptions(String[] opt) { 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 * @return an array of command's parameters
*/ */
public String[] getParameters() { public String[] getParameters() {
return parameters; return fParameters;
} }
public void setParameters(String[] p) { public void setParameters(String[] p) {
parameters = p; fParameters = p;
} }
protected String optionsToString() { protected String optionsToString() {
String[] options = getOptions();
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
if (options != null && options.length > 0) { if (options != null && options.length > 0) {
for (int i = 0; i < options.length; i++) { for (int i = 0; i < options.length; i++) {
@ -141,6 +142,8 @@ public class MICommand extends Command {
} }
protected String parametersToString() { protected String parametersToString() {
String[] parameters = getParameters();
String[] options = getOptions();
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
if (parameters != null && parameters.length > 0) { if (parameters != null && parameters.length > 0) {
// According to GDB/MI spec // According to GDB/MI spec

View file

@ -113,6 +113,7 @@ public class MIDataDisassemble extends MICommand
* So override the MICommand * So override the MICommand
*/ */
protected String parametersToString() { protected String parametersToString() {
String[] parameters = getParameters();
if (parameters != null && parameters.length > 0) { if (parameters != null && parameters.length > 0) {
return "-- " + parameters[0]; //$NON-NLS-1$ return "-- " + parameters[0]; //$NON-NLS-1$
} }

View file

@ -33,6 +33,7 @@ public class MIEnvironmentCD extends MICommand
* @see org.eclipse.cdt.debug.mi.core.command.MICommand#parametersToString() * @see org.eclipse.cdt.debug.mi.core.command.MICommand#parametersToString()
*/ */
protected String parametersToString() { protected String parametersToString() {
String[] parameters = getParameters();
if (parameters != null && parameters.length == 1) { if (parameters != null && parameters.length == 1) {
return parameters[0]; return parameters[0];
} }

View file

@ -39,6 +39,7 @@ public class MIGDBSetEnvironment extends MIGDBSet {
* So pass the strings raw without interpretation. * So pass the strings raw without interpretation.
*/ */
protected String parametersToString() { protected String parametersToString() {
String[] parameters = getParameters();
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
if (parameters != null) { if (parameters != null) {
for (int i = 0; i < parameters.length; i++) { for (int i = 0; i < parameters.length; i++) {

View file

@ -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.CLIInfoSharedLibrary;
import org.eclipse.cdt.debug.mi.core.command.MIEnvironmentCD; 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; import org.eclipse.cdt.debug.mi.core.command.factories.StandardCommandFactory;
/** /**
@ -46,4 +47,33 @@ public class StandardWinCommandFactory extends StandardCommandFactory {
public CLIInfoSharedLibrary createCLIInfoSharedLibrary() { public CLIInfoSharedLibrary createCLIInfoSharedLibrary() {
return new WinCLIInfoSharedLibrary(); 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];
}
};
}
} }