How to update the package explorer manually (Preferences) - eclipse

I have added a custom LabelDecorator to an Eclipse 3.6, which replaces the cryptic usernames added by the SVN Team Text Decorations. The SVN Team Decorator allows you to add an author tag. What I did was adding another Decorator replacing these author strings (which are company specific shortnames with numbers) with the actual name of the user.
While SVN Team Text Decorations extends the Package Explorer with:
... com.company.package · XY9723 · [30.02.11 19:11]
I replace that by
... com.company.package · Neil Diamond · [30.02.11 19:11]
Now, to complete the mission, I added a preference page, where users are able to specify the attributes (name, forename, birthdate, company name, telephone, etc.), which should be used as replacement. I'd like to update the package explorer (or whereever svn team decorates ressources) with the newly selected attributes whenever "Apply" or "Ok" is pressed.
At the moment the ressources are only updated after you have pressed "Apply" or "Ok" and manually collapse/expand one of the ressource in the explorer.
Is there some event I could fire?

Use the IDecorationManager interface:
IWorkbench workbench = ...;
IDecoratorManager manager = workbench.getDecoratorManager();
inside of the prefernce pages LabelProvider:
ILabelDecorator decorator = manager.getLabelDecorator("com.plugin.mydecorator");
if(decorator != null){ // decorator is enabled
LabelProviderChangedEvent event = new LabelProviderChangedEvent(demoDecorator);
// update specific resources
fireLabelEvent(event, arrayOfResourceToUpdate);
// or update all resources
fireLabelEvent(event);
}
-> see Understanding Decorators
without a LabelProvider
manager.update("com.plugin.mydecorator");
-> see DecoratorManager.java

Related

How to add a new Activity type to the Task work item in VSTS

Is it possible to add a new Activity type on the Task work item in VSTS and, if so, how can I do it? Thanks!
To add activities that is also available in the Work Details page and Sprint capacity view you need to go to the Process used by the Project (Make sure you have a Process that is editable for the project) and edit a work item type that use the activity field.
You can then edit the work item field and add values to the pick list
Edit work item activity picklist
For VSTS, you can not change system fields (such as Activity) in System processes (Agile, Scrum and CMMI).
The workaround is create an inherited prcess and a new field to replace the system Activity field.
Such as if you are using Agile system process, you can create an inherited process (myagile) from Agile, then change your team project to the inherited process. And add a new field (such as Activity1) to replace the system Activity field. Detail steps as below:
Create inherited process
In Process Tab (https://account.visualstudio.com/_admin/_process) -> Create inherited process from system process -> input the name (such as myagile) -> Create.
Change your team project to use inherited process
Click … button for the inherited process myagile -> Change team projects to use myagile -> select your team project which you want to use the inherited process -> OK.
Add a new field for Task WIT
Click the inherited process (myagile) -> Task -> New field ->cCreate the field Activity1 with picklist(string) type -> add values as system Activity field has (Deployment, Design, Development, Documentation, Requirements and Testing) -> add the new value you want to add (such as MyActivity) -> Layout Tab -> Change the Label as Activity -> Add field.
Replace custom field Activity1 to replace system Activity field
Click … button for the system Activity field -> Hide from layout -> move the custom Activity1 field to the same position of the system Activity field.
Now you can select the new added value from Activity (Activity1 field) dropdown list.

How to activate Fluid (TYPO3) autocompletion in Netbeans?

I did what it said here: Extbase and Fluid Autocompletion
In NetBeans right-click your Extension project and choose Properties
in the opened context menu to edit the project properties. Select the
category PHP Include Path and use Add Folder... to add the directories
of Extbase and Fluid.
So I added the Fluid and Extbase Folders which I previously copied onto my computer from the Server at /var/www/typo3_src/typo3_src-6.2.25/typo3/sysext:
but it didn't work - here's my Project:
And here is fluid stuff that the editor still doesn't recognize:
What am I doing or thinking wrong?
Found info here, works for me:
It's an old topic but I have a trick so that you can add Auto-complete
function for fluid, vhs, flux.
First of all, download the XSD schema files from here :
https://fluidtypo3.org/viewhelpers/fluid/master.html put them
somewhere locally.
Next step, in Netbeans, go to menu Tools > DTD and XML Schemas, add
your 3 DTD in user catalog :
Flux : Public ID = http://typo3.org/ns/FluidTYPO3/Flux/ViewHelpers URI
= path to your flux XDS file
Fluid : Public ID = http://typo3.org/ns/TYPO3/Fluid/ViewHelpers URI =
path to your fluid XDS file
Vhs : Public ID = http://typo3.org/ns/FluidTYPO3/Vhs/ViewHelpers URI =
path to your flux VHS file
Next, in project properties, go to 'testing' menu and add the folder
where you stored your DTD.
Now, in your Project > Test Files, add a new XML Document and choose
"XML Schema-Constrained Document" on next step, click the button
'Browse' and By File > Your Project > Test Files and select import for
all the xsd schema files.
Then, change the prefix f for fluid, flux for flux and vhs for vhs
choose fluid as primary and finish.
A file is created with this content :
And into the section <f:alias>, you have the auto-completion for
fluid, vhs and flux.
<f:alias
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xmlns:f='http://typo3.org/ns/TYPO3/Fluid/ViewHelpers'
xmlns:vhs='http://typo3.org/ns/FluidTYPO3/Vhs/ViewHelpers'
xmlns:flux='http://typo3.org/ns/FluidTYPO3/Flux/ViewHelpers'
xsi:schemaLocation='http://typo3.org/ns/TYPO3/Fluid/ViewHelpers file:/home/florian/Documents/Docs/Netbeans/Autocomplete%20Fluid/Schemas/Fluid.xsd
http://typo3.org/ns/FluidTYPO3/Vhs/ViewHelpers file:/home/florian/Documents/Docs/Netbeans/Autocomplete%20Fluid/Schemas/Vhs.xsd
http://typo3.org/ns/FluidTYPO3/Flux/ViewHelpers file:/home/florian/Documents/Docs/Netbeans/Autocomplete%20Fluid/Schemas/Flux.xsd'>
Auto-completion here
</f:alias>
http://netbeans-org.1045718.n5.nabble.com/Schemas-for-code-completion-with-xsd-tt5752294.html#none
take files from https://fluidtypo3.org/schemas/
Some more info Use Netbeans to Create Sample XML from XSD
From a project that contains the .xsd:
Click New File on the tool bar or File > New File from the menu
Choose XML > XML Document
Name your file, click next
Choose XML Schema-Constrained Document, click next
Click the Browse button and use By File to navigate to the .xsd
Click the Import check box beside the file name, click next
Review the options available and click Finish to generate
You can use more than one .xsd file to generate the .xml. In this case it will use whichever .xsd file you choose as Primary to resolve any conflicts.

Updating XCode project template details

Previously all file headers were being displayed as follows.
// Created by ABC_User_Name on 10/31/11.
I have modified user name from ABC_User_Name to XYZ_User_Name.
Now, even after logging out & logging in again, I am finding the same headers in all project templates. How to update those templates with current user-name ?
Do I need to modify manually all of them ?
The original templates use this header:
// Created by ___FULLUSERNAME___.
// Copyright ___YEAR___ ___ORGANIZATIONNAME___. All rights reserved.
The words with the double underscore are placeholder references. There are 18 that I know of, and you can add more in your template definition. These options can be further modified using option variables. The ones you see above are:
___FULLUSERNAME___ Full user name of the current user (name + surname).
__YEAR__ Current year.
___ORGANIZATIONNAME___ The name of your organization as seen on your address book. You can change it for each project selecting the Project node and setting the Organization field.
Once the project is created, the header becomes plain text and is never updated.
For future projects I suggest you duplicate the templates and do the changes there. Otherwise you risk screwing up the original templates or having Xcode overwrite your changes.
The originals are at:
/Developer/Library/Xcode/Templates/
/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Templates
And I made a copy at:
mkdir -p ~/Library/Developer/Xcode/Templates/File\ Templates/Jano
mkdir -p ~/Library/Developer/Xcode/Templates/Project\ Templates/Jano
where "Jano" is my user and it will show as a template category in the new project selection screen.
Then you edit the header manually file by file, or from bash using sed.
Xcode 4 stores this on a per-project basis.
If you select the project in the Project Navigator (Cmd-1) and open the File Inspector (Cmd-Opt-1), you'll see a field for "Organization" under "Project Document".

Diff two methods in eclipse

I have an eclipse which generates java code. So if a method is there and is regenerated I want to show the old method and the newly generated one so the user can see the difference. Is this possible?
If your code generator is the one used by default by EMF, you can copy the generated method, and remove the #generated tag to the original one, then simply suffix the copied generated method with Gen and keep the #generated tag. For instance :
/* original code */
public String getName() {
...
}
#generated
public String getNameGen() {
...
}
At the next generation only getNameGen will me modified and you will be able to compare.
If you are looking to a more general solution to know if the regeneration modified some files, the best way is probably to store you files on a repo (with SVN or Git). After a regeneration filez not in sync will be indicated with graphical decorators and you will be able to use the compare editor to see the differences for each of them.
I'm using Eclipse Kepler, so depending on your version your mileage may vary.
To compare a method with a previously generated version, do the following:
Open the class.
Show the Outline view (Window->Show View->Outline)
Hold CTRL and click on the method you wish to compare.
Right click on the highlighted method.
Click on "Compare With->Element From Local History"
Double click with the revision you wish to compare with.
You'll get a diff window similar to if you were comparing two files.

Howto hide a preference page in an eclipse RCP

I have an eclipse rcp and want to hide the security and help prerence pages. How can I do that?
I was looking for the same thing and found the solution in this link:
http://sourceforge.net/apps/trac/fable/wiki/Preferences
Cheers.
Stefan
Disable help preferences ¶
Put the following code into your subclass of org.eclipse.ui.application.WorkbenchAdvisor, and it removes the "Help" group from RCP preference dialog:
public void postStartup() {
PreferenceManager pm = PlatformUI.getWorkbench().getPreferenceManager( );
pm.remove( "org.eclipse.help.ui.browsersPreferencePage" );
}
"org.eclipse.help.ui.browsersPreferencePage" is the ID for the preferences extension point.
Add Perspective preferences ¶
Remark : to find plugin id preferences, select Window-->show view--> PDE Runtime--> Plugin Registry ..... and try to find what you are looking for .....
For example, for "Workbench preferences", have a look in fable.eclipse.ui.ide and extension org.eclipse.ui.preferencePages: id="org.eclipse.ui.preferencePages.Workbench"
If you want to add only perspective (for example) preferences, add a preference extension in MANIFEST.XML :
id : org.eclipse.ui.preferencePages.Perspectives
name:perspective(fable)
class:org.eclipse.ui.internal.ide.dialogs.IDEPerspectivesPreferencePage
//Add : org.eclipse.ui.ide in your Dependencies
In ApplicationWorkBenchAdvisor :
public void postStartup() {
PreferenceManager pm = PlatformUI.getWorkbench().getPreferenceManager( );
pm.remove( ""org.eclipse.ui.preferencePages.Workbench"browsersPreferencePage" );
}
public String getInitialWindowPerspectiveId() {
IPreferenceStore pref = Activator.getDefault().getPreferenceStore();
String ret = pref.getDefaultString(IWorkbenchPreferenceConstants.DEFAULT_PERSPECTIVE_ID);
ret=(ret==null || ret.equals(""))?"yourDefaultPerspectiveID":ret;
return ret;
}//
According to this entry, you could use the "workbench activities" mechanism, and:
define separate activities corresponding to the different access levels
define your actions in regular action sets, grouped according to access level
associate each activity with the appropriate action sets via
activityPatternBinding elements
set the enabled activity ids after authentication, early in the workbench
lifecycle, e.g. from your WorkbenchAdvisor's preStartup() method.
(Note, the above was for a filtering based on user's permissions, but it could be generalize to other criteria.)
Regarding the preference pages for the storage and help, you should bind the id of those pages with an activity you know you can disable:
<activityPatternBinding
activityId="org.eclipse.javaDevelopment"
pattern="org\.eclipse\.help\..*/.*">
</activityPatternBinding>
would disable all menu/preferences/views related to help.
If you use org.eclipse.help.ui.PrefPageHelp\..*, it would only bind prefPageHelp and prefPageHelpContent.
If you add another activity binding extension with
org.eclipse.equinox.security.ui.sec_storage_preferences_context, that would also take care of the Secure Storage preference page.