Author: scabanovich
Date: 2009-10-13 06:33:24 -0400 (Tue, 13 Oct 2009)
New Revision: 18059
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/AbsoluteFilePathAttributeValueLoader.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DefaultDropWizardModel.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/LoadBundleBaseNameAttributeValueLoader.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/TagAttributesWizardPage.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/composite/TagAttributesComposite.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4996
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/AbsoluteFilePathAttributeValueLoader.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/AbsoluteFilePathAttributeValueLoader.java 2009-10-13
09:25:08 UTC (rev 18058)
+++
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/AbsoluteFilePathAttributeValueLoader.java 2009-10-13
10:33:24 UTC (rev 18059)
@@ -63,6 +63,9 @@
String v = (input == null) ? null : dropFileToFile(file, input.getFile(), model);
if(v == null) v = "/"+filePath.toString(); //$NON-NLS-1$
model.setAttributeValue(fPathAttributeName, v);
+ if(model instanceof DefaultDropWizardModel) {
+ ((DefaultDropWizardModel)model).setPreferable(fPathAttributeName);
+ }
}
}
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DefaultDropWizardModel.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DefaultDropWizardModel.java 2009-10-13
09:25:08 UTC (rev 18058)
+++
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DefaultDropWizardModel.java 2009-10-13
10:33:24 UTC (rev 18059)
@@ -60,17 +60,27 @@
*/
public void setAttributeValue(String name, Object value) {
if(name==null) throw new IllegalArgumentException("Attribute name cannot be
null"); //$NON-NLS-1$
- AttributeDescriptorValue descrValue = null;
+ AttributeDescriptorValue descrValue = findDescriptor(name);
+ if(descrValue==null) throw new IllegalArgumentException("Attribute '" +
name + "' not found"); //$NON-NLS-1$ //$NON-NLS-2$
+ descrValue.setValue(value);
+ fireModelChaged(ATTRIBUTE_VALUE,null,descrValue);
+ }
+
+ public void setPreferable(String name) {
+ if(name==null) return;
+ AttributeDescriptorValue descrValue = findDescriptor(name);
+ if(descrValue != null) descrValue.setPreferable(true);
+ }
+
+ private AttributeDescriptorValue findDescriptor(String name) {
for (int i = 0; i < fAttributeValues.size(); i++) {
AttributeDescriptorValue arrayElement =
(AttributeDescriptorValue)fAttributeValues.get(i);
if(name.equals(arrayElement.getName())) {
- descrValue = arrayElement;
+ return arrayElement;
}
}
- if(descrValue==null) throw new IllegalArgumentException("Attribute '" +
name + "' not found"); //$NON-NLS-1$ //$NON-NLS-2$
- descrValue.setValue(value);
- fireModelChaged(ATTRIBUTE_VALUE,null,descrValue);
- }
+ return null;
+ }
/**
*
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/LoadBundleBaseNameAttributeValueLoader.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/LoadBundleBaseNameAttributeValueLoader.java 2009-10-13
09:25:08 UTC (rev 18058)
+++
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/LoadBundleBaseNameAttributeValueLoader.java 2009-10-13
10:33:24 UTC (rev 18059)
@@ -21,9 +21,9 @@
*
* @author eskimo
*/
-public class LoadBundleBaseNameAttributeValueLoader
- implements
- IAttributeValueLoader {
+public class LoadBundleBaseNameAttributeValueLoader implements IAttributeValueLoader {
+ static String ATTR_BASENAME = "basename"; //$NON-NLS-1$
+ static String ATTR_VAR = "var"; //$NON-NLS-1$
public void fillTagAttributes(IDropWizardModel model) {
String baseName = ""; //$NON-NLS-1$
@@ -69,8 +69,12 @@
}
// TODO Eskimo - Think about how reject drop id properties file is not under java
source
- model.setAttributeValue("basename", baseName); //$NON-NLS-1$
- model.setAttributeValue("var", fileName.toLowerCase()); //$NON-NLS-1$
+ model.setAttributeValue(ATTR_BASENAME, baseName);
+ model.setAttributeValue(ATTR_VAR, fileName.toLowerCase());
+ if(model instanceof DefaultDropWizardModel) {
+ ((DefaultDropWizardModel)model).setPreferable(ATTR_BASENAME);
+ ((DefaultDropWizardModel)model).setPreferable(ATTR_VAR);
+ }
}
}
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/TagAttributesWizardPage.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/TagAttributesWizardPage.java 2009-10-13
09:25:08 UTC (rev 18058)
+++
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/TagAttributesWizardPage.java 2009-10-13
10:33:24 UTC (rev 18059)
@@ -139,7 +139,7 @@
protected boolean showAdvansedTab() {
AttributeDescriptorValue[] values =
getDropWizardModel().getAttributeValueDescriptors();
for(int i=0;i<values.length;i++) {
- if(values[i].isRequired() || values[i].isRequired()) {
+ if(values[i].isPreferable() || values[i].isRequired()) {
return true;
}
}
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/composite/TagAttributesComposite.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/composite/TagAttributesComposite.java 2009-10-13
09:25:08 UTC (rev 18058)
+++
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/composite/TagAttributesComposite.java 2009-10-13
10:33:24 UTC (rev 18059)
@@ -111,6 +111,9 @@
return isPreferable;
}
+ public void setPreferable(boolean b) {
+ isPreferable = b;
+ }
/**
*
*/
@@ -416,4 +419,5 @@
public void widgetDefaultSelected(SelectionEvent e) {
}
+
}