diff options
author | tle | 2011-05-12 15:15:13 +0000 |
---|---|---|
committer | tle | 2011-05-12 15:15:13 +0000 |
commit | 60a04a48ed56a69ea9101bd247ee48d9ff6e1a89 (patch) | |
tree | 08ba618103b4ca29ac0d937e6f88978416774841 /jpa_diagram_editor/plugins | |
parent | 9bea9f1317b2e17a9f304cbb2763e039edc5406a (diff) | |
download | webtools.dali-60a04a48ed56a69ea9101bd247ee48d9ff6e1a89.tar.gz webtools.dali-60a04a48ed56a69ea9101bd247ee48d9ff6e1a89.tar.xz webtools.dali-60a04a48ed56a69ea9101bd247ee48d9ff6e1a89.zip |
338960 - Diagram Editor needs to log error messages - jpae patch
Diffstat (limited to 'jpa_diagram_editor/plugins')
21 files changed, 132 insertions, 160 deletions
diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/JPADiagramEditor.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/JPADiagramEditor.java index 8998a4b976..04ef018a38 100644 --- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/JPADiagramEditor.java +++ b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/JPADiagramEditor.java @@ -132,8 +132,7 @@ public class JPADiagramEditor extends DiagramEditor { save = false; } } catch (JavaModelException e) { - System.err.println("Problem with compilation unit"); //$NON-NLS-1$ - e.printStackTrace(); + JPADiagramEditorPlugin.logError("Problem with compilation unit", e); //$NON-NLS-1$ } GraphicsUpdater.updateHeader(sh, entName); } @@ -150,8 +149,7 @@ public class JPADiagramEditor extends DiagramEditor { //IJPAEditorFeatureProvider fp = (IJPAEditorFeatureProvider)getFeatureProvider(); TransactionalEditingDomain ted = TransactionUtil.getEditingDomain(d); if ((d == null) || (ted == null)) { - System.err.println((d == null) ? "Diagram is null" : "TransactionalEditingDomain is null"); //$NON-NLS-1$ //$NON-NLS-2$ - new Exception().printStackTrace(); + JPADiagramEditorPlugin.logError((d == null) ? "Diagram is null" : "TransactionalEditingDomain is null", new Exception()); //$NON-NLS-1$ //$NON-NLS-2$ return; } ted.getCommandStack().execute(new RecordingCommand(ted) { diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/JPADiagramEditorPlugin.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/JPADiagramEditorPlugin.java index e2cb3fb9ec..7ad91463be 100644 --- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/JPADiagramEditorPlugin.java +++ b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/JPADiagramEditorPlugin.java @@ -15,6 +15,8 @@ *******************************************************************************/ package org.eclipse.jpt.jpadiagrameditor.ui.internal; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; import org.eclipse.jdt.internal.ui.dialogs.OptionalMessageDialog; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.JPAEditorConstants; @@ -77,4 +79,40 @@ public class JPADiagramEditorPlugin extends AbstractUIPlugin { public static ImageDescriptor getImageDescriptor(String path) { return imageDescriptorFromPlugin(PLUGIN_ID, path); } + + /** + * Log the specified message. + */ + public static void logError(String msg) { + logError(msg, null); + } + + /** + * Log the specified exception or error. + */ + public static void logError(Throwable throwable) { + logError(throwable.getLocalizedMessage(), throwable); + } + + /** + * Log the specified message and exception or error. + */ + public static void logError(String msg, Throwable throwable) { + log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, msg, throwable)); + } + + /** + * Log the specified status. + */ + public static void log(IStatus status) { + plugin.getLog().log(status); + } + + + /** + * Log the specified message and exception or error. + */ + public static void logInfo(String msg) { + log(new Status(IStatus.INFO, PLUGIN_ID, IStatus.OK, msg, null)); + } } diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/dialog/SelectTypeDialog.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/dialog/SelectTypeDialog.java index 2ae13d849b..5d85e97333 100644 --- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/dialog/SelectTypeDialog.java +++ b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/dialog/SelectTypeDialog.java @@ -34,6 +34,7 @@ import org.eclipse.jface.fieldassist.IContentProposalProvider; import org.eclipse.jface.fieldassist.SimpleContentProposalProvider; import org.eclipse.jface.fieldassist.TextContentAdapter; import org.eclipse.jpt.common.utility.internal.StringTools; +import org.eclipse.jpt.jpadiagrameditor.ui.internal.JPADiagramEditorPlugin; import org.eclipse.jpt.jpadiagrameditor.ui.internal.i18n.JPAEditorMessages; import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.JPAEditorConstants; import org.eclipse.swt.SWT; @@ -73,8 +74,7 @@ public class SelectTypeDialog extends TitleAreaDialog { try { ks = KeyStroke.getInstance("Ctrl+Space"); //$NON-NLS-1$ } catch (ParseException e1) { - System.err.println("Can't create keystroke object"); //$NON-NLS-1$ - e1.printStackTrace(); + JPADiagramEditorPlugin.logError("Can't create keystroke object", e1); //$NON-NLS-1$ } } @@ -144,8 +144,7 @@ public class SelectTypeDialog extends TitleAreaDialog { false, text.getText().trim()); } catch (JavaModelException e1) { - System.err.println("Can't create type selaction dialog instance"); //$NON-NLS-1$ - e1.printStackTrace(); + JPADiagramEditorPlugin.logError("Can't create type selaction dialog instance", e1); //$NON-NLS-1$ } d.open(); Object[] res = d.getResult(); diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/AddJPAEntityFeature.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/AddJPAEntityFeature.java index 377e9ef137..38cf22e304 100644 --- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/AddJPAEntityFeature.java +++ b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/AddJPAEntityFeature.java @@ -49,6 +49,7 @@ import org.eclipse.jpt.jpa.core.context.AttributeMapping; import org.eclipse.jpt.jpa.core.context.java.JavaMappedSuperclass; import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; +import org.eclipse.jpt.jpadiagrameditor.ui.internal.JPADiagramEditorPlugin; import org.eclipse.jpt.jpadiagrameditor.ui.internal.i18n.JPAEditorMessages; import org.eclipse.jpt.jpadiagrameditor.ui.internal.modelintegration.util.ModelIntegrationUtil; import org.eclipse.jpt.jpadiagrameditor.ui.internal.provider.IAddEntityContext; @@ -182,7 +183,7 @@ public class AddJPAEntityFeature extends AbstractAddShapeFeature { packageName = getMappedSuperclassPackageDeclaration(fp, jpt, packageName); } catch (JavaModelException e) { - e.printStackTrace(); + JPADiagramEditorPlugin.logError(e); } boolean hasPrimaryKey = hasMappedSuperclassPrimaryKeyAttribute(jpt); @@ -421,9 +422,8 @@ public class AddJPAEntityFeature extends AbstractAddShapeFeature { if (cu.hasUnsavedChanges()) { headerTextString = "* " + headerTextString; //$NON-NLS-1$ } - } catch (JavaModelException e) { - System.err.println("Cannot check compilation unit for unsaved changes"); //$NON-NLS-1$ - e.printStackTrace(); + } catch (JavaModelException e) { + JPADiagramEditorPlugin.logError("Cannot check compilation unit for unsaved changes", e); //$NON-NLS-1$ } Text headerTextObj = Graphiti.getGaService().createDefaultText(getDiagram(), headerRect, headerTextString); diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/ClickAddAttributeButtonFeature.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/ClickAddAttributeButtonFeature.java index fd885261f6..c8779ccdda 100644 --- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/ClickAddAttributeButtonFeature.java +++ b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/ClickAddAttributeButtonFeature.java @@ -23,6 +23,7 @@ import org.eclipse.graphiti.mm.pictograms.ContainerShape; import org.eclipse.jdt.core.ICompilationUnit; import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; +import org.eclipse.jpt.jpadiagrameditor.ui.internal.JPADiagramEditorPlugin; import org.eclipse.jpt.jpadiagrameditor.ui.internal.i18n.JPAEditorMessages; import org.eclipse.jpt.jpadiagrameditor.ui.internal.provider.IJPAEditorFeatureProvider; import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.JpaArtifactFactory; @@ -61,8 +62,7 @@ public class ClickAddAttributeButtonFeature extends AbstractCreateFeature { try { Thread.sleep(200); } catch (InterruptedException e) { - System.err.println("Thread sleep interrupted"); //$NON-NLS-1$ - e.printStackTrace(); + JPADiagramEditorPlugin.logError("Thread sleep interrupted", e); //$NON-NLS-1$ } } cnt++; diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateJPAEntityFeature.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateJPAEntityFeature.java index 09eb969464..8150e71677 100644 --- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateJPAEntityFeature.java +++ b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateJPAEntityFeature.java @@ -135,16 +135,14 @@ public class CreateJPAEntityFeature extends AbstractCreateFeature { try { this.getFeatureProvider().getJPAEditorUtil().createEntityInProject(targetProject, entityName, jpaPreferenceStore, isMappedSuperclassChild, mappedSuperclassName, mappedSuperclassPackage, hasPrimarykey); } catch (Exception e1) { - System.err.println("Cannot create an entity in the project " + targetProject.getName()); //$NON-NLS-1$ - e1.printStackTrace(); + JPADiagramEditorPlugin.logError("Cannot create an entity in the project " + targetProject.getName(), e1); //$NON-NLS-1$ } try { jpaProject.getProject().refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor()); } catch (CoreException e1) { - System.err.println("Cannot refresh the project"); //$NON-NLS-1$ - e1.printStackTrace(); + JPADiagramEditorPlugin.logError("Cannot refresh the project", e1); //$NON-NLS-1$ } ListIterator<PersistenceUnit> lit = jpaProject.getRootContextNode().getPersistenceXml().getPersistence().persistenceUnits(); @@ -156,8 +154,7 @@ public class CreateJPAEntityFeature extends AbstractCreateFeature { try { Thread.sleep(200); } catch (InterruptedException e) { - System.err.println("Thread sleep interrupted"); //$NON-NLS-1$ - e.printStackTrace(); + JPADiagramEditorPlugin.logError("Thread sleep interrupted", e); //$NON-NLS-1$ } jpt = (JavaPersistentType)pu.getPersistentType(entityName); cnt++; @@ -170,9 +167,7 @@ public class CreateJPAEntityFeature extends AbstractCreateFeature { getFeatureProvider().getJPAEditorUtil().formatCode(cu, ws); return new Object[] { jpt }; } else { - System.err.println("The JPA entity " + entityName + " could not be created"); //$NON-NLS-1$ //$NON-NLS-2$ - Exception e = new Exception(); - e.printStackTrace(); + JPADiagramEditorPlugin.logError("The JPA entity " + entityName + " could not be created", new Exception()); //$NON-NLS-1$ //$NON-NLS-2$ } return new Object[] {}; } @@ -202,7 +197,7 @@ public class CreateJPAEntityFeature extends AbstractCreateFeature { } } catch (IOException e) { - e.printStackTrace(); + JPADiagramEditorPlugin.logError(e); } return false; } diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateJPAEntityFromMappedSuperclassFeature.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateJPAEntityFromMappedSuperclassFeature.java index 15f7b60f63..620654b971 100644 --- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateJPAEntityFromMappedSuperclassFeature.java +++ b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateJPAEntityFromMappedSuperclassFeature.java @@ -73,9 +73,7 @@ public class CreateJPAEntityFromMappedSuperclassFeature extends .createEntityFromMappedSuperclassInProject(targetProject, mappedSuperclassName, jpaPreferenceStore); } catch (Exception e1) { - System.err - .println("Cannot create an entity in the project " + targetProject.getName()); //$NON-NLS-1$ - e1.printStackTrace(); + JPADiagramEditorPlugin.logError("Cannot create an entity in the project " + targetProject.getName(), e1); //$NON-NLS-1$ } CreateJPAEntityFeature createEntityFeature = new CreateJPAEntityFeature( diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/OpenJPADetailsViewFeature.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/OpenJPADetailsViewFeature.java index 19f73c52d5..60115a845b 100644 --- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/OpenJPADetailsViewFeature.java +++ b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/OpenJPADetailsViewFeature.java @@ -18,6 +18,7 @@ package org.eclipse.jpt.jpadiagrameditor.ui.internal.feature; import org.eclipse.graphiti.features.IFeatureProvider; import org.eclipse.graphiti.features.context.ICustomContext; import org.eclipse.graphiti.features.custom.AbstractCustomFeature; +import org.eclipse.jpt.jpadiagrameditor.ui.internal.JPADiagramEditorPlugin; import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.JPAEditorConstants; import org.eclipse.ui.PartInitException; import org.eclipse.ui.PlatformUI; @@ -38,8 +39,7 @@ public class OpenJPADetailsViewFeature extends AbstractCustomFeature { PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(). showView(JPAEditorConstants.ID_VIEW_JPA_DETAILS); } catch (PartInitException e) { - System.err.println("Can't open JPA Details view"); //$NON-NLS-1$ - e.printStackTrace(); + JPADiagramEditorPlugin.logError("Can't open JPA Details view", e); //$NON-NLS-1$ } } diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/OpenMiniatureViewFeature.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/OpenMiniatureViewFeature.java index a6b86e5492..d700c8be17 100644 --- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/OpenMiniatureViewFeature.java +++ b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/OpenMiniatureViewFeature.java @@ -18,6 +18,7 @@ package org.eclipse.jpt.jpadiagrameditor.ui.internal.feature; import org.eclipse.graphiti.features.IFeatureProvider; import org.eclipse.graphiti.features.context.ICustomContext; import org.eclipse.graphiti.features.custom.AbstractCustomFeature; +import org.eclipse.jpt.jpadiagrameditor.ui.internal.JPADiagramEditorPlugin; import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.JPAEditorConstants; import org.eclipse.ui.PartInitException; import org.eclipse.ui.PlatformUI; @@ -38,8 +39,7 @@ public class OpenMiniatureViewFeature extends AbstractCustomFeature { PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(). showView(JPAEditorConstants.ID_VIEW_MINIATURE); } catch (PartInitException e) { - System.err.println("Can't open Miniature view"); //$NON-NLS-1$ - e.printStackTrace(); + JPADiagramEditorPlugin.logError("Can't open Miniature view", e); //$NON-NLS-1$ } } diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/RefactorEntityFeature.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/RefactorEntityFeature.java index 729d88c7fc..f4a381d1e0 100644 --- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/RefactorEntityFeature.java +++ b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/RefactorEntityFeature.java @@ -52,6 +52,7 @@ import org.eclipse.jpt.jpa.core.resource.java.Annotation; import org.eclipse.jpt.jpa.core.resource.java.JavaResourceCompilationUnit; import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; import org.eclipse.jpt.jpa.core.resource.java.OwnableRelationshipMappingAnnotation; +import org.eclipse.jpt.jpadiagrameditor.ui.internal.JPADiagramEditorPlugin; import org.eclipse.jpt.jpadiagrameditor.ui.internal.provider.AddEntityContext; import org.eclipse.jpt.jpadiagrameditor.ui.internal.provider.IJPAEditorFeatureProvider; import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.JPAEditorConstants; @@ -249,8 +250,7 @@ public abstract class RefactorEntityFeature extends AbstractCustomFeature { try { moved = s.tryAcquire(2, 4, TimeUnit.SECONDS); } catch (InterruptedException e) { - System.err.println("Thread interrupted"); //$NON-NLS-1$ - e.printStackTrace(); + JPADiagramEditorPlugin.logError("Thread interrupted", e); //$NON-NLS-1$ } } diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/RemoveAttributeFeature.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/RemoveAttributeFeature.java index 3e6f13d3b8..055d602afb 100644 --- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/RemoveAttributeFeature.java +++ b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/RemoveAttributeFeature.java @@ -32,6 +32,7 @@ import org.eclipse.graphiti.mm.pictograms.ContainerShape; import org.eclipse.graphiti.mm.pictograms.PictogramElement; import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; +import org.eclipse.jpt.jpadiagrameditor.ui.internal.JPADiagramEditorPlugin; import org.eclipse.jpt.jpadiagrameditor.ui.internal.provider.IJPAEditorFeatureProvider; import org.eclipse.jpt.jpadiagrameditor.ui.internal.provider.JPAEditorFeatureProvider; import org.eclipse.jpt.jpadiagrameditor.ui.internal.relations.IRelation; @@ -79,8 +80,7 @@ public class RemoveAttributeFeature extends DefaultRemoveFeature { public void preRemove(IRemoveContext context) { final PictogramElement pe = context.getPictogramElement(); if (pe == null) { - System.err.println("PictogramElement is null\n"); //$NON-NLS-1$ - new Exception().printStackTrace(); + JPADiagramEditorPlugin.logError("PictogramElement is null\n", new Exception()); //$NON-NLS-1$ return; } IJPAEditorFeatureProvider fp = getFeatureProvider(); @@ -114,7 +114,7 @@ public class RemoveAttributeFeature extends DefaultRemoveFeature { try{ graphicalRemoveAttribute(entityShape); } catch (Exception e){ - e.printStackTrace(); + JPADiagramEditorPlugin.logError(e); } } diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/modelintegration/ui/JPAEditorMatchingStrategy.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/modelintegration/ui/JPAEditorMatchingStrategy.java index 9ef77ab65e..a81840bc65 100644 --- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/modelintegration/ui/JPAEditorMatchingStrategy.java +++ b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/modelintegration/ui/JPAEditorMatchingStrategy.java @@ -73,8 +73,7 @@ public class JPAEditorMatchingStrategy implements IEditorMatchingStrategy { return false; } } catch (CoreException e1) { - System.err.println("Cannot get session property DOUBLE_CLICK"); //$NON-NLS-1$ - e1.printStackTrace(); + JPADiagramEditorPlugin.logError("Cannot get session property DOUBLE_CLICK", e1); //$NON-NLS-1$ } JavaPersistentType inputJptType = null; diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/modelintegration/ui/OpenJpaDiagramActionDelegate.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/modelintegration/ui/OpenJpaDiagramActionDelegate.java index 88aa5352e9..b8b2ff23e1 100644 --- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/modelintegration/ui/OpenJpaDiagramActionDelegate.java +++ b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/modelintegration/ui/OpenJpaDiagramActionDelegate.java @@ -45,6 +45,7 @@ import org.eclipse.jpt.jpa.core.JpaNode; import org.eclipse.jpt.jpa.core.JpaProject; import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; import org.eclipse.jpt.jpadiagrameditor.ui.internal.JPADiagramEditor; +import org.eclipse.jpt.jpadiagrameditor.ui.internal.JPADiagramEditorPlugin; import org.eclipse.jpt.jpadiagrameditor.ui.internal.i18n.JPAEditorMessages; import org.eclipse.jpt.jpadiagrameditor.ui.internal.modelintegration.util.CreateDiagramJob; import org.eclipse.jpt.jpadiagrameditor.ui.internal.modelintegration.util.ModelIntegrationUtil; @@ -127,8 +128,7 @@ public class OpenJpaDiagramActionDelegate implements IObjectActionDelegate { // ret.doSave(new NullProgressMonitor()); } } catch (PartInitException e) { - System.err.println("Can't open JPA editor"); //$NON-NLS-1$ - e.printStackTrace(); + JPADiagramEditorPlugin.logError("Can't open JPA editor", e); //$NON-NLS-1$ } return (JPADiagramEditor)wrp.getObj(); } @@ -184,8 +184,7 @@ public class OpenJpaDiagramActionDelegate implements IObjectActionDelegate { private void handleException(Exception e) { - System.err.println(ERROR_OPENING_DIAGRAM); - e.printStackTrace(); + JPADiagramEditorPlugin.logError(ERROR_OPENING_DIAGRAM, e);; IStatus status = new ErrStatus(IStatus.ERROR, JPADiagramEditor.ID, e.toString(), e); ErrorDialog.openError(shell, JPAEditorMessages.OpenJpaDiagramActionDelegate_openJPADiagramErrorMsgTitle, ERROR_OPENING_DIAGRAM, status); diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/modelintegration/util/ModelIntegrationUtil.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/modelintegration/util/ModelIntegrationUtil.java index 06237741df..0fe2825187 100644 --- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/modelintegration/util/ModelIntegrationUtil.java +++ b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/modelintegration/util/ModelIntegrationUtil.java @@ -41,6 +41,7 @@ import org.eclipse.graphiti.services.Graphiti; import org.eclipse.graphiti.ui.editor.DiagramEditorFactory; import org.eclipse.jpt.jpa.core.JpaProject; import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; +import org.eclipse.jpt.jpadiagrameditor.ui.internal.JPADiagramEditorPlugin; import org.eclipse.jpt.jpadiagrameditor.ui.internal.propertypage.JPADiagramPropertyPage; import org.eclipse.jpt.jpadiagrameditor.ui.internal.provider.JPAEditorDiagramTypeProvider; @@ -117,8 +118,8 @@ public class ModelIntegrationUtil { try { resource.load(null); } catch (IOException e) { - System.out.println("The diagram file does not exist. It will be created"); //$NON-NLS-1$ - System.out.println(e.getLocalizedMessage()); + JPADiagramEditorPlugin.logInfo("The diagram file does not exist. It will be created"); + JPADiagramEditorPlugin.logInfo(e.getLocalizedMessage()); } } }); @@ -158,8 +159,7 @@ public class ModelIntegrationUtil { try { resource.save(Collections.EMPTY_MAP); } catch (IOException e) { - System.err.println("Cannot create new diagram"); //$NON-NLS-1$ - e.printStackTrace(); + JPADiagramEditorPlugin.logError("Cannot create new diagram", e); //$NON-NLS-1$ } } }); diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/provider/JPAEditorFeatureProvider.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/provider/JPAEditorFeatureProvider.java index 67d01ff573..bc94dccfee 100644 --- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/provider/JPAEditorFeatureProvider.java +++ b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/provider/JPAEditorFeatureProvider.java @@ -71,6 +71,7 @@ import org.eclipse.jpt.jpa.core.context.java.JavaEntity; import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; +import org.eclipse.jpt.jpadiagrameditor.ui.internal.JPADiagramEditorPlugin; import org.eclipse.jpt.jpadiagrameditor.ui.internal.feature.AddAllEntitiesFeature; import org.eclipse.jpt.jpadiagrameditor.ui.internal.feature.AddAttributeFeature; import org.eclipse.jpt.jpadiagrameditor.ui.internal.feature.AddJPAEntityFeature; @@ -510,8 +511,7 @@ public class JPAEditorFeatureProvider extends DefaultFeatureProvider implements solver.remove(solver.getKeyForBusinessObject(oldAt)); solver.addKeyBusinessObject(solver.getKeyForBusinessObject(newAt), newAt); if (newAt == null) { - System.err.println("New attribute is null\n"); //$NON-NLS-1$ - new Exception().printStackTrace(); + JPADiagramEditorPlugin.logError("New attribute is null\n", new Exception()); //$NON-NLS-1$ return; } link(pe, newAt); diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/provider/JPAEditorToolBehaviorProvider.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/provider/JPAEditorToolBehaviorProvider.java index 7a7898f0e0..4cdd9d0fed 100644 --- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/provider/JPAEditorToolBehaviorProvider.java +++ b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/provider/JPAEditorToolBehaviorProvider.java @@ -577,11 +577,9 @@ public class JPAEditorToolBehaviorProvider extends DefaultToolBehaviorProvider { file.setSessionProperty(new QualifiedName(null, JPAEditorMatchingStrategy.DOUBLE_CLICK), "true"); //$NON-NLS-1$ facade.getIDE().openEditor(file); } catch (PartInitException e) { - System.err.println("Cannot open editor"); //$NON-NLS-1$ - e.printStackTrace(); + JPADiagramEditorPlugin.logError("Cannot open editor", e); //$NON-NLS-1$ } catch (CoreException e) { - System.err.println("Cannot open editor"); //$NON-NLS-1$ - e.printStackTrace(); + JPADiagramEditorPlugin.logError("Cannot open editor", e); //$NON-NLS-1$ } } if (bo instanceof JavaPersistentType) { @@ -591,11 +589,9 @@ public class JPAEditorToolBehaviorProvider extends DefaultToolBehaviorProvider { file.setSessionProperty(new QualifiedName(null, JPAEditorMatchingStrategy.DOUBLE_CLICK), "true"); //$NON-NLS-1$ facade.getIDE().openEditor(file); } catch (PartInitException e) { - System.err.println("Cannot open editor"); //$NON-NLS-1$ - e.printStackTrace(); + JPADiagramEditorPlugin.logError("Cannot open editor", e); //$NON-NLS-1$ } catch (CoreException e) { - System.err.println("Cannot open editor"); //$NON-NLS-1$ - e.printStackTrace(); + JPADiagramEditorPlugin.logError("Cannot open editor", e); //$NON-NLS-1$ } } if ((bo == null) && (pe.getGraphicsAlgorithm() instanceof Rectangle)) { diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/EntityChangeListener.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/EntityChangeListener.java index 1c4d152855..d52b0a1d97 100644 --- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/EntityChangeListener.java +++ b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/EntityChangeListener.java @@ -36,6 +36,7 @@ import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; import org.eclipse.jpt.jpa.core.internal.context.java.JavaNullTypeMapping; import org.eclipse.jpt.jpa.core.resource.java.Annotation; import org.eclipse.jpt.jpa.core.resource.java.OwnableRelationshipMappingAnnotation; +import org.eclipse.jpt.jpadiagrameditor.ui.internal.JPADiagramEditorPlugin; import org.eclipse.jpt.jpadiagrameditor.ui.internal.feature.RemoveAndSaveEntityFeature; import org.eclipse.jpt.jpadiagrameditor.ui.internal.provider.IJPAEditorFeatureProvider; import org.eclipse.swt.widgets.Display; @@ -66,8 +67,7 @@ public class EntityChangeListener extends Thread { try { Thread.sleep(PAUSE_DURATION); } catch (InterruptedException e) { - System.err.println("Thread sleep interruprted"); //$NON-NLS-1$ - e.printStackTrace(); + JPADiagramEditorPlugin.logError("Thread sleep interruprted", e); //$NON-NLS-1$ } Display.getDefault().asyncExec(taskClass); } @@ -149,8 +149,7 @@ public class EntityChangeListener extends Thread { }); } catch (JavaModelException e) { - System.err.println("Cannot check compilation unit for unsaved changes"); //$NON-NLS-1$ - e.printStackTrace(); + JPADiagramEditorPlugin.logError("Cannot check compilation unit for unsaved changes", e); //$NON-NLS-1$ } } } diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JPACheckSum.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JPACheckSum.java index 556c213970..c01c6e508e 100644 --- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JPACheckSum.java +++ b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JPACheckSum.java @@ -28,6 +28,7 @@ import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jpt.jpa.core.JpaProject; import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; +import org.eclipse.jpt.jpadiagrameditor.ui.internal.JPADiagramEditorPlugin; public class JPACheckSum { @@ -39,8 +40,7 @@ public class JPACheckSum { try { md5 = MessageDigest.getInstance("MD5"); //$NON-NLS-1$ } catch (NoSuchAlgorithmException e) { - System.err.println("Couldn't create instance of MD5"); //$NON-NLS-1$ - e.printStackTrace(); + JPADiagramEditorPlugin.logError("Couldn't create instance of MD5", e); //$NON-NLS-1$ return null; } instance = new JPACheckSum(); @@ -80,8 +80,7 @@ public class JPACheckSum { try { src = cu.getSource(); } catch (JavaModelException e) { - System.err.println("Can't get the source of the compilation unit"); //$NON-NLS-1$ - e.printStackTrace(); + JPADiagramEditorPlugin.logError("Can't get the source of the compilation unit", e); //$NON-NLS-1$ return null; } byte[] res = md5.digest(src.getBytes()); diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JPAEditorUtil.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JPAEditorUtil.java index 61a4ef46e0..ea6266b6dc 100644 --- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JPAEditorUtil.java +++ b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JPAEditorUtil.java @@ -77,6 +77,7 @@ import org.eclipse.jpt.jpa.core.resource.persistence.XmlJavaClassRef; import org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistence; import org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnit; import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource; +import org.eclipse.jpt.jpadiagrameditor.ui.internal.JPADiagramEditorPlugin; import org.eclipse.jpt.jpadiagrameditor.ui.internal.facade.EclipseFacade; import org.eclipse.jpt.jpadiagrameditor.ui.internal.i18n.JPAEditorMessages; import org.eclipse.jpt.jpadiagrameditor.ui.internal.propertypage.JPADiagramPropertyPage; @@ -282,8 +283,7 @@ public class JPAEditorUtil { try { proj = JpaArtifactFactory.instance().getJpaProject(jp.getProject()); } catch (CoreException e) { - System.err.println("Cannot obtain the JPA project."); //$NON-NLS-1$ - e.printStackTrace(); + JPADiagramEditorPlugin.logError("Cannot obtain the JPA project.", e); //$NON-NLS-1$ } if (proj == null) return null; @@ -1166,8 +1166,7 @@ public class JPAEditorUtil { try { classpathEntries = javaProject.getRawClasspath(); } catch (JavaModelException e) { - System.err.println("Cannot obtain the classpath"); //$NON-NLS-1$ - e.printStackTrace(); + JPADiagramEditorPlugin.logError("Cannot obtain the classpath", e); //$NON-NLS-1$ return false; } for (IClasspathEntry classpathEntry : classpathEntries) { @@ -1185,8 +1184,7 @@ public class JPAEditorUtil { try { folder = (IFolder) packageFragment.getCorrespondingResource(); } catch (JavaModelException e) { - System.err.println("Cannot obtain the folder"); //$NON-NLS-1$ - e.printStackTrace(); + JPADiagramEditorPlugin.logError("Cannot obtain the folder", e); //$NON-NLS-1$ return false; } if (!folder.exists()) @@ -1251,8 +1249,7 @@ public class JPAEditorUtil { try { cu.becomeWorkingCopy(new NullProgressMonitor()); } catch (JavaModelException e) { - System.err.println("Can't discrad the working copy"); //$NON-NLS-1$ - e.printStackTrace(); + JPADiagramEditorPlugin.logError("Can't discard the working copy", e); //$NON-NLS-1$ } } @@ -1261,8 +1258,7 @@ public class JPAEditorUtil { try { cu.discardWorkingCopy(); } catch (JavaModelException e) { - System.err.println("Can't discard the working copy"); //$NON-NLS-1$ - e.printStackTrace(); + JPADiagramEditorPlugin.logError("Can't discard the working copy", e); //$NON-NLS-1$ } } @@ -1271,8 +1267,7 @@ public class JPAEditorUtil { try { cu.discardWorkingCopy(); } catch (JavaModelException e) { - System.err.println("Can't discard the working copy"); //$NON-NLS-1$ - e.printStackTrace(); + JPADiagramEditorPlugin.logError("Can't discard the working copy", e); //$NON-NLS-1$ } } @@ -1391,8 +1386,7 @@ public class JPAEditorUtil { try { fproj = ProjectFacetsManager.create(project); } catch (CoreException e) { - System.err.println("Could not create faceted project from " + project.getName()); //$NON-NLS-1$ - e.printStackTrace(); + JPADiagramEditorPlugin.logError("Could not create faceted project from " + project.getName(), e); //$NON-NLS-1$ } Set<IProjectFacetVersion> projFacets = fproj.getProjectFacets(); Iterator<IProjectFacetVersion> it = projFacets.iterator(); diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JPASolver.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JPASolver.java index 9d376cd6bd..2c4bb35fad 100644 --- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JPASolver.java +++ b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JPASolver.java @@ -106,6 +106,7 @@ import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; import org.eclipse.jpt.jpa.core.resource.java.JavaResourceCompilationUnit; import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; import org.eclipse.jpt.jpadiagrameditor.ui.internal.JPADiagramEditor; +import org.eclipse.jpt.jpadiagrameditor.ui.internal.JPADiagramEditorPlugin; import org.eclipse.jpt.jpadiagrameditor.ui.internal.facade.EclipseFacade; import org.eclipse.jpt.jpadiagrameditor.ui.internal.feature.AddAttributeFeature; import org.eclipse.jpt.jpadiagrameditor.ui.internal.feature.AddRelationFeature; @@ -992,8 +993,7 @@ public class JPASolver implements IResourceChangeListener, IJpaSolver { }); } catch (JavaModelException e) { - System.err.println("Cannot check compilation unit for unsaved changes"); //$NON-NLS-1$ - e.printStackTrace(); + JPADiagramEditorPlugin.logError("Cannot check compilation unit for unsaved changes", e); //$NON-NLS-1$ } } @@ -1445,7 +1445,7 @@ public class JPASolver implements IResourceChangeListener, IJpaSolver { } } } catch (CoreException e) { - e.printStackTrace(); + JPADiagramEditorPlugin.logError(e); } } } diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JpaArtifactFactory.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JpaArtifactFactory.java index cd56809672..2849edd5e5 100644 --- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JpaArtifactFactory.java +++ b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JpaArtifactFactory.java @@ -463,8 +463,7 @@ public class JpaArtifactFactory { cu.delete(true, new NullProgressMonitor()); return true; } catch (JavaModelException e) { - System.err.println("Cannot delete the JPA entity class"); //$NON-NLS-1$ - e.printStackTrace(); + JPADiagramEditorPlugin.logError("Cannot delete the JPA entity class", e); //$NON-NLS-1$ return false; } } @@ -482,8 +481,7 @@ public class JpaArtifactFactory { try { Thread.sleep(PAUSE_DURATION); } catch (InterruptedException e) { - System.err.println("Sleep interrupted"); //$NON-NLS-1$ - e.printStackTrace(); + JPADiagramEditorPlugin.logError("Sleep interrupted", e); //$NON-NLS-1$ } cnt++; } @@ -663,8 +661,7 @@ public class JpaArtifactFactory { new NullProgressMonitor()); } } catch (JavaModelException e) { - System.err.println("Cannnot create a new attribute with name " + attributeName); //$NON-NLS-1$ - e.printStackTrace(); + JPADiagramEditorPlugin.logError("Cannnot create a new attribute with name " + attributeName, e); //$NON-NLS-1$ } if(jpt.getAttributeNamed(attributeName) == null){ @@ -728,8 +725,7 @@ public class JpaArtifactFactory { try { Thread.sleep(250); } catch (InterruptedException e) { - System.err.println("Sleep interrupted"); //$NON-NLS-1$ - e.printStackTrace(); + JPADiagramEditorPlugin.logError("Sleep interrupted", e); //$NON-NLS-1$ } field = type.getField(attrTxt); cnt++; @@ -741,10 +737,8 @@ public class JpaArtifactFactory { || field.getTypeSignature().endsWith("[]")) //$NON-NLS-1$ return true; } catch (JavaModelException e) { - System.err.println( - JPAEditorMessages.JpaArtifactFactory_CanNotCheckReturnType + - " " + attrTxt + "\""); //$NON-NLS-1$ //$NON-NLS-2$ - e.printStackTrace(); + JPADiagramEditorPlugin.logError(JPAEditorMessages.JpaArtifactFactory_CanNotCheckReturnType + + " " + attrTxt + "\"", e); //$NON-NLS-1$ //$NON-NLS-2$ } } } @@ -770,9 +764,8 @@ public class JpaArtifactFactory { || method.getReturnType().endsWith("[]")) //$NON-NLS-1$ return true; } catch (JavaModelException e) { - System.err.println(JPAEditorMessages.JpaArtifactFactory_CanNotCheckReturnType + - " " + attrTxt + "\""); //$NON-NLS-1$ //$NON-NLS-2$ - e.printStackTrace(); + JPADiagramEditorPlugin.logError(JPAEditorMessages.JpaArtifactFactory_CanNotCheckReturnType + + " " + attrTxt + "\"", e); //$NON-NLS-1$ //$NON-NLS-2$ } } return false; @@ -821,8 +814,7 @@ public class JpaArtifactFactory { attrTypeElementNames, actName, annotations, isCollection, isMethodAnnotated); } catch (JavaModelException e) { - System.err.println("Cannot create a new attribute with name " + attrName); //$NON-NLS-1$ - e.printStackTrace(); + JPADiagramEditorPlugin.logError("Cannot create a new attribute with name " + attrName, e); //$NON-NLS-1$ } return attr; } @@ -839,8 +831,7 @@ public class JpaArtifactFactory { makeNewAttribute(fp, jpt, cu, attrName, attrTypeName, null, actName, annotations, isCollection, isMethodAnnotated); } catch (JavaModelException e) { - System.err.println("Cannot create a new attribute with name " + attrName); //$NON-NLS-1$ - e.printStackTrace(); + JPADiagramEditorPlugin.logError("Cannot create a new attribute with name " + attrName, e); //$NON-NLS-1$ } return attrName; } @@ -920,7 +911,7 @@ public class JpaArtifactFactory { try { Thread.sleep(250); } catch (InterruptedException e) { - e.printStackTrace(); + JPADiagramEditorPlugin.logError(e); } jpa = jpt.getAttributeNamed(attrName); cnt++; @@ -961,7 +952,7 @@ public class JpaArtifactFactory { if ((getAttributeMethod != null) && getAttributeMethod.exists()); typeSignature = getAttributeMethod.getReturnType(); } catch (JavaModelException e1) { - System.out.println("Cannot obtain the type of the getter with name " + methodName + "()"); //$NON-NLS-1$ //$NON-NLS-2$ + JPADiagramEditorPlugin.logError("Cannot obtain the type of the getter with name " + methodName + "()", e1); //$NON-NLS-1$ //$NON-NLS-2$ } } if (typeSignature == null) @@ -978,7 +969,7 @@ public class JpaArtifactFactory { if ((attributeField != null) && attributeField.exists()) attributeField.delete(true, new NullProgressMonitor()); } catch (JavaModelException e) { - System.out.println("Cannot remove the attribute field with name " + attributeName); //$NON-NLS-1$ + JPADiagramEditorPlugin.logError("Cannot remove the attribute field with name " + attributeName, e); //$NON-NLS-1$ } try { methodName = getterPrefix + attrNameWithCapitalLetter; //$NON-NLS-1$ @@ -988,7 +979,7 @@ public class JpaArtifactFactory { getAttributeMethod.delete(true, new NullProgressMonitor()); } } catch (JavaModelException e) { - System.out.println("Cannot remove the attribute getter with name " + methodName + "()"); //$NON-NLS-1$ //$NON-NLS-2$ + JPADiagramEditorPlugin.logError("Cannot remove the attribute getter with name " + methodName + "()", e); //$NON-NLS-1$ //$NON-NLS-2$ } } else { try { @@ -998,7 +989,7 @@ public class JpaArtifactFactory { getAttributeMethod.delete(true, new NullProgressMonitor()); } } catch (JavaModelException e) { - System.out.println("Cannot remove the attribute getter with name " + methodName + "()"); //$NON-NLS-1$ //$NON-NLS-2$ + JPADiagramEditorPlugin.logError("Cannot remove the attribute getter with name " + methodName + "()", e); //$NON-NLS-1$ //$NON-NLS-2$ } try { IField attributeField = javaType.getField(attributeName); @@ -1008,7 +999,7 @@ public class JpaArtifactFactory { if ((attributeField != null) && attributeField.exists()) attributeField.delete(true, new NullProgressMonitor()); } catch (JavaModelException e) { - System.out.println("Cannot remove the attribute field with name " + attributeName); //$NON-NLS-1$ + JPADiagramEditorPlugin.logError("Cannot remove the attribute field with name " + attributeName, e); //$NON-NLS-1$ } } try { @@ -1018,7 +1009,7 @@ public class JpaArtifactFactory { if ((setAttributeMethod != null) && setAttributeMethod.exists()) setAttributeMethod.delete(true, new NullProgressMonitor()); } catch (Exception e) { - System.out.println("Cannot remove the attribute setter with name " + methodName + "(...)"); //$NON-NLS-1$ //$NON-NLS-2$ + JPADiagramEditorPlugin.logError("Cannot remove the attribute setter with name " + methodName + "(...)", e); //$NON-NLS-1$ //$NON-NLS-2$ } refreshEntityModel(fp, jpt); @@ -1029,8 +1020,7 @@ public class JpaArtifactFactory { try { Thread.sleep(PAUSE_DURATION); } catch (InterruptedException e) { - System.err.println("Thread.sleep() interrupted"); //$NON-NLS-1$ - e.printStackTrace(); + JPADiagramEditorPlugin.logError("Thread.sleep() interrupted", e); //$NON-NLS-1$ } at = jpt.getAttributeNamed(attributeName); c++; @@ -1401,8 +1391,7 @@ public class JpaArtifactFactory { try { Thread.sleep(PAUSE_DURATION); } catch (InterruptedException e) { - System.err.println("Sleep interrupted"); //$NON-NLS-1$ - e.printStackTrace(); + JPADiagramEditorPlugin.logError("Sleep interrupted", e); //$NON-NLS-1$ } jpt = (JavaPersistentType)pu.getPersistentType(name); cnt++; @@ -1493,8 +1482,7 @@ public class JpaArtifactFactory { Shell sh = ww.getShell(); s.perform(sh, ww); } catch (Exception e1) { - System.err.println("Cannot rename the type " + //$NON-NLS-1$ - oldName); + JPADiagramEditorPlugin.logError("Cannot rename the type " + oldName, e1); //$NON-NLS-1$ } } @@ -1541,14 +1529,12 @@ public class JpaArtifactFactory { .resolveAttribute(JPAEditorUtil .revertFirstLetterCase(newName)); } catch (InterruptedException e) { - System.err.println("Thread.sleep() interrupted"); //$NON-NLS-1$ + JPADiagramEditorPlugin.logError("Thread.sleep() interrupted", e); //$NON-NLS-1$ return null; } } if (newAt == null) { - System.err.println("The attribute " + newName + " could not be resolved"); //$NON-NLS-1$ //$NON-NLS-2$ - NullPointerException npe = new NullPointerException(); - npe.printStackTrace(); + JPADiagramEditorPlugin.logError("The attribute " + newName + " could not be resolved", new NullPointerException()); //$NON-NLS-1$ //$NON-NLS-2$ } fp.addRemoveIgnore(jpt, oldAt.getName()); try { @@ -1625,27 +1611,19 @@ public class JpaArtifactFactory { try { typeSignature = getter.getReturnType(); } catch (JavaModelException e1) { - System.err.println("Cannot obtain type signature of the getter of the attribute " //$NON-NLS-1$ - + oldName); - e1.printStackTrace(); + JPADiagramEditorPlugin.logError("Cannot obtain type signature of the getter of the attribute " + oldName, e1); //$NON-NLS-1$ return; } if ((typeSignature == null) || (!"Z".equals(typeSignature) && !getterPrefix.equals("get"))) { //$NON-NLS-1$ //$NON-NLS-2$ - System.err.println("Cannot obtain type signature of the getter of the attribute " //$NON-NLS-1$ - + oldName); - NullPointerException npe = new NullPointerException(); - npe.printStackTrace(); + JPADiagramEditorPlugin.logError("Cannot obtain type signature of the getter of the attribute " + oldName, new NullPointerException()); //$NON-NLS-1$ return; } } else { try { typeSignature = attributeField.getTypeSignature(); } catch (JavaModelException e) { - System.err.println ( - "Cannot obtain type signature of the field of the attribute " //$NON-NLS-1$ - + oldName); - e.printStackTrace(); + JPADiagramEditorPlugin.logError("Cannot obtain type signature of the field of the attribute " + oldName, e); //$NON-NLS-1$ return; } } @@ -1686,18 +1664,12 @@ public class JpaArtifactFactory { Shell sh = ww.getShell(); s.perform(sh, ww); } catch (InterruptedException e) { - System.err.println("Cannot rename the field of the attribute " + //$NON-NLS-1$ - oldName); - e.printStackTrace(); + JPADiagramEditorPlugin.logError("Cannot rename the field of the attribute " + oldName, e); //$NON-NLS-1$ } catch (InvocationTargetException e) { - System.err.println("Cannot rename the field of the attribute " + //$NON-NLS-1$ - oldName); - e.printStackTrace(); + JPADiagramEditorPlugin.logError("Cannot rename the field of the attribute " + oldName, e); //$NON-NLS-1$ } } catch (CoreException e1) { - System.err.println("Cannot rename the field of the attribute " + //$NON-NLS-1$ - oldName); - e1.printStackTrace(); + JPADiagramEditorPlugin.logError("Cannot rename the field of the attribute " + oldName, e1); //$NON-NLS-1$ } } @@ -1709,8 +1681,7 @@ public class JpaArtifactFactory { try { getterType = getter.getReturnType(); } catch (JavaModelException e2) { - System.err.println("Can't obtain getter type"); //$NON-NLS-1$ - e2.printStackTrace(); + JPADiagramEditorPlugin.logError("Can't obtain getter type", e2); //$NON-NLS-1$ } String newGetterName = ("Z".equals(getterType) ? "is" : "get") + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ JPAEditorUtil.capitalizeFirstLetter(newName); @@ -1725,18 +1696,12 @@ public class JpaArtifactFactory { Shell sh = ww.getShell(); s.perform(sh, ww); } catch (InterruptedException e) { - System.err.println("Cannot rename the getter of the attribute " + //$NON-NLS-1$ - oldName); - e.printStackTrace(); + JPADiagramEditorPlugin.logError("Cannot rename the getter of the attribute " + oldName, e); //$NON-NLS-1$ } catch (InvocationTargetException e) { - System.err.println("Cannot rename the getter of the attribute " + //$NON-NLS-1$ - oldName); - e.printStackTrace(); + JPADiagramEditorPlugin.logError("Cannot rename the getter of the attribute " + oldName, e); //$NON-NLS-1$ } } catch (CoreException e1) { - System.err.println("Cannot rename the getter of the attribute " + //$NON-NLS-1$ - oldName); - e1.printStackTrace(); + JPADiagramEditorPlugin.logError("Cannot rename the getter of the attribute " + oldName, e1); //$NON-NLS-1$ } } @@ -1757,18 +1722,12 @@ public class JpaArtifactFactory { Shell sh = ww.getShell(); s.perform(sh, ww); } catch (InterruptedException e) { - System.err.println("Cannot rename the setter of the attribute " + //$NON-NLS-1$ - oldName); - e.printStackTrace(); + JPADiagramEditorPlugin.logError("Cannot rename the setter of the attribute " + oldName, e); //$NON-NLS-1$ } catch (InvocationTargetException e) { - System.err.println("Cannot rename the setter of the attribute " + //$NON-NLS-1$ - oldName); - e.printStackTrace(); + JPADiagramEditorPlugin.logError("Cannot rename the setter of the attribute " + oldName, e); //$NON-NLS-1$ } } catch (CoreException e1) { - System.err.println("Cannot rename the setter of the attribute " + //$NON-NLS-1$ - oldName); - e1.printStackTrace(); + JPADiagramEditorPlugin.logError("Cannot rename the setter of the attribute " + oldName, e1); //$NON-NLS-1$ } } @@ -2121,9 +2080,8 @@ public class JpaArtifactFactory { try { Thread.sleep(PAUSE_DURATION); } catch (InterruptedException e) { - System.err.println("Cannot get the attribute " + //$NON-NLS-1$ - attributeName + " from " + jpt.getName()); //$NON-NLS-1$ - e.printStackTrace(); + JPADiagramEditorPlugin.logError("Cannot get the attribute " + //$NON-NLS-1$ + attributeName + " from " + jpt.getName(), e); //$NON-NLS-1$ } at = jpt.getAttributeNamed(attributeName); c++; |