Skip to content

Commit 4588120

Browse files
committed
Merge branch 'new-extension' of https://github.com/arduino/Arduino
2 parents 6b2dec0 + 4553cee commit 4588120

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+1123
-343
lines changed

.classpath

+6-4
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
<classpath>
33
<classpathentry excluding="processing/app/tools/format/|processing/app/tools/format/src/|processing/app/Trace.java|processing/app/RunnerClassLoader.java" kind="src" path="app/src"/>
44
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
5-
<classpathentry combineaccessrules="false" kind="src" path="/core"/>
6-
<classpathentry kind="lib" path="build/shared/lib/antlr.jar"/>
7-
<classpathentry kind="lib" path="build/shared/lib/registry.jar"/>
8-
<classpathentry kind="lib" path="build/shared/lib/apple.jar"/>
5+
<classpathentry combineaccessrules="false" kind="src" path="/processing-core"/>
6+
<classpathentry kind="lib" path="app/lib/antlr.jar"/>
7+
<classpathentry kind="lib" path="app/lib/apple.jar"/>
8+
<classpathentry kind="lib" path="app/lib/ecj.jar"/>
9+
<classpathentry kind="lib" path="app/lib/jna.jar"/>
10+
<classpathentry kind="lib" path="app/lib/RXTXcomm.jar"/>
911
<classpathentry kind="output" path="app/bin"/>
1012
</classpath>

.settings/org.eclipse.jdt.core.prefs

+11-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
1-
#Thu Jan 10 10:50:38 PST 2008
1+
#Tue Aug 16 19:08:40 CEST 2011
22
eclipse.preferences.version=1
3-
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
4-
org.eclipse.jdt.core.compiler.compliance=1.4
5-
org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
6-
org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
7-
org.eclipse.jdt.core.compiler.source=1.3
3+
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
4+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
5+
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
6+
org.eclipse.jdt.core.compiler.compliance=1.6
7+
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
8+
org.eclipse.jdt.core.compiler.debug.localVariable=generate
9+
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
10+
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
11+
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
12+
org.eclipse.jdt.core.compiler.source=1.6
813
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
914
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
1015
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16

app/src/processing/app/Base.java

+8
Original file line numberDiff line numberDiff line change
@@ -993,6 +993,13 @@ public void rebuildExamplesMenu(JMenu menu) {
993993
}
994994

995995

996+
public void onBoardOrPortChange() {
997+
for (Editor editor : editors) {
998+
editor.onBoardOrPortChange();
999+
}
1000+
}
1001+
1002+
9961003
public void rebuildBoardsMenu(JMenu menu) {
9971004
//System.out.println("rebuilding boards menu");
9981005
menu.removeAll();
@@ -1005,6 +1012,7 @@ public void actionPerformed(ActionEvent actionevent) {
10051012
//System.out.println("Switching to " + target + ":" + board);
10061013
Preferences.set("target", (String) getValue("target"));
10071014
Preferences.set("board", (String) getValue("board"));
1015+
onBoardOrPortChange();
10081016
}
10091017
};
10101018
action.putValue("target", target.getName());

app/src/processing/app/Editor.java

+71-27
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
/**
4747
* Main editor panel for the Processing Development Environment.
4848
*/
49+
@SuppressWarnings("serial")
4950
public class Editor extends JFrame implements RunnerListener {
5051

5152
Base base;
@@ -113,7 +114,7 @@ public class Editor extends JFrame implements RunnerListener {
113114

114115
EditorLineStatus lineStatus;
115116

116-
JEditorPane editorPane;
117+
//JEditorPane editorPane;
117118

118119
JEditTextArea textarea;
119120
EditorListener listener;
@@ -195,8 +196,10 @@ public void windowDeactivated(WindowEvent e) {
195196
//PdeKeywords keywords = new PdeKeywords();
196197
//sketchbook = new Sketchbook(this);
197198

198-
if (serialMonitor == null)
199+
if (serialMonitor == null) {
199200
serialMonitor = new SerialMonitor(Preferences.get("serial.port"));
201+
serialMonitor.setIconImage(getIconImage());
202+
}
200203

201204
buildMenuBar();
202205

@@ -907,6 +910,7 @@ class SerialMenuListener implements ActionListener {
907910

908911
public void actionPerformed(ActionEvent e) {
909912
selectSerialPort(((JCheckBoxMenuItem)e.getSource()).getText());
913+
base.onBoardOrPortChange();
910914
}
911915

912916
/*
@@ -1818,7 +1822,7 @@ public void handleRun(final boolean verbose) {
18181822
internalCloseRunner();
18191823
running = true;
18201824
toolbar.activate(EditorToolbar.RUN);
1821-
statusNotice("Compiling...");
1825+
status.progress("Compiling sketch...");
18221826

18231827
// do this to advance/clear the terminal window / dos prompt / etc
18241828
for (int i = 0; i < 10; i++) System.out.println();
@@ -1838,12 +1842,14 @@ class DefaultRunHandler implements Runnable {
18381842
public void run() {
18391843
try {
18401844
sketch.prepare();
1841-
String appletClassName = sketch.build(false);
1845+
sketch.build(false);
18421846
statusNotice("Done compiling.");
18431847
} catch (Exception e) {
1848+
status.unprogress();
18441849
statusError(e);
18451850
}
18461851

1852+
status.unprogress();
18471853
toolbar.deactivate(EditorToolbar.RUN);
18481854
}
18491855
}
@@ -1853,12 +1859,14 @@ class DefaultPresentHandler implements Runnable {
18531859
public void run() {
18541860
try {
18551861
sketch.prepare();
1856-
String appletClassName = sketch.build(true);
1862+
sketch.build(true);
18571863
statusNotice("Done compiling.");
18581864
} catch (Exception e) {
1865+
status.unprogress();
18591866
statusError(e);
18601867
}
18611868

1869+
status.unprogress();
18621870
toolbar.deactivate(EditorToolbar.RUN);
18631871
}
18641872
}
@@ -2311,6 +2319,7 @@ public boolean serialPrompt() {
23112319
0);
23122320
if (result == null) return false;
23132321
selectSerialPort(result);
2322+
base.onBoardOrPortChange();
23142323
return true;
23152324
}
23162325

@@ -2334,7 +2343,7 @@ synchronized public void handleExport(final boolean usingProgrammer) {
23342343
//if (!handleExportCheckModified()) return;
23352344
toolbar.activate(EditorToolbar.EXPORT);
23362345
console.clear();
2337-
statusNotice("Uploading to I/O Board...");
2346+
status.progress("Uploading to I/O Board...");
23382347

23392348
new Thread(usingProgrammer ? exportAppHandler : exportHandler).start();
23402349
}
@@ -2363,10 +2372,12 @@ public void run() {
23632372
} catch (RunnerException e) {
23642373
//statusError("Error during upload.");
23652374
//e.printStackTrace();
2375+
status.unprogress();
23662376
statusError(e);
23672377
} catch (Exception e) {
23682378
e.printStackTrace();
23692379
}
2380+
status.unprogress();
23702381
uploading = false;
23712382
//toolbar.clear();
23722383
toolbar.deactivate(EditorToolbar.EXPORT);
@@ -2397,10 +2408,12 @@ public void run() {
23972408
} catch (RunnerException e) {
23982409
//statusError("Error during upload.");
23992410
//e.printStackTrace();
2411+
status.unprogress();
24002412
statusError(e);
24012413
} catch (Exception e) {
24022414
e.printStackTrace();
24032415
}
2416+
status.unprogress();
24042417
uploading = false;
24052418
//toolbar.clear();
24062419
toolbar.deactivate(EditorToolbar.EXPORT);
@@ -2615,110 +2628,141 @@ public void statusEmpty() {
26152628

26162629
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
26172630

2631+
protected void onBoardOrPortChange() {
2632+
Map<String, String> boardPreferences = Base.getBoardPreferences();
2633+
lineStatus.setBoardName(boardPreferences.get("name"));
2634+
lineStatus.setSerialPort(Preferences.get("serial.port"));
2635+
lineStatus.repaint();
2636+
}
26182637

2638+
26192639
/**
26202640
* Returns the edit popup menu.
26212641
*/
26222642
class TextAreaPopup extends JPopupMenu {
2623-
//String currentDir = System.getProperty("user.dir");
2624-
String referenceFile = null;
2643+
//private String currentDir = System.getProperty("user.dir");
2644+
private String referenceFile = null;
26252645

2626-
JMenuItem cutItem;
2627-
JMenuItem copyItem;
2628-
JMenuItem discourseItem;
2629-
JMenuItem referenceItem;
2646+
private JMenuItem cutItem;
2647+
private JMenuItem copyItem;
2648+
private JMenuItem discourseItem;
2649+
private JMenuItem referenceItem;
2650+
private JMenuItem openURLItem;
2651+
private JSeparator openURLItemSeparator;
26302652

2653+
private String clickedURL;
26312654

26322655
public TextAreaPopup() {
2633-
JMenuItem item;
2634-
2656+
openURLItem = new JMenuItem("Open URL");
2657+
openURLItem.addActionListener(new ActionListener() {
2658+
public void actionPerformed(ActionEvent e) {
2659+
Base.openURL(clickedURL);
2660+
}
2661+
});
2662+
add(openURLItem);
2663+
2664+
openURLItemSeparator = new JSeparator();
2665+
add(openURLItemSeparator);
2666+
26352667
cutItem = new JMenuItem("Cut");
26362668
cutItem.addActionListener(new ActionListener() {
26372669
public void actionPerformed(ActionEvent e) {
26382670
handleCut();
26392671
}
26402672
});
2641-
this.add(cutItem);
2673+
add(cutItem);
26422674

26432675
copyItem = new JMenuItem("Copy");
26442676
copyItem.addActionListener(new ActionListener() {
26452677
public void actionPerformed(ActionEvent e) {
26462678
handleCopy();
26472679
}
26482680
});
2649-
this.add(copyItem);
2681+
add(copyItem);
26502682

26512683
discourseItem = new JMenuItem("Copy for Forum");
26522684
discourseItem.addActionListener(new ActionListener() {
26532685
public void actionPerformed(ActionEvent e) {
26542686
handleDiscourseCopy();
26552687
}
26562688
});
2657-
this.add(discourseItem);
2689+
add(discourseItem);
26582690

26592691
discourseItem = new JMenuItem("Copy as HTML");
26602692
discourseItem.addActionListener(new ActionListener() {
26612693
public void actionPerformed(ActionEvent e) {
26622694
handleHTMLCopy();
26632695
}
26642696
});
2665-
this.add(discourseItem);
2697+
add(discourseItem);
26662698

2667-
item = new JMenuItem("Paste");
2699+
JMenuItem item = new JMenuItem("Paste");
26682700
item.addActionListener(new ActionListener() {
26692701
public void actionPerformed(ActionEvent e) {
26702702
handlePaste();
26712703
}
26722704
});
2673-
this.add(item);
2705+
add(item);
26742706

26752707
item = new JMenuItem("Select All");
26762708
item.addActionListener(new ActionListener() {
26772709
public void actionPerformed(ActionEvent e) {
26782710
handleSelectAll();
26792711
}
26802712
});
2681-
this.add(item);
2713+
add(item);
26822714

2683-
this.addSeparator();
2715+
addSeparator();
26842716

26852717
item = new JMenuItem("Comment/Uncomment");
26862718
item.addActionListener(new ActionListener() {
26872719
public void actionPerformed(ActionEvent e) {
26882720
handleCommentUncomment();
26892721
}
26902722
});
2691-
this.add(item);
2723+
add(item);
26922724

26932725
item = new JMenuItem("Increase Indent");
26942726
item.addActionListener(new ActionListener() {
26952727
public void actionPerformed(ActionEvent e) {
26962728
handleIndentOutdent(true);
26972729
}
26982730
});
2699-
this.add(item);
2731+
add(item);
27002732

27012733
item = new JMenuItem("Decrease Indent");
27022734
item.addActionListener(new ActionListener() {
27032735
public void actionPerformed(ActionEvent e) {
27042736
handleIndentOutdent(false);
27052737
}
27062738
});
2707-
this.add(item);
2739+
add(item);
27082740

2709-
this.addSeparator();
2741+
addSeparator();
27102742

27112743
referenceItem = new JMenuItem("Find in Reference");
27122744
referenceItem.addActionListener(new ActionListener() {
27132745
public void actionPerformed(ActionEvent e) {
27142746
handleFindReference();
27152747
}
27162748
});
2717-
this.add(referenceItem);
2749+
add(referenceItem);
27182750
}
27192751

27202752
// if no text is selected, disable copy and cut menu items
27212753
public void show(Component component, int x, int y) {
2754+
int lineNo = textarea.getLineOfOffset(textarea.xyToOffset(x, y));
2755+
int offset = textarea.xToOffset(lineNo, x);
2756+
String line = textarea.getLineText(lineNo);
2757+
clickedURL = textarea.checkClickedURL(line, offset);
2758+
if (clickedURL != null) {
2759+
openURLItem.setVisible(true);
2760+
openURLItemSeparator.setVisible(true);
2761+
} else {
2762+
openURLItem.setVisible(false);
2763+
openURLItemSeparator.setVisible(false);
2764+
}
2765+
27222766
if (textarea.isSelectionActive()) {
27232767
cutItem.setEnabled(true);
27242768
copyItem.setEnabled(true);

0 commit comments

Comments
 (0)