Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 84511 Details for
Bug 195026
Creating new report from Sequence diagram throws null pointer
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch file
patch_bugzilla195026_20071205.txt (text/plain), 13.65 KB, created by
Yasuhisa Gotoh
on 2007-12-05 07:01:41 EST
(
hide
)
Description:
Patch file
Filename:
MIME Type:
Creator:
Yasuhisa Gotoh
Created:
2007-12-05 07:01:41 EST
Size:
13.65 KB
patch
obsolete
>Index: src-uml2sd/org/eclipse/hyades/uml2sd/util/SDMessages.java >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.common.ui/src-uml2sd/org/eclipse/hyades/uml2sd/util/SDMessages.java,v >retrieving revision 1.1 >diff -u -r1.1 SDMessages.java >--- src-uml2sd/org/eclipse/hyades/uml2sd/util/SDMessages.java 16 Aug 2006 21:15:19 -0000 1.1 >+++ src-uml2sd/org/eclipse/hyades/uml2sd/util/SDMessages.java 5 Dec 2007 11:55:18 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2006 IBM Corporation and others. >+ * Copyright (c) 2000, 2007 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -154,6 +154,7 @@ > public static String _132; > public static String _133; > public static String _134; >+ public static String _135; > > static { > NLS.initializeMessages(BUNDLE_NAME, SDMessages.class); >Index: src-uml2sd/org/eclipse/hyades/uml2sd/util/messages.properties >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.common.ui/src-uml2sd/org/eclipse/hyades/uml2sd/util/messages.properties,v >retrieving revision 1.3 >diff -u -r1.3 messages.properties >--- src-uml2sd/org/eclipse/hyades/uml2sd/util/messages.properties 18 Apr 2007 15:35:07 -0000 1.3 >+++ src-uml2sd/org/eclipse/hyades/uml2sd/util/messages.properties 5 Dec 2007 11:55:18 -0000 >@@ -156,3 +156,5 @@ > _133 = \u00B5s > > _134 = Min Time {0} \n\nCurrent Time {1} \n\nMaxTime {2} >+ >+_135 = There is no default printer. Click Printer button first and select a printer. >Index: src-uml2sd/org/eclipse/hyades/uml2sd/util/SDPrintDialog.java >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.common.ui/src-uml2sd/org/eclipse/hyades/uml2sd/util/SDPrintDialog.java,v >retrieving revision 1.1 >diff -u -r1.1 SDPrintDialog.java >--- src-uml2sd/org/eclipse/hyades/uml2sd/util/SDPrintDialog.java 16 Aug 2006 21:15:19 -0000 1.1 >+++ src-uml2sd/org/eclipse/hyades/uml2sd/util/SDPrintDialog.java 5 Dec 2007 11:55:18 -0000 >@@ -1,5 +1,5 @@ > /********************************************************************** >- * Copyright (c) 2005, 2006 IBM Corporation and others. >+ * Copyright (c) 2005, 2007 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -15,10 +15,14 @@ > import org.eclipse.hyades.uml2sd.ui.view.SDWidget; > import org.eclipse.jface.dialogs.Dialog; > import org.eclipse.jface.dialogs.IDialogConstants; >+import org.eclipse.swt.SWT; > import org.eclipse.swt.events.SelectionEvent; > import org.eclipse.swt.events.SelectionListener; >+import org.eclipse.swt.layout.GridData; >+import org.eclipse.swt.widgets.Button; > import org.eclipse.swt.widgets.Composite; > import org.eclipse.swt.widgets.Control; >+import org.eclipse.swt.widgets.Label; > import org.eclipse.swt.widgets.Shell; > > >@@ -33,12 +37,17 @@ > private SDWidget view; > > private SDPrintDialogUI dialogUI; >- >+ >+ private String errorMessage = null; >+ private Label messageLabel = null; >+ private boolean isPageComplete = true; >+ > public SDPrintDialog(Shell s, SDWidget v) { > super(s); > view = v; > > dialogUI = new SDPrintDialogUI(s, view); >+ dialogUI.setParentDialog(this); > } > > protected Control createDialogArea(Composite p) { >@@ -47,7 +56,14 @@ > Composite parent = (Composite) super.createDialogArea(p); > > dialogUI.createDialogArea(parent); >- >+ >+ // bug 195026 >+ messageLabel = new Label(parent, SWT.NONE); >+ GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true); >+ gridData.horizontalSpan = 6; >+ messageLabel.setLayoutData(gridData); >+ setErrorMessage(errorMessage); >+ > return parent; > } > >@@ -80,10 +96,41 @@ > } > > }); >- >+ >+ updateButtons(); > } > > public SDPrintDialogUI getDialogUI() { > return dialogUI; > } >+ >+ public void setErrorMessage(String message) { >+ errorMessage = message; >+ if (messageLabel != null) { >+ if (errorMessage == null) { >+ messageLabel.setText(""); //$NON-NLS-1$ >+ } else { >+ messageLabel.setText(errorMessage); >+ } >+ } >+ } >+ >+ public void setPageComplete(boolean complete) { >+ isPageComplete = complete; >+ updateButtons(); >+ } >+ >+ public void updateButtons() { >+ Button okButton = getButton(IDialogConstants.OK_ID); >+ if (isPageComplete) { >+ if (okButton != null) { >+ okButton.setEnabled(true); >+ } >+ } else { >+ if (okButton != null) { >+ okButton.setEnabled(false); >+ } >+ } >+ } >+ > } >Index: src-uml2sd/org/eclipse/hyades/uml2sd/util/SDPrintDialogUI.java >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.common.ui/src-uml2sd/org/eclipse/hyades/uml2sd/util/SDPrintDialogUI.java,v >retrieving revision 1.1 >diff -u -r1.1 SDPrintDialogUI.java >--- src-uml2sd/org/eclipse/hyades/uml2sd/util/SDPrintDialogUI.java 16 Aug 2006 21:15:19 -0000 1.1 >+++ src-uml2sd/org/eclipse/hyades/uml2sd/util/SDPrintDialogUI.java 5 Dec 2007 11:55:18 -0000 >@@ -1,5 +1,5 @@ > /********************************************************************** >- * Copyright (c) 2005, 2006 IBM Corporation and others. >+ * Copyright (c) 2005, 2007 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -18,6 +18,7 @@ > import org.eclipse.hyades.uml2sd.ui.view.NGC; > import org.eclipse.hyades.uml2sd.ui.view.SDWidget; > import org.eclipse.jface.dialogs.MessageDialog; >+import org.eclipse.jface.wizard.WizardPage; > import org.eclipse.swt.SWT; > import org.eclipse.swt.events.FocusEvent; > import org.eclipse.swt.events.FocusListener; >@@ -132,7 +133,11 @@ > int test=3; > > public static int r=0; >- >+ >+ // bug 195026 >+ private WizardPage parentWizardPage = null; >+ private SDPrintDialog parentDialog = null; >+ > private class LocalSD extends SDWidget > { > >@@ -500,9 +505,11 @@ > setShell(s); > view = v; > showPrintButton = showPrintBtn; >- >- printerData=Printer.getDefaultPrinterData(); >- printerData.scope = PrinterData.SELECTION; >+ >+ printerData = Printer.getDefaultPrinterData(); >+ if (printerData != null) { >+ printerData.scope = PrinterData.SELECTION; >+ } > > pagesList = new int[0]; > >@@ -823,7 +830,8 @@ > }); > } > >- >+ updatePrinterStatus(); >+ > return parent; > } > >@@ -943,35 +951,37 @@ > float cw =overviewCanvas.getContentsWidth()/overviewCanvas.zoomValue; > float ch =overviewCanvas.getContentsHeight()/overviewCanvas.zoomValue; > try { >- Printer printer = new Printer(printerData); >- if (setHPagesNumber.getSelection()) { >- nbPages = Integer.valueOf(hPagesNum.getText()).intValue(); >- float z1 = (float)view.getContentsWidth() / (cw); >- float z2 = printer.getClientArea().width >- / ((float)view.getContentsWidth() / nbPages); >- >- stepY = printer.getClientArea().height / z1 / z2; >- stepX = cw / nbPages; >- } else if (setVPagesNumber.getSelection()) { >- nbPages = Integer.valueOf(vPagesNum.getText()).intValue(); >- float z1 = (float)view.getContentsHeight() / (ch); >- float z2 = printer.getClientArea().height >- / ((float)view.getContentsHeight() / nbPages); >- stepX = printer.getClientArea().width / z1 / z2; >- stepY = ch / nbPages; >- } >- else >- { >- float z1 = view.getContentsWidth() / (cw); >- stepX= ((float)view.getVisibleWidth() /z1 ); >- nbPages=Math.round(cw/stepX); >- if (nbPages==0) >- nbPages=1; >- int pw=printer.getClientArea().width; >- int ph=printer.getClientArea().height; >- float z2 = pw >- / ((float)view.getContentsWidth() / nbPages); >- stepY = ((float)ph / z1 / z2); >+ if (printerData == null) { >+ stepX = 0; >+ stepY = 0; >+ nbPages = 0; >+ zoomFactor = 0; >+ } else { >+ Printer printer = new Printer(printerData); >+ if (setHPagesNumber.getSelection()) { >+ nbPages = Integer.valueOf(hPagesNum.getText()).intValue(); >+ float z1 = (float) view.getContentsWidth() / (cw); >+ float z2 = printer.getClientArea().width / ((float) view.getContentsWidth() / nbPages); >+ >+ stepY = printer.getClientArea().height / z1 / z2; >+ stepX = cw / nbPages; >+ } else if (setVPagesNumber.getSelection()) { >+ nbPages = Integer.valueOf(vPagesNum.getText()).intValue(); >+ float z1 = (float) view.getContentsHeight() / (ch); >+ float z2 = printer.getClientArea().height / ((float) view.getContentsHeight() / nbPages); >+ stepX = printer.getClientArea().width / z1 / z2; >+ stepY = ch / nbPages; >+ } else { >+ float z1 = view.getContentsWidth() / (cw); >+ stepX = ((float) view.getVisibleWidth() / z1); >+ nbPages = Math.round(cw / stepX); >+ if (nbPages == 0) >+ nbPages = 1; >+ int pw = printer.getClientArea().width; >+ int ph = printer.getClientArea().height; >+ float z2 = pw / ((float) view.getContentsWidth() / nbPages); >+ stepY = ((float) ph / z1 / z2); >+ } > } > } catch (Exception e) { > stepX=stepY=nbPages=0; >@@ -1135,7 +1145,13 @@ > printer.setStartPage(from); > printer.setEndPage(to); > } >- printerData=printer.open(); >+ >+ PrinterData newPrinterData = printer.open(); >+ if (newPrinterData != null) { >+ printerData = newPrinterData; >+ } >+ updatePrinterStatus(); >+ > if (printer.getScope()==PrinterData.ALL_PAGES) > { > allPages.setSelection(true); >@@ -1159,4 +1175,39 @@ > computeStepXY(); > overviewCanvas.redraw(); > } >+ >+ public void setParentWizardPage(WizardPage parent) { >+ parentWizardPage = parent; >+ } >+ >+ public void setParentDialog(SDPrintDialog parent) { >+ parentDialog = parent; >+ } >+ >+ protected void updatePrinterStatus() { >+ if (parentWizardPage != null) { >+ // used in the wizard dialog >+ if (printerData == null) { >+ // show error message and disable Finish button >+ parentWizardPage.setErrorMessage(SDMessages._135); >+ parentWizardPage.setPageComplete(false); >+ } else { >+ // clear error message and enable Finish button >+ parentWizardPage.setErrorMessage(null); >+ parentWizardPage.setPageComplete(true); >+ } >+ } else if (parentDialog != null) { >+ // used in the print dialog >+ if (printerData == null) { >+ // show error message and disable OK button >+ parentDialog.setErrorMessage(SDMessages._135); >+ parentDialog.setPageComplete(false); >+ } else { >+ // clear error message and enable OK button >+ parentDialog.setErrorMessage(null); >+ parentDialog.setPageComplete(true); >+ } >+ } >+ } >+ > } >Index: src-uml2sd/org/eclipse/hyades/uml2sd/internal/reports/PrintSDViewReportWizard.java >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.common.ui/src-uml2sd/org/eclipse/hyades/uml2sd/internal/reports/PrintSDViewReportWizard.java,v >retrieving revision 1.2 >diff -u -r1.2 PrintSDViewReportWizard.java >--- src-uml2sd/org/eclipse/hyades/uml2sd/internal/reports/PrintSDViewReportWizard.java 20 Sep 2006 20:56:27 -0000 1.2 >+++ src-uml2sd/org/eclipse/hyades/uml2sd/internal/reports/PrintSDViewReportWizard.java 5 Dec 2007 11:55:18 -0000 >@@ -1,5 +1,5 @@ > /* *********************************************************** >- * Copyright (c) 2005, 2006 IBM Corporation and others. >+ * Copyright (c) 2005, 2007 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -81,16 +81,7 @@ > protected void addReportPages() throws Exception { > addPage(reportPage); > } >- >- /** >- * @see org.eclipse.jface.wizard.IWizard#canFinish() >- */ >- public boolean canFinish() { >- >- return true; >- >- } >- >+ > /** > * > * @param viewer >Index: src-uml2sd/org/eclipse/hyades/uml2sd/internal/reports/PrintSDViewReportPage.java >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.common.ui/src-uml2sd/org/eclipse/hyades/uml2sd/internal/reports/PrintSDViewReportPage.java,v >retrieving revision 1.1 >diff -u -r1.1 PrintSDViewReportPage.java >--- src-uml2sd/org/eclipse/hyades/uml2sd/internal/reports/PrintSDViewReportPage.java 16 Aug 2006 21:15:27 -0000 1.1 >+++ src-uml2sd/org/eclipse/hyades/uml2sd/internal/reports/PrintSDViewReportPage.java 5 Dec 2007 11:55:18 -0000 >@@ -1,5 +1,5 @@ > /********************************************************************** >- * Copyright (c) 2005, 2006 IBM Corporation and others. >+ * Copyright (c) 2005, 2007 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -39,7 +39,8 @@ > public void createControl(Composite parent) { > > dialogUI = new SDPrintDialogUI(getShell(), view.getSDWidget(), true); >- >+ dialogUI.setParentWizardPage(this); >+ > Composite composite = new Composite(parent, SWT.NONE); > GridLayout layout = new GridLayout(); > composite.setLayout(layout);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 195026
: 84511