JBoss Tools SVN: r27508 - trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2010-12-15 10:10:21 -0500 (Wed, 15 Dec 2010)
New Revision: 27508
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/NewAnnotationLiteralWizardPage.java
Log:
JBIDE-7875
https://issues.jboss.org/browse/JBIDE-7875
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/NewAnnotationLiteralWizardPage.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/NewAnnotationLiteralWizardPage.java 2010-12-15 14:50:26 UTC (rev 27507)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/NewAnnotationLiteralWizardPage.java 2010-12-15 15:10:21 UTC (rev 27508)
@@ -25,6 +25,8 @@
import org.eclipse.jdt.core.IField;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IMember;
+import org.eclipse.jdt.core.IMethod;
import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.ISourceRange;
import org.eclipse.jdt.core.IType;
@@ -40,6 +42,7 @@
import org.eclipse.jdt.internal.ui.preferences.JavaPreferencesSettings;
import org.eclipse.jdt.ui.CodeGeneration;
import org.eclipse.jdt.ui.wizards.NewClassWizardPage;
+import org.eclipse.jdt.ui.wizards.NewTypeWizardPage.ImportsManager;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.SWT;
@@ -51,6 +54,7 @@
import org.jboss.tools.cdi.core.CDICorePlugin;
import org.jboss.tools.cdi.core.ICDIAnnotation;
import org.jboss.tools.cdi.core.ICDIProject;
+import org.jboss.tools.cdi.core.IParametedType;
import org.jboss.tools.cdi.core.IQualifier;
import org.jboss.tools.cdi.ui.CDIUIMessages;
import org.jboss.tools.cdi.ui.CDIUiImages;
@@ -197,7 +201,10 @@
.getJavaProject());
StringBuffer sb = new StringBuffer();
buf.replace(range.getOffset(), 0, sb.toString());
- createInstanceField(newType, imports, monitor, lineDelimiter);
+ boolean isDefault = modifyMethodContent(newType, imports, monitor, lineDelimiter);
+ if(isDefault) {
+ createInstanceField(newType, imports, monitor, lineDelimiter);
+ }
}
protected void createCustomFields(Composite composite) {
@@ -266,27 +273,37 @@
protected IField createInstanceField(IType type, ImportsManager imports,
IProgressMonitor monitor, String lineDelimiter)
throws CoreException {
+ imports.addImport(CDIConstants.ANNOTATION_LITERAL_TYPE_NAME);
+ IType fieldType = selected.getSourceType();
+ imports.addImport(fieldType.getFullyQualifiedName());
+ String access = "public static final ";
+ String initialization = "new " + type.getElementName() + "()";
+ IJavaElement[] cs = type.getChildren();
+ IJavaElement sibling = cs == null || cs.length == 0 ? null : cs[0];
- imports.addImport(CDIConstants.ANNOTATION_LITERAL_TYPE_NAME);
-
- IType fieldType = fieldType = selected.getSourceType();
+ IField m = createField(type, sibling, imports, "INSTANCE", fieldType.getElementName(), access, initialization, monitor, lineDelimiter);
+ return m;
+ }
- imports.addImport(fieldType.getFullyQualifiedName());
+ protected IField createField(IType type, IJavaElement sibling, ImportsManager imports, String name, String fieldType, String access, String initialization,
+ IProgressMonitor monitor, String lineDelimiter)
+ throws CoreException {
ICompilationUnit cu = type.getCompilationUnit();
JavaModelUtil.reconcile(cu);
CodeGenerationSettings settings = JavaPreferencesSettings
.getCodeGenerationSettings(type.getJavaProject());
settings.createComments = isAddComments();
- String access = "public static final ";
- String fieldHeader = access + " " + fieldType.getElementName() + " " + "INSTANCE" +
- "= new " + type.getElementName() + "()" + ";" + lineDelimiter; //$NON-NLS-1$ //$NON-NLS-2$
- IJavaElement[] cs = type.getChildren();
- IJavaElement sibling = cs == null || cs.length == 0 ? null : cs[0];
+ String fieldHeader = access + " " + fieldType + " " + name;
+ if(initialization != null) {
+ fieldHeader += "= " + initialization;
+ }
+ fieldHeader += ";" + lineDelimiter; //$NON-NLS-1$ //$NON-NLS-2$
+
IField m = type.createField(fieldHeader, sibling, true, null);
- editField(cu, m, fieldType.getElementName(), fieldHeader, lineDelimiter);
+ editField(cu, m, fieldType, fieldHeader, lineDelimiter);
return m;
}
@@ -402,4 +419,93 @@
qualifiers.setValue(type);
}
+ protected boolean modifyMethodContent(IType type, ImportsManager imports,
+ IProgressMonitor monitor, String lineDelimiter) throws CoreException {
+ IMethod[] ms = type.getMethods();
+ IMethod sibling = null;
+ List<String[]> fields = new ArrayList<String[]>();
+ IMethod constructor = null;
+ for (int i = 0; i < ms.length; i++) {
+ if(ms[i].isConstructor()) {
+ constructor = ms[i];
+ continue;
+ }
+ if(sibling == null) {
+ sibling = ms[i];
+ }
+ ICompilationUnit cu = type.getCompilationUnit();
+ synchronized (cu) {
+ cu.reconcile(ICompilationUnit.NO_AST, true, null, null);
+ }
+ IBuffer buf = cu.getBuffer();
+ ISourceRange range = ms[i].getSourceRange();
+
+ int start = -1;
+ int end = -1;
+ StringBuffer sb = new StringBuffer();
+ if("void".equals(ms[i].getReturnType()) || "V".equals(ms[i].getReturnType())) {
+ end = buf.getContents().indexOf("}", range.getOffset());
+ if(end < 0) continue;
+ end = buf.getContents().lastIndexOf(lineDelimiter, end);
+ if(end < 0 || end < range.getOffset()) continue;
+// end += lineDelimiter.length();
+ start = end;
+ } else {
+ start = buf.getContents().indexOf("return", range.getOffset());
+ if(start < 0 || start > range.getOffset() + range.getLength()) continue;
+ start += 7;
+ end = buf.getContents().indexOf(";", start);
+ if(end < 0) continue;
+ end++;
+ }
+ String methodName = ms[i].getElementName();
+ String fieldName = "" + methodName;
+ sb.append(fieldName).append(";");
+ buf.replace(start, end - start, sb.toString());
+ fields.add(new String[]{ms[i].getReturnType(), fieldName});
+ }
+
+ for (int i = 0; i < fields.size(); i++) {
+ String[] data = fields.get(i);
+ String fieldType = data[0];
+ String fieldName = data[1];
+ IParametedType t = NewCDIAnnotationWizardPage.getCDIProject(getPackageFragmentRoot().getJavaProject()).getNature().getTypeFactory().getParametedType(type, fieldType);
+ if(t != null) {
+ data[0] = t.getSimpleName();
+ createField(type, constructor, imports, fieldName, t.getSimpleName(), "private final", null, monitor, lineDelimiter);
+ }
+ }
+
+ if(constructor != null) {
+ constructor.delete(true, monitor);
+ }
+
+ if(!fields.isEmpty()) {
+ String constructorContents = "public " + type.getElementName() + "(";
+ String comments = "/**" + lineDelimiter;
+ for (int i = 0; i < fields.size(); i++) {
+ String[] data = fields.get(i);
+ String fieldType = data[0];
+ String fieldName = data[1];
+ comments += " * @param " + fieldName + lineDelimiter;
+ if(i > 0) constructorContents += ", ";
+ constructorContents += fieldType + " " + fieldName;
+ }
+ comments += "*/" + lineDelimiter;
+ constructorContents += ") {" + lineDelimiter;
+ for (int i = 0; i < fields.size(); i++) {
+ String[] data = fields.get(i);
+ String fieldName = data[1];
+ constructorContents += "this." + fieldName + " = " + fieldName + ";" + lineDelimiter;
+ }
+ constructorContents += "}" + lineDelimiter;
+ if(isAddComments()) {
+ constructorContents = comments + constructorContents;
+ }
+ IMethod m = type.createMethod(constructorContents, sibling, true, monitor);
+ }
+
+ return fields.isEmpty();
+ }
+
}
\ No newline at end of file
14 years, 1 month
JBoss Tools SVN: r27507 - trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-12-15 09:50:26 -0500 (Wed, 15 Dec 2010)
New Revision: 27507
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ProfileComposite.java
Log:
cleanup
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ProfileComposite.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ProfileComposite.java 2010-12-15 14:49:01 UTC (rev 27506)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ProfileComposite.java 2010-12-15 14:50:26 UTC (rev 27507)
@@ -121,11 +121,11 @@
fd.top = new FormAttachment(memoryControl, 8);
storageLabel.setLayoutData(fd);
DeltaCloudHardwareProperty storageProperty = profile.getNamedProperty("storage"); //$NON-NLS-1$
- createStorageControls(memoryControl, memoryProperty, storageProperty, container);
+ createStorageControls(memoryControl, memoryProperty, storageProperty, storageLabel, container);
}
private Control createStorageControls(Control memoryControl, DeltaCloudHardwareProperty memoryProperty,
- DeltaCloudHardwareProperty storageProperty, Composite container) {
+ DeltaCloudHardwareProperty storageProperty, Label storageLabel, Composite container) {
Control storageControl = null;
if (storageProperty != null) {
if (storageProperty.getKind() == DeltaCloudHardwareProperty.Kind.FIXED) {
14 years, 1 month
JBoss Tools SVN: r27506 - trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-12-15 09:49:01 -0500 (Wed, 15 Dec 2010)
New Revision: 27506
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ProfileComposite.java
Log:
cleanup
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ProfileComposite.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ProfileComposite.java 2010-12-15 14:10:23 UTC (rev 27505)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ProfileComposite.java 2010-12-15 14:49:01 UTC (rev 27506)
@@ -30,12 +30,12 @@
* @author Jeff Johnston
*/
public class ProfileComposite {
-
+
private static final String CPU_LABEL = "Cpu.label"; //$NON-NLS-1$
private static final String MEMORY_LABEL = "Memory.label"; //$NON-NLS-1$
private static final String STORAGE_LABEL = "Storage.label"; //$NON-NLS-1$
private static final String DEFAULTED = "Defaulted"; //$NON-NLS-1$
-
+
private Composite container;
private DeltaCloudHardwareProfile profile;
private String cpu;
@@ -55,14 +55,14 @@
private Spinner storageSpinner;
private Combo storageCombo;
private int storageDecDigits;
-
- private int cw = 160;
-
+
+ private static int cw = 160;
+
private ModifyListener spinnerListener = new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
- String value = ((Spinner)e.widget).getText();
+ String value = ((Spinner) e.widget).getText();
if (e.widget == cpuSpinner)
cpu = value;
else if (e.widget == memorySpinner)
@@ -72,12 +72,11 @@
}
};
-
private ModifyListener comboListener = new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
- String value = ((Combo)e.widget).getText();
+ String value = ((Combo) e.widget).getText();
if (e.widget == cpuCombo)
cpu = value;
else if (e.widget == memoryCombo)
@@ -95,83 +94,140 @@
layout.marginHeight = 10;
layout.marginWidth = 10;
container.setLayout(layout);
- Control cpuControl = null;
- Control memoryControl = null;
- Control storageControl = null;
-
+
cpuLabel = new Label(container, SWT.NULL);
cpuLabel.setText(WizardMessages.getString(CPU_LABEL));
-
memoryLabel = new Label(container, SWT.NULL);
memoryLabel.setText(WizardMessages.getString(MEMORY_LABEL));
-
storageLabel = new Label(container, SWT.NULL);
storageLabel.setText(WizardMessages.getString(STORAGE_LABEL));
-
- DeltaCloudHardwareProperty cpuProperty = profile.getNamedProperty("cpu"); //$NON-NLS-1$
+
FormData fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(0, 0);
cpuLabel.setLayoutData(fd);
- if (cpuProperty != null) {
- if (cpuProperty.getKind() == DeltaCloudHardwareProperty.Kind.FIXED) {
- Label cpu = new Label(container, SWT.NULL);
- cpu.setText(cpuProperty.getValue());
+ DeltaCloudHardwareProperty cpuProperty = profile.getNamedProperty("cpu"); //$NON-NLS-1$
+ Control cpuControl = createCpuControls(cpuProperty, storageLabel, container);
+
+ fd = new FormData();
+ fd.left = new FormAttachment(cpuLabel, 0, SWT.LEFT);
+ fd.top = new FormAttachment(cpuLabel, 8);
+ memoryLabel.setLayoutData(fd);
+ DeltaCloudHardwareProperty memoryProperty = profile.getNamedProperty("memory"); //$NON-NLS-1$
+ Control memoryControl = createMemoyControl(cpuControl, memoryProperty, storageLabel, container);
+
+ fd = new FormData();
+ fd.left = new FormAttachment(cpuLabel, 0, SWT.LEFT);
+ fd.top = new FormAttachment(memoryControl, 8);
+ storageLabel.setLayoutData(fd);
+ DeltaCloudHardwareProperty storageProperty = profile.getNamedProperty("storage"); //$NON-NLS-1$
+ createStorageControls(memoryControl, memoryProperty, storageProperty, container);
+ }
+
+ private Control createStorageControls(Control memoryControl, DeltaCloudHardwareProperty memoryProperty,
+ DeltaCloudHardwareProperty storageProperty, Composite container) {
+ Control storageControl = null;
+ if (storageProperty != null) {
+ if (storageProperty.getKind() == DeltaCloudHardwareProperty.Kind.FIXED) {
+ Label storage = new Label(container, SWT.NULL);
+ storage.setText(storageProperty.getValue());
FormData f = new FormData();
f.left = new FormAttachment(storageLabel, 50);
- f.right = new FormAttachment(100, 0);
- cpu.setLayoutData(f);
- cpuControl = cpu;
- } else if (cpuProperty.getKind() == DeltaCloudHardwareProperty.Kind.RANGE) {
- cpuDefaultValue = cpuProperty.getValue();
- cpuSpinner = new Spinner(container, SWT.READ_ONLY);
- cpuSpinner.setMinimum(Integer.valueOf(cpuProperty.getRange().getFirst()));
- cpuSpinner.setMaximum(Integer.valueOf(cpuProperty.getRange().getLast()));
- cpuSpinner.addModifyListener(spinnerListener);
- cpuSpinner.setSelection(Integer.valueOf(cpuDefaultValue));
+ f.top = new FormAttachment(memoryControl, 8);
+ storage.setLayoutData(f);
+ storage.setVisible(true);
+ storageControl = storage;
+ } else if (storageProperty.getKind() == DeltaCloudHardwareProperty.Kind.RANGE) {
+ storageDefaultValue = storageProperty.getValue();
+ int indexDefault = storageDefaultValue.indexOf('.');
+ int decDigitsDefault = 0;
+ if (indexDefault >= 0) {
+ decDigitsDefault = storageDefaultValue.length() - indexDefault - 1;
+ storageDefaultValue = storageDefaultValue.replace(".", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ Spinner storageSpinner = new Spinner(container, SWT.READ_ONLY | SWT.BORDER);
+ String first = memoryProperty.getRange().getFirst();
+ int indexFirst = first.indexOf('.');
+ int decDigitsFirst = 0;
+ if (indexFirst >= 0) {
+ decDigitsFirst = first.length() - indexFirst - 1;
+ first = first.replace(".", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ String last = memoryProperty.getRange().getLast();
+ int indexLast = first.indexOf('.');
+ int decDigitsLast = 0;
+ if (indexLast >= 0) {
+ decDigitsLast = last.length() - indexLast - 1;
+ last = last.replace(".", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ int decDigits = Math.max(decDigitsFirst, decDigitsLast);
+ storageDecDigits = Math.max(decDigits, decDigitsDefault);
+ if (decDigitsFirst < storageDecDigits) {
+ for (int i = 0; i < storageDecDigits - decDigitsFirst; ++i)
+ first = first.concat("0"); //$NON-NLS-1$
+ }
+ if (decDigitsLast < storageDecDigits) {
+ for (int i = 0; i < storageDecDigits - decDigitsLast; ++i)
+ last = last.concat("0"); //$NON-NLS-1$
+ }
+ if (decDigitsDefault < storageDecDigits) {
+ for (int i = 0; i < storageDecDigits - decDigitsLast; ++i)
+ storageDefaultValue = storageDefaultValue.concat("0"); //$NON-NLS-1$
+ }
+ storageSpinner.setMinimum(Integer.valueOf(first));
+ storageSpinner.setMaximum(Integer.valueOf(last));
+ storageSpinner.setDigits(storageDecDigits);
+ storageSpinner.addModifyListener(spinnerListener);
+ storageSpinner.setSelection(Integer.valueOf(storageDefaultValue));
FormData f = new FormData();
f.width = 80;
+ f.top = new FormAttachment(memoryControl, 5);
f.left = new FormAttachment(storageLabel, 50);
f.right = new FormAttachment(storageLabel, cw, SWT.RIGHT);
- cpuSpinner.setLayoutData(f);
- cpuControl = cpuSpinner;
- } else if (cpuProperty.getKind() == DeltaCloudHardwareProperty.Kind.ENUM) {
- cpuDefaultValue = cpuProperty.getValue();
- List<String> values = cpuProperty.getEnums();
- cpuCombo = new Combo(container, SWT.BORDER);
+ storageSpinner.setLayoutData(f);
+ storageControl = storageSpinner;
+ } else if (storageProperty.getKind() == DeltaCloudHardwareProperty.Kind.ENUM) {
+ storageDefaultValue = storageProperty.getValue();
+ List<String> values = storageProperty.getEnums();
+ storageCombo = new Combo(container, SWT.BORDER | SWT.READ_ONLY);
String[] items = new String[values.size()];
- cpuCombo.setItems(values.toArray(items));
- cpuCombo.setText(items[0]);
- cpuCombo.addModifyListener(comboListener);
+ storageCombo.setItems(values.toArray(items));
+ storageCombo.setText(items[0]);
+ storageCombo.addModifyListener(comboListener);
FormData f = new FormData();
f.width = 80;
f.left = new FormAttachment(storageLabel, 50);
f.right = new FormAttachment(storageLabel, cw, SWT.RIGHT);
- cpuCombo.setLayoutData(f);
- cpuControl = cpuCombo;
+ f.top = new FormAttachment(memoryControl, 5);
+ storageCombo.setLayoutData(f);
+ storageControl = storageCombo;
}
- String cpuUnit = cpuProperty.getUnit();
- if (cpuUnit != null && !cpuUnit.equals("label") && !cpuUnit.equals("count")) { //$NON-NLS-1$ //$NON-NLS-1$
+ String storageUnit = storageProperty.getUnit();
+ if (storageUnit != null && !storageUnit.equals("label")) { //$NON-NLS-1$
Label unitLabel = new Label(container, SWT.NULL);
- unitLabel.setText(cpuProperty.getUnit());
+ unitLabel.setText(storageUnit);
FormData f = new FormData();
- f.left = new FormAttachment(cpuControl, 5);
+ f.left = new FormAttachment(storageControl, 3);
+ f.top = new FormAttachment(memoryControl, 8);
unitLabel.setLayoutData(f);
}
+
} else {
- Label cpu = new Label(container, SWT.NULL);
- cpu.setText(WizardMessages.getString(DEFAULTED));
+ Label storage = new Label(container, SWT.NULL);
+ storage.setText(WizardMessages.getString(DEFAULTED));
FormData f = new FormData();
f.left = new FormAttachment(storageLabel, 50);
+ f.top = new FormAttachment(memoryControl, 8);
f.right = new FormAttachment(100, 0);
- cpu.setLayoutData(f);
- cpuControl = cpu;
+ storage.setLayoutData(f);
+ storage.setVisible(true);
+ storageControl = storage;
}
- DeltaCloudHardwareProperty memoryProperty = profile.getNamedProperty("memory"); //$NON-NLS-1$
- fd = new FormData();
- fd.left = new FormAttachment(cpuLabel, 0, SWT.LEFT);
- fd.top = new FormAttachment(cpuLabel, 8);
- memoryLabel.setLayoutData(fd);
+ return storageControl;
+ }
+
+ private Control createMemoyControl(Control cpuControl, DeltaCloudHardwareProperty memoryProperty, Label storageLabel, Composite container) {
+ Control memoryControl = null;
if (memoryProperty != null) {
if (memoryProperty.getKind() == DeltaCloudHardwareProperty.Kind.FIXED) {
Label memory = new Label(container, SWT.NULL);
@@ -207,13 +263,13 @@
int decDigits = Math.max(decDigitsFirst, decDigitsLast);
memoryDecDigits = Math.max(decDigits, decDigitsDefault);
if (decDigitsFirst < memoryDecDigits) {
- for (int i= 0; i < memoryDecDigits - decDigitsFirst; ++i)
+ for (int i = 0; i < memoryDecDigits - decDigitsFirst; ++i)
first = first.concat("0"); //$NON-NLS-1$
- }
+ }
if (decDigitsLast < memoryDecDigits) {
for (int i = 0; i < memoryDecDigits - decDigitsLast; ++i)
last = last.concat("0"); //$NON-NLS-1$
- }
+ }
if (decDigitsDefault < memoryDecDigits) {
for (int i = 0; i < memoryDecDigits - decDigitsLast; ++i)
memoryDefaultValue = memoryDefaultValue.concat("0"); //$NON-NLS-1$
@@ -265,109 +321,68 @@
memory.setLayoutData(f);
memoryControl = memory;
}
- DeltaCloudHardwareProperty storageProperty = profile.getNamedProperty("storage"); //$NON-NLS-1$
- fd = new FormData();
- fd.left = new FormAttachment(cpuLabel, 0, SWT.LEFT);
- fd.top = new FormAttachment(memoryControl, 8);
- storageLabel.setLayoutData(fd);
- if (storageProperty != null) {
- if (storageProperty.getKind() == DeltaCloudHardwareProperty.Kind.FIXED) {
- Label storage = new Label(container, SWT.NULL);
- storage.setText(storageProperty.getValue());
+ return memoryControl;
+ }
+
+ private Control createCpuControls(DeltaCloudHardwareProperty cpuProperty, Label storageLabel, Composite container) {
+ Control cpuControl = null;
+ if (cpuProperty != null) {
+ if (cpuProperty.getKind() == DeltaCloudHardwareProperty.Kind.FIXED) {
+ Label cpu = new Label(container, SWT.NULL);
+ cpu.setText(cpuProperty.getValue());
FormData f = new FormData();
f.left = new FormAttachment(storageLabel, 50);
- f.top = new FormAttachment(memoryControl, 8);
- storage.setLayoutData(f);
- storage.setVisible(true);
- storageControl = storage;
- } else if (storageProperty.getKind() == DeltaCloudHardwareProperty.Kind.RANGE) {
- storageDefaultValue = storageProperty.getValue();
- int indexDefault = storageDefaultValue.indexOf('.');
- int decDigitsDefault = 0;
- if (indexDefault >= 0) {
- decDigitsDefault = storageDefaultValue.length() - indexDefault - 1;
- storageDefaultValue = storageDefaultValue.replace(".", ""); //$NON-NLS-1$ //$NON-NLS-2$
- }
- Spinner storageSpinner = new Spinner(container, SWT.READ_ONLY | SWT.BORDER);
- String first = memoryProperty.getRange().getFirst();
- int indexFirst = first.indexOf('.');
- int decDigitsFirst = 0;
- if (indexFirst >= 0) {
- decDigitsFirst = first.length() - indexFirst - 1;
- first = first.replace(".", ""); //$NON-NLS-1$ //$NON-NLS-2$
- }
- String last = memoryProperty.getRange().getLast();
- int indexLast = first.indexOf('.');
- int decDigitsLast = 0;
- if (indexLast >= 0) {
- decDigitsLast = last.length() - indexLast - 1;
- last = last.replace(".", ""); //$NON-NLS-1$ //$NON-NLS-2$
- }
- int decDigits = Math.max(decDigitsFirst, decDigitsLast);
- storageDecDigits = Math.max(decDigits, decDigitsDefault);
- if (decDigitsFirst < storageDecDigits) {
- for (int i= 0; i < storageDecDigits - decDigitsFirst; ++i)
- first = first.concat("0"); //$NON-NLS-1$
- }
- if (decDigitsLast < storageDecDigits) {
- for (int i = 0; i < storageDecDigits - decDigitsLast; ++i)
- last = last.concat("0"); //$NON-NLS-1$
- }
- if (decDigitsDefault < storageDecDigits) {
- for (int i = 0; i < storageDecDigits - decDigitsLast; ++i)
- storageDefaultValue = storageDefaultValue.concat("0"); //$NON-NLS-1$
- }
- storageSpinner.setMinimum(Integer.valueOf(first));
- storageSpinner.setMaximum(Integer.valueOf(last));
- storageSpinner.setDigits(storageDecDigits);
- storageSpinner.addModifyListener(spinnerListener);
- storageSpinner.setSelection(Integer.valueOf(storageDefaultValue));
+ f.right = new FormAttachment(100, 0);
+ cpu.setLayoutData(f);
+ cpuControl = cpu;
+ } else if (cpuProperty.getKind() == DeltaCloudHardwareProperty.Kind.RANGE) {
+ cpuDefaultValue = cpuProperty.getValue();
+ cpuSpinner = new Spinner(container, SWT.READ_ONLY);
+ cpuSpinner.setMinimum(Integer.valueOf(cpuProperty.getRange().getFirst()));
+ cpuSpinner.setMaximum(Integer.valueOf(cpuProperty.getRange().getLast()));
+ cpuSpinner.addModifyListener(spinnerListener);
+ cpuSpinner.setSelection(Integer.valueOf(cpuDefaultValue));
FormData f = new FormData();
f.width = 80;
- f.top = new FormAttachment(memoryControl, 5);
f.left = new FormAttachment(storageLabel, 50);
f.right = new FormAttachment(storageLabel, cw, SWT.RIGHT);
- storageSpinner.setLayoutData(f);
- storageControl = storageSpinner;
- } else if (storageProperty.getKind() == DeltaCloudHardwareProperty.Kind.ENUM) {
- storageDefaultValue = storageProperty.getValue();
- List<String> values = storageProperty.getEnums();
- storageCombo = new Combo(container, SWT.BORDER | SWT.READ_ONLY);
+ cpuSpinner.setLayoutData(f);
+ cpuControl = cpuSpinner;
+ } else if (cpuProperty.getKind() == DeltaCloudHardwareProperty.Kind.ENUM) {
+ cpuDefaultValue = cpuProperty.getValue();
+ List<String> values = cpuProperty.getEnums();
+ cpuCombo = new Combo(container, SWT.BORDER);
String[] items = new String[values.size()];
- storageCombo.setItems(values.toArray(items));
- storageCombo.setText(items[0]);
- storageCombo.addModifyListener(comboListener);
+ cpuCombo.setItems(values.toArray(items));
+ cpuCombo.setText(items[0]);
+ cpuCombo.addModifyListener(comboListener);
FormData f = new FormData();
f.width = 80;
f.left = new FormAttachment(storageLabel, 50);
f.right = new FormAttachment(storageLabel, cw, SWT.RIGHT);
- f.top = new FormAttachment(memoryControl, 5);
- storageCombo.setLayoutData(f);
- storageControl = storageCombo;
+ cpuCombo.setLayoutData(f);
+ cpuControl = cpuCombo;
}
- String storageUnit = storageProperty.getUnit();
- if (storageUnit != null && !storageUnit.equals("label")) { //$NON-NLS-1$
+ String cpuUnit = cpuProperty.getUnit();
+ if (cpuUnit != null && !cpuUnit.equals("label") && !cpuUnit.equals("count")) { //$NON-NLS-1$ //$NON-NLS-1$
Label unitLabel = new Label(container, SWT.NULL);
- unitLabel.setText(storageUnit);
+ unitLabel.setText(cpuProperty.getUnit());
FormData f = new FormData();
- f.left = new FormAttachment(storageControl, 3);
- f.top = new FormAttachment(memoryControl, 8);
+ f.left = new FormAttachment(cpuControl, 5);
unitLabel.setLayoutData(f);
}
-
} else {
- Label storage = new Label(container, SWT.NULL);
- storage.setText(WizardMessages.getString(DEFAULTED));
+ Label cpu = new Label(container, SWT.NULL);
+ cpu.setText(WizardMessages.getString(DEFAULTED));
FormData f = new FormData();
f.left = new FormAttachment(storageLabel, 50);
- f.top = new FormAttachment(memoryControl, 8);
f.right = new FormAttachment(100, 0);
- storage.setLayoutData(f);
- storage.setVisible(true);
- storageControl = storage;
+ cpu.setLayoutData(f);
+ cpuControl = cpu;
}
+ return cpuControl;
}
-
+
public void setVisible(boolean visible) {
container.setVisible(visible);
}
@@ -377,14 +392,14 @@
return cpu;
return null;
}
-
+
public String getMemory() {
if (memory != null && !memory.equals(memoryDefaultValue)) {
return memory;
}
return null;
}
-
+
public String getStorage() {
if (storage != null && !storage.equals(storageDefaultValue)) {
return storage;
14 years, 1 month
JBoss Tools SVN: r27505 - trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-12-15 09:10:23 -0500 (Wed, 15 Dec 2010)
New Revision: 27505
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudHardwareProfile.java
Log:
added author
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudHardwareProfile.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudHardwareProfile.java 2010-12-15 13:36:07 UTC (rev 27504)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudHardwareProfile.java 2010-12-15 14:10:23 UTC (rev 27505)
@@ -16,6 +16,9 @@
import org.jboss.tools.deltacloud.core.client.HardwareProfile;
import org.jboss.tools.deltacloud.core.client.Property;
+/**
+ * @author Jeff Johnston
+ */
public class DeltaCloudHardwareProfile {
private HardwareProfile profile;
14 years, 1 month
JBoss Tools SVN: r27504 - trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-12-15 08:36:07 -0500 (Wed, 15 Dec 2010)
New Revision: 27504
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ProfileComposite.java
Log:
added author
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ProfileComposite.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ProfileComposite.java 2010-12-15 13:30:31 UTC (rev 27503)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ProfileComposite.java 2010-12-15 13:36:07 UTC (rev 27504)
@@ -26,6 +26,9 @@
import org.jboss.tools.deltacloud.core.DeltaCloudHardwareProfile;
import org.jboss.tools.deltacloud.core.DeltaCloudHardwareProperty;
+/**
+ * @author Jeff Johnston
+ */
public class ProfileComposite {
private static final String CPU_LABEL = "Cpu.label"; //$NON-NLS-1$
14 years, 1 month
JBoss Tools SVN: r27503 - in trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test: ca and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2010-12-15 08:30:31 -0500 (Wed, 15 Dec 2010)
New Revision: 27503
Added:
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/selbar/
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/selbar/SelectionBarTest.java
Removed:
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/SelectionBarTest.java
Modified:
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/JstJspAllTests.java
Log:
https://issues.jboss.org/browse/JBIDE-7901
Modified: trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/JstJspAllTests.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/JstJspAllTests.java 2010-12-15 13:08:33 UTC (rev 27502)
+++ trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/JstJspAllTests.java 2010-12-15 13:30:31 UTC (rev 27503)
@@ -16,8 +16,7 @@
import org.jboss.tools.jst.jsp.test.ca.ExternalizeCommandTest;
import org.jboss.tools.jst.jsp.test.ca.JstJspJbide1585Test;
import org.jboss.tools.jst.jsp.test.ca.JstJspJbide1641Test;
-import org.jboss.tools.jst.jsp.test.ca.NewEditorSideBySideCommandTest;
-import org.jboss.tools.jst.jsp.test.ca.SelectionBarTest;
+import org.jboss.tools.jst.jsp.test.selbar.SelectionBarTest;
public class JstJspAllTests {
Deleted: trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/SelectionBarTest.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/SelectionBarTest.java 2010-12-15 13:08:33 UTC (rev 27502)
+++ trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/SelectionBarTest.java 2010-12-15 13:30:31 UTC (rev 27503)
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007-2010 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-
-package org.jboss.tools.jst.jsp.test.ca;
-
-import junit.framework.TestCase;
-
-import org.eclipse.core.commands.Command;
-import org.eclipse.core.commands.State;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.commands.ICommandService;
-import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
-import org.jboss.tools.jst.jsp.test.TestUtil;
-import org.jboss.tools.test.util.TestProjectProvider;
-import org.jboss.tools.test.util.WorkbenchUtils;
-
-/**
- * Junit which tests selection bar command behaviour and logic
- * @author mareshkau
- *
- */
-public class SelectionBarTest extends TestCase{
- protected IProject project = null;
- private TestProjectProvider provider = null;
- private Command toggleSelBarCommand;
- private State toggleSelBarState;
-
- public void setUp() throws Exception {
- provider = new TestProjectProvider("org.jboss.tools.jst.jsp.test", null, "JsfJbide1791Test",false); //$NON-NLS-1$ //$NON-NLS-2$
- project = provider.getProject();
- ICommandService commandService =
- (ICommandService) PlatformUI.getWorkbench()
- .getService(ICommandService.class);
- toggleSelBarCommand = commandService.getCommand(
- "org.jboss.tools.jst.jsp.commands.showSelectionBar"); //$NON-NLS-1$
- toggleSelBarState= toggleSelBarCommand
- .getState("org.eclipse.ui.commands.toggleState"); //$NON-NLS-1$
- }
-
- protected void tearDown() throws Exception {
- if(provider != null) {
- provider.dispose();
- }
- }
-
- public void testSelectionBarCommandState() throws Throwable{
- IEditorPart editorPart = WorkbenchUtils.openEditor(project.getName()+"/WebContent/pages/selectionBar.xhtml"); //$NON-NLS-1$
-
- assertTrue("Should be opened JSPMultiPage Editor", //$NON-NLS-1$
- editorPart instanceof JSPMultiPageEditor);
- JSPMultiPageEditor multiPageEditor = (JSPMultiPageEditor) editorPart;
- multiPageEditor.pageChange(0);
- assertEquals("check command enabled command status",true,toggleSelBarCommand.isEnabled()&&(Boolean)toggleSelBarState.getValue()); //$NON-NLS-1$
- multiPageEditor.pageChange(multiPageEditor.getPreviewIndex());
- assertEquals("check command enabled command status",false,toggleSelBarCommand.isEnabled()&&(Boolean)toggleSelBarState.getValue()); //$NON-NLS-1$
- multiPageEditor.pageChange(0);
- assertEquals("check command enabled command status",true,toggleSelBarCommand.isEnabled()&&(Boolean)toggleSelBarState.getValue()); //$NON-NLS-1$
- }
-}
Copied: trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/selbar/SelectionBarTest.java (from rev 27501, trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/SelectionBarTest.java)
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/selbar/SelectionBarTest.java (rev 0)
+++ trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/selbar/SelectionBarTest.java 2010-12-15 13:30:31 UTC (rev 27503)
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.jst.jsp.test.selbar;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.commands.Command;
+import org.eclipse.core.commands.State;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.commands.ICommandService;
+import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
+import org.jboss.tools.test.util.TestProjectProvider;
+import org.jboss.tools.test.util.WorkbenchUtils;
+
+/**
+ * Junit which tests selection bar command behaviour and logic
+ * @author mareshkau
+ *
+ */
+public class SelectionBarTest extends TestCase{
+ protected IProject project = null;
+ private TestProjectProvider provider = null;
+ private Command toggleSelBarCommand;
+ private State toggleSelBarState;
+
+ public void setUp() throws Exception {
+ provider = new TestProjectProvider("org.jboss.tools.jst.jsp.test", null, "JsfJbide1791Test",false); //$NON-NLS-1$ //$NON-NLS-2$
+ project = provider.getProject();
+ ICommandService commandService =
+ (ICommandService) PlatformUI.getWorkbench()
+ .getService(ICommandService.class);
+ toggleSelBarCommand = commandService.getCommand(
+ "org.jboss.tools.jst.jsp.commands.showSelectionBar"); //$NON-NLS-1$
+ toggleSelBarState= toggleSelBarCommand
+ .getState("org.eclipse.ui.commands.toggleState"); //$NON-NLS-1$
+ }
+
+ protected void tearDown() throws Exception {
+ if(provider != null) {
+ provider.dispose();
+ }
+ }
+
+ public void testSelectionBarCommandState() throws Throwable{
+ assertTrue("Command should be defined", toggleSelBarCommand.isDefined());//$NON-NLS-1$
+ IEditorPart editorPart = WorkbenchUtils.openEditor(project.getName()+"/WebContent/pages/selectionBar.xhtml"); //$NON-NLS-1$
+ assertTrue("Should be opened JSPMultiPage Editor", //$NON-NLS-1$
+ editorPart instanceof JSPMultiPageEditor);
+ JSPMultiPageEditor multiPageEditor = (JSPMultiPageEditor) editorPart;
+ multiPageEditor.pageChange(0);
+ assertEquals("check command enabled command status",true,toggleSelBarCommand.isEnabled()&&(Boolean)toggleSelBarState.getValue()); //$NON-NLS-1$
+ if(multiPageEditor.getPreviewIndex()==-1) return;
+ multiPageEditor.pageChange(multiPageEditor.getPreviewIndex());
+ assertEquals("check command enabled command status",false,toggleSelBarCommand.isEnabled()&&(Boolean)toggleSelBarState.getValue()); //$NON-NLS-1$
+ multiPageEditor.pageChange(0);
+ assertEquals("check command enabled command status",true,toggleSelBarCommand.isEnabled()&&(Boolean)toggleSelBarState.getValue()); //$NON-NLS-1$
+ }
+}
14 years, 1 month
JBoss Tools SVN: r27502 - trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2010-12-15 08:08:33 -0500 (Wed, 15 Dec 2010)
New Revision: 27502
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConfigurationFactory.java
Log:
https://issues.jboss.org/browse/JBIDE-7884
Logic changed back
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConfigurationFactory.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConfigurationFactory.java 2010-12-15 11:06:55 UTC (rev 27501)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConfigurationFactory.java 2010-12-15 13:08:33 UTC (rev 27502)
@@ -156,15 +156,10 @@
// TODO: delegate to some extension point
private Configuration buildConfiguration(Properties properties, boolean includeMappings) {
Configuration localCfg = null;
- Properties overrides = new Properties();
- overrides.put("javax.persistence.validation.mode", "none"); //$NON-NLS-1$//$NON-NLS-2$
- if (properties != null) {
- overrides.putAll(properties);
- }
if (prefs.getConfigurationMode().equals(ConfigurationMode.ANNOTATIONS)) {
try {
localCfg = buildAnnotationConfiguration();
- localCfg = configureStandardConfiguration(includeMappings, localCfg, overrides);
+ localCfg = configureStandardConfiguration(includeMappings, localCfg, properties);
} catch (HibernateConsoleRuntimeException he) {
throw he;
} catch (Exception e) {
@@ -175,7 +170,7 @@
} else if (prefs.getConfigurationMode().equals(ConfigurationMode.JPA)) {
try {
localCfg = buildJPAConfiguration(getPreferences().getPersistenceUnitName(),
- overrides, prefs.getEntityResolverName(), includeMappings);
+ properties, prefs.getEntityResolverName(), includeMappings);
} catch (HibernateConsoleRuntimeException he) {
throw he;
} catch (Exception e) {
@@ -184,7 +179,7 @@
}
} else {
localCfg = new Configuration();
- localCfg = configureStandardConfiguration(includeMappings, localCfg, overrides);
+ localCfg = configureStandardConfiguration(includeMappings, localCfg, properties);
}
return localCfg;
}
@@ -205,8 +200,9 @@
}
try {
Map<Object, Object> overrides = new HashMap<Object, Object>();
- overrides.putAll(properties);
-
+ if (properties != null) {
+ overrides.putAll(properties);
+ }
if (StringHelper.isNotEmpty(prefs.getNamingStrategy())) {
overrides.put("hibernate.ejb.naming_strategy", prefs.getNamingStrategy()); //$NON-NLS-1$
}
@@ -216,6 +212,9 @@
if (!includeMappings) {
overrides.put("hibernate.archive.autodetection", "none"); //$NON-NLS-1$//$NON-NLS-2$
}
+ if (StringHelper.isEmpty((String) overrides.get("javax.persistence.validation.mode"))) {//$NON-NLS-1$
+ overrides.put("javax.persistence.validation.mode", "none"); //$NON-NLS-1$//$NON-NLS-2$
+ }
Class<?> clazz = ReflectHelper.classForName(
"org.hibernate.ejb.Ejb3Configuration", ConsoleConfiguration.class); //$NON-NLS-1$
Object ejb3cfg = clazz.newInstance();
@@ -248,8 +247,9 @@
private Configuration configureStandardConfiguration(final boolean includeMappings,
Configuration localCfg, Properties properties) {
- localCfg = localCfg.setProperties(properties);
-
+ if (properties != null) {
+ localCfg = localCfg.setProperties(properties);
+ }
EntityResolver entityResolver = XMLHelper.DEFAULT_DTD_RESOLVER;
if (StringHelper.isNotEmpty(prefs.getEntityResolverName())) {
try {
@@ -279,6 +279,9 @@
if (StringHelper.isNotEmpty(prefs.getDialectName())) {
localCfg.setProperty(Environment.DIALECT, prefs.getDialectName());
}
+ if (StringHelper.isEmpty(localCfg.getProperty("javax.persistence.validation.mode"))) {//$NON-NLS-1$
+ localCfg.setProperty("javax.persistence.validation.mode", "none"); //$NON-NLS-1$//$NON-NLS-2$
+ }
return localCfg;
}
14 years, 1 month
JBoss Tools SVN: r27501 - trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-12-15 06:06:55 -0500 (Wed, 15 Dec 2010)
New Revision: 27501
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/DeltaCloudViewItem.java
Log:
[JBIDE-7594]
* corrected concurrent modification exception when removing children from tree item
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/DeltaCloudViewItem.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/DeltaCloudViewItem.java 2010-12-15 10:26:31 UTC (rev 27500)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/DeltaCloudViewItem.java 2010-12-15 11:06:55 UTC (rev 27501)
@@ -59,11 +59,7 @@
@Override
public void run() {
- // viewer.getTree().setRedraw(false);
- for (final DeltaCloudViewItem<?> element : children) {
- viewer.remove(element);
- }
- // viewer.getTree().setRedraw(true);
+ viewer.remove(children.toArray());
}
});
children.clear();
14 years, 1 month
JBoss Tools SVN: r27500 - trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/core/job.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-12-15 05:26:31 -0500 (Wed, 15 Dec 2010)
New Revision: 27500
Modified:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/core/job/CloudSchedulingRulesTest.java
Log:
[JBIDE-7594]
* corrected scheduling rules to have correct blocking across the scheduling class hierarchy
* created #createSecurePasswordStore to be able to fake store in tests
* created tests for all scheduling rules
Modified: trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/core/job/CloudSchedulingRulesTest.java
===================================================================
--- trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/core/job/CloudSchedulingRulesTest.java 2010-12-15 10:23:59 UTC (rev 27499)
+++ trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/core/job/CloudSchedulingRulesTest.java 2010-12-15 10:26:31 UTC (rev 27500)
@@ -56,6 +56,7 @@
CloudElementSchedulingRule cloudRule =
new CloudElementSchedulingRule(cloudFake, CLOUDELEMENT.INSTANCES);
assertTrue(instanceRule.isConflicting(cloudRule));
+ assertTrue(cloudRule.isConflicting(instanceRule));
}
@Test
@@ -64,6 +65,7 @@
new InstanceSchedulingRule(cloudFake, CLOUDELEMENT.INSTANCES, deltaCloudInstanceFake);
CloudElementSchedulingRule cloudRule = new CloudElementSchedulingRule(cloudFake, CLOUDELEMENT.IMAGES);
assertFalse(instanceRule.isConflicting(cloudRule));
+ assertFalse(cloudRule.isConflicting(instanceRule));
}
@Test
@@ -89,6 +91,7 @@
CloudElementSchedulingRule cloudImagesRule =
new CloudElementSchedulingRule(cloudFake, CLOUDELEMENT.IMAGES);
assertFalse(cloudInstancesRule.isConflicting(cloudImagesRule));
+ assertFalse(cloudImagesRule.isConflicting(cloudInstancesRule));
}
@Test
@@ -97,6 +100,7 @@
new CloudElementSchedulingRule(cloudFake, CLOUDELEMENT.INSTANCES);
CloudSchedulingRule cloudRule = new CloudSchedulingRule(cloudFake);
assertTrue(cloudInstancesRule.isConflicting(cloudRule));
+ assertTrue(cloudRule.isConflicting(cloudInstancesRule));
}
@Test
14 years, 1 month
JBoss Tools SVN: r27499 - trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/core/job.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-12-15 05:23:59 -0500 (Wed, 15 Dec 2010)
New Revision: 27499
Modified:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/core/job/CloudSchedulingRulesTest.java
Log:
[JBIDE-7594]
* corrected scheduling rules to have correct blocking across the scheduling class hierarchy
* created #createSecurePasswordStore to be able to fake store in tests
* created tests for all scheduling rules
Modified: trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/core/job/CloudSchedulingRulesTest.java
===================================================================
--- trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/core/job/CloudSchedulingRulesTest.java 2010-12-15 10:21:59 UTC (rev 27498)
+++ trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/core/job/CloudSchedulingRulesTest.java 2010-12-15 10:23:59 UTC (rev 27499)
@@ -50,7 +50,7 @@
}
@Test
- public void instanceRule2CloudElementInstanceRule() throws DeltaCloudException {
+ public void instanceRule2CloudElementInstancesRule() throws DeltaCloudException {
InstanceSchedulingRule instanceRule = new InstanceSchedulingRule(
cloudFake, AbstractCloudElementJob.CLOUDELEMENT.INSTANCES, deltaCloudInstanceFake);
CloudElementSchedulingRule cloudRule =
@@ -59,7 +59,7 @@
}
@Test
- public void instanceRule2CloudElementImageRule() throws DeltaCloudException {
+ public void instanceRule2CloudElementImagesRule() throws DeltaCloudException {
InstanceSchedulingRule instanceRule =
new InstanceSchedulingRule(cloudFake, CLOUDELEMENT.INSTANCES, deltaCloudInstanceFake);
CloudElementSchedulingRule cloudRule = new CloudElementSchedulingRule(cloudFake, CLOUDELEMENT.IMAGES);
@@ -72,17 +72,18 @@
new InstanceSchedulingRule(cloudFake, CLOUDELEMENT.INSTANCES, deltaCloudInstanceFake);
CloudSchedulingRule cloudRule = new CloudSchedulingRule(cloudFake);
assertTrue(instanceRule.isConflicting(cloudRule));
+ assertTrue(cloudRule.isConflicting(instanceRule));
}
@Test
- public void cloudInstancesRule2CloudInstancesRule() throws DeltaCloudException {
+ public void cloudElementInstancesRule2CloudInstancesRule() throws DeltaCloudException {
CloudElementSchedulingRule cloudInstancesRule =
new CloudElementSchedulingRule(cloudFake, CLOUDELEMENT.INSTANCES);
assertTrue(cloudInstancesRule.isConflicting(cloudInstancesRule));
}
@Test
- public void cloudInstancesRule2CloudImageRule() throws DeltaCloudException {
+ public void cloudElementInstancesRule2CloudImageRule() throws DeltaCloudException {
CloudElementSchedulingRule cloudInstancesRule =
new CloudElementSchedulingRule(cloudFake, CLOUDELEMENT.INSTANCES);
CloudElementSchedulingRule cloudImagesRule =
@@ -91,7 +92,7 @@
}
@Test
- public void cloudInstancesRule2CloudRule() throws DeltaCloudException {
+ public void cloudElementInstancesRule2CloudRule() throws DeltaCloudException {
CloudElementSchedulingRule cloudInstancesRule =
new CloudElementSchedulingRule(cloudFake, CLOUDELEMENT.INSTANCES);
CloudSchedulingRule cloudRule = new CloudSchedulingRule(cloudFake);
@@ -99,7 +100,7 @@
}
@Test
- public void cloudImagesRule2CloudImagesRule() throws DeltaCloudException {
+ public void cloudElementImagesRule2CloudImagesRule() throws DeltaCloudException {
CloudElementSchedulingRule cloudImagesRule =
new CloudElementSchedulingRule(cloudFake, CLOUDELEMENT.IMAGES);
assertTrue(cloudImagesRule.isConflicting(cloudImagesRule));
14 years, 1 month