Bug 424113 - Add 256x256 branding icon support to product editor
Fixes the product confguration editor, the PDE model and the
synchronization.
Change-Id: I7daedf058549e80e81ca75d8a4969747449b1e8c
Signed-off-by: Lars Vogel <Lars.Vogel@gmail.com>
diff --git a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/iproduct/IWindowImages.java b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/iproduct/IWindowImages.java
index ea3efae..2fa140f 100644
--- a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/iproduct/IWindowImages.java
+++ b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/iproduct/IWindowImages.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2008 IBM Corporation and others.
+ * Copyright (c) 2005, 2013 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Lars Vogel <Lars.Vogel@gmail.com> - Bug 424113
*******************************************************************************/
package org.eclipse.pde.internal.core.iproduct;
@@ -17,7 +18,9 @@
public static final String P_48 = "i48"; //$NON-NLS-1$
public static final String P_64 = "i64"; //$NON-NLS-1$
public static final String P_128 = "i128"; //$NON-NLS-1$
- public static final int TOTAL_IMAGES = 5;
+ public static final String P_256 = "i256"; //$NON-NLS-1$
+
+ public static final int TOTAL_IMAGES = 6;
String getImagePath(int size);
diff --git a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/product/WindowImages.java b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/product/WindowImages.java
index 81bfa27..ba3bee1 100644
--- a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/product/WindowImages.java
+++ b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/product/WindowImages.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2008 IBM Corporation and others.
+ * Copyright (c) 2005, 2013 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Lars Vogel <Lars.Vogel@gmail.com> - Bug 424113
*******************************************************************************/
package org.eclipse.pde.internal.core.product;
@@ -24,6 +25,7 @@
private String f48ImagePath;
private String f64ImagePath;
private String f128ImagePath;
+ private String f256ImagePath;
public WindowImages(IProductModel model) {
super(model);
@@ -41,6 +43,8 @@
return f64ImagePath;
case 4 :
return f128ImagePath;
+ case 5 :
+ return f256ImagePath;
}
return null;
}
@@ -78,6 +82,12 @@
if (isEditable())
firePropertyChanged(P_128, old, f128ImagePath);
break;
+ case 5 :
+ old = f256ImagePath;
+ f256ImagePath = path;
+ if (isEditable())
+ firePropertyChanged(P_256, old, f256ImagePath);
+ break;
}
}
@@ -98,6 +108,7 @@
f48ImagePath = element.getAttribute(P_48);
f64ImagePath = element.getAttribute(P_64);
f128ImagePath = element.getAttribute(P_128);
+ f256ImagePath = element.getAttribute(P_256);
}
}
@@ -118,6 +129,9 @@
if (f128ImagePath != null && f128ImagePath.length() > 0) {
writer.print(" " + P_128 + "=\"" + getWritableString(f128ImagePath) + "\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
+ if (f256ImagePath != null && f256ImagePath.length() > 0) {
+ writer.print(" " + P_256 + "=\"" + getWritableString(f256ImagePath) + "\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
writer.println("/>"); //$NON-NLS-1$
}
diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEUIMessages.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEUIMessages.java
index e1f2017..4e8746e 100644
--- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEUIMessages.java
+++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEUIMessages.java
@@ -2138,6 +2138,8 @@
public static String WindowImagesSection_128;
+ public static String WindowImagesSection_256;
+
public static String ManifestPackageRenameParticipant_packageRename;
public static String NewProjectCreationPage_standard;
diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/product/WindowImagesSection.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/product/WindowImagesSection.java
index 767440a..4fb02c7 100644
--- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/product/WindowImagesSection.java
+++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/product/WindowImagesSection.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2008 IBM Corporation and others.
+ * Copyright (c) 2005, 2013 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,6 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
* Peter Friese <peter.friese@gentleware.com> - bug 201956
+ * Lars Vogel <Lars.Vogel@gmail.com> - Bug 424113
*******************************************************************************/
package org.eclipse.pde.internal.ui.editor.product;
@@ -37,8 +38,8 @@
private TextValidator[] fWinImageEntryValidator;
- private static final int[][] F_ICON_DIMENSIONS = new int[][] { {16, 16}, {32, 32}, {48, 48}, {64, 64}, {128, 128}};
- private static final String[] F_ICON_LABELS = new String[] {PDEUIMessages.WindowImagesSection_16, PDEUIMessages.WindowImagesSection_32, PDEUIMessages.WindowImagesSection_48, PDEUIMessages.WindowImagesSection_64, PDEUIMessages.WindowImagesSection_128};
+ private static final int[][] F_ICON_DIMENSIONS = new int[][] { {16, 16}, {32, 32}, {48, 48}, {64, 64}, {128, 128}, {256, 256}};
+ private static final String[] F_ICON_LABELS = new String[] {PDEUIMessages.WindowImagesSection_16, PDEUIMessages.WindowImagesSection_32, PDEUIMessages.WindowImagesSection_48, PDEUIMessages.WindowImagesSection_64, PDEUIMessages.WindowImagesSection_128, PDEUIMessages.WindowImagesSection_256};
private FormEntry[] fImages = new FormEntry[F_ICON_LABELS.length];
public WindowImagesSection(PDEFormPage page, Composite parent) {
@@ -46,9 +47,7 @@
createClient(getSection(), page.getEditor().getToolkit());
}
- /* (non-Javadoc)
- * @see org.eclipse.pde.internal.ui.editor.PDESection#createClient(org.eclipse.ui.forms.widgets.Section, org.eclipse.ui.forms.widgets.FormToolkit)
- */
+ @Override
protected void createClient(Section section, FormToolkit toolkit) {
section.setLayout(FormLayoutFactory.createClearGridLayout(false, 1));
GridData data = new GridData(GridData.FILL_HORIZONTAL);
@@ -70,19 +69,23 @@
fImages[index].setEditable(isEditable());
// Create validator
fWinImageEntryValidator[index] = new TextValidator(getManagedForm(), fImages[index].getText(), getProject(), true) {
+ @Override
protected boolean validateControl() {
return validateWinImageEntry(index);
}
};
fImages[index].setFormEntryListener(new FormEntryAdapter(this, actionBars) {
+ @Override
public void textValueChanged(FormEntry entry) {
getWindowImages().setImagePath(entry.getValue(), index);
}
+ @Override
public void browseButtonSelected(FormEntry entry) {
handleBrowse(entry);
}
+ @Override
public void linkActivated(HyperlinkEvent e) {
EditorUtilities.openImage(fImages[index].getValue(), getProduct().getDefiningPluginId());
}
@@ -95,6 +98,7 @@
getModel().addModelChangedListener(this);
}
+ @Override
public void refresh() {
IWindowImages images = getWindowImages();
// Turn off auto message update until after values are set
@@ -128,6 +132,7 @@
return (IProductModel) getPage().getPDEEditor().getAggregateModel();
}
+ @Override
public void commit(boolean onSave) {
for (int i = 0; i < F_ICON_LABELS.length; i++) {
fImages[i].commit();
@@ -135,6 +140,7 @@
super.commit(onSave);
}
+ @Override
public void cancelEdit() {
for (int i = 0; i < F_ICON_LABELS.length; i++) {
fImages[i].cancelEdit();
@@ -161,6 +167,7 @@
}
}
+ @Override
public boolean canPaste(Clipboard clipboard) {
Display d = getSection().getDisplay();
Control c = d.getFocusControl();
@@ -169,9 +176,7 @@
return false;
}
- /* (non-Javadoc)
- * @see org.eclipse.pde.internal.ui.editor.PDESection#modelChanged(org.eclipse.pde.core.IModelChangedEvent)
- */
+ @Override
public void modelChanged(IModelChangedEvent e) {
// No need to call super, handling world changed event here
if (e.getChangeType() == IModelChangedEvent.WORLD_CHANGED) {
@@ -186,9 +191,7 @@
refresh();
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.forms.AbstractFormPart#dispose()
- */
+ @Override
public void dispose() {
IProductModel model = getModel();
if (model != null) {
diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/pderesources.properties b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/pderesources.properties
index 0e0f77c..4eabf46 100644
--- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/pderesources.properties
+++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/pderesources.properties
@@ -1976,6 +1976,7 @@
WindowImagesSection_48=48x48 Image:
WindowImagesSection_64=64x64 Image:
WindowImagesSection_128=128x128 Image:
+WindowImagesSection_256=256x256 Image:
WindowImagesSection_warning=The specified file could not be found.
WindowImagesSection_emptyPath=A path to an existing file must be provided.
WindowImagesSection_dialogTitle=Image Selection