diff options
| author | Martin Karpisek | 2016-11-12 13:33:52 +0000 |
|---|---|---|
| committer | Lars Vogel | 2016-11-15 20:59:35 +0000 |
| commit | 41848ee08f471dc377994819da55e3c568a517c2 (patch) | |
| tree | 96147c4173450b63525c2455190cea7a8042083b | |
| parent | 8acadba624d42c50cb0ea87b42d3d4e85a7a9ca1 (diff) | |
| download | eclipse.pde.ui-41848ee08f471dc377994819da55e3c568a517c2.tar.gz eclipse.pde.ui-41848ee08f471dc377994819da55e3c568a517c2.tar.xz eclipse.pde.ui-41848ee08f471dc377994819da55e3c568a517c2.zip | |
Bug 441543 - Default the ID in a new product configuration file Y20161117-1000I20161117-2000I20161116-2000I20161115-2000
- as in comment 4
- id is from filename without extension, focus and selection to ID field
of product editor is already existing behavior
Change-Id: I20a294a6963f6342f0dd28d4ea0d2a511375344e
Signed-off-by: Martin Karpisek <martin.karpisek@gmail.com>
| -rw-r--r-- | ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/product/BaseProductCreationOperation.java | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/product/BaseProductCreationOperation.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/product/BaseProductCreationOperation.java index 6f2b4da396..3b261f91f7 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/product/BaseProductCreationOperation.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/product/BaseProductCreationOperation.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2015 IBM Corporation and others. + * Copyright (c) 2005, 2016 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 * EclipseSource Corporation - ongoing enhancements + * Martin Karpisek <martin.karpisek@gmail.com> - Bug 441543 *******************************************************************************/ package org.eclipse.pde.internal.ui.wizards.product; @@ -55,6 +56,7 @@ public class BaseProductCreationOperation extends WorkspaceModifyOperation { } protected void initializeProduct(IProduct product) { + initializeProductId(product); IProductModelFactory factory = product.getModel().getFactory(); IConfigurationFileInfo info = factory.createConfigFileInfo(); info.setUse(null, "default"); //$NON-NLS-1$ @@ -109,6 +111,24 @@ public class BaseProductCreationOperation extends WorkspaceModifyOperation { return null; } + /** + * Initializes product id to name of product file (without extension). + * + * @param product + * whose id will be initialized + */ + protected void initializeProductId(IProduct product) { + if (fFile == null) { + return; + } + String id = fFile.getName(); + int index = id.lastIndexOf('.'); + if (index >= 0) { + id = id.substring(0, index); + } + product.setId(id); + } + protected void initializeProductInfo(IProductModelFactory factory, IProduct product, String id) { product.setProductId(id); product.setVersion("1.0.0.qualifier"); //$NON-NLS-1$ |
