List of usage examples for org.eclipse.jface.resource ImageDescriptor createFromFile
public static ImageDescriptor createFromFile(Class<?> location, String filename)
From source file:com.predic8.plugin.membrane_client.ui.PluginUtil.java
License:Apache License
public static Image createImage(String path, String key) { if (MembraneClientUIPlugin.getDefault() == null) return ImageDescriptor.createFromFile(MembraneClientUIPlugin.class, path).createImage(); return MembraneClientUIPlugin.getDefault().getImageRegistry().getDescriptor(key).createImage(); }
From source file:com.rinke.solutions.pinball.PinDmdEditor.java
/** * Create contents of the window.//from w w w. jav a2 s. c o m */ void createContents(Shell shell) { shell.setSize(1238, 657); shell.setText("Pin2dmd - Editor"); shell.setLayout(new GridLayout(4, false)); createMenu(shell); recentProjectsMenuManager = new RecentMenuManager("recentProject", 4, menuPopRecentProjects, e -> loadProject((String) e.widget.getData())); recentProjectsMenuManager.loadRecent(); recentPalettesMenuManager = new RecentMenuManager("recentPalettes", 4, mntmRecentPalettes, e -> paletteHandler.loadPalette((String) e.widget.getData())); recentPalettesMenuManager.loadRecent(); recentAnimationsMenuManager = new RecentMenuManager("recentAnimations", 4, mntmRecentAnimations, e -> aniAction.loadAni(((String) e.widget.getData()), true, false)); recentAnimationsMenuManager.loadRecent(); resManager = new LocalResourceManager(JFaceResources.getResources(), shell); Label lblAnimations = new Label(shell, SWT.NONE); lblAnimations.setText("Animations"); Label lblKeyframes = new Label(shell, SWT.NONE); lblKeyframes.setText("KeyFrames"); Label lblPreview = new Label(shell, SWT.NONE); lblPreview.setText("Preview"); new Label(shell, SWT.NONE); aniListViewer = new TableViewer(shell, SWT.BORDER | SWT.V_SCROLL); Table aniList = aniListViewer.getTable(); GridData gd_aniList = new GridData(SWT.LEFT, SWT.FILL, false, false, 1, 1); gd_aniList.widthHint = 189; aniList.setLayoutData(gd_aniList); aniList.setLinesVisible(true); aniList.addKeyListener(new EscUnselect(aniListViewer)); aniListViewer.setContentProvider(ArrayContentProvider.getInstance()); aniListViewer.setLabelProvider(new LabelProviderAdapter(o -> ((Animation) o).getDesc())); aniListViewer.setInput(animations.values()); aniListViewer.addSelectionChangedListener(event -> { IStructuredSelection selection = (IStructuredSelection) event.getSelection(); onAnimationSelectionChanged(selection.size() > 0 ? (Animation) selection.getFirstElement() : null); }); TableViewerColumn viewerCol1 = new TableViewerColumn(aniListViewer, SWT.LEFT); viewerCol1.setEditingSupport( new GenericTextCellEditor(aniListViewer, e -> ((Animation) e).getDesc(), (e, v) -> { Animation ani = (Animation) e; updateAnimationMapKey(ani.getDesc(), v); ani.setDesc(v); frameSeqViewer.refresh(); })); viewerCol1.getColumn().setWidth(220); viewerCol1.setLabelProvider(new ColumnLabelProviderAdapter(o -> ((Animation) o).getDesc())); keyframeTableViewer = new TableViewer(shell, SWT.SINGLE | SWT.V_SCROLL); Table keyframeList = keyframeTableViewer.getTable(); GridData gd_keyframeList = new GridData(SWT.LEFT, SWT.FILL, false, false, 1, 1); gd_keyframeList.widthHint = 137; keyframeList.setLinesVisible(true); keyframeList.setLayoutData(gd_keyframeList); keyframeList.addKeyListener(new EscUnselect(keyframeTableViewer)); //keyframeTableViewer.setLabelProvider(new KeyframeLabelProvider(shell)); keyframeTableViewer.setContentProvider(ArrayContentProvider.getInstance()); keyframeTableViewer.setInput(project.palMappings); keyframeTableViewer.addSelectionChangedListener(event -> keyFrameChanged(event)); TableViewerColumn viewerColumn = new TableViewerColumn(keyframeTableViewer, SWT.LEFT); viewerColumn.setEditingSupport( new GenericTextCellEditor(keyframeTableViewer, e -> ((PalMapping) e).name, (e, v) -> { ((PalMapping) e).name = v; })); viewerColumn.getColumn().setWidth(200); viewerColumn.setLabelProvider(new KeyframeLabelProvider(shell)); dmdWidget = new DMDWidget(shell, SWT.DOUBLE_BUFFERED, this.dmd, true); // dmdWidget.setBounds(0, 0, 700, 240); GridData gd_dmdWidget = new GridData(SWT.FILL, SWT.FILL, false, false, 2, 1); gd_dmdWidget.heightHint = 231; gd_dmdWidget.widthHint = 826; dmdWidget.setLayoutData(gd_dmdWidget); dmdWidget.setPalette(activePalette); dmdWidget.addListeners(l -> frameChanged(l)); Composite composite_1 = new Composite(shell, SWT.NONE); composite_1.setLayout(new GridLayout(2, false)); GridData gd_composite_1 = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1); gd_composite_1.heightHint = 35; gd_composite_1.widthHint = 206; composite_1.setLayoutData(gd_composite_1); btnRemoveAni = new Button(composite_1, SWT.NONE); btnRemoveAni.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1)); btnRemoveAni.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { } }); btnRemoveAni.setText("Remove"); btnRemoveAni.setEnabled(false); btnRemoveAni.addListener(SWT.Selection, e -> { if (selectedAnimation.isPresent()) { String key = selectedAnimation.get().getDesc(); animations.remove(key); playingAnis.clear(); animationHandler.setAnimations(playingAnis); animationHandler.setClockActive(true); } }); btnSortAni = new Button(composite_1, SWT.NONE); btnSortAni.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1)); btnSortAni.setText("Sort"); btnSortAni.addListener(SWT.Selection, e -> sortAnimations()); Composite composite_2 = new Composite(shell, SWT.NONE); composite_2.setLayout(new GridLayout(3, false)); GridData gd_composite_2 = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1); gd_composite_2.heightHint = 35; gd_composite_2.widthHint = 157; composite_2.setLayoutData(gd_composite_2); btnDeleteKeyframe = new Button(composite_2, SWT.NONE); GridData gd_btnDeleteKeyframe = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1); gd_btnDeleteKeyframe.widthHint = 88; btnDeleteKeyframe.setLayoutData(gd_btnDeleteKeyframe); btnDeleteKeyframe.setText("Remove"); btnDeleteKeyframe.setEnabled(false); btnDeleteKeyframe.addListener(SWT.Selection, e -> { if (selectedPalMapping != null) { project.palMappings.remove(selectedPalMapping); keyframeTableViewer.refresh(); checkReleaseMask(); } }); Button btnSortKeyFrames = new Button(composite_2, SWT.NONE); btnSortKeyFrames.setText("Sort"); btnSortKeyFrames.addListener(SWT.Selection, e -> sortKeyFrames()); new Label(composite_2, SWT.NONE); scale = new Scale(shell, SWT.NONE); scale.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 2, 1)); scale.addListener(SWT.Selection, e -> animationHandler.setPos(scale.getSelection())); Group grpKeyframe = new Group(shell, SWT.NONE); grpKeyframe.setLayout(new GridLayout(3, false)); GridData gd_grpKeyframe = new GridData(SWT.FILL, SWT.TOP, false, false, 2, 4); gd_grpKeyframe.heightHint = 191; gd_grpKeyframe.widthHint = 350; grpKeyframe.setLayoutData(gd_grpKeyframe); grpKeyframe.setText("KeyFrames"); Composite composite_hash = new Composite(grpKeyframe, SWT.NONE); //gd_composite_hash.widthHint = 105; GridData gd_composite_hash = new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1); gd_composite_hash.widthHint = 148; composite_hash.setLayoutData(gd_composite_hash); createHashButtons(composite_hash, 10, 0); previewDmd = new DMDWidget(grpKeyframe, SWT.DOUBLE_BUFFERED, dmd, false); GridData gd_dmdPreWidget = new GridData(SWT.CENTER, SWT.TOP, false, false, 1, 1); gd_dmdPreWidget.heightHint = 40; gd_dmdPreWidget.widthHint = 132; previewDmd.setLayoutData(gd_dmdPreWidget); previewDmd.setDrawingEnabled(false); previewDmd.setPalette(previewPalettes.get(0)); new Label(grpKeyframe, SWT.NONE); btnAddColormaskKeyFrame = new Button(grpKeyframe, SWT.NONE); btnAddColormaskKeyFrame .setToolTipText("Adds a key frame that trigger a color masking scene to be overlayed"); btnAddColormaskKeyFrame.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); btnAddColormaskKeyFrame.setText("Add ColorMask"); btnAddColormaskKeyFrame.setEnabled(false); btnAddColormaskKeyFrame.addListener(SWT.Selection, e -> addFrameSeq(SwitchMode.ADD)); btnAddKeyframe = new Button(grpKeyframe, SWT.NONE); btnAddKeyframe.setToolTipText("Adds a key frame that switches palette"); btnAddKeyframe.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, false, false, 1, 1)); btnAddKeyframe.setText("Add PalSwitch"); btnAddKeyframe.setEnabled(false); btnAddKeyframe.addListener(SWT.Selection, e -> addKeyFrame(SwitchMode.PALETTE)); Label lblDuration = new Label(grpKeyframe, SWT.NONE); lblDuration.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblDuration.setText("Duration:"); txtDuration = new Text(grpKeyframe, SWT.BORDER); GridData gd_txtDuration = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1); gd_txtDuration.widthHint = 93; txtDuration.setLayoutData(gd_txtDuration); txtDuration.setText("0"); txtDuration.addListener(SWT.Verify, e -> e.doit = Pattern.matches("^[0-9]*$", e.text)); txtDuration.addListener(SWT.Modify, e -> { if (selectedPalMapping != null) { selectedPalMapping.durationInMillis = Integer.parseInt(txtDuration.getText()); selectedPalMapping.durationInFrames = (int) selectedPalMapping.durationInMillis / 40; } }); btnFetchDuration = new Button(grpKeyframe, SWT.NONE); btnFetchDuration.setToolTipText( "Fetches duration for palette switches by calculating the difference between actual timestamp and keyframe timestamp"); btnFetchDuration.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); btnFetchDuration.setText("Fetch Duration"); btnFetchDuration.setEnabled(false); btnFetchDuration.addListener(SWT.Selection, e -> { if (selectedPalMapping != null) { selectedPalMapping.durationInMillis = lastTimeCode - saveTimeCode; selectedPalMapping.durationInFrames = (int) selectedPalMapping.durationInMillis / FRAME_RATE; txtDuration.setText(selectedPalMapping.durationInMillis + ""); } }); Label lblNewLabel = new Label(grpKeyframe, SWT.NONE); lblNewLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblNewLabel.setText("FrameSeq:"); frameSeqViewer = new ComboViewer(grpKeyframe, SWT.NONE); Combo frameSeqCombo = frameSeqViewer.getCombo(); frameSeqCombo.setToolTipText("Choose frame sequence to use with key frame"); GridData gd_frameSeqCombo = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1); gd_frameSeqCombo.widthHint = 100; frameSeqCombo.setLayoutData(gd_frameSeqCombo); frameSeqViewer.setLabelProvider(new LabelProviderAdapter(o -> ((Animation) o).getDesc())); frameSeqViewer.setContentProvider(ArrayContentProvider.getInstance()); frameSeqViewer.setInput(frameSeqList); frameSeqViewer.addSelectionChangedListener(event -> frameSeqChanged(event)); btnAddFrameSeq = new Button(grpKeyframe, SWT.NONE); btnAddFrameSeq.setToolTipText("Adds a keyframe that triggers playback of a replacement scene"); btnAddFrameSeq.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); btnAddFrameSeq.setText("Add FrameSeq"); btnAddFrameSeq.addListener(SWT.Selection, e -> addFrameSeq(SwitchMode.REPLACE)); btnAddFrameSeq.setEnabled(false); Group grpDetails = new Group(shell, SWT.NONE); grpDetails.setLayout(new GridLayout(10, false)); GridData gd_grpDetails = new GridData(SWT.FILL, SWT.FILL, false, false, 2, 1); gd_grpDetails.heightHint = 21; gd_grpDetails.widthHint = 776; grpDetails.setLayoutData(gd_grpDetails); grpDetails.setText("Details"); Label lblFrame = new Label(grpDetails, SWT.NONE); lblFrame.setText("Frame:"); lblFrameNo = new Label(grpDetails, SWT.NONE); GridData gd_lblFrameNo = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1); gd_lblFrameNo.widthHint = 66; gd_lblFrameNo.minimumWidth = 60; lblFrameNo.setLayoutData(gd_lblFrameNo); lblFrameNo.setText("---"); Label lblTimecode = new Label(grpDetails, SWT.NONE); lblTimecode.setText("Timecode:"); lblTcval = new Label(grpDetails, SWT.NONE); GridData gd_lblTcval = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1); gd_lblTcval.widthHint = 62; gd_lblTcval.minimumWidth = 80; lblTcval.setLayoutData(gd_lblTcval); lblTcval.setText("---"); Label lblDelay = new Label(grpDetails, SWT.NONE); lblDelay.setText("Delay:"); lblDelayVal = new Label(grpDetails, SWT.NONE); GridData gd_lblDelayVal = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1); gd_lblDelayVal.widthHint = 53; lblDelayVal.setLayoutData(gd_lblDelayVal); lblDelayVal.setText("---"); Label lblPlanes = new Label(grpDetails, SWT.NONE); lblPlanes.setText("Planes:"); lblPlanesVal = new Label(grpDetails, SWT.NONE); lblPlanesVal.setText("---"); new Label(grpDetails, SWT.NONE); btnLivePreview = new Button(grpDetails, SWT.CHECK); btnLivePreview.setToolTipText("controls live preview to real display device"); btnLivePreview.setText("Live Preview"); btnLivePreview.addListener(SWT.Selection, e -> switchLivePreview(e)); Composite composite = new Composite(shell, SWT.NONE); composite.setLayout(new GridLayout(9, false)); composite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 2, 1)); btnStartStop = new Button(composite, SWT.NONE); btnStartStop.setText("Start"); btnStartStop.addListener(SWT.Selection, e -> startStop(animationHandler.isStopped())); btnPrev = new Button(composite, SWT.NONE); btnPrev.setText("<"); btnPrev.addListener(SWT.Selection, e -> prevFrame()); btnNext = new Button(composite, SWT.NONE); btnNext.setText(">"); btnNext.addListener(SWT.Selection, e -> nextFrame()); btnMarkStart = new Button(composite, SWT.NONE); btnMarkStart.setToolTipText("Marks start of scene for cutting"); btnMarkEnd = new Button(composite, SWT.NONE); btnCut = new Button(composite, SWT.NONE); btnCut.setToolTipText("Cuts out a new scene for editing and use a replacement or color mask"); btnMarkStart.setText("Mark Start"); btnMarkStart.addListener(SWT.Selection, e -> { cutInfo.setStart(selectedAnimation.get().actFrame); }); btnMarkEnd.setText("Mark End"); btnMarkEnd.addListener(SWT.Selection, e -> { cutInfo.setEnd(selectedAnimation.get().actFrame); }); btnCut.setText("Cut"); btnCut.addListener(SWT.Selection, e -> { // respect number of planes while cutting / copying Animation ani = cutScene(selectedAnimation.get(), cutInfo.getStart(), cutInfo.getEnd(), "Scene " + animations.size()); log.info("cutting out scene from {} to {}", cutInfo); cutInfo.reset(); // TODO mark such a scene somehow, to copy it to the // projects frames sequence for later export // alternatively introduce a dedicated flag for scenes that // should be exported // also define a way that a keyframe triggers a replacement // sequence instead of switching // the palette only // TODO NEED TO ADD a reference to the animation in the list // / map project.scenes.add(new Scene(ani.getDesc(), ani.start, ani.end, activePalette.index)); }); new Label(composite, SWT.NONE); Button btnIncPitch = new Button(composite, SWT.NONE); btnIncPitch.setText("+"); btnIncPitch.addListener(SWT.Selection, e -> dmdWidget.incPitch()); Button btnDecPitch = new Button(composite, SWT.NONE); btnDecPitch.setText("-"); btnDecPitch.addListener(SWT.Selection, e -> dmdWidget.decPitch()); Group grpPalettes = new Group(shell, SWT.NONE); grpPalettes.setLayout(new GridLayout(4, false)); GridData gd_grpPalettes = new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1); gd_grpPalettes.widthHint = 479; gd_grpPalettes.heightHint = 71; grpPalettes.setLayoutData(gd_grpPalettes); grpPalettes.setText("Palettes"); paletteComboViewer = new ComboViewer(grpPalettes, SWT.NONE); Combo combo = paletteComboViewer.getCombo(); GridData gd_combo = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1); gd_combo.widthHint = 166; combo.setLayoutData(gd_combo); paletteComboViewer.setContentProvider(ArrayContentProvider.getInstance()); paletteComboViewer .setLabelProvider(new LabelProviderAdapter(o -> ((Palette) o).index + " - " + ((Palette) o).name)); paletteComboViewer.setInput(project.palettes); paletteComboViewer.addSelectionChangedListener(event -> { IStructuredSelection selection = (IStructuredSelection) event.getSelection(); if (selection.size() > 0) { paletteChanged((Palette) selection.getFirstElement()); } }); paletteTypeComboViewer = new ComboViewer(grpPalettes, SWT.READ_ONLY); Combo combo_1 = paletteTypeComboViewer.getCombo(); combo_1.setToolTipText( "Type of palette. Default palette is choosen at start and after timed switch is expired"); GridData gd_combo_1 = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1); gd_combo_1.widthHint = 85; combo_1.setLayoutData(gd_combo_1); paletteTypeComboViewer.setContentProvider(ArrayContentProvider.getInstance()); paletteTypeComboViewer.setInput(PaletteType.values()); paletteTypeComboViewer.setSelection(new StructuredSelection(activePalette.type)); paletteTypeComboViewer.addSelectionChangedListener(e -> paletteTypeChanged(e)); btnNewPalette = new Button(grpPalettes, SWT.NONE); btnNewPalette.setToolTipText("Creates a new palette by copying the actual colors"); btnNewPalette.setText("New"); btnNewPalette.addListener(SWT.Selection, e -> paletteHandler.newPalette()); btnRenamePalette = new Button(grpPalettes, SWT.NONE); btnRenamePalette.setToolTipText("Confirms the new palette name"); btnRenamePalette.setText("Rename"); btnRenamePalette.addListener(SWT.Selection, e -> { String newName = paletteComboViewer.getCombo().getText(); if (newName.contains(" - ")) { activePalette.name = newName.split(" - ")[1]; paletteComboViewer.setSelection(new StructuredSelection(activePalette)); paletteComboViewer.refresh(); } else { warn("Illegal palette name", "Palette names must consist of palette index and name.\nName format therefore must be '<idx> - <name>'"); paletteComboViewer.getCombo().setText(activePalette.index + " - " + activePalette.name); } }); Composite grpPal = new Composite(grpPalettes, SWT.NONE); grpPal.setLayout(new GridLayout(1, false)); GridData gd_grpPal = new GridData(SWT.LEFT, SWT.TOP, false, false, 2, 1); gd_grpPal.widthHint = 313; gd_grpPal.heightHint = 22; grpPal.setLayoutData(gd_grpPal); // GridData gd_grpPal = new GridData(SWT.LEFT, SWT.CENTER, false, false, // 1, 1); // gd_grpPal.widthHint = 223; // gd_grpPal.heightHint = 61; // grpPal.setLayoutData(gd_grpPal); // paletteTool = new PaletteTool(shell, grpPal, SWT.FLAT | SWT.RIGHT, activePalette); paletteTool.addListener(dmdWidget); Label lblCtrlclickToEdit = new Label(grpPalettes, SWT.NONE); GridData gd_lblCtrlclickToEdit = new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1); gd_lblCtrlclickToEdit.widthHint = 139; lblCtrlclickToEdit.setLayoutData(gd_lblCtrlclickToEdit); lblCtrlclickToEdit.setText("Ctrl-Click to edit color"); Composite composite_3 = new Composite(shell, SWT.NONE); GridLayout gl_composite_3 = new GridLayout(1, false); gl_composite_3.marginWidth = 0; gl_composite_3.marginHeight = 0; composite_3.setLayout(gl_composite_3); GridData gd_composite_3 = new GridData(SWT.LEFT, SWT.FILL, false, false, 1, 2); gd_composite_3.heightHint = 190; gd_composite_3.widthHint = 338; composite_3.setLayoutData(gd_composite_3); goDmdGroup = new GoDmdGroup(composite_3); Group grpDrawing = new Group(shell, SWT.NONE); grpDrawing.setLayout(new GridLayout(6, false)); GridData gd_grpDrawing = new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1); gd_grpDrawing.heightHint = 63; gd_grpDrawing.widthHint = 479; grpDrawing.setLayoutData(gd_grpDrawing); grpDrawing.setText("Drawing"); drawToolBar = new ToolBar(grpDrawing, SWT.FLAT | SWT.RIGHT); drawToolBar.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1)); ToolItem tltmPen = new ToolItem(drawToolBar, SWT.RADIO); tltmPen.setImage( resManager.createImage(ImageDescriptor.createFromFile(PinDmdEditor.class, "/icons/pencil.png"))); tltmPen.addListener(SWT.Selection, e -> dmdWidget.setDrawTool(drawTools.get("pencil"))); ToolItem tltmFill = new ToolItem(drawToolBar, SWT.RADIO); tltmFill.setImage(resManager .createImage(ImageDescriptor.createFromFile(PinDmdEditor.class, "/icons/color-fill.png"))); tltmFill.addListener(SWT.Selection, e -> dmdWidget.setDrawTool(drawTools.get("fill"))); ToolItem tltmRect = new ToolItem(drawToolBar, SWT.RADIO); tltmRect.setImage( resManager.createImage(ImageDescriptor.createFromFile(PinDmdEditor.class, "/icons/rect.png"))); tltmRect.addListener(SWT.Selection, e -> dmdWidget.setDrawTool(drawTools.get("rect"))); ToolItem tltmLine = new ToolItem(drawToolBar, SWT.RADIO); tltmLine.setImage( resManager.createImage(ImageDescriptor.createFromFile(PinDmdEditor.class, "/icons/line.png"))); tltmLine.addListener(SWT.Selection, e -> dmdWidget.setDrawTool(drawTools.get("line"))); ToolItem tltmCircle = new ToolItem(drawToolBar, SWT.RADIO); tltmCircle.setImage( resManager.createImage(ImageDescriptor.createFromFile(PinDmdEditor.class, "/icons/oval.png"))); tltmCircle.addListener(SWT.Selection, e -> dmdWidget.setDrawTool(drawTools.get("circle"))); ToolItem tltmColorize = new ToolItem(drawToolBar, SWT.RADIO); tltmColorize.setImage( resManager.createImage(ImageDescriptor.createFromFile(PinDmdEditor.class, "/icons/colorize.png"))); tltmColorize.addListener(SWT.Selection, e -> dmdWidget.setDrawTool(drawTools.get("colorize"))); drawTools.put("pencil", new SetPixelTool(paletteTool.getSelectedColor())); drawTools.put("fill", new FloodFillTool(paletteTool.getSelectedColor())); drawTools.put("rect", new RectTool(paletteTool.getSelectedColor())); drawTools.put("line", new LineTool(paletteTool.getSelectedColor())); drawTools.put("circle", new CircleTool(paletteTool.getSelectedColor())); drawTools.put("colorize", new ColorizeTool(paletteTool.getSelectedColor())); drawTools.values().forEach(d -> paletteTool.addIndexListener(d)); paletteTool.addListener(palette -> { if (livePreviewActive) { connector.upload(activePalette, handle); } }); new Label(grpDrawing, SWT.NONE); btnColorMask = new Button(grpDrawing, SWT.CHECK); btnColorMask.setToolTipText("limits drawing to upper planes, so that this will just add coloring layers"); btnColorMask.setText("ColMask"); btnColorMask.addListener(SWT.Selection, e -> switchColorMask(btnColorMask.getSelection())); Label lblMaskNo = new Label(grpDrawing, SWT.NONE); lblMaskNo.setText("Mask No:"); maskSpinner = new Spinner(grpDrawing, SWT.BORDER); maskSpinner.setToolTipText("select the mask to use"); maskSpinner.setMinimum(0); maskSpinner.setMaximum(9); maskSpinner.addListener(SWT.Selection, e -> maskNumberChanged(e)); btnMask = new Button(grpDrawing, SWT.CHECK); btnMask.setText("Show Mask"); btnMask.addListener(SWT.Selection, e -> switchMask(btnMask.getSelection())); btnCopyToPrev = new Button(grpDrawing, SWT.NONE); btnCopyToPrev.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); btnCopyToPrev.setText("CopyToPrev"); btnCopyToPrev.addListener(SWT.Selection, e -> copyAndMoveToPrevFrame()); new Label(grpDrawing, SWT.NONE); btnCopyToNext = new Button(grpDrawing, SWT.NONE); btnCopyToNext.setToolTipText("copy the actual scene / color mask to next frame and move forward"); btnCopyToNext.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1)); btnCopyToNext.setText("CopyToNext"); btnCopyToNext.addListener(SWT.Selection, e -> copyAndMoveToNextFrame()); btnUndo = new Button(grpDrawing, SWT.NONE); btnUndo.setText("&Undo"); btnUndo.addListener(SWT.Selection, e -> undo()); btnRedo = new Button(grpDrawing, SWT.NONE); btnRedo.setText("&Redo"); btnRedo.addListener(SWT.Selection, e -> redo()); ObserverManager.bind(maskDmdObserver, e -> btnUndo.setEnabled(e), () -> maskDmdObserver.canUndo()); ObserverManager.bind(maskDmdObserver, e -> btnRedo.setEnabled(e), () -> maskDmdObserver.canRedo()); }
From source file:com.tsc9526.monalisa.plugin.eclipse.resources.Resource.java
License:Open Source License
public static ImageDescriptor getImage(String name) { return ImageDescriptor.createFromFile(Resource.class, name + ".png"); }
From source file:com.twinsoft.convertigo.eclipse.ConvertigoPlugin.java
License:Open Source License
private void createConsoles() { ConsolePlugin consolePlugin = ConsolePlugin.getDefault(); IConsoleManager consoleManager = consolePlugin.getConsoleManager(); studioConsole = new MessageConsole("Studio", ImageDescriptor.createFromFile(getClass(), "/consoles/convertigo.gif")); studioConsole.setTabWidth(TAB_WIDTH); studioConsoleStream = studioConsole.newMessageStream(); stdoutConsole = new MessageConsole("Stdout", ImageDescriptor.createFromFile(getClass(), "/consoles/stdout.gif")); stdoutConsole.setTabWidth(TAB_WIDTH); stdoutConsoleStream = stdoutConsole.newMessageStream(); stderrConsoleStream = stdoutConsole.newMessageStream(); stderrConsoleStream.setColor(stderrConsoleStreamColor); traceConsole = new MessageConsole("Trace [no trace file]", ImageDescriptor.createFromFile(getClass(), "/consoles/trace.gif")); traceConsole.setTabWidth(TAB_WIDTH); traceConsoleStream = traceConsole.newMessageStream(); engineConsole = new MessageConsole("Engine", ImageDescriptor.createFromFile(getClass(), "/consoles/engine.gif")); engineConsole.setTabWidth(TAB_WIDTH); engineConsoleStream = engineConsole.newMessageStream(); debugConsole = new MessageConsole("Debug [no current session]", ImageDescriptor.createFromFile(getClass(), "/consoles/tomcat.gif")); debugConsole.setTabWidth(TAB_WIDTH); debugConsoleStream = debugConsole.newMessageStream(); consoleManager.addConsoles(//from www. j a v a 2s.co m new IConsole[] { engineConsole, stdoutConsole, traceConsole, debugConsole, studioConsole, }); // Restore previously opened console views /* final String consoles = properties.getProperty(ConvertigoPlugin.ConfigurationProperties.OPENED_CONSOLES); final IWorkbench workbench = PlatformUI.getWorkbench(); workbench.getDisplay().asyncExec(new Runnable() { public void run() { IWorkbenchWindow window = workbench.getActiveWorkbenchWindow(); IWorkbenchPage page = window.getActivePage(); String[] array = consoles.split(","); //System.out.println(consoles);// int counter = 1; for (int i=0; i<array.length; i++) { String consoleName = array[i]; try { ConsoleView consoleView = null; // restore console if (consoleName.indexOf("connector") == 0) { consoleView = (ConsoleView)page.showView(IConsoleConstants.ID_CONSOLE_VIEW, "Console View #" + counter++, 1); consoleView.consolesAdded(new IConsole[] { connectorConsole}); } else if (consoleName.indexOf("studio") == 0) { consoleView = (ConsoleView)page.showView(IConsoleConstants.ID_CONSOLE_VIEW, "Console View #" + counter++, 1); consoleView.consolesAdded(new IConsole[] { studioConsole}); } else if (consoleName.indexOf("engine") == 0) { consoleView = (ConsoleView)page.showView(IConsoleConstants.ID_CONSOLE_VIEW, "Console View #" + counter++, 1); consoleView.consolesAdded(new IConsole[] { engineConsole}); } else if (consoleName.indexOf("tomcat") == 0) { consoleView = (ConsoleView)page.showView(IConsoleConstants.ID_CONSOLE_VIEW, "Console View #" + counter++, 1); consoleView.consolesAdded(new IConsole[] { tomcatConsole}); } else if (consoleName.indexOf("trace") == 0) { consoleView = (ConsoleView)page.showView(IConsoleConstants.ID_CONSOLE_VIEW, "Console View #" + counter++, 1); consoleView.consolesAdded(new IConsole[] { traceConsole}); } else if (consoleName.indexOf("debug") == 0) { consoleView = (ConsoleView)page.showView(IConsoleConstants.ID_CONSOLE_VIEW, "Console View #" + counter++, 1); consoleView.consolesAdded(new IConsole[] { debugConsole}); } else if (consoleName.indexOf("stdout") == 0) { consoleView = (ConsoleView)page.showView(IConsoleConstants.ID_CONSOLE_VIEW, "Console View #" + counter++, 1); consoleView.consolesAdded(new IConsole[] { stdoutConsole}); } } catch (PartInitException e) { ConvertigoPlugin.logException(e, "Unexpected exception"); } if (counter >= 7) break; } }}); */ consolePipes = new ConsolePipes(); }
From source file:com.twinsoft.convertigo.eclipse.views.projectexplorer.ViewLabelDecorator.java
License:Open Source License
private Image getOverlayImageIcon(Image image, String iconName, int corner) { ImageDescriptor overlayDescriptor = ImageDescriptor.createFromFile(ViewImageProvider.class, iconName); OverlayImageIcon overlayImageIcon = new OverlayImageIcon(image, overlayDescriptor, corner); Image OverlayImageIcon = overlayImageIcon.createImage(); return OverlayImageIcon; }
From source file:com.twinsoft.convertigo.eclipse.views.schema.SchemaViewLabelDecorator.java
License:Open Source License
private Image getOverlayImageIcon(Image image, String iconName, int corner) { ImageDescriptor overlayDescriptor = ImageDescriptor.createFromFile(SchemaViewLabelDecorator.class, "images/" + iconName); OverlayImageIcon overlayImageIcon = new OverlayImageIcon(image, overlayDescriptor, corner); Image OverlayImageIcon = overlayImageIcon.createImage(); return OverlayImageIcon; }
From source file:com.wincom.actor.editor.flow.FlowEditorPaletteFactory.java
License:Open Source License
private static PaletteContainer createComponentsDrawer() { log.info("check"); PaletteDrawer drawer = new PaletteDrawer("Components", null); List entries = new ArrayList(); CombinedTemplateCreationEntry combined = new CombinedTemplateCreationEntry("Activity", "Create a new Activity Node", Activity.class, new SimpleFactory(Activity.class), ImageDescriptor.createFromFile(FlowPlugin.class, "images/gear16.gif"), ImageDescriptor.createFromFile(Activity.class, "images/gear16.gif")); entries.add(combined);//from w w w . j av a2 s . co m combined = new CombinedTemplateCreationEntry("Sequential Activity", "Create a Sequential Activity", SequentialActivity.class, new SimpleFactory(SequentialActivity.class), ImageDescriptor.createFromFile(FlowPlugin.class, "images/sequence16.gif"), ImageDescriptor.createFromFile(FlowPlugin.class, "images/sequence16.gif")); entries.add(combined); combined = new CombinedTemplateCreationEntry("Parallel Activity", "Create a Parallel Activity", ParallelActivity.class, new SimpleFactory(ParallelActivity.class), ImageDescriptor.createFromFile(FlowPlugin.class, "images/parallel16.gif"), ImageDescriptor.createFromFile(FlowPlugin.class, "images/parallel16.gif")); entries.add(combined); drawer.addAll(entries); return drawer; }
From source file:com.wincom.actor.editor.flow.FlowEditorPaletteFactory.java
License:Open Source License
private static PaletteContainer createControlGroup(PaletteRoot root) { log.info("check"); PaletteGroup controlGroup = new PaletteGroup("Control Group"); List entries = new ArrayList(); ToolEntry tool = new SelectionToolEntry(); entries.add(tool);// ww w.ja v a 2 s . c om root.setDefaultEntry(tool); tool = new MarqueeToolEntry(); entries.add(tool); PaletteSeparator sep = new PaletteSeparator("com.wincom.actor.editor.flow.flowplugin.sep2"); sep.setUserModificationPermission(PaletteEntry.PERMISSION_NO_MODIFICATION); entries.add(sep); tool = new ConnectionCreationToolEntry("Connection Creation", "Creating connections", null, ImageDescriptor.createFromFile(FlowPlugin.class, "images/connection16.gif"), ImageDescriptor.createFromFile(Activity.class, "images/connection16.gif")); entries.add(tool); controlGroup.addAll(entries); return controlGroup; }
From source file:com.wincom.actor.editor.flow.ui.FlowWizardPage1.java
License:Open Source License
public FlowWizardPage1(IWorkbench aWorkbench, IStructuredSelection selection) { super("sampleFlowPage1", selection); log.info("check"); this.setTitle("Create Flow Example File"); this.setDescription("Create a new flow file resource"); this.setImageDescriptor(ImageDescriptor.createFromFile(FlowPlugin.class, "images/flowbanner.gif")); this.workbench = aWorkbench; }
From source file:com.wincom.actor.editor.test1.TestEditorPaletteFactory.java
License:Open Source License
private static PaletteContainer createComponentsDrawer() { PaletteDrawer drawer = new PaletteDrawer("Components", null); List entries = new ArrayList(); CombinedTemplateCreationEntry combined = new CombinedTemplateCreationEntry("Figure1", "Create a new Figure1 Node", Figure1Model.class, new SimpleFactory(Figure1Model.class), ImageDescriptor.createFromFile(TestPlugin.class, "images/gear16.gif"), ImageDescriptor.createFromFile(Figure1Model.class, "images/gear16.gif")); entries.add(combined);//from www . j a va2 s .c o m combined = new CombinedTemplateCreationEntry("Figure2", "Create a Figure2", Figure2Model.class, new SimpleFactory(Figure2Model.class), ImageDescriptor.createFromFile(TestPlugin.class, "images/sequence16.gif"), ImageDescriptor.createFromFile(TestPlugin.class, "images/sequence16.gif")); entries.add(combined); combined = new CombinedTemplateCreationEntry("Figure3", "Create a Figure3", Figure3Model.class, new SimpleFactory(Figure3Model.class), ImageDescriptor.createFromFile(TestPlugin.class, "images/parallel16.gif"), ImageDescriptor.createFromFile(TestPlugin.class, "images/parallel16.gif")); entries.add(combined); drawer.addAll(entries); return drawer; }