Author: scabanovich
Date: 2007-09-12 11:35:49 -0400 (Wed, 12 Sep 2007)
New Revision: 3590
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/AbstractSectionEditor.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/ErrorMode.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/form/FormPlace.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/adapter/CheckListAdapter.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/adapter/DefaultXAttributeTreeContentProvider.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/adapter/custom/ColoredFontData.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/CheckListFieldEditor.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/ComboBoxFieldEditor.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/dnd/ControlDragDrop.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editor/EditorPartWrapper.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DefaultDropCommandRunner.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DropWizardDialog.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/context/DropContext.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/AnyElementForm.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/objecteditor/ExtendedPropertiesWizard.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/objecteditor/XTable.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/templates/configuration/MetaClassTemplateHelper.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/preferences/EditorsPreferencesPage.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/wizards/query/list/AbstractTreeWizardView.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/wizards/special/DefaultSpecialWizard.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/propertieseditor/bundlemodel/BundleModel.java
Log:
JBIDE-893
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/AbstractSectionEditor.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/AbstractSectionEditor.java 2007-09-12
15:27:55 UTC (rev 3589)
+++
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/AbstractSectionEditor.java 2007-09-12
15:35:49 UTC (rev 3590)
@@ -23,6 +23,7 @@
import org.eclipse.ui.IPropertyListener;
import org.eclipse.ui.PartInitException;
import org.jboss.tools.common.model.*;
+import org.jboss.tools.common.model.ui.ModelUIPlugin;
import org.jboss.tools.common.model.ui.editor.DefaultEditorPart;
public abstract class AbstractSectionEditor extends DefaultEditorPart {
@@ -37,7 +38,11 @@
errorMode = null;
disposeGui();
if(!wrapper.isDisposed()) {
- try { wrapper.dispose(); } catch (Exception e) {}
+ try {
+ wrapper.dispose();
+ } catch (SWTException e) {
+ ModelUIPlugin.getPluginLog().logError(e);
+ }
}
wrapper = null;
control = null;
@@ -56,7 +61,9 @@
guiControl.setLayout(l);
try {
wrapper.setWeights(new int[]{10, 30});
- } catch (Exception e) {}
+ } catch (Exception e) {
+ ModelUIPlugin.getPluginLog().logError(e);
+ }
return wrapper;
}
@@ -73,7 +80,11 @@
protected void disposeGui() {
if(control != null) {
- try { if(!control.isDisposed()) control.dispose(); } catch (Exception e) {}
+ try {
+ if(!control.isDisposed()) control.dispose();
+ } catch (Exception e) {
+ ModelUIPlugin.getPluginLog().logError(e);
+ }
control = null;
}
}
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/ErrorMode.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/ErrorMode.java 2007-09-12
15:27:55 UTC (rev 3589)
+++
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/ErrorMode.java 2007-09-12
15:35:49 UTC (rev 3590)
@@ -18,6 +18,7 @@
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;
import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.model.ui.ModelUIPlugin;
public class ErrorMode {
private ScrolledComposite errors = null;
@@ -55,7 +56,11 @@
public void dispose() {
if(errors != null) {
- try { errors.dispose(); } catch (Exception e) {}
+ try {
+ if(!errors.isDisposed()) errors.dispose();
+ } catch (Exception e) {
+ ModelUIPlugin.getPluginLog().logError(e);
+ }
errors = null;
labels.clear();
es = "";
@@ -173,8 +178,8 @@
messages[2] = s.substring(k + 1);
int qi = q.indexOf(':');
if(qi > 0) {
- try { line = Integer.parseInt(q.substring(0, qi)); } catch (Exception e) {}
- try { position = Integer.parseInt(q.substring(qi + 1)); } catch (Exception e) {}
+ line = getInt(q.substring(0, qi), line);
+ position = getInt(q.substring(qi + 1), position);
}
} else {
messages[0] = "ERROR";
@@ -186,6 +191,16 @@
}
}
+ int getInt(String s, int def) {
+ if(s == null || s.length() == 0) return def;
+ try {
+ return Integer.parseInt(s);
+ } catch (NumberFormatException e) {
+ ModelUIPlugin.getPluginLog().logError(e);
+ return def;
+ }
+ }
+
public void go() {
if(listener != null) listener.errorSelected(line, position);
}
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/form/FormPlace.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/form/FormPlace.java 2007-09-12
15:27:55 UTC (rev 3589)
+++
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/form/FormPlace.java 2007-09-12
15:35:49 UTC (rev 3590)
@@ -75,7 +75,11 @@
if(form != null) form.dispose();
form = null;
if(composite != null) {
- try { composite.dispose(); } catch (Exception e) {}
+ try {
+ if(!composite.isDisposed()) composite.dispose();
+ } catch (Exception e) {
+ ModelUIPlugin.getPluginLog().logError(e);
+ }
composite = null;
}
}
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/adapter/CheckListAdapter.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/adapter/CheckListAdapter.java 2007-09-12
15:27:55 UTC (rev 3589)
+++
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/adapter/CheckListAdapter.java 2007-09-12
15:35:49 UTC (rev 3590)
@@ -121,8 +121,14 @@
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
this.viewer = viewer;
- try { viewer.refresh(); } catch (Exception e) {}
+ try {
+ if(viewer != null) viewer.refresh();
+ } catch (Exception e) {
+ ignore();
+ }
}
+
+ void ignore() {}
public Object[] getChildren(Object parentElement) {
return new Object[0];
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/adapter/DefaultXAttributeTreeContentProvider.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/adapter/DefaultXAttributeTreeContentProvider.java 2007-09-12
15:27:55 UTC (rev 3589)
+++
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/adapter/DefaultXAttributeTreeContentProvider.java 2007-09-12
15:35:49 UTC (rev 3590)
@@ -22,7 +22,6 @@
import org.jboss.tools.common.model.XFilteredTree;
import org.jboss.tools.common.model.XModel;
import org.jboss.tools.common.model.XModelObject;
-import org.jboss.tools.common.model.util.ClassLoaderUtil;
import org.jboss.tools.common.model.util.ModelFeatureFactory;
public class DefaultXAttributeTreeContentProvider implements ITreeContentProvider {
@@ -105,19 +104,24 @@
}
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- try { viewer.refresh(); } catch (Exception e) {}
+ try {
+ viewer.refresh();
+ } catch (Exception e) {
+ ignore();
+ }
}
+
+ void ignore() {
+ //do nothing
+ }
protected XFilteredTree createFilteredTree(String filteredTreeName) {
String classname =
model.getMetaData().getMapping("FilteredTrees").getValue(filteredTreeName);
- try {
- XFilteredTree tree =
(XFilteredTree)ModelFeatureFactory.getInstance().createFeatureInstance(classname);
- tree.setModel(model);
- tree.setConstraint(new Object[]{attribute, object});
- return tree;
- } catch(Exception exception) {
- return null;
- }
+ XFilteredTree tree =
(XFilteredTree)ModelFeatureFactory.getInstance().createFeatureInstance(classname);
+ if(tree == null) return null;
+ tree.setModel(model);
+ tree.setConstraint(new Object[]{attribute, object});
+ return tree;
}
public XFilteredTree getFilteredTree() {
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/adapter/custom/ColoredFontData.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/adapter/custom/ColoredFontData.java 2007-09-12
15:27:55 UTC (rev 3589)
+++
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/adapter/custom/ColoredFontData.java 2007-09-12
15:35:49 UTC (rev 3590)
@@ -50,21 +50,21 @@
if(q == 0) {
if(!"default".equals(t)) data.setName(t);
} else if(t.startsWith("size=")) {
- try { data.setHeight(Integer.parseInt(t.substring(5))); } catch (Exception e) {}
+ data.setHeight(getInt(t.substring(5), data.getHeight()));
} else if(t.startsWith("style=")) {
- try { data.setStyle(Integer.parseInt(t.substring(6))); } catch (Exception e) {}
+ data.setStyle(getInt(t.substring(6), data.getStyle()));
} else if(t.startsWith("color=")) {
String sc = t.substring(6);
int red = color.red, green = color.green, blue = color.blue;
int i = sc.indexOf('-');
if(i < 0) continue;
- try { red = Integer.parseInt(sc.substring(0, i)); } catch (Exception e) {}
+ red = getInt(sc.substring(0, i), red);
sc = sc.substring(i + 1);
i = sc.indexOf('-');
if(i < 0) continue;
- try { green = Integer.parseInt(sc.substring(0, i)); } catch (Exception e) {}
+ green = getInt(sc.substring(0, i), green);
sc = sc.substring(i + 1);
- try { blue = Integer.parseInt(sc); } catch (Exception e) {}
+ blue = getInt(sc, blue);
color = new RGB(red, green, blue);
}
++q;
@@ -75,6 +75,16 @@
return d;
}
+ private static int getInt(String s, int def) {
+ if(s == null || s.length() == 0) return def;
+ try {
+ return Integer.parseInt(s);
+ } catch (NumberFormatException e) {
+ ModelUIPlugin.getPluginLog().logError(e);
+ return def;
+ }
+ }
+
public static String toString(FontData data, RGB rgb) {
StringBuffer sb = new StringBuffer();
if(data.getName().equals(DEFAULT.getFontData().getName()))
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/CheckListFieldEditor.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/CheckListFieldEditor.java 2007-09-12
15:27:55 UTC (rev 3589)
+++
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/CheckListFieldEditor.java 2007-09-12
15:35:49 UTC (rev 3590)
@@ -138,9 +138,12 @@
if (IPropertyEditor.VALUE.equals(event.getPropertyName())) {
Object v = event.getNewValue();
String s = (v == null) ? "" : v.toString();
- try {
- if(!s.equals(stringValue)) {
- stringValue = s;
+ if(!s.equals(stringValue)) {
+ stringValue = s;
+
+ if(viewer == null || viewer.getTree() == null || viewer.getTree().isDisposed()) {
+ //do nothing
+ } else {
if(lock == 0) {
lock++;
Tree tree = viewer.getTree();
@@ -157,11 +160,8 @@
}
lock--;
}
-
viewer.refresh();
}
- } catch (Exception e) {
- //ignore
}
}
valueProvider.addValueChangeListener(this);
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/ComboBoxFieldEditor.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/ComboBoxFieldEditor.java 2007-09-12
15:27:55 UTC (rev 3589)
+++
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/ComboBoxFieldEditor.java 2007-09-12
15:35:49 UTC (rev 3590)
@@ -458,8 +458,10 @@
f.setAccessible(true);
Text text = (Text)f.get(comboField);
return (text != null && !text.isDisposed()) ? text : null;
- } catch (Exception e) {
+ } catch (NoSuchFieldException e) {
return null;
+ } catch (IllegalAccessException e1) {
+ return null;
}
}
/**
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/dnd/ControlDragDrop.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/dnd/ControlDragDrop.java 2007-09-12
15:27:55 UTC (rev 3589)
+++
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/dnd/ControlDragDrop.java 2007-09-12
15:35:49 UTC (rev 3590)
@@ -329,6 +329,7 @@
((IControlDropListener)provider).drop(p);
}
} catch (ActionDeclinedException de) {
+ ignore();
} catch (Exception e) {
ModelUIPlugin.getPluginLog().logError(e);
}
@@ -336,6 +337,10 @@
}
}
+ void ignore() {
+ //do nothing
+ }
+
private static Vector<TreeItem> getTreeExpandedItems(Tree tree) {
TreeItem[] items = tree.getItems();
Vector<TreeItem> result = new Vector<TreeItem>();
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editor/EditorPartWrapper.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editor/EditorPartWrapper.java 2007-09-12
15:27:55 UTC (rev 3589)
+++
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editor/EditorPartWrapper.java 2007-09-12
15:35:49 UTC (rev 3590)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.common.model.ui.editor;
+import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import org.eclipse.core.resources.IMarker;
@@ -49,12 +50,21 @@
try {
Class editorClass = editor.getClass();
Method method = editorClass.getMethod("gotoMarker",new
Class[]{IMarker.class});
+ method.setAccessible(true);
method.invoke(editor,new Object[]{marker});
- } catch(Exception ex) {
- // Eat exception
- }
+ } catch(NoSuchMethodException e1) {
+ ignore();
+ } catch(IllegalAccessException e2) {
+ ignore();
+ } catch(InvocationTargetException e3) {
+ ModelUIPlugin.getPluginLog().logError(e3);
+ }
}
}
+
+ void ignore() {
+ //do nothing
+ }
public void init(IEditorSite site, IEditorInput input) throws PartInitException {
input = XModelObjectEditorInput.checkInput(input);
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DefaultDropCommandRunner.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DefaultDropCommandRunner.java 2007-09-12
15:27:55 UTC (rev 3589)
+++
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DefaultDropCommandRunner.java 2007-09-12
15:35:49 UTC (rev 3590)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.common.model.ui.editors.dnd;
+import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Properties;
@@ -60,8 +61,13 @@
Method m = AbstractTextEditor.class.getDeclaredMethod("getSourceViewer", new
Class[0]);
m.setAccessible(true);
return (ISourceViewer)m.invoke(ae, new Object[0]);
- } catch (Exception t) {}
- return null;
+ } catch (NoSuchMethodException e1) {
+ return null;
+ } catch (InvocationTargetException e2) {
+ return null;
+ } catch (IllegalAccessException e2) {
+ return null;
+ }
}
public int execute() {
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DropWizardDialog.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DropWizardDialog.java 2007-09-12
15:27:55 UTC (rev 3589)
+++
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DropWizardDialog.java 2007-09-12
15:35:49 UTC (rev 3590)
@@ -35,12 +35,8 @@
}
protected int getPreferredWidth() {
- try {
- String os_name = System.getProperty("os.name");
- if(os_name != null && os_name.indexOf("Windows") >= 0) return
DO_WIDTH_VALUE;
- } catch (Exception e) {
- //ignore
- }
+ String os_name = System.getProperty("os.name");
+ if(os_name != null && os_name.indexOf("Windows") >= 0) return
DO_WIDTH_VALUE;
return DO_WIDTH_VALUE_LINUX;
}
}
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/context/DropContext.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/context/DropContext.java 2007-09-12
15:27:55 UTC (rev 3589)
+++
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/context/DropContext.java 2007-09-12
15:35:49 UTC (rev 3590)
@@ -11,8 +11,10 @@
package org.jboss.tools.common.model.ui.editors.dnd.context;
import java.io.File;
+import java.net.MalformedURLException;
import org.eclipse.core.resources.IFile;
+import org.jboss.tools.common.model.ui.ModelUIPlugin;
import org.jboss.tools.common.model.ui.dnd.ModelTransfer;
import org.eclipse.swt.dnd.DropTargetEvent;
import org.eclipse.swt.dnd.FileTransfer;
@@ -107,9 +109,12 @@
private String getURL(XModelObject o) {
if(o.getFileType() == XModelObject.FILE) {
IFile f = (IFile)EclipseResourceUtil.getResource(o);
+ if(f == null || !f.exists()) return null;
try {
return f.getLocation().toFile().toURL().toString();
- } catch (Exception e) {}
+ } catch (MalformedURLException e) {
+ ModelUIPlugin.getPluginLog().logError(e);
+ }
}
return null;
}
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/AnyElementForm.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/AnyElementForm.java 2007-09-12
15:27:55 UTC (rev 3589)
+++
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/AnyElementForm.java 2007-09-12
15:35:49 UTC (rev 3590)
@@ -285,7 +285,9 @@
p.setProperty("name", name);
try {
XActionInvoker.invoke("AnyElementNew",
"EditActions.EditAttribute", xmo, p);
- } catch (Exception e) {}
+ } catch (Exception e) {
+ ModelUIPlugin.getPluginLog().logError(e);
+ }
}
void delete() {
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/objecteditor/ExtendedPropertiesWizard.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/objecteditor/ExtendedPropertiesWizard.java 2007-09-12
15:27:55 UTC (rev 3589)
+++
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/objecteditor/ExtendedPropertiesWizard.java 2007-09-12
15:35:49 UTC (rev 3590)
@@ -79,8 +79,10 @@
public void stopEditing() {
try {
- objectEditor.stopEditing();
- } catch (Exception e) {}
+ if(objectEditor != null) objectEditor.stopEditing();
+ } catch (Exception e) {
+ ModelUIPlugin.getPluginLog().logError(e);
+ }
}
public void dispose() {
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/objecteditor/XTable.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/objecteditor/XTable.java 2007-09-12
15:27:55 UTC (rev 3589)
+++
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/objecteditor/XTable.java 2007-09-12
15:35:49 UTC (rev 3590)
@@ -26,6 +26,7 @@
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
+import org.jboss.tools.common.model.ui.ModelUIPlugin;
public class XTable {
protected XTableProvider provider;
@@ -193,11 +194,17 @@
}
for (int i = table.getItemCount() - 1; i >= provider.getRowCount() ; i--) {
item = table.getItem(i);
- try { item.dispose(); } catch (Exception e) {}
+ try {
+ item.dispose();
+ } catch (Exception e) {
+ ModelUIPlugin.getPluginLog().logError(e);
+ }
}
if(r >= 0) try {
table.setSelection(r);
- } catch (Exception e) {}
+ } catch (Exception e) {
+ //ignore
+ }
resizeLock = false;
}
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/templates/configuration/MetaClassTemplateHelper.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/templates/configuration/MetaClassTemplateHelper.java 2007-09-12
15:27:55 UTC (rev 3589)
+++
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/templates/configuration/MetaClassTemplateHelper.java 2007-09-12
15:35:49 UTC (rev 3590)
@@ -12,6 +12,7 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.QualifiedName;
import org.jboss.tools.common.model.ui.ModelUIPlugin;
@@ -65,7 +66,8 @@
QualifiedName qn = new QualifiedName(ModelUIPlugin.ID_PLUGIN,
ModelUIPlugin.PROJECT_OVERRIDE);
try {
ResourcesPlugin.getWorkspace().getRoot().setPersistentProperty(qn, "" + b);
- } catch (Exception e) {
+ } catch (CoreException e) {
+ ModelUIPlugin.getPluginLog().logError(e);
}
}
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/preferences/EditorsPreferencesPage.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/preferences/EditorsPreferencesPage.java 2007-09-12
15:27:55 UTC (rev 3589)
+++
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/preferences/EditorsPreferencesPage.java 2007-09-12
15:35:49 UTC (rev 3590)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.common.model.ui.texteditors.preferences;
+import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import org.eclipse.core.runtime.Platform;
import org.jboss.tools.common.model.ui.ModelUIPlugin;
@@ -46,11 +47,19 @@
Method m =
AbstractUIPlugin.class.getDeclaredMethod("initializeDefaultPluginPreferences",
new Class[0]);
m.setAccessible(true);
m.invoke(plugin, new Object[0]);
- } catch (Exception e) {
- //ignore
+ } catch(NoSuchMethodException e1) {
+ ignore();
+ } catch(IllegalAccessException e2) {
+ ignore();
+ } catch(InvocationTargetException e3) {
+ ModelUIPlugin.getPluginLog().logError(e3);
}
store = (plugin == null) ? null : plugin.getPreferenceStore();
store.setDefault(BasePreferenceConstants.EDITOR_REPLACE_TAB_WITH_WHITESPACE, false);
}
+
+ static void ignore() {
+ //do nothing
+ }
}
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/wizards/query/list/AbstractTreeWizardView.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/wizards/query/list/AbstractTreeWizardView.java 2007-09-12
15:27:55 UTC (rev 3589)
+++
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/wizards/query/list/AbstractTreeWizardView.java 2007-09-12
15:35:49 UTC (rev 3590)
@@ -11,6 +11,8 @@
package org.jboss.tools.common.model.ui.wizards.query.list;
import java.util.Properties;
+
+import org.jboss.tools.common.model.ui.ModelUIPlugin;
import org.jboss.tools.common.model.ui.action.CommandBar;
import org.jboss.tools.common.model.ui.wizards.query.AbstractQueryWizardView;
import org.eclipse.jface.viewers.*;
@@ -51,9 +53,12 @@
super.setObject(data);
Properties p = (Properties)data;
vs = (String[][])p.get("data");
- try {
- expandingLevel = Integer.parseInt(p.getProperty("expandingLevel"));
- } catch (Exception e) {}
+ String s = p.getProperty("expandingLevel");
+ if(s != null && s.length() > 0) try {
+ expandingLevel = Integer.parseInt(s);
+ } catch (NumberFormatException e) {
+ ModelUIPlugin.getPluginLog().logError(e);
+ }
makeObject();
}
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/wizards/special/DefaultSpecialWizard.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/wizards/special/DefaultSpecialWizard.java 2007-09-12
15:27:55 UTC (rev 3589)
+++
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/wizards/special/DefaultSpecialWizard.java 2007-09-12
15:35:49 UTC (rev 3590)
@@ -152,7 +152,9 @@
if(dialog == null) return;
try {
if(dialog.getShell() != null && !dialog.getShell().isDisposed())
dialog.close();
- } catch (Exception e) {}
+ } catch (Exception e) {
+ ModelUIPlugin.getPluginLog().logError(e);
+ }
dialog = null;
}
@@ -179,20 +181,13 @@
validationRunnable.setData(validator, data);
validationRunnable.safeUpdateValidationData();
-/// synchronized(validationMonitor) {
-/// try { validationMonitor.notifyAll(); } catch (Exception e) {}
-/// }
}
private ValidationRunnable validationRunnable = new ValidationRunnable();
-/// Object validationMonitor = new Object();
public void stopValidator() {
if(validationRunnable == null) return;
validationRunnable = null;
-/// synchronized(validationMonitor) {
-/// try { validationMonitor.notifyAll(); } catch (Exception e) {}
-/// }
}
class ValidationRunnable implements Runnable {
@@ -207,16 +202,6 @@
}
public void run() {
-/// while(validationRunnable != null) {
-/// while(timeStamp != lastTimeStamp) {
-/// try { Thread.sleep(100); } catch (Exception e) {}
-/// lastTimeStamp = timeStamp;
-/// safeUpdateValidationData();
-/// }
-/// synchronized(validationMonitor) {
-/// try { validationMonitor.wait(); } catch (Exception e) {}
-/// }
-/// }
}
void safeUpdateValidationData() {
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/propertieseditor/bundlemodel/BundleModel.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/propertieseditor/bundlemodel/BundleModel.java 2007-09-12
15:27:55 UTC (rev 3589)
+++
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/propertieseditor/bundlemodel/BundleModel.java 2007-09-12
15:35:49 UTC (rev 3590)
@@ -13,14 +13,17 @@
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
+import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.*;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.Path;
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.options.PreferenceModelUtilities;
+import org.jboss.tools.common.model.ui.ModelUIPlugin;
public class BundleModel {
IFile main;
@@ -122,7 +125,11 @@
createPropertyModel(p[i][0], p[i][1], "");
}
IResource[] rs = new IResource[0];
- try { rs = main.getParent().members(); } catch (Exception e) {}
+ try {
+ rs = main.getParent().members();
+ } catch (Exception e) {
+ ModelUIPlugin.getPluginLog().logError(e);
+ }
for (int i = 0; i < rs.length; i++) {
if(!(rs[i] instanceof IFile)) continue;
IFile f = (IFile)rs[i];
@@ -175,7 +182,11 @@
values.add(p.getProperty(key));
}
}
- } catch (Exception e) {}
+ } catch (CoreException e) {
+ ModelUIPlugin.getPluginLog().logError(e);
+ } catch (IOException e) {
+ ModelUIPlugin.getPluginLog().logError(e);
+ }
String[][] r = new String[keys.size()][2];
for (int i = 0; i < r.length; i++) {
r[i][0] = keys.get(i).toString();
@@ -212,7 +223,11 @@
String[] ls = (String[])removedLocales.toArray(new String[0]);
for (int i = 0; i < ls.length; i++) {
IFile f = getFile(ls[i]);
- if(f.exists()) try { f.delete(true, true, null); } catch (Exception e) {}
+ if(f.exists()) try {
+ f.delete(true, true, null);
+ } catch (CoreException e) {
+ ModelUIPlugin.getPluginLog().logError(e);
+ }
}
removedLocales.clear();
ls = (String[])locales.toArray(new String[0]);
@@ -230,7 +245,8 @@
ByteArrayOutputStream os = new ByteArrayOutputStream();
try {
p0.store(os, null);
- } catch (Exception e) {
+ } catch (IOException e) {
+ ModelUIPlugin.getPluginLog().logError(e);
continue;
}
String s = os.toString();
@@ -242,7 +258,9 @@
try {
if(f.exists()) f.setContents(is, true, true, null);
else f.create(is, true, null);
- } catch (Exception e) {}
+ } catch (Exception e) {
+ ModelUIPlugin.getPluginLog().logError(e);
+ }
}
setModified(false);
}