public static Color convertColor(String key, String value) { if (Styles.NONE.equals(value)) { return null; } else if (Styles.SYSTEM.equals(value)) { return getSystemColor(key, null); } return ColorUtils.getColor(value); }
public void createControl(Composite parent) { viewer = new GalleryViewer(); EditDomain editDomain = new EditDomain(); editDomain.installTool(GEF.TOOL_SELECT, new TemplateGallerySelectTool()); viewer.setEditDomain(editDomain); Properties properties = viewer.getProperties(); properties.set(GalleryViewer.Horizontal, Boolean.TRUE); properties.set(GalleryViewer.Wrap, Boolean.TRUE); properties.set(GalleryViewer.TitlePlacement, GalleryViewer.TITLE_BOTTOM); properties.set(GalleryViewer.SingleClickToOpen, Boolean.TRUE); properties.set(GalleryViewer.SolidFrames, true); properties.set(GalleryViewer.FlatFrames, true); properties.set(GalleryViewer.ImageConstrained, true); properties.set(GalleryViewer.ImageStretched, true); properties.set( GalleryViewer.Layout, new GalleryLayout( GalleryLayout.ALIGN_CENTER, GalleryLayout.ALIGN_TOPLEFT, 10, 10, new Insets(5, 15, 5, 15))); properties.set(GalleryViewer.FrameContentSize, new Dimension(FRAME_WIDTH, FRAME_HEIGHT)); properties.set(GalleryViewer.ContentPaneBorderWidth, 1); properties.set(GalleryViewer.ContentPaneBorderColor, ColorUtils.getColor("#cccccc")); Control control = viewer.createControl(parent); control.setBackground(parent.getBackground()); control.setForeground(parent.getForeground()); viewer.setLabelProvider(new TemplateLabelProvider()); viewer.setInput(getViewerInput()); viewer.addOpenListener( new IOpenListener() { public void open(OpenEvent event) { if (normalOrEditMode) { if (!templateOpening) handleTemplateSelected(event.getSelection()); } } }); MindMapUI.getResourceManager().addResourceManagerListener(this); setControl(control); }
protected void onMoving(Point currentPos, MouseDragEvent me) { super.onMoving(currentPos, me); ITopicPart newParent = findTopicPart(me.target); if (newParent != targetParent) { if (feedbackService != null) { if (targetParent != null) { feedbackService.removeSelection(targetParent.getFigure()); } if (newParent != null) { SelectionFigure selection = feedbackService.addSelection(newParent.getFigure()); selection.setPreselectionColor(ColorUtils.getColor(MindMapUI.COLOR_WARNING)); selection.setPreselectionFillAlpha(0); selection.setPreselectionFillColor(null); selection.setPreselected(true); } } } targetParent = newParent; }