Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarvin Mueller2014-09-09 12:38:42 +0000
committerMarvin Mueller2014-09-11 06:04:13 +0000
commit9e8a39357a9d5ec0fca19d9ba89e7ccd3c9adad7 (patch)
tree69d7e4647cf2554b42bbb8ba79e375966679fcce /org.eclipse.jubula.client.wiki.ui
parentb5b3edb9d6005ac2dc95c0f1639c2b221b738775 (diff)
downloadorg.eclipse.jubula.core-9e8a39357a9d5ec0fca19d9ba89e7ccd3c9adad7.tar.gz
org.eclipse.jubula.core-9e8a39357a9d5ec0fca19d9ba89e7ccd3c9adad7.tar.xz
org.eclipse.jubula.core-9e8a39357a9d5ec0fca19d9ba89e7ccd3c9adad7.zip
Sprint task - adding default size, the sash is saved and the scrollbar of the markup viewer is in nearly the same place
Diffstat (limited to 'org.eclipse.jubula.client.wiki.ui')
-rw-r--r--org.eclipse.jubula.client.wiki.ui/src/org/eclipse/jubula/client/wiki/ui/Activator.java2
-rw-r--r--org.eclipse.jubula.client.wiki.ui/src/org/eclipse/jubula/client/wiki/ui/dialogs/DescriptionEditDialog.java51
2 files changed, 48 insertions, 5 deletions
diff --git a/org.eclipse.jubula.client.wiki.ui/src/org/eclipse/jubula/client/wiki/ui/Activator.java b/org.eclipse.jubula.client.wiki.ui/src/org/eclipse/jubula/client/wiki/ui/Activator.java
index f21a2226c..78c08e74e 100644
--- a/org.eclipse.jubula.client.wiki.ui/src/org/eclipse/jubula/client/wiki/ui/Activator.java
+++ b/org.eclipse.jubula.client.wiki.ui/src/org/eclipse/jubula/client/wiki/ui/Activator.java
@@ -30,12 +30,14 @@ public class Activator extends AbstractUIPlugin {
/** {@inheritDoc} */
public void start(BundleContext bundleContext) throws Exception {
+ super.start(bundleContext);
Activator.context = bundleContext;
activator = this;
}
/** {@inheritDoc} */
public void stop(BundleContext bundleContext) throws Exception {
+ super.stop(bundleContext);
Activator.context = null;
}
/**
diff --git a/org.eclipse.jubula.client.wiki.ui/src/org/eclipse/jubula/client/wiki/ui/dialogs/DescriptionEditDialog.java b/org.eclipse.jubula.client.wiki.ui/src/org/eclipse/jubula/client/wiki/ui/dialogs/DescriptionEditDialog.java
index b933ebc88..f5e043de8 100644
--- a/org.eclipse.jubula.client.wiki.ui/src/org/eclipse/jubula/client/wiki/ui/dialogs/DescriptionEditDialog.java
+++ b/org.eclipse.jubula.client.wiki.ui/src/org/eclipse/jubula/client/wiki/ui/dialogs/DescriptionEditDialog.java
@@ -10,6 +10,8 @@
*******************************************************************************/
package org.eclipse.jubula.client.wiki.ui.dialogs;
+
+import org.eclipse.jface.dialogs.DialogSettings;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.dialogs.TitleAreaDialog;
import org.eclipse.jface.text.Document;
@@ -41,6 +43,9 @@ import org.eclipse.swt.widgets.Shell;
*/
public class DescriptionEditDialog extends TitleAreaDialog {
+ /** key for dialog settings */
+ private static final String SASH_WEIGHTS = "sashWeights"; //$NON-NLS-1$
+
/** the wait time(ms) before the preview is updated */
private static final int WAIT_BEFORE_UPDATE = 400;
@@ -50,6 +55,9 @@ public class DescriptionEditDialog extends TitleAreaDialog {
/** the description text as document */
private IDocument m_description;
+ /** the sash which is used as main container*/
+ private SashForm m_sash;
+
/**
*
* @param parentShell the parent shell
@@ -71,12 +79,28 @@ public class DescriptionEditDialog extends TitleAreaDialog {
setMessage(Messages.EditDescriptionDialogDescription);
getShell().setText(dialogTitle);
- SashForm sashForm = new SashForm(parent, SWT.VERTICAL);
+ m_sash = new SashForm(parent, SWT.VERTICAL);
+ createDialogComponents(m_sash);
+ IDialogSettings settings = getDialogBoundsSettings();
+ String[] weights = settings.getArray(SASH_WEIGHTS);
+ try {
+ if (weights != null) {
+ int[] sashWeigths = new int[weights.length];
+ for (int i = 0; i < weights.length; i++) {
+ sashWeigths[i] = Integer.parseInt(weights[i]);
+ }
+ m_sash.setWeights(sashWeigths);
+ }
+ } catch (NumberFormatException nfe) {
+ // ignore
+ }
+
final GridData sashGridData = createGridData();
- sashForm.setLayoutData(sashGridData);
+ sashGridData.widthHint = 500;
+ sashGridData.heightHint = 500;
+ m_sash.setLayoutData(sashGridData);
- createDialogComponents(sashForm);
- return sashForm;
+ return m_sash;
}
/**
@@ -115,8 +139,10 @@ public class DescriptionEditDialog extends TitleAreaDialog {
public void run() {
Display.getDefault().syncExec(new Runnable() {
public void run() {
+ int test = viewer.getTopIndex();
viewer.setDocument(new Document(m_description
.get()));
+ viewer.setTopIndex(test);
}
});
}
@@ -194,7 +220,22 @@ public class DescriptionEditDialog extends TitleAreaDialog {
/** {@inheritDoc} */
protected IDialogSettings getDialogBoundsSettings() {
- return Activator.getActivator().getDialogSettings();
+ IDialogSettings bundleDialogSettings = Activator.getActivator()
+ .getDialogSettings();
+ return DialogSettings.getOrCreateSection(bundleDialogSettings,
+ this.getClass().getName());
}
+ /**
+ * {@inheritDoc}
+ */
+ public boolean close() {
+ int[] sashWeights = (m_sash.getWeights());
+ String[] weights = new String[sashWeights.length];
+ for (int i = 0; i < sashWeights.length; i++) {
+ weights[i] = Integer.toString(sashWeights[i]);
+ }
+ getDialogBoundsSettings().put(SASH_WEIGHTS, weights);
+ return super.close();
+ }
} \ No newline at end of file

Back to the top