» tagged pages
» logout

(Feed found, click Add Page to syndicate.) Error finding feed, please try again » Find feed title

A Blog Page allows you to add entries, for news or other time sensitive postings

(Login required to save to your tagged pages.)
(or Cancel)

Make further edits, (or Cancel)

(Login required to save to your tagged pages.)
(or Cancel)

(Editing anonymously: to be credited for your changes, login or register a new account)

Change Page Permissions? Changing these permissions will adjust who can modify this page.

Anonymous (change)
Swik Users (change)
(or Cancel)
Upload an image from your computer:
or Copy an image from a URL:
or Erase the current icon:
Icon Preview:

or Cancel

Erase EasyEclipse? The contents of EasyEclipse page and all pages directly attached to EasyEclipse will be erased.

or Cancel

(Editing anonymously: to be credited for your changes, login or register a new account)

other page actions:
EasyEclipse

EasyEclipse

EasyEclipse is an Eclipse distribution that packages together the Eclipse IDE and selected open source plugins targeted at various kinds of development. It is intended to make Eclipse easier to download, install, and use. Versions are available for Java (for desktop development, server side development, and mobile development), LAMP (Perl, Python, PHP), Ruby and Rails, C, C++ and for developing plug-ins for Eclipse itself (Plugin Warrior).

The latest release 1.3 is based on Eclipse 3.3 Europa.

easyeclipse.org
EasyEclipse project team

sorted by: recent | see : popular
Content Tagged EasyEclipse

Boris Bokowski: Avoiding Bloat

Martin Oberhuber asked on the e4 mailing list what had happened to the pervasive architectural themes that were identified at the summit, such as reducing bloat, too many listeners, and becoming more asynchronous. I started writing a response, focusing on one of the topics, bloat, and it quickly became more than just an email response so I am posting it here.

Before we go into the details, let me state the obvious: It is pretty much guaranteed that we will cause more bloat, overall, for the case of the Eclipse SDK based on the new e4 platform, as long as that SDK still contains 3.x plug-ins that require compatibility layers. This is because all the old (bloated?) functionality and the new (lean?) functionality will be there at the same time.



It seems the best we can do is to avoid bloating the new platform itself, when it is used without any compatibility layers. Unfortunately, we have all these cool new technologies that we would like to use - EMF, CSS, declarative UIs, data binding, cross-compiling of Java to ActionScipt, being able to use multiple languages, client-server split, etc. Put them together and the likely result is bloat. Or is there a way to avoid bloat and use cool new technology at the same time?

So what is bloat? Let's look at Wikipedia's definition of software bloat (thanks John Arthorne for pointing me to it):

Software bloat, also known as bloatware or elephantware, is a term used in both a neutral and disparaging sense, to describe the tendency of newer computer programs to be larger, or to use larger amounts of system resources (mass storage space, processing power or memory) than necessary for the same or similar benefits from older versions to its users.

Let me dive into one concrete example, to show why this is a hard problem:

Code bloat through redundancy, caused by low-level API occurs when clients of a low-level API have to write the same boilerplate code over and over again. Think of all the code we have to write for SWT layouts, for example:
Composite contents = new Composite(parentComposite, SWT.NONE);
contents.setLayoutData(new GridData(GridData.FILL_BOTH));
GridLayout layout = new GridLayout();
layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
layout.numColumns = 2;
contents.setLayout(layout);

Label label = new Label(contents, SWT.LEFT);
label.setText(WorkbenchMessages.FileExtension_fileTypeLabel);
GridData data = new GridData();
data.horizontalAlignment = GridData.FILL;
label.setLayoutData(data);

filenameField = new Text(contents, SWT.SINGLE | SWT.BORDER);
data = new GridData();
data.horizontalAlignment = GridData.FILL;
data.grabExcessHorizontalSpace = true;
filenameField.setLayoutData(data);
Whenever there is a low-level way of doing things, you can come up with a higher-level way and reduce the code size. Of course, you are only reducing the overall code size when the higher-level abstraction is used widely enough to amortize the cost of its implementation. In our SWT layout example, you could write instead:
Composite contents = new Composite(parentComposite, SWT.NONE);
contents.setLayoutData(new GridData(GridData.FILL_BOTH));

new Label(contents, SWT.LEFT).setText(label);

filenameField = new Text(contents, SWT.SINGLE | SWT.BORDER);

Point defaultMargins = LayoutConstants.getMargins();
GridLayoutFactory.fillDefaults().numColumns(2).margins(
defaultMargins.x, defaultMargins.y).generateLayout(contents);
Now this is looking a lot shorter, and maybe even more elegant. However, even if GridLayoutFactory is used widely enough to amortize the additional footprint caused by its implementation, there are still two problems: first, the original code ran faster, and second, you now have to learn two APIs - the higher-level one, and the lower-level one when the abstraction gets in your way.

You can see where I am going - there is no clear cut solution to this. It is really a hard problem, and in many cases, we will have to trade off one of the factors disk size, memory size, CPU consumption against the others.



Taking it just a little further, here is another idea, taken from the wikipedia article on code bloat:

The difference in code density between various languages is so great that often less memory is needed to hold both a program written in a "compact" language (such as a domain-specific programming language, Microsoft P-Code, or threaded code), plus an interpreter for that compact language (written in native code), than to hold that program written directly in native code.

So if we had a domain-specific language for creating SWT widgets and specifying their layout, we could get away with no Java code at all! I don't know if the .class file is a space efficient encoding for SWT widget hierarchies and layouts, but even if it is, consider this: The byte code for creating the widgets will stay in memory for as long as its class is referenced. Chances are that this will be a very long time; at least for the time that particular part of the UI is materialized somewhere. By comparison, if we had a domain-specific language, it would have to be read once to create the widgets and layout, after which the memory could be freed.

So maybe we can have our cake and eat it too! After thinking about this a bit, I am all excited about using cool new technologies, as long as they don't cause bloat.



We also have to be very carfeful not to use multiple redundant technologies to achieve the same thing, because that is another source of bloat. As in, for example, letting everyone plug in their favourite domain specific language for creating SWT widgets and layouts. This kind of redundancy would be just as bad as redundancy through repetitive boilerplate code, so let's pick one way of doing declarative UIs!

Note that there are lots of other sources of bloat, for example, unneeded functionality, too many layers of abstraction, or unnecessary flexibility. I am running out of time but it is probably interesting to think about these as well. I'd like to know if you have any pointers for me in the comments!

If avoiding bloat is one of the goals of e4, we need to keep this goal in mind all the time. Every bit of functionality should be pulling its own weight. For example, do not add convenience API unless its additional weight can be justified by reduced weight somewhere else.

I believe we should start watching our weight from the very beginning, and from time to time, it is probably healthy to discuss the weight of the various pieces. I can't wait until we have some kind of continuous build in place, so that we can make it visible for everyone how big (or small!) the components are, and how they are growing (or shrinking!) over time.

We could also borrow some ideas from the business world and introduce budgets. You want to provide a component for declarative UI? How about you get an allowance of 300 K? Would that be enough?

What do you think?

EasyEclipse: Planet Eclipse

Eugene Kuleshov: Maven book includes chapter on Eclipse integration

If you are using Maven and would like to have a printed reference in addition to a free online version, now you can buy your copy of "Maven: The Definitive Guide" book published at Amazon.

The book contains professionally written Maven introduction and number of examples and recipes written my Maven developers from Sonatype. It also contains chapter on Maven Integration for Eclipse (m2eclipse) that I reviewed.

Tim O'Brien, who edited the book, also blogged
why it is a good idea to buy a printed version of the free book.

EasyEclipse: Planet Eclipse

Dave Carver: HyperLink Detector Unit Testing

Three Laws of Test Driven Development:
  1. You may not write production code until have a written a failing unit test.
  2. You may not write more of a unit test that is sufficient to fail, and not compiling is failing.
  3. You may not write more production code that is sufficient to pass the current failing test.
Robert "Uncle Bob" Martin
"Clean Code", page 122


One of the things I see within the XSL Tools project at times is a tendency to not unit test the UI portion of the code. We have some unit tests for the Core, which is usually easier to setup tests for, but even within other eclipse projects I see little unit testing of the UI interfaces or classes that implement these interfaces. The main issue I think is that it can take some time to get all of the pre-condition code setup in order to enable the unit testing.

I had a need recently to enhance some hyperlink detector code within the XSL Tools project to add some parameter and variable hyperlinking. In order to add the ability to the existing code, I'm going to need to refactor a bit. First rule of refactoring is to run a test...So I went looking for the test...No test found. Second rule...if the test doesn't exist create it. So here is what I came up with for the Unit test.


public void testDetectHyperlinksDocument() throws Exception {
setUpTest("DraftReleaseCRs.xsl");
XSLHyperlinkDetector linkDetector = new XSLHyperlinkDetector();
int offset = 1200;
IRegion region = new Region(offset, 0);
boolean canShowMultipleLinks = true;
IHyperlink[] links = linkDetector.detectHyperlinks(document, region,canShowMultipleLinks);
assertNotNull("No links returned", links);
assertEquals("Unexpected number of links", 1, links.length);
}

public void testDetectHyperlinksViewer() throws Exception {
setUpTest("DraftReleaseCRs.xsl");
XSLHyperlinkDetector linkDetector = new XSLHyperlinkDetector();
int offset = 1200;
IRegion region = new Region(offset, 0);

boolean canShowMultipleLinks = true;
IHyperlink[] links = linkDetector.detectHyperlinks(sourceViewer,
region, canShowMultipleLinks);
assertNotNull("No links returned", links);
assertEquals("Unexpected number of links", 1, links.length);
}


The vast majority of the work of loading the file, getting the document setup, and creating the appropriate viewers is all handled through the setupTest() call. We already use the setup() and tearDown() methods to setup the workspace as needed.

That's basically it. Now one can test their hyperlink detection is working, and further add other tests to make sure they are getting the values they expect.

EasyEclipse: Planet Eclipse

Chris Aniszczyk: Eclipse Austin DemoCamp

It's that time again, for the Austin Eclipse DemoCamp!

This time, it's being kindly hosted by Freescale.



For food, we're going to chow down on some Homeslice pizza.



Also, we're going to have a special guest in town, Donald Smith from the Eclipse Foundation. Let me tell you something about Donald, the guy is amazing. You just walk around with him, and he attracts celebrities. Last time I was out with Donald, bam, Rachel Ray showed up out of nowhere:



Maybe this time around, Donald can attract Austin celebrities like Willie Nelson, Matthew McConaughey or Sandra Bullock.

If you're interested, please signup on the wiki.

EasyEclipse: Planet Eclipse

Kenn Hussey: On What's Wrong with UML...

Sure enough, I had an inevitable encounter with said company the week before last at the OMG technical meeting in Orlando. As Steve Cook said, he was welcomed with mostly open arms. The Analysis and Design Platform Task Force meeting was a little more interesting than usual because Steve had the gumption to point out many of the problems that exist with UML. I'm glad he did. Although many of his observations weren't a surprise to all of us, with any luck his fresh perspective will inspire the UML community to act rather than sit around and pontificate...

One of the things that came out of the Orlando meeting was the formation of a UML Roadmap working group, participation in which is open to any OMG member. As homework for today, participants were asked to come up with the top three things that they feel are wrong with UML. I'm sure many will cite complexity as a major problem with UML, but as I've said before, I think this failure is largely in the tools, not necessarily the metamodel. Rather than been passing the complexity of UML on to the end user, vendors should work smarter (not harder) to find innovative ways to make consumable products.

I don't claim to know everything about UML, but after spending several years developing and maintaining the de facto reference implementation of UML at Eclipse, I have a few opinions about what's wrong with the language. While difficult to choose only three, here's what I think my picks (mostly related to interchange) are.

1. Un-intended inheritance

The hierarchy of metaclasses in UML is deep and wide, and riddled with multiple inheritance. The designers of UML strived for a rich architecture with many reusable levels of abstraction; unfortunately, one of the side-effects of such a design is that concepts which make sense in one context (metaclass) are unintentionally inherited in another (metaclass). This is further exacerbated by package merge, which combines mutltiple flavours of a metaclass, from various contexts, into one overloaded representation.

2. Undefined namespaces for standard stereotypes and primitive types

The UML specification defines standard stereotypes for use in its higher compliance levels, but fails to define a normative URI via which the profiles containing them can be referenced. Similarly, UML defines a set of four standard primitive types, but rather then defining a model library with a normative namespace URI so that they can be reused, it merges them into the langage itself, forcing other related languages to do the same.

3. Inability to create a usable XML schema for UML

Currently, it's not possible to produce a working XML schema for UML because of its extensive use of multiple inheritance. Even with a schema produced using the XML extension mechanism a copy-down inheritance, a given UML instance document couldn't be validated, because UML doesn't make a consistent distinction between base classes and mixin classes.

Here's hoping this new working group will bear some fruit.

EasyEclipse: Planet Eclipse

Ed Merks: Mismanagement: The Weakest Link

We all know that a chain is only as strong as its weakest link. All too often leaders like to believe they are the most important link in their chain; it strokes their ego and justifies their compensation. Ironically that belief tends to make them the weakest link. A good leader works toward ensuring the strength of chain as a whole. They do not behave as if they are one tier above those they lead. They behave as simply another member of the team and set an example with their actions rather than with their words alone.

Behaving as if developers are equivalent to plumbers or assembly line workers is a really bad idea. In general, behaving as if the various different roles in the software development chain ought to be ranked from most important to least important, e.g., developers are more important than release engineers, is bound to weaken the chain. When was the last time goodness flowed from an Eclipse project without an associated release engineer, or someone acting like one, making it so? I've always believed in focusing on sound release engineering as the basic foundation upon which all other good things are built. When done well, it's a thankless job that's all too easily overlooked; when done poorly, it's a constant source of wasted time and energy for the entire food chain. Long live Eclipse's release engineers and thanks to the Eclipse foundation for their renewed focus on improving build infrastructure. It's a beautiful thing.


These days it's become clear that mismanagement is a bane of our collective existence. For example, I always thought CDO was an exceedingly cool project which graduated from EMFT to EMF during the last release, but yesterday I found out that CDO mismanagement is the cause of the world's financial crisis. Who would have thought that Eike would have so much influence? Just a little joke at Eike's expense!

All jokes aside though, how could such a complete and total financial disaster be allowed to unfold? Did none of our leaders foresee these possibilities? Of course some people saw this coming, but they were all too easily ignored by those whose vision was clouded by a veil of greed or wishful thinking. Systematic failure is the ultimate result of such mass myopia. I watch my father's struggle getting the mining industry to compute credible risk assessments in a context where hundreds of millions of investor dollars are often at risk for even a single project, yet the silence there too is deafening, which leaves my dad a little frosted.


I'm no economist, but watching all this unfold, I grow ever more doubtful about the actual prevalence of prevailing wisdom. Who decided, for example, that double digit growth is a goal that must be achieved at all costs? Is it actually a realistic goal? It's entirely clear that the risks taken by the few can ultimately become a burden to society has a whole. So as we take action to keep the financial house of cards (or stack of champagne glasses) from coming down, surely it's also time to identify the weak links in the chain. Perhaps many of the world's overpaid leaders' compensation should be scrutinized more closely. It doesn't seem totally unreasonable that one person might be compensated 100 times as much as another, but is 1000 times perhaps a little much? Do the CEOs of the world's large corporations really generate that much value? And most importantly, when they make huge mistakes, are their personal risks proportional? Watching investments evaporate certainly makes the rest of us blue.


Now that I've put the importance of good release engineering in proper perspective and have resolved the world's financial crisis with a witch hunt, I can prepare for my trip to Germany next week. I'll be visiting the itemis site in Lünen and then traveling to Elmshorn for MDSD. I hope I see some of you there. I'll have to check my camera chip's remaining capacity! Germany is so photogenic.

EasyEclipse: Planet Eclipse

Manuel Selva: Eclipse’s EventManager


Yesterday I reached a ConcurrentModificationException while notifying the selection listeners registered on my ViewPart. One listener was trying to remove itself of the listeners list while it was notified.

After a quick look into several Eclipse’s ViewPart classes providing selection change events it seems they all use the org.eclipse.core.commands.common.EventManager abstract class.

Here is this class description:

“A manager to which listeners can be attached. This handles the management of a list of listeners — optimizing memory and performance. All the methods on this class are guaranteed to be thread-safe”

This class also guarantees using org.eclipse.core.runtime.ListenerList class that a listener can be removed while we are itterating on the getListeners() method’s result.

This existing class was exactly the answer to my need.

Conclusion here is : REUSE and step into an Eclipse’s plugin already solving your problem (it’s generally easy to find such a plugin) to find the “right” answer.

      

EasyEclipse: Planet Eclipse

Gorkem Ercan: More on Mylyn Connector for ScrumWorks

I have released a preview version of the Mylyn Connector for ScrumWorks that I have blogged about some time ago. There is now a google group that hosts the update site.

I call this a “preview” version because this is a read-only version of the connector. After giving it some thought, I have decided not to make this open source. It is funny, whenever I do something related to Eclipse I assume that it should be open source. However, After struggling with my reflexes for a while I reached the conclusion that open sourcing this plugin is not really essential for Eclipse.

If you are using ScrumWorks and Mylyn, please give a try and provide feedback on the group, it will be highly appreciated.

EasyEclipse: Planet Eclipse

Mik Kersten: Tips on paying for free software

Comments on The Server Side have been voicing concerns about SpringSource’s new maintenance policy, which gives incentive to purchase a support contract if you’re building mission critical apps on Spring. I’ve been amazed at some of the dialog, which ranges from suggestions that SpringSource has neglected its community to recommendations that they should instead ask users for donations. Since well before they became a partner of Tasktop, I have had a deep respect for the innovation and productivity benefits that Rod Johnson and SpringSource have been delivering to enterprise Java. I know first-hand how much work it takes to foster and support an active community around a new technology. When a technology makes it big, it must transition to also supporting the demands of commercial adopters, otherwise its adoption will stall. While the tone of the dialog on The Server Side has been improving, some of it confuses the notions of free software, open source community and commercial solutions.

Clearly everyone loves free software. Free software rules. That is, as long as somebody pays. If nobody paid, free software would be very boring. Innovation requires one form of investment or another, and without ongoing investment, innovation cannot flourish. The neat thing with software is that we have various options for paying.

We can pay with our time, which is typical when first adopting open source tools and frameworks. This is a great option for technologists, because it supports experimentation and encourages involvement in technical communities. For example, at Tasktop we needed a reporting solution for the time tracking feature we released in July. We experimented with Eclipse BIRT, invested considerable time in adapting that code, got involved with the community channels, and have now committed to maintaining that integration in our tool. In a similar fashion, we have been interacting with the Bugzilla community and codebase since we make very heavy internal use of Bugzilla. In both cases, the time investment has paid off.

There’s also the more traditional approach of paying with money. Tasktop Pro supports accessing all of our Microsoft Outlook and Exchange data in a task-focused way. Instead of investing our time in doing more COM programming than we already have to, we instead purchased software from Moyosoft to do this for us. It was under $2000, and reduced our development and maintenance risks. A key feature of money is that it makes it much easier to measure the total cost of adopting a solution.

In the past couple of years, the trend of paying with our eyeballs has become more popular. It’s not quite as painful as it sounds, but you have to watch out for the “death by a thousand cuts” that can result from distractions of advertising. At Tasktop, we have been using the free and ad-supported Google Apps, since the Tasktop product integrates with Google Calendar and Gmail. Our entire mission is about less being more and ensuring that the user interface shows only the relevant information, and the presence of ads is at odds with this mission. So we’re now making the switch from the ad-supported, pay with your eyeballs Google Apps, to the paying with money $50/user/year version.

Finally, if you can manage it, paying with other people’s time and money is definitely cost-effective. There are open source projects whose code comes from the countless volunteer hours of people who love to make the world a better place with great software. There are alternate economical models at our disposal too. My favourite is the gift economy of Burning Man, which I have been frequenting for years, where all get to enjoy a temporary but fully-functioning city whose citizens forego trading money or bartering for sharing gifts and smiles instead.

In my opinion, gift economies are not feasible for driving major software innovations. As soon as an innovation gets traction, it needs to cross the chasm from techy early adopters to the very different requirements that come from an onslaught of commercial adoption. The adopters of the technology who think they will get a free ride, and invest neither time nor money, take on substantial risk. They have neither a contract nor the community influence necessary to adapt to the ongoing evolution of the technology. For example, I’d be concerned if SpringSource didn’t provide 24×7 support to the major airlines who use their Web Flow technology, because I’m already having a hard enough time getting my Christmas bookings without the Air Canada site going down. Similarly, if Tasktop didn’t provide additional support, training and integration for Mylyn, the task-focused interface could not stay on its amazingly fast adoption path, because too many of the new teams adopting it want a commercially supported product instead of investing their time in the open source project.

When adopting a free technology or solution, it’s a good idea to explicitly plan on how you’re going to pay for it. One of the great benefits of open source is that you can start by paying with time, and when your dependence on the technology increases, you can identify committers or vendors who can support you beyond the time investment that you’re willing to make. Or you can decide to get involved with the project. If it’s governed on the principle of meritocracy, as is the case with all Eclipse projects, you will have some assurance that it will be time well spent. It’s nice to have options.

Oct. 7: There has been an update to the SpringSource maintenance policy.

EasyEclipse: Planet Eclipse

EclipseLive: Upcoming Event: Single-Sourcing Techniques for RAP and RCP

Event Date: October 23, 2008 11:00 am GMT-8

Register Now

Frank Appel (Innoopract)
 
Abstract:

Application vendors are increasingly required to provide both desktop and web clients for their customers. But desktop and web applications are based on very different technologies which generally demand different programming paradigms and skills that make it impossible to reuse code. Specialized development skills and implementing the same functionality more than once increases the cost of production without in fact, adding new value to the application.

The Rich Ajax Platform (RAP) was designed to tackle exactly these problems for the Eclipse world. RAP allows Java and Eclipse developers to reuse their existing skills through a Java-based development model for web-clients. Furthermore, RAP maximizes code reuse by including the largest-possible web-enabled subset of the Rich Client Platform (Eclipse's technology on the desktop).

This approach is becoming more and more popular, even among companies that were not previously Eclipse users. However, building applications that use both RCP and RAP as frontend technologies does mean overcoming certain obstacles. In this talk we’ll describe the differences between RAP and RCP that are especially relevant to the goal of single sourcing as much code as possible. We’ll cover a range of techniques and basic patterns to close the gap between RCP and RAP, for both existing RCP applications and new RCP/RAP projects. Finally, we’ll discuss the critical points when converting existing applications to RCP and RAP.

Who should participate?

Developers and managers who are seeking a solution for bringing a rich client application to the web

What participants will learn

  • an overview of the architecture of the Eclipse Rich Client Platform (RCP) and the Eclipse Rich Ajax Platform (RAP)
  • how to get started working with RAP including a quick tour of the RAP Widget Toolkit
  • what the key differences are between RCP and RAP applications
  • best practices for programming single sourced RCP/RAP applications


delicious delicious | digg digg | dzone dzone

EasyEclipse: Planet Eclipse

Prakash G.R.: Finding the platform

If you are doing something specific to Mac platform, so far you might have been doing like SWT.getPlatform().equals("carbon"), stop doing it. Moving forward to 3.5, SWT will be supporting Cocoa as well, so you have to check for the cocoa string as well. This issue also pops up for Windows. You can't rely upon the platform String to be "win32", it could be "wpf" for the Vista. Just to make your life easier, there are new methods in the JFace Util class: isMac(), isWindows(), etc. You should be using these methods instead of the String comparison. More details on these methods are available in the associated bug.

EasyEclipse: Planet Eclipse

Doug Schaefer: What would I do without CDT

While waiting for my VOBs to sync from Salburg to Ottawa, I thought I'd poke around qemu to figure out exactly what I would need to do to add a PCI device. Apparently, there's very little, if any, documentation on how to do that. And I even saw one response to a similar query that told the guy to go look at the source. So I did.

I started by grabing the source for the latest qemu release 0.9.1. I created a CDT Makefile project and untared the release into the project directory. I created an External Tool to run configure with the options I wanted and then I did a project build which ran the resulting makefiles. So far so good. Looking at the Includes folder on the project, I see it caught the mingw gcc standard headers as well as my project as an include path.

So off I went. First I looked for things beginning with pc_ in the Open Element dialog (Shift-Ctrl-t). There I found the pc init code and went looking there for PCI devices. I found the LSI SCSI device init and hit F3 to go look at the implementation. There I started seeing some generic PCI type things. To see what other PCI devices I could look at, I selected the call to register a PCI I/O region and did a search for references. In the Search results view I quickly saw other PCI devices - VGA displays, the IDE device, some networking things, USB. All good examples.

It wasn't long before I figured out what I needed to do. It got me thinking. How did I ever do this before the CDT and how are the poor guys still stuck in the command line world doing stuff like this. I guess I used to do the same thing but used grep which does simple text searches. But there's no way I could do the same navigation with the same speed. And things like Alt left and right arrow to go back and forth along my path doesn't happen in that environment.

No, CDT rocks. I hear a lot lately about how there are still many people hesitant to leave the safety and comfort of the command line world. I think that's too bad. They're missing out on some real productivity gains.

EasyEclipse: Planet Eclipse

Dave Carver: Replace with MAP

In Part I, II, and III of the Replace Nested Conditional with Guard Clause series of posts. Several readers pointed out that the refactoring could be done with a MAP instead of a series of if then else statements. Since I recently implemented Syntax Coloring for XSL statements (i.e. they can be colored differently than their embedded xml content they wrap), I decided to tackle this refactoring.

Here is the bit of code as a reference as to where I started, basically following a similar model, but I wasn't happy with it and how it was to be maintained. This was code I wrote over the last couple of days to implement the syntax coloring for XSL Tools. The key to any type of refactoring though is having some unit tests to help verify that the external behavior is still the same.


private TextAttribute getXSLAttribute(String type) {

if ((type == DOMRegionContext.XML_TAG_OPEN)
|| (type == DOMRegionContext.XML_END_TAG_OPEN)
|| (type == DOMRegionContext.XML_TAG_CLOSE)
|| (type == DOMRegionContext.XML_EMPTY_TAG_CLOSE)) {
return (TextAttribute) getXSLTextAttributes().get(
IStyleConstantsXSL.TAG_BORDER);
}

if (type == DOMRegionContext.XML_TAG_ATTRIBUTE_NAME) {
return (TextAttribute) getXSLTextAttributes().get(
IStyleConstantsXSL.TAG_ATTRIBUTE_NAME);
}

if (type == DOMRegionContext.XML_TAG_NAME) {
return (TextAttribute) getXSLTextAttributes().get(
IStyleConstantsXSL.TAG_NAME);
}

if ((type == DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE)) {
return (TextAttribute) getXSLTextAttributes().get(
IStyleConstantsXSL.TAG_ATTRIBUTE_VALUE);
}

return null;
}

protected HashMap<String,TextAttribute> getXSLTextAttributes() {
if (xslTextAttributes == null) {
xslTextAttributes = new HashMap<String,TextAttribute>();
loadXSLColors();
}
return xslTextAttributes;
}


protected void loadXSLColors() {
addXSLTextAttribute(IStyleConstantsXSL.TAG_NAME);
addXSLTextAttribute(IStyleConstantsXSL.TAG_BORDER);
addXSLTextAttribute(IStyleConstantsXSL.TAG_ATTRIBUTE_NAME);
addXSLTextAttribute(IStyleConstantsXSL.TAG_ATTRIBUTE_VALUE);
}


Like I said in Part III, the problem I have with some if-then-else statements is that they can become very large very quickly. And I do agree that depending on the size of the method and it's complexity, one should try to limit the number of returns (i.e. One Entry One Exit), but I'm not a stickler to that rule. So with a little bit of work, here is what the refactored code looks like using the MAP interface, specially a HashMap.


private TextAttribute getXSLAttribute(String type) {
TextAttribute attribute = null;
HashMap<String,String> regionMap = getXSLRegions();
HashMap<String,TextAttribute> textAttributes = getXSLTextAttributes();

if (regionMap.containsKey(type)) {
attribute = textAttributes.get(regionMap.get(type));
}
return attribute;
}

protected HashMap<String,String> getXSLRegions() {
if (xslRegionMap == null) {
xslRegionMap = new HashMap<String,String>();
loadXSLRegions();
}
return xslRegionMap;
}

protected void loadXSLRegions() {
xslRegionMap.put(DOMRegionContext.XML_TAG_OPEN, IStyleConstantsXSL.TAG_BORDER);
xslRegionMap.put(DOMRegionContext.XML_END_TAG_OPEN, IStyleConstantsXSL.TAG_BORDER);
xslRegionMap.put(DOMRegionContext.XML_TAG_CLOSE, IStyleConstantsXSL.TAG_BORDER);
xslRegionMap.put(DOMRegionContext.XML_EMPTY_TAG_CLOSE, IStyleConstantsXSL.TAG_BORDER);
xslRegionMap.put(DOMRegionContext.XML_TAG_ATTRIBUTE_NAME, IStyleConstantsXSL.TAG_ATTRIBUTE_NAME);
xslRegionMap.put(DOMRegionContext.XML_TAG_NAME, IStyleConstantsXSL.TAG_NAME);
xslRegionMap.put(DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE, IStyleConstantsXSL.TAG_ATTRIBUTE_VALUE);
}

protected HashMap<String,TextAttribute> getXSLTextAttributes() {
if (xslTextAttributes == null) {
xslTextAttributes = new HashMap<String,TextAttribute>();
loadXSLColors();
}
return xslTextAttributes;
}

protected void loadXSLColors() {
addXSLTextAttribute(IStyleConstantsXSL.TAG_NAME);
addXSLTextAttribute(IStyleConstantsXSL.TAG_BORDER);
addXSLTextAttribute(IStyleConstantsXSL.TAG_ATTRIBUTE_NAME);
addXSLTextAttribute(IStyleConstantsXSL.TAG_ATTRIBUTE_VALUE);
}


So by refactoring the DOMRegion checks into a HashMap, it makes adding new mappings much simpler. Just add a new key,value pair to the loadXSLRegions method, and off you go. As more mappings need to be done, the getXSLAttribute method remains small and manageable.

A couple of other things popped out at me while do this refactoring...I can isolate this code from the mapping code by creating a Mapper class to handle the mapping. I'll probably end up doing this, as it is now the Class is doing a bit more than I think it should. It's handling mapping as well as applying Syntax Coloring.

Thanks to everybody that responded to the original postings, it helped me work through some ways to help improve the code I was writing.

EasyEclipse: Planet Eclipse

Martin Lippert: New version of Spring Extension Factory available

When retrieving an OSGi service its good practice to use a timeout. Otherwise the operation could be blocked forever (in the case the service never appears). In past versions the Spring Extension Factory used a hard-coded timeout of 5 seconds. I chose this value more or less randomly, guessing that no bundle would hopefully need for than 5 seconds to create its application context. But I was proven wrong... :-)

Therefore I made the timeout setting configurable. Now you can define the timeout value (in milliseconds) via a system property called "org.eclipse.springextensionfactory.timeout". To set the timeout to 20sec, for example, start the JVM with this option:

-Dorg.eclipse.springextensionfactory.timeout=20000

I also added some more readable exceptions if no application context can be found or if the name of the bean to be used cannot be determined.

The new version can be downloaded from here:
Thanks for reporting the problem, Matthias!

EasyEclipse: Planet Eclipse

Wayne Beaton: Presentations in Eclipse

I’ve been tinkering on-and-off for a couple of years on some Eclipse-based presentation software. My primary motivation is my distrust of existing presentation software. Curiously, I get a new head of steam on the “project” every time PowerPoint or Open Office fries one of my documents. Last week was one of those times.

The effort has been two-fold. Actually laying out slides is probably a pretty obvious first target. I’ve been using draw2d from GEF for this and have had some success. One of the things that drives me nuts about existing presentation software is the whole WYSIWYG editing paradigm. Frankly, I hate pushing pixels around to make stuff look right and to simply fit on a slide. Open Office is particularly annoying in this regard; in some of my presentations, the title is in a different place on almost every slide and, frankly, I can’t be bothered to spend the time to tweak each slide to make it right. Most of my effort in this area has been to automate the assembly process as possible.

Some of my effort has been around just making stuff automatically fit. I just specify a bunch of bullets, and slide render makes it fit by reducing the font size until everything fits. Its a simple algorithm, but it works. Want to add a picture? No problem, a few simple rules govern the placement and the text just flows around it. Graphics inside text is also easy using draw2d (the text management stuff is quite awesome).

The missing piece as always been the mechanism for editing slide content. A while back it occurred to me that content can just be specified using wiki markup. For example:

=Slide One Title=
* Bullet one
* Bullet two

=Slide Two Title=
[[Image:fascinating.png|right]]
* Bullet three
** Nested bullet one
** Nested bullet two
* Bullet four

The basic idea is that the heading, denoted by the equals sign (=), the slide title. Everything between this heading and the next is the content of the slide. The second slide shows a picture that will be rendered to the right of the bullets. I envision adding support for some other tags. For example, [[Method:/MyProject/src/org.eclipse.stuff.MyClass#myMethod()]] will render the contents of the specified method on the slide (taken live out of the workspace). I’m not quite there yet, but I think it’d be cool.

Using the wiki-style text will make it easier to collaborate, track changes, change templates, borrow slides from other presentations (imagine an “include slides” markup), and more. My presentations will just be projects in my workspace (images are found relative to the markup file). Most of my images are screen shots anyway, so they’ll be easy to include. More interesting images can be created with GIMP, or possibly with an SVG editor (I’ve read that GEF provides some SVG import support that I need to look into).

I’ve decided on using the MediaWiki markup for this as it’s what we use on Eclipsepedia, so I’m already familiar with it.

The best part is that most of the work has already been done. The WikiText SOC project (completed under the supervision of the Mylyn project) has implemented a Wiki parser that I’ve managed to leverage. I haven’t looked at the editors yet, but I imagine they’ll be helpful as well.

My intent is to clean up the code and contribute it to the Examples project. The initial version will provide basic image and text support. At some point in the future, I’ll sort out the method displaying option, and look into things like table support. I’ll post some pictures in the coming week.

In the meantime… is this a crazy idea?

EasyEclipse: Planet Eclipse

Scott Lewis: Planning for ECF 3.0

ECF is nearly finished moving from Technology to the new Runtime project, and we are doing planning for ECF 3.0/Galileo. See the new plan here.

Please make enhancement requests and/or start discussion about desired features in the dev mailing list...and let us know what features, changes, or bug fixes you want for ECF 3.0.

EasyEclipse: Planet Eclipse

Page 1 | Next >>
Username:
Password:
(or Cancel)