Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStéphane Bégaudeau2016-10-14 14:28:01 +0000
committerStéphane Bégaudeau2016-10-14 14:29:08 +0000
commit6eb1253a5fd1e22ba43eb8aa48f11a76767b056f (patch)
tree98298ffe52d388090119c3f38a9c5d84cd16091f
parent7e904b1c3694adf4f47f259a956dedf6a511f25b (diff)
downloadorg.eclipse.eef-6eb1253a5fd1e22ba43eb8aa48f11a76767b056f.tar.gz
org.eclipse.eef-6eb1253a5fd1e22ba43eb8aa48f11a76767b056f.tar.xz
org.eclipse.eef-6eb1253a5fd1e22ba43eb8aa48f11a76767b056f.zip
[505813] Compute the tab descriptors only once
Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=505813 Change-Id: If1e6c9c9129746194ee165d364917ae946902c9b Signed-off-by: Stéphane Bégaudeau <stephane.begaudeau@obeo.fr>
-rw-r--r--plugins/org.eclipse.eef.properties.ui/src/org/eclipse/eef/properties/ui/api/EEFTabbedPropertySheetPage.java23
-rw-r--r--plugins/org.eclipse.eef.properties.ui/src/org/eclipse/eef/properties/ui/internal/page/EEFTabbedPropertyViewer.java53
2 files changed, 11 insertions, 65 deletions
diff --git a/plugins/org.eclipse.eef.properties.ui/src/org/eclipse/eef/properties/ui/api/EEFTabbedPropertySheetPage.java b/plugins/org.eclipse.eef.properties.ui/src/org/eclipse/eef/properties/ui/api/EEFTabbedPropertySheetPage.java
index cb108bd78..603e86c8e 100644
--- a/plugins/org.eclipse.eef.properties.ui/src/org/eclipse/eef/properties/ui/api/EEFTabbedPropertySheetPage.java
+++ b/plugins/org.eclipse.eef.properties.ui/src/org/eclipse/eef/properties/ui/api/EEFTabbedPropertySheetPage.java
@@ -137,11 +137,6 @@ public class EEFTabbedPropertySheetPage extends Page implements IPropertySheetPa
private ISelection currentSelection;
/**
- * The registry.
- */
- private EEFTabbedPropertyRegistry registry;
-
- /**
* The form used to contain the all the widgets.
*/
private Form form;
@@ -169,7 +164,6 @@ public class EEFTabbedPropertySheetPage extends Page implements IPropertySheetPa
*/
public EEFTabbedPropertySheetPage(IEEFTabbedPropertySheetPageContributor contributor) {
this.contributor = contributor;
- this.registry = EEFTabbedPropertyRegistry.getDefault(this.contributor);
}
/**
@@ -205,7 +199,7 @@ public class EEFTabbedPropertySheetPage extends Page implements IPropertySheetPa
this.form.setLayoutData(formData);
this.widgetFactory.paintBordersFor(form);
- this.tabbedPropertyViewer = new EEFTabbedPropertyViewer(this.tabbedPropertyComposite.getTabbedPropertyList(), this.registry);
+ this.tabbedPropertyViewer = new EEFTabbedPropertyViewer(this.tabbedPropertyComposite.getTabbedPropertyList());
this.viewerSelectionListener = new IEEFTabDescriptorChangedListener() {
@Override
public void selectionChanged(IEEFTabDescriptor descriptor) {
@@ -321,8 +315,8 @@ public class EEFTabbedPropertySheetPage extends Page implements IPropertySheetPa
this.updateTabs(descriptors);
}
// update tabs list
- this.tabbedPropertyViewer.setInput(part, currentSelection);
- int lastTabSelectionIndex = this.getLastTabSelection(part, currentSelection);
+ this.tabbedPropertyViewer.setInput(descriptors);
+ int lastTabSelectionIndex = this.getLastTabSelection(descriptors);
IEEFTabDescriptor selectedTab = this.tabbedPropertyViewer.getTabDescriptionAtIndex(lastTabSelectionIndex);
this.selectionQueueLocked = true;
try {
@@ -380,14 +374,11 @@ public class EEFTabbedPropertySheetPage extends Page implements IPropertySheetPa
/**
* Returns the last known selected tab for the given input.
*
- * @param part
- * The current workbench part
- * @param input
- * The current selection
+ * @param descriptors
+ * The tab descriptors
* @return The index of the currently selected tab (0, the first tab, by default)
*/
- private int getLastTabSelection(IWorkbenchPart part, ISelection input) {
- List<IEEFTabDescriptor> descriptors = registry.getTabDescriptors(part, input);
+ private int getLastTabSelection(List<IEEFTabDescriptor> descriptors) {
if (descriptors.size() != 0) {
for (String text : this.selectionQueue) {
int i = 0;
@@ -516,7 +507,7 @@ public class EEFTabbedPropertySheetPage extends Page implements IPropertySheetPa
this.tabToComposite.put(tab, tabComposite);
}
// force widgets to be resized
- tab.setInput(tabbedPropertyViewer.getWorkbenchPart(), tabbedPropertyViewer.getInput());
+ tab.setInput(this.currentPart, this.currentSelection);
// store tab selection
this.storeCurrentTabSelection(descriptor.getLabel());
diff --git a/plugins/org.eclipse.eef.properties.ui/src/org/eclipse/eef/properties/ui/internal/page/EEFTabbedPropertyViewer.java b/plugins/org.eclipse.eef.properties.ui/src/org/eclipse/eef/properties/ui/internal/page/EEFTabbedPropertyViewer.java
index 6054c1b41..f3edf411f 100644
--- a/plugins/org.eclipse.eef.properties.ui/src/org/eclipse/eef/properties/ui/internal/page/EEFTabbedPropertyViewer.java
+++ b/plugins/org.eclipse.eef.properties.ui/src/org/eclipse/eef/properties/ui/internal/page/EEFTabbedPropertyViewer.java
@@ -17,12 +17,9 @@ import java.util.List;
import org.eclipse.eef.properties.ui.api.IEEFTabDescriptor;
import org.eclipse.eef.properties.ui.internal.EEFTabbedPropertyViewPlugin;
import org.eclipse.eef.properties.ui.internal.page.propertylist.EEFTabbedPropertyList;
-import org.eclipse.eef.properties.ui.internal.registry.EEFTabbedPropertyRegistry;
import org.eclipse.jface.util.OpenStrategy;
-import org.eclipse.jface.viewers.ISelection;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.ui.IWorkbenchPart;
/**
* Viewer representing the property sheet page. On the left side it contains a list of tabs and on the right side it
@@ -64,31 +61,13 @@ public class EEFTabbedPropertyViewer {
private EEFTabbedPropertyList list;
/**
- * The workbench part.
- */
- private IWorkbenchPart part;
-
- /**
- * The tabbed property registry.
- */
- private EEFTabbedPropertyRegistry registry;
-
- /**
- * The input.
- */
- private ISelection input;
-
- /**
* The constructor.
*
* @param tabbedPropertyList
* The tabbed property list
- * @param registry
- * The tabbed property registry
*/
- public EEFTabbedPropertyViewer(EEFTabbedPropertyList tabbedPropertyList, EEFTabbedPropertyRegistry registry) {
+ public EEFTabbedPropertyViewer(EEFTabbedPropertyList tabbedPropertyList) {
this.list = tabbedPropertyList;
- this.registry = registry;
OpenStrategy handler = new OpenStrategy(this.list);
handler.addSelectionListener(new SelectionListener() {
@@ -131,19 +110,13 @@ public class EEFTabbedPropertyViewer {
/**
* Set the input for viewer.
*
- * @param workbenchPart
- * the workbench part.
- * @param selection
- * the selection in the workbench part.
+ * @param descriptors
+ * The tab descriptors
*/
- public void setInput(IWorkbenchPart workbenchPart, ISelection selection) {
+ public void setInput(List<IEEFTabDescriptor> descriptors) {
EEFTabbedPropertyViewPlugin.getPlugin().debug("EEFTabbedPropertyViewer#setInput()"); //$NON-NLS-1$
-
- this.part = workbenchPart;
- this.input = selection;
this.elements.clear();
- List<IEEFTabDescriptor> descriptors = this.registry.getTabDescriptors(this.part, selection);
list.removeAll();
for (IEEFTabDescriptor descriptor : descriptors) {
this.elements.add(descriptor);
@@ -153,24 +126,6 @@ public class EEFTabbedPropertyViewer {
}
/**
- * Return the input.
- *
- * @return the input
- */
- public ISelection getInput() {
- return this.input;
- }
-
- /**
- * Get the current workbench part.
- *
- * @return the current workbench part.
- */
- public IWorkbenchPart getWorkbenchPart() {
- return part;
- }
-
- /**
* Return the elements.
*
* @return the elements

Back to the top