Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
7a1ce33
multiple code improvements: squid:S1066, squid:S1197, squid:S00117, s…
Apr 11, 2016
597a838
Merge pull request #1 from DevFactory/release/multiple-code-improveme…
rlogiacco Apr 11, 2016
875b182
multiple code improvements: squid:S1149, squid:CommentedOutCodeLine, …
Apr 11, 2016
7fc00c6
Merge pull request #2 from DevFactory/release/multiple-code-improveme…
rlogiacco Apr 11, 2016
2f815b9
multiple code improvements: squid:S1149, squid:S00117
Apr 12, 2016
d76896e
Merge pull request #3 from DevFactory/release/multiple-code-improveme…
rlogiacco Apr 13, 2016
36bd438
Merge branch 'master' into feature/code-quality
rlogiacco Apr 13, 2016
75e7065
Merge branch 'feature/code-quality' of https://github.com/rlogiacco/a…
rlogiacco Apr 13, 2016
d007320
multiple code improvements: squid:S1118, squid:S1197, squid:S1213, sq…
Apr 15, 2016
768f2e1
Merge pull request #4 from DevFactory/release/multiple-code-improveme…
rlogiacco Apr 15, 2016
9e59aaf
multiple code improvements: squid:CommentedOutCodeLine, squid:S00108,…
Apr 22, 2016
a2e6d98
Merge pull request #5 from DevFactory/release/multiple-code-improveme…
rlogiacco May 7, 2016
a0779ee
Merge branch 'upstream/master' into feature/code-quality
rlogiacco May 7, 2016
dfa0f95
Merge branch 'upstream/master' into feature/code-quality
rlogiacco Jun 14, 2016
0fb7c81
Merge branch 'master' into feature/code-quality
rlogiacco Jun 29, 2016
8eb7513
added support for tycho versioning
rlogiacco Aug 3, 2016
2d2ff5a
Merge branch 'master' into feature/code-quality
rlogiacco Aug 3, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
multiple code improvements: squid:S1066, squid:S1197, squid:S00117, s…
…quid:S1118, squid:CommentedOutCodeLine, squid:S00116
  • Loading branch information
George Kankava committed Apr 11, 2016
commit 7a1ce334645305ce5824c417a7dad3d4423a41a9
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
import it.baeyens.arduino.monitor.views.SerialMonitor;

public class SerialConnection {
public static void add(String comPort, int baudrate) {
SerialMonitor.getSerialMonitor().connectSerial(comPort, baudrate);
private SerialConnection() {}

public static void add(String comPort, int baudrate) {
SerialMonitor.getSerialMonitor().connectSerial(comPort, baudrate);
}

public static void remove(String comPort) {
SerialMonitor.getSerialMonitor().disConnectSerialPort(comPort);
SerialMonitor.getSerialMonitor().disConnectSerialPort(comPort);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ public synchronized void message(byte[] newData) {

@Override
public void dispose() {
// myScope.removeStackListener(0, stackAdapter);
this.myScope = null;
this.myReceivedScopeData = null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,16 @@

public class SerialListener implements MessageConsumer {
private static boolean myScopeFilterFlag = false;
SerialMonitor TheMonitor;
SerialMonitor theMonitor;
int theColorIndex;
private ByteBuffer myReceivedScopeData = ByteBuffer.allocate(2000);

public SerialListener(SerialMonitor monitor, int colorIndex) {
this.theMonitor = monitor;
this.theColorIndex = colorIndex;
this.myReceivedScopeData.order(ByteOrder.LITTLE_ENDIAN);
}

public int removeBytesFromStart(int n) {
if (n == 0) {
return this.myReceivedScopeData.position();
Expand All @@ -35,12 +41,6 @@ public int removeBytesFromStart(int n) {
return this.myReceivedScopeData.position(index).position();
}

public SerialListener(SerialMonitor Monitor, int ColorIndex) {
this.TheMonitor = Monitor;
this.theColorIndex = ColorIndex;
this.myReceivedScopeData.order(ByteOrder.LITTLE_ENDIAN);
}

@Override
public void message(byte[] newData) {
if (myScopeFilterFlag) {
Expand All @@ -64,18 +64,14 @@ public void message(byte[] newData) {

private void internalExtractAndRemoveScopeData() {

String MonitorMessage = Const.EMPTY_STRING;
String monitorMessage = Const.EMPTY_STRING;
boolean doneSearching = false;
int length = this.myReceivedScopeData.position();
// System.out.println(""); //$NON-NLS-1$
// System.out.print("start :>"); //$NON-NLS-1$
// System.out.print(new String(this.myReceivedScopeData.array()));
// System.out.println("<"); //$NON-NLS-1$
int searchPointer;
for (searchPointer = 0; (searchPointer < length - 1) && !doneSearching; searchPointer++) {
if (this.myReceivedScopeData.getShort(searchPointer) != Const.SCOPE_START_DATA) {
char addChar = (char) this.myReceivedScopeData.get(searchPointer);
MonitorMessage += Character.toString(addChar);
monitorMessage += Character.toString(addChar);
} else {
// have we received the full header of the scope data?
if (length < (searchPointer + 6)) {
Expand Down Expand Up @@ -122,18 +118,12 @@ private void internalExtractAndRemoveScopeData() {
addChar = ' ';
}
searchPointer++;
MonitorMessage += Character.toString((char) addChar);
monitorMessage += Character.toString((char) addChar);
}
}
removeBytesFromStart(searchPointer);
}

// System.out.print("done :"); //$NON-NLS-1$
// System.out.print(" :>"); //$NON-NLS-1$
// System.out.print(MonitorMessage);
// System.out.println("<"); //$NON-NLS-1$

event(MonitorMessage);
event(monitorMessage);
}

@Override
Expand All @@ -143,12 +133,12 @@ public void dispose() {

@Override
public void event(String event) {
final String TempString = new String(event);
final String tempString = new String(event);
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
try {
SerialListener.this.TheMonitor.ReportSerialActivity(TempString, SerialListener.this.theColorIndex);
SerialListener.this.theMonitor.ReportSerialActivity(tempString, SerialListener.this.theColorIndex);
} catch (Exception e) {// ignore as we get errors when closing
// down
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public Change perform(IProgressMonitor pm) throws CoreException {
for (int curProject = 0; curProject < projects.length; curProject++) {
ICProjectDescription projectDescription = mngr.getProjectDescription(projects[curProject], true);
if (projectDescription != null) { // if the description is null it probably is not a cdt project
ICConfigurationDescription configurationDescriptions[] = projectDescription.getConfigurations();
ICConfigurationDescription[] configurationDescriptions = projectDescription.getConfigurations();
boolean projectDescriptionChanged = false;
for (int curConfigDescription = 0; curConfigDescription < configurationDescriptions.length; curConfigDescription++) {

Expand All @@ -68,27 +68,25 @@ public Change perform(IProgressMonitor pm) throws CoreException {
// Add include path to all languages
for (int idx = 0; idx < languageSettings.length; idx++) {
ICLanguageSetting lang = languageSettings[idx];
String LangID = lang.getLanguageId();
if (LangID != null) {
if (LangID.startsWith("org.eclipse.cdt.")) { //$NON-NLS-1$
String langId = lang.getLanguageId();
if (langId != null && langId.startsWith("org.eclipse.cdt.")) { //$NON-NLS-1$
boolean languageChanged = false;
ICLanguageSettingEntry[] IncludeEntries = lang.getSettingEntries(ICSettingEntry.INCLUDE_PATH);
for (int curIncludeEntry = 0; curIncludeEntry < IncludeEntries.length; curIncludeEntry++) {
if (IncludeEntries[curIncludeEntry].getName().startsWith(this.myOldName)) {
String newValue = IncludeEntries[curIncludeEntry].getName().replace(this.myOldName, this.myNewName);
ICLanguageSettingEntry[] includeEntries = lang.getSettingEntries(ICSettingEntry.INCLUDE_PATH);
for (int curIncludeEntry = 0; curIncludeEntry < includeEntries.length; curIncludeEntry++) {
if (includeEntries[curIncludeEntry].getName().startsWith(this.myOldName)) {
String newValue = includeEntries[curIncludeEntry].getName().replace(this.myOldName, this.myNewName);
languageChanged = true;
projectDescriptionChanged = true;
IncludeEntries[curIncludeEntry] = new CIncludePathEntry(newValue, ICSettingEntry.VALUE_WORKSPACE_PATH);
includeEntries[curIncludeEntry] = new CIncludePathEntry(newValue, ICSettingEntry.VALUE_WORKSPACE_PATH);
Activator.getDefault().getLog()
.log(new Status(IStatus.INFO, "it.baeyens.cdt.refactor", //$NON-NLS-1$
"changed path from " + this.myOldName + " to " //$NON-NLS-1$ //$NON-NLS-2$
+ this.myNewName));
}
}
if (languageChanged) {
lang.setSettingEntries(ICSettingEntry.INCLUDE_PATH, IncludeEntries);
}
}
if (languageChanged) {
lang.setSettingEntries(ICSettingEntry.INCLUDE_PATH, includeEntries);
}
}
}
}
Expand Down