Author: scabanovich
Date: 2008-04-04 10:04:29 -0400 (Fri, 04 Apr 2008)
New Revision: 7332
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/FacesConfigGuiEditor.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/edit/LinkEditPart.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/form/ManagedBeanPropertyForm.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/model/impl/JSFElement.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/model/impl/JSFModel.java
Log:
JBIDE-895
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/FacesConfigGuiEditor.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/FacesConfigGuiEditor.java 2008-04-04
13:10:21 UTC (rev 7331)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/FacesConfigGuiEditor.java 2008-04-04
14:04:29 UTC (rev 7332)
@@ -11,6 +11,7 @@
package org.jboss.tools.jsf.ui.editor;
import org.jboss.tools.common.editor.AbstractSectionEditor;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.gef.ui.actions.ActionRegistry;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.swt.layout.GridData;
@@ -95,7 +96,7 @@
guiControl.layout();
wrapper.update();
wrapper.layout();
- } catch (Exception ex) {
+ } catch (CoreException ex) {
JsfUiPlugin.getPluginLog().logError(ex);
}
}
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/edit/LinkEditPart.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/edit/LinkEditPart.java 2008-04-04
13:10:21 UTC (rev 7331)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/edit/LinkEditPart.java 2008-04-04
14:04:29 UTC (rev 7332)
@@ -27,6 +27,7 @@
import org.eclipse.swt.graphics.Image;
import org.jboss.tools.common.meta.action.XAction;
+import org.jboss.tools.common.model.XModelException;
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.gef.GEFGraphicalViewer;
import org.jboss.tools.common.gef.edit.GEFRootEditPart;
@@ -70,13 +71,11 @@
public void doDoubleClick(boolean cf) {
try {
- XAction action = DnDUtil.getEnabledAction(
- (XModelObject) getLinkModel().getSource(), null,
- "Properties.Properties");
+ XModelObject s = (XModelObject) getLinkModel().getSource();
+ XAction action = DnDUtil.getEnabledAction(s, null,
"Properties.Properties");
if (action != null)
- action.executeHandler(
- (XModelObject) getLinkModel().getSource(), null);
- } catch (Exception e) {
+ action.executeHandler(s, null);
+ } catch (XModelException e) {
JsfUiPlugin.getPluginLog().logError(e);
}
}
@@ -86,17 +85,12 @@
}
public void doMouseUp(boolean cf) {
+ if(!(getTarget() instanceof GroupEditPart)) return;
+ GroupEditPart g = (GroupEditPart)getTarget();
if (cf && getLink().isShortcut()) {
- try {
- ((GEFGraphicalViewer) getViewer()).getGEFEditor()
- .getModelSelectionProvider().setSelection(
- new StructuredSelection(
- ((GroupEditPart) getTarget())
- .getGroupModel().getSource()));
- } catch (Exception ex) {
- JsfUiPlugin.getPluginLog().logError(ex);
- }
- return;
+ ((GEFGraphicalViewer) getViewer()).getGEFEditor()
+ .getModelSelectionProvider().setSelection(
+ new StructuredSelection(g.getGroupModel().getSource()));
}
}
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/form/ManagedBeanPropertyForm.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/form/ManagedBeanPropertyForm.java 2008-04-04
13:10:21 UTC (rev 7331)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/form/ManagedBeanPropertyForm.java 2008-04-04
14:04:29 UTC (rev 7332)
@@ -19,6 +19,7 @@
import org.jboss.tools.common.model.ui.attribute.XAttributeSupport;
import org.jboss.tools.common.model.ui.attribute.editor.ExtendedFieldEditor;
import org.jboss.tools.common.model.ui.attribute.editor.IPropertyFieldEditor;
+import org.jboss.tools.common.model.ui.attribute.editor.JavaHyperlinkLineFieldEditor;
import org.jboss.tools.common.model.ui.attribute.editor.PropertyEditor;
import org.jboss.tools.common.model.ui.attribute.editor.StringButtonFieldEditorEx;
import org.eclipse.swt.SWT;
@@ -143,20 +144,14 @@
if (controls != null) anyLabel = controls[0];
}
if (PROPERTY_CLASS.equals(propertyEditor.getAttributeName())) {
- try {
- Class wraperClass =
Class.forName("org.jboss.tools.common.model.ui.attribute.editor.JavaHyperlinkLineFieldEditor");
- Constructor wraperConstructor = wraperClass.getConstructor(new
Class[]{IWidgetSettings.class});
- IPropertyFieldEditor wraper =
(IPropertyFieldEditor)wraperConstructor.newInstance(new Object[]{settings});
- ExtendedFieldEditor fe = (ExtendedFieldEditor)wraper;
- fe.setLabelText(propertyEditor.getLabelText());
- wraper.setPropertyEditor(propertyEditor);
- fe.fillIntoGrid(composite, 2);
- fe.setEnabled(xmo.isAttributeEditable(propertyEditor.getAttributeName()));
- support.registerFieldEditor(propertyEditor.getAttributeName(),
(ExtendedFieldEditor)wraper);
- anyLabel = fe.getLabelComposite(composite);
- } catch (Exception e) {
- JsfUiPlugin.getPluginLog().logError(e);
- }
+ IPropertyFieldEditor wraper = new JavaHyperlinkLineFieldEditor(settings);
+ ExtendedFieldEditor fe = (ExtendedFieldEditor)wraper;
+ fe.setLabelText(propertyEditor.getLabelText());
+ wraper.setPropertyEditor(propertyEditor);
+ fe.fillIntoGrid(composite, 2);
+ fe.setEnabled(xmo.isAttributeEditable(propertyEditor.getAttributeName()));
+ support.registerFieldEditor(propertyEditor.getAttributeName(),
(ExtendedFieldEditor)wraper);
+ anyLabel = fe.getLabelComposite(composite);
}
}
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/model/impl/JSFElement.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/model/impl/JSFElement.java 2008-04-04
13:10:21 UTC (rev 7331)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/model/impl/JSFElement.java 2008-04-04
14:04:29 UTC (rev 7332)
@@ -113,14 +113,8 @@
public void updateModelModifiedProperty(Object oldValue, Object newValue) {
if (getJSFModel() != null) {
- try {
- if (oldValue == null ||!oldValue.equals(newValue))
- getJSFModel().setModified(true);
- } catch (Exception exception) {
- JsfUiPlugin.getPluginLog().logError(exception);
- if (newValue != null)
- getJSFModel().setModified(true);
- }
+ if (oldValue == null || !oldValue.equals(newValue))
+ getJSFModel().setModified(true);
}
}
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/model/impl/JSFModel.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/model/impl/JSFModel.java 2008-04-04
13:10:21 UTC (rev 7331)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/model/impl/JSFModel.java 2008-04-04
14:04:29 UTC (rev 7332)
@@ -12,8 +12,6 @@
import java.util.*;
-import org.xml.sax.*;
-
import java.beans.*;
import org.eclipse.swt.graphics.Font;
@@ -50,7 +48,7 @@
public JSFModel() {
try {
setName("Struts Model");
- } catch (Exception ex) {
+ } catch (PropertyVetoException ex) {
JsfUiPlugin.getPluginLog().logError(ex);
}
}
@@ -79,7 +77,7 @@
return options;
}
- public JSFModel(Object data) throws SAXException, Exception {
+ public JSFModel(Object data) {
this();
setData(((XModelObject) data).getChildByPath("process"));
map.setData((XModelObject) data);
@@ -163,7 +161,7 @@
XModelTreeListenerSWTSync listener = null;
- public void setData(Object data) throws Exception {
+ public void setData(Object data) {
source = (XModelObject) data;
if (source == null) {
return;
@@ -334,16 +332,16 @@
public void structureChanged(XModelTreeEvent event) {
JSFElement element;
+ Object obj = event.getModelObject().getPath();
+ if (obj == null)
+ return;
+ if (map == null)
+ return;
+ element = (JSFElement) map.get(obj);
+ if (element == null) {
+ return;
+ }
try {
- Object obj = event.getModelObject().getPath();
- if (obj == null)
- return;
- if (map == null)
- return;
- element = (JSFElement) map.get(obj);
- if (element == null) {
- return;
- }
if (event.kind() == XModelTreeEvent.STRUCTURE_CHANGED) {
element.structureChanged(event);
} else if (event.kind() == XModelTreeEvent.CHILD_ADDED) {
@@ -432,7 +430,7 @@
}
public class JSFHashtable implements XModelTreeListener {
- Hashtable<Object, IJSFElement> map = new Hashtable<Object, IJSFElement>();
+ private Hashtable<Object, IJSFElement> map = new Hashtable<Object,
IJSFElement>();
XModelObject source;
@@ -473,9 +471,11 @@
if (!source.getAttributeValue("name").equals(name)) {
name = source.getAttributeValue("name");
- Enumeration keys = map.keys();
+ Enumeration<Object> keys = map.keys();
while (keys.hasMoreElements()) {
- path = (String) keys.nextElement();
+ Object key = keys.nextElement();
+ if(!(key instanceof String)) continue;
+ path = (String) key;
element = (JSFElement) map.get(path);
if (element != null) {
if (element.getSource() != null) {