forked from eclipse-platform/eclipse.platform.ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Options to hide tab icons and and show full text in view area (ec…
…lipse-platform#1071) * Added CSSPropertyHandler for handling selected tab image and full text Change-Id: I220507837cf3472bfb0f5d8a24d9d596568e232a * Added hide icons and show full text options for View tabs Added UI controls in View Preference page Added handlers to hide icons and show full text for view tabs in CTabRendering Change-Id: Ib719fcb114ec0b2edaa1a8a7d0c5dd5e4a1ca075 * Refactored SelectedImageVisibility handler Change-Id: I0c194113893a21069788b9a99907c419dedf0d6e * Added minimum chars tab handler,made icons & title prefs theme dependent * Added copyright header, improved variable/method names & code formatting * Refactored CSSPropertyHandlers and CTabRendering --------- Co-authored-by: Shubham Waghmare <shubham.waghmare@sap.com> Co-authored-by: shubhamWaghmare-sap <57699330+shubhamWaghmare-sap@users.noreply.github.com>
- Loading branch information
1 parent
d1fb200
commit fb0eabd
Showing
7 changed files
with
262 additions
and
4 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
40 changes: 40 additions & 0 deletions
40
...rg/eclipse/e4/ui/css/swt/properties/custom/CSSPropertySelectedImageVisibleSWTHandler.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,40 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2023 SAP SE. | ||
* | ||
* 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: SAP SE - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.e4.ui.css.swt.properties.custom; | ||
|
||
import org.eclipse.e4.ui.css.core.engine.CSSEngine; | ||
import org.eclipse.e4.ui.css.swt.properties.AbstractCSSPropertySWTHandler; | ||
import org.eclipse.swt.custom.CTabFolder; | ||
import org.eclipse.swt.widgets.Control; | ||
import org.w3c.dom.css.CSSValue; | ||
|
||
public class CSSPropertySelectedImageVisibleSWTHandler extends AbstractCSSPropertySWTHandler { | ||
|
||
@Override | ||
public void applyCSSProperty(Control control, String property, CSSValue value, String pseudo, CSSEngine engine) | ||
throws Exception { | ||
boolean isImageVisibleForSelectedTab = (Boolean) engine.convert(value, Boolean.class, null); | ||
if (control instanceof CTabFolder folder) { | ||
folder.setSelectedImageVisible(isImageVisibleForSelectedTab); | ||
} | ||
} | ||
|
||
@Override | ||
public String retrieveCSSProperty(Control control, String property, String pseudo, CSSEngine engine) | ||
throws Exception { | ||
if (control instanceof CTabFolder folder) { | ||
return Boolean.toString(folder.getSelectedImageVisible()); | ||
} | ||
return null; | ||
} | ||
} |
56 changes: 56 additions & 0 deletions
56
...clipse/e4/ui/css/swt/properties/custom/CSSPropertyTabTextMinimumCharactersSWTHandler.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,56 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2023 SAP SE. | ||
* | ||
* 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: SAP SE - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.e4.ui.css.swt.properties.custom; | ||
|
||
import org.eclipse.e4.ui.css.core.engine.CSSEngine; | ||
import org.eclipse.e4.ui.css.swt.properties.AbstractCSSPropertySWTHandler; | ||
import org.eclipse.swt.custom.CTabFolder; | ||
import org.eclipse.swt.widgets.Control; | ||
import org.w3c.dom.css.CSSPrimitiveValue; | ||
import org.w3c.dom.css.CSSValue; | ||
|
||
/** | ||
* CSS property to influence the minimum number of characters for rendering tab text and size | ||
* | ||
* Can be used in CSS Scratch Pad with the property name "swt-tab-text-minimum-characters", for example: | ||
* CTabFolder { swt-tab-text-minimum-characters: 20 } | ||
* | ||
* Default value for the property is 1. | ||
*/ | ||
public class CSSPropertyTabTextMinimumCharactersSWTHandler extends AbstractCSSPropertySWTHandler { | ||
|
||
@Override | ||
protected void applyCSSProperty(Control control, String property, CSSValue value, String pseudo, CSSEngine engine) | ||
throws Exception { | ||
if (!(control instanceof CTabFolder)) { | ||
return; | ||
} | ||
|
||
if (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE | ||
&& (((CSSPrimitiveValue) value).getPrimitiveType() == CSSPrimitiveValue.CSS_NUMBER)) { | ||
int minimumCharacters = (int) ((CSSPrimitiveValue) value).getFloatValue(CSSPrimitiveValue.CSS_NUMBER); | ||
CTabFolder folder = (CTabFolder) control; | ||
folder.setMinimumCharacters(minimumCharacters); | ||
} | ||
} | ||
|
||
@Override | ||
protected String retrieveCSSProperty(Control control, String property, String pseudo, CSSEngine engine) | ||
throws Exception { | ||
if (control instanceof CTabFolder folder) { | ||
return Integer.toString(folder.getMinimumCharacters()); | ||
} | ||
return null; | ||
} | ||
|
||
} |
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
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
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
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