1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42: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
Bug 114793: Add an extension point to contribute command factories.
* MANIFEST.MF

View file

@ -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]);

View file

@ -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

View file

@ -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$
}

View file

@ -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];
}

View file

@ -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++) {

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.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];
}
};
}
}