Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Leicht Vogt2012-09-07 07:51:41 +0000
committerStephan Leicht Vogt2012-09-07 07:51:41 +0000
commit2456cda8d79d4b7a45c2ecc23b716368df4296ce (patch)
tree3ee973be67a54ce9e6d425a346f2032ad2dd300e
parentc5a18ed9f6648a62905e9f7e22a8262530652e21 (diff)
downloadorg.eclipse.scout.sdk-2456cda8d79d4b7a45c2ecc23b716368df4296ce.tar.gz
org.eclipse.scout.sdk-2456cda8d79d4b7a45c2ecc23b716368df4296ce.tar.xz
org.eclipse.scout.sdk-2456cda8d79d4b7a45c2ecc23b716368df4296ce.zip
Normalize line endings
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/util/UiUtility.java144
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/IScoutExplorerPart.java94
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/OutlineCopySourceEvent.java72
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/OutlineDropTargetEvent.java148
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/OutlinePasteTargetEvent.java94
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/AbstractPage.java728
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/AbstractScoutTypePage.java236
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/INodeVisitor.java78
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/IPage.java160
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/IPageFilter.java50
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/IScoutPageConstants.java278
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/ITypePage.java42
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/InnerTypeOrderChangedPageDirtyListener.java126
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/InnerTypePageDirtyListener.java178
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/PageDirtyListener.java98
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/PageFilter.java214
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/basic/beanproperty/BeanPropertyNodePage.java182
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/basic/beanproperty/BeanPropertyTablePage.java206
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/project/IProjectNodePage.java42
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/project/client/ui/form/field/AbstractFormFieldNodePage.java126
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/project/server/service/AbstractServiceNodePage.java266
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/AbstractPropertyPageSection.java146
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/IPropertyPageSection.java72
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/PropertyViewFormToolkit.java128
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/AbstractSectionBasedPart.java642
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/ISection.java1008
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/Section.java1618
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/multipage/AbstractMultiPageSectionBasedViewPart.java150
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/multipage/JdtTypeMultiPropertyPart.java594
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/multipage/UnknownMultiPagePropertyViewPart.java88
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/singlepage/AbstractSinglePageSectionBasedViewPart.java254
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/singlepage/ConfigurationMethodSection.java582
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/singlepage/ExceptionSinglePagePropertyViewPart.java174
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/singlepage/FormPropertyPart.java326
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/singlepage/IconsPropertyViewPart.java146
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/singlepage/JdtTypePropertyPart.java1206
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/singlepage/ProductLaunchPropertyPart.java198
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/singlepage/PropertyViewConfig.java522
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/singlepage/ScoutProjectPropertyPart.java450
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/singlepage/ServicePropertyPart.java262
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/singlepage/UnknownSinglePagePropertyViewPart.java118
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/presenter/AbstractPresenter.java186
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/presenter/multi/AbstractMultiMethodPresenter.java314
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/presenter/multi/AbstractMultiValuePresenter.java254
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/presenter/single/AbstractJavaElementListPresenter.java382
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/presenter/single/AbstractMethodPresenter.java566
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/presenter/single/AbstractProposalPresenter.java324
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/presenter/single/AbstractTypeProposalPresenter.java178
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/presenter/single/AbstractValuePresenter.java440
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/presenter/single/ProductLaunchPresenter.java934
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/presenter/util/MethodBean.java126
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/presenter/util/MethodErrorPresenterContent.java434
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/viewer/ScoutBundleLableProvider.java98
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/AbstractScoutWizardPage.java456
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/AbstractWizard.java230
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/AbstractWorkspaceWizard.java270
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/AbstractWorkspaceWizardPage.java440
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/BundleTreeWizardPage.java444
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/IStatusProvider.java48
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/IWizardPageContainer.java38
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/ScoutWizardDialog.java208
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/beanproperty/BeanPropertyNewWizard.java82
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/beanproperty/BeanPropertyNewWizardPage.java476
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/beanproperty/SharedContextBeanPropertyNewWizard.java144
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/bundle/BundleImportWizard.java52
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/bundle/BundleImportWizardPage.java280
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/code/CodeNewWizard.java92
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/code/CodeNewWizardPage.java820
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/code/type/CodeTypeNewWizard.java64
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/code/type/CodeTypeNewWizardPage.java720
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/export/IExportScoutProjectWizard.java40
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/export/IExportScoutProjectWizardPage.java20
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/FormNewWizard.java1058
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/FormNewWizardPage.java726
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/SearchFormNewWizard.java590
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/SearchFormNewWizardPage.java650
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/EmptyTemplate.java62
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/FormFieldNewWizard.java90
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/FormFieldSelectionWizardPage.java586
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/bigdecimalfield/BigdecimalFieldNewWizard.java92
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/bigdecimalfield/BigdecimalFieldNewWizardPage.java492
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/booleanfield/BooleanFieldNewWizard.java92
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/booleanfield/BooleanFieldNewWizardPage.java490
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/buttonfield/ButtonFieldNewWizard.java106
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/buttonfield/ButtonFieldNewWizardPage.java538
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/buttonfield/CancelButtonNewWizard.java80
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/buttonfield/OkButtonNewWizard.java80
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/calendarfield/CalendarFieldNewWizard.java92
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/calendarfield/CalendarFieldNewWizardPage.java490
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/calendarfield/itemprovider/CalendarItemProviderNewWizard.java94
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/calendarfield/itemprovider/CalendarItemProviderNewWizardPage.java484
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/checkbox/CheckboxFieldNewWizard.java92
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/checkbox/CheckboxFieldNewWizardPage.java498
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/composerfield/ComposerFieldNewWizard.java92
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/composerfield/ComposerFieldNewWizardPage.java490
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/composerfield/attribute/AttributeNewWizard.java98
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/composerfield/attribute/AttributeNewWizardPage.java538
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/composerfield/entity/EntityNewWizard.java100
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/composerfield/entity/EntityNewWizardPage.java526
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/datefield/DateFieldNewWizard.java92
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/datefield/DateFieldNewWizardPage.java492
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/doublefield/DoubleFieldNewWizard.java92
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/doublefield/DoubleFieldNewWizardPage.java490
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/filechooserfield/FileChooserFieldNewWizard.java92
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/filechooserfield/FileChooserFieldNewWizardPage.java494
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/formfield/DefaultFormFieldNewWizard.java82
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/formfield/DefaultFormFieldNewWizardPage.java674
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/groupbox/GroupBoxNewWizard.java92
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/groupbox/GroupBoxNewWizardPage.java492
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/htmlfield/HtmlFieldNewWizard.java92
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/htmlfield/HtmlFieldNewWizardPage.java492
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/imagefield/ImageFieldNewWizard.java92
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/imagefield/ImageFieldNewWizardPage.java492
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/integerfield/IntegerFieldNewWizard.java92
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/integerfield/IntegerFieldNewWizardPage.java492
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/labelfield/LabelFieldNewWizard.java92
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/labelfield/LabelFieldNewWizardPage.java492
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/listbox/ListBoxFieldNewWizard.java92
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/listbox/ListBoxFieldNewWizardPage.java688
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/longfield/LongFieldNewWizard.java92
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/longfield/LongFieldNewWizardPage.java492
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/mailfield/MailFieldNewWizard.java92
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/mailfield/MailFieldNewWizardPage.java496
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/matrixfield/MatrixFieldNewWizard.java92
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/matrixfield/MatrixFieldNewWizardPage.java490
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/plannerfield/PlannerFieldNewWizard.java92
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/plannerfield/PlannerFieldNewWizardPage.java490
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/radiobutton/RadioButtonNewWizard.java90
128 files changed, 19683 insertions, 19683 deletions
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/util/UiUtility.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/util/UiUtility.java
index 27ad02654..30ed7ce5d 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/util/UiUtility.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/util/UiUtility.java
@@ -1,72 +1,72 @@
-/*******************************************************************************
- * 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.util;
-
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.internal.ui.javaeditor.EditorUtility;
-import org.eclipse.jdt.ui.JavaUI;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.scout.commons.CompareUtility;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.texteditor.ITextEditor;
-
-/**
- * <h3>{@link UiUtility}</h3> ...
- *
- * @author Andreas Hoegger
- * @since 1.0.8 07.03.2011
- */
-@SuppressWarnings("restriction")
-public class UiUtility {
- public static void showJavaElementInEditor(IJavaElement e, boolean createNew) {
- try {
- IEditorPart editor = null;
- if (createNew) {
- editor = JavaUI.openInEditor(e);
- }
- else {
- editor = EditorUtility.isOpenInEditor(e);
- if (editor != null) {
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().activate(editor);
- }
- }
- if (editor != null) {
- JavaUI.revealInEditor(editor, e);
- if (editor instanceof ITextEditor) {
- ITextEditor textEditor = (ITextEditor) editor;
- IRegion reg = textEditor.getHighlightRange();
- if (reg != null) {
- textEditor.setHighlightRange(reg.getOffset(), reg.getLength(), true);
- }
- }
- }
- }
- catch (Exception ex) {
- ScoutSdkUi.logWarning(ex);
- }
- }
-
- public static <T> boolean equals(T a, T b) {
- if (a instanceof String) {
- if (((String) a).equalsIgnoreCase("null")) {
- a = null;
- }
- }
- if (b instanceof String) {
- if (((String) b).equalsIgnoreCase("null")) {
- b = null;
- }
- }
- return CompareUtility.equals(a, b);
- }
-}
+/*******************************************************************************
+ * 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.util;
+
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.internal.ui.javaeditor.EditorUtility;
+import org.eclipse.jdt.ui.JavaUI;
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.scout.commons.CompareUtility;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.texteditor.ITextEditor;
+
+/**
+ * <h3>{@link UiUtility}</h3> ...
+ *
+ * @author Andreas Hoegger
+ * @since 1.0.8 07.03.2011
+ */
+@SuppressWarnings("restriction")
+public class UiUtility {
+ public static void showJavaElementInEditor(IJavaElement e, boolean createNew) {
+ try {
+ IEditorPart editor = null;
+ if (createNew) {
+ editor = JavaUI.openInEditor(e);
+ }
+ else {
+ editor = EditorUtility.isOpenInEditor(e);
+ if (editor != null) {
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().activate(editor);
+ }
+ }
+ if (editor != null) {
+ JavaUI.revealInEditor(editor, e);
+ if (editor instanceof ITextEditor) {
+ ITextEditor textEditor = (ITextEditor) editor;
+ IRegion reg = textEditor.getHighlightRange();
+ if (reg != null) {
+ textEditor.setHighlightRange(reg.getOffset(), reg.getLength(), true);
+ }
+ }
+ }
+ }
+ catch (Exception ex) {
+ ScoutSdkUi.logWarning(ex);
+ }
+ }
+
+ public static <T> boolean equals(T a, T b) {
+ if (a instanceof String) {
+ if (((String) a).equalsIgnoreCase("null")) {
+ a = null;
+ }
+ }
+ if (b instanceof String) {
+ if (((String) b).equalsIgnoreCase("null")) {
+ b = null;
+ }
+ }
+ return CompareUtility.equals(a, b);
+ }
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/IScoutExplorerPart.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/IScoutExplorerPart.java
index 540f97228..7f32a00ab 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/IScoutExplorerPart.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/IScoutExplorerPart.java
@@ -1,47 +1,47 @@
-/*******************************************************************************
- * 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.view.outline;
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
-
-/**
- * <h3>IScoutExplorerPart</h3> ...
- */
-public interface IScoutExplorerPart {
-
- /**
- * gets the current selection of the scout explorer tree.
- *
- * @return The structured selection of the tree.
- */
- IStructuredSelection getSelection();
-
- /**
- * sets the new selection of the scout explorer tree.
- *
- * @param selection
- * the new selection containing the {@link IPage} instances that should be selected.
- */
- void setSelection(IStructuredSelection selection);
-
- /**
- * expands the scout explorer tree to project level and sets the selection to the first project in the tree.
- */
- void expandAndSelectProjectLevel();
-
- /**
- * gets the (invisible) root page. this page contains the project nodes.
- *
- * @return the invisible root page.
- */
- IPage getRootPage();
-}
+/*******************************************************************************
+ * 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.view.outline;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
+
+/**
+ * <h3>IScoutExplorerPart</h3> ...
+ */
+public interface IScoutExplorerPart {
+
+ /**
+ * gets the current selection of the scout explorer tree.
+ *
+ * @return The structured selection of the tree.
+ */
+ IStructuredSelection getSelection();
+
+ /**
+ * sets the new selection of the scout explorer tree.
+ *
+ * @param selection
+ * the new selection containing the {@link IPage} instances that should be selected.
+ */
+ void setSelection(IStructuredSelection selection);
+
+ /**
+ * expands the scout explorer tree to project level and sets the selection to the first project in the tree.
+ */
+ void expandAndSelectProjectLevel();
+
+ /**
+ * gets the (invisible) root page. this page contains the project nodes.
+ *
+ * @return the invisible root page.
+ */
+ IPage getRootPage();
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/OutlineCopySourceEvent.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/OutlineCopySourceEvent.java
index 32e8874c4..80f7e896d 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/OutlineCopySourceEvent.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/OutlineCopySourceEvent.java
@@ -1,36 +1,36 @@
-/*******************************************************************************
- * 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.view.outline;
-
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.scout.sdk.ui.view.outline.pages.AbstractPage;
-import org.eclipse.swt.events.TypedEvent;
-
-public class OutlineCopySourceEvent extends TypedEvent {
-
- private static final long serialVersionUID = 1L;
-
- private AbstractPage m_page;
-
- public OutlineCopySourceEvent(TreeViewer viewer) {
- super(viewer);
- widget = viewer.getControl();
- display = viewer.getControl().getDisplay();
- }
-
- public AbstractPage getPage() {
- return m_page;
- }
-
- public void setPage(AbstractPage page) {
- m_page = page;
- }
-}
+/*******************************************************************************
+ * 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.view.outline;
+
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.scout.sdk.ui.view.outline.pages.AbstractPage;
+import org.eclipse.swt.events.TypedEvent;
+
+public class OutlineCopySourceEvent extends TypedEvent {
+
+ private static final long serialVersionUID = 1L;
+
+ private AbstractPage m_page;
+
+ public OutlineCopySourceEvent(TreeViewer viewer) {
+ super(viewer);
+ widget = viewer.getControl();
+ display = viewer.getControl().getDisplay();
+ }
+
+ public AbstractPage getPage() {
+ return m_page;
+ }
+
+ public void setPage(AbstractPage page) {
+ m_page = page;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/OutlineDropTargetEvent.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/OutlineDropTargetEvent.java
index a57f3ee85..18e789018 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/OutlineDropTargetEvent.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/OutlineDropTargetEvent.java
@@ -1,74 +1,74 @@
-/*******************************************************************************
- * 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.view.outline;
-
-import org.eclipse.swt.dnd.TransferData;
-import org.eclipse.swt.widgets.Event;
-
-public class OutlineDropTargetEvent extends Event {
- private TransferData m_transferData;
- private Object m_transferObject;
- private Object m_selectedObject;
- private Object m_currentTarget;
- private int m_currentLocation;
- private int m_operation;
-
- public OutlineDropTargetEvent() {
- }
-
- public void setSelectedObject(Object selectedObject) {
- m_selectedObject = selectedObject;
- }
-
- public Object getSelectedObject() {
- return m_selectedObject;
- }
-
- public void setCurrentTarget(Object currentTarget) {
- m_currentTarget = currentTarget;
- }
-
- public Object getCurrentTarget() {
- return m_currentTarget;
- }
-
- public void setCurrentLocation(int currentLocation) {
- m_currentLocation = currentLocation;
- }
-
- public int getCurrentLocation() {
- return m_currentLocation;
- }
-
- public void setOperation(int operation) {
- m_operation = operation;
- }
-
- public int getOperation() {
- return m_operation;
- }
-
- public TransferData getTransferData() {
- return m_transferData;
- }
-
- public void setTransferData(TransferData transferData) {
- m_transferData = transferData;
- }
-
- public Object getTransferObject() {
- return m_transferObject;
- }
-
- public void setTransferObject(Object transferObject) {
- m_transferObject = transferObject;
- }
-}
+/*******************************************************************************
+ * 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.view.outline;
+
+import org.eclipse.swt.dnd.TransferData;
+import org.eclipse.swt.widgets.Event;
+
+public class OutlineDropTargetEvent extends Event {
+ private TransferData m_transferData;
+ private Object m_transferObject;
+ private Object m_selectedObject;
+ private Object m_currentTarget;
+ private int m_currentLocation;
+ private int m_operation;
+
+ public OutlineDropTargetEvent() {
+ }
+
+ public void setSelectedObject(Object selectedObject) {
+ m_selectedObject = selectedObject;
+ }
+
+ public Object getSelectedObject() {
+ return m_selectedObject;
+ }
+
+ public void setCurrentTarget(Object currentTarget) {
+ m_currentTarget = currentTarget;
+ }
+
+ public Object getCurrentTarget() {
+ return m_currentTarget;
+ }
+
+ public void setCurrentLocation(int currentLocation) {
+ m_currentLocation = currentLocation;
+ }
+
+ public int getCurrentLocation() {
+ return m_currentLocation;
+ }
+
+ public void setOperation(int operation) {
+ m_operation = operation;
+ }
+
+ public int getOperation() {
+ return m_operation;
+ }
+
+ public TransferData getTransferData() {
+ return m_transferData;
+ }
+
+ public void setTransferData(TransferData transferData) {
+ m_transferData = transferData;
+ }
+
+ public Object getTransferObject() {
+ return m_transferObject;
+ }
+
+ public void setTransferObject(Object transferObject) {
+ m_transferObject = transferObject;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/OutlinePasteTargetEvent.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/OutlinePasteTargetEvent.java
index 6269dab54..f94a31175 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/OutlinePasteTargetEvent.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/OutlinePasteTargetEvent.java
@@ -1,47 +1,47 @@
-/*******************************************************************************
- * 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.view.outline;
-
-import java.awt.datatransfer.Transferable;
-
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.scout.sdk.ui.view.outline.pages.AbstractPage;
-import org.eclipse.swt.events.TypedEvent;
-
-public class OutlinePasteTargetEvent extends TypedEvent {
-
- private static final long serialVersionUID = 1L;
-
- private Transferable m_transferData;
- private AbstractPage m_page;
-
- public OutlinePasteTargetEvent(TreeViewer viewer) {
- super(viewer);
- widget = viewer.getControl();
- display = viewer.getControl().getDisplay();
- }
-
- public Transferable getTransferData() {
- return m_transferData;
- }
-
- public void setTransferData(Transferable transferData) {
- m_transferData = transferData;
- }
-
- public AbstractPage getPage() {
- return m_page;
- }
-
- public void setPage(AbstractPage page) {
- m_page = page;
- }
-}
+/*******************************************************************************
+ * 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.view.outline;
+
+import java.awt.datatransfer.Transferable;
+
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.scout.sdk.ui.view.outline.pages.AbstractPage;
+import org.eclipse.swt.events.TypedEvent;
+
+public class OutlinePasteTargetEvent extends TypedEvent {
+
+ private static final long serialVersionUID = 1L;
+
+ private Transferable m_transferData;
+ private AbstractPage m_page;
+
+ public OutlinePasteTargetEvent(TreeViewer viewer) {
+ super(viewer);
+ widget = viewer.getControl();
+ display = viewer.getControl().getDisplay();
+ }
+
+ public Transferable getTransferData() {
+ return m_transferData;
+ }
+
+ public void setTransferData(Transferable transferData) {
+ m_transferData = transferData;
+ }
+
+ public AbstractPage getPage() {
+ return m_page;
+ }
+
+ public void setPage(AbstractPage page) {
+ m_page = page;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/AbstractPage.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/AbstractPage.java
index b559c00f4..d85f3c965 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/AbstractPage.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/AbstractPage.java
@@ -1,364 +1,364 @@
-/*******************************************************************************
- * 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.view.outline.pages;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.TreeMap;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.jdt.ui.JavaElementImageDescriptor;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.scout.commons.CompositeObject;
-import org.eclipse.scout.sdk.ui.action.IScoutHandler;
-import org.eclipse.scout.sdk.ui.extensions.IPageFactory;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.internal.extensions.ExplorerPageExtensionPoint;
-import org.eclipse.scout.sdk.ui.internal.extensions.ExplorerPageExtensionPoint.ExplorerPageExtension;
-import org.eclipse.scout.sdk.ui.internal.view.outline.ScoutExplorerPart;
-import org.eclipse.scout.sdk.ui.menu.IContextMenuProvider;
-import org.eclipse.scout.sdk.workspace.IScoutElement;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-
-/**
- * Tree Node with editor adapter of type ICfgAdapter
- */
-public abstract class AbstractPage implements IPage, IContextMenuProvider {
-
- private String m_name;
- private Map<CompositeObject, IPage> m_children;
- private IPage m_parent;
- private boolean m_recursive;
- private boolean m_childrenLoaded;
- private PageDirtyListener m_pageDirtyListener;
- private ImageDescriptor m_imageDesc;
-
- public AbstractPage() {
- m_pageDirtyListener = new PageDirtyListener(this);
- m_children = new TreeMap<CompositeObject, IPage>();
- }
-
- @Override
- public int getOrder() {
- return -1;
- }
-
- @Override
- public void setParent(IPage parent) {
- m_parent = parent;
- if (m_parent != null) {
- m_parent.addChild(this);
- }
- }
-
- @Override
- public IPage getParent() {
- return m_parent;
- }
-
- @Override
- public IScoutElement getScoutResource() {
- if (getParent() != null) return getParent().getScoutResource();
- else return null;
- }
-
- @Override
- public ScoutExplorerPart getOutlineView() {
- IPage parent = getParent();
- if (parent != null) return parent.getOutlineView();
- else return null;
- }
-
- @Override
- public String getName() {
-
- return m_name;
- }
-
- public void setName(String s) {
- m_name = s;
- }
-
- @Override
- public boolean isChildrenLoaded() {
- return m_childrenLoaded;
- }
-
- @Override
- public boolean isInitiallyLoaded() {
- return false;
- }
-
- @Override
- public void markStructureDirty() {
- ScoutExplorerPart o = getOutlineView();
- if (o != null) {
- o.markStructureDirty(this);
- }
- }
-
- public String getDecoratedName() {
- return getName() + (m_recursive ? (" (R)") : (""));
- }
-
- @Override
- public void addChild(IPage child) {
- if (child == null) throw new IllegalArgumentException("adding null child to " + getName());
- synchronized (m_children) {
- m_children.put(new CompositeObject(child.getOrder(), m_children.size(), child), child);
- }
- }
-
- @Override
- public boolean removeChild(IPage childPage) {
- if (childPage == null) throw new IllegalArgumentException("remove null child to " + getName());
- childPage.setParent(null);
- synchronized (m_children) {
- for (Iterator<Entry<CompositeObject, IPage>> it = m_children.entrySet().iterator(); it.hasNext();) {
- Entry<CompositeObject, IPage> entry = it.next();
- if (childPage.equals(entry.getValue())) {
- it.remove();
- return true;
- }
- }
- }
- return false;
- }
-
- @Override
- public IPage[] getChildArray() {
- return getChildArray(null);
- }
-
- @Override
- public IPage[] getChildArray(IPageFilter filter) {
- ArrayList<IPage> children = new ArrayList<IPage>();
- synchronized (m_children) {
- for (IPage p : m_children.values()) {
- if (filter == null || filter.accept(p)) {
- children.add(p);
- }
- }
- }
- return children.toArray(new IPage[children.size()]);
- }
-
- @Override
- public List<IPage> getChildren() {
- synchronized (m_children) {
- return Collections.unmodifiableList(new ArrayList<IPage>(m_children.values()));
- }
- }
-
- @Override
- public boolean hasChildren() {
- synchronized (m_children) {
- return m_children.size() > 0;
- }
- }
-
- @Override
- public void unloadPage() {
- }
-
- @Override
- public final void unloadChildren() {
- synchronized (m_children) {
- for (IPage page : m_children.values()) {
- page.setParent(null);
- page.unloadChildren();
- page.unloadPage();
- }
- m_children.clear();
- m_childrenLoaded = false;
- }
- }
-
- @Override
- public void refresh(boolean clearCache) {
- ScoutExplorerPart outlineView = getOutlineView();
- if (outlineView != null) {
- outlineView.markStructureDirty(this);
- }
- }
-
- @Override
- public String toString() {
- return getDecoratedName();
- }
-
- @Override
- public final synchronized void loadChildren() {
- if (!isChildrenLoaded()) {
- try {
- loadChildrenImpl();
- // extension point
- ExplorerPageExtension[] extensions = ExplorerPageExtensionPoint.getExtensions(this);
- if (extensions != null) {
- for (ExplorerPageExtension ext : extensions) {
- if (ext.getFactoryClass() != null) {
- IPageFactory factory = ext.createFactoryClass();
- factory.createChildren(this);
- }
- else if (ext.getPageClass() != null) {
- IPage childPage = ext.createPageInstance();
- childPage.setParent(this);
- }
- }
- }
- }
- finally {
- // crucial to mark children as loaded to prevent an infinite loop
- m_childrenLoaded = true;
- }
- }
- }
-
- protected void loadChildrenImpl() {
- }
-
- /**
- * called when filter has changed
- */
- public void refreshFilteredChildren() {
- ScoutExplorerPart o = getOutlineView();
- if (o != null) {
- o.markFilterChanged(this);
- }
- }
-
- public final PageDirtyListener getPageDirtyListener() {
- return m_pageDirtyListener;
- }
-
- @Override
- public void setImageDescriptor(ImageDescriptor desc) {
- m_imageDesc = desc;
- }
-
- public ImageDescriptor getBaseImageDescriptor() {
- if (m_imageDesc == null) {
- if (isFolder()) {
- m_imageDesc = ScoutSdkUi.getImageDescriptor(ScoutSdkUi.FolderOpen);
- }
- else {
- m_imageDesc = ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Default);
- }
- }
- return m_imageDesc;
- }
-
- public final Image getImage() {
- ImageDescriptor baseDesc = getBaseImageDescriptor();
- int flags = 0;
- Point size = new Point(16, 16);
- int quality = getQuality();
- switch (quality) {
- case IMarker.SEVERITY_ERROR: {
- flags = flags | JavaElementImageDescriptor.ERROR;
- break;
- }
- case IMarker.SEVERITY_WARNING: {
- flags = flags | JavaElementImageDescriptor.WARNING;
- break;
- }
- }
- JavaElementImageDescriptor desc = new JavaElementImageDescriptor(baseDesc, flags, size);
- return ScoutSdkUi.getImage(desc);
- }
-
- @Override
- public int getQuality() {
- if (hasChildren()) {
- IPage[] a = getChildArray();
- int q = IMarker.SEVERITY_INFO;
- for (int i = 0; i < a.length; i++) {
- q = Math.max(q, a[i].getQuality());
- if (q == IMarker.SEVERITY_ERROR) {
- break;
- }
- }
- return q;
- }
- else {
- return IMarker.SEVERITY_INFO;
- }
- }
-
- /**
- * to handle the node selection
- */
- public void handleSelectionDelegate() {
- }
-
- /**
- * to handle the node double click
- *
- * @return consumed if the expansion should be prevented
- */
- public boolean handleDoubleClickedDelegate() {
- return false;
- }
-
- @Override
- public boolean isFolder() {
- return false;
- }
-
- @Override
- public int accept(INodeVisitor visitor) {
- switch (visitor.visit(this)) {
- case INodeVisitor.CANCEL:
- return INodeVisitor.CANCEL;
- case INodeVisitor.CANCEL_SUBTREE:
- return INodeVisitor.CONTINUE;
- case INodeVisitor.CONTINUE_BRANCH:
- visitChildren(visitor);
- return INodeVisitor.CANCEL;
- default:
- return visitChildren(visitor);
- }
- }
-
- protected int visitChildren(INodeVisitor visitor) {
- if (!isChildrenLoaded()) {
- loadChildren();
- }
- for (IPage childPage : getChildren()) {
- switch (childPage.accept(visitor)) {
- case INodeVisitor.CANCEL:
- return INodeVisitor.CANCEL;
- }
- }
- return INodeVisitor.CONTINUE;
- }
-
- @Override
- public Class<? extends IScoutHandler>[] getSupportedMenuActions() {
- return null;
- }
-
- @Override
- public void prepareMenuAction(IScoutHandler menu) {
- }
-
- /**
- * @param debugActions
- */
- public void addDebugMenus(List<Action> debugActions) {
- }
-}
+/*******************************************************************************
+ * 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.view.outline.pages;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.TreeMap;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.jdt.ui.JavaElementImageDescriptor;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.scout.commons.CompositeObject;
+import org.eclipse.scout.sdk.ui.action.IScoutHandler;
+import org.eclipse.scout.sdk.ui.extensions.IPageFactory;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.internal.extensions.ExplorerPageExtensionPoint;
+import org.eclipse.scout.sdk.ui.internal.extensions.ExplorerPageExtensionPoint.ExplorerPageExtension;
+import org.eclipse.scout.sdk.ui.internal.view.outline.ScoutExplorerPart;
+import org.eclipse.scout.sdk.ui.menu.IContextMenuProvider;
+import org.eclipse.scout.sdk.workspace.IScoutElement;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+
+/**
+ * Tree Node with editor adapter of type ICfgAdapter
+ */
+public abstract class AbstractPage implements IPage, IContextMenuProvider {
+
+ private String m_name;
+ private Map<CompositeObject, IPage> m_children;
+ private IPage m_parent;
+ private boolean m_recursive;
+ private boolean m_childrenLoaded;
+ private PageDirtyListener m_pageDirtyListener;
+ private ImageDescriptor m_imageDesc;
+
+ public AbstractPage() {
+ m_pageDirtyListener = new PageDirtyListener(this);
+ m_children = new TreeMap<CompositeObject, IPage>();
+ }
+
+ @Override
+ public int getOrder() {
+ return -1;
+ }
+
+ @Override
+ public void setParent(IPage parent) {
+ m_parent = parent;
+ if (m_parent != null) {
+ m_parent.addChild(this);
+ }
+ }
+
+ @Override
+ public IPage getParent() {
+ return m_parent;
+ }
+
+ @Override
+ public IScoutElement getScoutResource() {
+ if (getParent() != null) return getParent().getScoutResource();
+ else return null;
+ }
+
+ @Override
+ public ScoutExplorerPart getOutlineView() {
+ IPage parent = getParent();
+ if (parent != null) return parent.getOutlineView();
+ else return null;
+ }
+
+ @Override
+ public String getName() {
+
+ return m_name;
+ }
+
+ public void setName(String s) {
+ m_name = s;
+ }
+
+ @Override
+ public boolean isChildrenLoaded() {
+ return m_childrenLoaded;
+ }
+
+ @Override
+ public boolean isInitiallyLoaded() {
+ return false;
+ }
+
+ @Override
+ public void markStructureDirty() {
+ ScoutExplorerPart o = getOutlineView();
+ if (o != null) {
+ o.markStructureDirty(this);
+ }
+ }
+
+ public String getDecoratedName() {
+ return getName() + (m_recursive ? (" (R)") : (""));
+ }
+
+ @Override
+ public void addChild(IPage child) {
+ if (child == null) throw new IllegalArgumentException("adding null child to " + getName());
+ synchronized (m_children) {
+ m_children.put(new CompositeObject(child.getOrder(), m_children.size(), child), child);
+ }
+ }
+
+ @Override
+ public boolean removeChild(IPage childPage) {
+ if (childPage == null) throw new IllegalArgumentException("remove null child to " + getName());
+ childPage.setParent(null);
+ synchronized (m_children) {
+ for (Iterator<Entry<CompositeObject, IPage>> it = m_children.entrySet().iterator(); it.hasNext();) {
+ Entry<CompositeObject, IPage> entry = it.next();
+ if (childPage.equals(entry.getValue())) {
+ it.remove();
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public IPage[] getChildArray() {
+ return getChildArray(null);
+ }
+
+ @Override
+ public IPage[] getChildArray(IPageFilter filter) {
+ ArrayList<IPage> children = new ArrayList<IPage>();
+ synchronized (m_children) {
+ for (IPage p : m_children.values()) {
+ if (filter == null || filter.accept(p)) {
+ children.add(p);
+ }
+ }
+ }
+ return children.toArray(new IPage[children.size()]);
+ }
+
+ @Override
+ public List<IPage> getChildren() {
+ synchronized (m_children) {
+ return Collections.unmodifiableList(new ArrayList<IPage>(m_children.values()));
+ }
+ }
+
+ @Override
+ public boolean hasChildren() {
+ synchronized (m_children) {
+ return m_children.size() > 0;
+ }
+ }
+
+ @Override
+ public void unloadPage() {
+ }
+
+ @Override
+ public final void unloadChildren() {
+ synchronized (m_children) {
+ for (IPage page : m_children.values()) {
+ page.setParent(null);
+ page.unloadChildren();
+ page.unloadPage();
+ }
+ m_children.clear();
+ m_childrenLoaded = false;
+ }
+ }
+
+ @Override
+ public void refresh(boolean clearCache) {
+ ScoutExplorerPart outlineView = getOutlineView();
+ if (outlineView != null) {
+ outlineView.markStructureDirty(this);
+ }
+ }
+
+ @Override
+ public String toString() {
+ return getDecoratedName();
+ }
+
+ @Override
+ public final synchronized void loadChildren() {
+ if (!isChildrenLoaded()) {
+ try {
+ loadChildrenImpl();
+ // extension point
+ ExplorerPageExtension[] extensions = ExplorerPageExtensionPoint.getExtensions(this);
+ if (extensions != null) {
+ for (ExplorerPageExtension ext : extensions) {
+ if (ext.getFactoryClass() != null) {
+ IPageFactory factory = ext.createFactoryClass();
+ factory.createChildren(this);
+ }
+ else if (ext.getPageClass() != null) {
+ IPage childPage = ext.createPageInstance();
+ childPage.setParent(this);
+ }
+ }
+ }
+ }
+ finally {
+ // crucial to mark children as loaded to prevent an infinite loop
+ m_childrenLoaded = true;
+ }
+ }
+ }
+
+ protected void loadChildrenImpl() {
+ }
+
+ /**
+ * called when filter has changed
+ */
+ public void refreshFilteredChildren() {
+ ScoutExplorerPart o = getOutlineView();
+ if (o != null) {
+ o.markFilterChanged(this);
+ }
+ }
+
+ public final PageDirtyListener getPageDirtyListener() {
+ return m_pageDirtyListener;
+ }
+
+ @Override
+ public void setImageDescriptor(ImageDescriptor desc) {
+ m_imageDesc = desc;
+ }
+
+ public ImageDescriptor getBaseImageDescriptor() {
+ if (m_imageDesc == null) {
+ if (isFolder()) {
+ m_imageDesc = ScoutSdkUi.getImageDescriptor(ScoutSdkUi.FolderOpen);
+ }
+ else {
+ m_imageDesc = ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Default);
+ }
+ }
+ return m_imageDesc;
+ }
+
+ public final Image getImage() {
+ ImageDescriptor baseDesc = getBaseImageDescriptor();
+ int flags = 0;
+ Point size = new Point(16, 16);
+ int quality = getQuality();
+ switch (quality) {
+ case IMarker.SEVERITY_ERROR: {
+ flags = flags | JavaElementImageDescriptor.ERROR;
+ break;
+ }
+ case IMarker.SEVERITY_WARNING: {
+ flags = flags | JavaElementImageDescriptor.WARNING;
+ break;
+ }
+ }
+ JavaElementImageDescriptor desc = new JavaElementImageDescriptor(baseDesc, flags, size);
+ return ScoutSdkUi.getImage(desc);
+ }
+
+ @Override
+ public int getQuality() {
+ if (hasChildren()) {
+ IPage[] a = getChildArray();
+ int q = IMarker.SEVERITY_INFO;
+ for (int i = 0; i < a.length; i++) {
+ q = Math.max(q, a[i].getQuality());
+ if (q == IMarker.SEVERITY_ERROR) {
+ break;
+ }
+ }
+ return q;
+ }
+ else {
+ return IMarker.SEVERITY_INFO;
+ }
+ }
+
+ /**
+ * to handle the node selection
+ */
+ public void handleSelectionDelegate() {
+ }
+
+ /**
+ * to handle the node double click
+ *
+ * @return consumed if the expansion should be prevented
+ */
+ public boolean handleDoubleClickedDelegate() {
+ return false;
+ }
+
+ @Override
+ public boolean isFolder() {
+ return false;
+ }
+
+ @Override
+ public int accept(INodeVisitor visitor) {
+ switch (visitor.visit(this)) {
+ case INodeVisitor.CANCEL:
+ return INodeVisitor.CANCEL;
+ case INodeVisitor.CANCEL_SUBTREE:
+ return INodeVisitor.CONTINUE;
+ case INodeVisitor.CONTINUE_BRANCH:
+ visitChildren(visitor);
+ return INodeVisitor.CANCEL;
+ default:
+ return visitChildren(visitor);
+ }
+ }
+
+ protected int visitChildren(INodeVisitor visitor) {
+ if (!isChildrenLoaded()) {
+ loadChildren();
+ }
+ for (IPage childPage : getChildren()) {
+ switch (childPage.accept(visitor)) {
+ case INodeVisitor.CANCEL:
+ return INodeVisitor.CANCEL;
+ }
+ }
+ return INodeVisitor.CONTINUE;
+ }
+
+ @Override
+ public Class<? extends IScoutHandler>[] getSupportedMenuActions() {
+ return null;
+ }
+
+ @Override
+ public void prepareMenuAction(IScoutHandler menu) {
+ }
+
+ /**
+ * @param debugActions
+ */
+ public void addDebugMenus(List<Action> debugActions) {
+ }
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/AbstractScoutTypePage.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/AbstractScoutTypePage.java
index 6e94d4c89..f3d825637 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/AbstractScoutTypePage.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/AbstractScoutTypePage.java
@@ -1,118 +1,118 @@
-/*******************************************************************************
- * 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.view.outline.pages;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.ui.JavaUI;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.scout.commons.CompareUtility;
-import org.eclipse.scout.sdk.ui.action.IScoutHandler;
-import org.eclipse.scout.sdk.ui.action.ShowJavaReferencesAction;
-import org.eclipse.scout.sdk.ui.action.rename.TypeRenameAction;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.util.ScoutSeverityManager;
-import org.eclipse.scout.sdk.util.ScoutSourceUtility;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.texteditor.ITextEditor;
-
-public abstract class AbstractScoutTypePage extends AbstractPage implements ITypePage {
-
- private IType m_type;
- private final String m_readOnlySuffix;
-
- public AbstractScoutTypePage() {
- this(null);
- }
-
- public AbstractScoutTypePage(String readOnlySuffix) {
- m_readOnlySuffix = readOnlySuffix;
- }
-
- @Override
- public void setType(IType type) {
- m_type = type;
- String methodNameForTranslatedText = getMethodNameForTranslatedText();
- setName(ScoutSourceUtility.getTranslatedMethodStringValue(getType(), methodNameForTranslatedText));
- }
-
- @Override
- public IType getType() {
- return m_type;
- }
-
- protected String getMethodNameForTranslatedText() {
- return null;
- }
-
- @Override
- public boolean isFolder() {
- return false;
- }
-
- @Override
- public int getQuality() {
- int quality = IMarker.SEVERITY_INFO;
- if (getType().exists()) {
- quality = ScoutSeverityManager.getInstance().getSeverityOf(getType());
- }
- return quality;
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public Class<? extends IScoutHandler>[] getSupportedMenuActions() {
- return new Class[]{TypeRenameAction.class, ShowJavaReferencesAction.class};
- }
-
- @Override
- public void prepareMenuAction(IScoutHandler menu) {
- if (menu instanceof TypeRenameAction) {
- TypeRenameAction action = (TypeRenameAction) menu;
- action.setOldName(getType().getElementName());
- action.setReadOnlySuffix(m_readOnlySuffix);
- action.setType(getType());
- }
- else if (menu instanceof ShowJavaReferencesAction) {
- ((ShowJavaReferencesAction) menu).setElement(getType());
- }
- }
-
- @Override
- public boolean handleDoubleClickedDelegate() {
- try {
- IEditorPart editor = JavaUI.openInEditor(getType());
- // JavaUI.revealInEditor(editor, (IJavaElement)jdtMember);
- if (editor instanceof ITextEditor) {
- ITextEditor textEditor = (ITextEditor) editor;
- IRegion reg = textEditor.getHighlightRange();
- if (reg != null) {
- textEditor.setHighlightRange(reg.getOffset(), reg.getLength(), true);
- }
- }
- return true;
- }
- catch (Exception ex) {
- ScoutSdkUi.logWarning(ex);
- return false;
- }
- }
-
- @Override
- public boolean equals(Object obj) {
- if (!(obj instanceof AbstractScoutTypePage)) {
- return false;
- }
- AbstractScoutTypePage page = (AbstractScoutTypePage) obj;
- return getType().equals(page.getType()) && CompareUtility.equals(page.getParent(), getParent());
- }
-
-}
+/*******************************************************************************
+ * 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.view.outline.pages;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.ui.JavaUI;
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.scout.commons.CompareUtility;
+import org.eclipse.scout.sdk.ui.action.IScoutHandler;
+import org.eclipse.scout.sdk.ui.action.ShowJavaReferencesAction;
+import org.eclipse.scout.sdk.ui.action.rename.TypeRenameAction;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.util.ScoutSeverityManager;
+import org.eclipse.scout.sdk.util.ScoutSourceUtility;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.texteditor.ITextEditor;
+
+public abstract class AbstractScoutTypePage extends AbstractPage implements ITypePage {
+
+ private IType m_type;
+ private final String m_readOnlySuffix;
+
+ public AbstractScoutTypePage() {
+ this(null);
+ }
+
+ public AbstractScoutTypePage(String readOnlySuffix) {
+ m_readOnlySuffix = readOnlySuffix;
+ }
+
+ @Override
+ public void setType(IType type) {
+ m_type = type;
+ String methodNameForTranslatedText = getMethodNameForTranslatedText();
+ setName(ScoutSourceUtility.getTranslatedMethodStringValue(getType(), methodNameForTranslatedText));
+ }
+
+ @Override
+ public IType getType() {
+ return m_type;
+ }
+
+ protected String getMethodNameForTranslatedText() {
+ return null;
+ }
+
+ @Override
+ public boolean isFolder() {
+ return false;
+ }
+
+ @Override
+ public int getQuality() {
+ int quality = IMarker.SEVERITY_INFO;
+ if (getType().exists()) {
+ quality = ScoutSeverityManager.getInstance().getSeverityOf(getType());
+ }
+ return quality;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Class<? extends IScoutHandler>[] getSupportedMenuActions() {
+ return new Class[]{TypeRenameAction.class, ShowJavaReferencesAction.class};
+ }
+
+ @Override
+ public void prepareMenuAction(IScoutHandler menu) {
+ if (menu instanceof TypeRenameAction) {
+ TypeRenameAction action = (TypeRenameAction) menu;
+ action.setOldName(getType().getElementName());
+ action.setReadOnlySuffix(m_readOnlySuffix);
+ action.setType(getType());
+ }
+ else if (menu instanceof ShowJavaReferencesAction) {
+ ((ShowJavaReferencesAction) menu).setElement(getType());
+ }
+ }
+
+ @Override
+ public boolean handleDoubleClickedDelegate() {
+ try {
+ IEditorPart editor = JavaUI.openInEditor(getType());
+ // JavaUI.revealInEditor(editor, (IJavaElement)jdtMember);
+ if (editor instanceof ITextEditor) {
+ ITextEditor textEditor = (ITextEditor) editor;
+ IRegion reg = textEditor.getHighlightRange();
+ if (reg != null) {
+ textEditor.setHighlightRange(reg.getOffset(), reg.getLength(), true);
+ }
+ }
+ return true;
+ }
+ catch (Exception ex) {
+ ScoutSdkUi.logWarning(ex);
+ return false;
+ }
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (!(obj instanceof AbstractScoutTypePage)) {
+ return false;
+ }
+ AbstractScoutTypePage page = (AbstractScoutTypePage) obj;
+ return getType().equals(page.getType()) && CompareUtility.equals(page.getParent(), getParent());
+ }
+
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/INodeVisitor.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/INodeVisitor.java
index 1b89f163b..2ec2c56fa 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/INodeVisitor.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/INodeVisitor.java
@@ -1,39 +1,39 @@
-/*******************************************************************************
- * 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.view.outline.pages;
-
-/**
- * <h3>IPageVisitor</h3> The page visitor is used to visit all nodes of the Outline Tree.
- */
-public interface INodeVisitor {
- /**
- * continues visiting the tree (load children if not loaded)
- */
- public static final int CONTINUE = 1;
- /**
- * continues visiting the tree only on this branch (load children if not loaded)
- */
- public static final int CONTINUE_BRANCH = 2;
- /**
- * stop visiting the tree; used when the mission is completed.
- */
- public static final int CANCEL = 0;
- /**
- * continues visiting with siblings of the parent node, aboard subtree.
- */
- public static final int CANCEL_SUBTREE = 3;
-
- /**
- * @param page
- * @return one of {@link INodeVisitor#CONTINUE}; {@link INodeVisitor#CANCEL}; {@link INodeVisitor#CANCEL_SUBTREE}
- */
- int visit(IPage page);
-}
+/*******************************************************************************
+ * 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.view.outline.pages;
+
+/**
+ * <h3>IPageVisitor</h3> The page visitor is used to visit all nodes of the Outline Tree.
+ */
+public interface INodeVisitor {
+ /**
+ * continues visiting the tree (load children if not loaded)
+ */
+ public static final int CONTINUE = 1;
+ /**
+ * continues visiting the tree only on this branch (load children if not loaded)
+ */
+ public static final int CONTINUE_BRANCH = 2;
+ /**
+ * stop visiting the tree; used when the mission is completed.
+ */
+ public static final int CANCEL = 0;
+ /**
+ * continues visiting with siblings of the parent node, aboard subtree.
+ */
+ public static final int CANCEL_SUBTREE = 3;
+
+ /**
+ * @param page
+ * @return one of {@link INodeVisitor#CONTINUE}; {@link INodeVisitor#CANCEL}; {@link INodeVisitor#CANCEL_SUBTREE}
+ */
+ int visit(IPage page);
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/IPage.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/IPage.java
index 296ec0b53..4911ff193 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/IPage.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/IPage.java
@@ -1,80 +1,80 @@
-/*******************************************************************************
- * 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.view.outline.pages;
-
-import java.util.List;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.scout.sdk.ui.internal.view.outline.ScoutExplorerPart;
-import org.eclipse.scout.sdk.workspace.IScoutElement;
-
-public interface IPage {
-
- /**
- * @return a unique identifier of the page usually the fully qualified class name
- */
- String getPageId();
-
- String getName();
-
- void setImageDescriptor(ImageDescriptor descriptor);
-
- void setParent(IPage parent);
-
- IPage getParent();
-
- int getOrder();
-
- IScoutElement getScoutResource();
-
- ScoutExplorerPart getOutlineView();
-
- void addChild(IPage childPage);
-
- boolean removeChild(IPage childPage);
-
- void unloadChildren();
-
- IPage[] getChildArray();
-
- IPage[] getChildArray(IPageFilter filter);
-
- List<IPage> getChildren();
-
- boolean hasChildren();
-
- boolean isChildrenLoaded();
-
- boolean isInitiallyLoaded();
-
- void loadChildren();
-
- void refresh(boolean clearCache);
-
- /**
- * @return one of the {@link IMarker#SEVERITY_*} constants
- */
- int getQuality();
-
- int accept(INodeVisitor visitor);
-
- void markStructureDirty();
-
- /**
- * can be overridden to remove listeners and to some clean up stuff.
- */
- void unloadPage();
-
- /**
- * @return
- */
- boolean isFolder();
-}
+/*******************************************************************************
+ * 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.view.outline.pages;
+
+import java.util.List;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.scout.sdk.ui.internal.view.outline.ScoutExplorerPart;
+import org.eclipse.scout.sdk.workspace.IScoutElement;
+
+public interface IPage {
+
+ /**
+ * @return a unique identifier of the page usually the fully qualified class name
+ */
+ String getPageId();
+
+ String getName();
+
+ void setImageDescriptor(ImageDescriptor descriptor);
+
+ void setParent(IPage parent);
+
+ IPage getParent();
+
+ int getOrder();
+
+ IScoutElement getScoutResource();
+
+ ScoutExplorerPart getOutlineView();
+
+ void addChild(IPage childPage);
+
+ boolean removeChild(IPage childPage);
+
+ void unloadChildren();
+
+ IPage[] getChildArray();
+
+ IPage[] getChildArray(IPageFilter filter);
+
+ List<IPage> getChildren();
+
+ boolean hasChildren();
+
+ boolean isChildrenLoaded();
+
+ boolean isInitiallyLoaded();
+
+ void loadChildren();
+
+ void refresh(boolean clearCache);
+
+ /**
+ * @return one of the {@link IMarker#SEVERITY_*} constants
+ */
+ int getQuality();
+
+ int accept(INodeVisitor visitor);
+
+ void markStructureDirty();
+
+ /**
+ * can be overridden to remove listeners and to some clean up stuff.
+ */
+ void unloadPage();
+
+ /**
+ * @return
+ */
+ boolean isFolder();
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/IPageFilter.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/IPageFilter.java
index d27555bab..f59d8074f 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/IPageFilter.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/IPageFilter.java
@@ -1,25 +1,25 @@
-/*******************************************************************************
- * 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.view.outline.pages;
-
-/**
- * <h3>IPageFilter</h3> ...
- *
- * @author Andreas Hoegger
- * @since 1.0.8 23.07.2010
- */
-public interface IPageFilter {
- boolean isEmpty();
-
- boolean accept(IPage page);
-
- String getFilterExpression();
-}
+/*******************************************************************************
+ * 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.view.outline.pages;
+
+/**
+ * <h3>IPageFilter</h3> ...
+ *
+ * @author Andreas Hoegger
+ * @since 1.0.8 23.07.2010
+ */
+public interface IPageFilter {
+ boolean isEmpty();
+
+ boolean accept(IPage page);
+
+ String getFilterExpression();
+}
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 704f03a01..7cdb09411 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
@@ -1,139 +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.ui.view.outline.pages;
-
-/**
- * <h3>IScoutPageConstants</h3> ...
- */
-public abstract interface IScoutPageConstants {
- public static final String ALL_PAGES_TABLE_PAGE = "org.eclipse.scout.sdk.page.AllPagesTablePage";
- public static final String BEAN_PROPERTY_NODE_PAGE = "org.eclipse.scout.sdk.page.BeanPropertyNodePage";
- public static final String BEAN_PROPERTY_TABLE_PAGE = "org.eclipse.scout.sdk.page.BeanPropertyTablePage";
- public static final String BIG_DECIMAL_FIELD_NODE_PAGE = "org.eclipse.scout.sdk.page.BigDecimalFieldNodePage";
- public static final String BOOKMARK_STORAGE_SERVICE_NODE_PAGE = "org.eclipse.scout.sdk.page.BookmarkStorageServiceNodePage";
- public static final String BOOKMARK_STORAGE_SERVICE_TABLE_PAGE = "org.eclipse.scout.sdk.page.BookmarkStorageServiceTablePage";
- public static final String BOOLEAN_FIELD_NODE_PAGE = "org.eclipse.scout.sdk.page.BooleanFieldNodePage";
- public static final String BUTTON_NODE_PAGE = "org.eclipse.scout.sdk.page.ButtonNodePage";
- public static final String CALENDAR_FIELD_NODE_PAGE = "org.eclipse.scout.sdk.page.CalendarFieldNodePage";
- public static final String CALENDAR_ITEM_PROVIDER_NODE_PAGE = "org.eclipse.scout.sdk.page.CalendarItemProviderNodePage";
- public static final String CALENDAR_ITEM_PROVIDER_TABLE_PAGE = "org.eclipse.scout.sdk.page.CalendarItemProviderTablePage";
- public static final String CALENDAR_NODE_PAGE = "org.eclipse.scout.sdk.page.CalendarNodePage";
- public static final String CALENDAR_SERVICE_NODE_PAGE = "org.eclipse.scout.sdk.page.CalendarServiceNodePage";
- public static final String CALENDAR_SERVICE_TABLE_PAGE = "org.eclipse.scout.sdk.page.CalendarServiceTablePage";
- public static final String CHECK_BOX_NODE_PAGE = "org.eclipse.scout.sdk.page.CheckBoxNodePage";
- public static final String CLIENT_LOOKUP_CALL_TABLE_PAGE = "org.eclipse.scout.sdk.page.ClientLookupCallTablePage";
- public static final String CLIENT_NODE_PAGE = "org.eclipse.scout.sdk.page.ClientNodePage";
- public static final String CLIENT_SERVICE_NODE_PAGE = "org.eclipse.scout.sdk.page.ClientServiceNodePage";
- public static final String CLIENT_SERVICE_TABLE_PAGE = "org.eclipse.scout.sdk.page.ClientServiceTablePage";
- public static final String CLIENT_SESSION_NODE_PAGE = "org.eclipse.scout.sdk.page.ClientSessionNodePage";
- public static final String CODE_NODE_PAGE = "org.eclipse.scout.sdk.page.CodeNodePage";
- public static final String CODE_TYPE_NODE_PAGE = "org.eclipse.scout.sdk.page.CodeTypeNodePage";
- public static final String CODE_TYPE_TABLE_PAGE = "org.eclipse.scout.sdk.page.CodeTypeTablePage";
- public static final String COLUMN_NODE_PAGE = "org.eclipse.scout.sdk.page.ColumnNodePage";
- public static final String COLUMN_TABLE_PAGE = "org.eclipse.scout.sdk.page.ColumnTablePage";
- public static final String COMMON_SERVICES_NODE_PAGE = "org.eclipse.scout.sdk.page.CommonServicesNodePage";
- public static final String COMPOSER_FIELD_NODE_PAGE = "org.eclipse.scout.sdk.page.ComposerFieldNodePage";
- public static final String COMPOSER_FIELD_ENTITY_TABLE_PAGE = "org.eclipse.scout.sdk.page.ComposerField.EntityTablePage";
- public static final String COMPOSER_FIELD_ENTITY_NODE_PAGE = "org.eclipse.scout.sdk.page.ComposerField.EntityNodePage";
- public static final String COMPOSER_FIELD_ATTRIBUTE_TABLE_PAGE = "org.eclipse.scout.sdk.page.ComposerField.AttributeTablePage";
- public static final String COMPOSER_FIELD_ATTRIBUTE_NODE_PAGE = "org.eclipse.scout.sdk.page.ComposerField.AttributeNodePage";
- public static final String CUSTOM_FIELD_NODE_PAGE = "org.eclipse.scout.sdk.page.CustomFieldNodePage";
- public static final String CUSTOM_SERVICE_NODE_PAGE = "org.eclipse.scout.sdk.page.CustomServiceNodePage";
- public static final String CUSTOM_SERVICE_PACKAGE_NODE_PAGE = "org.eclipse.scout.sdk.page.CustomServicePackageNodePage";
- public static final String CUSTOM_SERVICE_TABLE_PAGE = "org.eclipse.scout.sdk.page.CustomServiceTablePage";
- public static final String DATE_FIELD_NODE_PAGE = "org.eclipse.scout.sdk.page.DateFieldNodePage";
- public static final String DESKTOP_NODE_PAGE = "org.eclipse.scout.sdk.page.DesktopNodePage";
- public static final String DESKTOP_EXTENSION_NODE_PAGE = "org.eclipse.scout.sdk.page.DesktopExtensionNodePage";
- public static final String DESKTOP_OUTLINE_TABLE_PAGE = "org.eclipse.scout.sdk.page.DesktopOutlineTablePage";
- public static final String DOUBLE_FIELD_NODE_PAGE = "org.eclipse.scout.sdk.page.DoubleFieldNodePage";
- public static final String FILE_CHOOSER_FIELD_NODE_PAGE = "org.eclipse.scout.sdk.page.FileChooserFieldNodePage";
- public static final String FORM_FIELD_TEMPLATE_TABLE_PAGE = "org.eclipse.scout.sdk.page.FormFieldTemplateTablePage";
- public static final String FORM_HANDLER_NODE_PAGE = "org.eclipse.scout.sdk.page.FormHandlerNodePage";
- public static final String FORM_HANDLER_TABLE_PAGE = "org.eclipse.scout.sdk.page.FormHandlerTablePage";
- public static final String FORM_NODE_PAGE = "org.eclipse.scout.sdk.page.FormNodePage";
- public static final String FORM_TABLE_PAGE = "org.eclipse.scout.sdk.page.FormTablePage";
- public static final String GROUP_BOX_NODE_PAGE = "org.eclipse.scout.sdk.page.GroupBoxNodePage";
- public static final String HTML_FIELD_NODE_PAGE = "org.eclipse.scout.sdk.page.HtmlFieldNodePage";
- public static final String ICON_NODE_PAGE = "org.eclipse.scout.sdk.page.IconNodePage";
- public static final String IMAGE_FIELD_NODE_PAGE = "org.eclipse.scout.sdk.page.ImageFieldNodePage";
- public static final String INTEGER_FIELD_NODE_PAGE = "org.eclipse.scout.sdk.page.IntegerFieldNodePage";
- public static final String INVISIBLE_ROOT_NODE = "org.eclipse.scout.sdk.page.InvisibleRootNode";
- public static final String KEY_STROKE_NODE_PAGE = "org.eclipse.scout.sdk.page.KeyStrokeNodePage";
- public static final String KEY_STROKE_TABLE_PAGE = "org.eclipse.scout.sdk.page.KeyStrokeTablePage";
- public static final String LABEL_FIELD_NODE_PAGE = "org.eclipse.scout.sdk.page.LabelFieldNodePage";
- public static final String LIBRARIES_NODE_PAGE = "org.eclipse.scout.sdk.page.LibrariesNodePage";
- public static final String LIBRARIES_TABLE_PAGE = "org.eclipse.scout.sdk.page.LibrariesTablePage";
- public static final String LIST_BOX_NODE_PAGE = "org.eclipse.scout.sdk.page.ListBoxNodePage";
- public static final String LONG_FIELD_NODE_PAGE = "org.eclipse.scout.sdk.page.LongFieldNodePage";
- public static final String LOOKUP_CALL_NODE_PAGE = "org.eclipse.scout.sdk.page.LookupCallNodePage";
- public static final String LOOKUP_CALL_TABLE_PAGE = "org.eclipse.scout.sdk.page.LookupCallTablePage";
- public static final String LOOKUP_SERVICE_NODE_PAGE = "org.eclipse.scout.sdk.page.LookupServiceNodePage";
- public static final String LOOKUP_SERVICE_TABLE_PAGE = "org.eclipse.scout.sdk.page.LookupServiceTablePage";
- public static final String MAIL_FIELD_NODE_PAGE = "org.eclipse.scout.sdk.page.MailFieldNodePage";
- public static final String MAIN_BOX_NODE_PAGE = "org.eclipse.scout.sdk.page.MainBoxNodePage";
- public static final String MATRIX_FIELD_NODE_PAGE = "org.eclipse.scout.sdk.page.MatrixFieldNodePage";
- public static final String MENU_NODE_PAGE = "org.eclipse.scout.sdk.page.MenuNodePage";
- public static final String MENU_TABLE_PAGE = "org.eclipse.scout.sdk.page.MenuTablePage";
- public static final String NODE_PAGE_CHILD_PAGE_TABLE_PAGE = "org.eclipse.scout.sdk.page. NodePageChildPageTablePage";
- public static final String OUTLINE_NODE_PAGE = "org.eclipse.scout.sdk.page.OutlineNodePage";
- public static final String OUTLINE_PAGE_CHILD_PAGE_TABLE_PAGE = "org.eclipse.scout.sdk.page.OutlinePageChildPageTablePage";
- public static final String OUTLINE_SERVICE_NODE_PAGE = "org.eclipse.scout.sdk.page.OutlineServiceNodePage";
- public static final String OUTLINE_SERVICE_TABLE_PAGE = "org.eclipse.scout.sdk.page.OutlineServiceTablePage";
- public static final String OUTLINE_TABLE_PAGE = "org.eclipse.scout.sdk.page.OutlineTablePage";
- public static final String PAGE_WITH_NODE_NODE_PAGE = "org.eclipse.scout.sdk.page.PageWithNodeNodePage";
- public static final String PAGE_WITH_TABLE_NODE_PAGE = "org.eclipse.scout.sdk.page.PageWithTableNodePage";
- public static final String PERMISSION_NODE_PAGE = "org.eclipse.scout.sdk.page.PermissionNodePage";
- public static final String PERMISSION_TABLE_PAGE = "org.eclipse.scout.sdk.page.PermissionTablePage";
- public static final String PLANNER_FIELD_NODE_PAGE = "org.eclipse.scout.sdk.page.PlannerFieldNodePage";
- public static final String PROCESS_SERVICE_NODE_PAGE = "org.eclipse.scout.sdk.page.ProcessServiceNodePage";
- public static final String PROCESS_SERVICE_TABLE_PAGE = "org.eclipse.scout.sdk.page.ProcessServiceTablePage";
- public static final String PROJECT_NODE_PAGE = "org.eclipse.scout.sdk.page.ProjectNodePage";
- public static final String PROJECT_TABLE_PAGE = "org.eclipse.scout.sdk.page.ProjectsTablePage";
- public static final String RADIO_BUTTON_GROUP_NODE_PAGE = "org.eclipse.scout.sdk.page.RadioButtonGroupNodePage";
-
- public static final String SEQUENCE_BOX_FIELD_NODE_PAGE = "org.eclipse.scout.sdk.page.SequenceBoxFieldNodePage";
- public static final String SERVER_NODE_PAGE = "org.eclipse.scout.sdk.page.ServerNodePage";
- public static final String SERVER_SESSION_NODE_PAGE = "org.eclipse.scout.sdk.page.ServerSessionNodePage";
- public static final String SERVICE_OPERATION_NODE_PAGE = "org.eclipse.scout.sdk.page.ServiceOperationNodePage";
- public static final String SHARED_CONTEXT_PROPERTY_NODE_PAGE = "org.eclipse.scout.sdk.page.SharedContextPropertyNodePage";
- public static final String SHARED_CONTEXT_PROPERTY_TABLE_PAGE = "org.eclipse.scout.sdk.page.SharedContextPropertyTablePage";
- public static final String SHARED_NODE_PAGE = "org.eclipse.scout.sdk.page.SharedNodePage";
-
- public static final String SMART_FIELD_NODE_PAGE = "org.eclipse.scout.sdk.page.SmartFieldNodePage";
- public static final String SMTP_SERVICE_NODE_PAGE = "org.eclipse.scout.sdk.page.SmtpServiceNodePage";
- public static final String SMTP_SERVICE_TABLE_PAGE = "org.eclipse.scout.sdk.page.SmtpServiceTablePage";
- public static final String SPLIT_BOX_NODE_PAGE = "org.eclipse.scout.sdk.page.SplitBoxNodePage";
- public static final String SQL_SERVICE_NODE_PAGE = "org.eclipse.scout.sdk.page.SqlServiceNodePage";
- public static final String SQL_SERVICE_TABLE_PAGE = "org.eclipse.scout.sdk.page.SqlServiceTablePage";
- public static final String STRING_FIELD_NODE_PAGE = "org.eclipse.scout.sdk.page.StringFieldNodePage";
-
- public static final String TAB_BOX_NODE_PAGE = "org.eclipse.scout.sdk.page.TabBoxNodePage";
- public static final String TABLE_FIELD_NODE_PAGE = "org.eclipse.scout.sdk.page.TableFieldNodePage";
- public static final String TABLE_NODE_PAGE = "org.eclipse.scout.sdk.page.TableNodePage";
- public static final String TABLE_PAGE_CHILD_PAGE_TABLE_PAGE = "org.eclipse.scout.sdk.page.TablePageChildPageTablePage";
- public static final String TEMPLATE_TABLE_PAGE = "org.eclipse.scout.sdk.page.TemplateTablePage";
-
- public static final String TIME_FIELD_NODE_PAGE = "org.eclipse.scout.sdk.page.TimeFieldNodePage";
- public static final String TOOL_BUTTON_NODE_PAGE = "org.eclipse.scout.sdk.page.ToolButtonNodePage";
- public static final String TOOL_BUTTON_TABLE_PAGE = "org.eclipse.scout.sdk.page.ToolButtonTablePage";
- public static final String TREE_BOX_NODE_PAGE = "org.eclipse.scout.sdk.page.TreeBoxNodePage";
- public static final String TREE_FIELD_NODE_PAGE = "org.eclipse.scout.sdk.page.TreeFieldNodePage";
- public static final String TREE_NODE_PAGE = "org.eclipse.scout.sdk.page.TreeNodePage";
- public static final String UI_SWING_NODE_PAGE = "org.eclipse.scout.sdk.page.UiSwingNodePage";
- public static final String UI_SWT_NODE_PAGE = "org.eclipse.scout.sdk.page.UiSwtNodePage";
- public static final String UNKNOWN_FIELD_NODE_PAGE = "org.eclipse.scout.sdk.page.UnknownFieldNodePage";
- public static final String WIZARD_NODE_PAGE = "org.eclipse.scout.sdk.page.WizardNodePage";
- public static final String WIZARD_STEP_NODE_PAGE = "org.eclipse.scout.sdk.page.WizardStepNodePage";
- public static final String WIZARD_STEP_TABLE_PAGE = "org.eclipse.scout.sdk.page.WizardStepTablePage";
- public static final String WIZARD_TABLE_PAGE = "org.eclipse.scout.sdk.page.WizardTablePage";
- public static final String SEARCH_TABLE_PAGE = "org.eclipse.scout.sdk.page.SearchTablePage";
-
-}
+/*******************************************************************************
+ * 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.view.outline.pages;
+
+/**
+ * <h3>IScoutPageConstants</h3> ...
+ */
+public abstract interface IScoutPageConstants {
+ public static final String ALL_PAGES_TABLE_PAGE = "org.eclipse.scout.sdk.page.AllPagesTablePage";
+ public static final String BEAN_PROPERTY_NODE_PAGE = "org.eclipse.scout.sdk.page.BeanPropertyNodePage";
+ public static final String BEAN_PROPERTY_TABLE_PAGE = "org.eclipse.scout.sdk.page.BeanPropertyTablePage";
+ public static final String BIG_DECIMAL_FIELD_NODE_PAGE = "org.eclipse.scout.sdk.page.BigDecimalFieldNodePage";
+ public static final String BOOKMARK_STORAGE_SERVICE_NODE_PAGE = "org.eclipse.scout.sdk.page.BookmarkStorageServiceNodePage";
+ public static final String BOOKMARK_STORAGE_SERVICE_TABLE_PAGE = "org.eclipse.scout.sdk.page.BookmarkStorageServiceTablePage";
+ public static final String BOOLEAN_FIELD_NODE_PAGE = "org.eclipse.scout.sdk.page.BooleanFieldNodePage";
+ public static final String BUTTON_NODE_PAGE = "org.eclipse.scout.sdk.page.ButtonNodePage";
+ public static final String CALENDAR_FIELD_NODE_PAGE = "org.eclipse.scout.sdk.page.CalendarFieldNodePage";
+ public static final String CALENDAR_ITEM_PROVIDER_NODE_PAGE = "org.eclipse.scout.sdk.page.CalendarItemProviderNodePage";
+ public static final String CALENDAR_ITEM_PROVIDER_TABLE_PAGE = "org.eclipse.scout.sdk.page.CalendarItemProviderTablePage";
+ public static final String CALENDAR_NODE_PAGE = "org.eclipse.scout.sdk.page.CalendarNodePage";
+ public static final String CALENDAR_SERVICE_NODE_PAGE = "org.eclipse.scout.sdk.page.CalendarServiceNodePage";
+ public static final String CALENDAR_SERVICE_TABLE_PAGE = "org.eclipse.scout.sdk.page.CalendarServiceTablePage";
+ public static final String CHECK_BOX_NODE_PAGE = "org.eclipse.scout.sdk.page.CheckBoxNodePage";
+ public static final String CLIENT_LOOKUP_CALL_TABLE_PAGE = "org.eclipse.scout.sdk.page.ClientLookupCallTablePage";
+ public static final String CLIENT_NODE_PAGE = "org.eclipse.scout.sdk.page.ClientNodePage";
+ public static final String CLIENT_SERVICE_NODE_PAGE = "org.eclipse.scout.sdk.page.ClientServiceNodePage";
+ public static final String CLIENT_SERVICE_TABLE_PAGE = "org.eclipse.scout.sdk.page.ClientServiceTablePage";
+ public static final String CLIENT_SESSION_NODE_PAGE = "org.eclipse.scout.sdk.page.ClientSessionNodePage";
+ public static final String CODE_NODE_PAGE = "org.eclipse.scout.sdk.page.CodeNodePage";
+ public static final String CODE_TYPE_NODE_PAGE = "org.eclipse.scout.sdk.page.CodeTypeNodePage";
+ public static final String CODE_TYPE_TABLE_PAGE = "org.eclipse.scout.sdk.page.CodeTypeTablePage";
+ public static final String COLUMN_NODE_PAGE = "org.eclipse.scout.sdk.page.ColumnNodePage";
+ public static final String COLUMN_TABLE_PAGE = "org.eclipse.scout.sdk.page.ColumnTablePage";
+ public static final String COMMON_SERVICES_NODE_PAGE = "org.eclipse.scout.sdk.page.CommonServicesNodePage";
+ public static final String COMPOSER_FIELD_NODE_PAGE = "org.eclipse.scout.sdk.page.ComposerFieldNodePage";
+ public static final String COMPOSER_FIELD_ENTITY_TABLE_PAGE = "org.eclipse.scout.sdk.page.ComposerField.EntityTablePage";
+ public static final String COMPOSER_FIELD_ENTITY_NODE_PAGE = "org.eclipse.scout.sdk.page.ComposerField.EntityNodePage";
+ public static final String COMPOSER_FIELD_ATTRIBUTE_TABLE_PAGE = "org.eclipse.scout.sdk.page.ComposerField.AttributeTablePage";
+ public static final String COMPOSER_FIELD_ATTRIBUTE_NODE_PAGE = "org.eclipse.scout.sdk.page.ComposerField.AttributeNodePage";
+ public static final String CUSTOM_FIELD_NODE_PAGE = "org.eclipse.scout.sdk.page.CustomFieldNodePage";
+ public static final String CUSTOM_SERVICE_NODE_PAGE = "org.eclipse.scout.sdk.page.CustomServiceNodePage";
+ public static final String CUSTOM_SERVICE_PACKAGE_NODE_PAGE = "org.eclipse.scout.sdk.page.CustomServicePackageNodePage";
+ public static final String CUSTOM_SERVICE_TABLE_PAGE = "org.eclipse.scout.sdk.page.CustomServiceTablePage";
+ public static final String DATE_FIELD_NODE_PAGE = "org.eclipse.scout.sdk.page.DateFieldNodePage";
+ public static final String DESKTOP_NODE_PAGE = "org.eclipse.scout.sdk.page.DesktopNodePage";
+ public static final String DESKTOP_EXTENSION_NODE_PAGE = "org.eclipse.scout.sdk.page.DesktopExtensionNodePage";
+ public static final String DESKTOP_OUTLINE_TABLE_PAGE = "org.eclipse.scout.sdk.page.DesktopOutlineTablePage";
+ public static final String DOUBLE_FIELD_NODE_PAGE = "org.eclipse.scout.sdk.page.DoubleFieldNodePage";
+ public static final String FILE_CHOOSER_FIELD_NODE_PAGE = "org.eclipse.scout.sdk.page.FileChooserFieldNodePage";
+ public static final String FORM_FIELD_TEMPLATE_TABLE_PAGE = "org.eclipse.scout.sdk.page.FormFieldTemplateTablePage";
+ public static final String FORM_HANDLER_NODE_PAGE = "org.eclipse.scout.sdk.page.FormHandlerNodePage";
+ public static final String FORM_HANDLER_TABLE_PAGE = "org.eclipse.scout.sdk.page.FormHandlerTablePage";
+ public static final String FORM_NODE_PAGE = "org.eclipse.scout.sdk.page.FormNodePage";
+ public static final String FORM_TABLE_PAGE = "org.eclipse.scout.sdk.page.FormTablePage";
+ public static final String GROUP_BOX_NODE_PAGE = "org.eclipse.scout.sdk.page.GroupBoxNodePage";
+ public static final String HTML_FIELD_NODE_PAGE = "org.eclipse.scout.sdk.page.HtmlFieldNodePage";
+ public static final String ICON_NODE_PAGE = "org.eclipse.scout.sdk.page.IconNodePage";
+ public static final String IMAGE_FIELD_NODE_PAGE = "org.eclipse.scout.sdk.page.ImageFieldNodePage";
+ public static final String INTEGER_FIELD_NODE_PAGE = "org.eclipse.scout.sdk.page.IntegerFieldNodePage";
+ public static final String INVISIBLE_ROOT_NODE = "org.eclipse.scout.sdk.page.InvisibleRootNode";
+ public static final String KEY_STROKE_NODE_PAGE = "org.eclipse.scout.sdk.page.KeyStrokeNodePage";
+ public static final String KEY_STROKE_TABLE_PAGE = "org.eclipse.scout.sdk.page.KeyStrokeTablePage";
+ public static final String LABEL_FIELD_NODE_PAGE = "org.eclipse.scout.sdk.page.LabelFieldNodePage";
+ public static final String LIBRARIES_NODE_PAGE = "org.eclipse.scout.sdk.page.LibrariesNodePage";
+ public static final String LIBRARIES_TABLE_PAGE = "org.eclipse.scout.sdk.page.LibrariesTablePage";
+ public static final String LIST_BOX_NODE_PAGE = "org.eclipse.scout.sdk.page.ListBoxNodePage";
+ public static final String LONG_FIELD_NODE_PAGE = "org.eclipse.scout.sdk.page.LongFieldNodePage";
+ public static final String LOOKUP_CALL_NODE_PAGE = "org.eclipse.scout.sdk.page.LookupCallNodePage";
+ public static final String LOOKUP_CALL_TABLE_PAGE = "org.eclipse.scout.sdk.page.LookupCallTablePage";
+ public static final String LOOKUP_SERVICE_NODE_PAGE = "org.eclipse.scout.sdk.page.LookupServiceNodePage";
+ public static final String LOOKUP_SERVICE_TABLE_PAGE = "org.eclipse.scout.sdk.page.LookupServiceTablePage";
+ public static final String MAIL_FIELD_NODE_PAGE = "org.eclipse.scout.sdk.page.MailFieldNodePage";
+ public static final String MAIN_BOX_NODE_PAGE = "org.eclipse.scout.sdk.page.MainBoxNodePage";
+ public static final String MATRIX_FIELD_NODE_PAGE = "org.eclipse.scout.sdk.page.MatrixFieldNodePage";
+ public static final String MENU_NODE_PAGE = "org.eclipse.scout.sdk.page.MenuNodePage";
+ public static final String MENU_TABLE_PAGE = "org.eclipse.scout.sdk.page.MenuTablePage";
+ public static final String NODE_PAGE_CHILD_PAGE_TABLE_PAGE = "org.eclipse.scout.sdk.page. NodePageChildPageTablePage";
+ public static final String OUTLINE_NODE_PAGE = "org.eclipse.scout.sdk.page.OutlineNodePage";
+ public static final String OUTLINE_PAGE_CHILD_PAGE_TABLE_PAGE = "org.eclipse.scout.sdk.page.OutlinePageChildPageTablePage";
+ public static final String OUTLINE_SERVICE_NODE_PAGE = "org.eclipse.scout.sdk.page.OutlineServiceNodePage";
+ public static final String OUTLINE_SERVICE_TABLE_PAGE = "org.eclipse.scout.sdk.page.OutlineServiceTablePage";
+ public static final String OUTLINE_TABLE_PAGE = "org.eclipse.scout.sdk.page.OutlineTablePage";
+ public static final String PAGE_WITH_NODE_NODE_PAGE = "org.eclipse.scout.sdk.page.PageWithNodeNodePage";
+ public static final String PAGE_WITH_TABLE_NODE_PAGE = "org.eclipse.scout.sdk.page.PageWithTableNodePage";
+ public static final String PERMISSION_NODE_PAGE = "org.eclipse.scout.sdk.page.PermissionNodePage";
+ public static final String PERMISSION_TABLE_PAGE = "org.eclipse.scout.sdk.page.PermissionTablePage";
+ public static final String PLANNER_FIELD_NODE_PAGE = "org.eclipse.scout.sdk.page.PlannerFieldNodePage";
+ public static final String PROCESS_SERVICE_NODE_PAGE = "org.eclipse.scout.sdk.page.ProcessServiceNodePage";
+ public static final String PROCESS_SERVICE_TABLE_PAGE = "org.eclipse.scout.sdk.page.ProcessServiceTablePage";
+ public static final String PROJECT_NODE_PAGE = "org.eclipse.scout.sdk.page.ProjectNodePage";
+ public static final String PROJECT_TABLE_PAGE = "org.eclipse.scout.sdk.page.ProjectsTablePage";
+ public static final String RADIO_BUTTON_GROUP_NODE_PAGE = "org.eclipse.scout.sdk.page.RadioButtonGroupNodePage";
+
+ public static final String SEQUENCE_BOX_FIELD_NODE_PAGE = "org.eclipse.scout.sdk.page.SequenceBoxFieldNodePage";
+ public static final String SERVER_NODE_PAGE = "org.eclipse.scout.sdk.page.ServerNodePage";
+ public static final String SERVER_SESSION_NODE_PAGE = "org.eclipse.scout.sdk.page.ServerSessionNodePage";
+ public static final String SERVICE_OPERATION_NODE_PAGE = "org.eclipse.scout.sdk.page.ServiceOperationNodePage";
+ public static final String SHARED_CONTEXT_PROPERTY_NODE_PAGE = "org.eclipse.scout.sdk.page.SharedContextPropertyNodePage";
+ public static final String SHARED_CONTEXT_PROPERTY_TABLE_PAGE = "org.eclipse.scout.sdk.page.SharedContextPropertyTablePage";
+ public static final String SHARED_NODE_PAGE = "org.eclipse.scout.sdk.page.SharedNodePage";
+
+ public static final String SMART_FIELD_NODE_PAGE = "org.eclipse.scout.sdk.page.SmartFieldNodePage";
+ public static final String SMTP_SERVICE_NODE_PAGE = "org.eclipse.scout.sdk.page.SmtpServiceNodePage";
+ public static final String SMTP_SERVICE_TABLE_PAGE = "org.eclipse.scout.sdk.page.SmtpServiceTablePage";
+ public static final String SPLIT_BOX_NODE_PAGE = "org.eclipse.scout.sdk.page.SplitBoxNodePage";
+ public static final String SQL_SERVICE_NODE_PAGE = "org.eclipse.scout.sdk.page.SqlServiceNodePage";
+ public static final String SQL_SERVICE_TABLE_PAGE = "org.eclipse.scout.sdk.page.SqlServiceTablePage";
+ public static final String STRING_FIELD_NODE_PAGE = "org.eclipse.scout.sdk.page.StringFieldNodePage";
+
+ public static final String TAB_BOX_NODE_PAGE = "org.eclipse.scout.sdk.page.TabBoxNodePage";
+ public static final String TABLE_FIELD_NODE_PAGE = "org.eclipse.scout.sdk.page.TableFieldNodePage";
+ public static final String TABLE_NODE_PAGE = "org.eclipse.scout.sdk.page.TableNodePage";
+ public static final String TABLE_PAGE_CHILD_PAGE_TABLE_PAGE = "org.eclipse.scout.sdk.page.TablePageChildPageTablePage";
+ public static final String TEMPLATE_TABLE_PAGE = "org.eclipse.scout.sdk.page.TemplateTablePage";
+
+ public static final String TIME_FIELD_NODE_PAGE = "org.eclipse.scout.sdk.page.TimeFieldNodePage";
+ public static final String TOOL_BUTTON_NODE_PAGE = "org.eclipse.scout.sdk.page.ToolButtonNodePage";
+ public static final String TOOL_BUTTON_TABLE_PAGE = "org.eclipse.scout.sdk.page.ToolButtonTablePage";
+ public static final String TREE_BOX_NODE_PAGE = "org.eclipse.scout.sdk.page.TreeBoxNodePage";
+ public static final String TREE_FIELD_NODE_PAGE = "org.eclipse.scout.sdk.page.TreeFieldNodePage";
+ public static final String TREE_NODE_PAGE = "org.eclipse.scout.sdk.page.TreeNodePage";
+ public static final String UI_SWING_NODE_PAGE = "org.eclipse.scout.sdk.page.UiSwingNodePage";
+ public static final String UI_SWT_NODE_PAGE = "org.eclipse.scout.sdk.page.UiSwtNodePage";
+ public static final String UNKNOWN_FIELD_NODE_PAGE = "org.eclipse.scout.sdk.page.UnknownFieldNodePage";
+ public static final String WIZARD_NODE_PAGE = "org.eclipse.scout.sdk.page.WizardNodePage";
+ public static final String WIZARD_STEP_NODE_PAGE = "org.eclipse.scout.sdk.page.WizardStepNodePage";
+ public static final String WIZARD_STEP_TABLE_PAGE = "org.eclipse.scout.sdk.page.WizardStepTablePage";
+ public static final String WIZARD_TABLE_PAGE = "org.eclipse.scout.sdk.page.WizardTablePage";
+ public static final String SEARCH_TABLE_PAGE = "org.eclipse.scout.sdk.page.SearchTablePage";
+
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/ITypePage.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/ITypePage.java
index 77d3f1fa0..ea658cc77 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/ITypePage.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/ITypePage.java
@@ -1,21 +1,21 @@
-/*******************************************************************************
- * 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.view.outline.pages;
-
-import org.eclipse.jdt.core.IType;
-
-public interface ITypePage extends IPage {
-
- void setType(IType type);
-
- IType getType();
-
-}
+/*******************************************************************************
+ * 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.view.outline.pages;
+
+import org.eclipse.jdt.core.IType;
+
+public interface ITypePage extends IPage {
+
+ void setType(IType type);
+
+ IType getType();
+
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/InnerTypeOrderChangedPageDirtyListener.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/InnerTypeOrderChangedPageDirtyListener.java
index 2b1054d59..fd5a8c83c 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/InnerTypeOrderChangedPageDirtyListener.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/InnerTypeOrderChangedPageDirtyListener.java
@@ -1,63 +1,63 @@
-/*******************************************************************************
- * 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.view.outline.pages;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.ITypeHierarchy;
-import org.eclipse.scout.sdk.util.jdt.IJavaResourceChangedListener;
-import org.eclipse.scout.sdk.util.jdt.JdtEvent;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-
-/**
- *
- */
-public class InnerTypeOrderChangedPageDirtyListener implements IJavaResourceChangedListener {
-
- private final IPage m_page;
- private final IType m_innerTypeSuperType;
- private final IType m_declaringType;
-
- public InnerTypeOrderChangedPageDirtyListener(IPage page, IType innerTypeSuperType, IType declaringType) {
- m_page = page;
- m_innerTypeSuperType = innerTypeSuperType;
- m_declaringType = declaringType;
- }
-
- @Override
- public void handleEvent(JdtEvent event) {
- if (TypeUtility.exists(event.getElement())) {
- if (event.getElementType() == IJavaElement.ANNOTATION) {
- IAnnotation annotation = (IAnnotation) event.getElement();
- IJavaElement annotationOwner = annotation.getParent();
- ITypeHierarchy superTypeHierarchy = event.getSuperTypeHierarchy();
- if (superTypeHierarchy != null && superTypeHierarchy.contains(getInnerTypeSuperType())) {
- if (TypeUtility.exists(annotationOwner) && annotationOwner.getParent().equals(getDeclaringType())) {
- getPage().markStructureDirty();
- }
- }
- }
- }
- }
-
- public IPage getPage() {
- return m_page;
- }
-
- public IType getInnerTypeSuperType() {
- return m_innerTypeSuperType;
- }
-
- public IType getDeclaringType() {
- return m_declaringType;
- }
-}
+/*******************************************************************************
+ * 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.view.outline.pages;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.ITypeHierarchy;
+import org.eclipse.scout.sdk.util.jdt.IJavaResourceChangedListener;
+import org.eclipse.scout.sdk.util.jdt.JdtEvent;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+
+/**
+ *
+ */
+public class InnerTypeOrderChangedPageDirtyListener implements IJavaResourceChangedListener {
+
+ private final IPage m_page;
+ private final IType m_innerTypeSuperType;
+ private final IType m_declaringType;
+
+ public InnerTypeOrderChangedPageDirtyListener(IPage page, IType innerTypeSuperType, IType declaringType) {
+ m_page = page;
+ m_innerTypeSuperType = innerTypeSuperType;
+ m_declaringType = declaringType;
+ }
+
+ @Override
+ public void handleEvent(JdtEvent event) {
+ if (TypeUtility.exists(event.getElement())) {
+ if (event.getElementType() == IJavaElement.ANNOTATION) {
+ IAnnotation annotation = (IAnnotation) event.getElement();
+ IJavaElement annotationOwner = annotation.getParent();
+ ITypeHierarchy superTypeHierarchy = event.getSuperTypeHierarchy();
+ if (superTypeHierarchy != null && superTypeHierarchy.contains(getInnerTypeSuperType())) {
+ if (TypeUtility.exists(annotationOwner) && annotationOwner.getParent().equals(getDeclaringType())) {
+ getPage().markStructureDirty();
+ }
+ }
+ }
+ }
+ }
+
+ public IPage getPage() {
+ return m_page;
+ }
+
+ public IType getInnerTypeSuperType() {
+ return m_innerTypeSuperType;
+ }
+
+ public IType getDeclaringType() {
+ return m_declaringType;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/InnerTypePageDirtyListener.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/InnerTypePageDirtyListener.java
index 0418fb92b..3283a8063 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/InnerTypePageDirtyListener.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/InnerTypePageDirtyListener.java
@@ -1,89 +1,89 @@
-/*******************************************************************************
- * 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.view.outline.pages;
-
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.ITypeHierarchy;
-import org.eclipse.scout.sdk.util.jdt.IJavaResourceChangedListener;
-import org.eclipse.scout.sdk.util.jdt.JdtEvent;
-
-/**
- * <h3>{@link InnerTypePageDirtyListener}</h3> This listener marks the given page dirty (what means all child pages will
- * be recreated)
- * if:
- * <ul>
- * <li>the changed type is the member of any child page and does not contain the given super type anymore in the
- * supertype hierarchy</li>
- * <li>the changed type is the not member of any child page and does contain the given super type anymore in the
- * supertype hierarchy</li>
- * </ul>
- *
- * @author Andreas Hoegger
- * @since 1.0.8 21.11.2010
- */
-public class InnerTypePageDirtyListener implements IJavaResourceChangedListener {
- private final IPage m_page;
- private final IType m_superType;
-
- public InnerTypePageDirtyListener(IPage page, IType superType) {
- m_page = page;
- m_superType = superType;
- }
-
- /**
- * @return the page
- */
- public IPage getPage() {
- return m_page;
- }
-
- /**
- * @return the superType
- */
- public IType getSuperType() {
- return m_superType;
- }
-
- @Override
- public void handleEvent(JdtEvent event) {
- ITypePage page = null;
- for (IPage p : getPage().getChildren()) {
- if (p instanceof ITypePage) {
- if (((ITypePage) p).getType().equals(event.getElement())) {
- page = (ITypePage) p;
- break;
- }
- }
- }
- if (page != null && (event.getEventType() == JdtEvent.REMOVED || event.getEventType() == JdtEvent.ADDED)) {
- handleChildPagesChanged(event);
- return;
- }
- ITypeHierarchy superTypeHierarchy = event.getSuperTypeHierarchy();
- if (superTypeHierarchy != null) {
- if (page != null) {
- if (!superTypeHierarchy.contains(getSuperType())) {
- handleChildPagesChanged(event);
- return;
- }
- }
- else {
- if (superTypeHierarchy.contains(getSuperType())) {
- handleChildPagesChanged(event);
- }
- }
- }
- }
-
- protected void handleChildPagesChanged(JdtEvent event) {
- getPage().markStructureDirty();
- }
-}
+/*******************************************************************************
+ * 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.view.outline.pages;
+
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.ITypeHierarchy;
+import org.eclipse.scout.sdk.util.jdt.IJavaResourceChangedListener;
+import org.eclipse.scout.sdk.util.jdt.JdtEvent;
+
+/**
+ * <h3>{@link InnerTypePageDirtyListener}</h3> This listener marks the given page dirty (what means all child pages will
+ * be recreated)
+ * if:
+ * <ul>
+ * <li>the changed type is the member of any child page and does not contain the given super type anymore in the
+ * supertype hierarchy</li>
+ * <li>the changed type is the not member of any child page and does contain the given super type anymore in the
+ * supertype hierarchy</li>
+ * </ul>
+ *
+ * @author Andreas Hoegger
+ * @since 1.0.8 21.11.2010
+ */
+public class InnerTypePageDirtyListener implements IJavaResourceChangedListener {
+ private final IPage m_page;
+ private final IType m_superType;
+
+ public InnerTypePageDirtyListener(IPage page, IType superType) {
+ m_page = page;
+ m_superType = superType;
+ }
+
+ /**
+ * @return the page
+ */
+ public IPage getPage() {
+ return m_page;
+ }
+
+ /**
+ * @return the superType
+ */
+ public IType getSuperType() {
+ return m_superType;
+ }
+
+ @Override
+ public void handleEvent(JdtEvent event) {
+ ITypePage page = null;
+ for (IPage p : getPage().getChildren()) {
+ if (p instanceof ITypePage) {
+ if (((ITypePage) p).getType().equals(event.getElement())) {
+ page = (ITypePage) p;
+ break;
+ }
+ }
+ }
+ if (page != null && (event.getEventType() == JdtEvent.REMOVED || event.getEventType() == JdtEvent.ADDED)) {
+ handleChildPagesChanged(event);
+ return;
+ }
+ ITypeHierarchy superTypeHierarchy = event.getSuperTypeHierarchy();
+ if (superTypeHierarchy != null) {
+ if (page != null) {
+ if (!superTypeHierarchy.contains(getSuperType())) {
+ handleChildPagesChanged(event);
+ return;
+ }
+ }
+ else {
+ if (superTypeHierarchy.contains(getSuperType())) {
+ handleChildPagesChanged(event);
+ }
+ }
+ }
+ }
+
+ protected void handleChildPagesChanged(JdtEvent event) {
+ getPage().markStructureDirty();
+ }
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/PageDirtyListener.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/PageDirtyListener.java
index d3b70dd0b..40c4524da 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/PageDirtyListener.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/PageDirtyListener.java
@@ -1,49 +1,49 @@
-/*******************************************************************************
- * 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.view.outline.pages;
-
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.scout.sdk.util.typecache.ITypeHierarchyChangedListener;
-
-public class PageDirtyListener implements ITypeHierarchyChangedListener {
- private AbstractPage m_page;
-
- public PageDirtyListener(AbstractPage page) {
- m_page = page;
- }
-
- @Override
- public void handleEvent(int eventType, IType type) {
- switch (eventType) {
- case POST_TYPE_REMOVING:
- case POST_TYPE_ADDING:
- case POST_TYPE_CHANGED:
- m_page.markStructureDirty();
- break;
- }
- }
-
- public void typeChanged(IType type, int eventType, IJavaElement modification) {
- m_page.markStructureDirty();
- }
-
- public void innerTypeChanged(IType type, IType innerType, int eventType, IJavaElement modification) {
- if (innerType != null && innerType.getDeclaringType() == type) {
- m_page.markStructureDirty();
- }
- }
-
- public void subTypeHierarchyChanged(IType type) {
- m_page.markStructureDirty();
- }
-
-}
+/*******************************************************************************
+ * 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.view.outline.pages;
+
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.scout.sdk.util.typecache.ITypeHierarchyChangedListener;
+
+public class PageDirtyListener implements ITypeHierarchyChangedListener {
+ private AbstractPage m_page;
+
+ public PageDirtyListener(AbstractPage page) {
+ m_page = page;
+ }
+
+ @Override
+ public void handleEvent(int eventType, IType type) {
+ switch (eventType) {
+ case POST_TYPE_REMOVING:
+ case POST_TYPE_ADDING:
+ case POST_TYPE_CHANGED:
+ m_page.markStructureDirty();
+ break;
+ }
+ }
+
+ public void typeChanged(IType type, int eventType, IJavaElement modification) {
+ m_page.markStructureDirty();
+ }
+
+ public void innerTypeChanged(IType type, IType innerType, int eventType, IJavaElement modification) {
+ if (innerType != null && innerType.getDeclaringType() == type) {
+ m_page.markStructureDirty();
+ }
+ }
+
+ public void subTypeHierarchyChanged(IType type) {
+ m_page.markStructureDirty();
+ }
+
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/PageFilter.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/PageFilter.java
index 6a0ca9933..8c823df3b 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/PageFilter.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/PageFilter.java
@@ -1,107 +1,107 @@
-/*******************************************************************************
- * 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.view.outline.pages;
-
-import java.util.regex.Pattern;
-
-import org.eclipse.scout.commons.CompareUtility;
-import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.PageFilterExpressionPresenter;
-import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.PageFilterRegExPresenter;
-
-/**
- * filter the contents of a table page
- *
- * @see PageFilterExpressionPresenter
- * @see PageFilterRegExPresenter
- */
-public class PageFilter implements IPageFilter {
- private String m_filterExpression;
- private boolean m_regExFilter;
- // cache
- private Pattern m_patternInternal;
-
- public PageFilter() {
- createPattern();
- }
-
- @Override
- public String getFilterExpression() {
- return m_filterExpression;
- }
-
- public void setFilterExpression(String s) {
- if (s != null && s.trim().length() == 0) {
- s = null;
- }
- m_filterExpression = s;
- createPattern();
- }
-
- public boolean isRegExFilter() {
- return m_regExFilter;
- }
-
- public void setRegExFilter(boolean b) {
- m_regExFilter = b;
- createPattern();
- }
-
- private void createPattern() {
- String regex = getFilterExpression();
- if (regex != null) {
- regex = regex.toLowerCase();
- try {
- if (!isRegExFilter()) {
- if (!regex.endsWith("*")) {
- regex += "*";
- }
- regex = regex.replaceAll("\\?", ".").replaceAll("\\*", ".*");
- }
- // match
- if (!regex.endsWith("$")) {
- regex += ".*$";
- }
- m_patternInternal = Pattern.compile(regex);
- }
- catch (Exception e) {
- m_patternInternal = null;
- }
- }
- else {
- m_patternInternal = Pattern.compile(".*");
- }
- }
-
- @Override
- public boolean isEmpty() {
- return m_filterExpression == null;
- }
-
- @Override
- public boolean accept(IPage page) {
- return m_patternInternal == null || m_patternInternal.matcher(page.getName().toLowerCase()).matches();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj instanceof PageFilter) {
- PageFilter other = (PageFilter) obj;
- return this.m_regExFilter == other.m_regExFilter &&
- CompareUtility.equals(this.m_filterExpression, other.m_filterExpression);
- }
- return false;
- }
-
- @Override
- public int hashCode() {
- return 1;
- }
-}
+/*******************************************************************************
+ * 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.view.outline.pages;
+
+import java.util.regex.Pattern;
+
+import org.eclipse.scout.commons.CompareUtility;
+import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.PageFilterExpressionPresenter;
+import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.PageFilterRegExPresenter;
+
+/**
+ * filter the contents of a table page
+ *
+ * @see PageFilterExpressionPresenter
+ * @see PageFilterRegExPresenter
+ */
+public class PageFilter implements IPageFilter {
+ private String m_filterExpression;
+ private boolean m_regExFilter;
+ // cache
+ private Pattern m_patternInternal;
+
+ public PageFilter() {
+ createPattern();
+ }
+
+ @Override
+ public String getFilterExpression() {
+ return m_filterExpression;
+ }
+
+ public void setFilterExpression(String s) {
+ if (s != null && s.trim().length() == 0) {
+ s = null;
+ }
+ m_filterExpression = s;
+ createPattern();
+ }
+
+ public boolean isRegExFilter() {
+ return m_regExFilter;
+ }
+
+ public void setRegExFilter(boolean b) {
+ m_regExFilter = b;
+ createPattern();
+ }
+
+ private void createPattern() {
+ String regex = getFilterExpression();
+ if (regex != null) {
+ regex = regex.toLowerCase();
+ try {
+ if (!isRegExFilter()) {
+ if (!regex.endsWith("*")) {
+ regex += "*";
+ }
+ regex = regex.replaceAll("\\?", ".").replaceAll("\\*", ".*");
+ }
+ // match
+ if (!regex.endsWith("$")) {
+ regex += ".*$";
+ }
+ m_patternInternal = Pattern.compile(regex);
+ }
+ catch (Exception e) {
+ m_patternInternal = null;
+ }
+ }
+ else {
+ m_patternInternal = Pattern.compile(".*");
+ }
+ }
+
+ @Override
+ public boolean isEmpty() {
+ return m_filterExpression == null;
+ }
+
+ @Override
+ public boolean accept(IPage page) {
+ return m_patternInternal == null || m_patternInternal.matcher(page.getName().toLowerCase()).matches();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof PageFilter) {
+ PageFilter other = (PageFilter) obj;
+ return this.m_regExFilter == other.m_regExFilter &&
+ CompareUtility.equals(this.m_filterExpression, other.m_filterExpression);
+ }
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return 1;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/basic/beanproperty/BeanPropertyNodePage.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/basic/beanproperty/BeanPropertyNodePage.java
index 2d4b408f6..fb90f262c 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/basic/beanproperty/BeanPropertyNodePage.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/basic/beanproperty/BeanPropertyNodePage.java
@@ -1,91 +1,91 @@
-/*******************************************************************************
- * 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.view.outline.pages.basic.beanproperty;
-
-import org.eclipse.jdt.core.Flags;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.Signature;
-import org.eclipse.jdt.ui.ISharedImages;
-import org.eclipse.jdt.ui.JavaUI;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.scout.sdk.ui.action.IScoutHandler;
-import org.eclipse.scout.sdk.ui.action.delete.PropertyBeanDeleteAction;
-import org.eclipse.scout.sdk.ui.action.rename.PropertyBeansRenameAction;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.view.outline.pages.AbstractPage;
-import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
-import org.eclipse.scout.sdk.ui.view.outline.pages.IScoutPageConstants;
-import org.eclipse.scout.sdk.util.type.IPropertyBean;
-
-/**
- * <h3>BeanPropertyNodePage</h3> ...
- */
-public class BeanPropertyNodePage extends AbstractPage {
- private final IPropertyBean m_propertyDescriptor;
-
- public BeanPropertyNodePage(IPage parentPage, IPropertyBean propertyDescriptor) {
- m_propertyDescriptor = propertyDescriptor;
- setParent(parentPage);
- setName(getPropertyDescriptor().getBeanName() + " (" + Signature.getSignatureSimpleName(getPropertyDescriptor().getBeanSignature()) + ")");
- setImageDescriptor(ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Variable));
- }
-
- @Override
- public String getPageId() {
- return IScoutPageConstants.BEAN_PROPERTY_NODE_PAGE;
- }
-
- @Override
- public ImageDescriptor getBaseImageDescriptor() {
- ImageDescriptor imgDesc = JavaUI.getSharedImages().getImageDescriptor(ISharedImages.IMG_FIELD_DEFAULT);
- if (getPropertyDescriptor().getReadMethod() != null) {
- try {
- int flags = getPropertyDescriptor().getReadMethod().getFlags();
- if ((flags & Flags.AccPublic) != 0) {
- imgDesc = JavaUI.getSharedImages().getImageDescriptor(ISharedImages.IMG_OBJS_PUBLIC);
- }
- else if ((flags & Flags.AccProtected) != 0) {
- imgDesc = JavaUI.getSharedImages().getImageDescriptor(ISharedImages.IMG_OBJS_PROTECTED);
- }
- else if ((flags & Flags.AccDefault) != 0) {
- imgDesc = JavaUI.getSharedImages().getImageDescriptor(ISharedImages.IMG_OBJS_DEFAULT);
- }
- else if ((flags & Flags.AccPrivate) != 0) {
- imgDesc = JavaUI.getSharedImages().getImageDescriptor(ISharedImages.IMG_OBJS_PRIVATE);
- }
- }
- catch (JavaModelException e) {
- ScoutSdkUi.logWarning(e);
- }
- }
- return imgDesc;
- }
-
- public IPropertyBean getPropertyDescriptor() {
- return m_propertyDescriptor;
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public Class<? extends IScoutHandler>[] getSupportedMenuActions() {
- return new Class[]{PropertyBeansRenameAction.class, PropertyBeanDeleteAction.class};
- }
-
- @Override
- public void prepareMenuAction(IScoutHandler menu) {
- if (menu instanceof PropertyBeansRenameAction) {
- ((PropertyBeansRenameAction) menu).setPropertyBeanDescriptors(new IPropertyBean[]{getPropertyDescriptor()});
- }
- else if (menu instanceof PropertyBeanDeleteAction) {
- ((PropertyBeanDeleteAction) menu).setBeanDesc(getPropertyDescriptor());
- }
- }
-}
+/*******************************************************************************
+ * 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.view.outline.pages.basic.beanproperty;
+
+import org.eclipse.jdt.core.Flags;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.Signature;
+import org.eclipse.jdt.ui.ISharedImages;
+import org.eclipse.jdt.ui.JavaUI;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.scout.sdk.ui.action.IScoutHandler;
+import org.eclipse.scout.sdk.ui.action.delete.PropertyBeanDeleteAction;
+import org.eclipse.scout.sdk.ui.action.rename.PropertyBeansRenameAction;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.view.outline.pages.AbstractPage;
+import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
+import org.eclipse.scout.sdk.ui.view.outline.pages.IScoutPageConstants;
+import org.eclipse.scout.sdk.util.type.IPropertyBean;
+
+/**
+ * <h3>BeanPropertyNodePage</h3> ...
+ */
+public class BeanPropertyNodePage extends AbstractPage {
+ private final IPropertyBean m_propertyDescriptor;
+
+ public BeanPropertyNodePage(IPage parentPage, IPropertyBean propertyDescriptor) {
+ m_propertyDescriptor = propertyDescriptor;
+ setParent(parentPage);
+ setName(getPropertyDescriptor().getBeanName() + " (" + Signature.getSignatureSimpleName(getPropertyDescriptor().getBeanSignature()) + ")");
+ setImageDescriptor(ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Variable));
+ }
+
+ @Override
+ public String getPageId() {
+ return IScoutPageConstants.BEAN_PROPERTY_NODE_PAGE;
+ }
+
+ @Override
+ public ImageDescriptor getBaseImageDescriptor() {
+ ImageDescriptor imgDesc = JavaUI.getSharedImages().getImageDescriptor(ISharedImages.IMG_FIELD_DEFAULT);
+ if (getPropertyDescriptor().getReadMethod() != null) {
+ try {
+ int flags = getPropertyDescriptor().getReadMethod().getFlags();
+ if ((flags & Flags.AccPublic) != 0) {
+ imgDesc = JavaUI.getSharedImages().getImageDescriptor(ISharedImages.IMG_OBJS_PUBLIC);
+ }
+ else if ((flags & Flags.AccProtected) != 0) {
+ imgDesc = JavaUI.getSharedImages().getImageDescriptor(ISharedImages.IMG_OBJS_PROTECTED);
+ }
+ else if ((flags & Flags.AccDefault) != 0) {
+ imgDesc = JavaUI.getSharedImages().getImageDescriptor(ISharedImages.IMG_OBJS_DEFAULT);
+ }
+ else if ((flags & Flags.AccPrivate) != 0) {
+ imgDesc = JavaUI.getSharedImages().getImageDescriptor(ISharedImages.IMG_OBJS_PRIVATE);
+ }
+ }
+ catch (JavaModelException e) {
+ ScoutSdkUi.logWarning(e);
+ }
+ }
+ return imgDesc;
+ }
+
+ public IPropertyBean getPropertyDescriptor() {
+ return m_propertyDescriptor;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Class<? extends IScoutHandler>[] getSupportedMenuActions() {
+ return new Class[]{PropertyBeansRenameAction.class, PropertyBeanDeleteAction.class};
+ }
+
+ @Override
+ public void prepareMenuAction(IScoutHandler menu) {
+ if (menu instanceof PropertyBeansRenameAction) {
+ ((PropertyBeansRenameAction) menu).setPropertyBeanDescriptors(new IPropertyBean[]{getPropertyDescriptor()});
+ }
+ else if (menu instanceof PropertyBeanDeleteAction) {
+ ((PropertyBeanDeleteAction) menu).setBeanDesc(getPropertyDescriptor());
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/basic/beanproperty/BeanPropertyTablePage.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/basic/beanproperty/BeanPropertyTablePage.java
index f0ae1a606..6d1373360 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/basic/beanproperty/BeanPropertyTablePage.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/basic/beanproperty/BeanPropertyTablePage.java
@@ -1,103 +1,103 @@
-/*******************************************************************************
- * 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.view.outline.pages.basic.beanproperty;
-
-import org.eclipse.jdt.core.IAnnotatable;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.scout.sdk.RuntimeClasses;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.ui.action.IScoutHandler;
-import org.eclipse.scout.sdk.ui.action.create.BeanPropertyNewAction;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.view.outline.pages.AbstractPage;
-import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
-import org.eclipse.scout.sdk.ui.view.outline.pages.IScoutPageConstants;
-import org.eclipse.scout.sdk.util.jdt.IJavaResourceChangedListener;
-import org.eclipse.scout.sdk.util.jdt.JdtEvent;
-import org.eclipse.scout.sdk.util.jdt.JdtUtility;
-import org.eclipse.scout.sdk.util.type.IPropertyBean;
-import org.eclipse.scout.sdk.util.type.PropertyBeanComparators;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.util.typecache.TypeCacheAccessor;
-import org.eclipse.scout.sdk.workspace.type.ScoutPropertyBeanFilters;
-
-/**
- * <h3>BeanPropertyTablePage</h3> ...
- */
-public class BeanPropertyTablePage extends AbstractPage {
-
- private final IType m_declaringType;
- private P_MethodChangedListener m_methodChangedListener;
-
- public BeanPropertyTablePage(IPage parentPage, IType beanDeclaringType) {
- m_declaringType = beanDeclaringType;
- setName(Texts.get("BeanPropertyTablePage"));
- setParent(parentPage);
- setImageDescriptor(ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Variables));
- }
-
- @Override
- public void unloadPage() {
- if (m_methodChangedListener != null) {
- TypeCacheAccessor.getJavaResourceChangedEmitter().removeMethodChangedListener(getDeclaringType(), m_methodChangedListener);
- }
- super.unloadPage();
- }
-
- @Override
- public String getPageId() {
- return IScoutPageConstants.BEAN_PROPERTY_TABLE_PAGE;
- }
-
- @Override
- public boolean isFolder() {
- return true;
- }
-
- /**
- * @return the declaringType
- */
- public IType getDeclaringType() {
- return m_declaringType;
- }
-
- @Override
- public void loadChildrenImpl() {
- if (m_methodChangedListener == null) {
- m_methodChangedListener = new P_MethodChangedListener();
- TypeCacheAccessor.getJavaResourceChangedEmitter().addMethodChangedListener(getDeclaringType(), m_methodChangedListener);
- }
- IPropertyBean[] beans = TypeUtility.getPropertyBeans(getDeclaringType(), ScoutPropertyBeanFilters.getFormDataPropertyFilter(), PropertyBeanComparators.getNameComparator());
- for (IPropertyBean bean : beans) {
- new BeanPropertyNodePage(this, bean);
- }
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public Class<? extends IScoutHandler>[] getSupportedMenuActions() {
- return new Class[]{BeanPropertyNewAction.class};
- }
-
- @Override
- public void prepareMenuAction(IScoutHandler menu) {
- ((BeanPropertyNewAction) menu).setType(m_declaringType);
- }
-
- private class P_MethodChangedListener implements IJavaResourceChangedListener {
- @Override
- public void handleEvent(JdtEvent event) {
- if (JdtUtility.hasAnnotation((IAnnotatable) event.getElement(), RuntimeClasses.FormData)) {
- markStructureDirty();
- }
- }
- } // end class P_MethodChangedListener
-}
+/*******************************************************************************
+ * 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.view.outline.pages.basic.beanproperty;
+
+import org.eclipse.jdt.core.IAnnotatable;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.scout.sdk.RuntimeClasses;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.ui.action.IScoutHandler;
+import org.eclipse.scout.sdk.ui.action.create.BeanPropertyNewAction;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.view.outline.pages.AbstractPage;
+import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
+import org.eclipse.scout.sdk.ui.view.outline.pages.IScoutPageConstants;
+import org.eclipse.scout.sdk.util.jdt.IJavaResourceChangedListener;
+import org.eclipse.scout.sdk.util.jdt.JdtEvent;
+import org.eclipse.scout.sdk.util.jdt.JdtUtility;
+import org.eclipse.scout.sdk.util.type.IPropertyBean;
+import org.eclipse.scout.sdk.util.type.PropertyBeanComparators;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.util.typecache.TypeCacheAccessor;
+import org.eclipse.scout.sdk.workspace.type.ScoutPropertyBeanFilters;
+
+/**
+ * <h3>BeanPropertyTablePage</h3> ...
+ */
+public class BeanPropertyTablePage extends AbstractPage {
+
+ private final IType m_declaringType;
+ private P_MethodChangedListener m_methodChangedListener;
+
+ public BeanPropertyTablePage(IPage parentPage, IType beanDeclaringType) {
+ m_declaringType = beanDeclaringType;
+ setName(Texts.get("BeanPropertyTablePage"));
+ setParent(parentPage);
+ setImageDescriptor(ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Variables));
+ }
+
+ @Override
+ public void unloadPage() {
+ if (m_methodChangedListener != null) {
+ TypeCacheAccessor.getJavaResourceChangedEmitter().removeMethodChangedListener(getDeclaringType(), m_methodChangedListener);
+ }
+ super.unloadPage();
+ }
+
+ @Override
+ public String getPageId() {
+ return IScoutPageConstants.BEAN_PROPERTY_TABLE_PAGE;
+ }
+
+ @Override
+ public boolean isFolder() {
+ return true;
+ }
+
+ /**
+ * @return the declaringType
+ */
+ public IType getDeclaringType() {
+ return m_declaringType;
+ }
+
+ @Override
+ public void loadChildrenImpl() {
+ if (m_methodChangedListener == null) {
+ m_methodChangedListener = new P_MethodChangedListener();
+ TypeCacheAccessor.getJavaResourceChangedEmitter().addMethodChangedListener(getDeclaringType(), m_methodChangedListener);
+ }
+ IPropertyBean[] beans = TypeUtility.getPropertyBeans(getDeclaringType(), ScoutPropertyBeanFilters.getFormDataPropertyFilter(), PropertyBeanComparators.getNameComparator());
+ for (IPropertyBean bean : beans) {
+ new BeanPropertyNodePage(this, bean);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Class<? extends IScoutHandler>[] getSupportedMenuActions() {
+ return new Class[]{BeanPropertyNewAction.class};
+ }
+
+ @Override
+ public void prepareMenuAction(IScoutHandler menu) {
+ ((BeanPropertyNewAction) menu).setType(m_declaringType);
+ }
+
+ private class P_MethodChangedListener implements IJavaResourceChangedListener {
+ @Override
+ public void handleEvent(JdtEvent event) {
+ if (JdtUtility.hasAnnotation((IAnnotatable) event.getElement(), RuntimeClasses.FormData)) {
+ markStructureDirty();
+ }
+ }
+ } // end class P_MethodChangedListener
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/project/IProjectNodePage.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/project/IProjectNodePage.java
index 3826dd388..74e0a770a 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/project/IProjectNodePage.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/project/IProjectNodePage.java
@@ -1,21 +1,21 @@
-/*******************************************************************************
- * 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.view.outline.pages.project;
-
-import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
-import org.eclipse.scout.sdk.workspace.IScoutProject;
-
-public interface IProjectNodePage extends IPage {
-
- @Override
- IScoutProject getScoutResource();
-
-}
+/*******************************************************************************
+ * 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.view.outline.pages.project;
+
+import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
+import org.eclipse.scout.sdk.workspace.IScoutProject;
+
+public interface IProjectNodePage extends IPage {
+
+ @Override
+ IScoutProject getScoutResource();
+
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/project/client/ui/form/field/AbstractFormFieldNodePage.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/project/client/ui/form/field/AbstractFormFieldNodePage.java
index 75fbfb763..e2a68f320 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/project/client/ui/form/field/AbstractFormFieldNodePage.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/project/client/ui/form/field/AbstractFormFieldNodePage.java
@@ -1,63 +1,63 @@
-/*******************************************************************************
- * 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.view.outline.pages.project.client.ui.form.field;
-
-import org.eclipse.scout.sdk.ui.action.FormDataUpdateAction;
-import org.eclipse.scout.sdk.ui.action.IScoutHandler;
-import org.eclipse.scout.sdk.ui.action.ShowJavaReferencesAction;
-import org.eclipse.scout.sdk.ui.action.create.CreateTemplateAction;
-import org.eclipse.scout.sdk.ui.action.delete.FormFieldDeleteAction;
-import org.eclipse.scout.sdk.ui.action.rename.FormFieldRenameAction;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.view.outline.pages.AbstractScoutTypePage;
-import org.eclipse.scout.sdk.util.SdkProperties;
-
-public abstract class AbstractFormFieldNodePage extends AbstractScoutTypePage {
-
- public AbstractFormFieldNodePage() {
- setImageDescriptor(ScoutSdkUi.getImageDescriptor(ScoutSdkUi.FormField));
- }
-
- @Override
- protected String getMethodNameForTranslatedText() {
- return "getConfiguredLabel";
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public Class<? extends IScoutHandler>[] getSupportedMenuActions() {
- return new Class[]{ShowJavaReferencesAction.class, FormDataUpdateAction.class,
- CreateTemplateAction.class, FormFieldRenameAction.class, FormFieldDeleteAction.class};
- }
-
- @Override
- public void prepareMenuAction(IScoutHandler menu) {
- super.prepareMenuAction(menu);
- if (menu instanceof FormDataUpdateAction) {
- ((FormDataUpdateAction) menu).setType(getType());
- }
- else if (menu instanceof CreateTemplateAction) {
- CreateTemplateAction action = (CreateTemplateAction) menu;
- action.setPage(this);
- action.setType(getType());
- }
- else if (menu instanceof FormFieldRenameAction) {
- FormFieldRenameAction a = (FormFieldRenameAction) menu;
- a.setFormField(getType());
- a.setOldName(getType().getElementName());
- a.setReadOnlySuffix(SdkProperties.SUFFIX_FORM_FIELD);
- }
- else if (menu instanceof FormFieldDeleteAction) {
- FormFieldDeleteAction action = (FormFieldDeleteAction) menu;
- action.addFormFieldType(getType());
- }
- }
-}
+/*******************************************************************************
+ * 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.view.outline.pages.project.client.ui.form.field;
+
+import org.eclipse.scout.sdk.ui.action.FormDataUpdateAction;
+import org.eclipse.scout.sdk.ui.action.IScoutHandler;
+import org.eclipse.scout.sdk.ui.action.ShowJavaReferencesAction;
+import org.eclipse.scout.sdk.ui.action.create.CreateTemplateAction;
+import org.eclipse.scout.sdk.ui.action.delete.FormFieldDeleteAction;
+import org.eclipse.scout.sdk.ui.action.rename.FormFieldRenameAction;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.view.outline.pages.AbstractScoutTypePage;
+import org.eclipse.scout.sdk.util.SdkProperties;
+
+public abstract class AbstractFormFieldNodePage extends AbstractScoutTypePage {
+
+ public AbstractFormFieldNodePage() {
+ setImageDescriptor(ScoutSdkUi.getImageDescriptor(ScoutSdkUi.FormField));
+ }
+
+ @Override
+ protected String getMethodNameForTranslatedText() {
+ return "getConfiguredLabel";
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Class<? extends IScoutHandler>[] getSupportedMenuActions() {
+ return new Class[]{ShowJavaReferencesAction.class, FormDataUpdateAction.class,
+ CreateTemplateAction.class, FormFieldRenameAction.class, FormFieldDeleteAction.class};
+ }
+
+ @Override
+ public void prepareMenuAction(IScoutHandler menu) {
+ super.prepareMenuAction(menu);
+ if (menu instanceof FormDataUpdateAction) {
+ ((FormDataUpdateAction) menu).setType(getType());
+ }
+ else if (menu instanceof CreateTemplateAction) {
+ CreateTemplateAction action = (CreateTemplateAction) menu;
+ action.setPage(this);
+ action.setType(getType());
+ }
+ else if (menu instanceof FormFieldRenameAction) {
+ FormFieldRenameAction a = (FormFieldRenameAction) menu;
+ a.setFormField(getType());
+ a.setOldName(getType().getElementName());
+ a.setReadOnlySuffix(SdkProperties.SUFFIX_FORM_FIELD);
+ }
+ else if (menu instanceof FormFieldDeleteAction) {
+ FormFieldDeleteAction action = (FormFieldDeleteAction) menu;
+ action.addFormFieldType(getType());
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/project/server/service/AbstractServiceNodePage.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/project/server/service/AbstractServiceNodePage.java
index 715e8d086..fdf2fd9c9 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/project/server/service/AbstractServiceNodePage.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/outline/pages/project/server/service/AbstractServiceNodePage.java
@@ -1,133 +1,133 @@
-/*******************************************************************************
- * 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.view.outline.pages.project.server.service;
-
-import java.util.TreeMap;
-
-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.scout.sdk.ui.action.IScoutHandler;
-import org.eclipse.scout.sdk.ui.action.ShowJavaReferencesAction;
-import org.eclipse.scout.sdk.ui.action.create.ServiceOperationNewAction;
-import org.eclipse.scout.sdk.ui.action.rename.ServiceRenameAction;
-import org.eclipse.scout.sdk.ui.action.validation.FormDataSqlBindingValidateAction;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.internal.view.outline.pages.project.server.service.ServiceOperationNodePage;
-import org.eclipse.scout.sdk.ui.view.outline.pages.AbstractPage;
-import org.eclipse.scout.sdk.ui.view.outline.pages.AbstractScoutTypePage;
-import org.eclipse.scout.sdk.util.jdt.IJavaResourceChangedListener;
-import org.eclipse.scout.sdk.util.jdt.JdtEvent;
-import org.eclipse.scout.sdk.util.signature.SignatureUtility;
-import org.eclipse.scout.sdk.util.type.MethodComparators;
-import org.eclipse.scout.sdk.util.type.MethodFilters;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.util.typecache.TypeCacheAccessor;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-
-/**
- * Page representing a service implementation
- */
-public abstract class AbstractServiceNodePage extends AbstractScoutTypePage {
-
- private final IType m_interfaceType;
- private final String m_readOnlySuffix;
- private P_ServiceMethodsListener m_serviceMethodListener;
-
- /**
- * server bundle
- */
- @Override
- public IScoutBundle getScoutResource() {
- return (IScoutBundle) super.getScoutResource();
- }
-
- public AbstractServiceNodePage(AbstractPage parent, IType type, IType interfaceType, String readOnlySuffix) {
- setParent(parent);
- setType(type);
- m_interfaceType = interfaceType;
- setImageDescriptor(ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Service));
- m_readOnlySuffix = readOnlySuffix;
- }
-
- @Override
- public void unloadPage() {
- if (m_serviceMethodListener != null) {
- TypeCacheAccessor.getJavaResourceChangedEmitter().removeMethodChangedListener(getType(), m_serviceMethodListener);
- m_serviceMethodListener = null;
- }
- super.unloadPage();
- }
-
- @Override
- public void loadChildrenImpl() {
- if (m_interfaceType == null) {
- return;
- }
- if (m_serviceMethodListener == null) {
- m_serviceMethodListener = new P_ServiceMethodsListener();
- TypeCacheAccessor.getJavaResourceChangedEmitter().addMethodChangedListener(getType(), m_serviceMethodListener);
- }
- IMethod[] serviceMethods = TypeUtility.getMethods(getType(), MethodFilters.getFlagsFilter(Flags.AccPublic), MethodComparators.getNameComparator());
-
- try {
- TreeMap<String, IMethod> interfaceMethodsMap = new TreeMap<String, IMethod>();
- if (TypeUtility.exists(getInterfaceType())) {
- for (IMethod m : TypeUtility.getMethods(getInterfaceType(), MethodFilters.getFlagsFilter(Flags.AccPublic | Flags.AccDefault), MethodComparators.getNameComparator())) {
- interfaceMethodsMap.put(SignatureUtility.getMethodIdentifier(m), m);
- }
- }
-
- for (IMethod implMethod : serviceMethods) {
- new ServiceOperationNodePage(this, interfaceMethodsMap.get(SignatureUtility.getMethodIdentifier(implMethod)), implMethod);
- }
- }
- catch (CoreException e) {
- ScoutSdkUi.logError(e);
- }
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public Class<? extends IScoutHandler>[] getSupportedMenuActions() {
- return new Class[]{ServiceRenameAction.class, ShowJavaReferencesAction.class, FormDataSqlBindingValidateAction.class, ServiceOperationNewAction.class};
- }
-
- @Override
- public void prepareMenuAction(IScoutHandler menu) {
- super.prepareMenuAction(menu);
- if (menu instanceof ServiceRenameAction) {
- ServiceRenameAction sra = (ServiceRenameAction) menu;
- sra.setServiceImplementation(getType());
- sra.setServiceInterface(getInterfaceType());
- sra.setReadOnlySuffix(m_readOnlySuffix);
- sra.setOldName(getType().getElementName());
- }
- else if (menu instanceof FormDataSqlBindingValidateAction) {
- ((FormDataSqlBindingValidateAction) menu).setServices(getType());
- }
- else if (menu instanceof ServiceOperationNewAction) {
- ((ServiceOperationNewAction) menu).init(getInterfaceType(), getType());
- }
- }
-
- public IType getInterfaceType() {
- return m_interfaceType;
- }
-
- private class P_ServiceMethodsListener implements IJavaResourceChangedListener {
- @Override
- public void handleEvent(JdtEvent event) {
- markStructureDirty();
- }
- }
-}
+/*******************************************************************************
+ * 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.view.outline.pages.project.server.service;
+
+import java.util.TreeMap;
+
+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.scout.sdk.ui.action.IScoutHandler;
+import org.eclipse.scout.sdk.ui.action.ShowJavaReferencesAction;
+import org.eclipse.scout.sdk.ui.action.create.ServiceOperationNewAction;
+import org.eclipse.scout.sdk.ui.action.rename.ServiceRenameAction;
+import org.eclipse.scout.sdk.ui.action.validation.FormDataSqlBindingValidateAction;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.internal.view.outline.pages.project.server.service.ServiceOperationNodePage;
+import org.eclipse.scout.sdk.ui.view.outline.pages.AbstractPage;
+import org.eclipse.scout.sdk.ui.view.outline.pages.AbstractScoutTypePage;
+import org.eclipse.scout.sdk.util.jdt.IJavaResourceChangedListener;
+import org.eclipse.scout.sdk.util.jdt.JdtEvent;
+import org.eclipse.scout.sdk.util.signature.SignatureUtility;
+import org.eclipse.scout.sdk.util.type.MethodComparators;
+import org.eclipse.scout.sdk.util.type.MethodFilters;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.util.typecache.TypeCacheAccessor;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+
+/**
+ * Page representing a service implementation
+ */
+public abstract class AbstractServiceNodePage extends AbstractScoutTypePage {
+
+ private final IType m_interfaceType;
+ private final String m_readOnlySuffix;
+ private P_ServiceMethodsListener m_serviceMethodListener;
+
+ /**
+ * server bundle
+ */
+ @Override
+ public IScoutBundle getScoutResource() {
+ return (IScoutBundle) super.getScoutResource();
+ }
+
+ public AbstractServiceNodePage(AbstractPage parent, IType type, IType interfaceType, String readOnlySuffix) {
+ setParent(parent);
+ setType(type);
+ m_interfaceType = interfaceType;
+ setImageDescriptor(ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Service));
+ m_readOnlySuffix = readOnlySuffix;
+ }
+
+ @Override
+ public void unloadPage() {
+ if (m_serviceMethodListener != null) {
+ TypeCacheAccessor.getJavaResourceChangedEmitter().removeMethodChangedListener(getType(), m_serviceMethodListener);
+ m_serviceMethodListener = null;
+ }
+ super.unloadPage();
+ }
+
+ @Override
+ public void loadChildrenImpl() {
+ if (m_interfaceType == null) {
+ return;
+ }
+ if (m_serviceMethodListener == null) {
+ m_serviceMethodListener = new P_ServiceMethodsListener();
+ TypeCacheAccessor.getJavaResourceChangedEmitter().addMethodChangedListener(getType(), m_serviceMethodListener);
+ }
+ IMethod[] serviceMethods = TypeUtility.getMethods(getType(), MethodFilters.getFlagsFilter(Flags.AccPublic), MethodComparators.getNameComparator());
+
+ try {
+ TreeMap<String, IMethod> interfaceMethodsMap = new TreeMap<String, IMethod>();
+ if (TypeUtility.exists(getInterfaceType())) {
+ for (IMethod m : TypeUtility.getMethods(getInterfaceType(), MethodFilters.getFlagsFilter(Flags.AccPublic | Flags.AccDefault), MethodComparators.getNameComparator())) {
+ interfaceMethodsMap.put(SignatureUtility.getMethodIdentifier(m), m);
+ }
+ }
+
+ for (IMethod implMethod : serviceMethods) {
+ new ServiceOperationNodePage(this, interfaceMethodsMap.get(SignatureUtility.getMethodIdentifier(implMethod)), implMethod);
+ }
+ }
+ catch (CoreException e) {
+ ScoutSdkUi.logError(e);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Class<? extends IScoutHandler>[] getSupportedMenuActions() {
+ return new Class[]{ServiceRenameAction.class, ShowJavaReferencesAction.class, FormDataSqlBindingValidateAction.class, ServiceOperationNewAction.class};
+ }
+
+ @Override
+ public void prepareMenuAction(IScoutHandler menu) {
+ super.prepareMenuAction(menu);
+ if (menu instanceof ServiceRenameAction) {
+ ServiceRenameAction sra = (ServiceRenameAction) menu;
+ sra.setServiceImplementation(getType());
+ sra.setServiceInterface(getInterfaceType());
+ sra.setReadOnlySuffix(m_readOnlySuffix);
+ sra.setOldName(getType().getElementName());
+ }
+ else if (menu instanceof FormDataSqlBindingValidateAction) {
+ ((FormDataSqlBindingValidateAction) menu).setServices(getType());
+ }
+ else if (menu instanceof ServiceOperationNewAction) {
+ ((ServiceOperationNewAction) menu).init(getInterfaceType(), getType());
+ }
+ }
+
+ public IType getInterfaceType() {
+ return m_interfaceType;
+ }
+
+ private class P_ServiceMethodsListener implements IJavaResourceChangedListener {
+ @Override
+ public void handleEvent(JdtEvent event) {
+ markStructureDirty();
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/AbstractPropertyPageSection.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/AbstractPropertyPageSection.java
index ea1c77b28..2be7577bc 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/AbstractPropertyPageSection.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/AbstractPropertyPageSection.java
@@ -1,73 +1,73 @@
-/*******************************************************************************
- * 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.view.properties;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-public abstract class AbstractPropertyPageSection implements IPropertyPageSection {
- private String m_name;
- private String m_desc;
- private int m_logicalHeight = 1;
- private boolean m_expanded = true;
- private ArrayList<Object> m_properties = new ArrayList<Object>();
-
- public AbstractPropertyPageSection(String name, String description, int logicalHeight) {
- m_name = name;
- m_desc = description;
- m_logicalHeight = logicalHeight;
- }
-
- @Override
- public String getName() {
- return m_name;
- }
-
- @Override
- public String getDescription() {
- return m_desc;
- }
-
- @Override
- public int getLogicalHeight() {
- return m_logicalHeight;
- }
-
- /**
- * @return read only list of attributes, list may be modified by caller
- */
- @Override
- public List<Object> getProperties() {
- return Collections.unmodifiableList(m_properties);
- }
-
- @Override
- public int getPropertyCount() {
- return m_properties.size();
- }
-
- @Override
- public void addProperty(Object p) {
- m_properties.add(p);
- }
-
- @Override
- public boolean isExpanded() {
- return m_expanded;
- }
-
- @Override
- public void setExpanded(boolean expanded) {
- m_expanded = expanded;
- }
-
-}
+/*******************************************************************************
+ * 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.view.properties;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+public abstract class AbstractPropertyPageSection implements IPropertyPageSection {
+ private String m_name;
+ private String m_desc;
+ private int m_logicalHeight = 1;
+ private boolean m_expanded = true;
+ private ArrayList<Object> m_properties = new ArrayList<Object>();
+
+ public AbstractPropertyPageSection(String name, String description, int logicalHeight) {
+ m_name = name;
+ m_desc = description;
+ m_logicalHeight = logicalHeight;
+ }
+
+ @Override
+ public String getName() {
+ return m_name;
+ }
+
+ @Override
+ public String getDescription() {
+ return m_desc;
+ }
+
+ @Override
+ public int getLogicalHeight() {
+ return m_logicalHeight;
+ }
+
+ /**
+ * @return read only list of attributes, list may be modified by caller
+ */
+ @Override
+ public List<Object> getProperties() {
+ return Collections.unmodifiableList(m_properties);
+ }
+
+ @Override
+ public int getPropertyCount() {
+ return m_properties.size();
+ }
+
+ @Override
+ public void addProperty(Object p) {
+ m_properties.add(p);
+ }
+
+ @Override
+ public boolean isExpanded() {
+ return m_expanded;
+ }
+
+ @Override
+ public void setExpanded(boolean expanded) {
+ m_expanded = expanded;
+ }
+
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/IPropertyPageSection.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/IPropertyPageSection.java
index fa813133b..3b0b2e357 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/IPropertyPageSection.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/IPropertyPageSection.java
@@ -1,36 +1,36 @@
-/*******************************************************************************
- * 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.view.properties;
-
-import java.util.List;
-
-public interface IPropertyPageSection {
-
- String getName();
-
- String getDescription();
-
- int getLogicalHeight();
-
- /**
- * @return read only list of attributes, list may be modified by caller
- */
- List<Object> getProperties();
-
- int getPropertyCount();
-
- void addProperty(Object p);
-
- boolean isExpanded();
-
- void setExpanded(boolean expanded);
-
-}
+/*******************************************************************************
+ * 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.view.properties;
+
+import java.util.List;
+
+public interface IPropertyPageSection {
+
+ String getName();
+
+ String getDescription();
+
+ int getLogicalHeight();
+
+ /**
+ * @return read only list of attributes, list may be modified by caller
+ */
+ List<Object> getProperties();
+
+ int getPropertyCount();
+
+ void addProperty(Object p);
+
+ boolean isExpanded();
+
+ void setExpanded(boolean expanded);
+
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/PropertyViewFormToolkit.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/PropertyViewFormToolkit.java
index 6a701c885..27224db0c 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/PropertyViewFormToolkit.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/PropertyViewFormToolkit.java
@@ -1,64 +1,64 @@
-/*******************************************************************************
- * 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.view.properties;
-
-import org.eclipse.scout.sdk.ui.fields.FieldToolkit;
-import org.eclipse.scout.sdk.ui.fields.proposal.ProposalTextField;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-
-/**
- * <h3>{@link PropertyViewFormToolkit}</h3> ...
- *
- * @author Andreas Hoegger
- * @since 3.8.0 12.02.2012
- */
-public class PropertyViewFormToolkit extends FormToolkit {
-
- private FieldToolkit m_fieldToolkit;
-
- /**
- * @param display
- */
- public PropertyViewFormToolkit(Display display) {
- super(display);
- m_fieldToolkit = new FieldToolkit();
- }
-
- public ProposalTextField createProposalField(Composite parent, int style) {
- return createProposalField(parent, null, style);
- }
-
- /**
- * @param parent
- * @param label
- * @return
- * @see org.eclipse.scout.sdk.ui.fields.FieldToolkit#createProposalField(org.eclipse.swt.widgets.Composite,
- * java.lang.String)
- */
- public ProposalTextField createProposalField(Composite parent, String label) {
- return m_fieldToolkit.createProposalField(parent, label);
- }
-
- /**
- * @param parent
- * @param label
- * @param style
- * @return
- * @see org.eclipse.scout.sdk.ui.fields.FieldToolkit#createProposalField(org.eclipse.swt.widgets.Composite,
- * java.lang.String, int)
- */
- public ProposalTextField createProposalField(Composite parent, String label, int style) {
- return m_fieldToolkit.createProposalField(parent, label, style);
- }
-
-}
+/*******************************************************************************
+ * 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.view.properties;
+
+import org.eclipse.scout.sdk.ui.fields.FieldToolkit;
+import org.eclipse.scout.sdk.ui.fields.proposal.ProposalTextField;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+
+/**
+ * <h3>{@link PropertyViewFormToolkit}</h3> ...
+ *
+ * @author Andreas Hoegger
+ * @since 3.8.0 12.02.2012
+ */
+public class PropertyViewFormToolkit extends FormToolkit {
+
+ private FieldToolkit m_fieldToolkit;
+
+ /**
+ * @param display
+ */
+ public PropertyViewFormToolkit(Display display) {
+ super(display);
+ m_fieldToolkit = new FieldToolkit();
+ }
+
+ public ProposalTextField createProposalField(Composite parent, int style) {
+ return createProposalField(parent, null, style);
+ }
+
+ /**
+ * @param parent
+ * @param label
+ * @return
+ * @see org.eclipse.scout.sdk.ui.fields.FieldToolkit#createProposalField(org.eclipse.swt.widgets.Composite,
+ * java.lang.String)
+ */
+ public ProposalTextField createProposalField(Composite parent, String label) {
+ return m_fieldToolkit.createProposalField(parent, label);
+ }
+
+ /**
+ * @param parent
+ * @param label
+ * @param style
+ * @return
+ * @see org.eclipse.scout.sdk.ui.fields.FieldToolkit#createProposalField(org.eclipse.swt.widgets.Composite,
+ * java.lang.String, int)
+ */
+ public ProposalTextField createProposalField(Composite parent, String label, int style) {
+ return m_fieldToolkit.createProposalField(parent, label, style);
+ }
+
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/AbstractSectionBasedPart.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/AbstractSectionBasedPart.java
index 80964b0f1..8faea7e7a 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/AbstractSectionBasedPart.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/AbstractSectionBasedPart.java
@@ -1,321 +1,321 @@
-/*******************************************************************************
- * 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.view.properties.part;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.sdk.ui.extensions.view.property.IPropertyViewPart;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.util.TableWrapLayoutEx;
-import org.eclipse.scout.sdk.ui.view.properties.PropertyViewFormToolkit;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.forms.widgets.ScrolledForm;
-
-/**
- * <h3>AbstractSectionBasedPart</h3> ...
- *
- * @author Andreas Hoegger
- * @since 1.0.8 20.07.2010
- */
-public abstract class AbstractSectionBasedPart implements IPropertyViewPart {
-
- private PropertyViewFormToolkit m_formToolkit;
- private ScrolledForm m_form;
- private HashMap<String, Section> m_sections;
- private Composite m_sectionContainer;
- private ArrayList<IStatus> m_stati;
- private Label m_statusIcon;
- private Label m_statusText;
- private Composite m_statusArea;
-
- public AbstractSectionBasedPart() {
- m_stati = new ArrayList<IStatus>();
- }
-
- @Override
- public final void createPart(Composite parent) {
- init();
- m_formToolkit = new PropertyViewFormToolkit(parent.getDisplay());
- m_form = m_formToolkit.createScrolledForm(parent);
- try {
- m_form.setRedraw(false);
- m_form.setDelayedReflow(true);
- //m_form.setText(Texts.get("Properties"));
- createHeadInternal(m_form);
-
- // sections
- Composite formBody = m_form.getBody();
-
- // root pane is used in order of layout errors in TableWrapLayout with scroll bars.
- m_sectionContainer = getFormToolkit().createComposite(formBody);
- formBody.setLayout(new FillLayout());
- TableWrapLayoutEx layout = new TableWrapLayoutEx();
- layout.makeColumnsEqualWidth = true;
- layout.numColumns = 1;
- layout.horizontalSpacing = 3;
- layout.verticalSpacing = 3;
- layout.rightMargin = 3;
- layout.leftMargin = 3;
- layout.topMargin = 3;
- layout.bottomMargin = 3;
- m_sectionContainer.setLayout(layout);
-
- // create sections
- m_sections = new HashMap<String, Section>();
- createSections();
-
- m_form.updateToolBar();
- m_form.reflow(true);
- }
- finally {
- m_form.setRedraw(true);
- }
- }
-
- @Override
- public void init(IMemento memento) {
- }
-
- @Override
- public void save(IMemento memento) {
- }
-
- @Override
- public final void dispose() {
- cleanup();
- getFormToolkit().dispose();
- getForm().dispose();
- }
-
- private void createHeadInternal(ScrolledForm form) {
- Composite headComposite = getFormToolkit().createComposite(m_form.getForm().getHead());
- headComposite.setBackground(headComposite.getDisplay().getSystemColor(SWT.COLOR_BLUE));
- Control head = createHead(headComposite);
- Control statusArea = createStatusControl(headComposite);
- m_form.setHeadClient(headComposite);
-
- // layout
- GridLayout layout = new GridLayout(1, true);
- layout.horizontalSpacing = 0;
- layout.verticalSpacing = 0;
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- headComposite.setLayout(layout);
- head.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_BOTH));
- GridData statusData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_BOTH);
- statusArea.setLayoutData(statusData);
- updateStatus();
- }
-
- private Control createStatusControl(Composite parent) {
- m_statusArea = getFormToolkit().createComposite(parent);
- m_statusIcon = getFormToolkit().createLabel(m_statusArea, "");
- m_statusText = getFormToolkit().createLabel(m_statusArea, "", SWT.LEFT);
-
- // layout
- m_statusArea.setLayout(new GridLayout(2, false));
- m_statusIcon.setLayoutData(new GridData(GridData.FILL_VERTICAL));
- m_statusText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_BOTH));
- return m_statusArea;
- }
-
- protected Control createHead(Composite parent) {
- Composite headArea = getFormToolkit().createComposite(parent);
- Label title = getFormToolkit().createLabel(headArea, "", SWT.WRAP | SWT.READ_ONLY);
- // layout
- headArea.setLayout(new GridLayout(1, true));
- GridData titleData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL);
- titleData.widthHint = 100;
- title.setLayoutData(titleData);
- return headArea;
- }
-
- protected void createSections() {
- }
-
- protected final Section[] getSections() {
- return m_sections.values().toArray(new Section[m_sections.values().size()]);
- }
-
- public ISection getSection(String sectionId) {
- Section section = m_sections.get(sectionId);
- return section;
- }
-
- public final void removeSection(String sectionId) {
- Section section = m_sections.remove(sectionId);
- if (section != null && !section.isDisposed()) {
- section.getUiSection().dispose();
- }
- }
-
- /**
- * @param sectionId
- * an identifier to access the section with {@link AbstractSectionBasedPart#getSection(String)}
- * @param title
- * the title of the section
- * @return the section - create controls with the sections client {@link ISection#getSectionClient()} as parent
- */
- protected final ISection createSection(String sectionId, String title) {
- return createSection(sectionId, title, null, true);
- }
-
- /**
- * @param sectionId
- * an identifier to access the section with {@link AbstractSectionBasedPart#getSection(String)}
- * @param title
- * the title of the section
- * @param description
- * the description of the section. If null or empty the section will not have a description part.
- * @param twistle
- * true to ensure the section is collapsable
- * @return the section - create controls with the sections client {@link ISection#getSectionClient()} as parent
- */
- protected final ISection createSection(String sectionId, String title, String description, boolean twistle) {
- return createSection(sectionId, title, description, twistle, null);
- }
-
- /**
- * @param sectionId
- * an identifier to access the section with {@link AbstractSectionBasedPart#getSection(String)}
- * @param title
- * the title of the section.
- * @param description
- * the description of the section. If null or empty the section will not have a description part.
- * @param twistle
- * true to ensure the section is collapsable.
- * @param siblingSectionId
- * an section id to insert the new section before the sibling section. null to append at the end.
- * @return the section - create controls with the sections client {@link ISection#getSectionClient()} as parent
- */
- protected final ISection createSection(String sectionId, String title, String description, boolean twistle, String siblingSectionId) {
- Section section = m_sections.get(sectionId);
- if (section == null) {
- int style = org.eclipse.ui.forms.widgets.Section.TITLE_BAR | org.eclipse.ui.forms.widgets.Section.EXPANDED;
- if (twistle) {
- style |= org.eclipse.ui.forms.widgets.Section.TWISTIE;
- }
- boolean hasDescription = !StringUtility.isNullOrEmpty(description);
- if (hasDescription) {
- style = style | org.eclipse.ui.forms.widgets.Section.DESCRIPTION;
- }
- Section sibling = null;
- // sibling
- if (siblingSectionId != null) {
- sibling = m_sections.get(siblingSectionId);
- }
- section = new Section(sectionId, getForm());
- section.createSection(getFormToolkit(), m_sectionContainer, title, description, style, sibling);
- m_sections.put(sectionId, section);
- }
- return section;
- }
-
- public void addStatus(IStatus status) {
- m_stati.add(status);
- updateStatus();
- }
-
- public boolean removeStatus(IStatus status) {
- boolean removed = m_stati.remove(status);
- updateStatus();
- return removed;
- }
-
- private void updateStatus() {
- if (getForm() != null && !getForm().isDisposed()) {
- MultiStatus multiStatus = new MultiStatus(ScoutSdkUi.PLUGIN_ID, -1, null, null);
- for (IStatus s : m_stati) {
- multiStatus.add(s);
- }
- IStatus status = getHighestSeverityStatus(multiStatus, Status.OK_STATUS);
- if (status == Status.OK_STATUS) {
- status = null;
- }
-
- GridData ld = (GridData) m_statusArea.getLayoutData();
- if (status == null) {
- ld.exclude = true;
- }
- else {
- ld.exclude = false;
- Image img = null;
- switch (status.getSeverity()) {
- case IStatus.ERROR:
- img = ScoutSdkUi.getImage(ScoutSdkUi.StatusError);
- break;
- case IStatus.WARNING:
- img = ScoutSdkUi.getImage(ScoutSdkUi.StatusWarning);
- break;
- case IStatus.INFO:
- img = ScoutSdkUi.getImage(ScoutSdkUi.StatusInfo);
- break;
- }
- m_statusIcon.setImage(img);
- m_statusText.setText(status.getMessage());
- }
- getForm().reflow(true);
-// m_sectionContainer.layout(true, true);
- }
-
- }
-
- private IStatus getHighestSeverityStatus(IStatus status, IStatus highestSeverity) {
- if (status.isMultiStatus()) {
- for (IStatus child : status.getChildren()) {
- highestSeverity = getHighestSeverityStatus(child, highestSeverity);
- }
- return highestSeverity;
- }
- else {
- if (highestSeverity.getSeverity() < status.getSeverity()) {
- highestSeverity = status;
- }
- return highestSeverity;
- }
- }
-
- /**
- * @return the form
- */
- public ScrolledForm getForm() {
- return m_form;
- }
-
- protected PropertyViewFormToolkit getFormToolkit() {
- return m_formToolkit;
- }
-
- /**
- * Is called before the sections are created to do some initialization work.
- */
- protected void init() {
- }
-
- /**
- * Is called to release resources or unregister from listeners.
- */
- protected void cleanup() {
- }
-}
+/*******************************************************************************
+ * 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.view.properties.part;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.sdk.ui.extensions.view.property.IPropertyViewPart;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.util.TableWrapLayoutEx;
+import org.eclipse.scout.sdk.ui.view.properties.PropertyViewFormToolkit;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
+
+/**
+ * <h3>AbstractSectionBasedPart</h3> ...
+ *
+ * @author Andreas Hoegger
+ * @since 1.0.8 20.07.2010
+ */
+public abstract class AbstractSectionBasedPart implements IPropertyViewPart {
+
+ private PropertyViewFormToolkit m_formToolkit;
+ private ScrolledForm m_form;
+ private HashMap<String, Section> m_sections;
+ private Composite m_sectionContainer;
+ private ArrayList<IStatus> m_stati;
+ private Label m_statusIcon;
+ private Label m_statusText;
+ private Composite m_statusArea;
+
+ public AbstractSectionBasedPart() {
+ m_stati = new ArrayList<IStatus>();
+ }
+
+ @Override
+ public final void createPart(Composite parent) {
+ init();
+ m_formToolkit = new PropertyViewFormToolkit(parent.getDisplay());
+ m_form = m_formToolkit.createScrolledForm(parent);
+ try {
+ m_form.setRedraw(false);
+ m_form.setDelayedReflow(true);
+ //m_form.setText(Texts.get("Properties"));
+ createHeadInternal(m_form);
+
+ // sections
+ Composite formBody = m_form.getBody();
+
+ // root pane is used in order of layout errors in TableWrapLayout with scroll bars.
+ m_sectionContainer = getFormToolkit().createComposite(formBody);
+ formBody.setLayout(new FillLayout());
+ TableWrapLayoutEx layout = new TableWrapLayoutEx();
+ layout.makeColumnsEqualWidth = true;
+ layout.numColumns = 1;
+ layout.horizontalSpacing = 3;
+ layout.verticalSpacing = 3;
+ layout.rightMargin = 3;
+ layout.leftMargin = 3;
+ layout.topMargin = 3;
+ layout.bottomMargin = 3;
+ m_sectionContainer.setLayout(layout);
+
+ // create sections
+ m_sections = new HashMap<String, Section>();
+ createSections();
+
+ m_form.updateToolBar();
+ m_form.reflow(true);
+ }
+ finally {
+ m_form.setRedraw(true);
+ }
+ }
+
+ @Override
+ public void init(IMemento memento) {
+ }
+
+ @Override
+ public void save(IMemento memento) {
+ }
+
+ @Override
+ public final void dispose() {
+ cleanup();
+ getFormToolkit().dispose();
+ getForm().dispose();
+ }
+
+ private void createHeadInternal(ScrolledForm form) {
+ Composite headComposite = getFormToolkit().createComposite(m_form.getForm().getHead());
+ headComposite.setBackground(headComposite.getDisplay().getSystemColor(SWT.COLOR_BLUE));
+ Control head = createHead(headComposite);
+ Control statusArea = createStatusControl(headComposite);
+ m_form.setHeadClient(headComposite);
+
+ // layout
+ GridLayout layout = new GridLayout(1, true);
+ layout.horizontalSpacing = 0;
+ layout.verticalSpacing = 0;
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ headComposite.setLayout(layout);
+ head.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_BOTH));
+ GridData statusData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_BOTH);
+ statusArea.setLayoutData(statusData);
+ updateStatus();
+ }
+
+ private Control createStatusControl(Composite parent) {
+ m_statusArea = getFormToolkit().createComposite(parent);
+ m_statusIcon = getFormToolkit().createLabel(m_statusArea, "");
+ m_statusText = getFormToolkit().createLabel(m_statusArea, "", SWT.LEFT);
+
+ // layout
+ m_statusArea.setLayout(new GridLayout(2, false));
+ m_statusIcon.setLayoutData(new GridData(GridData.FILL_VERTICAL));
+ m_statusText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_BOTH));
+ return m_statusArea;
+ }
+
+ protected Control createHead(Composite parent) {
+ Composite headArea = getFormToolkit().createComposite(parent);
+ Label title = getFormToolkit().createLabel(headArea, "", SWT.WRAP | SWT.READ_ONLY);
+ // layout
+ headArea.setLayout(new GridLayout(1, true));
+ GridData titleData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL);
+ titleData.widthHint = 100;
+ title.setLayoutData(titleData);
+ return headArea;
+ }
+
+ protected void createSections() {
+ }
+
+ protected final Section[] getSections() {
+ return m_sections.values().toArray(new Section[m_sections.values().size()]);
+ }
+
+ public ISection getSection(String sectionId) {
+ Section section = m_sections.get(sectionId);
+ return section;
+ }
+
+ public final void removeSection(String sectionId) {
+ Section section = m_sections.remove(sectionId);
+ if (section != null && !section.isDisposed()) {
+ section.getUiSection().dispose();
+ }
+ }
+
+ /**
+ * @param sectionId
+ * an identifier to access the section with {@link AbstractSectionBasedPart#getSection(String)}
+ * @param title
+ * the title of the section
+ * @return the section - create controls with the sections client {@link ISection#getSectionClient()} as parent
+ */
+ protected final ISection createSection(String sectionId, String title) {
+ return createSection(sectionId, title, null, true);
+ }
+
+ /**
+ * @param sectionId
+ * an identifier to access the section with {@link AbstractSectionBasedPart#getSection(String)}
+ * @param title
+ * the title of the section
+ * @param description
+ * the description of the section. If null or empty the section will not have a description part.
+ * @param twistle
+ * true to ensure the section is collapsable
+ * @return the section - create controls with the sections client {@link ISection#getSectionClient()} as parent
+ */
+ protected final ISection createSection(String sectionId, String title, String description, boolean twistle) {
+ return createSection(sectionId, title, description, twistle, null);
+ }
+
+ /**
+ * @param sectionId
+ * an identifier to access the section with {@link AbstractSectionBasedPart#getSection(String)}
+ * @param title
+ * the title of the section.
+ * @param description
+ * the description of the section. If null or empty the section will not have a description part.
+ * @param twistle
+ * true to ensure the section is collapsable.
+ * @param siblingSectionId
+ * an section id to insert the new section before the sibling section. null to append at the end.
+ * @return the section - create controls with the sections client {@link ISection#getSectionClient()} as parent
+ */
+ protected final ISection createSection(String sectionId, String title, String description, boolean twistle, String siblingSectionId) {
+ Section section = m_sections.get(sectionId);
+ if (section == null) {
+ int style = org.eclipse.ui.forms.widgets.Section.TITLE_BAR | org.eclipse.ui.forms.widgets.Section.EXPANDED;
+ if (twistle) {
+ style |= org.eclipse.ui.forms.widgets.Section.TWISTIE;
+ }
+ boolean hasDescription = !StringUtility.isNullOrEmpty(description);
+ if (hasDescription) {
+ style = style | org.eclipse.ui.forms.widgets.Section.DESCRIPTION;
+ }
+ Section sibling = null;
+ // sibling
+ if (siblingSectionId != null) {
+ sibling = m_sections.get(siblingSectionId);
+ }
+ section = new Section(sectionId, getForm());
+ section.createSection(getFormToolkit(), m_sectionContainer, title, description, style, sibling);
+ m_sections.put(sectionId, section);
+ }
+ return section;
+ }
+
+ public void addStatus(IStatus status) {
+ m_stati.add(status);
+ updateStatus();
+ }
+
+ public boolean removeStatus(IStatus status) {
+ boolean removed = m_stati.remove(status);
+ updateStatus();
+ return removed;
+ }
+
+ private void updateStatus() {
+ if (getForm() != null && !getForm().isDisposed()) {
+ MultiStatus multiStatus = new MultiStatus(ScoutSdkUi.PLUGIN_ID, -1, null, null);
+ for (IStatus s : m_stati) {
+ multiStatus.add(s);
+ }
+ IStatus status = getHighestSeverityStatus(multiStatus, Status.OK_STATUS);
+ if (status == Status.OK_STATUS) {
+ status = null;
+ }
+
+ GridData ld = (GridData) m_statusArea.getLayoutData();
+ if (status == null) {
+ ld.exclude = true;
+ }
+ else {
+ ld.exclude = false;
+ Image img = null;
+ switch (status.getSeverity()) {
+ case IStatus.ERROR:
+ img = ScoutSdkUi.getImage(ScoutSdkUi.StatusError);
+ break;
+ case IStatus.WARNING:
+ img = ScoutSdkUi.getImage(ScoutSdkUi.StatusWarning);
+ break;
+ case IStatus.INFO:
+ img = ScoutSdkUi.getImage(ScoutSdkUi.StatusInfo);
+ break;
+ }
+ m_statusIcon.setImage(img);
+ m_statusText.setText(status.getMessage());
+ }
+ getForm().reflow(true);
+// m_sectionContainer.layout(true, true);
+ }
+
+ }
+
+ private IStatus getHighestSeverityStatus(IStatus status, IStatus highestSeverity) {
+ if (status.isMultiStatus()) {
+ for (IStatus child : status.getChildren()) {
+ highestSeverity = getHighestSeverityStatus(child, highestSeverity);
+ }
+ return highestSeverity;
+ }
+ else {
+ if (highestSeverity.getSeverity() < status.getSeverity()) {
+ highestSeverity = status;
+ }
+ return highestSeverity;
+ }
+ }
+
+ /**
+ * @return the form
+ */
+ public ScrolledForm getForm() {
+ return m_form;
+ }
+
+ protected PropertyViewFormToolkit getFormToolkit() {
+ return m_formToolkit;
+ }
+
+ /**
+ * Is called before the sections are created to do some initialization work.
+ */
+ protected void init() {
+ }
+
+ /**
+ * Is called to release resources or unregister from listeners.
+ */
+ protected void cleanup() {
+ }
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/ISection.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/ISection.java
index ab91f4df0..30a45f10f 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/ISection.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/ISection.java
@@ -1,504 +1,504 @@
-/*******************************************************************************
- * 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.view.properties.part;
-
-import org.eclipse.swt.events.KeyListener;
-import org.eclipse.swt.events.MouseWheelListener;
-import org.eclipse.swt.events.TraverseListener;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Cursor;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Caret;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.Monitor;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.forms.events.IExpansionListener;
-
-/**
- * <h3>{@link ISection}</h3> ...
- *
- * @author Andreas Hoegger
- * @since 1.0.8 31.08.2010
- */
-public interface ISection {
- String getSectionId();
-
- Composite getSectionClient();
-
- boolean isVisible();
-
- void setVisible(boolean visible);
-
- boolean isExpanded();
-
- void setExpanded(boolean expanded);
-
- /**
- * @param listener
- * @see org.eclipse.ui.forms.widgets.ExpandableComposite#addExpansionListener(org.eclipse.ui.forms.events.IExpansionListener)
- */
- void addExpansionListener(IExpansionListener listener);
-
- /**
- * @param listener
- * @see org.eclipse.swt.widgets.Control#addMouseWheelListener(org.eclipse.swt.events.MouseWheelListener)
- */
- void addMouseWheelListener(MouseWheelListener listener);
-
- /**
- * @param listener
- * @see org.eclipse.swt.widgets.Control#addTraverseListener(org.eclipse.swt.events.TraverseListener)
- */
- void addTraverseListener(TraverseListener listener);
-
- /**
- * @return
- * @see org.eclipse.ui.forms.widgets.ExpandableComposite#forceFocus()
- */
- boolean forceFocus();
-
- /**
- * @return
- * @see org.eclipse.swt.widgets.Control#getBackground()
- */
- Color getBackground();
-
- /**
- * @return
- * @see org.eclipse.swt.widgets.Control#getBackgroundImage()
- */
- Image getBackgroundImage();
-
- /**
- * @return
- * @see org.eclipse.swt.widgets.Composite#getBackgroundMode()
- */
- int getBackgroundMode();
-
- /**
- * @return
- * @see org.eclipse.swt.widgets.Control#getBorderWidth()
- */
- int getBorderWidth();
-
- /**
- * @return
- * @see org.eclipse.swt.widgets.Control#getBounds()
- */
- Rectangle getBounds();
-
- /**
- * @return
- * @see org.eclipse.swt.widgets.Canvas#getCaret()
- */
- Caret getCaret();
-
- /**
- * @return
- * @see org.eclipse.ui.forms.widgets.Section#getDescription()
- */
- String getDescription();
-
- /**
- * @return
- * @see org.eclipse.swt.widgets.Widget#getDisplay()
- */
- Display getDisplay();
-
- /**
- * @return
- * @see org.eclipse.swt.widgets.Control#getDragDetect()
- */
- boolean getDragDetect();
-
- /**
- * @return
- * @see org.eclipse.swt.widgets.Control#getEnabled()
- */
- boolean getEnabled();
-
- /**
- * @return
- * @see org.eclipse.ui.forms.widgets.ExpandableComposite#getExpansionStyle()
- */
- int getExpansionStyle();
-
- /**
- * @return
- * @see org.eclipse.swt.widgets.Control#getFont()
- */
- Font getFont();
-
- /**
- * @return
- * @see org.eclipse.swt.widgets.Control#getForeground()
- */
- Color getForeground();
-
- /**
- * @return
- * @see org.eclipse.swt.widgets.Control#getMenu()
- */
- Menu getMenu();
-
- /**
- * @return
- * @see org.eclipse.swt.widgets.Control#getMonitor()
- */
- Monitor getMonitor();
-
- /**
- * @return
- * @see org.eclipse.swt.widgets.Control#getShell()
- */
- Shell getShell();
-
- /**
- * @return
- * @see org.eclipse.swt.widgets.Control#getSize()
- */
- Point getSize();
-
- /**
- * @return
- * @see org.eclipse.swt.widgets.Widget#getStyle()
- */
- int getStyle();
-
- /**
- * @return
- * @see org.eclipse.ui.forms.widgets.ExpandableComposite#getText()
- */
- String getText();
-
- /**
- * @return
- * @see org.eclipse.ui.forms.widgets.ExpandableComposite#getTextClientHeightDifference()
- */
- int getTextClientHeightDifference();
-
- /**
- * @return
- * @see org.eclipse.ui.forms.widgets.Section#getTitleBarBackground()
- */
- Color getTitleBarBackground();
-
- /**
- * @return
- * @see org.eclipse.ui.forms.widgets.Section#getTitleBarBorderColor()
- */
- Color getTitleBarBorderColor();
-
- /**
- * @return
- * @see org.eclipse.ui.forms.widgets.ExpandableComposite#getTitleBarForeground()
- */
- Color getTitleBarForeground();
-
- /**
- * @return
- * @see org.eclipse.ui.forms.widgets.Section#getTitleBarGradientBackground()
- */
- Color getTitleBarGradientBackground();
-
- /**
- * @return
- * @see org.eclipse.swt.widgets.Control#getToolTipText()
- */
- String getToolTipText();
-
- /**
- * @return
- * @see org.eclipse.swt.widgets.Control#getVisible()
- */
- boolean getVisible();
-
- /**
- * @return
- * @see org.eclipse.swt.widgets.Widget#isDisposed()
- */
- boolean isDisposed();
-
- /**
- * @return
- * @see org.eclipse.swt.widgets.Control#isEnabled()
- */
- boolean isEnabled();
-
- /**
- * @return
- * @see org.eclipse.swt.widgets.Control#isFocusControl()
- */
- boolean isFocusControl();
-
- /**
- * @see org.eclipse.swt.widgets.Composite#layout()
- */
- void layout();
-
- /**
- * @param changed
- * @param all
- * @see org.eclipse.swt.widgets.Composite#layout(boolean, boolean)
- */
- void layout(boolean changed, boolean all);
-
- /**
- * @param changed
- * @see org.eclipse.swt.widgets.Composite#layout(boolean)
- */
- void layout(boolean changed);
-
- /**
- * @param changed
- * @see org.eclipse.swt.widgets.Composite#layout(org.eclipse.swt.widgets.Control[])
- */
- void layout(Control[] changed);
-
- /**
- * @see org.eclipse.swt.widgets.Control#pack()
- */
- void pack();
-
- /**
- * @param changed
- * @see org.eclipse.swt.widgets.Control#pack(boolean)
- */
- void pack(boolean changed);
-
- /**
- * @param listener
- * @see org.eclipse.ui.forms.widgets.ExpandableComposite#removeExpansionListener(org.eclipse.ui.forms.events.IExpansionListener)
- */
- void removeExpansionListener(IExpansionListener listener);
-
- /**
- * @param listener
- * @see org.eclipse.swt.widgets.Control#removeKeyListener(org.eclipse.swt.events.KeyListener)
- */
- void removeKeyListener(KeyListener listener);
-
- /**
- * @param eventType
- * @param listener
- * @see org.eclipse.swt.widgets.Widget#removeListener(int, org.eclipse.swt.widgets.Listener)
- */
- void removeListener(int eventType, Listener listener);
-
- /**
- * @param listener
- * @see org.eclipse.swt.widgets.Control#removeTraverseListener(org.eclipse.swt.events.TraverseListener)
- */
- void removeTraverseListener(TraverseListener listener);
-
- /**
- * @param bg
- * @see org.eclipse.ui.forms.widgets.Section#setBackground(org.eclipse.swt.graphics.Color)
- */
- void setBackground(Color bg);
-
- /**
- * @param image
- * @see org.eclipse.ui.forms.widgets.Section#setBackgroundImage(org.eclipse.swt.graphics.Image)
- */
- void setBackgroundImage(Image image);
-
- /**
- * @param mode
- * @see org.eclipse.swt.widgets.Composite#setBackgroundMode(int)
- */
- void setBackgroundMode(int mode);
-
- /**
- * @param x
- * @param y
- * @param width
- * @param height
- * @see org.eclipse.swt.widgets.Control#setBounds(int, int, int, int)
- */
- void setBounds(int x, int y, int width, int height);
-
- /**
- * @param rect
- * @see org.eclipse.swt.widgets.Control#setBounds(org.eclipse.swt.graphics.Rectangle)
- */
- void setBounds(Rectangle rect);
-
- /**
- * @param capture
- * @see org.eclipse.swt.widgets.Control#setCapture(boolean)
- */
- void setCapture(boolean capture);
-
- /**
- * @param caret
- * @see org.eclipse.swt.widgets.Canvas#setCaret(org.eclipse.swt.widgets.Caret)
- */
- void setCaret(Caret caret);
-
- /**
- * @param cursor
- * @see org.eclipse.swt.widgets.Control#setCursor(org.eclipse.swt.graphics.Cursor)
- */
- void setCursor(Cursor cursor);
-
- /**
- * @param description
- * @see org.eclipse.ui.forms.widgets.Section#setDescription(java.lang.String)
- */
- void setDescription(String description);
-
- /**
- * @param dragDetect
- * @see org.eclipse.swt.widgets.Control#setDragDetect(boolean)
- */
- void setDragDetect(boolean dragDetect);
-
- /**
- * @param enabled
- * @see org.eclipse.ui.forms.widgets.ExpandableComposite#setEnabled(boolean)
- */
- void setEnabled(boolean enabled);
-
- /**
- * @return
- * @see org.eclipse.swt.widgets.Composite#setFocus()
- */
- boolean setFocus();
-
- /**
- * @param font
- * @see org.eclipse.ui.forms.widgets.ExpandableComposite#setFont(org.eclipse.swt.graphics.Font)
- */
- void setFont(Font font);
-
- /**
- * @param fg
- * @see org.eclipse.ui.forms.widgets.Section#setForeground(org.eclipse.swt.graphics.Color)
- */
- void setForeground(Color fg);
-
- /**
- * @param menu
- * @see org.eclipse.ui.forms.widgets.ExpandableComposite#setMenu(org.eclipse.swt.widgets.Menu)
- */
- void setMenu(Menu menu);
-
- /**
- * @param width
- * @param height
- * @see org.eclipse.swt.widgets.Control#setSize(int, int)
- */
- void setSize(int width, int height);
-
- /**
- * @param size
- * @see org.eclipse.swt.widgets.Control#setSize(org.eclipse.swt.graphics.Point)
- */
- void setSize(Point size);
-
- /**
- * @param title
- * @see org.eclipse.ui.forms.widgets.ExpandableComposite#setText(java.lang.String)
- */
- void setText(String title);
-
- /**
- * @param color
- * @see org.eclipse.ui.forms.widgets.Section#setTitleBarBackground(org.eclipse.swt.graphics.Color)
- */
- void setTitleBarBackground(Color color);
-
- /**
- * @param color
- * @see org.eclipse.ui.forms.widgets.Section#setTitleBarBorderColor(org.eclipse.swt.graphics.Color)
- */
- void setTitleBarBorderColor(Color color);
-
- /**
- * @param color
- * @see org.eclipse.ui.forms.widgets.ExpandableComposite#setTitleBarForeground(org.eclipse.swt.graphics.Color)
- */
- void setTitleBarForeground(Color color);
-
- /**
- * @param color
- * @see org.eclipse.ui.forms.widgets.Section#setTitleBarGradientBackground(org.eclipse.swt.graphics.Color)
- */
- void setTitleBarGradientBackground(Color color);
-
- /**
- * @param c
- * @see org.eclipse.ui.forms.widgets.ExpandableComposite#setToggleColor(org.eclipse.swt.graphics.Color)
- */
- void setToggleColor(Color c);
-
- /**
- * @param string
- * @see org.eclipse.swt.widgets.Control#setToolTipText(java.lang.String)
- */
- void setToolTipText(String string);
-
- /**
- * @param x
- * @param y
- * @return
- * @see org.eclipse.swt.widgets.Control#toControl(int, int)
- */
- Point toControl(int x, int y);
-
- /**
- * @param point
- * @return
- * @see org.eclipse.swt.widgets.Control#toControl(org.eclipse.swt.graphics.Point)
- */
- Point toControl(Point point);
-
- /**
- * @param x
- * @param y
- * @return
- * @see org.eclipse.swt.widgets.Control#toDisplay(int, int)
- */
- Point toDisplay(int x, int y);
-
- /**
- * @param point
- * @return
- * @see org.eclipse.swt.widgets.Control#toDisplay(org.eclipse.swt.graphics.Point)
- */
- Point toDisplay(Point point);
-
- /**
- * @param traversal
- * @return
- * @see org.eclipse.swt.widgets.Control#traverse(int)
- */
- boolean traverse(int traversal);
-
- /**
- * @see org.eclipse.swt.widgets.Control#update()
- */
- void update();
-
- /**
- * reflows the form associated with this section
- */
- void reflow();
-
-}
+/*******************************************************************************
+ * 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.view.properties.part;
+
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.events.MouseWheelListener;
+import org.eclipse.swt.events.TraverseListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Cursor;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Caret;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.Monitor;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.forms.events.IExpansionListener;
+
+/**
+ * <h3>{@link ISection}</h3> ...
+ *
+ * @author Andreas Hoegger
+ * @since 1.0.8 31.08.2010
+ */
+public interface ISection {
+ String getSectionId();
+
+ Composite getSectionClient();
+
+ boolean isVisible();
+
+ void setVisible(boolean visible);
+
+ boolean isExpanded();
+
+ void setExpanded(boolean expanded);
+
+ /**
+ * @param listener
+ * @see org.eclipse.ui.forms.widgets.ExpandableComposite#addExpansionListener(org.eclipse.ui.forms.events.IExpansionListener)
+ */
+ void addExpansionListener(IExpansionListener listener);
+
+ /**
+ * @param listener
+ * @see org.eclipse.swt.widgets.Control#addMouseWheelListener(org.eclipse.swt.events.MouseWheelListener)
+ */
+ void addMouseWheelListener(MouseWheelListener listener);
+
+ /**
+ * @param listener
+ * @see org.eclipse.swt.widgets.Control#addTraverseListener(org.eclipse.swt.events.TraverseListener)
+ */
+ void addTraverseListener(TraverseListener listener);
+
+ /**
+ * @return
+ * @see org.eclipse.ui.forms.widgets.ExpandableComposite#forceFocus()
+ */
+ boolean forceFocus();
+
+ /**
+ * @return
+ * @see org.eclipse.swt.widgets.Control#getBackground()
+ */
+ Color getBackground();
+
+ /**
+ * @return
+ * @see org.eclipse.swt.widgets.Control#getBackgroundImage()
+ */
+ Image getBackgroundImage();
+
+ /**
+ * @return
+ * @see org.eclipse.swt.widgets.Composite#getBackgroundMode()
+ */
+ int getBackgroundMode();
+
+ /**
+ * @return
+ * @see org.eclipse.swt.widgets.Control#getBorderWidth()
+ */
+ int getBorderWidth();
+
+ /**
+ * @return
+ * @see org.eclipse.swt.widgets.Control#getBounds()
+ */
+ Rectangle getBounds();
+
+ /**
+ * @return
+ * @see org.eclipse.swt.widgets.Canvas#getCaret()
+ */
+ Caret getCaret();
+
+ /**
+ * @return
+ * @see org.eclipse.ui.forms.widgets.Section#getDescription()
+ */
+ String getDescription();
+
+ /**
+ * @return
+ * @see org.eclipse.swt.widgets.Widget#getDisplay()
+ */
+ Display getDisplay();
+
+ /**
+ * @return
+ * @see org.eclipse.swt.widgets.Control#getDragDetect()
+ */
+ boolean getDragDetect();
+
+ /**
+ * @return
+ * @see org.eclipse.swt.widgets.Control#getEnabled()
+ */
+ boolean getEnabled();
+
+ /**
+ * @return
+ * @see org.eclipse.ui.forms.widgets.ExpandableComposite#getExpansionStyle()
+ */
+ int getExpansionStyle();
+
+ /**
+ * @return
+ * @see org.eclipse.swt.widgets.Control#getFont()
+ */
+ Font getFont();
+
+ /**
+ * @return
+ * @see org.eclipse.swt.widgets.Control#getForeground()
+ */
+ Color getForeground();
+
+ /**
+ * @return
+ * @see org.eclipse.swt.widgets.Control#getMenu()
+ */
+ Menu getMenu();
+
+ /**
+ * @return
+ * @see org.eclipse.swt.widgets.Control#getMonitor()
+ */
+ Monitor getMonitor();
+
+ /**
+ * @return
+ * @see org.eclipse.swt.widgets.Control#getShell()
+ */
+ Shell getShell();
+
+ /**
+ * @return
+ * @see org.eclipse.swt.widgets.Control#getSize()
+ */
+ Point getSize();
+
+ /**
+ * @return
+ * @see org.eclipse.swt.widgets.Widget#getStyle()
+ */
+ int getStyle();
+
+ /**
+ * @return
+ * @see org.eclipse.ui.forms.widgets.ExpandableComposite#getText()
+ */
+ String getText();
+
+ /**
+ * @return
+ * @see org.eclipse.ui.forms.widgets.ExpandableComposite#getTextClientHeightDifference()
+ */
+ int getTextClientHeightDifference();
+
+ /**
+ * @return
+ * @see org.eclipse.ui.forms.widgets.Section#getTitleBarBackground()
+ */
+ Color getTitleBarBackground();
+
+ /**
+ * @return
+ * @see org.eclipse.ui.forms.widgets.Section#getTitleBarBorderColor()
+ */
+ Color getTitleBarBorderColor();
+
+ /**
+ * @return
+ * @see org.eclipse.ui.forms.widgets.ExpandableComposite#getTitleBarForeground()
+ */
+ Color getTitleBarForeground();
+
+ /**
+ * @return
+ * @see org.eclipse.ui.forms.widgets.Section#getTitleBarGradientBackground()
+ */
+ Color getTitleBarGradientBackground();
+
+ /**
+ * @return
+ * @see org.eclipse.swt.widgets.Control#getToolTipText()
+ */
+ String getToolTipText();
+
+ /**
+ * @return
+ * @see org.eclipse.swt.widgets.Control#getVisible()
+ */
+ boolean getVisible();
+
+ /**
+ * @return
+ * @see org.eclipse.swt.widgets.Widget#isDisposed()
+ */
+ boolean isDisposed();
+
+ /**
+ * @return
+ * @see org.eclipse.swt.widgets.Control#isEnabled()
+ */
+ boolean isEnabled();
+
+ /**
+ * @return
+ * @see org.eclipse.swt.widgets.Control#isFocusControl()
+ */
+ boolean isFocusControl();
+
+ /**
+ * @see org.eclipse.swt.widgets.Composite#layout()
+ */
+ void layout();
+
+ /**
+ * @param changed
+ * @param all
+ * @see org.eclipse.swt.widgets.Composite#layout(boolean, boolean)
+ */
+ void layout(boolean changed, boolean all);
+
+ /**
+ * @param changed
+ * @see org.eclipse.swt.widgets.Composite#layout(boolean)
+ */
+ void layout(boolean changed);
+
+ /**
+ * @param changed
+ * @see org.eclipse.swt.widgets.Composite#layout(org.eclipse.swt.widgets.Control[])
+ */
+ void layout(Control[] changed);
+
+ /**
+ * @see org.eclipse.swt.widgets.Control#pack()
+ */
+ void pack();
+
+ /**
+ * @param changed
+ * @see org.eclipse.swt.widgets.Control#pack(boolean)
+ */
+ void pack(boolean changed);
+
+ /**
+ * @param listener
+ * @see org.eclipse.ui.forms.widgets.ExpandableComposite#removeExpansionListener(org.eclipse.ui.forms.events.IExpansionListener)
+ */
+ void removeExpansionListener(IExpansionListener listener);
+
+ /**
+ * @param listener
+ * @see org.eclipse.swt.widgets.Control#removeKeyListener(org.eclipse.swt.events.KeyListener)
+ */
+ void removeKeyListener(KeyListener listener);
+
+ /**
+ * @param eventType
+ * @param listener
+ * @see org.eclipse.swt.widgets.Widget#removeListener(int, org.eclipse.swt.widgets.Listener)
+ */
+ void removeListener(int eventType, Listener listener);
+
+ /**
+ * @param listener
+ * @see org.eclipse.swt.widgets.Control#removeTraverseListener(org.eclipse.swt.events.TraverseListener)
+ */
+ void removeTraverseListener(TraverseListener listener);
+
+ /**
+ * @param bg
+ * @see org.eclipse.ui.forms.widgets.Section#setBackground(org.eclipse.swt.graphics.Color)
+ */
+ void setBackground(Color bg);
+
+ /**
+ * @param image
+ * @see org.eclipse.ui.forms.widgets.Section#setBackgroundImage(org.eclipse.swt.graphics.Image)
+ */
+ void setBackgroundImage(Image image);
+
+ /**
+ * @param mode
+ * @see org.eclipse.swt.widgets.Composite#setBackgroundMode(int)
+ */
+ void setBackgroundMode(int mode);
+
+ /**
+ * @param x
+ * @param y
+ * @param width
+ * @param height
+ * @see org.eclipse.swt.widgets.Control#setBounds(int, int, int, int)
+ */
+ void setBounds(int x, int y, int width, int height);
+
+ /**
+ * @param rect
+ * @see org.eclipse.swt.widgets.Control#setBounds(org.eclipse.swt.graphics.Rectangle)
+ */
+ void setBounds(Rectangle rect);
+
+ /**
+ * @param capture
+ * @see org.eclipse.swt.widgets.Control#setCapture(boolean)
+ */
+ void setCapture(boolean capture);
+
+ /**
+ * @param caret
+ * @see org.eclipse.swt.widgets.Canvas#setCaret(org.eclipse.swt.widgets.Caret)
+ */
+ void setCaret(Caret caret);
+
+ /**
+ * @param cursor
+ * @see org.eclipse.swt.widgets.Control#setCursor(org.eclipse.swt.graphics.Cursor)
+ */
+ void setCursor(Cursor cursor);
+
+ /**
+ * @param description
+ * @see org.eclipse.ui.forms.widgets.Section#setDescription(java.lang.String)
+ */
+ void setDescription(String description);
+
+ /**
+ * @param dragDetect
+ * @see org.eclipse.swt.widgets.Control#setDragDetect(boolean)
+ */
+ void setDragDetect(boolean dragDetect);
+
+ /**
+ * @param enabled
+ * @see org.eclipse.ui.forms.widgets.ExpandableComposite#setEnabled(boolean)
+ */
+ void setEnabled(boolean enabled);
+
+ /**
+ * @return
+ * @see org.eclipse.swt.widgets.Composite#setFocus()
+ */
+ boolean setFocus();
+
+ /**
+ * @param font
+ * @see org.eclipse.ui.forms.widgets.ExpandableComposite#setFont(org.eclipse.swt.graphics.Font)
+ */
+ void setFont(Font font);
+
+ /**
+ * @param fg
+ * @see org.eclipse.ui.forms.widgets.Section#setForeground(org.eclipse.swt.graphics.Color)
+ */
+ void setForeground(Color fg);
+
+ /**
+ * @param menu
+ * @see org.eclipse.ui.forms.widgets.ExpandableComposite#setMenu(org.eclipse.swt.widgets.Menu)
+ */
+ void setMenu(Menu menu);
+
+ /**
+ * @param width
+ * @param height
+ * @see org.eclipse.swt.widgets.Control#setSize(int, int)
+ */
+ void setSize(int width, int height);
+
+ /**
+ * @param size
+ * @see org.eclipse.swt.widgets.Control#setSize(org.eclipse.swt.graphics.Point)
+ */
+ void setSize(Point size);
+
+ /**
+ * @param title
+ * @see org.eclipse.ui.forms.widgets.ExpandableComposite#setText(java.lang.String)
+ */
+ void setText(String title);
+
+ /**
+ * @param color
+ * @see org.eclipse.ui.forms.widgets.Section#setTitleBarBackground(org.eclipse.swt.graphics.Color)
+ */
+ void setTitleBarBackground(Color color);
+
+ /**
+ * @param color
+ * @see org.eclipse.ui.forms.widgets.Section#setTitleBarBorderColor(org.eclipse.swt.graphics.Color)
+ */
+ void setTitleBarBorderColor(Color color);
+
+ /**
+ * @param color
+ * @see org.eclipse.ui.forms.widgets.ExpandableComposite#setTitleBarForeground(org.eclipse.swt.graphics.Color)
+ */
+ void setTitleBarForeground(Color color);
+
+ /**
+ * @param color
+ * @see org.eclipse.ui.forms.widgets.Section#setTitleBarGradientBackground(org.eclipse.swt.graphics.Color)
+ */
+ void setTitleBarGradientBackground(Color color);
+
+ /**
+ * @param c
+ * @see org.eclipse.ui.forms.widgets.ExpandableComposite#setToggleColor(org.eclipse.swt.graphics.Color)
+ */
+ void setToggleColor(Color c);
+
+ /**
+ * @param string
+ * @see org.eclipse.swt.widgets.Control#setToolTipText(java.lang.String)
+ */
+ void setToolTipText(String string);
+
+ /**
+ * @param x
+ * @param y
+ * @return
+ * @see org.eclipse.swt.widgets.Control#toControl(int, int)
+ */
+ Point toControl(int x, int y);
+
+ /**
+ * @param point
+ * @return
+ * @see org.eclipse.swt.widgets.Control#toControl(org.eclipse.swt.graphics.Point)
+ */
+ Point toControl(Point point);
+
+ /**
+ * @param x
+ * @param y
+ * @return
+ * @see org.eclipse.swt.widgets.Control#toDisplay(int, int)
+ */
+ Point toDisplay(int x, int y);
+
+ /**
+ * @param point
+ * @return
+ * @see org.eclipse.swt.widgets.Control#toDisplay(org.eclipse.swt.graphics.Point)
+ */
+ Point toDisplay(Point point);
+
+ /**
+ * @param traversal
+ * @return
+ * @see org.eclipse.swt.widgets.Control#traverse(int)
+ */
+ boolean traverse(int traversal);
+
+ /**
+ * @see org.eclipse.swt.widgets.Control#update()
+ */
+ void update();
+
+ /**
+ * reflows the form associated with this section
+ */
+ void reflow();
+
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/Section.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/Section.java
index 0d16ec403..1931e23f8 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/Section.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/Section.java
@@ -1,809 +1,809 @@
-/*******************************************************************************
- * 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.view.properties.part;
-
-import org.eclipse.scout.sdk.ui.util.TableWrapDataEx;
-import org.eclipse.swt.events.KeyListener;
-import org.eclipse.swt.events.MouseWheelListener;
-import org.eclipse.swt.events.TraverseListener;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Cursor;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Caret;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.Monitor;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.forms.events.ExpansionAdapter;
-import org.eclipse.ui.forms.events.ExpansionEvent;
-import org.eclipse.ui.forms.events.IExpansionListener;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.ScrolledForm;
-import org.eclipse.ui.forms.widgets.TableWrapData;
-
-/**
- * <h3>{@link Section}</h3> ...
- *
- * @author Andreas Hoegger
- * @since 1.0.8 31.08.2010
- */
-public class Section implements ISection {
-
- private org.eclipse.ui.forms.widgets.Section m_uiSection;
- private String m_sectionId;
- private final ScrolledForm m_form;
-
- public Section(String sectionId, ScrolledForm form) {
- m_sectionId = sectionId;
- m_form = form;
- }
-
- @Override
- public String getSectionId() {
- return m_sectionId;
- }
-
- void createSection(FormToolkit toolkit, Composite parent, String title, String description, int style, Section sibling) {
- m_uiSection = toolkit.createSection(parent, style);
- m_uiSection.addExpansionListener(new ExpansionAdapter() {
- @Override
- public void expansionStateChanged(ExpansionEvent e) {
- reflow();
- }
- });
- m_uiSection.setText(title);
- if ((style & org.eclipse.ui.forms.widgets.Section.DESCRIPTION) != 0) {
- m_uiSection.setDescription(description);
- }
- // position
- if (sibling != null) {
- m_uiSection.moveAbove(sibling.getUiSection());
- }
- // layout
- TableWrapDataEx data = new TableWrapDataEx(TableWrapData.FILL_GRAB);
- data.maxWidth = 260; // to scale presenter fill width properly. 260 = 2 x labelWidth
- m_uiSection.setLayoutData(data);
- Composite sectionClient = toolkit.createComposite(m_uiSection);
- m_uiSection.setClient(sectionClient);
- GridLayout layout = new GridLayout(1, true);
- layout.horizontalSpacing = 3;
- layout.verticalSpacing = 4;
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- sectionClient.setLayout(layout);
- }
-
- /**
- * @return the uiSection
- */
- public org.eclipse.ui.forms.widgets.Section getUiSection() {
- return m_uiSection;
- }
-
- @Override
- public Composite getSectionClient() {
- if (m_uiSection == null || m_uiSection.isDisposed()) {
- throw new IllegalStateException("section has not been created or is disposed.");
- }
- return (Composite) m_uiSection.getClient();
- }
-
- @Override
- public boolean isVisible() {
- return m_uiSection.isVisible();
- }
-
- @Override
- public void setVisible(boolean visible) {
- if (isVisible() != visible) { // do this check as this call is very expensive
- Object layoutData = m_uiSection.getLayoutData();
- if (layoutData instanceof TableWrapDataEx) {
- ((TableWrapDataEx) layoutData).exclude = !visible;
- }
- m_uiSection.setVisible(visible);
- m_form.layout(true, true);
- reflow();
- }
- }
-
- @Override
- public boolean isExpanded() {
- return m_uiSection.isExpanded();
- }
-
- @Override
- public void setExpanded(boolean expanded) {
- if (isExpanded() != expanded) {
- // expand forces a complete re-layout and redraw (slow).
- // only call if a change is necessary.
- m_uiSection.setExpanded(expanded);
- }
- }
-
- /**
- * @param listener
- * @see org.eclipse.ui.forms.widgets.ExpandableComposite#addExpansionListener(org.eclipse.ui.forms.events.IExpansionListener)
- */
- @Override
- public void addExpansionListener(IExpansionListener listener) {
- m_uiSection.addExpansionListener(listener);
- }
-
- /**
- * @param listener
- * @see org.eclipse.swt.widgets.Control#addMouseWheelListener(org.eclipse.swt.events.MouseWheelListener)
- */
- @Override
- public void addMouseWheelListener(MouseWheelListener listener) {
- m_uiSection.addMouseWheelListener(listener);
- }
-
- /**
- * @param listener
- * @see org.eclipse.swt.widgets.Control#addTraverseListener(org.eclipse.swt.events.TraverseListener)
- */
- @Override
- public void addTraverseListener(TraverseListener listener) {
- m_uiSection.addTraverseListener(listener);
- }
-
- /**
- * @return
- * @see org.eclipse.ui.forms.widgets.ExpandableComposite#forceFocus()
- */
- @Override
- public boolean forceFocus() {
- return m_uiSection.forceFocus();
- }
-
- /**
- * @return
- * @see org.eclipse.swt.widgets.Control#getBackground()
- */
- @Override
- public Color getBackground() {
- return m_uiSection.getBackground();
- }
-
- /**
- * @return
- * @see org.eclipse.swt.widgets.Control#getBackgroundImage()
- */
- @Override
- public Image getBackgroundImage() {
- return m_uiSection.getBackgroundImage();
- }
-
- /**
- * @return
- * @see org.eclipse.swt.widgets.Composite#getBackgroundMode()
- */
- @Override
- public int getBackgroundMode() {
- return m_uiSection.getBackgroundMode();
- }
-
- /**
- * @return
- * @see org.eclipse.swt.widgets.Control#getBorderWidth()
- */
- @Override
- public int getBorderWidth() {
- return m_uiSection.getBorderWidth();
- }
-
- /**
- * @return
- * @see org.eclipse.swt.widgets.Control#getBounds()
- */
- @Override
- public Rectangle getBounds() {
- return m_uiSection.getBounds();
- }
-
- /**
- * @return
- * @see org.eclipse.swt.widgets.Canvas#getCaret()
- */
- @Override
- public Caret getCaret() {
- return m_uiSection.getCaret();
- }
-
- /**
- * @return
- * @see org.eclipse.ui.forms.widgets.Section#getDescription()
- */
- @Override
- public String getDescription() {
- return m_uiSection.getDescription();
- }
-
- /**
- * @return
- * @see org.eclipse.swt.widgets.Widget#getDisplay()
- */
- @Override
- public Display getDisplay() {
- return m_uiSection.getDisplay();
- }
-
- /**
- * @return
- * @see org.eclipse.swt.widgets.Control#getDragDetect()
- */
- @Override
- public boolean getDragDetect() {
- return m_uiSection.getDragDetect();
- }
-
- /**
- * @return
- * @see org.eclipse.swt.widgets.Control#getEnabled()
- */
- @Override
- public boolean getEnabled() {
- return m_uiSection.getEnabled();
- }
-
- /**
- * @return
- * @see org.eclipse.ui.forms.widgets.ExpandableComposite#getExpansionStyle()
- */
- @Override
- public int getExpansionStyle() {
- return m_uiSection.getExpansionStyle();
- }
-
- /**
- * @return
- * @see org.eclipse.swt.widgets.Control#getFont()
- */
- @Override
- public Font getFont() {
- return m_uiSection.getFont();
- }
-
- /**
- * @return
- * @see org.eclipse.swt.widgets.Control#getForeground()
- */
- @Override
- public Color getForeground() {
- return m_uiSection.getForeground();
- }
-
- /**
- * @return
- * @see org.eclipse.swt.widgets.Control#getMenu()
- */
- @Override
- public Menu getMenu() {
- return m_uiSection.getMenu();
- }
-
- /**
- * @return
- * @see org.eclipse.swt.widgets.Control#getMonitor()
- */
- @Override
- public Monitor getMonitor() {
- return m_uiSection.getMonitor();
- }
-
- /**
- * @return
- * @see org.eclipse.swt.widgets.Control#getShell()
- */
- @Override
- public Shell getShell() {
- return m_uiSection.getShell();
- }
-
- /**
- * @return
- * @see org.eclipse.swt.widgets.Control#getSize()
- */
- @Override
- public Point getSize() {
- return m_uiSection.getSize();
- }
-
- /**
- * @return
- * @see org.eclipse.swt.widgets.Widget#getStyle()
- */
- @Override
- public int getStyle() {
- return m_uiSection.getStyle();
- }
-
- /**
- * @return
- * @see org.eclipse.ui.forms.widgets.ExpandableComposite#getText()
- */
- @Override
- public String getText() {
- return m_uiSection.getText();
- }
-
- /**
- * @return
- * @see org.eclipse.ui.forms.widgets.ExpandableComposite#getTextClientHeightDifference()
- */
- @Override
- public int getTextClientHeightDifference() {
- return m_uiSection.getTextClientHeightDifference();
- }
-
- /**
- * @return
- * @see org.eclipse.ui.forms.widgets.Section#getTitleBarBackground()
- */
- @Override
- public Color getTitleBarBackground() {
- return m_uiSection.getTitleBarBackground();
- }
-
- /**
- * @return
- * @see org.eclipse.ui.forms.widgets.Section#getTitleBarBorderColor()
- */
- @Override
- public Color getTitleBarBorderColor() {
- return m_uiSection.getTitleBarBorderColor();
- }
-
- /**
- * @return
- * @see org.eclipse.ui.forms.widgets.ExpandableComposite#getTitleBarForeground()
- */
- @Override
- public Color getTitleBarForeground() {
- return m_uiSection.getTitleBarForeground();
- }
-
- /**
- * @return
- * @see org.eclipse.ui.forms.widgets.Section#getTitleBarGradientBackground()
- */
- @Override
- public Color getTitleBarGradientBackground() {
- return m_uiSection.getTitleBarGradientBackground();
- }
-
- /**
- * @return
- * @see org.eclipse.swt.widgets.Control#getToolTipText()
- */
- @Override
- public String getToolTipText() {
- return m_uiSection.getToolTipText();
- }
-
- /**
- * @return
- * @see org.eclipse.swt.widgets.Control#getVisible()
- */
- @Override
- public boolean getVisible() {
- return m_uiSection.getVisible();
- }
-
- /**
- * @return
- * @see org.eclipse.swt.widgets.Widget#isDisposed()
- */
- @Override
- public boolean isDisposed() {
- return m_uiSection.isDisposed();
- }
-
- /**
- * @return
- * @see org.eclipse.swt.widgets.Control#isEnabled()
- */
- @Override
- public boolean isEnabled() {
- return m_uiSection.isEnabled();
- }
-
- /**
- * @return
- * @see org.eclipse.swt.widgets.Control#isFocusControl()
- */
- @Override
- public boolean isFocusControl() {
- return m_uiSection.isFocusControl();
- }
-
- /**
- * @see org.eclipse.swt.widgets.Composite#layout()
- */
- @Override
- public void layout() {
- m_uiSection.layout();
- }
-
- /**
- * @param changed
- * @param all
- * @see org.eclipse.swt.widgets.Composite#layout(boolean, boolean)
- */
- @Override
- public void layout(boolean changed, boolean all) {
- m_uiSection.layout(changed, all);
- }
-
- /**
- * @param changed
- * @see org.eclipse.swt.widgets.Composite#layout(boolean)
- */
- @Override
- public void layout(boolean changed) {
- m_uiSection.layout(changed);
- }
-
- /**
- * @param changed
- * @see org.eclipse.swt.widgets.Composite#layout(org.eclipse.swt.widgets.Control[])
- */
- @Override
- public void layout(Control[] changed) {
- m_uiSection.layout(changed);
- }
-
- /**
- * @see org.eclipse.swt.widgets.Control#pack()
- */
- @Override
- public void pack() {
- m_uiSection.pack();
- }
-
- /**
- * @param changed
- * @see org.eclipse.swt.widgets.Control#pack(boolean)
- */
- @Override
- public void pack(boolean changed) {
- m_uiSection.pack(changed);
- }
-
- /**
- * @param listener
- * @see org.eclipse.ui.forms.widgets.ExpandableComposite#removeExpansionListener(org.eclipse.ui.forms.events.IExpansionListener)
- */
- @Override
- public void removeExpansionListener(IExpansionListener listener) {
- m_uiSection.removeExpansionListener(listener);
- }
-
- /**
- * @param listener
- * @see org.eclipse.swt.widgets.Control#removeKeyListener(org.eclipse.swt.events.KeyListener)
- */
- @Override
- public void removeKeyListener(KeyListener listener) {
- m_uiSection.removeKeyListener(listener);
- }
-
- /**
- * @param eventType
- * @param listener
- * @see org.eclipse.swt.widgets.Widget#removeListener(int, org.eclipse.swt.widgets.Listener)
- */
- @Override
- public void removeListener(int eventType, Listener listener) {
- m_uiSection.removeListener(eventType, listener);
- }
-
- /**
- * @param listener
- * @see org.eclipse.swt.widgets.Control#removeTraverseListener(org.eclipse.swt.events.TraverseListener)
- */
- @Override
- public void removeTraverseListener(TraverseListener listener) {
- m_uiSection.removeTraverseListener(listener);
- }
-
- /**
- * @param bg
- * @see org.eclipse.ui.forms.widgets.Section#setBackground(org.eclipse.swt.graphics.Color)
- */
- @Override
- public void setBackground(Color bg) {
- m_uiSection.setBackground(bg);
- }
-
- /**
- * @param image
- * @see org.eclipse.ui.forms.widgets.Section#setBackgroundImage(org.eclipse.swt.graphics.Image)
- */
- @Override
- public final void setBackgroundImage(Image image) {
- m_uiSection.setBackgroundImage(image);
- }
-
- /**
- * @param mode
- * @see org.eclipse.swt.widgets.Composite#setBackgroundMode(int)
- */
- @Override
- public void setBackgroundMode(int mode) {
- m_uiSection.setBackgroundMode(mode);
- }
-
- /**
- * @param x
- * @param y
- * @param width
- * @param height
- * @see org.eclipse.swt.widgets.Control#setBounds(int, int, int, int)
- */
- @Override
- public void setBounds(int x, int y, int width, int height) {
- m_uiSection.setBounds(x, y, width, height);
- }
-
- /**
- * @param rect
- * @see org.eclipse.swt.widgets.Control#setBounds(org.eclipse.swt.graphics.Rectangle)
- */
- @Override
- public void setBounds(Rectangle rect) {
- m_uiSection.setBounds(rect);
- }
-
- /**
- * @param capture
- * @see org.eclipse.swt.widgets.Control#setCapture(boolean)
- */
- @Override
- public void setCapture(boolean capture) {
- m_uiSection.setCapture(capture);
- }
-
- /**
- * @param caret
- * @see org.eclipse.swt.widgets.Canvas#setCaret(org.eclipse.swt.widgets.Caret)
- */
- @Override
- public void setCaret(Caret caret) {
- m_uiSection.setCaret(caret);
- }
-
- /**
- * @param cursor
- * @see org.eclipse.swt.widgets.Control#setCursor(org.eclipse.swt.graphics.Cursor)
- */
- @Override
- public void setCursor(Cursor cursor) {
- m_uiSection.setCursor(cursor);
- }
-
- /**
- * @param description
- * @see org.eclipse.ui.forms.widgets.Section#setDescription(java.lang.String)
- */
- @Override
- public void setDescription(String description) {
- m_uiSection.setDescription(description);
- }
-
- /**
- * @param dragDetect
- * @see org.eclipse.swt.widgets.Control#setDragDetect(boolean)
- */
- @Override
- public void setDragDetect(boolean dragDetect) {
- m_uiSection.setDragDetect(dragDetect);
- }
-
- /**
- * @param enabled
- * @see org.eclipse.ui.forms.widgets.ExpandableComposite#setEnabled(boolean)
- */
- @Override
- public void setEnabled(boolean enabled) {
- m_uiSection.setEnabled(enabled);
- }
-
- /**
- * @return
- * @see org.eclipse.swt.widgets.Composite#setFocus()
- */
- @Override
- public boolean setFocus() {
- return m_uiSection.setFocus();
- }
-
- /**
- * @param font
- * @see org.eclipse.ui.forms.widgets.ExpandableComposite#setFont(org.eclipse.swt.graphics.Font)
- */
- @Override
- public void setFont(Font font) {
- m_uiSection.setFont(font);
- }
-
- /**
- * @param fg
- * @see org.eclipse.ui.forms.widgets.Section#setForeground(org.eclipse.swt.graphics.Color)
- */
- @Override
- public void setForeground(Color fg) {
- m_uiSection.setForeground(fg);
- }
-
- /**
- * @param menu
- * @see org.eclipse.ui.forms.widgets.ExpandableComposite#setMenu(org.eclipse.swt.widgets.Menu)
- */
- @Override
- public void setMenu(Menu menu) {
- m_uiSection.setMenu(menu);
- }
-
- /**
- * @param width
- * @param height
- * @see org.eclipse.swt.widgets.Control#setSize(int, int)
- */
- @Override
- public void setSize(int width, int height) {
- m_uiSection.setSize(width, height);
- }
-
- /**
- * @param size
- * @see org.eclipse.swt.widgets.Control#setSize(org.eclipse.swt.graphics.Point)
- */
- @Override
- public void setSize(Point size) {
- m_uiSection.setSize(size);
- }
-
- /**
- * @param title
- * @see org.eclipse.ui.forms.widgets.ExpandableComposite#setText(java.lang.String)
- */
- @Override
- public void setText(String title) {
- m_uiSection.setText(title);
- }
-
- /**
- * @param color
- * @see org.eclipse.ui.forms.widgets.Section#setTitleBarBackground(org.eclipse.swt.graphics.Color)
- */
- @Override
- public void setTitleBarBackground(Color color) {
- m_uiSection.setTitleBarBackground(color);
- }
-
- /**
- * @param color
- * @see org.eclipse.ui.forms.widgets.Section#setTitleBarBorderColor(org.eclipse.swt.graphics.Color)
- */
- @Override
- public void setTitleBarBorderColor(Color color) {
- m_uiSection.setTitleBarBorderColor(color);
- }
-
- /**
- * @param color
- * @see org.eclipse.ui.forms.widgets.ExpandableComposite#setTitleBarForeground(org.eclipse.swt.graphics.Color)
- */
- @Override
- public void setTitleBarForeground(Color color) {
- m_uiSection.setTitleBarForeground(color);
- }
-
- /**
- * @param color
- * @see org.eclipse.ui.forms.widgets.Section#setTitleBarGradientBackground(org.eclipse.swt.graphics.Color)
- */
- @Override
- public void setTitleBarGradientBackground(Color color) {
- m_uiSection.setTitleBarGradientBackground(color);
- }
-
- /**
- * @param c
- * @see org.eclipse.ui.forms.widgets.ExpandableComposite#setToggleColor(org.eclipse.swt.graphics.Color)
- */
- @Override
- public void setToggleColor(Color c) {
- m_uiSection.setToggleColor(c);
- }
-
- /**
- * @param string
- * @see org.eclipse.swt.widgets.Control#setToolTipText(java.lang.String)
- */
- @Override
- public void setToolTipText(String string) {
- m_uiSection.setToolTipText(string);
- }
-
- /**
- * @param x
- * @param y
- * @return
- * @see org.eclipse.swt.widgets.Control#toControl(int, int)
- */
- @Override
- public Point toControl(int x, int y) {
- return m_uiSection.toControl(x, y);
- }
-
- /**
- * @param point
- * @return
- * @see org.eclipse.swt.widgets.Control#toControl(org.eclipse.swt.graphics.Point)
- */
- @Override
- public Point toControl(Point point) {
- return m_uiSection.toControl(point);
- }
-
- /**
- * @param x
- * @param y
- * @return
- * @see org.eclipse.swt.widgets.Control#toDisplay(int, int)
- */
- @Override
- public Point toDisplay(int x, int y) {
- return m_uiSection.toDisplay(x, y);
- }
-
- /**
- * @param point
- * @return
- * @see org.eclipse.swt.widgets.Control#toDisplay(org.eclipse.swt.graphics.Point)
- */
- @Override
- public Point toDisplay(Point point) {
- return m_uiSection.toDisplay(point);
- }
-
- /**
- * @param traversal
- * @return
- * @see org.eclipse.swt.widgets.Control#traverse(int)
- */
- @Override
- public boolean traverse(int traversal) {
- return m_uiSection.traverse(traversal);
- }
-
- /**
- * @see org.eclipse.swt.widgets.Control#update()
- */
- @Override
- public void update() {
- m_uiSection.update();
- }
-
- @Override
- public void reflow() {
- m_form.reflow(true);
- }
-}
+/*******************************************************************************
+ * 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.view.properties.part;
+
+import org.eclipse.scout.sdk.ui.util.TableWrapDataEx;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.events.MouseWheelListener;
+import org.eclipse.swt.events.TraverseListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Cursor;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Caret;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.Monitor;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.forms.events.ExpansionAdapter;
+import org.eclipse.ui.forms.events.ExpansionEvent;
+import org.eclipse.ui.forms.events.IExpansionListener;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
+import org.eclipse.ui.forms.widgets.TableWrapData;
+
+/**
+ * <h3>{@link Section}</h3> ...
+ *
+ * @author Andreas Hoegger
+ * @since 1.0.8 31.08.2010
+ */
+public class Section implements ISection {
+
+ private org.eclipse.ui.forms.widgets.Section m_uiSection;
+ private String m_sectionId;
+ private final ScrolledForm m_form;
+
+ public Section(String sectionId, ScrolledForm form) {
+ m_sectionId = sectionId;
+ m_form = form;
+ }
+
+ @Override
+ public String getSectionId() {
+ return m_sectionId;
+ }
+
+ void createSection(FormToolkit toolkit, Composite parent, String title, String description, int style, Section sibling) {
+ m_uiSection = toolkit.createSection(parent, style);
+ m_uiSection.addExpansionListener(new ExpansionAdapter() {
+ @Override
+ public void expansionStateChanged(ExpansionEvent e) {
+ reflow();
+ }
+ });
+ m_uiSection.setText(title);
+ if ((style & org.eclipse.ui.forms.widgets.Section.DESCRIPTION) != 0) {
+ m_uiSection.setDescription(description);
+ }
+ // position
+ if (sibling != null) {
+ m_uiSection.moveAbove(sibling.getUiSection());
+ }
+ // layout
+ TableWrapDataEx data = new TableWrapDataEx(TableWrapData.FILL_GRAB);
+ data.maxWidth = 260; // to scale presenter fill width properly. 260 = 2 x labelWidth
+ m_uiSection.setLayoutData(data);
+ Composite sectionClient = toolkit.createComposite(m_uiSection);
+ m_uiSection.setClient(sectionClient);
+ GridLayout layout = new GridLayout(1, true);
+ layout.horizontalSpacing = 3;
+ layout.verticalSpacing = 4;
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ sectionClient.setLayout(layout);
+ }
+
+ /**
+ * @return the uiSection
+ */
+ public org.eclipse.ui.forms.widgets.Section getUiSection() {
+ return m_uiSection;
+ }
+
+ @Override
+ public Composite getSectionClient() {
+ if (m_uiSection == null || m_uiSection.isDisposed()) {
+ throw new IllegalStateException("section has not been created or is disposed.");
+ }
+ return (Composite) m_uiSection.getClient();
+ }
+
+ @Override
+ public boolean isVisible() {
+ return m_uiSection.isVisible();
+ }
+
+ @Override
+ public void setVisible(boolean visible) {
+ if (isVisible() != visible) { // do this check as this call is very expensive
+ Object layoutData = m_uiSection.getLayoutData();
+ if (layoutData instanceof TableWrapDataEx) {
+ ((TableWrapDataEx) layoutData).exclude = !visible;
+ }
+ m_uiSection.setVisible(visible);
+ m_form.layout(true, true);
+ reflow();
+ }
+ }
+
+ @Override
+ public boolean isExpanded() {
+ return m_uiSection.isExpanded();
+ }
+
+ @Override
+ public void setExpanded(boolean expanded) {
+ if (isExpanded() != expanded) {
+ // expand forces a complete re-layout and redraw (slow).
+ // only call if a change is necessary.
+ m_uiSection.setExpanded(expanded);
+ }
+ }
+
+ /**
+ * @param listener
+ * @see org.eclipse.ui.forms.widgets.ExpandableComposite#addExpansionListener(org.eclipse.ui.forms.events.IExpansionListener)
+ */
+ @Override
+ public void addExpansionListener(IExpansionListener listener) {
+ m_uiSection.addExpansionListener(listener);
+ }
+
+ /**
+ * @param listener
+ * @see org.eclipse.swt.widgets.Control#addMouseWheelListener(org.eclipse.swt.events.MouseWheelListener)
+ */
+ @Override
+ public void addMouseWheelListener(MouseWheelListener listener) {
+ m_uiSection.addMouseWheelListener(listener);
+ }
+
+ /**
+ * @param listener
+ * @see org.eclipse.swt.widgets.Control#addTraverseListener(org.eclipse.swt.events.TraverseListener)
+ */
+ @Override
+ public void addTraverseListener(TraverseListener listener) {
+ m_uiSection.addTraverseListener(listener);
+ }
+
+ /**
+ * @return
+ * @see org.eclipse.ui.forms.widgets.ExpandableComposite#forceFocus()
+ */
+ @Override
+ public boolean forceFocus() {
+ return m_uiSection.forceFocus();
+ }
+
+ /**
+ * @return
+ * @see org.eclipse.swt.widgets.Control#getBackground()
+ */
+ @Override
+ public Color getBackground() {
+ return m_uiSection.getBackground();
+ }
+
+ /**
+ * @return
+ * @see org.eclipse.swt.widgets.Control#getBackgroundImage()
+ */
+ @Override
+ public Image getBackgroundImage() {
+ return m_uiSection.getBackgroundImage();
+ }
+
+ /**
+ * @return
+ * @see org.eclipse.swt.widgets.Composite#getBackgroundMode()
+ */
+ @Override
+ public int getBackgroundMode() {
+ return m_uiSection.getBackgroundMode();
+ }
+
+ /**
+ * @return
+ * @see org.eclipse.swt.widgets.Control#getBorderWidth()
+ */
+ @Override
+ public int getBorderWidth() {
+ return m_uiSection.getBorderWidth();
+ }
+
+ /**
+ * @return
+ * @see org.eclipse.swt.widgets.Control#getBounds()
+ */
+ @Override
+ public Rectangle getBounds() {
+ return m_uiSection.getBounds();
+ }
+
+ /**
+ * @return
+ * @see org.eclipse.swt.widgets.Canvas#getCaret()
+ */
+ @Override
+ public Caret getCaret() {
+ return m_uiSection.getCaret();
+ }
+
+ /**
+ * @return
+ * @see org.eclipse.ui.forms.widgets.Section#getDescription()
+ */
+ @Override
+ public String getDescription() {
+ return m_uiSection.getDescription();
+ }
+
+ /**
+ * @return
+ * @see org.eclipse.swt.widgets.Widget#getDisplay()
+ */
+ @Override
+ public Display getDisplay() {
+ return m_uiSection.getDisplay();
+ }
+
+ /**
+ * @return
+ * @see org.eclipse.swt.widgets.Control#getDragDetect()
+ */
+ @Override
+ public boolean getDragDetect() {
+ return m_uiSection.getDragDetect();
+ }
+
+ /**
+ * @return
+ * @see org.eclipse.swt.widgets.Control#getEnabled()
+ */
+ @Override
+ public boolean getEnabled() {
+ return m_uiSection.getEnabled();
+ }
+
+ /**
+ * @return
+ * @see org.eclipse.ui.forms.widgets.ExpandableComposite#getExpansionStyle()
+ */
+ @Override
+ public int getExpansionStyle() {
+ return m_uiSection.getExpansionStyle();
+ }
+
+ /**
+ * @return
+ * @see org.eclipse.swt.widgets.Control#getFont()
+ */
+ @Override
+ public Font getFont() {
+ return m_uiSection.getFont();
+ }
+
+ /**
+ * @return
+ * @see org.eclipse.swt.widgets.Control#getForeground()
+ */
+ @Override
+ public Color getForeground() {
+ return m_uiSection.getForeground();
+ }
+
+ /**
+ * @return
+ * @see org.eclipse.swt.widgets.Control#getMenu()
+ */
+ @Override
+ public Menu getMenu() {
+ return m_uiSection.getMenu();
+ }
+
+ /**
+ * @return
+ * @see org.eclipse.swt.widgets.Control#getMonitor()
+ */
+ @Override
+ public Monitor getMonitor() {
+ return m_uiSection.getMonitor();
+ }
+
+ /**
+ * @return
+ * @see org.eclipse.swt.widgets.Control#getShell()
+ */
+ @Override
+ public Shell getShell() {
+ return m_uiSection.getShell();
+ }
+
+ /**
+ * @return
+ * @see org.eclipse.swt.widgets.Control#getSize()
+ */
+ @Override
+ public Point getSize() {
+ return m_uiSection.getSize();
+ }
+
+ /**
+ * @return
+ * @see org.eclipse.swt.widgets.Widget#getStyle()
+ */
+ @Override
+ public int getStyle() {
+ return m_uiSection.getStyle();
+ }
+
+ /**
+ * @return
+ * @see org.eclipse.ui.forms.widgets.ExpandableComposite#getText()
+ */
+ @Override
+ public String getText() {
+ return m_uiSection.getText();
+ }
+
+ /**
+ * @return
+ * @see org.eclipse.ui.forms.widgets.ExpandableComposite#getTextClientHeightDifference()
+ */
+ @Override
+ public int getTextClientHeightDifference() {
+ return m_uiSection.getTextClientHeightDifference();
+ }
+
+ /**
+ * @return
+ * @see org.eclipse.ui.forms.widgets.Section#getTitleBarBackground()
+ */
+ @Override
+ public Color getTitleBarBackground() {
+ return m_uiSection.getTitleBarBackground();
+ }
+
+ /**
+ * @return
+ * @see org.eclipse.ui.forms.widgets.Section#getTitleBarBorderColor()
+ */
+ @Override
+ public Color getTitleBarBorderColor() {
+ return m_uiSection.getTitleBarBorderColor();
+ }
+
+ /**
+ * @return
+ * @see org.eclipse.ui.forms.widgets.ExpandableComposite#getTitleBarForeground()
+ */
+ @Override
+ public Color getTitleBarForeground() {
+ return m_uiSection.getTitleBarForeground();
+ }
+
+ /**
+ * @return
+ * @see org.eclipse.ui.forms.widgets.Section#getTitleBarGradientBackground()
+ */
+ @Override
+ public Color getTitleBarGradientBackground() {
+ return m_uiSection.getTitleBarGradientBackground();
+ }
+
+ /**
+ * @return
+ * @see org.eclipse.swt.widgets.Control#getToolTipText()
+ */
+ @Override
+ public String getToolTipText() {
+ return m_uiSection.getToolTipText();
+ }
+
+ /**
+ * @return
+ * @see org.eclipse.swt.widgets.Control#getVisible()
+ */
+ @Override
+ public boolean getVisible() {
+ return m_uiSection.getVisible();
+ }
+
+ /**
+ * @return
+ * @see org.eclipse.swt.widgets.Widget#isDisposed()
+ */
+ @Override
+ public boolean isDisposed() {
+ return m_uiSection.isDisposed();
+ }
+
+ /**
+ * @return
+ * @see org.eclipse.swt.widgets.Control#isEnabled()
+ */
+ @Override
+ public boolean isEnabled() {
+ return m_uiSection.isEnabled();
+ }
+
+ /**
+ * @return
+ * @see org.eclipse.swt.widgets.Control#isFocusControl()
+ */
+ @Override
+ public boolean isFocusControl() {
+ return m_uiSection.isFocusControl();
+ }
+
+ /**
+ * @see org.eclipse.swt.widgets.Composite#layout()
+ */
+ @Override
+ public void layout() {
+ m_uiSection.layout();
+ }
+
+ /**
+ * @param changed
+ * @param all
+ * @see org.eclipse.swt.widgets.Composite#layout(boolean, boolean)
+ */
+ @Override
+ public void layout(boolean changed, boolean all) {
+ m_uiSection.layout(changed, all);
+ }
+
+ /**
+ * @param changed
+ * @see org.eclipse.swt.widgets.Composite#layout(boolean)
+ */
+ @Override
+ public void layout(boolean changed) {
+ m_uiSection.layout(changed);
+ }
+
+ /**
+ * @param changed
+ * @see org.eclipse.swt.widgets.Composite#layout(org.eclipse.swt.widgets.Control[])
+ */
+ @Override
+ public void layout(Control[] changed) {
+ m_uiSection.layout(changed);
+ }
+
+ /**
+ * @see org.eclipse.swt.widgets.Control#pack()
+ */
+ @Override
+ public void pack() {
+ m_uiSection.pack();
+ }
+
+ /**
+ * @param changed
+ * @see org.eclipse.swt.widgets.Control#pack(boolean)
+ */
+ @Override
+ public void pack(boolean changed) {
+ m_uiSection.pack(changed);
+ }
+
+ /**
+ * @param listener
+ * @see org.eclipse.ui.forms.widgets.ExpandableComposite#removeExpansionListener(org.eclipse.ui.forms.events.IExpansionListener)
+ */
+ @Override
+ public void removeExpansionListener(IExpansionListener listener) {
+ m_uiSection.removeExpansionListener(listener);
+ }
+
+ /**
+ * @param listener
+ * @see org.eclipse.swt.widgets.Control#removeKeyListener(org.eclipse.swt.events.KeyListener)
+ */
+ @Override
+ public void removeKeyListener(KeyListener listener) {
+ m_uiSection.removeKeyListener(listener);
+ }
+
+ /**
+ * @param eventType
+ * @param listener
+ * @see org.eclipse.swt.widgets.Widget#removeListener(int, org.eclipse.swt.widgets.Listener)
+ */
+ @Override
+ public void removeListener(int eventType, Listener listener) {
+ m_uiSection.removeListener(eventType, listener);
+ }
+
+ /**
+ * @param listener
+ * @see org.eclipse.swt.widgets.Control#removeTraverseListener(org.eclipse.swt.events.TraverseListener)
+ */
+ @Override
+ public void removeTraverseListener(TraverseListener listener) {
+ m_uiSection.removeTraverseListener(listener);
+ }
+
+ /**
+ * @param bg
+ * @see org.eclipse.ui.forms.widgets.Section#setBackground(org.eclipse.swt.graphics.Color)
+ */
+ @Override
+ public void setBackground(Color bg) {
+ m_uiSection.setBackground(bg);
+ }
+
+ /**
+ * @param image
+ * @see org.eclipse.ui.forms.widgets.Section#setBackgroundImage(org.eclipse.swt.graphics.Image)
+ */
+ @Override
+ public final void setBackgroundImage(Image image) {
+ m_uiSection.setBackgroundImage(image);
+ }
+
+ /**
+ * @param mode
+ * @see org.eclipse.swt.widgets.Composite#setBackgroundMode(int)
+ */
+ @Override
+ public void setBackgroundMode(int mode) {
+ m_uiSection.setBackgroundMode(mode);
+ }
+
+ /**
+ * @param x
+ * @param y
+ * @param width
+ * @param height
+ * @see org.eclipse.swt.widgets.Control#setBounds(int, int, int, int)
+ */
+ @Override
+ public void setBounds(int x, int y, int width, int height) {
+ m_uiSection.setBounds(x, y, width, height);
+ }
+
+ /**
+ * @param rect
+ * @see org.eclipse.swt.widgets.Control#setBounds(org.eclipse.swt.graphics.Rectangle)
+ */
+ @Override
+ public void setBounds(Rectangle rect) {
+ m_uiSection.setBounds(rect);
+ }
+
+ /**
+ * @param capture
+ * @see org.eclipse.swt.widgets.Control#setCapture(boolean)
+ */
+ @Override
+ public void setCapture(boolean capture) {
+ m_uiSection.setCapture(capture);
+ }
+
+ /**
+ * @param caret
+ * @see org.eclipse.swt.widgets.Canvas#setCaret(org.eclipse.swt.widgets.Caret)
+ */
+ @Override
+ public void setCaret(Caret caret) {
+ m_uiSection.setCaret(caret);
+ }
+
+ /**
+ * @param cursor
+ * @see org.eclipse.swt.widgets.Control#setCursor(org.eclipse.swt.graphics.Cursor)
+ */
+ @Override
+ public void setCursor(Cursor cursor) {
+ m_uiSection.setCursor(cursor);
+ }
+
+ /**
+ * @param description
+ * @see org.eclipse.ui.forms.widgets.Section#setDescription(java.lang.String)
+ */
+ @Override
+ public void setDescription(String description) {
+ m_uiSection.setDescription(description);
+ }
+
+ /**
+ * @param dragDetect
+ * @see org.eclipse.swt.widgets.Control#setDragDetect(boolean)
+ */
+ @Override
+ public void setDragDetect(boolean dragDetect) {
+ m_uiSection.setDragDetect(dragDetect);
+ }
+
+ /**
+ * @param enabled
+ * @see org.eclipse.ui.forms.widgets.ExpandableComposite#setEnabled(boolean)
+ */
+ @Override
+ public void setEnabled(boolean enabled) {
+ m_uiSection.setEnabled(enabled);
+ }
+
+ /**
+ * @return
+ * @see org.eclipse.swt.widgets.Composite#setFocus()
+ */
+ @Override
+ public boolean setFocus() {
+ return m_uiSection.setFocus();
+ }
+
+ /**
+ * @param font
+ * @see org.eclipse.ui.forms.widgets.ExpandableComposite#setFont(org.eclipse.swt.graphics.Font)
+ */
+ @Override
+ public void setFont(Font font) {
+ m_uiSection.setFont(font);
+ }
+
+ /**
+ * @param fg
+ * @see org.eclipse.ui.forms.widgets.Section#setForeground(org.eclipse.swt.graphics.Color)
+ */
+ @Override
+ public void setForeground(Color fg) {
+ m_uiSection.setForeground(fg);
+ }
+
+ /**
+ * @param menu
+ * @see org.eclipse.ui.forms.widgets.ExpandableComposite#setMenu(org.eclipse.swt.widgets.Menu)
+ */
+ @Override
+ public void setMenu(Menu menu) {
+ m_uiSection.setMenu(menu);
+ }
+
+ /**
+ * @param width
+ * @param height
+ * @see org.eclipse.swt.widgets.Control#setSize(int, int)
+ */
+ @Override
+ public void setSize(int width, int height) {
+ m_uiSection.setSize(width, height);
+ }
+
+ /**
+ * @param size
+ * @see org.eclipse.swt.widgets.Control#setSize(org.eclipse.swt.graphics.Point)
+ */
+ @Override
+ public void setSize(Point size) {
+ m_uiSection.setSize(size);
+ }
+
+ /**
+ * @param title
+ * @see org.eclipse.ui.forms.widgets.ExpandableComposite#setText(java.lang.String)
+ */
+ @Override
+ public void setText(String title) {
+ m_uiSection.setText(title);
+ }
+
+ /**
+ * @param color
+ * @see org.eclipse.ui.forms.widgets.Section#setTitleBarBackground(org.eclipse.swt.graphics.Color)
+ */
+ @Override
+ public void setTitleBarBackground(Color color) {
+ m_uiSection.setTitleBarBackground(color);
+ }
+
+ /**
+ * @param color
+ * @see org.eclipse.ui.forms.widgets.Section#setTitleBarBorderColor(org.eclipse.swt.graphics.Color)
+ */
+ @Override
+ public void setTitleBarBorderColor(Color color) {
+ m_uiSection.setTitleBarBorderColor(color);
+ }
+
+ /**
+ * @param color
+ * @see org.eclipse.ui.forms.widgets.ExpandableComposite#setTitleBarForeground(org.eclipse.swt.graphics.Color)
+ */
+ @Override
+ public void setTitleBarForeground(Color color) {
+ m_uiSection.setTitleBarForeground(color);
+ }
+
+ /**
+ * @param color
+ * @see org.eclipse.ui.forms.widgets.Section#setTitleBarGradientBackground(org.eclipse.swt.graphics.Color)
+ */
+ @Override
+ public void setTitleBarGradientBackground(Color color) {
+ m_uiSection.setTitleBarGradientBackground(color);
+ }
+
+ /**
+ * @param c
+ * @see org.eclipse.ui.forms.widgets.ExpandableComposite#setToggleColor(org.eclipse.swt.graphics.Color)
+ */
+ @Override
+ public void setToggleColor(Color c) {
+ m_uiSection.setToggleColor(c);
+ }
+
+ /**
+ * @param string
+ * @see org.eclipse.swt.widgets.Control#setToolTipText(java.lang.String)
+ */
+ @Override
+ public void setToolTipText(String string) {
+ m_uiSection.setToolTipText(string);
+ }
+
+ /**
+ * @param x
+ * @param y
+ * @return
+ * @see org.eclipse.swt.widgets.Control#toControl(int, int)
+ */
+ @Override
+ public Point toControl(int x, int y) {
+ return m_uiSection.toControl(x, y);
+ }
+
+ /**
+ * @param point
+ * @return
+ * @see org.eclipse.swt.widgets.Control#toControl(org.eclipse.swt.graphics.Point)
+ */
+ @Override
+ public Point toControl(Point point) {
+ return m_uiSection.toControl(point);
+ }
+
+ /**
+ * @param x
+ * @param y
+ * @return
+ * @see org.eclipse.swt.widgets.Control#toDisplay(int, int)
+ */
+ @Override
+ public Point toDisplay(int x, int y) {
+ return m_uiSection.toDisplay(x, y);
+ }
+
+ /**
+ * @param point
+ * @return
+ * @see org.eclipse.swt.widgets.Control#toDisplay(org.eclipse.swt.graphics.Point)
+ */
+ @Override
+ public Point toDisplay(Point point) {
+ return m_uiSection.toDisplay(point);
+ }
+
+ /**
+ * @param traversal
+ * @return
+ * @see org.eclipse.swt.widgets.Control#traverse(int)
+ */
+ @Override
+ public boolean traverse(int traversal) {
+ return m_uiSection.traverse(traversal);
+ }
+
+ /**
+ * @see org.eclipse.swt.widgets.Control#update()
+ */
+ @Override
+ public void update() {
+ m_uiSection.update();
+ }
+
+ @Override
+ public void reflow() {
+ m_form.reflow(true);
+ }
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/multipage/AbstractMultiPageSectionBasedViewPart.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/multipage/AbstractMultiPageSectionBasedViewPart.java
index 2eaacab5f..6f5ec509d 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/multipage/AbstractMultiPageSectionBasedViewPart.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/multipage/AbstractMultiPageSectionBasedViewPart.java
@@ -1,75 +1,75 @@
-/*******************************************************************************
- * 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.view.properties.part.multipage;
-
-import org.eclipse.scout.sdk.ui.extensions.view.property.IMultiPropertyViewPart;
-import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
-import org.eclipse.scout.sdk.ui.view.properties.part.AbstractSectionBasedPart;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-
-/**
- * <h3>AbstractSinglePageSectionBasedViewPart</h3> ...
- *
- * @author Andreas Hoegger
- * @since 1.0.8 23.07.2010
- */
-public abstract class AbstractMultiPageSectionBasedViewPart extends AbstractSectionBasedPart implements IMultiPropertyViewPart {
-
- private IPage[] m_pages;
-
- @Override
- public void setPages(IPage[] pages) {
- m_pages = pages;
- }
-
- @Override
- public IPage[] getPages() {
- return m_pages;
- }
-
- @Override
- protected Control createHead(Composite parent) {
- Composite headArea = getFormToolkit().createComposite(parent);
- Label title = getFormToolkit().createLabel(headArea, "", SWT.WRAP | SWT.READ_ONLY);
- updatePageName(title);
- // layout
- headArea.setLayout(new GridLayout(1, true));
- GridData titleData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL);
- titleData.widthHint = 100;
- title.setLayoutData(titleData);
- return headArea;
- }
-
- protected void updatePageName(Label l) {
- StringBuilder labelBuilder = new StringBuilder();
- labelBuilder.append("Pages '");
- IPage[] pages = getPages();
- for (int i = 0; i < pages.length; i++) {
- labelBuilder.append(pages[i].getName());
- if (i < pages.length - 1) {
- labelBuilder.append(", ");
- }
- }
- if (labelBuilder.length() > 150) {
- l.setToolTipText(labelBuilder.toString());
- l.setText(labelBuilder.subSequence(0, 147) + "...");
- }
- else {
- l.setText(labelBuilder.toString());
- }
- }
-
-}
+/*******************************************************************************
+ * 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.view.properties.part.multipage;
+
+import org.eclipse.scout.sdk.ui.extensions.view.property.IMultiPropertyViewPart;
+import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
+import org.eclipse.scout.sdk.ui.view.properties.part.AbstractSectionBasedPart;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+
+/**
+ * <h3>AbstractSinglePageSectionBasedViewPart</h3> ...
+ *
+ * @author Andreas Hoegger
+ * @since 1.0.8 23.07.2010
+ */
+public abstract class AbstractMultiPageSectionBasedViewPart extends AbstractSectionBasedPart implements IMultiPropertyViewPart {
+
+ private IPage[] m_pages;
+
+ @Override
+ public void setPages(IPage[] pages) {
+ m_pages = pages;
+ }
+
+ @Override
+ public IPage[] getPages() {
+ return m_pages;
+ }
+
+ @Override
+ protected Control createHead(Composite parent) {
+ Composite headArea = getFormToolkit().createComposite(parent);
+ Label title = getFormToolkit().createLabel(headArea, "", SWT.WRAP | SWT.READ_ONLY);
+ updatePageName(title);
+ // layout
+ headArea.setLayout(new GridLayout(1, true));
+ GridData titleData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL);
+ titleData.widthHint = 100;
+ title.setLayoutData(titleData);
+ return headArea;
+ }
+
+ protected void updatePageName(Label l) {
+ StringBuilder labelBuilder = new StringBuilder();
+ labelBuilder.append("Pages '");
+ IPage[] pages = getPages();
+ for (int i = 0; i < pages.length; i++) {
+ labelBuilder.append(pages[i].getName());
+ if (i < pages.length - 1) {
+ labelBuilder.append(", ");
+ }
+ }
+ if (labelBuilder.length() > 150) {
+ l.setToolTipText(labelBuilder.toString());
+ l.setText(labelBuilder.subSequence(0, 147) + "...");
+ }
+ else {
+ l.setText(labelBuilder.toString());
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/multipage/JdtTypeMultiPropertyPart.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/multipage/JdtTypeMultiPropertyPart.java
index 8bb167555..044445ed0 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/multipage/JdtTypeMultiPropertyPart.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/multipage/JdtTypeMultiPropertyPart.java
@@ -1,297 +1,297 @@
-/*******************************************************************************
- * 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.view.properties.part.multipage;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jdt.core.IElementChangedListener;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IMethod;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.multi.MultiBooleanPresenter;
-import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.multi.MultiIntegerPresenter;
-import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.multi.MultiLongPresenter;
-import org.eclipse.scout.sdk.ui.view.outline.pages.AbstractScoutTypePage;
-import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
-import org.eclipse.scout.sdk.ui.view.properties.part.ISection;
-import org.eclipse.scout.sdk.ui.view.properties.presenter.multi.AbstractMultiMethodPresenter;
-import org.eclipse.scout.sdk.util.jdt.ElementChangedListenerEx;
-import org.eclipse.scout.sdk.workspace.type.config.ConfigPropertyTypeSet;
-import org.eclipse.scout.sdk.workspace.type.config.ConfigurationMethod;
-import org.eclipse.scout.sdk.workspace.type.config.ConfigurationMethodSet;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-
-/**
- * <h3>JdtTypeMultiPropertyPart</h3> ...
- *
- * @author Andreas Hoegger
- * @since 1.0.8 23.07.2010
- */
-public class JdtTypeMultiPropertyPart extends AbstractMultiPageSectionBasedViewPart {
- private static final String SECTION_ID_PROPERTIES = "section.properties";
-
- private IElementChangedListener m_methodChangedListener;
- private ConfigPropertyTypeSet m_configPropertyTypeSet;
-
- private HashMap<String, AbstractMultiMethodPresenter<?>> m_methodPresenters;
- private P_DelayedUpdateJob m_updateJob;
-
- public JdtTypeMultiPropertyPart() {
- m_methodPresenters = new HashMap<String, AbstractMultiMethodPresenter<?>>();
- }
-
- @Override
- protected void createSections() {
- ArrayList<IType> types = new ArrayList<IType>();
- for (IPage p : getPages()) {
- if (p instanceof AbstractScoutTypePage) {
- types.add(((AbstractScoutTypePage) p).getType());
- }
- else {
- return;
- }
- }
- m_configPropertyTypeSet = new ConfigPropertyTypeSet(types.toArray(new IType[types.size()]));
- if (m_configPropertyTypeSet.hasConfigPropertyMethods()) {
- ISection propertySection = createSection(SECTION_ID_PROPERTIES, "Properties");
- for (ConfigurationMethodSet set : m_configPropertyTypeSet.getCommonConfigPropertyMethodSets()) {
- createConfigMethodPresenter(propertySection.getSectionClient(), set);
- }
- }
- super.createSections();
- if (m_updateJob == null) {
- m_updateJob = new P_DelayedUpdateJob(getForm().getDisplay());
- }
- if (m_methodChangedListener == null) {
- m_methodChangedListener = new P_MethodChangedListener2();
- JavaCore.addElementChangedListener(m_methodChangedListener);
- }
- }
-
- @Override
- public void cleanup() {
- if (m_methodChangedListener != null) {
- JavaCore.removeElementChangedListener(m_methodChangedListener);
- m_methodChangedListener = null;
- }
- if (m_updateJob != null) {
- m_updateJob.cancel();
- m_updateJob = null;
- }
- }
-
- protected AbstractMultiMethodPresenter createConfigMethodPresenter(Composite parent, ConfigurationMethodSet methodSet) {
- AbstractMultiMethodPresenter presenter = null;
- String propertyType = methodSet.getConfigAnnotationType();
-
- if (propertyType.equals("BOOLEAN")) {
- presenter = new MultiBooleanPresenter(getFormToolkit(), parent);
- presenter.setMethodSet(methodSet);
- }
- else if (propertyType.equals("DOUBLE")) {
- //TODO: multi double presenter
- }
- else if (propertyType.equals("DRAG_AND_DROP_TYPE")) {
- // TODO: multi DRAG_AND_DROP_TYPE presenter
- }
- else if (propertyType.equals("INTEGER")) {
- presenter = new MultiIntegerPresenter(getFormToolkit(), parent);
- presenter.setMethodSet(methodSet);
- }
- else if (propertyType.equals("LONG")) {
- presenter = new MultiLongPresenter(getFormToolkit(), parent);
- presenter.setMethodSet(methodSet);
- }
- else if (propertyType.equals("STRING")) {
- //TODO: multi string presenter
- }
- else if (propertyType.equals("FONT")) {
- //TODO: multi font presenter
- }
- else if (propertyType.equals("COLOR")) {
- //TODO: multi color presenter
- }
- else if (propertyType.equals("OBJECT")) {
- //TODO: multi object presenter
- }
- else if (propertyType.equals("BUTTON_DISPLAY_STYLE")) {
- //TODO: multi BUTTON_DISPLAY_STYLE presenter
- }
- else if (propertyType.equals("BUTTON_SYSTEM_TYPE")) {
- //TODO: multi BUTTON_SYSTEM_TYPE presenter
- }
- else if (propertyType.equals("CODE_TYPE")) {
- //TODO: multi CODE_TYPE presenter
- }
- else if (propertyType.equals("COMPOSER_ATTRIBUTE_TYPE")) {
- //TODO: multi COMPOSER_ATTRIBUTE_TYPE presenter
- }
- else if (propertyType.equals("FILE_EXTENSIONS")) {
- // TODO: multi FILE_EXTENSIONS presenter
- }
- else if (propertyType.equals("FORM_DISPLAY_HINT")) {
- //TODO: multi FORM_DISPLAY_HINT presenter
- }
- else if (propertyType.equals("FORM_VIEW_ID")) {
- //TODO: multi FORM_VIEW_ID presenter
- }
- else if (propertyType.equals("HORIZONTAL_ALIGNMENT")) {
- //TODO: multi HORIZONTAL_ALIGNMENT presenter
- }
- else if (propertyType.equals("ICON_ID")) {
- //TODO: multi ICON_ID presenter
- }
- else if (propertyType.equals("KEY_STROKE")) {
- // NOT in use
- }
- else if (propertyType.equals("LOOKUP_CALL")) {
- //TODO: multi LOOKUP_CALL presenter
- }
- else if (propertyType.equals("LOOKUP_SERVICE")) {
- //TODO: multi LOOKUP_SERVICE presenter
- }
- else if (propertyType.equals("MASTER_FIELD")) {
- //TODO: multi MASTER_FIELD presenter
- }
- else if (propertyType.equals("OUTLINE_ROOT_PAGE")) {
- //TODO: multi OUTLINE_ROOT_PAGE presenter
- }
- else if (propertyType.equals("OUTLINE")) {
- //TODO: multi OUTLINE presenter
- }
- else if (propertyType.equals("OUTLINES")) {
- //TODO: multi OUTLINES presenter
- }
- else if (propertyType.equals("FORM")) {
- //TODO: multi form presenter
- }
- else if (propertyType.equals("SEARCH_FORM")) {
- //TODO: multi SEARCH_FORM presenter
- }
- else if (propertyType.equals("NLS_PROVIDER")) {
- //TODO: multi NLS_PROVIDER presenter
- }
- else if (propertyType.equals("SQL_STYLE")) {
- //TODO: multi sql_style presenter
- }
- else if (propertyType.equals("SQL")) {
- //TODO: multi SQL presenter
- }
- else if (propertyType.equals("TEXT")) {
- //TODO: multi TEXT presenter
- }
- else if (propertyType.equals("VERTICAL_ALIGNMENT")) {
- //TODO: multi VERTICAL_ALIGNMENT presenter
- }
- else if (propertyType.equals("CHART_QNAME")) {
- //TODO: multi CHART_QNAME presenter
- }
- else if (propertyType.equals("HOUR_OF_DAY")) {
- //TODO: multi HOUR_OF_DAY presenter
- }
- else if (propertyType.equals("DURATION_MINUTES")) {
- //TODO: multi DURATION_MINUTES presenter
- }
- else if (propertyType.equals("MENU_CLASS")) {
- //TODO: multi MENU_CLASS presenter
- }
- else if (propertyType.equals("PRIMITIVE_TYPE")) {
- //TODO: multi PRIMITIVE_TYPE presenter
- }
-
- // layout
- if (presenter != null) {
- GridData layoutData = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
- layoutData.widthHint = 200;
- presenter.getContainer().setLayoutData(layoutData);
- m_methodPresenters.put(methodSet.getMethodName(), presenter);
- }
- else {
- ScoutSdkUi.logInfo("Could not find a multi presenter for property '" + propertyType + "'.");
- }
- return presenter;
- }
-
- private void handleMethodChanged(IMethod method) {
- if (m_configPropertyTypeSet.isRelevantType(method.getDeclaringType())) {
- ConfigurationMethod updatedMethod = m_configPropertyTypeSet.updateIfChanged(method);
- if (updatedMethod != null) {
- AbstractMultiMethodPresenter presenter = m_methodPresenters.get(updatedMethod.getMethodName());
- if (presenter != null) {
- m_updateJob.update(presenter, m_configPropertyTypeSet.getConfigurationMethodSet(updatedMethod.getMethodName()));
-
- }
- }
- }
- }
-
- private class P_MethodChangedListener2 extends ElementChangedListenerEx {
- @Override
- protected boolean visit(int kind, int flags, IJavaElement e, CompilationUnit ast) {
- if (e != null && e.getElementType() == IJavaElement.METHOD) {
- handleMethodChanged((IMethod) e);
- return true;
- }
- return super.visit(kind, flags, e, ast);
- }
- } // end class P_MethodChangedListener2
-
- private class P_DelayedUpdateJob extends Job {
- private Object m_delayedUpdateLock = new Object();
- private ConfigurationMethodSet m_methodSet;
- private AbstractMultiMethodPresenter m_presenter;
- private final Display m_display;
-
- /**
- * @param name
- */
- public P_DelayedUpdateJob(Display display) {
- super("");
- m_display = display;
- }
-
- private void update(AbstractMultiMethodPresenter presenter, ConfigurationMethodSet methodSet) {
- synchronized (m_delayedUpdateLock) {
- cancel();
- setName(Texts.get("UpdatePresenterForX", methodSet.getMethodName()));
- m_presenter = presenter;
- m_methodSet = methodSet;
- schedule(200);
- }
- }
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- synchronized (m_delayedUpdateLock) {
- m_display.syncExec(new Runnable() {
- @Override
- public void run() {
- if (m_presenter.getContainer() != null && !m_presenter.getContainer().isDisposed()) {
- m_presenter.setMethodSet(m_methodSet);
- }
- }
- });
- return Status.OK_STATUS;
- }
- }
- }
-}
+/*******************************************************************************
+ * 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.view.properties.part.multipage;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jdt.core.IElementChangedListener;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.multi.MultiBooleanPresenter;
+import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.multi.MultiIntegerPresenter;
+import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.multi.MultiLongPresenter;
+import org.eclipse.scout.sdk.ui.view.outline.pages.AbstractScoutTypePage;
+import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
+import org.eclipse.scout.sdk.ui.view.properties.part.ISection;
+import org.eclipse.scout.sdk.ui.view.properties.presenter.multi.AbstractMultiMethodPresenter;
+import org.eclipse.scout.sdk.util.jdt.ElementChangedListenerEx;
+import org.eclipse.scout.sdk.workspace.type.config.ConfigPropertyTypeSet;
+import org.eclipse.scout.sdk.workspace.type.config.ConfigurationMethod;
+import org.eclipse.scout.sdk.workspace.type.config.ConfigurationMethodSet;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * <h3>JdtTypeMultiPropertyPart</h3> ...
+ *
+ * @author Andreas Hoegger
+ * @since 1.0.8 23.07.2010
+ */
+public class JdtTypeMultiPropertyPart extends AbstractMultiPageSectionBasedViewPart {
+ private static final String SECTION_ID_PROPERTIES = "section.properties";
+
+ private IElementChangedListener m_methodChangedListener;
+ private ConfigPropertyTypeSet m_configPropertyTypeSet;
+
+ private HashMap<String, AbstractMultiMethodPresenter<?>> m_methodPresenters;
+ private P_DelayedUpdateJob m_updateJob;
+
+ public JdtTypeMultiPropertyPart() {
+ m_methodPresenters = new HashMap<String, AbstractMultiMethodPresenter<?>>();
+ }
+
+ @Override
+ protected void createSections() {
+ ArrayList<IType> types = new ArrayList<IType>();
+ for (IPage p : getPages()) {
+ if (p instanceof AbstractScoutTypePage) {
+ types.add(((AbstractScoutTypePage) p).getType());
+ }
+ else {
+ return;
+ }
+ }
+ m_configPropertyTypeSet = new ConfigPropertyTypeSet(types.toArray(new IType[types.size()]));
+ if (m_configPropertyTypeSet.hasConfigPropertyMethods()) {
+ ISection propertySection = createSection(SECTION_ID_PROPERTIES, "Properties");
+ for (ConfigurationMethodSet set : m_configPropertyTypeSet.getCommonConfigPropertyMethodSets()) {
+ createConfigMethodPresenter(propertySection.getSectionClient(), set);
+ }
+ }
+ super.createSections();
+ if (m_updateJob == null) {
+ m_updateJob = new P_DelayedUpdateJob(getForm().getDisplay());
+ }
+ if (m_methodChangedListener == null) {
+ m_methodChangedListener = new P_MethodChangedListener2();
+ JavaCore.addElementChangedListener(m_methodChangedListener);
+ }
+ }
+
+ @Override
+ public void cleanup() {
+ if (m_methodChangedListener != null) {
+ JavaCore.removeElementChangedListener(m_methodChangedListener);
+ m_methodChangedListener = null;
+ }
+ if (m_updateJob != null) {
+ m_updateJob.cancel();
+ m_updateJob = null;
+ }
+ }
+
+ protected AbstractMultiMethodPresenter createConfigMethodPresenter(Composite parent, ConfigurationMethodSet methodSet) {
+ AbstractMultiMethodPresenter presenter = null;
+ String propertyType = methodSet.getConfigAnnotationType();
+
+ if (propertyType.equals("BOOLEAN")) {
+ presenter = new MultiBooleanPresenter(getFormToolkit(), parent);
+ presenter.setMethodSet(methodSet);
+ }
+ else if (propertyType.equals("DOUBLE")) {
+ //TODO: multi double presenter
+ }
+ else if (propertyType.equals("DRAG_AND_DROP_TYPE")) {
+ // TODO: multi DRAG_AND_DROP_TYPE presenter
+ }
+ else if (propertyType.equals("INTEGER")) {
+ presenter = new MultiIntegerPresenter(getFormToolkit(), parent);
+ presenter.setMethodSet(methodSet);
+ }
+ else if (propertyType.equals("LONG")) {
+ presenter = new MultiLongPresenter(getFormToolkit(), parent);
+ presenter.setMethodSet(methodSet);
+ }
+ else if (propertyType.equals("STRING")) {
+ //TODO: multi string presenter
+ }
+ else if (propertyType.equals("FONT")) {
+ //TODO: multi font presenter
+ }
+ else if (propertyType.equals("COLOR")) {
+ //TODO: multi color presenter
+ }
+ else if (propertyType.equals("OBJECT")) {
+ //TODO: multi object presenter
+ }
+ else if (propertyType.equals("BUTTON_DISPLAY_STYLE")) {
+ //TODO: multi BUTTON_DISPLAY_STYLE presenter
+ }
+ else if (propertyType.equals("BUTTON_SYSTEM_TYPE")) {
+ //TODO: multi BUTTON_SYSTEM_TYPE presenter
+ }
+ else if (propertyType.equals("CODE_TYPE")) {
+ //TODO: multi CODE_TYPE presenter
+ }
+ else if (propertyType.equals("COMPOSER_ATTRIBUTE_TYPE")) {
+ //TODO: multi COMPOSER_ATTRIBUTE_TYPE presenter
+ }
+ else if (propertyType.equals("FILE_EXTENSIONS")) {
+ // TODO: multi FILE_EXTENSIONS presenter
+ }
+ else if (propertyType.equals("FORM_DISPLAY_HINT")) {
+ //TODO: multi FORM_DISPLAY_HINT presenter
+ }
+ else if (propertyType.equals("FORM_VIEW_ID")) {
+ //TODO: multi FORM_VIEW_ID presenter
+ }
+ else if (propertyType.equals("HORIZONTAL_ALIGNMENT")) {
+ //TODO: multi HORIZONTAL_ALIGNMENT presenter
+ }
+ else if (propertyType.equals("ICON_ID")) {
+ //TODO: multi ICON_ID presenter
+ }
+ else if (propertyType.equals("KEY_STROKE")) {
+ // NOT in use
+ }
+ else if (propertyType.equals("LOOKUP_CALL")) {
+ //TODO: multi LOOKUP_CALL presenter
+ }
+ else if (propertyType.equals("LOOKUP_SERVICE")) {
+ //TODO: multi LOOKUP_SERVICE presenter
+ }
+ else if (propertyType.equals("MASTER_FIELD")) {
+ //TODO: multi MASTER_FIELD presenter
+ }
+ else if (propertyType.equals("OUTLINE_ROOT_PAGE")) {
+ //TODO: multi OUTLINE_ROOT_PAGE presenter
+ }
+ else if (propertyType.equals("OUTLINE")) {
+ //TODO: multi OUTLINE presenter
+ }
+ else if (propertyType.equals("OUTLINES")) {
+ //TODO: multi OUTLINES presenter
+ }
+ else if (propertyType.equals("FORM")) {
+ //TODO: multi form presenter
+ }
+ else if (propertyType.equals("SEARCH_FORM")) {
+ //TODO: multi SEARCH_FORM presenter
+ }
+ else if (propertyType.equals("NLS_PROVIDER")) {
+ //TODO: multi NLS_PROVIDER presenter
+ }
+ else if (propertyType.equals("SQL_STYLE")) {
+ //TODO: multi sql_style presenter
+ }
+ else if (propertyType.equals("SQL")) {
+ //TODO: multi SQL presenter
+ }
+ else if (propertyType.equals("TEXT")) {
+ //TODO: multi TEXT presenter
+ }
+ else if (propertyType.equals("VERTICAL_ALIGNMENT")) {
+ //TODO: multi VERTICAL_ALIGNMENT presenter
+ }
+ else if (propertyType.equals("CHART_QNAME")) {
+ //TODO: multi CHART_QNAME presenter
+ }
+ else if (propertyType.equals("HOUR_OF_DAY")) {
+ //TODO: multi HOUR_OF_DAY presenter
+ }
+ else if (propertyType.equals("DURATION_MINUTES")) {
+ //TODO: multi DURATION_MINUTES presenter
+ }
+ else if (propertyType.equals("MENU_CLASS")) {
+ //TODO: multi MENU_CLASS presenter
+ }
+ else if (propertyType.equals("PRIMITIVE_TYPE")) {
+ //TODO: multi PRIMITIVE_TYPE presenter
+ }
+
+ // layout
+ if (presenter != null) {
+ GridData layoutData = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
+ layoutData.widthHint = 200;
+ presenter.getContainer().setLayoutData(layoutData);
+ m_methodPresenters.put(methodSet.getMethodName(), presenter);
+ }
+ else {
+ ScoutSdkUi.logInfo("Could not find a multi presenter for property '" + propertyType + "'.");
+ }
+ return presenter;
+ }
+
+ private void handleMethodChanged(IMethod method) {
+ if (m_configPropertyTypeSet.isRelevantType(method.getDeclaringType())) {
+ ConfigurationMethod updatedMethod = m_configPropertyTypeSet.updateIfChanged(method);
+ if (updatedMethod != null) {
+ AbstractMultiMethodPresenter presenter = m_methodPresenters.get(updatedMethod.getMethodName());
+ if (presenter != null) {
+ m_updateJob.update(presenter, m_configPropertyTypeSet.getConfigurationMethodSet(updatedMethod.getMethodName()));
+
+ }
+ }
+ }
+ }
+
+ private class P_MethodChangedListener2 extends ElementChangedListenerEx {
+ @Override
+ protected boolean visit(int kind, int flags, IJavaElement e, CompilationUnit ast) {
+ if (e != null && e.getElementType() == IJavaElement.METHOD) {
+ handleMethodChanged((IMethod) e);
+ return true;
+ }
+ return super.visit(kind, flags, e, ast);
+ }
+ } // end class P_MethodChangedListener2
+
+ private class P_DelayedUpdateJob extends Job {
+ private Object m_delayedUpdateLock = new Object();
+ private ConfigurationMethodSet m_methodSet;
+ private AbstractMultiMethodPresenter m_presenter;
+ private final Display m_display;
+
+ /**
+ * @param name
+ */
+ public P_DelayedUpdateJob(Display display) {
+ super("");
+ m_display = display;
+ }
+
+ private void update(AbstractMultiMethodPresenter presenter, ConfigurationMethodSet methodSet) {
+ synchronized (m_delayedUpdateLock) {
+ cancel();
+ setName(Texts.get("UpdatePresenterForX", methodSet.getMethodName()));
+ m_presenter = presenter;
+ m_methodSet = methodSet;
+ schedule(200);
+ }
+ }
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ synchronized (m_delayedUpdateLock) {
+ m_display.syncExec(new Runnable() {
+ @Override
+ public void run() {
+ if (m_presenter.getContainer() != null && !m_presenter.getContainer().isDisposed()) {
+ m_presenter.setMethodSet(m_methodSet);
+ }
+ }
+ });
+ return Status.OK_STATUS;
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/multipage/UnknownMultiPagePropertyViewPart.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/multipage/UnknownMultiPagePropertyViewPart.java
index 1d4c94ccf..1e86358e8 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/multipage/UnknownMultiPagePropertyViewPart.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/multipage/UnknownMultiPagePropertyViewPart.java
@@ -1,44 +1,44 @@
-/*******************************************************************************
- * 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.view.properties.part.multipage;
-
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
-import org.eclipse.swt.widgets.Label;
-
-/**
- * <h3>UnknownPropertyViewPart</h3> ...
- *
- * @author Andreas Hoegger
- * @since 1.0.8 21.07.2010
- */
-public class UnknownMultiPagePropertyViewPart extends AbstractMultiPageSectionBasedViewPart {
-
- @Override
- protected void updatePageName(Label l) {
- StringBuilder labelBuilder = new StringBuilder(Texts.get("Pages"));
- labelBuilder.append(" '");
- IPage[] pages = getPages();
- for (int i = 0; i < pages.length; i++) {
- labelBuilder.append(pages[i].getName());
- if (i < pages.length - 1) {
- labelBuilder.append(", ");
- }
- }
- if (labelBuilder.length() > 150) {
- l.setToolTipText(labelBuilder.toString());
- l.setText(labelBuilder.subSequence(0, 147) + "...");
- }
- else {
- l.setText(labelBuilder.toString());
- }
- }
-}
+/*******************************************************************************
+ * 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.view.properties.part.multipage;
+
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
+import org.eclipse.swt.widgets.Label;
+
+/**
+ * <h3>UnknownPropertyViewPart</h3> ...
+ *
+ * @author Andreas Hoegger
+ * @since 1.0.8 21.07.2010
+ */
+public class UnknownMultiPagePropertyViewPart extends AbstractMultiPageSectionBasedViewPart {
+
+ @Override
+ protected void updatePageName(Label l) {
+ StringBuilder labelBuilder = new StringBuilder(Texts.get("Pages"));
+ labelBuilder.append(" '");
+ IPage[] pages = getPages();
+ for (int i = 0; i < pages.length; i++) {
+ labelBuilder.append(pages[i].getName());
+ if (i < pages.length - 1) {
+ labelBuilder.append(", ");
+ }
+ }
+ if (labelBuilder.length() > 150) {
+ l.setToolTipText(labelBuilder.toString());
+ l.setText(labelBuilder.subSequence(0, 147) + "...");
+ }
+ else {
+ l.setText(labelBuilder.toString());
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/singlepage/AbstractSinglePageSectionBasedViewPart.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/singlepage/AbstractSinglePageSectionBasedViewPart.java
index 20ff30b82..3766cca05 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/singlepage/AbstractSinglePageSectionBasedViewPart.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/singlepage/AbstractSinglePageSectionBasedViewPart.java
@@ -1,127 +1,127 @@
-/*******************************************************************************
- * 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.view.properties.part.singlepage;
-
-import java.util.HashMap;
-
-import org.eclipse.scout.commons.TriState;
-import org.eclipse.scout.sdk.ui.extensions.view.property.ISinglePropertyViewPart;
-import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
-import org.eclipse.scout.sdk.ui.view.properties.part.AbstractSectionBasedPart;
-import org.eclipse.scout.sdk.ui.view.properties.part.Section;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-
-/**
- * <h3>AbstractSinglePageSectionBasedViewPart</h3> ...
- *
- * @author Andreas Hoegger
- * @since 1.0.8 23.07.2010
- */
-public abstract class AbstractSinglePageSectionBasedViewPart extends AbstractSectionBasedPart implements ISinglePropertyViewPart {
-
- private final static HashMap<String, HashMap<String, Boolean>> expansionSettings = new HashMap<String, HashMap<String, Boolean>>();
-
- private IPage m_page;
-
- @Override
- public IPage getPage() {
- return m_page;
- }
-
- @Override
- public void setPage(IPage page) {
- m_page = page;
- }
-
- /**
- * Gets a string that uniquely identifies this part for the current page.<br>
- * Override this method to use a more precise key.
- *
- * @return The default implementation returns a string representing the page instance this part is attached to or null
- * if no page is present.
- */
- protected String getPartKey() {
- IPage p = getPage();
- if (p == null) return null;
- return p.toString();
- }
-
- @Override
- protected void cleanup() {
- cacheSectionExpansionState();
- super.cleanup();
- }
-
- private void cacheSectionExpansionState() {
- final Section[] sections = getSections();
- HashMap<String, Boolean> pageCache = expansionSettings.get(getPage());
- if (pageCache == null) {
- pageCache = new HashMap<String, Boolean>(sections.length);
- expansionSettings.put(getPartKey(), pageCache);
- }
- for (Section s : sections) {
- pageCache.put(s.getSectionId(), s.isExpanded());
- }
- }
-
- /**
- * Gets if the section with given Id was expanded when used the last time for the page of this part.<br>
- * If no last state exist, the given default value is returned.
- *
- * @param sectionId
- * The id of the section.
- * @param defaultValue
- * The default value to return when this section was never used before for the page of this part.
- * @return If the section was expanded the last time or the default value if not known.
- */
- protected boolean wasSectionExpanded(String sectionId, boolean defaultValue) {
- TriState state = wasSectionExpanded(sectionId);
- if (state == TriState.UNDEFINED) return defaultValue;
- else return state.getBooleanValue();
- }
-
- /**
- * Gets the expansion state of the section with the given id like it was lastly used for the page of this part.
- *
- * @param sectionId
- * The id of the section.
- * @return If the given section for the current page was expanded when used the last time. The <code>TriState</code>
- * has the value <code>UNDEFINED</code> if no last usage for this section and page is stored so far.
- * @see TriState
- */
- protected TriState wasSectionExpanded(String sectionId) {
- HashMap<String, Boolean> pageCache = expansionSettings.get(getPartKey());
- if (pageCache == null) return TriState.UNDEFINED;
-
- Boolean expanded = pageCache.get(sectionId);
- if (expanded == null) return TriState.UNDEFINED;
-
- if (expanded) return TriState.TRUE;
- else return TriState.FALSE;
- }
-
- @Override
- protected Control createHead(Composite parent) {
- Composite headArea = getFormToolkit().createComposite(parent);
- Label title = getFormToolkit().createLabel(headArea, getPage().getName(), SWT.WRAP | SWT.READ_ONLY);
- // layout
- headArea.setLayout(new GridLayout(1, true));
- GridData titleData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL);
- titleData.widthHint = 100;
- title.setLayoutData(titleData);
- return headArea;
- }
-}
+/*******************************************************************************
+ * 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.view.properties.part.singlepage;
+
+import java.util.HashMap;
+
+import org.eclipse.scout.commons.TriState;
+import org.eclipse.scout.sdk.ui.extensions.view.property.ISinglePropertyViewPart;
+import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
+import org.eclipse.scout.sdk.ui.view.properties.part.AbstractSectionBasedPart;
+import org.eclipse.scout.sdk.ui.view.properties.part.Section;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+
+/**
+ * <h3>AbstractSinglePageSectionBasedViewPart</h3> ...
+ *
+ * @author Andreas Hoegger
+ * @since 1.0.8 23.07.2010
+ */
+public abstract class AbstractSinglePageSectionBasedViewPart extends AbstractSectionBasedPart implements ISinglePropertyViewPart {
+
+ private final static HashMap<String, HashMap<String, Boolean>> expansionSettings = new HashMap<String, HashMap<String, Boolean>>();
+
+ private IPage m_page;
+
+ @Override
+ public IPage getPage() {
+ return m_page;
+ }
+
+ @Override
+ public void setPage(IPage page) {
+ m_page = page;
+ }
+
+ /**
+ * Gets a string that uniquely identifies this part for the current page.<br>
+ * Override this method to use a more precise key.
+ *
+ * @return The default implementation returns a string representing the page instance this part is attached to or null
+ * if no page is present.
+ */
+ protected String getPartKey() {
+ IPage p = getPage();
+ if (p == null) return null;
+ return p.toString();
+ }
+
+ @Override
+ protected void cleanup() {
+ cacheSectionExpansionState();
+ super.cleanup();
+ }
+
+ private void cacheSectionExpansionState() {
+ final Section[] sections = getSections();
+ HashMap<String, Boolean> pageCache = expansionSettings.get(getPage());
+ if (pageCache == null) {
+ pageCache = new HashMap<String, Boolean>(sections.length);
+ expansionSettings.put(getPartKey(), pageCache);
+ }
+ for (Section s : sections) {
+ pageCache.put(s.getSectionId(), s.isExpanded());
+ }
+ }
+
+ /**
+ * Gets if the section with given Id was expanded when used the last time for the page of this part.<br>
+ * If no last state exist, the given default value is returned.
+ *
+ * @param sectionId
+ * The id of the section.
+ * @param defaultValue
+ * The default value to return when this section was never used before for the page of this part.
+ * @return If the section was expanded the last time or the default value if not known.
+ */
+ protected boolean wasSectionExpanded(String sectionId, boolean defaultValue) {
+ TriState state = wasSectionExpanded(sectionId);
+ if (state == TriState.UNDEFINED) return defaultValue;
+ else return state.getBooleanValue();
+ }
+
+ /**
+ * Gets the expansion state of the section with the given id like it was lastly used for the page of this part.
+ *
+ * @param sectionId
+ * The id of the section.
+ * @return If the given section for the current page was expanded when used the last time. The <code>TriState</code>
+ * has the value <code>UNDEFINED</code> if no last usage for this section and page is stored so far.
+ * @see TriState
+ */
+ protected TriState wasSectionExpanded(String sectionId) {
+ HashMap<String, Boolean> pageCache = expansionSettings.get(getPartKey());
+ if (pageCache == null) return TriState.UNDEFINED;
+
+ Boolean expanded = pageCache.get(sectionId);
+ if (expanded == null) return TriState.UNDEFINED;
+
+ if (expanded) return TriState.TRUE;
+ else return TriState.FALSE;
+ }
+
+ @Override
+ protected Control createHead(Composite parent) {
+ Composite headArea = getFormToolkit().createComposite(parent);
+ Label title = getFormToolkit().createLabel(headArea, getPage().getName(), SWT.WRAP | SWT.READ_ONLY);
+ // layout
+ headArea.setLayout(new GridLayout(1, true));
+ GridData titleData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL);
+ titleData.widthHint = 100;
+ title.setLayoutData(titleData);
+ return headArea;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/singlepage/ConfigurationMethodSection.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/singlepage/ConfigurationMethodSection.java
index 7dbe02de6..05f29ab65 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/singlepage/ConfigurationMethodSection.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/singlepage/ConfigurationMethodSection.java
@@ -1,291 +1,291 @@
-/*******************************************************************************
- * 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.view.properties.part.singlepage;
-
-import java.util.TreeSet;
-
-import org.eclipse.scout.sdk.ui.view.properties.part.ISection;
-import org.eclipse.scout.sdk.ui.view.properties.part.singlepage.PropertyViewConfig.Config;
-import org.eclipse.scout.sdk.ui.view.properties.part.singlepage.PropertyViewConfig.ConfigCategory;
-import org.eclipse.scout.sdk.ui.view.properties.part.singlepage.PropertyViewConfig.ConfigTypes;
-import org.eclipse.scout.sdk.workspace.type.config.ConfigPropertyType;
-import org.eclipse.scout.sdk.workspace.type.config.ConfigurationMethod;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ControlEvent;
-import org.eclipse.swt.events.ControlListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.ui.forms.events.ExpansionAdapter;
-import org.eclipse.ui.forms.events.ExpansionEvent;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-
-/**
- * A section used to represent configuration methods of certain types.
- */
-public class ConfigurationMethodSection {
-
- private static final PropertyViewConfig CONFIG = new PropertyViewConfig();
- private static final FormToolkit TOOLKIT = new FormToolkit(Display.getDefault());
-
- private final ConfigurationMethodEx[] m_methods;
-
- private ISection m_section;
- private int m_numCategories;
-
- /**
- * Creates a section showing all presenters for methods that match the type parameters given to this constructor.<br>
- * The presenters are grouped by category as defined in the configuration xml file.
- *
- * @param t
- * The configuration methods of this type are rendered.
- * @param methodType
- * One of ConfigurationMethod.PROPERTY_METHOD or ConfigurationMethod.OPERATION_METHOD
- * @param configurationType
- * One of the <code>ConfigTypes</code>
- * @see ConfigTypes
- * @see ConfigurationMethod
- */
- public ConfigurationMethodSection(ConfigPropertyType t, int methodType, ConfigTypes configurationType) {
- m_methods = getConfigMethods(t, methodType, configurationType);
- }
-
- /**
- * creates the content of the section.
- *
- * @param parent
- * The section will be added to this PropertyPart
- * @param id
- * The id of the section. Must be unique.
- * @param label
- * The label of the section shown on top in the colored bar.
- * @param expanded
- * specifies if the section should be expanded by default or collapsed. if expanded is false, the content of
- * the section is created on demand when the section is expanded for the first time.
- */
- public ISection createContent(JdtTypePropertyPart parent, String id, String label, boolean expanded) {
- if (m_methods != null && m_methods.length > 0) {
- m_numCategories = getCategoryCount();
- m_section = createSection(parent, id, label, expanded);
- }
- return m_section;
- }
-
- private ISection createSection(final JdtTypePropertyPart part, String id, String label, boolean expanded) {
- final ISection section = part.addSection(id, label);
- section.setExpanded(expanded);
-
- final Composite clientSection = section.getSectionClient();
- GridLayout layout = new GridLayout(1, true);
- layout.horizontalSpacing = 0;
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- layout.verticalSpacing = 0;
- clientSection.setLayout(layout);
-
- if (expanded) {
- createCategories(clientSection, part, section);
- }
- else {
- // if collapsed by default: load content only on demand
- section.addExpansionListener(new ExpansionAdapter() {
- private boolean isInitialized = false;
-
- @Override
- public void expansionStateChanging(ExpansionEvent e) {
- if (!isInitialized && e.getState()) {
- createCategories(clientSection, part, section);
- isInitialized = true;
- }
- }
- });
- }
- return section;
- }
-
- /**
- * completely creates all categories that exist for this section.
- */
- private void createCategories(Composite parent, JdtTypePropertyPart part, ISection section) {
- ConfigCategory curCat = null;
- Composite curCatContainer = null;
- for (ConfigurationMethodEx m : m_methods) {
- if (!m.m_category.equals(curCat)) {
- // category changed: render horizontal line and create a new composite for the following presenters
- curCat = m.m_category;
- if (m_numCategories > 1) {
- // only show category heading, if there is more than one category
- createCategoryHeading(parent, curCat.getLabel());
- }
- curCatContainer = createCategory(parent, section);
- }
-
- if (m.m_configMethod.getMethodType() == ConfigurationMethod.PROPERTY_METHOD) {
- part.createConfigMethodPresenter(curCatContainer, m.m_configMethod);
- }
- else if (m.m_configMethod.getMethodType() == ConfigurationMethod.OPERATION_METHOD) {
- part.createOperationPresenter(curCatContainer, m.m_configMethod);
- }
- }
- }
-
- /**
- * creates a new category composite that is able to change its columns dynamically based on the space available.
- */
- private Composite createCategory(final Composite parent, final ISection section) {
- final Composite category = TOOLKIT.createComposite(parent);
- final GridLayout catLayout = new GridLayout(1, true);
- catLayout.marginHeight = 0;
- catLayout.marginWidth = 0;
- catLayout.verticalSpacing = 0;
- category.setLayout(catLayout);
- category.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
-
- category.addControlListener(new ControlListener() {
- private final int m_columnWidth = 300;
- private int m_numCols = 1;
-
- private void layoutColumns() {
- try {
- category.setRedraw(false);
- parent.setRedraw(false);
- int numCols = Math.max(1, category.getBounds().width / m_columnWidth);
- if (numCols != m_numCols) {
- catLayout.numColumns = numCols;
- m_numCols = numCols;
- section.reflow();
- }
- }
- finally {
- category.setRedraw(true);
- parent.setRedraw(true);
- }
- }
-
- @Override
- public void controlResized(ControlEvent e) {
- layoutColumns();
- }
-
- @Override
- public void controlMoved(ControlEvent e) {
- layoutColumns();
- }
- });
- return category;
- }
-
- /**
- * creates a new category heading with a label and a horizontal line behind.
- *
- * @param parent
- * @param label
- * The text of the heading
- * @return
- */
- private Composite createCategoryHeading(Composite parent, String label) {
- Composite body = TOOLKIT.createComposite(parent);
- GridLayout bodyLayout = new GridLayout(2, false);
- bodyLayout.horizontalSpacing = 5;
- bodyLayout.marginHeight = 0;
- bodyLayout.marginWidth = 0;
- bodyLayout.verticalSpacing = 0;
- body.setLayout(bodyLayout);
-
- GridData bodyLayoutData = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
- body.setLayoutData(bodyLayoutData);
-
- Label l = new Label(body, SWT.NONE);
- l.setText(label);
-
- Label line = new Label(body, SWT.SEPARATOR | SWT.SHADOW_OUT | SWT.HORIZONTAL);
- line.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
- return body;
- }
-
- /**
- * gets all configuration methods that match the given type filters ordered by category and order annotation of the
- * method.
- */
- private ConfigurationMethodEx[] getConfigMethods(ConfigPropertyType source, int methodType, ConfigTypes configurationType) {
- ConfigurationMethod[] allMethods = source.getConfigurationMethods(methodType);
- TreeSet<ConfigurationMethodEx> result = new TreeSet<ConfigurationMethodEx>();
- for (ConfigurationMethod m : allMethods) {
- ConfigurationMethodEx cme = new ConfigurationMethodEx(m);
- if (cme.m_configType.equals(configurationType)) {
- result.add(cme);
- }
- }
- return result.toArray(new ConfigurationMethodEx[result.size()]);
- }
-
- private int getCategoryCount() {
- ConfigCategory cat = m_methods[0].m_category;
- int ret = 1;
- for (ConfigurationMethodEx m : m_methods) {
- if (!m.m_category.equals(cat)) {
- cat = m.m_category;
- ret++;
- }
- }
- return ret;
- }
-
- /**
- * Helper class to hold additional meta data to a configuration method as configured in the xml file.
- */
- private static class ConfigurationMethodEx implements Comparable<ConfigurationMethodEx> {
- private final ConfigurationMethod m_configMethod;
- private final Double m_order; /* order annotation of the method in scout RT or as configured in the xml configuration */
- private final ConfigCategory m_category; /* category it belongs to according to the xml configuration */
- private final ConfigTypes m_configType; /* normal or advanced type according to the xml configuration */
-
- private ConfigurationMethodEx(ConfigurationMethod configMethod) {
- m_configMethod = configMethod;
-
- Config c = CONFIG.getConfiguration(configMethod);
- Double o = null;
- if (c != null && c.getOrder() != null) {
- // xml config overrides scout RT annotation
- o = c.getOrder();
- }
- else {
- o = configMethod.getOrder();
- }
-
- m_order = o == null ? Double.MAX_VALUE : o;
- m_category = c == null ? PropertyViewConfig.DEFAULT_CONFIG_CATEGORY : c.getCategory();
- m_configType = c == null ? PropertyViewConfig.DEFAULT_CONFIG_TYPE : c.getType();
- }
-
- @Override
- public int compareTo(ConfigurationMethodEx o) {
- // sort first by category
- int catComp = new Integer(m_category.getOrder()).compareTo(o.m_category.getOrder());
- if (catComp != 0) {
- return catComp;
- }
- else {
- // sort second by order of the method inside the category
- int orderComp = m_order.compareTo(o.m_order);
- if (orderComp != 0) {
- return orderComp;
- }
- else {
- // sort third by property name
- return m_configMethod.getMethodName().compareTo(o.m_configMethod.getMethodName());
- }
- }
- }
- }
-}
+/*******************************************************************************
+ * 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.view.properties.part.singlepage;
+
+import java.util.TreeSet;
+
+import org.eclipse.scout.sdk.ui.view.properties.part.ISection;
+import org.eclipse.scout.sdk.ui.view.properties.part.singlepage.PropertyViewConfig.Config;
+import org.eclipse.scout.sdk.ui.view.properties.part.singlepage.PropertyViewConfig.ConfigCategory;
+import org.eclipse.scout.sdk.ui.view.properties.part.singlepage.PropertyViewConfig.ConfigTypes;
+import org.eclipse.scout.sdk.workspace.type.config.ConfigPropertyType;
+import org.eclipse.scout.sdk.workspace.type.config.ConfigurationMethod;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ControlEvent;
+import org.eclipse.swt.events.ControlListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.forms.events.ExpansionAdapter;
+import org.eclipse.ui.forms.events.ExpansionEvent;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+
+/**
+ * A section used to represent configuration methods of certain types.
+ */
+public class ConfigurationMethodSection {
+
+ private static final PropertyViewConfig CONFIG = new PropertyViewConfig();
+ private static final FormToolkit TOOLKIT = new FormToolkit(Display.getDefault());
+
+ private final ConfigurationMethodEx[] m_methods;
+
+ private ISection m_section;
+ private int m_numCategories;
+
+ /**
+ * Creates a section showing all presenters for methods that match the type parameters given to this constructor.<br>
+ * The presenters are grouped by category as defined in the configuration xml file.
+ *
+ * @param t
+ * The configuration methods of this type are rendered.
+ * @param methodType
+ * One of ConfigurationMethod.PROPERTY_METHOD or ConfigurationMethod.OPERATION_METHOD
+ * @param configurationType
+ * One of the <code>ConfigTypes</code>
+ * @see ConfigTypes
+ * @see ConfigurationMethod
+ */
+ public ConfigurationMethodSection(ConfigPropertyType t, int methodType, ConfigTypes configurationType) {
+ m_methods = getConfigMethods(t, methodType, configurationType);
+ }
+
+ /**
+ * creates the content of the section.
+ *
+ * @param parent
+ * The section will be added to this PropertyPart
+ * @param id
+ * The id of the section. Must be unique.
+ * @param label
+ * The label of the section shown on top in the colored bar.
+ * @param expanded
+ * specifies if the section should be expanded by default or collapsed. if expanded is false, the content of
+ * the section is created on demand when the section is expanded for the first time.
+ */
+ public ISection createContent(JdtTypePropertyPart parent, String id, String label, boolean expanded) {
+ if (m_methods != null && m_methods.length > 0) {
+ m_numCategories = getCategoryCount();
+ m_section = createSection(parent, id, label, expanded);
+ }
+ return m_section;
+ }
+
+ private ISection createSection(final JdtTypePropertyPart part, String id, String label, boolean expanded) {
+ final ISection section = part.addSection(id, label);
+ section.setExpanded(expanded);
+
+ final Composite clientSection = section.getSectionClient();
+ GridLayout layout = new GridLayout(1, true);
+ layout.horizontalSpacing = 0;
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ layout.verticalSpacing = 0;
+ clientSection.setLayout(layout);
+
+ if (expanded) {
+ createCategories(clientSection, part, section);
+ }
+ else {
+ // if collapsed by default: load content only on demand
+ section.addExpansionListener(new ExpansionAdapter() {
+ private boolean isInitialized = false;
+
+ @Override
+ public void expansionStateChanging(ExpansionEvent e) {
+ if (!isInitialized && e.getState()) {
+ createCategories(clientSection, part, section);
+ isInitialized = true;
+ }
+ }
+ });
+ }
+ return section;
+ }
+
+ /**
+ * completely creates all categories that exist for this section.
+ */
+ private void createCategories(Composite parent, JdtTypePropertyPart part, ISection section) {
+ ConfigCategory curCat = null;
+ Composite curCatContainer = null;
+ for (ConfigurationMethodEx m : m_methods) {
+ if (!m.m_category.equals(curCat)) {
+ // category changed: render horizontal line and create a new composite for the following presenters
+ curCat = m.m_category;
+ if (m_numCategories > 1) {
+ // only show category heading, if there is more than one category
+ createCategoryHeading(parent, curCat.getLabel());
+ }
+ curCatContainer = createCategory(parent, section);
+ }
+
+ if (m.m_configMethod.getMethodType() == ConfigurationMethod.PROPERTY_METHOD) {
+ part.createConfigMethodPresenter(curCatContainer, m.m_configMethod);
+ }
+ else if (m.m_configMethod.getMethodType() == ConfigurationMethod.OPERATION_METHOD) {
+ part.createOperationPresenter(curCatContainer, m.m_configMethod);
+ }
+ }
+ }
+
+ /**
+ * creates a new category composite that is able to change its columns dynamically based on the space available.
+ */
+ private Composite createCategory(final Composite parent, final ISection section) {
+ final Composite category = TOOLKIT.createComposite(parent);
+ final GridLayout catLayout = new GridLayout(1, true);
+ catLayout.marginHeight = 0;
+ catLayout.marginWidth = 0;
+ catLayout.verticalSpacing = 0;
+ category.setLayout(catLayout);
+ category.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
+
+ category.addControlListener(new ControlListener() {
+ private final int m_columnWidth = 300;
+ private int m_numCols = 1;
+
+ private void layoutColumns() {
+ try {
+ category.setRedraw(false);
+ parent.setRedraw(false);
+ int numCols = Math.max(1, category.getBounds().width / m_columnWidth);
+ if (numCols != m_numCols) {
+ catLayout.numColumns = numCols;
+ m_numCols = numCols;
+ section.reflow();
+ }
+ }
+ finally {
+ category.setRedraw(true);
+ parent.setRedraw(true);
+ }
+ }
+
+ @Override
+ public void controlResized(ControlEvent e) {
+ layoutColumns();
+ }
+
+ @Override
+ public void controlMoved(ControlEvent e) {
+ layoutColumns();
+ }
+ });
+ return category;
+ }
+
+ /**
+ * creates a new category heading with a label and a horizontal line behind.
+ *
+ * @param parent
+ * @param label
+ * The text of the heading
+ * @return
+ */
+ private Composite createCategoryHeading(Composite parent, String label) {
+ Composite body = TOOLKIT.createComposite(parent);
+ GridLayout bodyLayout = new GridLayout(2, false);
+ bodyLayout.horizontalSpacing = 5;
+ bodyLayout.marginHeight = 0;
+ bodyLayout.marginWidth = 0;
+ bodyLayout.verticalSpacing = 0;
+ body.setLayout(bodyLayout);
+
+ GridData bodyLayoutData = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
+ body.setLayoutData(bodyLayoutData);
+
+ Label l = new Label(body, SWT.NONE);
+ l.setText(label);
+
+ Label line = new Label(body, SWT.SEPARATOR | SWT.SHADOW_OUT | SWT.HORIZONTAL);
+ line.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+ return body;
+ }
+
+ /**
+ * gets all configuration methods that match the given type filters ordered by category and order annotation of the
+ * method.
+ */
+ private ConfigurationMethodEx[] getConfigMethods(ConfigPropertyType source, int methodType, ConfigTypes configurationType) {
+ ConfigurationMethod[] allMethods = source.getConfigurationMethods(methodType);
+ TreeSet<ConfigurationMethodEx> result = new TreeSet<ConfigurationMethodEx>();
+ for (ConfigurationMethod m : allMethods) {
+ ConfigurationMethodEx cme = new ConfigurationMethodEx(m);
+ if (cme.m_configType.equals(configurationType)) {
+ result.add(cme);
+ }
+ }
+ return result.toArray(new ConfigurationMethodEx[result.size()]);
+ }
+
+ private int getCategoryCount() {
+ ConfigCategory cat = m_methods[0].m_category;
+ int ret = 1;
+ for (ConfigurationMethodEx m : m_methods) {
+ if (!m.m_category.equals(cat)) {
+ cat = m.m_category;
+ ret++;
+ }
+ }
+ return ret;
+ }
+
+ /**
+ * Helper class to hold additional meta data to a configuration method as configured in the xml file.
+ */
+ private static class ConfigurationMethodEx implements Comparable<ConfigurationMethodEx> {
+ private final ConfigurationMethod m_configMethod;
+ private final Double m_order; /* order annotation of the method in scout RT or as configured in the xml configuration */
+ private final ConfigCategory m_category; /* category it belongs to according to the xml configuration */
+ private final ConfigTypes m_configType; /* normal or advanced type according to the xml configuration */
+
+ private ConfigurationMethodEx(ConfigurationMethod configMethod) {
+ m_configMethod = configMethod;
+
+ Config c = CONFIG.getConfiguration(configMethod);
+ Double o = null;
+ if (c != null && c.getOrder() != null) {
+ // xml config overrides scout RT annotation
+ o = c.getOrder();
+ }
+ else {
+ o = configMethod.getOrder();
+ }
+
+ m_order = o == null ? Double.MAX_VALUE : o;
+ m_category = c == null ? PropertyViewConfig.DEFAULT_CONFIG_CATEGORY : c.getCategory();
+ m_configType = c == null ? PropertyViewConfig.DEFAULT_CONFIG_TYPE : c.getType();
+ }
+
+ @Override
+ public int compareTo(ConfigurationMethodEx o) {
+ // sort first by category
+ int catComp = new Integer(m_category.getOrder()).compareTo(o.m_category.getOrder());
+ if (catComp != 0) {
+ return catComp;
+ }
+ else {
+ // sort second by order of the method inside the category
+ int orderComp = m_order.compareTo(o.m_order);
+ if (orderComp != 0) {
+ return orderComp;
+ }
+ else {
+ // sort third by property name
+ return m_configMethod.getMethodName().compareTo(o.m_configMethod.getMethodName());
+ }
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/singlepage/ExceptionSinglePagePropertyViewPart.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/singlepage/ExceptionSinglePagePropertyViewPart.java
index 30ddcc9dc..29d95e3fc 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/singlepage/ExceptionSinglePagePropertyViewPart.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/singlepage/ExceptionSinglePagePropertyViewPart.java
@@ -1,87 +1,87 @@
-/*******************************************************************************
- * 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.view.properties.part.singlepage;
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.ui.view.properties.part.ISection;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-
-/**
- * <h3>UnknownPropertyViewPart</h3> ...
- *
- * @author Andreas Hoegger
- * @since 1.0.8 21.07.2010
- */
-public class ExceptionSinglePagePropertyViewPart extends AbstractSinglePageSectionBasedViewPart {
- private static final String SECTION_ID_ERROR = "section.error";
-
- private Throwable m_throwable;
-
- @Override
- protected Control createHead(Composite parent) {
- Composite headArea = getFormToolkit().createComposite(parent);
- String titleText = Texts.get("ErrorDuringCreatingPropertyPart");
- Label title = getFormToolkit().createLabel(headArea, titleText, SWT.WRAP | SWT.READ_ONLY);
- // layout
- headArea.setLayout(new GridLayout(1, true));
- GridData titleData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL);
- titleData.widthHint = 100;
- title.setLayoutData(titleData);
- return headArea;
- }
-
- @Override
- protected void createSections() {
- ISection errorSection = createSection(SECTION_ID_ERROR, Texts.get("ErrorDetail"));
- errorSection.setExpanded(false);
- Text errorText = getFormToolkit().createText(errorSection.getSectionClient(), "", SWT.SHADOW_ETCHED_IN | SWT.MULTI);
- StringBuilder sb = new StringBuilder();
- if (getThrowable() != null) {
- try {
- StringWriter sw = new StringWriter();
- PrintWriter pw = new PrintWriter(sw);
- getThrowable().printStackTrace(pw);
- pw.close();
- sb.append(sw.toString());
- }
- catch (Exception ex) {
- }
- errorText.setText(sb.toString());
- }
- GridData layoutData = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
- layoutData.widthHint = 200;
- errorText.setLayoutData(layoutData);
- }
-
- /**
- * @param throwable
- * the throwable to set
- */
- public void setThrowable(Throwable throwable) {
- m_throwable = throwable;
- }
-
- /**
- * @return the throwable
- */
- public Throwable getThrowable() {
- return m_throwable;
- }
-}
+/*******************************************************************************
+ * 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.view.properties.part.singlepage;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.ui.view.properties.part.ISection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * <h3>UnknownPropertyViewPart</h3> ...
+ *
+ * @author Andreas Hoegger
+ * @since 1.0.8 21.07.2010
+ */
+public class ExceptionSinglePagePropertyViewPart extends AbstractSinglePageSectionBasedViewPart {
+ private static final String SECTION_ID_ERROR = "section.error";
+
+ private Throwable m_throwable;
+
+ @Override
+ protected Control createHead(Composite parent) {
+ Composite headArea = getFormToolkit().createComposite(parent);
+ String titleText = Texts.get("ErrorDuringCreatingPropertyPart");
+ Label title = getFormToolkit().createLabel(headArea, titleText, SWT.WRAP | SWT.READ_ONLY);
+ // layout
+ headArea.setLayout(new GridLayout(1, true));
+ GridData titleData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL);
+ titleData.widthHint = 100;
+ title.setLayoutData(titleData);
+ return headArea;
+ }
+
+ @Override
+ protected void createSections() {
+ ISection errorSection = createSection(SECTION_ID_ERROR, Texts.get("ErrorDetail"));
+ errorSection.setExpanded(false);
+ Text errorText = getFormToolkit().createText(errorSection.getSectionClient(), "", SWT.SHADOW_ETCHED_IN | SWT.MULTI);
+ StringBuilder sb = new StringBuilder();
+ if (getThrowable() != null) {
+ try {
+ StringWriter sw = new StringWriter();
+ PrintWriter pw = new PrintWriter(sw);
+ getThrowable().printStackTrace(pw);
+ pw.close();
+ sb.append(sw.toString());
+ }
+ catch (Exception ex) {
+ }
+ errorText.setText(sb.toString());
+ }
+ GridData layoutData = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
+ layoutData.widthHint = 200;
+ errorText.setLayoutData(layoutData);
+ }
+
+ /**
+ * @param throwable
+ * the throwable to set
+ */
+ public void setThrowable(Throwable throwable) {
+ m_throwable = throwable;
+ }
+
+ /**
+ * @return the throwable
+ */
+ public Throwable getThrowable() {
+ return m_throwable;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/singlepage/FormPropertyPart.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/singlepage/FormPropertyPart.java
index e19e433a1..687fada2f 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/singlepage/FormPropertyPart.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/singlepage/FormPropertyPart.java
@@ -1,163 +1,163 @@
-/*******************************************************************************
- * 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.view.properties.part.singlepage;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jface.dialogs.ProgressIndicator;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.sdk.RuntimeClasses;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.ui.internal.view.outline.pages.project.client.form.FormNodePage;
-import org.eclipse.scout.sdk.ui.internal.view.properties.model.links.LinkGroup;
-import org.eclipse.scout.sdk.ui.internal.view.properties.model.links.LinksPresenterModel;
-import org.eclipse.scout.sdk.ui.internal.view.properties.model.links.TypeOpenLink;
-import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.LinksPresenter;
-import org.eclipse.scout.sdk.ui.view.properties.part.ISection;
-import org.eclipse.scout.sdk.util.SdkProperties;
-import org.eclipse.scout.sdk.util.type.ITypeFilter;
-import org.eclipse.scout.sdk.util.type.TypeComparators;
-import org.eclipse.scout.sdk.util.type.TypeFilters;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.workspace.IScoutProject;
-import org.eclipse.scout.sdk.workspace.type.ScoutTypeFilters;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * <h3>ServicePropertyPart</h3> ...
- *
- * @author Andreas Hoegger
- * @since 1.0.8 22.07.2010
- */
-public class FormPropertyPart extends JdtTypePropertyPart {
- private static final String SECTION_ID_LINKS = "section.links";
-
- final IType abstractFormData = TypeUtility.getType(RuntimeClasses.AbstractFormData);
- final IType iService = TypeUtility.getType(RuntimeClasses.IService);
- final IType basicPermission = TypeUtility.getType(RuntimeClasses.BasicPermission);
-
- @Override
- protected void createSections() {
- // link area
- ISection linkSection = createSection(SECTION_ID_LINKS, Texts.get("Links"));
- fillLinkSection(linkSection.getSectionClient());
- linkSection.setExpanded(wasSectionExpanded(SECTION_ID_LINKS, true));
- super.createSections();
- }
-
- @Override
- public FormNodePage getPage() {
- return (FormNodePage) super.getPage();
- }
-
- protected void fillLinkSection(Composite parent) {
- // ui
-
- final LinksPresenter presenter = new LinksPresenter(getFormToolkit(), parent);
- GridData layoutData = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
- layoutData.widthHint = 200;
- presenter.getContainer().setLayoutData(layoutData);
- // load lazy
- final ProgressIndicator indicator = new ProgressIndicator(presenter.getContainer(), SWT.INDETERMINATE | SWT.SMOOTH);
- indicator.beginAnimatedTask();
- GridData indicatorData = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
- indicatorData.horizontalSpan = 2;
- indicatorData.heightHint = 5;
- indicator.setLayoutData(indicatorData);
- Job j = new Job("load links...") {
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- String entityName = null;
- LinksPresenterModel model = new LinksPresenterModel();
- if (getPage().getType() != null) {
- model.addGlobalLink(new TypeOpenLink(getPage().getType()));
- entityName = findEntityName(getPage().getType().getElementName());
- }
- if (!StringUtility.isNullOrEmpty(entityName)) {
- // form data
- IScoutBundle clientBundle = getPage().getScoutResource();
- IScoutProject scoutProject = clientBundle.getScoutProject();
- IScoutBundle sharedBundle = scoutProject.getSharedBundle();
- while (sharedBundle == null) {
- scoutProject = scoutProject.getParentProject();
- if (scoutProject == null) {
- break;
- }
- sharedBundle = scoutProject.getSharedBundle();
- }
- if (sharedBundle != null) {
- String formDataName = sharedBundle.getPackageName(IScoutBundle.SHARED_PACKAGE_APPENDIX_SERVICES_PROCESS) + "." + entityName + SdkProperties.SUFFIX_FORM_DATA;
- if (TypeUtility.existsType(formDataName)) {
- model.addGlobalLink(new TypeOpenLink(TypeUtility.getType(formDataName)));
- }
- }
- // service
- String formRegex = "(I)?" + entityName + SdkProperties.SUFFIX_PROCESS_SERVICE;
- ITypeFilter formFilter = TypeFilters.getMultiTypeFilter(
- TypeFilters.getRegexSimpleNameFilter(formRegex),
- ScoutTypeFilters.getInScoutProject(clientBundle.getScoutProject())
- );
- LinkGroup serviceGroup = model.getOrCreateGroup(Texts.get("Service"), 10);
- for (IType candidate : TypeUtility.getPrimaryTypeHierarchy(iService).getAllSubtypes(iService, formFilter, TypeComparators.getTypeNameComparator())) {
- serviceGroup.addLink(new TypeOpenLink(candidate));
- }
- // permissions
- String permissionRegex = "(Create|Read|Update)" + entityName + SdkProperties.SUFFIX_PERMISSION;
- ITypeFilter filter = TypeFilters.getMultiTypeFilter(
- TypeFilters.getRegexSimpleNameFilter(permissionRegex),
- TypeFilters.getClassFilter(),
- ScoutTypeFilters.getInScoutProject(clientBundle.getScoutProject())
- );
- LinkGroup permissionGroup = model.getOrCreateGroup(Texts.get("PermissionTablePage"), 20);
- for (IType candidate : TypeUtility.getPrimaryTypeHierarchy(basicPermission).getAllSubtypes(basicPermission, filter, TypeComparators.getTypeNameComparator())) {
- permissionGroup.addLink(new TypeOpenLink(candidate));
- }
- }
- if (presenter != null && !presenter.isDisposed()) {
- final LinksPresenterModel finalModel = model;
- presenter.getContainer().getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- if (presenter != null && !presenter.isDisposed()) {
- indicator.dispose();
- presenter.setLinksProperty(finalModel);
- getForm().layout(true, true);
- getForm().updateToolBar();
- getForm().reflow(true);
-
- }
- }
- });
- }
- return Status.OK_STATUS;
- }
- };
- j.setSystem(true);
- j.schedule();
-
- }
-
- private String findEntityName(String serviceName) {
- if (StringUtility.isNullOrEmpty(serviceName)) {
- return serviceName;
- }
- if (serviceName.endsWith(SdkProperties.SUFFIX_FORM)) {
- return serviceName.replaceAll("^(.*)" + SdkProperties.SUFFIX_FORM + "$", "$1");
- }
- return serviceName;
- }
-}
+/*******************************************************************************
+ * 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.view.properties.part.singlepage;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jface.dialogs.ProgressIndicator;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.sdk.RuntimeClasses;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.ui.internal.view.outline.pages.project.client.form.FormNodePage;
+import org.eclipse.scout.sdk.ui.internal.view.properties.model.links.LinkGroup;
+import org.eclipse.scout.sdk.ui.internal.view.properties.model.links.LinksPresenterModel;
+import org.eclipse.scout.sdk.ui.internal.view.properties.model.links.TypeOpenLink;
+import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.LinksPresenter;
+import org.eclipse.scout.sdk.ui.view.properties.part.ISection;
+import org.eclipse.scout.sdk.util.SdkProperties;
+import org.eclipse.scout.sdk.util.type.ITypeFilter;
+import org.eclipse.scout.sdk.util.type.TypeComparators;
+import org.eclipse.scout.sdk.util.type.TypeFilters;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.workspace.IScoutProject;
+import org.eclipse.scout.sdk.workspace.type.ScoutTypeFilters;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * <h3>ServicePropertyPart</h3> ...
+ *
+ * @author Andreas Hoegger
+ * @since 1.0.8 22.07.2010
+ */
+public class FormPropertyPart extends JdtTypePropertyPart {
+ private static final String SECTION_ID_LINKS = "section.links";
+
+ final IType abstractFormData = TypeUtility.getType(RuntimeClasses.AbstractFormData);
+ final IType iService = TypeUtility.getType(RuntimeClasses.IService);
+ final IType basicPermission = TypeUtility.getType(RuntimeClasses.BasicPermission);
+
+ @Override
+ protected void createSections() {
+ // link area
+ ISection linkSection = createSection(SECTION_ID_LINKS, Texts.get("Links"));
+ fillLinkSection(linkSection.getSectionClient());
+ linkSection.setExpanded(wasSectionExpanded(SECTION_ID_LINKS, true));
+ super.createSections();
+ }
+
+ @Override
+ public FormNodePage getPage() {
+ return (FormNodePage) super.getPage();
+ }
+
+ protected void fillLinkSection(Composite parent) {
+ // ui
+
+ final LinksPresenter presenter = new LinksPresenter(getFormToolkit(), parent);
+ GridData layoutData = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
+ layoutData.widthHint = 200;
+ presenter.getContainer().setLayoutData(layoutData);
+ // load lazy
+ final ProgressIndicator indicator = new ProgressIndicator(presenter.getContainer(), SWT.INDETERMINATE | SWT.SMOOTH);
+ indicator.beginAnimatedTask();
+ GridData indicatorData = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
+ indicatorData.horizontalSpan = 2;
+ indicatorData.heightHint = 5;
+ indicator.setLayoutData(indicatorData);
+ Job j = new Job("load links...") {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ String entityName = null;
+ LinksPresenterModel model = new LinksPresenterModel();
+ if (getPage().getType() != null) {
+ model.addGlobalLink(new TypeOpenLink(getPage().getType()));
+ entityName = findEntityName(getPage().getType().getElementName());
+ }
+ if (!StringUtility.isNullOrEmpty(entityName)) {
+ // form data
+ IScoutBundle clientBundle = getPage().getScoutResource();
+ IScoutProject scoutProject = clientBundle.getScoutProject();
+ IScoutBundle sharedBundle = scoutProject.getSharedBundle();
+ while (sharedBundle == null) {
+ scoutProject = scoutProject.getParentProject();
+ if (scoutProject == null) {
+ break;
+ }
+ sharedBundle = scoutProject.getSharedBundle();
+ }
+ if (sharedBundle != null) {
+ String formDataName = sharedBundle.getPackageName(IScoutBundle.SHARED_PACKAGE_APPENDIX_SERVICES_PROCESS) + "." + entityName + SdkProperties.SUFFIX_FORM_DATA;
+ if (TypeUtility.existsType(formDataName)) {
+ model.addGlobalLink(new TypeOpenLink(TypeUtility.getType(formDataName)));
+ }
+ }
+ // service
+ String formRegex = "(I)?" + entityName + SdkProperties.SUFFIX_PROCESS_SERVICE;
+ ITypeFilter formFilter = TypeFilters.getMultiTypeFilter(
+ TypeFilters.getRegexSimpleNameFilter(formRegex),
+ ScoutTypeFilters.getInScoutProject(clientBundle.getScoutProject())
+ );
+ LinkGroup serviceGroup = model.getOrCreateGroup(Texts.get("Service"), 10);
+ for (IType candidate : TypeUtility.getPrimaryTypeHierarchy(iService).getAllSubtypes(iService, formFilter, TypeComparators.getTypeNameComparator())) {
+ serviceGroup.addLink(new TypeOpenLink(candidate));
+ }
+ // permissions
+ String permissionRegex = "(Create|Read|Update)" + entityName + SdkProperties.SUFFIX_PERMISSION;
+ ITypeFilter filter = TypeFilters.getMultiTypeFilter(
+ TypeFilters.getRegexSimpleNameFilter(permissionRegex),
+ TypeFilters.getClassFilter(),
+ ScoutTypeFilters.getInScoutProject(clientBundle.getScoutProject())
+ );
+ LinkGroup permissionGroup = model.getOrCreateGroup(Texts.get("PermissionTablePage"), 20);
+ for (IType candidate : TypeUtility.getPrimaryTypeHierarchy(basicPermission).getAllSubtypes(basicPermission, filter, TypeComparators.getTypeNameComparator())) {
+ permissionGroup.addLink(new TypeOpenLink(candidate));
+ }
+ }
+ if (presenter != null && !presenter.isDisposed()) {
+ final LinksPresenterModel finalModel = model;
+ presenter.getContainer().getDisplay().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ if (presenter != null && !presenter.isDisposed()) {
+ indicator.dispose();
+ presenter.setLinksProperty(finalModel);
+ getForm().layout(true, true);
+ getForm().updateToolBar();
+ getForm().reflow(true);
+
+ }
+ }
+ });
+ }
+ return Status.OK_STATUS;
+ }
+ };
+ j.setSystem(true);
+ j.schedule();
+
+ }
+
+ private String findEntityName(String serviceName) {
+ if (StringUtility.isNullOrEmpty(serviceName)) {
+ return serviceName;
+ }
+ if (serviceName.endsWith(SdkProperties.SUFFIX_FORM)) {
+ return serviceName.replaceAll("^(.*)" + SdkProperties.SUFFIX_FORM + "$", "$1");
+ }
+ return serviceName;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/singlepage/IconsPropertyViewPart.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/singlepage/IconsPropertyViewPart.java
index ed50c83d2..244c4f59d 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/singlepage/IconsPropertyViewPart.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/singlepage/IconsPropertyViewPart.java
@@ -1,73 +1,73 @@
-/*******************************************************************************
- * 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.view.properties.part.singlepage;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.ui.extensions.view.property.ISinglePropertyViewPart;
-import org.eclipse.scout.sdk.ui.internal.view.icons.IconsEditor;
-import org.eclipse.scout.sdk.ui.internal.view.outline.pages.project.shared.IconNodePage;
-import org.eclipse.scout.sdk.ui.internal.view.properties.model.links.FileOpenLink;
-import org.eclipse.scout.sdk.ui.internal.view.properties.model.links.LinksPresenterModel;
-import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.LinksPresenter;
-import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
-import org.eclipse.scout.sdk.ui.view.properties.part.AbstractSectionBasedPart;
-import org.eclipse.scout.sdk.ui.view.properties.part.ISection;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * <h3>UnknownPropertyViewPart</h3> ...
- *
- * @author Andreas Hoegger
- * @since 1.0.8 21.07.2010
- */
-public class IconsPropertyViewPart extends AbstractSectionBasedPart implements ISinglePropertyViewPart {
- private static final String SECTION_ID_LINKS = "section.links";
- private IconNodePage m_page;
-
- @Override
- public void setPage(IPage page) {
- if (!(page instanceof IconNodePage)) {
- throw new IllegalArgumentException("page must extend '" + IconNodePage.class.getName() + "'");
- }
- m_page = (IconNodePage) page;
- }
-
- @Override
- public IconNodePage getPage() {
- return m_page;
- }
-
- @Override
- protected void createSections() {
- // link area
- ISection linkSection = createSection(SECTION_ID_LINKS, Texts.get("Links"));
- fillLinkSection(linkSection.getSectionClient());
- super.createSections();
- }
-
- protected void fillLinkSection(Composite parent) {
- // model
- LinksPresenterModel model = new LinksPresenterModel();
- IFile nlsFile = (IFile) getPage().getIconsType().getResource();
- if (nlsFile != null && nlsFile.exists()) {
- FileOpenLink link = new FileOpenLink(nlsFile, 10, IconsEditor.ID);
- link.setName(Texts.get("OpenIconsEditor"));
- model.addGlobalLink(link);
- }
- // ui
- LinksPresenter presenter = new LinksPresenter(getFormToolkit(), parent, model);
- GridData layoutData = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
- layoutData.widthHint = 200;
- presenter.getContainer().setLayoutData(layoutData);
- }
-}
+/*******************************************************************************
+ * 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.view.properties.part.singlepage;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.ui.extensions.view.property.ISinglePropertyViewPart;
+import org.eclipse.scout.sdk.ui.internal.view.icons.IconsEditor;
+import org.eclipse.scout.sdk.ui.internal.view.outline.pages.project.shared.IconNodePage;
+import org.eclipse.scout.sdk.ui.internal.view.properties.model.links.FileOpenLink;
+import org.eclipse.scout.sdk.ui.internal.view.properties.model.links.LinksPresenterModel;
+import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.LinksPresenter;
+import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
+import org.eclipse.scout.sdk.ui.view.properties.part.AbstractSectionBasedPart;
+import org.eclipse.scout.sdk.ui.view.properties.part.ISection;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * <h3>UnknownPropertyViewPart</h3> ...
+ *
+ * @author Andreas Hoegger
+ * @since 1.0.8 21.07.2010
+ */
+public class IconsPropertyViewPart extends AbstractSectionBasedPart implements ISinglePropertyViewPart {
+ private static final String SECTION_ID_LINKS = "section.links";
+ private IconNodePage m_page;
+
+ @Override
+ public void setPage(IPage page) {
+ if (!(page instanceof IconNodePage)) {
+ throw new IllegalArgumentException("page must extend '" + IconNodePage.class.getName() + "'");
+ }
+ m_page = (IconNodePage) page;
+ }
+
+ @Override
+ public IconNodePage getPage() {
+ return m_page;
+ }
+
+ @Override
+ protected void createSections() {
+ // link area
+ ISection linkSection = createSection(SECTION_ID_LINKS, Texts.get("Links"));
+ fillLinkSection(linkSection.getSectionClient());
+ super.createSections();
+ }
+
+ protected void fillLinkSection(Composite parent) {
+ // model
+ LinksPresenterModel model = new LinksPresenterModel();
+ IFile nlsFile = (IFile) getPage().getIconsType().getResource();
+ if (nlsFile != null && nlsFile.exists()) {
+ FileOpenLink link = new FileOpenLink(nlsFile, 10, IconsEditor.ID);
+ link.setName(Texts.get("OpenIconsEditor"));
+ model.addGlobalLink(link);
+ }
+ // ui
+ LinksPresenter presenter = new LinksPresenter(getFormToolkit(), parent, model);
+ GridData layoutData = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
+ layoutData.widthHint = 200;
+ presenter.getContainer().setLayoutData(layoutData);
+ }
+}
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 059425427..64fd434d4 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
@@ -1,603 +1,603 @@
-/*******************************************************************************
- * 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.view.properties.part.singlepage;
-
-import java.util.HashMap;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IMethod;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.ui.JavaUI;
-import org.eclipse.scout.commons.RunnableWithData;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.jobs.OperationJob;
-import org.eclipse.scout.sdk.operation.util.CompilationUnitSaveOperation;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.ExecMethodPresenter;
-import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.ExecResetSerchFilterMethodPresenter;
-import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.PageFilterPresenter;
-import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.single.BooleanPresenter;
-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.DoublePresenter;
-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;
-import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.single.HorizontalAlignmentPresenter;
-import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.single.IconPresenter;
-import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.single.IntegerPresenter;
-import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.single.LabelHorizontalAlignmentPresenter;
-import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.single.LabelPositionPresenter;
-import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.single.LongPresenter;
-import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.single.LookupCallProposalPresenter;
-import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.single.LookupServiceProposalPresenter;
-import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.single.MasterFieldPresenter;
-import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.single.MultiLineStringPresenter;
-import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.single.NlsDocsTextPresenter;
-import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.single.NlsTextPresenter;
-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.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;
-import org.eclipse.scout.sdk.ui.view.outline.pages.AbstractScoutTypePage;
-import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
-import org.eclipse.scout.sdk.ui.view.properties.part.ISection;
-import org.eclipse.scout.sdk.ui.view.properties.part.singlepage.PropertyViewConfig.ConfigTypes;
-import org.eclipse.scout.sdk.ui.view.properties.presenter.single.AbstractMethodPresenter;
-import org.eclipse.scout.sdk.util.jdt.IJavaResourceChangedListener;
-import org.eclipse.scout.sdk.util.jdt.JdtEvent;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.util.typecache.TypeCacheAccessor;
-import org.eclipse.scout.sdk.workspace.type.config.ConfigPropertyType;
-import org.eclipse.scout.sdk.workspace.type.config.ConfigurationMethod;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.forms.events.HyperlinkAdapter;
-import org.eclipse.ui.forms.events.HyperlinkEvent;
-import org.eclipse.ui.forms.widgets.Hyperlink;
-import org.eclipse.ui.forms.widgets.ScrolledForm;
-import org.eclipse.ui.ide.IDE;
-import org.eclipse.ui.part.FileEditorInput;
-
-/**
- * <h3>JdtTypePropertyPart</h3> ...
- *
- * @author Andreas Hoegger
- * @since 1.0.8 19.07.2010
- */
-public class JdtTypePropertyPart extends AbstractSinglePageSectionBasedViewPart {
- protected static final String SECTION_ID_FILTER = "section.filter";
- protected static final String SECTION_ID_PROPS_IMPORTANT = "section.properties.important";
- protected static final String SECTION_ID_PROPS_ADVANCED = "section.properties.advanced";
- protected static final String SECTION_ID_OPS_IMPORTANT = "section.operations.important";
- protected static final String SECTION_ID_OPS_ADVANCED = "section.operations.advanced";
-
- private IJavaResourceChangedListener m_methodChangedListener;
- private ConfigPropertyType m_configPropertyType;
- private HashMap<String, AbstractMethodPresenter> m_methodPresenters;
-
- private HashMap<String, ConfigurationMethod> m_methodsToUpdate;
- private Object m_methodUpdateLock = new Object();
- private P_UpdateMethodsJob m_updateJob;
- private Button m_saveButton;
-
- private IStatus m_icuNotSyncStatus;
- private P_MarkDirtyJob m_markDirtyJob = new P_MarkDirtyJob();
- private Object m_markDirtyLock = new Object();
-
- public JdtTypePropertyPart() {
- m_methodsToUpdate = new HashMap<String, ConfigurationMethod>();
- m_methodPresenters = new HashMap<String, AbstractMethodPresenter>();
- }
-
- @Override
- protected String getPartKey() {
- if (getPage() == null || !TypeUtility.exists(getPage().getType())) return null;
- return getPage().getType().getFullyQualifiedName();
- }
-
- @Override
- public AbstractScoutTypePage getPage() {
- return (AbstractScoutTypePage) super.getPage();
- }
-
- ISection addSection(String sectionId, String title) {
- return super.createSection(sectionId, title);
- }
-
- private boolean isDirty() {
- return m_markDirtyJob.isDirty();
- }
-
- @Override
- public void setPage(IPage page) {
- super.setPage(page);
- m_icuNotSyncStatus = new Status(IStatus.INFO, ScoutSdkUi.PLUGIN_ID, Texts.get("SaveTheFile", getPage().getType().getResource().getName()));
- }
-
- @Override
- protected Control createHead(Composite parent) {
- Composite headArea = getFormToolkit().createComposite(parent);
- Hyperlink title = getFormToolkit().createHyperlink(headArea, getPage().getName(), SWT.WRAP);
- title.setFont(new Font(parent.getDisplay(), parent.getFont().getFontData()[0].getName(), 12, SWT.NORMAL));
- title.addHyperlinkListener(new HyperlinkAdapter() {
- @Override
- public void linkActivated(HyperlinkEvent e) {
- try {
- IResource r = getPage().getType().getCompilationUnit().getResource();
- if (r instanceof IFile) {
- IFile f = (IFile) r;
- String editorId = IDE.getEditorDescriptor(f).getId();
- IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
- IEditorPart editorPart = activePage.openEditor(new FileEditorInput(f), editorId, true, IWorkbenchPage.MATCH_ID | IWorkbenchPage.MATCH_INPUT);
- JavaUI.revealInEditor(editorPart, (IJavaElement) getPage().getType());
- }
- }
- catch (Exception e1) {
- ScoutSdkUi.logError("could not open '" + getPage().getType().getElementName() + "' in editor.", e1);
- }
- }
- });
-
- m_saveButton = getFormToolkit().createButton(headArea, Texts.get("SaveFile"), SWT.PUSH);
- m_saveButton.setEnabled(false);
- m_saveButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- ICompilationUnit icu = getPage().getType().getCompilationUnit();
- if (icu.isWorkingCopy()) {
- CompilationUnitSaveOperation op = new CompilationUnitSaveOperation(icu);
- new OperationJob(op).schedule();
- }
- }
- });
-
- // layout
- headArea.setLayout(new GridLayout(2, false));
- GridData titleData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
- title.setLayoutData(titleData);
- m_saveButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.FILL_HORIZONTAL));
- return headArea;
- }
-
- @Override
- protected void createSections() {
- if (m_updateJob == null) {
- m_updateJob = new P_UpdateMethodsJob(getForm().getDisplay());
- }
-
- // Filter Section
- if (getPage().isFolder()) {
- ISection filterSection = createSection(SECTION_ID_FILTER, Texts.get("Filter"));
- PageFilterPresenter filterPresenter = new PageFilterPresenter(getFormToolkit(), filterSection.getSectionClient(), getPage());
- GridData layoutData = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
- layoutData.widthHint = 200;
- filterPresenter.getContainer().setLayoutData(layoutData);
- filterSection.setExpanded(wasSectionExpanded(SECTION_ID_FILTER, false));
- }
-
- m_configPropertyType = new ConfigPropertyType(getPage().getType());
-
- // ensure consistent order
- boolean noImpProps = !createImportantProperties();
- if (noImpProps) {
- createAdvancedProperties(false);
- boolean created = createImportantOperations();
- createAdvancedOperations(created);
- }
- else {
- boolean noImpOps = !createImportantOperations();
- if (noImpOps) {
- createAdvancedOperations(false);
- createAdvancedProperties(true);
- }
- else {
- createAdvancedProperties(true);
- createAdvancedOperations(true);
- }
- }
-
- if (m_methodChangedListener == null) {
- m_methodChangedListener = new P_MethodChangedListener();
- TypeCacheAccessor.getJavaResourceChangedEmitter().addJavaResourceChangedListener(m_methodChangedListener);
- }
-
- try {
- setCompilationUnitDirty(getPage().getType().getCompilationUnit().isWorkingCopy() && getPage().getType().getCompilationUnit().getBuffer().hasUnsavedChanges());
- }
- catch (JavaModelException e) {
- ScoutSdkUi.logWarning("could not determ working copy '" + getPage().getType().getElementName() + "'.");
- }
- }
-
- private boolean createImportantProperties() {
- ConfigurationMethodSection impConfigPropsSection = new ConfigurationMethodSection(m_configPropertyType, ConfigurationMethod.PROPERTY_METHOD, ConfigTypes.Normal);
- ISection impPropsSection = impConfigPropsSection.createContent(this, SECTION_ID_PROPS_IMPORTANT, Texts.get("Properties"), wasSectionExpanded(SECTION_ID_PROPS_IMPORTANT, true));
- return impPropsSection != null;
- }
-
- private boolean createImportantOperations() {
- ConfigurationMethodSection importantExecSection = new ConfigurationMethodSection(m_configPropertyType, ConfigurationMethod.OPERATION_METHOD, ConfigTypes.Normal);
- ISection impOpsSection = importantExecSection.createContent(this, SECTION_ID_OPS_IMPORTANT, Texts.get("Operations"), wasSectionExpanded(SECTION_ID_OPS_IMPORTANT, true));
- return impOpsSection != null;
- }
-
- private boolean createAdvancedProperties(boolean importantCreated) {
- ConfigurationMethodSection advancedConfigPropsSection = new ConfigurationMethodSection(m_configPropertyType, ConfigurationMethod.PROPERTY_METHOD, ConfigTypes.Advanced);
- ISection advPropsSection = advancedConfigPropsSection.createContent(this, SECTION_ID_PROPS_ADVANCED, Texts.get(importantCreated ? "AdvancedProperties" : "Properties"), wasSectionExpanded(SECTION_ID_PROPS_ADVANCED, !importantCreated));
- return advPropsSection != null;
- }
-
- private boolean createAdvancedOperations(boolean importantCreated) {
- ConfigurationMethodSection advancedExecSection = new ConfigurationMethodSection(m_configPropertyType, ConfigurationMethod.OPERATION_METHOD, ConfigTypes.Advanced);
- ISection advOpsSection = advancedExecSection.createContent(this, SECTION_ID_OPS_ADVANCED, Texts.get(importantCreated ? "AdvancedOperations" : "Operations"), wasSectionExpanded(SECTION_ID_OPS_ADVANCED, !importantCreated));
- return advOpsSection != null;
- }
-
- @Override
- protected void cleanup() {
- if (m_methodChangedListener != null) {
- TypeCacheAccessor.getJavaResourceChangedEmitter().removeJavaResourceChangedListener(m_methodChangedListener);
- m_methodChangedListener = null;
- }
- super.cleanup();
- }
-
- AbstractMethodPresenter createConfigMethodPresenter(Composite parent, ConfigurationMethod method) {
- AbstractMethodPresenter presenter = null;
- String propertyType = method.getConfigAnnotationType();
-
- if (propertyType.equals("BOOLEAN")) {
- presenter = new BooleanPresenter(getFormToolkit(), parent);
- presenter.setMethod(method);
- }
- else if (propertyType.equals("DOUBLE")) {
- presenter = new DoublePresenter(getFormToolkit(), parent);
- presenter.setMethod(method);
- }
- else if (propertyType.equals("DRAG_AND_DROP_TYPE")) {
- // TODO: presenter for DRAG_AND_DROP_TYPE
- }
- else if (propertyType.equals("INTEGER")) {
- presenter = new IntegerPresenter(getFormToolkit(), parent);
- presenter.setMethod(method);
- }
- else if (propertyType.equals("LONG")) {
- presenter = new LongPresenter(getFormToolkit(), parent);
- presenter.setMethod(method);
- }
- else if (propertyType.equals("STRING")) {
- presenter = new StringPresenter(getFormToolkit(), parent);
- presenter.setMethod(method);
- }
- else if (propertyType.equals("FONT")) {
- presenter = new FontPresenter(getFormToolkit(), parent);
- presenter.setMethod(method);
- }
- else if (propertyType.equals("COLOR")) {
- presenter = new ColorPresenter(getFormToolkit(), parent);
- presenter.setMethod(method);
- }
- else if (propertyType.equals("OBJECT")) {
- // TODO: 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);
- }
- else if (propertyType.equals("BUTTON_SYSTEM_TYPE")) {
- presenter = new ButtonSystemTypePresenter(getFormToolkit(), parent);
- presenter.setMethod(method);
- }
- else if (propertyType.equals("CODE_TYPE")) {
- presenter = new CodeTypeProposalPresenter(getFormToolkit(), parent);
- presenter.setMethod(method);
- }
- else if (propertyType.equals("COMPOSER_ATTRIBUTE_TYPE")) {
- // TODO: presenter for COMPOSER_ATTRIBUTE_TYPE
- }
- else if (propertyType.equals("FILE_EXTENSIONS")) {
- // TODO: presenter for FILE_EXTENSIONS
- }
- else if (propertyType.equals("FORM_DISPLAY_HINT")) {
- presenter = new FormDisplayHintPresenter(getFormToolkit(), parent);
- presenter.setMethod(method);
- }
- else if (propertyType.equals("FORM_VIEW_ID")) {
- presenter = new FormViewIdPresenter(getFormToolkit(), parent);
- presenter.setMethod(method);
- }
- else if (propertyType.equals("HORIZONTAL_ALIGNMENT")) {
- presenter = new HorizontalAlignmentPresenter(getFormToolkit(), parent);
- presenter.setMethod(method);
- }
- else if (propertyType.equals("ICON_ID")) {
- presenter = new IconPresenter(getFormToolkit(), parent);
- presenter.setMethod(method);
- }
- else if (propertyType.equals("KEY_STROKE")) {
- // TODO: presenter for KEY_STROKE
- }
- else if (propertyType.equals("LOOKUP_CALL")) {
- presenter = new LookupCallProposalPresenter(getFormToolkit(), parent);
- presenter.setMethod(method);
- }
- else if (propertyType.equals("LOOKUP_SERVICE")) {
- presenter = new LookupServiceProposalPresenter(getFormToolkit(), parent);
- presenter.setMethod(method);
- }
- else if (propertyType.equals("MASTER_FIELD")) {
- presenter = new MasterFieldPresenter(getFormToolkit(), parent);
- presenter.setMethod(method);
- }
- else if (propertyType.equals("OUTLINE_ROOT_PAGE")) {
- presenter = new OutlineRootPagePresenter(getFormToolkit(), parent);
- presenter.setMethod(method);
- }
- else if (propertyType.equals("OUTLINE")) {
- // TODO: presenter for OUTLINE
- }
- else if (propertyType.equals("OUTLINES")) {
- presenter = new OutlinesPresenter(getFormToolkit(), parent);
- presenter.setMethod(method);
- }
- else if (propertyType.equals("FORM")) {
- // TODO: presenter for FORM
- }
- else if (propertyType.equals("SEARCH_FORM")) {
- presenter = new SearchFormPresenter(getFormToolkit(), parent);
- presenter.setMethod(method);
- }
- else if (propertyType.equals("NLS_PROVIDER")) {
- // TODO: presenter for NLS_PROVIDER (obsolete?)
- }
- else if (propertyType.equals("SQL_STYLE")) {
- // TODO: presenter for SQL_STYLE
- }
- else if (propertyType.equals("SQL")) {
- presenter = new MultiLineStringPresenter(getFormToolkit(), parent);
- presenter.setMethod(method);
- }
- else if (propertyType.equals("TEXT")) {
- presenter = new NlsTextPresenter(getFormToolkit(), parent);
- presenter.setMethod(method);
- }
- else if (propertyType.equals("DOC")) {
- presenter = new NlsDocsTextPresenter(getFormToolkit(), parent);
-// ((NlsDocsTextPresenter) presenter).setType(getPage().getType());
- presenter.setMethod(method);
- }
- else if (propertyType.equals("VERTICAL_ALIGNMENT")) {
- presenter = new VerticalAglinmentPresenter(getFormToolkit(), parent);
- presenter.setMethod(method);
- }
- else if (propertyType.equals("CHART_QNAME")) {
- // TODO: presenter for CHART_QNAME
- }
- else if (propertyType.equals("HOUR_OF_DAY")) {
- // TODO: presenter for HOUR_OF_DAY
- }
- else if (propertyType.equals("DURATION_MINUTES")) {
- // TODO: presenter for DURATION_MINUTES
- }
- else if (propertyType.equals("MENU_CLASS")) {
- // TODO: presenter for MENU_CLASS
- }
- else if (propertyType.equals("PRIMITIVE_TYPE")) {
- presenter = new PrimitiveTypePresenter(getFormToolkit(), parent);
- presenter.setMethod(method);
- }
-
- // layout
- if (presenter != null) {
- GridData layoutData = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
- layoutData.widthHint = 200;
- presenter.getContainer().setLayoutData(layoutData);
- presenter.setEnabled(!isDirty());
- m_methodPresenters.put(method.getMethodName(), presenter);
- }
- else {
- ScoutSdkUi.logWarning("Could not find a presenter for property '" + propertyType + "'.");
- }
-
- return presenter;
- }
-
- AbstractMethodPresenter createOperationPresenter(Composite parent, ConfigurationMethod method) {
- AbstractMethodPresenter presenter = null;
- if (method.getMethodName().equals("execResetSearchFilter")) {
- presenter = new ExecResetSerchFilterMethodPresenter(getFormToolkit(), parent);
- presenter.setMethod(method);
- }
- else {
- presenter = new ExecMethodPresenter(getFormToolkit(), parent);
- presenter.setMethod(method);
- }
- //layout
- if (presenter != null) {
- GridData layoutData = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
- layoutData.widthHint = 200;
- presenter.getContainer().setLayoutData(layoutData);
- presenter.setEnabled(!isDirty());
- m_methodPresenters.put(method.getMethodName(), presenter);
- }
- return presenter;
- }
-
- private void handleMethodChanged(IMethod method) {
- if (m_configPropertyType.isRelevantType(method.getDeclaringType())) {
- ConfigurationMethod updatedMethod = m_configPropertyType.updateIfChanged(method);
- if (updatedMethod != null) {
- synchronized (m_methodUpdateLock) {
- m_methodsToUpdate.put(updatedMethod.getMethodName(), updatedMethod);
- m_updateJob.cancel();
- m_updateJob.schedule(150);
- }
- }
- }
- }
-
- private void setCompilationUnitDirty(final boolean dirty) {
- synchronized (m_markDirtyLock) {
- ScrolledForm form = getForm();
- if (form != null && !form.isDisposed()) {
- form.getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- if (getForm() != null && !getForm().isDisposed()) {
- m_saveButton.setEnabled(dirty);
- for (AbstractMethodPresenter p : m_methodPresenters.values()) {
- p.setEnabled(!dirty);
- }
- if (dirty) {
- addStatus(m_icuNotSyncStatus);
- }
- else {
- removeStatus(m_icuNotSyncStatus);
- }
- }
- }
- });
- }
- }
- }
-
- private class P_MethodChangedListener implements IJavaResourceChangedListener {
- @Override
- public void handleEvent(JdtEvent event) {
- switch (event.getEventType()) {
- case JdtEvent.ADDED:
- case JdtEvent.REMOVED:
- case JdtEvent.CHANGED:
- if (event.getElement().getElementType() == IJavaElement.METHOD) {
- handleMethodChanged((IMethod) event.getElement());
- }
- break;
- case JdtEvent.BUFFER_DIRTY:
- if (event.getElementType() == IJavaElement.COMPILATION_UNIT && getPage().getType().getCompilationUnit().equals(event.getElement())) {
- m_markDirtyJob.cancel();
- m_markDirtyJob.setDirty(true);
- m_markDirtyJob.schedule(150);
- }
- break;
- case JdtEvent.BUFFER_SYNC:
- if (event.getElementType() == IJavaElement.COMPILATION_UNIT && getPage().getType().getCompilationUnit().equals(event.getElement())) {
- m_markDirtyJob.cancel();
- m_markDirtyJob.setDirty(false);
- m_markDirtyJob.schedule(150);
- }
- break;
- }
- }
- }
-
- private class P_UpdateMethodsJob extends Job {
- private final Display m_display;
-
- public P_UpdateMethodsJob(Display display) {
- super("");
- m_display = display;
- setSystem(true);
- setRule(ResourcesPlugin.getWorkspace().getRoot());
- }
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- if (monitor.isCanceled()) {
- return Status.CANCEL_STATUS;
- }
- ConfigurationMethod[] methods = new ConfigurationMethod[0];
- synchronized (m_methodUpdateLock) {
- if (m_methodsToUpdate.size() > 0) methods = m_methodsToUpdate.values().toArray(new ConfigurationMethod[m_methodsToUpdate.size()]);
- m_methodsToUpdate.clear();
- }
- for (ConfigurationMethod cm : methods) {
- AbstractMethodPresenter presenter = m_methodPresenters.get(cm.getMethodName());
- if (presenter != null) {
- RunnableWithData runnable = new RunnableWithData() {
- @Override
- public void run() {
- ((AbstractMethodPresenter) getData("presenter")).setMethod((ConfigurationMethod) getData("configMethod"));
-
- }
- };
- runnable.setData("presenter", presenter);
- runnable.setData("configMethod", cm);
- if (m_display != null && !m_display.isDisposed()) {
- m_display.syncExec(runnable);
- }
- }
- }
- return Status.OK_STATUS;
- }
- } // end P_UpdateMethodsJob
-
- private class P_MarkDirtyJob extends Job {
- private boolean m_dirty;
-
- public P_MarkDirtyJob() {
- super("");
- setSystem(true);
- }
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- setCompilationUnitDirty(m_dirty);
- return Status.OK_STATUS;
- }
-
- /**
- * @param dirty
- * the dirty to set
- */
- public void setDirty(boolean dirty) {
- m_dirty = dirty;
- }
-
- /**
- * @return the dirty
- */
- public boolean isDirty() {
- return m_dirty;
- }
- }
-}
+/*******************************************************************************
+ * 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.view.properties.part.singlepage;
+
+import java.util.HashMap;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.ui.JavaUI;
+import org.eclipse.scout.commons.RunnableWithData;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.jobs.OperationJob;
+import org.eclipse.scout.sdk.operation.util.CompilationUnitSaveOperation;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.ExecMethodPresenter;
+import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.ExecResetSerchFilterMethodPresenter;
+import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.PageFilterPresenter;
+import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.single.BooleanPresenter;
+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.DoublePresenter;
+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;
+import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.single.HorizontalAlignmentPresenter;
+import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.single.IconPresenter;
+import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.single.IntegerPresenter;
+import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.single.LabelHorizontalAlignmentPresenter;
+import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.single.LabelPositionPresenter;
+import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.single.LongPresenter;
+import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.single.LookupCallProposalPresenter;
+import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.single.LookupServiceProposalPresenter;
+import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.single.MasterFieldPresenter;
+import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.single.MultiLineStringPresenter;
+import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.single.NlsDocsTextPresenter;
+import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.single.NlsTextPresenter;
+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.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;
+import org.eclipse.scout.sdk.ui.view.outline.pages.AbstractScoutTypePage;
+import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
+import org.eclipse.scout.sdk.ui.view.properties.part.ISection;
+import org.eclipse.scout.sdk.ui.view.properties.part.singlepage.PropertyViewConfig.ConfigTypes;
+import org.eclipse.scout.sdk.ui.view.properties.presenter.single.AbstractMethodPresenter;
+import org.eclipse.scout.sdk.util.jdt.IJavaResourceChangedListener;
+import org.eclipse.scout.sdk.util.jdt.JdtEvent;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.util.typecache.TypeCacheAccessor;
+import org.eclipse.scout.sdk.workspace.type.config.ConfigPropertyType;
+import org.eclipse.scout.sdk.workspace.type.config.ConfigurationMethod;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.forms.events.HyperlinkAdapter;
+import org.eclipse.ui.forms.events.HyperlinkEvent;
+import org.eclipse.ui.forms.widgets.Hyperlink;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
+import org.eclipse.ui.ide.IDE;
+import org.eclipse.ui.part.FileEditorInput;
+
+/**
+ * <h3>JdtTypePropertyPart</h3> ...
+ *
+ * @author Andreas Hoegger
+ * @since 1.0.8 19.07.2010
+ */
+public class JdtTypePropertyPart extends AbstractSinglePageSectionBasedViewPart {
+ protected static final String SECTION_ID_FILTER = "section.filter";
+ protected static final String SECTION_ID_PROPS_IMPORTANT = "section.properties.important";
+ protected static final String SECTION_ID_PROPS_ADVANCED = "section.properties.advanced";
+ protected static final String SECTION_ID_OPS_IMPORTANT = "section.operations.important";
+ protected static final String SECTION_ID_OPS_ADVANCED = "section.operations.advanced";
+
+ private IJavaResourceChangedListener m_methodChangedListener;
+ private ConfigPropertyType m_configPropertyType;
+ private HashMap<String, AbstractMethodPresenter> m_methodPresenters;
+
+ private HashMap<String, ConfigurationMethod> m_methodsToUpdate;
+ private Object m_methodUpdateLock = new Object();
+ private P_UpdateMethodsJob m_updateJob;
+ private Button m_saveButton;
+
+ private IStatus m_icuNotSyncStatus;
+ private P_MarkDirtyJob m_markDirtyJob = new P_MarkDirtyJob();
+ private Object m_markDirtyLock = new Object();
+
+ public JdtTypePropertyPart() {
+ m_methodsToUpdate = new HashMap<String, ConfigurationMethod>();
+ m_methodPresenters = new HashMap<String, AbstractMethodPresenter>();
+ }
+
+ @Override
+ protected String getPartKey() {
+ if (getPage() == null || !TypeUtility.exists(getPage().getType())) return null;
+ return getPage().getType().getFullyQualifiedName();
+ }
+
+ @Override
+ public AbstractScoutTypePage getPage() {
+ return (AbstractScoutTypePage) super.getPage();
+ }
+
+ ISection addSection(String sectionId, String title) {
+ return super.createSection(sectionId, title);
+ }
+
+ private boolean isDirty() {
+ return m_markDirtyJob.isDirty();
+ }
+
+ @Override
+ public void setPage(IPage page) {
+ super.setPage(page);
+ m_icuNotSyncStatus = new Status(IStatus.INFO, ScoutSdkUi.PLUGIN_ID, Texts.get("SaveTheFile", getPage().getType().getResource().getName()));
+ }
+
+ @Override
+ protected Control createHead(Composite parent) {
+ Composite headArea = getFormToolkit().createComposite(parent);
+ Hyperlink title = getFormToolkit().createHyperlink(headArea, getPage().getName(), SWT.WRAP);
+ title.setFont(new Font(parent.getDisplay(), parent.getFont().getFontData()[0].getName(), 12, SWT.NORMAL));
+ title.addHyperlinkListener(new HyperlinkAdapter() {
+ @Override
+ public void linkActivated(HyperlinkEvent e) {
+ try {
+ IResource r = getPage().getType().getCompilationUnit().getResource();
+ if (r instanceof IFile) {
+ IFile f = (IFile) r;
+ String editorId = IDE.getEditorDescriptor(f).getId();
+ IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ IEditorPart editorPart = activePage.openEditor(new FileEditorInput(f), editorId, true, IWorkbenchPage.MATCH_ID | IWorkbenchPage.MATCH_INPUT);
+ JavaUI.revealInEditor(editorPart, (IJavaElement) getPage().getType());
+ }
+ }
+ catch (Exception e1) {
+ ScoutSdkUi.logError("could not open '" + getPage().getType().getElementName() + "' in editor.", e1);
+ }
+ }
+ });
+
+ m_saveButton = getFormToolkit().createButton(headArea, Texts.get("SaveFile"), SWT.PUSH);
+ m_saveButton.setEnabled(false);
+ m_saveButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ ICompilationUnit icu = getPage().getType().getCompilationUnit();
+ if (icu.isWorkingCopy()) {
+ CompilationUnitSaveOperation op = new CompilationUnitSaveOperation(icu);
+ new OperationJob(op).schedule();
+ }
+ }
+ });
+
+ // layout
+ headArea.setLayout(new GridLayout(2, false));
+ GridData titleData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
+ title.setLayoutData(titleData);
+ m_saveButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.FILL_HORIZONTAL));
+ return headArea;
+ }
+
+ @Override
+ protected void createSections() {
+ if (m_updateJob == null) {
+ m_updateJob = new P_UpdateMethodsJob(getForm().getDisplay());
+ }
+
+ // Filter Section
+ if (getPage().isFolder()) {
+ ISection filterSection = createSection(SECTION_ID_FILTER, Texts.get("Filter"));
+ PageFilterPresenter filterPresenter = new PageFilterPresenter(getFormToolkit(), filterSection.getSectionClient(), getPage());
+ GridData layoutData = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
+ layoutData.widthHint = 200;
+ filterPresenter.getContainer().setLayoutData(layoutData);
+ filterSection.setExpanded(wasSectionExpanded(SECTION_ID_FILTER, false));
+ }
+
+ m_configPropertyType = new ConfigPropertyType(getPage().getType());
+
+ // ensure consistent order
+ boolean noImpProps = !createImportantProperties();
+ if (noImpProps) {
+ createAdvancedProperties(false);
+ boolean created = createImportantOperations();
+ createAdvancedOperations(created);
+ }
+ else {
+ boolean noImpOps = !createImportantOperations();
+ if (noImpOps) {
+ createAdvancedOperations(false);
+ createAdvancedProperties(true);
+ }
+ else {
+ createAdvancedProperties(true);
+ createAdvancedOperations(true);
+ }
+ }
+
+ if (m_methodChangedListener == null) {
+ m_methodChangedListener = new P_MethodChangedListener();
+ TypeCacheAccessor.getJavaResourceChangedEmitter().addJavaResourceChangedListener(m_methodChangedListener);
+ }
+
+ try {
+ setCompilationUnitDirty(getPage().getType().getCompilationUnit().isWorkingCopy() && getPage().getType().getCompilationUnit().getBuffer().hasUnsavedChanges());
+ }
+ catch (JavaModelException e) {
+ ScoutSdkUi.logWarning("could not determ working copy '" + getPage().getType().getElementName() + "'.");
+ }
+ }
+
+ private boolean createImportantProperties() {
+ ConfigurationMethodSection impConfigPropsSection = new ConfigurationMethodSection(m_configPropertyType, ConfigurationMethod.PROPERTY_METHOD, ConfigTypes.Normal);
+ ISection impPropsSection = impConfigPropsSection.createContent(this, SECTION_ID_PROPS_IMPORTANT, Texts.get("Properties"), wasSectionExpanded(SECTION_ID_PROPS_IMPORTANT, true));
+ return impPropsSection != null;
+ }
+
+ private boolean createImportantOperations() {
+ ConfigurationMethodSection importantExecSection = new ConfigurationMethodSection(m_configPropertyType, ConfigurationMethod.OPERATION_METHOD, ConfigTypes.Normal);
+ ISection impOpsSection = importantExecSection.createContent(this, SECTION_ID_OPS_IMPORTANT, Texts.get("Operations"), wasSectionExpanded(SECTION_ID_OPS_IMPORTANT, true));
+ return impOpsSection != null;
+ }
+
+ private boolean createAdvancedProperties(boolean importantCreated) {
+ ConfigurationMethodSection advancedConfigPropsSection = new ConfigurationMethodSection(m_configPropertyType, ConfigurationMethod.PROPERTY_METHOD, ConfigTypes.Advanced);
+ ISection advPropsSection = advancedConfigPropsSection.createContent(this, SECTION_ID_PROPS_ADVANCED, Texts.get(importantCreated ? "AdvancedProperties" : "Properties"), wasSectionExpanded(SECTION_ID_PROPS_ADVANCED, !importantCreated));
+ return advPropsSection != null;
+ }
+
+ private boolean createAdvancedOperations(boolean importantCreated) {
+ ConfigurationMethodSection advancedExecSection = new ConfigurationMethodSection(m_configPropertyType, ConfigurationMethod.OPERATION_METHOD, ConfigTypes.Advanced);
+ ISection advOpsSection = advancedExecSection.createContent(this, SECTION_ID_OPS_ADVANCED, Texts.get(importantCreated ? "AdvancedOperations" : "Operations"), wasSectionExpanded(SECTION_ID_OPS_ADVANCED, !importantCreated));
+ return advOpsSection != null;
+ }
+
+ @Override
+ protected void cleanup() {
+ if (m_methodChangedListener != null) {
+ TypeCacheAccessor.getJavaResourceChangedEmitter().removeJavaResourceChangedListener(m_methodChangedListener);
+ m_methodChangedListener = null;
+ }
+ super.cleanup();
+ }
+
+ AbstractMethodPresenter createConfigMethodPresenter(Composite parent, ConfigurationMethod method) {
+ AbstractMethodPresenter presenter = null;
+ String propertyType = method.getConfigAnnotationType();
+
+ if (propertyType.equals("BOOLEAN")) {
+ presenter = new BooleanPresenter(getFormToolkit(), parent);
+ presenter.setMethod(method);
+ }
+ else if (propertyType.equals("DOUBLE")) {
+ presenter = new DoublePresenter(getFormToolkit(), parent);
+ presenter.setMethod(method);
+ }
+ else if (propertyType.equals("DRAG_AND_DROP_TYPE")) {
+ // TODO: presenter for DRAG_AND_DROP_TYPE
+ }
+ else if (propertyType.equals("INTEGER")) {
+ presenter = new IntegerPresenter(getFormToolkit(), parent);
+ presenter.setMethod(method);
+ }
+ else if (propertyType.equals("LONG")) {
+ presenter = new LongPresenter(getFormToolkit(), parent);
+ presenter.setMethod(method);
+ }
+ else if (propertyType.equals("STRING")) {
+ presenter = new StringPresenter(getFormToolkit(), parent);
+ presenter.setMethod(method);
+ }
+ else if (propertyType.equals("FONT")) {
+ presenter = new FontPresenter(getFormToolkit(), parent);
+ presenter.setMethod(method);
+ }
+ else if (propertyType.equals("COLOR")) {
+ presenter = new ColorPresenter(getFormToolkit(), parent);
+ presenter.setMethod(method);
+ }
+ else if (propertyType.equals("OBJECT")) {
+ // TODO: 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);
+ }
+ else if (propertyType.equals("BUTTON_SYSTEM_TYPE")) {
+ presenter = new ButtonSystemTypePresenter(getFormToolkit(), parent);
+ presenter.setMethod(method);
+ }
+ else if (propertyType.equals("CODE_TYPE")) {
+ presenter = new CodeTypeProposalPresenter(getFormToolkit(), parent);
+ presenter.setMethod(method);
+ }
+ else if (propertyType.equals("COMPOSER_ATTRIBUTE_TYPE")) {
+ // TODO: presenter for COMPOSER_ATTRIBUTE_TYPE
+ }
+ else if (propertyType.equals("FILE_EXTENSIONS")) {
+ // TODO: presenter for FILE_EXTENSIONS
+ }
+ else if (propertyType.equals("FORM_DISPLAY_HINT")) {
+ presenter = new FormDisplayHintPresenter(getFormToolkit(), parent);
+ presenter.setMethod(method);
+ }
+ else if (propertyType.equals("FORM_VIEW_ID")) {
+ presenter = new FormViewIdPresenter(getFormToolkit(), parent);
+ presenter.setMethod(method);
+ }
+ else if (propertyType.equals("HORIZONTAL_ALIGNMENT")) {
+ presenter = new HorizontalAlignmentPresenter(getFormToolkit(), parent);
+ presenter.setMethod(method);
+ }
+ else if (propertyType.equals("ICON_ID")) {
+ presenter = new IconPresenter(getFormToolkit(), parent);
+ presenter.setMethod(method);
+ }
+ else if (propertyType.equals("KEY_STROKE")) {
+ // TODO: presenter for KEY_STROKE
+ }
+ else if (propertyType.equals("LOOKUP_CALL")) {
+ presenter = new LookupCallProposalPresenter(getFormToolkit(), parent);
+ presenter.setMethod(method);
+ }
+ else if (propertyType.equals("LOOKUP_SERVICE")) {
+ presenter = new LookupServiceProposalPresenter(getFormToolkit(), parent);
+ presenter.setMethod(method);
+ }
+ else if (propertyType.equals("MASTER_FIELD")) {
+ presenter = new MasterFieldPresenter(getFormToolkit(), parent);
+ presenter.setMethod(method);
+ }
+ else if (propertyType.equals("OUTLINE_ROOT_PAGE")) {
+ presenter = new OutlineRootPagePresenter(getFormToolkit(), parent);
+ presenter.setMethod(method);
+ }
+ else if (propertyType.equals("OUTLINE")) {
+ // TODO: presenter for OUTLINE
+ }
+ else if (propertyType.equals("OUTLINES")) {
+ presenter = new OutlinesPresenter(getFormToolkit(), parent);
+ presenter.setMethod(method);
+ }
+ else if (propertyType.equals("FORM")) {
+ // TODO: presenter for FORM
+ }
+ else if (propertyType.equals("SEARCH_FORM")) {
+ presenter = new SearchFormPresenter(getFormToolkit(), parent);
+ presenter.setMethod(method);
+ }
+ else if (propertyType.equals("NLS_PROVIDER")) {
+ // TODO: presenter for NLS_PROVIDER (obsolete?)
+ }
+ else if (propertyType.equals("SQL_STYLE")) {
+ // TODO: presenter for SQL_STYLE
+ }
+ else if (propertyType.equals("SQL")) {
+ presenter = new MultiLineStringPresenter(getFormToolkit(), parent);
+ presenter.setMethod(method);
+ }
+ else if (propertyType.equals("TEXT")) {
+ presenter = new NlsTextPresenter(getFormToolkit(), parent);
+ presenter.setMethod(method);
+ }
+ else if (propertyType.equals("DOC")) {
+ presenter = new NlsDocsTextPresenter(getFormToolkit(), parent);
+// ((NlsDocsTextPresenter) presenter).setType(getPage().getType());
+ presenter.setMethod(method);
+ }
+ else if (propertyType.equals("VERTICAL_ALIGNMENT")) {
+ presenter = new VerticalAglinmentPresenter(getFormToolkit(), parent);
+ presenter.setMethod(method);
+ }
+ else if (propertyType.equals("CHART_QNAME")) {
+ // TODO: presenter for CHART_QNAME
+ }
+ else if (propertyType.equals("HOUR_OF_DAY")) {
+ // TODO: presenter for HOUR_OF_DAY
+ }
+ else if (propertyType.equals("DURATION_MINUTES")) {
+ // TODO: presenter for DURATION_MINUTES
+ }
+ else if (propertyType.equals("MENU_CLASS")) {
+ // TODO: presenter for MENU_CLASS
+ }
+ else if (propertyType.equals("PRIMITIVE_TYPE")) {
+ presenter = new PrimitiveTypePresenter(getFormToolkit(), parent);
+ presenter.setMethod(method);
+ }
+
+ // layout
+ if (presenter != null) {
+ GridData layoutData = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
+ layoutData.widthHint = 200;
+ presenter.getContainer().setLayoutData(layoutData);
+ presenter.setEnabled(!isDirty());
+ m_methodPresenters.put(method.getMethodName(), presenter);
+ }
+ else {
+ ScoutSdkUi.logWarning("Could not find a presenter for property '" + propertyType + "'.");
+ }
+
+ return presenter;
+ }
+
+ AbstractMethodPresenter createOperationPresenter(Composite parent, ConfigurationMethod method) {
+ AbstractMethodPresenter presenter = null;
+ if (method.getMethodName().equals("execResetSearchFilter")) {
+ presenter = new ExecResetSerchFilterMethodPresenter(getFormToolkit(), parent);
+ presenter.setMethod(method);
+ }
+ else {
+ presenter = new ExecMethodPresenter(getFormToolkit(), parent);
+ presenter.setMethod(method);
+ }
+ //layout
+ if (presenter != null) {
+ GridData layoutData = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
+ layoutData.widthHint = 200;
+ presenter.getContainer().setLayoutData(layoutData);
+ presenter.setEnabled(!isDirty());
+ m_methodPresenters.put(method.getMethodName(), presenter);
+ }
+ return presenter;
+ }
+
+ private void handleMethodChanged(IMethod method) {
+ if (m_configPropertyType.isRelevantType(method.getDeclaringType())) {
+ ConfigurationMethod updatedMethod = m_configPropertyType.updateIfChanged(method);
+ if (updatedMethod != null) {
+ synchronized (m_methodUpdateLock) {
+ m_methodsToUpdate.put(updatedMethod.getMethodName(), updatedMethod);
+ m_updateJob.cancel();
+ m_updateJob.schedule(150);
+ }
+ }
+ }
+ }
+
+ private void setCompilationUnitDirty(final boolean dirty) {
+ synchronized (m_markDirtyLock) {
+ ScrolledForm form = getForm();
+ if (form != null && !form.isDisposed()) {
+ form.getDisplay().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ if (getForm() != null && !getForm().isDisposed()) {
+ m_saveButton.setEnabled(dirty);
+ for (AbstractMethodPresenter p : m_methodPresenters.values()) {
+ p.setEnabled(!dirty);
+ }
+ if (dirty) {
+ addStatus(m_icuNotSyncStatus);
+ }
+ else {
+ removeStatus(m_icuNotSyncStatus);
+ }
+ }
+ }
+ });
+ }
+ }
+ }
+
+ private class P_MethodChangedListener implements IJavaResourceChangedListener {
+ @Override
+ public void handleEvent(JdtEvent event) {
+ switch (event.getEventType()) {
+ case JdtEvent.ADDED:
+ case JdtEvent.REMOVED:
+ case JdtEvent.CHANGED:
+ if (event.getElement().getElementType() == IJavaElement.METHOD) {
+ handleMethodChanged((IMethod) event.getElement());
+ }
+ break;
+ case JdtEvent.BUFFER_DIRTY:
+ if (event.getElementType() == IJavaElement.COMPILATION_UNIT && getPage().getType().getCompilationUnit().equals(event.getElement())) {
+ m_markDirtyJob.cancel();
+ m_markDirtyJob.setDirty(true);
+ m_markDirtyJob.schedule(150);
+ }
+ break;
+ case JdtEvent.BUFFER_SYNC:
+ if (event.getElementType() == IJavaElement.COMPILATION_UNIT && getPage().getType().getCompilationUnit().equals(event.getElement())) {
+ m_markDirtyJob.cancel();
+ m_markDirtyJob.setDirty(false);
+ m_markDirtyJob.schedule(150);
+ }
+ break;
+ }
+ }
+ }
+
+ private class P_UpdateMethodsJob extends Job {
+ private final Display m_display;
+
+ public P_UpdateMethodsJob(Display display) {
+ super("");
+ m_display = display;
+ setSystem(true);
+ setRule(ResourcesPlugin.getWorkspace().getRoot());
+ }
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ if (monitor.isCanceled()) {
+ return Status.CANCEL_STATUS;
+ }
+ ConfigurationMethod[] methods = new ConfigurationMethod[0];
+ synchronized (m_methodUpdateLock) {
+ if (m_methodsToUpdate.size() > 0) methods = m_methodsToUpdate.values().toArray(new ConfigurationMethod[m_methodsToUpdate.size()]);
+ m_methodsToUpdate.clear();
+ }
+ for (ConfigurationMethod cm : methods) {
+ AbstractMethodPresenter presenter = m_methodPresenters.get(cm.getMethodName());
+ if (presenter != null) {
+ RunnableWithData runnable = new RunnableWithData() {
+ @Override
+ public void run() {
+ ((AbstractMethodPresenter) getData("presenter")).setMethod((ConfigurationMethod) getData("configMethod"));
+
+ }
+ };
+ runnable.setData("presenter", presenter);
+ runnable.setData("configMethod", cm);
+ if (m_display != null && !m_display.isDisposed()) {
+ m_display.syncExec(runnable);
+ }
+ }
+ }
+ return Status.OK_STATUS;
+ }
+ } // end P_UpdateMethodsJob
+
+ private class P_MarkDirtyJob extends Job {
+ private boolean m_dirty;
+
+ public P_MarkDirtyJob() {
+ super("");
+ setSystem(true);
+ }
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ setCompilationUnitDirty(m_dirty);
+ return Status.OK_STATUS;
+ }
+
+ /**
+ * @param dirty
+ * the dirty to set
+ */
+ public void setDirty(boolean dirty) {
+ m_dirty = dirty;
+ }
+
+ /**
+ * @return the dirty
+ */
+ public boolean isDirty() {
+ return m_dirty;
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/singlepage/ProductLaunchPropertyPart.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/singlepage/ProductLaunchPropertyPart.java
index db0fd1914..61d3d2d45 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/singlepage/ProductLaunchPropertyPart.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/singlepage/ProductLaunchPropertyPart.java
@@ -1,99 +1,99 @@
-/*******************************************************************************
- * 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.view.properties.part.singlepage;
-
-import java.util.ArrayList;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceVisitor;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.scout.sdk.RuntimeClasses;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.view.properties.part.ISection;
-import org.eclipse.scout.sdk.ui.view.properties.presenter.single.ProductLaunchPresenter;
-import org.eclipse.scout.sdk.util.SdkProperties;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * <h3>ServicePropertyPart</h3> ...
- *
- * @author Andreas Hoegger
- * @since 1.0.8 22.07.2010
- */
-public class ProductLaunchPropertyPart extends AbstractSinglePageSectionBasedViewPart {
- private static final String SECTION_ID_LINKS = "section.links";
-
- final IType basicPermission = TypeUtility.getType(RuntimeClasses.BasicPermission);
- final IType iForm = TypeUtility.getType(RuntimeClasses.IForm);
-
- public ProductLaunchPropertyPart() {
- }
-
- @Override
- protected void createSections() {
- // link area
- ISection linkSection = createSection(SECTION_ID_LINKS, Texts.get("Links"));
- fillLinkSection(linkSection.getSectionClient());
- super.createSections();
- }
-
- protected void fillLinkSection(Composite parent) {
- IScoutBundle bundle = (IScoutBundle) getPage().getScoutResource();
- if (bundle != null) {
- IResource resource = bundle.getProject().findMember(SdkProperties.PRODUCT_FOLDER);
- if (resource != null && resource.exists() && resource.getType() == IResource.FOLDER) {
- // spider products
- IFolder productFolder = (IFolder) resource;
- P_ProductResourceVisitor productVisitor = new P_ProductResourceVisitor();
- try {
- productFolder.accept(productVisitor);
- }
- catch (CoreException e) {
- ScoutSdkUi.logError("error during visiting folder '" + productFolder.getFullPath() + "'.", e);
- }
- for (IFile productFile : productVisitor.getProductFiles()) {
- ProductLaunchPresenter p = new ProductLaunchPresenter(getFormToolkit(), parent, productFile, bundle);
- GridData layoutData = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
- layoutData.widthHint = 200;
- p.getContainer().setLayoutData(layoutData);
- }
- }
- }
-
- }
-
- private class P_ProductResourceVisitor implements IResourceVisitor {
- private ArrayList<IFile> m_productFiels = new ArrayList<IFile>();
-
- @Override
- public boolean visit(IResource resource) throws CoreException {
- if (resource.getType() == IResource.FILE && resource.getName().matches(".*\\.product")) {
- m_productFiels.add((IFile) resource);
- }
- else if (resource.getType() == IResource.FOLDER) {
- return true;
- }
- return false;
- }
-
- private IFile[] getProductFiles() {
- return m_productFiels.toArray(new IFile[m_productFiels.size()]);
- }
- }
-
-}
+/*******************************************************************************
+ * 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.view.properties.part.singlepage;
+
+import java.util.ArrayList;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceVisitor;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.scout.sdk.RuntimeClasses;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.view.properties.part.ISection;
+import org.eclipse.scout.sdk.ui.view.properties.presenter.single.ProductLaunchPresenter;
+import org.eclipse.scout.sdk.util.SdkProperties;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * <h3>ServicePropertyPart</h3> ...
+ *
+ * @author Andreas Hoegger
+ * @since 1.0.8 22.07.2010
+ */
+public class ProductLaunchPropertyPart extends AbstractSinglePageSectionBasedViewPart {
+ private static final String SECTION_ID_LINKS = "section.links";
+
+ final IType basicPermission = TypeUtility.getType(RuntimeClasses.BasicPermission);
+ final IType iForm = TypeUtility.getType(RuntimeClasses.IForm);
+
+ public ProductLaunchPropertyPart() {
+ }
+
+ @Override
+ protected void createSections() {
+ // link area
+ ISection linkSection = createSection(SECTION_ID_LINKS, Texts.get("Links"));
+ fillLinkSection(linkSection.getSectionClient());
+ super.createSections();
+ }
+
+ protected void fillLinkSection(Composite parent) {
+ IScoutBundle bundle = (IScoutBundle) getPage().getScoutResource();
+ if (bundle != null) {
+ IResource resource = bundle.getProject().findMember(SdkProperties.PRODUCT_FOLDER);
+ if (resource != null && resource.exists() && resource.getType() == IResource.FOLDER) {
+ // spider products
+ IFolder productFolder = (IFolder) resource;
+ P_ProductResourceVisitor productVisitor = new P_ProductResourceVisitor();
+ try {
+ productFolder.accept(productVisitor);
+ }
+ catch (CoreException e) {
+ ScoutSdkUi.logError("error during visiting folder '" + productFolder.getFullPath() + "'.", e);
+ }
+ for (IFile productFile : productVisitor.getProductFiles()) {
+ ProductLaunchPresenter p = new ProductLaunchPresenter(getFormToolkit(), parent, productFile, bundle);
+ GridData layoutData = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
+ layoutData.widthHint = 200;
+ p.getContainer().setLayoutData(layoutData);
+ }
+ }
+ }
+
+ }
+
+ private class P_ProductResourceVisitor implements IResourceVisitor {
+ private ArrayList<IFile> m_productFiels = new ArrayList<IFile>();
+
+ @Override
+ public boolean visit(IResource resource) throws CoreException {
+ if (resource.getType() == IResource.FILE && resource.getName().matches(".*\\.product")) {
+ m_productFiels.add((IFile) resource);
+ }
+ else if (resource.getType() == IResource.FOLDER) {
+ return true;
+ }
+ return false;
+ }
+
+ private IFile[] getProductFiles() {
+ return m_productFiels.toArray(new IFile[m_productFiels.size()]);
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/singlepage/PropertyViewConfig.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/singlepage/PropertyViewConfig.java
index ad1ac2e01..9a20d38e3 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/singlepage/PropertyViewConfig.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/singlepage/PropertyViewConfig.java
@@ -1,261 +1,261 @@
-package org.eclipse.scout.sdk.ui.view.properties.part.singlepage;
-
-import java.io.InputStream;
-import java.net.URL;
-import java.util.HashMap;
-
-import org.eclipse.core.runtime.FileLocator;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument;
-import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument.ScoutXmlElement;
-import org.eclipse.scout.commons.xmlparser.ScoutXmlParser;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.workspace.type.config.ConfigurationMethod;
-
-public class PropertyViewConfig {
-
- private final static String TAG_TYPE = "type";
- private final static String TAG_CONFIG = "config";
- private final static String PROP_TYPE_NAME = "name";
- private final static String PROP_CONFIG_NAME = "name";
- private final static String PROP_CONFIG_TYPE = "type";
- private final static String PROP_CONFIG_CATEGORY = "category";
- private final static String PROP_CONFIG_ORDER = "order";
-
- private final HashMap<String, HashMap<String, Config>> m_typeConfigs;
-
- public final static ConfigTypes DEFAULT_CONFIG_TYPE = ConfigTypes.Advanced;
- public final static ConfigCategory DEFAULT_CONFIG_CATEGORY = ConfigCategory.Misc;
-
- /**
- * Method priority.
- */
- public enum ConfigTypes {
- /**
- * Important method. Shown by default.
- */
- Normal,
-
- /**
- * Advanced method. Collapsed by default.
- */
- Advanced
- }
-
- /**
- * Method cateogry. Defines to which category a method belongs.
- */
- public enum ConfigCategory {
- /**
- * Used for properties or operations that influence how the item looks like.<br>
- * Examples:<br>
- * Label text, icons, titles, colors, fonts, numeric fraction-digits, ...
- */
- Appearance(100 /* defines in which order the categories appear in a section */),
-
- /**
- * Used for properties that influence how the item is positioned.<br>
- * Examples:<br>
- * alignments, widths, heights, label-visibilities, positions (x,y), display view hints, ...
- */
- Layout(200),
-
- /**
- * Used for properties that influence how the item behaves at runtime.<br>
- * Examples:<br>
- * type of buttons, column displayable, editable, sortings, modality of dialogs, enabled, ...
- */
- Behavior(300),
-
- /**
- * Used for properties that influence how the item behaves at runtime.<br>
- * Examples:<br>
- * min/max values, lookup calls, code types, master fields, max lengths, most service properties, data filters, load
- * table data, ...
- */
- Data(400),
-
- /**
- * Used for most operations that have no influence on the appearance of an item.
- */
- BusinessLogic(500),
-
- /**
- * Undefined or various other operations and properties. Default for methods that have nothing configured.
- */
- Misc(Integer.MAX_VALUE);
-
- private final int m_order;
- private final String m_name;
-
- private ConfigCategory(int order) {
- m_order = order;
- m_name = Texts.get("PropertyViewConfig.Categories." + toString());
- }
-
- public int getOrder() {
- return m_order;
- }
-
- public String getLabel() {
- return m_name;
- }
- }
-
- /**
- * complete meta data for a {@link ConfigurationMethod}.
- */
- public static class Config {
- private ConfigTypes type;
- private ConfigCategory category;
- private Double order;
-
- /**
- * The order is defined by the {@link Order} annotation of the method in the Scout Runtime.<br>
- * It can be overridden by the xml configuration file using the optional "order" attribute on the "config" tag.
- *
- * @return Gets the order of the method inside a category.
- */
- public Double getOrder() {
- return order;
- }
-
- /**
- * If not defined in the config file, {@link PropertyViewConfig}<code>.DEFAULT_CONFIG_TYPE</code> is returned.
- *
- * @return gets the type of the method (normal or advanced)
- */
- public ConfigTypes getType() {
- return type;
- }
-
- /**
- * If not defined in the config file, {@link PropertyViewConfig}<code>.DEFAULT_CONFIG_CATEGORY</code> is returned.
- *
- * @return Gets the category the method belongs to.
- */
- public ConfigCategory getCategory() {
- return category;
- }
- }
-
- public PropertyViewConfig() {
- m_typeConfigs = new HashMap<String, HashMap<String, Config>>(100);
- load();
- }
-
- private void load() {
- try {
- URL url = FileLocator.find(ScoutSdkUi.getDefault().getBundle(), new Path("resources/sdkPropertyViewConfig.xml"), null);
- ScoutXmlParser parser = new ScoutXmlParser();
- InputStream is = null;
- try {
- is = url.openStream();
- ScoutXmlDocument xmlDoc = parser.parse(is);
- for (ScoutXmlElement o : xmlDoc.getRoot().getChildren(TAG_TYPE)) {
- loadType(o);
- }
- }
- finally {
- if (is != null) {
- try {
- is.close();
- }
- catch (Exception e) {
- }
- }
- }
- }
- catch (Exception e) {
- ScoutSdkUi.logError("unable to load property view configuration. ", e);
- }
- }
-
- /**
- * Gets the complete meta data for the given {@link ConfigurationMethod} as defined in the xml config file or null if
- * nothing is configured.
- *
- * @param m
- * @return
- */
- public Config getConfiguration(ConfigurationMethod m) {
- IType[] superTypes = m.getSuperTypeHierarchy().getAllSupertypes(m.getType());
- for (IType superType : superTypes) {
- HashMap<String, Config> tc = m_typeConfigs.get(superType.getFullyQualifiedName());
- if (tc != null) {
- Config c = tc.get(m.getMethodName());
- if (c != null) {
- return c;
- }
- }
- }
- return null;
- }
-
- private void loadType(ScoutXmlElement type) {
- if (type == null) return;
- String name = type.getAttribute(PROP_TYPE_NAME);
- if (name == null || name.trim().length() < 1) return;
-
- HashMap<String, Config> c = new HashMap<String, Config>(20);
- m_typeConfigs.put(name, c);
-
- for (ScoutXmlElement o : type.getChildren(TAG_CONFIG)) {
- loadConfig(c, o);
- }
- }
-
- private ConfigTypes parseConfigType(String type) {
- try {
- ConfigTypes ret = ConfigTypes.valueOf(type);
- if (ret == null) {
- ret = DEFAULT_CONFIG_TYPE;
- }
- return ret;
- }
- catch (Exception e) {
- return DEFAULT_CONFIG_TYPE;
- }
- }
-
- private ConfigCategory parseConfigCategory(String cat) {
- try {
- ConfigCategory ret = ConfigCategory.valueOf(cat);
- if (ret == null) {
- ret = DEFAULT_CONFIG_CATEGORY;
- }
- return ret;
- }
- catch (Exception e) {
- return DEFAULT_CONFIG_CATEGORY;
- }
- }
-
- private Double parseOrder(String order) {
- try {
- if (order == null || order.trim().length() < 1) return null;
- else return Double.parseDouble(order);
- }
- catch (Exception e) {
- return null;
- }
- }
-
- private void loadConfig(HashMap<String, Config> tc, ScoutXmlElement config) {
- if (config == null) return;
- String name = config.getAttribute(PROP_CONFIG_NAME);
- String type = config.getAttribute(PROP_CONFIG_TYPE, ConfigTypes.Advanced.toString());
- String category = config.getAttribute(PROP_CONFIG_CATEGORY, ConfigCategory.Misc.toString());
- String order = config.getAttribute(PROP_CONFIG_ORDER, null);
-
- Config c = new Config();
- c.category = parseConfigCategory(category);
- c.type = parseConfigType(type);
- c.order = parseOrder(order);
-
- tc.put(name, c);
- }
-}
+package org.eclipse.scout.sdk.ui.view.properties.part.singlepage;
+
+import java.io.InputStream;
+import java.net.URL;
+import java.util.HashMap;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument;
+import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument.ScoutXmlElement;
+import org.eclipse.scout.commons.xmlparser.ScoutXmlParser;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.workspace.type.config.ConfigurationMethod;
+
+public class PropertyViewConfig {
+
+ private final static String TAG_TYPE = "type";
+ private final static String TAG_CONFIG = "config";
+ private final static String PROP_TYPE_NAME = "name";
+ private final static String PROP_CONFIG_NAME = "name";
+ private final static String PROP_CONFIG_TYPE = "type";
+ private final static String PROP_CONFIG_CATEGORY = "category";
+ private final static String PROP_CONFIG_ORDER = "order";
+
+ private final HashMap<String, HashMap<String, Config>> m_typeConfigs;
+
+ public final static ConfigTypes DEFAULT_CONFIG_TYPE = ConfigTypes.Advanced;
+ public final static ConfigCategory DEFAULT_CONFIG_CATEGORY = ConfigCategory.Misc;
+
+ /**
+ * Method priority.
+ */
+ public enum ConfigTypes {
+ /**
+ * Important method. Shown by default.
+ */
+ Normal,
+
+ /**
+ * Advanced method. Collapsed by default.
+ */
+ Advanced
+ }
+
+ /**
+ * Method cateogry. Defines to which category a method belongs.
+ */
+ public enum ConfigCategory {
+ /**
+ * Used for properties or operations that influence how the item looks like.<br>
+ * Examples:<br>
+ * Label text, icons, titles, colors, fonts, numeric fraction-digits, ...
+ */
+ Appearance(100 /* defines in which order the categories appear in a section */),
+
+ /**
+ * Used for properties that influence how the item is positioned.<br>
+ * Examples:<br>
+ * alignments, widths, heights, label-visibilities, positions (x,y), display view hints, ...
+ */
+ Layout(200),
+
+ /**
+ * Used for properties that influence how the item behaves at runtime.<br>
+ * Examples:<br>
+ * type of buttons, column displayable, editable, sortings, modality of dialogs, enabled, ...
+ */
+ Behavior(300),
+
+ /**
+ * Used for properties that influence how the item behaves at runtime.<br>
+ * Examples:<br>
+ * min/max values, lookup calls, code types, master fields, max lengths, most service properties, data filters, load
+ * table data, ...
+ */
+ Data(400),
+
+ /**
+ * Used for most operations that have no influence on the appearance of an item.
+ */
+ BusinessLogic(500),
+
+ /**
+ * Undefined or various other operations and properties. Default for methods that have nothing configured.
+ */
+ Misc(Integer.MAX_VALUE);
+
+ private final int m_order;
+ private final String m_name;
+
+ private ConfigCategory(int order) {
+ m_order = order;
+ m_name = Texts.get("PropertyViewConfig.Categories." + toString());
+ }
+
+ public int getOrder() {
+ return m_order;
+ }
+
+ public String getLabel() {
+ return m_name;
+ }
+ }
+
+ /**
+ * complete meta data for a {@link ConfigurationMethod}.
+ */
+ public static class Config {
+ private ConfigTypes type;
+ private ConfigCategory category;
+ private Double order;
+
+ /**
+ * The order is defined by the {@link Order} annotation of the method in the Scout Runtime.<br>
+ * It can be overridden by the xml configuration file using the optional "order" attribute on the "config" tag.
+ *
+ * @return Gets the order of the method inside a category.
+ */
+ public Double getOrder() {
+ return order;
+ }
+
+ /**
+ * If not defined in the config file, {@link PropertyViewConfig}<code>.DEFAULT_CONFIG_TYPE</code> is returned.
+ *
+ * @return gets the type of the method (normal or advanced)
+ */
+ public ConfigTypes getType() {
+ return type;
+ }
+
+ /**
+ * If not defined in the config file, {@link PropertyViewConfig}<code>.DEFAULT_CONFIG_CATEGORY</code> is returned.
+ *
+ * @return Gets the category the method belongs to.
+ */
+ public ConfigCategory getCategory() {
+ return category;
+ }
+ }
+
+ public PropertyViewConfig() {
+ m_typeConfigs = new HashMap<String, HashMap<String, Config>>(100);
+ load();
+ }
+
+ private void load() {
+ try {
+ URL url = FileLocator.find(ScoutSdkUi.getDefault().getBundle(), new Path("resources/sdkPropertyViewConfig.xml"), null);
+ ScoutXmlParser parser = new ScoutXmlParser();
+ InputStream is = null;
+ try {
+ is = url.openStream();
+ ScoutXmlDocument xmlDoc = parser.parse(is);
+ for (ScoutXmlElement o : xmlDoc.getRoot().getChildren(TAG_TYPE)) {
+ loadType(o);
+ }
+ }
+ finally {
+ if (is != null) {
+ try {
+ is.close();
+ }
+ catch (Exception e) {
+ }
+ }
+ }
+ }
+ catch (Exception e) {
+ ScoutSdkUi.logError("unable to load property view configuration. ", e);
+ }
+ }
+
+ /**
+ * Gets the complete meta data for the given {@link ConfigurationMethod} as defined in the xml config file or null if
+ * nothing is configured.
+ *
+ * @param m
+ * @return
+ */
+ public Config getConfiguration(ConfigurationMethod m) {
+ IType[] superTypes = m.getSuperTypeHierarchy().getAllSupertypes(m.getType());
+ for (IType superType : superTypes) {
+ HashMap<String, Config> tc = m_typeConfigs.get(superType.getFullyQualifiedName());
+ if (tc != null) {
+ Config c = tc.get(m.getMethodName());
+ if (c != null) {
+ return c;
+ }
+ }
+ }
+ return null;
+ }
+
+ private void loadType(ScoutXmlElement type) {
+ if (type == null) return;
+ String name = type.getAttribute(PROP_TYPE_NAME);
+ if (name == null || name.trim().length() < 1) return;
+
+ HashMap<String, Config> c = new HashMap<String, Config>(20);
+ m_typeConfigs.put(name, c);
+
+ for (ScoutXmlElement o : type.getChildren(TAG_CONFIG)) {
+ loadConfig(c, o);
+ }
+ }
+
+ private ConfigTypes parseConfigType(String type) {
+ try {
+ ConfigTypes ret = ConfigTypes.valueOf(type);
+ if (ret == null) {
+ ret = DEFAULT_CONFIG_TYPE;
+ }
+ return ret;
+ }
+ catch (Exception e) {
+ return DEFAULT_CONFIG_TYPE;
+ }
+ }
+
+ private ConfigCategory parseConfigCategory(String cat) {
+ try {
+ ConfigCategory ret = ConfigCategory.valueOf(cat);
+ if (ret == null) {
+ ret = DEFAULT_CONFIG_CATEGORY;
+ }
+ return ret;
+ }
+ catch (Exception e) {
+ return DEFAULT_CONFIG_CATEGORY;
+ }
+ }
+
+ private Double parseOrder(String order) {
+ try {
+ if (order == null || order.trim().length() < 1) return null;
+ else return Double.parseDouble(order);
+ }
+ catch (Exception e) {
+ return null;
+ }
+ }
+
+ private void loadConfig(HashMap<String, Config> tc, ScoutXmlElement config) {
+ if (config == null) return;
+ String name = config.getAttribute(PROP_CONFIG_NAME);
+ String type = config.getAttribute(PROP_CONFIG_TYPE, ConfigTypes.Advanced.toString());
+ String category = config.getAttribute(PROP_CONFIG_CATEGORY, ConfigCategory.Misc.toString());
+ String order = config.getAttribute(PROP_CONFIG_ORDER, null);
+
+ Config c = new Config();
+ c.category = parseConfigCategory(category);
+ c.type = parseConfigType(type);
+ c.order = parseOrder(order);
+
+ tc.put(name, c);
+ }
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/singlepage/ScoutProjectPropertyPart.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/singlepage/ScoutProjectPropertyPart.java
index f78858e4c..0c1f7f8e6 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/singlepage/ScoutProjectPropertyPart.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/singlepage/ScoutProjectPropertyPart.java
@@ -1,225 +1,225 @@
-/*******************************************************************************
- * 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.view.properties.part.singlepage;
-
-import java.util.ArrayList;
-import java.util.Map.Entry;
-import java.util.TreeMap;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.ToolBarManager;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.ProgressIndicator;
-import org.eclipse.scout.commons.CompositeObject;
-import org.eclipse.scout.sdk.ScoutSdkCore;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.ui.dialog.ProductSelectionDialog;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.PageFilterPresenter;
-import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.single.ProjectVersionPresenter;
-import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.single.TechnologyPresenter;
-import org.eclipse.scout.sdk.ui.view.properties.part.ISection;
-import org.eclipse.scout.sdk.ui.view.properties.part.Section;
-import org.eclipse.scout.sdk.ui.view.properties.presenter.single.ProductLaunchPresenter;
-import org.eclipse.scout.sdk.util.SdkProperties;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.workspace.IScoutProject;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Cursor;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.ToolBar;
-import org.eclipse.ui.IMemento;
-
-/**
- * <h3>{@link ScoutProjectPropertyPart}</h3> ...
- *
- * @author Andreas Hoegger
- * @since 1.0.8 09.09.2010
- */
-public class ScoutProjectPropertyPart extends AbstractSinglePageSectionBasedViewPart {
-
- private static final String SECTION_ID_FILTER = "section.filter";
- private static final String SECTION_ID_PRODUCT_LAUNCHER = "section.productLauncher";
- private static final String SECTION_ID_VERSION = "section.version";
- private static final String SECTION_ID_TECHNOLOGY = "section.technology";
-
- private ArrayList<ProductLaunchPresenter> m_launchPresenters = new ArrayList<ProductLaunchPresenter>();
-
- @Override
- protected void createSections() {
- // filter
- ISection filterSection = createSection(SECTION_ID_FILTER, Texts.get("Filter"));
- PageFilterPresenter filterPresenter = new PageFilterPresenter(getFormToolkit(), filterSection.getSectionClient(), getPage());
- GridData layoutData = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
- layoutData.widthHint = 200;
- filterPresenter.getContainer().setLayoutData(layoutData);
- filterSection.setExpanded(wasSectionExpanded(SECTION_ID_FILTER, false));
-
- // version
- ISection versionSection = createSection(SECTION_ID_VERSION, Texts.get("ProjectVersion"));
- ProjectVersionPresenter versionPresenter = new ProjectVersionPresenter(getFormToolkit(), versionSection.getSectionClient(), getScoutProject());
- GridData versionLayoutData = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
- versionLayoutData.widthHint = 200;
- versionPresenter.getContainer().setLayoutData(versionLayoutData);
- versionSection.setExpanded(wasSectionExpanded(SECTION_ID_VERSION, true));
-
- // product launchers
- Section linkSection = (Section) createSection(SECTION_ID_PRODUCT_LAUNCHER, Texts.get("ProductLauncher"));
- ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
- ToolBar toolbar = toolBarManager.createControl(linkSection.getUiSection());
- final Cursor handCursor = new Cursor(Display.getCurrent(), SWT.CURSOR_HAND);
- toolbar.setCursor(handCursor);
- Action action = new Action() {
- @Override
- public void run() {
- ArrayList<IFile> productFiles = new ArrayList<IFile>();
- for (ProductLaunchPresenter p : m_launchPresenters) {
- productFiles.add(p.getProductFile());
- }
- ProductSelectionDialog dialog = new ProductSelectionDialog(getForm().getShell(), getScoutProject());
- dialog.setCheckedProductFiles(productFiles.toArray(new IFile[productFiles.size()]));
- if (dialog.open() == Dialog.OK) {
- refreshProductLaunchPresenters(dialog.getCheckedProductFiles());
- }
- }
- };
- action.setImageDescriptor(ScoutSdkUi.getImageDescriptor(ScoutSdkUi.ToolEdit));
- action.setToolTipText(Texts.get("EditContent"));
- toolBarManager.add(action);
- toolBarManager.update(true);
- linkSection.getUiSection().setTextClient(toolbar);
- linkSection.setExpanded(wasSectionExpanded(SECTION_ID_PRODUCT_LAUNCHER, true));
-
- // technologies
- Section techSection = (Section) createSection(SECTION_ID_TECHNOLOGY, Texts.get("Technologies"));
- final TechnologyPresenter techPresenter = new TechnologyPresenter(getFormToolkit(), techSection.getSectionClient(), getScoutProject());
- GridData techLayoutData = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
- techLayoutData.widthHint = 200;
- techPresenter.getContainer().setLayoutData(techLayoutData);
-
- // load technologies lazy
- final ProgressIndicator indicator = new ProgressIndicator(techPresenter.getContainer(), SWT.INDETERMINATE | SWT.SMOOTH);
- indicator.beginAnimatedTask();
- GridData indicatorData = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
- indicatorData.horizontalSpan = 2;
- indicatorData.heightHint = 5;
- indicator.setLayoutData(indicatorData);
- Job j = new Job("load technologies...") {
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- if (techPresenter != null && !techPresenter.isDisposed()) {
- try {
- techPresenter.loadModel();
- }
- finally {
- if (techPresenter.getContainer() != null && !techPresenter.getContainer().isDisposed()) {
- techPresenter.getContainer().getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- if (techPresenter != null && !techPresenter.isDisposed()) {
- techPresenter.createContent();
- indicator.dispose();
- getForm().layout(true, true);
- getForm().updateToolBar();
- getForm().reflow(true);
- }
- }
- });
- }
- }
- }
- return Status.OK_STATUS;
- }
- };
- j.setSystem(true);
- j.schedule();
- techSection.setExpanded(wasSectionExpanded(SECTION_ID_TECHNOLOGY, true));
- }
-
- protected IScoutProject getScoutProject() {
- return (IScoutProject) getPage().getScoutResource();
- }
-
- private void refreshProductLaunchPresenters(IFile[] productFiles) {
- ISection section = getSection(SECTION_ID_PRODUCT_LAUNCHER);
- for (ProductLaunchPresenter p : m_launchPresenters) {
- p.dispose();
- }
- m_launchPresenters.clear();
- Composite sectionClient = section.getSectionClient();
- TreeMap<CompositeObject, P_ProductFile> orderedProducts = new TreeMap<CompositeObject, P_ProductFile>();
- for (IFile productFile : productFiles) {
- if (productFile != null && productFile.exists()) {
- IScoutBundle scoutBundle = ScoutSdkCore.getScoutWorkspace().getScoutBundle(productFile.getProject());
- int productType = -1;
- if (scoutBundle != null) {
- productType = scoutBundle.getType();
- }
- orderedProducts.put(new CompositeObject(-productType, productFile.getName(), productFile), new P_ProductFile(productFile, scoutBundle));
- }
- }
- for (Entry<CompositeObject, P_ProductFile> entry : orderedProducts.entrySet()) {
- P_ProductFile productFile = entry.getValue();
- ProductLaunchPresenter presenter = new ProductLaunchPresenter(getFormToolkit(), sectionClient, productFile.getFile(), productFile.getBundle());
- GridData layoutData = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
- layoutData.widthHint = 200;
- presenter.getContainer().setLayoutData(layoutData);
- m_launchPresenters.add(presenter);
- }
- getForm().layout(true, true);
- getForm().reflow(true);
- }
-
- @Override
- public void init(IMemento memento) {
- refreshProductLaunchPresenters(SdkProperties.getProjectProductLaunchers(getScoutProject().getProjectName()));
- }
-
- @Override
- public void save(IMemento memento) {
- IFile[] files = new IFile[m_launchPresenters.size()];
- for (int i = 0; i < files.length; i++) {
- files[i] = m_launchPresenters.get(i).getProductFile();
- }
- SdkProperties.saveProjectProductLaunchers(getScoutProject().getProjectName(), files);
- }
-
- private class P_ProductFile {
- private final IScoutBundle m_bundle;
- private final IFile m_file;
-
- public P_ProductFile(IFile file, IScoutBundle bundle) {
- m_file = file;
- m_bundle = bundle;
- }
-
- /**
- * @return the bundleType
- */
- public IScoutBundle getBundle() {
- return m_bundle;
- }
-
- /**
- * @return the file
- */
- public IFile getFile() {
- return m_file;
- }
- }
-}
+/*******************************************************************************
+ * 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.view.properties.part.singlepage;
+
+import java.util.ArrayList;
+import java.util.Map.Entry;
+import java.util.TreeMap;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.ToolBarManager;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.ProgressIndicator;
+import org.eclipse.scout.commons.CompositeObject;
+import org.eclipse.scout.sdk.ScoutSdkCore;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.ui.dialog.ProductSelectionDialog;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.PageFilterPresenter;
+import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.single.ProjectVersionPresenter;
+import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.single.TechnologyPresenter;
+import org.eclipse.scout.sdk.ui.view.properties.part.ISection;
+import org.eclipse.scout.sdk.ui.view.properties.part.Section;
+import org.eclipse.scout.sdk.ui.view.properties.presenter.single.ProductLaunchPresenter;
+import org.eclipse.scout.sdk.util.SdkProperties;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.workspace.IScoutProject;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Cursor;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.ui.IMemento;
+
+/**
+ * <h3>{@link ScoutProjectPropertyPart}</h3> ...
+ *
+ * @author Andreas Hoegger
+ * @since 1.0.8 09.09.2010
+ */
+public class ScoutProjectPropertyPart extends AbstractSinglePageSectionBasedViewPart {
+
+ private static final String SECTION_ID_FILTER = "section.filter";
+ private static final String SECTION_ID_PRODUCT_LAUNCHER = "section.productLauncher";
+ private static final String SECTION_ID_VERSION = "section.version";
+ private static final String SECTION_ID_TECHNOLOGY = "section.technology";
+
+ private ArrayList<ProductLaunchPresenter> m_launchPresenters = new ArrayList<ProductLaunchPresenter>();
+
+ @Override
+ protected void createSections() {
+ // filter
+ ISection filterSection = createSection(SECTION_ID_FILTER, Texts.get("Filter"));
+ PageFilterPresenter filterPresenter = new PageFilterPresenter(getFormToolkit(), filterSection.getSectionClient(), getPage());
+ GridData layoutData = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
+ layoutData.widthHint = 200;
+ filterPresenter.getContainer().setLayoutData(layoutData);
+ filterSection.setExpanded(wasSectionExpanded(SECTION_ID_FILTER, false));
+
+ // version
+ ISection versionSection = createSection(SECTION_ID_VERSION, Texts.get("ProjectVersion"));
+ ProjectVersionPresenter versionPresenter = new ProjectVersionPresenter(getFormToolkit(), versionSection.getSectionClient(), getScoutProject());
+ GridData versionLayoutData = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
+ versionLayoutData.widthHint = 200;
+ versionPresenter.getContainer().setLayoutData(versionLayoutData);
+ versionSection.setExpanded(wasSectionExpanded(SECTION_ID_VERSION, true));
+
+ // product launchers
+ Section linkSection = (Section) createSection(SECTION_ID_PRODUCT_LAUNCHER, Texts.get("ProductLauncher"));
+ ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
+ ToolBar toolbar = toolBarManager.createControl(linkSection.getUiSection());
+ final Cursor handCursor = new Cursor(Display.getCurrent(), SWT.CURSOR_HAND);
+ toolbar.setCursor(handCursor);
+ Action action = new Action() {
+ @Override
+ public void run() {
+ ArrayList<IFile> productFiles = new ArrayList<IFile>();
+ for (ProductLaunchPresenter p : m_launchPresenters) {
+ productFiles.add(p.getProductFile());
+ }
+ ProductSelectionDialog dialog = new ProductSelectionDialog(getForm().getShell(), getScoutProject());
+ dialog.setCheckedProductFiles(productFiles.toArray(new IFile[productFiles.size()]));
+ if (dialog.open() == Dialog.OK) {
+ refreshProductLaunchPresenters(dialog.getCheckedProductFiles());
+ }
+ }
+ };
+ action.setImageDescriptor(ScoutSdkUi.getImageDescriptor(ScoutSdkUi.ToolEdit));
+ action.setToolTipText(Texts.get("EditContent"));
+ toolBarManager.add(action);
+ toolBarManager.update(true);
+ linkSection.getUiSection().setTextClient(toolbar);
+ linkSection.setExpanded(wasSectionExpanded(SECTION_ID_PRODUCT_LAUNCHER, true));
+
+ // technologies
+ Section techSection = (Section) createSection(SECTION_ID_TECHNOLOGY, Texts.get("Technologies"));
+ final TechnologyPresenter techPresenter = new TechnologyPresenter(getFormToolkit(), techSection.getSectionClient(), getScoutProject());
+ GridData techLayoutData = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
+ techLayoutData.widthHint = 200;
+ techPresenter.getContainer().setLayoutData(techLayoutData);
+
+ // load technologies lazy
+ final ProgressIndicator indicator = new ProgressIndicator(techPresenter.getContainer(), SWT.INDETERMINATE | SWT.SMOOTH);
+ indicator.beginAnimatedTask();
+ GridData indicatorData = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
+ indicatorData.horizontalSpan = 2;
+ indicatorData.heightHint = 5;
+ indicator.setLayoutData(indicatorData);
+ Job j = new Job("load technologies...") {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ if (techPresenter != null && !techPresenter.isDisposed()) {
+ try {
+ techPresenter.loadModel();
+ }
+ finally {
+ if (techPresenter.getContainer() != null && !techPresenter.getContainer().isDisposed()) {
+ techPresenter.getContainer().getDisplay().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ if (techPresenter != null && !techPresenter.isDisposed()) {
+ techPresenter.createContent();
+ indicator.dispose();
+ getForm().layout(true, true);
+ getForm().updateToolBar();
+ getForm().reflow(true);
+ }
+ }
+ });
+ }
+ }
+ }
+ return Status.OK_STATUS;
+ }
+ };
+ j.setSystem(true);
+ j.schedule();
+ techSection.setExpanded(wasSectionExpanded(SECTION_ID_TECHNOLOGY, true));
+ }
+
+ protected IScoutProject getScoutProject() {
+ return (IScoutProject) getPage().getScoutResource();
+ }
+
+ private void refreshProductLaunchPresenters(IFile[] productFiles) {
+ ISection section = getSection(SECTION_ID_PRODUCT_LAUNCHER);
+ for (ProductLaunchPresenter p : m_launchPresenters) {
+ p.dispose();
+ }
+ m_launchPresenters.clear();
+ Composite sectionClient = section.getSectionClient();
+ TreeMap<CompositeObject, P_ProductFile> orderedProducts = new TreeMap<CompositeObject, P_ProductFile>();
+ for (IFile productFile : productFiles) {
+ if (productFile != null && productFile.exists()) {
+ IScoutBundle scoutBundle = ScoutSdkCore.getScoutWorkspace().getScoutBundle(productFile.getProject());
+ int productType = -1;
+ if (scoutBundle != null) {
+ productType = scoutBundle.getType();
+ }
+ orderedProducts.put(new CompositeObject(-productType, productFile.getName(), productFile), new P_ProductFile(productFile, scoutBundle));
+ }
+ }
+ for (Entry<CompositeObject, P_ProductFile> entry : orderedProducts.entrySet()) {
+ P_ProductFile productFile = entry.getValue();
+ ProductLaunchPresenter presenter = new ProductLaunchPresenter(getFormToolkit(), sectionClient, productFile.getFile(), productFile.getBundle());
+ GridData layoutData = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
+ layoutData.widthHint = 200;
+ presenter.getContainer().setLayoutData(layoutData);
+ m_launchPresenters.add(presenter);
+ }
+ getForm().layout(true, true);
+ getForm().reflow(true);
+ }
+
+ @Override
+ public void init(IMemento memento) {
+ refreshProductLaunchPresenters(SdkProperties.getProjectProductLaunchers(getScoutProject().getProjectName()));
+ }
+
+ @Override
+ public void save(IMemento memento) {
+ IFile[] files = new IFile[m_launchPresenters.size()];
+ for (int i = 0; i < files.length; i++) {
+ files[i] = m_launchPresenters.get(i).getProductFile();
+ }
+ SdkProperties.saveProjectProductLaunchers(getScoutProject().getProjectName(), files);
+ }
+
+ private class P_ProductFile {
+ private final IScoutBundle m_bundle;
+ private final IFile m_file;
+
+ public P_ProductFile(IFile file, IScoutBundle bundle) {
+ m_file = file;
+ m_bundle = bundle;
+ }
+
+ /**
+ * @return the bundleType
+ */
+ public IScoutBundle getBundle() {
+ return m_bundle;
+ }
+
+ /**
+ * @return the file
+ */
+ public IFile getFile() {
+ return m_file;
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/singlepage/ServicePropertyPart.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/singlepage/ServicePropertyPart.java
index af865828b..aecbbaa52 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/singlepage/ServicePropertyPart.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/singlepage/ServicePropertyPart.java
@@ -1,131 +1,131 @@
-/*******************************************************************************
- * 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.view.properties.part.singlepage;
-
-import org.eclipse.jdt.core.IType;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.sdk.RuntimeClasses;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.ui.internal.view.properties.model.links.LinkGroup;
-import org.eclipse.scout.sdk.ui.internal.view.properties.model.links.LinksPresenterModel;
-import org.eclipse.scout.sdk.ui.internal.view.properties.model.links.TypeOpenLink;
-import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.LinksPresenter;
-import org.eclipse.scout.sdk.ui.view.outline.pages.project.server.service.AbstractServiceNodePage;
-import org.eclipse.scout.sdk.ui.view.properties.part.ISection;
-import org.eclipse.scout.sdk.util.SdkProperties;
-import org.eclipse.scout.sdk.util.type.ITypeFilter;
-import org.eclipse.scout.sdk.util.type.TypeComparators;
-import org.eclipse.scout.sdk.util.type.TypeFilters;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.workspace.type.ScoutTypeFilters;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * <h3>ServicePropertyPart</h3> ...
- *
- * @author Andreas Hoegger
- * @since 1.0.8 22.07.2010
- */
-public class ServicePropertyPart extends JdtTypePropertyPart {
- private static final String SECTION_ID_LINKS = "section.links";
-
- final IType basicPermission = TypeUtility.getType(RuntimeClasses.BasicPermission);
- final IType iForm = TypeUtility.getType(RuntimeClasses.IForm);
-
- @Override
- protected void createSections() {
- // link area
- ISection linkSection = createSection(SECTION_ID_LINKS, Texts.get("Links"));
- fillLinkSection(linkSection.getSectionClient());
- linkSection.setExpanded(wasSectionExpanded(SECTION_ID_LINKS, true));
- super.createSections();
- }
-
- @Override
- public AbstractServiceNodePage getPage() {
- return (AbstractServiceNodePage) super.getPage();
- }
-
- protected void fillLinkSection(Composite parent) {
- String entityName = null;
- // model
- LinksPresenterModel model = new LinksPresenterModel();
- if (getPage().getInterfaceType() != null) {
- model.addGlobalLink(new TypeOpenLink(getPage().getInterfaceType()));
- }
- if (getPage().getType() != null) {
- model.addGlobalLink(new TypeOpenLink(getPage().getType()));
- entityName = findEntityName(getPage().getType().getElementName());
- }
- if (!StringUtility.isNullOrEmpty(entityName)) {
- // form
- if (TypeUtility.exists(iForm)) /* can be null on a server-only-project (bugzilla ticket 325428) */{
- String formRegex = entityName + SdkProperties.SUFFIX_FORM;
- ITypeFilter formFilter = TypeFilters.getMultiTypeFilter(
- TypeFilters.getRegexSimpleNameFilter(formRegex),
- TypeFilters.getClassFilter(),
- ScoutTypeFilters.getInScoutProject(getPage().getScoutResource().getScoutProject())
- );
- LinkGroup formGroup = model.getOrCreateGroup(Texts.get("Form"), 10);
- for (IType candidate : TypeUtility.getPrimaryTypeHierarchy(iForm).getAllSubtypes(iForm, formFilter, TypeComparators.getTypeNameComparator())) {
- formGroup.addLink(new TypeOpenLink(candidate));
- }
- }
- // permissions
- String permissionRegex = "(Create|Read|Update)" + entityName + SdkProperties.SUFFIX_PERMISSION;
- ITypeFilter filter = TypeFilters.getMultiTypeFilter(
- TypeFilters.getRegexSimpleNameFilter(permissionRegex),
- TypeFilters.getClassFilter(),
- ScoutTypeFilters.getInScoutProject(getPage().getScoutResource().getScoutProject())
- );
- LinkGroup permissionGroup = model.getOrCreateGroup(Texts.get("PermissionTablePage"), 20);
- for (IType candidate : TypeUtility.getPrimaryTypeHierarchy(basicPermission).getAllSubtypes(basicPermission, filter, TypeComparators.getTypeNameComparator())) {
- permissionGroup.addLink(new TypeOpenLink(candidate));
- }
-
- }
-
- // ui
- LinksPresenter presenter = new LinksPresenter(getFormToolkit(), parent, model);
- GridData layoutData = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
- layoutData.widthHint = 200;
- presenter.getContainer().setLayoutData(layoutData);
- }
-
- private String findEntityName(String serviceName) {
- if (StringUtility.isNullOrEmpty(serviceName)) {
- return serviceName;
- }
- if (serviceName.endsWith(SdkProperties.SUFFIX_PROCESS_SERVICE)) {
- return serviceName.replaceAll("^(.*)" + SdkProperties.SUFFIX_PROCESS_SERVICE + "$", "$1");
- }
- if (serviceName.endsWith(SdkProperties.SUFFIX_OUTLINE_SERVICE)) {
- return serviceName.replaceAll("^(.*)" + SdkProperties.SUFFIX_OUTLINE_SERVICE + "$", "$1");
- }
- if (serviceName.endsWith(SdkProperties.SUFFIX_CUSTOM_SERVICE)) {
- return serviceName.replaceAll("^(.*)" + SdkProperties.SUFFIX_CUSTOM_SERVICE + "$", "$1");
- }
- if (serviceName.endsWith(SdkProperties.SUFFIX_CALENDAR_SERVICE)) {
- return serviceName.replaceAll("^(.*)" + SdkProperties.SUFFIX_CALENDAR_SERVICE + "$", "$1");
- }
- if (serviceName.endsWith(SdkProperties.SUFFIX_SMTP_SERVICE)) {
- return serviceName.replaceAll("^(.*)" + SdkProperties.SUFFIX_SMTP_SERVICE + "$", "$1");
- }
- if (serviceName.endsWith(SdkProperties.SUFFIX_SQL_SERVICE)) {
- return serviceName.replaceAll("^(.*)" + SdkProperties.SUFFIX_SQL_SERVICE + "$", "$1");
- }
- if (serviceName.endsWith(SdkProperties.SUFFIX_SERVICE)) {
- return serviceName.replaceAll("^(.*)" + SdkProperties.SUFFIX_SERVICE + "$", "$1");
- }
- return serviceName;
- }
-}
+/*******************************************************************************
+ * 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.view.properties.part.singlepage;
+
+import org.eclipse.jdt.core.IType;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.sdk.RuntimeClasses;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.ui.internal.view.properties.model.links.LinkGroup;
+import org.eclipse.scout.sdk.ui.internal.view.properties.model.links.LinksPresenterModel;
+import org.eclipse.scout.sdk.ui.internal.view.properties.model.links.TypeOpenLink;
+import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.LinksPresenter;
+import org.eclipse.scout.sdk.ui.view.outline.pages.project.server.service.AbstractServiceNodePage;
+import org.eclipse.scout.sdk.ui.view.properties.part.ISection;
+import org.eclipse.scout.sdk.util.SdkProperties;
+import org.eclipse.scout.sdk.util.type.ITypeFilter;
+import org.eclipse.scout.sdk.util.type.TypeComparators;
+import org.eclipse.scout.sdk.util.type.TypeFilters;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.workspace.type.ScoutTypeFilters;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * <h3>ServicePropertyPart</h3> ...
+ *
+ * @author Andreas Hoegger
+ * @since 1.0.8 22.07.2010
+ */
+public class ServicePropertyPart extends JdtTypePropertyPart {
+ private static final String SECTION_ID_LINKS = "section.links";
+
+ final IType basicPermission = TypeUtility.getType(RuntimeClasses.BasicPermission);
+ final IType iForm = TypeUtility.getType(RuntimeClasses.IForm);
+
+ @Override
+ protected void createSections() {
+ // link area
+ ISection linkSection = createSection(SECTION_ID_LINKS, Texts.get("Links"));
+ fillLinkSection(linkSection.getSectionClient());
+ linkSection.setExpanded(wasSectionExpanded(SECTION_ID_LINKS, true));
+ super.createSections();
+ }
+
+ @Override
+ public AbstractServiceNodePage getPage() {
+ return (AbstractServiceNodePage) super.getPage();
+ }
+
+ protected void fillLinkSection(Composite parent) {
+ String entityName = null;
+ // model
+ LinksPresenterModel model = new LinksPresenterModel();
+ if (getPage().getInterfaceType() != null) {
+ model.addGlobalLink(new TypeOpenLink(getPage().getInterfaceType()));
+ }
+ if (getPage().getType() != null) {
+ model.addGlobalLink(new TypeOpenLink(getPage().getType()));
+ entityName = findEntityName(getPage().getType().getElementName());
+ }
+ if (!StringUtility.isNullOrEmpty(entityName)) {
+ // form
+ if (TypeUtility.exists(iForm)) /* can be null on a server-only-project (bugzilla ticket 325428) */{
+ String formRegex = entityName + SdkProperties.SUFFIX_FORM;
+ ITypeFilter formFilter = TypeFilters.getMultiTypeFilter(
+ TypeFilters.getRegexSimpleNameFilter(formRegex),
+ TypeFilters.getClassFilter(),
+ ScoutTypeFilters.getInScoutProject(getPage().getScoutResource().getScoutProject())
+ );
+ LinkGroup formGroup = model.getOrCreateGroup(Texts.get("Form"), 10);
+ for (IType candidate : TypeUtility.getPrimaryTypeHierarchy(iForm).getAllSubtypes(iForm, formFilter, TypeComparators.getTypeNameComparator())) {
+ formGroup.addLink(new TypeOpenLink(candidate));
+ }
+ }
+ // permissions
+ String permissionRegex = "(Create|Read|Update)" + entityName + SdkProperties.SUFFIX_PERMISSION;
+ ITypeFilter filter = TypeFilters.getMultiTypeFilter(
+ TypeFilters.getRegexSimpleNameFilter(permissionRegex),
+ TypeFilters.getClassFilter(),
+ ScoutTypeFilters.getInScoutProject(getPage().getScoutResource().getScoutProject())
+ );
+ LinkGroup permissionGroup = model.getOrCreateGroup(Texts.get("PermissionTablePage"), 20);
+ for (IType candidate : TypeUtility.getPrimaryTypeHierarchy(basicPermission).getAllSubtypes(basicPermission, filter, TypeComparators.getTypeNameComparator())) {
+ permissionGroup.addLink(new TypeOpenLink(candidate));
+ }
+
+ }
+
+ // ui
+ LinksPresenter presenter = new LinksPresenter(getFormToolkit(), parent, model);
+ GridData layoutData = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
+ layoutData.widthHint = 200;
+ presenter.getContainer().setLayoutData(layoutData);
+ }
+
+ private String findEntityName(String serviceName) {
+ if (StringUtility.isNullOrEmpty(serviceName)) {
+ return serviceName;
+ }
+ if (serviceName.endsWith(SdkProperties.SUFFIX_PROCESS_SERVICE)) {
+ return serviceName.replaceAll("^(.*)" + SdkProperties.SUFFIX_PROCESS_SERVICE + "$", "$1");
+ }
+ if (serviceName.endsWith(SdkProperties.SUFFIX_OUTLINE_SERVICE)) {
+ return serviceName.replaceAll("^(.*)" + SdkProperties.SUFFIX_OUTLINE_SERVICE + "$", "$1");
+ }
+ if (serviceName.endsWith(SdkProperties.SUFFIX_CUSTOM_SERVICE)) {
+ return serviceName.replaceAll("^(.*)" + SdkProperties.SUFFIX_CUSTOM_SERVICE + "$", "$1");
+ }
+ if (serviceName.endsWith(SdkProperties.SUFFIX_CALENDAR_SERVICE)) {
+ return serviceName.replaceAll("^(.*)" + SdkProperties.SUFFIX_CALENDAR_SERVICE + "$", "$1");
+ }
+ if (serviceName.endsWith(SdkProperties.SUFFIX_SMTP_SERVICE)) {
+ return serviceName.replaceAll("^(.*)" + SdkProperties.SUFFIX_SMTP_SERVICE + "$", "$1");
+ }
+ if (serviceName.endsWith(SdkProperties.SUFFIX_SQL_SERVICE)) {
+ return serviceName.replaceAll("^(.*)" + SdkProperties.SUFFIX_SQL_SERVICE + "$", "$1");
+ }
+ if (serviceName.endsWith(SdkProperties.SUFFIX_SERVICE)) {
+ return serviceName.replaceAll("^(.*)" + SdkProperties.SUFFIX_SERVICE + "$", "$1");
+ }
+ return serviceName;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/singlepage/UnknownSinglePagePropertyViewPart.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/singlepage/UnknownSinglePagePropertyViewPart.java
index ce3b73241..fcf7f7afc 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/singlepage/UnknownSinglePagePropertyViewPart.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/part/singlepage/UnknownSinglePagePropertyViewPart.java
@@ -1,59 +1,59 @@
-/*******************************************************************************
- * 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.view.properties.part.singlepage;
-
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.PageFilterPresenter;
-import org.eclipse.scout.sdk.ui.view.properties.part.ISection;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-
-/**
- * <h3>UnknownPropertyViewPart</h3> ...
- *
- * @author Andreas Hoegger
- * @since 1.0.8 21.07.2010
- */
-public class UnknownSinglePagePropertyViewPart extends AbstractSinglePageSectionBasedViewPart {
- private static final String SECTION_ID_FILTER = "section.filter";
-
- @Override
- protected Control createHead(Composite parent) {
- Composite headArea = getFormToolkit().createComposite(parent);
- String titleText = Texts.get("NoPropertiesAvailable");
- if (getPage() != null) {
- titleText = Texts.get("NoPropertiesAvailableForX", getPage().getName());
- }
- Label title = getFormToolkit().createLabel(headArea, titleText, SWT.WRAP | SWT.READ_ONLY);
- // layout
- headArea.setLayout(new GridLayout(1, true));
- GridData titleData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL);
- titleData.widthHint = 100;
- title.setLayoutData(titleData);
- return headArea;
- }
-
- @Override
- protected void createSections() {
- if (getPage() != null && getPage().isFolder()) {
- ISection filterSection = createSection(SECTION_ID_FILTER, Texts.get("Filter"));
- PageFilterPresenter filterPresenter = new PageFilterPresenter(getFormToolkit(), filterSection.getSectionClient(), getPage());
- GridData layoutData = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
- layoutData.widthHint = 200;
- filterPresenter.getContainer().setLayoutData(layoutData);
- }
- super.createSections();
- }
-}
+/*******************************************************************************
+ * 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.view.properties.part.singlepage;
+
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.PageFilterPresenter;
+import org.eclipse.scout.sdk.ui.view.properties.part.ISection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+
+/**
+ * <h3>UnknownPropertyViewPart</h3> ...
+ *
+ * @author Andreas Hoegger
+ * @since 1.0.8 21.07.2010
+ */
+public class UnknownSinglePagePropertyViewPart extends AbstractSinglePageSectionBasedViewPart {
+ private static final String SECTION_ID_FILTER = "section.filter";
+
+ @Override
+ protected Control createHead(Composite parent) {
+ Composite headArea = getFormToolkit().createComposite(parent);
+ String titleText = Texts.get("NoPropertiesAvailable");
+ if (getPage() != null) {
+ titleText = Texts.get("NoPropertiesAvailableForX", getPage().getName());
+ }
+ Label title = getFormToolkit().createLabel(headArea, titleText, SWT.WRAP | SWT.READ_ONLY);
+ // layout
+ headArea.setLayout(new GridLayout(1, true));
+ GridData titleData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL);
+ titleData.widthHint = 100;
+ title.setLayoutData(titleData);
+ return headArea;
+ }
+
+ @Override
+ protected void createSections() {
+ if (getPage() != null && getPage().isFolder()) {
+ ISection filterSection = createSection(SECTION_ID_FILTER, Texts.get("Filter"));
+ PageFilterPresenter filterPresenter = new PageFilterPresenter(getFormToolkit(), filterSection.getSectionClient(), getPage());
+ GridData layoutData = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
+ layoutData.widthHint = 200;
+ filterPresenter.getContainer().setLayoutData(layoutData);
+ }
+ super.createSections();
+ }
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/presenter/AbstractPresenter.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/presenter/AbstractPresenter.java
index a6e1c5399..047eb5a6f 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/presenter/AbstractPresenter.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/presenter/AbstractPresenter.java
@@ -1,93 +1,93 @@
-/*******************************************************************************
- * 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.view.properties.presenter;
-
-import org.eclipse.scout.sdk.ui.view.properties.PropertyViewFormToolkit;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * <h3>{@link AbstractPresenter}</h3> ...
- *
- * @author Andreas Hoegger
- * @since 1.0.8 31.08.2010
- */
-public abstract class AbstractPresenter {
- private Composite m_container;
- private final PropertyViewFormToolkit m_toolkit;
-
- public AbstractPresenter(PropertyViewFormToolkit toolkit, Composite parent) {
- m_toolkit = toolkit;
- m_container = getToolkit().createComposite(parent);
-
- }
-
- public boolean isMultiLine() {
- return false;
- }
-
- protected Font getFont(String symbolicName, boolean bold) {
- if (bold) {
- return PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getFontRegistry().getBold(symbolicName);
- }
- else {
- return PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getFontRegistry().get(symbolicName);
- }
- }
-
- public Composite getContainer() {
- return m_container;
- }
-
- public void dispose() {
- if (getContainer() != null && (!getContainer().isDisposed())) {
- getContainer().dispose();
- }
- }
-
- public boolean isDisposed() {
- boolean disposed = true;
- if (getContainer() != null) {
- disposed = getContainer().isDisposed();
- }
- return disposed;
- }
-
- public void setEnabled(boolean enabled) {
- if (!isDisposed()) {
- getContainer().setEnabled(enabled);
- }
- }
-
- public boolean isEnabled() {
- boolean enabled = false;
- if (getContainer() != null && !getContainer().isDisposed()) {
- enabled = getContainer().isEnabled();
- }
- return enabled;
- }
-
- public PropertyViewFormToolkit getToolkit() {
- return m_toolkit;
- }
-
- protected void toolkitAdapt(Control control) {
- if (control instanceof Composite) {
- for (Control c : ((Composite) control).getChildren()) {
- toolkitAdapt(c);
- }
- }
- getToolkit().adapt(control, false, false);
- }
-
-}
+/*******************************************************************************
+ * 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.view.properties.presenter;
+
+import org.eclipse.scout.sdk.ui.view.properties.PropertyViewFormToolkit;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * <h3>{@link AbstractPresenter}</h3> ...
+ *
+ * @author Andreas Hoegger
+ * @since 1.0.8 31.08.2010
+ */
+public abstract class AbstractPresenter {
+ private Composite m_container;
+ private final PropertyViewFormToolkit m_toolkit;
+
+ public AbstractPresenter(PropertyViewFormToolkit toolkit, Composite parent) {
+ m_toolkit = toolkit;
+ m_container = getToolkit().createComposite(parent);
+
+ }
+
+ public boolean isMultiLine() {
+ return false;
+ }
+
+ protected Font getFont(String symbolicName, boolean bold) {
+ if (bold) {
+ return PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getFontRegistry().getBold(symbolicName);
+ }
+ else {
+ return PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getFontRegistry().get(symbolicName);
+ }
+ }
+
+ public Composite getContainer() {
+ return m_container;
+ }
+
+ public void dispose() {
+ if (getContainer() != null && (!getContainer().isDisposed())) {
+ getContainer().dispose();
+ }
+ }
+
+ public boolean isDisposed() {
+ boolean disposed = true;
+ if (getContainer() != null) {
+ disposed = getContainer().isDisposed();
+ }
+ return disposed;
+ }
+
+ public void setEnabled(boolean enabled) {
+ if (!isDisposed()) {
+ getContainer().setEnabled(enabled);
+ }
+ }
+
+ public boolean isEnabled() {
+ boolean enabled = false;
+ if (getContainer() != null && !getContainer().isDisposed()) {
+ enabled = getContainer().isEnabled();
+ }
+ return enabled;
+ }
+
+ public PropertyViewFormToolkit getToolkit() {
+ return m_toolkit;
+ }
+
+ protected void toolkitAdapt(Control control) {
+ if (control instanceof Composite) {
+ for (Control c : ((Composite) control).getChildren()) {
+ toolkitAdapt(c);
+ }
+ }
+ getToolkit().adapt(control, false, false);
+ }
+
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/presenter/multi/AbstractMultiMethodPresenter.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/presenter/multi/AbstractMultiMethodPresenter.java
index cfe5b5e09..f256a9816 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/presenter/multi/AbstractMultiMethodPresenter.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/presenter/multi/AbstractMultiMethodPresenter.java
@@ -1,157 +1,157 @@
-/*******************************************************************************
- * 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.view.properties.presenter.multi;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.core.IMethod;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.scout.sdk.ui.fields.tooltip.CustomTooltip;
-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.AbstractPresenter;
-import org.eclipse.scout.sdk.ui.view.properties.presenter.util.MethodBean;
-import org.eclipse.scout.sdk.ui.view.properties.presenter.util.MethodErrorPresenterContent;
-import org.eclipse.scout.sdk.util.SdkProperties;
-import org.eclipse.scout.sdk.util.signature.SignatureUtility;
-import org.eclipse.scout.sdk.workspace.type.config.ConfigurationMethod;
-import org.eclipse.scout.sdk.workspace.type.config.ConfigurationMethodSet;
-import org.eclipse.scout.sdk.workspace.type.config.PropertyMethodSourceUtility;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.forms.widgets.Hyperlink;
-
-/**
- * <h3>{@link AbstractMultiMethodPresenter}</h3> ...
- *
- * @author Andreas Hoegger
- * @since 1.0.8 31.08.2010
- * @param <T>
- */
-public abstract class AbstractMultiMethodPresenter<T> extends AbstractPresenter {
-
- private Hyperlink m_labelLink;
- private Composite m_body;
- private MethodErrorPresenterContent m_errorContent;
- private CustomTooltip m_tooltip;
- private HashMap<String, MethodBean<T>> m_methodSources = new HashMap<String, MethodBean<T>>();
-
- public AbstractMultiMethodPresenter(PropertyViewFormToolkit toolkit, Composite parent) {
- super(toolkit, parent);
- create(getContainer());
- }
-
- public final void setMethodSet(ConfigurationMethodSet methodSet) {
- try {
- for (ConfigurationMethod method : methodSet.getMethods()) {
- String key = method.getType().getFullyQualifiedName() + SignatureUtility.getMethodIdentifier(method.peekMethod());
-
- MethodBean<T> methodBean = m_methodSources.get(key);
- if (methodBean == null) {
- methodBean = new MethodBean<T>(method, key);
- m_methodSources.put(key, methodBean);
- }
- else {
- methodBean.setMethod(method);
- }
- }
- try {
- init(methodSet);
- }
- catch (CoreException e) {
- ScoutSdkUi.logWarning("parse error in multi presenter. ", e);
- }
- }
- catch (JavaModelException e) {
- ScoutSdkUi.logWarning("could not compare method body with cached body of presenter '" + methodSet.getMethodName() + "'", e);
- }
- getContainer().layout(true);
- }
-
- protected void init(ConfigurationMethodSet methodSet) throws CoreException {
- m_labelLink.setText(SdkProperties.getMethodPresenterName(getFirstMethod()));
- for (MethodBean<T> bean : m_methodSources.values()) {
- T sourceValue = parseSourceInput(PropertyMethodSourceUtility.getMethodReturnValue(bean.getMethod().peekMethod()), bean.getMethod());
- bean.setCurrentSourceValue(sourceValue);
- T defaultValue = parseSourceInput(bean.getMethod().computeDefaultValue(), bean.getMethod());
- bean.setDefaultValue(defaultValue);
- }
- }
-
- protected abstract String formatSourceValue(T value) throws CoreException;
-
- protected abstract String formatDisplayValue(T value) throws CoreException;
-
- protected abstract T parseSourceInput(String value, ConfigurationMethod method) throws CoreException;
-
- protected abstract T parseDisplayInput(String value) throws CoreException;
-
- protected void create(Composite parent) {
- m_errorContent = new MethodErrorPresenterContent(parent, getToolkit());
- m_body = getToolkit().createComposite(parent);
- m_labelLink = getToolkit().createHyperlink(m_body, "", SWT.NONE);
- m_tooltip = new CustomTooltip(m_labelLink, false);
- Control content = createContent(m_body);
-
- // layout
- GridLayout glayout = new GridLayout(1, true);
- glayout.horizontalSpacing = 0;
- glayout.marginHeight = 0;
- glayout.marginWidth = 0;
- glayout.verticalSpacing = 0;
- parent.setLayout(glayout);
- m_body.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL));
- m_errorContent.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL));
- ((GridData) m_errorContent.getLayoutData()).exclude = true;
-
- m_body.setLayout(new FormLayout());
-
- FormData data = new FormData();
- data.top = new FormAttachment(0, 0);
- data.left = new FormAttachment(0, 0);
- data.bottom = new FormAttachment(100, 0);
- data.right = new FormAttachment(0, 150);
- m_labelLink.setLayoutData(data);
- if (content != null) {
- data = new FormData();
- data.top = new FormAttachment(0, 0);
- data.left = new FormAttachment(m_labelLink, 5);
- data.right = new FormAttachment(100, 0);
- data.bottom = new FormAttachment(100, 0);
- content.setLayoutData(data);
- }
- }
-
- protected abstract Control createContent(Composite container);
-
- protected IMethod getFirstMethod() {
- if (m_methodSources == null || m_methodSources.size() < 1) {
- return null;
- }
- else {
- return new ArrayList<MethodBean<T>>(m_methodSources.values()).get(0).getMethod().peekMethod();
- }
- }
-
- @SuppressWarnings("unchecked")
- protected MethodBean<T>[] getMethodBeans() {
- return m_methodSources.values().toArray(new MethodBean[m_methodSources.size()]);
- }
-
-}
+/*******************************************************************************
+ * 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.view.properties.presenter.multi;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.scout.sdk.ui.fields.tooltip.CustomTooltip;
+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.AbstractPresenter;
+import org.eclipse.scout.sdk.ui.view.properties.presenter.util.MethodBean;
+import org.eclipse.scout.sdk.ui.view.properties.presenter.util.MethodErrorPresenterContent;
+import org.eclipse.scout.sdk.util.SdkProperties;
+import org.eclipse.scout.sdk.util.signature.SignatureUtility;
+import org.eclipse.scout.sdk.workspace.type.config.ConfigurationMethod;
+import org.eclipse.scout.sdk.workspace.type.config.ConfigurationMethodSet;
+import org.eclipse.scout.sdk.workspace.type.config.PropertyMethodSourceUtility;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.forms.widgets.Hyperlink;
+
+/**
+ * <h3>{@link AbstractMultiMethodPresenter}</h3> ...
+ *
+ * @author Andreas Hoegger
+ * @since 1.0.8 31.08.2010
+ * @param <T>
+ */
+public abstract class AbstractMultiMethodPresenter<T> extends AbstractPresenter {
+
+ private Hyperlink m_labelLink;
+ private Composite m_body;
+ private MethodErrorPresenterContent m_errorContent;
+ private CustomTooltip m_tooltip;
+ private HashMap<String, MethodBean<T>> m_methodSources = new HashMap<String, MethodBean<T>>();
+
+ public AbstractMultiMethodPresenter(PropertyViewFormToolkit toolkit, Composite parent) {
+ super(toolkit, parent);
+ create(getContainer());
+ }
+
+ public final void setMethodSet(ConfigurationMethodSet methodSet) {
+ try {
+ for (ConfigurationMethod method : methodSet.getMethods()) {
+ String key = method.getType().getFullyQualifiedName() + SignatureUtility.getMethodIdentifier(method.peekMethod());
+
+ MethodBean<T> methodBean = m_methodSources.get(key);
+ if (methodBean == null) {
+ methodBean = new MethodBean<T>(method, key);
+ m_methodSources.put(key, methodBean);
+ }
+ else {
+ methodBean.setMethod(method);
+ }
+ }
+ try {
+ init(methodSet);
+ }
+ catch (CoreException e) {
+ ScoutSdkUi.logWarning("parse error in multi presenter. ", e);
+ }
+ }
+ catch (JavaModelException e) {
+ ScoutSdkUi.logWarning("could not compare method body with cached body of presenter '" + methodSet.getMethodName() + "'", e);
+ }
+ getContainer().layout(true);
+ }
+
+ protected void init(ConfigurationMethodSet methodSet) throws CoreException {
+ m_labelLink.setText(SdkProperties.getMethodPresenterName(getFirstMethod()));
+ for (MethodBean<T> bean : m_methodSources.values()) {
+ T sourceValue = parseSourceInput(PropertyMethodSourceUtility.getMethodReturnValue(bean.getMethod().peekMethod()), bean.getMethod());
+ bean.setCurrentSourceValue(sourceValue);
+ T defaultValue = parseSourceInput(bean.getMethod().computeDefaultValue(), bean.getMethod());
+ bean.setDefaultValue(defaultValue);
+ }
+ }
+
+ protected abstract String formatSourceValue(T value) throws CoreException;
+
+ protected abstract String formatDisplayValue(T value) throws CoreException;
+
+ protected abstract T parseSourceInput(String value, ConfigurationMethod method) throws CoreException;
+
+ protected abstract T parseDisplayInput(String value) throws CoreException;
+
+ protected void create(Composite parent) {
+ m_errorContent = new MethodErrorPresenterContent(parent, getToolkit());
+ m_body = getToolkit().createComposite(parent);
+ m_labelLink = getToolkit().createHyperlink(m_body, "", SWT.NONE);
+ m_tooltip = new CustomTooltip(m_labelLink, false);
+ Control content = createContent(m_body);
+
+ // layout
+ GridLayout glayout = new GridLayout(1, true);
+ glayout.horizontalSpacing = 0;
+ glayout.marginHeight = 0;
+ glayout.marginWidth = 0;
+ glayout.verticalSpacing = 0;
+ parent.setLayout(glayout);
+ m_body.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL));
+ m_errorContent.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL));
+ ((GridData) m_errorContent.getLayoutData()).exclude = true;
+
+ m_body.setLayout(new FormLayout());
+
+ FormData data = new FormData();
+ data.top = new FormAttachment(0, 0);
+ data.left = new FormAttachment(0, 0);
+ data.bottom = new FormAttachment(100, 0);
+ data.right = new FormAttachment(0, 150);
+ m_labelLink.setLayoutData(data);
+ if (content != null) {
+ data = new FormData();
+ data.top = new FormAttachment(0, 0);
+ data.left = new FormAttachment(m_labelLink, 5);
+ data.right = new FormAttachment(100, 0);
+ data.bottom = new FormAttachment(100, 0);
+ content.setLayoutData(data);
+ }
+ }
+
+ protected abstract Control createContent(Composite container);
+
+ protected IMethod getFirstMethod() {
+ if (m_methodSources == null || m_methodSources.size() < 1) {
+ return null;
+ }
+ else {
+ return new ArrayList<MethodBean<T>>(m_methodSources.values()).get(0).getMethod().peekMethod();
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ protected MethodBean<T>[] getMethodBeans() {
+ return m_methodSources.values().toArray(new MethodBean[m_methodSources.size()]);
+ }
+
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/presenter/multi/AbstractMultiValuePresenter.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/presenter/multi/AbstractMultiValuePresenter.java
index 871e9e37b..d578b99f2 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/presenter/multi/AbstractMultiValuePresenter.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/presenter/multi/AbstractMultiValuePresenter.java
@@ -1,127 +1,127 @@
-/*******************************************************************************
- * 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.view.properties.presenter.multi;
-
-import java.util.regex.Pattern;
-
-import org.eclipse.core.runtime.CoreException;
-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.util.MethodBean;
-import org.eclipse.scout.sdk.util.SdkProperties;
-import org.eclipse.scout.sdk.workspace.type.config.ConfigurationMethodSet;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Text;
-
-/**
- * <h3>AbstractMultiValuePresenter</h3> ...
- *
- * @param <T>
- */
-public abstract class AbstractMultiValuePresenter<T> extends AbstractMultiMethodPresenter<T> {
-
- private Text m_textComponent;
- private final String m_regexAllowedCharacters;
-
- public AbstractMultiValuePresenter(PropertyViewFormToolkit toolkit, Composite parent, String regexAllowedInput) {
- super(toolkit, parent);
- m_regexAllowedCharacters = regexAllowedInput;
- }
-
- @Override
- protected Control createContent(Composite container) {
- m_textComponent = getToolkit().createText(container, "", getTextAlignment());
- P_TextListener listener = new P_TextListener();
- m_textComponent.addListener(SWT.FocusIn, listener);
- m_textComponent.addListener(SWT.FocusOut, listener);
- m_textComponent.addListener(SWT.Verify, listener);
- return m_textComponent;
- }
-
- @Override
- public void setEnabled(boolean enabled) {
- if (!isDisposed()) {
- m_textComponent.setEnabled(enabled);
- }
- super.setEnabled(enabled);
- }
-
- @Override
- public boolean isEnabled() {
- if (!isDisposed()) {
- return m_textComponent.getEnabled() && super.isEnabled();
- }
- return false;
- }
-
- @Override
- protected void init(ConfigurationMethodSet methodSet) throws CoreException {
- super.init(methodSet);
-// if (methodSet.getMethods().length > 0) {
-// m_textComponent.setEnabled(true);
-// }
- }
-
- protected abstract void storeMethods(MethodBean<T>[] beans, T value);
-
- protected int getTextAlignment() {
- return SWT.LEFT;
- }
-
- public Text getTextComponent() {
- return m_textComponent;
- }
-
- private class P_TextListener implements Listener {
- @Override
- public void handleEvent(Event event) {
- switch (event.type) {
- case SWT.Verify:
- String string = event.text;
- if (SdkProperties.INPUT_MULTI_UNDEFINED.equals(string)) {
- // allow undefined focus lost
- return;
- }
- if (string != null) {
- event.doit = Pattern.matches(m_regexAllowedCharacters, string);
- }
- break;
- case SWT.FocusOut:
-
- String input = getTextComponent().getText();
- if (SdkProperties.INPUT_MULTI_UNDEFINED.equals(input)) {
- // allow undefined focus lost
- return;
- }
- try {
- T value = parseDisplayInput(input);
- getTextComponent().setText(formatDisplayValue(value));
- storeMethods(getMethodBeans(), value);
- }
- catch (CoreException e) {
- ScoutSdkUi.logInfo("input is not well fomed " + input);
- getTextComponent().setForeground(getTextComponent().getDisplay().getSystemColor(SWT.COLOR_RED));
- }
- break;
- case SWT.FocusIn:
- getTextComponent().setForeground(null);
- break;
- default:
- break;
- }
- }
- } // end class P_TextListener
-
-}
+/*******************************************************************************
+ * 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.view.properties.presenter.multi;
+
+import java.util.regex.Pattern;
+
+import org.eclipse.core.runtime.CoreException;
+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.util.MethodBean;
+import org.eclipse.scout.sdk.util.SdkProperties;
+import org.eclipse.scout.sdk.workspace.type.config.ConfigurationMethodSet;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * <h3>AbstractMultiValuePresenter</h3> ...
+ *
+ * @param <T>
+ */
+public abstract class AbstractMultiValuePresenter<T> extends AbstractMultiMethodPresenter<T> {
+
+ private Text m_textComponent;
+ private final String m_regexAllowedCharacters;
+
+ public AbstractMultiValuePresenter(PropertyViewFormToolkit toolkit, Composite parent, String regexAllowedInput) {
+ super(toolkit, parent);
+ m_regexAllowedCharacters = regexAllowedInput;
+ }
+
+ @Override
+ protected Control createContent(Composite container) {
+ m_textComponent = getToolkit().createText(container, "", getTextAlignment());
+ P_TextListener listener = new P_TextListener();
+ m_textComponent.addListener(SWT.FocusIn, listener);
+ m_textComponent.addListener(SWT.FocusOut, listener);
+ m_textComponent.addListener(SWT.Verify, listener);
+ return m_textComponent;
+ }
+
+ @Override
+ public void setEnabled(boolean enabled) {
+ if (!isDisposed()) {
+ m_textComponent.setEnabled(enabled);
+ }
+ super.setEnabled(enabled);
+ }
+
+ @Override
+ public boolean isEnabled() {
+ if (!isDisposed()) {
+ return m_textComponent.getEnabled() && super.isEnabled();
+ }
+ return false;
+ }
+
+ @Override
+ protected void init(ConfigurationMethodSet methodSet) throws CoreException {
+ super.init(methodSet);
+// if (methodSet.getMethods().length > 0) {
+// m_textComponent.setEnabled(true);
+// }
+ }
+
+ protected abstract void storeMethods(MethodBean<T>[] beans, T value);
+
+ protected int getTextAlignment() {
+ return SWT.LEFT;
+ }
+
+ public Text getTextComponent() {
+ return m_textComponent;
+ }
+
+ private class P_TextListener implements Listener {
+ @Override
+ public void handleEvent(Event event) {
+ switch (event.type) {
+ case SWT.Verify:
+ String string = event.text;
+ if (SdkProperties.INPUT_MULTI_UNDEFINED.equals(string)) {
+ // allow undefined focus lost
+ return;
+ }
+ if (string != null) {
+ event.doit = Pattern.matches(m_regexAllowedCharacters, string);
+ }
+ break;
+ case SWT.FocusOut:
+
+ String input = getTextComponent().getText();
+ if (SdkProperties.INPUT_MULTI_UNDEFINED.equals(input)) {
+ // allow undefined focus lost
+ return;
+ }
+ try {
+ T value = parseDisplayInput(input);
+ getTextComponent().setText(formatDisplayValue(value));
+ storeMethods(getMethodBeans(), value);
+ }
+ catch (CoreException e) {
+ ScoutSdkUi.logInfo("input is not well fomed " + input);
+ getTextComponent().setForeground(getTextComponent().getDisplay().getSystemColor(SWT.COLOR_RED));
+ }
+ break;
+ case SWT.FocusIn:
+ getTextComponent().setForeground(null);
+ break;
+ default:
+ break;
+ }
+ }
+ } // end class P_TextListener
+
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/presenter/single/AbstractJavaElementListPresenter.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/presenter/single/AbstractJavaElementListPresenter.java
index 0d6ce059a..65a5aafc5 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/presenter/single/AbstractJavaElementListPresenter.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/presenter/single/AbstractJavaElementListPresenter.java
@@ -1,191 +1,191 @@
-/*******************************************************************************
- * 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.view.properties.presenter.single;
-
-import java.util.ArrayList;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.ui.fields.table.AutoResizeColumnTable;
-import org.eclipse.scout.sdk.ui.fields.table.JavaElementTableContentProvider;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.view.properties.PropertyViewFormToolkit;
-import org.eclipse.scout.sdk.util.SdkProperties;
-import org.eclipse.scout.sdk.workspace.type.config.ConfigurationMethod;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-
-public abstract class AbstractJavaElementListPresenter extends AbstractMethodPresenter {
-
- private TableViewer m_viewer;
- private Table m_table;
- private IJavaElement[] m_sourceElements;
- private JavaElementTableContentProvider m_tableModel;
- private Button m_removeButton;
- private Button m_addButton;
-
- public AbstractJavaElementListPresenter(PropertyViewFormToolkit toolkit, Composite parent) {
- super(toolkit, parent);
- }
-
- @Override
- protected Control createContent(Composite container) {
- Composite rootArea = getToolkit().createComposite(container);
- Control table = createTable(rootArea);
- Control controlArea = createControlArea(rootArea);
-
- // layout
- GridLayout layout = new GridLayout(2, false);
- layout.horizontalSpacing = 2;
- layout.marginHeight = 0;
- layout.marginTop = 0;
- layout.marginWidth = 0;
- rootArea.setLayout(layout);
- GridData gdata = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL | GridData.GRAB_VERTICAL);
- gdata.heightHint = m_table.getItemHeight() * 3 + 5;
- gdata.minimumWidth = 100;
- gdata.widthHint = 150;
- table.setLayoutData(gdata);
- controlArea.setLayoutData(new GridData());
- return rootArea;
- }
-
- @Override
- public void setEnabled(boolean enabled) {
- if (!isDisposed()) {
- if (enabled) {
- m_removeButton.setEnabled(!m_viewer.getSelection().isEmpty());
- }
- else {
- m_removeButton.setEnabled(false);
- }
- m_addButton.setEnabled(enabled);
- }
- super.setEnabled(enabled);
- }
-
- private Control createTable(Composite container) {
- // create content provider
-
- m_tableModel = new JavaElementTableContentProvider();
- m_table = new AutoResizeColumnTable(container, SWT.FULL_SELECTION | SWT.BORDER);
- TableColumn simpleNameCol = new TableColumn(m_table, SWT.LEFT);
- simpleNameCol.setData(AutoResizeColumnTable.COLUMN_WEIGHT, new Integer(3));
- simpleNameCol.setWidth(170);
- simpleNameCol.setText(Texts.get("Member"));
- m_table.setHeaderVisible(false);
- m_viewer = new TableViewer(m_table);
- m_viewer.addSelectionChangedListener(new ISelectionChangedListener() {
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- m_removeButton.setEnabled(!event.getSelection().isEmpty());
- }
- });
- m_viewer.setContentProvider(m_tableModel);
- m_viewer.setLabelProvider(m_tableModel);
- m_viewer.setInput(this);
- m_viewer.addDoubleClickListener(new IDoubleClickListener() {
- @Override
- public void doubleClick(DoubleClickEvent event) {
- // TODO select the current oultine in the outline view
- }
- });
-
- return m_viewer.getControl();
- }
-
- @Override
- protected void init(ConfigurationMethod method) throws CoreException {
- super.init(method);
- m_sourceElements = readSource();
- m_tableModel.setElements(m_sourceElements);
- m_viewer.refresh();
- m_removeButton.setEnabled(!m_viewer.getSelection().isEmpty());
- m_addButton.setEnabled(true);
- }
-
- private Control createControlArea(Composite parent) {
- Composite pane = getToolkit().createComposite(parent);
- m_addButton = getToolkit().createButton(pane, "", SWT.PUSH);
- m_addButton.setImage(ScoutSdkUi.getImage(ScoutSdkUi.ToolAdd));
- m_addButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- handleAddComponent();
- }
- });
- m_addButton.setEnabled(false);
- m_removeButton = getToolkit().createButton(pane, "", SWT.PUSH);
- m_removeButton.setImage(ScoutSdkUi.getImage(ScoutSdkUi.ToolRemove));
- m_removeButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- handleRemoveComponent();
- }
- });
- m_removeButton.setEnabled(false);
-
- // layout
- GridLayout layout = new GridLayout(1, true);
- layout.horizontalSpacing = 0;
- layout.marginHeight = 0;
- layout.marginTop = 0;
- layout.marginWidth = 0;
- pane.setLayout(layout);
- GridData gridData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
- gridData.heightHint = SdkProperties.TOOL_BUTTON_SIZE;
- gridData.widthHint = SdkProperties.TOOL_BUTTON_SIZE;
- m_addButton.setLayoutData(gridData);
- gridData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
- gridData.heightHint = SdkProperties.TOOL_BUTTON_SIZE;
- gridData.widthHint = SdkProperties.TOOL_BUTTON_SIZE;
- m_removeButton.setLayoutData(gridData);
-
- return pane;
- }
-
- private void handleRemoveComponent() {
- IJavaElement toRemove = (IJavaElement) ((StructuredSelection) m_viewer.getSelection()).getFirstElement();
- ArrayList<IJavaElement> props = new ArrayList<IJavaElement>();
- for (IJavaElement prop : getSourceProps()) {
- if (!prop.equals(toRemove)) {
- props.add(prop);
- }
- }
- store(props.toArray(new IJavaElement[props.size()]));
- }
-
- protected abstract void handleAddComponent();
-
- public abstract IJavaElement[] readSource() throws CoreException;
-
- public abstract void store(IJavaElement[] proposals);
-
- public IJavaElement[] getSourceProps() {
- return m_sourceElements;
- }
-
-}
+/*******************************************************************************
+ * 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.view.properties.presenter.single;
+
+import java.util.ArrayList;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.ui.fields.table.AutoResizeColumnTable;
+import org.eclipse.scout.sdk.ui.fields.table.JavaElementTableContentProvider;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.view.properties.PropertyViewFormToolkit;
+import org.eclipse.scout.sdk.util.SdkProperties;
+import org.eclipse.scout.sdk.workspace.type.config.ConfigurationMethod;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+
+public abstract class AbstractJavaElementListPresenter extends AbstractMethodPresenter {
+
+ private TableViewer m_viewer;
+ private Table m_table;
+ private IJavaElement[] m_sourceElements;
+ private JavaElementTableContentProvider m_tableModel;
+ private Button m_removeButton;
+ private Button m_addButton;
+
+ public AbstractJavaElementListPresenter(PropertyViewFormToolkit toolkit, Composite parent) {
+ super(toolkit, parent);
+ }
+
+ @Override
+ protected Control createContent(Composite container) {
+ Composite rootArea = getToolkit().createComposite(container);
+ Control table = createTable(rootArea);
+ Control controlArea = createControlArea(rootArea);
+
+ // layout
+ GridLayout layout = new GridLayout(2, false);
+ layout.horizontalSpacing = 2;
+ layout.marginHeight = 0;
+ layout.marginTop = 0;
+ layout.marginWidth = 0;
+ rootArea.setLayout(layout);
+ GridData gdata = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL | GridData.GRAB_VERTICAL);
+ gdata.heightHint = m_table.getItemHeight() * 3 + 5;
+ gdata.minimumWidth = 100;
+ gdata.widthHint = 150;
+ table.setLayoutData(gdata);
+ controlArea.setLayoutData(new GridData());
+ return rootArea;
+ }
+
+ @Override
+ public void setEnabled(boolean enabled) {
+ if (!isDisposed()) {
+ if (enabled) {
+ m_removeButton.setEnabled(!m_viewer.getSelection().isEmpty());
+ }
+ else {
+ m_removeButton.setEnabled(false);
+ }
+ m_addButton.setEnabled(enabled);
+ }
+ super.setEnabled(enabled);
+ }
+
+ private Control createTable(Composite container) {
+ // create content provider
+
+ m_tableModel = new JavaElementTableContentProvider();
+ m_table = new AutoResizeColumnTable(container, SWT.FULL_SELECTION | SWT.BORDER);
+ TableColumn simpleNameCol = new TableColumn(m_table, SWT.LEFT);
+ simpleNameCol.setData(AutoResizeColumnTable.COLUMN_WEIGHT, new Integer(3));
+ simpleNameCol.setWidth(170);
+ simpleNameCol.setText(Texts.get("Member"));
+ m_table.setHeaderVisible(false);
+ m_viewer = new TableViewer(m_table);
+ m_viewer.addSelectionChangedListener(new ISelectionChangedListener() {
+ @Override
+ public void selectionChanged(SelectionChangedEvent event) {
+ m_removeButton.setEnabled(!event.getSelection().isEmpty());
+ }
+ });
+ m_viewer.setContentProvider(m_tableModel);
+ m_viewer.setLabelProvider(m_tableModel);
+ m_viewer.setInput(this);
+ m_viewer.addDoubleClickListener(new IDoubleClickListener() {
+ @Override
+ public void doubleClick(DoubleClickEvent event) {
+ // TODO select the current oultine in the outline view
+ }
+ });
+
+ return m_viewer.getControl();
+ }
+
+ @Override
+ protected void init(ConfigurationMethod method) throws CoreException {
+ super.init(method);
+ m_sourceElements = readSource();
+ m_tableModel.setElements(m_sourceElements);
+ m_viewer.refresh();
+ m_removeButton.setEnabled(!m_viewer.getSelection().isEmpty());
+ m_addButton.setEnabled(true);
+ }
+
+ private Control createControlArea(Composite parent) {
+ Composite pane = getToolkit().createComposite(parent);
+ m_addButton = getToolkit().createButton(pane, "", SWT.PUSH);
+ m_addButton.setImage(ScoutSdkUi.getImage(ScoutSdkUi.ToolAdd));
+ m_addButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ handleAddComponent();
+ }
+ });
+ m_addButton.setEnabled(false);
+ m_removeButton = getToolkit().createButton(pane, "", SWT.PUSH);
+ m_removeButton.setImage(ScoutSdkUi.getImage(ScoutSdkUi.ToolRemove));
+ m_removeButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ handleRemoveComponent();
+ }
+ });
+ m_removeButton.setEnabled(false);
+
+ // layout
+ GridLayout layout = new GridLayout(1, true);
+ layout.horizontalSpacing = 0;
+ layout.marginHeight = 0;
+ layout.marginTop = 0;
+ layout.marginWidth = 0;
+ pane.setLayout(layout);
+ GridData gridData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
+ gridData.heightHint = SdkProperties.TOOL_BUTTON_SIZE;
+ gridData.widthHint = SdkProperties.TOOL_BUTTON_SIZE;
+ m_addButton.setLayoutData(gridData);
+ gridData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
+ gridData.heightHint = SdkProperties.TOOL_BUTTON_SIZE;
+ gridData.widthHint = SdkProperties.TOOL_BUTTON_SIZE;
+ m_removeButton.setLayoutData(gridData);
+
+ return pane;
+ }
+
+ private void handleRemoveComponent() {
+ IJavaElement toRemove = (IJavaElement) ((StructuredSelection) m_viewer.getSelection()).getFirstElement();
+ ArrayList<IJavaElement> props = new ArrayList<IJavaElement>();
+ for (IJavaElement prop : getSourceProps()) {
+ if (!prop.equals(toRemove)) {
+ props.add(prop);
+ }
+ }
+ store(props.toArray(new IJavaElement[props.size()]));
+ }
+
+ protected abstract void handleAddComponent();
+
+ public abstract IJavaElement[] readSource() throws CoreException;
+
+ public abstract void store(IJavaElement[] proposals);
+
+ public IJavaElement[] getSourceProps() {
+ return m_sourceElements;
+ }
+
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/presenter/single/AbstractMethodPresenter.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/presenter/single/AbstractMethodPresenter.java
index f7c581c35..716fe8cc5 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/presenter/single/AbstractMethodPresenter.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/presenter/single/AbstractMethodPresenter.java
@@ -1,283 +1,283 @@
-/*******************************************************************************
- * 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.view.properties.presenter.single;
-
-import java.util.regex.Matcher;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.jobs.OperationJob;
-import org.eclipse.scout.sdk.operation.method.ScoutMethodDeleteOperation;
-import org.eclipse.scout.sdk.ui.fields.tooltip.JavadocTooltip;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.util.UiUtility;
-import org.eclipse.scout.sdk.ui.view.properties.PropertyViewFormToolkit;
-import org.eclipse.scout.sdk.ui.view.properties.presenter.AbstractPresenter;
-import org.eclipse.scout.sdk.ui.view.properties.presenter.util.MethodErrorPresenterContent;
-import org.eclipse.scout.sdk.util.Regex;
-import org.eclipse.scout.sdk.util.SdkProperties;
-import org.eclipse.scout.sdk.util.log.ScoutStatus;
-import org.eclipse.scout.sdk.workspace.type.config.ConfigurationMethod;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Canvas;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.ui.forms.events.HyperlinkAdapter;
-import org.eclipse.ui.forms.events.HyperlinkEvent;
-import org.eclipse.ui.forms.widgets.Hyperlink;
-import org.eclipse.ui.forms.widgets.ImageHyperlink;
-
-/**
- * <h3>AbstractMethodPresenter</h3> ...
- */
-public abstract class AbstractMethodPresenter extends AbstractPresenter {
-
- private ConfigurationMethod m_configurationMethod;
- private Hyperlink m_labelLink;
- private Label m_label;
- private Composite m_body;
- private Composite m_linkComposite;
- private MethodErrorPresenterContent m_errorContent;
- private JavadocTooltip m_tooltip;
- private ImageHyperlink m_deleteButton;
-
- public AbstractMethodPresenter(PropertyViewFormToolkit toolkit, Composite parent) {
- super(toolkit, parent);
- create(getContainer());
- }
-
- protected boolean isLinkMode() {
- return m_configurationMethod != null && m_configurationMethod.isImplemented();
- }
-
- protected void init(ConfigurationMethod method) throws CoreException {
- if (m_labelLink != null) m_labelLink.dispose();
- if (m_label != null) m_label.dispose();
-
- GridData gd = new GridData(SWT.RIGHT, SWT.TOP, true, false);
- if (isLinkMode()) {
- m_labelLink = getToolkit().createHyperlink(m_linkComposite, SdkProperties.getMethodPresenterName(method.peekMethod()), SWT.NONE);
- m_labelLink.addHyperlinkListener(new HyperlinkAdapter() {
- @Override
- public void linkActivated(HyperlinkEvent e) {
- handleLabelLinkSelected();
- }
- });
- m_labelLink.setEnabled(true);
- m_labelLink.setFont(getFont(JFaceResources.DIALOG_FONT, true));
- m_labelLink.setLayoutData(gd);
- m_labelLink.getParent().layout();
- m_tooltip = new JavadocTooltip(m_labelLink);
- }
- else {
- m_label = getToolkit().createLabel(m_linkComposite, SdkProperties.getMethodPresenterName(method.peekMethod()));
- m_label.setForeground(new Color(m_linkComposite.getDisplay(), 0, 0, 128));
- m_label.setLayoutData(gd);
- m_tooltip = new JavadocTooltip(m_label);
- }
- m_tooltip.setMember(method.peekMethod());
- }
-
- protected void create(Composite parent) {
- // layout parent
- GridLayout glayout = new GridLayout(1, true);
- glayout.horizontalSpacing = 0;
- glayout.marginHeight = 0;
- glayout.marginWidth = 0;
- glayout.verticalSpacing = 0;
- parent.setLayout(glayout);
-
- createBody(parent);
- }
-
- private Control createBody(Composite parent) {
- m_body = getToolkit().createComposite(parent);
- m_linkComposite = getToolkit().createComposite(m_body);
-
- Control content = createContent(m_body);
- Composite buttonArea = getToolkit().createComposite(m_body);
- Control placeHolderControl = new Canvas(buttonArea, SWT.NONE);
- fillButtonArea(buttonArea);
-
- //layout
- GridLayout bodyLayout = new GridLayout(3, false);
- bodyLayout.horizontalSpacing = 0;
- bodyLayout.marginHeight = 0;
- bodyLayout.marginWidth = 0;
- bodyLayout.verticalSpacing = 0;
- m_body.setLayout(bodyLayout);
-
- GridData bodyLayoutData = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL);
- m_body.setLayoutData(bodyLayoutData);
-
- GridData linkCompData = new GridData();
- linkCompData.widthHint = 180;
- m_linkComposite.setLayoutData(linkCompData);
-
- GridData contentData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
- if (content != null) {
- content.setLayoutData(contentData);
- }
-
- GridData buttonAreaData = new GridData(GridData.FILL_VERTICAL);
- buttonArea.setLayoutData(buttonAreaData);
-
- m_linkComposite.setLayout(new GridLayout(1, true));
-
- GridLayout buttonBarLayout = new GridLayout(100, false);
- buttonBarLayout.horizontalSpacing = 0;
- buttonBarLayout.marginHeight = 0;
- buttonBarLayout.marginWidth = 0;
- buttonBarLayout.verticalSpacing = 0;
- buttonArea.setLayout(buttonBarLayout);
- placeHolderControl.setLayoutData(new GridData(1, 1));
- return m_body;
- }
-
- protected void fillButtonArea(Composite buttonArea) {
- m_deleteButton = getToolkit().createImageHyperlink(buttonArea, SWT.PUSH);
- m_deleteButton.setImage(ScoutSdkUi.getImage(ScoutSdkUi.ToolRemove));
- m_deleteButton.addHyperlinkListener(new HyperlinkAdapter() {
- @Override
- public void linkActivated(HyperlinkEvent e) {
- if (getMethod().isImplemented()) {
- ScoutMethodDeleteOperation op = new ScoutMethodDeleteOperation(getMethod().peekMethod());
- OperationJob job = new OperationJob(op);
- job.schedule();
- }
- }
- });
- GridData deleteButtonData = new GridData(GridData.VERTICAL_ALIGN_CENTER | GridData.GRAB_VERTICAL);
- m_deleteButton.setLayoutData(deleteButtonData);
- }
-
- protected abstract Control createContent(Composite container);
-
- public final void setMethod(ConfigurationMethod configurationMethod) {
- try {
- getContainer().setRedraw(false);
-
- m_configurationMethod = configurationMethod;
- try {
- init(configurationMethod);
- setErrorPresenterVisible(false);
- }
- catch (CoreException e) {
- if (m_errorContent == null) {
- m_errorContent = new MethodErrorPresenterContent(getContainer(), getToolkit());
- m_errorContent.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL));
- }
- if (e instanceof MethodErrorPresenterException) {
- m_errorContent.setPresenterText(e.getMessage());
- }
- m_errorContent.setMethod(configurationMethod);
- setErrorPresenterVisible(true);
- }
- ((GridData) m_deleteButton.getLayoutData()).exclude = !configurationMethod.isImplemented();
- m_deleteButton.setVisible(configurationMethod.isImplemented());
- m_deleteButton.setToolTipText(Texts.get("RemoveXinY", getMethod().getMethodName(), getMethod().getType().getElementName()));
- }
- finally {
- getContainer().setRedraw(true);
- getContainer().layout(true, true);
- }
- }
-
- private void setErrorPresenterVisible(boolean visible) {
- m_body.setVisible(!visible);
- ((GridData) m_body.getLayoutData()).exclude = visible;
-
- if (m_errorContent != null) {
- m_errorContent.setVisible(visible);
- ((GridData) m_errorContent.getLayoutData()).exclude = !visible;
- }
- }
-
- public ConfigurationMethod getMethod() {
- return m_configurationMethod;
- }
-
- public void setLabelText(String text) {
- if (!isDisposed()) {
- m_labelLink.setText(text);
- }
- }
-
- public String getLabelText() {
- String labelText = null;
- if (!isDisposed()) {
- labelText = m_labelLink.getText();
- }
- return labelText;
- }
-
- @Override
- public void setEnabled(boolean enabled) {
- if (!isDisposed()) {
- if (m_errorContent != null) {
- m_errorContent.setEnabled(enabled);
- }
- m_deleteButton.setEnabled(enabled);
- }
- }
-
- @Override
- public boolean isEnabled() {
- if (!isDisposed()) {
- return m_deleteButton.isEnabled();
- }
- return false;
- }
-
- protected void handleLabelLinkSelected() {
- showJavaElementInEditor(getMethod().peekMethod());
- }
-
- protected void showJavaElementInEditor(IJavaElement e) {
- showJavaElementInEditor(e, true);
- }
-
- protected void showJavaElementInEditor(IJavaElement e, boolean createNew) {
- UiUtility.showJavaElementInEditor(e, createNew);
- }
-
- protected final String readInitalValue() throws CoreException {
- try {
- Matcher m = Regex.REGEX_PROPERTY_METHOD_REPRESENTER_VALUE.matcher(getMethod().peekMethod().getSource());
- if (m.find()) {
- return m.group(1);
- }
- else {
- throw new CoreException(new ScoutStatus(getMethod().peekMethod().getSource()));
- }
- }
- catch (JavaModelException e) {
- ScoutSdkUi.logError(e);
- return null;
- }
- }
-
- protected static class MethodErrorPresenterException extends CoreException {
- private static final long serialVersionUID = 1L;
-
- public MethodErrorPresenterException(IStatus status) {
- super(status);
- }
- }
-}
+/*******************************************************************************
+ * 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.view.properties.presenter.single;
+
+import java.util.regex.Matcher;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.jobs.OperationJob;
+import org.eclipse.scout.sdk.operation.method.ScoutMethodDeleteOperation;
+import org.eclipse.scout.sdk.ui.fields.tooltip.JavadocTooltip;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.util.UiUtility;
+import org.eclipse.scout.sdk.ui.view.properties.PropertyViewFormToolkit;
+import org.eclipse.scout.sdk.ui.view.properties.presenter.AbstractPresenter;
+import org.eclipse.scout.sdk.ui.view.properties.presenter.util.MethodErrorPresenterContent;
+import org.eclipse.scout.sdk.util.Regex;
+import org.eclipse.scout.sdk.util.SdkProperties;
+import org.eclipse.scout.sdk.util.log.ScoutStatus;
+import org.eclipse.scout.sdk.workspace.type.config.ConfigurationMethod;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.forms.events.HyperlinkAdapter;
+import org.eclipse.ui.forms.events.HyperlinkEvent;
+import org.eclipse.ui.forms.widgets.Hyperlink;
+import org.eclipse.ui.forms.widgets.ImageHyperlink;
+
+/**
+ * <h3>AbstractMethodPresenter</h3> ...
+ */
+public abstract class AbstractMethodPresenter extends AbstractPresenter {
+
+ private ConfigurationMethod m_configurationMethod;
+ private Hyperlink m_labelLink;
+ private Label m_label;
+ private Composite m_body;
+ private Composite m_linkComposite;
+ private MethodErrorPresenterContent m_errorContent;
+ private JavadocTooltip m_tooltip;
+ private ImageHyperlink m_deleteButton;
+
+ public AbstractMethodPresenter(PropertyViewFormToolkit toolkit, Composite parent) {
+ super(toolkit, parent);
+ create(getContainer());
+ }
+
+ protected boolean isLinkMode() {
+ return m_configurationMethod != null && m_configurationMethod.isImplemented();
+ }
+
+ protected void init(ConfigurationMethod method) throws CoreException {
+ if (m_labelLink != null) m_labelLink.dispose();
+ if (m_label != null) m_label.dispose();
+
+ GridData gd = new GridData(SWT.RIGHT, SWT.TOP, true, false);
+ if (isLinkMode()) {
+ m_labelLink = getToolkit().createHyperlink(m_linkComposite, SdkProperties.getMethodPresenterName(method.peekMethod()), SWT.NONE);
+ m_labelLink.addHyperlinkListener(new HyperlinkAdapter() {
+ @Override
+ public void linkActivated(HyperlinkEvent e) {
+ handleLabelLinkSelected();
+ }
+ });
+ m_labelLink.setEnabled(true);
+ m_labelLink.setFont(getFont(JFaceResources.DIALOG_FONT, true));
+ m_labelLink.setLayoutData(gd);
+ m_labelLink.getParent().layout();
+ m_tooltip = new JavadocTooltip(m_labelLink);
+ }
+ else {
+ m_label = getToolkit().createLabel(m_linkComposite, SdkProperties.getMethodPresenterName(method.peekMethod()));
+ m_label.setForeground(new Color(m_linkComposite.getDisplay(), 0, 0, 128));
+ m_label.setLayoutData(gd);
+ m_tooltip = new JavadocTooltip(m_label);
+ }
+ m_tooltip.setMember(method.peekMethod());
+ }
+
+ protected void create(Composite parent) {
+ // layout parent
+ GridLayout glayout = new GridLayout(1, true);
+ glayout.horizontalSpacing = 0;
+ glayout.marginHeight = 0;
+ glayout.marginWidth = 0;
+ glayout.verticalSpacing = 0;
+ parent.setLayout(glayout);
+
+ createBody(parent);
+ }
+
+ private Control createBody(Composite parent) {
+ m_body = getToolkit().createComposite(parent);
+ m_linkComposite = getToolkit().createComposite(m_body);
+
+ Control content = createContent(m_body);
+ Composite buttonArea = getToolkit().createComposite(m_body);
+ Control placeHolderControl = new Canvas(buttonArea, SWT.NONE);
+ fillButtonArea(buttonArea);
+
+ //layout
+ GridLayout bodyLayout = new GridLayout(3, false);
+ bodyLayout.horizontalSpacing = 0;
+ bodyLayout.marginHeight = 0;
+ bodyLayout.marginWidth = 0;
+ bodyLayout.verticalSpacing = 0;
+ m_body.setLayout(bodyLayout);
+
+ GridData bodyLayoutData = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL);
+ m_body.setLayoutData(bodyLayoutData);
+
+ GridData linkCompData = new GridData();
+ linkCompData.widthHint = 180;
+ m_linkComposite.setLayoutData(linkCompData);
+
+ GridData contentData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
+ if (content != null) {
+ content.setLayoutData(contentData);
+ }
+
+ GridData buttonAreaData = new GridData(GridData.FILL_VERTICAL);
+ buttonArea.setLayoutData(buttonAreaData);
+
+ m_linkComposite.setLayout(new GridLayout(1, true));
+
+ GridLayout buttonBarLayout = new GridLayout(100, false);
+ buttonBarLayout.horizontalSpacing = 0;
+ buttonBarLayout.marginHeight = 0;
+ buttonBarLayout.marginWidth = 0;
+ buttonBarLayout.verticalSpacing = 0;
+ buttonArea.setLayout(buttonBarLayout);
+ placeHolderControl.setLayoutData(new GridData(1, 1));
+ return m_body;
+ }
+
+ protected void fillButtonArea(Composite buttonArea) {
+ m_deleteButton = getToolkit().createImageHyperlink(buttonArea, SWT.PUSH);
+ m_deleteButton.setImage(ScoutSdkUi.getImage(ScoutSdkUi.ToolRemove));
+ m_deleteButton.addHyperlinkListener(new HyperlinkAdapter() {
+ @Override
+ public void linkActivated(HyperlinkEvent e) {
+ if (getMethod().isImplemented()) {
+ ScoutMethodDeleteOperation op = new ScoutMethodDeleteOperation(getMethod().peekMethod());
+ OperationJob job = new OperationJob(op);
+ job.schedule();
+ }
+ }
+ });
+ GridData deleteButtonData = new GridData(GridData.VERTICAL_ALIGN_CENTER | GridData.GRAB_VERTICAL);
+ m_deleteButton.setLayoutData(deleteButtonData);
+ }
+
+ protected abstract Control createContent(Composite container);
+
+ public final void setMethod(ConfigurationMethod configurationMethod) {
+ try {
+ getContainer().setRedraw(false);
+
+ m_configurationMethod = configurationMethod;
+ try {
+ init(configurationMethod);
+ setErrorPresenterVisible(false);
+ }
+ catch (CoreException e) {
+ if (m_errorContent == null) {
+ m_errorContent = new MethodErrorPresenterContent(getContainer(), getToolkit());
+ m_errorContent.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL));
+ }
+ if (e instanceof MethodErrorPresenterException) {
+ m_errorContent.setPresenterText(e.getMessage());
+ }
+ m_errorContent.setMethod(configurationMethod);
+ setErrorPresenterVisible(true);
+ }
+ ((GridData) m_deleteButton.getLayoutData()).exclude = !configurationMethod.isImplemented();
+ m_deleteButton.setVisible(configurationMethod.isImplemented());
+ m_deleteButton.setToolTipText(Texts.get("RemoveXinY", getMethod().getMethodName(), getMethod().getType().getElementName()));
+ }
+ finally {
+ getContainer().setRedraw(true);
+ getContainer().layout(true, true);
+ }
+ }
+
+ private void setErrorPresenterVisible(boolean visible) {
+ m_body.setVisible(!visible);
+ ((GridData) m_body.getLayoutData()).exclude = visible;
+
+ if (m_errorContent != null) {
+ m_errorContent.setVisible(visible);
+ ((GridData) m_errorContent.getLayoutData()).exclude = !visible;
+ }
+ }
+
+ public ConfigurationMethod getMethod() {
+ return m_configurationMethod;
+ }
+
+ public void setLabelText(String text) {
+ if (!isDisposed()) {
+ m_labelLink.setText(text);
+ }
+ }
+
+ public String getLabelText() {
+ String labelText = null;
+ if (!isDisposed()) {
+ labelText = m_labelLink.getText();
+ }
+ return labelText;
+ }
+
+ @Override
+ public void setEnabled(boolean enabled) {
+ if (!isDisposed()) {
+ if (m_errorContent != null) {
+ m_errorContent.setEnabled(enabled);
+ }
+ m_deleteButton.setEnabled(enabled);
+ }
+ }
+
+ @Override
+ public boolean isEnabled() {
+ if (!isDisposed()) {
+ return m_deleteButton.isEnabled();
+ }
+ return false;
+ }
+
+ protected void handleLabelLinkSelected() {
+ showJavaElementInEditor(getMethod().peekMethod());
+ }
+
+ protected void showJavaElementInEditor(IJavaElement e) {
+ showJavaElementInEditor(e, true);
+ }
+
+ protected void showJavaElementInEditor(IJavaElement e, boolean createNew) {
+ UiUtility.showJavaElementInEditor(e, createNew);
+ }
+
+ protected final String readInitalValue() throws CoreException {
+ try {
+ Matcher m = Regex.REGEX_PROPERTY_METHOD_REPRESENTER_VALUE.matcher(getMethod().peekMethod().getSource());
+ if (m.find()) {
+ return m.group(1);
+ }
+ else {
+ throw new CoreException(new ScoutStatus(getMethod().peekMethod().getSource()));
+ }
+ }
+ catch (JavaModelException e) {
+ ScoutSdkUi.logError(e);
+ return null;
+ }
+ }
+
+ protected static class MethodErrorPresenterException extends CoreException {
+ private static final long serialVersionUID = 1L;
+
+ public MethodErrorPresenterException(IStatus status) {
+ super(status);
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/presenter/single/AbstractProposalPresenter.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/presenter/single/AbstractProposalPresenter.java
index dea98ceb6..ab91171e0 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/presenter/single/AbstractProposalPresenter.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/presenter/single/AbstractProposalPresenter.java
@@ -1,162 +1,162 @@
-/*******************************************************************************
- * 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.view.properties.presenter.single;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.scout.commons.OptimisticLock;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.operation.method.ScoutMethodDeleteOperation;
-import org.eclipse.scout.sdk.ui.action.LegacyOperationAction;
-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.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.view.properties.PropertyViewFormToolkit;
-import org.eclipse.scout.sdk.workspace.type.config.ConfigurationMethod;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Menu;
-
-/**
- * <h3>AbstractProposalPresenter</h3> ...
- */
-@SuppressWarnings("deprecation")
-public abstract class AbstractProposalPresenter<T extends Object> extends AbstractMethodPresenter {
-
- private ProposalTextField m_proposalField;
- private T m_currentSourceValue;
- private T m_defaultValue;
- private OptimisticLock storeValueLock = new OptimisticLock();
-
- public AbstractProposalPresenter(PropertyViewFormToolkit toolkit, Composite parent) {
- super(toolkit, parent);
- }
-
- @Override
- protected Control createContent(Composite container) {
- m_proposalField = getToolkit().createProposalField(container, "", ProposalTextField.STYLE_NO_LABEL);
- createProposalFieldProviders(m_proposalField);
- m_proposalField.setEnabled(false);
- P_ProposalFieldListener listener = new P_ProposalFieldListener();
- m_proposalField.addProposalAdapterListener(listener);
- MenuManager manager = new MenuManager();
- Menu menu = manager.createContextMenu(m_proposalField);
- manager.addMenuListener(new IMenuListener() {
- @Override
- public void menuAboutToShow(IMenuManager managerInside) {
- managerInside.removeAll();
- createContextMenu((MenuManager) managerInside);
- }
- });
- m_proposalField.setMenu(menu);
- return m_proposalField;
- }
-
- /**
- * @param proposalField
- */
- protected abstract void createProposalFieldProviders(ProposalTextField proposalField);
-
- @Override
- public void setEnabled(boolean enabled) {
- if (!isDisposed()) {
- m_proposalField.setEnabled(enabled);
- }
- super.setEnabled(enabled);
- }
-
- @Override
- public boolean isEnabled() {
- if (!isDisposed()) {
- return m_proposalField.getEnabled() && super.isEnabled();
- }
- return false;
- }
-
- @Override
- protected void init(ConfigurationMethod method) throws CoreException {
- super.init(method);
- m_defaultValue = parseInput(getMethod().computeDefaultValue());
- setCurrentSourceValue(parseInput(getMethod().computeValue()));
- try {
- storeValueLock.acquire();
- if (getCurrentSourceValue() != null) {
- m_proposalField.acceptProposal(getCurrentSourceValue());
- }
- else {
- m_proposalField.setText("");
- }
- m_proposalField.setEnabled(true);
- }
- finally {
- storeValueLock.release();
- }
- }
-
- /**
- * @param input
- * the source string
- * @return the value represented by the input string
- * @throws CoreException
- * when the input could not be parsed.
- */
- protected abstract T parseInput(String input) throws CoreException;
-
- /**
- * to store the value in the source file.
- *
- * @param value
- * can be null
- */
- protected abstract void storeValue(T value);
-
- public T getCurrentSourceValue() {
- return m_currentSourceValue;
- }
-
- public void setCurrentSourceValue(T value) {
- m_currentSourceValue = value;
- }
-
- public T getDefaultValue() {
- return m_defaultValue;
- }
-
- public ProposalTextField getProposalField() {
- return m_proposalField;
- }
-
- protected void createContextMenu(MenuManager manager) {
- if (getMethod().isImplemented()) {
- manager.add(new LegacyOperationAction(Texts.get("SetDefaultValue"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.StatusInfo), new ScoutMethodDeleteOperation(getMethod().peekMethod())));
- }
- }
-
- private class P_ProposalFieldListener implements IProposalAdapterListener {
- @Override
- @SuppressWarnings("unchecked")
- public void proposalAccepted(ContentProposalEvent event) {
- setCurrentSourceValue((T) event.proposal);
- try {
- if (storeValueLock.acquire()) {
- storeValue(getCurrentSourceValue());
- }
- }
- finally {
- storeValueLock.release();
- }
- }
-
- } // end class P_TextListener
-}
+/*******************************************************************************
+ * 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.view.properties.presenter.single;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.scout.commons.OptimisticLock;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.operation.method.ScoutMethodDeleteOperation;
+import org.eclipse.scout.sdk.ui.action.LegacyOperationAction;
+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.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.view.properties.PropertyViewFormToolkit;
+import org.eclipse.scout.sdk.workspace.type.config.ConfigurationMethod;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Menu;
+
+/**
+ * <h3>AbstractProposalPresenter</h3> ...
+ */
+@SuppressWarnings("deprecation")
+public abstract class AbstractProposalPresenter<T extends Object> extends AbstractMethodPresenter {
+
+ private ProposalTextField m_proposalField;
+ private T m_currentSourceValue;
+ private T m_defaultValue;
+ private OptimisticLock storeValueLock = new OptimisticLock();
+
+ public AbstractProposalPresenter(PropertyViewFormToolkit toolkit, Composite parent) {
+ super(toolkit, parent);
+ }
+
+ @Override
+ protected Control createContent(Composite container) {
+ m_proposalField = getToolkit().createProposalField(container, "", ProposalTextField.STYLE_NO_LABEL);
+ createProposalFieldProviders(m_proposalField);
+ m_proposalField.setEnabled(false);
+ P_ProposalFieldListener listener = new P_ProposalFieldListener();
+ m_proposalField.addProposalAdapterListener(listener);
+ MenuManager manager = new MenuManager();
+ Menu menu = manager.createContextMenu(m_proposalField);
+ manager.addMenuListener(new IMenuListener() {
+ @Override
+ public void menuAboutToShow(IMenuManager managerInside) {
+ managerInside.removeAll();
+ createContextMenu((MenuManager) managerInside);
+ }
+ });
+ m_proposalField.setMenu(menu);
+ return m_proposalField;
+ }
+
+ /**
+ * @param proposalField
+ */
+ protected abstract void createProposalFieldProviders(ProposalTextField proposalField);
+
+ @Override
+ public void setEnabled(boolean enabled) {
+ if (!isDisposed()) {
+ m_proposalField.setEnabled(enabled);
+ }
+ super.setEnabled(enabled);
+ }
+
+ @Override
+ public boolean isEnabled() {
+ if (!isDisposed()) {
+ return m_proposalField.getEnabled() && super.isEnabled();
+ }
+ return false;
+ }
+
+ @Override
+ protected void init(ConfigurationMethod method) throws CoreException {
+ super.init(method);
+ m_defaultValue = parseInput(getMethod().computeDefaultValue());
+ setCurrentSourceValue(parseInput(getMethod().computeValue()));
+ try {
+ storeValueLock.acquire();
+ if (getCurrentSourceValue() != null) {
+ m_proposalField.acceptProposal(getCurrentSourceValue());
+ }
+ else {
+ m_proposalField.setText("");
+ }
+ m_proposalField.setEnabled(true);
+ }
+ finally {
+ storeValueLock.release();
+ }
+ }
+
+ /**
+ * @param input
+ * the source string
+ * @return the value represented by the input string
+ * @throws CoreException
+ * when the input could not be parsed.
+ */
+ protected abstract T parseInput(String input) throws CoreException;
+
+ /**
+ * to store the value in the source file.
+ *
+ * @param value
+ * can be null
+ */
+ protected abstract void storeValue(T value);
+
+ public T getCurrentSourceValue() {
+ return m_currentSourceValue;
+ }
+
+ public void setCurrentSourceValue(T value) {
+ m_currentSourceValue = value;
+ }
+
+ public T getDefaultValue() {
+ return m_defaultValue;
+ }
+
+ public ProposalTextField getProposalField() {
+ return m_proposalField;
+ }
+
+ protected void createContextMenu(MenuManager manager) {
+ if (getMethod().isImplemented()) {
+ manager.add(new LegacyOperationAction(Texts.get("SetDefaultValue"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.StatusInfo), new ScoutMethodDeleteOperation(getMethod().peekMethod())));
+ }
+ }
+
+ private class P_ProposalFieldListener implements IProposalAdapterListener {
+ @Override
+ @SuppressWarnings("unchecked")
+ public void proposalAccepted(ContentProposalEvent event) {
+ setCurrentSourceValue((T) event.proposal);
+ try {
+ if (storeValueLock.acquire()) {
+ storeValue(getCurrentSourceValue());
+ }
+ }
+ finally {
+ storeValueLock.release();
+ }
+ }
+
+ } // end class P_TextListener
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/presenter/single/AbstractTypeProposalPresenter.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/presenter/single/AbstractTypeProposalPresenter.java
index 2121bbefe..4d025336d 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/presenter/single/AbstractTypeProposalPresenter.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/presenter/single/AbstractTypeProposalPresenter.java
@@ -1,89 +1,89 @@
-/*******************************************************************************
- * 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.view.properties.presenter.single;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.core.IMethod;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.Signature;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.jobs.OperationJob;
-import org.eclipse.scout.sdk.operation.ConfigPropertyMethodUpdateOperation;
-import org.eclipse.scout.sdk.operation.IOperation;
-import org.eclipse.scout.sdk.operation.method.ScoutMethodDeleteOperation;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.util.UiUtility;
-import org.eclipse.scout.sdk.ui.view.properties.PropertyViewFormToolkit;
-import org.eclipse.scout.sdk.util.signature.IImportValidator;
-import org.eclipse.scout.sdk.util.signature.SignatureUtility;
-import org.eclipse.scout.sdk.workspace.type.config.PropertyMethodSourceUtility;
-import org.eclipse.swt.widgets.Composite;
-
-public abstract class AbstractTypeProposalPresenter extends AbstractProposalPresenter<IType> {
-
- public AbstractTypeProposalPresenter(PropertyViewFormToolkit toolkit, Composite parent) {
- super(toolkit, parent);
- }
-
- @Override
- protected IType parseInput(String input) throws CoreException {
- IType referedType = PropertyMethodSourceUtility.parseReturnParameterClass(input, getMethod().peekMethod());
- return referedType;
- }
-
- @Override
- protected synchronized void storeValue(final IType value) {
- IOperation op = null;
- if (UiUtility.equals(getDefaultValue(), value)) {
- if (getMethod().isImplemented()) {
- op = new ScoutMethodDeleteOperation(getMethod().peekMethod());
- }
- }
- else {
- op = new ConfigPropertyMethodUpdateOperation(getMethod().getType(), getMethod().getMethodName()) {
- @Override
- protected String createMethodBody(IMethod methodToOverride, IImportValidator validator) throws JavaModelException {
- StringBuilder source = new StringBuilder();
- source.append(" return ");
- if (value != null) {
- source.append(SignatureUtility.getTypeReference(Signature.createTypeSignature(value.getFullyQualifiedName(), true), validator) + ".class;");
- }
- else {
- source.append("null;");
- }
- return source.toString();
- }
- };
- ((ConfigPropertyMethodUpdateOperation) op).setFormatSource(true);
- }
- new OperationJob(op).schedule();
- }
-
- @Override
- protected void createContextMenu(MenuManager manager) {
- super.createContextMenu(manager);
- if (getCurrentSourceValue() != null) {
- final IType t = getCurrentSourceValue();
- if (t != null) {
- manager.add(new Action(Texts.get("GoTo") + t.getElementName(), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.StatusInfo)) {
- @Override
- public void run() {
- showJavaElementInEditor(t);
- }
- });
- }
- }
- }
-
-}
+/*******************************************************************************
+ * 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.view.properties.presenter.single;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.Signature;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.jobs.OperationJob;
+import org.eclipse.scout.sdk.operation.ConfigPropertyMethodUpdateOperation;
+import org.eclipse.scout.sdk.operation.IOperation;
+import org.eclipse.scout.sdk.operation.method.ScoutMethodDeleteOperation;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.util.UiUtility;
+import org.eclipse.scout.sdk.ui.view.properties.PropertyViewFormToolkit;
+import org.eclipse.scout.sdk.util.signature.IImportValidator;
+import org.eclipse.scout.sdk.util.signature.SignatureUtility;
+import org.eclipse.scout.sdk.workspace.type.config.PropertyMethodSourceUtility;
+import org.eclipse.swt.widgets.Composite;
+
+public abstract class AbstractTypeProposalPresenter extends AbstractProposalPresenter<IType> {
+
+ public AbstractTypeProposalPresenter(PropertyViewFormToolkit toolkit, Composite parent) {
+ super(toolkit, parent);
+ }
+
+ @Override
+ protected IType parseInput(String input) throws CoreException {
+ IType referedType = PropertyMethodSourceUtility.parseReturnParameterClass(input, getMethod().peekMethod());
+ return referedType;
+ }
+
+ @Override
+ protected synchronized void storeValue(final IType value) {
+ IOperation op = null;
+ if (UiUtility.equals(getDefaultValue(), value)) {
+ if (getMethod().isImplemented()) {
+ op = new ScoutMethodDeleteOperation(getMethod().peekMethod());
+ }
+ }
+ else {
+ op = new ConfigPropertyMethodUpdateOperation(getMethod().getType(), getMethod().getMethodName()) {
+ @Override
+ protected String createMethodBody(IMethod methodToOverride, IImportValidator validator) throws JavaModelException {
+ StringBuilder source = new StringBuilder();
+ source.append(" return ");
+ if (value != null) {
+ source.append(SignatureUtility.getTypeReference(Signature.createTypeSignature(value.getFullyQualifiedName(), true), validator) + ".class;");
+ }
+ else {
+ source.append("null;");
+ }
+ return source.toString();
+ }
+ };
+ ((ConfigPropertyMethodUpdateOperation) op).setFormatSource(true);
+ }
+ new OperationJob(op).schedule();
+ }
+
+ @Override
+ protected void createContextMenu(MenuManager manager) {
+ super.createContextMenu(manager);
+ if (getCurrentSourceValue() != null) {
+ final IType t = getCurrentSourceValue();
+ if (t != null) {
+ manager.add(new Action(Texts.get("GoTo") + t.getElementName(), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.StatusInfo)) {
+ @Override
+ public void run() {
+ showJavaElementInEditor(t);
+ }
+ });
+ }
+ }
+ }
+
+}
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 91bb10cfb..ada267f58 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
@@ -1,220 +1,220 @@
-/*******************************************************************************
- * 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.view.properties.presenter.single;
-
-import java.util.regex.Pattern;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.scout.commons.CompareUtility;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.operation.method.ScoutMethodDeleteOperation;
-import org.eclipse.scout.sdk.ui.action.LegacyOperationAction;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.view.properties.PropertyViewFormToolkit;
-import org.eclipse.scout.sdk.workspace.type.config.ConfigurationMethod;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.Text;
-
-/**
- * <h3>AbstractValuePresenter</h3> ...
- */
-@SuppressWarnings("deprecation")
-public abstract class AbstractValuePresenter<T> extends AbstractMethodPresenter {
-
- private Text m_textComponent;
- private final String m_regexAllowedCharacters;
- private T m_currentSourceValue;
- private T m_defaultValue;
-
- public AbstractValuePresenter(PropertyViewFormToolkit toolkit, Composite parent, String regexAllowedCharacters) {
- super(toolkit, parent);
- m_regexAllowedCharacters = regexAllowedCharacters;
- }
-
- @Override
- protected Control createContent(Composite container) {
- m_textComponent = getToolkit().createText(container, "", SWT.BORDER | getTextAlignment() | (isMultiLine() ? SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL : 0));
- m_textComponent.setEnabled(false);
- P_TextListener listener = new P_TextListener();
- m_textComponent.addListener(SWT.FocusIn, listener);
- m_textComponent.addListener(SWT.FocusOut, listener);
- m_textComponent.addListener(SWT.Verify, listener);
- MenuManager manager = new MenuManager();
- manager.setRemoveAllWhenShown(true);
- Menu menu = manager.createContextMenu(m_textComponent);
- manager.addMenuListener(new IMenuListener() {
- @Override
- public void menuAboutToShow(IMenuManager managerInside) {
- managerInside.removeAll();
- createContextMenu((MenuManager) managerInside);
- }
- });
- m_textComponent.setMenu(menu);
- return m_textComponent;
- }
-
- @Override
- public void setEnabled(boolean enabled) {
- if (!isDisposed()) {
- m_textComponent.setEnabled(enabled);
- }
- super.setEnabled(enabled);
- }
-
- @Override
- public boolean isEnabled() {
- if (!isDisposed()) {
- return m_textComponent.getEnabled() && super.isEnabled();
- }
- return false;
- }
-
- @Override
- protected void init(ConfigurationMethod method) throws CoreException {
- super.init(method);
- String defValue = getMethod().computeDefaultValue();
- String value = getMethod().computeValue();
- m_defaultValue = parseSourceInput(defValue);
-
- if (CompareUtility.equals(defValue, value)) {
- // if the default value and the value are the same: directly use the already parsed default value.
- setCurrentSourceValue(m_defaultValue);
- }
- else {
- // only parse, if the value is different than the default value.
- setCurrentSourceValue(parseSourceInput(value));
- }
-
- String initialText = formatDisplayValue(getCurrentSourceValue());
- m_textComponent.setText(initialText);
- m_textComponent.setEnabled(true);
-
- }
-
- /**
- * to write the value to the source
- *
- * @param value
- * @return
- * @throws CoreException
- */
- protected abstract String formatSourceValue(T value) throws CoreException;
-
- /**
- * to write the value to the ui component
- *
- * @param value
- * @return
- * @throws CoreException
- */
- protected abstract String formatDisplayValue(T value) throws CoreException;
-
- /**
- * to parse the source input
- *
- * @param input
- * @return
- * @throws CoreException
- */
- protected abstract T parseSourceInput(String input) throws CoreException;
-
- /**
- * to parse the display input
- *
- * @param input
- * @return
- * @throws CoreException
- */
- protected abstract T parseDisplayInput(String input) throws CoreException;
-
- protected abstract void storeValue(T value) throws CoreException;
-
- protected int getTextAlignment() {
- return SWT.LEFT;
- }
-
- protected final void setCurrentSourceValue(T value) {
- if (CompareUtility.notEquals(value, m_currentSourceValue)) {
- m_currentSourceValue = value;
- execCurrentSourceValueChanged(m_currentSourceValue);
- }
- }
-
- protected void execCurrentSourceValueChanged(T value) {
- }
-
- public T getCurrentSourceValue() {
- return m_currentSourceValue;
- }
-
- public T getDefaultValue() {
- return m_defaultValue;
- }
-
- public Text getTextComponent() {
- return m_textComponent;
- }
-
- protected void createContextMenu(MenuManager manager) {
- if (getMethod() != null && getMethod().isImplemented()) {
- manager.add(new LegacyOperationAction(Texts.get("SetDefaultValue"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.StatusInfo), new ScoutMethodDeleteOperation(getMethod().peekMethod())));
- }
- }
-
- private class P_TextListener implements Listener {
- @Override
- public void handleEvent(Event event) {
- switch (event.type) {
- case SWT.Verify:
- if (m_regexAllowedCharacters != null) {
- String string = event.text;
- if (string != null) {
- event.doit = Pattern.matches(m_regexAllowedCharacters, string);
- if (!event.doit) {
- ScoutSdkUi.logInfo("not allowed input: " + string);
- }
- }
- }
- break;
- case SWT.FocusOut:
- String input = getTextComponent().getText();
- try {
- T value = parseDisplayInput(input);
- String displayValue = formatDisplayValue(value);
- getTextComponent().setText(displayValue);
- if (!CompareUtility.equals(value, getCurrentSourceValue())) {
- storeValue(value);
- setCurrentSourceValue(value);
- }
- }
- catch (CoreException e) {
- ScoutSdkUi.logInfo("input is not well formed " + input);
- getTextComponent().setForeground(getTextComponent().getDisplay().getSystemColor(SWT.COLOR_RED));
- }
- break;
- case SWT.FocusIn:
- getTextComponent().setForeground(null);
- break;
-
- default:
- break;
- }
- }
- } // end class P_TextListener
-}
+/*******************************************************************************
+ * 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.view.properties.presenter.single;
+
+import java.util.regex.Pattern;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.scout.commons.CompareUtility;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.operation.method.ScoutMethodDeleteOperation;
+import org.eclipse.scout.sdk.ui.action.LegacyOperationAction;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.view.properties.PropertyViewFormToolkit;
+import org.eclipse.scout.sdk.workspace.type.config.ConfigurationMethod;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * <h3>AbstractValuePresenter</h3> ...
+ */
+@SuppressWarnings("deprecation")
+public abstract class AbstractValuePresenter<T> extends AbstractMethodPresenter {
+
+ private Text m_textComponent;
+ private final String m_regexAllowedCharacters;
+ private T m_currentSourceValue;
+ private T m_defaultValue;
+
+ public AbstractValuePresenter(PropertyViewFormToolkit toolkit, Composite parent, String regexAllowedCharacters) {
+ super(toolkit, parent);
+ m_regexAllowedCharacters = regexAllowedCharacters;
+ }
+
+ @Override
+ protected Control createContent(Composite container) {
+ m_textComponent = getToolkit().createText(container, "", SWT.BORDER | getTextAlignment() | (isMultiLine() ? SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL : 0));
+ m_textComponent.setEnabled(false);
+ P_TextListener listener = new P_TextListener();
+ m_textComponent.addListener(SWT.FocusIn, listener);
+ m_textComponent.addListener(SWT.FocusOut, listener);
+ m_textComponent.addListener(SWT.Verify, listener);
+ MenuManager manager = new MenuManager();
+ manager.setRemoveAllWhenShown(true);
+ Menu menu = manager.createContextMenu(m_textComponent);
+ manager.addMenuListener(new IMenuListener() {
+ @Override
+ public void menuAboutToShow(IMenuManager managerInside) {
+ managerInside.removeAll();
+ createContextMenu((MenuManager) managerInside);
+ }
+ });
+ m_textComponent.setMenu(menu);
+ return m_textComponent;
+ }
+
+ @Override
+ public void setEnabled(boolean enabled) {
+ if (!isDisposed()) {
+ m_textComponent.setEnabled(enabled);
+ }
+ super.setEnabled(enabled);
+ }
+
+ @Override
+ public boolean isEnabled() {
+ if (!isDisposed()) {
+ return m_textComponent.getEnabled() && super.isEnabled();
+ }
+ return false;
+ }
+
+ @Override
+ protected void init(ConfigurationMethod method) throws CoreException {
+ super.init(method);
+ String defValue = getMethod().computeDefaultValue();
+ String value = getMethod().computeValue();
+ m_defaultValue = parseSourceInput(defValue);
+
+ if (CompareUtility.equals(defValue, value)) {
+ // if the default value and the value are the same: directly use the already parsed default value.
+ setCurrentSourceValue(m_defaultValue);
+ }
+ else {
+ // only parse, if the value is different than the default value.
+ setCurrentSourceValue(parseSourceInput(value));
+ }
+
+ String initialText = formatDisplayValue(getCurrentSourceValue());
+ m_textComponent.setText(initialText);
+ m_textComponent.setEnabled(true);
+
+ }
+
+ /**
+ * to write the value to the source
+ *
+ * @param value
+ * @return
+ * @throws CoreException
+ */
+ protected abstract String formatSourceValue(T value) throws CoreException;
+
+ /**
+ * to write the value to the ui component
+ *
+ * @param value
+ * @return
+ * @throws CoreException
+ */
+ protected abstract String formatDisplayValue(T value) throws CoreException;
+
+ /**
+ * to parse the source input
+ *
+ * @param input
+ * @return
+ * @throws CoreException
+ */
+ protected abstract T parseSourceInput(String input) throws CoreException;
+
+ /**
+ * to parse the display input
+ *
+ * @param input
+ * @return
+ * @throws CoreException
+ */
+ protected abstract T parseDisplayInput(String input) throws CoreException;
+
+ protected abstract void storeValue(T value) throws CoreException;
+
+ protected int getTextAlignment() {
+ return SWT.LEFT;
+ }
+
+ protected final void setCurrentSourceValue(T value) {
+ if (CompareUtility.notEquals(value, m_currentSourceValue)) {
+ m_currentSourceValue = value;
+ execCurrentSourceValueChanged(m_currentSourceValue);
+ }
+ }
+
+ protected void execCurrentSourceValueChanged(T value) {
+ }
+
+ public T getCurrentSourceValue() {
+ return m_currentSourceValue;
+ }
+
+ public T getDefaultValue() {
+ return m_defaultValue;
+ }
+
+ public Text getTextComponent() {
+ return m_textComponent;
+ }
+
+ protected void createContextMenu(MenuManager manager) {
+ if (getMethod() != null && getMethod().isImplemented()) {
+ manager.add(new LegacyOperationAction(Texts.get("SetDefaultValue"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.StatusInfo), new ScoutMethodDeleteOperation(getMethod().peekMethod())));
+ }
+ }
+
+ private class P_TextListener implements Listener {
+ @Override
+ public void handleEvent(Event event) {
+ switch (event.type) {
+ case SWT.Verify:
+ if (m_regexAllowedCharacters != null) {
+ String string = event.text;
+ if (string != null) {
+ event.doit = Pattern.matches(m_regexAllowedCharacters, string);
+ if (!event.doit) {
+ ScoutSdkUi.logInfo("not allowed input: " + string);
+ }
+ }
+ }
+ break;
+ case SWT.FocusOut:
+ String input = getTextComponent().getText();
+ try {
+ T value = parseDisplayInput(input);
+ String displayValue = formatDisplayValue(value);
+ getTextComponent().setText(displayValue);
+ if (!CompareUtility.equals(value, getCurrentSourceValue())) {
+ storeValue(value);
+ setCurrentSourceValue(value);
+ }
+ }
+ catch (CoreException e) {
+ ScoutSdkUi.logInfo("input is not well formed " + input);
+ getTextComponent().setForeground(getTextComponent().getDisplay().getSystemColor(SWT.COLOR_RED));
+ }
+ break;
+ case SWT.FocusIn:
+ getTextComponent().setForeground(null);
+ break;
+
+ default:
+ break;
+ }
+ }
+ } // end class P_TextListener
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/presenter/single/ProductLaunchPresenter.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/presenter/single/ProductLaunchPresenter.java
index 240a365e8..a417c6786 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/presenter/single/ProductLaunchPresenter.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/presenter/single/ProductLaunchPresenter.java
@@ -1,467 +1,467 @@
-/*******************************************************************************
- * 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.view.properties.presenter.single;
-
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchListener;
-import org.eclipse.debug.core.ILaunchManager;
-import org.eclipse.jface.dialogs.MessageDialogWithToggle;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.pde.internal.core.iproduct.IConfigurationFileInfo;
-import org.eclipse.pde.internal.core.product.WorkspaceProductModel;
-import org.eclipse.pde.internal.ui.IPDEUIConstants;
-import org.eclipse.pde.ui.launcher.EclipseLaunchShortcut;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.sdk.RuntimeClasses;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.internal.view.properties.model.links.FileOpenLink;
-import org.eclipse.scout.sdk.ui.internal.view.properties.model.links.LinksPresenterModel;
-import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.LinksPresenter;
-import org.eclipse.scout.sdk.ui.view.properties.PropertyViewFormToolkit;
-import org.eclipse.scout.sdk.ui.view.properties.presenter.AbstractPresenter;
-import org.eclipse.scout.sdk.util.pde.ProductFileModelHelper;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.ui.editors.text.EditorsUI;
-import org.eclipse.ui.forms.events.HyperlinkAdapter;
-import org.eclipse.ui.forms.events.HyperlinkEvent;
-import org.eclipse.ui.forms.widgets.ImageHyperlink;
-
-/**
- * <h3>{@link ProductLaunchPresenter}</h3> ...
- *
- * @author Andreas Hoegger
- * @since 1.0.8 31.08.2010
- */
-@SuppressWarnings("restriction")
-public class ProductLaunchPresenter extends AbstractPresenter {
-
- private String m_productName;
- private final IFile m_productFile;
- private final IScoutBundle m_bundle;
-
- // internal
- private ImageHyperlink m_runLink;
- private ImageHyperlink m_debugLink;
- private ImageHyperlink m_stopLink;
- private Group m_mainGroup;
-
- private P_LaunchListener m_launchListener;
- private P_RecomputeLaunchStateJob m_stateUpdateJob;
- private WorkspaceProductModel m_productModel;
-
- private final static Pattern PATTERN = Pattern.compile("name\\s*\\=\\s*(\\\")?([^\\\"]*)\\\"", Pattern.MULTILINE);
- private final static String MAC_OS_X_SWING_WARNING_MESSAGE_KEY = "scoutSwingMacOsXWarningKey";
- private final static String MAC_OS_X_SWT_WARNING_MESSAGE_KEY = "scoutSwtMacOsXWarningKey";
-
- /**
- * @param toolkit
- * @param parent
- */
- public ProductLaunchPresenter(PropertyViewFormToolkit toolkit, Composite parent, IFile productFile, IScoutBundle bundle) {
- super(toolkit, parent);
- m_productFile = productFile;
- m_bundle = bundle;
- String prodName = null;
- String productFileContent = "";
- Matcher m = PATTERN.matcher(productFileContent);
- if (m.find()) {
- prodName = m.group(2);
- }
- if (prodName == null) {
- prodName = productFile.getParent().getName() + " " + productFile.getName();
- }
- m_productName = prodName;
- create(getContainer(), productFile);
- m_launchListener = new P_LaunchListener();
- DebugPlugin.getDefault().getLaunchManager().addLaunchListener(m_launchListener);
- getContainer().addDisposeListener(new DisposeListener() {
- @Override
- public void widgetDisposed(DisposeEvent e) {
- dispose();
- }
- });
- m_stateUpdateJob = new P_RecomputeLaunchStateJob();
- m_stateUpdateJob.schedule();
- }
-
- @Override
- public void dispose() {
- super.dispose();
- if (m_launchListener != null) {
- try {
- DebugPlugin.getDefault().getLaunchManager().removeLaunchListener(m_launchListener);
- m_launchListener = null;
- }
- catch (Exception e) {
- ScoutSdkUi.logError("could not remove launch listener on debug plugin.", e);
- }
- }
- if (m_stateUpdateJob != null) {
- m_stateUpdateJob.m_canceled = true;
- m_stateUpdateJob = null;
- }
- }
-
- /**
- * @param container
- * @param productFile
- */
- protected void create(Composite parent, IFile productFile) {
- m_mainGroup = new Group(parent, SWT.SHADOW_ETCHED_OUT);
- m_mainGroup.setText(productFile.getParent().getName());
-
- Label l = getToolkit().createLabel(m_mainGroup, "");
- switch (getBundle().getType()) {
- case IScoutBundle.BUNDLE_SERVER:
- l.setImage(ScoutSdkUi.getImage(ScoutSdkUi.LauncherServer));
- break;
- case IScoutBundle.BUNDLE_UI_SWING:
- l.setImage(ScoutSdkUi.getImage(ScoutSdkUi.LauncherSwing));
- break;
- case IScoutBundle.BUNDLE_UI_SWT:
- l.setImage(ScoutSdkUi.getImage(ScoutSdkUi.LauncherSwt));
- break;
- // XXX RAP replace by better code
- case 8:
- l.setImage(ScoutSdkUi.getImage(ScoutSdkUi.LauncherRap));
- break;
- }
-
- m_productModel = null;
- try {
- m_productModel = new WorkspaceProductModel(getProductFile(), false);
- m_productModel.load();
- }
- catch (CoreException e) {
- ScoutSdkUi.logWarning("could not load product model of '" + getProductFile() + "'.", e);
- return;
- }
- Control linkPart = createLinkPart(m_mainGroup);
- Control actionPart = createActionPart(m_mainGroup);
-
- //layout
- parent.setLayout(new FillLayout());
- GridLayout layout = new GridLayout(3, false);
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- layout.verticalSpacing = 0;
- layout.horizontalSpacing = 0;
- m_mainGroup.setLayout(layout);
- l.setLayoutData(new GridData(GridData.FILL_VERTICAL));
- linkPart.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL));
- GridData actionPartData = new GridData(GridData.FILL_VERTICAL | GridData.FILL_HORIZONTAL);
- actionPartData.minimumWidth = actionPart.computeSize(SWT.DEFAULT, SWT.DEFAULT).x;
- actionPartData.horizontalAlignment = SWT.RIGHT;
- actionPart.setLayoutData(actionPartData);
- }
-
- protected Control createLinkPart(Composite parent) {
- LinksPresenterModel model = new LinksPresenterModel();
- model.addGlobalLink(new FileOpenLink(getProductFile(), 10, IPDEUIConstants.PRODUCT_EDITOR_ID));
- // find config.ini
- IConfigurationFileInfo info = m_productModel.getProduct().getConfigurationFileInfo();
- if (info != null) {
- String path = info.getPath(Platform.getOS());
- if (path == null) {
- path = info.getPath(null);
- }
- if (!StringUtility.isNullOrEmpty(path)) {
- IFile configIniFile = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(path));
- model.addGlobalLink(new FileOpenLink(configIniFile, 20, EditorsUI.DEFAULT_TEXT_EDITOR_ID));
- }
- }
-
- LinksPresenter presenter = new LinksPresenter(getToolkit(), parent, model);
- return presenter.getContainer();
- }
-
- protected Control createActionPart(Composite parent) {
- Composite container = getToolkit().createComposite(parent);
- m_runLink = getToolkit().createImageHyperlink(container, SWT.NONE);
- m_runLink.setImage(ScoutSdkUi.getImage(ScoutSdkUi.ToolRun));
- m_runLink.setToolTipText(Texts.get("StartProduct"));
- m_runLink.addHyperlinkListener(new HyperlinkAdapter() {
- @Override
- public void linkActivated(HyperlinkEvent e) {
- restartProduct(false);
- }
- });
- m_debugLink = getToolkit().createImageHyperlink(container, SWT.NONE);
- m_debugLink.setToolTipText(Texts.get("StartProductInDebugMode"));
- m_debugLink.setImage(ScoutSdkUi.getImage(ScoutSdkUi.ToolDebug));
- m_debugLink.addHyperlinkListener(new HyperlinkAdapter() {
- @Override
- public void linkActivated(HyperlinkEvent e) {
- restartProduct(true);
- }
- });
- m_stopLink = getToolkit().createImageHyperlink(container, SWT.NONE);
- m_stopLink.setImage(ScoutSdkUi.getImage(ScoutSdkUi.ToolStop));
- m_stopLink.setToolTipText(Texts.get("StopProduct"));
- m_stopLink.setEnabled(false);
- m_stopLink.addHyperlinkListener(new HyperlinkAdapter() {
- @Override
- public void linkActivated(HyperlinkEvent e) {
- stopProduct();
- }
- });
-
- //layout
- GridLayout layout = new GridLayout(1, false);
- layout.horizontalSpacing = 0;
- layout.verticalSpacing = 0;
- layout.marginHeight = 0;
- layout.marginWidth = 0;
-
- container.setLayout(layout);
- GridData layoutData = new GridData(GridData.FILL_BOTH);
-
- m_runLink.setLayoutData(layoutData);
- layoutData = new GridData(GridData.FILL_BOTH);
- m_debugLink.setLayoutData(layoutData);
- layoutData = new GridData(GridData.FILL_BOTH);
- layoutData.heightHint = 16;
- m_stopLink.setLayoutData(layoutData);
- return container;
- }
-
- /**
- * @return the productFile
- */
- public IFile getProductFile() {
- return m_productFile;
- }
-
- /**
- * @return the bundle
- */
- public IScoutBundle getBundle() {
- return m_bundle;
- }
-
- /**
- * @return the productName
- */
- public String getProductName() {
- return m_productName;
- }
-
- private Job startProduct(final boolean debug) {
-
- showMacOsXWarnings();
-
- Job job = new Job("starting '" + getProductName() + "' product...") {
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- try {
- EclipseLaunchShortcut shortCut = new EclipseLaunchShortcut();
- shortCut.launch(new StructuredSelection(m_productFile), (debug) ? (ILaunchManager.DEBUG_MODE) : (ILaunchManager.RUN_MODE));
- }
- catch (Exception e) {
- ScoutSdkUi.logError("could not start product '" + getProductFile().getName() + "'", e);
- }
- return Status.OK_STATUS;
- }
- };
- job.setUser(false);
- job.setRule(getProductFile());
- job.schedule();
- return job;
- }
-
- private void showMacOsXWarnings() {
- if (Platform.OS_MACOSX.equals(Platform.getOS())) {
- try {
- IPreferenceStore store = ScoutSdkUi.getDefault().getPreferenceStore();
- ProductFileModelHelper pfmh = new ProductFileModelHelper(m_productFile);
- if (pfmh.ProductFile.existsDependency(RuntimeClasses.ScoutUiSwingBundleId)) {
- // it is a swing product to be launched on Mac OS X: show warning
- String doNotShowAgainString = store.getString(MAC_OS_X_SWING_WARNING_MESSAGE_KEY);
- boolean doNotShowAgain = MessageDialogWithToggle.ALWAYS.equals(doNotShowAgainString);
- if (!doNotShowAgain) {
- // Swing only runs when the java process is running in 32bit mode.
- // therefore: if we detect a 64bit process, we add a parameter to switch to 32bit mode for the swing client.
- String x64AddMessage = "";
- if (Platform.ARCH_X86_64.equals(Platform.getOSArch())) {
- x64AddMessage = "\n - add '-d32'";
- }
- MessageDialogWithToggle.openWarning(ScoutSdkUi.getShell(), Texts.get("MacOsXSwingWarningTitle"), Texts.get("MacOsXSwingWarningMessage", x64AddMessage),
- Texts.get("DoNotShowAgain"), false, store, MAC_OS_X_SWING_WARNING_MESSAGE_KEY);
- }
- }
- else if (pfmh.ProductFile.existsDependency(RuntimeClasses.ScoutUiSwtBundleId)) {
- // it is a SWT product to be launched on Mac OS X: show warning
- String doNotShowAgainString = store.getString(MAC_OS_X_SWT_WARNING_MESSAGE_KEY);
- boolean doNotShowAgain = MessageDialogWithToggle.ALWAYS.equals(doNotShowAgainString);
- if (!doNotShowAgain) {
- // that the SWT binaries can be loaded, the arch of the process must match the arch of the binaries.
- // Even a 32bit process is running it might be that the JRE is a 64bit JRE. In that case a 64bit process would be created by default.
- // To correct that, we add the 32bit switch for that case so that the JRE works in the same mode as the running eclipse.
- String x86AddMessage = "";
- if (Platform.ARCH_X86.equals(Platform.getOSArch())) {
- x86AddMessage = "\n- Add '-d32' to the 'VM arguments' box (only when using an Apple JRE).";
- }
-
- MessageDialogWithToggle.openWarning(ScoutSdkUi.getShell(), Texts.get("MacOsXSwtWarningTitle"), Texts.get("MacOsXSwtWarningMessage", x86AddMessage),
- Texts.get("DoNotShowAgain"), false, store, MAC_OS_X_SWT_WARNING_MESSAGE_KEY);
- }
- }
- }
- catch (CoreException e) {
- ScoutSdkUi.logError(e);
- }
- }
- }
-
- private Job stopProduct() {
- Job job = new Job("stopping '" + getProductName() + "' product...") {
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- try {
- ILaunchManager lm = DebugPlugin.getDefault().getLaunchManager();
- for (ILaunch l : lm.getLaunches()) {
- ILaunchConfiguration lc = l.getLaunchConfiguration();
- if (getProductFile().getName().equals(lc.getName())) {
- l.terminate();
- for (int i = 0; i < 50; i++) {
- if (l.isTerminated()) {
- break;
- }
- else {
- Thread.sleep(100);
- }
- }
- recomputeLaunchState();
- break;
- }
- }
- }
- catch (Exception e) {
- ScoutSdkUi.logError("could not stop product '" + getProductFile().getName() + "'", e);
- }
- return Status.OK_STATUS;
- }
- };
- job.setUser(false);
- job.setRule(getProductFile());
- job.schedule();
- return job;
- }
-
- private void restartProduct(boolean debug) {
- Job stopJob = stopProduct();
- try {
- stopJob.join();
- startProduct(debug);
- }
- catch (InterruptedException e) {
- ScoutSdkUi.logError("error during stopping product '" + getProductName() + "'", e);
- }
- }
-
- private void recomputeLaunchState() {
- if (getContainer() != null && !getContainer().isDisposed()) {
- getContainer().getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- ILaunch[] launches = DebugPlugin.getDefault().getLaunchManager().getLaunches();
- for (ILaunch l : launches) {
- if (l.getLaunchConfiguration().getName().equals(getProductFile().getName())) {
- if (!m_stopLink.isDisposed() && !m_mainGroup.isDisposed()) {
- if (l.isTerminated()) {
- m_stopLink.setEnabled(false);
- m_mainGroup.setText(getProductFile().getParent().getName());
- }
- else {
- m_stopLink.setEnabled(true);
- if (l.getLaunchMode().equals(ILaunchManager.DEBUG_MODE)) {
- m_mainGroup.setText(getProductFile().getParent().getName() + " - " + Texts.get("debugging") + "...");
- }
- else if (l.getLaunchMode().equals(ILaunchManager.RUN_MODE)) {
- m_mainGroup.setText(getProductFile().getParent().getName() + " - " + Texts.get("Running") + "...");
- }
- else {
- m_mainGroup.setText(getProductFile().getParent().getName() + " - " + Texts.get("UndefinedState") + "...");
- }
- }
- }
- }
- }
- }
- });
- }
- }
-
- private class P_LaunchListener implements ILaunchListener {
- @Override
- public void launchAdded(ILaunch launch) {
- recomputeLaunchState();
- }
-
- @Override
- public void launchChanged(ILaunch launch) {
- recomputeLaunchState();
- }
-
- @Override
- public void launchRemoved(ILaunch launch) {
- recomputeLaunchState();
- }
- } // end class P_LaunchListener
-
- private class P_RecomputeLaunchStateJob extends Job {
-
- private boolean m_canceled = false;
-
- public P_RecomputeLaunchStateJob() {
- super("");
- setSystem(true);
- setPriority(Job.DECORATE);
- setRule(getProductFile());
- }
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- if (!m_canceled) {
- recomputeLaunchState();
- schedule(2500);
- }
- return Status.OK_STATUS;
- }
- } // end class P_RecomputeLaunchStateJob
-
-}
+/*******************************************************************************
+ * 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.view.properties.presenter.single;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchListener;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.jface.dialogs.MessageDialogWithToggle;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.pde.internal.core.iproduct.IConfigurationFileInfo;
+import org.eclipse.pde.internal.core.product.WorkspaceProductModel;
+import org.eclipse.pde.internal.ui.IPDEUIConstants;
+import org.eclipse.pde.ui.launcher.EclipseLaunchShortcut;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.sdk.RuntimeClasses;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.internal.view.properties.model.links.FileOpenLink;
+import org.eclipse.scout.sdk.ui.internal.view.properties.model.links.LinksPresenterModel;
+import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.LinksPresenter;
+import org.eclipse.scout.sdk.ui.view.properties.PropertyViewFormToolkit;
+import org.eclipse.scout.sdk.ui.view.properties.presenter.AbstractPresenter;
+import org.eclipse.scout.sdk.util.pde.ProductFileModelHelper;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.editors.text.EditorsUI;
+import org.eclipse.ui.forms.events.HyperlinkAdapter;
+import org.eclipse.ui.forms.events.HyperlinkEvent;
+import org.eclipse.ui.forms.widgets.ImageHyperlink;
+
+/**
+ * <h3>{@link ProductLaunchPresenter}</h3> ...
+ *
+ * @author Andreas Hoegger
+ * @since 1.0.8 31.08.2010
+ */
+@SuppressWarnings("restriction")
+public class ProductLaunchPresenter extends AbstractPresenter {
+
+ private String m_productName;
+ private final IFile m_productFile;
+ private final IScoutBundle m_bundle;
+
+ // internal
+ private ImageHyperlink m_runLink;
+ private ImageHyperlink m_debugLink;
+ private ImageHyperlink m_stopLink;
+ private Group m_mainGroup;
+
+ private P_LaunchListener m_launchListener;
+ private P_RecomputeLaunchStateJob m_stateUpdateJob;
+ private WorkspaceProductModel m_productModel;
+
+ private final static Pattern PATTERN = Pattern.compile("name\\s*\\=\\s*(\\\")?([^\\\"]*)\\\"", Pattern.MULTILINE);
+ private final static String MAC_OS_X_SWING_WARNING_MESSAGE_KEY = "scoutSwingMacOsXWarningKey";
+ private final static String MAC_OS_X_SWT_WARNING_MESSAGE_KEY = "scoutSwtMacOsXWarningKey";
+
+ /**
+ * @param toolkit
+ * @param parent
+ */
+ public ProductLaunchPresenter(PropertyViewFormToolkit toolkit, Composite parent, IFile productFile, IScoutBundle bundle) {
+ super(toolkit, parent);
+ m_productFile = productFile;
+ m_bundle = bundle;
+ String prodName = null;
+ String productFileContent = "";
+ Matcher m = PATTERN.matcher(productFileContent);
+ if (m.find()) {
+ prodName = m.group(2);
+ }
+ if (prodName == null) {
+ prodName = productFile.getParent().getName() + " " + productFile.getName();
+ }
+ m_productName = prodName;
+ create(getContainer(), productFile);
+ m_launchListener = new P_LaunchListener();
+ DebugPlugin.getDefault().getLaunchManager().addLaunchListener(m_launchListener);
+ getContainer().addDisposeListener(new DisposeListener() {
+ @Override
+ public void widgetDisposed(DisposeEvent e) {
+ dispose();
+ }
+ });
+ m_stateUpdateJob = new P_RecomputeLaunchStateJob();
+ m_stateUpdateJob.schedule();
+ }
+
+ @Override
+ public void dispose() {
+ super.dispose();
+ if (m_launchListener != null) {
+ try {
+ DebugPlugin.getDefault().getLaunchManager().removeLaunchListener(m_launchListener);
+ m_launchListener = null;
+ }
+ catch (Exception e) {
+ ScoutSdkUi.logError("could not remove launch listener on debug plugin.", e);
+ }
+ }
+ if (m_stateUpdateJob != null) {
+ m_stateUpdateJob.m_canceled = true;
+ m_stateUpdateJob = null;
+ }
+ }
+
+ /**
+ * @param container
+ * @param productFile
+ */
+ protected void create(Composite parent, IFile productFile) {
+ m_mainGroup = new Group(parent, SWT.SHADOW_ETCHED_OUT);
+ m_mainGroup.setText(productFile.getParent().getName());
+
+ Label l = getToolkit().createLabel(m_mainGroup, "");
+ switch (getBundle().getType()) {
+ case IScoutBundle.BUNDLE_SERVER:
+ l.setImage(ScoutSdkUi.getImage(ScoutSdkUi.LauncherServer));
+ break;
+ case IScoutBundle.BUNDLE_UI_SWING:
+ l.setImage(ScoutSdkUi.getImage(ScoutSdkUi.LauncherSwing));
+ break;
+ case IScoutBundle.BUNDLE_UI_SWT:
+ l.setImage(ScoutSdkUi.getImage(ScoutSdkUi.LauncherSwt));
+ break;
+ // XXX RAP replace by better code
+ case 8:
+ l.setImage(ScoutSdkUi.getImage(ScoutSdkUi.LauncherRap));
+ break;
+ }
+
+ m_productModel = null;
+ try {
+ m_productModel = new WorkspaceProductModel(getProductFile(), false);
+ m_productModel.load();
+ }
+ catch (CoreException e) {
+ ScoutSdkUi.logWarning("could not load product model of '" + getProductFile() + "'.", e);
+ return;
+ }
+ Control linkPart = createLinkPart(m_mainGroup);
+ Control actionPart = createActionPart(m_mainGroup);
+
+ //layout
+ parent.setLayout(new FillLayout());
+ GridLayout layout = new GridLayout(3, false);
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ layout.verticalSpacing = 0;
+ layout.horizontalSpacing = 0;
+ m_mainGroup.setLayout(layout);
+ l.setLayoutData(new GridData(GridData.FILL_VERTICAL));
+ linkPart.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL));
+ GridData actionPartData = new GridData(GridData.FILL_VERTICAL | GridData.FILL_HORIZONTAL);
+ actionPartData.minimumWidth = actionPart.computeSize(SWT.DEFAULT, SWT.DEFAULT).x;
+ actionPartData.horizontalAlignment = SWT.RIGHT;
+ actionPart.setLayoutData(actionPartData);
+ }
+
+ protected Control createLinkPart(Composite parent) {
+ LinksPresenterModel model = new LinksPresenterModel();
+ model.addGlobalLink(new FileOpenLink(getProductFile(), 10, IPDEUIConstants.PRODUCT_EDITOR_ID));
+ // find config.ini
+ IConfigurationFileInfo info = m_productModel.getProduct().getConfigurationFileInfo();
+ if (info != null) {
+ String path = info.getPath(Platform.getOS());
+ if (path == null) {
+ path = info.getPath(null);
+ }
+ if (!StringUtility.isNullOrEmpty(path)) {
+ IFile configIniFile = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(path));
+ model.addGlobalLink(new FileOpenLink(configIniFile, 20, EditorsUI.DEFAULT_TEXT_EDITOR_ID));
+ }
+ }
+
+ LinksPresenter presenter = new LinksPresenter(getToolkit(), parent, model);
+ return presenter.getContainer();
+ }
+
+ protected Control createActionPart(Composite parent) {
+ Composite container = getToolkit().createComposite(parent);
+ m_runLink = getToolkit().createImageHyperlink(container, SWT.NONE);
+ m_runLink.setImage(ScoutSdkUi.getImage(ScoutSdkUi.ToolRun));
+ m_runLink.setToolTipText(Texts.get("StartProduct"));
+ m_runLink.addHyperlinkListener(new HyperlinkAdapter() {
+ @Override
+ public void linkActivated(HyperlinkEvent e) {
+ restartProduct(false);
+ }
+ });
+ m_debugLink = getToolkit().createImageHyperlink(container, SWT.NONE);
+ m_debugLink.setToolTipText(Texts.get("StartProductInDebugMode"));
+ m_debugLink.setImage(ScoutSdkUi.getImage(ScoutSdkUi.ToolDebug));
+ m_debugLink.addHyperlinkListener(new HyperlinkAdapter() {
+ @Override
+ public void linkActivated(HyperlinkEvent e) {
+ restartProduct(true);
+ }
+ });
+ m_stopLink = getToolkit().createImageHyperlink(container, SWT.NONE);
+ m_stopLink.setImage(ScoutSdkUi.getImage(ScoutSdkUi.ToolStop));
+ m_stopLink.setToolTipText(Texts.get("StopProduct"));
+ m_stopLink.setEnabled(false);
+ m_stopLink.addHyperlinkListener(new HyperlinkAdapter() {
+ @Override
+ public void linkActivated(HyperlinkEvent e) {
+ stopProduct();
+ }
+ });
+
+ //layout
+ GridLayout layout = new GridLayout(1, false);
+ layout.horizontalSpacing = 0;
+ layout.verticalSpacing = 0;
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+
+ container.setLayout(layout);
+ GridData layoutData = new GridData(GridData.FILL_BOTH);
+
+ m_runLink.setLayoutData(layoutData);
+ layoutData = new GridData(GridData.FILL_BOTH);
+ m_debugLink.setLayoutData(layoutData);
+ layoutData = new GridData(GridData.FILL_BOTH);
+ layoutData.heightHint = 16;
+ m_stopLink.setLayoutData(layoutData);
+ return container;
+ }
+
+ /**
+ * @return the productFile
+ */
+ public IFile getProductFile() {
+ return m_productFile;
+ }
+
+ /**
+ * @return the bundle
+ */
+ public IScoutBundle getBundle() {
+ return m_bundle;
+ }
+
+ /**
+ * @return the productName
+ */
+ public String getProductName() {
+ return m_productName;
+ }
+
+ private Job startProduct(final boolean debug) {
+
+ showMacOsXWarnings();
+
+ Job job = new Job("starting '" + getProductName() + "' product...") {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ EclipseLaunchShortcut shortCut = new EclipseLaunchShortcut();
+ shortCut.launch(new StructuredSelection(m_productFile), (debug) ? (ILaunchManager.DEBUG_MODE) : (ILaunchManager.RUN_MODE));
+ }
+ catch (Exception e) {
+ ScoutSdkUi.logError("could not start product '" + getProductFile().getName() + "'", e);
+ }
+ return Status.OK_STATUS;
+ }
+ };
+ job.setUser(false);
+ job.setRule(getProductFile());
+ job.schedule();
+ return job;
+ }
+
+ private void showMacOsXWarnings() {
+ if (Platform.OS_MACOSX.equals(Platform.getOS())) {
+ try {
+ IPreferenceStore store = ScoutSdkUi.getDefault().getPreferenceStore();
+ ProductFileModelHelper pfmh = new ProductFileModelHelper(m_productFile);
+ if (pfmh.ProductFile.existsDependency(RuntimeClasses.ScoutUiSwingBundleId)) {
+ // it is a swing product to be launched on Mac OS X: show warning
+ String doNotShowAgainString = store.getString(MAC_OS_X_SWING_WARNING_MESSAGE_KEY);
+ boolean doNotShowAgain = MessageDialogWithToggle.ALWAYS.equals(doNotShowAgainString);
+ if (!doNotShowAgain) {
+ // Swing only runs when the java process is running in 32bit mode.
+ // therefore: if we detect a 64bit process, we add a parameter to switch to 32bit mode for the swing client.
+ String x64AddMessage = "";
+ if (Platform.ARCH_X86_64.equals(Platform.getOSArch())) {
+ x64AddMessage = "\n - add '-d32'";
+ }
+ MessageDialogWithToggle.openWarning(ScoutSdkUi.getShell(), Texts.get("MacOsXSwingWarningTitle"), Texts.get("MacOsXSwingWarningMessage", x64AddMessage),
+ Texts.get("DoNotShowAgain"), false, store, MAC_OS_X_SWING_WARNING_MESSAGE_KEY);
+ }
+ }
+ else if (pfmh.ProductFile.existsDependency(RuntimeClasses.ScoutUiSwtBundleId)) {
+ // it is a SWT product to be launched on Mac OS X: show warning
+ String doNotShowAgainString = store.getString(MAC_OS_X_SWT_WARNING_MESSAGE_KEY);
+ boolean doNotShowAgain = MessageDialogWithToggle.ALWAYS.equals(doNotShowAgainString);
+ if (!doNotShowAgain) {
+ // that the SWT binaries can be loaded, the arch of the process must match the arch of the binaries.
+ // Even a 32bit process is running it might be that the JRE is a 64bit JRE. In that case a 64bit process would be created by default.
+ // To correct that, we add the 32bit switch for that case so that the JRE works in the same mode as the running eclipse.
+ String x86AddMessage = "";
+ if (Platform.ARCH_X86.equals(Platform.getOSArch())) {
+ x86AddMessage = "\n- Add '-d32' to the 'VM arguments' box (only when using an Apple JRE).";
+ }
+
+ MessageDialogWithToggle.openWarning(ScoutSdkUi.getShell(), Texts.get("MacOsXSwtWarningTitle"), Texts.get("MacOsXSwtWarningMessage", x86AddMessage),
+ Texts.get("DoNotShowAgain"), false, store, MAC_OS_X_SWT_WARNING_MESSAGE_KEY);
+ }
+ }
+ }
+ catch (CoreException e) {
+ ScoutSdkUi.logError(e);
+ }
+ }
+ }
+
+ private Job stopProduct() {
+ Job job = new Job("stopping '" + getProductName() + "' product...") {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ ILaunchManager lm = DebugPlugin.getDefault().getLaunchManager();
+ for (ILaunch l : lm.getLaunches()) {
+ ILaunchConfiguration lc = l.getLaunchConfiguration();
+ if (getProductFile().getName().equals(lc.getName())) {
+ l.terminate();
+ for (int i = 0; i < 50; i++) {
+ if (l.isTerminated()) {
+ break;
+ }
+ else {
+ Thread.sleep(100);
+ }
+ }
+ recomputeLaunchState();
+ break;
+ }
+ }
+ }
+ catch (Exception e) {
+ ScoutSdkUi.logError("could not stop product '" + getProductFile().getName() + "'", e);
+ }
+ return Status.OK_STATUS;
+ }
+ };
+ job.setUser(false);
+ job.setRule(getProductFile());
+ job.schedule();
+ return job;
+ }
+
+ private void restartProduct(boolean debug) {
+ Job stopJob = stopProduct();
+ try {
+ stopJob.join();
+ startProduct(debug);
+ }
+ catch (InterruptedException e) {
+ ScoutSdkUi.logError("error during stopping product '" + getProductName() + "'", e);
+ }
+ }
+
+ private void recomputeLaunchState() {
+ if (getContainer() != null && !getContainer().isDisposed()) {
+ getContainer().getDisplay().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ ILaunch[] launches = DebugPlugin.getDefault().getLaunchManager().getLaunches();
+ for (ILaunch l : launches) {
+ if (l.getLaunchConfiguration().getName().equals(getProductFile().getName())) {
+ if (!m_stopLink.isDisposed() && !m_mainGroup.isDisposed()) {
+ if (l.isTerminated()) {
+ m_stopLink.setEnabled(false);
+ m_mainGroup.setText(getProductFile().getParent().getName());
+ }
+ else {
+ m_stopLink.setEnabled(true);
+ if (l.getLaunchMode().equals(ILaunchManager.DEBUG_MODE)) {
+ m_mainGroup.setText(getProductFile().getParent().getName() + " - " + Texts.get("debugging") + "...");
+ }
+ else if (l.getLaunchMode().equals(ILaunchManager.RUN_MODE)) {
+ m_mainGroup.setText(getProductFile().getParent().getName() + " - " + Texts.get("Running") + "...");
+ }
+ else {
+ m_mainGroup.setText(getProductFile().getParent().getName() + " - " + Texts.get("UndefinedState") + "...");
+ }
+ }
+ }
+ }
+ }
+ }
+ });
+ }
+ }
+
+ private class P_LaunchListener implements ILaunchListener {
+ @Override
+ public void launchAdded(ILaunch launch) {
+ recomputeLaunchState();
+ }
+
+ @Override
+ public void launchChanged(ILaunch launch) {
+ recomputeLaunchState();
+ }
+
+ @Override
+ public void launchRemoved(ILaunch launch) {
+ recomputeLaunchState();
+ }
+ } // end class P_LaunchListener
+
+ private class P_RecomputeLaunchStateJob extends Job {
+
+ private boolean m_canceled = false;
+
+ public P_RecomputeLaunchStateJob() {
+ super("");
+ setSystem(true);
+ setPriority(Job.DECORATE);
+ setRule(getProductFile());
+ }
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ if (!m_canceled) {
+ recomputeLaunchState();
+ schedule(2500);
+ }
+ return Status.OK_STATUS;
+ }
+ } // end class P_RecomputeLaunchStateJob
+
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/presenter/util/MethodBean.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/presenter/util/MethodBean.java
index c8b2e3dac..486e87b9f 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/presenter/util/MethodBean.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/presenter/util/MethodBean.java
@@ -1,63 +1,63 @@
-/*******************************************************************************
- * 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.view.properties.presenter.util;
-
-import org.eclipse.scout.sdk.workspace.type.config.ConfigurationMethod;
-
-/**
- * <h3>MethodBean</h3> ...
- *
- * @param <T>
- */
-public class MethodBean<T> {
-
- private final String m_identifier;
- private T m_defaultValue;
- private T m_currentSourceValue;
- private ConfigurationMethod m_method;
-
- public MethodBean(ConfigurationMethod method, String identifier) {
- m_method = method;
- m_identifier = identifier;
- }
-
- public T getCurrentSourceValue() {
- return m_currentSourceValue;
- }
-
- public T getDefaultValue() {
- return m_defaultValue;
- }
-
- public String getSource() {
- return m_method.getSource();
- }
-
- public String getIdentifier() {
- return m_identifier;
- }
-
- public void setCurrentSourceValue(T currentSourceValue) {
- m_currentSourceValue = currentSourceValue;
- }
-
- public void setDefaultValue(T defaultValue) {
- m_defaultValue = defaultValue;
- }
-
- public ConfigurationMethod getMethod() {
- return m_method;
- }
-
- public void setMethod(ConfigurationMethod method) {
- m_method = method;
- }
-}
+/*******************************************************************************
+ * 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.view.properties.presenter.util;
+
+import org.eclipse.scout.sdk.workspace.type.config.ConfigurationMethod;
+
+/**
+ * <h3>MethodBean</h3> ...
+ *
+ * @param <T>
+ */
+public class MethodBean<T> {
+
+ private final String m_identifier;
+ private T m_defaultValue;
+ private T m_currentSourceValue;
+ private ConfigurationMethod m_method;
+
+ public MethodBean(ConfigurationMethod method, String identifier) {
+ m_method = method;
+ m_identifier = identifier;
+ }
+
+ public T getCurrentSourceValue() {
+ return m_currentSourceValue;
+ }
+
+ public T getDefaultValue() {
+ return m_defaultValue;
+ }
+
+ public String getSource() {
+ return m_method.getSource();
+ }
+
+ public String getIdentifier() {
+ return m_identifier;
+ }
+
+ public void setCurrentSourceValue(T currentSourceValue) {
+ m_currentSourceValue = currentSourceValue;
+ }
+
+ public void setDefaultValue(T defaultValue) {
+ m_defaultValue = defaultValue;
+ }
+
+ public ConfigurationMethod getMethod() {
+ return m_method;
+ }
+
+ public void setMethod(ConfigurationMethod method) {
+ m_method = method;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/presenter/util/MethodErrorPresenterContent.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/presenter/util/MethodErrorPresenterContent.java
index c7566cdd3..bee9db74d 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/presenter/util/MethodErrorPresenterContent.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/view/properties/presenter/util/MethodErrorPresenterContent.java
@@ -1,217 +1,217 @@
-/*******************************************************************************
- * 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.view.properties.presenter.util;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IMethod;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.ui.JavaUI;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.jobs.OperationJob;
-import org.eclipse.scout.sdk.operation.method.ScoutMethodDeleteOperation;
-import org.eclipse.scout.sdk.ui.fields.tooltip.CustomTooltip;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.util.ScoutSourceUtility;
-import org.eclipse.scout.sdk.util.ScoutUtility;
-import org.eclipse.scout.sdk.util.SdkProperties;
-import org.eclipse.scout.sdk.util.resources.ResourceUtility;
-import org.eclipse.scout.sdk.workspace.type.config.ConfigurationMethod;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.forms.events.HyperlinkAdapter;
-import org.eclipse.ui.forms.events.HyperlinkEvent;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.Hyperlink;
-import org.eclipse.ui.forms.widgets.ImageHyperlink;
-import org.eclipse.ui.texteditor.ITextEditor;
-
-public class MethodErrorPresenterContent extends Composite {
-
- private final FormToolkit m_toolkit;
- private Hyperlink m_labelLink;
- private Label m_statusLabel;
- private Label m_statusIcon;
- private ImageHyperlink m_deleteButton;
- private ConfigurationMethod m_configurationMethod;
- private String m_presenterText;
- private CustomTooltip m_customTooltip;
-
- public MethodErrorPresenterContent(Composite parent, FormToolkit toolkit) {
- super(parent, SWT.NONE);
- m_toolkit = toolkit;
- setPresenterText(Texts.get("CustomImplementation"));
- createContent(this);
- }
-
- private void createContent(Composite parent) {
- createLabelArea(parent);
- createBodyArea(parent);
-
- // layout
- GridLayout bodyLayout = new GridLayout(3, false);
- bodyLayout.horizontalSpacing = 0;
- bodyLayout.marginHeight = 0;
- bodyLayout.marginWidth = 0;
- bodyLayout.verticalSpacing = 0;
- parent.setLayout(bodyLayout);
- parent.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL));
- }
-
- private void createBodyArea(Composite rootArea) {
- Composite area = getToolkit().createComposite(rootArea);
- m_statusIcon = getToolkit().createLabel(area, "");
- m_statusLabel = getToolkit().createLabel(area, "");
-
- m_deleteButton = getToolkit().createImageHyperlink(rootArea, SWT.PUSH);
- m_deleteButton.setImage(ScoutSdkUi.getImage(ScoutSdkUi.ToolRemove));
- m_deleteButton.addHyperlinkListener(new HyperlinkAdapter() {
- @Override
- public void linkActivated(HyperlinkEvent e) {
- new OperationJob(new ScoutMethodDeleteOperation(getMethod().peekMethod())).schedule();
- }
- });
-
- GridLayout glayout = new GridLayout(3, false);
- glayout.marginHeight = 0;
- glayout.marginWidth = 0;
- glayout.verticalSpacing = 0;
- glayout.horizontalSpacing = 3;
- area.setLayout(glayout);
- area.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
-
- m_statusIcon.setLayoutData(new GridData(GridData.BEGINNING));
- m_statusLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
-
- m_deleteButton.setLayoutData(new GridData(SWT.DEFAULT, SdkProperties.TOOL_BUTTON_SIZE));
- m_deleteButton.setEnabled(false);
- }
-
- private void createLabelArea(Composite parent) {
- Composite linkComposite = getToolkit().createComposite(parent);
- m_labelLink = getToolkit().createHyperlink(linkComposite, "", SWT.NONE);
- m_customTooltip = new CustomTooltip(m_labelLink, true);
-
- m_labelLink.addHyperlinkListener(new HyperlinkAdapter() {
- @Override
- public void linkActivated(HyperlinkEvent e) {
- showMethodInEditor(m_configurationMethod.peekMethod());
- }
- });
- m_labelLink.setEnabled(false);
-
- // layout
- GridData linkCompData = new GridData();
- linkCompData.widthHint = 180;
- linkComposite.setLayoutData(linkCompData);
- linkComposite.setLayout(new GridLayout(1, true));
-
- m_labelLink.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, true, false));
- }
-
- public ConfigurationMethod getMethod() {
- return m_configurationMethod;
- }
-
- public void setMethod(ConfigurationMethod method) {
- m_configurationMethod = method;
- m_labelLink.setText(SdkProperties.getMethodPresenterName(method.peekMethod()));
- m_labelLink.setEnabled(true);
- m_labelLink.setFont(getFont(JFaceResources.DIALOG_FONT, getMethod().isImplemented()));
- try {
- m_customTooltip.setText(wellFormMethod());
- }
- catch (JavaModelException e1) {
- ScoutSdkUi.logWarning("could not create tooltip for '" + method.getMethodName() + "'", e1);
- }
- m_deleteButton.setEnabled(method.isImplemented());
- setStatus(new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, getPresenterText()));
- m_deleteButton.setToolTipText(Texts.get("RemoveXinY", getMethod().getMethodName(), getMethod().getType().getElementName()));
- }
-
- public void setStatus(IStatus status) {
- Image image = null;
- String message = "";
- if (status != null) {
- switch (status.getSeverity()) {
- case IStatus.ERROR:
- image = ScoutSdkUi.getImage(ScoutSdkUi.StatusError);
- break;
- case IStatus.WARNING:
- image = ScoutSdkUi.getImage(ScoutSdkUi.StatusWarning);
- break;
- case IStatus.INFO:
- image = ScoutSdkUi.getImage(ScoutSdkUi.StatusInfo);
- break;
- }
- message = status.getMessage();
- }
- m_statusIcon.setImage(image);
- m_statusLabel.setText(message);
- }
-
- protected FormToolkit getToolkit() {
- return m_toolkit;
- }
-
- protected void showMethodInEditor(IMethod method) {
- try {
- IEditorPart editor = JavaUI.openInEditor(method);
- JavaUI.revealInEditor(editor, (IJavaElement) method);
- if (editor instanceof ITextEditor) {
- ITextEditor textEditor = (ITextEditor) editor;
- IRegion reg = textEditor.getHighlightRange();
- if (reg != null) {
- textEditor.setHighlightRange(reg.getOffset(), reg.getLength(), true);
- }
- }
- }
- catch (Exception e) {
- ScoutSdkUi.logWarning(e);
- }
- }
-
- private String wellFormMethod() throws JavaModelException {
- String methodBody = getMethod().peekMethod().getSource();
- String newBody = ScoutSourceUtility.removeLeadingCommentAndAnnotationLines(methodBody);
- String newLine = ResourceUtility.getLineSeparator(getMethod().getType().getCompilationUnit());
- newBody = ScoutSourceUtility.removeLineLeadingTab(ScoutUtility.getIndent(getMethod().getType()).length() + 1, newBody, newLine);
- newBody = newBody.replaceAll("\t", SdkProperties.TAB);
- return newBody;
- }
-
- protected Font getFont(String symbolicName, boolean bold) {
- if (bold) {
- return PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getFontRegistry().getBold(symbolicName);
- }
- else {
- return PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getFontRegistry().get(symbolicName);
- }
- }
-
- public void setPresenterText(String presenterText) {
- m_presenterText = presenterText;
- }
-
- public String getPresenterText() {
- return m_presenterText;
- }
-}
+/*******************************************************************************
+ * 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.view.properties.presenter.util;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.ui.JavaUI;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.jobs.OperationJob;
+import org.eclipse.scout.sdk.operation.method.ScoutMethodDeleteOperation;
+import org.eclipse.scout.sdk.ui.fields.tooltip.CustomTooltip;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.util.ScoutSourceUtility;
+import org.eclipse.scout.sdk.util.ScoutUtility;
+import org.eclipse.scout.sdk.util.SdkProperties;
+import org.eclipse.scout.sdk.util.resources.ResourceUtility;
+import org.eclipse.scout.sdk.workspace.type.config.ConfigurationMethod;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.forms.events.HyperlinkAdapter;
+import org.eclipse.ui.forms.events.HyperlinkEvent;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.Hyperlink;
+import org.eclipse.ui.forms.widgets.ImageHyperlink;
+import org.eclipse.ui.texteditor.ITextEditor;
+
+public class MethodErrorPresenterContent extends Composite {
+
+ private final FormToolkit m_toolkit;
+ private Hyperlink m_labelLink;
+ private Label m_statusLabel;
+ private Label m_statusIcon;
+ private ImageHyperlink m_deleteButton;
+ private ConfigurationMethod m_configurationMethod;
+ private String m_presenterText;
+ private CustomTooltip m_customTooltip;
+
+ public MethodErrorPresenterContent(Composite parent, FormToolkit toolkit) {
+ super(parent, SWT.NONE);
+ m_toolkit = toolkit;
+ setPresenterText(Texts.get("CustomImplementation"));
+ createContent(this);
+ }
+
+ private void createContent(Composite parent) {
+ createLabelArea(parent);
+ createBodyArea(parent);
+
+ // layout
+ GridLayout bodyLayout = new GridLayout(3, false);
+ bodyLayout.horizontalSpacing = 0;
+ bodyLayout.marginHeight = 0;
+ bodyLayout.marginWidth = 0;
+ bodyLayout.verticalSpacing = 0;
+ parent.setLayout(bodyLayout);
+ parent.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL));
+ }
+
+ private void createBodyArea(Composite rootArea) {
+ Composite area = getToolkit().createComposite(rootArea);
+ m_statusIcon = getToolkit().createLabel(area, "");
+ m_statusLabel = getToolkit().createLabel(area, "");
+
+ m_deleteButton = getToolkit().createImageHyperlink(rootArea, SWT.PUSH);
+ m_deleteButton.setImage(ScoutSdkUi.getImage(ScoutSdkUi.ToolRemove));
+ m_deleteButton.addHyperlinkListener(new HyperlinkAdapter() {
+ @Override
+ public void linkActivated(HyperlinkEvent e) {
+ new OperationJob(new ScoutMethodDeleteOperation(getMethod().peekMethod())).schedule();
+ }
+ });
+
+ GridLayout glayout = new GridLayout(3, false);
+ glayout.marginHeight = 0;
+ glayout.marginWidth = 0;
+ glayout.verticalSpacing = 0;
+ glayout.horizontalSpacing = 3;
+ area.setLayout(glayout);
+ area.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
+
+ m_statusIcon.setLayoutData(new GridData(GridData.BEGINNING));
+ m_statusLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
+
+ m_deleteButton.setLayoutData(new GridData(SWT.DEFAULT, SdkProperties.TOOL_BUTTON_SIZE));
+ m_deleteButton.setEnabled(false);
+ }
+
+ private void createLabelArea(Composite parent) {
+ Composite linkComposite = getToolkit().createComposite(parent);
+ m_labelLink = getToolkit().createHyperlink(linkComposite, "", SWT.NONE);
+ m_customTooltip = new CustomTooltip(m_labelLink, true);
+
+ m_labelLink.addHyperlinkListener(new HyperlinkAdapter() {
+ @Override
+ public void linkActivated(HyperlinkEvent e) {
+ showMethodInEditor(m_configurationMethod.peekMethod());
+ }
+ });
+ m_labelLink.setEnabled(false);
+
+ // layout
+ GridData linkCompData = new GridData();
+ linkCompData.widthHint = 180;
+ linkComposite.setLayoutData(linkCompData);
+ linkComposite.setLayout(new GridLayout(1, true));
+
+ m_labelLink.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, true, false));
+ }
+
+ public ConfigurationMethod getMethod() {
+ return m_configurationMethod;
+ }
+
+ public void setMethod(ConfigurationMethod method) {
+ m_configurationMethod = method;
+ m_labelLink.setText(SdkProperties.getMethodPresenterName(method.peekMethod()));
+ m_labelLink.setEnabled(true);
+ m_labelLink.setFont(getFont(JFaceResources.DIALOG_FONT, getMethod().isImplemented()));
+ try {
+ m_customTooltip.setText(wellFormMethod());
+ }
+ catch (JavaModelException e1) {
+ ScoutSdkUi.logWarning("could not create tooltip for '" + method.getMethodName() + "'", e1);
+ }
+ m_deleteButton.setEnabled(method.isImplemented());
+ setStatus(new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, getPresenterText()));
+ m_deleteButton.setToolTipText(Texts.get("RemoveXinY", getMethod().getMethodName(), getMethod().getType().getElementName()));
+ }
+
+ public void setStatus(IStatus status) {
+ Image image = null;
+ String message = "";
+ if (status != null) {
+ switch (status.getSeverity()) {
+ case IStatus.ERROR:
+ image = ScoutSdkUi.getImage(ScoutSdkUi.StatusError);
+ break;
+ case IStatus.WARNING:
+ image = ScoutSdkUi.getImage(ScoutSdkUi.StatusWarning);
+ break;
+ case IStatus.INFO:
+ image = ScoutSdkUi.getImage(ScoutSdkUi.StatusInfo);
+ break;
+ }
+ message = status.getMessage();
+ }
+ m_statusIcon.setImage(image);
+ m_statusLabel.setText(message);
+ }
+
+ protected FormToolkit getToolkit() {
+ return m_toolkit;
+ }
+
+ protected void showMethodInEditor(IMethod method) {
+ try {
+ IEditorPart editor = JavaUI.openInEditor(method);
+ JavaUI.revealInEditor(editor, (IJavaElement) method);
+ if (editor instanceof ITextEditor) {
+ ITextEditor textEditor = (ITextEditor) editor;
+ IRegion reg = textEditor.getHighlightRange();
+ if (reg != null) {
+ textEditor.setHighlightRange(reg.getOffset(), reg.getLength(), true);
+ }
+ }
+ }
+ catch (Exception e) {
+ ScoutSdkUi.logWarning(e);
+ }
+ }
+
+ private String wellFormMethod() throws JavaModelException {
+ String methodBody = getMethod().peekMethod().getSource();
+ String newBody = ScoutSourceUtility.removeLeadingCommentAndAnnotationLines(methodBody);
+ String newLine = ResourceUtility.getLineSeparator(getMethod().getType().getCompilationUnit());
+ newBody = ScoutSourceUtility.removeLineLeadingTab(ScoutUtility.getIndent(getMethod().getType()).length() + 1, newBody, newLine);
+ newBody = newBody.replaceAll("\t", SdkProperties.TAB);
+ return newBody;
+ }
+
+ protected Font getFont(String symbolicName, boolean bold) {
+ if (bold) {
+ return PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getFontRegistry().getBold(symbolicName);
+ }
+ else {
+ return PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getFontRegistry().get(symbolicName);
+ }
+ }
+
+ public void setPresenterText(String presenterText) {
+ m_presenterText = presenterText;
+ }
+
+ public String getPresenterText() {
+ return m_presenterText;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/viewer/ScoutBundleLableProvider.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/viewer/ScoutBundleLableProvider.java
index 32d9d44d3..300dd9480 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/viewer/ScoutBundleLableProvider.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/viewer/ScoutBundleLableProvider.java
@@ -1,49 +1,49 @@
-/*******************************************************************************
- * 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.viewer;
-
-import org.eclipse.scout.sdk.ui.fields.proposal.styled.SearchRangeStyledLabelProvider;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * <h3>{@link ScoutBundleLableProvider}</h3> ...
- *
- * @author aho
- * @since 3.8.0 19.03.2012
- */
-public class ScoutBundleLableProvider extends SearchRangeStyledLabelProvider {
-
- @Override
- public String getText(Object element) {
- return ((IScoutBundle) element).getBundleName();
- }
-
- @Override
- public Image getImage(Object element) {
- switch (((IScoutBundle) element).getType()) {
- case IScoutBundle.BUNDLE_UI_SWING:
- return ScoutSdkUi.getImage(ScoutSdkUi.SwingBundle);
- case IScoutBundle.BUNDLE_UI_SWT:
- return ScoutSdkUi.getImage(ScoutSdkUi.SwtBundle);
- case IScoutBundle.BUNDLE_CLIENT:
- return ScoutSdkUi.getImage(ScoutSdkUi.ClientBundle);
- case IScoutBundle.BUNDLE_SHARED:
- return ScoutSdkUi.getImage(ScoutSdkUi.SharedBundle);
- case IScoutBundle.BUNDLE_SERVER:
- return ScoutSdkUi.getImage(ScoutSdkUi.ServerBundle);
- default:
- // TODO default bundle img
- return ScoutSdkUi.getImage(ScoutSdkUi.SharedBundle);
- }
- }
-}
+/*******************************************************************************
+ * 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.viewer;
+
+import org.eclipse.scout.sdk.ui.fields.proposal.styled.SearchRangeStyledLabelProvider;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * <h3>{@link ScoutBundleLableProvider}</h3> ...
+ *
+ * @author aho
+ * @since 3.8.0 19.03.2012
+ */
+public class ScoutBundleLableProvider extends SearchRangeStyledLabelProvider {
+
+ @Override
+ public String getText(Object element) {
+ return ((IScoutBundle) element).getBundleName();
+ }
+
+ @Override
+ public Image getImage(Object element) {
+ switch (((IScoutBundle) element).getType()) {
+ case IScoutBundle.BUNDLE_UI_SWING:
+ return ScoutSdkUi.getImage(ScoutSdkUi.SwingBundle);
+ case IScoutBundle.BUNDLE_UI_SWT:
+ return ScoutSdkUi.getImage(ScoutSdkUi.SwtBundle);
+ case IScoutBundle.BUNDLE_CLIENT:
+ return ScoutSdkUi.getImage(ScoutSdkUi.ClientBundle);
+ case IScoutBundle.BUNDLE_SHARED:
+ return ScoutSdkUi.getImage(ScoutSdkUi.SharedBundle);
+ case IScoutBundle.BUNDLE_SERVER:
+ return ScoutSdkUi.getImage(ScoutSdkUi.ServerBundle);
+ default:
+ // TODO default bundle img
+ return ScoutSdkUi.getImage(ScoutSdkUi.SharedBundle);
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/AbstractScoutWizardPage.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/AbstractScoutWizardPage.java
index 30f60e456..05b047d2b 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/AbstractScoutWizardPage.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/AbstractScoutWizardPage.java
@@ -1,228 +1,228 @@
-/*******************************************************************************
- * 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;
-
-import java.util.ArrayList;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.IMessageProvider;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.scout.sdk.ui.fields.FieldToolkit;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * <h3>BCWizardPage</h3> ...
- *
- * @author Andreas Hoegger
- * @since 1.0.0 11.01.2008
- * @see ScoutWizardDialog
- */
-public abstract class AbstractScoutWizardPage extends WizardPage {
-
- private IStatus m_status = Status.OK_STATUS;
- private Composite m_content;
- private final FieldToolkit m_fieldToolkit;
- private int m_stateChangingCounter = 0;
- private boolean m_excludePage;
- private ArrayList<IStatusProvider> m_statusProvider;
-
- public AbstractScoutWizardPage(String pageName, String title, ImageDescriptor titleImage) {
- super(pageName, title, titleImage);
- m_fieldToolkit = new FieldToolkit();
- m_statusProvider = new ArrayList<IStatusProvider>();
- }
-
- public AbstractScoutWizardPage(String pageName) {
- this(pageName, null, (ImageDescriptor) null);
-
- }
-
- public FieldToolkit getFieldToolkit() {
- return m_fieldToolkit;
- }
-
- /**
- * Override to handle each page activate.
- */
- public void postActivate() {
- }
-
- @Override
- public final void createControl(Composite parent) {
- m_content = new Composite(parent, SWT.NONE);
- m_content.setLayout(new FillLayout());
- createContent(m_content);
- setControl(m_content);
- revalidate();
- }
-
- @Override
- protected boolean isControlCreated() {
- return super.isControlCreated() && !getControl().isDisposed();
- }
-
- /**
- * Overwrite this method to add your controls to the wizard page.
- *
- * @param parent
- */
- protected abstract void createContent(Composite parent);
-
- @Override
- public Composite getControl() {
- return m_content;
- }
-
- @Override
- public void setVisible(boolean visible) {
- m_content.setVisible(visible);
- }
-
- public boolean addStatusProvider(IStatusProvider provider) {
- return m_statusProvider.add(provider);
- }
-
- public boolean removeStatusProvider(IStatusProvider provider) {
- return m_statusProvider.remove(provider);
- }
-
- protected void setStatus(IStatus status) {
- if (status == null) {
- status = Status.OK_STATUS;
- }
- if (status.isOK()) {
- setMessage(getDescription(), IStatus.OK);
- }
- else {
- IStatus highestSeverityStatus = getHighestSeverityStatus(status, Status.OK_STATUS);
- int messagetype;
- switch (highestSeverityStatus.getSeverity()) {
- case IStatus.INFO:
- messagetype = IMessageProvider.INFORMATION;
- break;
- case IStatus.WARNING:
- messagetype = IMessageProvider.WARNING;
- break;
- case IStatus.ERROR:
- messagetype = IMessageProvider.ERROR;
- break;
- default:
- messagetype = IMessageProvider.NONE;
- break;
- }
- String message = highestSeverityStatus.getMessage();
- setMessage(message, messagetype);
- }
- if (!status.matches(IStatus.ERROR)) {
- setPageComplete(true);
- }
- else {
- setPageComplete(false);
- }
- m_status = status;
- }
-
- private IStatus getHighestSeverityStatus(IStatus status, IStatus highestSeverity) {
- if (status.isMultiStatus()) {
- for (IStatus child : status.getChildren()) {
- highestSeverity = getHighestSeverityStatus(child, highestSeverity);
- }
- return highestSeverity;
- }
- else {
- if (highestSeverity.getSeverity() < status.getSeverity()) {
- highestSeverity = status;
- }
- return highestSeverity;
- }
- }
-
- /**
- * to force a revalidate if needed.
- */
- public void pingStateChanging() {
- if (m_stateChangingCounter <= 0) {
- m_stateChangingCounter = 0;
- revalidate();
- }
- }
-
- /**
- * NOTE: always call this method in a try finally block.
- *
- * @param changing
- */
- protected void setStateChanging(boolean changing) {
- if (changing) {
- m_stateChangingCounter++;
- }
- else {
- m_stateChangingCounter--;
- }
- if (m_stateChangingCounter <= 0) {
- m_stateChangingCounter = 0;
- revalidate();
- }
- }
-
- /**
- * call to revalidate the wizard page. this method calls the overwritable method
- * {@link AbstractScoutWizardPage#validatePage(MultiStatus)}.
- *
- * @see {@link AbstractScoutWizardPage#validatePage(MultiStatus)}
- */
- protected final void revalidate() {
- MultiStatus multiStatus = new MultiStatus(ScoutSdkUi.PLUGIN_ID, -1, "multi status", null);
- validatePage(multiStatus);
- for (IStatusProvider p : m_statusProvider) {
- p.validate(this, multiStatus);
- }
- setStatus(multiStatus);
- }
-
- /**
- * Classes extending BCWizardPage can overwrite this method to do some page validation and
- * add additional status to the given multi status.
- *
- * @param multiStatus
- */
- protected void validatePage(MultiStatus multiStatus) {
- }
-
- public boolean performFinish() {
- return true;
- }
-
- protected IStatus getStatus() {
- return m_status;
- }
-
- public void setExcludePage(boolean excludePage) {
- m_excludePage = excludePage;
- }
-
- public boolean isExcludePage() {
- return m_excludePage;
- }
-
- /**
- * sets the focus when the page is activated. Can be overridden.
- */
- public void setFocus() {
- getControl().setFocus();
- }
-}
+/*******************************************************************************
+ * 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;
+
+import java.util.ArrayList;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.dialogs.IMessageProvider;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.scout.sdk.ui.fields.FieldToolkit;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * <h3>BCWizardPage</h3> ...
+ *
+ * @author Andreas Hoegger
+ * @since 1.0.0 11.01.2008
+ * @see ScoutWizardDialog
+ */
+public abstract class AbstractScoutWizardPage extends WizardPage {
+
+ private IStatus m_status = Status.OK_STATUS;
+ private Composite m_content;
+ private final FieldToolkit m_fieldToolkit;
+ private int m_stateChangingCounter = 0;
+ private boolean m_excludePage;
+ private ArrayList<IStatusProvider> m_statusProvider;
+
+ public AbstractScoutWizardPage(String pageName, String title, ImageDescriptor titleImage) {
+ super(pageName, title, titleImage);
+ m_fieldToolkit = new FieldToolkit();
+ m_statusProvider = new ArrayList<IStatusProvider>();
+ }
+
+ public AbstractScoutWizardPage(String pageName) {
+ this(pageName, null, (ImageDescriptor) null);
+
+ }
+
+ public FieldToolkit getFieldToolkit() {
+ return m_fieldToolkit;
+ }
+
+ /**
+ * Override to handle each page activate.
+ */
+ public void postActivate() {
+ }
+
+ @Override
+ public final void createControl(Composite parent) {
+ m_content = new Composite(parent, SWT.NONE);
+ m_content.setLayout(new FillLayout());
+ createContent(m_content);
+ setControl(m_content);
+ revalidate();
+ }
+
+ @Override
+ protected boolean isControlCreated() {
+ return super.isControlCreated() && !getControl().isDisposed();
+ }
+
+ /**
+ * Overwrite this method to add your controls to the wizard page.
+ *
+ * @param parent
+ */
+ protected abstract void createContent(Composite parent);
+
+ @Override
+ public Composite getControl() {
+ return m_content;
+ }
+
+ @Override
+ public void setVisible(boolean visible) {
+ m_content.setVisible(visible);
+ }
+
+ public boolean addStatusProvider(IStatusProvider provider) {
+ return m_statusProvider.add(provider);
+ }
+
+ public boolean removeStatusProvider(IStatusProvider provider) {
+ return m_statusProvider.remove(provider);
+ }
+
+ protected void setStatus(IStatus status) {
+ if (status == null) {
+ status = Status.OK_STATUS;
+ }
+ if (status.isOK()) {
+ setMessage(getDescription(), IStatus.OK);
+ }
+ else {
+ IStatus highestSeverityStatus = getHighestSeverityStatus(status, Status.OK_STATUS);
+ int messagetype;
+ switch (highestSeverityStatus.getSeverity()) {
+ case IStatus.INFO:
+ messagetype = IMessageProvider.INFORMATION;
+ break;
+ case IStatus.WARNING:
+ messagetype = IMessageProvider.WARNING;
+ break;
+ case IStatus.ERROR:
+ messagetype = IMessageProvider.ERROR;
+ break;
+ default:
+ messagetype = IMessageProvider.NONE;
+ break;
+ }
+ String message = highestSeverityStatus.getMessage();
+ setMessage(message, messagetype);
+ }
+ if (!status.matches(IStatus.ERROR)) {
+ setPageComplete(true);
+ }
+ else {
+ setPageComplete(false);
+ }
+ m_status = status;
+ }
+
+ private IStatus getHighestSeverityStatus(IStatus status, IStatus highestSeverity) {
+ if (status.isMultiStatus()) {
+ for (IStatus child : status.getChildren()) {
+ highestSeverity = getHighestSeverityStatus(child, highestSeverity);
+ }
+ return highestSeverity;
+ }
+ else {
+ if (highestSeverity.getSeverity() < status.getSeverity()) {
+ highestSeverity = status;
+ }
+ return highestSeverity;
+ }
+ }
+
+ /**
+ * to force a revalidate if needed.
+ */
+ public void pingStateChanging() {
+ if (m_stateChangingCounter <= 0) {
+ m_stateChangingCounter = 0;
+ revalidate();
+ }
+ }
+
+ /**
+ * NOTE: always call this method in a try finally block.
+ *
+ * @param changing
+ */
+ protected void setStateChanging(boolean changing) {
+ if (changing) {
+ m_stateChangingCounter++;
+ }
+ else {
+ m_stateChangingCounter--;
+ }
+ if (m_stateChangingCounter <= 0) {
+ m_stateChangingCounter = 0;
+ revalidate();
+ }
+ }
+
+ /**
+ * call to revalidate the wizard page. this method calls the overwritable method
+ * {@link AbstractScoutWizardPage#validatePage(MultiStatus)}.
+ *
+ * @see {@link AbstractScoutWizardPage#validatePage(MultiStatus)}
+ */
+ protected final void revalidate() {
+ MultiStatus multiStatus = new MultiStatus(ScoutSdkUi.PLUGIN_ID, -1, "multi status", null);
+ validatePage(multiStatus);
+ for (IStatusProvider p : m_statusProvider) {
+ p.validate(this, multiStatus);
+ }
+ setStatus(multiStatus);
+ }
+
+ /**
+ * Classes extending BCWizardPage can overwrite this method to do some page validation and
+ * add additional status to the given multi status.
+ *
+ * @param multiStatus
+ */
+ protected void validatePage(MultiStatus multiStatus) {
+ }
+
+ public boolean performFinish() {
+ return true;
+ }
+
+ protected IStatus getStatus() {
+ return m_status;
+ }
+
+ public void setExcludePage(boolean excludePage) {
+ m_excludePage = excludePage;
+ }
+
+ public boolean isExcludePage() {
+ return m_excludePage;
+ }
+
+ /**
+ * sets the focus when the page is activated. Can be overridden.
+ */
+ public void setFocus() {
+ getControl().setFocus();
+ }
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/AbstractWizard.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/AbstractWizard.java
index 0cbf09a57..71c19019f 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/AbstractWizard.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/AbstractWizard.java
@@ -1,115 +1,115 @@
-/*******************************************************************************
- * 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;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-
-/**
- * <h3>AbstractWizard</h3> ...
- */
-public class AbstractWizard extends Wizard implements IWizard {
-
- public AbstractWizard(AbstractScoutWizardPage... pages) {
- for (AbstractScoutWizardPage page : pages) {
- addPage(page);
- }
- setDialogSettings(ScoutSdkUi.getDefault().getDialogSettingsSection(getDialogSettingsKey(), true));
- }
-
- /**
- * may be overwritten to provide a special dialog settings key.
- *
- * @return a dialog settings key (default is the fqn of the wizard.
- */
- protected String getDialogSettingsKey() {
- return getClass().getName();
- }
-
- @Override
- public void addPage(IWizardPage page) {
- if (page instanceof AbstractScoutWizardPage) {
- super.addPage(page);
- }
- else {
- throw new IllegalArgumentException("Expecting an instance of '" + AbstractScoutWizardPage.class.getName() + "'.");
- }
- }
-
- @Override
- public AbstractScoutWizardPage getPage(String name) {
- return (AbstractScoutWizardPage) super.getPage(name);
- }
-
- @Override
- public IWizardPage getStartingPage() {
- AbstractScoutWizardPage startingPage = (AbstractScoutWizardPage) super.getStartingPage();
- if (startingPage.isExcludePage()) {
- return getNextPage(startingPage);
- }
- return startingPage;
- }
-
- @Override
- public IWizardPage getNextPage(IWizardPage page) {
- List<IWizardPage> pages = Arrays.asList(getPages());
- int index = pages.indexOf(page);
- if (index == pages.size() - 1 || index == -1) {
- return null;
- }
- AbstractScoutWizardPage nextPage = (AbstractScoutWizardPage) pages.get(index + 1);
- if (nextPage.isExcludePage()) {
- return getNextPage(nextPage);
- }
- else {
- return nextPage;
- }
- }
-
- @Override
- public IWizardPage getPreviousPage(IWizardPage page) {
- AbstractScoutWizardPage prevPage = (AbstractScoutWizardPage) super.getPreviousPage(page);
- if (prevPage != null && prevPage.isExcludePage()) {
- return getPreviousPage(prevPage);
- }
- else {
- return prevPage;
- }
- }
-
- @Override
- public boolean canFinish() {
- for (IWizardPage page : getPages()) {
- AbstractScoutWizardPage bcPage = (AbstractScoutWizardPage) page;
- if (!bcPage.isExcludePage() && !bcPage.isPageComplete()) {
- return false;
- }
- }
- return true;
- }
-
- @Override
- public boolean performFinish() {
- for (IWizardPage page : getPages()) {
- AbstractScoutWizardPage bcPage = (AbstractScoutWizardPage) page;
- if (!bcPage.performFinish()) {
- return false;
- }
- }
- return true;
- }
-
-}
+/*******************************************************************************
+ * 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;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+
+/**
+ * <h3>AbstractWizard</h3> ...
+ */
+public class AbstractWizard extends Wizard implements IWizard {
+
+ public AbstractWizard(AbstractScoutWizardPage... pages) {
+ for (AbstractScoutWizardPage page : pages) {
+ addPage(page);
+ }
+ setDialogSettings(ScoutSdkUi.getDefault().getDialogSettingsSection(getDialogSettingsKey(), true));
+ }
+
+ /**
+ * may be overwritten to provide a special dialog settings key.
+ *
+ * @return a dialog settings key (default is the fqn of the wizard.
+ */
+ protected String getDialogSettingsKey() {
+ return getClass().getName();
+ }
+
+ @Override
+ public void addPage(IWizardPage page) {
+ if (page instanceof AbstractScoutWizardPage) {
+ super.addPage(page);
+ }
+ else {
+ throw new IllegalArgumentException("Expecting an instance of '" + AbstractScoutWizardPage.class.getName() + "'.");
+ }
+ }
+
+ @Override
+ public AbstractScoutWizardPage getPage(String name) {
+ return (AbstractScoutWizardPage) super.getPage(name);
+ }
+
+ @Override
+ public IWizardPage getStartingPage() {
+ AbstractScoutWizardPage startingPage = (AbstractScoutWizardPage) super.getStartingPage();
+ if (startingPage.isExcludePage()) {
+ return getNextPage(startingPage);
+ }
+ return startingPage;
+ }
+
+ @Override
+ public IWizardPage getNextPage(IWizardPage page) {
+ List<IWizardPage> pages = Arrays.asList(getPages());
+ int index = pages.indexOf(page);
+ if (index == pages.size() - 1 || index == -1) {
+ return null;
+ }
+ AbstractScoutWizardPage nextPage = (AbstractScoutWizardPage) pages.get(index + 1);
+ if (nextPage.isExcludePage()) {
+ return getNextPage(nextPage);
+ }
+ else {
+ return nextPage;
+ }
+ }
+
+ @Override
+ public IWizardPage getPreviousPage(IWizardPage page) {
+ AbstractScoutWizardPage prevPage = (AbstractScoutWizardPage) super.getPreviousPage(page);
+ if (prevPage != null && prevPage.isExcludePage()) {
+ return getPreviousPage(prevPage);
+ }
+ else {
+ return prevPage;
+ }
+ }
+
+ @Override
+ public boolean canFinish() {
+ for (IWizardPage page : getPages()) {
+ AbstractScoutWizardPage bcPage = (AbstractScoutWizardPage) page;
+ if (!bcPage.isExcludePage() && !bcPage.isPageComplete()) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ @Override
+ public boolean performFinish() {
+ for (IWizardPage page : getPages()) {
+ AbstractScoutWizardPage bcPage = (AbstractScoutWizardPage) page;
+ if (!bcPage.performFinish()) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/AbstractWorkspaceWizard.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/AbstractWorkspaceWizard.java
index b9182185a..4fa66e57f 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/AbstractWorkspaceWizard.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/AbstractWorkspaceWizard.java
@@ -1,135 +1,135 @@
-/*******************************************************************************
- * 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;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.scout.sdk.jobs.OperationJob;
-import org.eclipse.scout.sdk.operation.IOperation;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.swt.widgets.Display;
-
-/**
- * <h3>AbstractProcessWizard</h3> ...
- */
-public class AbstractWorkspaceWizard extends AbstractWizard {
-
- public AbstractWorkspaceWizard() {
- }
-
- @Override
- public void addPage(IWizardPage page) {
- if (page instanceof AbstractWorkspaceWizardPage) {
- super.addPage(page);
- }
- else {
- throw new IllegalArgumentException("Expecting an instance of '" + AbstractWorkspaceWizardPage.class.getName() + "'.");
- }
- }
-
- @Override
- public final boolean performFinish() {
- try {
- if (!beforeFinish()) {
- ScoutSdkUi.logInfo("Wizard '" + getWindowTitle() + "' before finish canceled.");
- return false;
- }
- P_PerformFinishOperation performFinishOperation = new P_PerformFinishOperation(getShell().getDisplay());
- OperationJob job = new OperationJob(performFinishOperation);
- job.schedule();
- return true;
- }
- catch (CoreException e) {
- ScoutSdkUi.logError("Wizard finished abnormally", e);
- return false;
- }
- }
-
- /**
- * The default implementation iterates over the associated wizard pages and calls
- * {@link AbstractWorkspaceWizardPage#performFinish()} of each page. Overwrite this method to implement a specific
- * finish behavior.
- *
- * @param monitor
- * @param workingCopyManager
- * @return
- * @throws CoreException
- * @throws IllegalArgumentException
- */
- protected boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
- for (IWizardPage page : getPages()) {
- boolean validPage = false;
- AbstractWorkspaceWizardPage bcPage = (AbstractWorkspaceWizardPage) page;
- try {
- validPage = bcPage.performFinish(monitor, workingCopyManager);
- }
- catch (Exception e) {
- ScoutSdkUi.logError("exception during perfoming finish on wizard page '" + page.getClass().getName() + "'.", e);
- return false;
- }
- if (!validPage) {
- return false;
- }
- }
- return true;
- }
-
- protected void postFinishDisplayThread() {
- }
-
- /**
- * Is called before the wizard is finished and disposed. Typically, this method is overwritten to extract values from
- * within UI fields of the wizard pages to parameterize an associated operation.
- *
- * @return true to continue or false to cancel
- * @throws CoreException
- */
- protected boolean beforeFinish() throws CoreException {
- return true;
- }
-
- private class P_PerformFinishOperation implements IOperation {
- private final Display m_display;
-
- private P_PerformFinishOperation(Display display) {
- m_display = display;
- }
-
- @Override
- public String getOperationName() {
- return getWindowTitle();
- }
-
- @Override
- public void validate() throws IllegalArgumentException {
-
- }
-
- @Override
- public void run(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
- try {
- performFinish(monitor, workingCopyManager);
- m_display.asyncExec(new Runnable() {
-
- @Override
- public void run() {
- postFinishDisplayThread();
- }
- });
- }
- catch (Exception e) {
- ScoutSdkUi.logError("exception during perfoming finish on wizard page '" + AbstractWorkspaceWizard.this.getClass().getName() + "'.", e);
- }
- }
- } // end class P_PerformFinishOperation
-}
+/*******************************************************************************
+ * 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;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.scout.sdk.jobs.OperationJob;
+import org.eclipse.scout.sdk.operation.IOperation;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * <h3>AbstractProcessWizard</h3> ...
+ */
+public class AbstractWorkspaceWizard extends AbstractWizard {
+
+ public AbstractWorkspaceWizard() {
+ }
+
+ @Override
+ public void addPage(IWizardPage page) {
+ if (page instanceof AbstractWorkspaceWizardPage) {
+ super.addPage(page);
+ }
+ else {
+ throw new IllegalArgumentException("Expecting an instance of '" + AbstractWorkspaceWizardPage.class.getName() + "'.");
+ }
+ }
+
+ @Override
+ public final boolean performFinish() {
+ try {
+ if (!beforeFinish()) {
+ ScoutSdkUi.logInfo("Wizard '" + getWindowTitle() + "' before finish canceled.");
+ return false;
+ }
+ P_PerformFinishOperation performFinishOperation = new P_PerformFinishOperation(getShell().getDisplay());
+ OperationJob job = new OperationJob(performFinishOperation);
+ job.schedule();
+ return true;
+ }
+ catch (CoreException e) {
+ ScoutSdkUi.logError("Wizard finished abnormally", e);
+ return false;
+ }
+ }
+
+ /**
+ * The default implementation iterates over the associated wizard pages and calls
+ * {@link AbstractWorkspaceWizardPage#performFinish()} of each page. Overwrite this method to implement a specific
+ * finish behavior.
+ *
+ * @param monitor
+ * @param workingCopyManager
+ * @return
+ * @throws CoreException
+ * @throws IllegalArgumentException
+ */
+ protected boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
+ for (IWizardPage page : getPages()) {
+ boolean validPage = false;
+ AbstractWorkspaceWizardPage bcPage = (AbstractWorkspaceWizardPage) page;
+ try {
+ validPage = bcPage.performFinish(monitor, workingCopyManager);
+ }
+ catch (Exception e) {
+ ScoutSdkUi.logError("exception during perfoming finish on wizard page '" + page.getClass().getName() + "'.", e);
+ return false;
+ }
+ if (!validPage) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ protected void postFinishDisplayThread() {
+ }
+
+ /**
+ * Is called before the wizard is finished and disposed. Typically, this method is overwritten to extract values from
+ * within UI fields of the wizard pages to parameterize an associated operation.
+ *
+ * @return true to continue or false to cancel
+ * @throws CoreException
+ */
+ protected boolean beforeFinish() throws CoreException {
+ return true;
+ }
+
+ private class P_PerformFinishOperation implements IOperation {
+ private final Display m_display;
+
+ private P_PerformFinishOperation(Display display) {
+ m_display = display;
+ }
+
+ @Override
+ public String getOperationName() {
+ return getWindowTitle();
+ }
+
+ @Override
+ public void validate() throws IllegalArgumentException {
+
+ }
+
+ @Override
+ public void run(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
+ try {
+ performFinish(monitor, workingCopyManager);
+ m_display.asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ postFinishDisplayThread();
+ }
+ });
+ }
+ catch (Exception e) {
+ ScoutSdkUi.logError("exception during perfoming finish on wizard page '" + AbstractWorkspaceWizard.this.getClass().getName() + "'.", e);
+ }
+ }
+ } // end class P_PerformFinishOperation
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/AbstractWorkspaceWizardPage.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/AbstractWorkspaceWizardPage.java
index ce8383397..131f09a05 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/AbstractWorkspaceWizardPage.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/AbstractWorkspaceWizardPage.java
@@ -1,220 +1,220 @@
-/*******************************************************************************
- * 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;
-
-import java.beans.PropertyChangeListener;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.scout.commons.beans.BasicPropertySupport;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-
-/**
- * <h3>AbstractProcessWizardPage</h3> ...
- */
-public abstract class AbstractWorkspaceWizardPage extends AbstractScoutWizardPage {
-
- private BasicPropertySupport m_propertySupport;
-
- public AbstractWorkspaceWizardPage(String pageName, String title, ImageDescriptor titleImage) {
- super(pageName, title, titleImage);
- m_propertySupport = new BasicPropertySupport(this);
-
- }
-
- public AbstractWorkspaceWizardPage(String pageName) {
- this(pageName, null, (ImageDescriptor) null);
- }
-
- @Override
- public final boolean performFinish() {
- return true;
- }
-
- /**
- * Override this method to do modifications on resources. This method will be called within
- * a ProcessJob using the IWorkspaceRoot rule.
- *
- * @param monitor
- * @param manager
- * @return
- */
- public boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager manager) throws CoreException {
- return true;
- }
-
- /**
- * @param listener
- * @see org.eclipse.scout.commons.beans.BasicPropertySupport#addPropertyChangeListener(java.beans.PropertyChangeListener)
- */
- public void addPropertyChangeListener(PropertyChangeListener listener) {
- m_propertySupport.addPropertyChangeListener(listener);
- }
-
- /**
- * @param propertyName
- * @param listener
- * @see org.eclipse.scout.commons.beans.BasicPropertySupport#addPropertyChangeListener(java.lang.String,
- * java.beans.PropertyChangeListener)
- */
- public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) {
- m_propertySupport.addPropertyChangeListener(propertyName, listener);
- }
-
- /**
- * @param name
- * @return
- * @see org.eclipse.scout.commons.beans.BasicPropertySupport#getProperty(java.lang.String)
- */
- public Object getProperty(String name) {
- return m_propertySupport.getProperty(name);
- }
-
- /**
- * @param name
- * @return
- * @see org.eclipse.scout.commons.beans.BasicPropertySupport#getPropertyBool(java.lang.String)
- */
- public boolean getPropertyBool(String name) {
- return m_propertySupport.getPropertyBool(name);
- }
-
- /**
- * @param name
- * @return
- * @see org.eclipse.scout.commons.beans.BasicPropertySupport#getPropertyDouble(java.lang.String)
- */
- public double getPropertyDouble(String name) {
- return m_propertySupport.getPropertyDouble(name);
- }
-
- /**
- * @param name
- * @return
- * @see org.eclipse.scout.commons.beans.BasicPropertySupport#getPropertyInt(java.lang.String)
- */
- public int getPropertyInt(String name) {
- return m_propertySupport.getPropertyInt(name);
- }
-
- /**
- * @param name
- * @return
- * @see org.eclipse.scout.commons.beans.BasicPropertySupport#getPropertyLong(java.lang.String)
- */
- public long getPropertyLong(String name) {
- return m_propertySupport.getPropertyLong(name);
- }
-
- /**
- * @param name
- * @return
- * @see org.eclipse.scout.commons.beans.BasicPropertySupport#getPropertyString(java.lang.String)
- */
- public String getPropertyString(String name) {
- return m_propertySupport.getPropertyString(name);
- }
-
- /**
- * @param listener
- * @see org.eclipse.scout.commons.beans.BasicPropertySupport#removePropertyChangeListener(java.beans.PropertyChangeListener)
- */
- public void removePropertyChangeListener(PropertyChangeListener listener) {
- m_propertySupport.removePropertyChangeListener(listener);
- }
-
- /**
- * @param propertyName
- * @param listener
- * @see org.eclipse.scout.commons.beans.BasicPropertySupport#removePropertyChangeListener(java.lang.String,
- * java.beans.PropertyChangeListener)
- */
- public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) {
- m_propertySupport.removePropertyChangeListener(propertyName, listener);
- }
-
- /**
- * @param name
- * @param newValue
- * @return
- * @see org.eclipse.scout.commons.beans.BasicPropertySupport#setProperty(java.lang.String, java.lang.Object)
- */
- public boolean setProperty(String name, Object newValue) {
- return m_propertySupport.setProperty(name, newValue);
- }
-
- /**
- * @param name
- * @param newValue
- * @see org.eclipse.scout.commons.beans.BasicPropertySupport#setPropertyAlwaysFire(java.lang.String, java.lang.Object)
- */
- public void setPropertyAlwaysFire(String name, Object newValue) {
- m_propertySupport.setPropertyAlwaysFire(name, newValue);
- }
-
- /**
- * @param name
- * @param b
- * @return
- * @see org.eclipse.scout.commons.beans.BasicPropertySupport#setPropertyBool(java.lang.String, boolean)
- */
- public boolean setPropertyBool(String name, boolean b) {
- return m_propertySupport.setPropertyBool(name, b);
- }
-
- /**
- * @param name
- * @param d
- * @see org.eclipse.scout.commons.beans.BasicPropertySupport#setPropertyDouble(java.lang.String, double)
- */
- public void setPropertyDouble(String name, double d) {
- m_propertySupport.setPropertyDouble(name, d);
- }
-
- /**
- * @param name
- * @param i
- * @see org.eclipse.scout.commons.beans.BasicPropertySupport#setPropertyInt(java.lang.String, int)
- */
- public void setPropertyInt(String name, int i) {
- m_propertySupport.setPropertyInt(name, i);
- }
-
- /**
- * @param name
- * @param i
- * @see org.eclipse.scout.commons.beans.BasicPropertySupport#setPropertyLong(java.lang.String, long)
- */
- public void setPropertyLong(String name, long i) {
- m_propertySupport.setPropertyLong(name, i);
- }
-
- /**
- * @param name
- * @param newValue
- * @return
- * @see org.eclipse.scout.commons.beans.BasicPropertySupport#setPropertyNoFire(java.lang.String, java.lang.Object)
- */
- public boolean setPropertyNoFire(String name, Object newValue) {
- return m_propertySupport.setPropertyNoFire(name, newValue);
- }
-
- /**
- * @param name
- * @param s
- * @see org.eclipse.scout.commons.beans.BasicPropertySupport#setPropertyString(java.lang.String, java.lang.String)
- */
- public void setPropertyString(String name, String s) {
- m_propertySupport.setPropertyString(name, s);
- }
-
-}
+/*******************************************************************************
+ * 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;
+
+import java.beans.PropertyChangeListener;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.scout.commons.beans.BasicPropertySupport;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+
+/**
+ * <h3>AbstractProcessWizardPage</h3> ...
+ */
+public abstract class AbstractWorkspaceWizardPage extends AbstractScoutWizardPage {
+
+ private BasicPropertySupport m_propertySupport;
+
+ public AbstractWorkspaceWizardPage(String pageName, String title, ImageDescriptor titleImage) {
+ super(pageName, title, titleImage);
+ m_propertySupport = new BasicPropertySupport(this);
+
+ }
+
+ public AbstractWorkspaceWizardPage(String pageName) {
+ this(pageName, null, (ImageDescriptor) null);
+ }
+
+ @Override
+ public final boolean performFinish() {
+ return true;
+ }
+
+ /**
+ * Override this method to do modifications on resources. This method will be called within
+ * a ProcessJob using the IWorkspaceRoot rule.
+ *
+ * @param monitor
+ * @param manager
+ * @return
+ */
+ public boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager manager) throws CoreException {
+ return true;
+ }
+
+ /**
+ * @param listener
+ * @see org.eclipse.scout.commons.beans.BasicPropertySupport#addPropertyChangeListener(java.beans.PropertyChangeListener)
+ */
+ public void addPropertyChangeListener(PropertyChangeListener listener) {
+ m_propertySupport.addPropertyChangeListener(listener);
+ }
+
+ /**
+ * @param propertyName
+ * @param listener
+ * @see org.eclipse.scout.commons.beans.BasicPropertySupport#addPropertyChangeListener(java.lang.String,
+ * java.beans.PropertyChangeListener)
+ */
+ public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) {
+ m_propertySupport.addPropertyChangeListener(propertyName, listener);
+ }
+
+ /**
+ * @param name
+ * @return
+ * @see org.eclipse.scout.commons.beans.BasicPropertySupport#getProperty(java.lang.String)
+ */
+ public Object getProperty(String name) {
+ return m_propertySupport.getProperty(name);
+ }
+
+ /**
+ * @param name
+ * @return
+ * @see org.eclipse.scout.commons.beans.BasicPropertySupport#getPropertyBool(java.lang.String)
+ */
+ public boolean getPropertyBool(String name) {
+ return m_propertySupport.getPropertyBool(name);
+ }
+
+ /**
+ * @param name
+ * @return
+ * @see org.eclipse.scout.commons.beans.BasicPropertySupport#getPropertyDouble(java.lang.String)
+ */
+ public double getPropertyDouble(String name) {
+ return m_propertySupport.getPropertyDouble(name);
+ }
+
+ /**
+ * @param name
+ * @return
+ * @see org.eclipse.scout.commons.beans.BasicPropertySupport#getPropertyInt(java.lang.String)
+ */
+ public int getPropertyInt(String name) {
+ return m_propertySupport.getPropertyInt(name);
+ }
+
+ /**
+ * @param name
+ * @return
+ * @see org.eclipse.scout.commons.beans.BasicPropertySupport#getPropertyLong(java.lang.String)
+ */
+ public long getPropertyLong(String name) {
+ return m_propertySupport.getPropertyLong(name);
+ }
+
+ /**
+ * @param name
+ * @return
+ * @see org.eclipse.scout.commons.beans.BasicPropertySupport#getPropertyString(java.lang.String)
+ */
+ public String getPropertyString(String name) {
+ return m_propertySupport.getPropertyString(name);
+ }
+
+ /**
+ * @param listener
+ * @see org.eclipse.scout.commons.beans.BasicPropertySupport#removePropertyChangeListener(java.beans.PropertyChangeListener)
+ */
+ public void removePropertyChangeListener(PropertyChangeListener listener) {
+ m_propertySupport.removePropertyChangeListener(listener);
+ }
+
+ /**
+ * @param propertyName
+ * @param listener
+ * @see org.eclipse.scout.commons.beans.BasicPropertySupport#removePropertyChangeListener(java.lang.String,
+ * java.beans.PropertyChangeListener)
+ */
+ public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) {
+ m_propertySupport.removePropertyChangeListener(propertyName, listener);
+ }
+
+ /**
+ * @param name
+ * @param newValue
+ * @return
+ * @see org.eclipse.scout.commons.beans.BasicPropertySupport#setProperty(java.lang.String, java.lang.Object)
+ */
+ public boolean setProperty(String name, Object newValue) {
+ return m_propertySupport.setProperty(name, newValue);
+ }
+
+ /**
+ * @param name
+ * @param newValue
+ * @see org.eclipse.scout.commons.beans.BasicPropertySupport#setPropertyAlwaysFire(java.lang.String, java.lang.Object)
+ */
+ public void setPropertyAlwaysFire(String name, Object newValue) {
+ m_propertySupport.setPropertyAlwaysFire(name, newValue);
+ }
+
+ /**
+ * @param name
+ * @param b
+ * @return
+ * @see org.eclipse.scout.commons.beans.BasicPropertySupport#setPropertyBool(java.lang.String, boolean)
+ */
+ public boolean setPropertyBool(String name, boolean b) {
+ return m_propertySupport.setPropertyBool(name, b);
+ }
+
+ /**
+ * @param name
+ * @param d
+ * @see org.eclipse.scout.commons.beans.BasicPropertySupport#setPropertyDouble(java.lang.String, double)
+ */
+ public void setPropertyDouble(String name, double d) {
+ m_propertySupport.setPropertyDouble(name, d);
+ }
+
+ /**
+ * @param name
+ * @param i
+ * @see org.eclipse.scout.commons.beans.BasicPropertySupport#setPropertyInt(java.lang.String, int)
+ */
+ public void setPropertyInt(String name, int i) {
+ m_propertySupport.setPropertyInt(name, i);
+ }
+
+ /**
+ * @param name
+ * @param i
+ * @see org.eclipse.scout.commons.beans.BasicPropertySupport#setPropertyLong(java.lang.String, long)
+ */
+ public void setPropertyLong(String name, long i) {
+ m_propertySupport.setPropertyLong(name, i);
+ }
+
+ /**
+ * @param name
+ * @param newValue
+ * @return
+ * @see org.eclipse.scout.commons.beans.BasicPropertySupport#setPropertyNoFire(java.lang.String, java.lang.Object)
+ */
+ public boolean setPropertyNoFire(String name, Object newValue) {
+ return m_propertySupport.setPropertyNoFire(name, newValue);
+ }
+
+ /**
+ * @param name
+ * @param s
+ * @see org.eclipse.scout.commons.beans.BasicPropertySupport#setPropertyString(java.lang.String, java.lang.String)
+ */
+ public void setPropertyString(String name, String s) {
+ m_propertySupport.setPropertyString(name, s);
+ }
+
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/BundleTreeWizardPage.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/BundleTreeWizardPage.java
index 0b6f14848..62d3a79c1 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/BundleTreeWizardPage.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/BundleTreeWizardPage.java
@@ -1,222 +1,222 @@
-/*******************************************************************************
- * 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;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.scout.sdk.ui.fields.bundletree.CheckableTree;
-import org.eclipse.scout.sdk.ui.fields.bundletree.DndEvent;
-import org.eclipse.scout.sdk.ui.fields.bundletree.ICheckStateListener;
-import org.eclipse.scout.sdk.ui.fields.bundletree.ITreeDndListener;
-import org.eclipse.scout.sdk.ui.fields.bundletree.ITreeNode;
-import org.eclipse.scout.sdk.ui.fields.bundletree.ITreeNodeFilter;
-import org.eclipse.scout.sdk.ui.fields.bundletree.NodeFilters;
-import org.eclipse.scout.sdk.ui.fields.bundletree.TreeUtility;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * <h3>BundleTreeWizardPage</h3> ...
- *
- * @author Andreas Hoegger
- * @since 1.0.8 12.02.2010
- */
-public class BundleTreeWizardPage extends AbstractWorkspaceWizardPage {
-
- private CheckableTree m_tree;
- private boolean m_treeListenersAttached = false;
- private final ITreeNode m_rootNode;
- private List<ITreeDndListener> m_tempListeners = new ArrayList<ITreeDndListener>();
- private Object m_tempListenersLock = new Object();
- private final ITreeNodeFilter m_initialCheckedFilter;
-
- public BundleTreeWizardPage(String pageTitle, String message, ITreeNode rootNode) {
- this(pageTitle, message, rootNode, null);
- }
-
- public BundleTreeWizardPage(String pageTitle, String message, ITreeNode rootNode, ITreeNodeFilter initialCheckedFilter) {
- super(BundleTreeWizardPage.class.getName());
- m_rootNode = rootNode;
- setDescription(message);
- setTitle(pageTitle);
- if (initialCheckedFilter == null) {
- initialCheckedFilter = NodeFilters.getAcceptNone();
- }
- m_initialCheckedFilter = initialCheckedFilter;
- }
-
- public void addDndListener(ITreeDndListener listener) {
- if (m_treeListenersAttached) {
- m_tree.addDndListener(listener);
- }
- else {
- synchronized (m_tempListenersLock) {
- m_tempListeners.add(listener);
- }
- }
- }
-
- public void removeDndListener(ITreeDndListener listener) {
- if (m_treeListenersAttached) {
- m_tree.removeDndListener(listener);
- }
- else {
- synchronized (m_tempListenersLock) {
- m_tempListeners.remove(listener);
- }
- }
- }
-
- @Override
- protected void createContent(Composite parent) {
- m_tree = new CheckableTree(parent, getRootNode());
- synchronized (m_tempListenersLock) {
- // listeners
- for (ITreeDndListener l : m_tempListeners) {
- m_tree.addDndListener(l);
- }
- m_tempListeners.clear();
- }
- m_treeListenersAttached = true;
- m_tree.addDndListener(new P_TreeDndListener());
- m_tree.setChecked(TreeUtility.findNodes(getRootNode(), m_initialCheckedFilter));
- m_tree.addCheckSelectionListener(new ICheckStateListener() {
- @Override
- public void fireNodeCheckStateChanged(ITreeNode node, boolean checkState) {
- pingStateChanging();
- }
- });
- // layout
- parent.setLayout(new GridLayout(1, true));
-
- GridData interfaceLocationData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.FILL_VERTICAL);
- interfaceLocationData.heightHint = 200;
- m_tree.setLayoutData(interfaceLocationData);
- }
-
- /**
- * @return the rootNode
- */
- public ITreeNode getRootNode() {
- return m_rootNode;
- }
-
- private CheckableTree getTree() {
- return m_tree;
- }
-
- public void refreshTree() {
- if (isControlCreated()) {
- m_tree.getTreeViewer().refresh();
- }
-
- }
-
- public IScoutBundle[] getLocationBundles(int type, boolean visibleOnly, boolean checkedOnly) {
- ITreeNode[] nodes = getTreeNodes(type, visibleOnly, checkedOnly);
- ArrayList<IScoutBundle> result = new ArrayList<IScoutBundle>();
- for (ITreeNode node : nodes) {
- if (node != null && node.getParent() != null && node.getParent().getData() instanceof IScoutBundle) {
- result.add((IScoutBundle) node.getParent().getData());
- }
- }
- return result.toArray(new IScoutBundle[result.size()]);
- }
-
- public ITreeNode[] getTreeNodes(int type, boolean visibleOnly, boolean checkedOnly) {
- ArrayList<ITreeNode> result = new ArrayList<ITreeNode>();
- if (isControlCreated()) {
- ITreeNode[] nodes = TreeUtility.findNodes(m_rootNode, NodeFilters.getByType(type));
- for (ITreeNode node : nodes) {
- if (node != null && checkedOnly && node.isCheckable()) {
- if (!getTree().isChecked(node)) {
- continue;
- }
- }
- if (node != null && visibleOnly) {
- if (!node.isVisible()) {
- continue;
- }
- }
- result.add(node);
- }
- }
- return result.toArray(new ITreeNode[result.size()]);
- }
-
- public IScoutBundle getLocationBundle(int type, boolean visibleOnly, boolean checkedOnly) {
- ITreeNode node = getTreeNode(type, visibleOnly, checkedOnly);
- if (node != null) {
- try {
- return (IScoutBundle) node.getParent().getData();
- }
- catch (ClassCastException e) {
- ScoutSdkUi.logError("Tree node data not instance of " + IScoutBundle.class.getName());
- return null;
- }
- }
- return null;
- }
-
- public ITreeNode getTreeNode(int type, boolean visibleOnly, boolean checkedOnly) {
- ITreeNode node = null;
- if (isControlCreated()) {
- node = TreeUtility.findNode(m_rootNode, NodeFilters.getByType(type));
- if (node != null) {
- if (node.isCheckable() && checkedOnly && !getTree().isChecked(node)) {
- return null;
- }
- if (visibleOnly && !node.isVisible()) {
- return null;
- }
- }
- }
- return node;
- }
-
- /**
- * @param nodeType
- * @return
- */
- public String getTextOfNode(int nodeType) {
- return getTextOfNode(nodeType, true, true);
- }
-
- public String getTextOfNode(int type, boolean visibleOnly, boolean checkedOnly) {
- ITreeNode treeNode = getTreeNode(type, visibleOnly, checkedOnly);
- String text = null;
- if (treeNode != null) {
- text = treeNode.getText();
- }
- return text;
- }
-
- private class P_TreeDndListener implements ITreeDndListener {
- @Override
- public boolean isDragableNode(ITreeNode node) {
- return true;
- }
-
- @Override
- public void validateTarget(DndEvent dndEvent) {
- }
-
- @Override
- public void dndPerformed(DndEvent dndEvent) {
- pingStateChanging();
- }
- } // end class P_TreeDndListener
-
-}
+/*******************************************************************************
+ * 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;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.scout.sdk.ui.fields.bundletree.CheckableTree;
+import org.eclipse.scout.sdk.ui.fields.bundletree.DndEvent;
+import org.eclipse.scout.sdk.ui.fields.bundletree.ICheckStateListener;
+import org.eclipse.scout.sdk.ui.fields.bundletree.ITreeDndListener;
+import org.eclipse.scout.sdk.ui.fields.bundletree.ITreeNode;
+import org.eclipse.scout.sdk.ui.fields.bundletree.ITreeNodeFilter;
+import org.eclipse.scout.sdk.ui.fields.bundletree.NodeFilters;
+import org.eclipse.scout.sdk.ui.fields.bundletree.TreeUtility;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * <h3>BundleTreeWizardPage</h3> ...
+ *
+ * @author Andreas Hoegger
+ * @since 1.0.8 12.02.2010
+ */
+public class BundleTreeWizardPage extends AbstractWorkspaceWizardPage {
+
+ private CheckableTree m_tree;
+ private boolean m_treeListenersAttached = false;
+ private final ITreeNode m_rootNode;
+ private List<ITreeDndListener> m_tempListeners = new ArrayList<ITreeDndListener>();
+ private Object m_tempListenersLock = new Object();
+ private final ITreeNodeFilter m_initialCheckedFilter;
+
+ public BundleTreeWizardPage(String pageTitle, String message, ITreeNode rootNode) {
+ this(pageTitle, message, rootNode, null);
+ }
+
+ public BundleTreeWizardPage(String pageTitle, String message, ITreeNode rootNode, ITreeNodeFilter initialCheckedFilter) {
+ super(BundleTreeWizardPage.class.getName());
+ m_rootNode = rootNode;
+ setDescription(message);
+ setTitle(pageTitle);
+ if (initialCheckedFilter == null) {
+ initialCheckedFilter = NodeFilters.getAcceptNone();
+ }
+ m_initialCheckedFilter = initialCheckedFilter;
+ }
+
+ public void addDndListener(ITreeDndListener listener) {
+ if (m_treeListenersAttached) {
+ m_tree.addDndListener(listener);
+ }
+ else {
+ synchronized (m_tempListenersLock) {
+ m_tempListeners.add(listener);
+ }
+ }
+ }
+
+ public void removeDndListener(ITreeDndListener listener) {
+ if (m_treeListenersAttached) {
+ m_tree.removeDndListener(listener);
+ }
+ else {
+ synchronized (m_tempListenersLock) {
+ m_tempListeners.remove(listener);
+ }
+ }
+ }
+
+ @Override
+ protected void createContent(Composite parent) {
+ m_tree = new CheckableTree(parent, getRootNode());
+ synchronized (m_tempListenersLock) {
+ // listeners
+ for (ITreeDndListener l : m_tempListeners) {
+ m_tree.addDndListener(l);
+ }
+ m_tempListeners.clear();
+ }
+ m_treeListenersAttached = true;
+ m_tree.addDndListener(new P_TreeDndListener());
+ m_tree.setChecked(TreeUtility.findNodes(getRootNode(), m_initialCheckedFilter));
+ m_tree.addCheckSelectionListener(new ICheckStateListener() {
+ @Override
+ public void fireNodeCheckStateChanged(ITreeNode node, boolean checkState) {
+ pingStateChanging();
+ }
+ });
+ // layout
+ parent.setLayout(new GridLayout(1, true));
+
+ GridData interfaceLocationData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.FILL_VERTICAL);
+ interfaceLocationData.heightHint = 200;
+ m_tree.setLayoutData(interfaceLocationData);
+ }
+
+ /**
+ * @return the rootNode
+ */
+ public ITreeNode getRootNode() {
+ return m_rootNode;
+ }
+
+ private CheckableTree getTree() {
+ return m_tree;
+ }
+
+ public void refreshTree() {
+ if (isControlCreated()) {
+ m_tree.getTreeViewer().refresh();
+ }
+
+ }
+
+ public IScoutBundle[] getLocationBundles(int type, boolean visibleOnly, boolean checkedOnly) {
+ ITreeNode[] nodes = getTreeNodes(type, visibleOnly, checkedOnly);
+ ArrayList<IScoutBundle> result = new ArrayList<IScoutBundle>();
+ for (ITreeNode node : nodes) {
+ if (node != null && node.getParent() != null && node.getParent().getData() instanceof IScoutBundle) {
+ result.add((IScoutBundle) node.getParent().getData());
+ }
+ }
+ return result.toArray(new IScoutBundle[result.size()]);
+ }
+
+ public ITreeNode[] getTreeNodes(int type, boolean visibleOnly, boolean checkedOnly) {
+ ArrayList<ITreeNode> result = new ArrayList<ITreeNode>();
+ if (isControlCreated()) {
+ ITreeNode[] nodes = TreeUtility.findNodes(m_rootNode, NodeFilters.getByType(type));
+ for (ITreeNode node : nodes) {
+ if (node != null && checkedOnly && node.isCheckable()) {
+ if (!getTree().isChecked(node)) {
+ continue;
+ }
+ }
+ if (node != null && visibleOnly) {
+ if (!node.isVisible()) {
+ continue;
+ }
+ }
+ result.add(node);
+ }
+ }
+ return result.toArray(new ITreeNode[result.size()]);
+ }
+
+ public IScoutBundle getLocationBundle(int type, boolean visibleOnly, boolean checkedOnly) {
+ ITreeNode node = getTreeNode(type, visibleOnly, checkedOnly);
+ if (node != null) {
+ try {
+ return (IScoutBundle) node.getParent().getData();
+ }
+ catch (ClassCastException e) {
+ ScoutSdkUi.logError("Tree node data not instance of " + IScoutBundle.class.getName());
+ return null;
+ }
+ }
+ return null;
+ }
+
+ public ITreeNode getTreeNode(int type, boolean visibleOnly, boolean checkedOnly) {
+ ITreeNode node = null;
+ if (isControlCreated()) {
+ node = TreeUtility.findNode(m_rootNode, NodeFilters.getByType(type));
+ if (node != null) {
+ if (node.isCheckable() && checkedOnly && !getTree().isChecked(node)) {
+ return null;
+ }
+ if (visibleOnly && !node.isVisible()) {
+ return null;
+ }
+ }
+ }
+ return node;
+ }
+
+ /**
+ * @param nodeType
+ * @return
+ */
+ public String getTextOfNode(int nodeType) {
+ return getTextOfNode(nodeType, true, true);
+ }
+
+ public String getTextOfNode(int type, boolean visibleOnly, boolean checkedOnly) {
+ ITreeNode treeNode = getTreeNode(type, visibleOnly, checkedOnly);
+ String text = null;
+ if (treeNode != null) {
+ text = treeNode.getText();
+ }
+ return text;
+ }
+
+ private class P_TreeDndListener implements ITreeDndListener {
+ @Override
+ public boolean isDragableNode(ITreeNode node) {
+ return true;
+ }
+
+ @Override
+ public void validateTarget(DndEvent dndEvent) {
+ }
+
+ @Override
+ public void dndPerformed(DndEvent dndEvent) {
+ pingStateChanging();
+ }
+ } // end class P_TreeDndListener
+
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/IStatusProvider.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/IStatusProvider.java
index 4bbaf5f67..d50bd5a8f 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/IStatusProvider.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/IStatusProvider.java
@@ -1,24 +1,24 @@
-/*******************************************************************************
- * 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;
-
-import org.eclipse.core.runtime.MultiStatus;
-
-/**
- * <h3>IStatusProvider</h3> ...
- *
- * @author Andreas Hoegger
- * @since 1.0.8 12.02.2010
- */
-public interface IStatusProvider {
-
- void validate(Object source, MultiStatus multiStatus);
-}
+/*******************************************************************************
+ * 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;
+
+import org.eclipse.core.runtime.MultiStatus;
+
+/**
+ * <h3>IStatusProvider</h3> ...
+ *
+ * @author Andreas Hoegger
+ * @since 1.0.8 12.02.2010
+ */
+public interface IStatusProvider {
+
+ void validate(Object source, MultiStatus multiStatus);
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/IWizardPageContainer.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/IWizardPageContainer.java
index f71352dfc..5811ce6a4 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/IWizardPageContainer.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/IWizardPageContainer.java
@@ -1,19 +1,19 @@
-/*******************************************************************************
- * 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;
-
-import org.eclipse.core.runtime.IStatus;
-
-public interface IWizardPageContainer {
-
- void setStatus(IStatus status, IStatus defaultOkStatus);
-
-}
+/*******************************************************************************
+ * 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;
+
+import org.eclipse.core.runtime.IStatus;
+
+public interface IWizardPageContainer {
+
+ void setStatus(IStatus status, IStatus defaultOkStatus);
+
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/ScoutWizardDialog.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/ScoutWizardDialog.java
index 7f1f65b5b..916d8b280 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/ScoutWizardDialog.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/ScoutWizardDialog.java
@@ -1,104 +1,104 @@
-/*******************************************************************************
- * 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;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.dialogs.IMessageProvider;
-import org.eclipse.jface.dialogs.IPageChangedListener;
-import org.eclipse.jface.dialogs.PageChangedEvent;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.swt.widgets.Shell;
-
-public class ScoutWizardDialog extends WizardDialog implements IWizardPageContainer {
-
- public ScoutWizardDialog(IWizard newWizard) {
- this(ScoutSdkUi.getDefault().getWorkbench().getActiveWorkbenchWindow().getShell(), newWizard);
- }
-
- public ScoutWizardDialog(Shell parentShell, IWizard newWizard) {
- super(parentShell, newWizard);
- super.addPageChangedListener(new IPageChangedListener() {
- @Override
- public void pageChanged(PageChangedEvent event) {
- // initially set the status
- if (event.getSelectedPage() instanceof AbstractScoutWizardPage) {
- AbstractScoutWizardPage selectedPage = (AbstractScoutWizardPage) event.getSelectedPage();
- selectedPage.postActivate();
- }
- }
- });
- }
-
- /**
- * delegate to the underlying wizard.
- */
- @Override
- protected IDialogSettings getDialogBoundsSettings() {
- if (getWizard() != null) {
- return getWizard().getDialogSettings();
- }
- return null;
- }
-
- @Override
- public void showPage(IWizardPage page) {
- super.showPage(page);
- if (page instanceof AbstractScoutWizardPage) {
- ((AbstractScoutWizardPage) page).setFocus();
- }
- else {
- page.getControl().setFocus();
- }
- }
-
- @Override
- public void setStatus(IStatus status, IStatus defaultOkStatus) {
- IStatus highestSeverityStatus = getHighestSeverityStatus(status, defaultOkStatus);
- int messagetype;
- switch (highestSeverityStatus.getSeverity()) {
- case IStatus.INFO:
- messagetype = IMessageProvider.INFORMATION;
- break;
- case IStatus.WARNING:
- messagetype = IMessageProvider.WARNING;
- break;
- case IStatus.ERROR:
- messagetype = IMessageProvider.ERROR;
- break;
- default:
- messagetype = IMessageProvider.NONE;
- break;
- }
- String message = highestSeverityStatus.getMessage();
-
- setMessage(message, messagetype);
-
- }
-
- private IStatus getHighestSeverityStatus(IStatus status, IStatus highestSeverity) {
- if (status.isMultiStatus()) {
- for (IStatus child : status.getChildren()) {
- highestSeverity = getHighestSeverityStatus(child, highestSeverity);
- }
- return highestSeverity;
- }
- else {
- if (highestSeverity.getSeverity() < status.getSeverity()) {
- highestSeverity = status;
- }
- return highestSeverity;
- }
- }
-}
+/*******************************************************************************
+ * 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;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.dialogs.IMessageProvider;
+import org.eclipse.jface.dialogs.IPageChangedListener;
+import org.eclipse.jface.dialogs.PageChangedEvent;
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.swt.widgets.Shell;
+
+public class ScoutWizardDialog extends WizardDialog implements IWizardPageContainer {
+
+ public ScoutWizardDialog(IWizard newWizard) {
+ this(ScoutSdkUi.getDefault().getWorkbench().getActiveWorkbenchWindow().getShell(), newWizard);
+ }
+
+ public ScoutWizardDialog(Shell parentShell, IWizard newWizard) {
+ super(parentShell, newWizard);
+ super.addPageChangedListener(new IPageChangedListener() {
+ @Override
+ public void pageChanged(PageChangedEvent event) {
+ // initially set the status
+ if (event.getSelectedPage() instanceof AbstractScoutWizardPage) {
+ AbstractScoutWizardPage selectedPage = (AbstractScoutWizardPage) event.getSelectedPage();
+ selectedPage.postActivate();
+ }
+ }
+ });
+ }
+
+ /**
+ * delegate to the underlying wizard.
+ */
+ @Override
+ protected IDialogSettings getDialogBoundsSettings() {
+ if (getWizard() != null) {
+ return getWizard().getDialogSettings();
+ }
+ return null;
+ }
+
+ @Override
+ public void showPage(IWizardPage page) {
+ super.showPage(page);
+ if (page instanceof AbstractScoutWizardPage) {
+ ((AbstractScoutWizardPage) page).setFocus();
+ }
+ else {
+ page.getControl().setFocus();
+ }
+ }
+
+ @Override
+ public void setStatus(IStatus status, IStatus defaultOkStatus) {
+ IStatus highestSeverityStatus = getHighestSeverityStatus(status, defaultOkStatus);
+ int messagetype;
+ switch (highestSeverityStatus.getSeverity()) {
+ case IStatus.INFO:
+ messagetype = IMessageProvider.INFORMATION;
+ break;
+ case IStatus.WARNING:
+ messagetype = IMessageProvider.WARNING;
+ break;
+ case IStatus.ERROR:
+ messagetype = IMessageProvider.ERROR;
+ break;
+ default:
+ messagetype = IMessageProvider.NONE;
+ break;
+ }
+ String message = highestSeverityStatus.getMessage();
+
+ setMessage(message, messagetype);
+
+ }
+
+ private IStatus getHighestSeverityStatus(IStatus status, IStatus highestSeverity) {
+ if (status.isMultiStatus()) {
+ for (IStatus child : status.getChildren()) {
+ highestSeverity = getHighestSeverityStatus(child, highestSeverity);
+ }
+ return highestSeverity;
+ }
+ else {
+ if (highestSeverity.getSeverity() < status.getSeverity()) {
+ highestSeverity = status;
+ }
+ return highestSeverity;
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/beanproperty/BeanPropertyNewWizard.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/beanproperty/BeanPropertyNewWizard.java
index 151207da8..b6b910233 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/beanproperty/BeanPropertyNewWizard.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/beanproperty/BeanPropertyNewWizard.java
@@ -1,41 +1,41 @@
-/*******************************************************************************
- * 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.beanproperty;
-
-import java.util.HashSet;
-import java.util.regex.Pattern;
-
-import org.eclipse.jdt.core.IMethod;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.operation.BeanPropertyNewOperation;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
-import org.eclipse.scout.sdk.util.type.MethodFilters;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-
-public class BeanPropertyNewWizard extends AbstractWorkspaceWizard {
-
- public BeanPropertyNewWizard(IType declaringType) {
- setWindowTitle(Texts.get("NewProperty"));
- BeanPropertyNewWizardPage beanPropertyWizardPage = new BeanPropertyNewWizardPage(TypeUtility.newSearchScope(declaringType.getJavaProject()));
- BeanPropertyNewOperation op = new BeanPropertyNewOperation(declaringType);
- beanPropertyWizardPage.setOperation(op);
- // find all used method names
- HashSet<String> notAllowedMethodNames = new HashSet<String>();
- IMethod[] methods = TypeUtility.getMethods(declaringType, MethodFilters.getNameRegexFilter(Pattern.compile("^(get|set|is).*")));
- for (IMethod m : methods) {
- notAllowedMethodNames.add(m.getElementName());
- }
- beanPropertyWizardPage.setNotAllowedNames(notAllowedMethodNames);
- addPage(beanPropertyWizardPage);
- }
-
-}
+/*******************************************************************************
+ * 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.beanproperty;
+
+import java.util.HashSet;
+import java.util.regex.Pattern;
+
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.operation.BeanPropertyNewOperation;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
+import org.eclipse.scout.sdk.util.type.MethodFilters;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+
+public class BeanPropertyNewWizard extends AbstractWorkspaceWizard {
+
+ public BeanPropertyNewWizard(IType declaringType) {
+ setWindowTitle(Texts.get("NewProperty"));
+ BeanPropertyNewWizardPage beanPropertyWizardPage = new BeanPropertyNewWizardPage(TypeUtility.newSearchScope(declaringType.getJavaProject()));
+ BeanPropertyNewOperation op = new BeanPropertyNewOperation(declaringType);
+ beanPropertyWizardPage.setOperation(op);
+ // find all used method names
+ HashSet<String> notAllowedMethodNames = new HashSet<String>();
+ IMethod[] methods = TypeUtility.getMethods(declaringType, MethodFilters.getNameRegexFilter(Pattern.compile("^(get|set|is).*")));
+ for (IMethod m : methods) {
+ notAllowedMethodNames.add(m.getElementName());
+ }
+ beanPropertyWizardPage.setNotAllowedNames(notAllowedMethodNames);
+ addPage(beanPropertyWizardPage);
+ }
+
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/beanproperty/BeanPropertyNewWizardPage.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/beanproperty/BeanPropertyNewWizardPage.java
index 285ebef71..10ae29bf5 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/beanproperty/BeanPropertyNewWizardPage.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/beanproperty/BeanPropertyNewWizardPage.java
@@ -1,238 +1,238 @@
-/*******************************************************************************
- * 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.beanproperty;
-
-import java.util.Set;
-
-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.Flags;
-import org.eclipse.jdt.core.search.IJavaSearchScope;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.operation.IBeanPropertyNewOperation;
-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.signature.SignatureLabelProvider;
-import org.eclipse.scout.sdk.ui.fields.proposal.signature.SignatureProposalProvider;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
-import org.eclipse.scout.sdk.util.Regex;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-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;
-
-public class BeanPropertyNewWizardPage extends AbstractWorkspaceWizardPage {
-
- // fields
- private String m_beanName;
- private String m_beanSignature;
-
- // ui fields
- private StyledTextField m_beanNameField;
- private ProposalTextField m_beanTypeField;
-
- // other fields
- private IBeanPropertyNewOperation m_operation;
- private Set<String> m_notAllowedNames;
-
- private final IJavaSearchScope m_searchScope;
-
- public BeanPropertyNewWizardPage(IJavaSearchScope searchScope) {
- super(BeanPropertyNewWizardPage.class.getName());
- m_searchScope = searchScope;
- setTitle(Texts.get("NewPropertyBean"));
- setDescription(Texts.get("NewPropertyBeanDesc"));
- }
-
- @Override
- protected void createContent(Composite parent) {
- // find client session
-
- m_beanNameField = new StyledTextField(parent, Texts.get("Dialog_rename_oldNameLabel"));
- m_beanNameField.setText(getBeanName());
- m_beanNameField.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- m_beanName = m_beanNameField.getText();
- pingStateChanging();
- }
- });
-
- ILabelProvider labelProvider = new SignatureLabelProvider();
- SignatureProposalProvider contentProvider = new SignatureProposalProvider(m_searchScope, labelProvider, SignatureProposalProvider.DEFAULT_MOST_USED, true);
- contentProvider.setPrimitivSignatures(SignatureProposalProvider.DEFAULT_PRIMITIV_SIGNATURES);
- m_beanTypeField = getFieldToolkit().createProposalField(parent, Texts.get("Dialog_propertyBean_typeLabel"));
- m_beanTypeField.setLabelProvider(labelProvider);
- m_beanTypeField.setContentProvider(contentProvider);
- m_beanTypeField.acceptProposal(getBeanSignature());
- m_beanTypeField.addProposalAdapterListener(new IProposalAdapterListener() {
- @Override
- public void proposalAccepted(ContentProposalEvent event) {
- try {
- setStateChanging(true);
- m_beanSignature = (String) event.proposal;
- }
- finally {
- setStateChanging(false);
- }
- }
- });
-
- // m_beanGenericTypeField=new ProposalTextField(parent, new BcElementProposalProvider(getProjectGroup(), false, false));
- // m_beanGenericTypeField.setEnabled(false);
- // m_beanGenericTypeField.acceptProposal(getBeanGenericType());
- // m_beanGenericTypeField.setLabelText(Texts.get("Dialog_propertyBean_genericLabel"));
- // m_beanGenericTypeField.addProposalAdapterListener(new IProposalAdapterListener(){
- // public void proposalAccepted(ContentProposalEvent event){
- // m_beanGenericType=(IBCTypeProposal)event.proposal;
- // pingStateChanging();
- // }
- // });
-
- parent.setLayout(new GridLayout(1, true));
- // layout
- m_beanNameField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
- m_beanTypeField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
- // m_beanGenericTypeField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL|GridData.GRAB_HORIZONTAL));
- }
-
- @Override
- protected void validatePage(MultiStatus multiStatus) {
-
- // m_propertyName
- IStatus status = getPropertyNameStatus();
- multiStatus.add(status);
- multiStatus.add(getPropertyTypeStatus());
- // m_beanType
- // IStatus typeStatus=getPropertyTypeStatus();
- // ControlStatusFactory.applyStatusToField(m_beanTypeField, typeStatus);
- // multiStatus.add(typeStatus);
- // // m_genericType
- // IStatus genericStatus=getBeanGenericStatus();
- // ControlStatusFactory.applyStatusToField(m_beanGenericTypeField, genericStatus);
- // multiStatus.add(genericStatus);
- }
-
- private IStatus getPropertyNameStatus() {
- String propertyName = getBeanName();
- if (propertyName == null || propertyName.length() == 0) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
- }
- else {
- // check existing method names
- if (m_notAllowedNames != null &&
- (m_notAllowedNames.contains("get" + getBeanName(true)) ||
- m_notAllowedNames.contains("set" + getBeanName(true)) ||
- m_notAllowedNames.contains("is" + getBeanName(true)))) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
- }
- if (Regex.REGEX_WELLFORMED_PROPERTY.matcher(propertyName).matches()) {
- return Status.OK_STATUS;
- }
- if (Regex.REGEX_JAVAFIELD.matcher(propertyName).matches()) {
- return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
- }
- else {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", propertyName));
- }
- }
- }
-
- private IStatus getPropertyTypeStatus() {
- String signature = getBeanSignature();
- if (signature == null) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_beanTypeNull"));
- }
- return Status.OK_STATUS;
- }
-
- @Override
- public boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager manager) throws CoreException {
- m_operation.setBeanName(getBeanName());
- m_operation.setBeanTypeSignature(getBeanSignature());
- m_operation.setMethodFlags(Flags.AccPublic);
- m_operation.run(monitor, manager);
- return true;
- }
-
- public Set<String> getNotAllowedNames() {
- return m_notAllowedNames;
- }
-
- public void setNotAllowedNames(Set<String> notAllowedNames) {
- m_notAllowedNames = notAllowedNames;
- }
-
- public IBeanPropertyNewOperation getOperation() {
- return m_operation;
- }
-
- public void setOperation(IBeanPropertyNewOperation operation) {
- m_operation = operation;
- }
-
- public String getBeanName() {
- return m_beanName;
- }
-
- public String getBeanName(boolean startWithUpperCase) {
- if (StringUtility.isNullOrEmpty(getBeanName())) {
- return null;
- }
- if (startWithUpperCase) {
- return Character.toUpperCase(getBeanName().charAt(0)) + getBeanName().substring(1);
- }
- else {
- return Character.toLowerCase(getBeanName().charAt(0)) + getBeanName().substring(1);
- }
- }
-
- public void setBeanName(String beanName) {
- try {
- setStateChanging(true);
- m_beanName = beanName;
- if (isControlCreated()) {
- m_beanNameField.setText(beanName);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- public String getBeanSignature() {
- return m_beanSignature;
- }
-
- public void setBeanSignature(String beanSignature) {
- try {
- setStateChanging(true);
- m_beanSignature = beanSignature;
- if (isControlCreated()) {
- m_beanTypeField.acceptProposal(beanSignature);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
-}
+/*******************************************************************************
+ * 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.beanproperty;
+
+import java.util.Set;
+
+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.Flags;
+import org.eclipse.jdt.core.search.IJavaSearchScope;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.operation.IBeanPropertyNewOperation;
+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.signature.SignatureLabelProvider;
+import org.eclipse.scout.sdk.ui.fields.proposal.signature.SignatureProposalProvider;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
+import org.eclipse.scout.sdk.util.Regex;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+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;
+
+public class BeanPropertyNewWizardPage extends AbstractWorkspaceWizardPage {
+
+ // fields
+ private String m_beanName;
+ private String m_beanSignature;
+
+ // ui fields
+ private StyledTextField m_beanNameField;
+ private ProposalTextField m_beanTypeField;
+
+ // other fields
+ private IBeanPropertyNewOperation m_operation;
+ private Set<String> m_notAllowedNames;
+
+ private final IJavaSearchScope m_searchScope;
+
+ public BeanPropertyNewWizardPage(IJavaSearchScope searchScope) {
+ super(BeanPropertyNewWizardPage.class.getName());
+ m_searchScope = searchScope;
+ setTitle(Texts.get("NewPropertyBean"));
+ setDescription(Texts.get("NewPropertyBeanDesc"));
+ }
+
+ @Override
+ protected void createContent(Composite parent) {
+ // find client session
+
+ m_beanNameField = new StyledTextField(parent, Texts.get("Dialog_rename_oldNameLabel"));
+ m_beanNameField.setText(getBeanName());
+ m_beanNameField.addModifyListener(new ModifyListener() {
+ @Override
+ public void modifyText(ModifyEvent e) {
+ m_beanName = m_beanNameField.getText();
+ pingStateChanging();
+ }
+ });
+
+ ILabelProvider labelProvider = new SignatureLabelProvider();
+ SignatureProposalProvider contentProvider = new SignatureProposalProvider(m_searchScope, labelProvider, SignatureProposalProvider.DEFAULT_MOST_USED, true);
+ contentProvider.setPrimitivSignatures(SignatureProposalProvider.DEFAULT_PRIMITIV_SIGNATURES);
+ m_beanTypeField = getFieldToolkit().createProposalField(parent, Texts.get("Dialog_propertyBean_typeLabel"));
+ m_beanTypeField.setLabelProvider(labelProvider);
+ m_beanTypeField.setContentProvider(contentProvider);
+ m_beanTypeField.acceptProposal(getBeanSignature());
+ m_beanTypeField.addProposalAdapterListener(new IProposalAdapterListener() {
+ @Override
+ public void proposalAccepted(ContentProposalEvent event) {
+ try {
+ setStateChanging(true);
+ m_beanSignature = (String) event.proposal;
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+ });
+
+ // m_beanGenericTypeField=new ProposalTextField(parent, new BcElementProposalProvider(getProjectGroup(), false, false));
+ // m_beanGenericTypeField.setEnabled(false);
+ // m_beanGenericTypeField.acceptProposal(getBeanGenericType());
+ // m_beanGenericTypeField.setLabelText(Texts.get("Dialog_propertyBean_genericLabel"));
+ // m_beanGenericTypeField.addProposalAdapterListener(new IProposalAdapterListener(){
+ // public void proposalAccepted(ContentProposalEvent event){
+ // m_beanGenericType=(IBCTypeProposal)event.proposal;
+ // pingStateChanging();
+ // }
+ // });
+
+ parent.setLayout(new GridLayout(1, true));
+ // layout
+ m_beanNameField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
+ m_beanTypeField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
+ // m_beanGenericTypeField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL|GridData.GRAB_HORIZONTAL));
+ }
+
+ @Override
+ protected void validatePage(MultiStatus multiStatus) {
+
+ // m_propertyName
+ IStatus status = getPropertyNameStatus();
+ multiStatus.add(status);
+ multiStatus.add(getPropertyTypeStatus());
+ // m_beanType
+ // IStatus typeStatus=getPropertyTypeStatus();
+ // ControlStatusFactory.applyStatusToField(m_beanTypeField, typeStatus);
+ // multiStatus.add(typeStatus);
+ // // m_genericType
+ // IStatus genericStatus=getBeanGenericStatus();
+ // ControlStatusFactory.applyStatusToField(m_beanGenericTypeField, genericStatus);
+ // multiStatus.add(genericStatus);
+ }
+
+ private IStatus getPropertyNameStatus() {
+ String propertyName = getBeanName();
+ if (propertyName == null || propertyName.length() == 0) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
+ }
+ else {
+ // check existing method names
+ if (m_notAllowedNames != null &&
+ (m_notAllowedNames.contains("get" + getBeanName(true)) ||
+ m_notAllowedNames.contains("set" + getBeanName(true)) ||
+ m_notAllowedNames.contains("is" + getBeanName(true)))) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
+ }
+ if (Regex.REGEX_WELLFORMED_PROPERTY.matcher(propertyName).matches()) {
+ return Status.OK_STATUS;
+ }
+ if (Regex.REGEX_JAVAFIELD.matcher(propertyName).matches()) {
+ return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
+ }
+ else {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", propertyName));
+ }
+ }
+ }
+
+ private IStatus getPropertyTypeStatus() {
+ String signature = getBeanSignature();
+ if (signature == null) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_beanTypeNull"));
+ }
+ return Status.OK_STATUS;
+ }
+
+ @Override
+ public boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager manager) throws CoreException {
+ m_operation.setBeanName(getBeanName());
+ m_operation.setBeanTypeSignature(getBeanSignature());
+ m_operation.setMethodFlags(Flags.AccPublic);
+ m_operation.run(monitor, manager);
+ return true;
+ }
+
+ public Set<String> getNotAllowedNames() {
+ return m_notAllowedNames;
+ }
+
+ public void setNotAllowedNames(Set<String> notAllowedNames) {
+ m_notAllowedNames = notAllowedNames;
+ }
+
+ public IBeanPropertyNewOperation getOperation() {
+ return m_operation;
+ }
+
+ public void setOperation(IBeanPropertyNewOperation operation) {
+ m_operation = operation;
+ }
+
+ public String getBeanName() {
+ return m_beanName;
+ }
+
+ public String getBeanName(boolean startWithUpperCase) {
+ if (StringUtility.isNullOrEmpty(getBeanName())) {
+ return null;
+ }
+ if (startWithUpperCase) {
+ return Character.toUpperCase(getBeanName().charAt(0)) + getBeanName().substring(1);
+ }
+ else {
+ return Character.toLowerCase(getBeanName().charAt(0)) + getBeanName().substring(1);
+ }
+ }
+
+ public void setBeanName(String beanName) {
+ try {
+ setStateChanging(true);
+ m_beanName = beanName;
+ if (isControlCreated()) {
+ m_beanNameField.setText(beanName);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ public String getBeanSignature() {
+ return m_beanSignature;
+ }
+
+ public void setBeanSignature(String beanSignature) {
+ try {
+ setStateChanging(true);
+ m_beanSignature = beanSignature;
+ if (isControlCreated()) {
+ m_beanTypeField.acceptProposal(beanSignature);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/beanproperty/SharedContextBeanPropertyNewWizard.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/beanproperty/SharedContextBeanPropertyNewWizard.java
index c567a1fa7..79c38d0fa 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/beanproperty/SharedContextBeanPropertyNewWizard.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/beanproperty/SharedContextBeanPropertyNewWizard.java
@@ -1,72 +1,72 @@
-/*******************************************************************************
- * 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.beanproperty;
-
-import java.util.HashSet;
-import java.util.Set;
-import java.util.regex.Pattern;
-
-import org.eclipse.jdt.core.Flags;
-import org.eclipse.jdt.core.IMethod;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.scout.sdk.ScoutSdkCore;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.operation.SharedContextBeanPropertyNewOperation;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
-import org.eclipse.scout.sdk.util.type.IMethodFilter;
-import org.eclipse.scout.sdk.util.type.MethodFilters;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-
-public class SharedContextBeanPropertyNewWizard extends AbstractWorkspaceWizard {
-
- public SharedContextBeanPropertyNewWizard(IType serverSessionType, IType clientSessionType) {
- setWindowTitle(Texts.get("NewSharedContextProperty"));
- BeanPropertyNewWizardPage beanPropertyWizardPage = new BeanPropertyNewWizardPage(ScoutSdkCore.getScoutWorkspace().getScoutBundle(serverSessionType.getJavaProject().getProject()).getSearchScope());
-
- SharedContextBeanPropertyNewOperation op = new SharedContextBeanPropertyNewOperation(serverSessionType, clientSessionType);
- beanPropertyWizardPage.setOperation(op);
- // IType[] serverSessions=SDE.getType(RuntimeClasses.IServerSession).getSubTypes(false,BCTypeFilters.getExistingNonAbstractClassesInProjectGroup(group));
- // IType serverSession = null;
- // if(serverSessions != null && serverSessions.length > 0){
- // serverSession = serverSessions[0];
- // }
- // IType[] clientSessions=SDE.getType(RuntimeClasses.IClientSession).getSubTypes(false,BCTypeFilters.getExistingNonAbstractClassesInProjectGroup(group));
- // IType clientSession = null;
- // if(clientSessions != null && clientSessions.length > 0){
- // clientSession = clientSessions[0];
- // }
- // op.setServerSessionType(serverSession);
- // op.setClientSessionType(clientSession);
- // beanPropertyWizardPage.setOperation(op);
-
- // find all used method names
- HashSet<String> notAllowedMethodNames = new HashSet<String>();
- if (serverSessionType != null) {
- collectMethodNames(serverSessionType, notAllowedMethodNames);
- }
- if (clientSessionType != null) {
- collectMethodNames(clientSessionType, notAllowedMethodNames);
- }
- beanPropertyWizardPage.setNotAllowedNames(notAllowedMethodNames);
- addPage(beanPropertyWizardPage);
- }
-
- protected void collectMethodNames(IType type, Set<String> collector) {
- IMethodFilter filter = MethodFilters.getMultiMethodFilter(
- MethodFilters.getFlagsFilter(Flags.AccPublic),
- MethodFilters.getNameRegexFilter(Pattern.compile("^(get|set|is).*")));
-
- for (IMethod m : TypeUtility.getMethods(type, filter)) {
- collector.add(m.getElementName());
- }
-
- }
-}
+/*******************************************************************************
+ * 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.beanproperty;
+
+import java.util.HashSet;
+import java.util.Set;
+import java.util.regex.Pattern;
+
+import org.eclipse.jdt.core.Flags;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.scout.sdk.ScoutSdkCore;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.operation.SharedContextBeanPropertyNewOperation;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
+import org.eclipse.scout.sdk.util.type.IMethodFilter;
+import org.eclipse.scout.sdk.util.type.MethodFilters;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+
+public class SharedContextBeanPropertyNewWizard extends AbstractWorkspaceWizard {
+
+ public SharedContextBeanPropertyNewWizard(IType serverSessionType, IType clientSessionType) {
+ setWindowTitle(Texts.get("NewSharedContextProperty"));
+ BeanPropertyNewWizardPage beanPropertyWizardPage = new BeanPropertyNewWizardPage(ScoutSdkCore.getScoutWorkspace().getScoutBundle(serverSessionType.getJavaProject().getProject()).getSearchScope());
+
+ SharedContextBeanPropertyNewOperation op = new SharedContextBeanPropertyNewOperation(serverSessionType, clientSessionType);
+ beanPropertyWizardPage.setOperation(op);
+ // IType[] serverSessions=SDE.getType(RuntimeClasses.IServerSession).getSubTypes(false,BCTypeFilters.getExistingNonAbstractClassesInProjectGroup(group));
+ // IType serverSession = null;
+ // if(serverSessions != null && serverSessions.length > 0){
+ // serverSession = serverSessions[0];
+ // }
+ // IType[] clientSessions=SDE.getType(RuntimeClasses.IClientSession).getSubTypes(false,BCTypeFilters.getExistingNonAbstractClassesInProjectGroup(group));
+ // IType clientSession = null;
+ // if(clientSessions != null && clientSessions.length > 0){
+ // clientSession = clientSessions[0];
+ // }
+ // op.setServerSessionType(serverSession);
+ // op.setClientSessionType(clientSession);
+ // beanPropertyWizardPage.setOperation(op);
+
+ // find all used method names
+ HashSet<String> notAllowedMethodNames = new HashSet<String>();
+ if (serverSessionType != null) {
+ collectMethodNames(serverSessionType, notAllowedMethodNames);
+ }
+ if (clientSessionType != null) {
+ collectMethodNames(clientSessionType, notAllowedMethodNames);
+ }
+ beanPropertyWizardPage.setNotAllowedNames(notAllowedMethodNames);
+ addPage(beanPropertyWizardPage);
+ }
+
+ protected void collectMethodNames(IType type, Set<String> collector) {
+ IMethodFilter filter = MethodFilters.getMultiMethodFilter(
+ MethodFilters.getFlagsFilter(Flags.AccPublic),
+ MethodFilters.getNameRegexFilter(Pattern.compile("^(get|set|is).*")));
+
+ for (IMethod m : TypeUtility.getMethods(type, filter)) {
+ collector.add(m.getElementName());
+ }
+
+ }
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/bundle/BundleImportWizard.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/bundle/BundleImportWizard.java
index b1de13984..1b989c68e 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/bundle/BundleImportWizard.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/bundle/BundleImportWizard.java
@@ -1,26 +1,26 @@
-/*******************************************************************************
- * 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.bundle;
-
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
-
-public class BundleImportWizard extends AbstractWorkspaceWizard {
-
- private BundleImportWizardPage m_importBundlePage;
-
- public BundleImportWizard() {
- // create pages
- setWindowTitle(Texts.get("ImportBundle"));
- m_importBundlePage = new BundleImportWizardPage();
- addPage(m_importBundlePage);
- }
-}
+/*******************************************************************************
+ * 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.bundle;
+
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
+
+public class BundleImportWizard extends AbstractWorkspaceWizard {
+
+ private BundleImportWizardPage m_importBundlePage;
+
+ public BundleImportWizard() {
+ // create pages
+ setWindowTitle(Texts.get("ImportBundle"));
+ m_importBundlePage = new BundleImportWizardPage();
+ addPage(m_importBundlePage);
+ }
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/bundle/BundleImportWizardPage.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/bundle/BundleImportWizardPage.java
index 846b2e735..f3818636f 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/bundle/BundleImportWizardPage.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/bundle/BundleImportWizardPage.java
@@ -1,140 +1,140 @@
-/*******************************************************************************
- * 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.bundle;
-
-import java.util.ArrayList;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.pde.core.plugin.IPluginModelBase;
-import org.eclipse.pde.core.plugin.PluginRegistry;
-import org.eclipse.scout.sdk.ScoutSdkCore;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.operation.project.BundleImportOperation;
-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.StaticContentProvider;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.MessageBox;
-
-/**
- * <h3> {@link BundleImportWizardPage}</h3> ...
- */
-public class BundleImportWizardPage extends AbstractWorkspaceWizardPage {
-
- // ui fields
- private ProposalTextField m_pluginModelField;
-
- // members
- private IPluginModelBase m_pluginModel;
-
- // process members
- private boolean m_projectIdFieldEnabled = true;
-
- public BundleImportWizardPage() {
- super(BundleImportWizardPage.class.getName());
- setTitle(Texts.get("ImportScoutBundle"));
- setDescription(Texts.get("BundleImportDesc"));
- }
-
- @Override
- protected void createContent(Composite parent) {
- IPluginModelBase[] workspaceModels = PluginRegistry.getWorkspaceModels();
- ArrayList<IPluginModelBase> proposals = new ArrayList<IPluginModelBase>();
- for (IPluginModelBase pluginModel : workspaceModels) {
- IProject p = pluginModel.getUnderlyingResource().getProject();
- if (ScoutSdkCore.getScoutWorkspace().getScoutBundle(p) == null) {
- proposals.add(pluginModel);
- }
- }
-
- m_pluginModelField = getFieldToolkit().createProposalField(parent, Texts.get("PluginToImport"));
- ILabelProvider labelProvider = new P_PluginDescLabelProvider();
- m_pluginModelField.setLabelProvider(labelProvider);
- m_pluginModelField.setContentProvider(new StaticContentProvider(proposals.toArray(new Object[proposals.size()]), labelProvider));
-
- // m_pluginModelField.acceptProposal(m_superType);
- m_pluginModelField.addProposalAdapterListener(new IProposalAdapterListener() {
- @Override
- public void proposalAccepted(ContentProposalEvent event) {
- try {
- setStateChanging(true);
- setPluginSelectionInternal((IPluginModelBase) event.proposal);
- }
- finally {
- setStateChanging(false);
- }
- }
- });
-
- // layout
- parent.setLayout(new GridLayout(1, true));
- m_pluginModelField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- }
-
- private void setPluginSelectionInternal(IPluginModelBase proposal) {
- m_pluginModel = proposal;
- }
-
- @Override
- public boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
- BundleImportOperation operation = new BundleImportOperation();
- operation.setPluginModel(getPluginModel());
- operation.run(monitor, workingCopyManager);
-
- ScoutSdkUi.getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- MessageBox box = new MessageBox(ScoutSdkUi.getShell(), SWT.ICON_INFORMATION | SWT.OK);
- box.setMessage(Texts.get("BundleImportRestartMsg"));
- box.open();
- }
- });
-
- return true;
- }
-
- public void setPluginModel(IPluginModelBase pluginModel) {
- m_pluginModel = pluginModel;
- }
-
- public IPluginModelBase getPluginModel() {
- return m_pluginModel;
- }
-
- public boolean isProjectIdFieldEnabled() {
- return m_projectIdFieldEnabled;
- }
-
- private class P_PluginDescLabelProvider extends LabelProvider {
- @Override
- public String getText(Object element) {
- IPluginModelBase pluginModel = (IPluginModelBase) element;
- return pluginModel.getBundleDescription().getName();
- }
-
- @Override
- public Image getImage(Object element) {
- return ScoutSdkUi.getImage(ScoutSdkUi.SharedBundle);
- }
- }
-}
+/*******************************************************************************
+ * 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.bundle;
+
+import java.util.ArrayList;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.pde.core.plugin.IPluginModelBase;
+import org.eclipse.pde.core.plugin.PluginRegistry;
+import org.eclipse.scout.sdk.ScoutSdkCore;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.operation.project.BundleImportOperation;
+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.StaticContentProvider;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.MessageBox;
+
+/**
+ * <h3> {@link BundleImportWizardPage}</h3> ...
+ */
+public class BundleImportWizardPage extends AbstractWorkspaceWizardPage {
+
+ // ui fields
+ private ProposalTextField m_pluginModelField;
+
+ // members
+ private IPluginModelBase m_pluginModel;
+
+ // process members
+ private boolean m_projectIdFieldEnabled = true;
+
+ public BundleImportWizardPage() {
+ super(BundleImportWizardPage.class.getName());
+ setTitle(Texts.get("ImportScoutBundle"));
+ setDescription(Texts.get("BundleImportDesc"));
+ }
+
+ @Override
+ protected void createContent(Composite parent) {
+ IPluginModelBase[] workspaceModels = PluginRegistry.getWorkspaceModels();
+ ArrayList<IPluginModelBase> proposals = new ArrayList<IPluginModelBase>();
+ for (IPluginModelBase pluginModel : workspaceModels) {
+ IProject p = pluginModel.getUnderlyingResource().getProject();
+ if (ScoutSdkCore.getScoutWorkspace().getScoutBundle(p) == null) {
+ proposals.add(pluginModel);
+ }
+ }
+
+ m_pluginModelField = getFieldToolkit().createProposalField(parent, Texts.get("PluginToImport"));
+ ILabelProvider labelProvider = new P_PluginDescLabelProvider();
+ m_pluginModelField.setLabelProvider(labelProvider);
+ m_pluginModelField.setContentProvider(new StaticContentProvider(proposals.toArray(new Object[proposals.size()]), labelProvider));
+
+ // m_pluginModelField.acceptProposal(m_superType);
+ m_pluginModelField.addProposalAdapterListener(new IProposalAdapterListener() {
+ @Override
+ public void proposalAccepted(ContentProposalEvent event) {
+ try {
+ setStateChanging(true);
+ setPluginSelectionInternal((IPluginModelBase) event.proposal);
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+ });
+
+ // layout
+ parent.setLayout(new GridLayout(1, true));
+ m_pluginModelField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ }
+
+ private void setPluginSelectionInternal(IPluginModelBase proposal) {
+ m_pluginModel = proposal;
+ }
+
+ @Override
+ public boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
+ BundleImportOperation operation = new BundleImportOperation();
+ operation.setPluginModel(getPluginModel());
+ operation.run(monitor, workingCopyManager);
+
+ ScoutSdkUi.getDisplay().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ MessageBox box = new MessageBox(ScoutSdkUi.getShell(), SWT.ICON_INFORMATION | SWT.OK);
+ box.setMessage(Texts.get("BundleImportRestartMsg"));
+ box.open();
+ }
+ });
+
+ return true;
+ }
+
+ public void setPluginModel(IPluginModelBase pluginModel) {
+ m_pluginModel = pluginModel;
+ }
+
+ public IPluginModelBase getPluginModel() {
+ return m_pluginModel;
+ }
+
+ public boolean isProjectIdFieldEnabled() {
+ return m_projectIdFieldEnabled;
+ }
+
+ private class P_PluginDescLabelProvider extends LabelProvider {
+ @Override
+ public String getText(Object element) {
+ IPluginModelBase pluginModel = (IPluginModelBase) element;
+ return pluginModel.getBundleDescription().getName();
+ }
+
+ @Override
+ public Image getImage(Object element) {
+ return ScoutSdkUi.getImage(ScoutSdkUi.SharedBundle);
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/code/CodeNewWizard.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/code/CodeNewWizard.java
index 03fb9cb2f..f132f2f89 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/code/CodeNewWizard.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/code/CodeNewWizard.java
@@ -1,46 +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.code;
-
-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 CodeNewWizard extends AbstractFormFieldWizard {
-
- private CodeNewWizardPage m_page1;
-
- public CodeNewWizard() {
- setWindowTitle(Texts.get("NewCode"));
- }
-
- @Override
- public void initWizard(IType declaringType) {
- super.initWizard(declaringType);
- m_page1 = new CodeNewWizardPage(getDeclaringType());
- addPage(m_page1);
- }
-
- @Override
- public void setSuperType(IType superType) {
- m_page1.setSuperType(superType);
- }
-
- @Override
- protected void postFinishDisplayThread() {
- IType createdField = m_page1.getCreatedCode();
- if (TypeUtility.exists(createdField)) {
- ScoutSdkUi.showJavaElementInEditor(createdField, false);
- }
- }
-}
+/*******************************************************************************
+ * 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.code;
+
+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 CodeNewWizard extends AbstractFormFieldWizard {
+
+ private CodeNewWizardPage m_page1;
+
+ public CodeNewWizard() {
+ setWindowTitle(Texts.get("NewCode"));
+ }
+
+ @Override
+ public void initWizard(IType declaringType) {
+ super.initWizard(declaringType);
+ m_page1 = new CodeNewWizardPage(getDeclaringType());
+ addPage(m_page1);
+ }
+
+ @Override
+ public void setSuperType(IType superType) {
+ m_page1.setSuperType(superType);
+ }
+
+ @Override
+ protected void postFinishDisplayThread() {
+ IType createdField = m_page1.getCreatedCode();
+ if (TypeUtility.exists(createdField)) {
+ ScoutSdkUi.showJavaElementInEditor(createdField, false);
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/code/CodeNewWizardPage.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/code/CodeNewWizardPage.java
index 047ffffa0..ef146f975 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/code/CodeNewWizardPage.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/code/CodeNewWizardPage.java
@@ -1,410 +1,410 @@
-/*******************************************************************************
- * 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.code;
-
-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.jdt.core.Signature;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.nls.sdk.model.INlsEntry;
-import org.eclipse.scout.sdk.RuntimeClasses;
-import org.eclipse.scout.sdk.ScoutSdkCore;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.operation.CodeNewOperation;
-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.fields.proposal.javaelement.AbstractJavaElementContentProvider;
-import org.eclipse.scout.sdk.ui.fields.proposal.signature.SignatureProposalProvider;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.internal.extensions.CodeIdExtensionPoint;
-import org.eclipse.scout.sdk.ui.internal.fields.code.CodeIdField;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
-import org.eclipse.scout.sdk.util.Regex;
-import org.eclipse.scout.sdk.util.SdkProperties;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutProject;
-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>CodeNewWizardPage</h3> ...
- */
-public class CodeNewWizardPage extends AbstractWorkspaceWizardPage {
-
- final IType iCode = TypeUtility.getType(RuntimeClasses.ICode);
- final IType abstractCode = TypeUtility.getType(RuntimeClasses.AbstractCode);
-
- private String m_nextCodeId;
- private String m_nextCodeIdSource;
- private INlsEntry m_nlsName;
- private String m_typeName;
- private IType m_superType;
- private String m_genericSignature;
- private SiblingProposal m_sibling;
-
- private CodeIdField m_nextCodeIdField;
- private ProposalTextField m_nlsNameField;
- private StyledTextField m_typeNameField;
- private ProposalTextField m_superTypeField;
- private ProposalTextField m_genericTypeField;
- private ProposalTextField m_siblingField;
-
- // process members
- private final IType m_declaringType;
- private IType m_createdCode;
-
- public CodeNewWizardPage(IType declaringType) {
- super(CodeNewWizardPage.class.getName());
- setTitle(Texts.get("NewCode"));
- setDescription(Texts.get("CreateANewCode"));
- m_declaringType = declaringType;
- m_superType = abstractCode;
- m_genericSignature = Signature.createTypeSignature(Long.class.getName(), true);
- m_sibling = SiblingProposal.SIBLING_END;
- }
-
- @Override
- public void postActivate() {
- m_nlsNameField.setFocus();
- }
-
- @Override
- protected void createContent(Composite parent) {
- IScoutProject project = ScoutSdkCore.getScoutWorkspace().getScoutBundle(m_declaringType.getJavaProject().getProject()).getScoutProject();
- m_nextCodeIdField = new CodeIdField(parent, project);
- m_nextCodeIdField.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- m_nextCodeId = m_nextCodeIdField.getValue();
- m_nextCodeIdSource = m_nextCodeIdField.getValueSource();
- pingStateChanging();
- }
- });
- 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_CODE);
- m_typeNameField.setText(m_typeName);
- m_typeNameField.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- m_typeName = m_typeNameField.getText();
- pingStateChanging();
- }
- });
-
- m_superTypeField = getFieldToolkit().createJavaElementProposalField(parent, Texts.get("SuperType"),
- new AbstractJavaElementContentProvider() {
- @Override
- protected Object[][] computeProposals() {
- return new Object[][]{TypeUtility.toArray(m_declaringType), ScoutTypeUtility.getCodes(m_declaringType)};
- }
- });
- m_superTypeField.acceptProposal(m_superType);
- m_superTypeField.addProposalAdapterListener(new IProposalAdapterListener() {
- @Override
- public void proposalAccepted(ContentProposalEvent event) {
- try {
- setStateChanging(true);
- m_superType = (IType) event.proposal;
- if (TypeUtility.isGenericType(getSuperType())) {
- m_genericTypeField.setEnabled(true);
- if (getGenericSignature() == null) {
- m_genericTypeField.acceptProposal(TypeUtility.getType(Long.class.getName()));
- }
- }
- else {
- m_genericTypeField.setEnabled(false);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
- });
-
- m_genericTypeField = getFieldToolkit().createSignatureProposalField(parent, Texts.get("GenericType"), ScoutTypeUtility.getScoutBundle(m_declaringType), SignatureProposalProvider.DEFAULT_PRIMITIV_SIGNATURES);
- m_genericTypeField.acceptProposal(getGenericSignature());
- m_genericTypeField.setEnabled(TypeUtility.isGenericType(getSuperType()));
- m_genericTypeField.addProposalAdapterListener(new IProposalAdapterListener() {
- @Override
- public void proposalAccepted(ContentProposalEvent event) {
- try {
- setStateChanging(true);
- m_genericSignature = (String) event.proposal;
- if (m_genericSignature != null && getNextCodeId() == null) {
- setNextCodeId(CodeIdExtensionPoint.getNextCodeId(ScoutTypeUtility.getScoutProject(m_declaringType), getGenericSignature()));
- }
- }
- finally {
- setStateChanging(false);
- }
- }
- });
-
- m_siblingField = getFieldToolkit().createSiblingProposalField(parent, m_declaringType, iCode);
- m_siblingField.acceptProposal(m_sibling);
- m_siblingField.addProposalAdapterListener(new IProposalAdapterListener() {
- @Override
- public void proposalAccepted(ContentProposalEvent event) {
- m_sibling = (SiblingProposal) event.proposal;
- pingStateChanging();
- }
- });
- m_nextCodeIdField.setGenericTypeField(m_genericTypeField);
-
- // layout
- parent.setLayout(new GridLayout(1, true));
-
- m_nextCodeIdField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- m_nlsNameField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- m_typeNameField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- m_superTypeField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- m_genericTypeField.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 {
- CodeNewOperation op = new CodeNewOperation(m_declaringType, true);
-
- // write back members
- op.setNlsEntry(getNlsName());
- op.setTypeName(getTypeName());
- IType superTypeProp = getSuperType();
- if (superTypeProp != null) {
- String sig = null;
- if (getGenericSignature() != null) {
- sig = Signature.createTypeSignature(superTypeProp.getFullyQualifiedName() + "<" + Signature.toString(getGenericSignature()) + ">", true);
- }
- else {
- sig = Signature.createTypeSignature(superTypeProp.getFullyQualifiedName(), true);
- }
- op.setSuperTypeSignature(sig);
- }
- if (getSibling() == SiblingProposal.SIBLING_END) {
- IStructuredType structuredType = ScoutTypeUtility.createStructuredCodeType(m_declaringType);
- op.setSibling(structuredType.getSibling(CATEGORIES.TYPE_CODE));
- }
- else {
- op.setSibling(getSibling().getElement());
- }
- op.setGenericTypeSignature(getGenericSignature());
- op.setNextCodeId(getNextCodeIdSource());
- op.run(monitor, workingCopyManager);
- m_createdCode = op.getCreatedCode();
- return true;
- }
-
- @Override
- protected void validatePage(MultiStatus multiStatus) {
- try {
- multiStatus.add(getStatusCodeIdField());
- multiStatus.add(getStatusNameField());
- multiStatus.add(getStatusSuperType());
- multiStatus.add(getStatusGenericType());
- }
- catch (JavaModelException e) {
- ScoutSdkUi.logError("could not validate name field.", e);
- }
- }
-
- protected IStatus getStatusCodeIdField() throws JavaModelException {
- if (isControlCreated()) {
- return m_nextCodeIdField.getStatus();
- }
- else {
- return Status.OK_STATUS;
- }
- }
-
- protected IStatus getStatusNameField() throws JavaModelException {
- if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_CODE)) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
- }
- // check not allowed names
- if (TypeUtility.exists(m_declaringType.getType(getTypeName()))) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
- }
- if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
- return Status.OK_STATUS;
- }
- else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
- return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
- }
- else {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
- }
- }
-
- protected IStatus getStatusSuperType() throws JavaModelException {
- if (getSuperType() == null) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("TheSuperTypeCanNotBeNull"));
- }
- return Status.OK_STATUS;
- }
-
- protected IStatus getStatusGenericType() throws JavaModelException {
- if (TypeUtility.isGenericType(getSuperType())) {
- if (getGenericSignature() == null) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("GenericTypeCanNotBeNull"));
- }
- }
- return Status.OK_STATUS;
- }
-
- public void setNextCodeId(String nextCodeId) {
- try {
- setStateChanging(true);
- m_nextCodeId = nextCodeId;
- if (isControlCreated()) {
- m_nextCodeIdField.setValue(nextCodeId);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- public String getNextCodeId() {
- return m_nextCodeId;
- }
-
- public String getNextCodeIdSource() {
- return m_nextCodeIdSource;
- }
-
- /**
- * @return the createdCode
- */
- public IType getCreatedCode() {
- return m_createdCode;
- }
-
- 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) {
- try {
- setStateChanging(true);
- m_superType = superType;
- if (isControlCreated()) {
- m_superTypeField.acceptProposal(superType);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- public void setGenericSignature(String genericType) {
- try {
- setStateChanging(true);
- m_genericSignature = genericType;
- if (isControlCreated()) {
- m_genericTypeField.acceptProposal(genericType);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- public String getGenericSignature() {
- return m_genericSignature;
- }
-
- 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);
- }
- }
-}
+/*******************************************************************************
+ * 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.code;
+
+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.jdt.core.Signature;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.nls.sdk.model.INlsEntry;
+import org.eclipse.scout.sdk.RuntimeClasses;
+import org.eclipse.scout.sdk.ScoutSdkCore;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.operation.CodeNewOperation;
+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.fields.proposal.javaelement.AbstractJavaElementContentProvider;
+import org.eclipse.scout.sdk.ui.fields.proposal.signature.SignatureProposalProvider;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.internal.extensions.CodeIdExtensionPoint;
+import org.eclipse.scout.sdk.ui.internal.fields.code.CodeIdField;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
+import org.eclipse.scout.sdk.util.Regex;
+import org.eclipse.scout.sdk.util.SdkProperties;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutProject;
+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>CodeNewWizardPage</h3> ...
+ */
+public class CodeNewWizardPage extends AbstractWorkspaceWizardPage {
+
+ final IType iCode = TypeUtility.getType(RuntimeClasses.ICode);
+ final IType abstractCode = TypeUtility.getType(RuntimeClasses.AbstractCode);
+
+ private String m_nextCodeId;
+ private String m_nextCodeIdSource;
+ private INlsEntry m_nlsName;
+ private String m_typeName;
+ private IType m_superType;
+ private String m_genericSignature;
+ private SiblingProposal m_sibling;
+
+ private CodeIdField m_nextCodeIdField;
+ private ProposalTextField m_nlsNameField;
+ private StyledTextField m_typeNameField;
+ private ProposalTextField m_superTypeField;
+ private ProposalTextField m_genericTypeField;
+ private ProposalTextField m_siblingField;
+
+ // process members
+ private final IType m_declaringType;
+ private IType m_createdCode;
+
+ public CodeNewWizardPage(IType declaringType) {
+ super(CodeNewWizardPage.class.getName());
+ setTitle(Texts.get("NewCode"));
+ setDescription(Texts.get("CreateANewCode"));
+ m_declaringType = declaringType;
+ m_superType = abstractCode;
+ m_genericSignature = Signature.createTypeSignature(Long.class.getName(), true);
+ m_sibling = SiblingProposal.SIBLING_END;
+ }
+
+ @Override
+ public void postActivate() {
+ m_nlsNameField.setFocus();
+ }
+
+ @Override
+ protected void createContent(Composite parent) {
+ IScoutProject project = ScoutSdkCore.getScoutWorkspace().getScoutBundle(m_declaringType.getJavaProject().getProject()).getScoutProject();
+ m_nextCodeIdField = new CodeIdField(parent, project);
+ m_nextCodeIdField.addModifyListener(new ModifyListener() {
+ @Override
+ public void modifyText(ModifyEvent e) {
+ m_nextCodeId = m_nextCodeIdField.getValue();
+ m_nextCodeIdSource = m_nextCodeIdField.getValueSource();
+ pingStateChanging();
+ }
+ });
+ 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_CODE);
+ m_typeNameField.setText(m_typeName);
+ m_typeNameField.addModifyListener(new ModifyListener() {
+ @Override
+ public void modifyText(ModifyEvent e) {
+ m_typeName = m_typeNameField.getText();
+ pingStateChanging();
+ }
+ });
+
+ m_superTypeField = getFieldToolkit().createJavaElementProposalField(parent, Texts.get("SuperType"),
+ new AbstractJavaElementContentProvider() {
+ @Override
+ protected Object[][] computeProposals() {
+ return new Object[][]{TypeUtility.toArray(m_declaringType), ScoutTypeUtility.getCodes(m_declaringType)};
+ }
+ });
+ m_superTypeField.acceptProposal(m_superType);
+ m_superTypeField.addProposalAdapterListener(new IProposalAdapterListener() {
+ @Override
+ public void proposalAccepted(ContentProposalEvent event) {
+ try {
+ setStateChanging(true);
+ m_superType = (IType) event.proposal;
+ if (TypeUtility.isGenericType(getSuperType())) {
+ m_genericTypeField.setEnabled(true);
+ if (getGenericSignature() == null) {
+ m_genericTypeField.acceptProposal(TypeUtility.getType(Long.class.getName()));
+ }
+ }
+ else {
+ m_genericTypeField.setEnabled(false);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+ });
+
+ m_genericTypeField = getFieldToolkit().createSignatureProposalField(parent, Texts.get("GenericType"), ScoutTypeUtility.getScoutBundle(m_declaringType), SignatureProposalProvider.DEFAULT_PRIMITIV_SIGNATURES);
+ m_genericTypeField.acceptProposal(getGenericSignature());
+ m_genericTypeField.setEnabled(TypeUtility.isGenericType(getSuperType()));
+ m_genericTypeField.addProposalAdapterListener(new IProposalAdapterListener() {
+ @Override
+ public void proposalAccepted(ContentProposalEvent event) {
+ try {
+ setStateChanging(true);
+ m_genericSignature = (String) event.proposal;
+ if (m_genericSignature != null && getNextCodeId() == null) {
+ setNextCodeId(CodeIdExtensionPoint.getNextCodeId(ScoutTypeUtility.getScoutProject(m_declaringType), getGenericSignature()));
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+ });
+
+ m_siblingField = getFieldToolkit().createSiblingProposalField(parent, m_declaringType, iCode);
+ m_siblingField.acceptProposal(m_sibling);
+ m_siblingField.addProposalAdapterListener(new IProposalAdapterListener() {
+ @Override
+ public void proposalAccepted(ContentProposalEvent event) {
+ m_sibling = (SiblingProposal) event.proposal;
+ pingStateChanging();
+ }
+ });
+ m_nextCodeIdField.setGenericTypeField(m_genericTypeField);
+
+ // layout
+ parent.setLayout(new GridLayout(1, true));
+
+ m_nextCodeIdField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ m_nlsNameField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ m_typeNameField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ m_superTypeField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ m_genericTypeField.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 {
+ CodeNewOperation op = new CodeNewOperation(m_declaringType, true);
+
+ // write back members
+ op.setNlsEntry(getNlsName());
+ op.setTypeName(getTypeName());
+ IType superTypeProp = getSuperType();
+ if (superTypeProp != null) {
+ String sig = null;
+ if (getGenericSignature() != null) {
+ sig = Signature.createTypeSignature(superTypeProp.getFullyQualifiedName() + "<" + Signature.toString(getGenericSignature()) + ">", true);
+ }
+ else {
+ sig = Signature.createTypeSignature(superTypeProp.getFullyQualifiedName(), true);
+ }
+ op.setSuperTypeSignature(sig);
+ }
+ if (getSibling() == SiblingProposal.SIBLING_END) {
+ IStructuredType structuredType = ScoutTypeUtility.createStructuredCodeType(m_declaringType);
+ op.setSibling(structuredType.getSibling(CATEGORIES.TYPE_CODE));
+ }
+ else {
+ op.setSibling(getSibling().getElement());
+ }
+ op.setGenericTypeSignature(getGenericSignature());
+ op.setNextCodeId(getNextCodeIdSource());
+ op.run(monitor, workingCopyManager);
+ m_createdCode = op.getCreatedCode();
+ return true;
+ }
+
+ @Override
+ protected void validatePage(MultiStatus multiStatus) {
+ try {
+ multiStatus.add(getStatusCodeIdField());
+ multiStatus.add(getStatusNameField());
+ multiStatus.add(getStatusSuperType());
+ multiStatus.add(getStatusGenericType());
+ }
+ catch (JavaModelException e) {
+ ScoutSdkUi.logError("could not validate name field.", e);
+ }
+ }
+
+ protected IStatus getStatusCodeIdField() throws JavaModelException {
+ if (isControlCreated()) {
+ return m_nextCodeIdField.getStatus();
+ }
+ else {
+ return Status.OK_STATUS;
+ }
+ }
+
+ protected IStatus getStatusNameField() throws JavaModelException {
+ if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_CODE)) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
+ }
+ // check not allowed names
+ if (TypeUtility.exists(m_declaringType.getType(getTypeName()))) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
+ }
+ if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return Status.OK_STATUS;
+ }
+ else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
+ }
+ else {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
+ }
+ }
+
+ protected IStatus getStatusSuperType() throws JavaModelException {
+ if (getSuperType() == null) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("TheSuperTypeCanNotBeNull"));
+ }
+ return Status.OK_STATUS;
+ }
+
+ protected IStatus getStatusGenericType() throws JavaModelException {
+ if (TypeUtility.isGenericType(getSuperType())) {
+ if (getGenericSignature() == null) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("GenericTypeCanNotBeNull"));
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+ public void setNextCodeId(String nextCodeId) {
+ try {
+ setStateChanging(true);
+ m_nextCodeId = nextCodeId;
+ if (isControlCreated()) {
+ m_nextCodeIdField.setValue(nextCodeId);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ public String getNextCodeId() {
+ return m_nextCodeId;
+ }
+
+ public String getNextCodeIdSource() {
+ return m_nextCodeIdSource;
+ }
+
+ /**
+ * @return the createdCode
+ */
+ public IType getCreatedCode() {
+ return m_createdCode;
+ }
+
+ 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) {
+ try {
+ setStateChanging(true);
+ m_superType = superType;
+ if (isControlCreated()) {
+ m_superTypeField.acceptProposal(superType);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ public void setGenericSignature(String genericType) {
+ try {
+ setStateChanging(true);
+ m_genericSignature = genericType;
+ if (isControlCreated()) {
+ m_genericTypeField.acceptProposal(genericType);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ public String getGenericSignature() {
+ return m_genericSignature;
+ }
+
+ 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.ui/src/org/eclipse/scout/sdk/ui/wizard/code/type/CodeTypeNewWizard.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/code/type/CodeTypeNewWizard.java
index ee64fd833..73e5ca6e2 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/code/type/CodeTypeNewWizard.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/code/type/CodeTypeNewWizard.java
@@ -1,32 +1,32 @@
-/*******************************************************************************
- * 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.code.type;
-
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-
-public class CodeTypeNewWizard extends AbstractWorkspaceWizard {
-
- private CodeTypeNewWizardPage m_page1;
- private final IScoutBundle m_sharedBundle;
-
- public CodeTypeNewWizard(IScoutBundle sharedBundle) {
- setWindowTitle(Texts.get("NewCodeType"));
- m_sharedBundle = sharedBundle;
- m_page1 = new CodeTypeNewWizardPage(getSharedBundle());
- addPage(m_page1);
- }
-
- public IScoutBundle getSharedBundle() {
- return m_sharedBundle;
- }
-}
+/*******************************************************************************
+ * 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.code.type;
+
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+
+public class CodeTypeNewWizard extends AbstractWorkspaceWizard {
+
+ private CodeTypeNewWizardPage m_page1;
+ private final IScoutBundle m_sharedBundle;
+
+ public CodeTypeNewWizard(IScoutBundle sharedBundle) {
+ setWindowTitle(Texts.get("NewCodeType"));
+ m_sharedBundle = sharedBundle;
+ m_page1 = new CodeTypeNewWizardPage(getSharedBundle());
+ addPage(m_page1);
+ }
+
+ public IScoutBundle getSharedBundle() {
+ return m_sharedBundle;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/code/type/CodeTypeNewWizardPage.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/code/type/CodeTypeNewWizardPage.java
index df519b93d..ef8f75d3f 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/code/type/CodeTypeNewWizardPage.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/code/type/CodeTypeNewWizardPage.java
@@ -1,360 +1,360 @@
-/*******************************************************************************
- * 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.code.type;
-
-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.jdt.core.Signature;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.nls.sdk.model.INlsEntry;
-import org.eclipse.scout.sdk.RuntimeClasses;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.operation.CodeTypeNewOperation;
-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.javaelement.JavaElementAbstractTypeContentProvider;
-import org.eclipse.scout.sdk.ui.fields.proposal.signature.SignatureProposalProvider;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.internal.fields.code.CodeIdField;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
-import org.eclipse.scout.sdk.util.Regex;
-import org.eclipse.scout.sdk.util.SdkProperties;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-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> {@link CodeTypeNewWizardPage}</h3> ...
- */
-public class CodeTypeNewWizardPage extends AbstractWorkspaceWizardPage {
-
- final IType iCodeType = TypeUtility.getType(RuntimeClasses.ICodeType);
- final IType abstractCodeType = TypeUtility.getType(RuntimeClasses.AbstractCodeType);
-
- private String m_nextCodeId;
- private String m_nextCodeIdSource;
- private INlsEntry m_nlsName;
- private String m_typeName;
- private IType m_superType;
- private String m_genericSignature;
-
- private CodeIdField m_nextCodeIdField;
- private ProposalTextField m_nlsNameField;
- private StyledTextField m_typeNameField;
- private ProposalTextField m_superTypeField;
- private ProposalTextField m_genericTypeField;
-
- // process members
-
- private final IScoutBundle m_sharedBundle;
-
- public CodeTypeNewWizardPage(IScoutBundle sharedBundle) {
- super(CodeTypeNewWizardPage.class.getName());
- m_sharedBundle = sharedBundle;
- setTitle(Texts.get("NewCodeType"));
- setDescription(Texts.get("CreateANewCodeType"));
- m_superType = abstractCodeType;
- m_genericSignature = Signature.createTypeSignature(Long.class.getName(), true);
- }
-
- @Override
- public void postActivate() {
- m_nlsNameField.setFocus();
- }
-
- @Override
- protected void createContent(Composite parent) {
- m_nextCodeIdField = new CodeIdField(parent, getSharedBundle().getScoutProject());
- m_nextCodeIdField.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- m_nextCodeId = m_nextCodeIdField.getValue();
- m_nextCodeIdSource = m_nextCodeIdField.getValueSource();
- pingStateChanging();
- }
- });
-
- m_nlsNameField = getFieldToolkit().createNlsProposalTextField(parent, getSharedBundle().findBestMatchNlsProject(), 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_CODE_TYPE);
- m_typeNameField.setText(m_typeName);
- m_typeNameField.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- m_typeName = m_typeNameField.getText();
- pingStateChanging();
- }
- });
-
- m_superTypeField = getFieldToolkit().createJavaElementProposalField(parent, Texts.get("SuperType"),
- new JavaElementAbstractTypeContentProvider(iCodeType, getSharedBundle().getJavaProject(), abstractCodeType));
- m_superTypeField.acceptProposal(m_superType);
- m_superTypeField.addProposalAdapterListener(new IProposalAdapterListener() {
- @Override
- public void proposalAccepted(ContentProposalEvent event) {
- try {
- setStateChanging(true);
- m_superType = (IType) event.proposal;
-
- if (TypeUtility.isGenericType(getSuperType())) {
- m_genericTypeField.setEnabled(true);
- if (getGenericSignature() == null) {
- m_genericTypeField.acceptProposal(TypeUtility.getType(Long.class.getName()));
- }
- }
- else {
- m_genericTypeField.setEnabled(false);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
- });
-
- m_genericTypeField = getFieldToolkit().createSignatureProposalField(parent, Texts.get("GenericType"), getSharedBundle(), SignatureProposalProvider.DEFAULT_MOST_USED);
- m_genericTypeField.acceptProposal(getGenericSignature());
- m_genericTypeField.setEnabled(getSuperType() != null && TypeUtility.isGenericType(getSuperType()));
- m_genericTypeField.addProposalAdapterListener(new IProposalAdapterListener() {
- @Override
- public void proposalAccepted(ContentProposalEvent event) {
- try {
- setStateChanging(true);
- m_genericSignature = (String) event.proposal;
- }
- finally {
- setStateChanging(false);
- }
- }
- });
- m_nextCodeIdField.setGenericTypeField(m_genericTypeField);
-
- // layout
- parent.setLayout(new GridLayout(1, true));
-
- m_nextCodeIdField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- m_nlsNameField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- m_typeNameField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- m_superTypeField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- m_genericTypeField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- }
-
- @Override
- public boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
- CodeTypeNewOperation op = new CodeTypeNewOperation();
- // write back members
- op.setSharedBundle(getSharedBundle());
- op.setTypeName(getTypeName());
- op.setNlsEntry(getNlsName());
-
- IType superTypeProp = getSuperType();
- if (superTypeProp != null) {
- String sig = null;
- if (getGenericSignature() != null) {
- sig = Signature.createTypeSignature(superTypeProp.getFullyQualifiedName() + "<" + Signature.toString(getGenericSignature()) + ">", true);
- }
- else {
- sig = Signature.createTypeSignature(superTypeProp.getFullyQualifiedName(), true);
- }
- op.setSuperTypeSignature(sig);
- }
- if (getGenericSignature() != null) {
- op.setGenericTypeSignature(getGenericSignature());
- }
- op.setNextCodeId(getNextCodeIdSource());
- op.setFormatSource(true);
- op.validate();
- op.run(monitor, workingCopyManager);
- return true;
- }
-
- @Override
- protected void validatePage(MultiStatus multiStatus) {
- try {
- multiStatus.add(getStatusNextCodeIdField());
- multiStatus.add(getStatusNameField());
- multiStatus.add(getStatusSuperType());
- multiStatus.add(getStatusGenericType());
- }
- catch (JavaModelException e) {
- ScoutSdkUi.logError("could not validate name field.", e);
- }
- }
-
- public IScoutBundle getSharedBundle() {
- return m_sharedBundle;
- }
-
- protected IStatus getStatusNextCodeIdField() throws JavaModelException {
- if (isControlCreated()) {
- return m_nextCodeIdField.getStatus();
- }
- else {
- return Status.OK_STATUS;
- }
- }
-
- protected IStatus getStatusNameField() throws JavaModelException {
- if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_CODE_TYPE)) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
- }
- // check not allowed names
- if (TypeUtility.existsType(getSharedBundle().getPackageName(IScoutBundle.SHARED_PACKAGE_APPENDIX_SERVICES_CODE) + "." + getTypeName())) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
- }
- if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
- return Status.OK_STATUS;
- }
- else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
- return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
- }
- else {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
- }
- }
-
- protected IStatus getStatusSuperType() throws JavaModelException {
- if (getSuperType() == null) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("TheSuperTypeCanNotBeNull"));
- }
- return Status.OK_STATUS;
- }
-
- protected IStatus getStatusGenericType() throws JavaModelException {
- if (TypeUtility.isGenericType(getSuperType())) {
- if (getGenericSignature() == null) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("GenericTypeCanNotBeNull"));
- }
- }
- return Status.OK_STATUS;
- }
-
- public void setNextCodeId(String nextCodeId) {
- try {
- setStateChanging(true);
- m_nextCodeId = nextCodeId;
- if (isControlCreated()) {
- m_nextCodeIdField.setValue(nextCodeId);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- public String getNextCodeId() {
- return m_nextCodeId;
- }
-
- public String getNextCodeIdSource() {
- return m_nextCodeIdSource;
- }
-
- 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) {
- try {
- setStateChanging(true);
- m_superType = superType;
- if (isControlCreated()) {
- m_superTypeField.acceptProposal(superType);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- public void setGenericSignature(String genericSignature) {
- try {
- setStateChanging(true);
- m_genericSignature = genericSignature;
- if (isControlCreated()) {
- m_genericTypeField.acceptProposal(genericSignature);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- public String getGenericSignature() {
- return m_genericSignature;
- }
-}
+/*******************************************************************************
+ * 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.code.type;
+
+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.jdt.core.Signature;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.nls.sdk.model.INlsEntry;
+import org.eclipse.scout.sdk.RuntimeClasses;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.operation.CodeTypeNewOperation;
+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.javaelement.JavaElementAbstractTypeContentProvider;
+import org.eclipse.scout.sdk.ui.fields.proposal.signature.SignatureProposalProvider;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.internal.fields.code.CodeIdField;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
+import org.eclipse.scout.sdk.util.Regex;
+import org.eclipse.scout.sdk.util.SdkProperties;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+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> {@link CodeTypeNewWizardPage}</h3> ...
+ */
+public class CodeTypeNewWizardPage extends AbstractWorkspaceWizardPage {
+
+ final IType iCodeType = TypeUtility.getType(RuntimeClasses.ICodeType);
+ final IType abstractCodeType = TypeUtility.getType(RuntimeClasses.AbstractCodeType);
+
+ private String m_nextCodeId;
+ private String m_nextCodeIdSource;
+ private INlsEntry m_nlsName;
+ private String m_typeName;
+ private IType m_superType;
+ private String m_genericSignature;
+
+ private CodeIdField m_nextCodeIdField;
+ private ProposalTextField m_nlsNameField;
+ private StyledTextField m_typeNameField;
+ private ProposalTextField m_superTypeField;
+ private ProposalTextField m_genericTypeField;
+
+ // process members
+
+ private final IScoutBundle m_sharedBundle;
+
+ public CodeTypeNewWizardPage(IScoutBundle sharedBundle) {
+ super(CodeTypeNewWizardPage.class.getName());
+ m_sharedBundle = sharedBundle;
+ setTitle(Texts.get("NewCodeType"));
+ setDescription(Texts.get("CreateANewCodeType"));
+ m_superType = abstractCodeType;
+ m_genericSignature = Signature.createTypeSignature(Long.class.getName(), true);
+ }
+
+ @Override
+ public void postActivate() {
+ m_nlsNameField.setFocus();
+ }
+
+ @Override
+ protected void createContent(Composite parent) {
+ m_nextCodeIdField = new CodeIdField(parent, getSharedBundle().getScoutProject());
+ m_nextCodeIdField.addModifyListener(new ModifyListener() {
+ @Override
+ public void modifyText(ModifyEvent e) {
+ m_nextCodeId = m_nextCodeIdField.getValue();
+ m_nextCodeIdSource = m_nextCodeIdField.getValueSource();
+ pingStateChanging();
+ }
+ });
+
+ m_nlsNameField = getFieldToolkit().createNlsProposalTextField(parent, getSharedBundle().findBestMatchNlsProject(), 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_CODE_TYPE);
+ m_typeNameField.setText(m_typeName);
+ m_typeNameField.addModifyListener(new ModifyListener() {
+ @Override
+ public void modifyText(ModifyEvent e) {
+ m_typeName = m_typeNameField.getText();
+ pingStateChanging();
+ }
+ });
+
+ m_superTypeField = getFieldToolkit().createJavaElementProposalField(parent, Texts.get("SuperType"),
+ new JavaElementAbstractTypeContentProvider(iCodeType, getSharedBundle().getJavaProject(), abstractCodeType));
+ m_superTypeField.acceptProposal(m_superType);
+ m_superTypeField.addProposalAdapterListener(new IProposalAdapterListener() {
+ @Override
+ public void proposalAccepted(ContentProposalEvent event) {
+ try {
+ setStateChanging(true);
+ m_superType = (IType) event.proposal;
+
+ if (TypeUtility.isGenericType(getSuperType())) {
+ m_genericTypeField.setEnabled(true);
+ if (getGenericSignature() == null) {
+ m_genericTypeField.acceptProposal(TypeUtility.getType(Long.class.getName()));
+ }
+ }
+ else {
+ m_genericTypeField.setEnabled(false);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+ });
+
+ m_genericTypeField = getFieldToolkit().createSignatureProposalField(parent, Texts.get("GenericType"), getSharedBundle(), SignatureProposalProvider.DEFAULT_MOST_USED);
+ m_genericTypeField.acceptProposal(getGenericSignature());
+ m_genericTypeField.setEnabled(getSuperType() != null && TypeUtility.isGenericType(getSuperType()));
+ m_genericTypeField.addProposalAdapterListener(new IProposalAdapterListener() {
+ @Override
+ public void proposalAccepted(ContentProposalEvent event) {
+ try {
+ setStateChanging(true);
+ m_genericSignature = (String) event.proposal;
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+ });
+ m_nextCodeIdField.setGenericTypeField(m_genericTypeField);
+
+ // layout
+ parent.setLayout(new GridLayout(1, true));
+
+ m_nextCodeIdField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ m_nlsNameField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ m_typeNameField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ m_superTypeField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ m_genericTypeField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ }
+
+ @Override
+ public boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
+ CodeTypeNewOperation op = new CodeTypeNewOperation();
+ // write back members
+ op.setSharedBundle(getSharedBundle());
+ op.setTypeName(getTypeName());
+ op.setNlsEntry(getNlsName());
+
+ IType superTypeProp = getSuperType();
+ if (superTypeProp != null) {
+ String sig = null;
+ if (getGenericSignature() != null) {
+ sig = Signature.createTypeSignature(superTypeProp.getFullyQualifiedName() + "<" + Signature.toString(getGenericSignature()) + ">", true);
+ }
+ else {
+ sig = Signature.createTypeSignature(superTypeProp.getFullyQualifiedName(), true);
+ }
+ op.setSuperTypeSignature(sig);
+ }
+ if (getGenericSignature() != null) {
+ op.setGenericTypeSignature(getGenericSignature());
+ }
+ op.setNextCodeId(getNextCodeIdSource());
+ op.setFormatSource(true);
+ op.validate();
+ op.run(monitor, workingCopyManager);
+ return true;
+ }
+
+ @Override
+ protected void validatePage(MultiStatus multiStatus) {
+ try {
+ multiStatus.add(getStatusNextCodeIdField());
+ multiStatus.add(getStatusNameField());
+ multiStatus.add(getStatusSuperType());
+ multiStatus.add(getStatusGenericType());
+ }
+ catch (JavaModelException e) {
+ ScoutSdkUi.logError("could not validate name field.", e);
+ }
+ }
+
+ public IScoutBundle getSharedBundle() {
+ return m_sharedBundle;
+ }
+
+ protected IStatus getStatusNextCodeIdField() throws JavaModelException {
+ if (isControlCreated()) {
+ return m_nextCodeIdField.getStatus();
+ }
+ else {
+ return Status.OK_STATUS;
+ }
+ }
+
+ protected IStatus getStatusNameField() throws JavaModelException {
+ if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_CODE_TYPE)) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
+ }
+ // check not allowed names
+ if (TypeUtility.existsType(getSharedBundle().getPackageName(IScoutBundle.SHARED_PACKAGE_APPENDIX_SERVICES_CODE) + "." + getTypeName())) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
+ }
+ if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return Status.OK_STATUS;
+ }
+ else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
+ }
+ else {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
+ }
+ }
+
+ protected IStatus getStatusSuperType() throws JavaModelException {
+ if (getSuperType() == null) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("TheSuperTypeCanNotBeNull"));
+ }
+ return Status.OK_STATUS;
+ }
+
+ protected IStatus getStatusGenericType() throws JavaModelException {
+ if (TypeUtility.isGenericType(getSuperType())) {
+ if (getGenericSignature() == null) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("GenericTypeCanNotBeNull"));
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+ public void setNextCodeId(String nextCodeId) {
+ try {
+ setStateChanging(true);
+ m_nextCodeId = nextCodeId;
+ if (isControlCreated()) {
+ m_nextCodeIdField.setValue(nextCodeId);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ public String getNextCodeId() {
+ return m_nextCodeId;
+ }
+
+ public String getNextCodeIdSource() {
+ return m_nextCodeIdSource;
+ }
+
+ 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) {
+ try {
+ setStateChanging(true);
+ m_superType = superType;
+ if (isControlCreated()) {
+ m_superTypeField.acceptProposal(superType);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ public void setGenericSignature(String genericSignature) {
+ try {
+ setStateChanging(true);
+ m_genericSignature = genericSignature;
+ if (isControlCreated()) {
+ m_genericTypeField.acceptProposal(genericSignature);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ public String getGenericSignature() {
+ return m_genericSignature;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/export/IExportScoutProjectWizard.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/export/IExportScoutProjectWizard.java
index ee4763325..ea15c0a17 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/export/IExportScoutProjectWizard.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/export/IExportScoutProjectWizard.java
@@ -1,20 +1,20 @@
-package org.eclipse.scout.sdk.ui.wizard.export;
-
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.scout.sdk.ui.wizard.AbstractScoutWizardPage;
-import org.eclipse.scout.sdk.workspace.IScoutProject;
-
-public interface IExportScoutProjectWizard extends IWizard {
-
- IScoutProject getProject();
-
- IExportScoutProjectWizardPage getExportWizardPage();
-
- void addPage(IWizardPage page);
-
- @Override
- AbstractScoutWizardPage getPage(String name);
-
- String getProjectAlias();
-}
+package org.eclipse.scout.sdk.ui.wizard.export;
+
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.scout.sdk.ui.wizard.AbstractScoutWizardPage;
+import org.eclipse.scout.sdk.workspace.IScoutProject;
+
+public interface IExportScoutProjectWizard extends IWizard {
+
+ IScoutProject getProject();
+
+ IExportScoutProjectWizardPage getExportWizardPage();
+
+ void addPage(IWizardPage page);
+
+ @Override
+ AbstractScoutWizardPage getPage(String name);
+
+ String getProjectAlias();
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/export/IExportScoutProjectWizardPage.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/export/IExportScoutProjectWizardPage.java
index d250d8f99..3c8794029 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/export/IExportScoutProjectWizardPage.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/export/IExportScoutProjectWizardPage.java
@@ -1,10 +1,10 @@
-package org.eclipse.scout.sdk.ui.wizard.export;
-
-import org.eclipse.scout.sdk.ui.internal.extensions.export.ExportScoutProjectEntry;
-
-public interface IExportScoutProjectWizardPage {
-
- boolean isNodesSelected(String... entryIds);
-
- ExportScoutProjectEntry[] getSelectedEntries();
-}
+package org.eclipse.scout.sdk.ui.wizard.export;
+
+import org.eclipse.scout.sdk.ui.internal.extensions.export.ExportScoutProjectEntry;
+
+public interface IExportScoutProjectWizardPage {
+
+ boolean isNodesSelected(String... entryIds);
+
+ ExportScoutProjectEntry[] getSelectedEntries();
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/FormNewWizard.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/FormNewWizard.java
index 200f01b01..37e332434 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/FormNewWizard.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/FormNewWizard.java
@@ -1,529 +1,529 @@
-/*******************************************************************************
- * 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;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-
-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.scout.commons.StringUtility;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.operation.form.FormStackNewOperation;
-import org.eclipse.scout.sdk.ui.fields.bundletree.DndEvent;
-import org.eclipse.scout.sdk.ui.fields.bundletree.ITreeDndListener;
-import org.eclipse.scout.sdk.ui.fields.bundletree.ITreeNode;
-import org.eclipse.scout.sdk.ui.fields.bundletree.ITreeNodeFilter;
-import org.eclipse.scout.sdk.ui.fields.bundletree.NodeFilters;
-import org.eclipse.scout.sdk.ui.fields.bundletree.TreeUtility;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
-import org.eclipse.scout.sdk.ui.wizard.BundleTreeWizardPage;
-import org.eclipse.scout.sdk.ui.wizard.IStatusProvider;
-import org.eclipse.scout.sdk.ui.wizard.services.ServiceNewWizardPage;
-import org.eclipse.scout.sdk.util.SdkProperties;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.workspace.IScoutProject;
-import org.eclipse.scout.sdk.workspace.ScoutBundleFilters;
-import org.eclipse.swt.dnd.DND;
-
-/**
- * <h3> {@link FormNewWizard}</h3> To create a new form.
- *
- * @author Andreas Hoegger
- * @since 1.0.8 05.11.2009
- */
-public class FormNewWizard extends AbstractWorkspaceWizard {
-
- public static final int TYPE_FORM = 100;
- public static final int TYPE_FORM_BUTTON_OK = 101;
- public static final int TYPE_FORM_BUTTON_CANCEL = 102;
- public static final int TYPE_HANDLER_MODIFY = 110;
- public static final int TYPE_HANDLER_NEW = 111;
- public static final int TYPE_FORM_DATA = 130;
- public static final int TYPE_PERMISSION_CREATE = 140;
- public static final int TYPE_PERMISSION_READ = 143;
- public static final int TYPE_PERMISSION_UPDATE = 146;
- public static final int TYPE_SERVICE_INTERFACE = 200;
- public static final int TYPE_SERVICE_IMPLEMENTATION = 210;
- public static final int TYPE_SERVICE_REG_CLIENT = 230;
- public static final int TYPE_SERVICE_REG_SERVER = 240;
-
- private final IScoutBundle m_clientBundle;
- private FormNewWizardPage m_formPage;
- private BundleTreeWizardPage m_locationPage;
- private FormStackNewOperation m_operation = new FormStackNewOperation(true);
- private ITreeNode m_locationPageRoot;
-
- public FormNewWizard(IScoutBundle clientBundle) {
- setWindowTitle(Texts.get("NewForm"));
- P_StatusRevalidator statusProvider = new P_StatusRevalidator();
- m_clientBundle = clientBundle;
- m_formPage = new FormNewWizardPage(getClientBundle());
- addPage(m_formPage);
- m_locationPageRoot = createTree(clientBundle);
- m_locationPage = new BundleTreeWizardPage(Texts.get("FormClassLocations"), Texts.get("OrganiseLocations"), m_locationPageRoot, new P_InitialCheckedFilter());
- m_locationPage.addStatusProvider(statusProvider);
- m_locationPage.addDndListener(new P_TreeDndListener());
- addPage(m_locationPage);
- // init
- m_formPage.addPropertyChangeListener(new P_LocationPropertyListener());
- }
-
- private ITreeNode createTree(IScoutBundle clientBundle) {
- IScoutBundle sharedBundle = null;
- IScoutBundle serverBundle = null;
- IScoutProject scoutProject = clientBundle.getScoutProject();
- while ((sharedBundle == null || serverBundle == null) && scoutProject != null) {
- sharedBundle = scoutProject.getSharedBundle();
- serverBundle = scoutProject.getServerBundle();
- scoutProject = scoutProject.getParentProject();
- }
-
- // BundleSet bundleSet=BundleLocationUtility.createBundleSet(clientBundle);
- ITreeNode rootNode = TreeUtility.createBundleTree(clientBundle.getScoutProject(), NodeFilters.getAcceptAll());
-
- ITreeNode clientNode = TreeUtility.findNode(rootNode, NodeFilters.getByData(getClientBundle()));
- // form
- ITreeNode formNode = TreeUtility.createNode(clientNode, TYPE_FORM, Texts.get("Form"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class), TYPE_FORM);
- formNode.setEnabled(false);
- // form buttons
- TreeUtility.createNode(formNode, TYPE_FORM_BUTTON_OK, Texts.get("OkButton"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class), TYPE_FORM_BUTTON_OK);
- TreeUtility.createNode(formNode, TYPE_FORM_BUTTON_CANCEL, Texts.get("CancelButton"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class), TYPE_FORM_BUTTON_CANCEL);
-
- // newHandler
- TreeUtility.createNode(formNode, TYPE_HANDLER_NEW, Texts.get("NewHandler"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class), TYPE_HANDLER_NEW);
- // modifyHandler
- TreeUtility.createNode(formNode, TYPE_HANDLER_MODIFY, Texts.get("ModifyHandler"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class), TYPE_HANDLER_MODIFY);
- if (sharedBundle != null && serverBundle != null) {
- // service client reg
- TreeUtility.createNode(clientNode, TYPE_SERVICE_REG_CLIENT, Texts.get("ServiceProxyRegistration"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Public), TYPE_SERVICE_REG_CLIENT);
- }
-
- if (sharedBundle != null) {
- ITreeNode sharedNode = TreeUtility.findNode(rootNode, NodeFilters.getByData(sharedBundle));
- // formData
- TreeUtility.createNode(sharedNode, TYPE_FORM_DATA, Texts.get("FormData"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class), TYPE_FORM_DATA);
- // permission create
- TreeUtility.createNode(sharedNode, TYPE_PERMISSION_CREATE, Texts.get("CreatePermission"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class), TYPE_PERMISSION_CREATE);
- // permission read
- TreeUtility.createNode(sharedNode, TYPE_PERMISSION_READ, Texts.get("ReadPermission"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class), TYPE_PERMISSION_READ);
- // permission update
- TreeUtility.createNode(sharedNode, TYPE_PERMISSION_UPDATE, Texts.get("UpdatePermission"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class), TYPE_PERMISSION_UPDATE);
- if (serverBundle != null) {
- // service interface
- TreeUtility.createNode(sharedNode, TYPE_SERVICE_INTERFACE, Texts.get("IService"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Interface), TYPE_SERVICE_INTERFACE);
- }
- }
- if (serverBundle != null) {
- ITreeNode serverNode = TreeUtility.findNode(rootNode, NodeFilters.getByData(serverBundle));
- // service implementation
- TreeUtility.createNode(serverNode, TYPE_SERVICE_IMPLEMENTATION, Texts.get("Service"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class), TYPE_SERVICE_IMPLEMENTATION);
- // service implementation
- TreeUtility.createNode(serverNode, TYPE_SERVICE_REG_SERVER, Texts.get("ServiceRegistration"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Public), TYPE_SERVICE_REG_SERVER);
- }
- return rootNode;
- }
-
- public FormNewWizardPage getFormNewPage() {
- return m_formPage;
- }
-
- @Override
- protected boolean beforeFinish() throws CoreException {
- // fill operation before gui is disposed
- m_formPage.fillOperation(m_operation);
- m_operation.setCreateButtonOk(m_locationPage.getTreeNode(TYPE_FORM_BUTTON_OK, true, true) != null);
- m_operation.setCreateButtonCancel(m_locationPage.getTreeNode(TYPE_FORM_BUTTON_CANCEL, true, true) != null);
- m_operation.setCreateModifyHandler(m_locationPage.getTreeNode(TYPE_HANDLER_MODIFY, true, true) != null);
- m_operation.setCreateNewHandler(m_locationPage.getTreeNode(TYPE_HANDLER_NEW, true, true) != null);
- m_operation.setFormBundle(m_locationPage.getLocationBundle(TYPE_FORM, true, true));
- m_operation.setFormDataBundle(m_locationPage.getLocationBundle(TYPE_FORM_DATA, true, true));
-
- m_operation.setClientServiceRegistryBundles(m_locationPage.getLocationBundles(TYPE_SERVICE_REG_CLIENT, true, true));
- m_operation.setPermissionCreateBundle(m_locationPage.getLocationBundle(TYPE_PERMISSION_CREATE, true, true));
- m_operation.setPermissionCreateName(m_locationPage.getTextOfNode(TYPE_PERMISSION_CREATE, true, true));
- m_operation.setPermissionReadBundle(m_locationPage.getLocationBundle(TYPE_PERMISSION_READ, true, true));
- m_operation.setPermissionReadName(m_locationPage.getTextOfNode(TYPE_PERMISSION_READ, true, true));
- m_operation.setPermissionUpdateBundle(m_locationPage.getLocationBundle(TYPE_PERMISSION_UPDATE, true, true));
- m_operation.setPermissionUpdateName(m_locationPage.getTextOfNode(TYPE_PERMISSION_UPDATE, true, true));
- m_operation.setServerServiceRegistryBundles(m_locationPage.getLocationBundles(TYPE_SERVICE_REG_SERVER, true, true));
- m_operation.setServiceImplementationBundle(m_locationPage.getLocationBundle(TYPE_SERVICE_IMPLEMENTATION, true, true));
- m_operation.setServiceImplementationName(m_locationPage.getTextOfNode(TYPE_SERVICE_IMPLEMENTATION, true, true));
- m_operation.setServiceInterfaceBundle(m_locationPage.getLocationBundle(TYPE_SERVICE_INTERFACE, true, true));
- m_operation.setServiceInterfaceName(m_locationPage.getTextOfNode(TYPE_SERVICE_INTERFACE, true, true));
- return true;
- }
-
- @Override
- protected boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) {
- try {
- m_operation.run(monitor, workingCopyManager);
- return true;
- }
- catch (Exception e) {
- ScoutSdkUi.logError("exception during perfoming finish of wizard.", e);
- return false;
- }
- }
-
- public FormNewWizardPage getFormPage() {
- return m_formPage;
- }
-
- public IScoutBundle getClientBundle() {
- return m_clientBundle;
- }
-
- private class P_LocationPropertyListener implements PropertyChangeListener {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- if (evt.getPropertyName().equals(ServiceNewWizardPage.PROP_TYPE_NAME)) {
- String typeName = m_formPage.getTypeName();
- if (!StringUtility.isNullOrEmpty(typeName)) {
- String prefix = typeName.replaceAll(SdkProperties.SUFFIX_FORM + "$", "");
- TreeUtility.findNode(m_locationPageRoot, NodeFilters.getByType(TYPE_FORM)).setText(prefix + SdkProperties.SUFFIX_FORM);
- ITreeNode formDataNode = TreeUtility.findNode(m_locationPageRoot, NodeFilters.getByType(TYPE_FORM_DATA));
- if (formDataNode != null) {
- formDataNode.setText(prefix + SdkProperties.SUFFIX_FORM_DATA);
- }
- ITreeNode permissionCreateNode = TreeUtility.findNode(m_locationPageRoot, NodeFilters.getByType(TYPE_PERMISSION_CREATE));
- if (permissionCreateNode != null) {
- permissionCreateNode.setText("Create" + prefix + SdkProperties.SUFFIX_PERMISSION);
- }
- ITreeNode permissionReadNode = TreeUtility.findNode(m_locationPageRoot, NodeFilters.getByType(TYPE_PERMISSION_READ));
- if (permissionReadNode != null) {
- permissionReadNode.setText("Read" + prefix + SdkProperties.SUFFIX_PERMISSION);
- }
-
- ITreeNode permissionUpdateNode = TreeUtility.findNode(m_locationPageRoot, NodeFilters.getByType(TYPE_PERMISSION_UPDATE));
- if (permissionUpdateNode != null) {
- permissionUpdateNode.setText("Update" + prefix + SdkProperties.SUFFIX_PERMISSION);
- }
- ITreeNode serviceImplNode = TreeUtility.findNode(m_locationPageRoot, NodeFilters.getByType(TYPE_SERVICE_IMPLEMENTATION));
- if (serviceImplNode != null) {
- serviceImplNode.setText(prefix + SdkProperties.SUFFIX_PROCESS_SERVICE);
- }
- ITreeNode serviceInterfaceNode = TreeUtility.findNode(m_locationPageRoot, NodeFilters.getByType(TYPE_SERVICE_INTERFACE));
- if (serviceInterfaceNode != null) {
- serviceInterfaceNode.setText("I" + prefix + SdkProperties.SUFFIX_PROCESS_SERVICE);
- }
- m_locationPage.refreshTree();
- }
- m_locationPage.pingStateChanging();
- }
- }
- } // end class P_LocationPropertyListener
-
- private class P_InitialCheckedFilter implements ITreeNodeFilter {
- @Override
- public boolean accept(ITreeNode node) {
- switch (node.getType()) {
- case IScoutBundle.BUNDLE_CLIENT:
- case IScoutBundle.BUNDLE_SHARED:
- case IScoutBundle.BUNDLE_SERVER:
- case TYPE_HANDLER_MODIFY:
- case TYPE_HANDLER_NEW:
- case TYPE_PERMISSION_CREATE:
- case TYPE_PERMISSION_READ:
- case TYPE_PERMISSION_UPDATE:
- case TYPE_SERVICE_IMPLEMENTATION:
- case TYPE_SERVICE_INTERFACE:
- case TYPE_SERVICE_REG_CLIENT:
- case TYPE_SERVICE_REG_SERVER:
- case TYPE_FORM:
- case TYPE_FORM_BUTTON_OK:
- case TYPE_FORM_BUTTON_CANCEL:
- case TYPE_FORM_DATA:
- return true;
- default:
- return false;
- }
- }
- } // end class P_InitialCheckedFilter
-
- private class P_TreeDndListener implements ITreeDndListener {
- @Override
- public boolean isDragableNode(ITreeNode node) {
- switch (node.getType()) {
- case TYPE_FORM:
- case TYPE_PERMISSION_CREATE:
- case TYPE_PERMISSION_READ:
- case TYPE_PERMISSION_UPDATE:
- case TYPE_SERVICE_IMPLEMENTATION:
- case TYPE_SERVICE_INTERFACE:
- case TYPE_SERVICE_REG_CLIENT:
- case TYPE_SERVICE_REG_SERVER:
- return true;
-
- default:
- return false;
- }
- }
-
- @Override
- public void validateTarget(DndEvent dndEvent) {
- if (dndEvent.targetParent == null) {
- dndEvent.doit = false;
- return;
- }
- if (dndEvent.operation == DND.DROP_COPY) {
- validateDropCopy(dndEvent);
- }
- else if (dndEvent.operation == DND.DROP_MOVE) {
- validateDropMove(dndEvent);
- }
- }
-
- @Override
- public void dndPerformed(DndEvent dndEvent) {
- if (dndEvent.node.getType() == TYPE_FORM) {
- ITreeNode formDataNode = TreeUtility.findNode(m_locationPageRoot, NodeFilters.getByType(TYPE_FORM_DATA));
- if (formDataNode != null) {
-
- ITreeNode oldFomDataParent = formDataNode.getParent();
- IScoutBundle formBundle = (IScoutBundle) dndEvent.node.getParent().getData();
- IScoutBundle[] sharedBundles = formBundle.getRequiredBundles(ScoutBundleFilters.getSharedFilter(), false);
- for (IScoutBundle formDataBundle : sharedBundles) {
- ITreeNode sharedNode = TreeUtility.findNode(m_locationPageRoot, NodeFilters.getByData(formDataBundle));
- if (sharedNode != null) {
- if (!oldFomDataParent.equals(sharedNode)) {
- // move
- oldFomDataParent.removeChild(formDataNode);
- formDataNode.setParent(sharedNode);
- sharedNode.addChild(formDataNode);
- }
- break;
- }
- }
- }
- }
- m_formPage.pingStateChanging();
- }
-
- private void validateDropCopy(DndEvent dndEvent) {
- switch (dndEvent.node.getType()) {
- case TYPE_SERVICE_REG_CLIENT:
- dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_CLIENT;
- break;
- case TYPE_SERVICE_REG_SERVER:
- dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_SERVER;
- break;
- default:
- dndEvent.doit = false;
- break;
- }
- }
-
- private void validateDropMove(DndEvent dndEvent) {
- switch (dndEvent.node.getType()) {
- case TYPE_FORM:
- case TYPE_SERVICE_REG_CLIENT:
- dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_CLIENT;
- break;
- case TYPE_PERMISSION_CREATE:
- case TYPE_PERMISSION_READ:
- case TYPE_PERMISSION_UPDATE:
- case TYPE_SERVICE_INTERFACE:
- dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_SHARED;
- break;
- case TYPE_SERVICE_IMPLEMENTATION:
- case TYPE_SERVICE_REG_SERVER:
- dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_SERVER;
- break;
- default:
- dndEvent.doit = false;
- break;
- }
-
- }
- } // end class P_TreeDndListener
-
- private class P_StatusRevalidator implements IStatusProvider {
-
- @Override
- public void validate(Object source, MultiStatus multiStatus) {
- multiStatus.add(getStatusForm());
- multiStatus.add(getStatusService());
- multiStatus.add(getStatusServiceRegistrationClient());
- multiStatus.add(getStatusServiceRegistrationServer());
- multiStatus.add(getStatusTypeNames());
- }
-
- protected IStatus getStatusTypeNames() {
-
- IScoutBundle serviceImplementationBundle = m_locationPage.getLocationBundle(TYPE_SERVICE_IMPLEMENTATION, true, true);
- if (serviceImplementationBundle != null) {
- ITreeNode serviceImplNode = m_locationPage.getTreeNode(TYPE_SERVICE_IMPLEMENTATION, true, true);
- if (serviceImplNode != null) {
- String fqn = serviceImplementationBundle.getPackageName(IScoutBundle.SERVER_PACKAGE_APPENDIX_SERVICES_PROCESS) + "." + serviceImplNode.getText();
- IType findType = serviceImplementationBundle.findType(fqn);
- if (findType != null && findType.exists()) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, "'" + serviceImplNode.getText() + "' " + Texts.get("AlreadyExists") + ".");
- }
- }
- }
- // shared bundles
- IScoutBundle serviceInterfaceBundle = m_locationPage.getLocationBundle(TYPE_SERVICE_INTERFACE, true, true);
- if (serviceInterfaceBundle != null) {
- ITreeNode serviceInterfaceNode = m_locationPage.getTreeNode(TYPE_SERVICE_INTERFACE, true, true);
- if (serviceInterfaceNode != null) {
- String fqn = serviceInterfaceBundle.getPackageName(IScoutBundle.SHARED_PACKAGE_APPENDIX_SERVICES_PROCESS) + "." + serviceInterfaceNode.getText();
- IType interfaceType = serviceInterfaceBundle.findType(fqn);
- if (interfaceType != null && interfaceType.exists()) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, "'" + serviceInterfaceNode.getText() + "' " + Texts.get("AlreadyExists") + ".");
- }
- }
- }
- // permission read
- IStatus createStatus = getStatusPermission(TYPE_PERMISSION_CREATE);
- if (createStatus != Status.OK_STATUS) {
- return createStatus;
- }
- IStatus readStatus = getStatusPermission(TYPE_PERMISSION_READ);
- if (readStatus != Status.OK_STATUS) {
- return readStatus;
- }
- IStatus updateStatus = getStatusPermission(TYPE_PERMISSION_UPDATE);
- if (updateStatus != Status.OK_STATUS) {
- return updateStatus;
- }
- return Status.OK_STATUS;
- }
-
- protected IStatus getStatusPermission(int permissionType) {
- IScoutBundle permissionBundle = m_locationPage.getLocationBundle(permissionType, true, true);
- if (permissionBundle != null) {
- ITreeNode permissionNode = m_locationPage.getTreeNode(permissionType, true, true);
- if (permissionNode != null) {
- String fqn = permissionBundle.getPackageName(IScoutBundle.SHARED_PACKAGE_APPENDIX_SECURITY) + "." + permissionNode.getText();
- IType permission = permissionBundle.findType(fqn);
- if (permission != null && permission.exists()) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, "'" + permissionNode.getText() + "' " + Texts.get("AlreadyExists") + ".");
- }
- }
- }
- return Status.OK_STATUS;
- }
-
- protected IStatus getStatusForm() {
- IScoutBundle formBundle = m_locationPage.getLocationBundle(TYPE_FORM, true, true);
- if (formBundle != null) {
- IScoutBundle formDataBundle = m_locationPage.getLocationBundle(TYPE_FORM_DATA, true, true);
- if (formDataBundle != null) {
- if (!formBundle.isOnClasspath(formDataBundle)) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("XIsNotAClasspathOfY", m_locationPage.getTextOfNode(TYPE_FORM_DATA), m_locationPage.getTextOfNode(TYPE_FORM)));
- }
- }
- IScoutBundle formServiceBundle = m_locationPage.getLocationBundle(TYPE_SERVICE_INTERFACE, true, true);
- if (formServiceBundle != null) {
- if (!formBundle.isOnClasspath(formServiceBundle)) {
- return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("XIsNotAClasspathOfY", m_locationPage.getTextOfNode(TYPE_SERVICE_INTERFACE), m_locationPage.getTextOfNode(TYPE_FORM)));
- }
- }
- IScoutBundle permissionCreateBundle = m_locationPage.getLocationBundle(TYPE_PERMISSION_CREATE, true, true);
- if (permissionCreateBundle != null) {
- if (!formBundle.isOnClasspath(permissionCreateBundle)) {
- return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("XIsNotAClasspathOfY", m_locationPage.getTextOfNode(TYPE_PERMISSION_CREATE), m_locationPage.getTextOfNode(TYPE_FORM)));
- }
- }
- IScoutBundle permissionReadBundle = m_locationPage.getLocationBundle(TYPE_PERMISSION_READ, true, true);
- if (permissionReadBundle != null) {
- if (!formBundle.isOnClasspath(permissionReadBundle)) {
- return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("XIsNotAClasspathOfY", m_locationPage.getTextOfNode(TYPE_PERMISSION_READ), m_locationPage.getTextOfNode(TYPE_FORM)));
- }
- }
- IScoutBundle permissionUpdateBundle = m_locationPage.getLocationBundle(TYPE_PERMISSION_UPDATE, true, true);
- if (permissionUpdateBundle != null) {
- if (!formBundle.isOnClasspath(permissionUpdateBundle)) {
- return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("XIsNotAClasspathOfY", m_locationPage.getTextOfNode(TYPE_PERMISSION_UPDATE), m_locationPage.getTextOfNode(TYPE_FORM)));
- }
- }
- }
- return Status.OK_STATUS;
- }
-
- protected IStatus getStatusService() {
- IScoutBundle serviceImplementationBundle = m_locationPage.getLocationBundle(TYPE_SERVICE_IMPLEMENTATION, true, true);
- if (serviceImplementationBundle != null) {
- IScoutBundle serviceInterfaceBundle = m_locationPage.getLocationBundle(TYPE_SERVICE_INTERFACE, true, true);
- if (serviceInterfaceBundle != null) {
- if (!serviceImplementationBundle.isOnClasspath(serviceInterfaceBundle)) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("XIsNotAClasspathOfY", m_locationPage.getTextOfNode(TYPE_SERVICE_INTERFACE), m_locationPage.getTextOfNode(TYPE_SERVICE_IMPLEMENTATION)));
- }
- }
- IScoutBundle permissionCreateBundle = m_locationPage.getLocationBundle(TYPE_PERMISSION_CREATE, true, true);
- if (permissionCreateBundle != null) {
- if (!serviceImplementationBundle.isOnClasspath(permissionCreateBundle)) {
- return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("XIsNotAClasspathOfY", m_locationPage.getTextOfNode(TYPE_PERMISSION_CREATE), m_locationPage.getTextOfNode(TYPE_SERVICE_IMPLEMENTATION)));
- }
- }
- IScoutBundle permissionReadBundle = m_locationPage.getLocationBundle(TYPE_PERMISSION_READ, true, true);
- if (permissionReadBundle != null) {
- if (!serviceImplementationBundle.isOnClasspath(permissionReadBundle)) {
- return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("XIsNotAClasspathOfY", m_locationPage.getTextOfNode(TYPE_PERMISSION_READ), m_locationPage.getTextOfNode(TYPE_SERVICE_IMPLEMENTATION)));
- }
- }
- IScoutBundle permissionUpdateBundle = m_locationPage.getLocationBundle(TYPE_PERMISSION_UPDATE, true, true);
- if (permissionUpdateBundle != null) {
- if (!serviceImplementationBundle.isOnClasspath(permissionUpdateBundle)) {
- return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("XIsNotAClasspathOfY", m_locationPage.getTextOfNode(TYPE_PERMISSION_UPDATE), m_locationPage.getTextOfNode(TYPE_SERVICE_IMPLEMENTATION)));
- }
- }
- }
- return Status.OK_STATUS;
- }
-
- protected IStatus getStatusServiceRegistrationClient() {
- IScoutBundle serviceInterfaceBundle = m_locationPage.getLocationBundle(TYPE_SERVICE_INTERFACE, true, true);
- ITreeNode[] serviceRegistrationClientNodes = m_locationPage.getTreeNodes(TYPE_SERVICE_REG_CLIENT, true, true);
- for (ITreeNode serviceRegNode : serviceRegistrationClientNodes) {
- Object data = serviceRegNode.getParent().getData();
- if (data instanceof IScoutBundle) {
- IScoutBundle serviceRegistrationBundle = (IScoutBundle) data;
- if (serviceInterfaceBundle == null && serviceRegistrationBundle != null) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, "The client service registration can not be done without a service interface.");
- }
- if (serviceInterfaceBundle != null && serviceRegistrationBundle != null) {
- if (!serviceRegistrationBundle.isOnClasspath(serviceInterfaceBundle)) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("XIsNotOnClasspathOfServiceY", m_locationPage.getTextOfNode(TYPE_SERVICE_INTERFACE), serviceRegistrationBundle.getBundleName()));
- }
- }
- }
- }
- return Status.OK_STATUS;
- }
-
- protected IStatus getStatusServiceRegistrationServer() {
- IScoutBundle serviceImplementationBundle = m_locationPage.getLocationBundle(TYPE_SERVICE_IMPLEMENTATION, true, true);
- ITreeNode[] serviceRegistrationServerNodes = m_locationPage.getTreeNodes(TYPE_SERVICE_REG_SERVER, true, true);
- for (ITreeNode serviceRegNode : serviceRegistrationServerNodes) {
- Object data = serviceRegNode.getParent().getData();
- if (data instanceof IScoutBundle) {
- IScoutBundle serviceRegistrationBundle = (IScoutBundle) data;
- if (serviceImplementationBundle != null && serviceRegistrationBundle != null) {
- if (!serviceRegistrationBundle.isOnClasspath(serviceImplementationBundle)) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("XIsNotOnClasspathOfServiceY", m_locationPage.getTextOfNode(TYPE_SERVICE_IMPLEMENTATION), serviceRegistrationBundle.getBundleName()));
- }
- }
- }
- }
- return Status.OK_STATUS;
- }
-
- } // end class P_StatusRevalidator
-
-}
+/*******************************************************************************
+ * 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;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+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.scout.commons.StringUtility;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.operation.form.FormStackNewOperation;
+import org.eclipse.scout.sdk.ui.fields.bundletree.DndEvent;
+import org.eclipse.scout.sdk.ui.fields.bundletree.ITreeDndListener;
+import org.eclipse.scout.sdk.ui.fields.bundletree.ITreeNode;
+import org.eclipse.scout.sdk.ui.fields.bundletree.ITreeNodeFilter;
+import org.eclipse.scout.sdk.ui.fields.bundletree.NodeFilters;
+import org.eclipse.scout.sdk.ui.fields.bundletree.TreeUtility;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
+import org.eclipse.scout.sdk.ui.wizard.BundleTreeWizardPage;
+import org.eclipse.scout.sdk.ui.wizard.IStatusProvider;
+import org.eclipse.scout.sdk.ui.wizard.services.ServiceNewWizardPage;
+import org.eclipse.scout.sdk.util.SdkProperties;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.workspace.IScoutProject;
+import org.eclipse.scout.sdk.workspace.ScoutBundleFilters;
+import org.eclipse.swt.dnd.DND;
+
+/**
+ * <h3> {@link FormNewWizard}</h3> To create a new form.
+ *
+ * @author Andreas Hoegger
+ * @since 1.0.8 05.11.2009
+ */
+public class FormNewWizard extends AbstractWorkspaceWizard {
+
+ public static final int TYPE_FORM = 100;
+ public static final int TYPE_FORM_BUTTON_OK = 101;
+ public static final int TYPE_FORM_BUTTON_CANCEL = 102;
+ public static final int TYPE_HANDLER_MODIFY = 110;
+ public static final int TYPE_HANDLER_NEW = 111;
+ public static final int TYPE_FORM_DATA = 130;
+ public static final int TYPE_PERMISSION_CREATE = 140;
+ public static final int TYPE_PERMISSION_READ = 143;
+ public static final int TYPE_PERMISSION_UPDATE = 146;
+ public static final int TYPE_SERVICE_INTERFACE = 200;
+ public static final int TYPE_SERVICE_IMPLEMENTATION = 210;
+ public static final int TYPE_SERVICE_REG_CLIENT = 230;
+ public static final int TYPE_SERVICE_REG_SERVER = 240;
+
+ private final IScoutBundle m_clientBundle;
+ private FormNewWizardPage m_formPage;
+ private BundleTreeWizardPage m_locationPage;
+ private FormStackNewOperation m_operation = new FormStackNewOperation(true);
+ private ITreeNode m_locationPageRoot;
+
+ public FormNewWizard(IScoutBundle clientBundle) {
+ setWindowTitle(Texts.get("NewForm"));
+ P_StatusRevalidator statusProvider = new P_StatusRevalidator();
+ m_clientBundle = clientBundle;
+ m_formPage = new FormNewWizardPage(getClientBundle());
+ addPage(m_formPage);
+ m_locationPageRoot = createTree(clientBundle);
+ m_locationPage = new BundleTreeWizardPage(Texts.get("FormClassLocations"), Texts.get("OrganiseLocations"), m_locationPageRoot, new P_InitialCheckedFilter());
+ m_locationPage.addStatusProvider(statusProvider);
+ m_locationPage.addDndListener(new P_TreeDndListener());
+ addPage(m_locationPage);
+ // init
+ m_formPage.addPropertyChangeListener(new P_LocationPropertyListener());
+ }
+
+ private ITreeNode createTree(IScoutBundle clientBundle) {
+ IScoutBundle sharedBundle = null;
+ IScoutBundle serverBundle = null;
+ IScoutProject scoutProject = clientBundle.getScoutProject();
+ while ((sharedBundle == null || serverBundle == null) && scoutProject != null) {
+ sharedBundle = scoutProject.getSharedBundle();
+ serverBundle = scoutProject.getServerBundle();
+ scoutProject = scoutProject.getParentProject();
+ }
+
+ // BundleSet bundleSet=BundleLocationUtility.createBundleSet(clientBundle);
+ ITreeNode rootNode = TreeUtility.createBundleTree(clientBundle.getScoutProject(), NodeFilters.getAcceptAll());
+
+ ITreeNode clientNode = TreeUtility.findNode(rootNode, NodeFilters.getByData(getClientBundle()));
+ // form
+ ITreeNode formNode = TreeUtility.createNode(clientNode, TYPE_FORM, Texts.get("Form"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class), TYPE_FORM);
+ formNode.setEnabled(false);
+ // form buttons
+ TreeUtility.createNode(formNode, TYPE_FORM_BUTTON_OK, Texts.get("OkButton"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class), TYPE_FORM_BUTTON_OK);
+ TreeUtility.createNode(formNode, TYPE_FORM_BUTTON_CANCEL, Texts.get("CancelButton"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class), TYPE_FORM_BUTTON_CANCEL);
+
+ // newHandler
+ TreeUtility.createNode(formNode, TYPE_HANDLER_NEW, Texts.get("NewHandler"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class), TYPE_HANDLER_NEW);
+ // modifyHandler
+ TreeUtility.createNode(formNode, TYPE_HANDLER_MODIFY, Texts.get("ModifyHandler"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class), TYPE_HANDLER_MODIFY);
+ if (sharedBundle != null && serverBundle != null) {
+ // service client reg
+ TreeUtility.createNode(clientNode, TYPE_SERVICE_REG_CLIENT, Texts.get("ServiceProxyRegistration"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Public), TYPE_SERVICE_REG_CLIENT);
+ }
+
+ if (sharedBundle != null) {
+ ITreeNode sharedNode = TreeUtility.findNode(rootNode, NodeFilters.getByData(sharedBundle));
+ // formData
+ TreeUtility.createNode(sharedNode, TYPE_FORM_DATA, Texts.get("FormData"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class), TYPE_FORM_DATA);
+ // permission create
+ TreeUtility.createNode(sharedNode, TYPE_PERMISSION_CREATE, Texts.get("CreatePermission"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class), TYPE_PERMISSION_CREATE);
+ // permission read
+ TreeUtility.createNode(sharedNode, TYPE_PERMISSION_READ, Texts.get("ReadPermission"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class), TYPE_PERMISSION_READ);
+ // permission update
+ TreeUtility.createNode(sharedNode, TYPE_PERMISSION_UPDATE, Texts.get("UpdatePermission"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class), TYPE_PERMISSION_UPDATE);
+ if (serverBundle != null) {
+ // service interface
+ TreeUtility.createNode(sharedNode, TYPE_SERVICE_INTERFACE, Texts.get("IService"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Interface), TYPE_SERVICE_INTERFACE);
+ }
+ }
+ if (serverBundle != null) {
+ ITreeNode serverNode = TreeUtility.findNode(rootNode, NodeFilters.getByData(serverBundle));
+ // service implementation
+ TreeUtility.createNode(serverNode, TYPE_SERVICE_IMPLEMENTATION, Texts.get("Service"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class), TYPE_SERVICE_IMPLEMENTATION);
+ // service implementation
+ TreeUtility.createNode(serverNode, TYPE_SERVICE_REG_SERVER, Texts.get("ServiceRegistration"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Public), TYPE_SERVICE_REG_SERVER);
+ }
+ return rootNode;
+ }
+
+ public FormNewWizardPage getFormNewPage() {
+ return m_formPage;
+ }
+
+ @Override
+ protected boolean beforeFinish() throws CoreException {
+ // fill operation before gui is disposed
+ m_formPage.fillOperation(m_operation);
+ m_operation.setCreateButtonOk(m_locationPage.getTreeNode(TYPE_FORM_BUTTON_OK, true, true) != null);
+ m_operation.setCreateButtonCancel(m_locationPage.getTreeNode(TYPE_FORM_BUTTON_CANCEL, true, true) != null);
+ m_operation.setCreateModifyHandler(m_locationPage.getTreeNode(TYPE_HANDLER_MODIFY, true, true) != null);
+ m_operation.setCreateNewHandler(m_locationPage.getTreeNode(TYPE_HANDLER_NEW, true, true) != null);
+ m_operation.setFormBundle(m_locationPage.getLocationBundle(TYPE_FORM, true, true));
+ m_operation.setFormDataBundle(m_locationPage.getLocationBundle(TYPE_FORM_DATA, true, true));
+
+ m_operation.setClientServiceRegistryBundles(m_locationPage.getLocationBundles(TYPE_SERVICE_REG_CLIENT, true, true));
+ m_operation.setPermissionCreateBundle(m_locationPage.getLocationBundle(TYPE_PERMISSION_CREATE, true, true));
+ m_operation.setPermissionCreateName(m_locationPage.getTextOfNode(TYPE_PERMISSION_CREATE, true, true));
+ m_operation.setPermissionReadBundle(m_locationPage.getLocationBundle(TYPE_PERMISSION_READ, true, true));
+ m_operation.setPermissionReadName(m_locationPage.getTextOfNode(TYPE_PERMISSION_READ, true, true));
+ m_operation.setPermissionUpdateBundle(m_locationPage.getLocationBundle(TYPE_PERMISSION_UPDATE, true, true));
+ m_operation.setPermissionUpdateName(m_locationPage.getTextOfNode(TYPE_PERMISSION_UPDATE, true, true));
+ m_operation.setServerServiceRegistryBundles(m_locationPage.getLocationBundles(TYPE_SERVICE_REG_SERVER, true, true));
+ m_operation.setServiceImplementationBundle(m_locationPage.getLocationBundle(TYPE_SERVICE_IMPLEMENTATION, true, true));
+ m_operation.setServiceImplementationName(m_locationPage.getTextOfNode(TYPE_SERVICE_IMPLEMENTATION, true, true));
+ m_operation.setServiceInterfaceBundle(m_locationPage.getLocationBundle(TYPE_SERVICE_INTERFACE, true, true));
+ m_operation.setServiceInterfaceName(m_locationPage.getTextOfNode(TYPE_SERVICE_INTERFACE, true, true));
+ return true;
+ }
+
+ @Override
+ protected boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) {
+ try {
+ m_operation.run(monitor, workingCopyManager);
+ return true;
+ }
+ catch (Exception e) {
+ ScoutSdkUi.logError("exception during perfoming finish of wizard.", e);
+ return false;
+ }
+ }
+
+ public FormNewWizardPage getFormPage() {
+ return m_formPage;
+ }
+
+ public IScoutBundle getClientBundle() {
+ return m_clientBundle;
+ }
+
+ private class P_LocationPropertyListener implements PropertyChangeListener {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ if (evt.getPropertyName().equals(ServiceNewWizardPage.PROP_TYPE_NAME)) {
+ String typeName = m_formPage.getTypeName();
+ if (!StringUtility.isNullOrEmpty(typeName)) {
+ String prefix = typeName.replaceAll(SdkProperties.SUFFIX_FORM + "$", "");
+ TreeUtility.findNode(m_locationPageRoot, NodeFilters.getByType(TYPE_FORM)).setText(prefix + SdkProperties.SUFFIX_FORM);
+ ITreeNode formDataNode = TreeUtility.findNode(m_locationPageRoot, NodeFilters.getByType(TYPE_FORM_DATA));
+ if (formDataNode != null) {
+ formDataNode.setText(prefix + SdkProperties.SUFFIX_FORM_DATA);
+ }
+ ITreeNode permissionCreateNode = TreeUtility.findNode(m_locationPageRoot, NodeFilters.getByType(TYPE_PERMISSION_CREATE));
+ if (permissionCreateNode != null) {
+ permissionCreateNode.setText("Create" + prefix + SdkProperties.SUFFIX_PERMISSION);
+ }
+ ITreeNode permissionReadNode = TreeUtility.findNode(m_locationPageRoot, NodeFilters.getByType(TYPE_PERMISSION_READ));
+ if (permissionReadNode != null) {
+ permissionReadNode.setText("Read" + prefix + SdkProperties.SUFFIX_PERMISSION);
+ }
+
+ ITreeNode permissionUpdateNode = TreeUtility.findNode(m_locationPageRoot, NodeFilters.getByType(TYPE_PERMISSION_UPDATE));
+ if (permissionUpdateNode != null) {
+ permissionUpdateNode.setText("Update" + prefix + SdkProperties.SUFFIX_PERMISSION);
+ }
+ ITreeNode serviceImplNode = TreeUtility.findNode(m_locationPageRoot, NodeFilters.getByType(TYPE_SERVICE_IMPLEMENTATION));
+ if (serviceImplNode != null) {
+ serviceImplNode.setText(prefix + SdkProperties.SUFFIX_PROCESS_SERVICE);
+ }
+ ITreeNode serviceInterfaceNode = TreeUtility.findNode(m_locationPageRoot, NodeFilters.getByType(TYPE_SERVICE_INTERFACE));
+ if (serviceInterfaceNode != null) {
+ serviceInterfaceNode.setText("I" + prefix + SdkProperties.SUFFIX_PROCESS_SERVICE);
+ }
+ m_locationPage.refreshTree();
+ }
+ m_locationPage.pingStateChanging();
+ }
+ }
+ } // end class P_LocationPropertyListener
+
+ private class P_InitialCheckedFilter implements ITreeNodeFilter {
+ @Override
+ public boolean accept(ITreeNode node) {
+ switch (node.getType()) {
+ case IScoutBundle.BUNDLE_CLIENT:
+ case IScoutBundle.BUNDLE_SHARED:
+ case IScoutBundle.BUNDLE_SERVER:
+ case TYPE_HANDLER_MODIFY:
+ case TYPE_HANDLER_NEW:
+ case TYPE_PERMISSION_CREATE:
+ case TYPE_PERMISSION_READ:
+ case TYPE_PERMISSION_UPDATE:
+ case TYPE_SERVICE_IMPLEMENTATION:
+ case TYPE_SERVICE_INTERFACE:
+ case TYPE_SERVICE_REG_CLIENT:
+ case TYPE_SERVICE_REG_SERVER:
+ case TYPE_FORM:
+ case TYPE_FORM_BUTTON_OK:
+ case TYPE_FORM_BUTTON_CANCEL:
+ case TYPE_FORM_DATA:
+ return true;
+ default:
+ return false;
+ }
+ }
+ } // end class P_InitialCheckedFilter
+
+ private class P_TreeDndListener implements ITreeDndListener {
+ @Override
+ public boolean isDragableNode(ITreeNode node) {
+ switch (node.getType()) {
+ case TYPE_FORM:
+ case TYPE_PERMISSION_CREATE:
+ case TYPE_PERMISSION_READ:
+ case TYPE_PERMISSION_UPDATE:
+ case TYPE_SERVICE_IMPLEMENTATION:
+ case TYPE_SERVICE_INTERFACE:
+ case TYPE_SERVICE_REG_CLIENT:
+ case TYPE_SERVICE_REG_SERVER:
+ return true;
+
+ default:
+ return false;
+ }
+ }
+
+ @Override
+ public void validateTarget(DndEvent dndEvent) {
+ if (dndEvent.targetParent == null) {
+ dndEvent.doit = false;
+ return;
+ }
+ if (dndEvent.operation == DND.DROP_COPY) {
+ validateDropCopy(dndEvent);
+ }
+ else if (dndEvent.operation == DND.DROP_MOVE) {
+ validateDropMove(dndEvent);
+ }
+ }
+
+ @Override
+ public void dndPerformed(DndEvent dndEvent) {
+ if (dndEvent.node.getType() == TYPE_FORM) {
+ ITreeNode formDataNode = TreeUtility.findNode(m_locationPageRoot, NodeFilters.getByType(TYPE_FORM_DATA));
+ if (formDataNode != null) {
+
+ ITreeNode oldFomDataParent = formDataNode.getParent();
+ IScoutBundle formBundle = (IScoutBundle) dndEvent.node.getParent().getData();
+ IScoutBundle[] sharedBundles = formBundle.getRequiredBundles(ScoutBundleFilters.getSharedFilter(), false);
+ for (IScoutBundle formDataBundle : sharedBundles) {
+ ITreeNode sharedNode = TreeUtility.findNode(m_locationPageRoot, NodeFilters.getByData(formDataBundle));
+ if (sharedNode != null) {
+ if (!oldFomDataParent.equals(sharedNode)) {
+ // move
+ oldFomDataParent.removeChild(formDataNode);
+ formDataNode.setParent(sharedNode);
+ sharedNode.addChild(formDataNode);
+ }
+ break;
+ }
+ }
+ }
+ }
+ m_formPage.pingStateChanging();
+ }
+
+ private void validateDropCopy(DndEvent dndEvent) {
+ switch (dndEvent.node.getType()) {
+ case TYPE_SERVICE_REG_CLIENT:
+ dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_CLIENT;
+ break;
+ case TYPE_SERVICE_REG_SERVER:
+ dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_SERVER;
+ break;
+ default:
+ dndEvent.doit = false;
+ break;
+ }
+ }
+
+ private void validateDropMove(DndEvent dndEvent) {
+ switch (dndEvent.node.getType()) {
+ case TYPE_FORM:
+ case TYPE_SERVICE_REG_CLIENT:
+ dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_CLIENT;
+ break;
+ case TYPE_PERMISSION_CREATE:
+ case TYPE_PERMISSION_READ:
+ case TYPE_PERMISSION_UPDATE:
+ case TYPE_SERVICE_INTERFACE:
+ dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_SHARED;
+ break;
+ case TYPE_SERVICE_IMPLEMENTATION:
+ case TYPE_SERVICE_REG_SERVER:
+ dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_SERVER;
+ break;
+ default:
+ dndEvent.doit = false;
+ break;
+ }
+
+ }
+ } // end class P_TreeDndListener
+
+ private class P_StatusRevalidator implements IStatusProvider {
+
+ @Override
+ public void validate(Object source, MultiStatus multiStatus) {
+ multiStatus.add(getStatusForm());
+ multiStatus.add(getStatusService());
+ multiStatus.add(getStatusServiceRegistrationClient());
+ multiStatus.add(getStatusServiceRegistrationServer());
+ multiStatus.add(getStatusTypeNames());
+ }
+
+ protected IStatus getStatusTypeNames() {
+
+ IScoutBundle serviceImplementationBundle = m_locationPage.getLocationBundle(TYPE_SERVICE_IMPLEMENTATION, true, true);
+ if (serviceImplementationBundle != null) {
+ ITreeNode serviceImplNode = m_locationPage.getTreeNode(TYPE_SERVICE_IMPLEMENTATION, true, true);
+ if (serviceImplNode != null) {
+ String fqn = serviceImplementationBundle.getPackageName(IScoutBundle.SERVER_PACKAGE_APPENDIX_SERVICES_PROCESS) + "." + serviceImplNode.getText();
+ IType findType = serviceImplementationBundle.findType(fqn);
+ if (findType != null && findType.exists()) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, "'" + serviceImplNode.getText() + "' " + Texts.get("AlreadyExists") + ".");
+ }
+ }
+ }
+ // shared bundles
+ IScoutBundle serviceInterfaceBundle = m_locationPage.getLocationBundle(TYPE_SERVICE_INTERFACE, true, true);
+ if (serviceInterfaceBundle != null) {
+ ITreeNode serviceInterfaceNode = m_locationPage.getTreeNode(TYPE_SERVICE_INTERFACE, true, true);
+ if (serviceInterfaceNode != null) {
+ String fqn = serviceInterfaceBundle.getPackageName(IScoutBundle.SHARED_PACKAGE_APPENDIX_SERVICES_PROCESS) + "." + serviceInterfaceNode.getText();
+ IType interfaceType = serviceInterfaceBundle.findType(fqn);
+ if (interfaceType != null && interfaceType.exists()) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, "'" + serviceInterfaceNode.getText() + "' " + Texts.get("AlreadyExists") + ".");
+ }
+ }
+ }
+ // permission read
+ IStatus createStatus = getStatusPermission(TYPE_PERMISSION_CREATE);
+ if (createStatus != Status.OK_STATUS) {
+ return createStatus;
+ }
+ IStatus readStatus = getStatusPermission(TYPE_PERMISSION_READ);
+ if (readStatus != Status.OK_STATUS) {
+ return readStatus;
+ }
+ IStatus updateStatus = getStatusPermission(TYPE_PERMISSION_UPDATE);
+ if (updateStatus != Status.OK_STATUS) {
+ return updateStatus;
+ }
+ return Status.OK_STATUS;
+ }
+
+ protected IStatus getStatusPermission(int permissionType) {
+ IScoutBundle permissionBundle = m_locationPage.getLocationBundle(permissionType, true, true);
+ if (permissionBundle != null) {
+ ITreeNode permissionNode = m_locationPage.getTreeNode(permissionType, true, true);
+ if (permissionNode != null) {
+ String fqn = permissionBundle.getPackageName(IScoutBundle.SHARED_PACKAGE_APPENDIX_SECURITY) + "." + permissionNode.getText();
+ IType permission = permissionBundle.findType(fqn);
+ if (permission != null && permission.exists()) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, "'" + permissionNode.getText() + "' " + Texts.get("AlreadyExists") + ".");
+ }
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+ protected IStatus getStatusForm() {
+ IScoutBundle formBundle = m_locationPage.getLocationBundle(TYPE_FORM, true, true);
+ if (formBundle != null) {
+ IScoutBundle formDataBundle = m_locationPage.getLocationBundle(TYPE_FORM_DATA, true, true);
+ if (formDataBundle != null) {
+ if (!formBundle.isOnClasspath(formDataBundle)) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("XIsNotAClasspathOfY", m_locationPage.getTextOfNode(TYPE_FORM_DATA), m_locationPage.getTextOfNode(TYPE_FORM)));
+ }
+ }
+ IScoutBundle formServiceBundle = m_locationPage.getLocationBundle(TYPE_SERVICE_INTERFACE, true, true);
+ if (formServiceBundle != null) {
+ if (!formBundle.isOnClasspath(formServiceBundle)) {
+ return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("XIsNotAClasspathOfY", m_locationPage.getTextOfNode(TYPE_SERVICE_INTERFACE), m_locationPage.getTextOfNode(TYPE_FORM)));
+ }
+ }
+ IScoutBundle permissionCreateBundle = m_locationPage.getLocationBundle(TYPE_PERMISSION_CREATE, true, true);
+ if (permissionCreateBundle != null) {
+ if (!formBundle.isOnClasspath(permissionCreateBundle)) {
+ return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("XIsNotAClasspathOfY", m_locationPage.getTextOfNode(TYPE_PERMISSION_CREATE), m_locationPage.getTextOfNode(TYPE_FORM)));
+ }
+ }
+ IScoutBundle permissionReadBundle = m_locationPage.getLocationBundle(TYPE_PERMISSION_READ, true, true);
+ if (permissionReadBundle != null) {
+ if (!formBundle.isOnClasspath(permissionReadBundle)) {
+ return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("XIsNotAClasspathOfY", m_locationPage.getTextOfNode(TYPE_PERMISSION_READ), m_locationPage.getTextOfNode(TYPE_FORM)));
+ }
+ }
+ IScoutBundle permissionUpdateBundle = m_locationPage.getLocationBundle(TYPE_PERMISSION_UPDATE, true, true);
+ if (permissionUpdateBundle != null) {
+ if (!formBundle.isOnClasspath(permissionUpdateBundle)) {
+ return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("XIsNotAClasspathOfY", m_locationPage.getTextOfNode(TYPE_PERMISSION_UPDATE), m_locationPage.getTextOfNode(TYPE_FORM)));
+ }
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+ protected IStatus getStatusService() {
+ IScoutBundle serviceImplementationBundle = m_locationPage.getLocationBundle(TYPE_SERVICE_IMPLEMENTATION, true, true);
+ if (serviceImplementationBundle != null) {
+ IScoutBundle serviceInterfaceBundle = m_locationPage.getLocationBundle(TYPE_SERVICE_INTERFACE, true, true);
+ if (serviceInterfaceBundle != null) {
+ if (!serviceImplementationBundle.isOnClasspath(serviceInterfaceBundle)) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("XIsNotAClasspathOfY", m_locationPage.getTextOfNode(TYPE_SERVICE_INTERFACE), m_locationPage.getTextOfNode(TYPE_SERVICE_IMPLEMENTATION)));
+ }
+ }
+ IScoutBundle permissionCreateBundle = m_locationPage.getLocationBundle(TYPE_PERMISSION_CREATE, true, true);
+ if (permissionCreateBundle != null) {
+ if (!serviceImplementationBundle.isOnClasspath(permissionCreateBundle)) {
+ return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("XIsNotAClasspathOfY", m_locationPage.getTextOfNode(TYPE_PERMISSION_CREATE), m_locationPage.getTextOfNode(TYPE_SERVICE_IMPLEMENTATION)));
+ }
+ }
+ IScoutBundle permissionReadBundle = m_locationPage.getLocationBundle(TYPE_PERMISSION_READ, true, true);
+ if (permissionReadBundle != null) {
+ if (!serviceImplementationBundle.isOnClasspath(permissionReadBundle)) {
+ return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("XIsNotAClasspathOfY", m_locationPage.getTextOfNode(TYPE_PERMISSION_READ), m_locationPage.getTextOfNode(TYPE_SERVICE_IMPLEMENTATION)));
+ }
+ }
+ IScoutBundle permissionUpdateBundle = m_locationPage.getLocationBundle(TYPE_PERMISSION_UPDATE, true, true);
+ if (permissionUpdateBundle != null) {
+ if (!serviceImplementationBundle.isOnClasspath(permissionUpdateBundle)) {
+ return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("XIsNotAClasspathOfY", m_locationPage.getTextOfNode(TYPE_PERMISSION_UPDATE), m_locationPage.getTextOfNode(TYPE_SERVICE_IMPLEMENTATION)));
+ }
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+ protected IStatus getStatusServiceRegistrationClient() {
+ IScoutBundle serviceInterfaceBundle = m_locationPage.getLocationBundle(TYPE_SERVICE_INTERFACE, true, true);
+ ITreeNode[] serviceRegistrationClientNodes = m_locationPage.getTreeNodes(TYPE_SERVICE_REG_CLIENT, true, true);
+ for (ITreeNode serviceRegNode : serviceRegistrationClientNodes) {
+ Object data = serviceRegNode.getParent().getData();
+ if (data instanceof IScoutBundle) {
+ IScoutBundle serviceRegistrationBundle = (IScoutBundle) data;
+ if (serviceInterfaceBundle == null && serviceRegistrationBundle != null) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, "The client service registration can not be done without a service interface.");
+ }
+ if (serviceInterfaceBundle != null && serviceRegistrationBundle != null) {
+ if (!serviceRegistrationBundle.isOnClasspath(serviceInterfaceBundle)) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("XIsNotOnClasspathOfServiceY", m_locationPage.getTextOfNode(TYPE_SERVICE_INTERFACE), serviceRegistrationBundle.getBundleName()));
+ }
+ }
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+ protected IStatus getStatusServiceRegistrationServer() {
+ IScoutBundle serviceImplementationBundle = m_locationPage.getLocationBundle(TYPE_SERVICE_IMPLEMENTATION, true, true);
+ ITreeNode[] serviceRegistrationServerNodes = m_locationPage.getTreeNodes(TYPE_SERVICE_REG_SERVER, true, true);
+ for (ITreeNode serviceRegNode : serviceRegistrationServerNodes) {
+ Object data = serviceRegNode.getParent().getData();
+ if (data instanceof IScoutBundle) {
+ IScoutBundle serviceRegistrationBundle = (IScoutBundle) data;
+ if (serviceImplementationBundle != null && serviceRegistrationBundle != null) {
+ if (!serviceRegistrationBundle.isOnClasspath(serviceImplementationBundle)) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("XIsNotOnClasspathOfServiceY", m_locationPage.getTextOfNode(TYPE_SERVICE_IMPLEMENTATION), serviceRegistrationBundle.getBundleName()));
+ }
+ }
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+ } // end class P_StatusRevalidator
+
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/FormNewWizardPage.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/FormNewWizardPage.java
index 94dd3cc81..00ce60916 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/FormNewWizardPage.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/FormNewWizardPage.java
@@ -1,363 +1,363 @@
-/*******************************************************************************
- * 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;
-
-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.jdt.core.Signature;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.nls.sdk.internal.ui.action.NlsProposal;
-import org.eclipse.scout.nls.sdk.model.INlsEntry;
-import org.eclipse.scout.sdk.RuntimeClasses;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.operation.form.FormStackNewOperation;
-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.javaelement.JavaElementAbstractTypeContentProvider;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
-import org.eclipse.scout.sdk.util.Regex;
-import org.eclipse.scout.sdk.util.SdkProperties;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Group;
-
-/**
- * <h3>FormNewWizardPage</h3> ...
- *
- * @author Andreas Hoegger
- * @since 1.0.8 03.08.2009
- */
-public class FormNewWizardPage extends AbstractWorkspaceWizardPage {
-
- final IType iForm = TypeUtility.getType(RuntimeClasses.IForm);
- final IType abstractForm = TypeUtility.getType(RuntimeClasses.AbstractForm);
-
- /** {@link NlsProposal} **/
- public static final String PROP_NLS_NAME = "nlsName";
- /** {@link String} **/
- public static final String PROP_TYPE_NAME = "typeName";
- /** {@link IType} **/
- public static final String PROP_SUPER_TYPE = "superType";
- /** {@link Boolean} **/
- public static final String PROP_CREATE_FORM_ID = "createFormId";
- /** {@link String} **/
- public static final String PROP_FORM_ID_NAME = "formIdName";
-
- // ui fields
- private ProposalTextField m_nlsNameField;
- private StyledTextField m_typeNameField;
- private ProposalTextField m_superTypeField;
- private Button m_createFormIdField;
- private StyledTextField m_formIdField;
-
- // process members
- private final IScoutBundle m_clientBundle;
-
- public FormNewWizardPage(IScoutBundle clientBundle) {
- super(FormNewWizardPage.class.getName());
- m_clientBundle = clientBundle;
- setTitle(Texts.get("Form"));
- setDescription(Texts.get("CreateANewForm"));
- setSuperTypeInternal(abstractForm);
- setCreateFormId(true);
- }
-
- @Override
- protected void createContent(Composite parent) {
- m_nlsNameField = getFieldToolkit().createNlsProposalTextField(parent, getClientBundle().findBestMatchNlsProject(), Texts.get("Name"));
- m_nlsNameField.acceptProposal(getNlsName());
- m_nlsNameField.addProposalAdapterListener(new IProposalAdapterListener() {
- @Override
- public void proposalAccepted(ContentProposalEvent event) {
-
- try {
- setStateChanging(true);
- String oldKey = "";
- if (getNlsName() != null) {
- oldKey = getNlsName().getKey();
- }
- INlsEntry newName = (INlsEntry) event.proposal;
- setNlsNameInternal(newName);
- if (newName != null) {
- if (StringUtility.isNullOrEmpty(m_typeNameField.getModifiableText()) || oldKey.equals(m_typeNameField.getModifiableText())) {
- m_typeNameField.setText(newName.getKey());
- }
- if (StringUtility.isNullOrEmpty(m_formIdField.getModifiableText()) || oldKey.equals(m_formIdField.getModifiableText())) {
- m_formIdField.setText(newName.getKey());
- }
- }
- }
- finally {
- setStateChanging(false);
- }
- }
- });
-
- m_typeNameField = getFieldToolkit().createStyledTextField(parent, Texts.get("TypeName"));
- m_typeNameField.setReadOnlySuffix(SdkProperties.SUFFIX_FORM);
- m_typeNameField.setText(getTypeName());
- m_typeNameField.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- setTypeNameInternal(m_typeNameField.getText());
- pingStateChanging();
- }
- });
-
- m_superTypeField = getFieldToolkit().createJavaElementProposalField(parent, Texts.get("SuperType"),
- new JavaElementAbstractTypeContentProvider(iForm, getClientBundle().getJavaProject(), abstractForm));
- m_superTypeField.acceptProposal(getSuperType());
- m_superTypeField.addProposalAdapterListener(new IProposalAdapterListener() {
- @Override
- public void proposalAccepted(ContentProposalEvent event) {
- setSuperTypeInternal((IType) event.proposal);
- pingStateChanging();
- }
- });
-
- Control formIdGroup = createIdGroup(parent);
-
- // 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_superTypeField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- formIdGroup.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
-
- }
-
- protected Control createIdGroup(Composite parent) {
- Group group = new Group(parent, SWT.SHADOW_ETCHED_IN);
- group.setText(Texts.get("FormId"));
-
- m_createFormIdField = new Button(group, SWT.CHECK);
- m_createFormIdField.setText(Texts.get("CreateFormId"));
- m_createFormIdField.setSelection(isCreateFormId());
- m_createFormIdField.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- setCreateFormIdInternal(m_createFormIdField.getSelection());
- pingStateChanging();
- }
- });
-
- m_formIdField = getFieldToolkit().createStyledTextField(group, Texts.get("PropertyNameId"));
- m_formIdField.setReadOnlySuffix(SdkProperties.SUFFIX_ID);
- m_formIdField.setText(getTypeName());
- m_formIdField.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- setFormIdInternal(m_formIdField.getText());
- pingStateChanging();
- }
- });
-
- // layout
- group.setLayout(new GridLayout(1, true));
- m_createFormIdField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- m_formIdField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
-
- return group;
- }
-
- void fillOperation(FormStackNewOperation operation) {
- operation.setCreateIdProperty(isCreateFormId());
- operation.setFormIdName(getFormId());
- operation.setFormName(getTypeName());
- if (getNlsName() != null) {
- operation.setNlsEntry(getNlsName());
- }
- IType superTypeProp = getSuperType();
- if (superTypeProp != null) {
- operation.setFormSuperTypeSignature(Signature.createTypeSignature(superTypeProp.getFullyQualifiedName(), true));
- }
- }
-
- @Override
- public FormNewWizard getWizard() {
- return (FormNewWizard) super.getWizard();
- }
-
- @Override
- protected void validatePage(MultiStatus multiStatus) {
- try {
- multiStatus.add(getStatusNameField());
- multiStatus.add(getStatusSuperType());
- multiStatus.add(getStatusPropertyId());
- }
- catch (JavaModelException e) {
- ScoutSdkUi.logError("could not validate name field.", e);
- }
- }
-
- protected IStatus getStatusPropertyId() {
- if (isCreateFormId()) {
- if (StringUtility.isNullOrEmpty(getFormId()) || getFormId().equals(SdkProperties.SUFFIX_ID)) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("IdNameMissing"));
- }
- }
- return Status.OK_STATUS;
- }
-
- protected IStatus getStatusNameField() throws JavaModelException {
- if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_FORM)) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
- }
- // check not allowed names
- if (TypeUtility.existsType(getClientBundle().getPackageName(IScoutBundle.CLIENT_PACKAGE_APPENDIX_UI_FORMS) + "." + getTypeName())) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
- }
-
- if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
- return Status.OK_STATUS;
- }
- else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
- return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
- }
- else {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
- }
- }
-
- protected IStatus getStatusSuperType() throws JavaModelException {
- if (getSuperType() == null) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("TheSuperTypeCanNotBeNull"));
- }
- return Status.OK_STATUS;
- }
-
- public IScoutBundle getClientBundle() {
- return m_clientBundle;
- }
-
- public INlsEntry getNlsName() {
- return (INlsEntry) getProperty(PROP_NLS_NAME);
- }
-
- public void setNlsName(INlsEntry proposal) {
- try {
- setStateChanging(true);
- setNlsNameInternal(proposal);
- if (isControlCreated()) {
- m_nlsNameField.acceptProposal(proposal);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setNlsNameInternal(INlsEntry proposal) {
- setProperty(PROP_NLS_NAME, proposal);
- }
-
- public String getTypeName() {
- return getPropertyString(PROP_TYPE_NAME);
- }
-
- public void setTypeName(String typeName) {
- try {
- setStateChanging(true);
- setTypeNameInternal(typeName);
- if (isControlCreated()) {
- m_typeNameField.setText(typeName);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setTypeNameInternal(String typeName) {
- setPropertyString(PROP_TYPE_NAME, typeName);
- }
-
- public IType getSuperType() {
- return (IType) getProperty(PROP_SUPER_TYPE);
- }
-
- public void setSuperType(IType superType) {
- try {
- setStateChanging(true);
- setSuperTypeInternal(superType);
- if (isControlCreated()) {
- m_superTypeField.acceptProposal(superType);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setSuperTypeInternal(IType superType) {
- setProperty(PROP_SUPER_TYPE, superType);
- }
-
- public boolean isCreateFormId() {
- return getPropertyBool(PROP_CREATE_FORM_ID);
- }
-
- public void setCreateFormId(boolean createFormId) {
- try {
- setStateChanging(true);
- setCreateFormIdInternal(createFormId);
- if (isControlCreated()) {
- m_createFormIdField.setSelection(createFormId);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setCreateFormIdInternal(boolean createFormId) {
- setPropertyBool(PROP_CREATE_FORM_ID, createFormId);
- }
-
- public String getFormId() {
- return getPropertyString(PROP_FORM_ID_NAME);
- }
-
- public void setFormId(String formId) {
- try {
- setStateChanging(true);
- setFormIdInternal(formId);
- if (isControlCreated()) {
- m_formIdField.setText(formId);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setFormIdInternal(String formId) {
- setPropertyString(PROP_FORM_ID_NAME, formId);
- }
-
-}
+/*******************************************************************************
+ * 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;
+
+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.jdt.core.Signature;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.nls.sdk.internal.ui.action.NlsProposal;
+import org.eclipse.scout.nls.sdk.model.INlsEntry;
+import org.eclipse.scout.sdk.RuntimeClasses;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.operation.form.FormStackNewOperation;
+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.javaelement.JavaElementAbstractTypeContentProvider;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
+import org.eclipse.scout.sdk.util.Regex;
+import org.eclipse.scout.sdk.util.SdkProperties;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+
+/**
+ * <h3>FormNewWizardPage</h3> ...
+ *
+ * @author Andreas Hoegger
+ * @since 1.0.8 03.08.2009
+ */
+public class FormNewWizardPage extends AbstractWorkspaceWizardPage {
+
+ final IType iForm = TypeUtility.getType(RuntimeClasses.IForm);
+ final IType abstractForm = TypeUtility.getType(RuntimeClasses.AbstractForm);
+
+ /** {@link NlsProposal} **/
+ public static final String PROP_NLS_NAME = "nlsName";
+ /** {@link String} **/
+ public static final String PROP_TYPE_NAME = "typeName";
+ /** {@link IType} **/
+ public static final String PROP_SUPER_TYPE = "superType";
+ /** {@link Boolean} **/
+ public static final String PROP_CREATE_FORM_ID = "createFormId";
+ /** {@link String} **/
+ public static final String PROP_FORM_ID_NAME = "formIdName";
+
+ // ui fields
+ private ProposalTextField m_nlsNameField;
+ private StyledTextField m_typeNameField;
+ private ProposalTextField m_superTypeField;
+ private Button m_createFormIdField;
+ private StyledTextField m_formIdField;
+
+ // process members
+ private final IScoutBundle m_clientBundle;
+
+ public FormNewWizardPage(IScoutBundle clientBundle) {
+ super(FormNewWizardPage.class.getName());
+ m_clientBundle = clientBundle;
+ setTitle(Texts.get("Form"));
+ setDescription(Texts.get("CreateANewForm"));
+ setSuperTypeInternal(abstractForm);
+ setCreateFormId(true);
+ }
+
+ @Override
+ protected void createContent(Composite parent) {
+ m_nlsNameField = getFieldToolkit().createNlsProposalTextField(parent, getClientBundle().findBestMatchNlsProject(), Texts.get("Name"));
+ m_nlsNameField.acceptProposal(getNlsName());
+ m_nlsNameField.addProposalAdapterListener(new IProposalAdapterListener() {
+ @Override
+ public void proposalAccepted(ContentProposalEvent event) {
+
+ try {
+ setStateChanging(true);
+ String oldKey = "";
+ if (getNlsName() != null) {
+ oldKey = getNlsName().getKey();
+ }
+ INlsEntry newName = (INlsEntry) event.proposal;
+ setNlsNameInternal(newName);
+ if (newName != null) {
+ if (StringUtility.isNullOrEmpty(m_typeNameField.getModifiableText()) || oldKey.equals(m_typeNameField.getModifiableText())) {
+ m_typeNameField.setText(newName.getKey());
+ }
+ if (StringUtility.isNullOrEmpty(m_formIdField.getModifiableText()) || oldKey.equals(m_formIdField.getModifiableText())) {
+ m_formIdField.setText(newName.getKey());
+ }
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+ });
+
+ m_typeNameField = getFieldToolkit().createStyledTextField(parent, Texts.get("TypeName"));
+ m_typeNameField.setReadOnlySuffix(SdkProperties.SUFFIX_FORM);
+ m_typeNameField.setText(getTypeName());
+ m_typeNameField.addModifyListener(new ModifyListener() {
+ @Override
+ public void modifyText(ModifyEvent e) {
+ setTypeNameInternal(m_typeNameField.getText());
+ pingStateChanging();
+ }
+ });
+
+ m_superTypeField = getFieldToolkit().createJavaElementProposalField(parent, Texts.get("SuperType"),
+ new JavaElementAbstractTypeContentProvider(iForm, getClientBundle().getJavaProject(), abstractForm));
+ m_superTypeField.acceptProposal(getSuperType());
+ m_superTypeField.addProposalAdapterListener(new IProposalAdapterListener() {
+ @Override
+ public void proposalAccepted(ContentProposalEvent event) {
+ setSuperTypeInternal((IType) event.proposal);
+ pingStateChanging();
+ }
+ });
+
+ Control formIdGroup = createIdGroup(parent);
+
+ // 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_superTypeField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ formIdGroup.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+
+ }
+
+ protected Control createIdGroup(Composite parent) {
+ Group group = new Group(parent, SWT.SHADOW_ETCHED_IN);
+ group.setText(Texts.get("FormId"));
+
+ m_createFormIdField = new Button(group, SWT.CHECK);
+ m_createFormIdField.setText(Texts.get("CreateFormId"));
+ m_createFormIdField.setSelection(isCreateFormId());
+ m_createFormIdField.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ setCreateFormIdInternal(m_createFormIdField.getSelection());
+ pingStateChanging();
+ }
+ });
+
+ m_formIdField = getFieldToolkit().createStyledTextField(group, Texts.get("PropertyNameId"));
+ m_formIdField.setReadOnlySuffix(SdkProperties.SUFFIX_ID);
+ m_formIdField.setText(getTypeName());
+ m_formIdField.addModifyListener(new ModifyListener() {
+ @Override
+ public void modifyText(ModifyEvent e) {
+ setFormIdInternal(m_formIdField.getText());
+ pingStateChanging();
+ }
+ });
+
+ // layout
+ group.setLayout(new GridLayout(1, true));
+ m_createFormIdField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ m_formIdField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+
+ return group;
+ }
+
+ void fillOperation(FormStackNewOperation operation) {
+ operation.setCreateIdProperty(isCreateFormId());
+ operation.setFormIdName(getFormId());
+ operation.setFormName(getTypeName());
+ if (getNlsName() != null) {
+ operation.setNlsEntry(getNlsName());
+ }
+ IType superTypeProp = getSuperType();
+ if (superTypeProp != null) {
+ operation.setFormSuperTypeSignature(Signature.createTypeSignature(superTypeProp.getFullyQualifiedName(), true));
+ }
+ }
+
+ @Override
+ public FormNewWizard getWizard() {
+ return (FormNewWizard) super.getWizard();
+ }
+
+ @Override
+ protected void validatePage(MultiStatus multiStatus) {
+ try {
+ multiStatus.add(getStatusNameField());
+ multiStatus.add(getStatusSuperType());
+ multiStatus.add(getStatusPropertyId());
+ }
+ catch (JavaModelException e) {
+ ScoutSdkUi.logError("could not validate name field.", e);
+ }
+ }
+
+ protected IStatus getStatusPropertyId() {
+ if (isCreateFormId()) {
+ if (StringUtility.isNullOrEmpty(getFormId()) || getFormId().equals(SdkProperties.SUFFIX_ID)) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("IdNameMissing"));
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+ protected IStatus getStatusNameField() throws JavaModelException {
+ if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_FORM)) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
+ }
+ // check not allowed names
+ if (TypeUtility.existsType(getClientBundle().getPackageName(IScoutBundle.CLIENT_PACKAGE_APPENDIX_UI_FORMS) + "." + getTypeName())) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
+ }
+
+ if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return Status.OK_STATUS;
+ }
+ else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
+ }
+ else {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
+ }
+ }
+
+ protected IStatus getStatusSuperType() throws JavaModelException {
+ if (getSuperType() == null) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("TheSuperTypeCanNotBeNull"));
+ }
+ return Status.OK_STATUS;
+ }
+
+ public IScoutBundle getClientBundle() {
+ return m_clientBundle;
+ }
+
+ public INlsEntry getNlsName() {
+ return (INlsEntry) getProperty(PROP_NLS_NAME);
+ }
+
+ public void setNlsName(INlsEntry proposal) {
+ try {
+ setStateChanging(true);
+ setNlsNameInternal(proposal);
+ if (isControlCreated()) {
+ m_nlsNameField.acceptProposal(proposal);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setNlsNameInternal(INlsEntry proposal) {
+ setProperty(PROP_NLS_NAME, proposal);
+ }
+
+ public String getTypeName() {
+ return getPropertyString(PROP_TYPE_NAME);
+ }
+
+ public void setTypeName(String typeName) {
+ try {
+ setStateChanging(true);
+ setTypeNameInternal(typeName);
+ if (isControlCreated()) {
+ m_typeNameField.setText(typeName);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setTypeNameInternal(String typeName) {
+ setPropertyString(PROP_TYPE_NAME, typeName);
+ }
+
+ public IType getSuperType() {
+ return (IType) getProperty(PROP_SUPER_TYPE);
+ }
+
+ public void setSuperType(IType superType) {
+ try {
+ setStateChanging(true);
+ setSuperTypeInternal(superType);
+ if (isControlCreated()) {
+ m_superTypeField.acceptProposal(superType);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setSuperTypeInternal(IType superType) {
+ setProperty(PROP_SUPER_TYPE, superType);
+ }
+
+ public boolean isCreateFormId() {
+ return getPropertyBool(PROP_CREATE_FORM_ID);
+ }
+
+ public void setCreateFormId(boolean createFormId) {
+ try {
+ setStateChanging(true);
+ setCreateFormIdInternal(createFormId);
+ if (isControlCreated()) {
+ m_createFormIdField.setSelection(createFormId);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setCreateFormIdInternal(boolean createFormId) {
+ setPropertyBool(PROP_CREATE_FORM_ID, createFormId);
+ }
+
+ public String getFormId() {
+ return getPropertyString(PROP_FORM_ID_NAME);
+ }
+
+ public void setFormId(String formId) {
+ try {
+ setStateChanging(true);
+ setFormIdInternal(formId);
+ if (isControlCreated()) {
+ m_formIdField.setText(formId);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setFormIdInternal(String formId) {
+ setPropertyString(PROP_FORM_ID_NAME, formId);
+ }
+
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/SearchFormNewWizard.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/SearchFormNewWizard.java
index 3c3b2ebe6..f0e6813b5 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/SearchFormNewWizard.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/SearchFormNewWizard.java
@@ -1,295 +1,295 @@
-/*******************************************************************************
- * 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;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-
-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.Signature;
-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.operation.form.SearchFormNewOperation;
-import org.eclipse.scout.sdk.ui.fields.bundletree.DndEvent;
-import org.eclipse.scout.sdk.ui.fields.bundletree.ITreeDndListener;
-import org.eclipse.scout.sdk.ui.fields.bundletree.ITreeNode;
-import org.eclipse.scout.sdk.ui.fields.bundletree.ITreeNodeFilter;
-import org.eclipse.scout.sdk.ui.fields.bundletree.NodeFilters;
-import org.eclipse.scout.sdk.ui.fields.bundletree.TreeUtility;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
-import org.eclipse.scout.sdk.ui.wizard.BundleTreeWizardPage;
-import org.eclipse.scout.sdk.ui.wizard.IStatusProvider;
-import org.eclipse.scout.sdk.ui.wizard.services.ServiceNewWizardPage;
-import org.eclipse.scout.sdk.util.SdkProperties;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.workspace.IScoutProject;
-import org.eclipse.scout.sdk.workspace.ScoutBundleFilters;
-import org.eclipse.swt.dnd.DND;
-
-public class SearchFormNewWizard extends AbstractWorkspaceWizard {
-
- public static final int TYPE_SEARCH_FORM = 100;
- public static final int TYPE_SEARCH_FORM_DATA = 101;
- public static final int TYPE_HANDLER_SEARCH = 102;
-
- private final IScoutBundle m_clientBundle;
- private SearchFormNewWizardPage m_page1;
- private BundleTreeWizardPage m_page2;
- private SearchFormNewOperation m_operation = new SearchFormNewOperation();
- private ITreeNode m_locationPageRoot;
-
- public SearchFormNewWizard(IScoutBundle clientBundle) {
- setWindowTitle(Texts.get("NewSearchForm"));
- P_StatusRevalidator statusProvider = new P_StatusRevalidator();
- m_clientBundle = clientBundle;
- m_page1 = new SearchFormNewWizardPage(clientBundle);
- m_page1.addStatusProvider(statusProvider);
- addPage(m_page1);
- m_locationPageRoot = createTree(clientBundle);
- m_page2 = new BundleTreeWizardPage(Texts.get("SearchFormClassLocations"), Texts.get("OrganiseLocations"), m_locationPageRoot, new P_InitialCheckedFilter());
- m_page2.addStatusProvider(statusProvider);
- m_page2.addDndListener(new P_TreeDndListener());
- addPage(m_page2);
- // init
- m_page1.addPropertyChangeListener(new P_LocationPropertyListener());
- }
-
- public void setTablePage(IType tablePage) {
- if (tablePage != null) {
- m_page1.setTablePageType(tablePage);
- }
- }
-
- public void setNlsEntry(INlsEntry nlsEntry) {
- if (nlsEntry != null) {
- m_page1.setNlsName(nlsEntry);
- m_page1.setTypeName(nlsEntry.getKey() + SdkProperties.SUFFIX_SEARCH_FORM);
- }
- else {
- m_page1.setNlsName(null);
- }
- }
-
- private ITreeNode createTree(IScoutBundle clientBundle) {
- IScoutBundle sharedBundle = null;
- IScoutProject scoutProject = clientBundle.getScoutProject();
- while (sharedBundle == null && scoutProject != null) {
- sharedBundle = scoutProject.getSharedBundle();
- scoutProject = scoutProject.getParentProject();
- }
- ITreeNode rootNode = TreeUtility.createBundleTree(clientBundle.getScoutProject(), NodeFilters.getAcceptAll());
-
- ITreeNode clientNode = TreeUtility.findNode(rootNode, NodeFilters.getByData(clientBundle));
- // form
- ITreeNode formNode = TreeUtility.createNode(clientNode, TYPE_SEARCH_FORM, Texts.get("SearchForm"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class), TYPE_SEARCH_FORM);
- // searchHandler
- TreeUtility.createNode(formNode, TYPE_HANDLER_SEARCH, Texts.get("SearchHandler"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class), TYPE_HANDLER_SEARCH);
-
- if (sharedBundle != null) {
- ITreeNode sharedNode = TreeUtility.findNode(rootNode, NodeFilters.getByData(sharedBundle));
- // formData
- TreeUtility.createNode(sharedNode, TYPE_SEARCH_FORM_DATA, Texts.get("SearchFormData"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class), TYPE_SEARCH_FORM_DATA);
- }
- return rootNode;
- }
-
- @Override
- protected boolean beforeFinish() throws CoreException {
- // fill operation before gui is disposed
- m_operation.setTypeName(m_page1.getTypeName());
- m_operation.setNlsEntry(m_page1.getNlsName());
- IType superTypeProp = m_page1.getSuperType();
- if (superTypeProp != null) {
- m_operation.setSuperTypeSignature(Signature.createTypeSignature(superTypeProp.getFullyQualifiedName(), true));
- }
- m_operation.setTablePage(m_page1.getTablePageType());
- m_operation.setCreateSearchHandler(m_page2.getTreeNode(TYPE_HANDLER_SEARCH, true, true) != null);
- m_operation.setSearchFormLocationBundle(m_page2.getLocationBundle(TYPE_SEARCH_FORM, true, true));
- m_operation.setSearchFormDataLocationBundle(m_page2.getLocationBundle(TYPE_SEARCH_FORM_DATA, true, true));
- return true;
- }
-
- @Override
- protected boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) {
- try {
- m_operation.run(monitor, workingCopyManager);
- return true;
- }
- catch (Exception e) {
- ScoutSdkUi.logError("exception during perfoming finish of wizard.", e);
- return false;
- }
- }
-
- public IScoutBundle getClientBundle() {
- return m_clientBundle;
- }
-
- private class P_LocationPropertyListener implements PropertyChangeListener {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- if (evt.getPropertyName().equals(ServiceNewWizardPage.PROP_TYPE_NAME)) {
- String typeName = m_page1.getTypeName();
- if (!StringUtility.isNullOrEmpty(typeName)) {
- String prefix = typeName.replaceAll(SdkProperties.SUFFIX_SEARCH_FORM + "$", "");
- TreeUtility.findNode(m_locationPageRoot, NodeFilters.getByType(TYPE_SEARCH_FORM)).setText(prefix + SdkProperties.SUFFIX_SEARCH_FORM);
- TreeUtility.findNode(m_locationPageRoot, NodeFilters.getByType(TYPE_SEARCH_FORM_DATA)).setText(prefix + SdkProperties.SUFFIX_SEARCH_FORM_DATA);
- m_page2.refreshTree();
- }
- m_page2.pingStateChanging();
- }
- }
- } // end class P_LocationPropertyListener
-
- private class P_InitialCheckedFilter implements ITreeNodeFilter {
- @Override
- public boolean accept(ITreeNode node) {
- switch (node.getType()) {
- case TYPE_HANDLER_SEARCH:
- case TYPE_SEARCH_FORM:
- case TYPE_SEARCH_FORM_DATA:
- return true;
- default:
- return false;
- }
- }
- } // end class P_InitialCheckedFilter
-
- private class P_TreeDndListener implements ITreeDndListener {
- @Override
- public boolean isDragableNode(ITreeNode node) {
- switch (node.getType()) {
- case TYPE_SEARCH_FORM:
- return true;
-
- default:
- return false;
- }
- }
-
- @Override
- public void validateTarget(DndEvent dndEvent) {
- if (dndEvent.targetParent == null) {
- dndEvent.doit = false;
- return;
- }
- if (dndEvent.operation == DND.DROP_COPY) {
- validateDropCopy(dndEvent);
- }
- else if (dndEvent.operation == DND.DROP_MOVE) {
- validateDropMove(dndEvent);
- }
- }
-
- @Override
- public void dndPerformed(DndEvent dndEvent) {
- if (dndEvent.node.getType() == TYPE_SEARCH_FORM) {
- ITreeNode formDataNode = TreeUtility.findNode(m_locationPageRoot, NodeFilters.getByType(TYPE_SEARCH_FORM_DATA));
- if (formDataNode != null) {
-
- ITreeNode oldFomDataParent = formDataNode.getParent();
- IScoutBundle formBundle = (IScoutBundle) dndEvent.node.getParent().getData();
- IScoutBundle[] sharedBundles = formBundle.getRequiredBundles(ScoutBundleFilters.getSharedFilter(), false);
- for (IScoutBundle formDataBundle : sharedBundles) {
- ITreeNode sharedNode = TreeUtility.findNode(m_locationPageRoot, NodeFilters.getByData(formDataBundle));
- if (sharedNode != null) {
- if (!oldFomDataParent.equals(sharedNode)) {
- // move
- oldFomDataParent.removeChild(formDataNode);
- formDataNode.setParent(sharedNode);
- sharedNode.addChild(formDataNode);
- }
- break;
- }
- }
- }
- }
- m_page1.pingStateChanging();
- }
-
- private void validateDropCopy(DndEvent dndEvent) {
- dndEvent.doit = false;
- }
-
- private void validateDropMove(DndEvent dndEvent) {
- switch (dndEvent.node.getType()) {
- case TYPE_SEARCH_FORM:
- dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_CLIENT;
- break;
- default:
- dndEvent.doit = false;
- break;
- }
-
- }
- } // end class P_TreeDndListener
-
- private class P_StatusRevalidator implements IStatusProvider {
-
- @Override
- public void validate(Object source, MultiStatus multiStatus) {
- multiStatus.add(getStatusSearchForm(source));
- multiStatus.add(getStatusTypeNames(source));
- }
-
- protected IStatus getStatusTypeNames(Object source) {
- IScoutBundle searchFormBundle = m_page2.getLocationBundle(TYPE_SEARCH_FORM, true, true);
- if (searchFormBundle != null) {
- ITreeNode searchFormNode = m_page2.getTreeNode(TYPE_SEARCH_FORM, true, true);
- if (searchFormNode != null) {
- String fqn = searchFormBundle.getPackageName(IScoutBundle.CLIENT_PACKAGE_APPENDIX_UI_SEARCHFORMS) + "." + searchFormNode.getText();
- if (searchFormBundle.findType(fqn) != null) {
- return new Status((source instanceof SearchFormNewWizardPage) ? (IStatus.ERROR) : (IStatus.WARNING),
- ScoutSdkUi.PLUGIN_ID, "'" + searchFormNode.getText() + "' " + Texts.get("AlreadyExists") + ".");
- }
- }
- }
-
- IScoutBundle formDataBundle = m_page2.getLocationBundle(TYPE_SEARCH_FORM_DATA, true, true);
- if (formDataBundle != null) {
- ITreeNode formDataNode = m_page2.getTreeNode(TYPE_SEARCH_FORM_DATA, true, true);
- if (formDataNode != null) {
- String fqn = formDataBundle.getPackageName(IScoutBundle.SHARED_PACKAGE_APPENDIX_SERVICES_PROCESS) + "." + formDataNode.getText();
- if (formDataBundle.findType(fqn) != null) {
- return new Status((source instanceof SearchFormNewWizardPage) ? (IStatus.WARNING) : (IStatus.ERROR),
- ScoutSdkUi.PLUGIN_ID, "'" + formDataNode.getText() + "' " + Texts.get("AlreadyExists") + ".");
- }
- }
- }
- return Status.OK_STATUS;
- }
-
- protected IStatus getStatusSearchForm(Object source) {
- IScoutBundle formBundle = m_page2.getLocationBundle(TYPE_SEARCH_FORM, true, true);
- if (formBundle != null) {
- IScoutBundle formDataBundle = m_page2.getLocationBundle(TYPE_SEARCH_FORM_DATA, true, true);
- if (formDataBundle != null) {
- if (!formBundle.isOnClasspath(formDataBundle)) {
- return new Status((source instanceof SearchFormNewWizardPage) ? (IStatus.WARNING) : (IStatus.ERROR),
- ScoutSdkUi.PLUGIN_ID, Texts.get("XIsNotAClasspathOfY", m_page2.getTextOfNode(TYPE_SEARCH_FORM_DATA), m_page2.getTextOfNode(TYPE_SEARCH_FORM)));
- }
- }
-
- }
- return Status.OK_STATUS;
- }
-
- } // end class P_StatusRevalidator
-
-}
+/*******************************************************************************
+ * 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;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+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.Signature;
+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.operation.form.SearchFormNewOperation;
+import org.eclipse.scout.sdk.ui.fields.bundletree.DndEvent;
+import org.eclipse.scout.sdk.ui.fields.bundletree.ITreeDndListener;
+import org.eclipse.scout.sdk.ui.fields.bundletree.ITreeNode;
+import org.eclipse.scout.sdk.ui.fields.bundletree.ITreeNodeFilter;
+import org.eclipse.scout.sdk.ui.fields.bundletree.NodeFilters;
+import org.eclipse.scout.sdk.ui.fields.bundletree.TreeUtility;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
+import org.eclipse.scout.sdk.ui.wizard.BundleTreeWizardPage;
+import org.eclipse.scout.sdk.ui.wizard.IStatusProvider;
+import org.eclipse.scout.sdk.ui.wizard.services.ServiceNewWizardPage;
+import org.eclipse.scout.sdk.util.SdkProperties;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.workspace.IScoutProject;
+import org.eclipse.scout.sdk.workspace.ScoutBundleFilters;
+import org.eclipse.swt.dnd.DND;
+
+public class SearchFormNewWizard extends AbstractWorkspaceWizard {
+
+ public static final int TYPE_SEARCH_FORM = 100;
+ public static final int TYPE_SEARCH_FORM_DATA = 101;
+ public static final int TYPE_HANDLER_SEARCH = 102;
+
+ private final IScoutBundle m_clientBundle;
+ private SearchFormNewWizardPage m_page1;
+ private BundleTreeWizardPage m_page2;
+ private SearchFormNewOperation m_operation = new SearchFormNewOperation();
+ private ITreeNode m_locationPageRoot;
+
+ public SearchFormNewWizard(IScoutBundle clientBundle) {
+ setWindowTitle(Texts.get("NewSearchForm"));
+ P_StatusRevalidator statusProvider = new P_StatusRevalidator();
+ m_clientBundle = clientBundle;
+ m_page1 = new SearchFormNewWizardPage(clientBundle);
+ m_page1.addStatusProvider(statusProvider);
+ addPage(m_page1);
+ m_locationPageRoot = createTree(clientBundle);
+ m_page2 = new BundleTreeWizardPage(Texts.get("SearchFormClassLocations"), Texts.get("OrganiseLocations"), m_locationPageRoot, new P_InitialCheckedFilter());
+ m_page2.addStatusProvider(statusProvider);
+ m_page2.addDndListener(new P_TreeDndListener());
+ addPage(m_page2);
+ // init
+ m_page1.addPropertyChangeListener(new P_LocationPropertyListener());
+ }
+
+ public void setTablePage(IType tablePage) {
+ if (tablePage != null) {
+ m_page1.setTablePageType(tablePage);
+ }
+ }
+
+ public void setNlsEntry(INlsEntry nlsEntry) {
+ if (nlsEntry != null) {
+ m_page1.setNlsName(nlsEntry);
+ m_page1.setTypeName(nlsEntry.getKey() + SdkProperties.SUFFIX_SEARCH_FORM);
+ }
+ else {
+ m_page1.setNlsName(null);
+ }
+ }
+
+ private ITreeNode createTree(IScoutBundle clientBundle) {
+ IScoutBundle sharedBundle = null;
+ IScoutProject scoutProject = clientBundle.getScoutProject();
+ while (sharedBundle == null && scoutProject != null) {
+ sharedBundle = scoutProject.getSharedBundle();
+ scoutProject = scoutProject.getParentProject();
+ }
+ ITreeNode rootNode = TreeUtility.createBundleTree(clientBundle.getScoutProject(), NodeFilters.getAcceptAll());
+
+ ITreeNode clientNode = TreeUtility.findNode(rootNode, NodeFilters.getByData(clientBundle));
+ // form
+ ITreeNode formNode = TreeUtility.createNode(clientNode, TYPE_SEARCH_FORM, Texts.get("SearchForm"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class), TYPE_SEARCH_FORM);
+ // searchHandler
+ TreeUtility.createNode(formNode, TYPE_HANDLER_SEARCH, Texts.get("SearchHandler"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class), TYPE_HANDLER_SEARCH);
+
+ if (sharedBundle != null) {
+ ITreeNode sharedNode = TreeUtility.findNode(rootNode, NodeFilters.getByData(sharedBundle));
+ // formData
+ TreeUtility.createNode(sharedNode, TYPE_SEARCH_FORM_DATA, Texts.get("SearchFormData"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class), TYPE_SEARCH_FORM_DATA);
+ }
+ return rootNode;
+ }
+
+ @Override
+ protected boolean beforeFinish() throws CoreException {
+ // fill operation before gui is disposed
+ m_operation.setTypeName(m_page1.getTypeName());
+ m_operation.setNlsEntry(m_page1.getNlsName());
+ IType superTypeProp = m_page1.getSuperType();
+ if (superTypeProp != null) {
+ m_operation.setSuperTypeSignature(Signature.createTypeSignature(superTypeProp.getFullyQualifiedName(), true));
+ }
+ m_operation.setTablePage(m_page1.getTablePageType());
+ m_operation.setCreateSearchHandler(m_page2.getTreeNode(TYPE_HANDLER_SEARCH, true, true) != null);
+ m_operation.setSearchFormLocationBundle(m_page2.getLocationBundle(TYPE_SEARCH_FORM, true, true));
+ m_operation.setSearchFormDataLocationBundle(m_page2.getLocationBundle(TYPE_SEARCH_FORM_DATA, true, true));
+ return true;
+ }
+
+ @Override
+ protected boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) {
+ try {
+ m_operation.run(monitor, workingCopyManager);
+ return true;
+ }
+ catch (Exception e) {
+ ScoutSdkUi.logError("exception during perfoming finish of wizard.", e);
+ return false;
+ }
+ }
+
+ public IScoutBundle getClientBundle() {
+ return m_clientBundle;
+ }
+
+ private class P_LocationPropertyListener implements PropertyChangeListener {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ if (evt.getPropertyName().equals(ServiceNewWizardPage.PROP_TYPE_NAME)) {
+ String typeName = m_page1.getTypeName();
+ if (!StringUtility.isNullOrEmpty(typeName)) {
+ String prefix = typeName.replaceAll(SdkProperties.SUFFIX_SEARCH_FORM + "$", "");
+ TreeUtility.findNode(m_locationPageRoot, NodeFilters.getByType(TYPE_SEARCH_FORM)).setText(prefix + SdkProperties.SUFFIX_SEARCH_FORM);
+ TreeUtility.findNode(m_locationPageRoot, NodeFilters.getByType(TYPE_SEARCH_FORM_DATA)).setText(prefix + SdkProperties.SUFFIX_SEARCH_FORM_DATA);
+ m_page2.refreshTree();
+ }
+ m_page2.pingStateChanging();
+ }
+ }
+ } // end class P_LocationPropertyListener
+
+ private class P_InitialCheckedFilter implements ITreeNodeFilter {
+ @Override
+ public boolean accept(ITreeNode node) {
+ switch (node.getType()) {
+ case TYPE_HANDLER_SEARCH:
+ case TYPE_SEARCH_FORM:
+ case TYPE_SEARCH_FORM_DATA:
+ return true;
+ default:
+ return false;
+ }
+ }
+ } // end class P_InitialCheckedFilter
+
+ private class P_TreeDndListener implements ITreeDndListener {
+ @Override
+ public boolean isDragableNode(ITreeNode node) {
+ switch (node.getType()) {
+ case TYPE_SEARCH_FORM:
+ return true;
+
+ default:
+ return false;
+ }
+ }
+
+ @Override
+ public void validateTarget(DndEvent dndEvent) {
+ if (dndEvent.targetParent == null) {
+ dndEvent.doit = false;
+ return;
+ }
+ if (dndEvent.operation == DND.DROP_COPY) {
+ validateDropCopy(dndEvent);
+ }
+ else if (dndEvent.operation == DND.DROP_MOVE) {
+ validateDropMove(dndEvent);
+ }
+ }
+
+ @Override
+ public void dndPerformed(DndEvent dndEvent) {
+ if (dndEvent.node.getType() == TYPE_SEARCH_FORM) {
+ ITreeNode formDataNode = TreeUtility.findNode(m_locationPageRoot, NodeFilters.getByType(TYPE_SEARCH_FORM_DATA));
+ if (formDataNode != null) {
+
+ ITreeNode oldFomDataParent = formDataNode.getParent();
+ IScoutBundle formBundle = (IScoutBundle) dndEvent.node.getParent().getData();
+ IScoutBundle[] sharedBundles = formBundle.getRequiredBundles(ScoutBundleFilters.getSharedFilter(), false);
+ for (IScoutBundle formDataBundle : sharedBundles) {
+ ITreeNode sharedNode = TreeUtility.findNode(m_locationPageRoot, NodeFilters.getByData(formDataBundle));
+ if (sharedNode != null) {
+ if (!oldFomDataParent.equals(sharedNode)) {
+ // move
+ oldFomDataParent.removeChild(formDataNode);
+ formDataNode.setParent(sharedNode);
+ sharedNode.addChild(formDataNode);
+ }
+ break;
+ }
+ }
+ }
+ }
+ m_page1.pingStateChanging();
+ }
+
+ private void validateDropCopy(DndEvent dndEvent) {
+ dndEvent.doit = false;
+ }
+
+ private void validateDropMove(DndEvent dndEvent) {
+ switch (dndEvent.node.getType()) {
+ case TYPE_SEARCH_FORM:
+ dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_CLIENT;
+ break;
+ default:
+ dndEvent.doit = false;
+ break;
+ }
+
+ }
+ } // end class P_TreeDndListener
+
+ private class P_StatusRevalidator implements IStatusProvider {
+
+ @Override
+ public void validate(Object source, MultiStatus multiStatus) {
+ multiStatus.add(getStatusSearchForm(source));
+ multiStatus.add(getStatusTypeNames(source));
+ }
+
+ protected IStatus getStatusTypeNames(Object source) {
+ IScoutBundle searchFormBundle = m_page2.getLocationBundle(TYPE_SEARCH_FORM, true, true);
+ if (searchFormBundle != null) {
+ ITreeNode searchFormNode = m_page2.getTreeNode(TYPE_SEARCH_FORM, true, true);
+ if (searchFormNode != null) {
+ String fqn = searchFormBundle.getPackageName(IScoutBundle.CLIENT_PACKAGE_APPENDIX_UI_SEARCHFORMS) + "." + searchFormNode.getText();
+ if (searchFormBundle.findType(fqn) != null) {
+ return new Status((source instanceof SearchFormNewWizardPage) ? (IStatus.ERROR) : (IStatus.WARNING),
+ ScoutSdkUi.PLUGIN_ID, "'" + searchFormNode.getText() + "' " + Texts.get("AlreadyExists") + ".");
+ }
+ }
+ }
+
+ IScoutBundle formDataBundle = m_page2.getLocationBundle(TYPE_SEARCH_FORM_DATA, true, true);
+ if (formDataBundle != null) {
+ ITreeNode formDataNode = m_page2.getTreeNode(TYPE_SEARCH_FORM_DATA, true, true);
+ if (formDataNode != null) {
+ String fqn = formDataBundle.getPackageName(IScoutBundle.SHARED_PACKAGE_APPENDIX_SERVICES_PROCESS) + "." + formDataNode.getText();
+ if (formDataBundle.findType(fqn) != null) {
+ return new Status((source instanceof SearchFormNewWizardPage) ? (IStatus.WARNING) : (IStatus.ERROR),
+ ScoutSdkUi.PLUGIN_ID, "'" + formDataNode.getText() + "' " + Texts.get("AlreadyExists") + ".");
+ }
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+ protected IStatus getStatusSearchForm(Object source) {
+ IScoutBundle formBundle = m_page2.getLocationBundle(TYPE_SEARCH_FORM, true, true);
+ if (formBundle != null) {
+ IScoutBundle formDataBundle = m_page2.getLocationBundle(TYPE_SEARCH_FORM_DATA, true, true);
+ if (formDataBundle != null) {
+ if (!formBundle.isOnClasspath(formDataBundle)) {
+ return new Status((source instanceof SearchFormNewWizardPage) ? (IStatus.WARNING) : (IStatus.ERROR),
+ ScoutSdkUi.PLUGIN_ID, Texts.get("XIsNotAClasspathOfY", m_page2.getTextOfNode(TYPE_SEARCH_FORM_DATA), m_page2.getTextOfNode(TYPE_SEARCH_FORM)));
+ }
+ }
+
+ }
+ return Status.OK_STATUS;
+ }
+
+ } // end class P_StatusRevalidator
+
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/SearchFormNewWizardPage.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/SearchFormNewWizardPage.java
index 60f171280..9c1bb01e5 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/SearchFormNewWizardPage.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/SearchFormNewWizardPage.java
@@ -1,325 +1,325 @@
-/*******************************************************************************
- * 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;
-
-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.jdt.core.Signature;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.nls.sdk.internal.ui.action.NlsProposal;
-import org.eclipse.scout.nls.sdk.model.INlsEntry;
-import org.eclipse.scout.sdk.RuntimeClasses;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.operation.form.FormStackNewOperation;
-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.javaelement.AbstractJavaElementContentProvider;
-import org.eclipse.scout.sdk.ui.fields.proposal.javaelement.JavaElementAbstractTypeContentProvider;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
-import org.eclipse.scout.sdk.util.Regex;
-import org.eclipse.scout.sdk.util.SdkProperties;
-import org.eclipse.scout.sdk.util.type.TypeComparators;
-import org.eclipse.scout.sdk.util.type.TypeFilters;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.swt.SWT;
-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;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-
-/**
- * <h3>SearchFormNewWizardPage</h3> ...
- */
-public class SearchFormNewWizardPage extends AbstractWorkspaceWizardPage {
-
- /** {@link NlsProposal} **/
- public static final String PROP_NLS_NAME = "nlsName";
- /** {@link String} **/
- public static final String PROP_TYPE_NAME = "typeName";
- /** {@link IType} **/
- public static final String PROP_SUPER_TYPE = "superType";
- /** {@link IType} **/
- public static final String PROP_TABLE_PAGE = "tablePage";
-
- final IType iForm = TypeUtility.getType(RuntimeClasses.IForm);
- final IType iSearchForm = TypeUtility.getType(RuntimeClasses.ISearchForm);
- final IType abstractSearchForm = TypeUtility.getType(RuntimeClasses.AbstractSearchForm);
- final IType iPage = TypeUtility.getType(RuntimeClasses.IPage);
- final IType iPageWithTable = TypeUtility.getType(RuntimeClasses.IPageWithTable);
- // ui fields
- private ProposalTextField m_nlsNameField;
- private StyledTextField m_typeNameField;
- private ProposalTextField m_superTypeField;
- private ProposalTextField m_tablePageField;
-
- // process members
- private final IScoutBundle m_clientBundle;
-
- public SearchFormNewWizardPage(IScoutBundle clientBundle) {
- super(SearchFormNewWizardPage.class.getName());
- m_clientBundle = clientBundle;
- setTitle(Texts.get("SearchForm2"));
- setDescription(Texts.get("CreateANewSearchForm"));
- setSuperTypeInternal(abstractSearchForm);
- }
-
- @Override
- protected void createContent(Composite parent) {
- Control tablePageGroup = createTablePageGroup(parent);
- m_nlsNameField = getFieldToolkit().createNlsProposalTextField(parent, getClientBundle().findBestMatchNlsProject(), Texts.get("Name"));
- m_nlsNameField.acceptProposal(getNlsName());
- m_nlsNameField.addProposalAdapterListener(new IProposalAdapterListener() {
- @Override
- public void proposalAccepted(ContentProposalEvent event) {
- try {
- setStateChanging(true);
- INlsEntry oldEntry = getNlsName();
- INlsEntry newName = (INlsEntry) event.proposal;
- setNlsNameInternal(newName);
- if (newName != null) {
- if (oldEntry == null || StringUtility.isNullOrEmpty(m_typeNameField.getModifiableText()) || oldEntry.getKey().equals(m_typeNameField.getModifiableText())) {
- m_typeNameField.setText(newName.getKey());
- }
-
- }
- }
- finally {
- setStateChanging(false);
- }
- }
- });
-
- m_typeNameField = getFieldToolkit().createStyledTextField(parent, Texts.get("TypeName"));
- m_typeNameField.setReadOnlySuffix(SdkProperties.SUFFIX_SEARCH_FORM);
- m_typeNameField.setText(getTypeName());
- m_typeNameField.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- setTypeNameInternal(m_typeNameField.getText());
- pingStateChanging();
- }
- });
-
- m_superTypeField = getFieldToolkit().createJavaElementProposalField(parent, Texts.get("SuperType"),
- new JavaElementAbstractTypeContentProvider(iSearchForm, getClientBundle().getJavaProject(), abstractSearchForm));
- m_superTypeField.acceptProposal(getSuperType());
- m_superTypeField.addProposalAdapterListener(new IProposalAdapterListener() {
- @Override
- public void proposalAccepted(ContentProposalEvent event) {
- setSuperTypeInternal((IType) event.proposal);
- pingStateChanging();
- }
- });
-
- // layout
- parent.setLayout(new GridLayout(1, true));
-
- tablePageGroup.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- m_nlsNameField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- m_typeNameField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- m_superTypeField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- }
-
- private Control createTablePageGroup(Composite parent) {
- Group group = new Group(parent, SWT.SHADOW_ETCHED_IN);
- group.setText(Texts.get("AutoCreate"));
- Label label = new Label(group, SWT.NONE);
- label.setText(Texts.get("SelectTablePageForSearchForm"));
- m_tablePageField = getFieldToolkit().createJavaElementProposalField(parent, Texts.get("TablePage"), new AbstractJavaElementContentProvider() {
- @Override
- protected Object[][] computeProposals() {
- IType[] list = TypeUtility.getPrimaryTypeHierarchy(iPage).getAllSubtypes(iPageWithTable, TypeFilters.getTypesOnClasspath(getClientBundle().getJavaProject()), TypeComparators.getTypeNameComparator());
- return new Object[][]{list};
- }
- });
- m_tablePageField.acceptProposal(getTablePageType());
- m_tablePageField.addProposalAdapterListener(new IProposalAdapterListener() {
- @Override
- public void proposalAccepted(ContentProposalEvent event) {
- setTablePageTypeInternal((IType) event.proposal);
- pingStateChanging();
- }
- });
-
- // layout
- group.setLayout(new GridLayout(1, true));
-
- label.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- m_tablePageField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- return group;
- }
-
- @Override
- public void setFocus() {
- if (m_tablePageField.getSelectedProposal() == null) {
- m_tablePageField.setFocus();
- }
- else {
- m_nlsNameField.setFocus();
- }
- }
-
- void fillOperation(FormStackNewOperation operation) {
- // operation.setCreateIdProperty(isCreateFormId());
- // operation.setFormIdName(getFormId());
- operation.setFormName(getTypeName());
- if (getNlsName() != null) {
- operation.setNlsEntry(getNlsName());
- }
- IType superTypeProp = getSuperType();
- if (superTypeProp != null) {
- operation.setFormSuperTypeSignature(Signature.createTypeSignature(superTypeProp.getFullyQualifiedName(), true));
- }
- }
-
- @Override
- public SearchFormNewWizard getWizard() {
- return (SearchFormNewWizard) super.getWizard();
- }
-
- @Override
- protected void validatePage(MultiStatus multiStatus) {
- try {
- multiStatus.add(getStatusNameField());
- multiStatus.add(getStatusSuperType());
- }
- catch (JavaModelException e) {
- ScoutSdkUi.logError("could not validate name field.", e);
- }
- }
-
- protected IStatus getStatusNameField() throws JavaModelException {
- if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_SEARCH_FORM)) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
- }
- // check not allowed names
- if (TypeUtility.existsType(getClientBundle().getPackageName(IScoutBundle.CLIENT_PACKAGE_APPENDIX_UI_SEARCHFORMS) + "." + getTypeName())) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
- }
-
- if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
- return Status.OK_STATUS;
- }
- else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
- return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
- }
- else {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
- }
- }
-
- protected IStatus getStatusSuperType() throws JavaModelException {
- if (getSuperType() == null) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("TheSuperTypeCanNotBeNull"));
- }
- return Status.OK_STATUS;
- }
-
- public IScoutBundle getClientBundle() {
- return m_clientBundle;
- }
-
- public INlsEntry getNlsName() {
- return (INlsEntry) getProperty(PROP_NLS_NAME);
- }
-
- public void setNlsName(INlsEntry proposal) {
- try {
- setStateChanging(true);
- setNlsNameInternal(proposal);
- if (isControlCreated()) {
- m_nlsNameField.acceptProposal(proposal);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setNlsNameInternal(INlsEntry proposal) {
- setProperty(PROP_NLS_NAME, proposal);
- }
-
- public String getTypeName() {
- return getPropertyString(PROP_TYPE_NAME);
- }
-
- public void setTypeName(String typeName) {
- try {
- setStateChanging(true);
- setTypeNameInternal(typeName);
- if (isControlCreated()) {
- m_typeNameField.setText(typeName);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setTypeNameInternal(String typeName) {
- setPropertyString(PROP_TYPE_NAME, typeName);
- }
-
- public IType getSuperType() {
- return (IType) getProperty(PROP_SUPER_TYPE);
- }
-
- public void setSuperType(IType superType) {
- try {
- setStateChanging(true);
- setSuperTypeInternal(superType);
- if (isControlCreated()) {
- m_superTypeField.acceptProposal(superType);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setSuperTypeInternal(IType superType) {
- setProperty(PROP_SUPER_TYPE, superType);
- }
-
- public IType getTablePageType() {
- return (IType) getProperty(PROP_TABLE_PAGE);
- }
-
- public void setTablePageType(IType superType) {
- try {
- setStateChanging(true);
- setTablePageTypeInternal(superType);
- if (isControlCreated()) {
- m_tablePageField.acceptProposal(superType);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setTablePageTypeInternal(IType superType) {
- setProperty(PROP_TABLE_PAGE, superType);
- }
-
-}
+/*******************************************************************************
+ * 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;
+
+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.jdt.core.Signature;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.nls.sdk.internal.ui.action.NlsProposal;
+import org.eclipse.scout.nls.sdk.model.INlsEntry;
+import org.eclipse.scout.sdk.RuntimeClasses;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.operation.form.FormStackNewOperation;
+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.javaelement.AbstractJavaElementContentProvider;
+import org.eclipse.scout.sdk.ui.fields.proposal.javaelement.JavaElementAbstractTypeContentProvider;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
+import org.eclipse.scout.sdk.util.Regex;
+import org.eclipse.scout.sdk.util.SdkProperties;
+import org.eclipse.scout.sdk.util.type.TypeComparators;
+import org.eclipse.scout.sdk.util.type.TypeFilters;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.swt.SWT;
+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;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+
+/**
+ * <h3>SearchFormNewWizardPage</h3> ...
+ */
+public class SearchFormNewWizardPage extends AbstractWorkspaceWizardPage {
+
+ /** {@link NlsProposal} **/
+ public static final String PROP_NLS_NAME = "nlsName";
+ /** {@link String} **/
+ public static final String PROP_TYPE_NAME = "typeName";
+ /** {@link IType} **/
+ public static final String PROP_SUPER_TYPE = "superType";
+ /** {@link IType} **/
+ public static final String PROP_TABLE_PAGE = "tablePage";
+
+ final IType iForm = TypeUtility.getType(RuntimeClasses.IForm);
+ final IType iSearchForm = TypeUtility.getType(RuntimeClasses.ISearchForm);
+ final IType abstractSearchForm = TypeUtility.getType(RuntimeClasses.AbstractSearchForm);
+ final IType iPage = TypeUtility.getType(RuntimeClasses.IPage);
+ final IType iPageWithTable = TypeUtility.getType(RuntimeClasses.IPageWithTable);
+ // ui fields
+ private ProposalTextField m_nlsNameField;
+ private StyledTextField m_typeNameField;
+ private ProposalTextField m_superTypeField;
+ private ProposalTextField m_tablePageField;
+
+ // process members
+ private final IScoutBundle m_clientBundle;
+
+ public SearchFormNewWizardPage(IScoutBundle clientBundle) {
+ super(SearchFormNewWizardPage.class.getName());
+ m_clientBundle = clientBundle;
+ setTitle(Texts.get("SearchForm2"));
+ setDescription(Texts.get("CreateANewSearchForm"));
+ setSuperTypeInternal(abstractSearchForm);
+ }
+
+ @Override
+ protected void createContent(Composite parent) {
+ Control tablePageGroup = createTablePageGroup(parent);
+ m_nlsNameField = getFieldToolkit().createNlsProposalTextField(parent, getClientBundle().findBestMatchNlsProject(), Texts.get("Name"));
+ m_nlsNameField.acceptProposal(getNlsName());
+ m_nlsNameField.addProposalAdapterListener(new IProposalAdapterListener() {
+ @Override
+ public void proposalAccepted(ContentProposalEvent event) {
+ try {
+ setStateChanging(true);
+ INlsEntry oldEntry = getNlsName();
+ INlsEntry newName = (INlsEntry) event.proposal;
+ setNlsNameInternal(newName);
+ if (newName != null) {
+ if (oldEntry == null || StringUtility.isNullOrEmpty(m_typeNameField.getModifiableText()) || oldEntry.getKey().equals(m_typeNameField.getModifiableText())) {
+ m_typeNameField.setText(newName.getKey());
+ }
+
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+ });
+
+ m_typeNameField = getFieldToolkit().createStyledTextField(parent, Texts.get("TypeName"));
+ m_typeNameField.setReadOnlySuffix(SdkProperties.SUFFIX_SEARCH_FORM);
+ m_typeNameField.setText(getTypeName());
+ m_typeNameField.addModifyListener(new ModifyListener() {
+ @Override
+ public void modifyText(ModifyEvent e) {
+ setTypeNameInternal(m_typeNameField.getText());
+ pingStateChanging();
+ }
+ });
+
+ m_superTypeField = getFieldToolkit().createJavaElementProposalField(parent, Texts.get("SuperType"),
+ new JavaElementAbstractTypeContentProvider(iSearchForm, getClientBundle().getJavaProject(), abstractSearchForm));
+ m_superTypeField.acceptProposal(getSuperType());
+ m_superTypeField.addProposalAdapterListener(new IProposalAdapterListener() {
+ @Override
+ public void proposalAccepted(ContentProposalEvent event) {
+ setSuperTypeInternal((IType) event.proposal);
+ pingStateChanging();
+ }
+ });
+
+ // layout
+ parent.setLayout(new GridLayout(1, true));
+
+ tablePageGroup.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ m_nlsNameField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ m_typeNameField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ m_superTypeField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ }
+
+ private Control createTablePageGroup(Composite parent) {
+ Group group = new Group(parent, SWT.SHADOW_ETCHED_IN);
+ group.setText(Texts.get("AutoCreate"));
+ Label label = new Label(group, SWT.NONE);
+ label.setText(Texts.get("SelectTablePageForSearchForm"));
+ m_tablePageField = getFieldToolkit().createJavaElementProposalField(parent, Texts.get("TablePage"), new AbstractJavaElementContentProvider() {
+ @Override
+ protected Object[][] computeProposals() {
+ IType[] list = TypeUtility.getPrimaryTypeHierarchy(iPage).getAllSubtypes(iPageWithTable, TypeFilters.getTypesOnClasspath(getClientBundle().getJavaProject()), TypeComparators.getTypeNameComparator());
+ return new Object[][]{list};
+ }
+ });
+ m_tablePageField.acceptProposal(getTablePageType());
+ m_tablePageField.addProposalAdapterListener(new IProposalAdapterListener() {
+ @Override
+ public void proposalAccepted(ContentProposalEvent event) {
+ setTablePageTypeInternal((IType) event.proposal);
+ pingStateChanging();
+ }
+ });
+
+ // layout
+ group.setLayout(new GridLayout(1, true));
+
+ label.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ m_tablePageField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ return group;
+ }
+
+ @Override
+ public void setFocus() {
+ if (m_tablePageField.getSelectedProposal() == null) {
+ m_tablePageField.setFocus();
+ }
+ else {
+ m_nlsNameField.setFocus();
+ }
+ }
+
+ void fillOperation(FormStackNewOperation operation) {
+ // operation.setCreateIdProperty(isCreateFormId());
+ // operation.setFormIdName(getFormId());
+ operation.setFormName(getTypeName());
+ if (getNlsName() != null) {
+ operation.setNlsEntry(getNlsName());
+ }
+ IType superTypeProp = getSuperType();
+ if (superTypeProp != null) {
+ operation.setFormSuperTypeSignature(Signature.createTypeSignature(superTypeProp.getFullyQualifiedName(), true));
+ }
+ }
+
+ @Override
+ public SearchFormNewWizard getWizard() {
+ return (SearchFormNewWizard) super.getWizard();
+ }
+
+ @Override
+ protected void validatePage(MultiStatus multiStatus) {
+ try {
+ multiStatus.add(getStatusNameField());
+ multiStatus.add(getStatusSuperType());
+ }
+ catch (JavaModelException e) {
+ ScoutSdkUi.logError("could not validate name field.", e);
+ }
+ }
+
+ protected IStatus getStatusNameField() throws JavaModelException {
+ if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_SEARCH_FORM)) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
+ }
+ // check not allowed names
+ if (TypeUtility.existsType(getClientBundle().getPackageName(IScoutBundle.CLIENT_PACKAGE_APPENDIX_UI_SEARCHFORMS) + "." + getTypeName())) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
+ }
+
+ if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return Status.OK_STATUS;
+ }
+ else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
+ }
+ else {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
+ }
+ }
+
+ protected IStatus getStatusSuperType() throws JavaModelException {
+ if (getSuperType() == null) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("TheSuperTypeCanNotBeNull"));
+ }
+ return Status.OK_STATUS;
+ }
+
+ public IScoutBundle getClientBundle() {
+ return m_clientBundle;
+ }
+
+ public INlsEntry getNlsName() {
+ return (INlsEntry) getProperty(PROP_NLS_NAME);
+ }
+
+ public void setNlsName(INlsEntry proposal) {
+ try {
+ setStateChanging(true);
+ setNlsNameInternal(proposal);
+ if (isControlCreated()) {
+ m_nlsNameField.acceptProposal(proposal);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setNlsNameInternal(INlsEntry proposal) {
+ setProperty(PROP_NLS_NAME, proposal);
+ }
+
+ public String getTypeName() {
+ return getPropertyString(PROP_TYPE_NAME);
+ }
+
+ public void setTypeName(String typeName) {
+ try {
+ setStateChanging(true);
+ setTypeNameInternal(typeName);
+ if (isControlCreated()) {
+ m_typeNameField.setText(typeName);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setTypeNameInternal(String typeName) {
+ setPropertyString(PROP_TYPE_NAME, typeName);
+ }
+
+ public IType getSuperType() {
+ return (IType) getProperty(PROP_SUPER_TYPE);
+ }
+
+ public void setSuperType(IType superType) {
+ try {
+ setStateChanging(true);
+ setSuperTypeInternal(superType);
+ if (isControlCreated()) {
+ m_superTypeField.acceptProposal(superType);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setSuperTypeInternal(IType superType) {
+ setProperty(PROP_SUPER_TYPE, superType);
+ }
+
+ public IType getTablePageType() {
+ return (IType) getProperty(PROP_TABLE_PAGE);
+ }
+
+ public void setTablePageType(IType superType) {
+ try {
+ setStateChanging(true);
+ setTablePageTypeInternal(superType);
+ if (isControlCreated()) {
+ m_tablePageField.acceptProposal(superType);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setTablePageTypeInternal(IType superType) {
+ setProperty(PROP_TABLE_PAGE, superType);
+ }
+
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/EmptyTemplate.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/EmptyTemplate.java
index 3d100a771..c2f1d90c4 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/EmptyTemplate.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/EmptyTemplate.java
@@ -1,31 +1,31 @@
-/*******************************************************************************
- * 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;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.operation.template.IContentTemplate;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-
-public class EmptyTemplate implements IContentTemplate {
-
- @Override
- public void apply(IType type, IWorkingCopyManager manager, IProgressMonitor monitor) throws CoreException {
- // void
- }
-
- @Override
- public String getName() {
- return Texts.get("None");
- }
-}
+/*******************************************************************************
+ * 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;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.operation.template.IContentTemplate;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+
+public class EmptyTemplate implements IContentTemplate {
+
+ @Override
+ public void apply(IType type, IWorkingCopyManager manager, IProgressMonitor monitor) throws CoreException {
+ // void
+ }
+
+ @Override
+ public String getName() {
+ return Texts.get("None");
+ }
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/FormFieldNewWizard.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/FormFieldNewWizard.java
index 69e58a901..e8f3984e2 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/FormFieldNewWizard.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/FormFieldNewWizard.java
@@ -1,45 +1,45 @@
-/*******************************************************************************
- * 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;
-
-import org.eclipse.jdt.core.IType;
-import org.eclipse.scout.sdk.ui.extensions.AbstractFormFieldWizard;
-
-public class FormFieldNewWizard extends AbstractFormFieldWizard {
-
- public FormFieldNewWizard(IType declaringType) {
- super();
- initWizard(declaringType);
- }
-
- @Override
- public void initWizard(IType declaringType) {
- super.initWizard(declaringType);
- addPage(new FormFieldSelectionWizardPage(declaringType));
- }
-
- @Override
- public boolean needsPreviousAndNextButtons() {
- return true;
- }
-
- @Override
- public boolean canFinish() {
- return false;
-
- }
-
- @Override
- public void setSuperType(IType superType) {
- // void
- }
-
-}
+/*******************************************************************************
+ * 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;
+
+import org.eclipse.jdt.core.IType;
+import org.eclipse.scout.sdk.ui.extensions.AbstractFormFieldWizard;
+
+public class FormFieldNewWizard extends AbstractFormFieldWizard {
+
+ public FormFieldNewWizard(IType declaringType) {
+ super();
+ initWizard(declaringType);
+ }
+
+ @Override
+ public void initWizard(IType declaringType) {
+ super.initWizard(declaringType);
+ addPage(new FormFieldSelectionWizardPage(declaringType));
+ }
+
+ @Override
+ public boolean needsPreviousAndNextButtons() {
+ return true;
+ }
+
+ @Override
+ public boolean canFinish() {
+ return false;
+
+ }
+
+ @Override
+ public void setSuperType(IType superType) {
+ // void
+ }
+
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/FormFieldSelectionWizardPage.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/FormFieldSelectionWizardPage.java
index 0d8f5cc03..0d2f9a1f0 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/FormFieldSelectionWizardPage.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/FormFieldSelectionWizardPage.java
@@ -1,293 +1,293 @@
-/*******************************************************************************
- * 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;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-
-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.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerSorter;
-import org.eclipse.jface.wizard.IWizardContainer;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.scout.commons.CompositeObject;
-import org.eclipse.scout.sdk.RuntimeClasses;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.ui.extensions.AbstractFormFieldWizard;
-import org.eclipse.scout.sdk.ui.extensions.IFormFieldExtension;
-import org.eclipse.scout.sdk.ui.fields.table.FilteredTable;
-import org.eclipse.scout.sdk.ui.fields.table.ISeparator;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.internal.extensions.FormFieldExtensionPoint;
-import org.eclipse.scout.sdk.ui.wizard.AbstractScoutWizardPage;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
-import org.eclipse.scout.sdk.util.type.TypeFilters;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.util.typecache.IPrimaryTypeTypeHierarchy;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * <h3>FormFieldSelectionWizardPage</h3> ...
- *
- * @author Andreas Hoegger
- * @since 1.0.8 02.03.2010
- */
-public class FormFieldSelectionWizardPage extends AbstractWorkspaceWizardPage {
-
- private IType iFormField = TypeUtility.getType(RuntimeClasses.IFormField);
-
- private final IType m_declaringType;
- private AbstractScoutWizardPage m_nextPage;
- private Object m_currentSelection;
- private HashSet<IType> m_modelTypeShortList;
-
- // ui fields
- private FilteredTable m_table;
-
- /**
- * @param pageName
- */
- public FormFieldSelectionWizardPage(IType declaringType) {
- super(FormFieldSelectionWizardPage.class.getName());
- m_declaringType = declaringType;
- setTitle(Texts.get("FormField"));
- setDescription(Texts.get("FormFieldDesc"));
-
- }
-
- @Override
- protected void createContent(Composite parent) {
- m_modelTypeShortList = new HashSet<IType>();
- ArrayList<Object> elements = new ArrayList<Object>();
- elements.add(new ISeparator() {
- });
- // entries
- IPrimaryTypeTypeHierarchy formFieldHierarchy = TypeUtility.getPrimaryTypeHierarchy(iFormField);
- IType[] abstractFormFields = formFieldHierarchy.getAllSubtypes(iFormField, TypeFilters.getAbstractOnClasspath(m_declaringType.getJavaProject()));
- for (IType formField : abstractFormFields) {
- IFormFieldExtension formFieldExtension = FormFieldExtensionPoint.findExtension(formField, 1);
- if (formFieldExtension != null && formFieldExtension.isInShortList()) {
- m_modelTypeShortList.add(formField);
- }
- elements.add(formField);
- }
- // ui
- m_table = new FilteredTable(parent, SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION | SWT.V_SCROLL);
- m_table.getViewer().addSelectionChangedListener(new ISelectionChangedListener() {
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- if (m_currentSelection != null) {
- m_table.getViewer().update(m_currentSelection, new String[]{"label"});
- }
- m_currentSelection = null;
- if (!event.getSelection().isEmpty()) {
- m_currentSelection = ((StructuredSelection) event.getSelection()).getFirstElement();
- }
- if (m_currentSelection != null) {
- m_table.getViewer().update(m_currentSelection, new String[]{"label"});
- }
- handleSelection(m_currentSelection);
- }
- });
-
- m_table.getViewer().addDoubleClickListener(new IDoubleClickListener() {
- @Override
- public void doubleClick(DoubleClickEvent event) {
- Object selectedItem = null;
- if (!event.getSelection().isEmpty()) {
- StructuredSelection selection = (StructuredSelection) event.getSelection();
- selectedItem = selection.getFirstElement();
- }
- handleSelection(selectedItem);
- IWizardPage page = getNextPage();
- if (page == null) {
- // something must have happend getting the next page
- return;
- }
-
- // show the next page
- IWizardContainer container = getWizard().getContainer();
- if (container != null) {
- container.showPage(page);
- }
- }
- });
- P_ContentProvider provider = new P_ContentProvider(elements.toArray());
- m_table.getViewer().setLabelProvider(provider);
- m_table.getViewer().setContentProvider(provider);
- m_table.getViewer().setInput(provider);
- m_table.getViewer().setSorter(new P_TableSorter());
-
- // layout
- parent.setLayout(new GridLayout(1, true));
- GridData tableData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_BOTH | GridData.GRAB_VERTICAL);
- tableData.heightHint = 150;
- m_table.setLayoutData(tableData);
- }
-
- private void handleSelection(Object selectedItem) {
-
- AbstractFormFieldWizard wizard = null;
- if (selectedItem instanceof IType) {
- IType formField = (IType) selectedItem;
- wizard = (AbstractFormFieldWizard) FormFieldExtensionPoint.createNewWizard(formField);
- wizard.initWizard(m_declaringType);
- wizard.setSuperType(formField);
- }
- if (wizard != null) {
- m_nextPage = (AbstractScoutWizardPage) wizard.getPages()[0];
- }
- else {
- m_nextPage = null;
- }
- revalidate();
- }
-
- @Override
- protected void validatePage(MultiStatus multiStatus) {
- multiStatus.add(getStatusFieldList());
- }
-
- private IStatus getStatusFieldList() {
- if (m_nextPage == null) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("NoFieldSelected"));
- }
- return Status.OK_STATUS;
- }
-
- @Override
- public IWizardPage getNextPage() {
- return m_nextPage;
- }
-
- private class P_ContentProvider implements IStructuredContentProvider, ITableLabelProvider {
-
- private Object[] m_elements;
-
- public P_ContentProvider(Object[] elements) {
- m_elements = elements;
- }
-
- @Override
- public Object[] getElements(Object inputElement) {
- return m_elements;
- }
-
- @Override
- public Image getColumnImage(Object element, int columnIndex) {
- if (columnIndex == 0) {
- if (element instanceof ISeparator) {
- return ScoutSdkUi.getImage(ScoutSdkUi.Separator);
- }
- return ScoutSdkUi.getImage(ScoutSdkUi.FormField);
- }
- return null;
- }
-
- @Override
- public String getColumnText(Object element, int columnIndex) {
- if (columnIndex == 0) {
- StringBuilder label = new StringBuilder();
- if (element instanceof ISeparator) {
- return "------------------ more fields ------------------";
- }
- StructuredSelection selection = (StructuredSelection) m_table.getViewer().getSelection();
-
- IType t = (IType) element;
- String typeName = t.getElementName();
- if (typeName.toLowerCase().startsWith("abstract")) {
- typeName = typeName.substring("abstract".length());
- }
- label.append(typeName);
- if (selection.toList().contains(element)) {
- label.append(" - ").append(t.getFullyQualifiedName());
- }
- return label.toString();
- }
- return null;
- }
-
- @Override
- public void dispose() {
- }
-
- @Override
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
-
- @Override
- public void addListener(ILabelProviderListener listener) {
-
- }
-
- @Override
- public boolean isLabelProperty(Object element, String property) {
- return "label".equals(property);
- }
-
- @Override
- public void removeListener(ILabelProviderListener listener) {
- }
- } // end class P_ByClassProvider
-
- private class P_TableSorter extends ViewerSorter {
-
- @Override
- public int compare(Viewer viewer, Object e1, Object e2) {
-
- CompositeObject comp1;
- if (e1 instanceof ISeparator) {
- comp1 = new CompositeObject(2);
- }
- else {
- IType modelType = (IType) e1;
- if (m_modelTypeShortList.contains(modelType)) {
- comp1 = new CompositeObject(1, modelType.getElementName(), modelType.getFullyQualifiedName());
- }
- else {
- comp1 = new CompositeObject(3, modelType.getElementName(), modelType.getFullyQualifiedName());
- }
- }
-
- CompositeObject comp2;
- if (e2 instanceof ISeparator) {
- comp2 = new CompositeObject(2);
- }
- else {
- IType modelType = (IType) e2;
- if (m_modelTypeShortList.contains(modelType)) {
- comp2 = new CompositeObject(1, modelType.getElementName(), modelType.getFullyQualifiedName());
- }
- else {
- comp2 = new CompositeObject(3, modelType.getElementName(), modelType.getFullyQualifiedName());
- }
- }
-
- return comp1.compareTo(comp2);
- }
- }
-
-}
+/*******************************************************************************
+ * 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;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+
+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.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerSorter;
+import org.eclipse.jface.wizard.IWizardContainer;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.scout.commons.CompositeObject;
+import org.eclipse.scout.sdk.RuntimeClasses;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.ui.extensions.AbstractFormFieldWizard;
+import org.eclipse.scout.sdk.ui.extensions.IFormFieldExtension;
+import org.eclipse.scout.sdk.ui.fields.table.FilteredTable;
+import org.eclipse.scout.sdk.ui.fields.table.ISeparator;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.internal.extensions.FormFieldExtensionPoint;
+import org.eclipse.scout.sdk.ui.wizard.AbstractScoutWizardPage;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
+import org.eclipse.scout.sdk.util.type.TypeFilters;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.util.typecache.IPrimaryTypeTypeHierarchy;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * <h3>FormFieldSelectionWizardPage</h3> ...
+ *
+ * @author Andreas Hoegger
+ * @since 1.0.8 02.03.2010
+ */
+public class FormFieldSelectionWizardPage extends AbstractWorkspaceWizardPage {
+
+ private IType iFormField = TypeUtility.getType(RuntimeClasses.IFormField);
+
+ private final IType m_declaringType;
+ private AbstractScoutWizardPage m_nextPage;
+ private Object m_currentSelection;
+ private HashSet<IType> m_modelTypeShortList;
+
+ // ui fields
+ private FilteredTable m_table;
+
+ /**
+ * @param pageName
+ */
+ public FormFieldSelectionWizardPage(IType declaringType) {
+ super(FormFieldSelectionWizardPage.class.getName());
+ m_declaringType = declaringType;
+ setTitle(Texts.get("FormField"));
+ setDescription(Texts.get("FormFieldDesc"));
+
+ }
+
+ @Override
+ protected void createContent(Composite parent) {
+ m_modelTypeShortList = new HashSet<IType>();
+ ArrayList<Object> elements = new ArrayList<Object>();
+ elements.add(new ISeparator() {
+ });
+ // entries
+ IPrimaryTypeTypeHierarchy formFieldHierarchy = TypeUtility.getPrimaryTypeHierarchy(iFormField);
+ IType[] abstractFormFields = formFieldHierarchy.getAllSubtypes(iFormField, TypeFilters.getAbstractOnClasspath(m_declaringType.getJavaProject()));
+ for (IType formField : abstractFormFields) {
+ IFormFieldExtension formFieldExtension = FormFieldExtensionPoint.findExtension(formField, 1);
+ if (formFieldExtension != null && formFieldExtension.isInShortList()) {
+ m_modelTypeShortList.add(formField);
+ }
+ elements.add(formField);
+ }
+ // ui
+ m_table = new FilteredTable(parent, SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION | SWT.V_SCROLL);
+ m_table.getViewer().addSelectionChangedListener(new ISelectionChangedListener() {
+ @Override
+ public void selectionChanged(SelectionChangedEvent event) {
+ if (m_currentSelection != null) {
+ m_table.getViewer().update(m_currentSelection, new String[]{"label"});
+ }
+ m_currentSelection = null;
+ if (!event.getSelection().isEmpty()) {
+ m_currentSelection = ((StructuredSelection) event.getSelection()).getFirstElement();
+ }
+ if (m_currentSelection != null) {
+ m_table.getViewer().update(m_currentSelection, new String[]{"label"});
+ }
+ handleSelection(m_currentSelection);
+ }
+ });
+
+ m_table.getViewer().addDoubleClickListener(new IDoubleClickListener() {
+ @Override
+ public void doubleClick(DoubleClickEvent event) {
+ Object selectedItem = null;
+ if (!event.getSelection().isEmpty()) {
+ StructuredSelection selection = (StructuredSelection) event.getSelection();
+ selectedItem = selection.getFirstElement();
+ }
+ handleSelection(selectedItem);
+ IWizardPage page = getNextPage();
+ if (page == null) {
+ // something must have happend getting the next page
+ return;
+ }
+
+ // show the next page
+ IWizardContainer container = getWizard().getContainer();
+ if (container != null) {
+ container.showPage(page);
+ }
+ }
+ });
+ P_ContentProvider provider = new P_ContentProvider(elements.toArray());
+ m_table.getViewer().setLabelProvider(provider);
+ m_table.getViewer().setContentProvider(provider);
+ m_table.getViewer().setInput(provider);
+ m_table.getViewer().setSorter(new P_TableSorter());
+
+ // layout
+ parent.setLayout(new GridLayout(1, true));
+ GridData tableData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_BOTH | GridData.GRAB_VERTICAL);
+ tableData.heightHint = 150;
+ m_table.setLayoutData(tableData);
+ }
+
+ private void handleSelection(Object selectedItem) {
+
+ AbstractFormFieldWizard wizard = null;
+ if (selectedItem instanceof IType) {
+ IType formField = (IType) selectedItem;
+ wizard = (AbstractFormFieldWizard) FormFieldExtensionPoint.createNewWizard(formField);
+ wizard.initWizard(m_declaringType);
+ wizard.setSuperType(formField);
+ }
+ if (wizard != null) {
+ m_nextPage = (AbstractScoutWizardPage) wizard.getPages()[0];
+ }
+ else {
+ m_nextPage = null;
+ }
+ revalidate();
+ }
+
+ @Override
+ protected void validatePage(MultiStatus multiStatus) {
+ multiStatus.add(getStatusFieldList());
+ }
+
+ private IStatus getStatusFieldList() {
+ if (m_nextPage == null) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("NoFieldSelected"));
+ }
+ return Status.OK_STATUS;
+ }
+
+ @Override
+ public IWizardPage getNextPage() {
+ return m_nextPage;
+ }
+
+ private class P_ContentProvider implements IStructuredContentProvider, ITableLabelProvider {
+
+ private Object[] m_elements;
+
+ public P_ContentProvider(Object[] elements) {
+ m_elements = elements;
+ }
+
+ @Override
+ public Object[] getElements(Object inputElement) {
+ return m_elements;
+ }
+
+ @Override
+ public Image getColumnImage(Object element, int columnIndex) {
+ if (columnIndex == 0) {
+ if (element instanceof ISeparator) {
+ return ScoutSdkUi.getImage(ScoutSdkUi.Separator);
+ }
+ return ScoutSdkUi.getImage(ScoutSdkUi.FormField);
+ }
+ return null;
+ }
+
+ @Override
+ public String getColumnText(Object element, int columnIndex) {
+ if (columnIndex == 0) {
+ StringBuilder label = new StringBuilder();
+ if (element instanceof ISeparator) {
+ return "------------------ more fields ------------------";
+ }
+ StructuredSelection selection = (StructuredSelection) m_table.getViewer().getSelection();
+
+ IType t = (IType) element;
+ String typeName = t.getElementName();
+ if (typeName.toLowerCase().startsWith("abstract")) {
+ typeName = typeName.substring("abstract".length());
+ }
+ label.append(typeName);
+ if (selection.toList().contains(element)) {
+ label.append(" - ").append(t.getFullyQualifiedName());
+ }
+ return label.toString();
+ }
+ return null;
+ }
+
+ @Override
+ public void dispose() {
+ }
+
+ @Override
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+
+ @Override
+ public void addListener(ILabelProviderListener listener) {
+
+ }
+
+ @Override
+ public boolean isLabelProperty(Object element, String property) {
+ return "label".equals(property);
+ }
+
+ @Override
+ public void removeListener(ILabelProviderListener listener) {
+ }
+ } // end class P_ByClassProvider
+
+ private class P_TableSorter extends ViewerSorter {
+
+ @Override
+ public int compare(Viewer viewer, Object e1, Object e2) {
+
+ CompositeObject comp1;
+ if (e1 instanceof ISeparator) {
+ comp1 = new CompositeObject(2);
+ }
+ else {
+ IType modelType = (IType) e1;
+ if (m_modelTypeShortList.contains(modelType)) {
+ comp1 = new CompositeObject(1, modelType.getElementName(), modelType.getFullyQualifiedName());
+ }
+ else {
+ comp1 = new CompositeObject(3, modelType.getElementName(), modelType.getFullyQualifiedName());
+ }
+ }
+
+ CompositeObject comp2;
+ if (e2 instanceof ISeparator) {
+ comp2 = new CompositeObject(2);
+ }
+ else {
+ IType modelType = (IType) e2;
+ if (m_modelTypeShortList.contains(modelType)) {
+ comp2 = new CompositeObject(1, modelType.getElementName(), modelType.getFullyQualifiedName());
+ }
+ else {
+ comp2 = new CompositeObject(3, modelType.getElementName(), modelType.getFullyQualifiedName());
+ }
+ }
+
+ return comp1.compareTo(comp2);
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/bigdecimalfield/BigdecimalFieldNewWizard.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/bigdecimalfield/BigdecimalFieldNewWizard.java
index c6dd9c022..64c1ab5c1 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/bigdecimalfield/BigdecimalFieldNewWizard.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/bigdecimalfield/BigdecimalFieldNewWizard.java
@@ -1,46 +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.bigdecimalfield;
-
-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 BigdecimalFieldNewWizard extends AbstractFormFieldWizard {
-
- private BigdecimalFieldNewWizardPage m_page1;
-
- public BigdecimalFieldNewWizard() {
- setWindowTitle(Texts.get("NewBigdecimalField"));
- }
-
- @Override
- public void initWizard(IType declaringType) {
- super.initWizard(declaringType);
- m_page1 = new BigdecimalFieldNewWizardPage(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);
- }
- }
-}
+/*******************************************************************************
+ * 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.bigdecimalfield;
+
+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 BigdecimalFieldNewWizard extends AbstractFormFieldWizard {
+
+ private BigdecimalFieldNewWizardPage m_page1;
+
+ public BigdecimalFieldNewWizard() {
+ setWindowTitle(Texts.get("NewBigdecimalField"));
+ }
+
+ @Override
+ public void initWizard(IType declaringType) {
+ super.initWizard(declaringType);
+ m_page1 = new BigdecimalFieldNewWizardPage(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/bigdecimalfield/BigdecimalFieldNewWizardPage.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/bigdecimalfield/BigdecimalFieldNewWizardPage.java
index 4aa548f08..541f67a93 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/bigdecimalfield/BigdecimalFieldNewWizardPage.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/bigdecimalfield/BigdecimalFieldNewWizardPage.java
@@ -1,246 +1,246 @@
-/*******************************************************************************
- * 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.bigdecimalfield;
-
-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.jdt.core.Signature;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.nls.sdk.model.INlsEntry;
-import org.eclipse.scout.sdk.RuntimeClasses;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.operation.form.field.BigdecimalFieldNewOperation;
-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.Regex;
-import org.eclipse.scout.sdk.util.SdkProperties;
-import org.eclipse.scout.sdk.util.type.TypeFilters;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-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>BigdecimalFieldNewWizardPage</h3> ...
- */
-public class BigdecimalFieldNewWizardPage 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 BigdecimalFieldNewWizardPage(IType declaringType) {
- super(BigdecimalFieldNewWizardPage.class.getName());
- m_declaringType = declaringType;
- m_superType = TypeUtility.getType(RuntimeClasses.AbstractBigDecimalField);
- m_sibling = SiblingProposal.SIBLING_END;
- }
-
- @Override
- protected void createContent(Composite parent) {
- setTitle(Texts.get("BigdecimalField"));
- setDescription(Texts.get("CreateANewBigdecimalField"));
-
- 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 {
- BigdecimalFieldNewOperation operation = new BigdecimalFieldNewOperation(m_declaringType);
- operation.setFormatSource(true);
- // write back members
- if (getNlsName() != null) {
- operation.setNlsEntry(getNlsName());
- }
- operation.setTypeName(getTypeName());
- if (getSuperType() != null) {
- operation.setSuperTypeSignature(Signature.createTypeSignature(getSuperType().getFullyQualifiedName(), true));
- }
- 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 {
- if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_FORM_FIELD)) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
- }
- // check not allowed names
- if (ScoutTypeUtility.getAllTypes(m_declaringType.getCompilationUnit(), TypeFilters.getRegexSimpleNameFilter(getTypeName())).length > 0) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
- }
- if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
- return Status.OK_STATUS;
- }
- else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
- return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
- }
- else {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
- }
- }
-
- /**
- * @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);
- }
- }
-}
+/*******************************************************************************
+ * 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.bigdecimalfield;
+
+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.jdt.core.Signature;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.nls.sdk.model.INlsEntry;
+import org.eclipse.scout.sdk.RuntimeClasses;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.operation.form.field.BigdecimalFieldNewOperation;
+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.Regex;
+import org.eclipse.scout.sdk.util.SdkProperties;
+import org.eclipse.scout.sdk.util.type.TypeFilters;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+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>BigdecimalFieldNewWizardPage</h3> ...
+ */
+public class BigdecimalFieldNewWizardPage 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 BigdecimalFieldNewWizardPage(IType declaringType) {
+ super(BigdecimalFieldNewWizardPage.class.getName());
+ m_declaringType = declaringType;
+ m_superType = TypeUtility.getType(RuntimeClasses.AbstractBigDecimalField);
+ m_sibling = SiblingProposal.SIBLING_END;
+ }
+
+ @Override
+ protected void createContent(Composite parent) {
+ setTitle(Texts.get("BigdecimalField"));
+ setDescription(Texts.get("CreateANewBigdecimalField"));
+
+ 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 {
+ BigdecimalFieldNewOperation operation = new BigdecimalFieldNewOperation(m_declaringType);
+ operation.setFormatSource(true);
+ // write back members
+ if (getNlsName() != null) {
+ operation.setNlsEntry(getNlsName());
+ }
+ operation.setTypeName(getTypeName());
+ if (getSuperType() != null) {
+ operation.setSuperTypeSignature(Signature.createTypeSignature(getSuperType().getFullyQualifiedName(), true));
+ }
+ 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 {
+ if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_FORM_FIELD)) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
+ }
+ // check not allowed names
+ if (ScoutTypeUtility.getAllTypes(m_declaringType.getCompilationUnit(), TypeFilters.getRegexSimpleNameFilter(getTypeName())).length > 0) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
+ }
+ if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return Status.OK_STATUS;
+ }
+ else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
+ }
+ else {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
+ }
+ }
+
+ /**
+ * @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.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/booleanfield/BooleanFieldNewWizard.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/booleanfield/BooleanFieldNewWizard.java
index 58e2f26c2..ddcf9b8d2 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/booleanfield/BooleanFieldNewWizard.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/booleanfield/BooleanFieldNewWizard.java
@@ -1,46 +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.booleanfield;
-
-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 BooleanFieldNewWizard extends AbstractFormFieldWizard {
-
- private BooleanFieldNewWizardPage m_page1;
-
- public BooleanFieldNewWizard() {
- setWindowTitle(Texts.get("NewBooleanField"));
- }
-
- @Override
- public void initWizard(IType declaringType) {
- super.initWizard(declaringType);
- m_page1 = new BooleanFieldNewWizardPage(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);
- }
- }
-}
+/*******************************************************************************
+ * 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.booleanfield;
+
+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 BooleanFieldNewWizard extends AbstractFormFieldWizard {
+
+ private BooleanFieldNewWizardPage m_page1;
+
+ public BooleanFieldNewWizard() {
+ setWindowTitle(Texts.get("NewBooleanField"));
+ }
+
+ @Override
+ public void initWizard(IType declaringType) {
+ super.initWizard(declaringType);
+ m_page1 = new BooleanFieldNewWizardPage(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/booleanfield/BooleanFieldNewWizardPage.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/booleanfield/BooleanFieldNewWizardPage.java
index 65a922287..2802db9cd 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/booleanfield/BooleanFieldNewWizardPage.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/booleanfield/BooleanFieldNewWizardPage.java
@@ -1,245 +1,245 @@
-/*******************************************************************************
- * 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.booleanfield;
-
-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.jdt.core.Signature;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.nls.sdk.model.INlsEntry;
-import org.eclipse.scout.sdk.RuntimeClasses;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.operation.form.field.BooleanFieldNewOperation;
-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.Regex;
-import org.eclipse.scout.sdk.util.SdkProperties;
-import org.eclipse.scout.sdk.util.type.TypeFilters;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-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>BooleanFieldNewWizardPage</h3> ...
- */
-public class BooleanFieldNewWizardPage 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 BooleanFieldNewWizardPage(IType declaringType) {
- super(BooleanFieldNewWizardPage.class.getName());
- m_declaringType = declaringType;
- setSuperType(TypeUtility.getType(RuntimeClasses.AbstractBooleanField));
- m_sibling = SiblingProposal.SIBLING_END;
- }
-
- @Override
- protected void createContent(Composite parent) {
- setTitle(Texts.get("NewBooleanField"));
- setDescription(Texts.get("CreateANewBooleanField"));
-
- 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 {
- BooleanFieldNewOperation operation = new BooleanFieldNewOperation(m_declaringType);
- operation.setFormatSource(true);
- // write back members
- operation.setNlsEntry(getNlsName());
- operation.setTypeName(getTypeName());
-
- if (getSuperType() != null) {
- operation.setSuperTypeSignature(Signature.createTypeSignature(getSuperType().getFullyQualifiedName(), true));
- }
- 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 {
- if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_FORM_FIELD)) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
- }
- // check not allowed names
- if (ScoutTypeUtility.getAllTypes(m_declaringType.getCompilationUnit(), TypeFilters.getRegexSimpleNameFilter(getTypeName())).length > 0) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
- }
- if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
- return Status.OK_STATUS;
- }
- else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
- return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
- }
- else {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
- }
- }
-
- /**
- * @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);
- }
- }
-}
+/*******************************************************************************
+ * 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.booleanfield;
+
+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.jdt.core.Signature;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.nls.sdk.model.INlsEntry;
+import org.eclipse.scout.sdk.RuntimeClasses;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.operation.form.field.BooleanFieldNewOperation;
+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.Regex;
+import org.eclipse.scout.sdk.util.SdkProperties;
+import org.eclipse.scout.sdk.util.type.TypeFilters;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+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>BooleanFieldNewWizardPage</h3> ...
+ */
+public class BooleanFieldNewWizardPage 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 BooleanFieldNewWizardPage(IType declaringType) {
+ super(BooleanFieldNewWizardPage.class.getName());
+ m_declaringType = declaringType;
+ setSuperType(TypeUtility.getType(RuntimeClasses.AbstractBooleanField));
+ m_sibling = SiblingProposal.SIBLING_END;
+ }
+
+ @Override
+ protected void createContent(Composite parent) {
+ setTitle(Texts.get("NewBooleanField"));
+ setDescription(Texts.get("CreateANewBooleanField"));
+
+ 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 {
+ BooleanFieldNewOperation operation = new BooleanFieldNewOperation(m_declaringType);
+ operation.setFormatSource(true);
+ // write back members
+ operation.setNlsEntry(getNlsName());
+ operation.setTypeName(getTypeName());
+
+ if (getSuperType() != null) {
+ operation.setSuperTypeSignature(Signature.createTypeSignature(getSuperType().getFullyQualifiedName(), true));
+ }
+ 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 {
+ if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_FORM_FIELD)) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
+ }
+ // check not allowed names
+ if (ScoutTypeUtility.getAllTypes(m_declaringType.getCompilationUnit(), TypeFilters.getRegexSimpleNameFilter(getTypeName())).length > 0) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
+ }
+ if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return Status.OK_STATUS;
+ }
+ else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
+ }
+ else {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
+ }
+ }
+
+ /**
+ * @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.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/buttonfield/ButtonFieldNewWizard.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/buttonfield/ButtonFieldNewWizard.java
index 937ae162b..0e65cf0c6 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/buttonfield/ButtonFieldNewWizard.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/buttonfield/ButtonFieldNewWizard.java
@@ -1,53 +1,53 @@
-/*******************************************************************************
- * 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.buttonfield;
-
-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 ButtonFieldNewWizard extends AbstractFormFieldWizard {
-
- private ButtonFieldNewWizardPage m_page1;
-
- public ButtonFieldNewWizard() {
- setWindowTitle(Texts.get("NewButtonField"));
- }
-
- @Override
- public void initWizard(IType declaringType) {
- super.initWizard(declaringType);
- m_page1 = new ButtonFieldNewWizardPage(getDeclaringType());
- addPage(getButtonFieldWizardPage());
- }
-
- @Override
- public void setSuperType(IType superType) {
- getButtonFieldWizardPage().setSuperType(superType);
- }
-
- @Override
- protected void postFinishDisplayThread() {
- IType createdField = getButtonFieldWizardPage().getCreatedField();
- if (TypeUtility.exists(createdField)) {
- ScoutSdkUi.showJavaElementInEditor(createdField, false);
- }
- }
-
- /**
- * @return the page1
- */
- public ButtonFieldNewWizardPage getButtonFieldWizardPage() {
- return m_page1;
- }
-}
+/*******************************************************************************
+ * 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.buttonfield;
+
+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 ButtonFieldNewWizard extends AbstractFormFieldWizard {
+
+ private ButtonFieldNewWizardPage m_page1;
+
+ public ButtonFieldNewWizard() {
+ setWindowTitle(Texts.get("NewButtonField"));
+ }
+
+ @Override
+ public void initWizard(IType declaringType) {
+ super.initWizard(declaringType);
+ m_page1 = new ButtonFieldNewWizardPage(getDeclaringType());
+ addPage(getButtonFieldWizardPage());
+ }
+
+ @Override
+ public void setSuperType(IType superType) {
+ getButtonFieldWizardPage().setSuperType(superType);
+ }
+
+ @Override
+ protected void postFinishDisplayThread() {
+ IType createdField = getButtonFieldWizardPage().getCreatedField();
+ if (TypeUtility.exists(createdField)) {
+ ScoutSdkUi.showJavaElementInEditor(createdField, false);
+ }
+ }
+
+ /**
+ * @return the page1
+ */
+ public ButtonFieldNewWizardPage getButtonFieldWizardPage() {
+ return m_page1;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/buttonfield/ButtonFieldNewWizardPage.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/buttonfield/ButtonFieldNewWizardPage.java
index 94052a009..1926e4f35 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/buttonfield/ButtonFieldNewWizardPage.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/buttonfield/ButtonFieldNewWizardPage.java
@@ -1,269 +1,269 @@
-/*******************************************************************************
- * 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.buttonfield;
-
-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.jdt.core.Signature;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.nls.sdk.model.INlsEntry;
-import org.eclipse.scout.sdk.RuntimeClasses;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.operation.form.field.ButtonFieldNewOperation;
-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.Regex;
-import org.eclipse.scout.sdk.util.SdkProperties;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-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>ButtonFieldNewWizardPage</h3> ...
- */
-public class ButtonFieldNewWizardPage 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 ButtonFieldNewOperation m_operation;
- private final String m_readOnlySuffix;
- private IType m_createdField;
-
- public ButtonFieldNewWizardPage(IType declaringType) {
- this(declaringType, Texts.get("NewButtonField"), Texts.get("CreateANewButtonField"), SdkProperties.SUFFIX_BUTTON);
- }
-
- public ButtonFieldNewWizardPage(IType declaringType, String title, String message, String suffix) {
- super(ButtonFieldNewWizardPage.class.getName());
- m_readOnlySuffix = suffix;
- setTitle(title);
- setDescription(message);
- m_declaringType = declaringType;
-
- setOperation(new ButtonFieldNewOperation(m_declaringType));
-
- setSuperType(TypeUtility.getType(RuntimeClasses.AbstractButton));
- m_sibling = SiblingProposal.SIBLING_END;
- }
-
- @Override
- protected void createContent(Composite parent) {
-
- 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(m_readOnlySuffix);
- 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.acceptProposal(m_sibling);
- m_siblingField.addProposalAdapterListener(new IProposalAdapterListener() {
- @Override
- public void proposalAccepted(ContentProposalEvent event) {
- m_sibling = (SiblingProposal) event.proposal;
- pingStateChanging();
- }
- });
-
- // 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 {
- getOperation().setFormatSource(true);
- // write back members
- getOperation().setNlsEntry(getNlsName());
- getOperation().setTypeName(getTypeName());
- if (getSuperType() != null) {
- getOperation().setSuperTypeSignature(Signature.createTypeSignature(getSuperType().getFullyQualifiedName(), true));
- }
- if (getSibling() == SiblingProposal.SIBLING_END) {
- IStructuredType structuredType = ScoutTypeUtility.createStructuredCompositeField(m_declaringType);
- getOperation().setSibling(structuredType.getSibling(CATEGORIES.TYPE_FORM_FIELD));
- }
- else {
- getOperation().setSibling(getSibling().getElement());
- }
- getOperation().run(monitor, workingCopyManager);
- m_createdField = getOperation().getCreatedButton();
- return true;
- }
-
- @Override
- protected void validatePage(MultiStatus multiStatus) {
- try {
- multiStatus.add(getStatusNameField());
- multiStatus.add(getStatusSuperType());
- }
- catch (JavaModelException e) {
- ScoutSdkUi.logError("could not validate name field.", e);
- }
- }
-
- protected IStatus getStatusNameField() throws JavaModelException {
- if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(m_readOnlySuffix)) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
- }
- // check not allowed names
- if (TypeUtility.findInnerType(m_declaringType, getTypeName()) != null) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
- }
- if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
- return Status.OK_STATUS;
- }
- else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
- return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
- }
- else {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
- }
- }
-
- protected IStatus getStatusSuperType() throws JavaModelException {
- if (getSuperType() == null) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("TheSuperTypeCanNotBeNull"));
- }
- return Status.OK_STATUS;
- }
-
- public void setOperation(ButtonFieldNewOperation operation) {
- m_operation = operation;
- }
-
- public ButtonFieldNewOperation getOperation() {
- return m_operation;
- }
-
- /**
- * @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);
- }
- }
-
-}
+/*******************************************************************************
+ * 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.buttonfield;
+
+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.jdt.core.Signature;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.nls.sdk.model.INlsEntry;
+import org.eclipse.scout.sdk.RuntimeClasses;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.operation.form.field.ButtonFieldNewOperation;
+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.Regex;
+import org.eclipse.scout.sdk.util.SdkProperties;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+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>ButtonFieldNewWizardPage</h3> ...
+ */
+public class ButtonFieldNewWizardPage 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 ButtonFieldNewOperation m_operation;
+ private final String m_readOnlySuffix;
+ private IType m_createdField;
+
+ public ButtonFieldNewWizardPage(IType declaringType) {
+ this(declaringType, Texts.get("NewButtonField"), Texts.get("CreateANewButtonField"), SdkProperties.SUFFIX_BUTTON);
+ }
+
+ public ButtonFieldNewWizardPage(IType declaringType, String title, String message, String suffix) {
+ super(ButtonFieldNewWizardPage.class.getName());
+ m_readOnlySuffix = suffix;
+ setTitle(title);
+ setDescription(message);
+ m_declaringType = declaringType;
+
+ setOperation(new ButtonFieldNewOperation(m_declaringType));
+
+ setSuperType(TypeUtility.getType(RuntimeClasses.AbstractButton));
+ m_sibling = SiblingProposal.SIBLING_END;
+ }
+
+ @Override
+ protected void createContent(Composite parent) {
+
+ 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(m_readOnlySuffix);
+ 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.acceptProposal(m_sibling);
+ m_siblingField.addProposalAdapterListener(new IProposalAdapterListener() {
+ @Override
+ public void proposalAccepted(ContentProposalEvent event) {
+ m_sibling = (SiblingProposal) event.proposal;
+ pingStateChanging();
+ }
+ });
+
+ // 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 {
+ getOperation().setFormatSource(true);
+ // write back members
+ getOperation().setNlsEntry(getNlsName());
+ getOperation().setTypeName(getTypeName());
+ if (getSuperType() != null) {
+ getOperation().setSuperTypeSignature(Signature.createTypeSignature(getSuperType().getFullyQualifiedName(), true));
+ }
+ if (getSibling() == SiblingProposal.SIBLING_END) {
+ IStructuredType structuredType = ScoutTypeUtility.createStructuredCompositeField(m_declaringType);
+ getOperation().setSibling(structuredType.getSibling(CATEGORIES.TYPE_FORM_FIELD));
+ }
+ else {
+ getOperation().setSibling(getSibling().getElement());
+ }
+ getOperation().run(monitor, workingCopyManager);
+ m_createdField = getOperation().getCreatedButton();
+ return true;
+ }
+
+ @Override
+ protected void validatePage(MultiStatus multiStatus) {
+ try {
+ multiStatus.add(getStatusNameField());
+ multiStatus.add(getStatusSuperType());
+ }
+ catch (JavaModelException e) {
+ ScoutSdkUi.logError("could not validate name field.", e);
+ }
+ }
+
+ protected IStatus getStatusNameField() throws JavaModelException {
+ if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(m_readOnlySuffix)) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
+ }
+ // check not allowed names
+ if (TypeUtility.findInnerType(m_declaringType, getTypeName()) != null) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
+ }
+ if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return Status.OK_STATUS;
+ }
+ else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
+ }
+ else {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
+ }
+ }
+
+ protected IStatus getStatusSuperType() throws JavaModelException {
+ if (getSuperType() == null) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("TheSuperTypeCanNotBeNull"));
+ }
+ return Status.OK_STATUS;
+ }
+
+ public void setOperation(ButtonFieldNewOperation operation) {
+ m_operation = operation;
+ }
+
+ public ButtonFieldNewOperation getOperation() {
+ return m_operation;
+ }
+
+ /**
+ * @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.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/buttonfield/CancelButtonNewWizard.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/buttonfield/CancelButtonNewWizard.java
index 3753a9e48..459abd171 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/buttonfield/CancelButtonNewWizard.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/buttonfield/CancelButtonNewWizard.java
@@ -1,40 +1,40 @@
-/*******************************************************************************
- * 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.buttonfield;
-
-import org.eclipse.jdt.core.IType;
-import org.eclipse.scout.nls.sdk.model.INlsEntry;
-import org.eclipse.scout.nls.sdk.model.workspace.project.INlsProject;
-import org.eclipse.scout.sdk.RuntimeClasses;
-import org.eclipse.scout.sdk.ScoutSdkCore;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-
-public class CancelButtonNewWizard extends ButtonFieldNewWizard {
-
- public CancelButtonNewWizard() {
- setWindowTitle(Texts.get("NewCancelButton"));
- }
-
- @Override
- public void initWizard(IType declaringType) {
- super.initWizard(declaringType);
- getButtonFieldWizardPage().setSuperType(TypeUtility.getType(RuntimeClasses.AbstractCancelButton));
- INlsProject nlsProject = ScoutSdkCore.getScoutWorkspace().getScoutBundle(declaringType.getJavaProject().getProject()).findBestMatchNlsProject();
- INlsEntry entry = null;
- if (nlsProject != null) {
- entry = nlsProject.getEntry("Cancel");
- getButtonFieldWizardPage().setTypeName("CancelButton");
- }
- getButtonFieldWizardPage().setNlsName(entry);
- }
-
-}
+/*******************************************************************************
+ * 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.buttonfield;
+
+import org.eclipse.jdt.core.IType;
+import org.eclipse.scout.nls.sdk.model.INlsEntry;
+import org.eclipse.scout.nls.sdk.model.workspace.project.INlsProject;
+import org.eclipse.scout.sdk.RuntimeClasses;
+import org.eclipse.scout.sdk.ScoutSdkCore;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+
+public class CancelButtonNewWizard extends ButtonFieldNewWizard {
+
+ public CancelButtonNewWizard() {
+ setWindowTitle(Texts.get("NewCancelButton"));
+ }
+
+ @Override
+ public void initWizard(IType declaringType) {
+ super.initWizard(declaringType);
+ getButtonFieldWizardPage().setSuperType(TypeUtility.getType(RuntimeClasses.AbstractCancelButton));
+ INlsProject nlsProject = ScoutSdkCore.getScoutWorkspace().getScoutBundle(declaringType.getJavaProject().getProject()).findBestMatchNlsProject();
+ INlsEntry entry = null;
+ if (nlsProject != null) {
+ entry = nlsProject.getEntry("Cancel");
+ getButtonFieldWizardPage().setTypeName("CancelButton");
+ }
+ getButtonFieldWizardPage().setNlsName(entry);
+ }
+
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/buttonfield/OkButtonNewWizard.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/buttonfield/OkButtonNewWizard.java
index 7a78718f8..ac8f1aabb 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/buttonfield/OkButtonNewWizard.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/buttonfield/OkButtonNewWizard.java
@@ -1,40 +1,40 @@
-/*******************************************************************************
- * 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.buttonfield;
-
-import org.eclipse.jdt.core.IType;
-import org.eclipse.scout.nls.sdk.model.INlsEntry;
-import org.eclipse.scout.nls.sdk.model.workspace.project.INlsProject;
-import org.eclipse.scout.sdk.RuntimeClasses;
-import org.eclipse.scout.sdk.ScoutSdkCore;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-
-public class OkButtonNewWizard extends ButtonFieldNewWizard {
-
- public OkButtonNewWizard() {
- setWindowTitle(Texts.get("NewOkButton"));
- }
-
- @Override
- public void initWizard(IType declaringType) {
- super.initWizard(declaringType);
- getButtonFieldWizardPage().setSuperType(TypeUtility.getType(RuntimeClasses.AbstractOkButton));
- INlsProject nlsProject = ScoutSdkCore.getScoutWorkspace().getScoutBundle(declaringType.getJavaProject().getProject()).findBestMatchNlsProject();
- INlsEntry entry = null;
- if (nlsProject != null) {
- entry = nlsProject.getEntry("Ok");
- getButtonFieldWizardPage().setTypeName("OkButton");
- }
- getButtonFieldWizardPage().setNlsName(entry);
- }
-
-}
+/*******************************************************************************
+ * 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.buttonfield;
+
+import org.eclipse.jdt.core.IType;
+import org.eclipse.scout.nls.sdk.model.INlsEntry;
+import org.eclipse.scout.nls.sdk.model.workspace.project.INlsProject;
+import org.eclipse.scout.sdk.RuntimeClasses;
+import org.eclipse.scout.sdk.ScoutSdkCore;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+
+public class OkButtonNewWizard extends ButtonFieldNewWizard {
+
+ public OkButtonNewWizard() {
+ setWindowTitle(Texts.get("NewOkButton"));
+ }
+
+ @Override
+ public void initWizard(IType declaringType) {
+ super.initWizard(declaringType);
+ getButtonFieldWizardPage().setSuperType(TypeUtility.getType(RuntimeClasses.AbstractOkButton));
+ INlsProject nlsProject = ScoutSdkCore.getScoutWorkspace().getScoutBundle(declaringType.getJavaProject().getProject()).findBestMatchNlsProject();
+ INlsEntry entry = null;
+ if (nlsProject != null) {
+ entry = nlsProject.getEntry("Ok");
+ getButtonFieldWizardPage().setTypeName("OkButton");
+ }
+ getButtonFieldWizardPage().setNlsName(entry);
+ }
+
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/calendarfield/CalendarFieldNewWizard.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/calendarfield/CalendarFieldNewWizard.java
index b784614d4..eddb7234b 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/calendarfield/CalendarFieldNewWizard.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/calendarfield/CalendarFieldNewWizard.java
@@ -1,46 +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.calendarfield;
-
-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 CalendarFieldNewWizard extends AbstractFormFieldWizard {
-
- private CalendarFieldNewWizardPage m_page1;
-
- public CalendarFieldNewWizard() {
- setWindowTitle(Texts.get("NewCalendarField"));
- }
-
- @Override
- public void initWizard(IType declaringType) {
- super.initWizard(declaringType);
- m_page1 = new CalendarFieldNewWizardPage(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);
- }
- }
-}
+/*******************************************************************************
+ * 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.calendarfield;
+
+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 CalendarFieldNewWizard extends AbstractFormFieldWizard {
+
+ private CalendarFieldNewWizardPage m_page1;
+
+ public CalendarFieldNewWizard() {
+ setWindowTitle(Texts.get("NewCalendarField"));
+ }
+
+ @Override
+ public void initWizard(IType declaringType) {
+ super.initWizard(declaringType);
+ m_page1 = new CalendarFieldNewWizardPage(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/calendarfield/CalendarFieldNewWizardPage.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/calendarfield/CalendarFieldNewWizardPage.java
index 80c936ac4..fdd4cfdc4 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/calendarfield/CalendarFieldNewWizardPage.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/calendarfield/CalendarFieldNewWizardPage.java
@@ -1,245 +1,245 @@
-/*******************************************************************************
- * 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.calendarfield;
-
-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.jdt.core.Signature;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.nls.sdk.model.INlsEntry;
-import org.eclipse.scout.sdk.RuntimeClasses;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.operation.form.field.CalendarFieldNewOperation;
-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.Regex;
-import org.eclipse.scout.sdk.util.SdkProperties;
-import org.eclipse.scout.sdk.util.type.TypeFilters;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-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>ButtonFieldNewWizardPage</h3> ...
- */
-public class CalendarFieldNewWizardPage 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 CalendarFieldNewWizardPage(IType declaringType) {
- super(CalendarFieldNewWizard.class.getName());
- setTitle(Texts.get("NewCalendarField"));
- setDescription(Texts.get("CreateANewCalendarField"));
- m_declaringType = declaringType;
- setSuperType(TypeUtility.getType(RuntimeClasses.AbstractCalendarField));
- m_sibling = SiblingProposal.SIBLING_END;
- }
-
- @Override
- protected void createContent(Composite parent) {
-
- 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 {
- CalendarFieldNewOperation operation = new CalendarFieldNewOperation(m_declaringType);
- operation.setFormatSource(true);
- // write back members
- if (getNlsName() != null) {
- operation.setNlsEntry(getNlsName());
- }
- operation.setTypeName(getTypeName());
- if (getSuperType() != null) {
- operation.setSuperTypeSignature(Signature.createTypeSignature(getSuperType().getFullyQualifiedName(), true));
- }
- 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.getCreatedCalendarField();
- 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 {
- if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_FORM_FIELD)) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
- }
- // check not allowed names
- if (ScoutTypeUtility.getAllTypes(m_declaringType.getCompilationUnit(), TypeFilters.getRegexSimpleNameFilter(getTypeName())).length > 0) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
- }
- if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
- return Status.OK_STATUS;
- }
- else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
- return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
- }
- else {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
- }
- }
-
- /**
- * @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);
- }
- }
-}
+/*******************************************************************************
+ * 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.calendarfield;
+
+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.jdt.core.Signature;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.nls.sdk.model.INlsEntry;
+import org.eclipse.scout.sdk.RuntimeClasses;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.operation.form.field.CalendarFieldNewOperation;
+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.Regex;
+import org.eclipse.scout.sdk.util.SdkProperties;
+import org.eclipse.scout.sdk.util.type.TypeFilters;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+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>ButtonFieldNewWizardPage</h3> ...
+ */
+public class CalendarFieldNewWizardPage 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 CalendarFieldNewWizardPage(IType declaringType) {
+ super(CalendarFieldNewWizard.class.getName());
+ setTitle(Texts.get("NewCalendarField"));
+ setDescription(Texts.get("CreateANewCalendarField"));
+ m_declaringType = declaringType;
+ setSuperType(TypeUtility.getType(RuntimeClasses.AbstractCalendarField));
+ m_sibling = SiblingProposal.SIBLING_END;
+ }
+
+ @Override
+ protected void createContent(Composite parent) {
+
+ 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 {
+ CalendarFieldNewOperation operation = new CalendarFieldNewOperation(m_declaringType);
+ operation.setFormatSource(true);
+ // write back members
+ if (getNlsName() != null) {
+ operation.setNlsEntry(getNlsName());
+ }
+ operation.setTypeName(getTypeName());
+ if (getSuperType() != null) {
+ operation.setSuperTypeSignature(Signature.createTypeSignature(getSuperType().getFullyQualifiedName(), true));
+ }
+ 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.getCreatedCalendarField();
+ 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 {
+ if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_FORM_FIELD)) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
+ }
+ // check not allowed names
+ if (ScoutTypeUtility.getAllTypes(m_declaringType.getCompilationUnit(), TypeFilters.getRegexSimpleNameFilter(getTypeName())).length > 0) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
+ }
+ if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return Status.OK_STATUS;
+ }
+ else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
+ }
+ else {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
+ }
+ }
+
+ /**
+ * @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.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/calendarfield/itemprovider/CalendarItemProviderNewWizard.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/calendarfield/itemprovider/CalendarItemProviderNewWizard.java
index dfb44e726..ca43014e5 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/calendarfield/itemprovider/CalendarItemProviderNewWizard.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/calendarfield/itemprovider/CalendarItemProviderNewWizard.java
@@ -1,47 +1,47 @@
-/*******************************************************************************
- * 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.calendarfield.itemprovider;
-
-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 CalendarItemProviderNewWizard extends AbstractFormFieldWizard {
-
- private CalendarItemProviderNewWizardPage m_page1;
-
- public CalendarItemProviderNewWizard(IType calendarType) {
- setWindowTitle(Texts.get("NewItemProvider"));
- initWizard(calendarType);
- }
-
- @Override
- public void initWizard(IType declaringType) {
- super.initWizard(declaringType);
- m_page1 = new CalendarItemProviderNewWizardPage(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);
- }
- }
-}
+/*******************************************************************************
+ * 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.calendarfield.itemprovider;
+
+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 CalendarItemProviderNewWizard extends AbstractFormFieldWizard {
+
+ private CalendarItemProviderNewWizardPage m_page1;
+
+ public CalendarItemProviderNewWizard(IType calendarType) {
+ setWindowTitle(Texts.get("NewItemProvider"));
+ initWizard(calendarType);
+ }
+
+ @Override
+ public void initWizard(IType declaringType) {
+ super.initWizard(declaringType);
+ m_page1 = new CalendarItemProviderNewWizardPage(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/calendarfield/itemprovider/CalendarItemProviderNewWizardPage.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/calendarfield/itemprovider/CalendarItemProviderNewWizardPage.java
index 6aeda3f71..8f2bce783 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/calendarfield/itemprovider/CalendarItemProviderNewWizardPage.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/calendarfield/itemprovider/CalendarItemProviderNewWizardPage.java
@@ -1,242 +1,242 @@
-/*******************************************************************************
- * 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.calendarfield.itemprovider;
-
-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.jdt.core.Signature;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.sdk.RuntimeClasses;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.operation.form.field.calendar.CalendarItemProviderNewOperation;
-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.fields.proposal.javaelement.JavaElementAbstractTypeContentProvider;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
-import org.eclipse.scout.sdk.util.Regex;
-import org.eclipse.scout.sdk.util.SdkProperties;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-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>CalendarItemProviderNewWizardPage</h3> ...
- */
-public class CalendarItemProviderNewWizardPage extends AbstractWorkspaceWizardPage {
-
- final IType iFormField = TypeUtility.getType(RuntimeClasses.IFormField);
- final IType iCalendarItemProvider = TypeUtility.getType(RuntimeClasses.ICalendarItemProvider);
- final IType abstractCalendarItemProvider = TypeUtility.getType(RuntimeClasses.AbstractCalendarItemProvider);
-
- private String m_typeName;
- private IType m_superType;
- private SiblingProposal m_sibling;
-
- private StyledTextField m_typeNameField;
- private ProposalTextField m_superTypeField;
- private ProposalTextField m_siblingField;
-
- // process members
- private final IType m_declaringType;
- private IType m_createdField;
-
- public CalendarItemProviderNewWizardPage(IType declaringType) {
- super(CalendarItemProviderNewWizardPage.class.getName());
- setTitle(Texts.get("NewCalendarItemProvider"));
- setDescription(Texts.get("CreateANewCalendarItemProvider"));
- m_declaringType = declaringType;
-
- IType superType = getSuperType();
- if (superType == null) {
- superType = abstractCalendarItemProvider;
- }
- m_superType = superType;
- m_sibling = SiblingProposal.SIBLING_END;
- }
-
- @Override
- protected void createContent(Composite parent) {
-
- m_typeNameField = getFieldToolkit().createStyledTextField(parent, Texts.get("TypeName"));
- m_typeNameField.setReadOnlySuffix(SdkProperties.SUFFIX_CALENDAR_ITEM_PROVIDER);
- m_typeNameField.setText(m_typeName);
- m_typeNameField.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- m_typeName = m_typeNameField.getText();
- pingStateChanging();
- }
- });
-
- m_superTypeField = getFieldToolkit().createJavaElementProposalField(parent, Texts.get("SuperType"),
- new JavaElementAbstractTypeContentProvider(iCalendarItemProvider, m_declaringType.getJavaProject(), abstractCalendarItemProvider));
- m_superTypeField.acceptProposal(m_superType);
- m_superTypeField.addProposalAdapterListener(new IProposalAdapterListener() {
- @Override
- public void proposalAccepted(ContentProposalEvent event) {
- m_superType = (IType) event.proposal;
- pingStateChanging();
- }
- });
-
- m_siblingField = getFieldToolkit().createSiblingProposalField(parent, m_declaringType, iCalendarItemProvider);
- m_siblingField.acceptProposal(m_sibling);
- m_siblingField.addProposalAdapterListener(new IProposalAdapterListener() {
- @Override
- public void proposalAccepted(ContentProposalEvent event) {
- m_sibling = (SiblingProposal) event.proposal;
- pingStateChanging();
- }
- });
-
- // layout
- parent.setLayout(new GridLayout(1, true));
-
- m_typeNameField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- m_superTypeField.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 {
- CalendarItemProviderNewOperation operation = new CalendarItemProviderNewOperation(m_declaringType);
- operation.setFormatSource(true);
- // write back members
- operation.setTypeName(getTypeName());
- IType superTypeProp = getSuperType();
- if (superTypeProp != null) {
- operation.setSuperTypeSignature(Signature.createTypeSignature(superTypeProp.getFullyQualifiedName(), true));
- }
-
- if (getSibling() == SiblingProposal.SIBLING_END) {
- IStructuredType structuredType = ScoutTypeUtility.createStructuredCalendar(m_declaringType);
- operation.setSibling(structuredType.getSibling(CATEGORIES.TYPE_CALENDAR_ITEM_PROVIDER));
- }
- else {
- operation.setSibling(getSibling().getElement());
- }
- operation.validate();
- operation.run(monitor, workingCopyManager);
- m_createdField = operation.getCreatedField();
- return true;
- }
-
- @Override
- protected void validatePage(MultiStatus multiStatus) {
- try {
- multiStatus.add(getStatusNameField());
- multiStatus.add(getStatusSuperType());
- }
- catch (JavaModelException e) {
- ScoutSdkUi.logError("could not validate name field.", e);
- }
- }
-
- protected IStatus getStatusNameField() throws JavaModelException {
- if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_CALENDAR_ITEM_PROVIDER)) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
- }
- // check not allowed names
- if (TypeUtility.exists(m_declaringType.getType(getTypeName()))) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
- }
- if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
- return Status.OK_STATUS;
- }
- else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
- return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
- }
- else {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
- }
- }
-
- protected IStatus getStatusSuperType() throws JavaModelException {
- if (getSuperType() == null) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("TheSuperTypeCanNotBeNull"));
- }
- return Status.OK_STATUS;
- }
-
- /**
- * @return the createdField
- */
- public IType getCreatedField() {
- return m_createdField;
- }
-
- 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) {
- try {
- setStateChanging(true);
- m_superType = superType;
- if (isControlCreated()) {
- m_superTypeField.acceptProposal(superType);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- 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);
- }
- }
-}
+/*******************************************************************************
+ * 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.calendarfield.itemprovider;
+
+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.jdt.core.Signature;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.sdk.RuntimeClasses;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.operation.form.field.calendar.CalendarItemProviderNewOperation;
+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.fields.proposal.javaelement.JavaElementAbstractTypeContentProvider;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
+import org.eclipse.scout.sdk.util.Regex;
+import org.eclipse.scout.sdk.util.SdkProperties;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+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>CalendarItemProviderNewWizardPage</h3> ...
+ */
+public class CalendarItemProviderNewWizardPage extends AbstractWorkspaceWizardPage {
+
+ final IType iFormField = TypeUtility.getType(RuntimeClasses.IFormField);
+ final IType iCalendarItemProvider = TypeUtility.getType(RuntimeClasses.ICalendarItemProvider);
+ final IType abstractCalendarItemProvider = TypeUtility.getType(RuntimeClasses.AbstractCalendarItemProvider);
+
+ private String m_typeName;
+ private IType m_superType;
+ private SiblingProposal m_sibling;
+
+ private StyledTextField m_typeNameField;
+ private ProposalTextField m_superTypeField;
+ private ProposalTextField m_siblingField;
+
+ // process members
+ private final IType m_declaringType;
+ private IType m_createdField;
+
+ public CalendarItemProviderNewWizardPage(IType declaringType) {
+ super(CalendarItemProviderNewWizardPage.class.getName());
+ setTitle(Texts.get("NewCalendarItemProvider"));
+ setDescription(Texts.get("CreateANewCalendarItemProvider"));
+ m_declaringType = declaringType;
+
+ IType superType = getSuperType();
+ if (superType == null) {
+ superType = abstractCalendarItemProvider;
+ }
+ m_superType = superType;
+ m_sibling = SiblingProposal.SIBLING_END;
+ }
+
+ @Override
+ protected void createContent(Composite parent) {
+
+ m_typeNameField = getFieldToolkit().createStyledTextField(parent, Texts.get("TypeName"));
+ m_typeNameField.setReadOnlySuffix(SdkProperties.SUFFIX_CALENDAR_ITEM_PROVIDER);
+ m_typeNameField.setText(m_typeName);
+ m_typeNameField.addModifyListener(new ModifyListener() {
+ @Override
+ public void modifyText(ModifyEvent e) {
+ m_typeName = m_typeNameField.getText();
+ pingStateChanging();
+ }
+ });
+
+ m_superTypeField = getFieldToolkit().createJavaElementProposalField(parent, Texts.get("SuperType"),
+ new JavaElementAbstractTypeContentProvider(iCalendarItemProvider, m_declaringType.getJavaProject(), abstractCalendarItemProvider));
+ m_superTypeField.acceptProposal(m_superType);
+ m_superTypeField.addProposalAdapterListener(new IProposalAdapterListener() {
+ @Override
+ public void proposalAccepted(ContentProposalEvent event) {
+ m_superType = (IType) event.proposal;
+ pingStateChanging();
+ }
+ });
+
+ m_siblingField = getFieldToolkit().createSiblingProposalField(parent, m_declaringType, iCalendarItemProvider);
+ m_siblingField.acceptProposal(m_sibling);
+ m_siblingField.addProposalAdapterListener(new IProposalAdapterListener() {
+ @Override
+ public void proposalAccepted(ContentProposalEvent event) {
+ m_sibling = (SiblingProposal) event.proposal;
+ pingStateChanging();
+ }
+ });
+
+ // layout
+ parent.setLayout(new GridLayout(1, true));
+
+ m_typeNameField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ m_superTypeField.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 {
+ CalendarItemProviderNewOperation operation = new CalendarItemProviderNewOperation(m_declaringType);
+ operation.setFormatSource(true);
+ // write back members
+ operation.setTypeName(getTypeName());
+ IType superTypeProp = getSuperType();
+ if (superTypeProp != null) {
+ operation.setSuperTypeSignature(Signature.createTypeSignature(superTypeProp.getFullyQualifiedName(), true));
+ }
+
+ if (getSibling() == SiblingProposal.SIBLING_END) {
+ IStructuredType structuredType = ScoutTypeUtility.createStructuredCalendar(m_declaringType);
+ operation.setSibling(structuredType.getSibling(CATEGORIES.TYPE_CALENDAR_ITEM_PROVIDER));
+ }
+ else {
+ operation.setSibling(getSibling().getElement());
+ }
+ operation.validate();
+ operation.run(monitor, workingCopyManager);
+ m_createdField = operation.getCreatedField();
+ return true;
+ }
+
+ @Override
+ protected void validatePage(MultiStatus multiStatus) {
+ try {
+ multiStatus.add(getStatusNameField());
+ multiStatus.add(getStatusSuperType());
+ }
+ catch (JavaModelException e) {
+ ScoutSdkUi.logError("could not validate name field.", e);
+ }
+ }
+
+ protected IStatus getStatusNameField() throws JavaModelException {
+ if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_CALENDAR_ITEM_PROVIDER)) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
+ }
+ // check not allowed names
+ if (TypeUtility.exists(m_declaringType.getType(getTypeName()))) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
+ }
+ if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return Status.OK_STATUS;
+ }
+ else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
+ }
+ else {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
+ }
+ }
+
+ protected IStatus getStatusSuperType() throws JavaModelException {
+ if (getSuperType() == null) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("TheSuperTypeCanNotBeNull"));
+ }
+ return Status.OK_STATUS;
+ }
+
+ /**
+ * @return the createdField
+ */
+ public IType getCreatedField() {
+ return m_createdField;
+ }
+
+ 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) {
+ try {
+ setStateChanging(true);
+ m_superType = superType;
+ if (isControlCreated()) {
+ m_superTypeField.acceptProposal(superType);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ 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.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/checkbox/CheckboxFieldNewWizard.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/checkbox/CheckboxFieldNewWizard.java
index bbfa18acc..3fb298e68 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/checkbox/CheckboxFieldNewWizard.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/checkbox/CheckboxFieldNewWizard.java
@@ -1,46 +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.checkbox;
-
-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 CheckboxFieldNewWizard extends AbstractFormFieldWizard {
-
- private CheckboxFieldNewWizardPage m_page1;
-
- public CheckboxFieldNewWizard() {
- setWindowTitle(Texts.get("NewCheckboxField"));
- }
-
- @Override
- public void initWizard(IType declaringType) {
- super.initWizard(declaringType);
- m_page1 = new CheckboxFieldNewWizardPage(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);
- }
- }
-}
+/*******************************************************************************
+ * 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.checkbox;
+
+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 CheckboxFieldNewWizard extends AbstractFormFieldWizard {
+
+ private CheckboxFieldNewWizardPage m_page1;
+
+ public CheckboxFieldNewWizard() {
+ setWindowTitle(Texts.get("NewCheckboxField"));
+ }
+
+ @Override
+ public void initWizard(IType declaringType) {
+ super.initWizard(declaringType);
+ m_page1 = new CheckboxFieldNewWizardPage(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/checkbox/CheckboxFieldNewWizardPage.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/checkbox/CheckboxFieldNewWizardPage.java
index f3e671adf..e0936d118 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/checkbox/CheckboxFieldNewWizardPage.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/checkbox/CheckboxFieldNewWizardPage.java
@@ -1,249 +1,249 @@
-/*******************************************************************************
- * 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.checkbox;
-
-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.jdt.core.Signature;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.nls.sdk.model.INlsEntry;
-import org.eclipse.scout.sdk.RuntimeClasses;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.operation.form.field.CheckboxFieldNewOperation;
-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.Regex;
-import org.eclipse.scout.sdk.util.SdkProperties;
-import org.eclipse.scout.sdk.util.type.TypeFilters;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-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>BooleanFieldNewWizardPage</h3> ...
- */
-public class CheckboxFieldNewWizardPage extends AbstractWorkspaceWizardPage {
-
- final IType iCheckBox = TypeUtility.getType(RuntimeClasses.ICheckBox);
- final IType abstractCheckBox = TypeUtility.getType(RuntimeClasses.AbstractCheckBox);
-
- 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 CheckboxFieldNewWizardPage(IType declaringType) {
- super(CheckboxFieldNewWizardPage.class.getName());
- setTitle(Texts.get("NewCheckboxField"));
- setDescription(Texts.get("CreateANewCheckboxField"));
- m_declaringType = declaringType;
-
- setSuperType(abstractCheckBox);
- m_sibling = SiblingProposal.SIBLING_END;
- }
-
- @Override
- protected void createContent(Composite parent) {
-
- 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 {
- CheckboxFieldNewOperation operation = new CheckboxFieldNewOperation(m_declaringType);
- operation.setFormatSource(true);
- // write back members
- if (getNlsName() != null) {
- operation.setNlsEntry(getNlsName());
- }
- operation.setTypeName(getTypeName());
- if (getSuperType() != null) {
- operation.setSuperTypeSignature(Signature.createTypeSignature(getSuperType().getFullyQualifiedName(), true));
- }
- 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 {
- if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_FORM_FIELD)) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
- }
- // check not allowed names
- if (ScoutTypeUtility.getAllTypes(m_declaringType.getCompilationUnit(), TypeFilters.getRegexSimpleNameFilter(getTypeName())).length > 0) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
- }
- if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
- return Status.OK_STATUS;
- }
- else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
- return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
- }
- else {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
- }
- }
-
- /**
- * @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);
- }
- }
-}
+/*******************************************************************************
+ * 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.checkbox;
+
+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.jdt.core.Signature;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.nls.sdk.model.INlsEntry;
+import org.eclipse.scout.sdk.RuntimeClasses;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.operation.form.field.CheckboxFieldNewOperation;
+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.Regex;
+import org.eclipse.scout.sdk.util.SdkProperties;
+import org.eclipse.scout.sdk.util.type.TypeFilters;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+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>BooleanFieldNewWizardPage</h3> ...
+ */
+public class CheckboxFieldNewWizardPage extends AbstractWorkspaceWizardPage {
+
+ final IType iCheckBox = TypeUtility.getType(RuntimeClasses.ICheckBox);
+ final IType abstractCheckBox = TypeUtility.getType(RuntimeClasses.AbstractCheckBox);
+
+ 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 CheckboxFieldNewWizardPage(IType declaringType) {
+ super(CheckboxFieldNewWizardPage.class.getName());
+ setTitle(Texts.get("NewCheckboxField"));
+ setDescription(Texts.get("CreateANewCheckboxField"));
+ m_declaringType = declaringType;
+
+ setSuperType(abstractCheckBox);
+ m_sibling = SiblingProposal.SIBLING_END;
+ }
+
+ @Override
+ protected void createContent(Composite parent) {
+
+ 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 {
+ CheckboxFieldNewOperation operation = new CheckboxFieldNewOperation(m_declaringType);
+ operation.setFormatSource(true);
+ // write back members
+ if (getNlsName() != null) {
+ operation.setNlsEntry(getNlsName());
+ }
+ operation.setTypeName(getTypeName());
+ if (getSuperType() != null) {
+ operation.setSuperTypeSignature(Signature.createTypeSignature(getSuperType().getFullyQualifiedName(), true));
+ }
+ 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 {
+ if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_FORM_FIELD)) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
+ }
+ // check not allowed names
+ if (ScoutTypeUtility.getAllTypes(m_declaringType.getCompilationUnit(), TypeFilters.getRegexSimpleNameFilter(getTypeName())).length > 0) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
+ }
+ if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return Status.OK_STATUS;
+ }
+ else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
+ }
+ else {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
+ }
+ }
+
+ /**
+ * @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.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/composerfield/ComposerFieldNewWizard.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/composerfield/ComposerFieldNewWizard.java
index af55a2723..dc9674569 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/composerfield/ComposerFieldNewWizard.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/composerfield/ComposerFieldNewWizard.java
@@ -1,46 +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.composerfield;
-
-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 ComposerFieldNewWizard extends AbstractFormFieldWizard {
-
- private ComposerFieldNewWizardPage m_page1;
-
- public ComposerFieldNewWizard() {
- setWindowTitle(Texts.get("NewComposerField"));
- }
-
- @Override
- public void initWizard(IType declaringType) {
- super.initWizard(declaringType);
- m_page1 = new ComposerFieldNewWizardPage(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);
- }
- }
-}
+/*******************************************************************************
+ * 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.composerfield;
+
+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 ComposerFieldNewWizard extends AbstractFormFieldWizard {
+
+ private ComposerFieldNewWizardPage m_page1;
+
+ public ComposerFieldNewWizard() {
+ setWindowTitle(Texts.get("NewComposerField"));
+ }
+
+ @Override
+ public void initWizard(IType declaringType) {
+ super.initWizard(declaringType);
+ m_page1 = new ComposerFieldNewWizardPage(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/composerfield/ComposerFieldNewWizardPage.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/composerfield/ComposerFieldNewWizardPage.java
index 0ab463fa8..d858e4841 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/composerfield/ComposerFieldNewWizardPage.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/composerfield/ComposerFieldNewWizardPage.java
@@ -1,245 +1,245 @@
-/*******************************************************************************
- * 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.composerfield;
-
-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.jdt.core.Signature;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.nls.sdk.model.INlsEntry;
-import org.eclipse.scout.sdk.RuntimeClasses;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.operation.form.field.ComposerFieldNewOperation;
-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.Regex;
-import org.eclipse.scout.sdk.util.SdkProperties;
-import org.eclipse.scout.sdk.util.type.TypeFilters;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-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>ComposerFieldNewWizardPage</h3> ...
- */
-public class ComposerFieldNewWizardPage 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 ComposerFieldNewWizardPage(IType declaringType) {
- super(ComposerFieldNewWizardPage.class.getName());
- setTitle(Texts.get("NewCheckboxField"));
- setDescription(Texts.get("CreateANewComposerField"));
- m_declaringType = declaringType;
- setSuperType(TypeUtility.getType(RuntimeClasses.AbstractComposerField));
- m_sibling = SiblingProposal.SIBLING_END;
- }
-
- @Override
- protected void createContent(Composite parent) {
-
- 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 {
- ComposerFieldNewOperation operation = new ComposerFieldNewOperation(m_declaringType);
- operation.setFormatSource(true);
- // write back members
- if (getNlsName() != null) {
- operation.setNlsEntry(getNlsName());
- }
- operation.setTypeName(getTypeName());
- if (getSuperType() != null) {
- operation.setSuperTypeSignature(Signature.createTypeSignature(getSuperType().getFullyQualifiedName(), true));
- }
- 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 {
- if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_FORM_FIELD)) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
- }
- // check not allowed names
- if (ScoutTypeUtility.getAllTypes(m_declaringType.getCompilationUnit(), TypeFilters.getRegexSimpleNameFilter(getTypeName())).length > 0) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
- }
- if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
- return Status.OK_STATUS;
- }
- else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
- return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
- }
- else {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
- }
- }
-
- /**
- * @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);
- }
- }
-}
+/*******************************************************************************
+ * 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.composerfield;
+
+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.jdt.core.Signature;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.nls.sdk.model.INlsEntry;
+import org.eclipse.scout.sdk.RuntimeClasses;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.operation.form.field.ComposerFieldNewOperation;
+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.Regex;
+import org.eclipse.scout.sdk.util.SdkProperties;
+import org.eclipse.scout.sdk.util.type.TypeFilters;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+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>ComposerFieldNewWizardPage</h3> ...
+ */
+public class ComposerFieldNewWizardPage 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 ComposerFieldNewWizardPage(IType declaringType) {
+ super(ComposerFieldNewWizardPage.class.getName());
+ setTitle(Texts.get("NewCheckboxField"));
+ setDescription(Texts.get("CreateANewComposerField"));
+ m_declaringType = declaringType;
+ setSuperType(TypeUtility.getType(RuntimeClasses.AbstractComposerField));
+ m_sibling = SiblingProposal.SIBLING_END;
+ }
+
+ @Override
+ protected void createContent(Composite parent) {
+
+ 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 {
+ ComposerFieldNewOperation operation = new ComposerFieldNewOperation(m_declaringType);
+ operation.setFormatSource(true);
+ // write back members
+ if (getNlsName() != null) {
+ operation.setNlsEntry(getNlsName());
+ }
+ operation.setTypeName(getTypeName());
+ if (getSuperType() != null) {
+ operation.setSuperTypeSignature(Signature.createTypeSignature(getSuperType().getFullyQualifiedName(), true));
+ }
+ 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 {
+ if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_FORM_FIELD)) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
+ }
+ // check not allowed names
+ if (ScoutTypeUtility.getAllTypes(m_declaringType.getCompilationUnit(), TypeFilters.getRegexSimpleNameFilter(getTypeName())).length > 0) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
+ }
+ if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return Status.OK_STATUS;
+ }
+ else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
+ }
+ else {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
+ }
+ }
+
+ /**
+ * @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.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/composerfield/attribute/AttributeNewWizard.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/composerfield/attribute/AttributeNewWizard.java
index cf1a81cc0..ef24d5308 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/composerfield/attribute/AttributeNewWizard.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/composerfield/attribute/AttributeNewWizard.java
@@ -1,49 +1,49 @@
-/*******************************************************************************
- * 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.composerfield.attribute;
-
-import org.eclipse.jdt.core.IType;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-
-public class AttributeNewWizard extends AbstractWorkspaceWizard {
-
- private AttributeNewWizardPage m_page1;
- private IType m_declaringType;
-
- public AttributeNewWizard(IType declaringType) {
- setWindowTitle(Texts.get("NewAttribute"));
- m_declaringType = declaringType;
- }
-
- @Override
- public void addPages() {
- m_page1 = new AttributeNewWizardPage(getDeclaringType());
- addPage(m_page1);
- }
-
- /**
- * @return the declaringType
- */
- public IType getDeclaringType() {
- return m_declaringType;
- }
-
- @Override
- protected void postFinishDisplayThread() {
- IType createdField = m_page1.getCreatedAttribute();
- if (TypeUtility.exists(createdField)) {
- ScoutSdkUi.showJavaElementInEditor(createdField, false);
- }
- }
-}
+/*******************************************************************************
+ * 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.composerfield.attribute;
+
+import org.eclipse.jdt.core.IType;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+
+public class AttributeNewWizard extends AbstractWorkspaceWizard {
+
+ private AttributeNewWizardPage m_page1;
+ private IType m_declaringType;
+
+ public AttributeNewWizard(IType declaringType) {
+ setWindowTitle(Texts.get("NewAttribute"));
+ m_declaringType = declaringType;
+ }
+
+ @Override
+ public void addPages() {
+ m_page1 = new AttributeNewWizardPage(getDeclaringType());
+ addPage(m_page1);
+ }
+
+ /**
+ * @return the declaringType
+ */
+ public IType getDeclaringType() {
+ return m_declaringType;
+ }
+
+ @Override
+ protected void postFinishDisplayThread() {
+ IType createdField = m_page1.getCreatedAttribute();
+ 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/composerfield/attribute/AttributeNewWizardPage.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/composerfield/attribute/AttributeNewWizardPage.java
index fabdf926f..81811c61a 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/composerfield/attribute/AttributeNewWizardPage.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/composerfield/attribute/AttributeNewWizardPage.java
@@ -1,269 +1,269 @@
-/*******************************************************************************
- * 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.composerfield.attribute;
-
-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.jdt.core.Signature;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.nls.sdk.internal.ui.action.NlsProposal;
-import org.eclipse.scout.nls.sdk.model.INlsEntry;
-import org.eclipse.scout.sdk.RuntimeClasses;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.operation.form.field.composer.ComposerAttributeNewOperation;
-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.javaelement.JavaElementAbstractTypeContentProvider;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
-import org.eclipse.scout.sdk.util.Regex;
-import org.eclipse.scout.sdk.util.SdkProperties;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.type.IStructuredType;
-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>{@link AttributeNewWizardPage}</h3> ...
- *
- * @author Andreas Hoegger
- * @since 1.0.8 02.09.2010
- */
-public class AttributeNewWizardPage extends AbstractWorkspaceWizardPage {
-
- final IType iComposerAttribute = TypeUtility.getType(RuntimeClasses.IComposerAttribute);
- final IType abstractComposerAttribute = TypeUtility.getType(RuntimeClasses.AbstractComposerAttribute);
-
- /** {@link NlsProposal} **/
- public static final String PROP_NLS_NAME = "nlsName";
-
- /** {@link String} **/
- public static final String PROP_TYPE_NAME = "typeName";
- /** {@link IType} **/
- public static final String PROP_SUPER_TYPE = "superType";
-
- private ProposalTextField m_nlsNameField;
- private StyledTextField m_typeNameField;
- private ProposalTextField m_superTypeField;
-
- // process members
- private final IType m_declaringType;
- private IType m_createdAttribtue;
-
- public AttributeNewWizardPage(IType declaringType) {
- super(AttributeNewWizardPage.class.getName());
- setTitle(Texts.get("NewAttribute"));
- setDescription(Texts.get("CreateANewComposerFieldAttribute"));
- m_declaringType = declaringType;
-
- // default values
- IType superType = getSuperType();
- if (superType == null) {
- superType = abstractComposerAttribute;
- }
- setSuperTypeInternal(superType);
- }
-
- @Override
- protected void createContent(Composite parent) {
-
- m_nlsNameField = getFieldToolkit().createNlsProposalTextField(parent, ScoutTypeUtility.findNlsProject(m_declaringType), Texts.get("Name"));
- m_nlsNameField.acceptProposal(getNlsName());
- m_nlsNameField.addProposalAdapterListener(new IProposalAdapterListener() {
- @Override
- public void proposalAccepted(ContentProposalEvent event) {
- try {
- setStateChanging(true);
- INlsEntry oldEntry = getNlsName();
- INlsEntry newEntry = (INlsEntry) event.proposal;
- setNlsNameInternal(newEntry);
- if (newEntry != null) {
- if (oldEntry == null || oldEntry.getKey().equals(m_typeNameField.getModifiableText()) || StringUtility.isNullOrEmpty(m_typeNameField.getModifiableText())) {
- m_typeNameField.setText(newEntry.getKey());
- }
- }
- }
- finally {
- setStateChanging(false);
- }
- }
- });
-
- m_typeNameField = getFieldToolkit().createStyledTextField(parent, Texts.get("TypeName"));
- m_typeNameField.setReadOnlySuffix(SdkProperties.SUFFIX_COMPOSER_ATTRIBUTE);
- m_typeNameField.setText(getTypeName());
- m_typeNameField.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- setTypeNameInternal(m_typeNameField.getText());
- pingStateChanging();
- }
- });
-
- m_superTypeField = getFieldToolkit().createJavaElementProposalField(parent, Texts.get("SuperType"),
- new JavaElementAbstractTypeContentProvider(iComposerAttribute, m_declaringType.getJavaProject(), abstractComposerAttribute));
- m_superTypeField.acceptProposal(getSuperType());
- m_superTypeField.addProposalAdapterListener(new IProposalAdapterListener() {
- @Override
- public void proposalAccepted(ContentProposalEvent event) {
- setSuperTypeInternal((IType) event.proposal);
- pingStateChanging();
- }
- });
-
- // 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_superTypeField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- }
-
- @Override
- public boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
- ComposerAttributeNewOperation operation = new ComposerAttributeNewOperation(m_declaringType);
-
- // write back members
- if (getNlsName() != null) {
- operation.setNlsEntry(getNlsName());
- }
- operation.setTypeName(getTypeName());
- IType superTypeProp = getSuperType();
- if (superTypeProp != null) {
- operation.setSuperTypeSignature(Signature.createTypeSignature(superTypeProp.getFullyQualifiedName(), true));
- }
- IStructuredType structuredType = ScoutTypeUtility.createStructuredComposer(m_declaringType);
- operation.setSibling(structuredType.getSiblingComposerAttribute(getTypeName()));
- operation.run(monitor, workingCopyManager);
- m_createdAttribtue = operation.getCreatedAttribute();
- return true;
- }
-
- @Override
- protected void validatePage(MultiStatus multiStatus) {
- try {
- multiStatus.add(getStatusNameField());
- multiStatus.add(getStatusSuperType());
- }
- catch (JavaModelException e) {
- ScoutSdkUi.logError("could not validate name field.", e);
- }
- }
-
- protected IStatus getStatusNameField() throws JavaModelException {
- if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_COMPOSER_ATTRIBUTE)) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
- }
- // check not allowed names
- if (TypeUtility.exists(m_declaringType.getType(getTypeName()))) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
- }
- if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
- return Status.OK_STATUS;
- }
- else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
- return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
- }
- else {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
- }
- }
-
- protected IStatus getStatusSuperType() throws JavaModelException {
- if (getSuperType() == null) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("TheSuperTypeCanNotBeNull"));
- }
- return Status.OK_STATUS;
- }
-
- /**
- * @return the createdWizardStep
- */
- public IType getCreatedAttribute() {
- return m_createdAttribtue;
- }
-
- public INlsEntry getNlsName() {
- return (INlsEntry) getProperty(PROP_NLS_NAME);
- }
-
- public void setNlsName(INlsEntry nlsName) {
- try {
- setStateChanging(true);
- setNlsNameInternal(nlsName);
- if (isControlCreated()) {
- m_nlsNameField.acceptProposal(nlsName);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setNlsNameInternal(INlsEntry nlsName) {
- setProperty(PROP_NLS_NAME, nlsName);
- }
-
- public String getTypeName() {
- return getPropertyString(PROP_TYPE_NAME);
- }
-
- public void setTypeName(String typeName) {
- try {
- setStateChanging(true);
- setTypeNameInternal(typeName);
- if (isControlCreated()) {
- m_typeNameField.setText(typeName);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setTypeNameInternal(String typeName) {
- setPropertyString(PROP_TYPE_NAME, typeName);
- }
-
- public IType getSuperType() {
- return (IType) getProperty(PROP_SUPER_TYPE);
- }
-
- public void setSuperType(IType superType) {
- try {
- setStateChanging(true);
- setSuperTypeInternal(superType);
- if (isControlCreated()) {
- m_superTypeField.acceptProposal(superType);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setSuperTypeInternal(IType superType) {
- setProperty(PROP_SUPER_TYPE, superType);
- }
-
-}
+/*******************************************************************************
+ * 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.composerfield.attribute;
+
+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.jdt.core.Signature;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.nls.sdk.internal.ui.action.NlsProposal;
+import org.eclipse.scout.nls.sdk.model.INlsEntry;
+import org.eclipse.scout.sdk.RuntimeClasses;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.operation.form.field.composer.ComposerAttributeNewOperation;
+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.javaelement.JavaElementAbstractTypeContentProvider;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
+import org.eclipse.scout.sdk.util.Regex;
+import org.eclipse.scout.sdk.util.SdkProperties;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.type.IStructuredType;
+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>{@link AttributeNewWizardPage}</h3> ...
+ *
+ * @author Andreas Hoegger
+ * @since 1.0.8 02.09.2010
+ */
+public class AttributeNewWizardPage extends AbstractWorkspaceWizardPage {
+
+ final IType iComposerAttribute = TypeUtility.getType(RuntimeClasses.IComposerAttribute);
+ final IType abstractComposerAttribute = TypeUtility.getType(RuntimeClasses.AbstractComposerAttribute);
+
+ /** {@link NlsProposal} **/
+ public static final String PROP_NLS_NAME = "nlsName";
+
+ /** {@link String} **/
+ public static final String PROP_TYPE_NAME = "typeName";
+ /** {@link IType} **/
+ public static final String PROP_SUPER_TYPE = "superType";
+
+ private ProposalTextField m_nlsNameField;
+ private StyledTextField m_typeNameField;
+ private ProposalTextField m_superTypeField;
+
+ // process members
+ private final IType m_declaringType;
+ private IType m_createdAttribtue;
+
+ public AttributeNewWizardPage(IType declaringType) {
+ super(AttributeNewWizardPage.class.getName());
+ setTitle(Texts.get("NewAttribute"));
+ setDescription(Texts.get("CreateANewComposerFieldAttribute"));
+ m_declaringType = declaringType;
+
+ // default values
+ IType superType = getSuperType();
+ if (superType == null) {
+ superType = abstractComposerAttribute;
+ }
+ setSuperTypeInternal(superType);
+ }
+
+ @Override
+ protected void createContent(Composite parent) {
+
+ m_nlsNameField = getFieldToolkit().createNlsProposalTextField(parent, ScoutTypeUtility.findNlsProject(m_declaringType), Texts.get("Name"));
+ m_nlsNameField.acceptProposal(getNlsName());
+ m_nlsNameField.addProposalAdapterListener(new IProposalAdapterListener() {
+ @Override
+ public void proposalAccepted(ContentProposalEvent event) {
+ try {
+ setStateChanging(true);
+ INlsEntry oldEntry = getNlsName();
+ INlsEntry newEntry = (INlsEntry) event.proposal;
+ setNlsNameInternal(newEntry);
+ if (newEntry != null) {
+ if (oldEntry == null || oldEntry.getKey().equals(m_typeNameField.getModifiableText()) || StringUtility.isNullOrEmpty(m_typeNameField.getModifiableText())) {
+ m_typeNameField.setText(newEntry.getKey());
+ }
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+ });
+
+ m_typeNameField = getFieldToolkit().createStyledTextField(parent, Texts.get("TypeName"));
+ m_typeNameField.setReadOnlySuffix(SdkProperties.SUFFIX_COMPOSER_ATTRIBUTE);
+ m_typeNameField.setText(getTypeName());
+ m_typeNameField.addModifyListener(new ModifyListener() {
+ @Override
+ public void modifyText(ModifyEvent e) {
+ setTypeNameInternal(m_typeNameField.getText());
+ pingStateChanging();
+ }
+ });
+
+ m_superTypeField = getFieldToolkit().createJavaElementProposalField(parent, Texts.get("SuperType"),
+ new JavaElementAbstractTypeContentProvider(iComposerAttribute, m_declaringType.getJavaProject(), abstractComposerAttribute));
+ m_superTypeField.acceptProposal(getSuperType());
+ m_superTypeField.addProposalAdapterListener(new IProposalAdapterListener() {
+ @Override
+ public void proposalAccepted(ContentProposalEvent event) {
+ setSuperTypeInternal((IType) event.proposal);
+ pingStateChanging();
+ }
+ });
+
+ // 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_superTypeField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ }
+
+ @Override
+ public boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
+ ComposerAttributeNewOperation operation = new ComposerAttributeNewOperation(m_declaringType);
+
+ // write back members
+ if (getNlsName() != null) {
+ operation.setNlsEntry(getNlsName());
+ }
+ operation.setTypeName(getTypeName());
+ IType superTypeProp = getSuperType();
+ if (superTypeProp != null) {
+ operation.setSuperTypeSignature(Signature.createTypeSignature(superTypeProp.getFullyQualifiedName(), true));
+ }
+ IStructuredType structuredType = ScoutTypeUtility.createStructuredComposer(m_declaringType);
+ operation.setSibling(structuredType.getSiblingComposerAttribute(getTypeName()));
+ operation.run(monitor, workingCopyManager);
+ m_createdAttribtue = operation.getCreatedAttribute();
+ return true;
+ }
+
+ @Override
+ protected void validatePage(MultiStatus multiStatus) {
+ try {
+ multiStatus.add(getStatusNameField());
+ multiStatus.add(getStatusSuperType());
+ }
+ catch (JavaModelException e) {
+ ScoutSdkUi.logError("could not validate name field.", e);
+ }
+ }
+
+ protected IStatus getStatusNameField() throws JavaModelException {
+ if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_COMPOSER_ATTRIBUTE)) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
+ }
+ // check not allowed names
+ if (TypeUtility.exists(m_declaringType.getType(getTypeName()))) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
+ }
+ if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return Status.OK_STATUS;
+ }
+ else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
+ }
+ else {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
+ }
+ }
+
+ protected IStatus getStatusSuperType() throws JavaModelException {
+ if (getSuperType() == null) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("TheSuperTypeCanNotBeNull"));
+ }
+ return Status.OK_STATUS;
+ }
+
+ /**
+ * @return the createdWizardStep
+ */
+ public IType getCreatedAttribute() {
+ return m_createdAttribtue;
+ }
+
+ public INlsEntry getNlsName() {
+ return (INlsEntry) getProperty(PROP_NLS_NAME);
+ }
+
+ public void setNlsName(INlsEntry nlsName) {
+ try {
+ setStateChanging(true);
+ setNlsNameInternal(nlsName);
+ if (isControlCreated()) {
+ m_nlsNameField.acceptProposal(nlsName);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setNlsNameInternal(INlsEntry nlsName) {
+ setProperty(PROP_NLS_NAME, nlsName);
+ }
+
+ public String getTypeName() {
+ return getPropertyString(PROP_TYPE_NAME);
+ }
+
+ public void setTypeName(String typeName) {
+ try {
+ setStateChanging(true);
+ setTypeNameInternal(typeName);
+ if (isControlCreated()) {
+ m_typeNameField.setText(typeName);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setTypeNameInternal(String typeName) {
+ setPropertyString(PROP_TYPE_NAME, typeName);
+ }
+
+ public IType getSuperType() {
+ return (IType) getProperty(PROP_SUPER_TYPE);
+ }
+
+ public void setSuperType(IType superType) {
+ try {
+ setStateChanging(true);
+ setSuperTypeInternal(superType);
+ if (isControlCreated()) {
+ m_superTypeField.acceptProposal(superType);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setSuperTypeInternal(IType superType) {
+ setProperty(PROP_SUPER_TYPE, superType);
+ }
+
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/composerfield/entity/EntityNewWizard.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/composerfield/entity/EntityNewWizard.java
index 6c81b36be..e8b21acfc 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/composerfield/entity/EntityNewWizard.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/composerfield/entity/EntityNewWizard.java
@@ -1,50 +1,50 @@
-/*******************************************************************************
- * 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.composerfield.entity;
-
-import org.eclipse.jdt.core.IType;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-
-public class EntityNewWizard extends AbstractWorkspaceWizard {
-
- private EntityNewWizardPage m_page1;
- private IType m_declaringType;
-
- public EntityNewWizard(IType declaringType) {
- setWindowTitle(Texts.get("NewComposerFieldEntity"));
- m_declaringType = declaringType;
-
- }
-
- @Override
- public void addPages() {
- m_page1 = new EntityNewWizardPage(getDeclaringType());
- addPage(m_page1);
- }
-
- /**
- * @return the declaringType
- */
- public IType getDeclaringType() {
- return m_declaringType;
- }
-
- @Override
- protected void postFinishDisplayThread() {
- IType createdField = m_page1.getCreatedEntity();
- if (TypeUtility.exists(createdField)) {
- ScoutSdkUi.showJavaElementInEditor(createdField, false);
- }
- }
-}
+/*******************************************************************************
+ * 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.composerfield.entity;
+
+import org.eclipse.jdt.core.IType;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+
+public class EntityNewWizard extends AbstractWorkspaceWizard {
+
+ private EntityNewWizardPage m_page1;
+ private IType m_declaringType;
+
+ public EntityNewWizard(IType declaringType) {
+ setWindowTitle(Texts.get("NewComposerFieldEntity"));
+ m_declaringType = declaringType;
+
+ }
+
+ @Override
+ public void addPages() {
+ m_page1 = new EntityNewWizardPage(getDeclaringType());
+ addPage(m_page1);
+ }
+
+ /**
+ * @return the declaringType
+ */
+ public IType getDeclaringType() {
+ return m_declaringType;
+ }
+
+ @Override
+ protected void postFinishDisplayThread() {
+ IType createdField = m_page1.getCreatedEntity();
+ 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/composerfield/entity/EntityNewWizardPage.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/composerfield/entity/EntityNewWizardPage.java
index 8f3bd821a..dc187c95d 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/composerfield/entity/EntityNewWizardPage.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/composerfield/entity/EntityNewWizardPage.java
@@ -1,263 +1,263 @@
-/*******************************************************************************
- * 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.composerfield.entity;
-
-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.jdt.core.Signature;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.nls.sdk.internal.ui.action.NlsProposal;
-import org.eclipse.scout.nls.sdk.model.INlsEntry;
-import org.eclipse.scout.sdk.RuntimeClasses;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.operation.form.field.composer.ComposerEntityNewOperation;
-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.javaelement.JavaElementAbstractTypeContentProvider;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
-import org.eclipse.scout.sdk.util.Regex;
-import org.eclipse.scout.sdk.util.SdkProperties;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.type.IStructuredType;
-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>{@link EntityNewWizardPage}</h3> ...
- *
- * @author Andreas Hoegger
- * @since 1.0.8 02.09.2010
- */
-public class EntityNewWizardPage extends AbstractWorkspaceWizardPage {
-
- final IType iComposerEntity = TypeUtility.getType(RuntimeClasses.IComposerEntity);
- final IType abstractComposerEntity = TypeUtility.getType(RuntimeClasses.AbstractComposerEntity);
-
- /** {@link NlsProposal} **/
- public static final String PROP_NLS_NAME = "nlsName";
-
- /** {@link String} **/
- public static final String PROP_TYPE_NAME = "typeName";
- /** {@link IType} **/
- public static final String PROP_SUPER_TYPE = "superType";
-
- private ProposalTextField m_nlsNameField;
- private StyledTextField m_typeNameField;
- private ProposalTextField m_superTypeField;
-
- // process members
- private final IType m_declaringType;
- private IType m_createdEntity;
-
- public EntityNewWizardPage(IType declaringType) {
- super(EntityNewWizardPage.class.getName());
- setTitle(Texts.get("NewComposerFieldEntity"));
- setDescription(Texts.get("CreateANewComposerFieldEntity"));
- m_declaringType = declaringType;
-
- // default values
- IType superType = getSuperType();
- if (superType == null) {
- superType = abstractComposerEntity;
- }
- setSuperTypeInternal(superType);
- }
-
- @Override
- protected void createContent(Composite parent) {
-
- m_nlsNameField = getFieldToolkit().createNlsProposalTextField(parent, ScoutTypeUtility.findNlsProject(m_declaringType), Texts.get("Name"));
- m_nlsNameField.acceptProposal(getNlsName());
- m_nlsNameField.addProposalAdapterListener(new IProposalAdapterListener() {
- @Override
- public void proposalAccepted(ContentProposalEvent event) {
- try {
- setStateChanging(true);
- INlsEntry oldEntry = getNlsName();
- INlsEntry newEntry = (INlsEntry) event.proposal;
- setNlsNameInternal(newEntry);
- if (newEntry != null) {
- if (oldEntry == null || oldEntry.getKey().equals(m_typeNameField.getModifiableText()) || StringUtility.isNullOrEmpty(m_typeNameField.getModifiableText())) {
- m_typeNameField.setText(newEntry.getKey());
- }
- }
- }
- finally {
- setStateChanging(false);
- }
- }
- });
-
- m_typeNameField = getFieldToolkit().createStyledTextField(parent, Texts.get("TypeName"));
- m_typeNameField.setReadOnlySuffix(SdkProperties.SUFFIX_COMPOSER_ENTRY);
- m_typeNameField.setText(getTypeName());
- m_typeNameField.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- setTypeNameInternal(m_typeNameField.getText());
- pingStateChanging();
- }
- });
-
- m_superTypeField = getFieldToolkit().createJavaElementProposalField(parent, Texts.get("SuperType"),
- new JavaElementAbstractTypeContentProvider(iComposerEntity, m_declaringType.getJavaProject(), abstractComposerEntity));
- m_superTypeField.acceptProposal(getSuperType());
- m_superTypeField.addProposalAdapterListener(new IProposalAdapterListener() {
- @Override
- public void proposalAccepted(ContentProposalEvent event) {
- setSuperTypeInternal((IType) event.proposal);
- pingStateChanging();
- }
- });
-
- // 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_superTypeField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- }
-
- @Override
- public boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
- ComposerEntityNewOperation operation = new ComposerEntityNewOperation(m_declaringType);
-
- // write back members
- operation.setNlsEntry(getNlsName());
- operation.setTypeName(getTypeName());
- if (getSuperType() != null) {
- operation.setSuperTypeSignature(Signature.createTypeSignature(getSuperType().getFullyQualifiedName(), true));
- }
- IStructuredType structuredType = ScoutTypeUtility.createStructuredComposer(m_declaringType);
- operation.setSibling(structuredType.getSiblingComposerEntity(getTypeName()));
- operation.run(monitor, workingCopyManager);
- m_createdEntity = operation.getCreatedEntry();
- return true;
- }
-
- @Override
- protected void validatePage(MultiStatus multiStatus) {
- try {
- multiStatus.add(getStatusNameField());
- multiStatus.add(getStatusSuperType());
- }
- catch (JavaModelException e) {
- ScoutSdkUi.logError("could not validate name field.", e);
- }
- }
-
- protected IStatus getStatusNameField() throws JavaModelException {
- if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_COMPOSER_ENTRY)) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
- }
- // check not allowed names
- if (TypeUtility.exists(m_declaringType.getType(getTypeName()))) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
- }
- if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
- return Status.OK_STATUS;
- }
- else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
- return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
- }
- else {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
- }
- }
-
- protected IStatus getStatusSuperType() throws JavaModelException {
- if (getSuperType() == null) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("TheSuperTypeCanNotBeNull"));
- }
- return Status.OK_STATUS;
- }
-
- public IType getCreatedEntity() {
- return m_createdEntity;
- }
-
- public INlsEntry getNlsName() {
- return (INlsEntry) getProperty(PROP_NLS_NAME);
- }
-
- public void setNlsName(INlsEntry nlsName) {
- try {
- setStateChanging(true);
- setNlsNameInternal(nlsName);
- if (isControlCreated()) {
- m_nlsNameField.acceptProposal(nlsName);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setNlsNameInternal(INlsEntry nlsName) {
- setProperty(PROP_NLS_NAME, nlsName);
- }
-
- public String getTypeName() {
- return getPropertyString(PROP_TYPE_NAME);
- }
-
- public void setTypeName(String typeName) {
- try {
- setStateChanging(true);
- setTypeNameInternal(typeName);
- if (isControlCreated()) {
- m_typeNameField.setText(typeName);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setTypeNameInternal(String typeName) {
- setPropertyString(PROP_TYPE_NAME, typeName);
- }
-
- public IType getSuperType() {
- return (IType) getProperty(PROP_SUPER_TYPE);
- }
-
- public void setSuperType(IType superType) {
- try {
- setStateChanging(true);
- setSuperTypeInternal(superType);
- if (isControlCreated()) {
- m_superTypeField.acceptProposal(superType);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setSuperTypeInternal(IType superType) {
- setProperty(PROP_SUPER_TYPE, superType);
- }
-
-}
+/*******************************************************************************
+ * 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.composerfield.entity;
+
+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.jdt.core.Signature;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.nls.sdk.internal.ui.action.NlsProposal;
+import org.eclipse.scout.nls.sdk.model.INlsEntry;
+import org.eclipse.scout.sdk.RuntimeClasses;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.operation.form.field.composer.ComposerEntityNewOperation;
+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.javaelement.JavaElementAbstractTypeContentProvider;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
+import org.eclipse.scout.sdk.util.Regex;
+import org.eclipse.scout.sdk.util.SdkProperties;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.type.IStructuredType;
+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>{@link EntityNewWizardPage}</h3> ...
+ *
+ * @author Andreas Hoegger
+ * @since 1.0.8 02.09.2010
+ */
+public class EntityNewWizardPage extends AbstractWorkspaceWizardPage {
+
+ final IType iComposerEntity = TypeUtility.getType(RuntimeClasses.IComposerEntity);
+ final IType abstractComposerEntity = TypeUtility.getType(RuntimeClasses.AbstractComposerEntity);
+
+ /** {@link NlsProposal} **/
+ public static final String PROP_NLS_NAME = "nlsName";
+
+ /** {@link String} **/
+ public static final String PROP_TYPE_NAME = "typeName";
+ /** {@link IType} **/
+ public static final String PROP_SUPER_TYPE = "superType";
+
+ private ProposalTextField m_nlsNameField;
+ private StyledTextField m_typeNameField;
+ private ProposalTextField m_superTypeField;
+
+ // process members
+ private final IType m_declaringType;
+ private IType m_createdEntity;
+
+ public EntityNewWizardPage(IType declaringType) {
+ super(EntityNewWizardPage.class.getName());
+ setTitle(Texts.get("NewComposerFieldEntity"));
+ setDescription(Texts.get("CreateANewComposerFieldEntity"));
+ m_declaringType = declaringType;
+
+ // default values
+ IType superType = getSuperType();
+ if (superType == null) {
+ superType = abstractComposerEntity;
+ }
+ setSuperTypeInternal(superType);
+ }
+
+ @Override
+ protected void createContent(Composite parent) {
+
+ m_nlsNameField = getFieldToolkit().createNlsProposalTextField(parent, ScoutTypeUtility.findNlsProject(m_declaringType), Texts.get("Name"));
+ m_nlsNameField.acceptProposal(getNlsName());
+ m_nlsNameField.addProposalAdapterListener(new IProposalAdapterListener() {
+ @Override
+ public void proposalAccepted(ContentProposalEvent event) {
+ try {
+ setStateChanging(true);
+ INlsEntry oldEntry = getNlsName();
+ INlsEntry newEntry = (INlsEntry) event.proposal;
+ setNlsNameInternal(newEntry);
+ if (newEntry != null) {
+ if (oldEntry == null || oldEntry.getKey().equals(m_typeNameField.getModifiableText()) || StringUtility.isNullOrEmpty(m_typeNameField.getModifiableText())) {
+ m_typeNameField.setText(newEntry.getKey());
+ }
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+ });
+
+ m_typeNameField = getFieldToolkit().createStyledTextField(parent, Texts.get("TypeName"));
+ m_typeNameField.setReadOnlySuffix(SdkProperties.SUFFIX_COMPOSER_ENTRY);
+ m_typeNameField.setText(getTypeName());
+ m_typeNameField.addModifyListener(new ModifyListener() {
+ @Override
+ public void modifyText(ModifyEvent e) {
+ setTypeNameInternal(m_typeNameField.getText());
+ pingStateChanging();
+ }
+ });
+
+ m_superTypeField = getFieldToolkit().createJavaElementProposalField(parent, Texts.get("SuperType"),
+ new JavaElementAbstractTypeContentProvider(iComposerEntity, m_declaringType.getJavaProject(), abstractComposerEntity));
+ m_superTypeField.acceptProposal(getSuperType());
+ m_superTypeField.addProposalAdapterListener(new IProposalAdapterListener() {
+ @Override
+ public void proposalAccepted(ContentProposalEvent event) {
+ setSuperTypeInternal((IType) event.proposal);
+ pingStateChanging();
+ }
+ });
+
+ // 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_superTypeField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ }
+
+ @Override
+ public boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
+ ComposerEntityNewOperation operation = new ComposerEntityNewOperation(m_declaringType);
+
+ // write back members
+ operation.setNlsEntry(getNlsName());
+ operation.setTypeName(getTypeName());
+ if (getSuperType() != null) {
+ operation.setSuperTypeSignature(Signature.createTypeSignature(getSuperType().getFullyQualifiedName(), true));
+ }
+ IStructuredType structuredType = ScoutTypeUtility.createStructuredComposer(m_declaringType);
+ operation.setSibling(structuredType.getSiblingComposerEntity(getTypeName()));
+ operation.run(monitor, workingCopyManager);
+ m_createdEntity = operation.getCreatedEntry();
+ return true;
+ }
+
+ @Override
+ protected void validatePage(MultiStatus multiStatus) {
+ try {
+ multiStatus.add(getStatusNameField());
+ multiStatus.add(getStatusSuperType());
+ }
+ catch (JavaModelException e) {
+ ScoutSdkUi.logError("could not validate name field.", e);
+ }
+ }
+
+ protected IStatus getStatusNameField() throws JavaModelException {
+ if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_COMPOSER_ENTRY)) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
+ }
+ // check not allowed names
+ if (TypeUtility.exists(m_declaringType.getType(getTypeName()))) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
+ }
+ if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return Status.OK_STATUS;
+ }
+ else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
+ }
+ else {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
+ }
+ }
+
+ protected IStatus getStatusSuperType() throws JavaModelException {
+ if (getSuperType() == null) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("TheSuperTypeCanNotBeNull"));
+ }
+ return Status.OK_STATUS;
+ }
+
+ public IType getCreatedEntity() {
+ return m_createdEntity;
+ }
+
+ public INlsEntry getNlsName() {
+ return (INlsEntry) getProperty(PROP_NLS_NAME);
+ }
+
+ public void setNlsName(INlsEntry nlsName) {
+ try {
+ setStateChanging(true);
+ setNlsNameInternal(nlsName);
+ if (isControlCreated()) {
+ m_nlsNameField.acceptProposal(nlsName);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setNlsNameInternal(INlsEntry nlsName) {
+ setProperty(PROP_NLS_NAME, nlsName);
+ }
+
+ public String getTypeName() {
+ return getPropertyString(PROP_TYPE_NAME);
+ }
+
+ public void setTypeName(String typeName) {
+ try {
+ setStateChanging(true);
+ setTypeNameInternal(typeName);
+ if (isControlCreated()) {
+ m_typeNameField.setText(typeName);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setTypeNameInternal(String typeName) {
+ setPropertyString(PROP_TYPE_NAME, typeName);
+ }
+
+ public IType getSuperType() {
+ return (IType) getProperty(PROP_SUPER_TYPE);
+ }
+
+ public void setSuperType(IType superType) {
+ try {
+ setStateChanging(true);
+ setSuperTypeInternal(superType);
+ if (isControlCreated()) {
+ m_superTypeField.acceptProposal(superType);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setSuperTypeInternal(IType superType) {
+ setProperty(PROP_SUPER_TYPE, superType);
+ }
+
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/datefield/DateFieldNewWizard.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/datefield/DateFieldNewWizard.java
index 5220a7972..d7bb7a569 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/datefield/DateFieldNewWizard.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/datefield/DateFieldNewWizard.java
@@ -1,46 +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.datefield;
-
-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 DateFieldNewWizard extends AbstractFormFieldWizard {
-
- private DateFieldNewWizardPage m_page1;
-
- public DateFieldNewWizard() {
- setWindowTitle(Texts.get("NewDateField"));
- }
-
- @Override
- public void initWizard(IType declaringType) {
- super.initWizard(declaringType);
- m_page1 = new DateFieldNewWizardPage(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);
- }
- }
-}
+/*******************************************************************************
+ * 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.datefield;
+
+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 DateFieldNewWizard extends AbstractFormFieldWizard {
+
+ private DateFieldNewWizardPage m_page1;
+
+ public DateFieldNewWizard() {
+ setWindowTitle(Texts.get("NewDateField"));
+ }
+
+ @Override
+ public void initWizard(IType declaringType) {
+ super.initWizard(declaringType);
+ m_page1 = new DateFieldNewWizardPage(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/datefield/DateFieldNewWizardPage.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/datefield/DateFieldNewWizardPage.java
index 4addd826f..6e0f9f9fc 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/datefield/DateFieldNewWizardPage.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/datefield/DateFieldNewWizardPage.java
@@ -1,246 +1,246 @@
-/*******************************************************************************
- * 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.datefield;
-
-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.jdt.core.Signature;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.nls.sdk.model.INlsEntry;
-import org.eclipse.scout.sdk.RuntimeClasses;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.operation.form.field.DateFieldNewOperation;
-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.Regex;
-import org.eclipse.scout.sdk.util.SdkProperties;
-import org.eclipse.scout.sdk.util.type.TypeFilters;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-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> {@link DateFieldNewWizardPage}</h3> ...
- */
-public class DateFieldNewWizardPage 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 DateFieldNewWizardPage(IType declaringType) {
- super(DateFieldNewWizardPage.class.getName());
- m_declaringType = declaringType;
- setSuperType(TypeUtility.getType(RuntimeClasses.AbstractDateField));
- m_sibling = SiblingProposal.SIBLING_END;
- }
-
- @Override
- protected void createContent(Composite parent) {
- setTitle(Texts.get("New DateField"));
- setDescription(Texts.get("CreateANewDateField"));
-
- 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 {
- DateFieldNewOperation operation = new DateFieldNewOperation(m_declaringType);
- operation.setFormatSource(true);
- // write back members
- if (getNlsName() != null) {
- operation.setNlsEntry(getNlsName());
- }
- operation.setTypeName(getTypeName());
- if (getSuperType() != null) {
- operation.setSuperTypeSignature(Signature.createTypeSignature(getSuperType().getFullyQualifiedName(), true));
- }
- 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 {
- if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_FORM_FIELD)) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
- }
- // check not allowed names
- if (ScoutTypeUtility.getAllTypes(m_declaringType.getCompilationUnit(), TypeFilters.getRegexSimpleNameFilter(getTypeName())).length > 0) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
- }
- if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
- return Status.OK_STATUS;
- }
- else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
- return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
- }
- else {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
- }
- }
-
- /**
- * @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);
- }
- }
-}
+/*******************************************************************************
+ * 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.datefield;
+
+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.jdt.core.Signature;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.nls.sdk.model.INlsEntry;
+import org.eclipse.scout.sdk.RuntimeClasses;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.operation.form.field.DateFieldNewOperation;
+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.Regex;
+import org.eclipse.scout.sdk.util.SdkProperties;
+import org.eclipse.scout.sdk.util.type.TypeFilters;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+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> {@link DateFieldNewWizardPage}</h3> ...
+ */
+public class DateFieldNewWizardPage 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 DateFieldNewWizardPage(IType declaringType) {
+ super(DateFieldNewWizardPage.class.getName());
+ m_declaringType = declaringType;
+ setSuperType(TypeUtility.getType(RuntimeClasses.AbstractDateField));
+ m_sibling = SiblingProposal.SIBLING_END;
+ }
+
+ @Override
+ protected void createContent(Composite parent) {
+ setTitle(Texts.get("New DateField"));
+ setDescription(Texts.get("CreateANewDateField"));
+
+ 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 {
+ DateFieldNewOperation operation = new DateFieldNewOperation(m_declaringType);
+ operation.setFormatSource(true);
+ // write back members
+ if (getNlsName() != null) {
+ operation.setNlsEntry(getNlsName());
+ }
+ operation.setTypeName(getTypeName());
+ if (getSuperType() != null) {
+ operation.setSuperTypeSignature(Signature.createTypeSignature(getSuperType().getFullyQualifiedName(), true));
+ }
+ 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 {
+ if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_FORM_FIELD)) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
+ }
+ // check not allowed names
+ if (ScoutTypeUtility.getAllTypes(m_declaringType.getCompilationUnit(), TypeFilters.getRegexSimpleNameFilter(getTypeName())).length > 0) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
+ }
+ if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return Status.OK_STATUS;
+ }
+ else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
+ }
+ else {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
+ }
+ }
+
+ /**
+ * @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.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/doublefield/DoubleFieldNewWizard.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/doublefield/DoubleFieldNewWizard.java
index 6b8df797e..389a06708 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/doublefield/DoubleFieldNewWizard.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/doublefield/DoubleFieldNewWizard.java
@@ -1,46 +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.doublefield;
-
-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 DoubleFieldNewWizard extends AbstractFormFieldWizard {
-
- private DoubleFieldNewWizardPage m_page1;
-
- public DoubleFieldNewWizard() {
- setWindowTitle(Texts.get("NewDoubleField"));
- }
-
- @Override
- public void initWizard(IType declaringType) {
- super.initWizard(declaringType);
- m_page1 = new DoubleFieldNewWizardPage(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);
- }
- }
-}
+/*******************************************************************************
+ * 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.doublefield;
+
+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 DoubleFieldNewWizard extends AbstractFormFieldWizard {
+
+ private DoubleFieldNewWizardPage m_page1;
+
+ public DoubleFieldNewWizard() {
+ setWindowTitle(Texts.get("NewDoubleField"));
+ }
+
+ @Override
+ public void initWizard(IType declaringType) {
+ super.initWizard(declaringType);
+ m_page1 = new DoubleFieldNewWizardPage(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/doublefield/DoubleFieldNewWizardPage.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/doublefield/DoubleFieldNewWizardPage.java
index 5874949c7..a8a6dac35 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/doublefield/DoubleFieldNewWizardPage.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/doublefield/DoubleFieldNewWizardPage.java
@@ -1,245 +1,245 @@
-/*******************************************************************************
- * 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.doublefield;
-
-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.jdt.core.Signature;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.nls.sdk.model.INlsEntry;
-import org.eclipse.scout.sdk.RuntimeClasses;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.operation.form.field.DoubleFieldNewOperation;
-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.Regex;
-import org.eclipse.scout.sdk.util.SdkProperties;
-import org.eclipse.scout.sdk.util.type.TypeFilters;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-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> {@link DoubleFieldNewWizardPage}</h3> ...
- */
-public class DoubleFieldNewWizardPage 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 DoubleFieldNewWizardPage(IType declaringType) {
- super(DoubleFieldNewWizardPage.class.getName());
- setTitle(Texts.get("NewDoubleField"));
- setDescription(Texts.get("CreateANewDoubleField"));
- m_declaringType = declaringType;
- setSuperType(TypeUtility.getType(RuntimeClasses.AbstractDoubleField));
- m_sibling = SiblingProposal.SIBLING_END;
- }
-
- @Override
- protected void createContent(Composite parent) {
- 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 {
- DoubleFieldNewOperation operation = new DoubleFieldNewOperation(m_declaringType);
- operation.setFormatSource(true);
- // write back members
- if (getNlsName() != null) {
- operation.setNlsEntry(getNlsName());
- }
- operation.setTypeName(getTypeName());
- if (getSuperType() != null) {
- operation.setSuperTypeSignature(Signature.createTypeSignature(getSuperType().getFullyQualifiedName(), true));
- }
- 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 {
- if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_FORM_FIELD)) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
- }
- // check not allowed names
- if (ScoutTypeUtility.getAllTypes(m_declaringType.getCompilationUnit(), TypeFilters.getRegexSimpleNameFilter(getTypeName())).length > 0) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
- }
- if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
- return Status.OK_STATUS;
- }
- else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
- return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
- }
- else {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
- }
- }
-
- /**
- * @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);
- }
- }
-}
+/*******************************************************************************
+ * 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.doublefield;
+
+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.jdt.core.Signature;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.nls.sdk.model.INlsEntry;
+import org.eclipse.scout.sdk.RuntimeClasses;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.operation.form.field.DoubleFieldNewOperation;
+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.Regex;
+import org.eclipse.scout.sdk.util.SdkProperties;
+import org.eclipse.scout.sdk.util.type.TypeFilters;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+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> {@link DoubleFieldNewWizardPage}</h3> ...
+ */
+public class DoubleFieldNewWizardPage 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 DoubleFieldNewWizardPage(IType declaringType) {
+ super(DoubleFieldNewWizardPage.class.getName());
+ setTitle(Texts.get("NewDoubleField"));
+ setDescription(Texts.get("CreateANewDoubleField"));
+ m_declaringType = declaringType;
+ setSuperType(TypeUtility.getType(RuntimeClasses.AbstractDoubleField));
+ m_sibling = SiblingProposal.SIBLING_END;
+ }
+
+ @Override
+ protected void createContent(Composite parent) {
+ 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 {
+ DoubleFieldNewOperation operation = new DoubleFieldNewOperation(m_declaringType);
+ operation.setFormatSource(true);
+ // write back members
+ if (getNlsName() != null) {
+ operation.setNlsEntry(getNlsName());
+ }
+ operation.setTypeName(getTypeName());
+ if (getSuperType() != null) {
+ operation.setSuperTypeSignature(Signature.createTypeSignature(getSuperType().getFullyQualifiedName(), true));
+ }
+ 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 {
+ if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_FORM_FIELD)) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
+ }
+ // check not allowed names
+ if (ScoutTypeUtility.getAllTypes(m_declaringType.getCompilationUnit(), TypeFilters.getRegexSimpleNameFilter(getTypeName())).length > 0) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
+ }
+ if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return Status.OK_STATUS;
+ }
+ else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
+ }
+ else {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
+ }
+ }
+
+ /**
+ * @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.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/filechooserfield/FileChooserFieldNewWizard.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/filechooserfield/FileChooserFieldNewWizard.java
index 1a138efeb..84017303f 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/filechooserfield/FileChooserFieldNewWizard.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/filechooserfield/FileChooserFieldNewWizard.java
@@ -1,46 +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.filechooserfield;
-
-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 FileChooserFieldNewWizard extends AbstractFormFieldWizard {
-
- private FileChooserFieldNewWizardPage m_page1;
-
- public FileChooserFieldNewWizard() {
- setWindowTitle(Texts.get("NewFileChooserField"));
- }
-
- @Override
- public void initWizard(IType declaringType) {
- super.initWizard(declaringType);
- m_page1 = new FileChooserFieldNewWizardPage(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);
- }
- }
-}
+/*******************************************************************************
+ * 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.filechooserfield;
+
+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 FileChooserFieldNewWizard extends AbstractFormFieldWizard {
+
+ private FileChooserFieldNewWizardPage m_page1;
+
+ public FileChooserFieldNewWizard() {
+ setWindowTitle(Texts.get("NewFileChooserField"));
+ }
+
+ @Override
+ public void initWizard(IType declaringType) {
+ super.initWizard(declaringType);
+ m_page1 = new FileChooserFieldNewWizardPage(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/filechooserfield/FileChooserFieldNewWizardPage.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/filechooserfield/FileChooserFieldNewWizardPage.java
index a7f752f0f..f8f99e567 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/filechooserfield/FileChooserFieldNewWizardPage.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/filechooserfield/FileChooserFieldNewWizardPage.java
@@ -1,247 +1,247 @@
-/*******************************************************************************
- * 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.filechooserfield;
-
-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.jdt.core.Signature;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.nls.sdk.model.INlsEntry;
-import org.eclipse.scout.sdk.RuntimeClasses;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.operation.form.field.FileChooserFieldNewOperation;
-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.Regex;
-import org.eclipse.scout.sdk.util.SdkProperties;
-import org.eclipse.scout.sdk.util.type.TypeFilters;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-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>FileChooserFieldNewWizardPage</h3> ...
- */
-public class FileChooserFieldNewWizardPage 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 FileChooserFieldNewWizardPage(IType declaringType) {
- super(FileChooserFieldNewWizardPage.class.getName());
- setTitle(Texts.get("NewFileChooserField"));
- setDescription(Texts.get("CreateANnewFileChooserField"));
- m_declaringType = declaringType;
- setSuperType(TypeUtility.getType(RuntimeClasses.AbstractFileChooserField));
- m_sibling = SiblingProposal.SIBLING_END;
- }
-
- @Override
- protected void createContent(Composite parent) {
-
- 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 {
- FileChooserFieldNewOperation operation = new FileChooserFieldNewOperation(m_declaringType);
- operation.setFormatSource(true);
- // write back members
- if (getNlsName() != null) {
- operation.setNlsEntry(getNlsName());
- }
- operation.setTypeName(getTypeName());
- if (getSuperType() != null) {
- operation.setSuperTypeSignature(Signature.createTypeSignature(getSuperType().getFullyQualifiedName(), true));
- }
-
- 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 {
- if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_FORM_FIELD)) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
- }
- // check not allowed names
- if (ScoutTypeUtility.getAllTypes(m_declaringType.getCompilationUnit(), TypeFilters.getRegexSimpleNameFilter(getTypeName())).length > 0) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
- }
- if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
- return Status.OK_STATUS;
- }
- else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
- return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
- }
- else {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
- }
- }
-
- /**
- * @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);
- }
- }
-}
+/*******************************************************************************
+ * 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.filechooserfield;
+
+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.jdt.core.Signature;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.nls.sdk.model.INlsEntry;
+import org.eclipse.scout.sdk.RuntimeClasses;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.operation.form.field.FileChooserFieldNewOperation;
+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.Regex;
+import org.eclipse.scout.sdk.util.SdkProperties;
+import org.eclipse.scout.sdk.util.type.TypeFilters;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+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>FileChooserFieldNewWizardPage</h3> ...
+ */
+public class FileChooserFieldNewWizardPage 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 FileChooserFieldNewWizardPage(IType declaringType) {
+ super(FileChooserFieldNewWizardPage.class.getName());
+ setTitle(Texts.get("NewFileChooserField"));
+ setDescription(Texts.get("CreateANnewFileChooserField"));
+ m_declaringType = declaringType;
+ setSuperType(TypeUtility.getType(RuntimeClasses.AbstractFileChooserField));
+ m_sibling = SiblingProposal.SIBLING_END;
+ }
+
+ @Override
+ protected void createContent(Composite parent) {
+
+ 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 {
+ FileChooserFieldNewOperation operation = new FileChooserFieldNewOperation(m_declaringType);
+ operation.setFormatSource(true);
+ // write back members
+ if (getNlsName() != null) {
+ operation.setNlsEntry(getNlsName());
+ }
+ operation.setTypeName(getTypeName());
+ if (getSuperType() != null) {
+ operation.setSuperTypeSignature(Signature.createTypeSignature(getSuperType().getFullyQualifiedName(), true));
+ }
+
+ 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 {
+ if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_FORM_FIELD)) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
+ }
+ // check not allowed names
+ if (ScoutTypeUtility.getAllTypes(m_declaringType.getCompilationUnit(), TypeFilters.getRegexSimpleNameFilter(getTypeName())).length > 0) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
+ }
+ if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return Status.OK_STATUS;
+ }
+ else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
+ }
+ else {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
+ }
+ }
+
+ /**
+ * @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.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/formfield/DefaultFormFieldNewWizard.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/formfield/DefaultFormFieldNewWizard.java
index c77cbb9e9..f9fefbf31 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/formfield/DefaultFormFieldNewWizard.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/formfield/DefaultFormFieldNewWizard.java
@@ -1,41 +1,41 @@
-/*******************************************************************************
- * 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.formfield;
-
-import org.eclipse.jdt.core.IType;
-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 DefaultFormFieldNewWizard extends AbstractFormFieldWizard {
-
- private DefaultFormFieldNewWizardPage m_page1;
-
- @Override
- public void initWizard(IType declaringType) {
- super.initWizard(declaringType);
- m_page1 = new DefaultFormFieldNewWizardPage(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);
- }
- }
-}
+/*******************************************************************************
+ * 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.formfield;
+
+import org.eclipse.jdt.core.IType;
+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 DefaultFormFieldNewWizard extends AbstractFormFieldWizard {
+
+ private DefaultFormFieldNewWizardPage m_page1;
+
+ @Override
+ public void initWizard(IType declaringType) {
+ super.initWizard(declaringType);
+ m_page1 = new DefaultFormFieldNewWizardPage(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/formfield/DefaultFormFieldNewWizardPage.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/formfield/DefaultFormFieldNewWizardPage.java
index 5be2af779..ada2aa96a 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/formfield/DefaultFormFieldNewWizardPage.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/formfield/DefaultFormFieldNewWizardPage.java
@@ -1,337 +1,337 @@
-/*******************************************************************************
- * 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.formfield;
-
-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.jdt.core.Signature;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.nls.sdk.model.INlsEntry;
-import org.eclipse.scout.sdk.RuntimeClasses;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.operation.form.field.DefaultFormFieldNewOperation;
-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.fields.proposal.javaelement.JavaElementAbstractTypeContentProvider;
-import org.eclipse.scout.sdk.ui.fields.proposal.signature.SignatureProposalProvider;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
-import org.eclipse.scout.sdk.util.Regex;
-import org.eclipse.scout.sdk.util.SdkProperties;
-import org.eclipse.scout.sdk.util.type.TypeFilters;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-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>DefaultFormFieldNewWizardPage</h3> ...
- */
-public class DefaultFormFieldNewWizardPage extends AbstractWorkspaceWizardPage {
-
- final IType abstractFormField = TypeUtility.getType(RuntimeClasses.AbstractFormField);
- final IType iFormField = TypeUtility.getType(RuntimeClasses.IFormField);
-
- private INlsEntry m_nlsName;
- private String m_typeName;
- private IType m_superType;
- private String m_genericSignature;
- private SiblingProposal m_sibling;
-
- private ProposalTextField m_nlsNameField;
- private StyledTextField m_typeNameField;
- private ProposalTextField m_superTypeField;
- private ProposalTextField m_genericTypeField;
- private ProposalTextField m_siblingField;
-
- // process members
- private final IType m_declaringType;
- private IType m_createdField;
-
- public DefaultFormFieldNewWizardPage(IType declaringType) {
- super(DefaultFormFieldNewWizardPage.class.getName());
- m_declaringType = declaringType;
- m_superType = abstractFormField;
- m_sibling = SiblingProposal.SIBLING_END;
- }
-
- @Override
- protected void createContent(Composite parent) {
- setTitle(Texts.get("NewDefaultField"));
- setDescription(Texts.get("CreateANewDefaultField"));
-
- 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_superTypeField = getFieldToolkit().createJavaElementProposalField(parent, Texts.get("SuperType"),
- new JavaElementAbstractTypeContentProvider(iFormField, m_declaringType.getJavaProject(), abstractFormField));
- m_superTypeField.acceptProposal(m_superType);
- m_superTypeField.addProposalAdapterListener(new IProposalAdapterListener() {
- @Override
- public void proposalAccepted(ContentProposalEvent event) {
- try {
- setStateChanging(true);
- m_superType = (IType) event.proposal;
-
- if (getSuperType() != null && TypeUtility.isGenericType(getSuperType())) {
- m_genericTypeField.setEnabled(true);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
- });
-
- m_genericTypeField = getFieldToolkit().createSignatureProposalField(parent, Texts.get("GenericType"), ScoutTypeUtility.getScoutBundle(m_declaringType), SignatureProposalProvider.DEFAULT_MOST_USED);
- m_genericTypeField.acceptProposal(getGenericSignature());
- m_genericTypeField.setEnabled(TypeUtility.isGenericType(getSuperType()));
- m_genericTypeField.addProposalAdapterListener(new IProposalAdapterListener() {
- @Override
- public void proposalAccepted(ContentProposalEvent event) {
- m_genericSignature = (String) event.proposal;
- 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_superTypeField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- m_genericTypeField.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 {
- DefaultFormFieldNewOperation operation = new DefaultFormFieldNewOperation(m_declaringType);
- operation.setFormatSource(true);
- // write back members
- if (getNlsName() != null) {
- operation.setNlsEntry(getNlsName());
- }
- operation.setTypeName(getTypeName());
- if (getSuperType() != null) {
- String sig = null;
- if (getGenericSignature() != null) {
- sig = Signature.createTypeSignature(getSuperType().getFullyQualifiedName() + "<" + Signature.toString(getGenericSignature()) + ">", true);
- }
- else {
- sig = Signature.createTypeSignature(getSuperType().getFullyQualifiedName(), true);
- }
- operation.setSuperTypeSignature(sig);
- }
- 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());
- multiStatus.add(getStatusSuperType());
- multiStatus.add(getStatusGenericType());
- }
- catch (JavaModelException e) {
- ScoutSdkUi.logError("could not validate name field.", e);
- }
- }
-
- protected IStatus getStatusNameField() throws JavaModelException {
- if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_FORM_FIELD)) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
- }
- // check not allowed names
- if (ScoutTypeUtility.getAllTypes(m_declaringType.getCompilationUnit(), TypeFilters.getRegexSimpleNameFilter(getTypeName())).length > 0) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
- }
- if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
- return Status.OK_STATUS;
- }
- else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
- return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
- }
- else {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
- }
- }
-
- protected IStatus getStatusSuperType() throws JavaModelException {
- if (getSuperType() == null) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("TheSuperTypeCanNotBeNull"));
- }
- return Status.OK_STATUS;
- }
-
- protected IStatus getStatusGenericType() throws JavaModelException {
- if (getSuperType() != null && TypeUtility.isGenericType(getSuperType())) {
- if (getGenericSignature() == null) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("GenericTypeCanNotBeNull"));
- }
- }
- return Status.OK_STATUS;
- }
-
- /**
- * @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) {
- try {
- setStateChanging(true);
- m_superType = superType;
- if (isControlCreated()) {
- m_superTypeField.acceptProposal(superType);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- public void setGenericSignature(String genericSignature) {
- try {
- setStateChanging(true);
- m_genericSignature = genericSignature;
- if (isControlCreated()) {
- m_genericTypeField.acceptProposal(genericSignature);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- public String getGenericSignature() {
- return m_genericSignature;
- }
-
- 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);
- }
- }
-}
+/*******************************************************************************
+ * 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.formfield;
+
+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.jdt.core.Signature;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.nls.sdk.model.INlsEntry;
+import org.eclipse.scout.sdk.RuntimeClasses;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.operation.form.field.DefaultFormFieldNewOperation;
+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.fields.proposal.javaelement.JavaElementAbstractTypeContentProvider;
+import org.eclipse.scout.sdk.ui.fields.proposal.signature.SignatureProposalProvider;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
+import org.eclipse.scout.sdk.util.Regex;
+import org.eclipse.scout.sdk.util.SdkProperties;
+import org.eclipse.scout.sdk.util.type.TypeFilters;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+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>DefaultFormFieldNewWizardPage</h3> ...
+ */
+public class DefaultFormFieldNewWizardPage extends AbstractWorkspaceWizardPage {
+
+ final IType abstractFormField = TypeUtility.getType(RuntimeClasses.AbstractFormField);
+ final IType iFormField = TypeUtility.getType(RuntimeClasses.IFormField);
+
+ private INlsEntry m_nlsName;
+ private String m_typeName;
+ private IType m_superType;
+ private String m_genericSignature;
+ private SiblingProposal m_sibling;
+
+ private ProposalTextField m_nlsNameField;
+ private StyledTextField m_typeNameField;
+ private ProposalTextField m_superTypeField;
+ private ProposalTextField m_genericTypeField;
+ private ProposalTextField m_siblingField;
+
+ // process members
+ private final IType m_declaringType;
+ private IType m_createdField;
+
+ public DefaultFormFieldNewWizardPage(IType declaringType) {
+ super(DefaultFormFieldNewWizardPage.class.getName());
+ m_declaringType = declaringType;
+ m_superType = abstractFormField;
+ m_sibling = SiblingProposal.SIBLING_END;
+ }
+
+ @Override
+ protected void createContent(Composite parent) {
+ setTitle(Texts.get("NewDefaultField"));
+ setDescription(Texts.get("CreateANewDefaultField"));
+
+ 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_superTypeField = getFieldToolkit().createJavaElementProposalField(parent, Texts.get("SuperType"),
+ new JavaElementAbstractTypeContentProvider(iFormField, m_declaringType.getJavaProject(), abstractFormField));
+ m_superTypeField.acceptProposal(m_superType);
+ m_superTypeField.addProposalAdapterListener(new IProposalAdapterListener() {
+ @Override
+ public void proposalAccepted(ContentProposalEvent event) {
+ try {
+ setStateChanging(true);
+ m_superType = (IType) event.proposal;
+
+ if (getSuperType() != null && TypeUtility.isGenericType(getSuperType())) {
+ m_genericTypeField.setEnabled(true);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+ });
+
+ m_genericTypeField = getFieldToolkit().createSignatureProposalField(parent, Texts.get("GenericType"), ScoutTypeUtility.getScoutBundle(m_declaringType), SignatureProposalProvider.DEFAULT_MOST_USED);
+ m_genericTypeField.acceptProposal(getGenericSignature());
+ m_genericTypeField.setEnabled(TypeUtility.isGenericType(getSuperType()));
+ m_genericTypeField.addProposalAdapterListener(new IProposalAdapterListener() {
+ @Override
+ public void proposalAccepted(ContentProposalEvent event) {
+ m_genericSignature = (String) event.proposal;
+ 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_superTypeField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ m_genericTypeField.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 {
+ DefaultFormFieldNewOperation operation = new DefaultFormFieldNewOperation(m_declaringType);
+ operation.setFormatSource(true);
+ // write back members
+ if (getNlsName() != null) {
+ operation.setNlsEntry(getNlsName());
+ }
+ operation.setTypeName(getTypeName());
+ if (getSuperType() != null) {
+ String sig = null;
+ if (getGenericSignature() != null) {
+ sig = Signature.createTypeSignature(getSuperType().getFullyQualifiedName() + "<" + Signature.toString(getGenericSignature()) + ">", true);
+ }
+ else {
+ sig = Signature.createTypeSignature(getSuperType().getFullyQualifiedName(), true);
+ }
+ operation.setSuperTypeSignature(sig);
+ }
+ 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());
+ multiStatus.add(getStatusSuperType());
+ multiStatus.add(getStatusGenericType());
+ }
+ catch (JavaModelException e) {
+ ScoutSdkUi.logError("could not validate name field.", e);
+ }
+ }
+
+ protected IStatus getStatusNameField() throws JavaModelException {
+ if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_FORM_FIELD)) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
+ }
+ // check not allowed names
+ if (ScoutTypeUtility.getAllTypes(m_declaringType.getCompilationUnit(), TypeFilters.getRegexSimpleNameFilter(getTypeName())).length > 0) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
+ }
+ if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return Status.OK_STATUS;
+ }
+ else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
+ }
+ else {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
+ }
+ }
+
+ protected IStatus getStatusSuperType() throws JavaModelException {
+ if (getSuperType() == null) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("TheSuperTypeCanNotBeNull"));
+ }
+ return Status.OK_STATUS;
+ }
+
+ protected IStatus getStatusGenericType() throws JavaModelException {
+ if (getSuperType() != null && TypeUtility.isGenericType(getSuperType())) {
+ if (getGenericSignature() == null) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("GenericTypeCanNotBeNull"));
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+ /**
+ * @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) {
+ try {
+ setStateChanging(true);
+ m_superType = superType;
+ if (isControlCreated()) {
+ m_superTypeField.acceptProposal(superType);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ public void setGenericSignature(String genericSignature) {
+ try {
+ setStateChanging(true);
+ m_genericSignature = genericSignature;
+ if (isControlCreated()) {
+ m_genericTypeField.acceptProposal(genericSignature);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ public String getGenericSignature() {
+ return m_genericSignature;
+ }
+
+ 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.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/groupbox/GroupBoxNewWizard.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/groupbox/GroupBoxNewWizard.java
index 754f342ff..15db79e3d 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/groupbox/GroupBoxNewWizard.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/groupbox/GroupBoxNewWizard.java
@@ -1,46 +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.groupbox;
-
-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 GroupBoxNewWizard extends AbstractFormFieldWizard {
-
- private GroupBoxNewWizardPage m_page1;
-
- public GroupBoxNewWizard() {
- setWindowTitle(Texts.get("NewGroupBox"));
- }
-
- @Override
- public void initWizard(IType declaringType) {
- super.initWizard(declaringType);
- m_page1 = new GroupBoxNewWizardPage(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);
- }
- }
-}
+/*******************************************************************************
+ * 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.groupbox;
+
+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 GroupBoxNewWizard extends AbstractFormFieldWizard {
+
+ private GroupBoxNewWizardPage m_page1;
+
+ public GroupBoxNewWizard() {
+ setWindowTitle(Texts.get("NewGroupBox"));
+ }
+
+ @Override
+ public void initWizard(IType declaringType) {
+ super.initWizard(declaringType);
+ m_page1 = new GroupBoxNewWizardPage(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/groupbox/GroupBoxNewWizardPage.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/groupbox/GroupBoxNewWizardPage.java
index 12b53f89f..f9a3b692b 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/groupbox/GroupBoxNewWizardPage.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/groupbox/GroupBoxNewWizardPage.java
@@ -1,246 +1,246 @@
-/*******************************************************************************
- * 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.groupbox;
-
-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.jdt.core.Signature;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.nls.sdk.model.INlsEntry;
-import org.eclipse.scout.sdk.RuntimeClasses;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.operation.form.field.GroupBoxNewOperation;
-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.Regex;
-import org.eclipse.scout.sdk.util.SdkProperties;
-import org.eclipse.scout.sdk.util.type.TypeFilters;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-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>GroupBoxNewWizardPage</h3> ...
- */
-public class GroupBoxNewWizardPage 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 GroupBoxNewWizardPage(IType declaringType) {
- super(GroupBoxNewWizardPage.class.getName());
- m_declaringType = declaringType;
- setSuperType(TypeUtility.getType(RuntimeClasses.AbstractGroupBox));
- m_sibling = SiblingProposal.SIBLING_END;
- }
-
- @Override
- protected void createContent(Composite parent) {
- setTitle(Texts.get("NewGroupBox"));
- setDescription(Texts.get("CreateANewGroupBox"));
-
- 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_GROUP_BOX);
- 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 {
- GroupBoxNewOperation operation = new GroupBoxNewOperation(m_declaringType);
- operation.setFormatSource(true);
- // write back members
- if (getNlsName() != null) {
- operation.setNlsEntry(getNlsName());
- }
- operation.setTypeName(getTypeName());
- if (getSuperType() != null) {
- operation.setSuperTypeSignature(Signature.createTypeSignature(getSuperType().getFullyQualifiedName(), true));
- }
- 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 {
- if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_GROUP_BOX)) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
- }
- // check not allowed names
- if (ScoutTypeUtility.getAllTypes(m_declaringType.getCompilationUnit(), TypeFilters.getRegexSimpleNameFilter(getTypeName())).length > 0) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
- }
- if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
- return Status.OK_STATUS;
- }
- else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
- return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
- }
- else {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
- }
- }
-
- /**
- * @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);
- }
- }
-}
+/*******************************************************************************
+ * 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.groupbox;
+
+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.jdt.core.Signature;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.nls.sdk.model.INlsEntry;
+import org.eclipse.scout.sdk.RuntimeClasses;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.operation.form.field.GroupBoxNewOperation;
+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.Regex;
+import org.eclipse.scout.sdk.util.SdkProperties;
+import org.eclipse.scout.sdk.util.type.TypeFilters;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+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>GroupBoxNewWizardPage</h3> ...
+ */
+public class GroupBoxNewWizardPage 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 GroupBoxNewWizardPage(IType declaringType) {
+ super(GroupBoxNewWizardPage.class.getName());
+ m_declaringType = declaringType;
+ setSuperType(TypeUtility.getType(RuntimeClasses.AbstractGroupBox));
+ m_sibling = SiblingProposal.SIBLING_END;
+ }
+
+ @Override
+ protected void createContent(Composite parent) {
+ setTitle(Texts.get("NewGroupBox"));
+ setDescription(Texts.get("CreateANewGroupBox"));
+
+ 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_GROUP_BOX);
+ 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 {
+ GroupBoxNewOperation operation = new GroupBoxNewOperation(m_declaringType);
+ operation.setFormatSource(true);
+ // write back members
+ if (getNlsName() != null) {
+ operation.setNlsEntry(getNlsName());
+ }
+ operation.setTypeName(getTypeName());
+ if (getSuperType() != null) {
+ operation.setSuperTypeSignature(Signature.createTypeSignature(getSuperType().getFullyQualifiedName(), true));
+ }
+ 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 {
+ if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_GROUP_BOX)) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
+ }
+ // check not allowed names
+ if (ScoutTypeUtility.getAllTypes(m_declaringType.getCompilationUnit(), TypeFilters.getRegexSimpleNameFilter(getTypeName())).length > 0) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
+ }
+ if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return Status.OK_STATUS;
+ }
+ else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
+ }
+ else {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
+ }
+ }
+
+ /**
+ * @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.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/htmlfield/HtmlFieldNewWizard.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/htmlfield/HtmlFieldNewWizard.java
index ec344b0cd..74befb6fb 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/htmlfield/HtmlFieldNewWizard.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/htmlfield/HtmlFieldNewWizard.java
@@ -1,46 +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.htmlfield;
-
-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 HtmlFieldNewWizard extends AbstractFormFieldWizard {
-
- private HtmlFieldNewWizardPage m_page1;
-
- public HtmlFieldNewWizard() {
- setWindowTitle(Texts.get("NewHTMLField"));
- }
-
- @Override
- public void initWizard(IType declaringType) {
- super.initWizard(declaringType);
- m_page1 = new HtmlFieldNewWizardPage(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);
- }
- }
-}
+/*******************************************************************************
+ * 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.htmlfield;
+
+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 HtmlFieldNewWizard extends AbstractFormFieldWizard {
+
+ private HtmlFieldNewWizardPage m_page1;
+
+ public HtmlFieldNewWizard() {
+ setWindowTitle(Texts.get("NewHTMLField"));
+ }
+
+ @Override
+ public void initWizard(IType declaringType) {
+ super.initWizard(declaringType);
+ m_page1 = new HtmlFieldNewWizardPage(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/htmlfield/HtmlFieldNewWizardPage.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/htmlfield/HtmlFieldNewWizardPage.java
index c60559714..809c13bd1 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/htmlfield/HtmlFieldNewWizardPage.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/htmlfield/HtmlFieldNewWizardPage.java
@@ -1,246 +1,246 @@
-/*******************************************************************************
- * 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.htmlfield;
-
-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.jdt.core.Signature;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.nls.sdk.model.INlsEntry;
-import org.eclipse.scout.sdk.RuntimeClasses;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.operation.form.field.HtmlFieldNewOperation;
-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.Regex;
-import org.eclipse.scout.sdk.util.SdkProperties;
-import org.eclipse.scout.sdk.util.type.TypeFilters;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-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>HtmlFieldNewWizardPage</h3> ...
- */
-public class HtmlFieldNewWizardPage 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 HtmlFieldNewWizardPage(IType declaringType) {
- super(HtmlFieldNewWizardPage.class.getName());
- setTitle(Texts.get("NewHTMLField"));
- setDescription(Texts.get("CreateANewHTMLField"));
- m_declaringType = declaringType;
- setSuperType(TypeUtility.getType(RuntimeClasses.AbstractHtmlField));
- m_sibling = SiblingProposal.SIBLING_END;
- }
-
- @Override
- protected void createContent(Composite parent) {
-
- 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 {
- HtmlFieldNewOperation operation = new HtmlFieldNewOperation(m_declaringType);
- operation.setFormatSource(true);
- // write back members
- if (getNlsName() != null) {
- operation.setNlsEntry(getNlsName());
- }
- operation.setTypeName(getTypeName());
- if (getSuperType() != null) {
- operation.setSuperTypeSignature(Signature.createTypeSignature(getSuperType().getFullyQualifiedName(), true));
- }
- 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 {
- if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_FORM_FIELD)) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
- }
- // check not allowed names
- if (ScoutTypeUtility.getAllTypes(m_declaringType.getCompilationUnit(), TypeFilters.getRegexSimpleNameFilter(getTypeName())).length > 0) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
- }
- if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
- return Status.OK_STATUS;
- }
- else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
- return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
- }
- else {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
- }
- }
-
- /**
- * @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);
- }
- }
-}
+/*******************************************************************************
+ * 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.htmlfield;
+
+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.jdt.core.Signature;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.nls.sdk.model.INlsEntry;
+import org.eclipse.scout.sdk.RuntimeClasses;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.operation.form.field.HtmlFieldNewOperation;
+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.Regex;
+import org.eclipse.scout.sdk.util.SdkProperties;
+import org.eclipse.scout.sdk.util.type.TypeFilters;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+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>HtmlFieldNewWizardPage</h3> ...
+ */
+public class HtmlFieldNewWizardPage 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 HtmlFieldNewWizardPage(IType declaringType) {
+ super(HtmlFieldNewWizardPage.class.getName());
+ setTitle(Texts.get("NewHTMLField"));
+ setDescription(Texts.get("CreateANewHTMLField"));
+ m_declaringType = declaringType;
+ setSuperType(TypeUtility.getType(RuntimeClasses.AbstractHtmlField));
+ m_sibling = SiblingProposal.SIBLING_END;
+ }
+
+ @Override
+ protected void createContent(Composite parent) {
+
+ 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 {
+ HtmlFieldNewOperation operation = new HtmlFieldNewOperation(m_declaringType);
+ operation.setFormatSource(true);
+ // write back members
+ if (getNlsName() != null) {
+ operation.setNlsEntry(getNlsName());
+ }
+ operation.setTypeName(getTypeName());
+ if (getSuperType() != null) {
+ operation.setSuperTypeSignature(Signature.createTypeSignature(getSuperType().getFullyQualifiedName(), true));
+ }
+ 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 {
+ if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_FORM_FIELD)) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
+ }
+ // check not allowed names
+ if (ScoutTypeUtility.getAllTypes(m_declaringType.getCompilationUnit(), TypeFilters.getRegexSimpleNameFilter(getTypeName())).length > 0) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
+ }
+ if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return Status.OK_STATUS;
+ }
+ else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
+ }
+ else {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
+ }
+ }
+
+ /**
+ * @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.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/imagefield/ImageFieldNewWizard.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/imagefield/ImageFieldNewWizard.java
index a21b69a90..0e728d442 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/imagefield/ImageFieldNewWizard.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/imagefield/ImageFieldNewWizard.java
@@ -1,46 +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.imagefield;
-
-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 ImageFieldNewWizard extends AbstractFormFieldWizard {
-
- private ImageFieldNewWizardPage m_page1;
-
- public ImageFieldNewWizard() {
- setWindowTitle(Texts.get("NewImageField"));
- }
-
- @Override
- public void initWizard(IType declaringType) {
- super.initWizard(declaringType);
- m_page1 = new ImageFieldNewWizardPage(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);
- }
- }
-}
+/*******************************************************************************
+ * 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.imagefield;
+
+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 ImageFieldNewWizard extends AbstractFormFieldWizard {
+
+ private ImageFieldNewWizardPage m_page1;
+
+ public ImageFieldNewWizard() {
+ setWindowTitle(Texts.get("NewImageField"));
+ }
+
+ @Override
+ public void initWizard(IType declaringType) {
+ super.initWizard(declaringType);
+ m_page1 = new ImageFieldNewWizardPage(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/imagefield/ImageFieldNewWizardPage.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/imagefield/ImageFieldNewWizardPage.java
index 962bd4846..027a65657 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/imagefield/ImageFieldNewWizardPage.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/imagefield/ImageFieldNewWizardPage.java
@@ -1,246 +1,246 @@
-/*******************************************************************************
- * 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.imagefield;
-
-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.jdt.core.Signature;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.nls.sdk.model.INlsEntry;
-import org.eclipse.scout.sdk.RuntimeClasses;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.operation.form.field.ImageFieldNewOperation;
-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.Regex;
-import org.eclipse.scout.sdk.util.SdkProperties;
-import org.eclipse.scout.sdk.util.type.TypeFilters;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-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>ImageFieldNewWizardPage</h3> ...
- */
-public class ImageFieldNewWizardPage 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 ImageFieldNewWizardPage(IType declaringType) {
- super(ImageFieldNewWizardPage.class.getName());
- setTitle(Texts.get("NewImageField"));
- setDescription(Texts.get("CreateANnewImageField"));
- m_declaringType = declaringType;
- setSuperType(TypeUtility.getType(RuntimeClasses.AbstractImageField));
- m_sibling = SiblingProposal.SIBLING_END;
- }
-
- @Override
- protected void createContent(Composite parent) {
-
- 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 {
- ImageFieldNewOperation operation = new ImageFieldNewOperation(m_declaringType);
- operation.setFormatSource(true);
- // write back members
- if (getNlsName() != null) {
- operation.setNlsEntry(getNlsName());
- }
- operation.setTypeName(getTypeName());
- if (getSuperType() != null) {
- operation.setSuperTypeSignature(Signature.createTypeSignature(getSuperType().getFullyQualifiedName(), true));
- }
- 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 {
- if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_FORM_FIELD)) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
- }
- // check not allowed names
- if (ScoutTypeUtility.getAllTypes(m_declaringType.getCompilationUnit(), TypeFilters.getRegexSimpleNameFilter(getTypeName())).length > 0) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
- }
- if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
- return Status.OK_STATUS;
- }
- else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
- return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
- }
- else {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
- }
- }
-
- /**
- * @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);
- }
- }
-}
+/*******************************************************************************
+ * 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.imagefield;
+
+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.jdt.core.Signature;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.nls.sdk.model.INlsEntry;
+import org.eclipse.scout.sdk.RuntimeClasses;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.operation.form.field.ImageFieldNewOperation;
+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.Regex;
+import org.eclipse.scout.sdk.util.SdkProperties;
+import org.eclipse.scout.sdk.util.type.TypeFilters;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+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>ImageFieldNewWizardPage</h3> ...
+ */
+public class ImageFieldNewWizardPage 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 ImageFieldNewWizardPage(IType declaringType) {
+ super(ImageFieldNewWizardPage.class.getName());
+ setTitle(Texts.get("NewImageField"));
+ setDescription(Texts.get("CreateANnewImageField"));
+ m_declaringType = declaringType;
+ setSuperType(TypeUtility.getType(RuntimeClasses.AbstractImageField));
+ m_sibling = SiblingProposal.SIBLING_END;
+ }
+
+ @Override
+ protected void createContent(Composite parent) {
+
+ 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 {
+ ImageFieldNewOperation operation = new ImageFieldNewOperation(m_declaringType);
+ operation.setFormatSource(true);
+ // write back members
+ if (getNlsName() != null) {
+ operation.setNlsEntry(getNlsName());
+ }
+ operation.setTypeName(getTypeName());
+ if (getSuperType() != null) {
+ operation.setSuperTypeSignature(Signature.createTypeSignature(getSuperType().getFullyQualifiedName(), true));
+ }
+ 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 {
+ if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_FORM_FIELD)) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
+ }
+ // check not allowed names
+ if (ScoutTypeUtility.getAllTypes(m_declaringType.getCompilationUnit(), TypeFilters.getRegexSimpleNameFilter(getTypeName())).length > 0) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
+ }
+ if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return Status.OK_STATUS;
+ }
+ else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
+ }
+ else {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
+ }
+ }
+
+ /**
+ * @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.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/integerfield/IntegerFieldNewWizard.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/integerfield/IntegerFieldNewWizard.java
index 0fba95472..43a1f5825 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/integerfield/IntegerFieldNewWizard.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/integerfield/IntegerFieldNewWizard.java
@@ -1,46 +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.integerfield;
-
-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 IntegerFieldNewWizard extends AbstractFormFieldWizard {
-
- private IntegerFieldNewWizardPage m_page1;
-
- public IntegerFieldNewWizard() {
- setWindowTitle(Texts.get("NewIntegerField"));
- }
-
- @Override
- public void initWizard(IType declaringType) {
- super.initWizard(declaringType);
- m_page1 = new IntegerFieldNewWizardPage(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);
- }
- }
-}
+/*******************************************************************************
+ * 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.integerfield;
+
+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 IntegerFieldNewWizard extends AbstractFormFieldWizard {
+
+ private IntegerFieldNewWizardPage m_page1;
+
+ public IntegerFieldNewWizard() {
+ setWindowTitle(Texts.get("NewIntegerField"));
+ }
+
+ @Override
+ public void initWizard(IType declaringType) {
+ super.initWizard(declaringType);
+ m_page1 = new IntegerFieldNewWizardPage(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/integerfield/IntegerFieldNewWizardPage.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/integerfield/IntegerFieldNewWizardPage.java
index 5f8a1e018..58a5cac0e 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/integerfield/IntegerFieldNewWizardPage.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/integerfield/IntegerFieldNewWizardPage.java
@@ -1,246 +1,246 @@
-/*******************************************************************************
- * 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.integerfield;
-
-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.jdt.core.Signature;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.nls.sdk.model.INlsEntry;
-import org.eclipse.scout.sdk.RuntimeClasses;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.operation.form.field.IntegerFieldNewOperation;
-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.Regex;
-import org.eclipse.scout.sdk.util.SdkProperties;
-import org.eclipse.scout.sdk.util.type.TypeFilters;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-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>IntegerFieldNewWizardPage</h3> ...
- */
-public class IntegerFieldNewWizardPage 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 IntegerFieldNewWizardPage(IType declaringType) {
- super(IntegerFieldNewWizardPage.class.getName());
- setTitle(Texts.get("NewIntegerField"));
- setDescription(Texts.get("CreateANewIntegerField"));
- m_declaringType = declaringType;
- setSuperType(TypeUtility.getType(RuntimeClasses.AbstractIntegerField));
- m_sibling = SiblingProposal.SIBLING_END;
- }
-
- @Override
- protected void createContent(Composite parent) {
-
- 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 {
- IntegerFieldNewOperation operation = new IntegerFieldNewOperation(m_declaringType);
- operation.setFormatSource(true);
- // write back members
- if (getNlsName() != null) {
- operation.setNlsEntry(getNlsName());
- }
- operation.setTypeName(getTypeName());
- if (getSuperType() != null) {
- operation.setSuperTypeSignature(Signature.createTypeSignature(getSuperType().getFullyQualifiedName(), true));
- }
- 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 {
- if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_FORM_FIELD)) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
- }
- // check not allowed names
- if (ScoutTypeUtility.getAllTypes(m_declaringType.getCompilationUnit(), TypeFilters.getRegexSimpleNameFilter(getTypeName())).length > 0) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
- }
- if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
- return Status.OK_STATUS;
- }
- else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
- return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
- }
- else {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
- }
- }
-
- /**
- * @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);
- }
- }
-}
+/*******************************************************************************
+ * 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.integerfield;
+
+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.jdt.core.Signature;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.nls.sdk.model.INlsEntry;
+import org.eclipse.scout.sdk.RuntimeClasses;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.operation.form.field.IntegerFieldNewOperation;
+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.Regex;
+import org.eclipse.scout.sdk.util.SdkProperties;
+import org.eclipse.scout.sdk.util.type.TypeFilters;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+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>IntegerFieldNewWizardPage</h3> ...
+ */
+public class IntegerFieldNewWizardPage 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 IntegerFieldNewWizardPage(IType declaringType) {
+ super(IntegerFieldNewWizardPage.class.getName());
+ setTitle(Texts.get("NewIntegerField"));
+ setDescription(Texts.get("CreateANewIntegerField"));
+ m_declaringType = declaringType;
+ setSuperType(TypeUtility.getType(RuntimeClasses.AbstractIntegerField));
+ m_sibling = SiblingProposal.SIBLING_END;
+ }
+
+ @Override
+ protected void createContent(Composite parent) {
+
+ 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 {
+ IntegerFieldNewOperation operation = new IntegerFieldNewOperation(m_declaringType);
+ operation.setFormatSource(true);
+ // write back members
+ if (getNlsName() != null) {
+ operation.setNlsEntry(getNlsName());
+ }
+ operation.setTypeName(getTypeName());
+ if (getSuperType() != null) {
+ operation.setSuperTypeSignature(Signature.createTypeSignature(getSuperType().getFullyQualifiedName(), true));
+ }
+ 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 {
+ if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_FORM_FIELD)) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
+ }
+ // check not allowed names
+ if (ScoutTypeUtility.getAllTypes(m_declaringType.getCompilationUnit(), TypeFilters.getRegexSimpleNameFilter(getTypeName())).length > 0) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
+ }
+ if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return Status.OK_STATUS;
+ }
+ else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
+ }
+ else {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
+ }
+ }
+
+ /**
+ * @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.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/labelfield/LabelFieldNewWizard.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/labelfield/LabelFieldNewWizard.java
index ff64a1607..b299ada2a 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/labelfield/LabelFieldNewWizard.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/labelfield/LabelFieldNewWizard.java
@@ -1,46 +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.labelfield;
-
-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 LabelFieldNewWizard extends AbstractFormFieldWizard {
-
- private LabelFieldNewWizardPage m_page1;
-
- public LabelFieldNewWizard() {
- setWindowTitle(Texts.get("NewLabelField"));
- }
-
- @Override
- public void initWizard(IType declaringType) {
- super.initWizard(declaringType);
- m_page1 = new LabelFieldNewWizardPage(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);
- }
- }
-}
+/*******************************************************************************
+ * 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.labelfield;
+
+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 LabelFieldNewWizard extends AbstractFormFieldWizard {
+
+ private LabelFieldNewWizardPage m_page1;
+
+ public LabelFieldNewWizard() {
+ setWindowTitle(Texts.get("NewLabelField"));
+ }
+
+ @Override
+ public void initWizard(IType declaringType) {
+ super.initWizard(declaringType);
+ m_page1 = new LabelFieldNewWizardPage(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/labelfield/LabelFieldNewWizardPage.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/labelfield/LabelFieldNewWizardPage.java
index 90ec5f999..89a581498 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/labelfield/LabelFieldNewWizardPage.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/labelfield/LabelFieldNewWizardPage.java
@@ -1,246 +1,246 @@
-/*******************************************************************************
- * 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.labelfield;
-
-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.jdt.core.Signature;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.nls.sdk.model.INlsEntry;
-import org.eclipse.scout.sdk.RuntimeClasses;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.operation.form.field.LabelFieldNewOperation;
-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.Regex;
-import org.eclipse.scout.sdk.util.SdkProperties;
-import org.eclipse.scout.sdk.util.type.TypeFilters;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-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>LabelFieldNewWizardPage</h3> ...
- */
-public class LabelFieldNewWizardPage 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 LabelFieldNewWizardPage(IType declaringType) {
- super(LabelFieldNewWizardPage.class.getName());
- setTitle(Texts.get("NewLabelField"));
- setDescription(Texts.get("CreateANewLabelField"));
- m_declaringType = declaringType;
- setSuperType(TypeUtility.getType(RuntimeClasses.AbstractLabelField));
- m_sibling = SiblingProposal.SIBLING_END;
- }
-
- @Override
- protected void createContent(Composite parent) {
-
- 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 {
- LabelFieldNewOperation operation = new LabelFieldNewOperation(m_declaringType);
- operation.setFormatSource(true);
- // write back members
- if (getNlsName() != null) {
- operation.setNlsEntry(getNlsName());
- }
- operation.setTypeName(getTypeName());
- if (getSuperType() != null) {
- operation.setSuperTypeSignature(Signature.createTypeSignature(getSuperType().getFullyQualifiedName(), true));
- }
- 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 {
- if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_FORM_FIELD)) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
- }
- // check not allowed names
- if (ScoutTypeUtility.getAllTypes(m_declaringType.getCompilationUnit(), TypeFilters.getRegexSimpleNameFilter(getTypeName())).length > 0) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
- }
- if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
- return Status.OK_STATUS;
- }
- else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
- return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
- }
- else {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
- }
- }
-
- /**
- * @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);
- }
- }
-}
+/*******************************************************************************
+ * 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.labelfield;
+
+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.jdt.core.Signature;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.nls.sdk.model.INlsEntry;
+import org.eclipse.scout.sdk.RuntimeClasses;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.operation.form.field.LabelFieldNewOperation;
+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.Regex;
+import org.eclipse.scout.sdk.util.SdkProperties;
+import org.eclipse.scout.sdk.util.type.TypeFilters;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+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>LabelFieldNewWizardPage</h3> ...
+ */
+public class LabelFieldNewWizardPage 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 LabelFieldNewWizardPage(IType declaringType) {
+ super(LabelFieldNewWizardPage.class.getName());
+ setTitle(Texts.get("NewLabelField"));
+ setDescription(Texts.get("CreateANewLabelField"));
+ m_declaringType = declaringType;
+ setSuperType(TypeUtility.getType(RuntimeClasses.AbstractLabelField));
+ m_sibling = SiblingProposal.SIBLING_END;
+ }
+
+ @Override
+ protected void createContent(Composite parent) {
+
+ 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 {
+ LabelFieldNewOperation operation = new LabelFieldNewOperation(m_declaringType);
+ operation.setFormatSource(true);
+ // write back members
+ if (getNlsName() != null) {
+ operation.setNlsEntry(getNlsName());
+ }
+ operation.setTypeName(getTypeName());
+ if (getSuperType() != null) {
+ operation.setSuperTypeSignature(Signature.createTypeSignature(getSuperType().getFullyQualifiedName(), true));
+ }
+ 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 {
+ if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_FORM_FIELD)) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
+ }
+ // check not allowed names
+ if (ScoutTypeUtility.getAllTypes(m_declaringType.getCompilationUnit(), TypeFilters.getRegexSimpleNameFilter(getTypeName())).length > 0) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
+ }
+ if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return Status.OK_STATUS;
+ }
+ else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
+ }
+ else {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
+ }
+ }
+
+ /**
+ * @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.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/listbox/ListBoxFieldNewWizard.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/listbox/ListBoxFieldNewWizard.java
index 4267556fa..ef1e85e4c 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/listbox/ListBoxFieldNewWizard.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/listbox/ListBoxFieldNewWizard.java
@@ -1,46 +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.listbox;
-
-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 ListBoxFieldNewWizard extends AbstractFormFieldWizard {
-
- private ListBoxFieldNewWizardPage m_page1;
-
- public ListBoxFieldNewWizard() {
- setWindowTitle(Texts.get("NewListboxField"));
- }
-
- @Override
- public void initWizard(IType declaringType) {
- super.initWizard(declaringType);
- m_page1 = new ListBoxFieldNewWizardPage(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);
- }
- }
-}
+/*******************************************************************************
+ * 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.listbox;
+
+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 ListBoxFieldNewWizard extends AbstractFormFieldWizard {
+
+ private ListBoxFieldNewWizardPage m_page1;
+
+ public ListBoxFieldNewWizard() {
+ setWindowTitle(Texts.get("NewListboxField"));
+ }
+
+ @Override
+ public void initWizard(IType declaringType) {
+ super.initWizard(declaringType);
+ m_page1 = new ListBoxFieldNewWizardPage(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/listbox/ListBoxFieldNewWizardPage.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/listbox/ListBoxFieldNewWizardPage.java
index 1284000c6..bc574ce74 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/listbox/ListBoxFieldNewWizardPage.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/listbox/ListBoxFieldNewWizardPage.java
@@ -1,344 +1,344 @@
-/*******************************************************************************
- * 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.listbox;
-
-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.jdt.core.Signature;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.nls.sdk.model.INlsEntry;
-import org.eclipse.scout.sdk.RuntimeClasses;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.operation.form.field.ListBoxFieldNewOperation;
-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.fields.proposal.javaelement.AbstractJavaElementContentProvider;
-import org.eclipse.scout.sdk.ui.fields.proposal.signature.SignatureProposalProvider;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
-import org.eclipse.scout.sdk.util.Regex;
-import org.eclipse.scout.sdk.util.SdkProperties;
-import org.eclipse.scout.sdk.util.type.TypeFilters;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-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>DefaultFormFieldNewWizardPage</h3> ...
- */
-public class ListBoxFieldNewWizardPage extends AbstractWorkspaceWizardPage {
-
- final IType iListBox = TypeUtility.getType(RuntimeClasses.IListBox);
- final IType abstractListBox = TypeUtility.getType(RuntimeClasses.AbstractListBox);
-
- final IType iCodeType = TypeUtility.getType(RuntimeClasses.ICodeType);
- final IType abstractCodeType = TypeUtility.getType(RuntimeClasses.AbstractCodeType);
-
- private INlsEntry m_nlsName;
- private String m_typeName;
- private IType m_superType;
- private String m_genericSignature;
- private IType m_codeType;
- private SiblingProposal m_sibling;
-
- private ProposalTextField m_nlsNameField;
- private StyledTextField m_typeNameField;
- private ProposalTextField m_genericTypeField;
- private ProposalTextField m_codeTypeField;
- private ProposalTextField m_siblingField;
-
- // process members
- private final IType m_declaringType;
- private IType m_createdField;
-
- public ListBoxFieldNewWizardPage(IType declaringType) {
- super(ListBoxFieldNewWizardPage.class.getName());
- setTitle(Texts.get("NewListboxField"));
- setDescription(Texts.get("CreateANewListBoxField"));
- m_declaringType = declaringType;
- // default
- m_superType = abstractListBox;
- m_genericSignature = Signature.createTypeSignature(Long.class.getName(), true);
- m_sibling = SiblingProposal.SIBLING_END;
- }
-
- @Override
- protected void createContent(Composite parent) {
-
- 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_genericTypeField = getFieldToolkit().createSignatureProposalField(parent, Texts.get("GenericType"), ScoutTypeUtility.getScoutBundle(m_declaringType), SignatureProposalProvider.DEFAULT_MOST_USED);
- m_genericTypeField.acceptProposal(getGenericSignature());
- m_genericTypeField.setEnabled(TypeUtility.isGenericType(getSuperType()));
- m_genericTypeField.addProposalAdapterListener(new IProposalAdapterListener() {
- @Override
- public void proposalAccepted(ContentProposalEvent event) {
- m_genericSignature = (String) event.proposal;
- pingStateChanging();
- }
- });
-
- m_codeTypeField = getFieldToolkit().createJavaElementProposalField(parent, Texts.get("CodeType"), new AbstractJavaElementContentProvider() {
- @Override
- protected Object[][] computeProposals() {
- return new Object[][]{ScoutTypeUtility.getClassesOnClasspath(iCodeType, m_declaringType.getJavaProject())};
- }
- });
- m_codeTypeField.acceptProposal(getCodeType());
- m_codeTypeField.addProposalAdapterListener(new IProposalAdapterListener() {
- @Override
- public void proposalAccepted(ContentProposalEvent event) {
- m_codeType = (IType) event.proposal;
- 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_genericTypeField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- m_codeTypeField.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 {
- ListBoxFieldNewOperation operation = new ListBoxFieldNewOperation(m_declaringType);
- operation.setFormatSource(true);
- // write back members
- if (getNlsName() != null) {
- operation.setNlsEntry(getNlsName());
- }
- operation.setTypeName(getTypeName());
- if (getSuperType() != null) {
- String sig = null;
- if (getGenericSignature() != null) {
- sig = Signature.createTypeSignature(getSuperType().getFullyQualifiedName() + "<" + Signature.toString(getGenericSignature()) + ">", true);
- }
- else {
- sig = Signature.createTypeSignature(getSuperType().getFullyQualifiedName(), true);
- }
- operation.setSuperTypeSignature(sig);
- }
-
- operation.setCodeType(getCodeType());
- 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());
- multiStatus.add(getStatusGenericType());
- if (isControlCreated()) {
- m_genericTypeField.setEnabled(TypeUtility.isGenericType(getSuperType()));
- }
- }
- catch (JavaModelException e) {
- ScoutSdkUi.logError("could not validate name field.", e);
- }
- }
-
- protected IStatus getStatusNameField() throws JavaModelException {
- if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_FORM_FIELD)) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
- }
- // check not allowed names
- if (ScoutTypeUtility.getAllTypes(m_declaringType.getCompilationUnit(), TypeFilters.getRegexSimpleNameFilter(getTypeName())).length > 0) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
- }
- if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
- return Status.OK_STATUS;
- }
- else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
- return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
- }
- else {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
- }
- }
-
- protected IStatus getStatusGenericType() throws JavaModelException {
- if (TypeUtility.isGenericType(getSuperType())) {
- if (getGenericSignature() == null) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("GenericTypeCanNotBeNull"));
- }
- }
- return Status.OK_STATUS;
- }
-
- /**
- * @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 void setGenericSignature(String genericSignature) {
- try {
- setStateChanging(true);
- m_genericSignature = genericSignature;
- if (isControlCreated()) {
- m_genericTypeField.acceptProposal(genericSignature);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- public String getGenericSignature() {
- return m_genericSignature;
- }
-
- public void setCodeType(IType codeType) {
- try {
- setStateChanging(true);
- m_codeType = codeType;
- if (isControlCreated()) {
- m_codeTypeField.acceptProposal(codeType);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- public IType getCodeType() {
- return m_codeType;
- }
-
- 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);
- }
- }
-}
+/*******************************************************************************
+ * 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.listbox;
+
+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.jdt.core.Signature;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.nls.sdk.model.INlsEntry;
+import org.eclipse.scout.sdk.RuntimeClasses;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.operation.form.field.ListBoxFieldNewOperation;
+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.fields.proposal.javaelement.AbstractJavaElementContentProvider;
+import org.eclipse.scout.sdk.ui.fields.proposal.signature.SignatureProposalProvider;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
+import org.eclipse.scout.sdk.util.Regex;
+import org.eclipse.scout.sdk.util.SdkProperties;
+import org.eclipse.scout.sdk.util.type.TypeFilters;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+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>DefaultFormFieldNewWizardPage</h3> ...
+ */
+public class ListBoxFieldNewWizardPage extends AbstractWorkspaceWizardPage {
+
+ final IType iListBox = TypeUtility.getType(RuntimeClasses.IListBox);
+ final IType abstractListBox = TypeUtility.getType(RuntimeClasses.AbstractListBox);
+
+ final IType iCodeType = TypeUtility.getType(RuntimeClasses.ICodeType);
+ final IType abstractCodeType = TypeUtility.getType(RuntimeClasses.AbstractCodeType);
+
+ private INlsEntry m_nlsName;
+ private String m_typeName;
+ private IType m_superType;
+ private String m_genericSignature;
+ private IType m_codeType;
+ private SiblingProposal m_sibling;
+
+ private ProposalTextField m_nlsNameField;
+ private StyledTextField m_typeNameField;
+ private ProposalTextField m_genericTypeField;
+ private ProposalTextField m_codeTypeField;
+ private ProposalTextField m_siblingField;
+
+ // process members
+ private final IType m_declaringType;
+ private IType m_createdField;
+
+ public ListBoxFieldNewWizardPage(IType declaringType) {
+ super(ListBoxFieldNewWizardPage.class.getName());
+ setTitle(Texts.get("NewListboxField"));
+ setDescription(Texts.get("CreateANewListBoxField"));
+ m_declaringType = declaringType;
+ // default
+ m_superType = abstractListBox;
+ m_genericSignature = Signature.createTypeSignature(Long.class.getName(), true);
+ m_sibling = SiblingProposal.SIBLING_END;
+ }
+
+ @Override
+ protected void createContent(Composite parent) {
+
+ 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_genericTypeField = getFieldToolkit().createSignatureProposalField(parent, Texts.get("GenericType"), ScoutTypeUtility.getScoutBundle(m_declaringType), SignatureProposalProvider.DEFAULT_MOST_USED);
+ m_genericTypeField.acceptProposal(getGenericSignature());
+ m_genericTypeField.setEnabled(TypeUtility.isGenericType(getSuperType()));
+ m_genericTypeField.addProposalAdapterListener(new IProposalAdapterListener() {
+ @Override
+ public void proposalAccepted(ContentProposalEvent event) {
+ m_genericSignature = (String) event.proposal;
+ pingStateChanging();
+ }
+ });
+
+ m_codeTypeField = getFieldToolkit().createJavaElementProposalField(parent, Texts.get("CodeType"), new AbstractJavaElementContentProvider() {
+ @Override
+ protected Object[][] computeProposals() {
+ return new Object[][]{ScoutTypeUtility.getClassesOnClasspath(iCodeType, m_declaringType.getJavaProject())};
+ }
+ });
+ m_codeTypeField.acceptProposal(getCodeType());
+ m_codeTypeField.addProposalAdapterListener(new IProposalAdapterListener() {
+ @Override
+ public void proposalAccepted(ContentProposalEvent event) {
+ m_codeType = (IType) event.proposal;
+ 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_genericTypeField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ m_codeTypeField.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 {
+ ListBoxFieldNewOperation operation = new ListBoxFieldNewOperation(m_declaringType);
+ operation.setFormatSource(true);
+ // write back members
+ if (getNlsName() != null) {
+ operation.setNlsEntry(getNlsName());
+ }
+ operation.setTypeName(getTypeName());
+ if (getSuperType() != null) {
+ String sig = null;
+ if (getGenericSignature() != null) {
+ sig = Signature.createTypeSignature(getSuperType().getFullyQualifiedName() + "<" + Signature.toString(getGenericSignature()) + ">", true);
+ }
+ else {
+ sig = Signature.createTypeSignature(getSuperType().getFullyQualifiedName(), true);
+ }
+ operation.setSuperTypeSignature(sig);
+ }
+
+ operation.setCodeType(getCodeType());
+ 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());
+ multiStatus.add(getStatusGenericType());
+ if (isControlCreated()) {
+ m_genericTypeField.setEnabled(TypeUtility.isGenericType(getSuperType()));
+ }
+ }
+ catch (JavaModelException e) {
+ ScoutSdkUi.logError("could not validate name field.", e);
+ }
+ }
+
+ protected IStatus getStatusNameField() throws JavaModelException {
+ if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_FORM_FIELD)) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
+ }
+ // check not allowed names
+ if (ScoutTypeUtility.getAllTypes(m_declaringType.getCompilationUnit(), TypeFilters.getRegexSimpleNameFilter(getTypeName())).length > 0) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
+ }
+ if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return Status.OK_STATUS;
+ }
+ else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
+ }
+ else {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
+ }
+ }
+
+ protected IStatus getStatusGenericType() throws JavaModelException {
+ if (TypeUtility.isGenericType(getSuperType())) {
+ if (getGenericSignature() == null) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("GenericTypeCanNotBeNull"));
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+ /**
+ * @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 void setGenericSignature(String genericSignature) {
+ try {
+ setStateChanging(true);
+ m_genericSignature = genericSignature;
+ if (isControlCreated()) {
+ m_genericTypeField.acceptProposal(genericSignature);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ public String getGenericSignature() {
+ return m_genericSignature;
+ }
+
+ public void setCodeType(IType codeType) {
+ try {
+ setStateChanging(true);
+ m_codeType = codeType;
+ if (isControlCreated()) {
+ m_codeTypeField.acceptProposal(codeType);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ public IType getCodeType() {
+ return m_codeType;
+ }
+
+ 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.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/longfield/LongFieldNewWizard.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/longfield/LongFieldNewWizard.java
index 93b13eb6e..c1b0033aa 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/longfield/LongFieldNewWizard.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/longfield/LongFieldNewWizard.java
@@ -1,46 +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.longfield;
-
-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 LongFieldNewWizard extends AbstractFormFieldWizard {
-
- private LongFieldNewWizardPage m_page1;
-
- public LongFieldNewWizard() {
- setWindowTitle(Texts.get("NewLongField"));
- }
-
- @Override
- public void initWizard(IType declaringType) {
- super.initWizard(declaringType);
- m_page1 = new LongFieldNewWizardPage(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);
- }
- }
-}
+/*******************************************************************************
+ * 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.longfield;
+
+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 LongFieldNewWizard extends AbstractFormFieldWizard {
+
+ private LongFieldNewWizardPage m_page1;
+
+ public LongFieldNewWizard() {
+ setWindowTitle(Texts.get("NewLongField"));
+ }
+
+ @Override
+ public void initWizard(IType declaringType) {
+ super.initWizard(declaringType);
+ m_page1 = new LongFieldNewWizardPage(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/longfield/LongFieldNewWizardPage.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/longfield/LongFieldNewWizardPage.java
index 06717d21e..d958fd73d 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/longfield/LongFieldNewWizardPage.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/longfield/LongFieldNewWizardPage.java
@@ -1,246 +1,246 @@
-/*******************************************************************************
- * 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.longfield;
-
-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.jdt.core.Signature;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.nls.sdk.model.INlsEntry;
-import org.eclipse.scout.sdk.RuntimeClasses;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.operation.form.field.LongFieldNewOperation;
-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.Regex;
-import org.eclipse.scout.sdk.util.SdkProperties;
-import org.eclipse.scout.sdk.util.type.TypeFilters;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-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>LongFieldNewWizardPage</h3> ...
- */
-public class LongFieldNewWizardPage 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 LongFieldNewWizardPage(IType declaringType) {
- super(LongFieldNewWizardPage.class.getName());
- setTitle(Texts.get("NewLongField"));
- setDescription(Texts.get("CreateANewLongField"));
- m_declaringType = declaringType;
- setSuperType(TypeUtility.getType(RuntimeClasses.AbstractLongField));
- m_sibling = SiblingProposal.SIBLING_END;
- }
-
- @Override
- protected void createContent(Composite parent) {
-
- 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 {
- LongFieldNewOperation operation = new LongFieldNewOperation(m_declaringType);
- operation.setFormatSource(true);
- // write back members
- if (getNlsName() != null) {
- operation.setNlsEntry(getNlsName());
- }
- operation.setTypeName(getTypeName());
- if (getSuperType() != null) {
- operation.setSuperTypeSignature(Signature.createTypeSignature(getSuperType().getFullyQualifiedName(), true));
- }
- 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 {
- if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_FORM_FIELD)) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
- }
- // check not allowed names
- if (ScoutTypeUtility.getAllTypes(m_declaringType.getCompilationUnit(), TypeFilters.getRegexSimpleNameFilter(getTypeName())).length > 0) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
- }
- if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
- return Status.OK_STATUS;
- }
- else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
- return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
- }
- else {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
- }
- }
-
- /**
- * @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);
- }
- }
-}
+/*******************************************************************************
+ * 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.longfield;
+
+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.jdt.core.Signature;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.nls.sdk.model.INlsEntry;
+import org.eclipse.scout.sdk.RuntimeClasses;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.operation.form.field.LongFieldNewOperation;
+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.Regex;
+import org.eclipse.scout.sdk.util.SdkProperties;
+import org.eclipse.scout.sdk.util.type.TypeFilters;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+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>LongFieldNewWizardPage</h3> ...
+ */
+public class LongFieldNewWizardPage 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 LongFieldNewWizardPage(IType declaringType) {
+ super(LongFieldNewWizardPage.class.getName());
+ setTitle(Texts.get("NewLongField"));
+ setDescription(Texts.get("CreateANewLongField"));
+ m_declaringType = declaringType;
+ setSuperType(TypeUtility.getType(RuntimeClasses.AbstractLongField));
+ m_sibling = SiblingProposal.SIBLING_END;
+ }
+
+ @Override
+ protected void createContent(Composite parent) {
+
+ 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 {
+ LongFieldNewOperation operation = new LongFieldNewOperation(m_declaringType);
+ operation.setFormatSource(true);
+ // write back members
+ if (getNlsName() != null) {
+ operation.setNlsEntry(getNlsName());
+ }
+ operation.setTypeName(getTypeName());
+ if (getSuperType() != null) {
+ operation.setSuperTypeSignature(Signature.createTypeSignature(getSuperType().getFullyQualifiedName(), true));
+ }
+ 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 {
+ if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_FORM_FIELD)) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
+ }
+ // check not allowed names
+ if (ScoutTypeUtility.getAllTypes(m_declaringType.getCompilationUnit(), TypeFilters.getRegexSimpleNameFilter(getTypeName())).length > 0) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
+ }
+ if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return Status.OK_STATUS;
+ }
+ else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
+ }
+ else {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
+ }
+ }
+
+ /**
+ * @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.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/mailfield/MailFieldNewWizard.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/mailfield/MailFieldNewWizard.java
index c74bfae0a..655c51503 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/mailfield/MailFieldNewWizard.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/mailfield/MailFieldNewWizard.java
@@ -1,46 +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.mailfield;
-
-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 MailFieldNewWizard extends AbstractFormFieldWizard {
-
- private MailFieldNewWizardPage m_page1;
-
- public MailFieldNewWizard() {
- setWindowTitle(Texts.get("NewMailField"));
- }
-
- @Override
- public void initWizard(IType declaringType) {
- super.initWizard(declaringType);
- m_page1 = new MailFieldNewWizardPage(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);
- }
- }
-}
+/*******************************************************************************
+ * 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.mailfield;
+
+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 MailFieldNewWizard extends AbstractFormFieldWizard {
+
+ private MailFieldNewWizardPage m_page1;
+
+ public MailFieldNewWizard() {
+ setWindowTitle(Texts.get("NewMailField"));
+ }
+
+ @Override
+ public void initWizard(IType declaringType) {
+ super.initWizard(declaringType);
+ m_page1 = new MailFieldNewWizardPage(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/mailfield/MailFieldNewWizardPage.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/mailfield/MailFieldNewWizardPage.java
index 51374e982..5f6ec3f13 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/mailfield/MailFieldNewWizardPage.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/mailfield/MailFieldNewWizardPage.java
@@ -1,248 +1,248 @@
-/*******************************************************************************
- * 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.mailfield;
-
-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.jdt.core.Signature;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.nls.sdk.model.INlsEntry;
-import org.eclipse.scout.sdk.RuntimeClasses;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.operation.form.field.MailFieldNewOperation;
-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.Regex;
-import org.eclipse.scout.sdk.util.SdkProperties;
-import org.eclipse.scout.sdk.util.type.TypeFilters;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-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>MailFieldNewWizardPage</h3> ...
- */
-public class MailFieldNewWizardPage 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_superTypeField;
- private ProposalTextField m_siblingField;
-
- // process members
- private final IType m_declaringType;
- private IType m_createdField;
-
- public MailFieldNewWizardPage(IType declaringType) {
- super(MailFieldNewWizardPage.class.getName());
- setTitle(Texts.get("NewMailField"));
- setDescription(Texts.get("CreateANewMailField"));
- m_declaringType = declaringType;
- setSuperType(TypeUtility.getType(RuntimeClasses.AbstractMailField));
- m_sibling = SiblingProposal.SIBLING_END;
- }
-
- @Override
- protected void createContent(Composite parent) {
-
- 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_superTypeField.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 {
- MailFieldNewOperation operation = new MailFieldNewOperation(m_declaringType);
- operation.setFormatSource(true);
- // write back members
- if (getNlsName() != null) {
- operation.setNlsEntry(getNlsName());
- }
- operation.setTypeName(getTypeName());
- if (getSuperType() != null) {
- operation.setSuperTypeSignature(Signature.createTypeSignature(getSuperType().getFullyQualifiedName(), true));
- }
- 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 {
- if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_FORM_FIELD)) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
- }
- // check not allowed names
- if (ScoutTypeUtility.getAllTypes(m_declaringType.getCompilationUnit(), TypeFilters.getRegexSimpleNameFilter(getTypeName())).length > 0) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
- }
- if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
- return Status.OK_STATUS;
- }
- else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
- return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
- }
- else {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
- }
- }
-
- /**
- * @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);
- }
- }
-}
+/*******************************************************************************
+ * 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.mailfield;
+
+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.jdt.core.Signature;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.nls.sdk.model.INlsEntry;
+import org.eclipse.scout.sdk.RuntimeClasses;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.operation.form.field.MailFieldNewOperation;
+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.Regex;
+import org.eclipse.scout.sdk.util.SdkProperties;
+import org.eclipse.scout.sdk.util.type.TypeFilters;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+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>MailFieldNewWizardPage</h3> ...
+ */
+public class MailFieldNewWizardPage 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_superTypeField;
+ private ProposalTextField m_siblingField;
+
+ // process members
+ private final IType m_declaringType;
+ private IType m_createdField;
+
+ public MailFieldNewWizardPage(IType declaringType) {
+ super(MailFieldNewWizardPage.class.getName());
+ setTitle(Texts.get("NewMailField"));
+ setDescription(Texts.get("CreateANewMailField"));
+ m_declaringType = declaringType;
+ setSuperType(TypeUtility.getType(RuntimeClasses.AbstractMailField));
+ m_sibling = SiblingProposal.SIBLING_END;
+ }
+
+ @Override
+ protected void createContent(Composite parent) {
+
+ 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_superTypeField.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 {
+ MailFieldNewOperation operation = new MailFieldNewOperation(m_declaringType);
+ operation.setFormatSource(true);
+ // write back members
+ if (getNlsName() != null) {
+ operation.setNlsEntry(getNlsName());
+ }
+ operation.setTypeName(getTypeName());
+ if (getSuperType() != null) {
+ operation.setSuperTypeSignature(Signature.createTypeSignature(getSuperType().getFullyQualifiedName(), true));
+ }
+ 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 {
+ if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_FORM_FIELD)) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
+ }
+ // check not allowed names
+ if (ScoutTypeUtility.getAllTypes(m_declaringType.getCompilationUnit(), TypeFilters.getRegexSimpleNameFilter(getTypeName())).length > 0) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
+ }
+ if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return Status.OK_STATUS;
+ }
+ else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
+ }
+ else {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
+ }
+ }
+
+ /**
+ * @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.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/matrixfield/MatrixFieldNewWizard.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/matrixfield/MatrixFieldNewWizard.java
index 28c79ff8c..f779bd03e 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/matrixfield/MatrixFieldNewWizard.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/matrixfield/MatrixFieldNewWizard.java
@@ -1,46 +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.matrixfield;
-
-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 MatrixFieldNewWizard extends AbstractFormFieldWizard {
-
- private MatrixFieldNewWizardPage m_page1;
-
- public MatrixFieldNewWizard() {
- setWindowTitle(Texts.get("NewMatrixField"));
- }
-
- @Override
- public void initWizard(IType declaringType) {
- super.initWizard(declaringType);
- m_page1 = new MatrixFieldNewWizardPage(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);
- }
- }
-}
+/*******************************************************************************
+ * 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.matrixfield;
+
+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 MatrixFieldNewWizard extends AbstractFormFieldWizard {
+
+ private MatrixFieldNewWizardPage m_page1;
+
+ public MatrixFieldNewWizard() {
+ setWindowTitle(Texts.get("NewMatrixField"));
+ }
+
+ @Override
+ public void initWizard(IType declaringType) {
+ super.initWizard(declaringType);
+ m_page1 = new MatrixFieldNewWizardPage(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/matrixfield/MatrixFieldNewWizardPage.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/matrixfield/MatrixFieldNewWizardPage.java
index 00c3f2b66..b280dda4f 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/matrixfield/MatrixFieldNewWizardPage.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/matrixfield/MatrixFieldNewWizardPage.java
@@ -1,245 +1,245 @@
-/*******************************************************************************
- * 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.matrixfield;
-
-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.jdt.core.Signature;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.nls.sdk.model.INlsEntry;
-import org.eclipse.scout.sdk.RuntimeClasses;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.operation.form.field.MatrixFieldNewOperation;
-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.Regex;
-import org.eclipse.scout.sdk.util.SdkProperties;
-import org.eclipse.scout.sdk.util.type.TypeFilters;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-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>MatrixFieldNewWizardPage</h3> ...
- */
-public class MatrixFieldNewWizardPage 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 MatrixFieldNewWizardPage(IType declaringType) {
- super(MatrixFieldNewWizardPage.class.getName());
- setTitle(Texts.get("NewMatrixField"));
- setDescription(Texts.get("CreateANewMatrixField"));
- m_declaringType = declaringType;
- setSuperType(TypeUtility.getType(RuntimeClasses.AbstractMatrixField));
- m_sibling = SiblingProposal.SIBLING_END;
- }
-
- @Override
- protected void createContent(Composite parent) {
- 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 {
- MatrixFieldNewOperation operation = new MatrixFieldNewOperation(m_declaringType);
- operation.setFormatSource(true);
- // write back members
- if (getNlsName() != null) {
- operation.setNlsEntry(getNlsName());
- }
- operation.setTypeName(getTypeName());
- if (getSuperType() != null) {
- operation.setSuperTypeSignature(Signature.createTypeSignature(getSuperType().getFullyQualifiedName(), true));
- }
- 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 {
- if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_FORM_FIELD)) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
- }
- // check not allowed names
- if (ScoutTypeUtility.getAllTypes(m_declaringType.getCompilationUnit(), TypeFilters.getRegexSimpleNameFilter(getTypeName())).length > 0) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
- }
- if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
- return Status.OK_STATUS;
- }
- else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
- return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
- }
- else {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
- }
- }
-
- /**
- * @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);
- }
- }
-}
+/*******************************************************************************
+ * 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.matrixfield;
+
+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.jdt.core.Signature;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.nls.sdk.model.INlsEntry;
+import org.eclipse.scout.sdk.RuntimeClasses;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.operation.form.field.MatrixFieldNewOperation;
+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.Regex;
+import org.eclipse.scout.sdk.util.SdkProperties;
+import org.eclipse.scout.sdk.util.type.TypeFilters;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+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>MatrixFieldNewWizardPage</h3> ...
+ */
+public class MatrixFieldNewWizardPage 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 MatrixFieldNewWizardPage(IType declaringType) {
+ super(MatrixFieldNewWizardPage.class.getName());
+ setTitle(Texts.get("NewMatrixField"));
+ setDescription(Texts.get("CreateANewMatrixField"));
+ m_declaringType = declaringType;
+ setSuperType(TypeUtility.getType(RuntimeClasses.AbstractMatrixField));
+ m_sibling = SiblingProposal.SIBLING_END;
+ }
+
+ @Override
+ protected void createContent(Composite parent) {
+ 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 {
+ MatrixFieldNewOperation operation = new MatrixFieldNewOperation(m_declaringType);
+ operation.setFormatSource(true);
+ // write back members
+ if (getNlsName() != null) {
+ operation.setNlsEntry(getNlsName());
+ }
+ operation.setTypeName(getTypeName());
+ if (getSuperType() != null) {
+ operation.setSuperTypeSignature(Signature.createTypeSignature(getSuperType().getFullyQualifiedName(), true));
+ }
+ 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 {
+ if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_FORM_FIELD)) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
+ }
+ // check not allowed names
+ if (ScoutTypeUtility.getAllTypes(m_declaringType.getCompilationUnit(), TypeFilters.getRegexSimpleNameFilter(getTypeName())).length > 0) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
+ }
+ if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return Status.OK_STATUS;
+ }
+ else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
+ }
+ else {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
+ }
+ }
+
+ /**
+ * @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.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/plannerfield/PlannerFieldNewWizard.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/plannerfield/PlannerFieldNewWizard.java
index 1fae3cc0a..244b9c722 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/plannerfield/PlannerFieldNewWizard.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/plannerfield/PlannerFieldNewWizard.java
@@ -1,46 +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.plannerfield;
-
-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 PlannerFieldNewWizard extends AbstractFormFieldWizard {
-
- private PlannerFieldNewWizardPage m_page1;
-
- public PlannerFieldNewWizard() {
- setWindowTitle(Texts.get("NewPlannerField"));
- }
-
- @Override
- public void initWizard(IType declaringType) {
- super.initWizard(declaringType);
- m_page1 = new PlannerFieldNewWizardPage(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);
- }
- }
-}
+/*******************************************************************************
+ * 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.plannerfield;
+
+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 PlannerFieldNewWizard extends AbstractFormFieldWizard {
+
+ private PlannerFieldNewWizardPage m_page1;
+
+ public PlannerFieldNewWizard() {
+ setWindowTitle(Texts.get("NewPlannerField"));
+ }
+
+ @Override
+ public void initWizard(IType declaringType) {
+ super.initWizard(declaringType);
+ m_page1 = new PlannerFieldNewWizardPage(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/plannerfield/PlannerFieldNewWizardPage.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/plannerfield/PlannerFieldNewWizardPage.java
index 3fc1eeb35..72f9604ae 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/plannerfield/PlannerFieldNewWizardPage.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/plannerfield/PlannerFieldNewWizardPage.java
@@ -1,245 +1,245 @@
-/*******************************************************************************
- * 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.plannerfield;
-
-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.jdt.core.Signature;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.nls.sdk.model.INlsEntry;
-import org.eclipse.scout.sdk.RuntimeClasses;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.operation.form.field.PlannerFieldNewOperation;
-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.Regex;
-import org.eclipse.scout.sdk.util.SdkProperties;
-import org.eclipse.scout.sdk.util.type.TypeFilters;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-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>PlannerFieldNewWizardPage</h3> ...
- */
-public class PlannerFieldNewWizardPage 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 PlannerFieldNewWizardPage(IType declaringType) {
- super(PlannerFieldNewWizardPage.class.getName());
- setTitle(Texts.get("NewPlannerField"));
- setDescription(Texts.get("CreateANewPlannerField"));
- m_declaringType = declaringType;
- setSuperType(TypeUtility.getType(RuntimeClasses.AbstractPlannerField));
- m_sibling = SiblingProposal.SIBLING_END;
- }
-
- @Override
- protected void createContent(Composite parent) {
- 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 {
- PlannerFieldNewOperation operation = new PlannerFieldNewOperation(m_declaringType);
- operation.setFormatSource(true);
- // write back members
- if (getNlsName() != null) {
- operation.setNlsEntry(getNlsName());
- }
- operation.setTypeName(getTypeName());
- if (getSuperType() != null) {
- operation.setSuperTypeSignature(Signature.createTypeSignature(getSuperType().getFullyQualifiedName(), true));
- }
- 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 {
- if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_FORM_FIELD)) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
- }
- // check not allowed names
- if (ScoutTypeUtility.getAllTypes(m_declaringType.getCompilationUnit(), TypeFilters.getRegexSimpleNameFilter(getTypeName())).length > 0) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
- }
- if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
- return Status.OK_STATUS;
- }
- else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
- return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
- }
- else {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
- }
- }
-
- /**
- * @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);
- }
- }
-}
+/*******************************************************************************
+ * 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.plannerfield;
+
+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.jdt.core.Signature;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.nls.sdk.model.INlsEntry;
+import org.eclipse.scout.sdk.RuntimeClasses;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.operation.form.field.PlannerFieldNewOperation;
+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.Regex;
+import org.eclipse.scout.sdk.util.SdkProperties;
+import org.eclipse.scout.sdk.util.type.TypeFilters;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+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>PlannerFieldNewWizardPage</h3> ...
+ */
+public class PlannerFieldNewWizardPage 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 PlannerFieldNewWizardPage(IType declaringType) {
+ super(PlannerFieldNewWizardPage.class.getName());
+ setTitle(Texts.get("NewPlannerField"));
+ setDescription(Texts.get("CreateANewPlannerField"));
+ m_declaringType = declaringType;
+ setSuperType(TypeUtility.getType(RuntimeClasses.AbstractPlannerField));
+ m_sibling = SiblingProposal.SIBLING_END;
+ }
+
+ @Override
+ protected void createContent(Composite parent) {
+ 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 {
+ PlannerFieldNewOperation operation = new PlannerFieldNewOperation(m_declaringType);
+ operation.setFormatSource(true);
+ // write back members
+ if (getNlsName() != null) {
+ operation.setNlsEntry(getNlsName());
+ }
+ operation.setTypeName(getTypeName());
+ if (getSuperType() != null) {
+ operation.setSuperTypeSignature(Signature.createTypeSignature(getSuperType().getFullyQualifiedName(), true));
+ }
+ 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 {
+ if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_FORM_FIELD)) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
+ }
+ // check not allowed names
+ if (ScoutTypeUtility.getAllTypes(m_declaringType.getCompilationUnit(), TypeFilters.getRegexSimpleNameFilter(getTypeName())).length > 0) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
+ }
+ if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return Status.OK_STATUS;
+ }
+ else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
+ }
+ else {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
+ }
+ }
+
+ /**
+ * @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.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/radiobutton/RadioButtonNewWizard.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/radiobutton/RadioButtonNewWizard.java
index d6fde3f69..4a4a68de9 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/radiobutton/RadioButtonNewWizard.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/form/fields/radiobutton/RadioButtonNewWizard.java
@@ -1,45 +1,45 @@
-/*******************************************************************************
- * 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.radiobutton;
-
-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 RadioButtonNewWizard extends AbstractFormFieldWizard {
-
- private RadioButtonNewWizardPage m_page1;
-
- public RadioButtonNewWizard() {
- setWindowTitle(Texts.get("NewRadioButtonNoPopup"));
- }
-
- @Override
- public void initWizard(IType declaringType) {
- m_page1 = new RadioButtonNewWizardPage(declaringType);
- addPage(m_page1);
- }
-
- @Override
- public void setSuperType(IType superType) {
- m_page1.setSuperType(superType);
- }
-
- @Override
- protected void postFinishDisplayThread() {
- IType createdField = m_page1.getCreatedRadioButton();
- if (TypeUtility.exists(createdField)) {
- ScoutSdkUi.showJavaElementInEditor(createdField, false);
- }
- }
-}
+/*******************************************************************************
+ * 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.radiobutton;
+
+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 RadioButtonNewWizard extends AbstractFormFieldWizard {
+
+ private RadioButtonNewWizardPage m_page1;
+
+ public RadioButtonNewWizard() {
+ setWindowTitle(Texts.get("NewRadioButtonNoPopup"));
+ }
+
+ @Override
+ public void initWizard(IType declaringType) {
+ m_page1 = new RadioButtonNewWizardPage(declaringType);
+ addPage(m_page1);
+ }
+
+ @Override
+ public void setSuperType(IType superType) {
+ m_page1.setSuperType(superType);
+ }
+
+ @Override
+ protected void postFinishDisplayThread() {
+ IType createdField = m_page1.getCreatedRadioButton();
+ if (TypeUtility.exists(createdField)) {
+ ScoutSdkUi.showJavaElementInEditor(createdField, false);
+ }
+ }
+}

Back to the top