Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Staudacher2010-03-10 10:54:07 +0000
committerHolger Staudacher2010-03-10 10:54:07 +0000
commit69c8658d5ca7442bca5e60f613bd87c0b7041324 (patch)
tree1fbd09edf20b14cbcfb19c5c41260c32052a6807 /bundles
parenteb9a9a06055fa65c4dd7ca74753886d1874382c1 (diff)
downloadorg.eclipse.rap-69c8658d5ca7442bca5e60f613bd87c0b7041324.tar.gz
org.eclipse.rap-69c8658d5ca7442bca5e60f613bd87c0b7041324.tar.xz
org.eclipse.rap-69c8658d5ca7442bca5e60f613bd87c0b7041324.zip
RESOLVED - 280299: [design] provide a solution to make all viewactions visible
https://bugs.eclipse.org/bugs/show_bug.cgi?id=280299
Diffstat (limited to 'bundles')
-rw-r--r--bundles/org.eclipse.rap.design.example/plugin.xml6
-rw-r--r--bundles/org.eclipse.rap.design.example/src/org/eclipse/rap/internal/design/example/stacks/ViewStackPresentation.java3
-rw-r--r--bundles/org.eclipse.rap.ui.workbench/Eclipse UI/org/eclipse/rap/ui/interactiondesign/ConfigurationAction.java78
-rw-r--r--bundles/org.eclipse.rap.ui/schema/rap/branding.exsd7
4 files changed, 75 insertions, 19 deletions
diff --git a/bundles/org.eclipse.rap.design.example/plugin.xml b/bundles/org.eclipse.rap.design.example/plugin.xml
index 2a1f622afc..5a09544cba 100644
--- a/bundles/org.eclipse.rap.design.example/plugin.xml
+++ b/bundles/org.eclipse.rap.design.example/plugin.xml
@@ -25,7 +25,8 @@
<presentationFactory
defaultLayoutId="org.eclipse.rap.design.example.business.layout"
id="org.eclipse.rap.design.example.business.factory"
- name="Business Presentation Factory">
+ name="Business Presentation Factory"
+ viewActionsVisible="false">
<defaultStackPresentation
id="org.eclipse.rap.design.example.stack.view">
</defaultStackPresentation>
@@ -40,7 +41,8 @@
<presentationFactory
defaultLayoutId="org.eclipse.rap.design.example.fancy.layout"
id="org.eclipse.rap.design.example.fancy.factory"
- name="Fancy Presentation Factory">
+ name="Fancy Presentation Factory"
+ viewActionsVisible="false">
<defaultStackPresentation
id="org.eclipse.rap.design.example.stack.view">
</defaultStackPresentation>
diff --git a/bundles/org.eclipse.rap.design.example/src/org/eclipse/rap/internal/design/example/stacks/ViewStackPresentation.java b/bundles/org.eclipse.rap.design.example/src/org/eclipse/rap/internal/design/example/stacks/ViewStackPresentation.java
index 4ec134eb2a..69d67a942b 100644
--- a/bundles/org.eclipse.rap.design.example/src/org/eclipse/rap/internal/design/example/stacks/ViewStackPresentation.java
+++ b/bundles/org.eclipse.rap.design.example/src/org/eclipse/rap/internal/design/example/stacks/ViewStackPresentation.java
@@ -343,7 +343,8 @@ public class ViewStackPresentation extends ConfigurableStack {
IToolBarManager manager = getPartToolBarManager();
boolean hasViewActions
= manager != null && manager.getItems().length > 0;
- if( hasViewActions || hasViewMenu ) {
+ if( ( hasViewActions || hasViewMenu )
+ && !ConfigAction.allActionsVisible() ) {
if( confButton != null ) {
// enable conf button
confButton.setEnabled( true );
diff --git a/bundles/org.eclipse.rap.ui.workbench/Eclipse UI/org/eclipse/rap/ui/interactiondesign/ConfigurationAction.java b/bundles/org.eclipse.rap.ui.workbench/Eclipse UI/org/eclipse/rap/ui/interactiondesign/ConfigurationAction.java
index 52683d00a9..3e48eeec7b 100644
--- a/bundles/org.eclipse.rap.ui.workbench/Eclipse UI/org/eclipse/rap/ui/interactiondesign/ConfigurationAction.java
+++ b/bundles/org.eclipse.rap.ui.workbench/Eclipse UI/org/eclipse/rap/ui/interactiondesign/ConfigurationAction.java
@@ -11,10 +11,16 @@ package org.eclipse.rap.ui.interactiondesign;
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.ActionContributionItem;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.rap.ui.interactiondesign.internal.ConfigurableStackProxy;
+import org.eclipse.rwt.branding.AbstractBranding;
+import org.eclipse.rwt.internal.branding.BrandingUtil;
import org.eclipse.swt.widgets.ToolItem;
import org.eclipse.ui.internal.LayoutPart;
import org.eclipse.ui.internal.WorkbenchWindow;
@@ -64,6 +70,44 @@ public abstract class ConfigurationAction extends Action {
private IStackPresentationSite site;
private StackPresentation stackPresentation;
private List configurationChangeListeners = new ArrayList();
+
+ /**
+ * Helper method to check if all view contrib items are visible by default.
+ * @return true if all items are visible by default.
+ */
+ public static boolean allActionsVisible() {
+ boolean result = false;
+ AbstractBranding branding = BrandingUtil.findBranding();
+ if( branding != null ) {
+ String brandingId = branding.getId();
+ IExtensionRegistry registry = Platform.getExtensionRegistry();
+ final String id = "org.eclipse.rap.ui.branding";
+ IExtensionPoint brandingPoint = registry.getExtensionPoint( id );
+ if( brandingPoint != null ) {
+ IConfigurationElement[] elements
+ = brandingPoint.getConfigurationElements();
+ boolean found = false;
+ for( int i = 0; i < elements.length && !found; i++ ) {
+ String tempId = elements[ i ].getAttribute( "id" );
+ if( tempId.equals( brandingId ) ) {
+ found = true;
+ IConfigurationElement[] factory
+ = elements[ i ].getChildren( "presentationFactory" );
+ if( factory.length > 0 ) {
+ String visibility
+ = factory[ 0 ].getAttribute( "viewActionsVisible" );
+ if( visibility != null
+ && Boolean.valueOf( visibility ).booleanValue() )
+ {
+ result = true;
+ }
+ }
+ }
+ }
+ }
+ }
+ return result;
+ }
/**
* Method to add a <code>{@link IConfigurationChangeListener}.
@@ -205,12 +249,14 @@ public abstract class ConfigurationAction extends Action {
* @return the visibility of the part menu.
*/
public boolean isPartMenuVisible() {
- boolean result = false;
- if( stackPresentation instanceof ConfigurableStack ) {
- ConfigurableStack configStack = ( ConfigurableStack )stackPresentation;
- String paneId = configStack.getPaneId( site );
- String identifier = getPartMenuIdentifier( paneId );
- result = loadPartmenuVisibility( identifier );
+ boolean result = true;
+ if( !allActionsVisible() ) {
+ if( stackPresentation instanceof ConfigurableStack ) {
+ ConfigurableStack configStack = ( ConfigurableStack )stackPresentation;
+ String paneId = configStack.getPaneId( site );
+ String identifier = getPartMenuIdentifier( paneId );
+ result = loadPartmenuVisibility( identifier );
+ }
}
return result;
}
@@ -240,18 +286,18 @@ public abstract class ConfigurationAction extends Action {
* @see Action
* @see ScopedPreferenceStore
*/
- public boolean isViewActionVisibile(
- final String viewId, final String actionId )
+ public boolean isViewActionVisibile( final String viewId,
+ final String actionId )
{
- boolean result = false;
- String identifier = getActionIdentifier( viewId, actionId );
-
- ScopedPreferenceStore prefStore
- = ( ScopedPreferenceStore ) PrefUtil.getAPIPreferenceStore();
- result = prefStore.getBoolean( identifier );
-
+ boolean result = true;
+ if( !allActionsVisible() ) {
+ String identifier = getActionIdentifier( viewId, actionId );
+ ScopedPreferenceStore prefStore
+ = ( ScopedPreferenceStore ) PrefUtil.getAPIPreferenceStore();
+ result = prefStore.getBoolean( identifier );
+ }
return result;
- }
+ }
/**
* Removes a <code>{@link IConfigurationChangeListener}</code> from this
diff --git a/bundles/org.eclipse.rap.ui/schema/rap/branding.exsd b/bundles/org.eclipse.rap.ui/schema/rap/branding.exsd
index 144673efa9..80279b32ec 100644
--- a/bundles/org.eclipse.rap.ui/schema/rap/branding.exsd
+++ b/bundles/org.eclipse.rap.ui/schema/rap/branding.exsd
@@ -300,6 +300,13 @@ This is not supported by every browser.
</documentation>
</annotation>
</attribute>
+ <attribute name="viewActionsVisible" type="boolean">
+ <annotation>
+ <documentation>
+ Sets the default vibility for a view&apos;s contribution items (actions/commands). The default value is false. When set to true, all items are visible by default. Otherwise all items are invisible and can be configured via the configuration menu.
+ </documentation>
+ </annotation>
+ </attribute>
</complexType>
</element>

Back to the top