Skip to content

Commit

Permalink
Implement IContributedContentsView in Hints View and Browser Editor
Browse files Browse the repository at this point in the history
- Return null so that the Properties View displays "The active part does not provide properties" instead of a table

- See eclipse-platform/eclipse.platform.ui@3f86f44#diff-519f5d23401ce82b329a626c3bcab1cb5974605adb57ef06c5e197c704819416
  • Loading branch information
Phillipus committed Mar 7, 2024
1 parent 87ed67e commit 66928de
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,17 @@
import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorSite;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.part.EditorPart;
import org.eclipse.ui.part.IContributedContentsView;

/**
* An EditorPart containing a Browser component
*
* @author Phillip Beauvoir
*/
public class BrowserEditor extends EditorPart implements IBrowserEditor {
public class BrowserEditor extends EditorPart implements IBrowserEditor, IContributedContentsView {

/**
* The Browser component
Expand Down Expand Up @@ -167,4 +169,12 @@ public boolean isDirty() {
public boolean isSaveAsAllowed() {
return false;
}

/**
* Return null so that the Properties View displays "The active part does not provide properties" instead of a table
*/
@Override
public IWorkbenchPart getContributingPart() {
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,8 @@
import org.eclipse.ui.ISelectionListener;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.part.IContributedContentsView;
import org.eclipse.ui.part.ViewPart;
import org.eclipse.ui.views.properties.IPropertySheetPage;
import org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
import org.osgi.framework.Bundle;

import com.archimatetool.editor.ArchiPlugin;
Expand All @@ -72,7 +70,7 @@
@SuppressWarnings("nls")
public class HintsView
extends ViewPart
implements IContextProvider, IHintsView, ISelectionListener, IComponentSelectionListener, ITabbedPropertySheetPageContributor {
implements IContextProvider, IHintsView, ISelectionListener, IComponentSelectionListener, IContributedContentsView {


// CSS string
Expand Down Expand Up @@ -416,23 +414,14 @@ private void createFileMap() {
}
}

/**
* Return null so that the Properties View displays "The active part does not provide properties" instead of a table
*/
@Override
public <T> T getAdapter(Class<T> adapter) {
/*
* Return the PropertySheet Page (currently empty so we can display "Properties are not available" instead of the default table)
*/
if(adapter == IPropertySheetPage.class) {
return adapter.cast(new TabbedPropertySheetPage(this));
}

return super.getAdapter(adapter);
}

@Override
public String getContributorId() {
return ArchiPlugin.PLUGIN_ID;
public IWorkbenchPart getContributingPart() {
return null;
}

@Override
public void dispose() {
super.dispose();
Expand Down

0 comments on commit 66928de

Please sign in to comment.