MCPcopy Index your code
hub / github.com/arduino/Arduino / rebuildRecentSketchesMenuItems

Method rebuildRecentSketchesMenuItems

app/src/processing/app/Base.java:909–943  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

907 }
908
909 protected void rebuildRecentSketchesMenuItems() {
910 Set<File> recentSketches = new LinkedHashSet<File>() {
911
912 @Override
913 public boolean add(File file) {
914 if (size() >= RECENT_SKETCHES_MAX_SIZE) {
915 return false;
916 }
917 return super.add(file);
918 }
919 };
920
921 for (String path : PreferencesData.getCollection("recent.sketches")) {
922 File file = new File(path);
923 if (file.exists()) {
924 recentSketches.add(file);
925 }
926 }
927
928 recentSketchesMenuItems.clear();
929 for (final File recentSketch : recentSketches) {
930 JMenuItem recentSketchMenuItem = new JMenuItem(recentSketch.getParentFile().getName());
931 recentSketchMenuItem.addActionListener(new ActionListener() {
932 @Override
933 public void actionPerformed(ActionEvent actionEvent) {
934 try {
935 handleOpen(recentSketch);
936 } catch (Exception e) {
937 e.printStackTrace();
938 }
939 }
940 });
941 recentSketchesMenuItems.add(recentSketchMenuItem);
942 }
943 }
944
945
946 /**

Callers 4

handleOpenMethod · 0.95
buildFileMenuMethod · 0.80
handleSave2Method · 0.80
handleSaveAsMethod · 0.80

Calls 5

getCollectionMethod · 0.95
getNameMethod · 0.65
existsMethod · 0.45
addMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected