Author: scabanovich
Date: 2009-04-22 10:15:46 -0400 (Wed, 22 Apr 2009)
New Revision: 14848
Removed:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/JavaChoicerEditor.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/TabbedJavaChoicerFieldEditor.java
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/plugin.xml
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/XAttributeSupport.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/JavaEclipseChoicerEditor.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4140
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/plugin.xml
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/plugin.xml 2009-04-22 09:27:47
UTC (rev 14847)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/plugin.xml 2009-04-22 14:15:46
UTC (rev 14848)
@@ -357,8 +357,6 @@
class="org.jboss.tools.common.model.ui.action.XModelObjectActionInvoker"/>
<xclass
id="org.jboss.tools.common.model.ui.attribute.editor.CheckBoxEditor"
class="org.jboss.tools.common.model.ui.attribute.editor.CheckBoxEditor"/>
- <xclass
id="org.jboss.tools.common.model.ui.attribute.editor.JavaEclipseChoicerFieldEditor"
- class="org.jboss.tools.common.model.ui.attribute.editor.JavaEclipseChoicerFieldEditor"/>
<xclass
id="org.jboss.tools.common.model.ui.attribute.editor.JavaHyperlinkLineFieldEditor"
class="org.jboss.tools.common.model.ui.attribute.editor.JavaHyperlinkLineFieldEditor"/>
<xclass id="org.jboss.tools.common.model.ui.attribute.editor.NoteEditor"
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/XAttributeSupport.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/XAttributeSupport.java 2009-04-22
09:27:47 UTC (rev 14847)
+++
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/XAttributeSupport.java 2009-04-22
14:15:46 UTC (rev 14848)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.common.model.ui.attribute;
+
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -27,7 +28,6 @@
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.JavaChoicerEditor;
import org.jboss.tools.common.model.ui.attribute.editor.JavaHyperlinkLineFieldEditor;
import org.jboss.tools.common.model.ui.attribute.editor.PropertyEditor;
import org.jboss.tools.common.model.ui.attribute.editor.PropertyEditorFactory;
@@ -291,11 +291,9 @@
fieldEditor = editor.getFieldEditor(composite);
} else {
StringButtonFieldEditorEx sb;
- if (editor instanceof JavaChoicerEditor) {
- sb = new JavaHyperlinkLineFieldEditor(settings);
- } else {
- sb = new StringButtonFieldEditorEx(settings);
- }
+
+ sb = new StringButtonFieldEditorEx(settings);
+
sb.setLabelText(editor.getLabelText());
sb.setPropertyEditor(editor);
String changeButtonName = editor.getChangeButtonName();
@@ -338,11 +336,9 @@
fieldEditor = editor.getFieldEditor(composite);
} else {
StringButtonFieldEditorEx sb = null;
- if (editor instanceof JavaChoicerEditor) {
- sb = new JavaHyperlinkLineFieldEditor(settings);
- } else {
- sb = new StringButtonFieldEditorEx(settings);
- }
+
+ sb = new StringButtonFieldEditorEx(settings);
+
sb.setLabelText(editor.getLabelText());
String changeButtonName = editor.getChangeButtonName();
if(changeButtonName != null) {
Deleted:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/JavaChoicerEditor.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/JavaChoicerEditor.java 2009-04-22
09:27:47 UTC (rev 14847)
+++
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/JavaChoicerEditor.java 2009-04-22
14:15:46 UTC (rev 14848)
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * 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
- ******************************************************************************/
-package org.jboss.tools.common.model.ui.attribute.editor;
-
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-
-import org.jboss.tools.common.model.ui.widgets.IWidgetSettings;
-
-@Deprecated
-public class JavaChoicerEditor extends ValueEditor {
-
- protected DialogCellEditorEx cellEditor;
- //protected JavaChoicerFieldEditor fieldEditor;
- protected TabbedJavaChoicerFieldEditor fieldEditor;
-
- public JavaChoicerEditor() {}
-
- public JavaChoicerEditor(IWidgetSettings settings) {
- super(settings);
- }
-
- public void dispose() {
- super.dispose();
- if (cellEditor!=null) cellEditor.dispose();
- cellEditor = null;
- if (fieldEditor!=null) fieldEditor.dispose();
- fieldEditor = null;
- }
-
- public boolean isGreedyEditor() {
- return true;
- }
-
- protected CellEditor createCellEditor(Composite parent) {
-// cellEditor = new DialogCellEditorEx(parent, SWT.NONE);
- cellEditor = new JavaHyperlinkCellEditor(parent, SWT.NONE);
- cellEditor.setPropertyEditor(this);
- return cellEditor;
- }
-
- protected ExtendedFieldEditor createFieldEditor(Composite parent) {
- //fieldEditor = new JavaChoicerFieldEditor();
- fieldEditor = new TabbedJavaChoicerFieldEditor(settings);
- //fieldEditor.setLabelText(getLabelText());
- return fieldEditor;
- }
-
- public String getChangeButtonName() {
- return JFaceResources.getString("openBrowse");
- }
-
-}
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/JavaEclipseChoicerEditor.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/JavaEclipseChoicerEditor.java 2009-04-22
09:27:47 UTC (rev 14847)
+++
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/JavaEclipseChoicerEditor.java 2009-04-22
14:15:46 UTC (rev 14848)
@@ -64,9 +64,7 @@
}
protected ExtendedFieldEditor createFieldEditor(Composite parent) {
- //fieldEditor = new JavaChoicerFieldEditor();
fieldEditor = new JavaHyperlinkLineFieldEditor(settings);
- //fieldEditor.setLabelText(getLabelText());
return fieldEditor;
}
Deleted:
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 2009-04-22
09:27:47 UTC (rev 14847)
+++
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/JavaEclipseChoicerFieldEditor.java 2009-04-22
14:15:46 UTC (rev 14848)
@@ -1,268 +0,0 @@
-/*******************************************************************************
- * 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
- ******************************************************************************/
-package org.jboss.tools.common.model.ui.attribute.editor;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.lang.reflect.Field;
-import java.util.ArrayList;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-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.Signature;
-import org.eclipse.jdt.core.search.IJavaSearchScope;
-import org.eclipse.jdt.core.search.SearchEngine;
-import org.eclipse.jdt.core.search.TypeNameMatch;
-//import org.eclipse.jdt.internal.ui.dialogs.TypeInfoViewer;
-//import org.eclipse.jdt.internal.ui.dialogs.TypeSelectionComponent;
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Table;
-import org.jboss.tools.common.model.XModelObject;
-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.widgets.IWidgetSettings;
-import org.jboss.tools.common.model.util.EclipseResourceUtil;
-
-@Deprecated
-public class JavaEclipseChoicerFieldEditor extends ExtendedFieldEditor implements
IFieldEditor, IPropertyFieldEditor, PropertyChangeListener {
- protected IPropertyEditor propertyEditor;
- protected IValueChangeListener valueChangeListener;
- protected IValueProvider valueProvider;
-
-// protected TypeSelectionComponent tc;
- protected String filter;
- protected String javaProjectName;
-
- public JavaEclipseChoicerFieldEditor() {}
-
- public JavaEclipseChoicerFieldEditor(IWidgetSettings settings) {
- super(settings);
- }
-
- protected void adjustForNumColumns(int numColumns) {
- }
-
- protected void doFillIntoGrid(Composite parent, int numColumns) {
- }
-
- protected void doLoad() {
- }
-
- protected void doLoadDefault() {
- }
-
- protected void doStore() {
-// if(tc != null && tc.getSelection() != null &&
tc.getSelection().length > 0) {
-// valueProvider.setValue(tc.getSelection()[0].getFullyQualifiedName());
-// }
- }
-
- public int getNumberOfControls() {
- return 1;
- }
-
- public Control[] getControls(Composite parent) {
- return new Control[] { getControl(parent) };
- }
-
- private IJavaSearchScope getScope() {
- IJavaElement[] elements = new IJavaElement[0];
- if(javaProjectName != null) {
- IPath path = new Path(javaProjectName);
- IResource res = ResourcesPlugin.getWorkspace().getRoot().findMember(path);
- IProject proj = res.getProject();
- IJavaProject jproject = JavaCore.create(proj);
- IPackageFragmentRoot fCurrRoot = jproject.getPackageFragmentRoot(res);
- elements = new IJavaElement[] { fCurrRoot.getJavaProject() };
- } else {
- IProject[] ps = ModelPlugin.getWorkspace().getRoot().getProjects();
- ArrayList<IJavaElement> l = new ArrayList<IJavaElement>();
- for (int i = 0; i < ps.length; i++) {
- if(EclipseResourceUtil.getJavaProject(ps[i]) != null) l.add(JavaCore.create(ps[i]));
- }
- elements = l.toArray(new IJavaElement[0]);
- }
- return SearchEngine.createJavaSearchScope(elements);
- }
-
-// private class TitleLabel implements TypeSelectionComponent.ITitleLabel {
-// public void setText(String text) {
-// }
-// }
-
- protected Control getControl(Composite parent) {
- IJavaSearchScope scope = getScope();
-// String title =
EditorMessages.getString("JavaEclipseChoicerFieldEditor.ChooseType.Label");
- String message =
EditorMessages.getString("JavaEclipseChoicerFieldEditor.ChooseType.Label");
- if (this.valueProvider!=null) {
- filter = (String)this.valueProvider.getValue(); // string fron text field!
- } else {
- filter = "java.lang.Object";
- }
-
-// tc = new TypeSelectionComponent(parent, 0, message, false, scope,
0/*IJavaSearchConstants.CLASS + IJavaSearchConstants.INTERFACE*/,
Signature.getSimpleName(filter), new TitleLabel(), null);
- Composite composite = null; //tc;
-// tc.triggerSearch();
-
- GridLayout layout = new GridLayout(1, false);
- composite.setLayout(layout);
- layout.horizontalSpacing = 7;
- layout.verticalSpacing = 7;
- layout.marginHeight = 10;
- layout.marginWidth = 10;
-
-// tc.addSelectionListener(new SelectionListener() {
-// public void widgetDefaultSelected(SelectionEvent e) {
-// if(hasFocus(tc)) handle(tc.getSelection());
-// }
-// public void widgetSelected(SelectionEvent e) {
-// if(hasFocus(tc)) handle(tc.getSelection());
-// }
-// });
-
- Table table = getTable();
- if(table != null) {
- table.addMouseListener(new MouseAdapter() {
- public void mouseDoubleClick(MouseEvent e) {
- if(getOwnerDialog() != null) {
- getOwnerDialog().okPressed();
- }
- }
- });
- }
- return composite;
- }
-
- Table getTable() {
-// try {
-// Field f = TypeSelectionComponent.class.getDeclaredField("fViewer");
-// if(f == null) return null;
-// f.setAccessible(true);
-// TypeInfoViewer v = (TypeInfoViewer)f.get(tc);
-// return v == null ? null : v.getTable();
-// } catch (NoSuchFieldException ee) {
-//
-// } catch (IllegalArgumentException e2) {
-//
-// } catch (IllegalAccessException e3) {
-//
-// }
- return null;
- }
-
- boolean hasFocus(Composite c) {
- if(c.isFocusControl()) return true;
- Control[] cs = c.getChildren();
- for (int i = 0; i < cs.length; i++) {
- if(cs[i].isFocusControl()) return true;
- if(cs[i] instanceof Composite) {
- if(hasFocus((Composite)cs[i])) return true;
- }
- }
- return false;
- }
-
- private void handle(TypeNameMatch[] selection) {
- if(selection == null || selection.length == 0) {
- this.valueProvider.removeValueChangeListener(this);
- valueChangeListener.valueChange(new PropertyChangeEvent(this, PropertyEditor.VALUE,
"", ""));
- this.valueProvider.addValueChangeListener(this);
- } else {
- this.valueProvider.removeValueChangeListener(this);
- valueChangeListener.valueChange(new PropertyChangeEvent(this, PropertyEditor.VALUE,
"", selection[0].getFullyQualifiedName()));
- this.valueProvider.addValueChangeListener(this);
- }
- }
-
- private boolean localChange = false;
-
- //never invoked
- void handleSelectionChange(PropertyChangeEvent event) {
- if (!localChange) {
- this.valueProvider.removeValueChangeListener(this);
- valueChangeListener.valueChange(new PropertyChangeEvent(this, PropertyEditor.VALUE,
event.getOldValue(), event.getNewValue()));
- this.valueProvider.addValueChangeListener(this);
- }
- }
-
- public void setEnabled(boolean enabled){
- super.setEnabled(enabled);
- }
-
- // IPropertyFieldEditor
- public void setPropertyEditor(IPropertyEditor propertyEditor) {
- this.propertyEditor = propertyEditor;
- if (propertyEditor!=null) {
- valueProvider = (IValueProvider)propertyEditor.getAdapter(IValueProvider.class);
- // GET Java Project Name!
- if (valueProvider instanceof DefaultValueAdapter) {
- if (((DefaultValueAdapter)valueProvider).getModel()!=null) {
- XModelObject xmo =
((DefaultValueAdapter)valueProvider).getModel().getByPath("FileSystems");
- if (xmo!=null) {
- IProject project =
(IProject)xmo.getModel().getProperties().get("project");
- if (project!=null) {
- this.javaProjectName = project.getName();
- }
- }
- }
- }
- valueProvider.addValueChangeListener(this);
- valueChangeListener =
(IValueChangeListener)propertyEditor.getAdapter(IValueChangeListener.class);
- }
- }
-
- // java.beans.PropertyChangeListener for valueProvider
- public void propertyChange(PropertyChangeEvent event) {
- /*
- localChange = true;
- if((IPropertyEditor.VALUE.equals(event.getPropertyName()))&&(event!=null)&&(event.getNewValue()
instanceof String)) {
- this.filter = (String)event.getNewValue();
- }
- if (ts!=null) {
- try {
- this.ts.setFilter(Signature.getSimpleName(filter));
- } catch (Exception e) {
- // eat exception: widget disposed
- }
- }
- localChange = false;
- */
- }
-
- public void cut() {
- }
-
- public void copy() {
- }
-
- public void paste() {
- }
-
- public void delete() {
- }
-
-}
Deleted:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/TabbedJavaChoicerFieldEditor.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/TabbedJavaChoicerFieldEditor.java 2009-04-22
09:27:47 UTC (rev 14847)
+++
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/TabbedJavaChoicerFieldEditor.java 2009-04-22
14:15:46 UTC (rev 14848)
@@ -1,181 +0,0 @@
-/*******************************************************************************
- * 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
- ******************************************************************************/
-package org.jboss.tools.common.model.ui.attribute.editor;
-
-import org.jboss.tools.common.core.jdt.FavoritesClassController;
-import org.jboss.tools.common.model.ui.IValueProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Color;
-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.TabFolder;
-import org.eclipse.swt.widgets.TabItem;
-
-import org.jboss.tools.common.model.ui.ModelUIPlugin;
-import org.jboss.tools.common.model.ui.widgets.IWidgetSettings;
-
-@Deprecated
-public class TabbedJavaChoicerFieldEditor extends ExtendedFieldEditor implements
IPropertyFieldEditor {
-
- private static final String LAST_CHOICER =
"TabbedJavaChoicerFieldEditor.LastChoicer";
- private static final int WINDOW_HEIGHT = 400;
-
- protected IPropertyEditor propertyEditor;
- protected TabFolder tabbedPane;
- protected int selectedTab = 0;
-
- protected JavaChoicerFieldEditor classicEditor;
- protected JavaEclipseChoicerFieldEditor eclipseEditor;
- protected JavaFavoritesFieldEditor favoritesEditor;
-
- public TabbedJavaChoicerFieldEditor() {}
-
- public TabbedJavaChoicerFieldEditor(IWidgetSettings settings) {
- super(settings);
- classicEditor = new JavaChoicerFieldEditor(settings);
-// eclipseEditor = new JavaEclipseChoicerFieldEditor(settings);
- favoritesEditor = new JavaFavoritesFieldEditor(settings);
- }
-
- public void setOwnerDialog(PropertyEditorDialog dialog) {
- classicEditor.setOwnerDialog(dialog);
-// eclipseEditor.setOwnerDialog(dialog);
- favoritesEditor.setOwnerDialog(dialog);
- }
-
- protected void adjustForNumColumns(int numColumns) {
- }
-
- protected void doFillIntoGrid(Composite parent, int numColumns) {
- Control control = createTabbedPane(parent);
- GridData gd = new GridData(GridData.FILL_BOTH);
- gd.horizontalSpan = numColumns;
- control.setLayoutData(gd);
- }
-
- protected void doLoad() {
- }
-
- protected void doLoadDefault() {
- }
-
- protected void doStore() {
- }
-
- public int getNumberOfControls() {
- return 1;
- }
-
- protected Composite createTabbedPane(Composite parent) {
- GridData gd;
-
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setBackground(new Color(null,128,128,0));
- GridLayout layout = new GridLayout(1, false);
- composite.setLayout(layout);
- layout.horizontalSpacing = 0;
- layout.verticalSpacing = 0;
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- gd = new GridData(GridData.FILL_BOTH);
- gd.heightHint = WINDOW_HEIGHT;
- composite.setLayoutData(gd);
-
- tabbedPane = new TabFolder(composite, SWT.NONE);
- gd = new GridData(GridData.FILL_BOTH);
- gd.heightHint = WINDOW_HEIGHT;
- tabbedPane.setLayoutData(gd);
- // eclipse
-// TabItem eclipseChooser = new TabItem(tabbedPane, SWT.NONE);
-// eclipseChooser.setControl(createEclipseChooser(tabbedPane));
-// eclipseChooser.setText(EditorMessages.getString("TabbedJavaChoicerFieldEditor.Tab2.Label"));
- // classic
- TabItem classicChooser = new TabItem(tabbedPane, SWT.NONE);
- classicChooser.setControl(createClassicChooser(tabbedPane));
- classicChooser.setText(EditorMessages.getString("TabbedJavaChoicerFieldEditor.Tab1.Label"));
- // favorites
- TabItem favoritesChooser = new TabItem(tabbedPane, SWT.NONE);
- favoritesChooser.setControl(createFavoritesChooser(tabbedPane));
- favoritesChooser.setText(EditorMessages.getString("TabbedJavaChoicerFieldEditor.Tab3.Label"));
-
- int lastIndex = ModelUIPlugin.getDefault().getPreferenceStore().getInt(LAST_CHOICER);
- if(lastIndex >= 0 && lastIndex < 3) {
- selectedTab = lastIndex;
- tabbedPane.setSelection(lastIndex);
- }
-
- tabbedPane.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- handleTabbedPaneSelection();
- }
- public void widgetDefaultSelected(SelectionEvent e) {
- }
- });
-
- return composite;
- }
-
- private void handleTabbedPaneSelection() {
- selectedTab = tabbedPane.getSelectionIndex();
- tabbedPane.getItem(selectedTab).getControl().setFocus();
- ModelUIPlugin.getDefault().getPreferenceStore().setValue(LAST_CHOICER,selectedTab);
- }
-
- protected Control createClassicChooser(Composite parent) {
- return classicEditor.getControls(parent)[0];
- }
-// protected Control createEclipseChooser(Composite parent) {
-// return eclipseEditor.getControls(parent)[0];
-// }
- protected Control createFavoritesChooser(Composite parent) {
- return favoritesEditor.getControls(parent)[0];
- }
-
- //IPropertyFieldEditor
- public void setPropertyEditor(IPropertyEditor propertyEditor) {
- this.propertyEditor = propertyEditor;
- classicEditor.setPropertyEditor(propertyEditor);
-// eclipseEditor.setPropertyEditor(propertyEditor);
- favoritesEditor.setPropertyEditor(propertyEditor);
- }
-
- public void store() {
- super.store();
- //if (selectedTab==1) eclipseEditor.doStore(); // bugfix 8136 && 8155
- IValueProvider valueProvider =
(IValueProvider)propertyEditor.getAdapter(IValueProvider.class);
- String selectedClass = (String)valueProvider.getValue();
- FavoritesClassController.push(selectedClass);
- }
-
- public void setEnabled(boolean enabled){
- super.setEnabled(enabled);
- if (classicEditor!=null) classicEditor.setEnabled(enabled);
-// if (eclipseEditor!=null) eclipseEditor.setEnabled(enabled);
- if (favoritesEditor!=null) favoritesEditor.setEnabled(enabled);
- }
-
- public void cut() {
- }
-
- public void copy() {
- }
-
- public void paste() {
- }
-
- public void delete() {
- }
-
-}