Author: scabanovich
Date: 2008-04-04 12:38:58 -0400 (Fri, 04 Apr 2008)
New Revision: 7352
Modified:
trunk/struts/plugins/org.jboss.tools.struts.validator.ui/src/org/jboss/tools/struts/validator/ui/formset/FConstantsEditor.java
trunk/struts/plugins/org.jboss.tools.struts.validator.ui/src/org/jboss/tools/struts/validator/ui/formset/FieldDataEditor.java
trunk/struts/plugins/org.jboss.tools.struts.validator.ui/src/org/jboss/tools/struts/validator/ui/formset/FieldEditor.java
trunk/struts/plugins/org.jboss.tools.struts.validator.ui/src/org/jboss/tools/struts/validator/ui/formset/FormsetsBar.java
trunk/struts/plugins/org.jboss.tools.struts.validator.ui/src/org/jboss/tools/struts/validator/ui/global/ValidatorEditor.java
Log:
JBIDE-893
Modified:
trunk/struts/plugins/org.jboss.tools.struts.validator.ui/src/org/jboss/tools/struts/validator/ui/formset/FConstantsEditor.java
===================================================================
---
trunk/struts/plugins/org.jboss.tools.struts.validator.ui/src/org/jboss/tools/struts/validator/ui/formset/FConstantsEditor.java 2008-04-04
16:33:09 UTC (rev 7351)
+++
trunk/struts/plugins/org.jboss.tools.struts.validator.ui/src/org/jboss/tools/struts/validator/ui/formset/FConstantsEditor.java 2008-04-04
16:38:58 UTC (rev 7352)
@@ -1,13 +1,3 @@
-/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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
- *
- * Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
package org.jboss.tools.struts.validator.ui.formset;
import java.util.*;
@@ -102,7 +92,13 @@
if(o == null) return;
if(name.equals(ActionNames.DELETE)) callAction(o, "DeleteActions.Delete");
else if(name.equals(ActionNames.EDIT)) callAction(o,
"Properties.Properties");
- else if(name.equals(OVERWRITE)) executeOverwrite();
+ else if(name.equals(OVERWRITE)) {
+ try {
+ executeOverwrite();
+ } catch (XModelException e) {
+ throw new RuntimeException(e.getMessage(), e);
+ }
+ }
else if(name.equals(DEFAULT)) callAction(o, "DeleteActions.ResetDefault");
}
}
@@ -117,7 +113,7 @@
if(i >= 0) xtable.setSelection(i);
}
- protected void executeOverwrite() {
+ protected void executeOverwrite() throws XModelException {
if(helper == null || fmodel == null) return;
XModelObject o = helper.getModelObject(xtable.getSelectionIndex());
if(o == null) return;
Modified:
trunk/struts/plugins/org.jboss.tools.struts.validator.ui/src/org/jboss/tools/struts/validator/ui/formset/FieldDataEditor.java
===================================================================
---
trunk/struts/plugins/org.jboss.tools.struts.validator.ui/src/org/jboss/tools/struts/validator/ui/formset/FieldDataEditor.java 2008-04-04
16:33:09 UTC (rev 7351)
+++
trunk/struts/plugins/org.jboss.tools.struts.validator.ui/src/org/jboss/tools/struts/validator/ui/formset/FieldDataEditor.java 2008-04-04
16:38:58 UTC (rev 7352)
@@ -1,18 +1,9 @@
-/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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
- *
- * Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
package org.jboss.tools.struts.validator.ui.formset;
import java.util.Properties;
import java.util.Set;
+import org.jboss.tools.common.model.plugin.ModelPlugin;
import org.jboss.tools.common.model.ui.objecteditor.*;
import org.jboss.tools.struts.validator.ui.formset.model.DependencyModel;
import org.jboss.tools.struts.validator.ui.formset.model.FModel;
@@ -20,6 +11,7 @@
import org.jboss.tools.common.meta.action.XActionInvoker;
import org.jboss.tools.common.meta.action.impl.handlers.DefaultCreateHandler;
+import org.jboss.tools.common.model.XModelException;
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.util.FindObjectHelper;
@@ -82,7 +74,13 @@
XModelObject o = helper.getModelObject(xtable.getSelectionIndex());
if(o == null) return;
if(name.equals(ActionNames.EDIT)) executeEdit(o);
- else if(name.equals(OVERWRITE)) executeOverwrite();
+ else if(name.equals(OVERWRITE)) {
+ try {
+ executeOverwrite();
+ } catch (XModelException e) {
+ throw new RuntimeException(e.getMessage(), e);
+ }
+ }
else if(name.equals(ActionNames.DELETE)) callAction(o,
"DeleteActions.Delete");
else if(name.equals(DEFAULT)) callAction(o, "DeleteActions.ResetDefault");
}
@@ -102,7 +100,7 @@
callAction(o, "Properties.Properties");
}
- protected void executeOverwrite() {
+ protected void executeOverwrite() throws XModelException {
if(helper == null || fmodel == null) return;
XModelObject o = helper.getModelObject(xtable.getSelectionIndex());
if(o == null) return;
@@ -140,8 +138,13 @@
XActionInvoker.invoke(actionpath, target, p);
}
if(ts == target.getTimeStamp()) return;
- if(po != null && co != null)
- DefaultCreateHandler.addCreatedObject(po, co, FindObjectHelper.IN_EDITOR_ONLY);
+ if(po != null && co != null) {
+ try {
+ DefaultCreateHandler.addCreatedObject(po, co, FindObjectHelper.IN_EDITOR_ONLY);
+ } catch (XModelException e) {
+ ModelPlugin.getPluginLog().logError(e);
+ }
+ }
}
static XModelObject[] getTarget(FModel pf) {
Modified:
trunk/struts/plugins/org.jboss.tools.struts.validator.ui/src/org/jboss/tools/struts/validator/ui/formset/FieldEditor.java
===================================================================
---
trunk/struts/plugins/org.jboss.tools.struts.validator.ui/src/org/jboss/tools/struts/validator/ui/formset/FieldEditor.java 2008-04-04
16:33:09 UTC (rev 7351)
+++
trunk/struts/plugins/org.jboss.tools.struts.validator.ui/src/org/jboss/tools/struts/validator/ui/formset/FieldEditor.java 2008-04-04
16:38:58 UTC (rev 7352)
@@ -1,19 +1,10 @@
-/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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
- *
- * Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
package org.jboss.tools.struts.validator.ui.formset;
import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;
+import org.jboss.tools.common.model.plugin.ModelPlugin;
import org.jboss.tools.common.model.ui.swt.util.*;
import org.jboss.tools.common.model.*;
import org.jboss.tools.common.model.util.FindObjectHelper;
@@ -184,7 +175,13 @@
protected void setDefault() {
XModelObject o = getModelObject();
- if(o != null) o.getModel().changeObjectAttribute(o, "page", "");
+ if(o != null) {
+ try {
+ o.getModel().changeObjectAttribute(o, "page", "");
+ } catch (XModelException e) {
+ ModelPlugin.getPluginLog().logError(e);
+ }
+ }
}
protected void overwrite() {
@@ -195,7 +192,11 @@
invoke("EditActions.EditPage", ts[0]);
if(t != ts[0].getTimeStamp() && ts[1] != null) {
ts[0].setAttributeValue("indexedListProperty", "");
- DefaultCreateHandler.addCreatedObject(ts[1], ts[2], FindObjectHelper.IN_EDITOR_ONLY);
+ try {
+ DefaultCreateHandler.addCreatedObject(ts[1], ts[2],
FindObjectHelper.IN_EDITOR_ONLY);
+ } catch (XModelException e) {
+ ModelPlugin.getPluginLog().logError(e);
+ }
}
}
@@ -217,7 +218,13 @@
protected void setDefault() {
XModelObject o = getModelObject();
- if(o != null) o.getModel().changeObjectAttribute(o, "indexedListProperty",
"");
+ if(o != null) {
+ try {
+ o.getModel().changeObjectAttribute(o, "indexedListProperty",
"");
+ } catch (XModelException e) {
+ ModelPlugin.getPluginLog().logError(e);
+ }
+ }
}
protected void overwrite() {
@@ -228,7 +235,11 @@
invoke("EditActions.EditIndex", ts[0]);
if(t != ts[0].getTimeStamp() && ts[1] != null) {
ts[0].setAttributeValue("page", "");
- DefaultCreateHandler.addCreatedObject(ts[1], ts[2], FindObjectHelper.IN_EDITOR_ONLY);
+ try {
+ DefaultCreateHandler.addCreatedObject(ts[1], ts[2],
FindObjectHelper.IN_EDITOR_ONLY);
+ } catch (XModelException e) {
+ ModelPlugin.getPluginLog().logError(e);
+ }
}
}
Modified:
trunk/struts/plugins/org.jboss.tools.struts.validator.ui/src/org/jboss/tools/struts/validator/ui/formset/FormsetsBar.java
===================================================================
---
trunk/struts/plugins/org.jboss.tools.struts.validator.ui/src/org/jboss/tools/struts/validator/ui/formset/FormsetsBar.java 2008-04-04
16:33:09 UTC (rev 7351)
+++
trunk/struts/plugins/org.jboss.tools.struts.validator.ui/src/org/jboss/tools/struts/validator/ui/formset/FormsetsBar.java 2008-04-04
16:38:58 UTC (rev 7352)
@@ -1,13 +1,3 @@
-/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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
- *
- * Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
package org.jboss.tools.struts.validator.ui.formset;
import java.util.ArrayList;
@@ -23,7 +13,9 @@
import org.jboss.tools.common.meta.action.impl.handlers.DefaultCreateHandler;
import org.jboss.tools.common.meta.action.impl.handlers.DefaultRemoveHandler;
import org.jboss.tools.common.meta.help.HelpUtil;
+import org.jboss.tools.common.model.XModelException;
import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.model.plugin.ModelPlugin;
import org.jboss.tools.common.model.ui.action.CommandBar;
import org.jboss.tools.common.model.ui.action.CommandBarLayout;
import org.jboss.tools.common.model.ui.action.CommandBarListener;
@@ -321,8 +313,13 @@
private void overwriteObject() {
XModelObject[] targets = FieldDataEditor.getTarget(selected);
- if(targets != null && targets[1] != null)
- DefaultCreateHandler.addCreatedObject(targets[1], targets[2],
FindObjectHelper.IN_EDITOR_ONLY);
+ if(targets != null && targets[1] != null) {
+ try {
+ DefaultCreateHandler.addCreatedObject(targets[1], targets[2],
FindObjectHelper.IN_EDITOR_ONLY);
+ } catch (XModelException e) {
+ ModelPlugin.getPluginLog().logError(e);
+ }
+ }
updateInheritance();
}
Modified:
trunk/struts/plugins/org.jboss.tools.struts.validator.ui/src/org/jboss/tools/struts/validator/ui/global/ValidatorEditor.java
===================================================================
---
trunk/struts/plugins/org.jboss.tools.struts.validator.ui/src/org/jboss/tools/struts/validator/ui/global/ValidatorEditor.java 2008-04-04
16:33:09 UTC (rev 7351)
+++
trunk/struts/plugins/org.jboss.tools.struts.validator.ui/src/org/jboss/tools/struts/validator/ui/global/ValidatorEditor.java 2008-04-04
16:38:58 UTC (rev 7352)
@@ -1,13 +1,3 @@
-/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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
- *
- * Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
package org.jboss.tools.struts.validator.ui.global;
import java.util.Properties;
@@ -16,6 +6,7 @@
import org.eclipse.swt.layout.*;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.widgets.*;
+import org.jboss.tools.common.model.plugin.ModelPlugin;
import org.jboss.tools.common.model.ui.swt.util.*;
import org.jboss.tools.common.model.*;
import org.jboss.tools.common.model.ui.editor.DefaultEditorPart;
@@ -213,8 +204,13 @@
}
public void save() {
- if(object != null && text != null)
- object.getModel().changeObjectAttribute(object, name, "" + text.getText());
//$NON-NLS-1$
+ if(object != null && text != null) {
+ try {
+ object.getModel().changeObjectAttribute(object, name, "" + text.getText());
//$NON-NLS-1$
+ } catch (XModelException e) {
+ ModelPlugin.getPluginLog().logError(e);
+ }
+ }
}
public void setEnabled(boolean enabled) {
@@ -275,6 +271,8 @@
lock++;
try {
object.getModel().changeObjectAttribute(object, name, "" + text.getText());
//$NON-NLS-1$
+ } catch (XModelException e) {
+ ModelPlugin.getPluginLog().logError(e);
} finally {
lock--;
}