JBoss Tools SVN: r9950 - in trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common: model/project and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2008-08-29 02:36:13 -0400 (Fri, 29 Aug 2008)
New Revision: 9950
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/impl/documentation/DocumentGenerator.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/impl/documentation/MetaValidator.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project/ClassPathUpdate.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/search/impl/SearchCommandImpl.java
Log:
Fix PMD Violations
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/impl/documentation/DocumentGenerator.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/impl/documentation/DocumentGenerator.java 2008-08-29 00:21:46 UTC (rev 9949)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/impl/documentation/DocumentGenerator.java 2008-08-29 06:36:13 UTC (rev 9950)
@@ -10,12 +10,24 @@
******************************************************************************/
package org.jboss.tools.common.meta.impl.documentation;
-import java.io.*;
-import java.util.*;
-import org.w3c.dom.*;
-import org.jboss.tools.common.model.*;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Iterator;
+
+import org.jboss.tools.common.model.XModel;
+import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.plugin.ModelPlugin;
-import org.jboss.tools.common.model.util.*;
+import org.jboss.tools.common.model.util.XMLUtil;
+import org.jboss.tools.common.model.util.XModelObjectLoaderUtil;
+import org.w3c.dom.Element;
public class DocumentGenerator {
private XModelObject meta = null;
@@ -29,7 +41,7 @@
}
public void generate(String filename) {
- if(meta == null) throw new RuntimeException("Meta root is not set.");
+ if(meta == null) throw new IllegalStateException("Meta root is not set.");
this.filename = filename;
Element g = XMLUtil.createDocumentElement("html");
generateTitle(g);
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/impl/documentation/MetaValidator.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/impl/documentation/MetaValidator.java 2008-08-29 00:21:46 UTC (rev 9949)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/impl/documentation/MetaValidator.java 2008-08-29 06:36:13 UTC (rev 9950)
@@ -10,7 +10,11 @@
******************************************************************************/
package org.jboss.tools.common.meta.impl.documentation;
-import java.util.*;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.Set;
+import java.util.Vector;
+
import org.jboss.tools.common.model.XModelObject;
public class MetaValidator {
@@ -22,7 +26,7 @@
public void validate(XModelObject metaroot) {
if(!"MetaRoot".equals(metaroot.getModelEntity().getName()))
- throw new RuntimeException("Meta validator must be called with MetaRoot.");
+ throw new IllegalArgumentException("Meta validator must be called with MetaRoot.");
iv.validate(metaroot.getChildren("MetaIcons")[0]);
ev.validate(metaroot.getChildren("MetaEntities")[0]);
//// mv.validate(metaroot.getChildren("MetaMappings")[0]);
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project/ClassPathUpdate.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project/ClassPathUpdate.java 2008-08-29 00:21:46 UTC (rev 9949)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project/ClassPathUpdate.java 2008-08-29 06:36:13 UTC (rev 9950)
@@ -38,7 +38,7 @@
String entity = model.getRoot().getModelEntity().getName();
if("RootDummy".equals(entity)) {
String pn = (project == null) ? "?" : project.getName();
- throw new RuntimeException("Struts Project " + pn + " is corrupted.");
+ throw new IllegalArgumentException("Struts Project " + pn + " is corrupted.");
}
this.model = model;
}
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/search/impl/SearchCommandImpl.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/search/impl/SearchCommandImpl.java 2008-08-29 00:21:46 UTC (rev 9949)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/search/impl/SearchCommandImpl.java 2008-08-29 06:36:13 UTC (rev 9950)
@@ -51,9 +51,9 @@
public void validate() {
String rootpath = getAttributeValue("root");
- if(rootpath.length() == 0) throw new RuntimeException("Attribute 'root' of search command must be set.");
+ if(rootpath.length() == 0) throw new IllegalStateException("Attribute 'root' of search command must be set.");
XModelObject root = getModel().getByPath(rootpath);
- if(root == null) throw new RuntimeException("Root of search command is not found in model.");
+ if(root == null) throw new IllegalStateException("Root of search command is not found in model.");
}
protected void execute(XModelObject o, ArrayList<XModelObject> list) {
16 years, 6 months
JBoss Tools SVN: r9949 - in trunk: common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/reporting and 49 other directories.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2008-08-28 20:21:46 -0400 (Thu, 28 Aug 2008)
New Revision: 9949
Added:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/FormRuntimeException.java
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/MethodNotImplementedException.java
Modified:
trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbConnectorFactory.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/action/AddNatureActionDelegate.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/action/CommandBar.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/action/CommandBarListener.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/adapter/AdapterFactory.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/editor/CheckBoxFieldEditor.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/JavaAdapter.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/JavaChoicerFieldEditor.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/JavaEclipseChoicerFieldEditor.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/JavaHyperlinkLineFieldEditor.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/PropertyEditorFactory.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/SliderCellEditorEx.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/SliderFieldEditor.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/StringFieldEditor.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/TableStructuredFieldEditor.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/dnd/DnDUtil.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editor/DefaultEditorPart.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editor/EditorPartFactory.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/editor/EditorPartWrapperExtension.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editor/ModelObjectJarEntryEditorInput.java
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/DropCommandFactory.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DropUtils.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/ElementGeneratorFactory.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/JSPTagProposalFactory.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/PaletteDropCommand.java
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/TagProposalsComposite.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/forms/Form.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/FormContainer.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/FormFactory.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/GreedyLayoutDataFactory.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/InfoLayoutDataFactory.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/LayouredFormFactory.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/LayoutDataFactory.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/navigator/FilteredTreeContentProvider.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/navigator/TreeViewerModelListenerImpl.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/PropertiesWizard.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/objecteditor/XChildrenEditor.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/outline/XModelObjectContentProvider.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/reporting/ProblemReporter.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/reporting/ReportProblemWizard.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/resources/ResourceLayoutManager.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/select/SelectObjectWizard.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/select/XModelObjectSelectionProvider.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/templates/TemplatesConfiguration.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/templates/configuration/MetaConfigurationLoader.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/util/ExtensionPointUtils.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/views/navigator/NavigatorContentProvider.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/views/navigator/NavigatorMenuInvoker.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/views/navigator/NavigatorViewPart.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/widgets/TextAndReferenceComponent.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/wizard/newfile/NewFileContext.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/wizard/newfile/NewFileWizard.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/wizards/NewClassWizard.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/wizards/query/AbstractQueryWizardView.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/model/ui/wizards/standard/DefaultStandardStep.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/wizards/standard/DefaultStandardWizard.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/propertieseditor/BundleEditor.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/propertieseditor/PropertiesCompoundEditor.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/propertieseditor/PropertiesEditor.java
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/text/PropertyTextEditorSupport.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/extension/ExtensionPointUtil.java
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/CommonPlugin.java
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/reporting/ProblemReportingHelper.java
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/reporting/Submit.java
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/util/FileUtil.java
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/util/ResourcesUtils.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/action/AddJSFNatureActionDelegate.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/ExtendedJSPContentAssistProcessor.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/FaceletsHtmlContentAssistProcessor.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/SourceEditorPageContext.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb/WTPTextJspKbConnector.java
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/RunPageActionDelegate.java
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/SaveProjectAsTemplateActionDelegate.java
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/adf/AddADFSupportAction.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamMessagesLoader.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/LibraryScanner.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationContext.java
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamBeanHyperlink.java
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamBeanHyperlinkPartitioner.java
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamELInJavaStringHyperlinkDetector.java
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamViewHyperlink.java
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamViewHyperlinkPartitioner.java
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/SeamPagesEditor.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/actions/FindSeamAction.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/actions/ScopePresentationActionProvider.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/ButtonFieldEditor.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/LinkFieldEditor.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseOperation.java
trunk/struts/plugins/org.jboss.tools.struts.ui/src/org/jboss/tools/struts/ui/internal/action/AddStrutsNatureActionDelegate.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/context/VpePageContext.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/FileUtil.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-351
Fix for exceptions handling.
Modified: trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/CommonPlugin.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/CommonPlugin.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/CommonPlugin.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -18,7 +18,6 @@
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
import org.jboss.tools.common.log.BasePlugin;
import org.jboss.tools.common.log.IPluginLog;
import org.osgi.framework.Bundle;
Added: trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/MethodNotImplementedException.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/MethodNotImplementedException.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/MethodNotImplementedException.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.common;
+
+/**
+ * @author eskimo
+ *
+ */
+public class MethodNotImplementedException extends RuntimeException {
+
+ public MethodNotImplementedException() {
+ super("Method is not implemented yet");
+ }
+
+ public MethodNotImplementedException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public MethodNotImplementedException(String message) {
+ super(message);
+ }
+
+ public MethodNotImplementedException(Throwable cause) {
+ super(cause);
+ }
+
+}
Property changes on: trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/MethodNotImplementedException.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/reporting/ProblemReportingHelper.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/reporting/ProblemReportingHelper.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/reporting/ProblemReportingHelper.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -12,7 +12,6 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
-import org.jboss.tools.common.CommonPlugin;
/**
* Helper class for processing all exceptions caught in Red Hat code.
@@ -52,11 +51,7 @@
return;
}
IProblemReporter reporter = ProblemReporterFactory.getInstance().getProblemReporter();
- try {
- reporter.reportProblem(status);
- } catch (Exception t) {
- CommonPlugin.getPluginLog().logError("Failed to call custom reporter.", t);
- }
+ reporter.reportProblem(status);
}
public static final ProblemBuffer buffer = new ProblemBuffer();
Modified: trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/reporting/Submit.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/reporting/Submit.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/reporting/Submit.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -10,13 +10,14 @@
******************************************************************************/
package org.jboss.tools.common.reporting;
+import java.io.IOException;
+
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.methods.PostMethod;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
-
import org.jboss.tools.common.CommonPlugin;
import org.jboss.tools.common.util.HttpUtil;
@@ -55,7 +56,7 @@
public IStatus run(IProgressMonitor monitor) {
try {
submitReport(reportText);
- } catch (Exception e) {
+ } catch (IOException e) {
String exceptionMessage = e.getMessage();
String message = ERROR_MESSAGE;
if(exceptionMessage!=null && exceptionMessage.trim().length()>0) {
@@ -74,7 +75,7 @@
job.schedule();
}
- private int submitReport(String reportText) throws Exception {
+ private int submitReport(String reportText) throws IOException {
HttpClient httpClient = HttpUtil.createHttpClient(URL);
PostMethod httpPost = new PostMethod(URL);
httpPost.addParameter(REPORT_DESRIPTION_PARAMETER_NAME, reportText);
Modified: trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/util/FileUtil.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/util/FileUtil.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/util/FileUtil.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -10,9 +10,34 @@
******************************************************************************/
package org.jboss.tools.common.util;
-import java.io.*;
-import java.util.*;
-import java.util.jar.*;
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.StringTokenizer;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+import java.util.jar.JarInputStream;
+import java.util.jar.JarOutputStream;
+import java.util.jar.Manifest;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
@@ -345,11 +370,11 @@
}
}
- public static void jar(File[] fs, String path) throws Exception {
+ public static void jar(File[] fs, String path) throws IOException {
jar(fs, path, null);
}
- public static void jar(File[] fs, String path, Manifest mf) throws Exception {
+ public static void jar(File[] fs, String path, Manifest mf) throws IOException {
File f = new File(path);
FileOutputStream fos = new FileOutputStream(f);
JarOutputStream jos = mf == null ? new JarOutputStream(fos) : new JarOutputStream(fos, mf);
@@ -361,13 +386,13 @@
}
}
- public static void add(File root, File f, JarOutputStream jos) throws Exception {
+ public static void add(File root, File f, JarOutputStream jos) throws IOException {
int l = root.getAbsolutePath().length();
String en = f.getAbsolutePath().substring(l + 1).replace('\\', '/');
add(f, en, jos);
}
- public static void add(File f, String name, JarOutputStream jos) throws Exception {
+ public static void add(File f, String name, JarOutputStream jos) throws IOException {
String en = name;
if(f.isDirectory()) en += "/";
JarEntry entry = (en.endsWith("/")) ? null : new JarEntry(en);
Modified: trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/util/ResourcesUtils.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/util/ResourcesUtils.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/util/ResourcesUtils.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -24,12 +24,8 @@
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.dialogs.IOverwriteQuery;
import org.eclipse.ui.wizards.datatransfer.FileSystemStructureProvider;
import org.eclipse.ui.wizards.datatransfer.ImportOperation;
Modified: trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbConnectorFactory.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbConnectorFactory.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbConnectorFactory.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -76,7 +76,7 @@
* @throws IllegalAccessException
* @throws ClassNotFoundException
*/
- public KbConnector createConnector(KbConnectorType type, Object key) throws InstantiationException, IllegalAccessException, ClassNotFoundException {
+ public KbConnector createConnector(KbConnectorType type, Object key) throws KbException{
Object realKey = key;
if(type.isSingleton()) {
Object o = connectorInstances.get(type.toString());
@@ -90,9 +90,17 @@
if(o!=null) {
return (KbConnector)o;
}
- Object newInstance = type.getConnectorClass().newInstance();
- connectorInstances.put(realKey, newInstance);
- return (KbConnector) newInstance;
+
+ try {
+ Object newInstance = newInstance = type.getConnectorClass().newInstance();
+ connectorInstances.put(realKey, newInstance);
+ return (KbConnector) newInstance;
+ } catch (InstantiationException e) {
+ throw new KbException(e);
+ } catch (IllegalAccessException e) {
+ throw new KbException(e);
+ }
+
}
public void removeConnector(KbConnectorType type, Object key) {
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/extension/ExtensionPointUtil.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/extension/ExtensionPointUtil.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/extension/ExtensionPointUtil.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -11,21 +11,22 @@
package org.jboss.tools.common.model.util.extension;
import org.eclipse.core.runtime.*;
+import org.jboss.tools.common.model.XModelException;
public class ExtensionPointUtil {
- public static Object findClassByElementId(String pointId, String id) throws CoreException, IllegalArgumentException {
+ public static Object findClassByElementId(String pointId, String id) throws CoreException {
IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(pointId);
return findClassByElementId(point, id);
}
- public static Object findClassByElementId(IExtensionPoint point, String id) throws CoreException, IllegalArgumentException {
+ public static Object findClassByElementId(IExtensionPoint point, String id) throws CoreException {
IConfigurationElement element = getElementById(point, id);
if(element == null)
- throw new IllegalArgumentException("Configuration element with id=" + id + " is not found");
+ throw new XModelException("Configuration element with id=" + id + " is not found");
String className = element.getAttribute("class");
if(className == null || className.length() == 0)
- throw new IllegalArgumentException("Configuration element with id=" + id + " does not define 'class' attribute");
+ throw new XModelException("Configuration element with id=" + id + " does not define 'class' attribute");
return element.createExecutableExtension("class");
}
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/action/AddNatureActionDelegate.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/action/AddNatureActionDelegate.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/action/AddNatureActionDelegate.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -10,22 +10,23 @@
******************************************************************************/
package org.jboss.tools.common.model.ui.action;
-import java.io.*;
+import java.io.File;
+
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.ui.IObjectActionDelegate;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.ui.actions.RefreshAction;
-
import org.jboss.tools.common.model.ui.ModelUIPlugin;
public abstract class AddNatureActionDelegate implements IObjectActionDelegate, IWorkbenchWindowActionDelegate {
@@ -43,14 +44,10 @@
}
return;
}
- try {
- doRun();
- } catch(Exception ex) {
- ModelUIPlugin.getPluginLog().logError(ex);
- }
+ doRun();
}
- protected void doRun() throws Exception {
+ protected void doRun() {
if(project == null) return;
RefreshAction refreshAction = new RefreshAction(ModelUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getShell());
refreshAction.selectionChanged(new StructuredSelection(project));
@@ -61,7 +58,7 @@
dialog.open();
}
- protected abstract IWizard getWizard(IProject project) throws Exception;
+ protected abstract IWizard getWizard(IProject project);
protected abstract String getNatureID();
public void selectionChanged(IAction action, ISelection selection) {
@@ -80,7 +77,7 @@
try {
if (!project.isOpen() || project.hasNature(getNatureID()))
project = null;
- } catch (Exception ex) {
+ } catch (CoreException ex) {
project = null;
ModelUIPlugin.getPluginLog().logError(ex);
}
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/action/CommandBar.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/action/CommandBar.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/action/CommandBar.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -16,6 +16,8 @@
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.graphics.*;
+import org.jboss.tools.common.model.XModelException;
+import org.jboss.tools.common.model.ui.ModelUIPlugin;
import org.jboss.tools.common.model.ui.widgets.IWidgetSettings;
public class CommandBar {
@@ -274,7 +276,13 @@
}
public void widgetSelected(SelectionEvent e) {
- if(listener != null) listener.action(command);
+ if(listener != null) {
+ try {
+ listener.action(command);
+ } catch (XModelException e1) {
+ ModelUIPlugin.getPluginLog().logError(e1);
+ }
+ }
}
public void widgetDefaultSelected(SelectionEvent e) {}
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/action/CommandBarListener.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/action/CommandBarListener.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/action/CommandBarListener.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -10,6 +10,8 @@
******************************************************************************/
package org.jboss.tools.common.model.ui.action;
+import org.jboss.tools.common.model.XModelException;
+
public interface CommandBarListener {
- public void action(String command);
+ public void action(String command) throws XModelException;
}
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/adapter/AdapterFactory.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/adapter/AdapterFactory.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/adapter/AdapterFactory.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -39,12 +39,15 @@
}
public static IModelPropertyEditorAdapter getAdapter(XAttribute attribute, XModelObject modelObject, XAttributeData attributeData, XModel model) {
- IModelPropertyEditorAdapter adapter;
- try {
- adapter = (IModelPropertyEditorAdapter)getAdapterClass(attribute).newInstance();
- } catch (Exception e) {
- adapter = new DefaultValueAdapter();
- }
+ IModelPropertyEditorAdapter adapter = new DefaultValueAdapter();;
+ try {
+ adapter = (IModelPropertyEditorAdapter)getAdapterClass(attribute).newInstance();
+ } catch (InstantiationException e) {
+ ModelUIPlugin.getPluginLog().logError(e);
+ } catch (IllegalAccessException e) {
+ ModelUIPlugin.getPluginLog().logError(e);
+ }
+
if (model == null && modelObject != null) model = modelObject.getModel();
adapter.setModel(model);
adapter.setAttribute(attribute);
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 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/adapter/DefaultXAttributeTreeContentProvider.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -104,11 +104,7 @@
}
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- try {
- viewer.refresh();
- } catch (Exception e) {
- ignore();
- }
+ viewer.refresh();
}
void ignore() {
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/CheckBoxFieldEditor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/CheckBoxFieldEditor.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/CheckBoxFieldEditor.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -13,8 +13,6 @@
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
-import org.jboss.tools.common.model.ui.IValueChangeListener;
-import org.jboss.tools.common.model.ui.IValueProvider;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.DisposeEvent;
@@ -26,7 +24,9 @@
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
-
+import org.jboss.tools.common.MethodNotImplementedException;
+import org.jboss.tools.common.model.ui.IValueChangeListener;
+import org.jboss.tools.common.model.ui.IValueProvider;
import org.jboss.tools.common.model.ui.widgets.IWidgetSettings;
public class CheckBoxFieldEditor extends ExtendedFieldEditor implements IFieldEditor, IPropertyFieldEditor, IPropertyChangeListener, PropertyChangeListener {
@@ -58,6 +58,7 @@
if (style == SKIP_LABEL) numColumns--;
((GridData)checkBox.getLayoutData()).horizontalSpan = numColumns;
}
+
protected void doFillIntoGrid(Composite parent, int numColumns) {
String text = getLabelText();
if (style == SKIP_LABEL) {
@@ -76,20 +77,25 @@
checkBox.setLayoutData(gd);
if (text != null) checkBox.setText(text);
}
+
protected Control createCheckBoxLabelControl (Composite parent) {
Button checkBox = createChangeControl(parent);
if (getLabelText() != null) checkBox.setText(getLabelText());
return checkBox;
}
+
protected void doLoad() {
- throw new RuntimeException("Not implemented");
+ throw new MethodNotImplementedException();
}
+
protected void doLoadDefault() {
- throw new RuntimeException("Not implemented");
+ throw new MethodNotImplementedException();
}
+
protected void doStore() {
// getPreferenceStore().setValue(getPreferenceName(), checkBox.getSelection());
}
+
protected Button createChangeControl(Composite parent) {
if (checkBox != null) {
checkParent(checkBox, parent);
@@ -109,6 +115,7 @@
checkBox.setSelection(booleanValue);
return checkBox;
}
+
private void createSelectionListener() {
checkBox.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
@@ -118,6 +125,7 @@
}
});
}
+
private void createDisposeListener() {
checkBox.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent event) {
@@ -125,14 +133,17 @@
}
});
}
+
public int getNumberOfControls() {
return (style == SKIP_LABEL || style == SEPARATE_LABEL) ? 2 : 1;
}
+
public void setFocus() {
if (checkBox != null) {
checkBox.setFocus();
}
}
+
public void setLabelText(String text) {
super.setLabelText(text);
Control label = getLabelComposite();
@@ -140,6 +151,7 @@
checkBox.setText(text);
}
}
+
protected void valueChanged(boolean oldValue, boolean newValue) {
setPresentsDefaultValue(false);
if (oldValue != newValue)
@@ -169,6 +181,7 @@
}
}
}
+
public boolean getBooleanValue() {
if (checkBox != null)
return checkBox.getSelection();
@@ -179,6 +192,7 @@
public int getStyle() {
return style;
}
+
public void setStyle(int style) {
this.style = style;
}
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/JavaAdapter.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/JavaAdapter.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/JavaAdapter.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -12,8 +12,15 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jdt.core.*;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.ElementChangedEvent;
+import org.eclipse.jdt.core.IElementChangedListener;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
import org.jboss.tools.common.model.ui.ModelUIPlugin;
import org.jboss.tools.common.model.ui.templates.configuration.MetaClassTemplateHelper;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
@@ -52,7 +59,7 @@
try {
javaProject = (IJavaProject)project.getNature(JavaCore.NATURE_ID);
} catch (CoreException e) {
- ModelUIPlugin.getPluginLog().logError("Cannot find Java Project Nature.", new Exception());
+ ModelUIPlugin.getPluginLog().logError("Cannot find Java Project Nature.", e);
return null;
}
IResource r = EclipseResourceUtil.getJavaSourceRoot(project);
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/JavaChoicerFieldEditor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/JavaChoicerFieldEditor.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/JavaChoicerFieldEditor.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -16,15 +16,6 @@
import java.util.List;
import java.util.StringTokenizer;
-import org.jboss.tools.common.meta.XAttribute;
-import org.jboss.tools.common.model.plugin.ModelPlugin;
-import org.jboss.tools.common.model.ui.IValueChangeListener;
-import org.jboss.tools.common.model.ui.IValueEditor;
-import org.jboss.tools.common.model.ui.IValueProvider;
-import org.jboss.tools.common.model.ui.ModelUIPlugin;
-import org.jboss.tools.common.model.ui.attribute.IPropertyDescriptorEx;
-import org.jboss.tools.common.model.ui.attribute.adapter.DefaultValueAdapter;
-import org.jboss.tools.common.model.ui.attribute.adapter.IModelPropertyEditorAdapter;
import org.eclipse.jdt.internal.ui.JavaPluginImages;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
@@ -45,17 +36,22 @@
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
-
+import org.jboss.tools.common.meta.XAttribute;
import org.jboss.tools.common.model.XModel;
import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.model.ui.IValueChangeListener;
+import org.jboss.tools.common.model.ui.IValueEditor;
+import org.jboss.tools.common.model.ui.IValueProvider;
+import org.jboss.tools.common.model.ui.ModelUIPlugin;
+import org.jboss.tools.common.model.ui.attribute.IPropertyDescriptorEx;
+import org.jboss.tools.common.model.ui.attribute.adapter.DefaultValueAdapter;
+import org.jboss.tools.common.model.ui.attribute.adapter.IModelPropertyEditorAdapter;
+import org.jboss.tools.common.model.ui.widgets.IWidgetSettings;
import org.jboss.tools.common.model.util.AccessibleClasses;
-//import org.jboss.tools.common.model.util.ClassLoaderUtil;
import org.jboss.tools.common.model.util.AccessibleJava;
import org.jboss.tools.common.model.util.ISimpleTree;
import org.jboss.tools.common.model.util.ModelFeatureFactory;
import org.jboss.tools.common.model.util.ModelImages;
-import org.jboss.tools.common.model.util.XModelObjectUtil;
-import org.jboss.tools.common.model.ui.widgets.IWidgetSettings;
public class JavaChoicerFieldEditor extends ExtendedFieldEditor implements IFieldEditor, IPropertyFieldEditor, IValueEditor, ModifyListener, ISelectionChangedListener {
protected IPropertyEditor propertyEditor;
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/JavaEclipseChoicerFieldEditor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/JavaEclipseChoicerFieldEditor.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/JavaEclipseChoicerFieldEditor.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -19,17 +19,11 @@
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
-import org.jboss.tools.common.model.ui.IValueChangeListener;
-import org.jboss.tools.common.model.ui.IValueProvider;
-import org.jboss.tools.common.model.ui.ModelUIPlugin;
-import org.jboss.tools.common.model.ui.attribute.adapter.DefaultValueAdapter;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.Signature;
-import org.eclipse.jdt.core.search.IJavaSearchConstants;
import org.eclipse.jdt.core.search.IJavaSearchScope;
import org.eclipse.jdt.core.search.SearchEngine;
import org.eclipse.jdt.core.search.TypeNameMatch;
@@ -41,8 +35,11 @@
import org.eclipse.swt.widgets.Control;
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.plugin.ModelPlugin;
-import org.jboss.tools.common.model.util.EclipseResourceUtil;
+import org.jboss.tools.common.model.ui.IValueChangeListener;
+import org.jboss.tools.common.model.ui.IValueProvider;
+import org.jboss.tools.common.model.ui.attribute.adapter.DefaultValueAdapter;
import org.jboss.tools.common.model.ui.widgets.IWidgetSettings;
+import org.jboss.tools.common.model.util.EclipseResourceUtil;
public class JavaEclipseChoicerFieldEditor extends ExtendedFieldEditor implements IFieldEditor, IPropertyFieldEditor, PropertyChangeListener {
protected IPropertyEditor propertyEditor;
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/JavaHyperlinkLineFieldEditor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/JavaHyperlinkLineFieldEditor.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/JavaHyperlinkLineFieldEditor.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -18,20 +18,13 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
-import org.jboss.tools.common.model.plugin.ModelPlugin;
-import org.jboss.tools.common.model.ui.IValueChangeListener;
-import org.jboss.tools.common.model.ui.IValueProvider;
-import org.jboss.tools.common.model.ui.attribute.adapter.DefaultValueAdapter;
-import org.jboss.tools.common.model.ui.attribute.adapter.IModelPropertyEditorAdapter;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.search.IJavaSearchConstants;
import org.eclipse.jdt.core.search.IJavaSearchScope;
import org.eclipse.jdt.core.search.SearchEngine;
-import org.eclipse.jdt.internal.ui.dialogs.FilteredTypesSelectionDialog;
import org.eclipse.jdt.internal.ui.refactoring.contentassist.JavaTypeCompletionProcessor;
import org.eclipse.jdt.ui.JavaUI;
import org.eclipse.jface.action.Action;
@@ -40,19 +33,23 @@
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Text;
-
import org.jboss.tools.common.meta.XAttribute;
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.filesystems.FileSystemsHelper;
-import org.jboss.tools.common.model.util.AccessibleJava;
-import org.jboss.tools.common.model.util.EclipseResourceUtil;
-import org.jboss.tools.common.model.util.ModelFeatureFactory;
-import org.jboss.tools.common.model.util.XModelObjectUtil;
+import org.jboss.tools.common.model.plugin.ModelPlugin;
+import org.jboss.tools.common.model.ui.IValueChangeListener;
+import org.jboss.tools.common.model.ui.IValueProvider;
import org.jboss.tools.common.model.ui.ModelUIPlugin;
+import org.jboss.tools.common.model.ui.attribute.adapter.DefaultValueAdapter;
+import org.jboss.tools.common.model.ui.attribute.adapter.IModelPropertyEditorAdapter;
import org.jboss.tools.common.model.ui.templates.ControlContentAssistHelper;
import org.jboss.tools.common.model.ui.widgets.IWidgetSettings;
import org.jboss.tools.common.model.ui.wizards.NewClassWizard;
import org.jboss.tools.common.model.ui.wizards.NewTypeWizardAdapter;
+import org.jboss.tools.common.model.util.AccessibleJava;
+import org.jboss.tools.common.model.util.EclipseResourceUtil;
+import org.jboss.tools.common.model.util.ModelFeatureFactory;
+import org.jboss.tools.common.model.util.XModelObjectUtil;
public class JavaHyperlinkLineFieldEditor extends StringButtonFieldEditorEx
implements JavaHyperlinkCueLabelProvider.JavaClassHolder {
@@ -266,17 +263,6 @@
return null;
}
- //Overrides to show standard dialog
-// protected String changePressed() {
-// IJavaSearchScope scope = project != null ? getScope(project.getName()) : null;
-// FilteredTypesSelectionDialog d = new FilteredTypesSelectionDialog(getChangeControl().getShell(), false, null, scope, 0/*IJavaSearchConstants.CLASS + IJavaSearchConstants.INTERFACE*/);
-// d.create();
-// int q = d.open();
-// Object result = d.getFirstResult();
-// if(result instanceof String) return result.toString();
-// return null;
-// }
-
private IJavaSearchScope getScope(String javaProjectName) {
IJavaElement[] elements = new IJavaElement[0];
if(javaProjectName != null) {
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/PropertyEditorFactory.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/PropertyEditorFactory.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/PropertyEditorFactory.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -15,6 +15,7 @@
import java.util.Map;
import java.util.Set;
+import org.eclipse.core.runtime.CoreException;
import org.jboss.tools.common.meta.XAttribute;
import org.jboss.tools.common.meta.action.XAttributeData;
import org.jboss.tools.common.meta.key.WizardKeys;
@@ -53,12 +54,16 @@
}
private static PropertyEditor createPropertyEditor(Object adapter, XAttribute attribute, boolean required, IWidgetSettings settings) {
- PropertyEditor propertyEditor;
+ PropertyEditor propertyEditor=null;
try {
propertyEditor = (PropertyEditor)getEditorClass(attribute).newInstance();
propertyEditor.setSettings(settings);
- } catch (Exception e) {
+ } catch (IllegalAccessException e) {
ModelUIPlugin.getPluginLog().logError(e);
+ } catch (InstantiationException e) {
+ ModelUIPlugin.getPluginLog().logError(e);
+ }
+ if (propertyEditor == null) {
propertyEditor = new StringEditor(settings);
}
String labelText = WizardKeys.getAttributeDisplayName(attribute, true);
@@ -84,14 +89,14 @@
private static Class<?> getEditorClass(String id) {
Class<?> c = classes.get(id);
if(c != null) return c;
+ c = StringEditor.class;
try {
c = ExtensionPointUtil.findClassByElementId(ATTRIBUTE_EDITOR_EXT_POINT, id).getClass();
- } catch (Exception e) {
+ } catch (CoreException e) {
if(!defaultEditorIds.contains(id)) {
defaultEditorIds.add(id);
ModelUIPlugin.getPluginLog().logInfo("PropertyEditorFactory: Default editor used for " + id);
- }
- c = StringEditor.class;
+ }
}
classes.put(id, c);
return c;
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/SliderCellEditorEx.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/SliderCellEditorEx.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/SliderCellEditorEx.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -69,7 +69,7 @@
if (intValue <= MAX_SLIDER_VALUE && intValue >= MIN_SLIDER_VALUE) {
slider.setSelection(intValue);
}
- } catch (Exception e) {
+ } catch (NumberFormatException e) {
// Do nothing
}
}
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/SliderFieldEditor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/SliderFieldEditor.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/SliderFieldEditor.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -71,7 +71,7 @@
*/
try {
intValue = Integer.parseInt(valueProvider.getStringValue(true));
- } catch (Exception e) {
+ } catch (NumberFormatException e) {
// Do nothing
}
setPropertyChangeListener(this);
@@ -211,7 +211,7 @@
slider.addSelectionListener(selectionListener);
try {
intValue = Integer.parseInt(valueProvider.getStringValue(true).toString());
- } catch (Exception e) {
+ } catch (NumberFormatException e) {
intValue = DEFAULT_SLIDER_VALUE;
}
@@ -259,7 +259,7 @@
if (null != sliderLabel) {
sliderLabel.setText(weightsString);
}
- } catch (Exception e) {
+ } catch ( NumberFormatException e) {
// Do nothing
}
}
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/StringFieldEditor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/StringFieldEditor.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/StringFieldEditor.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -31,6 +31,7 @@
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Text;
+import org.jboss.tools.common.MethodNotImplementedException;
import org.jboss.tools.common.model.ui.widgets.BorderedControl;
import org.jboss.tools.common.model.ui.widgets.IWidgetSettings;
import org.jboss.tools.common.model.ui.widgets.ScrolledComposite;
@@ -110,11 +111,11 @@
}
protected void doLoad() {
- throw new RuntimeException("Not implemented");
+ throw new MethodNotImplementedException();
}
protected void doLoadDefault() {
- throw new RuntimeException("Not implemented");
+ throw new MethodNotImplementedException();
}
protected void doStore() {
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/TableStructuredFieldEditor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/TableStructuredFieldEditor.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/TableStructuredFieldEditor.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -254,11 +254,7 @@
}
});
}
- try {
- structureChanged(null);
- } catch (Exception e ) {
- ModelUIPlugin.getPluginLog().logError(e);
- }
+ structureChanged(null);
}
return this.tableControl;
@@ -341,15 +337,11 @@
if(table == null || table.isDisposed()) return;
int i = table.getSelectionIndex();
if(i < 0) i = 0;
- try {
- tableViewer.refresh();
- int c = tableViewer.getTable().getItemCount();
- while(i >= c) --i;
- if(i >= 0) {
- tableViewer.setSelection(new StructuredSelection(tableViewer.getTable().getItem(i).getData()));
- }
- } catch (Exception e) {
- ModelUIPlugin.getPluginLog().logError(e);
+ tableViewer.refresh();
+ int c = tableViewer.getTable().getItemCount();
+ while(i >= c) --i;
+ if(i >= 0) {
+ tableViewer.setSelection(new StructuredSelection(tableViewer.getTable().getItem(i).getData()));
}
}
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 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/dnd/ControlDragDrop.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -22,6 +22,7 @@
import org.jboss.tools.common.meta.XAdoptManager;
import org.jboss.tools.common.model.event.*;
import org.jboss.tools.common.model.util.ModelFeatureFactory;
+import org.jboss.tools.common.model.XModelException;
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.XModelTransferBuffer;
import org.jboss.tools.common.model.ui.ModelUIPlugin;
@@ -335,7 +336,7 @@
}
} catch (ActionDeclinedException de) {
ignore();
- } catch (Exception e) {
+ } catch (XModelException e) {
ModelUIPlugin.getPluginLog().logError(e);
}
}
@@ -367,21 +368,17 @@
}
public Widget findTreeItem (int x, int y) {
- try {
- Tree tree = (provider.getControl() instanceof Tree) ? (Tree)provider.getControl() : null;
- Vector<TreeItem> items = getTreeExpandedItems(tree);
- for (int i = 0; i < items.size(); i++) {
- TreeItem item = items.get(i);
- Rectangle bounds = item.getBounds();
- Point p = tree.toDisplay(bounds.x, bounds.y);
-
- if (/*x >= p.x && x <= p.x + bounds.width &&*/
- y >= p.y && y <= p.y + bounds.height) {
- return item;
- }
- }
- } catch (Exception ex) {
- ModelUIPlugin.getPluginLog().logError("Error while looking for tree item at given point", ex);
+ Tree tree = (provider.getControl() instanceof Tree) ? (Tree)provider.getControl() : null;
+ Vector<TreeItem> items = getTreeExpandedItems(tree);
+ for (int i = 0; i < items.size(); i++) {
+ TreeItem item = items.get(i);
+ Rectangle bounds = item.getBounds();
+ Point p = tree.toDisplay(bounds.x, bounds.y);
+
+ if (/*x >= p.x && x <= p.x + bounds.width &&*/
+ y >= p.y && y <= p.y + bounds.height) {
+ return item;
+ }
}
return null;
}
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/dnd/DnDUtil.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/dnd/DnDUtil.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/dnd/DnDUtil.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -88,7 +88,7 @@
copy.executeHandler(object, targets, p);
}
return true;
- } catch (Exception e) {
+ } catch (XModelException e) {
return false;
}
}
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editor/DefaultEditorPart.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editor/DefaultEditorPart.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editor/DefaultEditorPart.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -168,7 +168,7 @@
public void doOperation(int operation) {
if (operation>actionMapping.size()) {
- ModelUIPlugin.getPluginLog().logError(new RuntimeException("Can not find global action with index: "+operation));
+ ModelUIPlugin.getPluginLog().logError(new IllegalArgumentException("Can not find global action with index: "+operation));
} else {
String globalAction = (String)actionMapping.get(operation);
this.doGlobalAction(globalAction);
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editor/EditorPartFactory.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editor/EditorPartFactory.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editor/EditorPartFactory.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -13,6 +13,7 @@
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.ui.IEditorActionBarContributor;
import org.eclipse.ui.IEditorPart;
+import org.jboss.tools.common.model.ui.ModelUIPlugin;
public class EditorPartFactory {
IConfigurationElement element;
@@ -20,7 +21,7 @@
Class editorClass;
Class contributorClass;
- EditorPartFactory(IConfigurationElement element, Class editorClass, Class contributorClass) throws Exception {
+ EditorPartFactory(IConfigurationElement element, Class editorClass, Class contributorClass) throws InstantiationException, IllegalAccessException {
this.element = element;
this.editorClass = editorClass;
this.contributorClass = contributorClass;
@@ -34,19 +35,27 @@
}
public IEditorPart createEditorPart() {
- try {
- return (IEditorPart)editorClass.newInstance();
- } catch (Exception e) {
- return null;
- }
+ IEditorPart part = null;
+ try {
+ part = (IEditorPart)editorClass.newInstance();
+ } catch (InstantiationException e) {
+ ModelUIPlugin.getPluginLog().logError(e);
+ } catch (IllegalAccessException e) {
+ ModelUIPlugin.getPluginLog().logError(e);
+ }
+ return part;
}
public IEditorActionBarContributor createEditorActionBarContributor() {
+ IEditorActionBarContributor contributor = null;
try {
- return (IEditorActionBarContributor)contributorClass.newInstance();
- } catch (Exception e) {
- return null;
+ contributor = (IEditorActionBarContributor)contributorClass.newInstance();
+ } catch (InstantiationException e) {
+ ModelUIPlugin.getPluginLog().logError(e);
+ } catch (IllegalAccessException e) {
+ ModelUIPlugin.getPluginLog().logError(e);
}
+ return contributor;
}
public IConfigurationElement getConfigurationElement() {
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 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editor/EditorPartWrapper.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -94,13 +94,8 @@
EditorPartWrapperExtension extension = EditorPartWrapperExtension.getInstance();
EditorPartFactory f = extension.getFactory(entity);
editor = f.createEditorPart();
-//// if(editor == null) editor = new XmlEditor();
if(editor != null) {
- try {
((WorkbenchPart)editor).setInitializationData(f.getConfigurationElement(), "", null);
- } catch (Exception e) {
- ModelUIPlugin.getPluginLog().logError(e);
- }
}
editor.init(site, input);
setSite(site);
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editor/EditorPartWrapperExtension.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editor/EditorPartWrapperExtension.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editor/EditorPartWrapperExtension.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -10,12 +10,17 @@
******************************************************************************/
package org.jboss.tools.common.model.ui.editor;
-import java.util.*;
-import org.eclipse.core.runtime.*;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.ui.part.EditorActionBarContributor;
+import org.jboss.tools.common.model.ui.ModelUIPlugin;
import org.osgi.framework.Bundle;
-import org.jboss.tools.common.model.plugin.ModelPlugin;
-import org.jboss.tools.common.model.ui.ModelUIPlugin;
public class EditorPartWrapperExtension {
static String POINT_ID = "org.jboss.tools.common.model.ui.xmlEditor";
@@ -50,13 +55,13 @@
if(priorityString != null && priorityString.length() > 0) {
priority = Integer.parseInt(priorityString);
}
- } catch (Exception e) {
+ } catch (NumberFormatException e) {
ModelUIPlugin.getPluginLog().logError("Incorrect priority value " + priorityString + ".");
}
Class editorClass = null;
try {
editorClass = bundle.loadClass(editor);
- } catch (Exception e) {
+ } catch (ClassNotFoundException e) {
if(ModelUIPlugin.getDefault().isDebugging()) {
ModelUIPlugin.getPluginLog().logError("Cannot load editor class " + editor + " from " + es[i].getNamespaceIdentifier(), e);
}
@@ -66,7 +71,7 @@
Class contributorClass = null;
try {
contributorClass = bundle.loadClass(contributor);
- } catch (Exception e) {
+ } catch (ClassNotFoundException e) {
if(ModelUIPlugin.getDefault().isDebugging()) {
String message = "Cannot load contributor class " + contributor;
ModelUIPlugin.getPluginLog().logError( message, e);
@@ -77,14 +82,10 @@
EditorPartFactory f = null;
try {
f = new EditorPartFactory(cs[j], editorClass, contributorClass);
- } catch (ClassCastException e) {
- if(ModelUIPlugin.getDefault().isDebugging()) {
- ModelUIPlugin.getPluginLog().logError(e);
- }
- continue;
- } catch (Exception e) {
+ } catch (InstantiationException e) {
ModelUIPlugin.getPluginLog().logError(e);
- continue;
+ } catch (IllegalAccessException e) {
+ ModelUIPlugin.getPluginLog().logError(e);
}
StringTokenizer st = new StringTokenizer(entities, ",;");
while(st.hasMoreTokens()) {
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editor/ModelObjectJarEntryEditorInput.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editor/ModelObjectJarEntryEditorInput.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editor/ModelObjectJarEntryEditorInput.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -11,9 +11,10 @@
package org.jboss.tools.common.model.ui.editor;
import org.eclipse.core.resources.IStorage;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.ui.IStorageEditorInput;
-
import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.model.ui.ModelUIPlugin;
public class ModelObjectJarEntryEditorInput extends ModelObjectStorageEditorInput {
String jarFile;
@@ -39,8 +40,8 @@
IStorage storage = null;
try {
storage = input.getStorage();
- } catch (Exception e) {
- //ignore
+ } catch (CoreException e) {
+ ModelUIPlugin.getPluginLog().logError(e);
}
String s = (storage == null) ? "" : storage.toString();
if(jarEntryFileToString().equals(s)) return true;
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 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/AbsoluteFilePathAttributeValueLoader.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -11,14 +11,16 @@
package org.jboss.tools.common.model.ui.editors.dnd;
import java.util.Properties;
+
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IPath;
-import org.jboss.tools.common.model.ui.dnd.DnDUtil;
import org.eclipse.ui.IFileEditorInput;
import org.jboss.tools.common.model.XModelBuffer;
+import org.jboss.tools.common.model.XModelException;
import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.model.ui.dnd.DnDUtil;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
public class AbsoluteFilePathAttributeValueLoader implements IAttributeValueLoader {
@@ -75,7 +77,7 @@
DnDUtil.paste(t, p);
return p.getProperty("start text");
- } catch (Exception e) {
+ } catch (XModelException e) {
return null;
} finally {
b.clear();
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DropCommandFactory.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DropCommandFactory.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DropCommandFactory.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -12,7 +12,6 @@
import java.util.HashMap;
-import org.jboss.tools.common.model.ui.dnd.DnDUtil;
import org.jboss.tools.common.model.ui.dnd.ModelTransfer;
/**
@@ -95,14 +94,18 @@
* @return the drop command
*/
public IDropCommand getDropCommand(String mimeType, ITagProposalFactory tagProposalFactory) {
- IDropCommand fInstance = null;
+ IDropCommand fInstance = UNKNOWN_MIME_COMMAND;
try {
String fClassName = (String)fMimeCommandMap.get(mimeType);
Class newClass = this.getClass().getClassLoader().loadClass(fClassName);
fInstance = (IDropCommand)newClass.newInstance();
fInstance.setTagProposalFactory(tagProposalFactory);
- } catch (Exception e) {
- return UNKNOWN_MIME_COMMAND;
+ } catch (ClassNotFoundException e) {
+ //ignore
+ } catch (InstantiationException e) {
+ //ignore
+ } catch (IllegalAccessException e) {
+ //ignore
}
return fInstance;
}
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DropUtils.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DropUtils.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DropUtils.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -23,23 +23,23 @@
import org.eclipse.jface.text.IDocument;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IFileEditorInput;
-
-import org.jboss.tools.common.model.XModel;
-import org.jboss.tools.common.model.XModelObject;
-import org.jboss.tools.common.model.filesystems.impl.FileAnyImpl;
-import org.jboss.tools.common.model.project.IModelNature;
-import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.common.kb.AttributeDescriptor;
import org.jboss.tools.common.kb.KbConnectorFactory;
import org.jboss.tools.common.kb.KbConnectorType;
+import org.jboss.tools.common.kb.KbException;
import org.jboss.tools.common.kb.KbTldResource;
import org.jboss.tools.common.kb.TagDescriptor;
import org.jboss.tools.common.kb.wtp.JspWtpKbConnector;
import org.jboss.tools.common.kb.wtp.TLDVersionHelper;
+import org.jboss.tools.common.model.XModel;
+import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.model.filesystems.impl.FileAnyImpl;
+import org.jboss.tools.common.model.project.IModelNature;
import org.jboss.tools.common.model.ui.ModelUIPlugin;
import org.jboss.tools.common.model.ui.editor.IModelObjectEditorInput;
import org.jboss.tools.common.model.ui.editors.dnd.composite.TagAttributesComposite;
import org.jboss.tools.common.model.ui.editors.dnd.composite.TagAttributesComposite.AttributeDescriptorValue;
+import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.jst.web.tld.ITaglibMapping;
import org.jboss.tools.jst.web.tld.IWebProject;
import org.jboss.tools.jst.web.tld.WebProjectFactory;
@@ -61,28 +61,22 @@
*/
public static String getTldContent(IEditorInput input, String uri) {
String tldContent = null;
- try {
- XModel xModel = null;
- if(input instanceof IModelObjectEditorInput) {
- xModel = ((IModelObjectEditorInput)input).getXModelObject().getModel();
- } else if(input instanceof IFileEditorInput) {
- IFile f = ((IFileEditorInput)input).getFile();
- XModelObject o = EclipseResourceUtil.getObjectByResource(f);
- if(o != null) xModel = o.getModel();
+ XModel xModel = null;
+ if(input instanceof IModelObjectEditorInput) {
+ xModel = ((IModelObjectEditorInput)input).getXModelObject().getModel();
+ } else if(input instanceof IFileEditorInput) {
+ IFile f = ((IFileEditorInput)input).getFile();
+ XModelObject o = EclipseResourceUtil.getObjectByResource(f);
+ if(o != null) xModel = o.getModel();
+ }
+ if(xModel != null) {
+ ITaglibMapping mapping = WebProjectFactory.instance.getWebProject(xModel).getTaglibMapping();
+ XModelObject xmo = mapping.getTaglibObject(uri);
+ if(xmo != null) {
+// tldLocation = EclipseResourceUtil.getResource(xmo).getFullPath().toString();
+ FileAnyImpl fai = (FileAnyImpl)xmo;
+ tldContent = fai.getAsText();
}
- if(xModel != null) {
- ITaglibMapping mapping = WebProjectFactory.instance.getWebProject(xModel).getTaglibMapping();
- XModelObject xmo = mapping.getTaglibObject(uri);
- if(xmo != null) {
-// tldLocation = EclipseResourceUtil.getResource(xmo).getFullPath().toString();
- FileAnyImpl fai = (FileAnyImpl)xmo;
- tldContent = fai.getAsText();
- }
- }
- } catch (Exception ex) {
-// VpePlugin.reportProblem(ex);
- ModelUIPlugin.getPluginLog().logError(ex);
- // empty TLD content will be set
}
return tldContent;
}
@@ -121,10 +115,8 @@
if(tagInfo != null) {
attributes = tagInfo.getAttributesDescriptors();
}
- } catch (Exception ex) {
-// VpePlugin.reportProblem(ex);
+ } catch (KbException ex) {
ModelUIPlugin.getPluginLog().logError(ex);
- // empty array will be returned
}
if(attributes==null)return new AttributeDescriptorValue[0];
List<AttributeDescriptorValue> attributesValues = new ArrayList<AttributeDescriptorValue>();
@@ -152,7 +144,7 @@
}
wtpKbConnector.registerResource(new KbTldResource(uri, "", tagPrefix, version), true);
tagInfo = wtpKbConnector.getTagInformation("/"+(tagPrefix==TagProposal.EMPTY_PREFIX?"":tagPrefix+":")+tagName);
- } catch (Exception ex) {
+ } catch (KbException ex) {
ModelUIPlugin.getPluginLog().logError(ex);
}
return tagInfo;
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/ElementGeneratorFactory.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/ElementGeneratorFactory.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/ElementGeneratorFactory.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -13,6 +13,8 @@
import java.util.HashMap;
import java.util.Map;
+import org.jboss.tools.common.model.ui.ModelUIPlugin;
+
public class ElementGeneratorFactory {
private static final ElementGeneratorFactory INSTANCE
@@ -37,12 +39,14 @@
}
public IElementGenerator getElementGenerator(String uri) {
- IElementGenerator fInstance = null;
+ IElementGenerator fInstance = DEFAULT_ELEMENT_GENERATOR;
try {
Class fClass = (Class)generatorMap.get(uri);
fInstance = (IElementGenerator)fClass.newInstance();
- } catch (Exception e) {
- return DEFAULT_ELEMENT_GENERATOR;
+ } catch (InstantiationException e) {
+ ModelUIPlugin.getPluginLog().logError(e);
+ } catch (IllegalAccessException e) {
+ ModelUIPlugin.getPluginLog().logError(e);
}
return fInstance;
}
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/JSPTagProposalFactory.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/JSPTagProposalFactory.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/JSPTagProposalFactory.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -13,6 +13,8 @@
import java.util.HashMap;
import java.util.Map;
+import org.jboss.tools.common.model.ui.ModelUIPlugin;
+
public class JSPTagProposalFactory implements ITagProposalFactory {
private static final JSPTagProposalFactory INSTANCE = new JSPTagProposalFactory();
public static Map<String,String> loaderMap = new HashMap<String,String>();
@@ -30,13 +32,17 @@
}
public ITagProposalLoader getProposalLoader(String mimeType) {
- ITagProposalLoader fInstance = null;
+ ITagProposalLoader fInstance = DEFAULT_PROPOSAL_LOADER;
try {
String fClassName = (String)loaderMap.get(mimeType);
Class newClass = this.getClass().getClassLoader().loadClass(fClassName);
fInstance = (ITagProposalLoader)newClass.newInstance();
- } catch (Exception e) {
- return DEFAULT_PROPOSAL_LOADER;
+ } catch (InstantiationException e) {
+ ModelUIPlugin.getPluginLog().logError(e);
+ } catch (IllegalAccessException e) {
+ ModelUIPlugin.getPluginLog().logError(e);
+ } catch (ClassNotFoundException e) {
+ ModelUIPlugin.getPluginLog().logError(e);
}
return fInstance;
}
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/PaletteDropCommand.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/PaletteDropCommand.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/PaletteDropCommand.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -13,6 +13,8 @@
import java.util.Properties;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.ITextSelection;
import org.eclipse.jface.text.source.ISourceViewer;
@@ -57,16 +59,12 @@
}
protected void addCustomProperties(Properties runningProperties) {
- try {
- newLine = properties.getProperty(PaletteInsertHelper.PROPOPERTY_NEW_LINE);
- if (newLine == null) newLine="true";
- runningProperties.setProperty(PaletteInsertHelper.PROPOPERTY_NEW_LINE, newLine);
- String addTaglib = properties.getProperty(PaletteInsertHelper.PROPOPERTY_ADD_TAGLIB);
- if(addTaglib == null) addTaglib = "true";
- runningProperties.setProperty(PaletteInsertHelper.PROPOPERTY_ADD_TAGLIB, addTaglib);
- } catch (Exception e){
- ModelUIPlugin.getPluginLog().logError(e);
- }
+ newLine = properties.getProperty(PaletteInsertHelper.PROPOPERTY_NEW_LINE);
+ if (newLine == null) newLine="true";
+ runningProperties.setProperty(PaletteInsertHelper.PROPOPERTY_NEW_LINE, newLine);
+ String addTaglib = properties.getProperty(PaletteInsertHelper.PROPOPERTY_ADD_TAGLIB);
+ if(addTaglib == null) addTaglib = "true";
+ runningProperties.setProperty(PaletteInsertHelper.PROPOPERTY_ADD_TAGLIB, addTaglib);
}
public void execute() {
@@ -102,7 +100,7 @@
text += "></"+container.getNodeName()+">";
document.replace(containerOffset+slashPosition, containerString.length()-slashPosition, text);
}
- }catch(Exception ex){
+ }catch(BadLocationException ex){
ModelUIPlugin.getPluginLog().logError(ex);
}
}
@@ -173,7 +171,7 @@
properties.setProperty("new line", "newLine");
}
}
- } catch (Exception e) {
+ } catch (CoreException e) {
ModelUIPlugin.getPluginLog().logError(e);
}
startText = properties.getProperty(TLDToPaletteHelper.START_TEXT);
@@ -308,11 +306,7 @@
IDropWizard wizard = null;
if(wizardName != null) {
- try {
- wizard = (IDropWizard)PaletteInsertManager.getInstance().createWizardInstance(properties);
- } catch (Exception e) {
- ModelUIPlugin.getPluginLog().logError(e);
- }
+ wizard = (IDropWizard)PaletteInsertManager.getInstance().createWizardInstance(properties);
}
if(wizard == null) wizard = new DropWizard();
wizard.setCommand(this);
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 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/composite/TagAttributesComposite.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -12,12 +12,23 @@
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
-import java.util.*;
+import java.util.ArrayList;
import java.util.List;
+import java.util.Properties;
-import org.jboss.tools.common.model.ui.ModelUIPlugin;
-import org.jboss.tools.common.model.ui.objecteditor.ExtendedCellEditorProvider;
-import org.eclipse.jface.viewers.*;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.ColumnPixelData;
+import org.eclipse.jface.viewers.ICellEditorListener;
+import org.eclipse.jface.viewers.ICellModifier;
+import org.eclipse.jface.viewers.IElementComparer;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.TableLayout;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TextCellEditor;
+import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
@@ -26,11 +37,15 @@
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.jboss.tools.common.model.util.ModelFeatureFactory;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
import org.jboss.tools.common.kb.AttributeDescriptor;
import org.jboss.tools.common.kb.AttributeValueDescriptor;
import org.jboss.tools.common.model.ui.editors.dnd.IDropWizardModel;
+import org.jboss.tools.common.model.ui.objecteditor.ExtendedCellEditorProvider;
+import org.jboss.tools.common.model.util.ModelFeatureFactory;
/**
*
@@ -349,7 +364,7 @@
case ATTRIBUTE_VALUE_INDEX:
return attrDescr.getValue()==null?"":attrDescr.getValue().toString();
}
- throw new RuntimeException("Wrong column index for LabelProvider");
+ throw new IllegalArgumentException("Wrong column index for LabelProvider");
}
public void addListener(ILabelProviderListener listener) {
@@ -372,14 +387,7 @@
private Properties context = new Properties();
private ExtendedCellEditorProvider createCellEditorProvider() {
- try {
- return (ExtendedCellEditorProvider)ModelFeatureFactory.getInstance().createFeatureInstance("org.jboss.tools.jst.jsp.outline.JSPCellEditorProviderImpl");
- } catch (Exception e) {
-// VpePlugin.reportProblem(e);
- ModelUIPlugin.getPluginLog().logError(e);
- }
-
- return null;
+ return (ExtendedCellEditorProvider)ModelFeatureFactory.getInstance().createFeatureInstance("org.jboss.tools.jst.jsp.outline.JSPCellEditorProviderImpl");
}
/**
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/composite/TagProposalsComposite.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/composite/TagProposalsComposite.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/composite/TagProposalsComposite.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -26,10 +26,10 @@
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
+import org.jboss.tools.common.model.ui.editors.dnd.IDropWizardModel;
+import org.jboss.tools.common.model.ui.editors.dnd.ITagProposalFactory;
+import org.jboss.tools.common.model.ui.editors.dnd.TagProposal;
-import org.jboss.tools.common.model.ui.ModelUIPlugin;
-import org.jboss.tools.common.model.ui.editors.dnd.*;
-
public class TagProposalsComposite extends Composite {
private TagProposal selection = IDropWizardModel.UNDEFINED_TAG_PROPOSAL;
@@ -90,21 +90,16 @@
tableTreeViewer.addCheckStateListener(
new ICheckStateListener() {
public void checkStateChanged(CheckStateChangedEvent event) {
- try {
- TagProposal proposal = (TagProposal) event.getElement();
- if (event.getChecked()) {
- if(selection!=IDropWizardModel.UNDEFINED_TAG_PROPOSAL) {
- tableTreeViewer.setChecked(selection, false);
- }
- selection = proposal;
- } else {
- selection = IDropWizardModel.UNDEFINED_TAG_PROPOSAL;
+ TagProposal proposal = (TagProposal) event.getElement();
+ if (event.getChecked()) {
+ if(selection!=IDropWizardModel.UNDEFINED_TAG_PROPOSAL) {
+ tableTreeViewer.setChecked(selection, false);
}
- fModel.setTagProposal(selection);
- } catch (Exception e) {
-// VpePlugin.reportProblem(e);
- ModelUIPlugin.getPluginLog().logError(e);
+ selection = proposal;
+ } else {
+ selection = IDropWizardModel.UNDEFINED_TAG_PROPOSAL;
}
+ fModel.setTagProposal(selection);
}
}
);
@@ -143,7 +138,7 @@
case TAG_URI_INDEX:
return prop.getUri();
}
- throw new RuntimeException("Wrong column index for LabelProvider");
+ throw new IllegalArgumentException("Wrong column index for LabelProvider");
}
public void addListener(ILabelProviderListener listener) {
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 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/context/DropContext.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -27,7 +27,6 @@
import org.eclipse.swt.dnd.Transfer;
import org.eclipse.swt.dnd.TransferData;
import org.eclipse.swt.events.TypedEvent;
-import org.eclipse.wst.sse.ui.internal.TextDropAction;
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.XModelTransferBuffer;
import org.jboss.tools.common.model.options.PreferenceModelUtilities;
@@ -124,7 +123,7 @@
File f = new File(s[0]);
try {
return f.toURL().toString();
- } catch (Exception e) {
+ } catch (MalformedURLException e) {
return s[0];
}
}
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 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/AnyElementForm.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -10,13 +10,9 @@
******************************************************************************/
package org.jboss.tools.common.model.ui.forms;
-import java.util.*;
-import org.eclipse.core.runtime.Status;
-import org.jboss.tools.common.model.ui.action.CommandBar;
-import org.jboss.tools.common.model.ui.action.CommandBarListener;
-import org.jboss.tools.common.model.ui.objecteditor.XChildrenEditor;
-import org.jboss.tools.common.model.ui.objecteditor.XTable;
-import org.jboss.tools.common.model.ui.objecteditor.XTableProvider;
+import java.util.Properties;
+import java.util.StringTokenizer;
+
import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.ICellModifier;
import org.eclipse.jface.viewers.ISelectionChangedListener;
@@ -24,17 +20,25 @@
import org.eclipse.jface.viewers.TextCellEditor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.TableItem;
import org.jboss.tools.common.meta.action.XActionInvoker;
import org.jboss.tools.common.model.ServiceDialog;
import org.jboss.tools.common.model.XModelException;
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.impl.AnyElementObjectImpl;
import org.jboss.tools.common.model.ui.ModelUIPlugin;
-import org.jboss.tools.common.model.ui.forms.ExpandableForm;
-import org.jboss.tools.common.model.ui.widgets.*;
+import org.jboss.tools.common.model.ui.action.CommandBar;
+import org.jboss.tools.common.model.ui.action.CommandBarListener;
+import org.jboss.tools.common.model.ui.objecteditor.XChildrenEditor;
+import org.jboss.tools.common.model.ui.objecteditor.XTable;
+import org.jboss.tools.common.model.ui.objecteditor.XTableProvider;
+import org.jboss.tools.common.model.ui.widgets.IWidgetSettings;
+import org.jboss.tools.common.model.ui.widgets.WhiteSettings;
public class AnyElementForm extends ExpandableForm {
private XModelObject xmo;
@@ -251,17 +255,13 @@
}
class CommandBarListenerImpl implements CommandBarListener {
- public void action(String command) {
+ public void action(String command) throws XModelException {
if(XChildrenEditor.ADD.equals(command)) {
add();
} else if(XChildrenEditor.EDIT.equals(command)) {
edit();
} else if(XChildrenEditor.DELETE.equals(command)) {
- try {
delete();
- } catch (XModelException e) {
- throw new RuntimeException(e.getMessage(), e);
- }
}
}
}
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/Form.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/Form.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/Form.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -11,18 +11,10 @@
package org.jboss.tools.common.model.ui.forms;
import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Iterator;
-import org.eclipse.core.runtime.Status;
-import org.jboss.tools.common.editor.form.RightFormContainer;
-import org.jboss.tools.common.model.ui.attribute.XAttributeSupport;
-import org.jboss.tools.common.model.ui.attribute.adapter.XChildrenTableStructuredAdapter;
-import org.jboss.tools.common.model.ui.attribute.editor.ExtendedFieldEditor;
-import org.jboss.tools.common.model.ui.attribute.editor.IFieldEditor;
-import org.jboss.tools.common.model.ui.attribute.editor.IPropertyEditor;
-import org.jboss.tools.common.model.ui.attribute.editor.IPropertyFieldEditor;
-import org.jboss.tools.common.model.ui.attribute.editor.TableStructuredEditor;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
@@ -30,12 +22,17 @@
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
-
+import org.jboss.tools.common.editor.form.RightFormContainer;
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.ui.ModelUIMessages;
import org.jboss.tools.common.model.ui.ModelUIPlugin;
-import org.jboss.tools.common.model.ui.forms.ExpandableForm;
-import org.jboss.tools.common.model.ui.forms.IFormContainer;
+import org.jboss.tools.common.model.ui.attribute.XAttributeSupport;
+import org.jboss.tools.common.model.ui.attribute.adapter.XChildrenTableStructuredAdapter;
+import org.jboss.tools.common.model.ui.attribute.editor.ExtendedFieldEditor;
+import org.jboss.tools.common.model.ui.attribute.editor.IFieldEditor;
+import org.jboss.tools.common.model.ui.attribute.editor.IPropertyEditor;
+import org.jboss.tools.common.model.ui.attribute.editor.IPropertyFieldEditor;
+import org.jboss.tools.common.model.ui.attribute.editor.TableStructuredEditor;
import org.jboss.tools.common.model.ui.widgets.IWidgetSettings;
/**
@@ -134,9 +131,16 @@
((ExtendedFieldEditor)wraper).setEnabled(xmo.isAttributeEditable(attributes[i].getName()));
fieldEditors.add((ExtendedFieldEditor)wraper);
support.registerFieldEditor(editor.getAttributeName(), (ExtendedFieldEditor)wraper);
- }
- catch (Exception e) {
+ } catch (ClassNotFoundException e) {
ModelUIPlugin.getPluginLog().logError(e);
+ } catch (NoSuchMethodException e) {
+ ModelUIPlugin.getPluginLog().logError(e);
+ } catch (InstantiationException e) {
+ ModelUIPlugin.getPluginLog().logError(e);
+ } catch (IllegalAccessException e) {
+ ModelUIPlugin.getPluginLog().logError(e);
+ } catch (InvocationTargetException e) {
+ ModelUIPlugin.getPluginLog().logError(e);
}
} else {
ExtendedFieldEditor fieldEditor = (ExtendedFieldEditor)((IFieldEditor)editor.getFieldEditor(composite));
@@ -148,7 +152,7 @@
support.registerFieldEditor(editor.getAttributeName(), (ExtendedFieldEditor)fieldEditor);
}
} else {
- ModelUIPlugin.getPluginLog().logInfo( ModelUIMessages.getString(CANNOT_LOAD_ATTRIBUTE, new String[] {attributes[i].getName()}), new Exception(ModelUIMessages.getString(CANNOT_LOAD_ATTRIBUTE, new String[] {attributes[i].getName()})));
+ ModelUIPlugin.getPluginLog().logInfo( ModelUIMessages.getString(CANNOT_LOAD_ATTRIBUTE, new String[] {attributes[i].getName()}));
}
}
} else {
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/FormContainer.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/FormContainer.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/FormContainer.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -11,10 +11,8 @@
package org.jboss.tools.common.model.ui.forms;
import org.jboss.tools.common.model.XModelObject;
-import org.jboss.tools.common.model.util.ModelFeatureFactory;
import org.jboss.tools.common.model.ui.ModelUIPlugin;
-import org.jboss.tools.common.model.ui.forms.DefaultFormContainer;
-import org.jboss.tools.common.model.ui.forms.IForm;
+import org.jboss.tools.common.model.util.ModelFeatureFactory;
/**
* @author Igels
@@ -66,7 +64,7 @@
child = xmo.getChildByPath(entity);
if(child == null) {
String message = "Cannot build child form '" + forms[i].getEntityName() + "' for form '" + formData.getEntityName() + "'.";
- Exception exc = new RuntimeException(message);
+ Exception exc = new FormRuntimeException(message);
ModelUIPlugin.getPluginLog().logError(exc);
} else {
this.get(i).initialize(child);
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/FormFactory.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/FormFactory.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/FormFactory.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -11,9 +11,8 @@
package org.jboss.tools.common.model.ui.forms;
import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.model.ui.ModelUIPlugin;
import org.jboss.tools.common.model.util.ModelFeatureFactory;
-import org.jboss.tools.common.model.ui.ModelUIPlugin;
-import org.jboss.tools.common.model.ui.forms.IForm;
/**
* @author Igels
@@ -42,8 +41,10 @@
IForm form = null;
try {
form = (IForm)formClass.newInstance();
- } catch(Exception e) {
+ } catch (InstantiationException e) {
ModelUIPlugin.getPluginLog().logError(e);
+ } catch (IllegalAccessException e) {
+ ModelUIPlugin.getPluginLog().logError(e);
}
return form;
}
Added: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/FormRuntimeException.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/FormRuntimeException.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/FormRuntimeException.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.common.model.ui.forms;
+
+/**
+ * @author eskimo
+ *
+ */
+public class FormRuntimeException extends RuntimeException {
+
+ public FormRuntimeException() {
+ super();
+ // TODO Auto-generated constructor stub
+ }
+
+ public FormRuntimeException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public FormRuntimeException(String message) {
+ super(message);
+ }
+
+ public FormRuntimeException(Throwable cause) {
+ super(cause);
+ }
+
+}
Property changes on: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/FormRuntimeException.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/GreedyLayoutDataFactory.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/GreedyLayoutDataFactory.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/GreedyLayoutDataFactory.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -31,6 +31,6 @@
} else if(type == AttributeControlType.EDITOR) {
return new GridData(GridData.FILL_BOTH);
}
- throw new RuntimeException("Attribute control type may be only Label or Editor but this is " + type);
+ throw new FormRuntimeException("Attribute control type may be only Label or Editor but this is " + type);
}
}
\ No newline at end of file
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/InfoLayoutDataFactory.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/InfoLayoutDataFactory.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/InfoLayoutDataFactory.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -43,6 +43,6 @@
gd.heightHint = 60;
return gd;
}
- throw new RuntimeException("Attribute control type may be only Label or Editor but this is " + type);
+ throw new FormRuntimeException("Attribute control type may be only Label or Editor but this is " + type);
}
}
\ No newline at end of file
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/LayouredFormFactory.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/LayouredFormFactory.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/LayouredFormFactory.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -10,10 +10,11 @@
******************************************************************************/
package org.jboss.tools.common.model.ui.forms;
+import java.lang.reflect.InvocationTargetException;
+
import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.model.ui.ModelUIPlugin;
import org.jboss.tools.common.model.util.ModelFeatureFactory;
-import org.jboss.tools.common.model.ui.ModelUIPlugin;
-import org.jboss.tools.common.model.ui.forms.IForm;
/**
* @author Igels
@@ -27,6 +28,7 @@
initialize();
}
+ // FIXME: Get rid of reflection
private void initialize() {
// String entityName = getXModelObject().getModelEntity().getName();
String formLayoutDataClassName = null;
@@ -34,8 +36,12 @@
Class formLayoutDataClass = ModelFeatureFactory.getInstance().getFeatureClass(formLayoutDataClassName);
try {
formLayoutData = (IFormLayoutData)formLayoutDataClass.getMethod("getInstance", (Class[])null).invoke(null, (Object[])null);
- } catch(Exception e) {
+ } catch (IllegalAccessException e) {
ModelUIPlugin.getPluginLog().logError(e);
+ } catch (InvocationTargetException e) {
+ ModelUIPlugin.getPluginLog().logError(e);
+ } catch (NoSuchMethodException e) {
+ ModelUIPlugin.getPluginLog().logError(e);
}
}
@@ -43,20 +49,15 @@
public IForm getForm() {
IForm form = null;
- try {
- String entity = getXModelObject().getModelEntity().getName();
- IFormData formData = formLayoutData.getFormData(entity);
- if(formData == null) {
- String message = "Cannot find form for entity " + entity + ".";
- ModelUIPlugin.getPluginLog().logError(new Exception(message));
- } else if(formData.getForms() != null) {
- form = new FormContainer(formData);
- } else {
- form = new DefaultFormContainer(new Form(formData));
- }
- } catch(Exception e) {
- String message = "Cannot build form.";
- ModelUIPlugin.getPluginLog().logError( message, e);
+ String entity = getXModelObject().getModelEntity().getName();
+ IFormData formData = formLayoutData.getFormData(entity);
+ if(formData == null) {
+ String message = "Cannot find form for entity " + entity + ".";
+ ModelUIPlugin.getPluginLog().logError(message);
+ } else if(formData.getForms() != null) {
+ form = new FormContainer(formData);
+ } else {
+ form = new DefaultFormContainer(new Form(formData));
}
return form;
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/LayoutDataFactory.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/LayoutDataFactory.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/LayoutDataFactory.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -38,6 +38,6 @@
} else if(type == AttributeControlType.EDITOR) {
return new GridData(GridData.FILL_HORIZONTAL);
}
- throw new RuntimeException("Attribute control type may be only Label or Editor but this is " + type);
+ throw new FormRuntimeException("Attribute control type may be only Label or Editor but this is " + type);
}
}
\ No newline at end of file
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/navigator/FilteredTreeContentProvider.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/navigator/FilteredTreeContentProvider.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/navigator/FilteredTreeContentProvider.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -10,8 +10,12 @@
******************************************************************************/
package org.jboss.tools.common.model.ui.navigator;
-import org.eclipse.jface.viewers.*;
-import org.jboss.tools.common.model.*;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+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.ui.ModelUIPlugin;
public class FilteredTreeContentProvider implements ITreeContentProvider {
@@ -42,8 +46,12 @@
String classname = model.getMetaData().getMapping("FilteredTrees").getValue(filteredTreeName);
result = (XFilteredTree)getClass().getClassLoader().loadClass(classname).newInstance();
result.setModel(model);
- } catch(Exception ex) {
- ModelUIPlugin.getPluginLog().logError(ex);
+ } catch (InstantiationException e) {
+ ModelUIPlugin.getPluginLog().logError(e);
+ } catch (IllegalAccessException e) {
+ ModelUIPlugin.getPluginLog().logError(e);
+ } catch (ClassNotFoundException e) {
+ ModelUIPlugin.getPluginLog().logError(e);
}
}
return result;
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/navigator/TreeViewerModelListenerImpl.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/navigator/TreeViewerModelListenerImpl.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/navigator/TreeViewerModelListenerImpl.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -10,12 +10,17 @@
******************************************************************************/
package org.jboss.tools.common.model.ui.navigator;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.jface.viewers.*;
-import org.jboss.tools.common.model.*;
-import org.jboss.tools.common.model.ui.ModelUIPlugin;
-import org.jboss.tools.common.model.util.*;
-import org.jboss.tools.common.model.event.*;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.widgets.Control;
+import org.jboss.tools.common.model.XModel;
+import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.model.event.XModelTreeEvent;
+import org.jboss.tools.common.model.event.XModelTreeListener;
+import org.jboss.tools.common.model.util.XModelObjectCache;
public class TreeViewerModelListenerImpl implements XModelTreeListener {
protected TreeViewer viewer;
@@ -61,26 +66,17 @@
XModelObject r = getRoot();
if(root != r) {
root = r;
- try { viewer.refresh(); } catch (Exception e) { /* ignore */}
+ viewer.refresh();
return;
}
XModelObject selected = getSelectedObject();
XModelObject refreshObject = event.getModelObject();
if(refreshObject != null) {
- try {
- if(isFileParent(refreshObject, r)) {
- viewer.refresh(r);
- } else {
- viewer.refresh(refreshObject);
- }
- } catch (Exception e) {
- if(reportRefreshProblemCount == 0) {
- reportRefreshProblemCount = 1;
- String message = "Cannot refresh tree for " + refreshObject.getPresentationString();
- ModelUIPlugin.getPluginLog().logError( message, e);
- }
- return;
- }
+ if(isFileParent(refreshObject, r)) {
+ viewer.refresh(r);
+ } else {
+ viewer.refresh(refreshObject);
+ }
}
if(event.kind() == XModelTreeEvent.CHILD_ADDED) {
// XModelObject c = (XModelObject)event.getInfo();
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 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/objecteditor/ExtendedPropertiesWizard.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -12,12 +12,14 @@
import java.util.Properties;
-import org.jboss.tools.common.model.ui.ModelUIPlugin;
-import org.jboss.tools.common.model.ui.wizards.query.*;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
import org.jboss.tools.common.model.options.PreferenceModelUtilities;
+import org.jboss.tools.common.model.ui.wizards.query.AbstractQueryWizard;
+import org.jboss.tools.common.model.ui.wizards.query.AbstractQueryWizardView;
public class ExtendedPropertiesWizard extends AbstractQueryWizard {
@@ -50,18 +52,14 @@
public void setObject(Object data) {
super.setObject(data);
- try {
- Properties p = findProperties(data);
- ExtendedProperties attributes = (ExtendedProperties)p.get("extendedProperties");
- objectEditor.setExtendedProperties(attributes);
- boolean viewMode = p != null && "true".equals(p.getProperty("viewMode"));
- objectEditor.setReadOnly(viewMode);
- setWindowTitle("Attributes");
- String nodeName = attributes.getNodeName();
- setTitle((nodeName != null) ? "<" + nodeName + ">" : "");
- } catch (Exception e) {
- ModelUIPlugin.getPluginLog().logError(e);
- }
+ Properties p = findProperties(data);
+ ExtendedProperties attributes = (ExtendedProperties)p.get("extendedProperties");
+ objectEditor.setExtendedProperties(attributes);
+ boolean viewMode = p != null && "true".equals(p.getProperty("viewMode"));
+ objectEditor.setReadOnly(viewMode);
+ setWindowTitle("Attributes");
+ String nodeName = attributes.getNodeName();
+ setTitle((nodeName != null) ? "<" + nodeName + ">" : "");
}
public Control createControl(Composite parent) {
@@ -78,11 +76,7 @@
}
public void stopEditing() {
- try {
- if(objectEditor != null) objectEditor.stopEditing();
- } catch (Exception e) {
- ModelUIPlugin.getPluginLog().logError(e);
- }
+ if(objectEditor != null) objectEditor.stopEditing();
}
public void dispose() {
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/objecteditor/PropertiesWizard.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/objecteditor/PropertiesWizard.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/objecteditor/PropertiesWizard.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -12,17 +12,15 @@
import java.util.Properties;
-import org.jboss.tools.common.meta.key.WizardKeys;
-import org.jboss.tools.common.model.ui.ModelUIPlugin;
-import org.jboss.tools.common.model.ui.wizards.query.AbstractQueryWizard;
-import org.jboss.tools.common.model.ui.wizards.query.AbstractQueryWizardView;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
-
+import org.jboss.tools.common.meta.key.WizardKeys;
import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.model.ui.wizards.query.AbstractQueryWizard;
+import org.jboss.tools.common.model.ui.wizards.query.AbstractQueryWizardView;
public class PropertiesWizard extends AbstractQueryWizard {
@@ -52,17 +50,13 @@
//this.setMessage(WizardKeys.getString(getHelpKey()+".Message"));
Object[] ds = (Object[])data;
dataObject = ds[0];
- try {
- objectEditor.setModelObject((XModelObject)dataObject);
- Properties p = findProperties(data);
- if(windowTitle == null) {
- windowTitle = WizardKeys.getHeader("Properties");
- }
- boolean viewMode = p != null && "true".equals(p.getProperty("viewMode"));
- objectEditor.setViewMode(viewMode);
- } catch (Exception e) {
- ModelUIPlugin.getPluginLog().logError(e);
+ objectEditor.setModelObject((XModelObject)dataObject);
+ Properties p = findProperties(data);
+ if(windowTitle == null) {
+ windowTitle = WizardKeys.getHeader("Properties");
}
+ boolean viewMode = p != null && "true".equals(p.getProperty("viewMode"));
+ objectEditor.setViewMode(viewMode);
}
public Control createControl(Composite parent) {
@@ -80,11 +74,7 @@
}
public void stopEditing() {
- try {
- if(objectEditor != null) objectEditor.stopEditing();
- } catch (Exception e) {
- ModelUIPlugin.getPluginLog().logError(e);
- }
+ if(objectEditor != null) objectEditor.stopEditing();
}
public void dispose() {
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/objecteditor/XChildrenEditor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/objecteditor/XChildrenEditor.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/objecteditor/XChildrenEditor.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -13,25 +13,28 @@
import java.util.Properties;
import java.util.Set;
-import org.jboss.tools.common.editor.AbstractSelectionProvider;
-import org.jboss.tools.common.model.ui.ModelUIPlugin;
-import org.jboss.tools.common.model.ui.action.CommandBar;
-import org.jboss.tools.common.model.ui.action.CommandBarListener;
-import org.jboss.tools.common.model.ui.dnd.*;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.GC;
-import org.jboss.tools.common.model.ui.swt.util.BorderLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Widget;
-
+import org.jboss.tools.common.editor.AbstractSelectionProvider;
import org.jboss.tools.common.meta.action.XActionInvoker;
import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.model.ui.action.CommandBar;
+import org.jboss.tools.common.model.ui.action.CommandBarListener;
+import org.jboss.tools.common.model.ui.dnd.ControlDragDrop;
+import org.jboss.tools.common.model.ui.dnd.IControlDragDropProvider;
+import org.jboss.tools.common.model.ui.dnd.IControlDropListener;
+import org.jboss.tools.common.model.ui.swt.util.BorderLayout;
import org.jboss.tools.common.model.util.AbstractTableHelper;
public class XChildrenEditor implements CommandBarListener {
@@ -266,15 +269,11 @@
}
public void callAction(XModelObject o, String path) {
- try {
- Properties p = new Properties();
- p.put("shell", bar.getControl().getShell());
- int i = xtable.getSelectionIndex();
- p.put("insertAfter", Integer.valueOf(i));
- XActionInvoker.invoke(path, o, getTargets(), p);
- } catch (Exception e) {
- ModelUIPlugin.getPluginLog().logError(e);
- }
+ Properties p = new Properties();
+ p.put("shell", bar.getControl().getShell());
+ int i = xtable.getSelectionIndex();
+ p.put("insertAfter", Integer.valueOf(i));
+ XActionInvoker.invoke(path, o, getTargets(), p);
}
private XModelObject[] getTargets() {
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/outline/XModelObjectContentProvider.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/outline/XModelObjectContentProvider.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/outline/XModelObjectContentProvider.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -10,15 +10,15 @@
******************************************************************************/
package org.jboss.tools.common.model.ui.outline;
-import java.util.*;
+import java.util.ArrayList;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.ui.model.WorkbenchContentProvider;
-import org.jboss.tools.common.model.*;
-import org.jboss.tools.common.model.ui.ModelUIPlugin;
-import org.jboss.tools.common.model.util.*;
+import org.jboss.tools.common.model.XFilteredTreeConstraint;
+import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.model.util.XModelObjectCache;
public class XModelObjectContentProvider extends WorkbenchContentProvider {
XFilteredTreeConstraint[] filters = null;
@@ -29,13 +29,9 @@
if(isEqualObject(cache)) return;
this.cache = cache;
if(viewer != null) {
- try {
- viewer.refresh();
- ((TreeViewer)viewer).expandToLevel(2);
- if(cache != null) viewer.setSelection(new StructuredSelection(cache.getObject()));
- } catch (Exception e) {
- ModelUIPlugin.getPluginLog().logError(e);
- }
+ viewer.refresh();
+ ((TreeViewer)viewer).expandToLevel(2);
+ if(cache != null) viewer.setSelection(new StructuredSelection(cache.getObject()));
}
}
@@ -107,13 +103,9 @@
((TreeViewer)viewer).setAutoExpandLevel(2);
}
if(viewer == null || viewer.getControl() == null || viewer.getControl().isDisposed()) return;
- try {
- viewer.refresh();
- if(viewer.getSelection() == null || viewer.getSelection().isEmpty()) {
- if(cache != null) viewer.setSelection(new StructuredSelection(cache.getObject()));
- }
- } catch (Exception t) {
- ModelUIPlugin.getPluginLog().logError(t);
+ viewer.refresh();
+ if(viewer.getSelection() == null || viewer.getSelection().isEmpty()) {
+ if(cache != null) viewer.setSelection(new StructuredSelection(cache.getObject()));
}
}
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/reporting/ProblemReporter.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/reporting/ProblemReporter.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/reporting/ProblemReporter.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -13,16 +13,15 @@
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintStream;
+
import org.eclipse.core.runtime.IStatus;
-import org.jboss.tools.common.model.ui.ModelUIPlugin;
-import org.jboss.tools.common.model.ui.dialog.ErrorDialog;
import org.eclipse.swt.SWTError;
import org.eclipse.swt.SWTException;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.jboss.tools.common.model.plugin.ModelPlugin;
+import org.jboss.tools.common.model.ui.dialog.ErrorDialog;
import org.jboss.tools.common.reporting.IProblemReporter;
-import org.jboss.tools.common.reporting.ProblemReportingHelper;
public class ProblemReporter implements IProblemReporter {
static int DO_NOTNING_ACTION = 0;
@@ -44,31 +43,6 @@
showProblemDialog(status);
}
}
-
- /**
- *
- class R implements Runnable {
- IStatus status;
- R(IStatus status) {
- this.status = status;
- }
- public void run() {
- int action = ADD_TO_BUFFER_ACTION;
- if(isShowProblemDialogOn() && Display.getDefault()!=null) {
- action = showProblemDialog(status);
- } else if(isSubmitProblemAutomaticallyOn()) {
- action = REPORT_ACTION;
- }
- if(action == REPORT_ACTION) {
- String email = ReportPreference.E_MAIL_OPTION.getValue();
- String other = ReportPreference.OTHER_OPTION.getValue();
- ProblemReportingHelper.buffer.report(throwableToString(status.getMessage(), status.getException()), email, other, false);
- } else if(action == ADD_TO_BUFFER_ACTION) {
- ProblemReportingHelper.buffer.writeToBuffer(status);
- }
- }
- }
- */
private boolean isShowProblemDialogOn() {
return "yes".equals(ReportPreference.SHOW_ERROR_DIALOG_OPTION.getValue());
@@ -80,12 +54,7 @@
private int showProblemDialog(IStatus status) {
Shell shell = null;
- try {
- shell = ModelPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getShell();
- } catch (Exception e) {
- //we cannot call reporting service here!
- ModelUIPlugin.getPluginLog().logError(e);
- }
+ shell = ModelPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getShell();
return ErrorDialog.openError(shell, "Error", status.getMessage(), status.getException());
}
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/reporting/ReportProblemWizard.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/reporting/ReportProblemWizard.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/reporting/ReportProblemWizard.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -21,6 +21,7 @@
import java.io.StringWriter;
import java.text.Collator;
import java.text.DateFormat;
+import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Comparator;
@@ -276,7 +277,7 @@
lastOldSession = new String(t);
isAccept = false;
}
- }catch(Exception ex){
+ }catch(ParseException ex){
//ModelUIPlugin.getPluginLog().logError(ex);
sb.append(t);
isAccept = true;
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/resources/ResourceLayoutManager.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/resources/ResourceLayoutManager.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/resources/ResourceLayoutManager.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -29,17 +29,15 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.QualifiedName;
-import org.eclipse.core.runtime.Status;
+import org.jboss.tools.common.model.ui.ModelUIMessages;
+import org.jboss.tools.common.model.ui.ModelUIPlugin;
+import org.jboss.tools.common.xml.SafeDocumentBuilderFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
-import org.jboss.tools.common.xml.SafeDocumentBuilderFactory;
-import org.jboss.tools.common.model.ui.ModelUIPlugin;
-import org.jboss.tools.common.model.ui.ModelUIMessages;
-
/**
* @author AU
*/
@@ -237,7 +235,7 @@
serial.asDOMSerializer();
serial.serialize(document);
writer.close();
- } catch (Exception e) {
+ } catch (IOException e) {
//log(Status.ERROR, ModelUIMessages.getString(ERROR_CREATE_DOCUMENT, new String[] {fullLayoutLocation, fullResourceLocation}), e);
ModelUIPlugin.getPluginLog().logError(ModelUIMessages.getString(ERROR_CREATE_DOCUMENT, new String[] {layoutLocation, fullResourceLocation}), e);
}
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/select/SelectObjectWizard.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/select/SelectObjectWizard.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/select/SelectObjectWizard.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -55,20 +55,12 @@
oe.selectPageByName(preferredPage);
}
}
- try {
- p.getSite().getSelectionProvider().setSelection(getSelection((XModelObject)object));
- } catch (Exception e) {
- // we cannot avoid exception if third party editor is used
- }
+ p.getSite().getSelectionProvider().setSelection(getSelection((XModelObject)object));
IWorkbenchPage page = ModelUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage();
IViewPart vs = page.findView("org.eclipse.ui.views.ContentOutline");
ISelectionProvider sp = vs == null ? null : vs.getSite().getSelectionProvider();
if(sp != null) {
- try {
sp.setSelection(getSelection(object));
- } catch (Exception e) {
- // we cannot avoid exception if third party outline is used
- }
}
}
});
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/select/XModelObjectSelectionProvider.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/select/XModelObjectSelectionProvider.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/select/XModelObjectSelectionProvider.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -10,13 +10,21 @@
******************************************************************************/
package org.jboss.tools.common.model.ui.select;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jface.viewers.*;
-import org.jboss.tools.common.model.*;
-import org.jboss.tools.common.model.ui.ModelUIPlugin;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.jboss.tools.common.model.XModelObject;
public class XModelObjectSelectionProvider implements ISelectionProvider, ISelectionChangedListener {
private List<ISelectionChangedListener> listeners;
@@ -64,13 +72,7 @@
}
public ISelection getSelection() {
- try {
- return (host == null) ? null : convertSelectionToAdapter(host.getSelection());
- } catch (Exception e) {
- //TODO study possible problems and narrow caught exceptions.
- ModelUIPlugin.getPluginLog().logError(e);
- return null;
- }
+ return (host == null) ? null : convertSelectionToAdapter(host.getSelection());
}
public void removeSelectionChangedListener(ISelectionChangedListener listener) {
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/templates/TemplatesConfiguration.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/templates/TemplatesConfiguration.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/templates/TemplatesConfiguration.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -49,16 +49,12 @@
}
}
public void customizeDocumentCommand(IDocument d, DocumentCommand c) {
- try {
- if (c instanceof DocumentCommand) {
- DocumentCommand structuredDocumentCommand = (DocumentCommand)c;
- if (structuredDocumentCommand.length == 0 && structuredDocumentCommand.text != null && TextUtilities.endsWith(d.getLegalLineDelimiters(), structuredDocumentCommand.text) != -1) {
- _autoIndentAfterNewLine(d, structuredDocumentCommand);
- return;
- }
+ if (c instanceof DocumentCommand) {
+ DocumentCommand structuredDocumentCommand = (DocumentCommand)c;
+ if (structuredDocumentCommand.length == 0 && structuredDocumentCommand.text != null && TextUtilities.endsWith(d.getLegalLineDelimiters(), structuredDocumentCommand.text) != -1) {
+ _autoIndentAfterNewLine(d, structuredDocumentCommand);
+ return;
}
- } catch (Exception x) {
- ModelUIPlugin.getPluginLog().logError("Error in customizing document command", x);
}
super.customizeDocumentCommand(d, c);
}
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 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/templates/configuration/MetaClassTemplateHelper.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -56,8 +56,8 @@
QualifiedName qn = new QualifiedName(ModelUIPlugin.ID_PLUGIN, ModelUIPlugin.PROJECT_OVERRIDE);
try {
String projectOverride = ResourcesPlugin.getWorkspace().getRoot().getPersistentProperty(qn);
- return projectOverride != null && Boolean.valueOf(projectOverride).booleanValue();
- } catch (Exception e) {
+ return projectOverride != null && Boolean.parseBoolean(projectOverride);
+ } catch (CoreException e) {
return false;
}
}
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/templates/configuration/MetaConfigurationLoader.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/templates/configuration/MetaConfigurationLoader.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/templates/configuration/MetaConfigurationLoader.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -29,7 +29,7 @@
try {
String path = FileLocator.resolve(MetaConfigurationLoader.class.getResource("/dtds/meta-templates.dtd")).toString();
XMLEntityResolver.registerPublicEntity("-//Red Hat Inc.//DTD Meta Templates 1.0//EN", path);
- } catch (Exception e) {
+ } catch (IOException e) {
ModelUIPlugin.getPluginLog().logError(e);
}
}
@@ -62,7 +62,7 @@
StringWriter writer = new StringWriter();
try {
XMLUtilities.serialize(element, writer);
- } catch (Exception e) {
+ } catch (IOException e) {
ModelUIPlugin.getPluginLog().logError(e);
}
ModelUIPlugin.getDefault().getPluginPreferences().setValue(PREFERENCE_KEY, writer.toString());
@@ -82,7 +82,7 @@
saveConfiguration(c, element);
try {
XMLUtilities.serialize(element, location);
- } catch (Exception e) {
+ } catch (IOException e) {
ModelUIPlugin.getPluginLog().logError(e);
}
}
@@ -139,7 +139,7 @@
Bundle bundle = Platform.getBundle(name);
try {
url = FileLocator.resolve(bundle.getEntry("/"));
- } catch (Exception e) {
+ } catch (IOException e) {
ModelUIPlugin.getPluginLog().logError(e);
}
String file = element.getAttribute(FILE);
@@ -184,18 +184,14 @@
if(!file.isFile()) return null;
try {
return XMLUtilities.getDocument(new FileReader(file), createResolver());
- } catch (Exception e) {
+ } catch (FileNotFoundException e) {
return null;
}
}
Document getDocument(String text) {
if(text == null) return null;
- try {
- return XMLUtilities.getDocument(new StringReader (text), createResolver());
- } catch (Exception e) {
- return null;
- }
+ return XMLUtilities.getDocument(new StringReader (text), createResolver());
}
XMLEntityResolver createResolver() {
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/util/ExtensionPointUtils.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/util/ExtensionPointUtils.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/util/ExtensionPointUtils.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.common.model.ui.util;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.Platform;
import org.eclipse.ui.IImportWizard;
import org.eclipse.ui.INewWizard;
@@ -23,7 +24,7 @@
Platform.getBundle(pluginId);
try {
return (INewWizard)ExtensionPointUtil.findClassByElementId("org.eclipse.ui.newWizards", wizardId);
- } catch (Exception ex) {
+ } catch (CoreException ex) {
ModelUIPlugin.getPluginLog().logError(ex);
}
return null;
@@ -33,7 +34,7 @@
Platform.getBundle(pluginId);
try {
return (IImportWizard)ExtensionPointUtil.findClassByElementId("org.eclipse.ui.importWizards", wizardId);
- } catch (Exception ex) {
+ } catch (CoreException ex) {
ModelUIPlugin.getPluginLog().logError(ex);
}
return null;
@@ -44,7 +45,7 @@
Platform.getBundle(pluginId);
try {
return (IObjectActionDelegate)ExtensionPointUtil.findClassByElementId("org.eclipse.ui.popupMenus", actionId);
- } catch (Exception ex) {
+ } catch (CoreException ex) {
ModelUIPlugin.getPluginLog().logError(ex);
}
return null;
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/views/navigator/NavigatorContentProvider.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/views/navigator/NavigatorContentProvider.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/views/navigator/NavigatorContentProvider.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -24,22 +24,20 @@
import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRoot;
-import org.jboss.tools.common.model.util.XModelTreeListenerSWTASync;
-import org.jboss.tools.common.model.ui.navigator.TreeViewerModelListenerImpl;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeItem;
-
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.filesystems.FileSystemsHelper;
import org.jboss.tools.common.model.project.IModelNature;
+import org.jboss.tools.common.model.ui.navigator.TreeViewerModelListenerImpl;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
-import org.jboss.tools.common.model.ui.ModelUIPlugin;
+import org.jboss.tools.common.model.util.XModelTreeListenerSWTASync;
public class NavigatorContentProvider implements ITreeContentProvider, IResourceChangeListener {
protected FilteredTreesCache filteredTrees = FilteredTreesCache.getInstance();
@@ -263,13 +261,8 @@
if(project == null || !project.isOpen()) return null;
IModelNature nature = EclipseResourceUtil.getModelNature(project);
if(nature == null) return null;
- try {
- XFilteredTree filteredTree = getFilteredTree(nature.getModel().getRoot());
- return (filteredTree != null) ? filteredTree.getRoot() : null;
- } catch (Exception ex) {
- ModelUIPlugin.getPluginLog().logError(ex);
- }
- return null;
+ XFilteredTree filteredTree = getFilteredTree(nature.getModel().getRoot());
+ return (filteredTree != null) ? filteredTree.getRoot() : null;
}
private void check() {
@@ -278,35 +271,25 @@
if(swtTree == null || swtTree.isDisposed()) return;
TreeItem[] is = swtTree.getItems();
if(is == null || is.length == 0) return;
- try {
- for (int i = 0; i < is.length; i++) {
- XModelObject o = (XModelObject)is[i].getData();
- if(o == null) continue;
- IProject p = EclipseResourceUtil.getProject(o);
- IModelNature nature = EclipseResourceUtil.getModelNature(p);
- if(nature == null) {
+ for (int i = 0; i < is.length; i++) {
+ XModelObject o = (XModelObject)is[i].getData();
+ if(o == null) continue;
+ IProject p = EclipseResourceUtil.getProject(o);
+ IModelNature nature = EclipseResourceUtil.getModelNature(p);
+ if(nature == null) {
+ o.getModel().removeModelTreeListener(syncListener);
+ viewer.remove(o);
+ projects.remove(p.getLocation().toString());
+ } else {
+ String classname = o.getModel().getMetaData().getMapping("FilteredTrees").getValue(getFilteredTreeName(o.getModel()));
+ XFilteredTree tree = getFilteredTree(o.getModel().getRoot());
+ if(tree != null && !tree.getClass().getName().equals(classname)) {
o.getModel().removeModelTreeListener(syncListener);
- viewer.remove(o);
projects.remove(p.getLocation().toString());
- } else {
- String classname = o.getModel().getMetaData().getMapping("FilteredTrees").getValue(getFilteredTreeName(o.getModel()));
- XFilteredTree tree = getFilteredTree(o.getModel().getRoot());
- if(tree != null && !tree.getClass().getName().equals(classname)) {
- o.getModel().removeModelTreeListener(syncListener);
- projects.remove(p.getLocation().toString());
-// filteredTrees.remove(tree);
- viewer.remove(o);
- viewer.refresh();
- }
+ viewer.remove(o);
+ viewer.refresh();
}
}
- } catch (Exception e) {
- //ModelUIPlugin.log("NavigatorContentProvider:check");
- try {
- viewer.refresh();
- } catch (Exception e2) {
- //ignore
- }
}
}
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/views/navigator/NavigatorMenuInvoker.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/views/navigator/NavigatorMenuInvoker.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/views/navigator/NavigatorMenuInvoker.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -11,20 +11,19 @@
package org.jboss.tools.common.model.ui.views.navigator;
import java.util.Properties;
-import org.eclipse.swt.events.*;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.preferences.IScopeContext;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.graphics.Point;
import org.jboss.tools.common.meta.action.XActionInvoker;
import org.jboss.tools.common.model.XModel;
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.options.PreferenceModelUtilities;
+import org.jboss.tools.common.model.ui.navigator.TreeViewerMenuInvoker;
import org.jboss.tools.common.model.util.FindObjectHelper;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.preferences.IScopeContext;
-import org.eclipse.core.runtime.preferences.InstanceScope;
-import org.jboss.tools.common.model.ui.ModelUIPlugin;
-import org.jboss.tools.common.model.ui.navigator.*;
-
public class NavigatorMenuInvoker extends TreeViewerMenuInvoker {
private static XModelObject eclipseWorkspace = null;
@@ -62,12 +61,7 @@
}
private boolean isOpenOnSingleClick() {
- try {
- return Platform.getPreferencesService().getBoolean("org.eclipse.ui.workbench", "OPEN_ON_SINGLE_CLICK", true, new IScopeContext[]{new InstanceScope()});
- } catch (Exception e) {
- ModelUIPlugin.getPluginLog().logError(e);
- return false;
- }
+ return Platform.getPreferencesService().getBoolean("org.eclipse.ui.workbench", "OPEN_ON_SINGLE_CLICK", true, new IScopeContext[]{new InstanceScope()});
}
protected void fillRunningProperties(Properties p) {
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/views/navigator/NavigatorViewPart.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/views/navigator/NavigatorViewPart.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/views/navigator/NavigatorViewPart.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -132,11 +132,7 @@
dnd.enable();
initContextMenu();
- try {
- activateF3();
- } catch (Exception e) {
- //ignore
- }
+ activateF3();
getSite().getPage().addPartListener(partListener);
@@ -166,11 +162,7 @@
}
private IAction createActionInstance(String name) {
- try {
- return (IAction)ModelFeatureFactory.getInstance().createFeatureInstance(name);
- } catch (Exception exc) {
- return null;
- }
+ return (IAction)ModelFeatureFactory.getInstance().createFeatureInstance(name);
}
protected String[] getActionClasses() {
@@ -372,24 +364,16 @@
}
public void saveState(IMemento _memento) {
- try {
- XModelObject o = getSelectedModelObject();
- if(o != null) _memento.putString("selection", getNodePath(o));
- saveLinkingEnabled(_memento);
- } catch (Exception exc) {
- //ignore
- }
+ XModelObject o = getSelectedModelObject();
+ if(o != null) _memento.putString("selection", getNodePath(o));
+ saveLinkingEnabled(_memento);
}
public void restoreState(IMemento _memento) {
- try {
- String selection = _memento.getString("selection");
- XModelObject o = findModelObject(selection);
- if(o != null) viewer.setSelection(new StructuredSelection(o));
- restoreLinkingEnabled();
- } catch (Exception exc) {
- //ignore
- }
+ String selection = _memento.getString("selection");
+ XModelObject o = findModelObject(selection);
+ if(o != null) viewer.setSelection(new StructuredSelection(o));
+ restoreLinkingEnabled();
}
private String getNodePath(XModelObject o) {
@@ -638,11 +622,7 @@
if(isHandlingActivation) return;
isHandlingActivation = true;
IProject[] ps = null;
- try {
- ps = ModelUIPlugin.getWorkspace().getRoot().getProjects();
- } catch (Exception e) {
- //Workspace has been closed. There is no other way to know it.
- }
+ ps = ModelUIPlugin.getWorkspace().getRoot().getProjects();
if(ps == null) return;
for (int i = 0; i < ps.length; i++) {
IModelNature n = EclipseResourceUtil.getModelNature(ps[i]);
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/widgets/TextAndReferenceComponent.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/widgets/TextAndReferenceComponent.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/widgets/TextAndReferenceComponent.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -11,11 +11,22 @@
package org.jboss.tools.common.model.ui.widgets;
import java.util.ArrayList;
+
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.jboss.tools.common.model.ui.ModelUIPlugin;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseMoveListener;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.graphics.Cursor;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
public class TextAndReferenceComponent extends Canvas implements PaintListener, MouseMoveListener {
int defaultWidth = 100;
@@ -34,13 +45,9 @@
addPaintListener(this);
addMouseMoveListener(this);
addMouseListener(new MA());
- try {
- plain = getFont();
- FontData d = plain.getFontData()[0];
- bold = new Font(null, d.getName(), d.getHeight(), d.getStyle() | SWT.BOLD);
- } catch (Exception e) {
- ModelUIPlugin.getPluginLog().logError(e);
- }
+ plain = getFont();
+ FontData d = plain.getFontData()[0];
+ bold = new Font(null, d.getName(), d.getHeight(), d.getStyle() | SWT.BOLD);
}
public void mouseMove(MouseEvent e) {
@@ -84,11 +91,7 @@
defaultWidth = width;
this.width = width;
tokens = Tokenizer.tokenize(text, plain, bold);
- try {
- pack();
- } catch (Exception e) {
- ModelUIPlugin.getPluginLog().logError(e);
- }
+ pack();
}
public void paintControl(PaintEvent ev) {
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/wizard/newfile/NewFileContext.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/wizard/newfile/NewFileContext.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/wizard/newfile/NewFileContext.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -10,17 +10,20 @@
******************************************************************************/
package org.jboss.tools.common.model.ui.wizard.newfile;
-import java.util.*;
-import org.eclipse.core.resources.*;
+import java.util.Properties;
+
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IAdaptable;
-import org.jboss.tools.common.model.ui.util.ModelUtilities;
import org.eclipse.jface.viewers.IStructuredSelection;
-
-import org.jboss.tools.common.meta.action.*;
+import org.jboss.tools.common.meta.action.XAction;
+import org.jboss.tools.common.meta.action.XActionList;
import org.jboss.tools.common.meta.action.impl.SpecialWizardSupport;
import org.jboss.tools.common.meta.key.WizardKeys;
-import org.jboss.tools.common.model.*;
+import org.jboss.tools.common.model.XModel;
+import org.jboss.tools.common.model.XModelException;
+import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.filesystems.impl.FolderImpl;
+import org.jboss.tools.common.model.ui.util.ModelUtilities;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
public class NewFileContext {
@@ -67,13 +70,8 @@
errorMesage = "Project is closed";
return;
}
- try {
- if(EclipseResourceUtil.getModelNature(resource.getProject()) == null)
- errorMesage = "Add Struts Nature to project";
- } catch (Exception e) {
- errorMesage = e.getMessage();
- return;
- }
+ if(EclipseResourceUtil.getModelNature(resource.getProject()) == null)
+ errorMesage = "Add Struts Nature to project";
folder = EclipseResourceUtil.getObjectByResource(resource);
if(folder != null) {
@@ -102,7 +100,7 @@
return support.getValidator(0).getErrorMessage();
}
- public void execute() throws Exception {
+ public void execute() throws XModelException {
Properties p = new Properties();
if(resource != null) p.put("resource", resource);
action.executeHandler(support.getTarget(), p);
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/wizard/newfile/NewFileWizard.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/wizard/newfile/NewFileWizard.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/wizard/newfile/NewFileWizard.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -13,6 +13,7 @@
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.*;
import org.eclipse.ui.*;
+import org.jboss.tools.common.model.XModelException;
import org.jboss.tools.common.model.ui.ModelUIImages;
import org.jboss.tools.common.model.ui.ModelUIPlugin;
@@ -39,7 +40,7 @@
public boolean performFinish() {
try {
context.execute();
- } catch (Exception e) {
+ } catch (XModelException e) {
ModelUIPlugin.getPluginLog().logError(e);
return false;
}
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/wizards/NewClassWizard.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/wizards/NewClassWizard.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/wizards/NewClassWizard.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -94,9 +94,6 @@
return false;
} catch (InterruptedException e) {
return false;
- } catch (Exception e) {
- ModelUIPlugin.getPluginLog().logError(e);
- return false;
}
return true;
}
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/wizards/query/AbstractQueryWizardView.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/wizards/query/AbstractQueryWizardView.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/wizards/query/AbstractQueryWizardView.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -97,18 +97,12 @@
if(CANCEL.equals(command)) {
code = 1;
dispose();
- }
- else if(OK.equalsIgnoreCase(command)) {
+ } else if(OK.equalsIgnoreCase(command)) {
code = 0;
dispose();
+ } else if(HELP.equals(command)) {
+ HelpUtil.helpEclipse(model, helpkey);
}
- else if(HELP.equals(command)) {
- if(model != null) try {
- HelpUtil.helpEclipse(model, helpkey);
- } catch (Exception e) {
- ModelUIPlugin.getPluginLog().logError(e);
- }
- }
}
public int code() {
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 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/wizards/special/DefaultSpecialWizard.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -11,6 +11,8 @@
package org.jboss.tools.common.model.ui.wizards.special;
import java.util.Properties;
+
+import org.jboss.tools.common.model.XModelException;
import org.jboss.tools.common.model.ui.action.CommandBar;
import org.jboss.tools.common.model.ui.wizards.standard.DefaultStandardWizard;
import org.eclipse.jface.dialogs.IMessageProvider;
@@ -79,7 +81,7 @@
setStep();
try {
support.action("STEP");
- } catch (Exception e) {
+ } catch (XModelException e) {
ModelUIPlugin.getPluginLog().logError(e);
}
dialog.open();
@@ -91,18 +93,14 @@
CommandBar bar = dialog.getCommandBar();
bar.disable();
if(SpecialWizardSupport.HELP.equals(name)) {
- try {
- HelpUtil.helpEclipse(support.getTarget().getModel(), support.getHelpKey());
- } catch (Exception e) {
- ModelUIPlugin.getPluginLog().logError(e);
- }
+ HelpUtil.helpEclipse(support.getTarget().getModel(), support.getHelpKey());
return;
}
try {
save();
support.action(name);
dialog.setMessage("");
- } catch (Exception e) {
+ } catch (XModelException e) {
ModelUIPlugin.getPluginLog().logError(e);
}
setStep();
@@ -132,11 +130,7 @@
dialog.getShell().setText(support.getTitle());
dialog.setTitle(support.getSubtitle());
if(message != null) dialog.setMessage(message);
- try {
- wizardStep.validate();
- } catch (Exception e) {
- ModelUIPlugin.getPluginLog().logError(e);
- }
+ wizardStep.validate();
}
private ISpecialWizardStep getStep(int i) {
@@ -162,11 +156,7 @@
public void dispose() {
stopValidator();
if(dialog == null) return;
- try {
- if(dialog.getShell() != null && !dialog.getShell().isDisposed()) dialog.close();
- } catch (Exception e) {
- ModelUIPlugin.getPluginLog().logError(e);
- }
+ if(dialog.getShell() != null && !dialog.getShell().isDisposed()) dialog.close();
dialog = null;
}
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/wizards/standard/DefaultStandardStep.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/wizards/standard/DefaultStandardStep.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/wizards/standard/DefaultStandardStep.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -10,17 +10,19 @@
******************************************************************************/
package org.jboss.tools.common.model.ui.wizards.standard;
-import java.util.*;
import java.beans.PropertyChangeEvent;
+import java.util.Properties;
-import org.jboss.tools.common.model.ui.ModelUIPlugin;
-import org.jboss.tools.common.model.ui.attribute.XAttributeSupport;
import org.eclipse.jface.preference.FieldEditor;
-import org.eclipse.jface.wizard.*;
-import org.eclipse.swt.widgets.*;
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.widgets.Composite;
import org.jboss.tools.common.meta.action.XAttributeData;
import org.jboss.tools.common.meta.action.impl.SpecialWizardSupport;
import org.jboss.tools.common.meta.action.impl.WizardDataValidator;
+import org.jboss.tools.common.model.XModelException;
+import org.jboss.tools.common.model.ui.ModelUIPlugin;
+import org.jboss.tools.common.model.ui.attribute.XAttributeSupport;
public class DefaultStandardStep extends WizardPage implements java.beans.PropertyChangeListener {
protected DefaultStandardWizard wizard;
@@ -75,7 +77,7 @@
if(support.getStepId() > id) {
try {
support.action(SpecialWizardSupport.BACK);
- } catch (Exception e) {
+ } catch (XModelException e) {
ModelUIPlugin.getPluginLog().logError(e);
}
}
@@ -96,12 +98,8 @@
private void validateAll() {
attributes.store();
- try {
- validate();
- updateFieldEnablement();
- } catch (Exception e) {
- ModelUIPlugin.getPluginLog().logError(e);
- }
+ validate();
+ updateFieldEnablement();
}
public void propertyChange(PropertyChangeEvent arg0) {
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/wizards/standard/DefaultStandardWizard.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/wizards/standard/DefaultStandardWizard.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/wizards/standard/DefaultStandardWizard.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -10,16 +10,17 @@
******************************************************************************/
package org.jboss.tools.common.model.ui.wizards.standard;
-import java.util.*;
+import java.util.Properties;
+
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.PlatformUI;
-
import org.jboss.tools.common.meta.action.XEntityData;
import org.jboss.tools.common.meta.action.impl.SpecialWizardControlListener;
import org.jboss.tools.common.meta.action.impl.SpecialWizardSupport;
import org.jboss.tools.common.meta.action.impl.WizardDataValidator;
+import org.jboss.tools.common.model.XModelException;
import org.jboss.tools.common.model.ui.ModelUIPlugin;
public class DefaultStandardWizard extends Wizard implements SpecialWizardControlListener {
@@ -37,7 +38,7 @@
try {
support.action(SpecialWizardSupport.FINISH);
return support.isFinished();
- } catch (Exception e) {
+ } catch (XModelException e) {
ModelUIPlugin.getPluginLog().logError(e);
}
return false;
@@ -77,7 +78,7 @@
public IWizardPage getNextPage(IWizardPage page) {
try {
support.action(SpecialWizardSupport.NEXT);
- } catch (Exception e) {
+ } catch (XModelException e) {
ModelUIPlugin.getPluginLog().logError(e);
}
int id = support.getStepId();
@@ -138,7 +139,7 @@
step.save();
support.action(name);
- } catch (Exception e) {
+ } catch (XModelException e) {
ModelUIPlugin.getPluginLog().logError(e);
}
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/propertieseditor/BundleEditor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/propertieseditor/BundleEditor.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/propertieseditor/BundleEditor.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -38,12 +38,8 @@
super.dispose();
if(fActivationListener != null && bundleModel != null) {
IWorkbenchWindow window = getSite().getWorkbenchWindow();
- if(window != null) try {
- window.getPartService().removePartListener(fActivationListener);
- window.getShell().removeShellListener(fActivationListener);
- } catch (Exception e) {
- //ignore
- }
+ window.getPartService().removePartListener(fActivationListener);
+ window.getShell().removeShellListener(fActivationListener);
}
fActivationListener = null;
if (childrenEditor!=null) childrenEditor.dispose();
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/propertieseditor/PropertiesCompoundEditor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/propertieseditor/PropertiesCompoundEditor.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/propertieseditor/PropertiesCompoundEditor.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -10,10 +10,13 @@
******************************************************************************/
package org.jboss.tools.common.propertieseditor;
-import org.jboss.tools.common.editor.*;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.ui.PartInitException;
+import org.jboss.tools.common.editor.AbstractSelectionProvider;
+import org.jboss.tools.common.editor.ObjectMultiPageEditor;
+import org.jboss.tools.common.editor.ObjectTextEditor;
import org.jboss.tools.common.model.ui.ModelUIPlugin;
-import org.jboss.tools.common.propertieseditor.text.*;
-import org.eclipse.jface.viewers.ISelectionProvider;
+import org.jboss.tools.common.propertieseditor.text.PropertiesTextEditor;
public class PropertiesCompoundEditor extends ObjectMultiPageEditor {
protected PropertiesEditor propertiesEditor;
@@ -36,7 +39,7 @@
try {
propertiesEditor.init(getEditorSite(), getEditorInput());
index = addPage(propertiesEditor, getEditorInput());
- } catch (Exception e) {
+ } catch (PartInitException e) {
ModelUIPlugin.getPluginLog().logError(e);
return;
}
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/propertieseditor/PropertiesEditor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/propertieseditor/PropertiesEditor.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/propertieseditor/PropertiesEditor.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -10,28 +10,41 @@
******************************************************************************/
package org.jboss.tools.common.propertieseditor;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.*;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.text.ITextOperationTarget;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.IPropertyListener;
+import org.eclipse.ui.IWorkbenchPartSite;
+import org.eclipse.ui.PartInitException;
import org.eclipse.ui.actions.ActionFactory;
-import org.eclipse.ui.texteditor.*;
-
+import org.eclipse.ui.texteditor.IDocumentProvider;
+import org.eclipse.ui.texteditor.ITextEditor;
+import org.eclipse.ui.texteditor.ITextEditorActionConstants;
import org.jboss.tools.common.meta.action.XAction;
import org.jboss.tools.common.meta.action.XActionInvoker;
-import org.jboss.tools.common.model.*;
-import org.jboss.tools.common.model.util.*;
+import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.ui.ModelUIPlugin;
-import org.eclipse.core.runtime.IProgressMonitor;
-//import org.jboss.tools.common.core.jdt.Messages;
-import org.jboss.tools.common.model.ui.action.*;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.ITextOperationTarget;
-import org.eclipse.jface.viewers.*;
-import org.jboss.tools.common.model.ui.objecteditor.*;
+import org.jboss.tools.common.model.ui.action.CommandBar;
+import org.jboss.tools.common.model.ui.action.XMenuInvoker;
+import org.jboss.tools.common.model.ui.objecteditor.XChildrenEditor;
import org.jboss.tools.common.model.ui.texteditors.TextActionHelper;
+import org.jboss.tools.common.model.util.AbstractTableHelper;
public class PropertiesEditor extends XChildrenEditor implements ITextEditor, ITextOperationTarget {
private ArrayList<String> actionMapping = new ArrayList<String>();
@@ -175,12 +188,8 @@
public void removePropertyListener(IPropertyListener listener) {}
public void setFocus() {
- try {
- if(xtable == null || !xtable.isActive()) return;
- xtable.getTable().setFocus();
- } catch(Exception e) {
- //ignore
- }
+ if(xtable == null || !xtable.isActive()) return;
+ xtable.getTable().setFocus();
}
public Object getAdapter(Class adapter) {
@@ -216,7 +225,7 @@
public void doOperation(int operation) {
if (operation>actionMapping.size()) {
- ModelUIPlugin.getPluginLog().logError(new RuntimeException("Can not find global action with index: "+operation));
+ ModelUIPlugin.getPluginLog().logError(new IllegalArgumentException("Can not find global action with index: "+operation));
} else {
String globalAction = (String)actionMapping.get(operation);
doGlobalAction(globalAction);
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 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/propertieseditor/bundlemodel/BundleModel.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -16,7 +16,13 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Properties;
+import java.util.Set;
+import java.util.TreeSet;
+
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
@@ -127,7 +133,7 @@
IResource[] rs = new IResource[0];
try {
rs = main.getParent().members();
- } catch (Exception e) {
+ } catch (CoreException e) {
ModelUIPlugin.getPluginLog().logError(e);
}
for (int i = 0; i < rs.length; i++) {
@@ -264,7 +270,7 @@
try {
if(f.exists()) f.setContents(is, true, true, null);
else f.create(is, true, null);
- } 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/propertieseditor/text/PropertyTextEditorSupport.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/propertieseditor/text/PropertyTextEditorSupport.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/propertieseditor/text/PropertyTextEditorSupport.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -10,11 +10,9 @@
******************************************************************************/
package org.jboss.tools.common.propertieseditor.text;
-import org.jboss.tools.common.model.ui.ModelUIPlugin;
-import org.jboss.tools.common.model.ui.texteditors.TextEditorSupport;
-
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.loaders.impl.PropertiesLoader;
+import org.jboss.tools.common.model.ui.texteditors.TextEditorSupport;
/**
* @author Jeremy
@@ -35,8 +33,6 @@
lock++;
try {
loader.edit(getModelObject(), provider.getText());
- } catch (Exception e) {
- ModelUIPlugin.getPluginLog().logError(e);
} finally {
lock--;
setModified (false);
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/action/AddJSFNatureActionDelegate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/action/AddJSFNatureActionDelegate.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/action/AddJSFNatureActionDelegate.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -22,12 +22,12 @@
public class AddJSFNatureActionDelegate extends AddNatureActionDelegate {
- protected IWizard getWizard(IProject project) throws Exception {
+ protected IWizard getWizard(IProject project) {
ImportProjectWizard wizard = (ImportProjectWizard)ExtensionPointUtils.findImportWizardsItem(
JSFModelPlugin.PLUGIN_ID,
"org.jboss.tools.jsf.ui.wizard.project.ImportProjectWizard"
);
- if (wizard == null) throw new Exception("Wizard org.jboss.tools.common.model.ui.wizards.ImportProjectWizard is not found.");
+ if (wizard == null) throw new IllegalArgumentException("Wizard org.jboss.tools.common.model.ui.wizards.ImportProjectWizard is not found.");
wizard.setInitialName(project.getName());
wizard.setInitialLocation(findWebXML(project.getLocation().toString()));
wizard.init(ModelUIPlugin.getDefault().getWorkbench(), null);
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/ExtendedJSPContentAssistProcessor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/ExtendedJSPContentAssistProcessor.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/ExtendedJSPContentAssistProcessor.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -14,6 +14,7 @@
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
+
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
@@ -24,15 +25,12 @@
import org.eclipse.jst.jsp.core.internal.contentmodel.tld.TLDCMDocumentManager;
import org.eclipse.jst.jsp.core.internal.contentmodel.tld.TaglibTracker;
import org.eclipse.jst.jsp.core.internal.regions.DOMJSPRegionContexts;
-import org.eclipse.jst.jsp.core.text.IJSPPartitions;
import org.eclipse.jst.jsp.ui.internal.JSPUIPlugin;
import org.eclipse.jst.jsp.ui.internal.contentassist.JSPContentAssistProcessor;
import org.eclipse.jst.jsp.ui.internal.preferences.JSPUIPreferenceNames;
-import org.eclipse.jst.jsp.ui.internal.templates.TemplateContextTypeIdsJSP;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.graphics.Image;
import org.eclipse.wst.css.ui.internal.contentassist.CSSContentAssistProcessor;
-import org.eclipse.wst.html.core.text.IHTMLPartitions;
import org.eclipse.wst.javascript.ui.internal.common.contentassist.JavaScriptContentAssistProcessor;
import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
@@ -70,11 +68,6 @@
import org.jboss.tools.common.kb.wtp.TLDVersionHelper;
import org.jboss.tools.common.kb.wtp.WtpKbConnector;
import org.jboss.tools.jst.jsp.JspEditorPlugin;
-import org.jboss.tools.jst.web.project.WebProject;
-import org.jboss.tools.jst.web.tld.TaglibData;
-import org.jboss.tools.jst.web.tld.VpeTaglibListener;
-import org.jboss.tools.jst.web.tld.VpeTaglibManager;
-import org.jboss.tools.jst.web.tld.VpeTaglibManagerProvider;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -215,12 +208,8 @@
try {
wtpKbConnector = (WtpKbConnector)KbConnectorFactory.getIntstance().createConnector(KbConnectorType.JSP_WTP_KB_CONNECTOR, document);
jspActiveCAP.setKbConnector(wtpKbConnector);
- } catch (ClassNotFoundException e) {
+ } catch (KbException e) {
JspEditorPlugin.getPluginLog().logError(e);
- } catch (InstantiationException e) {
- JspEditorPlugin.getPluginLog().logError(e);
- } catch (IllegalAccessException e) {
- JspEditorPlugin.getPluginLog().logError(e);
}
}
return wtpKbConnector;
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/FaceletsHtmlContentAssistProcessor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/FaceletsHtmlContentAssistProcessor.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/FaceletsHtmlContentAssistProcessor.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -57,7 +57,6 @@
import org.jboss.tools.common.kb.wtp.TLDVersionHelper;
import org.jboss.tools.common.kb.wtp.WtpKbConnector;
import org.jboss.tools.common.model.util.ELParser;
-import org.jboss.tools.common.reporting.ProblemReportingHelper;
import org.jboss.tools.jst.jsp.JspEditorPlugin;
import org.jboss.tools.jst.jsp.editor.TLDRegisterHelper;
import org.jboss.tools.jst.jsp.outline.ValueHelper;
@@ -484,11 +483,7 @@
jspActiveCAP.setKbConnector(wtpKbConnector);
FaceletsJsfCResource fsfCResource = new FaceletsJsfCResource(wtpKbConnector);
wtpKbConnector.registerResource(fsfCResource);
- } catch(ClassNotFoundException e) {
- JspEditorPlugin.getPluginLog().logError(e);
- } catch (InstantiationException e) {
- JspEditorPlugin.getPluginLog().logError(e);
- } catch (IllegalAccessException e) {
+ } catch (KbException e) {
JspEditorPlugin.getPluginLog().logError(e);
}
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/SourceEditorPageContext.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/SourceEditorPageContext.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/SourceEditorPageContext.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -18,6 +18,7 @@
import org.eclipse.jface.text.IDocument;
import org.jboss.tools.common.kb.KbConnectorFactory;
import org.jboss.tools.common.kb.KbConnectorType;
+import org.jboss.tools.common.kb.KbException;
import org.jboss.tools.common.kb.wtp.WtpKbConnector;
import org.jboss.tools.jst.jsp.JspEditorPlugin;
import org.jboss.tools.jst.jsp.editor.IVisualContext;
@@ -99,12 +100,8 @@
}
try {
connector = (WtpKbConnector)KbConnectorFactory.getIntstance().createConnector(KbConnectorType.JSP_WTP_KB_CONNECTOR, iDocument);
- } catch (InstantiationException e) {
+ } catch (KbException e) {
JspEditorPlugin.getPluginLog().logError(e);
- } catch (IllegalAccessException e) {
- JspEditorPlugin.getPluginLog().logError(e);
- } catch (ClassNotFoundException e) {
- JspEditorPlugin.getPluginLog().logError(e);
}
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb/WTPTextJspKbConnector.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb/WTPTextJspKbConnector.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb/WTPTextJspKbConnector.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -130,13 +130,8 @@
fTaglibResource = taglibResource;
registerResource(fTaglibResource);
}
- invokeDelayedUpdateKnownTagLists();
- } catch(ClassNotFoundException e) {
+ } catch (KbException e) {
JspEditorPlugin.getPluginLog().logError(e);
- } catch (InstantiationException e) {
- JspEditorPlugin.getPluginLog().logError(e);
- } catch (IllegalAccessException e) {
- JspEditorPlugin.getPluginLog().logError(e);
}
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/RunPageActionDelegate.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/RunPageActionDelegate.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/RunPageActionDelegate.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -10,31 +10,44 @@
******************************************************************************/
package org.jboss.tools.jst.web.ui.action;
-import java.util.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.*;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jface.action.*;
+import java.util.Properties;
+import java.util.Set;
+import java.util.TreeSet;
+
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
-import org.jboss.tools.common.log.LogHelper;
-import org.jboss.tools.common.model.util.XModelTreeListenerSWTASync;
-import org.jboss.tools.common.model.ui.dnd.DnDUtil;
-import org.eclipse.jface.viewers.*;
-
-import org.jboss.tools.common.meta.action.*;
-import org.jboss.tools.common.meta.action.impl.*;
-import org.jboss.tools.common.model.*;
-import org.jboss.tools.common.model.event.*;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowPulldownDelegate;
+import org.jboss.tools.common.meta.action.XActionInvoker;
+import org.jboss.tools.common.meta.action.XEntityData;
+import org.jboss.tools.common.meta.action.impl.SpecialWizardSupport;
+import org.jboss.tools.common.meta.action.impl.XEntityDataImpl;
+import org.jboss.tools.common.model.XModel;
+import org.jboss.tools.common.model.XModelException;
+import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.model.event.XModelTreeEvent;
+import org.jboss.tools.common.model.event.XModelTreeListener;
import org.jboss.tools.common.model.options.PreferenceModelUtilities;
import org.jboss.tools.common.model.plugin.ModelPlugin;
import org.jboss.tools.common.model.project.IModelNature;
+import org.jboss.tools.common.model.ui.ModelUIPlugin;
+import org.jboss.tools.common.model.ui.action.AbstractModelActionDelegate;
+import org.jboss.tools.common.model.ui.dnd.DnDUtil;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
-import org.jboss.tools.common.model.ui.ModelUIPlugin;
-import org.jboss.tools.common.model.ui.action.*;
-import org.jboss.tools.jst.web.browser.*;
+import org.jboss.tools.common.model.util.XModelTreeListenerSWTASync;
+import org.jboss.tools.jst.web.browser.AbstractBrowserContext;
import org.jboss.tools.jst.web.browser.wtp.RunOnServerContext;
import org.jboss.tools.jst.web.server.ServerManager;
import org.jboss.tools.jst.web.server.ServerManagerListener;
@@ -147,7 +160,7 @@
return context.getModelActionPath();
}
- protected void doRun() throws Exception {
+ protected void doRun() {
if(context.isJustUrl(context.getLastRunURL())) {
if(!saveAllEditors()) return;
context.runJustUrl();
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/SaveProjectAsTemplateActionDelegate.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/SaveProjectAsTemplateActionDelegate.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/SaveProjectAsTemplateActionDelegate.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -24,7 +24,7 @@
return true;
}
- protected void doRun() throws Exception {
+ protected void doRun() {
XActionInvoker.invoke("WebWorkspace", "SaveAsTemplate", object, null);
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/adf/AddADFSupportAction.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/adf/AddADFSupportAction.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/adf/AddADFSupportAction.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -10,11 +10,15 @@
******************************************************************************/
package org.jboss.tools.jst.web.ui.action.adf;
+import java.lang.reflect.InvocationTargetException;
+
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.ui.IObjectActionDelegate;
import org.eclipse.ui.IWorkbenchPart;
+import org.jboss.tools.common.model.XModelException;
import org.jboss.tools.common.model.ui.action.*;
+import org.jboss.tools.jst.web.ui.WebUiPlugin;
public class AddADFSupportAction extends AbstractModelActionDelegate implements IObjectActionDelegate {
AddADFSupportHelper helper = new AddADFSupportHelper();
@@ -33,7 +37,13 @@
}
protected void doRun() throws XModelException {
- helper.execute();
+ try {
+ helper.execute();
+ } catch (InvocationTargetException e) {
+ WebUiPlugin.getPluginLog().logError(e);
+ } catch (InterruptedException e) {
+ WebUiPlugin.getPluginLog().logError(e);
+ }
}
public void setActivePart(IAction action, IWorkbenchPart targetPart) {}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamMessagesLoader.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamMessagesLoader.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamMessagesLoader.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -127,7 +127,7 @@
}
public Collection<ISeamProperty> getProperties() {
- throw new RuntimeException("Not implemented");
+ throw new IllegalStateException("Not implemented");
}
public Collection<String> getPropertyNames() {
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/LibraryScanner.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/LibraryScanner.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/LibraryScanner.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -203,12 +203,7 @@
if(cls == null) return;
if(!CLASS_SCANNER.isLikelyComponentSource(cls)) return;
LoadedDeclarations ds1 = null;
- try {
- ds1 = CLASS_SCANNER.parse(type, cls, sourcePath);
- } catch (Exception e) {
- // FIXME parse method should throw particular exception or catch block should be removed
- SeamCorePlugin.getPluginLog().logError(e);
- }
+ ds1 = CLASS_SCANNER.parse(type, cls, sourcePath);
if(ds1 != null) {
ds.add(ds1);
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationContext.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationContext.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationContext.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -21,7 +21,6 @@
import org.eclipse.core.runtime.Path;
import org.jboss.tools.common.xml.XMLUtilities;
import org.jboss.tools.seam.core.SeamCoreMessages;
-import org.jboss.tools.seam.core.SeamCorePlugin;
import org.w3c.dom.Element;
/**
@@ -276,10 +275,10 @@
*/
public void addLinkedResource(String variableName, IPath linkedResourcePath) {
if(linkedResourcePath==null) {
- throw new RuntimeException(SeamCoreMessages.SEAM_VALIDATION_CONTEXT_LINKED_RESOURCE_PATH_MUST_NOT_BE_NULL);
+ throw new IllegalArgumentException(SeamCoreMessages.SEAM_VALIDATION_CONTEXT_LINKED_RESOURCE_PATH_MUST_NOT_BE_NULL);
}
if(variableName==null) {
- throw new RuntimeException(SeamCoreMessages.SEAM_VALIDATION_CONTEXT_VARIABLE_NAME_MUST_NOT_BE_NULL);
+ throw new IllegalArgumentException(SeamCoreMessages.SEAM_VALIDATION_CONTEXT_VARIABLE_NAME_MUST_NOT_BE_NULL);
}
Set<IPath> linkedResources = resourcesByVariableName.get(variableName);
if(linkedResources==null) {
Modified: trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamBeanHyperlink.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamBeanHyperlink.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamBeanHyperlink.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -13,6 +13,7 @@
import java.text.MessageFormat;
import java.util.List;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.ui.JavaUI;
import org.eclipse.jface.text.BadLocationException;
@@ -49,7 +50,7 @@
// could not open editor
openFileFailed();
}
- } catch (Exception x) {
+ } catch (CoreException x) {
// could not open editor
openFileFailed();
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamBeanHyperlinkPartitioner.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamBeanHyperlinkPartitioner.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamBeanHyperlinkPartitioner.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -14,7 +14,6 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.Status;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
@@ -30,7 +29,6 @@
import org.jboss.tools.seam.core.ISeamProject;
import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.internal.core.el.ELOperandToken;
-import org.jboss.tools.seam.internal.core.el.ELToken;
import org.jboss.tools.seam.internal.core.el.ElVarSearcher;
import org.jboss.tools.seam.internal.core.el.SeamELCompletionEngine;
import org.jboss.tools.seam.internal.core.el.ElVarSearcher.Var;
@@ -46,8 +44,6 @@
public class SeamBeanHyperlinkPartitioner extends AbstractHyperlinkPartitioner implements IHyperlinkPartitionRecognizer, IHyperLinkPartitionPriority {
public static final String SEAM_BEAN_PARTITION = "org.jboss.tools.seam.text.ext.SEAM_BEAN";
- private final SeamELCompletionEngine fEngine= new SeamELCompletionEngine();
-
/**
* @see com.ibm.sse.editor.hyperlink.AbstractHyperlinkPartitioner#parse(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
@@ -73,9 +69,6 @@
IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
return region;
- } catch (Exception x) {
- SeamExtPlugin.getPluginLog().logError(x);
- return null;
} finally {
smw.dispose();
}
@@ -131,7 +124,7 @@
IHyperlinkRegion region = new HyperlinkRegion(propStart, propLength, null, null, null);
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
SeamExtPlugin.getPluginLog().logError(x);
return null;
} finally {
@@ -183,7 +176,7 @@
IHyperlinkRegion region = new HyperlinkRegion(propStart, propLength, null, null, null);
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
SeamExtPlugin.getPluginLog().logError(x);
return null;
} finally {
@@ -212,9 +205,6 @@
IHyperlinkRegion region = new HyperlinkRegion(propStart, propLength);
return region;
- } catch (Exception x) {
- SeamExtPlugin.getPluginLog().logError(x);
- return null;
} finally {
smw.dispose();
}
@@ -235,9 +225,6 @@
List<IJavaElement> javaElements = findJavaElements(document, region);
return (javaElements != null && javaElements.size() > 0);
- } catch (Exception x) {
- SeamExtPlugin.getPluginLog().logError(x);
- return false;
} finally {
smw.dispose();
}
@@ -336,7 +323,7 @@
seamProject, file, elText.toString());
}
return javaElements;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
SeamExtPlugin.getPluginLog().logError(x);
return null;
} finally {
Modified: trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamELInJavaStringHyperlinkDetector.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamELInJavaStringHyperlinkDetector.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamELInJavaStringHyperlinkDetector.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -20,7 +20,6 @@
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.internal.ui.javaeditor.EditorUtility;
import org.eclipse.jdt.internal.ui.javaeditor.JavaEditor;
-import org.eclipse.jdt.internal.ui.javaeditor.JavaElementHyperlink;
import org.eclipse.jdt.internal.ui.text.JavaWordFinder;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
Modified: trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamViewHyperlink.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamViewHyperlink.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamViewHyperlink.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -21,7 +21,6 @@
import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.common.text.ext.hyperlink.LinkHyperlink;
import org.jboss.tools.jst.web.project.list.WebPromptingProvider;
-import org.jboss.tools.seam.text.ext.SeamExtPlugin;
public class SeamViewHyperlink extends LinkHyperlink {
@@ -50,14 +49,8 @@
protected IFile getFileFromProject(String fileName) {
IFile documentFile = getFile();
-
- try {
- IProject project = documentFile.getProject();
- return super.getFileFromProject(updateFilenameForModel(fileName, project));
- } catch (Exception x) {
- SeamExtPlugin.getPluginLog().logError(x);
- return null;
- }
+ IProject project = documentFile.getProject();
+ return super.getFileFromProject(updateFilenameForModel(fileName, project));
}
}
\ No newline at end of file
Modified: trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamViewHyperlinkPartitioner.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamViewHyperlinkPartitioner.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamViewHyperlinkPartitioner.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -13,6 +13,7 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.text.IDocument;
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
import org.jboss.tools.common.text.ext.hyperlink.jsp.JSPLinkHyperlinkPartitioner;
@@ -49,7 +50,7 @@
return true;
}
return false;
- } catch (Exception x) {
+ } catch (CoreException x) {
SeamExtPlugin.getPluginLog().logError(x);
return false;
} finally {
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/actions/FindSeamAction.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/actions/FindSeamAction.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/actions/FindSeamAction.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -11,6 +11,7 @@
package org.jboss.tools.seam.ui.actions;
+import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
@@ -347,8 +348,14 @@
Object result = m.invoke(multiPageEditor, new Object[]{});
return (result instanceof IEditorPart ? (IEditorPart)result : null);
}
- } catch (NoSuchMethodException ne) {
- } catch (Exception e) {
+ } catch (NoSuchMethodException e) {
+ // ignore
+ } catch (IllegalArgumentException e) {
+ // ignore
+ } catch (IllegalAccessException e) {
+ // ignore
+ } catch (InvocationTargetException e) {
+ // ignore
}
editorClass = editorClass.getSuperclass();
}
@@ -373,8 +380,14 @@
Object result = m.invoke(editor, new Object[]{});
return (result instanceof ISourceViewer ? (ISourceViewer)result : null);
}
- } catch (NoSuchMethodException ne) {
- } catch (Exception e) {
+ } catch (NoSuchMethodException e) {
+ // ignore
+ } catch (IllegalArgumentException e) {
+ // ignore
+ } catch (IllegalAccessException e) {
+ // ignore
+ } catch (InvocationTargetException e) {
+ // ignore
}
editorClass = editorClass.getSuperclass();
}
@@ -388,11 +401,7 @@
* @return
*/
private Shell getShell() {
- try {
- return PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
- } catch (Throwable x) {
- return null;
- }
+ return PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
}
// IWorkbenchPart fActiveWorkbenchPart = null;
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/actions/ScopePresentationActionProvider.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/actions/ScopePresentationActionProvider.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/actions/ScopePresentationActionProvider.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -22,7 +22,6 @@
import org.eclipse.ui.navigator.IExtensionActivationListener;
import org.eclipse.ui.navigator.IExtensionStateModel;
import org.eclipse.ui.navigator.INavigatorActivationService;
-import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.core.SeamPreferences;
import org.jboss.tools.seam.ui.views.ViewConstants;
@@ -119,12 +118,7 @@
.getActiveWorkbenchWindow().getShell().getDisplay(),
new Runnable() {
public void run() {
- try {
- getActionSite().getStructuredViewer().refresh();
- } catch (Exception e2) {
- SeamCorePlugin.getPluginLog().logError(e2);
- //ignore
- }
+ getActionSite().getStructuredViewer().refresh();
}
}
);
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/ButtonFieldEditor.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/ButtonFieldEditor.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/ButtonFieldEditor.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -29,7 +29,7 @@
private ButtonPressedAction buttonAction = new ButtonPressedAction(SeamUIMessages.BUTTON_FIELD_EDITOR_BROWSE) {
@Override
public void run() {
- throw new RuntimeException(SeamUIMessages.BUTTON_FIELD_EDITOR_NOT_IMPLEMENTED_YET);
+ throw new IllegalStateException(SeamUIMessages.BUTTON_FIELD_EDITOR_NOT_IMPLEMENTED_YET);
}
};
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/LinkFieldEditor.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/LinkFieldEditor.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/LinkFieldEditor.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -12,7 +12,7 @@
private ButtonPressedAction buttonAction = new ButtonPressedAction(SeamUIMessages.BUTTON_FIELD_EDITOR_BROWSE) {
@Override
public void run() {
- throw new RuntimeException(SeamUIMessages.BUTTON_FIELD_EDITOR_NOT_IMPLEMENTED_YET);
+ throw new IllegalStateException(SeamUIMessages.BUTTON_FIELD_EDITOR_NOT_IMPLEMENTED_YET);
}
};
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseOperation.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseOperation.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseOperation.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -170,8 +170,6 @@
result = new Status(IStatus.ERROR,SeamGuiPlugin.PLUGIN_ID,e.getMessage(),e);
} catch (CoreException e) {
result = new Status(IStatus.ERROR,SeamGuiPlugin.PLUGIN_ID,e.getMessage(),e);
- } catch(Exception e) {
- result = new Status(IStatus.ERROR,SeamGuiPlugin.PLUGIN_ID,e.getMessage(),e);
}
finally {
try {
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/SeamPagesEditor.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/SeamPagesEditor.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/SeamPagesEditor.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -3,6 +3,7 @@
import org.eclipse.gef.ui.actions.ActionRegistry;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.PartInitException;
import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
import org.jboss.tools.common.editor.AbstractSelectionProvider;
import org.jboss.tools.common.editor.ObjectMultiPageEditor;
@@ -65,7 +66,7 @@
selectionProvider.setHost(guiEditor.getSelectionProvider());
guiEditor.addErrorSelectionListener(createErrorSelectionListener());
selectionProvider.addHost("guiEditor", guiEditor.getSelectionProvider());
- } catch(Exception ex) {
+ } catch(PartInitException ex) {
SeamUiPagesPlugin.getDefault().logError(ex);
}
}
Modified: trunk/struts/plugins/org.jboss.tools.struts.ui/src/org/jboss/tools/struts/ui/internal/action/AddStrutsNatureActionDelegate.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.ui/src/org/jboss/tools/struts/ui/internal/action/AddStrutsNatureActionDelegate.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/struts/plugins/org.jboss.tools.struts.ui/src/org/jboss/tools/struts/ui/internal/action/AddStrutsNatureActionDelegate.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -11,23 +11,23 @@
package org.jboss.tools.struts.ui.internal.action;
import org.eclipse.core.resources.IProject;
+import org.eclipse.jface.wizard.IWizard;
import org.jboss.tools.common.meta.key.WizardKeys;
-import org.jboss.tools.common.model.ui.util.ExtensionPointUtils;
-import org.eclipse.jface.wizard.IWizard;
import org.jboss.tools.common.model.ui.ModelUIPlugin;
import org.jboss.tools.common.model.ui.action.AddNatureActionDelegate;
+import org.jboss.tools.common.model.ui.util.ExtensionPointUtils;
import org.jboss.tools.struts.StrutsProjectUtil;
import org.jboss.tools.struts.ui.StrutsUIPlugin;
import org.jboss.tools.struts.ui.wizard.project.ImportProjectWizard;
public class AddStrutsNatureActionDelegate extends AddNatureActionDelegate {
- protected IWizard getWizard(IProject project) throws Exception {
+ protected IWizard getWizard(IProject project) {
ImportProjectWizard wizard = (ImportProjectWizard)ExtensionPointUtils.findImportWizardsItem(
StrutsUIPlugin.PLUGIN_ID,
"org.jboss.tools.struts.ui.wizard.project.ImportProjectWizard"
);
- if (wizard == null) throw new Exception("Wizard org.jboss.tools.common.model.ui.wizards.ImportProjectWizard is not found.");
+ if (wizard == null) throw new IllegalArgumentException("Wizard org.jboss.tools.common.model.ui.wizards.ImportProjectWizard is not found.");
wizard.setInitialName(project.getName());
wizard.setInitialLocation(findWebXML(project.getLocation().toString()));
wizard.init(ModelUIPlugin.getDefault().getWorkbench(), null);
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/context/VpePageContext.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/context/VpePageContext.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/context/VpePageContext.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -27,6 +27,7 @@
import org.eclipse.wst.xml.core.internal.document.ElementImpl;
import org.jboss.tools.common.kb.KbConnectorFactory;
import org.jboss.tools.common.kb.KbConnectorType;
+import org.jboss.tools.common.kb.KbException;
import org.jboss.tools.common.kb.wtp.WtpKbConnector;
import org.jboss.tools.jst.jsp.editor.IVisualContext;
import org.jboss.tools.jst.jsp.preferences.VpePreference;
@@ -87,12 +88,8 @@
IDocument document = sourceBuilder.getStructuredTextViewer().getDocument();
try {
connector = (WtpKbConnector)KbConnectorFactory.getIntstance().createConnector(KbConnectorType.JSP_WTP_KB_CONNECTOR, document);
- } catch (InstantiationException e) {
+ } catch (KbException e) {
VpePlugin.getPluginLog().logError(e);
- } catch (IllegalAccessException e) {
- VpePlugin.getPluginLog().logError(e);
- } catch (ClassNotFoundException e) {
- VpePlugin.getPluginLog().logError(e);
}
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/FileUtil.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/FileUtil.java 2008-08-28 20:56:59 UTC (rev 9948)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/FileUtil.java 2008-08-29 00:21:46 UTC (rev 9949)
@@ -23,6 +23,7 @@
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
import org.eclipse.ui.editors.text.ILocationProvider;
import org.eclipse.ui.ide.IDE;
import org.eclipse.wst.common.componentcore.ComponentCore;
@@ -82,39 +83,41 @@
*/
public static IFile getFile(String fileName, IFile includeFile) {
IFile file = null;
- if(fileName.startsWith("/")) { //$NON-NLS-1$
- try {
- ResourceReference[] resources = AbsoluteFolderReferenceList.getInstance().getAllResources(includeFile);
- if(resources!=null && resources.length==1) {
- String location =resources[0].getLocation()+fileName;
- IPath path=new Path(location);
- return ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(path);
- }else {
- WebArtifactEdit edit =
- WebArtifactEdit.getWebArtifactEditForRead(includeFile.getProject());
- IVirtualComponent com = ComponentCore.createComponent(includeFile.getProject());
- IVirtualFolder webRootFolder = com.getRootFolder().getFolder(new Path("/"));
- IContainer folder = webRootFolder.getUnderlyingFolder();
- IPath path = folder.getFullPath().append(fileName);
- file = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
- }
- }catch (Exception ex) {
- // do nothing that means include will shown as text region with included file name
+ if (fileName.startsWith("/")) { //$NON-NLS-1$
+ ResourceReference[] resources = AbsoluteFolderReferenceList
+ .getInstance().getAllResources(includeFile);
+ if (resources != null && resources.length == 1) {
+ String location = resources[0].getLocation() + fileName;
+ IPath path = new Path(location);
+ return ResourcesPlugin.getWorkspace().getRoot()
+ .getFileForLocation(path);
+ } else {
+ WebArtifactEdit edit = WebArtifactEdit
+ .getWebArtifactEditForRead(includeFile.getProject());
+ IVirtualComponent com = ComponentCore
+ .createComponent(includeFile.getProject());
+ IVirtualFolder webRootFolder = com.getRootFolder().getFolder(
+ new Path("/"));
+ IContainer folder = webRootFolder.getUnderlyingFolder();
+ IPath path = folder.getFullPath().append(fileName);
+ file = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
}
- } else {
- ResourceReference[] resources = RelativeFolderReferenceList.getInstance().getAllResources(includeFile);
- if ((resources != null) && resources.length == 1) {
- String location = resources[0].getLocation() + File.separator+fileName;
- IPath path = new Path(location);
- //new File(location);
- return ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(path);//ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(path);
- } else {
- IPath currentFolder = includeFile.getParent().getFullPath();
- IPath path = currentFolder.append(fileName);
- file = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
- }
- }
- return file;
+ } else {
+ ResourceReference[] resources = RelativeFolderReferenceList
+ .getInstance().getAllResources(includeFile);
+ if ((resources != null) && resources.length == 1) {
+ String location = resources[0].getLocation() + File.separator
+ + fileName;
+ IPath path = new Path(location);
+ return ResourcesPlugin.getWorkspace().getRoot()
+ .getFileForLocation(path);
+ } else {
+ IPath currentFolder = includeFile.getParent().getFullPath();
+ IPath path = currentFolder.append(fileName);
+ file = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
+ }
+ }
+ return file;
}
/**
@@ -129,7 +132,7 @@
if (file != null) {
IDE.openEditor(workbenchPage, file, true);
}
- } catch (Exception ex) {
+ } catch (PartInitException ex) {
VpePlugin.reportProblem(ex);
}
16 years, 6 months
JBoss Tools SVN: r9948 - trunk/core/plugins/org.jboss.ide.eclipse.archives.webtools/.settings.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2008-08-28 16:56:59 -0400 (Thu, 28 Aug 2008)
New Revision: 9948
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.webtools/.settings/org.eclipse.jdt.core.prefs
Log:
JBIDE-2699 - good patch on exported packages / compiler settings
Modified: trunk/core/plugins/org.jboss.ide.eclipse.archives.webtools/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.webtools/.settings/org.eclipse.jdt.core.prefs 2008-08-28 20:47:09 UTC (rev 9947)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.webtools/.settings/org.eclipse.jdt.core.prefs 2008-08-28 20:56:59 UTC (rev 9948)
@@ -1,7 +1,12 @@
-#Fri Aug 22 17:07:49 EDT 2008
+#Tue Aug 26 18:57:30 CDT 2008
eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
-org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.6
+org.eclipse.jdt.core.compiler.source=1.5
16 years, 6 months
JBoss Tools SVN: r9947 - in trunk: jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/adf and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2008-08-28 16:47:09 -0400 (Thu, 28 Aug 2008)
New Revision: 9947
Modified:
trunk/common/plugins/org.jboss.tools.common.verification.ui/src/org/jboss/tools/common/verification/ui/vrules/action/VRulesConfigurationAction.java
trunk/common/plugins/org.jboss.tools.common.verification.ui/src/org/jboss/tools/common/verification/ui/vrules/action/VerifyAllAction.java
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/adf/AddADFSupportAction.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-893
Fix compilation error
Modified: trunk/common/plugins/org.jboss.tools.common.verification.ui/src/org/jboss/tools/common/verification/ui/vrules/action/VRulesConfigurationAction.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.verification.ui/src/org/jboss/tools/common/verification/ui/vrules/action/VRulesConfigurationAction.java 2008-08-28 20:45:40 UTC (rev 9946)
+++ trunk/common/plugins/org.jboss.tools.common.verification.ui/src/org/jboss/tools/common/verification/ui/vrules/action/VRulesConfigurationAction.java 2008-08-28 20:47:09 UTC (rev 9947)
@@ -14,6 +14,7 @@
import org.eclipse.jface.preference.*;
import org.eclipse.jface.viewers.*;
+import org.jboss.tools.common.model.XModelException;
import org.jboss.tools.common.model.plugin.ModelPlugin;
import org.jboss.tools.common.model.ui.action.*;
@@ -23,7 +24,7 @@
action.setEnabled(computeEnabled());
}
- public void doRun() throws Exception {
+ public void doRun() throws XModelException {
new VRulesPreferenceDialog().open();
}
Modified: trunk/common/plugins/org.jboss.tools.common.verification.ui/src/org/jboss/tools/common/verification/ui/vrules/action/VerifyAllAction.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.verification.ui/src/org/jboss/tools/common/verification/ui/vrules/action/VerifyAllAction.java 2008-08-28 20:45:40 UTC (rev 9946)
+++ trunk/common/plugins/org.jboss.tools.common.verification.ui/src/org/jboss/tools/common/verification/ui/vrules/action/VerifyAllAction.java 2008-08-28 20:47:09 UTC (rev 9947)
@@ -12,6 +12,7 @@
import java.util.*;
import org.jboss.tools.common.meta.action.*;
+import org.jboss.tools.common.model.XModelException;
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.ui.action.*;
import org.eclipse.jface.action.IAction;
@@ -19,7 +20,7 @@
public class VerifyAllAction extends AbstractModelActionDelegate {
- public void doRun() throws Exception {
+ public void doRun() throws XModelException {
Properties p = new Properties();
p.put("shell", window.getShell());
XActionInvoker.invoke(getActionPath(), object, p);
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/adf/AddADFSupportAction.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/adf/AddADFSupportAction.java 2008-08-28 20:45:40 UTC (rev 9946)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/adf/AddADFSupportAction.java 2008-08-28 20:47:09 UTC (rev 9947)
@@ -32,7 +32,7 @@
return helper.isEnabled();
}
- protected void doRun() throws Exception {
+ protected void doRun() throws XModelException {
helper.execute();
}
16 years, 6 months
JBoss Tools SVN: r9946 - trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/action.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2008-08-28 16:45:40 -0400 (Thu, 28 Aug 2008)
New Revision: 9946
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/action/SaveModelActionDelegate.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-893
Fix compilation error
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/action/SaveModelActionDelegate.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/action/SaveModelActionDelegate.java 2008-08-28 18:23:13 UTC (rev 9945)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/action/SaveModelActionDelegate.java 2008-08-28 20:45:40 UTC (rev 9946)
@@ -24,7 +24,7 @@
public SaveModelActionDelegate() {}
- protected void doRun() throws Exception {
+ protected void doRun() throws XModelException {
(new SaveAllHandler()).executeHandler(object, null);
}
16 years, 6 months
JBoss Tools SVN: r9945 - in trunk/common/plugins: org.jboss.tools.common/src/org/jboss/tools/common/xml and 8 other directories.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2008-08-28 14:23:13 -0400 (Thu, 28 Aug 2008)
New Revision: 9945
Modified:
trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbDocumentBuilderFactory.java
trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbHtmlStore.java
trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbQuery.java
trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbTldConvertor.java
trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbTldResource.java
trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbTldStore.java
trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/SchemaNodeFactory.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/ObjectMultiPageEditor.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/TreeFormPage.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/action/AbstractModelActionDelegate.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/MultiPageContributor.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/PropertiesTextEditorComponent.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/TextEditorComponent.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/TextEditorSupport.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/TextMerge.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/XMLTextEditorComponent.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/XMLTextEditorStandAlone.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/dnd/TextEditorDrop.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/texteditors/preferences/ReplaceTabsAdapter.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/xmleditor/XMLTextEditor.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/views/palette/PaletteAdapter.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/views/palette/PaletteInsertHelper.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/views/palette/PaletteTaglibInserter.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/views/palette/PaletteViewPart.java
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/util/FileUtil.java
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/util/HttpUtil.java
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/xml/DtdResolver.java
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/xml/SAXValidator.java
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/xml/SafeDocumentBuilderFactory.java
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/xml/XMLEntityResolverImpl.java
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/xml/XMLUtilities.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-893
Fix PMD violations
Modified: trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/util/FileUtil.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/util/FileUtil.java 2008-08-28 15:51:57 UTC (rev 9944)
+++ trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/util/FileUtil.java 2008-08-28 18:23:13 UTC (rev 9945)
@@ -30,7 +30,7 @@
if(encoding == null) return new String(bs.bs, 0, bs.length);
try {
return new String(bs.bs, 0, bs.length, encoding);
- } catch (Exception e) {
+ } catch (UnsupportedEncodingException e) {
return new String(bs.bs, 0, bs.length);
}
}
@@ -46,7 +46,7 @@
br.close();
fr.close();
return new ReadBytes(bs, l);
- } catch (Exception e) {
+ } catch (IOException e) {
return null;
}
}
@@ -66,7 +66,7 @@
if(bs == null) return null;
try {
return new String(bs.bs, 0, bs.length, encoding);
- } catch (Exception e) {
+ } catch (UnsupportedEncodingException e) {
return null;
}
}
@@ -83,7 +83,7 @@
br.close();
fr.close();
return isText(new String(cs));
- } catch (Exception e) {
+ } catch (IOException e) {
return false;
}
}
@@ -108,7 +108,7 @@
sb.append(new String(b, 0, l));
}
is.close();
- } catch (Exception e) {
+ } catch (IOException e) {
CommonPlugin.getPluginLog().logError(e);
}
return sb.toString();
@@ -134,15 +134,17 @@
try {
if(f.isFile() && !isSameFile(f)) f.delete();
if(!f.exists()) f.createNewFile();
- } catch (Exception e) {
+ } catch (IOException e) {
CommonPlugin.getPluginLog().logError("Problem writing to file " + f, e);
+ } catch (SecurityException e) {
+ CommonPlugin.getPluginLog().logError("Problem writing to file " + f, e);
}
PrintWriter pw = new PrintWriter(new FileWriter(f));
pw.print(value);
pw.flush();
pw.close();
return true;
- } catch (Exception e) {
+ } catch (IOException e) {
return false;
}
}
@@ -174,7 +176,7 @@
os = new BufferedOutputStream(new FileOutputStream(dest), 16 * 1024);
copyStream(is, os);
return true;
- } catch (Exception e) {
+ } catch (IOException e) {
CommonPlugin.getPluginLog().logError(e);
return false;
} finally {
@@ -230,9 +232,9 @@
try {
String cn = f.getCanonicalFile().getName();
return fn.equals(cn);
- } catch (Exception e) {
+ } catch (IOException e) {
return false;
- }
+ }
}
public static void copyDir(File from, File to) {
@@ -377,7 +379,7 @@
} else {
try {
jos.putNextEntry(entry);
- } catch (Exception e) {
+ } catch (IOException e) {
return;
}
FileInputStream is = new FileInputStream(f);
@@ -485,7 +487,7 @@
char[] cs = new char[bs.length];
int l = r.read(cs, 0, cs.length);
return new String(cs, 0, l);
- } catch (Exception e) {
+ } catch (IOException e) {
if("UTF-8".equals(encoding)) return text;
return encode(text, "UTF-8");
}
@@ -534,9 +536,12 @@
pw.flush();
pw.close();
return true;
- } catch (Exception e) {
+ } catch (FileNotFoundException e) {
//ignore
return writeFileDefault(f, value);
+ } catch (UnsupportedEncodingException e) {
+ //ignore
+ return writeFileDefault(f, value);
}
}
@@ -569,7 +574,7 @@
}
validEncodings.add(encoding);
return encoding;
- } catch (Exception e) {
+ } catch (UnsupportedEncodingException e) {
invalidEncodings.add(encoding);
return defaultEncoding;
}
@@ -591,7 +596,7 @@
try {
String encoding = getEncoding(new String(bs, 0, i, "UTF-16"));
return validateEncoding(encoding, "UTF-16");
- } catch (Exception e) {
+ } catch (UnsupportedEncodingException e) {
return null;
}
}
Modified: trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/util/HttpUtil.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/util/HttpUtil.java 2008-08-28 15:51:57 UTC (rev 9944)
+++ trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/util/HttpUtil.java 2008-08-28 18:23:13 UTC (rev 9945)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.common.util;
+import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
@@ -37,7 +38,7 @@
* @return InputStream of responce to http GET request. Use proxy settings from preferences.
* @throws Exception
*/
- public static InputStream getInputStreamFromUrlByGetMethod(String url) throws Exception {
+ public static InputStream getInputStreamFromUrlByGetMethod(String url) throws IOException {
InputStream is = executeGetMethod(url).getResponseBodyAsStream();
return is;
}
@@ -47,7 +48,7 @@
* @return InputStream of responce to http GET request. Use proxy settings from preferences.
* @throws Exception
*/
- public static InputStream getInputStreamFromUrlByGetMethod(String url, IProxyService proxyService) throws Exception {
+ public static InputStream getInputStreamFromUrlByGetMethod(String url, IProxyService proxyService) throws IOException {
InputStream is = executeGetMethod(url, proxyService).getResponseBodyAsStream();
return is;
}
@@ -58,7 +59,7 @@
* @return Status code of responce to http GET request. Use given proxy settings.
* @throws Exception
*/
- public static int getStatusCodeFromUrlByGetMethod(String url, IProxyService proxyService) throws Exception {
+ public static int getStatusCodeFromUrlByGetMethod(String url, IProxyService proxyService) throws IOException {
int code = executeGetMethod(url, proxyService).getStatusCode();
return code;
}
@@ -68,7 +69,7 @@
* @return Status code of responce to http GET request. Use proxy settings from preferences.
* @throws Exception
*/
- public static int getStatusCodeFromUrlByGetMethod(String url) throws Exception {
+ public static int getStatusCodeFromUrlByGetMethod(String url) throws IOException {
int code = executeGetMethod(url).getStatusCode();
return code;
}
@@ -78,7 +79,7 @@
* @return InputStream of responce to http POST request. Use proxy settings from preferences.
* @throws Exception
*/
- public static InputStream getInputStreamFromUrlByPostMethod(String url) throws Exception {
+ public static InputStream getInputStreamFromUrlByPostMethod(String url) throws IOException {
InputStream is = executePostMethod(url).getResponseBodyAsStream();
return is;
}
@@ -89,7 +90,7 @@
* @return Status code of responce to http POST request. Use given proxy settings.
* @throws Exception
*/
- public static int getStatusCodeFromUrlByPostMethod(String url, IProxyService proxyService) throws Exception {
+ public static int getStatusCodeFromUrlByPostMethod(String url, IProxyService proxyService) throws IOException {
int code = executePostMethod(url, proxyService).getStatusCode();
return code;
}
@@ -99,17 +100,17 @@
* @return Status code of responce to http POST request. Use proxy settings from preferences.
* @throws Exception
*/
- public static int getStatusCodeFromUrlByPostMethod(String url) throws Exception {
+ public static int getStatusCodeFromUrlByPostMethod(String url) throws IOException {
int code = executePostMethod(url).getStatusCode();
return code;
}
- private static GetMethod executeGetMethod(String url) throws Exception {
+ private static GetMethod executeGetMethod(String url) throws IOException {
IProxyService proxyService = getProxyService();
return executeGetMethod(url, proxyService);
}
- private static PostMethod executePostMethod(String url) throws Exception {
+ private static PostMethod executePostMethod(String url) throws IOException {
IProxyService proxyService = getProxyService();
return executePostMethod(url, proxyService);
}
@@ -120,14 +121,14 @@
* @return
* @throws Exception
*/
- public static GetMethod executeGetMethod(String url, IProxyService proxyService) throws Exception {
+ public static GetMethod executeGetMethod(String url, IProxyService proxyService) throws IOException {
GetMethod httpGet = new GetMethod(url);
HttpClient httpClient = createHttpClient(url, proxyService);
httpClient.executeMethod(httpGet);
return httpGet;
}
- private static PostMethod executePostMethod(String url, IProxyService proxyService) throws Exception {
+ private static PostMethod executePostMethod(String url, IProxyService proxyService) throws IOException {
PostMethod httpPost = new PostMethod(url);
HttpClient httpClient = createHttpClient(url, proxyService);
httpClient.executeMethod(httpPost);
@@ -139,11 +140,11 @@
* @return HttpClient with internet proxy settings;
* @throws Exception
*/
- public static HttpClient createHttpClient(String url) throws Exception {
+ public static HttpClient createHttpClient(String url) throws IOException {
return createHttpClient(url, getProxyService());
}
- private static HttpClient createHttpClient(String url, IProxyService proxyService) throws Exception {
+ private static HttpClient createHttpClient(String url, IProxyService proxyService) throws IOException {
HttpClient httpClient = new HttpClient();
if(proxyService.isProxiesEnabled()) {
Modified: trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/xml/DtdResolver.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/xml/DtdResolver.java 2008-08-28 15:51:57 UTC (rev 9944)
+++ trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/xml/DtdResolver.java 2008-08-28 18:23:13 UTC (rev 9945)
@@ -12,8 +12,10 @@
import java.io.File;
import java.io.FileInputStream;
+import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
+import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashSet;
import java.util.Set;
@@ -78,7 +80,7 @@
} else if("jar".equals(url.getProtocol())) {
return url.openStream();
}
- } catch(Exception e) {
+ } catch(FileNotFoundException e) {
CommonPlugin.getPluginLog().logError("Error in DtdResolver: " + e.getMessage());
}
}
@@ -98,10 +100,13 @@
if("http".equals(url.getProtocol())) {
is = HttpUtil.getInputStreamFromUrlByGetMethod(systemId);
}
- } catch (Exception e) {
+ } catch (MalformedURLException e) {
CommonPlugin.getPluginLog().logError( e.getMessage());
// don't handle any exeptions. Bug #ESL-306
- }
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
}
return is;
}
Modified: trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/xml/SAXValidator.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/xml/SAXValidator.java 2008-08-28 15:51:57 UTC (rev 9944)
+++ trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/xml/SAXValidator.java 2008-08-28 18:23:13 UTC (rev 9945)
@@ -19,12 +19,13 @@
import org.apache.xerces.util.XMLCatalogResolver;
import org.apache.xerces.xni.XMLResourceIdentifier;
-import org.apache.xerces.xni.XNIException;
import org.eclipse.core.runtime.Platform;
import org.jboss.tools.common.CommonPlugin;
import org.jboss.tools.common.util.FileUtil;
import org.osgi.framework.Bundle;
import org.xml.sax.SAXException;
+import org.xml.sax.SAXNotRecognizedException;
+import org.xml.sax.SAXNotSupportedException;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.DefaultHandler;
import org.xml.sax.helpers.XMLReaderFactory;
@@ -56,7 +57,7 @@
try {
parserInstance = XMLReaderFactory.createXMLReader(DEFAULT_SAX_PARSER_CLASS_NAME);
- } catch (Exception e) {
+ } catch (SAXException e) {
return null;
}
@@ -70,9 +71,11 @@
try {
parserInstance.setProperty(ENTITY_RESOLVER_PROPERTY_ID, new XMLEntityResolverImpl());
- } catch (Exception e1) {
+ } catch (SAXNotRecognizedException e1) {
CommonPlugin.getPluginLog().logError( e1.getMessage()+"", e1);
- }
+ } catch (SAXNotSupportedException e1) {
+ CommonPlugin.getPluginLog().logError( e1.getMessage()+"", e1);
+ }
parserInstance.setContentHandler(handler);
parserInstance.setErrorHandler(handler);
@@ -124,11 +127,17 @@
return new String[]{ "error: Unable to instantiate parser ("+DEFAULT_SAX_PARSER_CLASS_NAME+")"};
parser.setErrorHandler(h);
parser.parse(is);
- } catch (Exception e) {
- if(h.errors.isEmpty())
+ } catch (SAXException e) {
+ if(h.errors.isEmpty()) {
// TODO - Move to NLS bundle
- return new String[]{"Unidentified parser error:0:0"};
- } finally {
+ return new String[]{"Unidentified parser error:0:0",e.getMessage()};
+ }
+ } catch (IOException e) {
+ if(h.errors.isEmpty()) {
+ // TODO - Move to NLS bundle
+ return new String[]{"Unidentified parser error:0:0",e.getMessage()};
+ }
+ } finally {
// Thread.currentThread().setContextClassLoader(cc);
}
return (String[])h.errors.toArray(new String[0]);
@@ -140,12 +149,8 @@
* @return
*/
public String[] getXMLErrors(Reader reader) {
- try {
org.xml.sax.InputSource inSource = new org.xml.sax.InputSource(reader);
return getXMLErrors(inSource);
- } catch (Exception e) {
- return new String[]{e.getMessage()};
- }
}
/**
@@ -164,15 +169,13 @@
urlString = url.toString();
if(!urlString.endsWith("/")) urlString += "/";
urlString += "schemas";
- } catch (Exception e) {
+ } catch (IOException e) {
CommonPlugin.getPluginLog().logError(e);
}
File f1 = new File(url.getFile() + "/schemas/catalog.xml");
File f2 = new File(location + "schemas/catalog.xml");
- if(f2.exists()) try {
+ if(f2.exists()) {
return "file:///" + location + "schemas/catalog.xml";
- } catch (Exception e) {
- return null;
}
FileUtil.copyDir(f1.getParentFile(), f2.getParentFile(), true);
String text = FileUtil.readFile(f2);
@@ -200,7 +203,7 @@
/**
*
*/
- public String resolveIdentifier(XMLResourceIdentifier resourceIdentifier) throws IOException, XNIException {
+ public String resolveIdentifier(XMLResourceIdentifier resourceIdentifier) throws IOException {
String literal = resourceIdentifier.getLiteralSystemId();
if(literal != null && !literals.contains(literal)) {
literals.add(literal);
Modified: trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/xml/SafeDocumentBuilderFactory.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/xml/SafeDocumentBuilderFactory.java 2008-08-28 15:51:57 UTC (rev 9944)
+++ trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/xml/SafeDocumentBuilderFactory.java 2008-08-28 18:23:13 UTC (rev 9945)
@@ -14,6 +14,7 @@
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
import org.jboss.tools.common.CommonPlugin;
import org.xml.sax.EntityResolver;
@@ -49,7 +50,7 @@
d.setEntityResolver(EMPTY_RESOLVER);
}
d.setErrorHandler(new ErrorHandlerImpl());
- } catch (Exception e) {
+ } catch (ParserConfigurationException e) {
CommonPlugin.getPluginLog().logError(e);
} finally {
Thread.currentThread().setContextClassLoader(loader);
@@ -64,7 +65,7 @@
try {
t.start();
t.join();
- } catch (Exception e) {
+ } catch (InterruptedException e) {
t.run();
}
return t.d;
Modified: trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/xml/XMLEntityResolverImpl.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/xml/XMLEntityResolverImpl.java 2008-08-28 15:51:57 UTC (rev 9944)
+++ trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/xml/XMLEntityResolverImpl.java 2008-08-28 18:23:13 UTC (rev 9945)
@@ -14,12 +14,11 @@
import java.io.InputStream;
import org.apache.xerces.xni.XMLResourceIdentifier;
-import org.apache.xerces.xni.XNIException;
import org.apache.xerces.xni.parser.XMLEntityResolver;
import org.apache.xerces.xni.parser.XMLInputSource;
-
import org.eclipse.wst.wsdl.validation.internal.resolver.URIResolver;
import org.jboss.tools.common.CommonPlugin;
+import org.xml.sax.SAXException;
/**
* @author Igels
@@ -35,7 +34,7 @@
this.uriResolver = uriResolver;
}
- public XMLInputSource resolveEntity(XMLResourceIdentifier rid) throws XNIException, IOException {
+ public XMLInputSource resolveEntity(XMLResourceIdentifier rid) throws IOException {
XMLInputSource result = null;
String systemId = null;
String publicId = null;
@@ -44,18 +43,13 @@
systemId = rid.getBaseSystemId()==null?rid.getLiteralSystemId():rid.getExpandedSystemId();
publicId = rid.getPublicId();
- if(systemId != null && systemId.indexOf("www.ibm.com") >= 0) {
-// CommonPlugin.getPluginLog().logError( "ignore");
-// return null;
- }
-
InputStream is = resolver.getInputStream(rid.getPublicId(), systemId);
if(is!=null) {
result = new XMLInputSource(rid.getPublicId(), systemId, rid.getBaseSystemId(), is, null);
}
- } catch (Exception e) {
+ } catch (SAXException e) {
CommonPlugin.getPluginLog().logError( "Exception publicId=" + publicId + " systemId=" + systemId + " exception=" + e.getClass().getName() + ":" + e.getMessage());
- }
+ }
return result;
}
Modified: trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/xml/XMLUtilities.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/xml/XMLUtilities.java 2008-08-28 15:51:57 UTC (rev 9944)
+++ trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/xml/XMLUtilities.java 2008-08-28 18:23:13 UTC (rev 9945)
@@ -110,7 +110,7 @@
DOMImplementation domImpl = createDocumentBuilder().getDOMImplementation();
DocumentType docType = domImpl.createDocumentType(qName, publicId, systemId);
d = domImpl.createDocument(namespaceURI, name, docType);
- } catch (Exception e) {
+ } catch (DOMException e) {
return null;
}
Element de = d.getDocumentElement();
@@ -141,7 +141,7 @@
} finally {
try {
if (fr != null) fr.close();
- } catch (Exception e) {
+ } catch (IOException e) {
CommonPlugin.getPluginLog().logError(e);
}
}
@@ -157,8 +157,10 @@
try {
org.xml.sax.InputSource inSource = new org.xml.sax.InputSource(reader);
return getDocument(inSource, resolver);
- } catch (Exception e) {
+ } catch (SAXException e) {
return null;
+ } catch (IOException e) {
+ return null;
}
}
@@ -166,8 +168,10 @@
try {
org.xml.sax.InputSource inSource = new org.xml.sax.InputSource(is);
return getElement(inSource, resolver);
- } catch (Exception e) {
+ } catch (SAXException e) {
return null;
+ } catch (IOException e) {
+ return null;
}
}
@@ -186,12 +190,8 @@
}
public static String[] getXMLErrors(Reader reader, boolean checkDTD, EntityResolver resolver) {
- try {
- org.xml.sax.InputSource inSource = new org.xml.sax.InputSource(reader);
- return getXMLErrors(inSource, checkDTD, resolver);
- } catch (Exception e) {
- return new String[]{e.getMessage()};
- }
+ org.xml.sax.InputSource inSource = new org.xml.sax.InputSource(reader);
+ return getXMLErrors(inSource, checkDTD, resolver);
}
public static String[] getXMLErrors(org.xml.sax.InputSource is, EntityResolver resolver) {
@@ -205,9 +205,11 @@
if(resolver != null) builder.setEntityResolver(resolver);
builder.setErrorHandler(h);
builder.parse(is);
- } catch (Exception e) {
- if(h.errors.isEmpty()) return new String[]{"Unidentified parser error:0:0"};
- }
+ } catch (IOException e) {
+ if(h.errors.isEmpty()) return new String[]{"Unexpected parser error:0:0",e.toString()};
+ } catch (SAXException e) {
+ if(h.errors.isEmpty()) return new String[]{"Unexpected parser error:0:0",e.toString()};
+ }
return h.errors.toArray(new String[0]);
}
@@ -219,13 +221,15 @@
serialize(element, new BufferedWriter(fw));
fw.close();
}
-
+ static final String ENCODING = "encoding=\"";
+ static final String UTF8 = "UTF-8";
+
public static String getEncoding(String body) {
- int i = body.indexOf("encoding=\"");
- if(i < 0) return "UTF-8";
- i = i + "encoding=\"".length();
+ int i = body.indexOf(ENCODING);
+ if(i < 0) return UTF8;
+ i = i + ENCODING.length();
int j = body.indexOf('"', i);
- if(j < 0) return "UTF-8";
+ if(j < 0) return UTF8;
return body.substring(i, j);
}
@@ -238,14 +242,14 @@
public static final boolean serialize(Element element, Writer w) throws IOException {
if(element == null) return false;
- serialize(element, new XMLSerializer(w, createOutputFormat("UTF-8")));
+ serialize(element, new XMLSerializer(w, createOutputFormat(UTF8)));
w.close();
return true;
}
public static final boolean serialize(Element element, OutputStream w) throws IOException {
if(element == null) return false;
- serialize(element, new XMLSerializer(w, createOutputFormat("UTF-8")));
+ serialize(element, new XMLSerializer(w, createOutputFormat(UTF8)));
w.close();
return true;
}
Modified: trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbDocumentBuilderFactory.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbDocumentBuilderFactory.java 2008-08-28 15:51:57 UTC (rev 9944)
+++ trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbDocumentBuilderFactory.java 2008-08-28 18:23:13 UTC (rev 9945)
@@ -14,6 +14,7 @@
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
import org.xml.sax.EntityResolver;
import org.xml.sax.InputSource;
@@ -29,7 +30,7 @@
public static synchronized DocumentBuilder createDocumentBuilder(boolean validating) {
try {
return new DocumentBuilderCreator().createDocumentBuilder(validating);
- } catch (Exception t) {
+ } catch (InterruptedException t) {
KbPlugin.getPluginLog().logError("Cannot create document builder.", t);
return null;
}
@@ -39,10 +40,11 @@
boolean validate = false;
DocumentBuilder documentBuilder = null;
- public DocumentBuilder createDocumentBuilder(boolean validate) throws Exception {
+ public DocumentBuilder createDocumentBuilder(boolean validate) throws InterruptedException {
this.validate = validate;
setContextClassLoader(getClass().getClassLoader());
start();
+ // FIXME: Verify that we still need it
join();
return documentBuilder;
}
@@ -64,7 +66,7 @@
}
});
}
- } catch (Exception t) {
+ } catch (ParserConfigurationException t) {
KbPlugin.getPluginLog().logError("Document builder creation failed.", t);
}
}
Modified: trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbHtmlStore.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbHtmlStore.java 2008-08-28 15:51:57 UTC (rev 9944)
+++ trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbHtmlStore.java 2008-08-28 18:23:13 UTC (rev 9945)
@@ -11,6 +11,8 @@
package org.jboss.tools.common.kb;
import java.io.File;
+import java.io.IOException;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -18,11 +20,14 @@
import java.util.Map;
import java.util.StringTokenizer;
+import javax.xml.parsers.DocumentBuilder;
+
import org.jboss.tools.common.kb.configuration.KbConfigurationFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
/**
* @author eskimo
@@ -351,6 +356,8 @@
}
private synchronized boolean activateHtmlSchema() {
+ String ERR_CANNNOT_LOAD_SCHEME = "Can't load HTML schema ''{0}''"; //$NON-NLS-N$
+ String ERR_EXCEPTION_DURING_PARSING = "Exception happend during parsing ''{0}''"; //$NON-NLS-N$
if(htmlSchemaIsActivating()) {
return false;
}
@@ -361,16 +368,21 @@
File schemaLocation = new File(htmlSchemaLocation);
if((schemaLocation == null)||(!schemaLocation.exists())) {
- KbPlugin.getPluginLog().logError("Can't load HTML schema " + schemaLocation);
+ KbPlugin.getPluginLog().logError(MessageFormat.format(ERR_CANNNOT_LOAD_SCHEME, schemaLocation));
return false;
}
- try {
- htmlSchema = KbDocumentBuilderFactory.createDocumentBuilder(false).parse(new File(htmlSchemaLocation));
- } catch (Exception e) {
- KbPlugin.getPluginLog().logError(e);
- return false;
+ DocumentBuilder builder = KbDocumentBuilderFactory.createDocumentBuilder(false);
+ if(builder!=null) {
+ try {
+ htmlSchema = builder.parse(new File(htmlSchemaLocation));
+ } catch (SAXException e) {
+ KbPlugin.getPluginLog().logError(MessageFormat.format(ERR_EXCEPTION_DURING_PARSING, schemaLocation),e);
+ } catch (IOException e) {
+ KbPlugin.getPluginLog().logError(MessageFormat.format(ERR_EXCEPTION_DURING_PARSING, schemaLocation),e);
+ }
}
+
return true;
}
Modified: trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbQuery.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbQuery.java 2008-08-28 15:51:57 UTC (rev 9944)
+++ trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbQuery.java 2008-08-28 18:23:13 UTC (rev 9945)
@@ -159,7 +159,7 @@
if(++endCode<s.length()) {
result.append(s.substring(endCode));
}
- } catch(Exception e) {
+ } catch(NumberFormatException e) {
String message = "ERROR: can't decode string=" + s;
KbPlugin.getPluginLog().logError(message, e);
}
Modified: trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbTldConvertor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbTldConvertor.java 2008-08-28 15:51:57 UTC (rev 9944)
+++ trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbTldConvertor.java 2008-08-28 18:23:13 UTC (rev 9945)
@@ -21,6 +21,8 @@
import java.util.Properties;
import java.util.StringTokenizer;
+import javax.xml.parsers.DocumentBuilder;
+
import org.apache.xml.serialize.OutputFormat;
import org.apache.xml.serialize.XMLSerializer;
import org.w3c.dom.CDATASection;
@@ -29,6 +31,7 @@
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
/**
* Class helps to convert TLD to Schema
@@ -120,25 +123,31 @@
* @return
*/
public Document convertToSchema(InputStream inputStream, Properties attributes, boolean jsfTld) {
+
+ final String ERR_CANNOT_PARSE_TLD = "ERROR: Can't parse TLD file for converting to the Schema."; //$NON-NLS-N$
Document tldDocument = null;
+ Document schema = null;
+
try {
- tldDocument = KbDocumentBuilderFactory.createDocumentBuilder(false).parse(inputStream);
- } catch (Exception e) {
- String message = "ERROR: Can't parse TLD file for converting to the Schema.";
- KbPlugin.getPluginLog().logError(message, e);
- return null;
+ DocumentBuilder builder = KbDocumentBuilderFactory.createDocumentBuilder(false);
+ if(builder!=null) {
+ tldDocument = builder.parse(inputStream);
+ Element rootTldElement = tldDocument.getDocumentElement();
+
+ String prefix = getShortName(rootTldElement);
+ if((prefix!=null)&&(prefix.length()>0)) {
+ attributes.setProperty(SchemaNodeFactory.PREFIX_ATTRIBUTE, prefix);
+ }
+
+ schema = SchemaNodeFactory.getInstance().createSchemaDocument(attributes);
+ addElementTypes(rootTldElement, schema, jsfTld);
+ }
+ } catch (IOException e) {
+ KbPlugin.getPluginLog().logError(ERR_CANNOT_PARSE_TLD, e);
+ } catch (SAXException e) {
+ KbPlugin.getPluginLog().logError(ERR_CANNOT_PARSE_TLD, e);
}
-
- Element rootTldElement = tldDocument.getDocumentElement();
-
- String prefix = getShortName(rootTldElement);
- if((prefix!=null)&&(prefix.length()>0)) {
- attributes.setProperty(SchemaNodeFactory.PREFIX_ATTRIBUTE, prefix);
- }
-
- Document schema = SchemaNodeFactory.getInstance().createSchemaDocument(attributes);
- addElementTypes(rootTldElement, schema, jsfTld);
-
+
return schema;
}
Modified: trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbTldResource.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbTldResource.java 2008-08-28 15:51:57 UTC (rev 9944)
+++ trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbTldResource.java 2008-08-28 18:23:13 UTC (rev 9945)
@@ -14,8 +14,12 @@
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
import java.io.InputStream;
+import java.net.MalformedURLException;
import java.net.URL;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Iterator;
@@ -103,6 +107,7 @@
}
private InputStream getInputStreamFromTldLocation() {
+ final String ERR_TLD_FILE_DOSENT_EXIST = "ERROR: TLD file ''{0}'' doesn't exist!";
InputStream is = null;
if (tldLocation == null) {
return null;
@@ -135,12 +140,15 @@
}
}
*/
- } catch (Exception e) {
- if(KbPlugin.isDebugEnabled()) {
- String message = "ERROR: TLD file (" + tldLocation + ") doesn't exist!";
- KbPlugin.getPluginLog().logError(message, e);
+ } catch (MalformedURLException e) {
+ if(KbPlugin.isDebugEnabled()) {
+ KbPlugin.getPluginLog().logError(MessageFormat.format(ERR_TLD_FILE_DOSENT_EXIST, tldLocation), e);
}
- }
+ } catch (IOException e) {
+ if(KbPlugin.isDebugEnabled()) {
+ KbPlugin.getPluginLog().logError(MessageFormat.format(ERR_TLD_FILE_DOSENT_EXIST, tldLocation), e);
+ }
+ }
return is;
}
@@ -234,7 +242,7 @@
try {
File file = new File(tldLocation);
lastModifiedTld = file.lastModified();
- } catch(Exception e) {
+ } catch(SecurityException e) {
return false;
}
/*
Modified: trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbTldStore.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbTldStore.java 2008-08-28 15:51:57 UTC (rev 9944)
+++ trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbTldStore.java 2008-08-28 18:23:13 UTC (rev 9945)
@@ -25,6 +25,8 @@
import java.util.Map;
import java.util.Set;
+import javax.xml.parsers.DocumentBuilder;
+
import org.apache.xml.serialize.OutputFormat;
import org.apache.xml.serialize.XMLSerializer;
import org.eclipse.core.runtime.FileLocator;
@@ -42,6 +44,7 @@
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
/**
* Describes store whish contains all TLD schemas.
@@ -570,13 +573,19 @@
Document document = null;
try {
- document = KbDocumentBuilderFactory.createDocumentBuilder(false).parse(schemaLocation);
- } catch (Exception e) {
+ DocumentBuilder builder = KbDocumentBuilderFactory.createDocumentBuilder(false);
+ if(builder!=null) {
+ document = builder.parse(schemaLocation);
+ }
+ } catch (IOException e) {
KbPlugin.getPluginLog().logError(e);
- return;
+ } catch (SAXException e) {
+ KbPlugin.getPluginLog().logError(e);
}
-
- activeDocuments.put(regResource, document);
+
+ if(document!=null) {
+ activeDocuments.put(regResource, document);
+ }
}
private synchronized void activateResources(Collection resources) {
@@ -661,10 +670,18 @@
for(int i=0; i<schemas.length; i++) {
Document document = null;
try {
- document = KbDocumentBuilderFactory.createDocumentBuilder(false).parse(schemas[i]);
- } catch (Exception e) {
+ DocumentBuilder builder = KbDocumentBuilderFactory.createDocumentBuilder(false);
+ if(builder!=null) {
+ document = builder.parse(schemas[i]);
+ } else {
+ continue;
+ }
+ } catch (IOException e) {
KbPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, KbPlugin.PLUGIN_ID, IStatus.OK, "Can't parse Schema (location: " + schemas[i] + ")", e));
continue;
+ } catch (SAXException e) {
+ KbPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, KbPlugin.PLUGIN_ID, IStatus.OK, "Can't parse Schema (location: " + schemas[i] + ")", e));
+ continue;
}
// String tldLocation = schemas[i].getAbsolutePath();
String tldLocation = document.getDocumentElement().getAttribute(SchemaNodeFactory.LOCATION_ATTRIBUTE);
@@ -1076,7 +1093,7 @@
os.close();
// TransformerFactory.newInstance().newTransformer().transform(new DOMSource(document), new StreamResult(schemaFile));
- } catch (Exception e) {
+ } catch (IOException e) {
KbPlugin.getPluginLog().logError(e);
schemaFile.deleteOnExit();
loadingResources.remove(resource);
Modified: trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/SchemaNodeFactory.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/SchemaNodeFactory.java 2008-08-28 15:51:57 UTC (rev 9944)
+++ trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/SchemaNodeFactory.java 2008-08-28 18:23:13 UTC (rev 9945)
@@ -13,6 +13,8 @@
import java.util.Enumeration;
import java.util.Properties;
+import javax.xml.parsers.DocumentBuilder;
+
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -72,7 +74,16 @@
* @return
*/
public Document createSchemaDocument(Properties attributes) {
- Document document = KbDocumentBuilderFactory.createDocumentBuilder(false).newDocument();
+ Document document = createSchemaDocument(KbDocumentBuilderFactory.createDocumentBuilder(false),attributes);
+ return document;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public Document createSchemaDocument(DocumentBuilder builder, Properties attributes) {
+ Document document = builder.newDocument();
Element element = createDocumentElement(SCHEMA_NODE, document, new Properties());
initAttributes(element, attributes);
document.appendChild(element);
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/ObjectMultiPageEditor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/ObjectMultiPageEditor.java 2008-08-28 15:51:57 UTC (rev 9944)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/ObjectMultiPageEditor.java 2008-08-28 18:23:13 UTC (rev 9945)
@@ -377,8 +377,16 @@
Method m = AbstractTextEditor.class.getDeclaredMethod("performSave", new Class[]{boolean.class, IProgressMonitor.class});
m.setAccessible(true);
m.invoke(textEditor, new Object[]{Boolean.TRUE, monitor});
- } catch (Exception e) {
+ } catch (SecurityException e) {
ModelUIPlugin.getPluginLog().logError(e);
+ } catch (NoSuchMethodException e) {
+ ModelUIPlugin.getPluginLog().logError(e);
+ } catch (IllegalArgumentException e) {
+ ModelUIPlugin.getPluginLog().logError(e);
+ } catch (InvocationTargetException e) {
+ ModelUIPlugin.getPluginLog().logError(e);
+ } catch (IllegalAccessException e) {
+ ModelUIPlugin.getPluginLog().logError(e);
}
}
@@ -1096,11 +1104,7 @@
e.setInput(e2);
e.updateTitle();
if(e.textEditor instanceof AbstractTextEditor) {
- try {
- ((AbstractTextEditor)e.textEditor).setInput(e2);
- } catch (Exception exc) {
- ModelUIPlugin.getPluginLog().logError(exc);
- }
+ ((AbstractTextEditor)e.textEditor).setInput(e2);
((XModelObjectEditorInput)ei).synchronize();
if(((XModelObjectEditorInput)ei).getXModelObject() != o) {
closeEditor();
@@ -1348,8 +1352,12 @@
IActionDelegate delegate = null;
try {
delegate = (IActionDelegate)bundle.loadClass(actionClass).newInstance();
- } catch (Exception e) {
+ } catch (ClassNotFoundException e) {
//ignore
+ } catch (InstantiationException e) {
+ //ignore
+ } catch (IllegalAccessException e) {
+ //ignore
}
if(delegate == null) return;
delegate.selectionChanged(null, new StructuredSelection(resource));
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/TreeFormPage.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/TreeFormPage.java 2008-08-28 15:51:57 UTC (rev 9944)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/TreeFormPage.java 2008-08-28 18:23:13 UTC (rev 9945)
@@ -459,7 +459,7 @@
public void doOperation(int operation) {
if (operation>actionMapping.size()) {
- ModelUIPlugin.getPluginLog().logError(new RuntimeException("Can not find global action with index: "+operation));
+ ModelUIPlugin.getPluginLog().logError(new IllegalArgumentException("Can not find global action with index: "+operation));
} else {
String globalAction = (String)actionMapping.get(operation);
this.doGlobalAction(globalAction);
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/action/AbstractModelActionDelegate.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/action/AbstractModelActionDelegate.java 2008-08-28 15:51:57 UTC (rev 9944)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/action/AbstractModelActionDelegate.java 2008-08-28 18:23:13 UTC (rev 9945)
@@ -61,12 +61,12 @@
public void run(IAction action) {
try {
doRun();
- } catch (Exception e) {
+ } catch (XModelException e) {
ModelUIPlugin.getPluginLog().logError(e);
}
}
- protected abstract void doRun() throws Exception;
+ protected abstract void doRun() throws XModelException;
public void dispose() {}
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/MultiPageContributor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/MultiPageContributor.java 2008-08-28 15:51:57 UTC (rev 9944)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/MultiPageContributor.java 2008-08-28 18:23:13 UTC (rev 9945)
@@ -18,8 +18,6 @@
import org.eclipse.ui.texteditor.ITextEditor;
import org.eclipse.ui.texteditor.ITextEditorActionConstants;
import org.eclipse.wst.sse.ui.internal.actions.StructuredTextEditorActionConstants;
-
-import org.jboss.tools.common.model.ui.ModelUIPlugin;
import org.jboss.tools.common.text.xml.xpl.ToggleOccurencesMarkUpAction;
/**
@@ -80,12 +78,8 @@
actionBars.updateActionBars();
}
- try {
- fToggleOccurencesMarkUp.setEditor(getTextEditor(part));
- fToggleOccurencesMarkUp.update();
- } catch (Exception x) {
- ModelUIPlugin.getPluginLog().logError(x);
- }
+ fToggleOccurencesMarkUp.setEditor(getTextEditor(part));
+ fToggleOccurencesMarkUp.update();
updateStatus();
}
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/PropertiesTextEditorComponent.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/PropertiesTextEditorComponent.java 2008-08-28 15:51:57 UTC (rev 9944)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/PropertiesTextEditorComponent.java 2008-08-28 18:23:13 UTC (rev 9945)
@@ -14,10 +14,6 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.jboss.tools.common.editor.ObjectTextEditor;
-import org.jboss.tools.common.propertieseditor.text.*;
-import org.jboss.tools.common.model.ui.ModelUIPlugin;
-import org.jboss.tools.common.model.ui.texteditors.propertyeditor.PropertiesTextEditorStub;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.DocumentEvent;
import org.eclipse.jface.text.IDocument;
@@ -38,9 +34,12 @@
import org.eclipse.ui.texteditor.ResourceAction;
import org.eclipse.ui.texteditor.RevertToSavedAction;
import org.eclipse.ui.texteditor.SaveAction;
-
+import org.jboss.tools.common.editor.ObjectTextEditor;
import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.model.ui.ModelUIPlugin;
import org.jboss.tools.common.model.ui.editor.IModelObjectEditorInput;
+import org.jboss.tools.common.model.ui.texteditors.propertyeditor.PropertiesTextEditorStub;
+import org.jboss.tools.common.propertieseditor.text.PropertyTextEditorSupport;
/**
* @author Jeremy
@@ -93,11 +92,7 @@
String text = null;
if(getSourceViewer() == null) return null;
if(getSourceViewer().getDocument() == null) return null;
- try {
- text = getSourceViewer().getDocument().get();
- } catch (Exception ex) {
- ModelUIPlugin.getPluginLog().logError(ex);
- }
+ text = getSourceViewer().getDocument().get();
return (text == null) ? "" : text;
}
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/TextEditorComponent.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/TextEditorComponent.java 2008-08-28 15:51:57 UTC (rev 9944)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/TextEditorComponent.java 2008-08-28 18:23:13 UTC (rev 9945)
@@ -10,22 +10,45 @@
******************************************************************************/
package org.jboss.tools.common.model.ui.texteditors;
-import java.util.*;
-import org.eclipse.jface.preference.*;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.jdt.internal.ui.preferences.OverlayPreferenceStore;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.PreferenceConverter;
import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.text.*;
-import org.eclipse.jface.text.source.*;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.Document;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IDocumentPartitioner;
+import org.eclipse.jface.text.ITextListener;
+import org.eclipse.jface.text.TextEvent;
+import org.eclipse.jface.text.source.ISourceViewer;
+import org.eclipse.jface.text.source.SourceViewer;
+import org.eclipse.jface.text.source.SourceViewerConfiguration;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
+import org.eclipse.swt.custom.ST;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.texteditor.AbstractTextEditor;
-import org.eclipse.jface.action.*;
-import org.eclipse.ui.texteditor.*;
-import org.eclipse.jdt.internal.ui.preferences.OverlayPreferenceStore;
-import org.jboss.tools.common.model.*;
+import org.eclipse.ui.texteditor.IStatusField;
+import org.eclipse.ui.texteditor.ITextEditorActionConstants;
+import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
+import org.eclipse.ui.texteditor.ITextEditorExtension;
+import org.eclipse.ui.texteditor.TextNavigationAction;
+import org.jboss.tools.common.model.XModelException;
+import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.filesystems.impl.FileAnyImpl;
import org.jboss.tools.common.model.ui.ModelUIPlugin;
import org.jboss.tools.common.model.util.XModelObjectCache;
@@ -165,11 +188,7 @@
public String getText() {
String text = null;
- try {
- if (document != null) text = document.get();
- } catch (Exception ex) {
- ModelUIPlugin.getPluginLog().logError(ex);
- }
+ if (document != null) text = document.get();
return (text == null) ? "" : text;
}
@@ -183,7 +202,7 @@
try {
FileAnyImpl f = (FileAnyImpl)getModelObject();
if(f != null) f.edit(getText());
- } catch (Exception e) {
+ } catch (XModelException e) {
ModelUIPlugin.getPluginLog().logError(e);
} finally {
lock = false;
@@ -195,7 +214,7 @@
try {
int i = document.getLineOffset(line - 1) + position -1;
preview.setSelectedRange(i, 0);
- } catch (Exception e) {
+ } catch (BadLocationException e) {
//ignore
}
}
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/TextEditorSupport.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/TextEditorSupport.java 2008-08-28 15:51:57 UTC (rev 9944)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/TextEditorSupport.java 2008-08-28 18:23:13 UTC (rev 9945)
@@ -11,11 +11,14 @@
package org.jboss.tools.common.model.ui.texteditors;
import java.util.Properties;
-import org.jboss.tools.common.meta.action.*;
-import org.jboss.tools.common.model.*;
+
+import org.jboss.tools.common.meta.action.XAction;
+import org.jboss.tools.common.meta.action.XActionInvoker;
+import org.jboss.tools.common.model.XModelException;
+import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.filesystems.impl.FileAnyImpl;
import org.jboss.tools.common.model.ui.ModelUIPlugin;
-import org.jboss.tools.common.model.util.*;
+import org.jboss.tools.common.model.util.XModelObjectCache;
public class TextEditorSupport {
protected XModelObjectCache object = null;
@@ -55,11 +58,7 @@
protected String loadContent() {
XModelObject o = getModelObject();
- try {
- return ((FileAnyImpl)o).getAsText();
- } catch (Exception e) {
- return "";
- }
+ return ((FileAnyImpl)o).getAsText();
}
public void setModified(boolean set) {
@@ -87,7 +86,7 @@
try {
FileAnyImpl f = (FileAnyImpl)getModelObject();
if(f != null) f.edit(provider.getText());
- } catch (Exception e) {
+ } catch (XModelException e) {
ModelUIPlugin.getPluginLog().logError(e);
} finally {
lock--;
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/TextMerge.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/TextMerge.java 2008-08-28 15:51:57 UTC (rev 9944)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/TextMerge.java 2008-08-28 18:23:13 UTC (rev 9945)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.common.model.ui.texteditors;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
public class TextMerge {
@@ -45,7 +46,7 @@
}
try {
document.replace(b, e - b, text.substring(b, e2));
- } catch (Exception exc) {
+ } catch (BadLocationException exc) {
return false;
}
return true;
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/XMLTextEditorComponent.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/XMLTextEditorComponent.java 2008-08-28 15:51:57 UTC (rev 9944)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/XMLTextEditorComponent.java 2008-08-28 18:23:13 UTC (rev 9945)
@@ -21,9 +21,6 @@
import org.eclipse.core.resources.IResourceChangeListener;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.jboss.tools.common.editor.ObjectTextEditor;
-import org.jboss.tools.common.model.ui.ModelUIPlugin;
-import org.jboss.tools.common.model.ui.texteditors.xmleditor.XMLTextEditor;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.ITextSelection;
@@ -47,14 +44,17 @@
import org.eclipse.ui.texteditor.RevertToSavedAction;
import org.eclipse.ui.texteditor.SaveAction;
import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
+import org.jboss.tools.common.editor.ObjectTextEditor;
import org.jboss.tools.common.model.XModelException;
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.filesystems.impl.DiscardFileHandler;
import org.jboss.tools.common.model.filesystems.impl.FolderImpl;
import org.jboss.tools.common.model.filesystems.impl.FolderLoader;
import org.jboss.tools.common.model.plugin.ModelPlugin;
+import org.jboss.tools.common.model.ui.ModelUIPlugin;
+import org.jboss.tools.common.model.ui.editor.IModelObjectEditorInput;
+import org.jboss.tools.common.model.ui.texteditors.xmleditor.XMLTextEditor;
import org.jboss.tools.common.model.util.PositionSearcher;
-import org.jboss.tools.common.model.ui.editor.IModelObjectEditorInput;
public class XMLTextEditorComponent extends XMLTextEditor implements ObjectTextEditor, ITextProvider {
protected TextEditorSupport support = createSupport();
@@ -202,7 +202,7 @@
}
if(old.isModified()) try {
new DiscardFileHandler().executeHandler(old, new Properties());
- } catch (Exception e) {
+ } catch (XModelException e) {
//ignore
// ModelUIPlugin.log(e);
}
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/XMLTextEditorStandAlone.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/XMLTextEditorStandAlone.java 2008-08-28 15:51:57 UTC (rev 9944)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/XMLTextEditorStandAlone.java 2008-08-28 18:23:13 UTC (rev 9945)
@@ -11,19 +11,22 @@
package org.jboss.tools.common.model.ui.texteditors;
import org.eclipse.core.runtime.CoreException;
-import org.jboss.tools.common.core.resources.XModelObjectEditorInput;
-import org.jboss.tools.common.model.ui.ModelUIPlugin;
-import org.jboss.tools.common.model.util.XModelTreeListenerSWTSync;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.*;
-
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.PartInitException;
+import org.jboss.tools.common.core.resources.XModelObjectEditorInput;
import org.jboss.tools.common.meta.action.XAction;
import org.jboss.tools.common.meta.action.XActionInvoker;
+import org.jboss.tools.common.model.XModelException;
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.event.XModelTreeEvent;
import org.jboss.tools.common.model.event.XModelTreeListener;
import org.jboss.tools.common.model.filesystems.impl.FolderImpl;
+import org.jboss.tools.common.model.ui.ModelUIPlugin;
+import org.jboss.tools.common.model.util.XModelTreeListenerSWTSync;
public class XMLTextEditorStandAlone extends XMLTextEditorComponent implements XModelTreeListener {
protected XModelTreeListenerSWTSync syncListener = new XModelTreeListenerSWTSync(this);
@@ -67,7 +70,7 @@
} else if(o.getParent() instanceof FolderImpl) {
((FolderImpl)o.getParent()).discardChildFile(o);
}
- } catch (Exception e) {
+ } catch (XModelException e) {
//ignore
}
}
@@ -92,13 +95,9 @@
class U implements Runnable {
public void run() {
lock2 = true;
- try {
+ update0();
+ while(needsUpdate()) {
update0();
- while(needsUpdate()) {
- update0();
- }
- } catch (Exception t) {
- ModelUIPlugin.getPluginLog().logError("Error in updating editor", t);
}
lock2 = false;
}
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/dnd/TextEditorDrop.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/dnd/TextEditorDrop.java 2008-08-28 15:51:57 UTC (rev 9944)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/dnd/TextEditorDrop.java 2008-08-28 18:23:13 UTC (rev 9945)
@@ -73,45 +73,32 @@
}
private int getPosition(int x, int y) {
- try {
- ISourceViewer v = provider.getSourceViewer();
- StyledText t = v.getTextWidget();
- Point pp = t.toControl(x, y);
- x = pp.x;
- y = pp.y;
- int lineIndex = (t.getTopPixel() + y) / t.getLineHeight();
- if (lineIndex >= t.getLineCount()) {
- return t.getCharCount();
- } else {
- int c = 0;
- try {
- c = t.getOffsetAtLocation(new Point(x, y));
- if(c < 0) c = 0;
- } catch (Exception ex) {
- c = t.getOffsetAtLine(lineIndex + 1) -
- (t.getLineDelimiter() == null ? 0 : t.getLineDelimiter().length());
- }
- return c;
- }
- } catch (Exception e) {
- return 0;
+ ISourceViewer v = provider.getSourceViewer();
+ StyledText t = v.getTextWidget();
+ Point pp = t.toControl(x, y);
+ x = pp.x;
+ y = pp.y;
+ int lineIndex = (t.getTopPixel() + y) / t.getLineHeight();
+ if (lineIndex >= t.getLineCount()) {
+ return t.getCharCount();
+ } else {
+ int c = 0;
+ c = t.getOffsetAtLocation(new Point(x, y));
+ if(c < 0) c = 0;
+ return c;
}
}
public void drop(Properties p) {
- try {
- ISourceViewer v = provider.getSourceViewer();
- int x = ((Integer)p.get("drop.x")).intValue();
- int y = ((Integer)p.get("drop.y")).intValue();
- int c = getPosition(x, y);
- Point sp = v.getTextWidget().getSelectionRange();
- if(sp == null || c < sp.x || c >= sp.x + sp.y) {
- v.getTextWidget().setCaretOffset(c);
- }
- provider.insert(p);
- } catch (Exception e) {
- ModelUIPlugin.getPluginLog().logError(e);
+ ISourceViewer v = provider.getSourceViewer();
+ int x = ((Integer)p.get("drop.x")).intValue();
+ int y = ((Integer)p.get("drop.y")).intValue();
+ int c = getPosition(x, y);
+ Point sp = v.getTextWidget().getSelectionRange();
+ if(sp == null || c < sp.x || c >= sp.x + sp.y) {
+ v.getTextWidget().setCaretOffset(c);
}
+ provider.insert(p);
}
}
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 2008-08-28 15:51:57 UTC (rev 9944)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/preferences/EditorsPreferencesPage.java 2008-08-28 18:23:13 UTC (rev 9945)
@@ -33,16 +33,14 @@
private static XModel _getPreferenceModel() {
XModel model = ModelUtilities.getPreferenceModel();
- try {
- initialize();
- } catch (Exception t) {
- ModelUIPlugin.getPluginLog().logError("Error in initializing editors preference page", t);
- }
+ initialize();
return model;
}
protected static IPreferenceStore store;
+
+ // FIXME: Remove Reflection
private static void initialize() {
if(store != null) return;
AbstractUIPlugin plugin = (AbstractUIPlugin)Platform.getPlugin("org.jboss.tools.common.text.xml");
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/preferences/ReplaceTabsAdapter.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/preferences/ReplaceTabsAdapter.java 2008-08-28 15:51:57 UTC (rev 9944)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/preferences/ReplaceTabsAdapter.java 2008-08-28 18:23:13 UTC (rev 9945)
@@ -29,11 +29,7 @@
XModelObject o = (XModelObject)object;
if(!o.isActive()) return;
if(EditorsPreferencesPage.store == null) return;
- try {
- EditorsPreferencesPage.store.setValue(PROPERTY, "true".equals(value));
- } catch (Exception e) {
- ModelUIPlugin.getPluginLog().logError(e);
- }
+ EditorsPreferencesPage.store.setValue(PROPERTY, "true".equals(value));
}
}
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/xmleditor/XMLTextEditor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/xmleditor/XMLTextEditor.java 2008-08-28 15:51:57 UTC (rev 9944)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/xmleditor/XMLTextEditor.java 2008-08-28 18:23:13 UTC (rev 9945)
@@ -64,6 +64,7 @@
import org.jboss.tools.common.meta.action.XActionInvoker;
import org.jboss.tools.common.model.XModelBuffer;
+import org.jboss.tools.common.model.XModelException;
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.XModelTransferBuffer;
import org.jboss.tools.common.model.filesystems.impl.FileAnyImpl;
@@ -153,8 +154,7 @@
setModified(false);
getDocumentListenerRegister().unregister();
getDocumentListenerRegister().register();
- try {
- Object dtid =
+ Object dtid =
getSourceViewer().getTextWidget().getData("DropTarget");
if (dtid != null) {
if (dtid instanceof DropTarget) {
@@ -181,64 +181,50 @@
}
public void dragEnter(DropTargetEvent event) {
- try {
- getFreeCaretControl(
- event.widget).enableFreeCaret(
- true);
- } catch (Exception x) {
- //ignore
- }
- }
+ FreeCaretStyledText fcst =getFreeCaretControl(
+ event.widget);
+ if(fcst != null) {
+ fcst.enableFreeCaret(true);
+ }
+ }
public void dragLeave(DropTargetEvent event) {
- try {
- getFreeCaretControl(
- event.widget).enableFreeCaret(
- false);
- } catch (Exception x) {
- //ignore
- }
- }
+ FreeCaretStyledText fcst =getFreeCaretControl(
+ event.widget);
+ if(fcst != null) {
+ fcst.enableFreeCaret(false);
+ }
+ }
public void dragOperationChanged(DropTargetEvent event) {
- try {
- getFreeCaretControl(
- event.widget).enableFreeCaret(
- false);
- } catch (Exception x) {
- //ignore
- }
- }
+ FreeCaretStyledText fcst =getFreeCaretControl(
+ event.widget);
+ if(fcst != null) {
+ fcst.enableFreeCaret(false);
+ }
+ }
public void dragOver(DropTargetEvent event) {
- try {
FreeCaretStyledText fcst =
getFreeCaretControl(event.widget);
- int pos = getPosition(fcst, event.x, event.y);
- Point p = fcst.getLocationAtOffset(pos);
- fcst.myRedraw(p.x, p.y);
- } catch (Exception x) {
- //ignore
- }
+ if(fcst != null) {
+ int pos = getPosition(fcst, event.x, event.y);
+ Point p = fcst.getLocationAtOffset(pos);
+ fcst.myRedraw(p.x, p.y);
+ }
}
public void drop(DropTargetEvent event) {
- try {
- getFreeCaretControl(
- event.widget).enableFreeCaret(
- false);
- } catch (Exception x) {
- //ignore
- }
+ FreeCaretStyledText fcst =getFreeCaretControl(
+ event.widget);
+ if(fcst != null) {
+ fcst.enableFreeCaret(false);
+ }
}
});
}
}
- } catch (Exception x) {
- //ignore
- }
-
}
/*
@@ -291,7 +277,7 @@
try {
FileAnyImpl f = (FileAnyImpl)getModelObject();
if(f != null) f.edit(getSourceViewer().getDocument().get());
- } catch (Exception e) {
+ } catch (XModelException e) {
ModelUIPlugin.getPluginLog().logError(e);
} finally {
setModified(false);
@@ -323,11 +309,7 @@
super.doSetInput(input);
this.input = input;
if (input instanceof IModelObjectEditorInput){
- try {
- object = ((IModelObjectEditorInput)input).getXModelObject();
- } catch (Exception ex) {
- ModelUIPlugin.getPluginLog().logError("Error while getting model object from editor input", ex);
- }
+ object = ((IModelObjectEditorInput)input).getXModelObject();
}
if(getSourceViewer() != null && getSourceViewer().getDocument() != null) {
getDocumentListenerRegister().unregister();
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/views/palette/PaletteAdapter.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/views/palette/PaletteAdapter.java 2008-08-28 15:51:57 UTC (rev 9944)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/views/palette/PaletteAdapter.java 2008-08-28 18:23:13 UTC (rev 9945)
@@ -43,6 +43,7 @@
import org.eclipse.jface.action.IContributionItem;
import org.eclipse.jface.action.IMenuManager;
import org.jboss.tools.common.model.XModel;
+import org.jboss.tools.common.model.XModelException;
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.event.ActionDeclinedException;
import org.jboss.tools.common.model.event.XModelTreeEvent;
@@ -406,7 +407,7 @@
} catch (ActionDeclinedException de) {
//ignore - this exception is thrown to inform that user
//selected cancel option in dialog.
- } catch (Exception e) {
+ } catch (XModelException e) {
message(e);
}
} else {
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/views/palette/PaletteInsertHelper.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/views/palette/PaletteInsertHelper.java 2008-08-28 15:51:57 UTC (rev 9944)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/views/palette/PaletteInsertHelper.java 2008-08-28 18:23:13 UTC (rev 9945)
@@ -69,14 +69,10 @@
d.showDialog("Warning", mes, new String[]{"OK"}, null, ServiceDialog.WARNING);
return;
}
- try {
- IDocument doc = editor.getDocumentProvider().getDocument(editor.getEditorInput());
- ISelectionProvider selProvider = editor.getSelectionProvider();
- p.put(PROPOPERTY_SELECTION_PROVIDER, selProvider);
- insertIntoEditorInternal(doc, p);
- } catch (Exception x) {
- ModelUIPlugin.getPluginLog().logError(x);
- }
+ IDocument doc = editor.getDocumentProvider().getDocument(editor.getEditorInput());
+ ISelectionProvider selProvider = editor.getSelectionProvider();
+ p.put(PROPOPERTY_SELECTION_PROVIDER, selProvider);
+ insertIntoEditorInternal(doc, p);
}
static boolean isEditable(ITextEditor editor) {
@@ -96,59 +92,51 @@
}
public static void insertIntoEditor(ISourceViewer v, Properties p) {
- try {
- String tagname = p.getProperty(PROPOPERTY_TAG_NAME);
- String startText = p.getProperty(PROPOPERTY_START_TEXT);
- String endText = p.getProperty(PROPOPERTY_END_TEXT);
- String uri = p.getProperty(PROPOPERTY_TAGLIBRARY_URI);
+ String tagname = p.getProperty(PROPOPERTY_TAG_NAME);
+ String startText = p.getProperty(PROPOPERTY_START_TEXT);
+ String endText = p.getProperty(PROPOPERTY_END_TEXT);
+ String uri = p.getProperty(PROPOPERTY_TAGLIBRARY_URI);
- ISelectionProvider selProvider = (ISelectionProvider)p.get(PROPOPERTY_SELECTION_PROVIDER);
- if(selProvider == null) p.put(PROPOPERTY_SELECTION_PROVIDER, v.getSelectionProvider());
+ ISelectionProvider selProvider = (ISelectionProvider)p.get(PROPOPERTY_SELECTION_PROVIDER);
+ if(selProvider == null) p.put(PROPOPERTY_SELECTION_PROVIDER, v.getSelectionProvider());
- IDocument d = v.getDocument();
- String[] texts = new String[]{startText, endText};
+ IDocument d = v.getDocument();
+ String[] texts = new String[]{startText, endText};
- if(startText!=null && startText.startsWith("<%@ taglib")) {
- if(PaletteTaglibInserter.inserTaglibInXml(v, p)) {
- return;
- }
- } else {
- p = PaletteTaglibInserter.inserTaglib(v, p);
- }
+ if(startText!=null && startText.startsWith("<%@ taglib")) {
+ if(PaletteTaglibInserter.inserTaglibInXml(v, p)) {
+ return;
+ }
+ } else {
+ p = PaletteTaglibInserter.inserTaglib(v, p);
+ }
- String defaultPrefix = p.getProperty(PROPOPERTY_DEFAULT_PREFIX);
- applyPrefix(texts, d, tagname, uri, defaultPrefix);
- startText = texts[0];
- endText = texts[1];
+ String defaultPrefix = p.getProperty(PROPOPERTY_DEFAULT_PREFIX);
+ applyPrefix(texts, d, tagname, uri, defaultPrefix);
+ startText = texts[0];
+ endText = texts[1];
- if(startText != null) p.setProperty(PROPOPERTY_START_TEXT, startText);
- if(endText != null) p.setProperty(PROPOPERTY_END_TEXT, endText);
+ if(startText != null) p.setProperty(PROPOPERTY_START_TEXT, startText);
+ if(endText != null) p.setProperty(PROPOPERTY_END_TEXT, endText);
- try {
- if (v != null ) {
- IEditorPart activeEditor = ModelUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
- IDocument doc = v.getDocument();
- insertIntoEditorInternal(doc, p);
- /*
- * Leave as is
- */
- if(v instanceof IIgnoreSelection) {
- ((IIgnoreSelection)v).setIgnore(true);
- }
- if (activeEditor != null)
- activeEditor.getSite().getPage().activate(activeEditor);
- /*
- * Set Ignore false, to prevent focus losing.
- */
- if(v instanceof IIgnoreSelection) {
- ((IIgnoreSelection)v).setIgnore(false);
- }
- }
- } catch (Exception x) {
- ModelUIPlugin.getPluginLog().logError("Error while inserting text into editor", x);
- }
- } catch (Exception e) {
- ModelUIPlugin.getPluginLog().logError(e);
+ if (v != null ) {
+ IEditorPart activeEditor = ModelUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+ IDocument doc = v.getDocument();
+ insertIntoEditorInternal(doc, p);
+ /*
+ * Leave as is
+ */
+ if(v instanceof IIgnoreSelection) {
+ ((IIgnoreSelection)v).setIgnore(true);
+ }
+ if (activeEditor != null)
+ activeEditor.getSite().getPage().activate(activeEditor);
+ /*
+ * Set Ignore false, to prevent focus losing.
+ */
+ if(v instanceof IIgnoreSelection) {
+ ((IIgnoreSelection)v).setIgnore(false);
+ }
}
}
@@ -265,7 +253,7 @@
if (lineOffset + lineLength - offset - length == 0)
appendLastDelimiter = false;
- } catch (Exception ex) {
+ } catch (BadLocationException ex) {
ModelUIPlugin.getPluginLog().logError(ex);
}
@@ -343,12 +331,7 @@
}
private static int getTabWidth() {
- try {
- return Platform.getPreferencesService().getInt("org.eclipse.ui.editors", AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH, 4, new IScopeContext[]{new InstanceScope()});
- } catch (Exception e) {
- ModelUIPlugin.getPluginLog().logError(e);
- return 4;
- }
+ return Platform.getPreferencesService().getInt("org.eclipse.ui.editors", AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH, 4, new IScopeContext[]{new InstanceScope()});
}
private static boolean useSpaces() {
@@ -440,7 +423,7 @@
int line = d.getLineOfOffset(offset);
String lineText = d.get(d.getLineOffset(line), d.getLineLength(line));
return getIndentOfLine(lineText, getLineDelimiter(d));
- } catch (Exception ex) {
+ } catch (BadLocationException ex) {
ModelUIPlugin.getPluginLog().logError(ex);
}
return indent;
@@ -504,14 +487,10 @@
public static void applyPrefix(String[] text, ITextEditor editor, String tagname, String uri, String defaultPrefix) {
if(defaultPrefix == null || defaultPrefix.length() == 0) return;
IDocument doc = null;
- try {
- if(editor != null && editor.getDocumentProvider() != null) {
- doc = editor.getDocumentProvider().getDocument(editor.getEditorInput());
- }
- } catch (Exception x) {
- ModelUIPlugin.getPluginLog().logError(x);
- }
- applyPrefix(text, doc, tagname, uri, defaultPrefix);
+ if(editor != null && editor.getDocumentProvider() != null) {
+ doc = editor.getDocumentProvider().getDocument(editor.getEditorInput());
+ }
+ applyPrefix(text, doc, tagname, uri, defaultPrefix);
}
public static void applyPrefix(String[] text, IDocument doc, String tagname, String uri, String defaultPrefix) {
@@ -540,13 +519,9 @@
String uri = "";
String defaultPrefix = "";
String pr = "";
- try {
- uri = text.substring(i + 8, j1);
- defaultPrefix = text.substring(j1 + 1, j);
- pr = prefixes.getProperty(uri, defaultPrefix);
- } catch (Exception e) {
- ModelUIPlugin.getPluginLog().logError(e);
- }
+ uri = text.substring(i + 8, j1);
+ defaultPrefix = text.substring(j1 + 1, j);
+ pr = prefixes.getProperty(uri, defaultPrefix);
if(pr.length() > 0) {
text = text.substring(0, i) + pr + ":" + text.substring(j + 1);
} else {
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/views/palette/PaletteTaglibInserter.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/views/palette/PaletteTaglibInserter.java 2008-08-28 15:51:57 UTC (rev 9944)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/views/palette/PaletteTaglibInserter.java 2008-08-28 18:23:13 UTC (rev 9945)
@@ -14,6 +14,7 @@
import java.util.List;
import java.util.Properties;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.ITextSelection;
import org.eclipse.jface.text.source.ISourceViewer;
@@ -108,7 +109,7 @@
}
}
}
- } catch (Exception e) {
+ } catch (BadLocationException e) {
ModelUIPlugin.getPluginLog().logError(e);
} finally {
if (model != null) model.releaseFromRead();
@@ -200,8 +201,6 @@
checkTL(root, v, p, d);
return true;
}
- } catch (Exception e) {
- ModelUIPlugin.getPluginLog().logError(e);
} finally {
if (model != null) model.releaseFromRead();
}
@@ -282,7 +281,7 @@
}
selectedSource.insert(selectedSource.length()-1, attribute);
d.replace(so, seo-so, selectedSource.toString());
- } catch (Exception t) {
+ } catch (BadLocationException t) {
ModelUIPlugin.getPluginLog().logError("", t);
}
}
@@ -330,7 +329,7 @@
return st;
}
- private static boolean checkplace(IDOMDocument xmlDocument, IDocument d, String st, StringBuffer tg, Properties p, ISourceViewer v) throws Exception {
+ private static boolean checkplace(IDOMDocument xmlDocument, IDocument d, String st, StringBuffer tg, Properties p, ISourceViewer v) throws BadLocationException {
NodeList nl = xmlDocument.getChildNodes();
boolean docType = false;
IndexedRegion irdt = null;
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/views/palette/PaletteViewPart.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/views/palette/PaletteViewPart.java 2008-08-28 15:51:57 UTC (rev 9944)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/views/palette/PaletteViewPart.java 2008-08-28 18:23:13 UTC (rev 9945)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.common.model.ui.views.palette;
+import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Properties;
import org.eclipse.core.runtime.Platform;
@@ -37,6 +38,7 @@
import org.jboss.tools.jst.web.tld.URIConstants;
public class PaletteViewPart extends ViewPart implements IPartListener {
+
public static final String VIEW_ID = "org.jboss.tools.common.model.ui.views.palette.PaletteView";
public static final String PALETTE_GEF_ID = "org.jboss.tools.vpe.ui.palette";
@@ -68,8 +70,12 @@
Bundle b = Platform.getBundle(PALETTE_GEF_ID);
Class cls = b == null ? null : b.loadClass("org.jboss.tools.vpe.ui.palette.PaletteAdapter");
if(cls != null) return (IPaletteAdapter)cls.newInstance();
- } catch (Exception t) {
+ } catch (ClassNotFoundException t) {
//ignore
+ } catch (InstantiationException e) {
+ //ignore
+ } catch (IllegalAccessException e) {
+ //ignore
}
return new PaletteAdapter();
}
@@ -178,9 +184,15 @@
return true;
} catch (NoSuchMethodException ne) {
return false;
- } catch (Exception e) {
+ } catch (IllegalAccessException e) {
ModelUIPlugin.getPluginLog().logError(e);
return false;
+ } catch (IllegalArgumentException e) {
+ ModelUIPlugin.getPluginLog().logError(e);
+ return false;
+ } catch (InvocationTargetException e) {
+ ModelUIPlugin.getPluginLog().logError(e);
+ return false;
}
}
private boolean dropIntoEditor2(ITextEditor editor, XModelObject macro) {
@@ -200,6 +212,10 @@
return lastPart != null; //lastTextEditor != null;
}
+ // TODO: NLS support
+ private static final String ERROR_GETTING_ACTIVE_EDITOR = "Error while getting active text editor";
+
+ // FIXME: Rewrite without reflection
private ITextEditor getActiveTextEditor(IWorkbenchPart part) {
ITextEditor editor = null;
if (part instanceof EditorPartWrapper) {
@@ -215,8 +231,14 @@
if (o instanceof ITextEditor) {
editor = (ITextEditor)o;
}
- } catch (Exception t) {
- ModelUIPlugin.getPluginLog().logError("Error while getting active text editor", t);
+ } catch (NoSuchMethodException t) {
+ ModelUIPlugin.getPluginLog().logError(ERROR_GETTING_ACTIVE_EDITOR, t);
+ } catch (IllegalArgumentException t) {
+ ModelUIPlugin.getPluginLog().logError(ERROR_GETTING_ACTIVE_EDITOR, t);
+ } catch (IllegalAccessException t) {
+ ModelUIPlugin.getPluginLog().logError(ERROR_GETTING_ACTIVE_EDITOR, t);
+ } catch (InvocationTargetException t) {
+ ModelUIPlugin.getPluginLog().logError(ERROR_GETTING_ACTIVE_EDITOR, t);
}
}
return editor;
16 years, 6 months
JBoss Tools SVN: r9944 - trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template.
by jbosstools-commits@lists.jboss.org
Author: sdzmitrovich
Date: 2008-08-28 11:51:57 -0400 (Thu, 28 Aug 2008)
New Revision: 9944
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDropDownMenuTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesMenuGroupTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesMenuItemTemplate.java
Log:
correct errors
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDropDownMenuTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDropDownMenuTemplate.java 2008-08-28 15:07:29 UTC (rev 9943)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDropDownMenuTemplate.java 2008-08-28 15:51:57 UTC (rev 9944)
@@ -12,7 +12,6 @@
import java.util.ArrayList;
import java.util.List;
-import java.util.Map;
import org.jboss.tools.jsf.vpe.richfaces.ComponentUtil;
import org.jboss.tools.jsf.vpe.richfaces.HtmlComponentUtil;
@@ -21,7 +20,6 @@
import org.jboss.tools.vpe.editor.template.VpeAbstractTemplate;
import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
import org.jboss.tools.vpe.editor.template.VpeCreationData;
-import org.jboss.tools.vpe.editor.template.VpeMouseOverTemplate;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
import org.mozilla.interfaces.nsIDOMNode;
@@ -215,7 +213,7 @@
super.validate(pageContext, sourceNode, visualDocument, data);
List<nsIDOMElement> children = getChildren(storedVisualMenu);
- storedVisualMenu.setAttribute(VpeVisualDomBuilder.VPE_USER_MOUSE_OVER_ID, String.valueOf(ddmId));
+// storedVisualMenu.setAttribute(VpeVisualDomBuilder.VPE_USER_MOUSE_OVER_ID, String.valueOf(ddmId));
// applyAttributeValueOnChildren(VpeVisualDomBuilder.VPE_USER_MOUSE_OVER_ID, String.valueOf(ddmId), children);
// applyAttributeValueOnChildren(
// VpeVisualDomBuilder.VPE_USER_MOUSE_OVER_LOOKUP_PARENT,
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesMenuGroupTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesMenuGroupTemplate.java 2008-08-28 15:07:29 UTC (rev 9943)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesMenuGroupTemplate.java 2008-08-28 15:51:57 UTC (rev 9944)
@@ -19,7 +19,6 @@
import org.jboss.tools.vpe.editor.template.VpeAbstractTemplate;
import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
import org.jboss.tools.vpe.editor.template.VpeCreationData;
-import org.jboss.tools.vpe.editor.template.VpeMouseOverTemplate;
import org.jboss.tools.vpe.editor.util.VpeStyleUtil;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesMenuItemTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesMenuItemTemplate.java 2008-08-28 15:07:29 UTC (rev 9943)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesMenuItemTemplate.java 2008-08-28 15:51:57 UTC (rev 9944)
@@ -19,14 +19,13 @@
import org.jboss.tools.vpe.editor.template.VpeAbstractTemplate;
import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
import org.jboss.tools.vpe.editor.template.VpeCreationData;
-import org.jboss.tools.vpe.editor.template.VpeMouseOverTemplate;
import org.jboss.tools.vpe.editor.util.VpeStyleUtil;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
import org.mozilla.interfaces.nsIDOMText;
import org.w3c.dom.Attr;
-import org.w3c.dom.Node;
import org.w3c.dom.Element;
+import org.w3c.dom.Node;
public class RichFacesMenuItemTemplate extends VpeAbstractTemplate {
16 years, 6 months
JBoss Tools SVN: r9943 - trunk/vpe/plugins/org.jboss.tools.vpe.html/templates.
by jbosstools-commits@lists.jboss.org
Author: sdzmitrovich
Date: 2008-08-28 11:07:29 -0400 (Thu, 28 Aug 2008)
New Revision: 9943
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.html/templates/vpe-templates-html.xml
Log:
https://jira.jboss.org/jira/browse/JBIDE-1805
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.html/templates/vpe-templates-html.xml
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.html/templates/vpe-templates-html.xml 2008-08-28 15:03:13 UTC (rev 9942)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.html/templates/vpe-templates-html.xml 2008-08-28 15:07:29 UTC (rev 9943)
@@ -1201,11 +1201,7 @@
</vpe:template>
</vpe:if>
<vpe:if test="@type='hidden'">
- <vpe:template children="no" modify="no">
- <!--input type="text" value="{@value}" class="{@class}" size="{@size}" style="{@style}border-style:dotted;"/-->
- <!--span class="__input__tag" style="{@style}">
- <nobr><vpe:value expr="{@value}"/></nobr>
- </span-->
+ <vpe:template children="no" modify="no" invisible="yes" >
</vpe:template>
</vpe:if>
<vpe:if test="@type='image'">
16 years, 6 months
JBoss Tools SVN: r9942 - in trunk/jsf/plugins: org.jboss.tools.jsf.vpe.facelets/templates and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: sdzmitrovich
Date: 2008-08-28 11:03:13 -0400 (Thu, 28 Aug 2008)
New Revision: 9942
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.ajax4jsf/templates/vpe-templates-ajax4jsf.xml
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.facelets/templates/vpe-templates-facelets.xml
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/templates/vpe-templates-jsf.xml
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml
Log:
https://jira.jboss.org/jira/browse/JBIDE-1805
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.ajax4jsf/templates/vpe-templates-ajax4jsf.xml
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.ajax4jsf/templates/vpe-templates-ajax4jsf.xml 2008-08-28 14:57:25 UTC (rev 9941)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.ajax4jsf/templates/vpe-templates-ajax4jsf.xml 2008-08-28 15:03:13 UTC (rev 9942)
@@ -33,7 +33,7 @@
</vpe:tag>
<vpe:tag name="a4j:ajaxListener" case-sensitive="yes">
- <vpe:template children="no" modify="no">
+ <vpe:template children="no" modify="no" invisible="yes" >
</vpe:template>
</vpe:tag>
@@ -44,11 +44,11 @@
</vpe:tag>
<vpe:tag name="a4j:support" case-sensitive="yes">
- <vpe:template children="no" modify="no"/>
+ <vpe:template children="no" modify="no" invisible="yes" />
</vpe:tag>
<vpe:tag name="a4j:poll" case-sensitive="yes">
- <vpe:template children="no" modify="no">
+ <vpe:template children="no" modify="no" invisible="yes" >
</vpe:template>
</vpe:tag>
@@ -132,7 +132,7 @@
</vpe:tag>
<vpe:tag name="a4j:actionparam" case-sensitive="yes">
- <vpe:template children="no" modify="no">
+ <vpe:template children="no" modify="no" invisible="yes" >
</vpe:template>
</vpe:tag>
@@ -151,18 +151,18 @@
</vpe:tag>
<vpe:tag name="a4j:loadStyle" case-sensitive="yes">
- <vpe:template children="no" modify="no">
+ <vpe:template children="no" modify="no" invisible="yes" >
<vpe:link rel="stylesheet" href="{href(@src)}" />
</vpe:template>
</vpe:tag>
<vpe:tag name="a4j:loadScript" case-sensitive="yes">
- <vpe:template children="no" modify="no">
+ <vpe:template children="no" modify="no" invisible="yes" >
</vpe:template>
</vpe:tag>
<vpe:tag name="a4j:jsFunction" case-sensitive="yes">
- <vpe:template children="no" modify="no">
+ <vpe:template children="no" modify="no" invisible="yes">
</vpe:template>
</vpe:tag>
@@ -174,7 +174,7 @@
</vpe:tag>
<vpe:tag name="a4j:log" case-sensitive="yes">
- <vpe:template children="no" modify="no">
+ <vpe:template children="no" modify="no" invisible="yes">
</vpe:template>
</vpe:tag>
@@ -227,9 +227,7 @@
</vpe:tag>
<vpe:tag name="a4j:push" case-sensitive="yes">
- <vpe:template children="yes" modify="no">
- <span style="display:none">
- </span>
+ <vpe:template children="no" modify="no" invisible="yes" >
</vpe:template>
</vpe:tag>
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.facelets/templates/vpe-templates-facelets.xml
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.facelets/templates/vpe-templates-facelets.xml 2008-08-28 14:57:25 UTC (rev 9941)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.facelets/templates/vpe-templates-facelets.xml 2008-08-28 15:03:13 UTC (rev 9942)
@@ -56,7 +56,7 @@
</vpe:tag>
<vpe:tag name="ui:remove" case-sensitive="yes">
- <vpe:template children="no" modify="no"/>
+ <vpe:template children="no" modify="no" invisible="yes" />
</vpe:tag>
<vpe:tag name="ui:include" case-sensitive="yes">
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/templates/vpe-templates-jsf.xml
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/templates/vpe-templates-jsf.xml 2008-08-28 14:57:25 UTC (rev 9941)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/templates/vpe-templates-jsf.xml 2008-08-28 15:03:13 UTC (rev 9942)
@@ -629,7 +629,7 @@
<vpe:tag name="f:facet" case-sensitive="yes">
<vpe:if test="@name='popup'">
- <vpe:template children="yes" modify="yes"></vpe:template>
+ <vpe:template children="yes" modify="yes" invisible="yes" ></vpe:template>
</vpe:if>
<vpe:template children="yes" modify="yes" class="org.jboss.tools.jsf.vpe.jsf.template.JsfFacet" >
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml 2008-08-28 14:57:25 UTC (rev 9941)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml 2008-08-28 15:03:13 UTC (rev 9942)
@@ -210,8 +210,6 @@
<vpe:tag name="rich:modalPanel" case-sensitive="yes">
<vpe:template children="no" modify="yes" invisible="yes" >
- <div style="display:none">
- </div>
</vpe:template>
</vpe:tag>
@@ -490,23 +488,23 @@
</vpe:tag>
<vpe:tag name="rich:dndParam" case-sensitive="yes">
- <vpe:template children="no" modify="no"/>
+ <vpe:template children="no" modify="no" invisible="yes"/>
</vpe:tag>
<vpe:tag name="rich:dragIndicator" case-sensitive="yes">
- <vpe:template children="no" modify="no"/>
+ <vpe:template children="no" modify="no" invisible="yes" />
</vpe:tag>
<vpe:tag name="rich:dragSupport" case-sensitive="yes">
- <vpe:template children="no" modify="no"/>
+ <vpe:template children="no" modify="no" invisible="yes"/>
</vpe:tag>
<vpe:tag name="rich:dropSupport" case-sensitive="yes">
- <vpe:template children="no" modify="no"/>
+ <vpe:template children="no" modify="no" invisible="yes"/>
</vpe:tag>
- <vpe:tag name="rich:suggestionbox" case-sensitive="yes">
- <vpe:template children="no" modify="no"/>
+ <vpe:tag name="rich:suggestionbox" case-sensitive="yes" >
+ <vpe:template children="no" modify="no" invisible="yes"/>
</vpe:tag>
<vpe:tag name="rich:dropDownMenu" case-sensitive="yes" >
@@ -552,13 +550,12 @@
</vpe:tag>
<vpe:tag name="rich:menuSeparator" case-sensitive="yes" >
- <vpe:template children="no" modify="no">
+ <vpe:template children="no" modify="no" >
</vpe:template>
</vpe:tag>
- <vpe:tag name="rich:contextMenu" case-sensitive="yes">
- <vpe:template children="no" modify="no">
- <span style="display:none"></span>
+ <vpe:tag name="rich:contextMenu" case-sensitive="yes" >
+ <vpe:template children="no" modify="no" invisible="yes" >
</vpe:template>
</vpe:tag>
@@ -619,30 +616,22 @@
</vpe:tag>
<vpe:tag name="rich:toolTip" case-sensitive="yes">
- <vpe:template children="no" modify="yes">
- <span style="display:none">
- </span>
+ <vpe:template children="no" modify="yes" invisible="yes">
</vpe:template>
</vpe:tag>
<vpe:tag name="rich:effect" case-sensitive="yes">
- <vpe:template children="no" modify="yes">
- <span style="display:none">
- </span>
+ <vpe:template children="no" modify="yes" invisible="yes">
</vpe:template>
</vpe:tag>
<vpe:tag name="rich:jQuery" case-sensitive="yes">
- <vpe:template children="no" modify="yes">
- <span style="display:none">
- </span>
+ <vpe:template children="no" modify="yes" invisible="yes">
</vpe:template>
</vpe:tag>
<vpe:tag name="rich:componentControl" case-sensitive="yes">
- <vpe:template children="no" modify="yes">
- <span style="display:none">
- </span>
+ <vpe:template children="no" modify="yes" invisible="yes">
</vpe:template>
</vpe:tag>
@@ -657,30 +646,21 @@
</vpe:tag>
<vpe:tag name="rich:changeExpandListener" case-sensitive="yes">
- <vpe:template children="no" modify="yes">
- <span style="display:none">
- </span>
+ <vpe:template children="no" modify="yes" invisible="yes">
</vpe:template>
</vpe:tag>
<vpe:tag name="rich:nodeSelectListener" case-sensitive="yes">
- <vpe:template children="no" modify="yes">
- <span style="display:none">
- </span>
+ <vpe:template children="no" modify="yes" invisible="yes">
</vpe:template>
</vpe:tag>
<vpe:tag name="rich:dragListener" case-sensitive="yes">
- <vpe:template children="no" modify="yes">
- <span style="display:none">
- </span>
+ <vpe:template children="no" modify="yes" invisible="yes">
</vpe:template>
</vpe:tag>
-
<vpe:tag name="rich:dropListener" case-sensitive="yes">
- <vpe:template children="no" modify="yes">
- <span style="display:none">
- </span>
+ <vpe:template children="no" modify="yes" invisisble="yes">
</vpe:template>
</vpe:tag>
16 years, 6 months
JBoss Tools SVN: r9941 - in trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces: resources/menuGroup and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: dmaliarevich
Date: 2008-08-28 10:57:25 -0400 (Thu, 28 Aug 2008)
New Revision: 9941
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/menuGroup/
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/menuGroup/spacer.gif
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/menuItem/
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/menuItem/spacer.gif
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesMenuGroupTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesMenuItemTemplate.java
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDropDownMenuTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml
Log:
https://jira.jboss.org/jira/browse/JBIDE-2497,
templates for menuGroup and menuItem were added, dropDownMenu template was updated.
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/menuGroup/spacer.gif
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/menuGroup/spacer.gif
___________________________________________________________________
Name: svn:mime-type
+ image/gif
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/menuItem/spacer.gif
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/menuItem/spacer.gif
___________________________________________________________________
Name: svn:mime-type
+ image/gif
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDropDownMenuTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDropDownMenuTemplate.java 2008-08-28 12:28:20 UTC (rev 9940)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDropDownMenuTemplate.java 2008-08-28 14:57:25 UTC (rev 9941)
@@ -1,284 +1,317 @@
/*******************************************************************************
- * 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
- ******************************************************************************/
+ * Copyright (c) 2007-2008 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.jsf.vpe.richfaces.template;
+import java.util.ArrayList;
+import java.util.List;
import java.util.Map;
import org.jboss.tools.jsf.vpe.richfaces.ComponentUtil;
import org.jboss.tools.jsf.vpe.richfaces.HtmlComponentUtil;
+import org.jboss.tools.vpe.editor.VpeVisualDomBuilder;
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.jboss.tools.vpe.editor.template.VpeAbstractTemplate;
import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
import org.jboss.tools.vpe.editor.template.VpeCreationData;
+import org.jboss.tools.vpe.editor.template.VpeMouseOverTemplate;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
import org.mozilla.interfaces.nsIDOMNode;
import org.mozilla.interfaces.nsIDOMNodeList;
+import org.mozilla.interfaces.nsIDOMText;
import org.mozilla.xpcom.XPCOMException;
import org.w3c.dom.Attr;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
public class RichFacesDropDownMenuTemplate extends VpeAbstractTemplate {
- private static final String STYLECLASS_ATTR_NAME = "styleClass";
- private static final String STYLE_ATTR_NAME = "style";
- private static final String ITEMCLASS_ATTR_NAME = "itemClass";
- private static final String ITEMSTYLE_ATTR_NAME = "itemStyle";
- private static final String LABEL_FACET_NAME = "label";
+ /*
+ * rich:dropDownMenu constants
+ */
+ private static final String LABEL_FACET_NAME = "label"; //$NON-NLS-1$
+ private static final String EMPTY = ""; //$NON-NLS-1$
+ private static final String SPACE = " "; //$NON-NLS-1$
+
+ /*
+ * rich:dropDownMenu css styles names
+ */
+ private static final String CSS_RICH_DDMENU_LABEL = "rich-ddmenu-label"; //$NON-NLS-1$
+ private static final String CSS_RICH_DDMENU_LABEL_UNSELECT = "rich-ddmenu-label-unselect"; //$NON-NLS-1$
+ private static final String CSS_RICH_DDMENU_LABEL_SELECT = "rich-ddmenu-label-select"; //$NON-NLS-1$
+ private static final String CSS_RICH_DDMENU_LABEL_DISABLED = "rich-ddmenu-label-disabled"; //$NON-NLS-1$
+ private static final String CSS_RICH_LABEL_TEXT_DECOR = "rich-label-text-decor"; //$NON-NLS-1$
+ private static final String CSS_RICH_MENU_LIST_BORDER = "rich-menu-list-border"; //$NON-NLS-1$
+ private static final String CSS_RICH_MENU_LIST_BG = "rich-menu-list-bg"; //$NON-NLS-1$
+ private static final String CSS_RICH_DDEMENU_LIST_DIV_STYLE = "position: relative; z-index: 100;"; //$NON-NLS-1$
+ private static final String CSS_RICH_DDEMENU_BORDER_DIV_STYLE = "position: relative; z-index: 2;"; //$NON-NLS-1$
+ /*
+ * rich:dropDownMenu attributes names
+ */
+ private static final String DIRECTION = "direction"; //$NON-NLS-1$
+ private static final String HORIZONTAL_OFFCET = "horizontalOffset"; //$NON-NLS-1$
+ private static final String JOINT_POINT = "jontPoint"; //$NON-NLS-1$
+ private static final String POPUP_WIDTH = "popupWidth"; //$NON-NLS-1$
+ private static final String VERTICAL_OFFSET = "verticalOffset"; //$NON-NLS-1$
+
+ /*
+ * rich:menuGroup css styles and classes attributes names
+ */
+ private static final String DISABLED_ITEM_CLASS = "disabledItemClass"; //$NON-NLS-1$
+ private static final String DISABLED_ITEM_STYLE = "disabledItemStyle"; //$NON-NLS-1$
+ private static final String DISABLED_LABEL_CLASS = "disabledLabelClass"; //$NON-NLS-1$
+ private static final String ITEM_CLASS = "itemClass"; //$NON-NLS-1$
+ private static final String ITEM_STYLE = "itemStyle"; //$NON-NLS-1$
+ private static final String SELECED_LABEL_CLASS = "selectedLabelClass"; //$NON-NLS-1$
+ private static final String SELECT_ITEM_CLASS = "selectItemClass"; //$NON-NLS-1$
+
+ /*
+ * rich:dropDownMenu attributes
+ */
+ private String ddm_direction;
+ private String ddm_disabled;
+ private String ddm_horizontalOffset;
+ private String ddm_jointPoint;
+ private String ddm_popupWidth;
+ private String ddm_verticalOffset;
+ /*
+ * rich:dropDownMenu css styles and classes attributes
+ */
+ private String ddm_disabledItemClass;
+ private String ddm_disabledItemStyle;
+ private String ddm_disabledLabelClass;
+ private String ddm_itemClass;
+ private String ddm_itemStyle;
+ private String ddm_selectedLabelClass;
+ private String ddm_selectItemClass;
+ private String ddm_style;
+ private String ddm_styleClass;
+
+ private nsIDOMElement storedVisualMenu = null;
+ private int ddmId = 1;
+
public VpeCreationData create(VpePageContext pageContext, Node sourceNode, nsIDOMDocument visualDocument) {
- VpeCreationData creatorInfo = null;
-
+ VpeCreationData creationData = null;
Element sourceElement = (Element)sourceNode;
- nsIDOMElement visualMenu = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_DIV);
-
- ComponentUtil.setCSSLink(pageContext, "dropDownMenu/dropDownMenu.css", "richFacesDropDownMenu");
-
- correctAttribute(sourceElement, visualMenu,
- STYLECLASS_ATTR_NAME,
- HtmlComponentUtil.HTML_CLASS_ATTR,
- "dr-menu-label dr-menu-label-unselect rich-ddmenu-label rich-ddmenu-label-unselect",
- "dr-menu-label dr-menu-label-unselect rich-ddmenu-label rich-ddmenu-label-unselect");
- correctAttribute(sourceElement, visualMenu,
- STYLE_ATTR_NAME,
- HtmlComponentUtil.HTML_STYLE_ATTR, null, null);
-
- nsIDOMElement visualMenuLabel = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_DIV);
- visualMenuLabel.setAttribute("class", "dr-label-text-decor rich-label-text-decor");
- correctAttribute(sourceElement, visualMenuLabel,
- ITEMCLASS_ATTR_NAME,
- HtmlComponentUtil.HTML_CLASS_ATTR,
- "dr-label-text-decor rich-label-text-decor",
- "dr-label-text-decor rich-label-text-decor");
- correctAttribute(sourceElement, visualMenuLabel,
- ITEMSTYLE_ATTR_NAME,
- HtmlComponentUtil.HTML_STYLE_ATTR, null, null);
-
-
- visualMenu.appendChild(visualMenuLabel);
- creatorInfo = new VpeCreationData(visualMenu);
- VpeChildrenInfo childrenInfo = new VpeChildrenInfo(visualMenuLabel);
- Element facetElement = getLabelFacet(sourceElement);
+ readDropDownMenuAttributes(sourceElement);
+
+ /*
+ * DropDownMenu component structure.
+ * In order of nesting.
+ */
+ nsIDOMElement ddmLabelDiv;
+ nsIDOMElement ddmTextSpan;
+ nsIDOMText ddmLabelText;
+ nsIDOMElement ddmListDiv;
+ nsIDOMElement ddmListBorderDiv;
+ nsIDOMElement ddmListBgDiv;
+
+ /*
+ * Creating visual elements
+ */
+ ddmLabelDiv = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_DIV);
+ ddmTextSpan = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_SPAN);
+ ddmLabelText = visualDocument.createTextNode(""); //$NON-NLS-1$
+ ddmListDiv = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_DIV);
+ ddmListBorderDiv = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_DIV);
+ ddmListBgDiv = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_DIV);
+ creationData = new VpeCreationData(ddmLabelDiv);
+ storedVisualMenu = ddmLabelDiv;
+
+ /*
+ * Nesting elements
+ */
+ ddmLabelDiv.appendChild(ddmTextSpan);
+ ddmTextSpan.appendChild(ddmLabelText);
+ ddmLabelDiv.appendChild(ddmListDiv);
+ ddmListDiv.appendChild(ddmListBorderDiv);
+ ddmListBorderDiv.appendChild(ddmListBgDiv);
+
+ /*
+ * Setting css classes
+ */
+ String labelDivClass = EMPTY;
+ String listBorderDivClass = EMPTY;
- if (facetElement != null) {
- childrenInfo.addSourceChild(facetElement);
- } else {
- Attr ddmLabelFromAttribute = sourceElement.getAttributeNode("value");
- String valueForLabel = ddmLabelFromAttribute != null && ddmLabelFromAttribute.getValue() != null
- ? ddmLabelFromAttribute.getValue()
- : "";
- nsIDOMNode textLabel = visualDocument.createTextNode(valueForLabel);
- visualMenuLabel.appendChild(textLabel);
- }
-
- creatorInfo.addChildrenInfo(childrenInfo);
- visualMenu.appendChild(visualMenuLabel);
+ labelDivClass += SPACE + CSS_RICH_DDMENU_LABEL + SPACE + CSS_RICH_DDMENU_LABEL_UNSELECT;
+ listBorderDivClass += SPACE + CSS_RICH_MENU_LIST_BORDER;
- return creatorInfo;
- }
-
-
-
- private Element getLabelFacet(Element sourceElement) {
- if (sourceElement == null) {
- return null;
+ if (attrPresents(ddm_styleClass)) {
+ labelDivClass += SPACE + ddm_styleClass;
+ listBorderDivClass += SPACE + ddm_styleClass;
}
- NodeList children = sourceElement.getChildNodes();
- if (children != null) {
- int size = children.getLength();
- if (size > 0) {
- for (int i=0; i<size; i++) {
- Node child = children.item(i);
- if (child.getNodeType() == Node.ELEMENT_NODE
- && child.getNodeName().endsWith(":facet")) {
- Element facetElement = (Element)child;
- if (LABEL_FACET_NAME.equals(facetElement.getAttribute("name"))) {
- return facetElement;
- }
- }
- }
- }
+ ddmLabelDiv.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, labelDivClass);
+ ddmTextSpan.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, CSS_RICH_LABEL_TEXT_DECOR);
+ ddmListBorderDiv.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, listBorderDivClass);
+ ddmListBgDiv.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, CSS_RICH_MENU_LIST_BG);
+
+ /*
+ * Setting css styles
+ */
+ String cssLabelDivStyle = EMPTY;
+ String cssListBorderDivStyle = EMPTY;
+
+ cssLabelDivStyle += SPACE + CSS_RICH_DDEMENU_LIST_DIV_STYLE;
+ cssListBorderDivStyle += SPACE + CSS_RICH_DDEMENU_BORDER_DIV_STYLE;
+
+ ddmListDiv.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, cssLabelDivStyle);
+ ddmListBorderDiv.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, cssListBorderDivStyle);
+
+ /*
+ * Encoding label value
+ */
+ Element labelFacet = ComponentUtil.getFacet(sourceElement, LABEL_FACET_NAME);
+ if (null != labelFacet) {
+ VpeChildrenInfo childrenInfo = new VpeChildrenInfo(ddmTextSpan);
+ childrenInfo.addSourceChild(labelFacet);
+ creationData.addChildrenInfo(childrenInfo);
+ } else {
+ Attr valueAttr = sourceElement.getAttributeNode(HtmlComponentUtil.HTML_VALUE_ATTR);
+ String labelValue = valueAttr != null && valueAttr.getValue() != null
+ ? valueAttr.getValue()
+ : EMPTY;
+ ddmLabelText.setNodeValue(labelValue);
}
+
- return null;
- }
-
- private String getElementTextContent(Element element) {
- String content = null;
- NodeList children = element.getChildNodes();
- for (int i = 0; children != null && i < children.getLength(); i++) {
- String text = null;
- if (children.item(i).getNodeType() == Node.TEXT_NODE) {
- text = children.item(i).getNodeValue();
- } else if (children.item(i).getNodeType() == Node.ELEMENT_NODE) {
- text = getElementTextContent((Element)children.item(i));
+ /*
+ * Adding child nodes
+ */
+ List<Node> children = ComponentUtil.getChildren(sourceElement);
+ int groupCount = 1;
+ for (Node child : children) {
+ if (child.getNodeType() == Node.ELEMENT_NODE
+ && child.getNodeName().endsWith(":menuGroup")) { //$NON-NLS-1$
+ child.setUserData(RichFacesMenuGroupTemplate.MENU_GROUP_ID,
+ String.valueOf(groupCount), null);
+ groupCount++;
}
- if (text != null && text.trim().length() > 0) {
- if (content == null) {
- content = text;
- } else {
- content += " " + text;
- }
- }
+ nsIDOMElement childDiv = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_DIV);
+ ddmListBorderDiv.appendChild(childDiv);
+ VpeChildrenInfo childDivInfo = new VpeChildrenInfo(childDiv);
+ childDivInfo.addSourceChild(child);
+ creationData.addChildrenInfo(childDivInfo);
}
-
- return content;
+
+ return creationData;
}
-
- @Override
- public void removeAttribute(VpePageContext pageContext, Element sourceElement, nsIDOMDocument visualDocument, nsIDOMNode visualNode, Object data, String name) {
- processAttributeChanges(pageContext, sourceElement, visualDocument, visualNode, data, name);
- }
- @Override
- public void setAttribute(VpePageContext pageContext, Element sourceElement, nsIDOMDocument visualDocument, nsIDOMNode visualNode, Object data, String name, String value) {
- processAttributeChanges(pageContext, sourceElement, visualDocument, visualNode, data, name);
- }
+ @Override
+ public void validate(VpePageContext pageContext, Node sourceNode,
+ nsIDOMDocument visualDocument, VpeCreationData data) {
+ super.validate(pageContext, sourceNode, visualDocument, data);
+ List<nsIDOMElement> children = getChildren(storedVisualMenu);
+
+ storedVisualMenu.setAttribute(VpeVisualDomBuilder.VPE_USER_MOUSE_OVER_ID, String.valueOf(ddmId));
+// applyAttributeValueOnChildren(VpeVisualDomBuilder.VPE_USER_MOUSE_OVER_ID, String.valueOf(ddmId), children);
+// applyAttributeValueOnChildren(
+// VpeVisualDomBuilder.VPE_USER_MOUSE_OVER_LOOKUP_PARENT,
+// "true", children); //$NON-NLS-1$
+ }
- /**
- * Correct list style accordinly parameters
- *
- * @param pageContext
- * @param sourceElement
- * @param visualDocument
- * @param visualNode
- * @param data
- * @param name
- */
-
- private void processAttributeChanges(VpePageContext pageContext,
- Element sourceElement, nsIDOMDocument visualDocument, nsIDOMNode visualNode,
- Object data, String name) {
- nsIDOMElement el = (nsIDOMElement) visualNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
-
- if (STYLECLASS_ATTR_NAME.equals(name)) {
- if (el.getNodeName()
- .equalsIgnoreCase(HtmlComponentUtil.HTML_TAG_DIV)) {
- correctAttribute(sourceElement, el,
- STYLECLASS_ATTR_NAME,
- HtmlComponentUtil.HTML_CLASS_ATTR,
- "dr-menu-label dr-menu-label-unselect rich-ddmenu-label rich-ddmenu-label-unselect",
- "dr-menu-label dr-menu-label-unselect rich-ddmenu-label rich-ddmenu-label-unselect");
+ /**
+ * Sets the attribute to element children
+ * @param attrName attribute name
+ * @param attrValue attribute value
+ * @param children children
+ */
+ private void applyAttributeValueOnChildren(String attrName, String attrValue, List<nsIDOMElement> children) {
+ if (children == null || attrName == null || attrValue == null) {
+ return;
}
- } else if (STYLE_ATTR_NAME.equals(name)) {
- if (el.getNodeName()
- .equalsIgnoreCase(HtmlComponentUtil.HTML_TAG_DIV)) {
- correctAttribute(sourceElement, el,
- STYLE_ATTR_NAME,
- HtmlComponentUtil.HTML_STYLE_ATTR, null, null);
+ for (nsIDOMElement child : children) {
+ child.setAttribute(attrName, attrValue);
+ applyAttributeValueOnChildren(attrName, attrValue, getChildren(child));
}
- } else if (ITEMCLASS_ATTR_NAME.equals(name)) {
- nsIDOMNodeList nodeList = el.getChildNodes();
- nsIDOMNode temp = null;
- for (int i = 0; i < nodeList.getLength(); i++) {
- temp = nodeList.item(i);
- if ((temp instanceof Element)
- && (temp.getNodeName()
- .equalsIgnoreCase(HtmlComponentUtil.HTML_TAG_DIV))) {
- correctAttribute(sourceElement, (nsIDOMElement) temp.queryInterface(nsIDOMNode.NS_IDOMNODE_IID),
- ITEMCLASS_ATTR_NAME,
- HtmlComponentUtil.HTML_CLASS_ATTR,
- "dr-label-text-decor rich-label-text-decor",
- "dr-label-text-decor rich-label-text-decor");
+ }
+
+ /**
+ * Gets element children
+ * @param element the element
+ * @return children
+ */
+ private List<nsIDOMElement> getChildren(nsIDOMElement element) {
+ List<nsIDOMElement> result = new ArrayList<nsIDOMElement>();
+ if (element.hasChildNodes()) {
+ nsIDOMNodeList children = element.getChildNodes();
+ if (null != children) {
+ long len = children.getLength();
+ for (int i = 0; i < len; i++) {
+ nsIDOMNode item = children.item(i);
+ try {
+ nsIDOMElement elem = (nsIDOMElement) item
+ .queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+ result.add(elem);
+ } catch (XPCOMException ex) {
+ // just ignore this exception
+ }
+ }
}
}
- } else if (ITEMSTYLE_ATTR_NAME.equals(name)) {
- nsIDOMNodeList nodeList = el.getChildNodes();
- nsIDOMNode temp = null;
- for (int i = 0; i < nodeList.getLength(); i++) {
- temp = nodeList.item(i);
- if ((temp instanceof Element)
- && (temp.getNodeName()
- .equalsIgnoreCase(HtmlComponentUtil.HTML_TAG_DIV))) {
- correctAttribute(sourceElement, (nsIDOMElement) temp.queryInterface(nsIDOMNode.NS_IDOMNODE_IID),
- ITEMSTYLE_ATTR_NAME,
- HtmlComponentUtil.HTML_STYLE_ATTR, null, null);
- }
- }
+ return result;
}
- }
- /**
- * Move attributes from sourceNode to html
- *
- * @param sourceNode
- * @param visualElement
- * @param attrName
- * @param htmlAttrName
- * @param prefValue
- * @param defValue
- */
- private void correctAttribute(Element sourceNode, nsIDOMElement visualElement,
- String attrName, String htmlAttrName, String prefValue, String defValue) {
- String attrValue = ((Element) sourceNode).getAttribute(attrName);
- if (prefValue != null && prefValue.trim().length() > 0 && attrValue != null) {
- attrValue = prefValue.trim() + " " + attrValue;
+ /**
+ * Read attributes from the source element.
+ *
+ * @param sourceNode the source node
+ */
+ private void readDropDownMenuAttributes(Element sourceElement) {
+ if (null == sourceElement) {
+ return;
+ }
+
+ ddm_direction = sourceElement.getAttribute(DIRECTION);
+ ddm_disabled = sourceElement.getAttribute(HtmlComponentUtil.HTML_ATTR_DISABLED);
+ ddm_horizontalOffset = sourceElement.getAttribute(HORIZONTAL_OFFCET);
+ ddm_jointPoint = sourceElement.getAttribute(JOINT_POINT);
+ ddm_popupWidth = sourceElement.getAttribute(POPUP_WIDTH);
+ ddm_verticalOffset = sourceElement.getAttribute(VERTICAL_OFFSET);
+
+ ddm_disabledItemClass = sourceElement.getAttribute(DISABLED_ITEM_CLASS);
+ ddm_disabledItemStyle = sourceElement.getAttribute(DISABLED_ITEM_STYLE);
+ ddm_disabledLabelClass = sourceElement.getAttribute(DISABLED_LABEL_CLASS);
+ ddm_itemClass = sourceElement.getAttribute(ITEM_CLASS);
+ ddm_itemStyle = sourceElement.getAttribute(ITEM_STYLE);
+ ddm_selectedLabelClass = sourceElement.getAttribute(SELECED_LABEL_CLASS);
+ ddm_selectItemClass = sourceElement.getAttribute(SELECT_ITEM_CLASS);
+ ddm_style = sourceElement.getAttribute(HtmlComponentUtil.HTML_STYLE_ATTR);
+ ddm_styleClass = sourceElement.getAttribute(HtmlComponentUtil.HTML_STYLECLASS_ATTR);
}
- if (attrValue != null) {
- visualElement.setAttribute(htmlAttrName, attrValue);
- } else if (defValue != null) {
- visualElement.setAttribute(htmlAttrName, defValue);
- } else
- visualElement.removeAttribute(attrName);
- }
- /**
- * Is invoked after construction of all child nodes of the current visual
- * node.
- *
- * @param pageContext
- * Contains the information on edited page.
- * @param sourceNode
- * The current node of the source tree.
- * @param visualDocument
- * The document of the visual tree.
- * @param data
- * Object <code>VpeCreationData</code>, built by a method
- * <code>create</code>
- */
-
- @Override
- public void validate(VpePageContext pageContext, Node sourceNode,
- nsIDOMDocument visualDocument, VpeCreationData data) {
- super.validate(pageContext, sourceNode, visualDocument, data);
- correctLabelStyles(data.getNode());
- }
-
/**
- * Correct font for label
+ * Checks is attribute have some value.
*
- * @param node
+ * @param attr the attribute
+ *
+ * @return true, if successful
*/
- private void correctLabelStyles(nsIDOMNode node) {
+ private static boolean attrPresents(String attr) {
+ return ((null != attr) && (!EMPTY.equalsIgnoreCase(attr)));
+ }
+
+ public void onMouseOver(VpeVisualDomBuilder visualDomBuilder, Node sourceNode, String mouseOverId) {
+ // TODO Auto-generated method stub
+// visualDomBuilder.updateNode(sourceNode);
+ }
- try {
- nsIDOMElement element = (nsIDOMElement) node
- .queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
- if (node.getNodeName().equalsIgnoreCase(
- HtmlComponentUtil.HTML_TAG_SPAN)) {
- String styleClass = element.getAttribute(HtmlComponentUtil.HTML_CLASS_ATTR);
- styleClass = (styleClass==null?"":styleClass) + " dr-label-text-decor dr-menu-label";
- element.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, styleClass);
- }
- nsIDOMNodeList list = node.getChildNodes();
- for (int i = 0; i < list.getLength(); i++) {
- correctLabelStyles(list.item(i));
- }
- } catch (XPCOMException e) {
- return;
+ public void stopMouseOver(Node sourceNode) {
+ // TODO Auto-generated method stub
+
}
- }
+
+
}
\ No newline at end of file
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesMenuGroupTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesMenuGroupTemplate.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesMenuGroupTemplate.java 2008-08-28 14:57:25 UTC (rev 9941)
@@ -0,0 +1,286 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 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.jsf.vpe.richfaces.template;
+
+import java.util.List;
+
+import org.jboss.tools.jsf.vpe.richfaces.ComponentUtil;
+import org.jboss.tools.jsf.vpe.richfaces.HtmlComponentUtil;
+import org.jboss.tools.vpe.editor.VpeVisualDomBuilder;
+import org.jboss.tools.vpe.editor.context.VpePageContext;
+import org.jboss.tools.vpe.editor.template.VpeAbstractTemplate;
+import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
+import org.jboss.tools.vpe.editor.template.VpeCreationData;
+import org.jboss.tools.vpe.editor.template.VpeMouseOverTemplate;
+import org.jboss.tools.vpe.editor.util.VpeStyleUtil;
+import org.mozilla.interfaces.nsIDOMDocument;
+import org.mozilla.interfaces.nsIDOMElement;
+import org.mozilla.interfaces.nsIDOMText;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+public class RichFacesMenuGroupTemplate extends VpeAbstractTemplate {
+
+ /*
+ * rich:menuGroup constants
+ */
+ public static final String MENU_GROUP_ID = "MENU-GROUP-ID"; //$NON-NLS-1$
+ private static final String ICON_FACET_NAME = "icon"; //$NON-NLS-1$
+ private static final String ICON_DISABLED_FACET_NAME = "iconDisabled"; //$NON-NLS-1$
+ private static final String SPACER_IMG_PATH = "menuGroup/spacer.gif"; //$NON-NLS-1$
+ private static final String EMPTY = ""; //$NON-NLS-1$
+ private static final String SPACE = " "; //$NON-NLS-1$
+
+ /*
+ * rich:menuGroup css styles names
+ */
+ private static final String CSS_RICH_MENU_GROUP = "rich-menu-group"; //$NON-NLS-1$
+ private static final String CSS_RICH_MENU_GROUP_LABEL = "rich-menu-group-label"; //$NON-NLS-1$
+ private static final String CSS_RICH_MENU_GROUP_FOLDER = "rich-menu-group-folder"; //$NON-NLS-1$
+ private static final String CSS_RICH_MENU_GROUP_HOVER = "rich-menu-group-over"; //$NON-NLS-1$
+ private static final String CSS_RICH_MENU_ITEM_LABEL = "rich-menu-item-label"; //$NON-NLS-1$
+ private static final String CSS_RICH_MENU_ITEM_ICON = "rich-menu-item-icon"; //$NON-NLS-1$
+ private static final String CSS_RICH_MENU_ITEM_FOLDER = "rich-menu-item-folder"; //$NON-NLS-1$
+ private static final String CSS_RICH_MENU_ITEM_LABEL_DISABLED = "rich-menu-item-label-disabled"; //$NON-NLS-1$
+ private static final String CSS_RICH_MENU_ITEM_ICON_DISABLED = "rich-menu-item-icon-disabled"; //$NON-NLS-1$
+ private static final String CSS_RICH_MENU_ITEM_FOLDER_DISABLED = "rich-menu-item-folder-disabled"; //$NON-NLS-1$
+ private static final String CSS_RICH_MENU_ITEM_ICON_ENABLED = "rich-menu-item-icon-enabled"; //$NON-NLS-1$
+ private static final String CSS_RICH_MENU_ITEM_ICON_SELECTED = "rich-menu-item-icon-seleceted"; //$NON-NLS-1$
+ private static final String CSS_RICH_MENU_LIST_BORDER = "rich-menu-list-border"; //$NON-NLS-1$
+ private static final String CSS_RICH_MENU_LIST_BG = "rich-menu-list-bg"; //$NON-NLS-1$
+ private static final String CSS_RICH_LIST_FOLDER_DIV_STYLE = "position: relative; z-index: 100;"; //$NON-NLS-1$
+ private static final String CSS_RICH_LIST_BORDER_DIV_STYLE = "position: relative; z-index: 2;"; //$NON-NLS-1$
+
+ /*
+ * rich:menuGroup attributes names
+ */
+ private static final String DIRECTION = "direction"; //$NON-NLS-1$
+ private static final String ICON = "icon"; //$NON-NLS-1$
+ private static final String ICON_DISABLED = "iconDisabled"; //$NON-NLS-1$
+ private static final String ICON_FOLDER = "iconFolder"; //$NON-NLS-1$
+ private static final String ICON_FOLDER_DISABLED = "iconFolderDisabled"; //$NON-NLS-1$
+
+ /*
+ * rich:menuGroup css styles and classes attributes names
+ */
+ private static final String ICON_CLASS = "iconClass"; //$NON-NLS-1$
+ private static final String ICON_STYLE = "iconStyle"; //$NON-NLS-1$
+ private static final String LABEL_CLASS = "labelClass"; //$NON-NLS-1$
+ private static final String SELECT_CLASS = "selectClass"; //$NON-NLS-1$
+ private static final String SELECT_STYLE = "selectStyle"; //$NON-NLS-1$
+
+ /*
+ * rich:menuGroup attributes
+ */
+ private String mg_direction;
+ private String mg_disabled;
+ private String mg_icon;
+ private String mg_iconDisabled;
+ private String mg_iconFolder;
+ private String mg_iconFolderDisabled;
+ private String mg_value;
+
+ /*
+ * rich:menuGroup css styles and classes attributes
+ */
+ private String mg_iconClass;
+ private String mg_iconStyle;
+ private String mg_labelClass;
+ private String mg_selectClass;
+ private String mg_selectStyle;
+ private String mg_style;
+ private String mg_styleClass;
+
+ public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
+ nsIDOMDocument visualDocument) {
+ VpeCreationData creationData = null;
+ Element sourceElement = (Element)sourceNode;
+
+ /*
+ * MenuGroup component structure.
+ * In order of nesting.
+ */
+ nsIDOMElement grTopDiv;
+ nsIDOMElement grImgSpan;
+ nsIDOMElement grImg;
+ nsIDOMElement grLabelSpan;
+ nsIDOMText grLabelText;
+ nsIDOMElement grFolderDiv;
+ nsIDOMElement grListBorderDiv;
+ nsIDOMElement grListBgDiv;
+
+ /*
+ * Creating visual elements
+ */
+ grTopDiv = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_DIV);
+ grImgSpan = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_SPAN);
+ grImg = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_IMG);
+ grLabelSpan = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_SPAN);
+ grLabelText = visualDocument.createTextNode(EMPTY);
+ grFolderDiv = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_DIV);
+ grListBorderDiv = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_DIV);
+ grListBgDiv = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_DIV);
+ creationData = new VpeCreationData(grTopDiv);
+
+ /*
+ * Nesting elements
+ */
+ grTopDiv.appendChild(grImgSpan);
+ grTopDiv.appendChild(grLabelSpan);
+ grLabelSpan.appendChild(grLabelText);
+ grTopDiv.appendChild(grFolderDiv);
+ grFolderDiv.appendChild(grListBorderDiv);
+ grListBorderDiv.appendChild(grListBgDiv);
+
+ /*
+ * Setting css classes
+ */
+
+ String topDivClass = EMPTY;
+ String imgSpanClass = EMPTY;
+ String labelSpanClass = EMPTY;
+ String folderDivClass = EMPTY;
+
+ topDivClass += SPACE + CSS_RICH_MENU_GROUP;
+ imgSpanClass += SPACE + CSS_RICH_MENU_ITEM_ICON_ENABLED;
+ labelSpanClass += SPACE + CSS_RICH_MENU_ITEM_LABEL + SPACE + CSS_RICH_MENU_GROUP_LABEL;
+ folderDivClass += SPACE + CSS_RICH_MENU_ITEM_FOLDER + SPACE + CSS_RICH_MENU_GROUP_FOLDER;
+
+ if (attrPresents(mg_styleClass)) {
+ topDivClass += SPACE + mg_styleClass;
+ }
+ if (attrPresents(mg_iconClass)) {
+ imgSpanClass += SPACE + mg_iconClass;
+ folderDivClass += SPACE + mg_iconClass;
+ }
+ if (attrPresents(mg_labelClass)) {
+ labelSpanClass += SPACE + mg_labelClass;
+ }
+
+ grTopDiv.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, topDivClass);
+ grImgSpan.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, imgSpanClass);
+ grLabelSpan.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, labelSpanClass);
+ grFolderDiv.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, folderDivClass);
+ grListBorderDiv.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, CSS_RICH_MENU_LIST_BORDER);
+ grListBgDiv.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, CSS_RICH_MENU_LIST_BG);
+
+ /*
+ * Setting css styles
+ */
+ grFolderDiv.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, CSS_RICH_LIST_FOLDER_DIV_STYLE);
+ grListBorderDiv.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, CSS_RICH_LIST_BORDER_DIV_STYLE);
+
+ /*
+ * Encode label value
+ */
+ Attr valueAttr = sourceElement.getAttributeNode(HtmlComponentUtil.HTML_VALUE_ATTR);
+ String labelValue = valueAttr != null
+ && valueAttr.getValue() != null ? valueAttr.getValue() : EMPTY;
+ grLabelText.setNodeValue(labelValue);
+
+ /*
+ * Encode icon facets
+ */
+ Element iconFacet = ComponentUtil.getFacet(sourceElement, ICON_FACET_NAME);
+ Element iconDisabledFacet = ComponentUtil.getFacet(sourceElement, ICON_DISABLED_FACET_NAME);
+ if (null != iconFacet) {
+ VpeChildrenInfo childInfo = new VpeChildrenInfo(grImgSpan);
+ childInfo.addSourceChild(iconFacet);
+ creationData.addChildrenInfo(childInfo);
+ } else {
+ String iconPath = sourceElement.getAttribute(ICON);
+ if (attrPresents(iconPath)) {
+ /*
+ * Add path to specified image
+ */
+ String imgFullPath = VpeStyleUtil.addFullPathToImgSrc(iconPath, pageContext, true);
+ grImg.setAttribute(HtmlComponentUtil.HTML_ATR_SRC, imgFullPath);
+ } else {
+ /*
+ * Create spacer image
+ */
+ ComponentUtil.setImg(grImg, SPACER_IMG_PATH);
+ grImgSpan.appendChild(grImg);
+ }
+ }
+
+ String menuGroupId = (String) sourceNode.getUserData(MENU_GROUP_ID);
+ /*
+ * Adding child nodes
+ */
+ List<Node> children = ComponentUtil.getChildren(sourceElement);
+ for (Node child : children) {
+ nsIDOMElement childDiv = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_DIV);
+ grTopDiv.appendChild(childDiv);
+ VpeChildrenInfo childDivInfo = new VpeChildrenInfo(childDiv);
+ childDivInfo.addSourceChild(child);
+ creationData.addChildrenInfo(childDivInfo);
+ }
+
+ return creationData;
+ }
+
+ /**
+ * Read attributes from the source element.
+ *
+ * @param sourceNode the source node
+ */
+ private void readMenuGroupAttributes(Element sourceElement) {
+ if (null == sourceElement) {
+ return;
+ }
+ mg_direction = sourceElement.getAttribute(DIRECTION);
+ mg_disabled = sourceElement.getAttribute(HtmlComponentUtil.HTML_ATTR_DISABLED);
+ mg_icon = sourceElement.getAttribute(ICON);
+ mg_iconDisabled = sourceElement.getAttribute(ICON_DISABLED);
+ mg_iconFolder = sourceElement.getAttribute(ICON_FOLDER);
+ mg_iconFolderDisabled = sourceElement.getAttribute(ICON_FOLDER_DISABLED);
+ mg_value = sourceElement.getAttribute(HtmlComponentUtil.HTML_VALUE_ATTR);
+
+ mg_iconClass = sourceElement.getAttribute(ICON_CLASS);
+ mg_iconStyle = sourceElement.getAttribute(ICON_STYLE);
+ mg_labelClass = sourceElement.getAttribute(LABEL_CLASS);
+ mg_selectClass = sourceElement.getAttribute(SELECT_CLASS);
+ mg_selectStyle = sourceElement.getAttribute(SELECT_STYLE);
+ mg_style = sourceElement.getAttribute(HtmlComponentUtil.HTML_STYLE_ATTR);
+ mg_styleClass = sourceElement.getAttribute(HtmlComponentUtil.HTML_STYLECLASS_ATTR);
+ }
+ /**
+ * Checks is attribute have some value.
+ *
+ * @param attr the attribute
+ *
+ * @return true, if successful
+ */
+ private static boolean attrPresents(String attr) {
+ return ((null != attr) && (!EMPTY.equalsIgnoreCase(attr)));
+ }
+
+ @Override
+ public boolean isRecreateAtAttrChange(VpePageContext pageContext,
+ Element sourceElement, nsIDOMDocument visualDocument,
+ nsIDOMElement visualNode, Object data, String name, String value) {
+ return true;
+ }
+
+ public void onMouseOver(VpeVisualDomBuilder visualDomBuilder, Node sourceNode, String mouseOverId) {
+ // TODO Auto-generated method stub
+// visualDomBuilder.updateNode(sourceNode);
+ }
+
+ public void stopMouseOver(Node sourceNode) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesMenuGroupTemplate.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesMenuItemTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesMenuItemTemplate.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesMenuItemTemplate.java 2008-08-28 14:57:25 UTC (rev 9941)
@@ -0,0 +1,252 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 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.jsf.vpe.richfaces.template;
+
+import java.util.List;
+
+import org.jboss.tools.jsf.vpe.richfaces.ComponentUtil;
+import org.jboss.tools.jsf.vpe.richfaces.HtmlComponentUtil;
+import org.jboss.tools.vpe.editor.VpeVisualDomBuilder;
+import org.jboss.tools.vpe.editor.context.VpePageContext;
+import org.jboss.tools.vpe.editor.template.VpeAbstractTemplate;
+import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
+import org.jboss.tools.vpe.editor.template.VpeCreationData;
+import org.jboss.tools.vpe.editor.template.VpeMouseOverTemplate;
+import org.jboss.tools.vpe.editor.util.VpeStyleUtil;
+import org.mozilla.interfaces.nsIDOMDocument;
+import org.mozilla.interfaces.nsIDOMElement;
+import org.mozilla.interfaces.nsIDOMText;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Node;
+import org.w3c.dom.Element;
+
+public class RichFacesMenuItemTemplate extends VpeAbstractTemplate {
+
+ /*
+ * rich:menuItem constants
+ */
+ private static final String ICON_FACET_NAME = "icon"; //$NON-NLS-1$
+ private static final String ICON_DISABLED_FACET_NAME = "iconDisabled"; //$NON-NLS-1$
+ private static final String SPACER_IMG_PATH = "menuItem/spacer.gif"; //$NON-NLS-1$
+ private static final String EMPTY = ""; //$NON-NLS-1$
+ private static final String SPACE = " "; //$NON-NLS-1$
+
+ /*
+ * rich:menuItem css styles names
+ */
+ private static final String CSS_RICH_MENU_ITEM = "rich-menu-item"; //$NON-NLS-1$
+ private static final String CSS_RICH_MENU_ITEM_LABEL = "rich-menu-item-label"; //$NON-NLS-1$
+ private static final String CSS_RICH_MENU_ITEM_ICON = "rich-menu-item-item"; //$NON-NLS-1$
+ private static final String CSS_RICH_MENU_ITEM_DISABLED = "rich-menu-item-disabled"; //$NON-NLS-1$
+ private static final String CSS_RICH_MENU_ITEM_ENABLED = "rich-menu-item-enabled"; //$NON-NLS-1$
+ private static final String CSS_RICH_MENU_ITEM_HOVER = "rich-menu-item-hover"; //$NON-NLS-1$
+ private static final String CSS_RICH_MENU_ITEM_LABEL_DISBLED = "rich-menu-item-label-disabled"; //$NON-NLS-1$
+ private static final String CSS_RICH_MENU_ITEM_ICON_DISABLED = "rich-menu-item-icon-disabled"; //$NON-NLS-1$
+ private static final String CSS_RICH_MENU_ITEM_LABEL_ENABLED = "rich-menu-item-label-enabled"; //$NON-NLS-1$
+ private static final String CSS_RICH_MENU_ITEM_ICON_ENABLED = "rich-menu-item-icon-enabled"; //$NON-NLS-1$
+ private static final String CSS_RICH_MENU_ITEM_LABEL_SELECTED = "rich-menu-item-label-selected"; //$NON-NLS-1$
+ private static final String CSS_RICH_MENU_ITEM_ICON_SELECTED = "rich-menu-item-icon-selected"; //$NON-NLS-1$
+
+ /*
+ * rich:menuItem attributes names
+ */
+ private static final String ICON = "icon"; //$NON-NLS-1$
+
+ /*
+ * rich:menuItem css styles and classes attributes names
+ */
+ private static final String ICON_CLASS = "iconClass"; //$NON-NLS-1$
+ private static final String ICON_DISABLED = "iconDisabled"; //$NON-NLS-1$
+ private static final String ICON_STYLE = "iconStyle"; //$NON-NLS-1$
+ private static final String LABEL_CLASS = "labelClass"; //$NON-NLS-1$
+ private static final String SELECT_STYLE = "selectStyle"; //$NON-NLS-1$
+ private static final String SELECT_CLASS = "selectClass"; //$NON-NLS-1$
+
+ /*
+ * rich:menuItem attributes
+ */
+ private String mi_disabled;
+ private String mi_icon;
+ private String mi_value;
+
+ /*
+ * rich:menuItem css styles and classes attributes
+ */
+ private String mi_iconClass;
+ private String mi_iconDisabled;
+ private String mi_iconStyle;
+ private String mi_labelClass;
+ private String mi_selectClass;
+ private String mi_selectStyle;
+ private String mi_style;
+ private String mi_styleClass;
+
+ public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
+ nsIDOMDocument visualDocument) {
+ VpeCreationData creationData = null;
+ Element sourceElement = (Element)sourceNode;
+
+ readMenuItemAttributes(sourceElement);
+
+ /*
+ * MenuItem component structure.
+ * In order of nesting.
+ */
+ nsIDOMElement itemTopDiv;
+ nsIDOMElement itemIconImgSpan;
+ nsIDOMElement itemIconImg;
+ nsIDOMElement itemLabelSpan;
+ nsIDOMText itemLabelText;
+
+ /*
+ * Creating visual elements
+ */
+ itemTopDiv = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_DIV);
+ itemIconImgSpan = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_SPAN);
+ itemIconImg = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_IMG);
+ itemLabelSpan = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_SPAN);
+ itemLabelText = visualDocument.createTextNode(""); //$NON-NLS-1$
+ creationData = new VpeCreationData(itemTopDiv);
+
+ /*
+ * Nesting elements
+ */
+ itemTopDiv.appendChild(itemIconImgSpan);
+ itemTopDiv.appendChild(itemLabelSpan);
+ itemLabelSpan.appendChild(itemLabelText);
+
+ /*
+ * Setting css classes
+ */
+ String topDivClass = EMPTY;
+ String iconImgSpanClass = EMPTY;
+ String labelSpanClass = EMPTY;
+
+ topDivClass += SPACE + CSS_RICH_MENU_ITEM;
+ iconImgSpanClass += SPACE + CSS_RICH_MENU_ITEM_ICON;
+ labelSpanClass += SPACE + CSS_RICH_MENU_ITEM_LABEL;
+
+ if (attrPresents(mi_styleClass)) {
+ topDivClass += SPACE + mi_styleClass;
+ }
+ if (attrPresents(mi_iconClass)) {
+ iconImgSpanClass += SPACE + mi_iconClass;
+ }
+ if (attrPresents(mi_labelClass)) {
+ labelSpanClass += SPACE + mi_labelClass;
+ }
+
+ itemTopDiv.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, topDivClass);
+ itemIconImgSpan.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, iconImgSpanClass);
+ itemLabelSpan.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, labelSpanClass);
+
+ /*
+ * Encode label and icon value
+ */
+ Attr valueAttr = sourceElement.getAttributeNode(HtmlComponentUtil.HTML_VALUE_ATTR);
+ String labelValue = valueAttr != null
+ && valueAttr.getValue() != null ? valueAttr.getValue() : ""; //$NON-NLS-1$
+ itemLabelText.setNodeValue(labelValue);
+
+ /*
+ * Encode icon facets
+ */
+ Element iconFacet = ComponentUtil.getFacet(sourceElement, ICON_FACET_NAME);
+ Element iconDisabledFacet = ComponentUtil.getFacet(sourceElement, ICON_DISABLED_FACET_NAME);
+ if (null != iconFacet) {
+ VpeChildrenInfo childInfo = new VpeChildrenInfo(itemIconImgSpan);
+ childInfo.addSourceChild(iconFacet);
+ creationData.addChildrenInfo(childInfo);
+ } else {
+ String iconPath = sourceElement.getAttribute(ICON);
+ if (attrPresents(iconPath)) {
+ /*
+ * Add path to specified image
+ */
+ String imgFullPath = VpeStyleUtil.addFullPathToImgSrc(iconPath, pageContext, true);
+ itemIconImg.setAttribute(HtmlComponentUtil.HTML_ATR_SRC, imgFullPath);
+ } else {
+ /*
+ * Create spacer image
+ */
+ ComponentUtil.setImg(itemIconImg, SPACER_IMG_PATH);
+ }
+ /*
+ * Add image to span
+ */
+ itemIconImgSpan.appendChild(itemIconImg);
+ }
+
+ /*
+ * Adding child nodes
+ */
+ List<Node> children = ComponentUtil.getChildren(sourceElement);
+ for (Node child : children) {
+ VpeChildrenInfo childInfo = new VpeChildrenInfo(itemLabelSpan);
+ childInfo.addSourceChild(child);
+ creationData.addChildrenInfo(childInfo);
+ }
+
+ return creationData;
+ }
+
+
+ /**
+ * Read attributes from the source element.
+ *
+ * @param sourceNode the source node
+ */
+ private void readMenuItemAttributes(Element sourceElement) {
+ if (null == sourceElement) {
+ return;
+ }
+ mi_disabled = sourceElement.getAttribute(HtmlComponentUtil.HTML_ATTR_DISABLED);
+ mi_icon = sourceElement.getAttribute(ICON);
+ mi_value = sourceElement.getAttribute(HtmlComponentUtil.HTML_VALUE_ATTR);
+
+ mi_iconClass = sourceElement.getAttribute(ICON_CLASS);
+ mi_iconDisabled = sourceElement.getAttribute(ICON_DISABLED);
+ mi_iconStyle = sourceElement.getAttribute(ICON_STYLE);
+ mi_labelClass = sourceElement.getAttribute(LABEL_CLASS);
+ mi_selectClass = sourceElement.getAttribute(SELECT_CLASS);
+ mi_selectStyle = sourceElement.getAttribute(SELECT_STYLE);
+ mi_style = sourceElement.getAttribute(HtmlComponentUtil.HTML_STYLE_ATTR);
+ mi_styleClass = sourceElement.getAttribute(HtmlComponentUtil.HTML_STYLECLASS_ATTR);
+ }
+
+ /**
+ * Checks is attribute have some value.
+ *
+ * @param attr the attribute
+ *
+ * @return true, if successful
+ */
+ private static boolean attrPresents(String attr) {
+ return ((null != attr) && (!EMPTY.equalsIgnoreCase(attr)));
+ }
+
+ @Override
+ public boolean isRecreateAtAttrChange(VpePageContext pageContext,
+ Element sourceElement, nsIDOMDocument visualDocument,
+ nsIDOMElement visualNode, Object data, String name, String value) {
+ return true;
+ }
+
+ public void onMouseOver(VpeVisualDomBuilder visualDomBuilder, Node sourceNode, String mouseOverId) {
+ // TODO Auto-generated method stub
+// visualDomBuilder.updateNode(sourceNode);
+ }
+
+ public void stopMouseOver(Node sourceNode) {
+ // TODO Auto-generated method stub
+
+ }
+}
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesMenuItemTemplate.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml 2008-08-28 12:28:20 UTC (rev 9940)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml 2008-08-28 14:57:25 UTC (rev 9941)
@@ -524,12 +524,30 @@
</vpe:tag>
<vpe:tag name="rich:menuItem" case-sensitive="yes" >
- <vpe:template children="no" modify="no">
+ <vpe:template class="org.jboss.tools.jsf.vpe.richfaces.template.RichFacesMenuItemTemplate"
+ children="yes" modify="no">
+ <vpe:resize>
+ <vpe:width width-attr="style.width" />
+ <vpe:height height-attr="style.height" />
+ </vpe:resize>
+ <vpe:dnd>
+ <vpe:drag start-enable="yes"/>
+ <vpe:drop container="no"/>
+ </vpe:dnd>
</vpe:template>
</vpe:tag>
<vpe:tag name="rich:menuGroup" case-sensitive="yes" >
- <vpe:template children="no" modify="no">
+ <vpe:template class="org.jboss.tools.jsf.vpe.richfaces.template.RichFacesMenuGroupTemplate"
+ children="yes" modify="no">
+ <vpe:resize>
+ <vpe:width width-attr="style.width" />
+ <vpe:height height-attr="style.height" />
+ </vpe:resize>
+ <vpe:dnd>
+ <vpe:drag start-enable="yes"/>
+ <vpe:drop container="no"/>
+ </vpe:dnd>
</vpe:template>
</vpe:tag>
16 years, 6 months