-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modify the 'Close Editor' handler and enabled when evaluation to supp…
…ort for Compatibility parts and new Parts which represent an Editor and are contributed via eg. PartDescriptors in a Model Fragment. Associated with Issue#2176.
- Loading branch information
1 parent
419bb61
commit 04dc50b
Showing
3 changed files
with
110 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
...pse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartTaggedAsEditorPropertyTester.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2007, 2015 IBM Corporation and others. | ||
* | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License 2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* IBM Corporation - initial API and implementation | ||
******************************************************************************/ | ||
|
||
package org.eclipse.ui.internal; | ||
|
||
import java.util.List; | ||
import org.eclipse.core.expressions.PropertyTester; | ||
|
||
/** | ||
* <p> | ||
* Tests whether the object under test represents an MPart instance which is | ||
* tagged as being one which represents an Editor (rather than a View). | ||
* </p> | ||
* | ||
* <p> | ||
* This test is performed via a query of the tags associated with the MPart, and | ||
* checking whether this collection contains the | ||
* {@link org.eclipse.ui.internal.Workbench#EDITOR_TAG} identifier. | ||
* </p> | ||
* | ||
*/ | ||
public class PartTaggedAsEditorPropertyTester extends PropertyTester { | ||
|
||
@Override | ||
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { | ||
if (receiver instanceof E4PartWrapper) { | ||
E4PartWrapper partWrapper = (E4PartWrapper) receiver; | ||
if (partWrapper.wrappedPart != null) { | ||
List<String> partTags = partWrapper.wrappedPart.getTags(); | ||
return partTags == null || partTags.isEmpty() ? false | ||
: partTags.stream().anyMatch(tag -> Workbench.EDITOR_TAG.equals(tag)); | ||
} | ||
} | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters