|
| 1 | +/* |
| 2 | + * Copyright 2010 Jonathan Feinberg |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); you may not |
| 5 | + * use this file except in compliance with the License. You may obtain a copy of |
| 6 | + * the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 12 | + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 13 | + * License for the specific language governing permissions and limitations under |
| 14 | + * the License. |
| 15 | + */ |
| 16 | +package jycessing.tool; |
| 17 | + |
| 18 | +import processing.app.Editor; |
| 19 | +import processing.app.tools.Tool; |
| 20 | + |
| 21 | +public class PythonMode implements Tool { |
| 22 | + private Editor editor; |
| 23 | + |
| 24 | + public String getMenuTitle() { |
| 25 | + return "Python Mode"; |
| 26 | + } |
| 27 | + |
| 28 | + public void init(final Editor editor) { |
| 29 | + this.editor = editor; |
| 30 | + } |
| 31 | + |
| 32 | + public void run() { |
| 33 | + editor.deactivateExport(); |
| 34 | + editor.setHandlers(new RunHandler(), new PresentHandler(), new StopHandler(), |
| 35 | + new ExportHandler(), new ExportAppHandler()); |
| 36 | + editor.statusNotice("Python Mode initialized."); |
| 37 | + } |
| 38 | + |
| 39 | + private class ExportHandler implements Runnable { |
| 40 | + public void run() { |
| 41 | + editor.statusError("Export not implemented in Python mode."); |
| 42 | + } |
| 43 | + } |
| 44 | + |
| 45 | + private class StopHandler implements Runnable { |
| 46 | + public void run() { |
| 47 | + editor.statusError("Stop not implemented in Python mode."); |
| 48 | + } |
| 49 | + } |
| 50 | + |
| 51 | + class PresentHandler implements Runnable { |
| 52 | + public void run() { |
| 53 | + editor.statusError("Present not implemented in Python mode."); |
| 54 | + } |
| 55 | + } |
| 56 | + |
| 57 | + class RunHandler implements Runnable { |
| 58 | + public void run() { |
| 59 | + editor.statusError("Run not implemented in Python mode."); |
| 60 | + } |
| 61 | + } |
| 62 | + |
| 63 | + class ExportAppHandler implements Runnable { |
| 64 | + public void run() { |
| 65 | + editor.statusError("Export Application not implemented in Python mode."); |
| 66 | + } |
| 67 | + } |
| 68 | +} |
0 commit comments