Last active
January 2, 2016 18:49
-
-
Save DinisCruz/8346187 to your computer and use it in GitHub Desktop.
View that shows images
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def view = eclipse.views.create("Images Embeded in Eclipse"); | |
| view.clear().set.layout.grid(2); | |
| view.add.label("Hovered image:"); | |
| def text = view.add.text().set.layout.grid_Grab_Horizontal() | |
| def panel = view.add.panel() | |
| .set.layout.row() | |
| .set.layout.grid_Grab_All(2,1) | |
| for(def name : images.names()) | |
| { | |
| def image = panel.add.image(images.get(name),name); | |
| def onMouseEnter = new java.lang.Runnable() { public void run() | |
| { | |
| text.text(image.get.toolTip()); | |
| }} | |
| image.set.event.onMouseEnter(onMouseEnter); | |
| } | |
| view.refresh() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package tm.eclipse.ui.views.utils; | |
| import tm.eclipse.helpers.Images; | |
| import tm.eclipse.swt.controls.Composite; | |
| import tm.eclipse.swt.controls.Label; | |
| import tm.eclipse.swt.controls.Text; | |
| import tm.eclipse.ui.Startup; | |
| import tm.eclipse.ui.views.Eclipse_Panel; | |
| public class IconsViewer | |
| { | |
| public IconsViewer() | |
| { | |
| createGui(); | |
| } | |
| public IconsViewer createGui() | |
| { | |
| //def view = eclipse.views.create("Images Embeded in Eclipse"); | |
| Eclipse_Panel view = Startup.eclipseApi.views.create("Images Embeded in Eclipse"); | |
| // view.clear().set.layout.grid(2); | |
| view.clear().set.layout.grid(2); | |
| // view.add.label("Hovered image:"); | |
| view.add.label("Hovered image:"); | |
| // def text = view.add.text().set.layout.grid_Grab_Horizontal() | |
| final Text text = view.add.text().set.layout.grid_Grab_Horizontal(); | |
| // def panel = view.add.panel() | |
| // .set.layout.row() | |
| // .set.layout.grid_Grab_All(2,1) | |
| Composite panel = view.add.panel() | |
| .set.layout.row() | |
| .set.layout.grid_Grab_All(2,1); | |
| // | |
| // for(def name : images.names()) | |
| for(String name : Images.names()) | |
| // { | |
| { | |
| // def image = panel.add.image(images.get(name),name); | |
| final Label image = panel.add.image(Images.get(name),name); | |
| // def onMouseEnter = new java.lang.Runnable() { public void run() | |
| // { | |
| // text.text(image.get.toolTip()); | |
| // }} | |
| Runnable onMouseEnter = new java.lang.Runnable() { public void run() | |
| { | |
| text.text(image.get.toolTip()); | |
| }}; | |
| // image.set.event.onMouseEnter(onMouseEnter); | |
| image.set.event.onMouseEnter(onMouseEnter); | |
| // } | |
| } | |
| // | |
| // view.refresh() | |
| view.refresh(); | |
| return this; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package tm.eclipse.ui.views.utils; | |
| import tm.eclipse.helpers.Images; | |
| import tm.eclipse.swt.controls.Composite; | |
| import tm.eclipse.swt.controls.Label; | |
| import tm.eclipse.swt.controls.Text; | |
| import tm.eclipse.ui.Startup; | |
| import tm.eclipse.ui.views.Eclipse_Panel; | |
| public class IconsViewer | |
| { | |
| public IconsViewer() | |
| { | |
| createGui(); | |
| } | |
| public IconsViewer createGui() | |
| { | |
| Eclipse_Panel view = Startup.eclipseApi.views.create("Images Embeded in Eclipse"); | |
| view.clear().set.layout.grid(2); | |
| view.add.label("Hovered image:"); | |
| final Text text = view.add.text().set.layout.grid_Grab_Horizontal(); | |
| Composite panel = view.add.panel() | |
| .set.layout.row() | |
| .set.layout.grid_Grab_All(2,1); | |
| for(String name : Images.names()) | |
| { | |
| final Label image = panel.add.image(Images.get(name),name); | |
| Runnable onMouseEnter = new java.lang.Runnable() { public void run() | |
| { | |
| text.text(image.get.toolTip()); | |
| }}; | |
| image.set.event.onMouseEnter(onMouseEnter); | |
| } | |
| view.refresh(); | |
| return this; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package tm.eclipse.ui.views.utils; | |
| import tm.eclipse.helpers.Images; | |
| import tm.eclipse.swt.controls.Composite; | |
| import tm.eclipse.swt.controls.Label; | |
| import tm.eclipse.swt.controls.Text; | |
| import tm.eclipse.ui.Startup; | |
| import tm.eclipse.ui.views.Eclipse_Panel; | |
| public class IconsViewer | |
| { | |
| EclipseAPI eclipse; | |
| Eclipse_Panel view; | |
| Text text; | |
| Composite panel; | |
| public IconsViewer() | |
| { | |
| eclipse = Startup.eclipseApi; | |
| createGui(); | |
| } | |
| public IconsViewer createGui() | |
| { | |
| view = eclipse.views.create("Images Embeded in Eclipse"); | |
| view.clear().set.layout.grid(2) | |
| .add.label("Hovered image:"); | |
| text = view.add.text() | |
| .set.layout.grid_Grab_Horizontal(); | |
| panel = view.add.panel() | |
| .set.layout.row() | |
| .set.layout.grid_Grab_All(2,1); | |
| for(String name : Images.names()) | |
| { | |
| final Label image = panel.add.image(Images.get(name),name); | |
| image.set.event.onMouseEnter(new java.lang.Runnable() { public void run() | |
| { | |
| text.text(image.get.toolTip()); | |
| }}); | |
| } | |
| view.refresh(); | |
| return this; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import tm.eclipse.ui.views.utils.*; | |
| def iconsViewer = new IconsViewer(); | |
| Thread.sleep(1000); | |
| iconsViewer.view.add.label("New text:") | |
| iconsViewer.view.add.textArea("box with multi line content").set.layout.grid_Grab_All() | |
| iconsViewer.view.refresh() | |
| return "done"; | |
| //Config:UIThread_False() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import tm.eclipse.ui.views.utils.*; | |
| def iconsViewer = new IconsViewer(); | |
| //Thread.sleep(1000); | |
| iconsViewer.view.add.label("Now with an Image:") | |
| iconsViewer.view.add.image("IMG_FIELD_PUBLIC") | |
| .set.layout.grid_Grab_All() | |
| .set.color.back_Red() | |
| iconsViewer.view.refresh() | |
| return "done"; | |
| //Config:UIThread_False() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment