Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added primitive statement type check. Removed redundant action class.…
… Heckload of refactoring & bug fixes.
- Loading branch information
Showing
10 changed files
with
262 additions
and
141 deletions.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
src/plainenglishjavadebugger/translationModule/StatementType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package plainenglishjavadebugger.translationModule; | ||
|
||
/* | ||
* This code belongs to: | ||
* Ahmet Emre Unal | ||
* S001974 | ||
* emre.unal@ozu.edu.tr | ||
*/ | ||
|
||
public enum StatementType { | ||
METHOD_CALL, IF, SWITCH, WHILE_LOOP, FOR_LOOP, INSTANTIATION, RETURN, METHOD_ENTER, OTHER | ||
} |
119 changes: 119 additions & 0 deletions
119
src/plainenglishjavadebugger/translationModule/TranslatedLine.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
package plainenglishjavadebugger.translationModule; | ||
|
||
import org.eclipse.debug.core.DebugEvent; | ||
import org.eclipse.swt.graphics.Image; | ||
import org.eclipse.ui.ISharedImages; | ||
import org.eclipse.ui.PlatformUI; | ||
|
||
/* | ||
* This code belongs to: | ||
* Ahmet Emre Unal | ||
* S001974 | ||
* emre.unal@ozu.edu.tr | ||
*/ | ||
|
||
public class TranslatedLine { | ||
private static int itemNumber = 0; | ||
|
||
private final int translationStepNumber; | ||
private String translatedCode; | ||
private String shortDescription; | ||
private String longDescription; | ||
private String debugEventType; | ||
private String popupMessage = ""; | ||
|
||
private StatementType statementType; | ||
|
||
public TranslatedLine(String translatedCode, int debugEventType) { | ||
this(translatedCode, "", "", debugEventType); | ||
} | ||
|
||
public TranslatedLine(String translatedCode, String shortDescription, String longDescription, int debugEventType) { | ||
TranslatedLine.itemNumber++; | ||
translationStepNumber = TranslatedLine.itemNumber; | ||
this.translatedCode = translatedCode; | ||
this.shortDescription = shortDescription; | ||
this.longDescription = longDescription; | ||
this.debugEventType = getDebugEventTypeName(debugEventType); | ||
} | ||
|
||
private String getDebugEventTypeName(int debugEventType) { | ||
switch (debugEventType) { | ||
case DebugEvent.STEP_OVER: | ||
return "Stepped over the line"; | ||
case DebugEvent.STEP_INTO: | ||
return "Stepped into the line"; | ||
default: | ||
return "Undetermined debug event."; | ||
} | ||
} | ||
|
||
private void createPopupMessage() { | ||
popupMessage = ""; | ||
popupMessage += "Step #" + translationStepNumber + "\n\n"; | ||
popupMessage += "Debug event: " + debugEventType + "\n\n"; | ||
popupMessage += "The translated line of code:\n\t" + translatedCode + "\n\n"; | ||
popupMessage += getLongDescription(); | ||
} | ||
|
||
public int getTranslationNumber() { | ||
return translationStepNumber; | ||
} | ||
|
||
public String getTranslatedCode() { | ||
return translatedCode; | ||
} | ||
|
||
public String getShortDescription() { | ||
return shortDescription; | ||
} | ||
|
||
public String getLongDescription() { | ||
return longDescription; | ||
} | ||
|
||
public String getDebugEventType() { | ||
return debugEventType; | ||
} | ||
|
||
public String getPopupMessage() { | ||
createPopupMessage(); | ||
return popupMessage; | ||
} | ||
|
||
public Image getImage() { | ||
// Returns a dummy image for now. Later on, it should return an icon depending on the translation. | ||
return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_ELEMENT); | ||
} | ||
|
||
/** | ||
* @param shortDescription | ||
* the shortDescription to set | ||
*/ | ||
public synchronized void setShortDescription(String shortDescription) { | ||
this.shortDescription = shortDescription; | ||
} | ||
|
||
/** | ||
* @param longDescription | ||
* the longDescription to set | ||
*/ | ||
public synchronized void setLongDescription(String longDescription) { | ||
this.longDescription = longDescription; | ||
} | ||
|
||
/** | ||
* @return the statementType | ||
*/ | ||
public StatementType getStatementType() { | ||
return statementType; | ||
} | ||
|
||
/** | ||
* @param statementType | ||
* the statementType to set | ||
*/ | ||
public synchronized void setStatementType(StatementType statementType) { | ||
this.statementType = statementType; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 0 additions & 69 deletions
69
src/plainenglishjavadebugger/views/translatorView/TranslatedLine.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.