Bug 422163 - BigIntegerField only accepts Long values
https://bugs.eclipse.org/bugs/show_bug.cgi?id=422163
SDK support for new properties and property types.
Change-Id: Ia71d4445626f578a7017375c3d57030cba8096c0
diff --git a/org.eclipse.scout.sdk.ui/plugin.xml b/org.eclipse.scout.sdk.ui/plugin.xml
index 10d286e..6650f67 100644
--- a/org.eclipse.scout.sdk.ui/plugin.xml
+++ b/org.eclipse.scout.sdk.ui/plugin.xml
@@ -431,6 +431,18 @@
</nodePage>
</FormField>
<FormField
+ active="true"
+ model="org.eclipse.scout.rt.client.ui.form.fields.bigintegerfield.IBigIntegerField"
+ name="Big Integer Field">
+ <newWizard
+ inShortList="false"
+ wizard="org.eclipse.scout.sdk.ui.wizard.form.fields.bigintegerfield.BigintegerFieldNewWizard">
+ </newWizard>
+ <nodePage
+ nodePage="org.eclipse.scout.sdk.ui.internal.view.outline.pages.project.client.form.field.BigIntegerFieldNodePage">
+ </nodePage>
+ </FormField>
+ <FormField
active="false"
model="org.eclipse.scout.rt.client.ui.form.fields.mailfield.IMailField"
name="Mail Field">
diff --git a/org.eclipse.scout.sdk.ui/resources/sdkPropertyViewConfig.xml b/org.eclipse.scout.sdk.ui/resources/sdkPropertyViewConfig.xml
index 749372e..034e093 100644
--- a/org.eclipse.scout.sdk.ui/resources/sdkPropertyViewConfig.xml
+++ b/org.eclipse.scout.sdk.ui/resources/sdkPropertyViewConfig.xml
@@ -18,21 +18,12 @@
<config name="execDecorateMinorTimeColumn" type="Advanced" category="Appearance" />
</type>
<type name="org.eclipse.scout.rt.client.ui.basic.table.columns.AbstractBigDecimalColumn">
- <config name="getConfiguredFormat" type="Advanced" category="Appearance" />
<config name="getConfiguredMinFractionDigits" type="Advanced" category="Appearance" />
<config name="getConfiguredMaxFractionDigits" type="Advanced" category="Appearance" />
<config name="getConfiguredGroupingUsed" type="Advanced" category="Appearance" />
<config name="getConfiguredPercent" type="Advanced" category="Appearance" />
<config name="getConfiguredMultiplier" type="Advanced" category="Appearance" />
</type>
- <type name="org.eclipse.scout.rt.client.ui.form.fields.bigdecimalfield.AbstractBigDecimalField">
- <config name="getConfiguredMinValue" type="Advanced" category="Data" />
- <config name="getConfiguredMaxValue" type="Advanced" category="Data" />
- </type>
- <type name="org.eclipse.scout.rt.client.ui.form.fields.bigintegerfield.AbstractBigIntegerField">
- <config name="getConfiguredMinValue" type="Advanced" category="Data" />
- <config name="getConfiguredMaxValue" type="Advanced" category="Data" />
- </type>
<type name="org.eclipse.scout.rt.client.ui.desktop.bookmark.menu.AbstractBookmarkMenu">
<config name="getConfiguredText" type="Advanced" category="Appearance" />
<config name="getConfiguredBookmarkForm" type="Advanced" category="Data" />
@@ -179,11 +170,9 @@
<config name="getConfiguredAutoTimeMillis" type="Advanced" category="Behavior" />
</type>
<type name="org.eclipse.scout.rt.client.ui.form.fields.decimalfield.AbstractDecimalField">
- <config name="getConfiguredFormat" type="Advanced" category="Appearance" />
<config name="getConfiguredFractionDigits" type="Advanced" category="Appearance" />
<config name="getConfiguredMinFractionDigits" type="Advanced" category="Appearance" />
<config name="getConfiguredMaxFractionDigits" type="Advanced" category="Appearance" />
- <config name="getConfiguredGroupingUsed" type="Advanced" category="Appearance" />
<config name="getConfiguredPercent" type="Advanced" category="Appearance" />
<config name="getConfiguredMultiplier" type="Advanced" category="Appearance" />
<config name="getConfiguredHorizontalAlignment" type="Advanced" category="Layout" />
@@ -223,17 +212,12 @@
<config name="getConfiguredStatusBarVisible" type="Advanced" category="Appearance" />
</type>
<type name="org.eclipse.scout.rt.client.ui.basic.table.columns.AbstractDoubleColumn">
- <config name="getConfiguredFormat" type="Advanced" category="Appearance" />
<config name="getConfiguredMinFractionDigits" type="Advanced" category="Appearance" />
<config name="getConfiguredMaxFractionDigits" type="Advanced" category="Appearance" />
<config name="getConfiguredGroupingUsed" type="Advanced" category="Appearance" />
<config name="getConfiguredPercent" type="Advanced" category="Appearance" />
<config name="getConfiguredMultiplier" type="Advanced" category="Appearance" />
</type>
- <type name="org.eclipse.scout.rt.client.ui.form.fields.doublefield.AbstractDoubleField">
- <config name="getConfiguredMinimumValue" type="Normal" category="Data" />
- <config name="getConfiguredMaximumValue" type="Normal" category="Data" />
- </type>
<type name="org.eclipse.scout.rt.client.ui.form.fields.filechooserfield.AbstractFileChooserField">
<config name="getConfiguredFolderMode" type="Advanced" category="Behavior" />
<config name="getConfiguredShowDirectory" type="Advanced" category="Appearance" />
@@ -368,19 +352,14 @@
<config name="getConfiguredZoomDelta" type="Advanced" category="Appearance" />
<config name="getConfiguredPanDelta" type="Advanced" category="Appearance" />
<config name="getConfiguredRotateDelta" type="Advanced" category="Appearance" />
- <config name="getConfiguredDropType" type="Advanced" category="Misc" />
- <config name="getConfiguredDragType" type="Advanced" category="Misc" />
+ <config name="getConfiguredDragType" type="Advanced" category="Data" />
+ <config name="getConfiguredDropType" type="Advanced" category="Data" />
<config name="execDragRequest" type="Advanced" category="BusinessLogic" />
<config name="execDropRequest" type="Advanced" category="BusinessLogic" />
</type>
<type name="org.eclipse.scout.rt.client.ui.basic.table.columns.AbstractIntegerColumn">
- <config name="getConfiguredFormat" type="Advanced" category="Appearance" />
<config name="getConfiguredGroupingUsed" type="Advanced" category="Appearance" />
</type>
- <type name="org.eclipse.scout.rt.client.ui.form.fields.integerfield.AbstractIntegerField">
- <config name="getConfiguredMinimumValue" type="Normal" category="Data" />
- <config name="getConfiguredMaximumValue" type="Normal" category="Data" />
- </type>
<type name="org.eclipse.scout.rt.server.services.common.jms.AbstractJmsConsumerService">
<config name="getConfiguredContextFactory" type="Normal" category="Data" />
<config name="getConfiguredProviderUrl" type="Normal" category="Data" />
@@ -407,13 +386,8 @@
</type>
<type name="org.eclipse.scout.rt.client.ui.basic.table.columns.AbstractLongColumn">
<config name="getConfiguredPrimaryKey" type="Normal" category="Data" />
- <config name="getConfiguredFormat" type="Advanced" category="Appearance" />
<config name="getConfiguredGroupingUsed" type="Advanced" category="Appearance" />
</type>
- <type name="org.eclipse.scout.rt.client.ui.form.fields.longfield.AbstractLongField">
- <config name="getConfiguredMinimumValue" type="Normal" category="Data" />
- <config name="getConfiguredMaximumValue" type="Normal" category="Data" />
- </type>
<type name="org.eclipse.scout.rt.client.ui.form.fields.mailfield.AbstractMailField">
<config name="getConfiguredMailEditor" type="Advanced" category="Behavior" />
<config name="getConfiguredLabel" type="Advanced" category="Appearance" />
@@ -431,6 +405,9 @@
<type name="org.eclipse.scout.rt.client.ui.form.fields.numberfield.AbstractNumberField">
<config name="getConfiguredFormat" type="Advanced" category="Appearance" />
<config name="getConfiguredGroupingUsed" type="Advanced" category="Appearance" />
+ <config name="getConfiguredRoundingMode" type="Advanced" category="Data" />
+ <config name="getConfiguredMinValue" type="Normal" category="Data" />
+ <config name="getConfiguredMaxValue" type="Normal" category="Data" />
</type>
<type name="org.eclipse.scout.rt.client.ui.desktop.outline.AbstractOutline">
<config name="getConfiguredTitle" type="Normal" category="Appearance" />
@@ -601,8 +578,8 @@
<config name="getConfiguredWrapText" type="Normal" category="Behavior" />
<config name="getConfiguredValueFormat" type="Advanced" category="Appearance" />
<config name="getConfiguredSelectAllOnFocus" type="Advanced" category="Behavior" />
- <config name="getConfiguredDropType" type="Advanced" category="Misc" />
- <config name="getConfiguredDragType" type="Advanced" category="Misc" />
+ <config name="getConfiguredDragType" type="Advanced" category="Data" />
+ <config name="getConfiguredDropType" type="Advanced" category="Data" />
<config name="execDragRequest" type="Advanced" category="BusinessLogic" />
<config name="execDropRequest" type="Advanced" category="BusinessLogic" />
<config name="execLinkAction" type="Advanced" category="BusinessLogic" />
@@ -621,8 +598,8 @@
<config name="getConfiguredRowHeightHint" type="Advanced" category="Layout" />
<config name="getConfiguredCheckable" type="Advanced" category="Behavior" />
<config name="getConfiguredCheckableColumn" type="Advanced" category="Behavior" />
- <config name="getConfiguredDropType" type="Advanced" category="Misc" />
- <config name="getConfiguredDragType" type="Advanced" category="Misc" />
+ <config name="getConfiguredDragType" type="Advanced" category="Data" />
+ <config name="getConfiguredDropType" type="Advanced" category="Data" />
<config name="getConfiguredKeyboardNavigation" type="Advanced" category="Behavior" />
<config name="getConfiguredScrollToSelection" type="Advanced" category="Behavior" />
<config name="execDrag" type="Advanced" category="BusinessLogic" />
@@ -660,8 +637,8 @@
<config name="getConfiguredMultiCheck" type="Advanced" category="Behavior" />
<config name="getConfiguredCheckable" type="Advanced" category="Behavior" />
<config name="getConfiguredDragEnabled" type="Advanced" category="Behavior" />
- <config name="getConfiguredDragType" type="Advanced" category="Misc" />
- <config name="getConfiguredDropType" type="Advanced" category="Misc" />
+ <config name="getConfiguredDragType" type="Advanced" category="Data" />
+ <config name="getConfiguredDropType" type="Advanced" category="Data" />
<config name="getConfiguredAutoDiscardOnDelete" type="Advanced" category="Behavior" />
<config name="getConfiguredRootNodeVisible" type="Advanced" category="Appearance" />
<config name="getConfiguredRootHandlesVisible" type="Normal" category="Appearance" />
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/internal/SdkIcons.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/internal/SdkIcons.java
index 1ee69cc..623d682 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/internal/SdkIcons.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/internal/SdkIcons.java
@@ -265,9 +265,6 @@
String FormFieldTemplate = Default; // TODO
String FormFieldTemplateAdd = ToolAdd; // TODO
String FormFieldTemplateRemove = ToolRemove; // TODO
- String BigDecimalField = FormField; // TODO
- String BigDecimalFieldAdd = ToolAdd; // TODO
- String BigDecimalFieldRemove = ToolRemove; // TODO
String BooleanField = FormField; // TODO
String BooleanFieldAdd = ToolAdd; // TODO
String BooleanFieldRemove = ToolRemove; // TODO
@@ -304,9 +301,9 @@
String ListboxField = FormField; // TODO
String ListboxFieldAdd = ToolAdd; // TODO
String ListboxFieldRemove = ToolRemove; // TODO
- String LongField = FormField; // TODO
- String LongFieldAdd = ToolAdd; // TODO
- String LongFieldRemove = ToolRemove; // TODO
+ String LongField = IntegerField; // TODO
+ String LongFieldAdd = IntegerFieldAdd; // TODO
+ String LongFieldRemove = IntegerFieldRemove; // TODO
String MailField = FormField; // TODO
String MailFieldAdd = ToolAdd; // TODO
String MailFieldRemove = ToolRemove; // TODO
@@ -331,6 +328,12 @@
String UnknownField = FormField; // TODO
String UnknownFieldAdd = ToolAdd; // TODO
String UnknownFieldRemove = ToolRemove; // TODO
+ String BigDecimalField = DoubleField; // TODO
+ String BigDecimalFieldAdd = DoubleFieldAdd; // TODO
+ String BigDecimalFieldRemove = DoubleFieldRemove; // TODO
+ String BigIntegerField = IntegerField; // TODO
+ String BigIntegerFieldAdd = IntegerFieldAdd; // TODO
+ String BigIntegerFieldRemove = IntegerFieldRemove; // TODO
String BundlePresentationGrouped = "presentation_grouped.gif";
String BundlePresentationFlatGrouped = "presentation_flatgroup.gif";
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/internal/view/outline/pages/project/client/form/field/BigIntegerFieldNodePage.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/internal/view/outline/pages/project/client/form/field/BigIntegerFieldNodePage.java
new file mode 100644
index 0000000..d1f7a97
--- /dev/null
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/internal/view/outline/pages/project/client/form/field/BigIntegerFieldNodePage.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ui.internal.view.outline.pages.project.client.form.field;
+
+import org.eclipse.scout.sdk.ui.action.IScoutHandler;
+import org.eclipse.scout.sdk.ui.action.delete.FormFieldDeleteAction;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.view.outline.pages.IScoutPageConstants;
+import org.eclipse.scout.sdk.ui.view.outline.pages.project.client.ui.form.field.AbstractFormFieldNodePage;
+
+public class BigIntegerFieldNodePage extends AbstractFormFieldNodePage {
+
+ public BigIntegerFieldNodePage() {
+ setImageDescriptor(ScoutSdkUi.getImageDescriptor(ScoutSdkUi.BigIntegerField));
+ }
+
+ @Override
+ public String getPageId() {
+ return IScoutPageConstants.BIG_INTEGER_FIELD_NODE_PAGE;
+ }
+
+ @Override
+ public void prepareMenuAction(IScoutHandler menu) {
+ super.prepareMenuAction(menu);
+ if (menu instanceof FormFieldDeleteAction) {
+ menu.setImage(ScoutSdkUi.getImageDescriptor(ScoutSdkUi.BigIntegerFieldRemove));
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/internal/view/properties/presenter/multi/MultiIntegerPresenter.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/internal/view/properties/presenter/multi/MultiIntegerPresenter.java
index df441c3..773e05c 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/internal/view/properties/presenter/multi/MultiIntegerPresenter.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/internal/view/properties/presenter/multi/MultiIntegerPresenter.java
@@ -68,8 +68,8 @@
if (value.intValue() == Integer.MAX_VALUE) {
return "Integer.MAX_VALUE";
}
- else if (value.intValue() == -Integer.MAX_VALUE) {
- return "-Integer.MAX_VALUE";
+ else if (value.intValue() == Integer.MIN_VALUE) {
+ return "Integer.MIN_VALUE";
}
return DecimalFormat.getNumberInstance().format(value);
}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/internal/view/properties/presenter/single/BigDecimalPresenter.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/internal/view/properties/presenter/single/BigDecimalPresenter.java
new file mode 100644
index 0000000..4bc6539
--- /dev/null
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/internal/view/properties/presenter/single/BigDecimalPresenter.java
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * Copyright (c) 2013 BSI Business Systems Integration AG.
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ui.internal.view.properties.presenter.single;
+
+import java.math.BigDecimal;
+import java.text.DecimalFormat;
+import java.text.NumberFormat;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.scout.sdk.jobs.OperationJob;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.view.properties.PropertyViewFormToolkit;
+import org.eclipse.scout.sdk.ui.view.properties.presenter.single.AbstractValuePresenter;
+import org.eclipse.scout.sdk.workspace.type.config.ConfigPropertyUpdateOperation;
+import org.eclipse.scout.sdk.workspace.type.config.parser.BigDecimalPropertySourceParser;
+import org.eclipse.scout.sdk.workspace.type.config.parser.IPropertySourceParser;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * <h3>{@link BigDecimalPresenter}</h3>
+ *
+ * @author Matthias Villiger
+ * @since 3.10.0 02.12.2013
+ */
+public class BigDecimalPresenter extends AbstractValuePresenter<BigDecimal> {
+
+ private final IPropertySourceParser<BigDecimal> m_parser;
+ private final NumberFormat m_formatter;
+
+ public BigDecimalPresenter(PropertyViewFormToolkit toolkit, Composite parent) {
+ super(toolkit, parent, "[\\-\\+0-9eE\\.']*");
+ m_parser = new BigDecimalPropertySourceParser();
+ m_formatter = DecimalFormat.getInstance();
+ m_formatter.setMaximumFractionDigits(20);
+ }
+
+ public IPropertySourceParser<BigDecimal> getParser() {
+ return m_parser;
+ }
+
+ @Override
+ protected String formatDisplayValue(BigDecimal value) throws CoreException {
+ if (value == null) {
+ return "";
+ }
+ return m_formatter.format(value);
+ }
+
+ @Override
+ protected BigDecimal parseSourceInput(String input) throws CoreException {
+ if (input.equals("")) {
+ return getDefaultValue();
+ }
+ else {
+ return getParser().parseSourceValue(input, getMethod().peekMethod(), getMethod().getSuperTypeHierarchy());
+ }
+ }
+
+ @Override
+ protected BigDecimal parseDisplayInput(String input) throws CoreException {
+ return parseSourceInput(input.replace("'", ""));
+ }
+
+ @Override
+ protected synchronized void storeValue(BigDecimal value) throws CoreException {
+ try {
+ ConfigPropertyUpdateOperation<BigDecimal> updateOp = new ConfigPropertyUpdateOperation<BigDecimal>(getMethod(), getParser());
+ updateOp.setValue(value);
+ OperationJob job = new OperationJob(updateOp);
+ job.setDebug(true);
+ job.schedule();
+ }
+ catch (Exception e) {
+ ScoutSdkUi.logError("could not parse default value of method '" + getMethod().getMethodName() + "' in type '" + getMethod().getType().getFullyQualifiedName() + "'.", e);
+ }
+ }
+
+ @Override
+ protected int getTextAlignment() {
+ return SWT.RIGHT;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/internal/view/properties/presenter/single/BigIntegerPresenter.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/internal/view/properties/presenter/single/BigIntegerPresenter.java
new file mode 100644
index 0000000..90967bb
--- /dev/null
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/internal/view/properties/presenter/single/BigIntegerPresenter.java
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * Copyright (c) 2013 BSI Business Systems Integration AG.
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ui.internal.view.properties.presenter.single;
+
+import java.math.BigInteger;
+import java.text.DecimalFormat;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.scout.sdk.jobs.OperationJob;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.view.properties.PropertyViewFormToolkit;
+import org.eclipse.scout.sdk.ui.view.properties.presenter.single.AbstractValuePresenter;
+import org.eclipse.scout.sdk.workspace.type.config.ConfigPropertyUpdateOperation;
+import org.eclipse.scout.sdk.workspace.type.config.parser.BigIntegerPropertySourceParser;
+import org.eclipse.scout.sdk.workspace.type.config.parser.IPropertySourceParser;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * <h3>{@link BigIntegerPresenter}</h3>
+ *
+ * @author Matthias Villiger
+ * @since 3.10.0 02.12.2013
+ */
+public class BigIntegerPresenter extends AbstractValuePresenter<BigInteger> {
+
+ private final IPropertySourceParser<BigInteger> m_parser;
+
+ public BigIntegerPresenter(PropertyViewFormToolkit toolkit, Composite parent) {
+ super(toolkit, parent, "[\\-\\+0-9']*");
+ m_parser = new BigIntegerPropertySourceParser();
+ }
+
+ public IPropertySourceParser<BigInteger> getParser() {
+ return m_parser;
+ }
+
+ @Override
+ protected String formatDisplayValue(BigInteger value) throws CoreException {
+ if (value == null) {
+ return "";
+ }
+ return DecimalFormat.getNumberInstance().format(value);
+ }
+
+ @Override
+ protected BigInteger parseSourceInput(String input) throws CoreException {
+ if (input.equals("")) {
+ return getDefaultValue();
+ }
+ else {
+ return getParser().parseSourceValue(input, getMethod().peekMethod(), getMethod().getSuperTypeHierarchy());
+ }
+ }
+
+ @Override
+ protected BigInteger parseDisplayInput(String input) throws CoreException {
+ return parseSourceInput(input.replace("'", ""));
+ }
+
+ @Override
+ protected synchronized void storeValue(BigInteger value) throws CoreException {
+ try {
+ ConfigPropertyUpdateOperation<BigInteger> updateOp = new ConfigPropertyUpdateOperation<BigInteger>(getMethod(), getParser());
+ updateOp.setValue(value);
+ OperationJob job = new OperationJob(updateOp);
+ job.setDebug(true);
+ job.schedule();
+ }
+ catch (Exception e) {
+ ScoutSdkUi.logError("could not parse default value of method '" + getMethod().getMethodName() + "' in type '" + getMethod().getType().getFullyQualifiedName() + "'.", e);
+ }
+ }
+
+ @Override
+ protected int getTextAlignment() {
+ return SWT.RIGHT;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/internal/view/properties/presenter/single/ComposerAttributeTypePresenter.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/internal/view/properties/presenter/single/ComposerAttributeTypePresenter.java
new file mode 100644
index 0000000..5e70de4
--- /dev/null
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/internal/view/properties/presenter/single/ComposerAttributeTypePresenter.java
@@ -0,0 +1,122 @@
+/*******************************************************************************
+ * Copyright (c) 2013 BSI Business Systems Integration AG.
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ui.internal.view.properties.presenter.single;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.scout.sdk.extensions.runtime.classes.IRuntimeClasses;
+import org.eclipse.scout.sdk.jobs.OperationJob;
+import org.eclipse.scout.sdk.ui.fields.proposal.ProposalTextField;
+import org.eclipse.scout.sdk.ui.fields.proposal.StaticContentProvider;
+import org.eclipse.scout.sdk.ui.fields.proposal.styled.SearchRangeStyledLabelProvider;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.view.properties.PropertyViewFormToolkit;
+import org.eclipse.scout.sdk.ui.view.properties.presenter.single.AbstractProposalPresenter;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.workspace.type.config.ConfigPropertyUpdateOperation;
+import org.eclipse.scout.sdk.workspace.type.config.parser.FieldReferencePropertyParser;
+import org.eclipse.scout.sdk.workspace.type.config.parser.IntegerFieldReferencePropertyParser;
+import org.eclipse.scout.sdk.workspace.type.config.property.FieldProperty;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * <h3>{@link ComposerAttributeTypePresenter}</h3>
+ *
+ * @author Matthias Villiger
+ * @since 3.10.0 02.12.2013
+ */
+public class ComposerAttributeTypePresenter extends AbstractProposalPresenter<FieldProperty<Integer>> {
+
+ protected static final List<FieldProperty<Integer>> PROPOSALS;
+ static {
+ IType dataModelConstants = TypeUtility.getType(IRuntimeClasses.DataModelConstants);
+ PROPOSALS = new ArrayList<FieldProperty<Integer>>(20);
+ PROPOSALS.add(new UiFieldProperty<Integer>(dataModelConstants.getField("TYPE_INHERITED"), "Inherited"));
+ PROPOSALS.add(new UiFieldProperty<Integer>(dataModelConstants.getField("TYPE_NONE"), "None"));
+ PROPOSALS.add(new UiFieldProperty<Integer>(dataModelConstants.getField("TYPE_CODE_LIST"), "Code List"));
+ PROPOSALS.add(new UiFieldProperty<Integer>(dataModelConstants.getField("TYPE_CODE_TREE"), "Code Tree"));
+ PROPOSALS.add(new UiFieldProperty<Integer>(dataModelConstants.getField("TYPE_NUMBER_LIST"), "Number List"));
+ PROPOSALS.add(new UiFieldProperty<Integer>(dataModelConstants.getField("TYPE_NUMBER_TREE"), "Number Tree"));
+ PROPOSALS.add(new UiFieldProperty<Integer>(dataModelConstants.getField("TYPE_DATE"), "Date"));
+ PROPOSALS.add(new UiFieldProperty<Integer>(dataModelConstants.getField("TYPE_TIME"), "Time"));
+ PROPOSALS.add(new UiFieldProperty<Integer>(dataModelConstants.getField("TYPE_DATE_TIME"), "Date-Time"));
+ PROPOSALS.add(new UiFieldProperty<Integer>(dataModelConstants.getField("TYPE_INTEGER"), "Integer"));
+ PROPOSALS.add(new UiFieldProperty<Integer>(dataModelConstants.getField("TYPE_LONG"), "Long"));
+ PROPOSALS.add(new UiFieldProperty<Integer>(dataModelConstants.getField("TYPE_DOUBLE"), "Double"));
+ PROPOSALS.add(new UiFieldProperty<Integer>(dataModelConstants.getField("TYPE_PLAIN_INTEGER"), "Plain Integer"));
+ PROPOSALS.add(new UiFieldProperty<Integer>(dataModelConstants.getField("TYPE_PLAIN_LONG"), "Plain Long"));
+ PROPOSALS.add(new UiFieldProperty<Integer>(dataModelConstants.getField("TYPE_PLAIN_DOUBLE"), "Plain Double"));
+ PROPOSALS.add(new UiFieldProperty<Integer>(dataModelConstants.getField("TYPE_PERCENT"), "Percent"));
+ PROPOSALS.add(new UiFieldProperty<Integer>(dataModelConstants.getField("TYPE_STRING"), "String"));
+ PROPOSALS.add(new UiFieldProperty<Integer>(dataModelConstants.getField("TYPE_SMART"), "Smart"));
+ PROPOSALS.add(new UiFieldProperty<Integer>(dataModelConstants.getField("TYPE_AGGREGATE_COUNT"), "Aggregate Count"));
+ PROPOSALS.add(new UiFieldProperty<Integer>(dataModelConstants.getField("TYPE_FULL_TEXT"), "Full Text"));
+ }
+
+ private final FieldReferencePropertyParser<Integer> m_parser;
+
+ public ComposerAttributeTypePresenter(PropertyViewFormToolkit toolkit, Composite parent) {
+ super(toolkit, parent);
+ m_parser = new IntegerFieldReferencePropertyParser(PROPOSALS);
+ }
+
+ @Override
+ protected void createProposalFieldProviders(ProposalTextField proposalField) {
+ ILabelProvider labelProvider = new SearchRangeStyledLabelProvider() {
+ @Override
+ public String getText(Object element) {
+ return element.toString();
+ }
+
+ @Override
+ public Image getImage(Object element) {
+ return ScoutSdkUi.getImage(ScoutSdkUi.Default);
+ }
+
+ };
+ getProposalField().setLabelProvider(labelProvider);
+ StaticContentProvider provider = new StaticContentProvider(PROPOSALS.toArray(new FieldProperty[PROPOSALS.size()]), labelProvider);
+ getProposalField().setContentProvider(provider);
+ }
+
+ public FieldReferencePropertyParser<Integer> getParser() {
+ return m_parser;
+ }
+
+ @Override
+ protected FieldProperty<Integer> parseInput(String input) throws CoreException {
+ return getParser().parseSourceValue(input, getMethod().peekMethod(), getMethod().getSuperTypeHierarchy());
+ }
+
+ @Override
+ protected synchronized void storeValue(FieldProperty<Integer> value) throws CoreException {
+ if (value == null) {
+ getProposalField().acceptProposal(getDefaultValue());
+ value = getDefaultValue();
+ }
+
+ try {
+ ConfigPropertyUpdateOperation<FieldProperty<Integer>> updateOp = new ConfigPropertyUpdateOperation<FieldProperty<Integer>>(getMethod(), getParser());
+ updateOp.setValue(value);
+ OperationJob job = new OperationJob(updateOp);
+ job.setDebug(true);
+ job.schedule();
+ }
+ catch (Exception e) {
+ ScoutSdkUi.logError("could not parse default value of method '" + getMethod().getMethodName() + "' in type '" + getMethod().getType().getFullyQualifiedName() + "'.", e);
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/internal/view/properties/presenter/single/DoublePresenter.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/internal/view/properties/presenter/single/DoublePresenter.java
index bf276b7..1efa0af 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/internal/view/properties/presenter/single/DoublePresenter.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/internal/view/properties/presenter/single/DoublePresenter.java
@@ -11,6 +11,7 @@
package org.eclipse.scout.sdk.ui.internal.view.properties.presenter.single;
import java.text.DecimalFormat;
+import java.text.NumberFormat;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.scout.sdk.jobs.OperationJob;
@@ -29,10 +30,13 @@
*/
public class DoublePresenter extends AbstractValuePresenter<Double> {
private final IPropertySourceParser<Double> m_parser;
+ private final NumberFormat m_formatter;
public DoublePresenter(PropertyViewFormToolkit toolkit, Composite parent) {
- super(toolkit, parent, "[-+0-9\\.\\,\\'eEinfd]*");
+ super(toolkit, parent, "[\\-\\+0-9\\.\\'eEinfdFD]*");
m_parser = new DoublePropertySourceParser();
+ m_formatter = DecimalFormat.getInstance();
+ m_formatter.setMaximumFractionDigits(20);
}
public IPropertySourceParser<Double> getParser() {
@@ -50,7 +54,7 @@
else if (value.doubleValue() == -Double.MAX_VALUE) {
return SdkProperties.NUMBER_MIN;
}
- return DecimalFormat.getInstance().format(value);
+ return m_formatter.format(value);
}
@Override
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/internal/view/properties/presenter/single/DragAndDropTypePresenter.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/internal/view/properties/presenter/single/DragAndDropTypePresenter.java
new file mode 100644
index 0000000..4f7957d
--- /dev/null
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/internal/view/properties/presenter/single/DragAndDropTypePresenter.java
@@ -0,0 +1,131 @@
+/*******************************************************************************
+ * Copyright (c) 2013 BSI Business Systems Integration AG.
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ui.internal.view.properties.presenter.single;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.scout.sdk.extensions.runtime.classes.IRuntimeClasses;
+import org.eclipse.scout.sdk.jobs.OperationJob;
+import org.eclipse.scout.sdk.ui.fields.proposal.ProposalTextField;
+import org.eclipse.scout.sdk.ui.fields.proposal.StaticContentProvider;
+import org.eclipse.scout.sdk.ui.fields.proposal.styled.SearchRangeStyledLabelProvider;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.view.properties.PropertyViewFormToolkit;
+import org.eclipse.scout.sdk.ui.view.properties.presenter.single.AbstractProposalPresenter;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.workspace.type.config.ConfigPropertyUpdateOperation;
+import org.eclipse.scout.sdk.workspace.type.config.parser.FieldReferencePropertyParser;
+import org.eclipse.scout.sdk.workspace.type.config.parser.IntegerFieldReferencePropertyParser;
+import org.eclipse.scout.sdk.workspace.type.config.property.FieldProperty;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * <h3>{@link DragAndDropTypePresenter}</h3>
+ *
+ * @author Matthias Villiger
+ * @since 3.10.0 02.12.2013
+ */
+public class DragAndDropTypePresenter extends AbstractProposalPresenter<FieldProperty<Integer>> {
+
+ protected static final List<FieldProperty<Integer>> PROPOSALS;
+ static {
+ IType iDNDSupport = TypeUtility.getType(IRuntimeClasses.IDNDSupport);
+ PROPOSALS = new ArrayList<FieldProperty<Integer>>(5);
+ PROPOSALS.add(new NoneFieldProperty());
+ PROPOSALS.add(new UiFieldProperty<Integer>(iDNDSupport.getField("TYPE_FILE_TRANSFER"), "File Transfer"));
+ PROPOSALS.add(new UiFieldProperty<Integer>(iDNDSupport.getField("TYPE_JAVA_ELEMENT_TRANSFER"), "Java Element Transfer"));
+ PROPOSALS.add(new UiFieldProperty<Integer>(iDNDSupport.getField("TYPE_TEXT_TRANSFER"), "Text Transfer"));
+ PROPOSALS.add(new UiFieldProperty<Integer>(iDNDSupport.getField("TYPE_IMAGE_TRANSFER"), "Image Transfer"));
+ }
+
+ private final FieldReferencePropertyParser<Integer> m_parser;
+
+ public DragAndDropTypePresenter(PropertyViewFormToolkit toolkit, Composite parent) {
+ super(toolkit, parent);
+ m_parser = new IntegerFieldReferencePropertyParser(PROPOSALS);
+ }
+
+ @Override
+ protected void createProposalFieldProviders(ProposalTextField proposalField) {
+ ILabelProvider labelProvider = new SearchRangeStyledLabelProvider() {
+ @Override
+ public String getText(Object element) {
+ return element.toString();
+ }
+
+ @Override
+ public Image getImage(Object element) {
+ return ScoutSdkUi.getImage(ScoutSdkUi.Default);
+ }
+
+ };
+ getProposalField().setLabelProvider(labelProvider);
+ StaticContentProvider provider = new StaticContentProvider(PROPOSALS.toArray(new FieldProperty[PROPOSALS.size()]), labelProvider);
+ getProposalField().setContentProvider(provider);
+ }
+
+ public FieldReferencePropertyParser<Integer> getParser() {
+ return m_parser;
+ }
+
+ @Override
+ protected FieldProperty<Integer> parseInput(String input) throws CoreException {
+ return getParser().parseSourceValue(input, getMethod().peekMethod(), getMethod().getSuperTypeHierarchy());
+ }
+
+ @Override
+ protected synchronized void storeValue(FieldProperty<Integer> value) throws CoreException {
+ if (value == null) {
+ getProposalField().acceptProposal(getDefaultValue());
+ value = getDefaultValue();
+ }
+
+ try {
+ ConfigPropertyUpdateOperation<FieldProperty<Integer>> updateOp = new ConfigPropertyUpdateOperation<FieldProperty<Integer>>(getMethod(), getParser());
+ updateOp.setValue(value);
+ OperationJob job = new OperationJob(updateOp);
+ job.setDebug(true);
+ job.schedule();
+ }
+ catch (Exception e) {
+ ScoutSdkUi.logError("could not parse default value of method '" + getMethod().getMethodName() + "' in type '" + getMethod().getType().getFullyQualifiedName() + "'.", e);
+ }
+ }
+
+ private final static class NoneFieldProperty extends UiFieldProperty<Integer> {
+ private NoneFieldProperty() {
+ super(new VirtualNoneField(), "None");
+ }
+
+ @Override
+ public Integer getSourceValue() throws JavaModelException {
+ return Integer.valueOf(0);
+ }
+ }
+
+ @SuppressWarnings("restriction")
+ private final static class VirtualNoneField extends org.eclipse.jdt.internal.core.ResolvedSourceField {
+ public VirtualNoneField() {
+ super(null, "0", null);
+ }
+
+ @Override
+ public String getElementName() {
+ return "0";
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/internal/view/properties/presenter/single/IconPresenter.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/internal/view/properties/presenter/single/IconPresenter.java
index 442e53c..6c6671e 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/internal/view/properties/presenter/single/IconPresenter.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/internal/view/properties/presenter/single/IconPresenter.java
@@ -49,14 +49,14 @@
private ProposalTextField m_proposalField;
private IIconProvider m_iconProvider;
private ScoutIconDesc m_defaultIcon;
- private OptimisticLock storeValueLock = new OptimisticLock();
private ScoutIconDesc m_currentSourceIcon;
-
- private IconSourcePropertyParser m_parser;
+ private final OptimisticLock m_storeValueLock;
+ private final IconSourcePropertyParser m_parser;
public IconPresenter(PropertyViewFormToolkit toolkit, Composite parent) {
super(toolkit, parent);
m_parser = new IconSourcePropertyParser();
+ m_storeValueLock = new OptimisticLock();
}
@Override
@@ -102,19 +102,15 @@
m_defaultIcon = parseInput(getMethod().computeDefaultValue());
try {
- storeValueLock.acquire();
+ m_storeValueLock.acquire();
m_currentSourceIcon = parseInput(getMethod().computeValue());
// TODO handle not parsable see nls presenter
- if (m_currentSourceIcon != null) {
- m_proposalField.acceptProposal(m_currentSourceIcon);
- }
- else {
- m_proposalField.acceptProposal(null);
- }
+ m_proposalField.acceptProposal(m_currentSourceIcon);
+ updateIcon(m_currentSourceIcon);
m_proposalField.setEnabled(true);
}
finally {
- storeValueLock.release();
+ m_storeValueLock.release();
}
}
@@ -161,48 +157,54 @@
return m_defaultIcon;
}
- protected synchronized void storeValue(ScoutIconDesc value) {
- if (value == null) {
- m_proposalField.acceptProposal(getDefaultValue());
- value = getDefaultValue();
+ /**
+ * must run in UI thread
+ */
+ private void updateIcon(ScoutIconDesc newIcon) {
+ Image icon = null;
+ if (newIcon != null) {
+ icon = ((ILabelProvider) m_proposalField.getLabelProvider()).getImage(newIcon);
}
+ boolean iconAvailable = icon != null;
+ ((GridData) m_currentIconPresenter.getLayoutData()).exclude = !iconAvailable;
+ m_currentIconPresenter.setVisible(iconAvailable);
+ m_currentIconPresenter.setImage(icon);
+ getContainer().layout(true, true);
+ }
+
+ protected synchronized void storeValue(ScoutIconDesc value) {
try {
- ConfigPropertyUpdateOperation<ScoutIconDesc> updateOp = new ConfigPropertyUpdateOperation<ScoutIconDesc>(getMethod(), getParser());
- updateOp.setValue(value);
- final OperationJob job = new OperationJob(updateOp);
- job.setDebug(true);
- final ScoutIconDesc finalValue = value;
- job.addJobChangeListener(new JobChangeAdapter() {
- @Override
- public void done(IJobChangeEvent event) {
- job.removeJobChangeListener(this);
- getContainer().getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- Image icon = null;
- if (finalValue != null) {
- icon = ((ILabelProvider) m_proposalField.getLabelProvider()).getImage(finalValue);
- }
- if (icon != null) {
- ((GridData) m_currentIconPresenter.getLayoutData()).exclude = false;
- m_currentIconPresenter.setVisible(true);
- }
- else {
- ((GridData) m_currentIconPresenter.getLayoutData()).exclude = true;
- m_currentIconPresenter.setVisible(false);
- }
- m_currentIconPresenter.setImage(icon);
- getContainer().layout(true, true);
- }
- });
+ if (m_storeValueLock.acquire()) {
+ if (value == null) {
+ m_proposalField.acceptProposal(getDefaultValue());
+ value = getDefaultValue();
}
- });
- job.schedule();
+
+ ConfigPropertyUpdateOperation<ScoutIconDesc> updateOp = new ConfigPropertyUpdateOperation<ScoutIconDesc>(getMethod(), getParser());
+ updateOp.setValue(value);
+ final OperationJob job = new OperationJob(updateOp);
+ job.setDebug(true);
+ final ScoutIconDesc finalValue = value;
+ job.addJobChangeListener(new JobChangeAdapter() {
+ @Override
+ public void done(IJobChangeEvent event) {
+ job.removeJobChangeListener(this);
+ getContainer().getDisplay().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ updateIcon(finalValue);
+ }
+ });
+ }
+ });
+ job.schedule();
+ }
}
catch (Exception e) {
ScoutSdkUi.logError("could not parse default value of method '" + getMethod().getMethodName() + "' in type '" + getMethod().getType().getFullyQualifiedName() + "'.", e);
}
-
+ finally {
+ m_storeValueLock.release();
+ }
}
-
}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/internal/view/properties/presenter/single/IntegerPresenter.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/internal/view/properties/presenter/single/IntegerPresenter.java
index 605cda4..ca26c7b 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/internal/view/properties/presenter/single/IntegerPresenter.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/internal/view/properties/presenter/single/IntegerPresenter.java
@@ -48,7 +48,7 @@
else if (value.intValue() == Integer.MAX_VALUE) {
return SdkProperties.NUMBER_MAX;
}
- else if (value.intValue() == -Integer.MAX_VALUE) {
+ else if (value.intValue() == Integer.MIN_VALUE) {
return SdkProperties.NUMBER_MIN;
}
return DecimalFormat.getIntegerInstance().format(value);
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/internal/view/properties/presenter/single/NlsTextPresenter.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/internal/view/properties/presenter/single/NlsTextPresenter.java
index 090b613..4a63bfc 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/internal/view/properties/presenter/single/NlsTextPresenter.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/internal/view/properties/presenter/single/NlsTextPresenter.java
@@ -52,11 +52,12 @@
private ProposalTextField m_proposalField;
private INlsEntry m_currentSourceTuple;
private INlsProject m_nlsProject;
- private OptimisticLock storeValueLock = new OptimisticLock();
+ private final OptimisticLock m_storeValueLock;
private NlsPropertySourceParser m_parser;
public NlsTextPresenter(PropertyViewFormToolkit toolkit, Composite parent) {
super(toolkit, parent);
+ m_storeValueLock = new OptimisticLock();
}
@Override
@@ -139,7 +140,7 @@
if (getNlsProject() != null) {
try {
- storeValueLock.acquire();
+ m_storeValueLock.acquire();
m_currentSourceTuple = getParser().parseSourceValue(getMethod().computeValue(), getMethod().peekMethod(), getMethod().getSuperTypeHierarchy());
if (m_currentSourceTuple == null) {
String simpleText = PropertyMethodSourceUtility.parseReturnParameterString(getMethod().computeValue(), getMethod().peekMethod(), getMethod().getSuperTypeHierarchy());
@@ -150,7 +151,7 @@
m_proposalField.acceptProposal(m_currentSourceTuple);
}
finally {
- storeValueLock.release();
+ m_storeValueLock.release();
}
}
m_proposalField.setEnabled(getNlsProject() != null);
@@ -208,7 +209,7 @@
*/
protected IProposalSelectionHandler createSelectionHandler(INlsProject project) {
if (project != null) {
- return new NlsTextSelectionHandler(getNlsProject());
+ return new NlsTextSelectionHandler(project);
}
return null;
}
@@ -238,7 +239,7 @@
protected synchronized void storeNlsText(final INlsEntry proposal) throws CoreException {
try {
- if (storeValueLock.acquire()) {
+ if (m_storeValueLock.acquire()) {
ConfigPropertyUpdateOperation<INlsEntry> updateOp = new ConfigPropertyUpdateOperation<INlsEntry>(getMethod(), getParser());
updateOp.setValue(proposal);
OperationJob job = new OperationJob(updateOp);
@@ -250,7 +251,7 @@
ScoutSdkUi.logError("could not parse default value of method '" + getMethod().getMethodName() + "' in type '" + getMethod().getType().getFullyQualifiedName() + "'.", e);
}
finally {
- storeValueLock.release();
+ m_storeValueLock.release();
}
}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/internal/view/properties/presenter/single/RoundingModePresenter.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/internal/view/properties/presenter/single/RoundingModePresenter.java
new file mode 100644
index 0000000..fb1074e
--- /dev/null
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/internal/view/properties/presenter/single/RoundingModePresenter.java
@@ -0,0 +1,110 @@
+/*******************************************************************************
+ * Copyright (c) 2013 BSI Business Systems Integration AG.
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ui.internal.view.properties.presenter.single;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.scout.sdk.jobs.OperationJob;
+import org.eclipse.scout.sdk.ui.fields.proposal.ProposalTextField;
+import org.eclipse.scout.sdk.ui.fields.proposal.StaticContentProvider;
+import org.eclipse.scout.sdk.ui.fields.proposal.styled.SearchRangeStyledLabelProvider;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.view.properties.PropertyViewFormToolkit;
+import org.eclipse.scout.sdk.ui.view.properties.presenter.single.AbstractProposalPresenter;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.workspace.type.config.ConfigPropertyUpdateOperation;
+import org.eclipse.scout.sdk.workspace.type.config.parser.FieldReferencePropertyParser;
+import org.eclipse.scout.sdk.workspace.type.config.parser.IntegerFieldReferencePropertyParser;
+import org.eclipse.scout.sdk.workspace.type.config.property.FieldProperty;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * <h3>{@link RoundingModePresenter}</h3>
+ *
+ * @author Matthias Villiger
+ * @since 3.10.0 02.12.2013
+ */
+public class RoundingModePresenter extends AbstractProposalPresenter<FieldProperty<Integer>> {
+
+ protected static final List<FieldProperty<Integer>> PROPOSALS;
+ static {
+ IType dataModelConstants = TypeUtility.getType(BigDecimal.class.getName());
+ PROPOSALS = new ArrayList<FieldProperty<Integer>>(8);
+ PROPOSALS.add(new UiFieldProperty<Integer>(dataModelConstants.getField("ROUND_UP"), "Up"));
+ PROPOSALS.add(new UiFieldProperty<Integer>(dataModelConstants.getField("ROUND_DOWN"), "Down"));
+ PROPOSALS.add(new UiFieldProperty<Integer>(dataModelConstants.getField("ROUND_CEILING"), "Ceiling"));
+ PROPOSALS.add(new UiFieldProperty<Integer>(dataModelConstants.getField("ROUND_FLOOR"), "Floor"));
+ PROPOSALS.add(new UiFieldProperty<Integer>(dataModelConstants.getField("ROUND_HALF_UP"), "Half Up"));
+ PROPOSALS.add(new UiFieldProperty<Integer>(dataModelConstants.getField("ROUND_HALF_DOWN"), "Half Down"));
+ PROPOSALS.add(new UiFieldProperty<Integer>(dataModelConstants.getField("ROUND_HALF_EVEN"), "Half Even"));
+ PROPOSALS.add(new UiFieldProperty<Integer>(dataModelConstants.getField("ROUND_UNNECESSARY"), "Unnecessary"));
+ }
+
+ private final FieldReferencePropertyParser<Integer> m_parser;
+
+ public RoundingModePresenter(PropertyViewFormToolkit toolkit, Composite parent) {
+ super(toolkit, parent);
+ m_parser = new IntegerFieldReferencePropertyParser(PROPOSALS, true);
+ }
+
+ @Override
+ protected void createProposalFieldProviders(ProposalTextField proposalField) {
+ ILabelProvider labelProvider = new SearchRangeStyledLabelProvider() {
+ @Override
+ public String getText(Object element) {
+ return element.toString();
+ }
+
+ @Override
+ public Image getImage(Object element) {
+ return ScoutSdkUi.getImage(ScoutSdkUi.Default);
+ }
+
+ };
+ getProposalField().setLabelProvider(labelProvider);
+ StaticContentProvider provider = new StaticContentProvider(PROPOSALS.toArray(new FieldProperty[PROPOSALS.size()]), labelProvider);
+ getProposalField().setContentProvider(provider);
+ }
+
+ public FieldReferencePropertyParser<Integer> getParser() {
+ return m_parser;
+ }
+
+ @Override
+ protected FieldProperty<Integer> parseInput(String input) throws CoreException {
+ return getParser().parseSourceValue(input, getMethod().peekMethod(), getMethod().getSuperTypeHierarchy());
+ }
+
+ @Override
+ protected synchronized void storeValue(FieldProperty<Integer> value) throws CoreException {
+ if (value == null) {
+ getProposalField().acceptProposal(getDefaultValue());
+ value = getDefaultValue();
+ }
+
+ try {
+ ConfigPropertyUpdateOperation<FieldProperty<Integer>> updateOp = new ConfigPropertyUpdateOperation<FieldProperty<Integer>>(getMethod(), getParser());
+ updateOp.setValue(value);
+ OperationJob job = new OperationJob(updateOp);
+ job.setDebug(true);
+ job.schedule();
+ }
+ catch (Exception e) {
+ ScoutSdkUi.logError("could not parse default value of method '" + getMethod().getMethodName() + "' in type '" + getMethod().getType().getFullyQualifiedName() + "'.", e);
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/IScoutPageConstants.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/IScoutPageConstants.java
index d3b8b8e..27dbcd0 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/IScoutPageConstants.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/IScoutPageConstants.java
@@ -20,6 +20,7 @@
String BEAN_PROPERTY_NODE_PAGE = "org.eclipse.scout.sdk.page.BeanPropertyNodePage";
String BEAN_PROPERTY_TABLE_PAGE = "org.eclipse.scout.sdk.page.BeanPropertyTablePage";
String BIG_DECIMAL_FIELD_NODE_PAGE = "org.eclipse.scout.sdk.page.BigDecimalFieldNodePage";
+ String BIG_INTEGER_FIELD_NODE_PAGE = "org.eclipse.scout.sdk.page.BigIntegerFieldNodePage";
String BOOKMARK_STORAGE_SERVICE_NODE_PAGE = "org.eclipse.scout.sdk.page.BookmarkStorageServiceNodePage";
String BOOKMARK_STORAGE_SERVICE_TABLE_PAGE = "org.eclipse.scout.sdk.page.BookmarkStorageServiceTablePage";
String BOOLEAN_FIELD_NODE_PAGE = "org.eclipse.scout.sdk.page.BooleanFieldNodePage";
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/singlepage/JdtTypePropertyPart.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/singlepage/JdtTypePropertyPart.java
index 5712092..fefd53b 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/singlepage/JdtTypePropertyPart.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/singlepage/JdtTypePropertyPart.java
@@ -31,13 +31,17 @@
import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.ExecMethodPresenter;
import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.ExecResetSearchFilterMethodPresenter;
import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.PageFilterPresenter;
+import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.single.BigDecimalPresenter;
+import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.single.BigIntegerPresenter;
import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.single.BooleanPresenter;
import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.single.BorderDecorationPresenter;
import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.single.ButtonDisplayStylePresenter;
import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.single.ButtonSystemTypePresenter;
import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.single.CodeTypeProposalPresenter;
import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.single.ColorPresenter;
+import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.single.ComposerAttributeTypePresenter;
import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.single.DoublePresenter;
+import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.single.DragAndDropTypePresenter;
import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.single.FontPresenter;
import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.single.FormDisplayHintPresenter;
import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.single.FormViewIdPresenter;
@@ -57,6 +61,7 @@
import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.single.OutlineRootPagePresenter;
import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.single.OutlinesPresenter;
import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.single.PrimitiveTypePresenter;
+import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.single.RoundingModePresenter;
import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.single.SearchFormPresenter;
import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.single.StringPresenter;
import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.single.VerticalAglinmentPresenter;
@@ -284,9 +289,14 @@
presenter = new DoublePresenter(getFormToolkit(), parent);
presenter.setMethod(method);
}
- //else if (propertyType.equals("DRAG_AND_DROP_TYPE")) {
- // presenter for DRAG_AND_DROP_TYPE
- //}
+ else if (propertyType.equals("BIG_DECIMAL")) {
+ presenter = new BigDecimalPresenter(getFormToolkit(), parent);
+ presenter.setMethod(method);
+ }
+ else if (propertyType.equals("DRAG_AND_DROP_TYPE")) {
+ presenter = new DragAndDropTypePresenter(getFormToolkit(), parent);
+ presenter.setMethod(method);
+ }
else if (propertyType.equals("INTEGER")) {
presenter = new IntegerPresenter(getFormToolkit(), parent);
presenter.setMethod(method);
@@ -295,6 +305,10 @@
presenter = new LongPresenter(getFormToolkit(), parent);
presenter.setMethod(method);
}
+ else if (propertyType.equals("BIG_INTEGER")) {
+ presenter = new BigIntegerPresenter(getFormToolkit(), parent);
+ presenter.setMethod(method);
+ }
else if (propertyType.equals("STRING")) {
presenter = new StringPresenter(getFormToolkit(), parent);
presenter.setMethod(method);
@@ -303,21 +317,19 @@
presenter = new FontPresenter(getFormToolkit(), parent);
presenter.setMethod(method);
}
+ //else if (propertyType.equals("FORM_DATA")) {
+ // presenter for FORM_DATA
+ //}
+ //else if (propertyType.equals("ABSTRACT_FORM_DATA")) {
+ // presenter for ABSTRACT_FORM_DATA
+ //}
else if (propertyType.equals("COLOR")) {
presenter = new ColorPresenter(getFormToolkit(), parent);
presenter.setMethod(method);
}
- // else if (propertyType.equals("OBJECT")) {
- // presenter for OBJECT
+ //else if (propertyType.equals("OBJECT")) {
+ // presenter for OBJECT
//}
- else if (propertyType.equals("LABEL_POSITION")) {
- presenter = new LabelPositionPresenter(getFormToolkit(), parent);
- presenter.setMethod(method);
- }
- else if (propertyType.equals("LABEL_HORIZONTAL_ALIGNMENT")) {
- presenter = new LabelHorizontalAlignmentPresenter(getFormToolkit(), parent);
- presenter.setMethod(method);
- }
else if (propertyType.equals("BUTTON_DISPLAY_STYLE")) {
presenter = new ButtonDisplayStylePresenter(getFormToolkit(), parent);
presenter.setMethod(method);
@@ -330,12 +342,13 @@
presenter = new CodeTypeProposalPresenter(getFormToolkit(), parent);
presenter.setMethod(method);
}
- //else if (propertyType.equals("COMPOSER_ATTRIBUTE_TYPE")) {
- // presenter for COMPOSER_ATTRIBUTE_TYPE
- //}
+ else if (propertyType.equals("COMPOSER_ATTRIBUTE_TYPE")) {
+ presenter = new ComposerAttributeTypePresenter(getFormToolkit(), parent);
+ presenter.setMethod(method);
+ }
//else if (propertyType.equals("FILE_EXTENSIONS")) {
- // presenter for FILE_EXTENSIONS
- //}
+// presenter for FILE_EXTENSIONS
+//}
else if (propertyType.equals("FORM_DISPLAY_HINT")) {
presenter = new FormDisplayHintPresenter(getFormToolkit(), parent);
presenter.setMethod(method);
@@ -352,9 +365,9 @@
presenter = new IconPresenter(getFormToolkit(), parent);
presenter.setMethod(method);
}
- //else if (propertyType.equals("KEY_STROKE")) {
- // presenter for KEY_STROKE
- //}
+ // else if (propertyType.equals("KEY_STROKE")) {
+// presenter for KEY_STROKE
+// }
else if (propertyType.equals("LOOKUP_CALL")) {
presenter = new LookupCallProposalPresenter(getFormToolkit(), parent);
presenter.setMethod(method);
@@ -371,26 +384,29 @@
presenter = new OutlineRootPagePresenter(getFormToolkit(), parent);
presenter.setMethod(method);
}
- //else if (propertyType.equals("OUTLINE")) {
- // presenter for OUTLINE
- //}
+ // else if (propertyType.equals("OUTLINE")) {
+// presenter for OUTLINE
+// }
else if (propertyType.equals("OUTLINES")) {
presenter = new OutlinesPresenter(getFormToolkit(), parent);
presenter.setMethod(method);
}
- //else if (propertyType.equals("FORM")) {
- // presenter for FORM
- //}
+ // else if (propertyType.equals("FORM")) {
+// presenter for FORM
+// }
else if (propertyType.equals("SEARCH_FORM")) {
presenter = new SearchFormPresenter(getFormToolkit(), parent);
presenter.setMethod(method);
}
- //else if (propertyType.equals("NLS_PROVIDER")) {
- // presenter for NLS_PROVIDER (on sql services: ? extends ScoutTexts)
- //}
- //else if (propertyType.equals("SQL_STYLE")) {
- // presenter for SQL_STYLE
- //}
+ // else if (propertyType.equals("NLS_PROVIDER")) {
+// presenter for NLS_PROVIDER (on sql services: ? extends ScoutTexts)
+// }
+// else if (propertyType.equals("SQL_STYLE")) {
+// presenter for SQL_STYLE
+// }
+// else if (propertyType.equals("TABLE_COLUMN")) {
+// presenter for SQL_STYLE
+// }
else if (propertyType.equals("SQL")) {
presenter = new MultiLineStringPresenter(getFormToolkit(), parent);
presenter.setMethod(method);
@@ -407,15 +423,15 @@
presenter = new VerticalAglinmentPresenter(getFormToolkit(), parent);
presenter.setMethod(method);
}
- //else if (propertyType.equals("CHART_QNAME")) {
- // presenter for CHART_QNAME
- //}
- //else if (propertyType.equals("HOUR_OF_DAY")) {
- // presenter for HOUR_OF_DAY
- //}
- //else if (propertyType.equals("DURATION_MINUTES")) {
- // presenter for DURATION_MINUTES
- //}
+ // else if (propertyType.equals("CHART_QNAME")) {
+// presenter for CHART_QNAME
+// }
+// else if (propertyType.equals("HOUR_OF_DAY")) {
+// presenter for HOUR_OF_DAY
+// }
+// else if (propertyType.equals("DURATION_MINUTES")) {
+// presenter for DURATION_MINUTES
+// }
else if (propertyType.equals("MENU_CLASS")) {
presenter = new MenuProposalPresenter(getFormToolkit(), parent);
presenter.setMethod(method);
@@ -424,10 +440,22 @@
presenter = new PrimitiveTypePresenter(getFormToolkit(), parent);
presenter.setMethod(method);
}
+ else if (propertyType.equals("LABEL_POSITION")) {
+ presenter = new LabelPositionPresenter(getFormToolkit(), parent);
+ presenter.setMethod(method);
+ }
+ else if (propertyType.equals("LABEL_HORIZONTAL_ALIGNMENT")) {
+ presenter = new LabelHorizontalAlignmentPresenter(getFormToolkit(), parent);
+ presenter.setMethod(method);
+ }
else if (propertyType.equals("BORDER_DECORATION")) {
presenter = new BorderDecorationPresenter(getFormToolkit(), parent);
presenter.setMethod(method);
}
+ else if (propertyType.equals("ROUNDING_MODE")) {
+ presenter = new RoundingModePresenter(getFormToolkit(), parent);
+ presenter.setMethod(method);
+ }
// layout
if (presenter != null) {
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/presenter/single/AbstractValuePresenter.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/presenter/single/AbstractValuePresenter.java
index 83ceac3..b124ded 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/presenter/single/AbstractValuePresenter.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/presenter/single/AbstractValuePresenter.java
@@ -167,9 +167,6 @@
String string = event.text;
if (string != null) {
event.doit = m_regexAllowedCharacters.matcher(string).matches();
- if (!event.doit) {
- ScoutSdkUi.logInfo("not allowed input: " + string);
- }
}
}
break;
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/bigintegerfield/BigintegerFieldNewWizard.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/bigintegerfield/BigintegerFieldNewWizard.java
new file mode 100644
index 0000000..0a33d8b
--- /dev/null
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/bigintegerfield/BigintegerFieldNewWizard.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ui.wizard.form.fields.bigintegerfield;
+
+import org.eclipse.jdt.core.IType;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.ui.extensions.AbstractFormFieldWizard;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+
+public class BigintegerFieldNewWizard extends AbstractFormFieldWizard {
+
+ private BigintegerFieldNewWizardPage m_page1;
+
+ public BigintegerFieldNewWizard() {
+ setWindowTitle(Texts.get("NewBigintegerField"));
+ }
+
+ @Override
+ public void initWizard(IType declaringType) {
+ super.initWizard(declaringType);
+ m_page1 = new BigintegerFieldNewWizardPage(getDeclaringType());
+ addPage(m_page1);
+ }
+
+ @Override
+ public void setSuperType(IType superType) {
+ m_page1.setSuperType(superType);
+ }
+
+ @Override
+ protected void postFinishDisplayThread() {
+ IType createdField = m_page1.getCreatedField();
+ if (TypeUtility.exists(createdField)) {
+ ScoutSdkUi.showJavaElementInEditor(createdField, false);
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/bigintegerfield/BigintegerFieldNewWizardPage.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/bigintegerfield/BigintegerFieldNewWizardPage.java
new file mode 100644
index 0000000..f314176
--- /dev/null
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/bigintegerfield/BigintegerFieldNewWizardPage.java
@@ -0,0 +1,235 @@
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ui.wizard.form.fields.bigintegerfield;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.nls.sdk.model.INlsEntry;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.extensions.runtime.classes.RuntimeClasses;
+import org.eclipse.scout.sdk.operation.form.field.BigintegerFieldNewOperation;
+import org.eclipse.scout.sdk.ui.fields.StyledTextField;
+import org.eclipse.scout.sdk.ui.fields.proposal.ContentProposalEvent;
+import org.eclipse.scout.sdk.ui.fields.proposal.IProposalAdapterListener;
+import org.eclipse.scout.sdk.ui.fields.proposal.ProposalTextField;
+import org.eclipse.scout.sdk.ui.fields.proposal.SiblingProposal;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
+import org.eclipse.scout.sdk.util.ScoutUtility;
+import org.eclipse.scout.sdk.util.SdkProperties;
+import org.eclipse.scout.sdk.util.internal.sigcache.SignatureCache;
+import org.eclipse.scout.sdk.util.type.TypeFilters;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.type.IStructuredType;
+import org.eclipse.scout.sdk.workspace.type.IStructuredType.CATEGORIES;
+import org.eclipse.scout.sdk.workspace.type.ScoutTypeUtility;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * <h3>BigintegerFieldNewWizardPage</h3> ...
+ */
+public class BigintegerFieldNewWizardPage extends AbstractWorkspaceWizardPage {
+
+ private INlsEntry m_nlsName;
+ private String m_typeName;
+ private IType m_superType;
+ private SiblingProposal m_sibling;
+
+ private ProposalTextField m_nlsNameField;
+ private StyledTextField m_typeNameField;
+ private ProposalTextField m_siblingField;
+
+ // process members
+ private final IType m_declaringType;
+ private IType m_createdField;
+
+ public BigintegerFieldNewWizardPage(IType declaringType) {
+ super(BigintegerFieldNewWizardPage.class.getName());
+ m_declaringType = declaringType;
+ m_superType = RuntimeClasses.getSuperType(RuntimeClasses.IBigIntegerField, m_declaringType.getJavaProject());
+ m_sibling = SiblingProposal.SIBLING_END;
+ }
+
+ @Override
+ protected void createContent(Composite parent) {
+ setTitle(Texts.get("BigintegerField"));
+ setDescription(Texts.get("CreateANewBigintegerField"));
+
+ m_nlsNameField = getFieldToolkit().createNlsProposalTextField(parent, ScoutTypeUtility.findNlsProject(m_declaringType), Texts.get("Name"));
+ m_nlsNameField.acceptProposal(m_nlsName);
+ m_nlsNameField.addProposalAdapterListener(new IProposalAdapterListener() {
+ @Override
+ public void proposalAccepted(ContentProposalEvent event) {
+ try {
+ setStateChanging(true);
+ INlsEntry oldEntry = getNlsName();
+ m_nlsName = (INlsEntry) event.proposal;
+ if (m_nlsName != null) {
+ if (oldEntry == null || oldEntry.getKey().equals(m_typeNameField.getModifiableText()) || StringUtility.isNullOrEmpty(m_typeNameField.getModifiableText())) {
+ m_typeNameField.setText(m_nlsName.getKey());
+ }
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+ });
+
+ m_typeNameField = getFieldToolkit().createStyledTextField(parent, Texts.get("TypeName"));
+ m_typeNameField.setReadOnlySuffix(SdkProperties.SUFFIX_FORM_FIELD);
+ m_typeNameField.setText(m_typeName);
+ m_typeNameField.addModifyListener(new ModifyListener() {
+ @Override
+ public void modifyText(ModifyEvent e) {
+ m_typeName = m_typeNameField.getText();
+ pingStateChanging();
+ }
+ });
+
+ m_siblingField = getFieldToolkit().createFormFieldSiblingProposalField(parent, m_declaringType);
+ m_siblingField.addProposalAdapterListener(new IProposalAdapterListener() {
+ @Override
+ public void proposalAccepted(ContentProposalEvent event) {
+ m_sibling = (SiblingProposal) event.proposal;
+ pingStateChanging();
+ }
+ });
+ m_sibling = (SiblingProposal) m_siblingField.getSelectedProposal();
+
+ // layout
+ parent.setLayout(new GridLayout(1, true));
+
+ m_nlsNameField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ m_typeNameField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ m_siblingField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ }
+
+ @Override
+ public boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
+ BigintegerFieldNewOperation operation = new BigintegerFieldNewOperation(getTypeName(), m_declaringType, true);
+ // write back members
+ if (getNlsName() != null) {
+ operation.setNlsEntry(getNlsName());
+ }
+ if (getSuperType() != null) {
+ operation.setSuperTypeSignature(SignatureCache.createTypeSignature(getSuperType().getFullyQualifiedName()));
+ }
+ if (getSibling() == SiblingProposal.SIBLING_END) {
+ IStructuredType structuredType = ScoutTypeUtility.createStructuredCompositeField(m_declaringType);
+ operation.setSibling(structuredType.getSibling(CATEGORIES.TYPE_FORM_FIELD));
+ }
+ else {
+ operation.setSibling(getSibling().getElement());
+ }
+ operation.run(monitor, workingCopyManager);
+ m_createdField = operation.getCreatedField();
+ return true;
+ }
+
+ @Override
+ protected void validatePage(MultiStatus multiStatus) {
+ try {
+ multiStatus.add(getStatusNameField());
+ }
+ catch (JavaModelException e) {
+ ScoutSdkUi.logError("could not validate name field.", e);
+ }
+ }
+
+ protected IStatus getStatusNameField() throws JavaModelException {
+ IStatus javaFieldNameStatus = ScoutUtility.getJavaNameStatus(getTypeName(), SdkProperties.SUFFIX_FORM_FIELD);
+ if (javaFieldNameStatus.getSeverity() > IStatus.WARNING) {
+ return javaFieldNameStatus;
+ }
+ if (ScoutTypeUtility.getAllTypes(m_declaringType.getCompilationUnit(), TypeFilters.getRegexSimpleNameFilter(getTypeName())).length > 0) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
+ }
+ return javaFieldNameStatus;
+ }
+
+ /**
+ * @return the createdField
+ */
+ public IType getCreatedField() {
+ return m_createdField;
+ }
+
+ public INlsEntry getNlsName() {
+ return m_nlsName;
+ }
+
+ public void setNlsName(INlsEntry nlsName) {
+ try {
+ setStateChanging(true);
+ m_nlsName = nlsName;
+ if (isControlCreated()) {
+ m_nlsNameField.acceptProposal(nlsName);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ public String getTypeName() {
+ return m_typeName;
+ }
+
+ public void setTypeName(String typeName) {
+ try {
+ setStateChanging(true);
+ m_typeName = typeName;
+ if (isControlCreated()) {
+ m_typeNameField.setText(typeName);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ public IType getSuperType() {
+ return m_superType;
+ }
+
+ public void setSuperType(IType superType) {
+ m_superType = superType;
+ pingStateChanging();
+ }
+
+ public SiblingProposal getSibling() {
+ return m_sibling;
+ }
+
+ public void setSibling(SiblingProposal sibling) {
+ try {
+ setStateChanging(true);
+ m_sibling = sibling;
+ if (isControlCreated()) {
+ m_siblingField.acceptProposal(sibling);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk/plugin.xml b/org.eclipse.scout.sdk/plugin.xml
index 88eb641..f1182de 100644
--- a/org.eclipse.scout.sdk/plugin.xml
+++ b/org.eclipse.scout.sdk/plugin.xml
@@ -247,6 +247,12 @@
</default>
</element>
<element
+ interface="org.eclipse.scout.rt.client.ui.form.fields.bigintegerfield.IBigIntegerField">
+ <default
+ class="org.eclipse.scout.rt.client.ui.form.fields.bigintegerfield.AbstractBigIntegerField">
+ </default>
+ </element>
+ <element
interface="org.eclipse.scout.rt.client.ui.desktop.IDesktopExtension">
<default
class="org.eclipse.scout.rt.client.ui.desktop.AbstractDesktopExtension">
diff --git a/org.eclipse.scout.sdk/resources/texts/Texts.properties b/org.eclipse.scout.sdk/resources/texts/Texts.properties
index d4c6acf..3ba13f8 100644
--- a/org.eclipse.scout.sdk/resources/texts/Texts.properties
+++ b/org.eclipse.scout.sdk/resources/texts/Texts.properties
@@ -36,6 +36,7 @@
AvailableBundles=Available Bundles
BeanPropertyTablePage=Variables
BigdecimalField=Bigdecimal Field
+BigintegerField=Biginteger Field
BookmarkStorageService=Bookmark Storage Services
BookmarkStorageServiceLocation=Bookmark Storage Service Location
BooleanColumn=Boolean Column
@@ -84,6 +85,7 @@
Copied=copied
CopyOf=CopyOf
CreateANewBigdecimalField=Create a new Bigdecimal Field.
+CreateANewBigintegerField=Create a new Biginteger Field.
CreateANewBookmarkStorageService=Create a new Bookmark Storage Service.
CreateANewBooleanField=Create a new Boolean Field.
CreateANewButtonField=Create a new Button.
@@ -307,6 +309,7 @@
New=New
NewAttribute=New Composer Field Attribute
NewBigdecimalField=New Bigdecimal Field
+NewBigintegerField=New Biginteger Field
NewBookmarkService=New Bookmark Service
NewBookmarkStorageService=New Bookmark Storage Service
NewBooleanField=New Boolean Field
diff --git a/org.eclipse.scout.sdk/src/org/eclipse/scout/sdk/extensions/runtime/classes/IRuntimeClasses.java b/org.eclipse.scout.sdk/src/org/eclipse/scout/sdk/extensions/runtime/classes/IRuntimeClasses.java
index 712e3d5..3bc86fe 100644
--- a/org.eclipse.scout.sdk/src/org/eclipse/scout/sdk/extensions/runtime/classes/IRuntimeClasses.java
+++ b/org.eclipse.scout.sdk/src/org/eclipse/scout/sdk/extensions/runtime/classes/IRuntimeClasses.java
@@ -15,7 +15,7 @@
/**
* <h3>{@link RuntimeClasses}</h3> ...
- *
+ *
* @author Andreas Hoegger
* @since 1.0.8 24.01.2009
*/
@@ -62,6 +62,7 @@
String ClientServiceFactory = "org.eclipse.scout.rt.client.services.ClientServiceFactory"; // NO_UCD
String ConfigProperty = "org.eclipse.scout.commons.annotations.ConfigProperty"; // NO_UCD
String ConfigOperation = "org.eclipse.scout.commons.annotations.ConfigOperation"; // NO_UCD
+ String DataModelConstants = "org.eclipse.scout.rt.shared.data.model.DataModelConstants"; // NO_UCD
String DefaultOutlineTableForm = "org.eclipse.scout.rt.client.ui.form.outline.DefaultOutlineTableForm"; // NO_UCD
String DefaultOutlineTreeForm = "org.eclipse.scout.rt.client.ui.form.outline.DefaultOutlineTreeForm"; // NO_UCD
String DefaultServiceFactory = "org.eclipse.scout.service.DefaultServiceFactory"; // NO_UCD
@@ -116,6 +117,7 @@
String IValidationStrategy = "org.eclipse.scout.rt.shared.validate.IValidationStrategy"; // NO_UCD
String IActivityMap = "org.eclipse.scout.rt.client.ui.basic.activitymap.IActivityMap"; // NO_UCD
String IBigDecimalField = "org.eclipse.scout.rt.client.ui.form.fields.bigdecimalfield.IBigDecimalField"; // NO_UCD
+ String IBigIntegerField = "org.eclipse.scout.rt.client.ui.form.fields.bigintegerfield.IBigIntegerField"; // NO_UCD
String IBookmarkStorageService = "org.eclipse.scout.rt.shared.services.common.bookmark.IBookmarkStorageService"; // NO_UCD
String IBooleanField = "org.eclipse.scout.rt.client.ui.form.fields.booleanfield.IBooleanField"; // NO_UCD
String IButton = "org.eclipse.scout.rt.client.ui.form.fields.button.IButton"; // NO_UCD
@@ -149,6 +151,7 @@
String IDesktop = "org.eclipse.scout.rt.client.ui.desktop.IDesktop"; // NO_UCD
String IDesktopExtension = "org.eclipse.scout.rt.client.ui.desktop.IDesktopExtension"; // NO_UCD
String IDoubleField = "org.eclipse.scout.rt.client.ui.form.fields.doublefield.IDoubleField"; // NO_UCD
+ String IDNDSupport = "org.eclipse.scout.rt.client.ui.IDNDSupport"; // NO_UCD
String IFileChooserField = "org.eclipse.scout.rt.client.ui.form.fields.filechooserfield.IFileChooserField"; // NO_UCD
String IForm = "org.eclipse.scout.rt.client.ui.form.IForm"; // NO_UCD
String IFormField = "org.eclipse.scout.rt.client.ui.form.fields.IFormField"; // NO_UCD
diff --git a/org.eclipse.scout.sdk/src/org/eclipse/scout/sdk/operation/form/field/BigintegerFieldNewOperation.java b/org.eclipse.scout.sdk/src/org/eclipse/scout/sdk/operation/form/field/BigintegerFieldNewOperation.java
new file mode 100644
index 0000000..e4aab4e
--- /dev/null
+++ b/org.eclipse.scout.sdk/src/org/eclipse/scout/sdk/operation/form/field/BigintegerFieldNewOperation.java
@@ -0,0 +1,139 @@
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.operation.form.field;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.core.Flags;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.nls.sdk.model.INlsEntry;
+import org.eclipse.scout.sdk.extensions.runtime.classes.RuntimeClasses;
+import org.eclipse.scout.sdk.operation.IOperation;
+import org.eclipse.scout.sdk.sourcebuilder.SortedMemberKeyFactory;
+import org.eclipse.scout.sdk.sourcebuilder.method.IMethodSourceBuilder;
+import org.eclipse.scout.sdk.sourcebuilder.method.MethodBodySourceBuilderFactory;
+import org.eclipse.scout.sdk.sourcebuilder.method.MethodSourceBuilderFactory;
+import org.eclipse.scout.sdk.util.SdkProperties;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+
+/**
+ * <h3>BigintegerFieldNewOperation</h3> ...
+ */
+public class BigintegerFieldNewOperation implements IOperation {
+
+ // in members
+ private final IType m_declaringType;
+ private boolean m_formatSource;
+ private String m_typeName;
+ private INlsEntry m_nlsEntry;
+ private String m_superTypeSignature;
+ private IJavaElement m_sibling;
+
+ // out members
+ private IType m_createdField;
+
+ public BigintegerFieldNewOperation(String typeName, IType declaringType) {
+ this(typeName, declaringType, true);
+ }
+
+ public BigintegerFieldNewOperation(String typeName, IType declaringType, boolean formatSource) {
+ m_typeName = typeName;
+ m_declaringType = declaringType;
+ m_formatSource = formatSource;
+ // default
+ setSuperTypeSignature(RuntimeClasses.getSuperTypeSignature(RuntimeClasses.IBigIntegerField, getDeclaringType().getJavaProject()));
+ }
+
+ @Override
+ public String getOperationName() {
+ return "Create Biginteger field '" + getTypeName() + "'...";
+ }
+
+ @Override
+ public void validate() throws IllegalArgumentException {
+ if (StringUtility.isNullOrEmpty(getTypeName())) {
+ throw new IllegalArgumentException("typeName is null or empty.");
+ }
+ if (getDeclaringType() == null) {
+ throw new IllegalArgumentException("declaring type can not be null.");
+ }
+ }
+
+ @Override
+ public void run(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
+ FormFieldNewOperation newOp = new FormFieldNewOperation(getTypeName(), getDeclaringType());
+ newOp.setFlags(Flags.AccPublic);
+ newOp.setSuperTypeSignature(getSuperTypeSignature());
+ newOp.setSibling(getSibling());
+ // getConfiguredLabel method
+ if (getNlsEntry() != null) {
+ IMethodSourceBuilder nlsMethodBuilder = MethodSourceBuilderFactory.createOverrideMethodSourceBuilder(newOp.getSourceBuilder(), SdkProperties.METHOD_NAME_GET_CONFIGURED_LABEL);
+ nlsMethodBuilder.setMethodBodySourceBuilder(MethodBodySourceBuilderFactory.createNlsEntryReferenceBody(getNlsEntry()));
+ newOp.addSortedMethodSourceBuilder(SortedMemberKeyFactory.createMethodGetConfiguredKey(nlsMethodBuilder), nlsMethodBuilder);
+ }
+
+ newOp.setFormatSource(isFormatSource());
+ newOp.validate();
+ newOp.run(monitor, workingCopyManager);
+ m_createdField = newOp.getCreatedType();
+ }
+
+ public IType getCreatedField() {
+ return m_createdField;
+ }
+
+ public IType getDeclaringType() {
+ return m_declaringType;
+ }
+
+ public void setFormatSource(boolean formatSource) {
+ m_formatSource = formatSource;
+ }
+
+ public boolean isFormatSource() {
+ return m_formatSource;
+ }
+
+ public String getTypeName() {
+ return m_typeName;
+ }
+
+ public void setTypeName(String typeName) {
+ m_typeName = typeName;
+ }
+
+ public INlsEntry getNlsEntry() {
+ return m_nlsEntry;
+ }
+
+ public void setNlsEntry(INlsEntry nlsEntry) {
+ m_nlsEntry = nlsEntry;
+ }
+
+ public String getSuperTypeSignature() {
+ return m_superTypeSignature;
+ }
+
+ public void setSuperTypeSignature(String superTypeSignature) {
+ m_superTypeSignature = superTypeSignature;
+ }
+
+ public IJavaElement getSibling() {
+ return m_sibling;
+ }
+
+ public void setSibling(IJavaElement sibling) {
+ m_sibling = sibling;
+ }
+
+}
diff --git a/org.eclipse.scout.sdk/src/org/eclipse/scout/sdk/util/method/MethodReturnExpression.java b/org.eclipse.scout.sdk/src/org/eclipse/scout/sdk/util/method/MethodReturnExpression.java
index b72aa8e..4f6450c 100644
--- a/org.eclipse.scout.sdk/src/org/eclipse/scout/sdk/util/method/MethodReturnExpression.java
+++ b/org.eclipse.scout.sdk/src/org/eclipse/scout/sdk/util/method/MethodReturnExpression.java
@@ -47,6 +47,11 @@
return getReturnStatement(null);
}
+ @Override
+ public String toString() {
+ return getReturnStatement();
+ }
+
public String getReturnStatement(IImportValidator validator) {
if (validator == null) {
// favor the return clause if no IImportValidator is given
diff --git a/org.eclipse.scout.sdk/src/org/eclipse/scout/sdk/workspace/type/config/ConfigurationMethod.java b/org.eclipse.scout.sdk/src/org/eclipse/scout/sdk/workspace/type/config/ConfigurationMethod.java
index ae34e70..0a8e99d 100644
--- a/org.eclipse.scout.sdk/src/org/eclipse/scout/sdk/workspace/type/config/ConfigurationMethod.java
+++ b/org.eclipse.scout.sdk/src/org/eclipse/scout/sdk/workspace/type/config/ConfigurationMethod.java
@@ -13,6 +13,7 @@
import java.util.Stack;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.Flags;
import org.eclipse.jdt.core.IMethod;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.ITypeHierarchy;
@@ -26,18 +27,19 @@
*
*/
public class ConfigurationMethod {
- public static int PROPERTY_METHOD = 1;
- public static int OPERATION_METHOD = 2;
+ public static final int PROPERTY_METHOD = 1;
+ public static final int OPERATION_METHOD = 2;
private final IType m_type;
private final ITypeHierarchy m_superTypeHierarchy;
- private String m_methodName;
- Stack<IMethod> m_methodStack = new Stack<IMethod>();
+ private final Stack<IMethod> m_methodStack;
+ private final String m_methodName;
+ private final int m_methodType;
private String m_configAnnotationType;
- private int m_methodType;
private String m_source;
public ConfigurationMethod(IType type, ITypeHierarchy superTypeHierarchy, String methodName, int methodType) {
+ m_methodStack = new Stack<IMethod>();
m_type = type;
m_superTypeHierarchy = superTypeHierarchy;
m_methodName = methodName;
@@ -68,13 +70,24 @@
return peekMethod().getDeclaringType().equals(getType());
}
+ /**
+ * Pushes the given method onto the top of this stack.<br>
+ * <b>Note: Compiler generated methods (Bridge methods) are ignored!</b>
+ *
+ * @param method
+ * The method to add
+ * @see Flags#AccBridge
+ */
public void pushMethod(IMethod method) {
- m_methodStack.push(method);
try {
+ if (Flags.isBridge(method.getFlags())) {
+ return; // ignore compiler generated methods
+ }
+ m_methodStack.push(method);
m_source = method.getSource();
}
catch (JavaModelException e) {
- ScoutSdk.logError("could not get source of method '" + method.getElementName() + "' in type '" + method.getDeclaringType() + "'.", e);
+ ScoutSdk.logError("could not add method '" + method.getElementName() + "' in type '" + method.getDeclaringType() + "'.", e);
}
}
@@ -119,6 +132,11 @@
return null;
}
+ /**
+ * returns the method at the top of this stack without removing it from the stack.
+ *
+ * @return
+ */
public IMethod peekMethod() {
if (!m_methodStack.isEmpty()) {
while (!m_methodStack.peek().exists()) {
diff --git a/org.eclipse.scout.sdk/src/org/eclipse/scout/sdk/workspace/type/config/PropertyMethodSourceUtility.java b/org.eclipse.scout.sdk/src/org/eclipse/scout/sdk/workspace/type/config/PropertyMethodSourceUtility.java
index 4650501..91168f5 100644
--- a/org.eclipse.scout.sdk/src/org/eclipse/scout/sdk/workspace/type/config/PropertyMethodSourceUtility.java
+++ b/org.eclipse.scout.sdk/src/org/eclipse/scout/sdk/workspace/type/config/PropertyMethodSourceUtility.java
@@ -10,6 +10,8 @@
******************************************************************************/
package org.eclipse.scout.sdk.workspace.type.config;
+import java.math.BigDecimal;
+import java.math.BigInteger;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.util.regex.Matcher;
@@ -35,39 +37,18 @@
import org.eclipse.scout.sdk.workspace.type.ScoutTypeUtility;
public final class PropertyMethodSourceUtility {
-
- /**
- * with "com.bsiag.test.ClassA.Field"
- * group1 = com.bsiag.test.ClassA.
- * group2 = ClassA.
- * group3 = Field
- * with "com.bsiag.test.ClassA.Field"
- * group1 = ""
- * group2 = null
- * group3 = Field
- */
- private final static Pattern REGEX_FIELD_NEW = Pattern.compile("\\b(([A-Za-z][a-zA-Z0-9_]*\\.)*)?([A-Za-z][a-zA-Z0-9_]*)\\b");
+ private final static Pattern REGEX_REFERENCED_VALUE = Pattern.compile("\\b(([A-Za-z][a-zA-Z0-9_]*\\.)*)?([A-Za-z][a-zA-Z0-9_]*)\\b");
private final static Pattern REGEX_NUMBER_PREFIX = Pattern.compile("^(\\+|\\-)?([A-Za-z0-9_\\.]*)$");
private final static Pattern REGEX_NUMBER_INFINITY = Pattern.compile("^(\\-)?(inf)$");
- private final static Pattern REGEX_SIMPLE_DOUBLE = Pattern.compile("^[\\+\\-0-9eEf\\.\\,']*[Dd]?$");
+ private final static Pattern REGEX_SIMPLE_DOUBLE = Pattern.compile("^[\\+\\-0-9eE\\.']*[DdfF]?$");
private final static Pattern REGEX_SIMPLE_INTEGER = Pattern.compile("^[\\+\\-0-9eE']*$");
+ private final static Pattern REGEX_SIMPLE_BIG_INTEGER = Pattern.compile("^(new (java\\.math\\.)?BigInteger\\(\\\")?([\\+\\-0-9]*)(\\\"\\))?$");
+ private final static Pattern REGEX_SIMPLE_BIG_DECIMAL = Pattern.compile("^(new (java\\.math\\.)?BigDecimal\\(\\\")?([\\+\\-0-9eE\\.]*)(\\\"\\))?$");
private final static Pattern REGEX_SIMPLE_LONG = Pattern.compile("^[\\+\\-0-9eE']*[lL]?$");
private final static Pattern REGEX_SIMPLE_BOOLEAN = Pattern.compile("^(false|true)$");
- private static final Pattern REGEX_FIELD_VALUE = Pattern.compile("=\\s*(.*)\\s*\\;", Pattern.DOTALL);
-
- /**
- * with com.bsiag.Test.class
- * group1 = com.bsiag.Test.
- * group2 = Test.
- * group3 = class
- * with Test.class
- * group1 = Test.
- * group2 = Test.
- * group3 = class
- */
+ private final static Pattern REGEX_FIELD_VALUE = Pattern.compile("=\\s*(.*)\\s*\\;", Pattern.DOTALL);
private final static Pattern REGEX_CLASS_REFERENCE = Pattern.compile("\\b(([A-Za-z][a-zA-Z0-9_]*\\.)*)?(class)\\b");
private final static Pattern REGEX_NULL = Pattern.compile("\\bnull\\b");
-
private final static Pattern REGEX_METHOD_RETURN_NON_NLS_TEXT = Pattern.compile("\\s*\"(.*)\"\\s*");
private final static Pattern REGEX_METHOD_RETURN_NLS_TEXT = Pattern.compile("[A-Za-z0-9_-]*\\.get\\(\\s*\\\"([^\\\"]*)\\\"\\s*\\)\\s*");
@@ -302,17 +283,17 @@
if (REGEX_NULL.matcher(parameter).matches() || parameter.equals("")) {
return null;
}
+ // handle MIN_VAL / MAX_VAL
if (parameter.equals("Integer.MAX_VALUE")) {
return Integer.MAX_VALUE;
}
- // handle MIN_VAL / MAX_VAL
- if (parameter.equals("-Integer.MAX_VALUE")) {
- return -Integer.MAX_VALUE;
+ if (parameter.equals("Integer.MIN_VALUE")) {
+ return Integer.MIN_VALUE;
}
Matcher infMatcher = REGEX_NUMBER_INFINITY.matcher(parameter);
if (infMatcher.find()) {
if (infMatcher.group(1) != null) {
- return -Integer.MAX_VALUE;
+ return Integer.MIN_VALUE;
}
else {
return Integer.MAX_VALUE;
@@ -367,6 +348,56 @@
throw new CustomImplementationException();
}
+ /**
+ * parses the given return clause input string into a big decimal.<br>
+ * <br>
+ * Example:<br>
+ * Input: new BigDecimal("-999999999999999999999999999999999999999999999999999999999999.056978")<br>
+ * Output: -999999999999999999999999999999999999999999999999999999999999.056978<br>
+ * <br>
+ * Input: 2358.2357<br>
+ * Output: 2358.2357
+ *
+ * @param parameter
+ * @return
+ * @throws CoreException
+ */
+ public static BigDecimal parseReturnParameterBigDecimal(String parameter) throws CoreException {
+ if (REGEX_NULL.matcher(parameter).matches() || parameter.equals("")) {
+ return null;
+ }
+ Matcher m = REGEX_SIMPLE_BIG_DECIMAL.matcher(parameter);
+ if (m.find()) {
+ return new BigDecimal(m.group(3));
+ }
+ throw new CustomImplementationException();
+ }
+
+ /**
+ * parses the given return clause input string into a big integer.<br>
+ * <br>
+ * Example:<br>
+ * Input: new BigInteger("-999999999999999999999999999999999999999999999999999999999999")<br>
+ * Output: -999999999999999999999999999999999999999999999999999999999999<br>
+ * <br>
+ * Input: 2358<br>
+ * Output: 2358
+ *
+ * @param parameter
+ * @return
+ * @throws CoreException
+ */
+ public static BigInteger parseReturnParameterBigInteger(String parameter) throws CoreException {
+ if (REGEX_NULL.matcher(parameter).matches() || parameter.equals("")) {
+ return null;
+ }
+ Matcher m = REGEX_SIMPLE_BIG_INTEGER.matcher(parameter);
+ if (m.find()) {
+ return new BigInteger(m.group(3));
+ }
+ throw new CustomImplementationException();
+ }
+
public static Long parseReturnParameterLong(String parameter) throws CoreException {
if (REGEX_NULL.matcher(parameter).matches() || parameter.equals("")) {
return null;
@@ -441,22 +472,21 @@
}
private static String findReferencedValue(String parameter, IMethod method, ITypeHierarchy superTypeHierarchy) throws CoreException {
- Matcher matcher = REGEX_FIELD_NEW.matcher(parameter);
+ Matcher matcher = REGEX_REFERENCED_VALUE.matcher(parameter);
if (matcher.find()) {
+ IType referencedType = null;
if (matcher.group(2) != null) {
String typeName = matcher.group(1);
typeName = typeName.substring(0, typeName.length() - 1);
- IType referencedType = ScoutUtility.getReferencedType(method.getDeclaringType(), typeName);
- if (referencedType == null) {
+ referencedType = ScoutUtility.getReferencedType(method.getDeclaringType(), typeName);
+ if (!TypeUtility.exists(referencedType)) {
throw new CoreException(new ScoutStatus(Status.WARNING, "Reference '" + parameter + "' could not be found.", null));
}
- String fieldValue = findReferencedFieldValue(referencedType, matcher.group(3), superTypeHierarchy);
- return fieldValue;
}
else {
- String fieldValue = findReferencedFieldValue(method.getDeclaringType(), matcher.group(3), superTypeHierarchy);
- return fieldValue;
+ referencedType = method.getDeclaringType();
}
+ return findReferencedFieldValue(referencedType, matcher.group(3), superTypeHierarchy);
}
throw new CustomImplementationException();
}
@@ -515,7 +545,7 @@
if (input.equals("null")) {
return "";
}
- Matcher matcher = REGEX_FIELD_NEW.matcher(input);
+ Matcher matcher = REGEX_REFERENCED_VALUE.matcher(input);
if (matcher.find()) {
if (matcher.group(2) != null) {
String typeName = matcher.group(1);
diff --git a/org.eclipse.scout.sdk/src/org/eclipse/scout/sdk/workspace/type/config/parser/BigDecimalPropertySourceParser.java b/org.eclipse.scout.sdk/src/org/eclipse/scout/sdk/workspace/type/config/parser/BigDecimalPropertySourceParser.java
new file mode 100644
index 0000000..89f5523
--- /dev/null
+++ b/org.eclipse.scout.sdk/src/org/eclipse/scout/sdk/workspace/type/config/parser/BigDecimalPropertySourceParser.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2013 BSI Business Systems Integration AG.
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.workspace.type.config.parser;
+
+import java.math.BigDecimal;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.ITypeHierarchy;
+import org.eclipse.scout.sdk.util.internal.sigcache.SignatureCache;
+import org.eclipse.scout.sdk.util.signature.IImportValidator;
+import org.eclipse.scout.sdk.workspace.type.config.PropertyMethodSourceUtility;
+
+/**
+ * <h3>{@link BigDecimalPropertySourceParser}</h3>
+ *
+ * @author Matthias Villiger
+ * @since 3.10.0 02.12.2013
+ */
+public class BigDecimalPropertySourceParser implements IPropertySourceParser<BigDecimal> {
+
+ @Override
+ public BigDecimal parseSourceValue(String source, IMethod context, ITypeHierarchy superTypeHierarchy) throws CoreException {
+ BigDecimal bd = PropertyMethodSourceUtility.parseReturnParameterBigDecimal(source);
+ return bd;
+ }
+
+ @Override
+ public String formatSourceValue(BigDecimal value, String lineDelimiter, IImportValidator importValidator) throws CoreException {
+ if (value == null) {
+ return "null";
+ }
+ return "new " + importValidator.getTypeName(SignatureCache.createTypeSignature(BigDecimal.class.getName())) + "(\"" + value.toPlainString() + "\")";
+ }
+}
diff --git a/org.eclipse.scout.sdk/src/org/eclipse/scout/sdk/workspace/type/config/parser/BigIntegerPropertySourceParser.java b/org.eclipse.scout.sdk/src/org/eclipse/scout/sdk/workspace/type/config/parser/BigIntegerPropertySourceParser.java
new file mode 100644
index 0000000..7351a1b
--- /dev/null
+++ b/org.eclipse.scout.sdk/src/org/eclipse/scout/sdk/workspace/type/config/parser/BigIntegerPropertySourceParser.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2013 BSI Business Systems Integration AG.
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.workspace.type.config.parser;
+
+import java.math.BigInteger;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.ITypeHierarchy;
+import org.eclipse.scout.sdk.util.internal.sigcache.SignatureCache;
+import org.eclipse.scout.sdk.util.signature.IImportValidator;
+import org.eclipse.scout.sdk.workspace.type.config.PropertyMethodSourceUtility;
+
+/**
+ * <h3>{@link BigIntegerPropertySourceParser}</h3>
+ *
+ * @author Matthias Villiger
+ * @since 3.10.0 02.12.2013
+ */
+public class BigIntegerPropertySourceParser implements IPropertySourceParser<BigInteger> {
+
+ @Override
+ public BigInteger parseSourceValue(String source, IMethod context, ITypeHierarchy superTypeHierarchy) throws CoreException {
+ BigInteger bi = PropertyMethodSourceUtility.parseReturnParameterBigInteger(source);
+ return bi;
+ }
+
+ @Override
+ public String formatSourceValue(BigInteger value, String lineDelimiter, IImportValidator importValidator) throws CoreException {
+ if (value == null) {
+ return "null";
+ }
+ return "new " + importValidator.getTypeName(SignatureCache.createTypeSignature(BigInteger.class.getName())) + "(\"" + value.toString() + "\")";
+ }
+}
diff --git a/org.eclipse.scout.sdk/src/org/eclipse/scout/sdk/workspace/type/config/parser/FieldReferencePropertyParser.java b/org.eclipse.scout.sdk/src/org/eclipse/scout/sdk/workspace/type/config/parser/FieldReferencePropertyParser.java
index 2860e8c..a33adfc 100644
--- a/org.eclipse.scout.sdk/src/org/eclipse/scout/sdk/workspace/type/config/parser/FieldReferencePropertyParser.java
+++ b/org.eclipse.scout.sdk/src/org/eclipse/scout/sdk/workspace/type/config/parser/FieldReferencePropertyParser.java
@@ -13,24 +13,27 @@
import java.util.List;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.IField;
import org.eclipse.jdt.core.IMethod;
import org.eclipse.jdt.core.ITypeHierarchy;
+import org.eclipse.scout.sdk.util.internal.sigcache.SignatureCache;
import org.eclipse.scout.sdk.util.signature.IImportValidator;
import org.eclipse.scout.sdk.workspace.type.config.property.FieldProperty;
/**
* <h3>{@link FieldReferencePropertyParser}</h3> ...
*
- * @author Andreas Hoegger
+ * @author Andreas Hoegger
* @since 3.8.0 27.02.2013
*/
public abstract class FieldReferencePropertyParser<T> implements IPropertySourceParser<FieldProperty<T>> {
private final List<FieldProperty<T>> m_properties;
+ private final boolean m_useTypeReference;
- public FieldReferencePropertyParser(List<FieldProperty<T>> properties) {
+ public FieldReferencePropertyParser(List<FieldProperty<T>> properties, boolean useTypeReference) {
m_properties = properties;
-
+ m_useTypeReference = useTypeReference;
}
public List<FieldProperty<T>> getProperties() {
@@ -52,7 +55,17 @@
@Override
public String formatSourceValue(FieldProperty<T> value, String lineDelimiter, IImportValidator importValidator) throws CoreException {
- return value.getConstant().getElementName();
+ IField field = value.getConstant();
+ StringBuilder sb = new StringBuilder();
+ if (isUseTypeReference()) {
+ sb.append(importValidator.getTypeName(SignatureCache.createTypeSignature(field.getDeclaringType().getFullyQualifiedName())));
+ sb.append(".");
+ }
+ sb.append(field.getElementName());
+ return sb.toString();
}
+ public boolean isUseTypeReference() {
+ return m_useTypeReference;
+ }
}
diff --git a/org.eclipse.scout.sdk/src/org/eclipse/scout/sdk/workspace/type/config/parser/IntegerFieldReferencePropertyParser.java b/org.eclipse.scout.sdk/src/org/eclipse/scout/sdk/workspace/type/config/parser/IntegerFieldReferencePropertyParser.java
index 0bd59ee..9185752 100644
--- a/org.eclipse.scout.sdk/src/org/eclipse/scout/sdk/workspace/type/config/parser/IntegerFieldReferencePropertyParser.java
+++ b/org.eclipse.scout.sdk/src/org/eclipse/scout/sdk/workspace/type/config/parser/IntegerFieldReferencePropertyParser.java
@@ -21,16 +21,17 @@
/**
* <h3>{@link IntegerFieldReferencePropertyParser}</h3> ...
*
- * @author Andreas Hoegger
+ * @author Andreas Hoegger
* @since 3.8.0 01.03.2013
*/
public class IntegerFieldReferencePropertyParser extends FieldReferencePropertyParser<Integer> {
- /**
- * @param properties
- */
public IntegerFieldReferencePropertyParser(List<FieldProperty<Integer>> properties) {
- super(properties);
+ this(properties, false);
+ }
+
+ public IntegerFieldReferencePropertyParser(List<FieldProperty<Integer>> properties, boolean useTypeReference) {
+ super(properties, useTypeReference);
}
@Override
diff --git a/org.eclipse.scout.sdk/src/org/eclipse/scout/sdk/workspace/type/config/parser/IntegerPropertySourceParser.java b/org.eclipse.scout.sdk/src/org/eclipse/scout/sdk/workspace/type/config/parser/IntegerPropertySourceParser.java
index 9476f21..39adf32 100644
--- a/org.eclipse.scout.sdk/src/org/eclipse/scout/sdk/workspace/type/config/parser/IntegerPropertySourceParser.java
+++ b/org.eclipse.scout.sdk/src/org/eclipse/scout/sdk/workspace/type/config/parser/IntegerPropertySourceParser.java
@@ -19,7 +19,7 @@
/**
* <h3>{@link IntegerPropertySourceParser}</h3> ...
*
- * @author Andreas Hoegger
+ * @author Andreas Hoegger
* @since 3.8.0 27.02.2013
*/
public class IntegerPropertySourceParser implements IPropertySourceParser<Integer> {
@@ -38,8 +38,8 @@
else if (value.intValue() == Integer.MAX_VALUE) {
return "Integer.MAX_VALUE";
}
- else if (value.intValue() == -Integer.MAX_VALUE) {
- return "-Integer.MAX_VALUE";
+ else if (value.intValue() == Integer.MIN_VALUE) {
+ return "Integer.MIN_VALUE";
}
return value.toString();
}
diff --git a/org.eclipse.scout.sdk/src/org/eclipse/scout/sdk/workspace/type/config/parser/StringFieldReferencePropertyParser.java b/org.eclipse.scout.sdk/src/org/eclipse/scout/sdk/workspace/type/config/parser/StringFieldReferencePropertyParser.java
index 91af558..e5108e7 100644
--- a/org.eclipse.scout.sdk/src/org/eclipse/scout/sdk/workspace/type/config/parser/StringFieldReferencePropertyParser.java
+++ b/org.eclipse.scout.sdk/src/org/eclipse/scout/sdk/workspace/type/config/parser/StringFieldReferencePropertyParser.java
@@ -21,16 +21,17 @@
/**
* <h3>{@link StringFieldReferencePropertyParser}</h3> ...
*
- * @author Andreas Hoegger
+ * @author Andreas Hoegger
* @since 3.8.0 01.03.2013
*/
public class StringFieldReferencePropertyParser extends FieldReferencePropertyParser<String> {
- /**
- * @param properties
- */
public StringFieldReferencePropertyParser(List<FieldProperty<String>> properties) {
- super(properties);
+ this(properties, false);
+ }
+
+ public StringFieldReferencePropertyParser(List<FieldProperty<String>> properties, boolean useTypeReference) {
+ super(properties, useTypeReference);
}
@Override