How I could create a component from a command on Stackblitz?
I create the components with the mouse but it's tedious.
Related
When adding a new item to a toolbar, you are given the option to choose Handled ToolItem, Direct ToolItem and Toolcontrol:
What is the difference between these three choices? I can't find the documentation for these anywhere.
'Handled' items are used when you have defined a command id and one or more handlers for the command. In the HandledToolItem you specify the id of the command that is to be executed.
'Direct' items are used when you just want to specify a Java class to be executed without using a command id and separate handler.
Toolcontrol is used when you want to write you own code for the control in the tool bar (something like a Combo for example).
I would like to create a personalize PCB template (Title block) for my company which include company information and logo. So I wanted to know how can I use or edit existing PCB sheet templates according to my needs?
Pariksit.
THIS ISN'T A QUESTION ABOUT PROGRAMMING. I'll answer but don't worry if someone delete the question.
I like to create my own title blocks. You can do that creating a schematic component and introducing the parameters you want.
In your schematic library, add a new component called Title_Block. Use lines and strings to create the fields.
I put these strings in red to show that are special strings starting with '=' sign.
These special strings will be replaced automatically by Altium when you create a parameters with the same name. I put some Altium default parameters (SheetNumber, SheetTotal, CurrentDate and Title) and two that we'll create (VersionRevision and Project). You can see other default special strings here: Schematic Text Strings.
In your schematic sheet, disable the Title Block to introduce yours. Right click on the schematic, Options > Sheet..., and uncheck the Title Block box.
Create your own parameters on Project > Project Options tab Parameters like this:
Now, when you add the component called _Title_Block it seems like this:
In Schematic Page,
Design->Project Template ->Choose a File
Now, following location will be open.
C:\Users\Public\Documents\Altium\AD16\Templates
Here, you can find like A3,A4 different template for Schematic and PCB also.
You can Edit that as per requirement.
To Edit or Change the logo in Template sheet:
Place->Drawing tool->Graphic.
I've implemented org.eclipse.ui.edit.delete command handler and I want to invoke it with Edit/Delete main menu item.
As "delete" action is a retargetable action invoking another defined in the context of each edit, editor is usually configured with IActionBars.setGlobalAction(String id, IAction action) where id = "delete" and action is a custom action to be invoked by a retargetable one.
I can see following options:
Create an action that would delegate its execution and state change monitoring to a command
convert convert existing command into an argument for setGlobalAction, probably copying org.eclipse.ui.internal.actions.CommandAction approach.
Remove an existing action from the main menu and insert command contribution item instead
Both ways look too complex/dirty. Am I missing something? Can I use a command instead of action?
EDIT:
It seems that main menu is implemented not with IAction, but with CommandContributionItem. The default command handler invokes CommandAction which in turn queries RetargetAction. "Better" handler for the command can override this behavior.
While I can provide a handler for delete command now, the question is still actual as calling a command from GUI (for example by clicking on a button) is useful and custom commands are not so easy to call (they have no default key bindings or retargetable actions).
How to select a node and start renaming in a SWT Tree? After single mouse click on the node only I am able to use F2. My usecase is - immediately after adding a new Tree node I should be able to press F2 and start renaming. But just setting focus and selection on the tree does not select the node explicitly. Is there any other code?
treeViewer.setSelection(new StructuredSelection(newNode), true);
treeViewer.getTree().setFocus();
This does not seem to work.
What exactly is newNode? It should be an element from your content provider.
Also, a lot of people have been having trouble with this limitation of the SWT/JFace toolkits. See this bug and this question.
I want to create a Custom Scaffolder that uses arbitrary PowerShell logic. It can render T4 templates (multiple ones if I want), with the result being output:
As a new file in your project
as a new code block inserted into an existing class
my PowerShell logic can use Visual Studio’s “code model” API to manipulate files and code elements in other arbitrary ways.
How to Customize T4 Scaffolding With PowerShell?
From http://blog.stevensanderson.com/2011/04/07/mvcscaffolding-creating-custom-scaffolders/:
In Package Manager Console of Visual Studio execute the following
command :
Scaffold CustomScaffolder ClassName
This adds a CodeTemplates folder to your project, containing files for
the new scaffolder.
As you can see, we’ve got two files:
A PowerShell script (.ps1), where we can put arbitrary logic to decide what templates get rendered and where the output goes. By
default, it renders a T4 template and uses the output to create a new
file called ExampleOutput in the root of your project.
A T4 template (.t4), i.e., the thing that the default .ps1 file renders. By default this generates a simple C#/VB class (depending on
your project type). If you want to see this working, you can run the
custom scaffolder right away:
Scaffold ClassName
This will generate a new class file, ExampleOutput.cs, in the root
folder of your project. That’s really just to show you how it works.
We don’t really want that, so don’t run the new scaffolder yet, or if
you already have done, delete ExampleOutput.cs