summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-07-28 16:44:26 (EDT)
committerEike Stepper2007-07-28 16:44:26 (EDT)
commitada3ee39047784b6b9d6e775bff977c8c421be48 (patch)
tree7fd9aac21119b9491c2adaded29d50990b2baeb6
parent5913d01f211c818923e06ebff98356d73db8be2d (diff)
downloadcdo-ada3ee39047784b6b9d6e775bff977c8c421be48.zip
cdo-ada3ee39047784b6b9d6e775bff977c8c421be48.tar.gz
cdo-ada3ee39047784b6b9d6e775bff977c8c421be48.tar.bz2
*** empty log message ***
-rw-r--r--plugins/org.eclipse.net4j.ui/plugin.xml6
-rw-r--r--plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/widgets/HistoryView.java67
-rw-r--r--plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/widgets/PreferenceButton.java117
3 files changed, 117 insertions, 73 deletions
diff --git a/plugins/org.eclipse.net4j.ui/plugin.xml b/plugins/org.eclipse.net4j.ui/plugin.xml
index d3392f4..845447e 100644
--- a/plugins/org.eclipse.net4j.ui/plugin.xml
+++ b/plugins/org.eclipse.net4j.ui/plugin.xml
@@ -9,12 +9,6 @@
id="org.eclipse.net4j.ui"
name="Net4j">
</category>
- <!--<view
- category="org.eclipse.net4j.ui"
- class="org.eclipse.net4j.ui.widgets.HistoryView"
- id="org.eclipse.net4j.ui.views.HistoryView"
- name="History">
- </view>-->
<view
category="org.eclipse.net4j.ui"
class="org.eclipse.net4j.internal.ui.views.AcceptorsView"
diff --git a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/widgets/HistoryView.java b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/widgets/HistoryView.java
deleted file mode 100644
index 74c9eff..0000000
--- a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/widgets/HistoryView.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/***************************************************************************
- * Copyright (c) 2004 - 2007 Eike Stepper, Germany.
- * 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- **************************************************************************/
-package org.eclipse.net4j.ui.widgets;
-
-import org.eclipse.net4j.internal.ui.bundle.OM;
-import org.eclipse.net4j.ui.UIUtil;
-import org.eclipse.net4j.util.collection.HistoryUtil;
-import org.eclipse.net4j.util.collection.IHistory;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.part.ViewPart;
-
-/**
- * @author Eike Stepper
- */
-@Deprecated
-public class HistoryView extends ViewPart
-{
- public static final IHistory<String> HISTORY = HistoryUtil.createPreferenceHistory(OM.PREF_HISTORY);
-
- private HistoryText control;
-
- public HistoryView()
- {
- }
-
- @Override
- public void createPartControl(Composite parent)
- {
- Composite composite = UIUtil.createGridComposite(parent, 2);
- control = new HistoryText(composite, SWT.NONE, HISTORY);
- control.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
- Button button = new Button(composite, SWT.PUSH);
- button.setText("Use");
- button.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false));
- button.addSelectionListener(new SelectionAdapter()
- {
- @Override
- public void widgetSelected(SelectionEvent e)
- {
- HISTORY.add(control.getText());
- }
- });
- }
-
- @Override
- public void setFocus()
- {
- if (control != null)
- {
- control.setFocus();
- }
- }
-}
diff --git a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/widgets/PreferenceButton.java b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/widgets/PreferenceButton.java
new file mode 100644
index 0000000..2885c03
--- /dev/null
+++ b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/widgets/PreferenceButton.java
@@ -0,0 +1,117 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2007 Eike Stepper, Germany.
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.net4j.ui.widgets;
+
+import org.eclipse.net4j.ui.UIUtil;
+import org.eclipse.net4j.util.om.pref.OMPreference;
+
+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.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * @author Eike Stepper
+ */
+public class PreferenceButton extends Composite
+{
+ private OMPreference<Boolean> preference;
+
+ private Button button;
+
+ public PreferenceButton(Composite parent, int buttonStyle, final OMPreference<Boolean> preference)
+ {
+ super(parent, SWT.NONE);
+ setLayout(UIUtil.createGridLayout(1));
+ this.preference = preference;
+
+ button = createButton(buttonStyle);
+ button.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ button.setSelection(preference.getValue());
+ button.addSelectionListener(new SelectionAdapter()
+ {
+ @Override
+ public void widgetSelected(SelectionEvent e)
+ {
+ preference.setValue(button.getSelection());
+ }
+ });
+ }
+
+ public OMPreference<Boolean> getPreference()
+ {
+ return preference;
+ }
+
+ public Button getButton()
+ {
+ return button;
+ }
+
+ protected Button createButton(int buttonStyle)
+ {
+ return new Button(this, buttonStyle);
+ }
+
+ public void addSelectionListener(SelectionListener listener)
+ {
+ button.addSelectionListener(listener);
+ }
+
+ public int getAlignment()
+ {
+ return button.getAlignment();
+ }
+
+ public Image getImage()
+ {
+ return button.getImage();
+ }
+
+ public boolean getSelection()
+ {
+ return button.getSelection();
+ }
+
+ public String getText()
+ {
+ return button.getText();
+ }
+
+ public void removeSelectionListener(SelectionListener listener)
+ {
+ button.removeSelectionListener(listener);
+ }
+
+ public void setAlignment(int alignment)
+ {
+ button.setAlignment(alignment);
+ }
+
+ public void setImage(Image image)
+ {
+ button.setImage(image);
+ }
+
+ public void setSelection(boolean selected)
+ {
+ button.setSelection(selected);
+ }
+
+ public void setText(String string)
+ {
+ button.setText(string);
+ }
+}