List of usage examples for org.eclipse.jface.resource JFaceResources getResources
public static ResourceManager getResources()
From source file:com.mentor.nucleus.bp.model.compare.providers.TreeDifferenceLabelProvider.java
License:Open Source License
private ResourceManager getResourceManager() { if (resourceManager == null) { resourceManager = new LocalResourceManager(JFaceResources.getResources()); }/*ww w. j a v a 2s. c o m*/ return resourceManager; }
From source file:com.mousefeed.eclipse.preferences.presentation.PresentationModePreferencePage.java
License:Open Source License
private void createColumns(final TableViewer viewer) { final LocalResourceManager resManager = new LocalResourceManager(JFaceResources.getResources(), viewer.getTable());/*from w w w . j a v a 2s . c om*/ createTableViewerColumn(viewer, "Scheme", 150, new ColumnLabelProvider() { @Override public String getText(Object element) { String schemeId = ((SchemeConfig) element).getSchemeId(); Scheme scheme = bindingService.getScheme(schemeId); if (scheme != null && scheme.isDefined()) { try { return scheme.getName(); } catch (NotDefinedException e) { // can not happen e.printStackTrace(); } } return "Undefined (" + schemeId + ")"; } }, null); createTableViewerColumn(viewer, "Label", 50, new ColumnLabelProvider() { @Override public String getText(Object element) { return ((SchemeConfig) element).getLabel(); } }, new TextEditingSupport<SchemeConfig>(viewer, SchemeConfig.class) { @Override protected String getStringValue(SchemeConfig element) { return element.getLabel(); } @Override protected void setStringValue(SchemeConfig element, String value) { element.setLabel(value); viewer.refresh(); } }); createTableViewerColumn(viewer, "Color", 150, new ColumnLabelProvider() { @Override public String getText(Object element) { return ""; } @Override public Color getBackground(Object element) { return resManager.createColor(((SchemeConfig) element).getColorCode()); } }, new ColorEditingSupport<SchemeConfig>(viewer, SchemeConfig.class) { @Override protected RGB getRGBValue(SchemeConfig element) { return element.getColorCode(); } @Override protected void setRGBValue(SchemeConfig element, RGB value) { element.setColorCode(value); viewer.refresh(); } }); }
From source file:com.nokia.carbide.remoteconnections.internal.ui.mylyn.AbstractNotificationPopup.java
License:Open Source License
public AbstractNotificationPopup(Display display, int style) { super(new Shell(display)); setShellStyle(style);//w w w . ja va2 s .co m this.display = display; resources = new LocalResourceManager(JFaceResources.getResources()); initResources(); closeJob.setSystem(true); }
From source file:com.rcpcompany.uibindings.internal.Activator.java
License:Open Source License
/** * Returns a local resource manager for use in this plug-in. * /*w ww .j ava2s . co m*/ * @return the manager */ public ResourceManager getResourceManager() { if (myResources == null) { myResources = new LocalResourceManager(JFaceResources.getResources()); } return myResources; }
From source file:com.rinke.solutions.pinball.PinDmdEditor.java
/** * Create contents of the window./*from w ww . j a va2 s .c om*/ */ 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.sap.dirigible.ide.db.viewer.views.DatabaseViewLabelProvider.java
License:Open Source License
/** * @param databaseViewer/*from w ww .jav a2 s. co m*/ */ DatabaseViewLabelProvider(DatabaseViewer databaseViewer) { this.databaseViewer = databaseViewer; this.resourceManager = new LocalResourceManager(JFaceResources.getResources()); }
From source file:com.sap.dirigible.ide.debug.ui.DebugView.java
License:Open Source License
public DebugView() { super(); this.resourceManager = new LocalResourceManager(JFaceResources.getResources()); }
From source file:com.sap.dirigible.ide.designer.ui.DesignerView.java
License:Open Source License
public DesignerView() { super(); resourceManager = new LocalResourceManager(JFaceResources.getResources()); }
From source file:com.sap.dirigible.ide.publish.ui.view.WebViewerView.java
License:Open Source License
public WebViewerView() { super(); resourceManager = new LocalResourceManager(JFaceResources.getResources()); }
From source file:com.sap.dirigible.ide.registry.ui.RegistryView.java
License:Open Source License
public RegistryView() { super(); resourceManager = new LocalResourceManager(JFaceResources.getResources()); }