mirror of
https://github.com/processing/processing4.git
synced 2026-02-04 06:09:17 +01:00
Minor JavaEditor cleanup
This commit is contained in:
@@ -49,8 +49,7 @@ public class JavaEditor extends Editor {
|
||||
|
||||
// Need to sort through the rest of these additions [fry]
|
||||
|
||||
protected List<LineHighlight> breakpointedLines =
|
||||
new ArrayList<LineHighlight>();
|
||||
protected final List<LineHighlight> breakpointedLines = new ArrayList<>();
|
||||
protected LineHighlight currentLine; // where the debugger is suspended
|
||||
protected final String breakpointMarkerComment = " //<>//";
|
||||
|
||||
@@ -977,7 +976,7 @@ public class JavaEditor extends Editor {
|
||||
Object value = optionPane.getValue();
|
||||
if (value.equals(exportButton)) {
|
||||
return jmode.handleExportApplication(sketch);
|
||||
} else if (value.equals(cancelButton) || value.equals(Integer.valueOf(-1))) {
|
||||
} else if (value.equals(cancelButton) || value.equals(-1)) {
|
||||
// closed window by hitting Cancel or ESC
|
||||
statusNotice(Language.text("export.notice.exporting.cancel"));
|
||||
}
|
||||
@@ -1675,7 +1674,7 @@ public class JavaEditor extends Editor {
|
||||
* removed from.
|
||||
*/
|
||||
protected List<LineID> stripBreakpointComments() {
|
||||
List<LineID> bps = new ArrayList<LineID>();
|
||||
List<LineID> bps = new ArrayList<>();
|
||||
// iterate over all tabs
|
||||
Sketch sketch = getSketch();
|
||||
for (int i = 0; i < sketch.getCodeCount(); i++) {
|
||||
@@ -1751,7 +1750,7 @@ public class JavaEditor extends Editor {
|
||||
@Override
|
||||
public boolean handleSave(boolean immediately) {
|
||||
// note modified tabs
|
||||
final List<String> modified = new ArrayList<String>();
|
||||
final List<String> modified = new ArrayList<>();
|
||||
for (int i = 0; i < getSketch().getCodeCount(); i++) {
|
||||
SketchCode tab = getSketch().getCode(i);
|
||||
if (tab.isModified()) {
|
||||
@@ -1909,7 +1908,7 @@ public class JavaEditor extends Editor {
|
||||
PApplet.matchAll(tabCode, ErrorCheckerService.IMPORT_REGEX);
|
||||
|
||||
if (pieces != null) {
|
||||
ArrayList<String> importHeaders = new ArrayList<String>();
|
||||
ArrayList<String> importHeaders = new ArrayList<>();
|
||||
for (String[] importStatement : pieces) {
|
||||
importHeaders.add(importStatement[2]);
|
||||
}
|
||||
@@ -1918,7 +1917,7 @@ public class JavaEditor extends Editor {
|
||||
if (!installLibsHeaders.isEmpty()) {
|
||||
StringBuilder libList = new StringBuilder("Would you like to install them now?");
|
||||
for (AvailableContribution ac : installLibsHeaders) {
|
||||
libList.append("\n • " + ac.getName());
|
||||
libList.append("\n • ").append(ac.getName());
|
||||
}
|
||||
int option = Messages.showYesNoQuestion(this,
|
||||
Language.text("contrib.import.dialog.title"),
|
||||
@@ -1944,7 +1943,7 @@ public class JavaEditor extends Editor {
|
||||
private List<AvailableContribution> getNotInstalledAvailableLibs(ArrayList<String> importHeadersList) {
|
||||
Map<String, Contribution> importMap =
|
||||
ContributionListing.getInstance().getLibrariesByImportHeader();
|
||||
List<AvailableContribution> libList = new ArrayList<AvailableContribution>();
|
||||
List<AvailableContribution> libList = new ArrayList<>();
|
||||
for (String importHeaders : importHeadersList) {
|
||||
int dot = importHeaders.lastIndexOf('.');
|
||||
String entry = (dot == -1) ? importHeaders : importHeaders.substring(0,
|
||||
@@ -2142,7 +2141,7 @@ public class JavaEditor extends Editor {
|
||||
|
||||
for (Component item : debugMenu.getMenuComponents()) {
|
||||
if (item instanceof JMenuItem && item != debugItem) {
|
||||
((JMenuItem) item).setEnabled(debugEnabled);
|
||||
item.setEnabled(debugEnabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2246,17 +2245,6 @@ public class JavaEditor extends Editor {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add highlight for a breakpointed line on the current tab.
|
||||
* @param lineIdx the line index on the current tab to highlight as
|
||||
* breakpointed
|
||||
*/
|
||||
//TODO: remove and replace by {@link #addBreakpointedLine(LineID lineID)}
|
||||
public void addBreakpointedLine(int lineIdx) {
|
||||
addBreakpointedLine(getLineIDInCurrentTab(lineIdx));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Remove a highlight for a breakpointed line. Needs to be on the current tab.
|
||||
* @param lineIdx the line index on the current tab to remove a breakpoint
|
||||
@@ -2608,7 +2596,7 @@ public class JavaEditor extends Editor {
|
||||
// frmImportSuggest = null;
|
||||
return;
|
||||
}
|
||||
final JList<String> classList = new JList<String>(list);
|
||||
final JList<String> classList = new JList<>(list);
|
||||
classList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||||
frmImportSuggest = new JFrame();
|
||||
|
||||
@@ -2866,7 +2854,7 @@ public class JavaEditor extends Editor {
|
||||
|
||||
baseCode = new String[code.length];
|
||||
for (int i = 0; i < code.length; i++) {
|
||||
baseCode[i] = new String(code[i].getSavedProgram());
|
||||
baseCode[i] = code[i].getSavedProgram();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user