Skip to content

Commit

Permalink
509684: EMF Parsley Editor problem with Properties view in Oxygen
Browse files Browse the repository at this point in the history
Change-Id: I6d58ba9a7b49bb1a33a74fd848e427473e058308
Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=509684
  • Loading branch information
LorenzoBettini committed Dec 23, 2016
1 parent fa20dc7 commit 581eb34
Showing 1 changed file with 25 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -139,7 +140,7 @@ public abstract class EmfAbstractEditor extends MultiPageEditorPart implements
*
* @generated
*/
protected PropertySheetPage propertySheetPage;
protected List<PropertySheetPage> propertySheetPages = new ArrayList<PropertySheetPage>();

/**
* This is the viewer that shadows the selection in the content outline. The
Expand Down Expand Up @@ -190,7 +191,7 @@ public void partActivated(IWorkbenchPart p) {
getActionBarContributor().setActiveEditor(EmfAbstractEditor.this);
}
} else if (p instanceof PropertySheet) {
if (((PropertySheet) p).getCurrentPage() == propertySheetPage) {
if (propertySheetPages.contains(((PropertySheet)p).getCurrentPage())) {
getActionBarContributor().setActiveEditor(EmfAbstractEditor.this);
handleActivate();
}
Expand Down Expand Up @@ -498,8 +499,13 @@ public void postCommandStackChanged(Command mostRecentCommand) {
if (mostRecentCommand != null) {
setSelectionToViewer(mostRecentCommand.getAffectedObjects());
}
if (propertySheetPage != null && !propertySheetPage.getControl().isDisposed()) {
propertySheetPage.refresh();
for (Iterator<PropertySheetPage> i = propertySheetPages.iterator(); i.hasNext();) {
PropertySheetPage propertySheetPage = i.next();
if (propertySheetPage.getControl().isDisposed()) {
i.remove();
} else {
propertySheetPage.refresh();
}
}
}

Expand Down Expand Up @@ -702,25 +708,21 @@ public void setSelectionOnRoot(StructuredViewer viewer) {
* @generated
*/
public IPropertySheetPage getPropertySheetPage() {
if (propertySheetPage == null) {
propertySheetPage = new ExtendedPropertySheetPage(editingDomain) {
@Override
public void setSelectionToViewer(List<?> selection) {
EmfAbstractEditor.this.setSelectionToViewer(selection);
EmfAbstractEditor.this.setFocus();
}
PropertySheetPage propertySheetPage = new ExtendedPropertySheetPage(editingDomain) {
@Override
public void setSelectionToViewer(List<?> selection) {
EmfAbstractEditor.this.setSelectionToViewer(selection);
EmfAbstractEditor.this.setFocus();
}

@Override
public void setActionBars(IActionBars actionBars) {
super.setActionBars(actionBars);
getActionBarContributor().shareGlobalActions(this,
actionBars);
}
};
propertySheetPage
.setPropertySourceProvider(new AdapterFactoryContentProvider(
adapterFactory));
}
@Override
public void setActionBars(IActionBars actionBars) {
super.setActionBars(actionBars);
getActionBarContributor().shareGlobalActions(this, actionBars);
}
};
propertySheetPage.setPropertySourceProvider(new AdapterFactoryContentProvider(adapterFactory));
propertySheetPages.add(propertySheetPage);

return propertySheetPage;
}
Expand Down Expand Up @@ -1079,7 +1081,7 @@ public void dispose() {
getActionBarContributor().setActiveEditor(null);
}

if (propertySheetPage != null) {
for (PropertySheetPage propertySheetPage : propertySheetPages) {
propertySheetPage.dispose();
}

Expand Down

0 comments on commit 581eb34

Please sign in to comment.