My package name is 'company' and my theme name is 'web', and I have another package named 'system' whose theme is named 'component'.
Run time is from the Block file but I want to set that theme and package from the front-end side in magento2.
If you want to Set package and theme at run time in magento simply use this code snippet.
create one function ex. changeTheme('Theme-name'); and run this function with your requirement
add this function in your head.phtml after php start.
function changeTheme($themeName)
{
Mage::getDesign()->setArea('frontend') //Area (frontend|adminhtml)
->setPackageName('default') //Name of Package
->setTheme($themeName); // Name of theme
}
enjoy :)
You can set your theme programmatically by using the following code :
Mage::getDesign()->setArea('frontend') //Area (frontend|adminhtml)
->setPackageName('default') //Name of Package
->setTheme('modern'); // Name of theme
http://roshanlal.in/magento/magento-programmatically-change-theme/#more-193
You can write below code in action to set package and theme for the action:
Mage::getDesign()->setArea(‘frontend’) //Area (frontend|adminhtml)
->setPackageName(‘default’) //Name of Package
->setTheme(‘modern’); // Name of theme
You may write the code in layout handler to set theme:
<reference name=”root”>
<action method=”setTheme”>
<theme>modern</theme>
</action>
</reference>
Change page layout:
<reference name=”root”>
<action method=”setTemplate”>
<template>page/1column.phtml</template>
</action>
</reference>
I hope it will surely help you.
Related
I want to configure some appearance settings for a type of file. So I created a new entry in the General->Appearance->Colors and Fonts.
My plugin.xml looks like this:
<extension point="org.eclipse.ui.themes">
<themeElementCategory
id="com.example.themeElementCategory"
label="My specific settings">
<description>
Control the appearance of .example files
</description>
</themeElementCategory>
<colorDefinition
categoryId="com.example.themeElementCategory"
id="com.example.colorDefinition"
label="Some Color"
value="COLOR_DARK_BLUE">
<description>
Your description goes here
</description>
</colorDefinition>
<fontDefinition
categoryId="com.example.themeElementCategory"
id="com.example.fontDefinition"
label="Some Font"
value="Lucida Sans-italic-18">
<description>
Description for this font
</description>
</fontDefinition>
</extension>
Now in the Colors and Fonts I have a new entry were I can set the color and the font.
How can I extend the preferences window so I can override the Restore defaults, Apply and Apply and Close buttons?
In my <themeElementCategory> I will have to add a class=MyHandlingClasswhich would override the performApply(), but what should that class extend/implement?
Same as 1, but add a PropertyChangeEvent, still don't know what should extend/implement
Less likely, create a new preference page which extends the PreferencePage and implements IWorkbenchPreferencePage
How can I achieve one of the first two options?
UPDATE FOR CLARIFICATION
Currently the color and the font for a specific file extension are hardcoded in a class( I KNOW).
When the file is opened in the editor, the informations are read from that static class and visible in the editor.
What I wanted to do:
In a static{} block, read the settings configured in the preferences and update the static fields from my class.
If the user changes those settings from the preferences, on apply I wanted to update the static fields from the class and "repaint" the editor.
If you just want to know when theme items change value use the addPropertyChangeListener method of IThemeManager to add a listener for changes:
IThemeManager manager = PlatformUI.getWorkbench().getThemeManager();
manager.addPropertyChangeListener(listener);
The PropertyChangeEvent passed to the propertyChanged method of IPropertyChangeListener contains the id, old and new value of the changed theme item.
I'll add a custom tile for my Fiori Launchpad. More precisely, I like to use a component instead of a view in my Chip Definition File. The reason why is getting the option for eg. load my own I18n or CSS files.
The Chip definition is descriped here. On your Server you can find a description by using this URL: http://:/sap/public/bc/ui2/services/sap/ui2/srvc/chipdefinition.xsd
The chipdefinition.xsd from your own server provides the option loading a custom tile by Component and not by View. The specific tag can be found under: chip => implementation => sapui5 => viewName or componentName.
I would like to use "componentName" instead of "viewName" but I can't find a dokumentation for this specific usage. Does anybody know how to add your own Path/Namespace to access the component.js?
The usage by using "viewName" is descriped as follows: "The viewName comprises package path, the name of the view and the file extension, for example tests.sample.Myview.view.xml." But this syntax doesn't work for "componentName"
Thanks for your Help!!
Jimboh
You could try to implement the tile as SAPUI5 Components.
Instead of a SAPUI5 view (sap.ui.core.mvc.View), try using a component by specifying the component's name instead (sap.ui.core.UIComponent). Note that this refers to the folder where SAPUI5 expects a Component.js file to be found.
/hana/sap/hba/apps/kpi/WebContent/KPITile/resources/Kpi.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright (c) 2013 SAP AG, All Rights Reserved -->
<chip xmlns="http://schemas.sap.com/sapui2/services/Chip/1">
<implementation>
<sapui5>
<basePath>../../../../../../..</basePath>
<componentName>sap.hba.apps.kpi.WebContent.KPITile.resources</componentName>
</sapui5>
</implementation>
</chip>
I would like to use some decorators in my Eclipse plugin. I have created a plugin where I created my own editor for my own .test file. If the user edits .test file and saves it. The file must show some decorations not only the .test file but also the project must show the decorator. I am stuck with this problem I can't find any good tutorial to create decorators.
I Have seen some of the websites like https://www.eclipse.org/articles/Article-Decorators/decorators.html but I couldn't get the exact point.
Will some one please tell me how to create custom decorator for my eclipse plugin.
A ILightweightLabelDecorator is the most common type of decorator
Declare this in your plugin.xml with something like this:
<extension point="org.eclipse.ui.decorators">
<decorator
id="my.decorator.id"
class="my.decorator.Decorator"
label="My Decorator"
state="true"
lightweight="true"
adaptable="true">
<enablement>
<objectClass name="org.eclipse.core.resources.IResource"/>
</enablement>
</decorator>
</extension>
You will have to adjust the enablement to suit what you want.
Your decorator class would be something like:
public class Decorator extends BaseLabelDecorator implements ILightweightLabelDecorator
{
#Override
public void decorate(final Object element, final IDecoration decoration)
{
// TODO call decoration methods to add overlay images or prefix / suffix text
}
}
<tabTrigger>hisnip</tabTrigger>
<description>Test Snippet</description>
<scope>js, php</scope>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<!-- <tabTrigger>hello</tabTrigger> -->
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<!-- <scope>source.python</scope> -->
how can I import this file, mySnippet.sublime-snippet into sublime setting so I could always access this snippet without adding to the JS and PHP snippet default file.
Is this the way to create snippet in sublime? I want to have a snippet file with my custom code snippets and maybe prioritize them above the default. but seems like sublime does not have user snippet and default snippet json.
First and foremost: your snippet, as such, probably won't do much. You'll want to format it in the following way:
<snippet>
<content><![CDATA[
Hello, ${1:this} is a ${2:snippet}.
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>hisnip</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.js</scope>
<scope>source.php</scope>
</snippet>
To begin creating a new snippet, go to Tools > New Snippet in the menu bar. This will create a new snippet with default options and formatting. You can get a comprehensive list of custom options from the docs.
Once you've created and customized your snippet, go to Sublime Text > Preferences > Browse Packages... and save the snippet in the User directory:
Note that the proper file extension for snippets is .sublime-snippet. You may also need to restart Sublime Text to load the snippet into use.
Once loaded into the environment, you'll be able to access your snippet by typing hisnip (or whatever is encapsulated between the <tabTrigger></tabTrigger> tags) and pressing the Tab key.
There is a simple but useful package called 'SublimeSnippetMaker'.
https://github.com/jugyo/SublimeSnippetMaker
i wrote a plugin for a eclipse that let user creating my own type of project , the template of the project have some configuration files and I want to give the user the option to chose which one will be active, it's mean which one i will use when i will compile the project, i add an action of this files that let the user set it as active, my question is if there is any way to mark it in the package explorer(maybe bold ar with some border) as active so when user look at this he can know which one is the active now
Thanks
You can use the decorator extension point org.eclipse.ui.decorators. Add this to your plugin.xml:
<extension
point="org.eclipse.ui.decorators">
<decorator
adaptable="true"
class="MyDecoratorClass"
id="some.id.for.decorator"
label="Active Build Configuration Decorator"
lightweight="true"
location="BOTTOM_RIGHT"
state="false">
<enablement>
<and>
<objectClass
name="org.eclipse.core.resources.IResource">
</objectClass>
<or>
<objectClass
name="org.eclipse.core.resources.IProject">
</objectClass>
<objectClass
name="org.eclipse.core.resources.IFile">
</objectClass>
</or>
</and>
</enablement>
</decorator>
</extension>
Provide implementation in your MyDecoratorClass (or whatever name you choose) to check your project's active config and either adding text, or images. Perhaps have something like this: []
Whenever a user makes a modification that requires you to update the decorators so that the latest changes can be decorated you can use this:
// the resource whose properties changed and needs to be re-decorated
IResource resource = ...;
IDecoratorManager manager = PlatformUI.getWorkbench().getDecoratorManager();
IBaseLabelProvider decorator = manager.getBaseLabelProvider("id.of.my.decorator");
if (decorator != null)
((ILabelProviderListener) manager).labelProviderChanged(new LabelProviderChangedEvent(decorator, resource));