Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
/*******************************************************************************
* Copyright (c) 2011 Google, Inc.
* Copyright (c) 2011, 2021 Google, Inc.
* All rights reserved. This program and the accompanying materials
* are 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:
* Google, Inc. - initial API and implementation
* Marcel du Preez - buildContextMenu alterations made to allow preferences to be set via external sources
*******************************************************************************/
package org.eclipse.wb.internal.core.editor;

Expand All @@ -17,11 +18,13 @@
import org.eclipse.wb.gef.core.EditPart;
import org.eclipse.wb.gef.core.IEditPartViewer;
import org.eclipse.wb.internal.core.editor.actions.DesignPageActions;
import org.eclipse.wb.internal.core.editor.constants.IEditorPreferenceConstants;
import org.eclipse.wb.internal.core.utils.execution.ExecutionUtils;
import org.eclipse.wb.internal.core.utils.execution.RunnableEx;
import org.eclipse.wb.internal.gef.core.ContextMenuProvider;
import org.eclipse.wb.internal.gef.core.MultiSelectionContextMenuProvider;

import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.Separator;

Expand Down Expand Up @@ -95,6 +98,11 @@ protected void preprocessSelection(List<EditPart> editParts) {
@Override
protected void buildContextMenu(final EditPart editPart, final IMenuManager manager) {
addGroups(manager);
//When Windowbuilder Basic is active Toolbar actions and Object Info actions are hidden from the context menu
boolean wbBasic = InstanceScope.INSTANCE.getNode(
IEditorPreferenceConstants.WB_BASIC_PREFERENCE_NODE).getBoolean(
IEditorPreferenceConstants.WB_BASIC,
false);
// edit
{
manager.appendToGroup(IContextMenuConstants.GROUP_EDIT, m_pageActions.getCutAction());
Expand All @@ -104,17 +112,21 @@ protected void buildContextMenu(final EditPart editPart, final IMenuManager mana
}
// edit2
{
manager.appendToGroup(IContextMenuConstants.GROUP_EDIT2, m_pageActions.getTestAction());
manager.appendToGroup(IContextMenuConstants.GROUP_EDIT2, m_pageActions.getRefreshAction());
if (!wbBasic) {
manager.appendToGroup(IContextMenuConstants.GROUP_EDIT2, m_pageActions.getTestAction());
manager.appendToGroup(IContextMenuConstants.GROUP_EDIT2, m_pageActions.getRefreshAction());
}
}
// send notification
if (editPart.getModel() instanceof ObjectInfo) {
ExecutionUtils.runLog(new RunnableEx() {
public void run() throws Exception {
ObjectInfo object = (ObjectInfo) editPart.getModel();
object.getBroadcastObject().addContextMenu(m_selectedObjects, object, manager);
}
});
if (!wbBasic) {
if (editPart.getModel() instanceof ObjectInfo) {
ExecutionUtils.runLog(new RunnableEx() {
public void run() throws Exception {
ObjectInfo object = (ObjectInfo) editPart.getModel();
object.getBroadcastObject().addContextMenu(m_selectedObjects, object, manager);
}
});
}
}
}
}
1 change: 1 addition & 0 deletions org.eclipse.wb.core/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ Export-Package: org.eclipse.wb.core.branding,
org.eclipse.wb.internal.core.editor.actions,
org.eclipse.wb.internal.core.editor.actions.assistant,
org.eclipse.wb.internal.core.editor.actions.errors,
org.eclipse.wb.internal.core.editor.constants,
org.eclipse.wb.internal.core.editor.describer,
org.eclipse.wb.internal.core.editor.errors,
org.eclipse.wb.internal.core.editor.errors.report2,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*******************************************************************************
* Copyright (c) 2021, 2021 DSA Daten- und Systemtechnik GmbH. (https://www.dsa.de)
* All rights reserved. This program and the accompanying materials
* are 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:
* Marcel du Preez - initial implementation
*********************************************************************************/
package org.eclipse.wb.internal.core.editor.constants;

/**
* This interface contains the constants used to alter preferences for Windowbuilder.
*
*/
public interface IEditorPreferenceConstants {
//The node to use for the Windowbuilder basic preference
public static String WB_BASIC_PREFERENCE_NODE =
"org.eclipse.wb.internal.core.editor.constants.preferences";
//Windowbuilder basic is a simplified version of Windowbuilder, containing fewer UI elements.
public static String WB_BASIC = "windowbuilderBasic";
}