From fb062ef825f0f5cdcdfd3459e512d900ce149e09 Mon Sep 17 00:00:00 2001 From: Nikolay Chashnikov Date: Tue, 1 Sep 2009 13:40:03 +0400 Subject: [PATCH] conversion ui fixes --- .../conversion/impl/ConversionServiceImpl.java | 10 +++--- .../conversion/impl/ui/StartConversionStep.form | 24 +++++--------- .../conversion/impl/ui/StartConversionStep.java | 38 +++++++++++++++------- .../src/messages/IdeBundle.properties | 9 +---- 4 files changed, 42 insertions(+), 39 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/conversion/impl/ConversionServiceImpl.java b/platform/lang-impl/src/com/intellij/conversion/impl/ConversionServiceImpl.java index d150231b54..e2dc9adbe4 100644 --- a/platform/lang-impl/src/com/intellij/conversion/impl/ConversionServiceImpl.java +++ b/platform/lang-impl/src/com/intellij/conversion/impl/ConversionServiceImpl.java @@ -143,7 +143,7 @@ public class ConversionServiceImpl extends ConversionService { private List getConvertersToRun(final ConversionContextImpl context) throws CannotConvertException { final CachedConversionResult conversionResult = loadCachedConversionResult(context.getProjectFile()); - return createConversionRunners(context, conversionResult.myConverters); + return createConversionRunners(context, conversionResult.myAppliedConverters); } private List createConversionRunners(ConversionContextImpl context, final Set performedConversionIds) { @@ -172,12 +172,13 @@ public class ConversionServiceImpl extends ConversionService { private void saveConversionResult(ConversionContextImpl context) { final CachedConversionResult conversionResult = loadCachedConversionResult(context.getProjectFile()); for (ConverterProvider provider : ConverterProvider.EP_NAME.getExtensions()) { - conversionResult.myConverters.add(provider.getId()); + conversionResult.myAppliedConverters.add(provider.getId()); } for (File file : context.getNonExistingModuleFiles()) { conversionResult.myNotConvertedModules.add(file.getAbsolutePath()); } final File infoFile = getConversionInfoFile(context.getProjectFile()); + infoFile.getParentFile().mkdirs(); try { JDOMUtil.writeDocument(new Document(XmlSerializer.serialize(conversionResult)), infoFile, SystemProperties.getLineSeparator()); } @@ -267,10 +268,11 @@ public class ConversionServiceImpl extends ConversionService { } } + @Tag("conversion") public static class CachedConversionResult { - @Tag("converters") + @Tag("applied-converters") @AbstractCollection(surroundWithTag = false, elementTag = "converter", elementValueAttribute = "id") - public Set myConverters = new HashSet(); + public Set myAppliedConverters = new HashSet(); @Tag("not-converted-modules") @AbstractCollection(surroundWithTag = false, elementTag = "module", elementValueAttribute = "path") diff --git a/platform/lang-impl/src/com/intellij/conversion/impl/ui/StartConversionStep.form b/platform/lang-impl/src/com/intellij/conversion/impl/ui/StartConversionStep.form index cdd556d3c4..3999f13988 100644 --- a/platform/lang-impl/src/com/intellij/conversion/impl/ui/StartConversionStep.form +++ b/platform/lang-impl/src/com/intellij/conversion/impl/ui/StartConversionStep.form @@ -1,33 +1,25 @@
- + - + - - - - - - - - - + - + - + + + - - - + diff --git a/platform/lang-impl/src/com/intellij/conversion/impl/ui/StartConversionStep.java b/platform/lang-impl/src/com/intellij/conversion/impl/ui/StartConversionStep.java index fc28839da1..ca19163900 100644 --- a/platform/lang-impl/src/com/intellij/conversion/impl/ui/StartConversionStep.java +++ b/platform/lang-impl/src/com/intellij/conversion/impl/ui/StartConversionStep.java @@ -1,11 +1,15 @@ package com.intellij.conversion.impl.ui; -import com.intellij.conversion.impl.ConversionRunner; import com.intellij.conversion.impl.ConversionContextImpl; +import com.intellij.conversion.impl.ConversionRunner; import com.intellij.ide.IdeBundle; +import com.intellij.openapi.ui.Messages; import org.jetbrains.annotations.NonNls; import javax.swing.*; +import javax.swing.event.HyperlinkEvent; +import javax.swing.event.HyperlinkListener; +import javax.swing.text.html.HTMLEditorKit; import java.util.List; /** @@ -13,19 +17,31 @@ import java.util.List; */ public class StartConversionStep extends AbstractConversionStep { private JPanel myMainPanel; - private JLabel myConvertersDescriptionsLabel; - private JLabel myTitleLabel; + private JTextPane myTextPane; - public StartConversionStep(ConversionContextImpl context, List conversionRunners) { - myTitleLabel.setText(IdeBundle.message("label.project.has.older.format.the.following.conversions.will.be.performed.text", + public StartConversionStep(ConversionContextImpl context, final List conversionRunners) { + JLabel templateLabel = new JLabel(); + myTextPane.setFont(templateLabel.getFont()); + myTextPane.setContentType("text/html"); + myTextPane.setEditorKit(new HTMLEditorKit()); + myTextPane.setEditable(false); + myTextPane.setBackground(templateLabel.getBackground()); + myTextPane.setForeground(templateLabel.getForeground()); + myTextPane.setText(IdeBundle.message("label.text.project.has.older.format", context.getProjectFile().getName())); - @NonNls StringBuilder descriptions = new StringBuilder(""); - for (ConversionRunner runner : conversionRunners) { - descriptions.append(runner.getProvider().getConversionDescription()).append("
"); - } - descriptions.append(""); - myConvertersDescriptionsLabel.setText(descriptions.toString()); + myTextPane.addHyperlinkListener(new HyperlinkListener() { + public void hyperlinkUpdate(HyperlinkEvent e) { + if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { + @NonNls StringBuilder descriptions = new StringBuilder("The following conversions will be performed:
"); + for (ConversionRunner runner : conversionRunners) { + descriptions.append(runner.getProvider().getConversionDescription()).append("
"); + } + descriptions.append(""); + Messages.showInfoMessage(descriptions.toString(), IdeBundle.message("dialog.title.convert.project")); + } + } + }); } public JComponent getComponent() { diff --git a/platform/platform-resources-en/src/messages/IdeBundle.properties b/platform/platform-resources-en/src/messages/IdeBundle.properties index 7107287657..3bf9520a9d 100644 --- a/platform/platform-resources-en/src/messages/IdeBundle.properties +++ b/platform/platform-resources-en/src/messages/IdeBundle.properties @@ -250,11 +250,7 @@ error.project.file.is.corrupted=Project file is corrupted title.cannot.convert.project=Cannot Convert Project dialog.title.convert.project=Convert Project -label.project.has.older.format.text=The project ''{0}'' has an older format. -label.project.has.older.format.the.following.conversions.will.be.performed.text=The project ''{0}'' has an older format. The following conversions will be performed: -label.project.has.older.format.and.will.be.converted.text=The project ''{0}'' has an older format. It will be converted to the new format. -radio.convert.project.text=&Convert to the new format now. You will not be able to open the project by earlier versions of IDEA. -radio.dont.convert.project.text=Convert &later. Some features will be unavailable until you convert the project. +label.text.project.has.older.format=The project ''{0}'' has an older format and will be converted. You will not be able to open the project by earlier versions of IDEA. Details label.text.unlock.read.only.files=The following files are read only. IDEA will unlock them. error.message.cannot.make.files.writable=Cannot make the following files writable:\n{0} label.text.project.was.succesfully.converted.old.version.was.saved.to.0=Your project was succesfully converted. \ @@ -264,9 +260,6 @@ error.some.file.is.corrupted.message=File ''{0}'' is corrupted:
message.files.doesn.t.exists.0.so.the.corresponding.modules.won.t.be.converted.do.you.want.to.continue=The following files doesn''t exists:
\ {0}The corresponding modules won''t be converted. Do you want to continue? -message.text.this.feature.is.not.available.for.project.in.older.format=This feature is not available for project in older format.
\ - Convert your project first (File | Convert Project). - select.in.project.settings=Project Structure select.in.file.structure=File Structure message.nothing.to.show.in.structure.view=Nothing to show in the Structure View -- 2.11.4.GIT