From 68da3d3a3804f5e0a4a88d7656da29c25d80793e Mon Sep 17 00:00:00 2001 From: Doug Schaefer Date: Tue, 16 Feb 2016 14:08:42 -0500 Subject: [PATCH] Bug 487471 - 16 pixel button icons in 32x24 pixels space. Brings back the switching since we're using the launch group icons in the Launch button. The Build and Stop buttons are also made 16-bit and should be familiar. Warning clean-up in CSelector. Change-Id: I05e4b912d0470eb3f533d462b402faa3002bddd2 --- .../.settings/org.eclipse.jdt.core.prefs | 5 +- .../icons/bgButton.png | Bin 0 -> 1163 bytes .../icons/build_16.png | Bin 0 -> 3539 bytes .../icons/launch_16.png | Bin 0 -> 620 bytes .../icons/stop_16.png | Bin 0 -> 330 bytes .../launchbar/ui/internal/Activator.java | 28 +--- .../ui/internal/controls/CSelector.java | 14 +- .../internal/controls/LaunchBarControl.java | 44 +++++-- .../ui/internal/controls/ModeSelector.java | 124 ++++++------------ 9 files changed, 92 insertions(+), 123 deletions(-) create mode 100644 bundles/org.eclipse.launchbar.ui/icons/bgButton.png create mode 100644 bundles/org.eclipse.launchbar.ui/icons/build_16.png create mode 100644 bundles/org.eclipse.launchbar.ui/icons/launch_16.png create mode 100644 bundles/org.eclipse.launchbar.ui/icons/stop_16.png diff --git a/bundles/org.eclipse.launchbar.ui/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.launchbar.ui/.settings/org.eclipse.jdt.core.prefs index 4a1ace7a1ef..a787de69683 100644 --- a/bundles/org.eclipse.launchbar.ui/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.eclipse.launchbar.ui/.settings/org.eclipse.jdt.core.prefs @@ -2,8 +2,11 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull +org.eclipse.jdt.core.compiler.annotation.nonnull.secondary= org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary= org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable +org.eclipse.jdt.core.compiler.annotation.nullable.secondary= org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate @@ -48,7 +51,7 @@ org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=error -org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=error +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=warning org.eclipse.jdt.core.compiler.problem.nullReference=error diff --git a/bundles/org.eclipse.launchbar.ui/icons/bgButton.png b/bundles/org.eclipse.launchbar.ui/icons/bgButton.png new file mode 100644 index 0000000000000000000000000000000000000000..e951bd34a153dfe905a255e28ce45004e1c6024c GIT binary patch literal 1163 zcmV;61a$j}P)4Tx062|}Rb6NtRTMtEb7vzY&QokOg>Hg1+lHrgWS zWcKdPn90sKGrRqvPeo9CG3uKX#J{(IASm?@+di}}l?o-=)F3E6wD^Ni=!>T7nL9I? zX}YoAW$t|Qo$sD|?zw001?ah|SeB6#0T!CBEf+H4bBB+JJu8rehoBb*p;u8ID_yBf z0ya+zcePvJL&AGs+11_tpRKn>9TgyPA7ZoSs0)aX0r00)%XR^J`jH<$>RKN5V(7Oq zK*TS4xZz{h!*f1C3ECFkK$#7nA@pGN!$;%jYvwjAKwmYb0gKL(K8 z-kPtb5${A?tlI~wzMrJ6wTdBr=Y%%%EaEMQ&o}4FQ^DA)s*}Z>!FI&AHCpoWI|RUq zx?7s@$8!5^Q=anY%X@i5{QA6kNcMelpE>R6eCYFpmMsVTrI(b06~u#xf1yS} z_UGdMvD``!0~u->P=lA4?YN`hilQ|3tHka)7T{2CGqw zjZfMwx$5irQN_*|e4l)UHmiYuz74Yp1t^#>hrJ3-SOXDcC_o0^7T9R1gAN8V6s;5) zieI5-7aQlmJn}lUna#nz!j%5V$X|o`xX!dHWQRV27P1=rj;t2bW$~+pTw@bIek?Zv zKPDL<64`^#UNTAck#RBsB6*5DP4<%UA_FqU$I>2EH_cM;u)Q~SI+rg`Rn{L_AC5qq~L$#SMj%U z$6Cz0vP{G5Y*=%5RT^yu;}-DInZ=349rJPVM6C3K^oO)8y(fJr{l>k`ead~!ea?NsT>_Ci%bnxC;Vy6=b6>{xYV#Ue-+LB$ z7`JEXmTRm^AtP)R9u{)KHsMiWGV&)32xCG~*nyU<>-!d;FP=Re4r3qYr~6#KE>;1F z`>_J_P5xC?ROxV(DIHdCO*p$HRQI@7^PwV@Pvuf+5K}u-6REM(K@W$s zrgorh0{i?O)v0c>QtHxU-hBdD(>iYJ4b2sIOVX2K8m~4gmYVA5h^QEb$V`rCQ-|7Z zS{nuL-t>?3n=-o(6I(7vocj#GzCZEo`!3>+v;dYIfPu#&ZWzzX2i^rZ^Mu;6+rb@? zNPG+6)c5T6zxpzGe*M(x+{AON=PiJ>H#?ob-|uwRK0yDg0B4PV0id6JRZw95ZvX%Q zIY~r8R7ef&*0Bu$Fbo2)rvHnVTjdHC=K+W(CdoU^YZln-+kAer6(B%>009C72oNAJ d%~iak^aJ5;3encFAQ%7u002ovPDHLkV1fqPHPZk9 literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.launchbar.ui/icons/build_16.png b/bundles/org.eclipse.launchbar.ui/icons/build_16.png new file mode 100644 index 0000000000000000000000000000000000000000..c0272bb5d88fc2871e41567c03d9a7c450e5d722 GIT binary patch literal 3539 zcmV;^4J`7BP)00009a7bBm000XU z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!&&OV|NmlynZm%p08!!L>G@w%ON-&lmoE%LPqr|y965ZL!HoAFgDLZq|1TLB z7@59&`NDYT`ZY%X=x7E828OKw00030|AL#5l$^{kZ|+=Q1!bOk+Xz!@Jk7`2Vnrd=!z9XVCuiJrhNefq~)EvYAt-FfcIW zFfcGQ1IQ$QUk1Ve3_p5}P+!ti1OwNBCJYuynG7``7Gm-T=wPxp2BL|PnCfq^laO36 z++gY=PSa9St`13?UiF9TeWpte&-M=Q@Vt5bON|L3@&JAuGGFfdIMP17iw=CTmt%-iNKK|pRKlSnDibsg7rsnu$99EWjfoVH8leIV7(f0Sr6 zI+V-h;;O2W&1TWBwQcwIWPW{ViU~EsKuDQuG+I0LW?KLk{<7yB1U7+l;9jjFX z?f<+xh5u(<&;MU{IOTuD^042M<#yl2OYM?yYL>5Y{8)W3>HpH39sf7qpY^}*d=?4@ z$*DKFd=x9P&BSoFc$wXov<*@JYY!&>pLenAKM3r)w+75d#>Kl5{sX=9RhgEM+cAJKmMPz zJQc167}#%x${b|C28fo}{IKow`VYf-tIGdl0~7bpgsTC1`=dmGg90QBN^Bq5^m_ky znBW7(1#2o%H2(ba^MB*EPPn{npZ9-}Vw>LxFO=9$(`$A6>pa=_KL{7CtAcBO`}N)b zoYf`&VR9gB(&+*8g6$Ew0iY-mFR}UPJjL(7+cf|GB^w}NaR2SY|FMfx!D2A%0#qYW zZu?E7#Kr+NA(hyc%2hdjbe$UTKW#r% literal 0 HcmV?d00001 diff --git a/bundles/org.eclipse.launchbar.ui/icons/stop_16.png b/bundles/org.eclipse.launchbar.ui/icons/stop_16.png new file mode 100644 index 0000000000000000000000000000000000000000..3544673b6896bb23b647944436a07b398c165967 GIT binary patch literal 330 zcmV-Q0k!^#P)HWWthq_^V5`=f3`bKy?qW8gNiVIsK@N*2hx@Hve(q!; modeButtonImages = new HashMap<>(); public ModeSelector(Composite parent, int style) { super(parent, style); @@ -157,6 +154,15 @@ public class ModeSelector extends CSelector { }); } + @Override + public void dispose() { + super.dispose(); + + for (Image image : modeButtonImages.values()) { + image.dispose(); + } + } + protected ILaunchGroup getDefaultLaunchGroup(String mode) { String groupId = null; if (mode.equals(ILaunchManager.DEBUG_MODE)) { @@ -206,9 +212,7 @@ public class ModeSelector extends CSelector { if (element == null) element = noModes[0]; super.setSelection(element); - if ("true".equals(Platform.getDebugOption(Activator.OPTION_LAUNCH_ICON_UPDATER))) { //$NON-NLS-1$ - updateLaunchButton(findLaunchButton()); - } + updateLaunchButton(findLaunchButton()); } private ToolItem findLaunchButton() { @@ -231,84 +235,42 @@ public class ModeSelector extends CSelector { if (toolItem == null || isDisposed()) { return; } - toolItem.setImage(Activator.getDefault().getImage(Activator.IMG_BUTTON_LAUNCH)); Object selection = getSelection(); if (selection instanceof ILaunchMode) { - ILaunchMode lmode = (ILaunchMode) selection; - toolItem.setToolTipText(NLS.bind(Messages.ModeSelector_ToolTip, lmode.getLabel())); - String mode = lmode.getIdentifier(); - String iconPath = "icons/icon_" + mode + "_32x32.png"; //$NON-NLS-1$ //$NON-NLS-2$ - Image modeBigImage = Activator.getDefault().getImage(iconPath); - if (modeBigImage == null) { - // no icon for the mode, lets do an overlay - Image modeImageOrig = getLabelProvider().getImage(lmode); - if (modeImageOrig != null) { - ImageDescriptor composite = new ReversedCenterOverlay(modeImageOrig.getImageData()); - Activator.getDefault().getImageRegistry().put(iconPath, composite); - modeBigImage = Activator.getDefault().getImage(iconPath); - } - } - if (modeBigImage != null) { - toolItem.setImage(modeBigImage); + ILaunchMode mode = (ILaunchMode) selection; + toolItem.setToolTipText(NLS.bind(Messages.ModeSelector_ToolTip, mode.getLabel())); + + Image image = modeButtonImages.get(mode.getIdentifier()); + if (image == null) { + Image bgImage = Activator.getDefault().getImage(Activator.IMG_BUTTON_BACKGROUND); + Image modeImage = getLabelProvider().getImage(mode); + + ImageDescriptor imageDesc = new CompositeImageDescriptor() { + @Override + protected Point getSize() { + Rectangle bounds = bgImage.getBounds(); + return new Point(bounds.width - bounds.y, bounds.height - bounds.x); + } + + @Override + protected void drawCompositeImage(int width, int height) { + drawImage(bgImage.getImageData(), 0, 0); + + Rectangle bgBounds = bgImage.getBounds(); + Rectangle modeBounds = modeImage.getBounds(); + int x = ((bgBounds.width - bgBounds.x) - (modeBounds.width - modeBounds.x)) / 2; + int y = ((bgBounds.height - bgBounds.y) - (modeBounds.height - modeBounds.y)) / 2; + drawImage(modeImage.getImageData(), x, y); + } + }; + + image = imageDesc.createImage(); + modeButtonImages.put(mode.getIdentifier(), image); } + + toolItem.setImage(image); } } - private final class ReversedCenterOverlay extends CompositeImageDescriptor { - private ImageData small; - - public ReversedCenterOverlay(ImageData small) { - this.small = small; - } - - @Override - protected Point getSize() { - return new Point(32, 32); - } - - @Override - protected void drawCompositeImage(int width, int height) { - ImageDescriptor base = Activator.getImageDescriptor("icons/launch_base_blank.png"); //$NON-NLS-1$ - ImageData baseData = base.getImageData(); - int baseColor = baseData.getPixel(16, 16); - ImageData data = getReversed(small, baseData.palette.getRGB(baseColor)); - drawImage(baseData, 0, 0); - drawImage(data, 8, 8); - } - - private ImageData getReversed(ImageData imageData, RGB baseColor) { - int width = imageData.width; - PaletteData palette = imageData.palette; - RGB whiteColor = new RGB(255, 255, 255); - if (!palette.isDirect) { - palette.colors = Arrays.copyOf(palette.colors, palette.colors.length + 2); - palette.colors[palette.colors.length - 1] = baseColor; - palette.colors[palette.colors.length - 2] = whiteColor; - } - int whitePixel = palette.getPixel(whiteColor); - int basePixed = palette.getPixel(baseColor); - int transPixed = imageData.transparentPixel; - int[] lineData = new int[imageData.width]; - for (int y = 0; y < imageData.height; y++) { - imageData.getPixels(0, y, width, lineData, 0); - for (int x = 0; x < lineData.length; x++) { - int pixelValue = lineData[x]; - if (pixelValue == transPixed) { - imageData.setPixel(x, y, basePixed); - continue; - } - RGB rgb = palette.getRGB(pixelValue); - float brightness = rgb.getHSB()[2]; - if (brightness > 0.97) { - imageData.setPixel(x, y, basePixed); - } else { - imageData.setPixel(x, y, whitePixel); - } - } - } - imageData.transparentPixel = -1; - return imageData; - } - } }